#include <CutModelSaveBinInfo.h>
Public Member Functions | |
CutModelSaveBinInfo (int id, int currentaction, UNDOTYPE actiontype, std::string path) | |
~CutModelSaveBinInfo () | |
int | getId () |
UNDOTYPE | getActionType () |
std::string | getSTDFileName () throw ( CutModelException) |
int | getCurrentShape () |
void | setCurrentShape (int currentshape) |
void | savePolyData (vtkPolyData *polydata) |
vtkTransform * | getPolyDataTransform () throw ( CutModelException) |
void | saveMatrix4x4 (vtkMatrix4x4 *matrix) |
vtkTransform * | getTransformFromMatrixFile () throw ( CutModelException) |
void | setRange (double *range) |
void | setIsInside (bool isinside) |
double * | getRange () |
bool | getIsInside () |
Private Attributes | |
int | _id |
UNDOTYPE | _actiontype |
int | _currentshape |
double * | _range |
bool | _isinside |
std::string | _stdFilename |
std::string | _matrixFilename |
Definition at line 44 of file CutModelSaveBinInfo.h.
CutModelSaveBinInfo::CutModelSaveBinInfo | ( | int | id, | |
int | currentaction, | |||
UNDOTYPE | actiontype, | |||
std::string | path | |||
) |
Start of the manager class
Definition at line 22 of file CutModelSaveBinInfo.cxx.
References _actiontype, _id, _matrixFilename, and _stdFilename.
00022 { 00023 00024 _id = id; 00025 00026 char c[100]; 00027 sprintf(c,"/infounrd_%d_fig_%d.info",currentaction,id); 00028 00029 _stdFilename = path; 00030 _stdFilename+=c; 00031 _stdFilename+=".poly"; 00032 00033 _matrixFilename = path; 00034 _matrixFilename+=c; 00035 _actiontype = actiontype; 00036 00037 00038 }
CutModelSaveBinInfo::~CutModelSaveBinInfo | ( | ) |
Definition at line 39 of file CutModelSaveBinInfo.cxx.
UNDOTYPE CutModelSaveBinInfo::getActionType | ( | ) | [inline] |
Definition at line 55 of file CutModelSaveBinInfo.h.
References _actiontype.
Referenced by CutModelManager::Redo(), and CutModelManager::Undo().
00055 { 00056 return _actiontype; 00057 }
int CutModelSaveBinInfo::getCurrentShape | ( | ) | [inline] |
Definition at line 69 of file CutModelSaveBinInfo.h.
References _currentshape.
Referenced by CutModelManager::Redo(), and CutModelManager::Undo().
00069 { 00070 return _currentshape; 00071 }
int CutModelSaveBinInfo::getId | ( | ) | [inline] |
Definition at line 51 of file CutModelSaveBinInfo.h.
References _id.
Referenced by CutModelManager::Redo(), and CutModelManager::Undo().
00051 { 00052 return _id; 00053 }
bool CutModelSaveBinInfo::getIsInside | ( | ) | [inline] |
Definition at line 94 of file CutModelSaveBinInfo.h.
References _isinside.
Referenced by CutModelManager::Redo(), and CutModelManager::Undo().
00094 { 00095 return _isinside; 00096 }
vtkTransform * CutModelSaveBinInfo::getPolyDataTransform | ( | ) | throw ( CutModelException) |
Definition at line 51 of file CutModelSaveBinInfo.cxx.
References getSTDFileName().
00051 { 00052 vtkPolyDataReader* reader = vtkPolyDataReader::New(); 00053 //std::cout<<"filename vtkTransform* CutModelSaveBinInfo::getPolyDataTransform()"<<this->getSTDFileName()<<std::endl; 00054 reader->SetFileName(this->getSTDFileName().c_str()); 00055 vtkPolyData* poly = reader->GetOutput(); 00056 00057 vtkPolyDataMapper* mapper = vtkPolyDataMapper::New(); 00058 mapper->SetInput(poly); 00059 vtkActor* actor = vtkActor::New(); 00060 actor->SetMapper(mapper); 00061 vtkMatrix4x4* actmatrix = actor->GetMatrix(); 00062 00063 std::cout<<"tkTransform* CutModelSaveBinInfo::getPolyDataTransform() Actor "<<actor<<std::endl; 00064 std::cout<<"tkTransform* CutModelSaveBinInfo::getPolyDataTransform() Actor Matrix "<<actmatrix<<std::endl; 00065 00066 mapper->Update(); 00067 00068 vtkTransform* transform = vtkTransform::New(); 00069 00070 transform->Identity(); 00071 00072 transform->GetMatrix()->SetElement(0,0,actmatrix->GetElement(0,0)); 00073 transform->GetMatrix()->SetElement(1,0,actmatrix->GetElement(1,0)); 00074 transform->GetMatrix()->SetElement(2,0,actmatrix->GetElement(2,0)); 00075 transform->GetMatrix()->SetElement(0,1,actmatrix->GetElement(0,1)); 00076 transform->GetMatrix()->SetElement(1,1,actmatrix->GetElement(1,1)); 00077 transform->GetMatrix()->SetElement(2,1,actmatrix->GetElement(2,1)); 00078 transform->GetMatrix()->SetElement(0,2,actmatrix->GetElement(0,2)); 00079 transform->GetMatrix()->SetElement(1,2,actmatrix->GetElement(1,2)); 00080 transform->GetMatrix()->SetElement(2,2,actmatrix->GetElement(2,2)); 00081 transform->GetMatrix()->SetElement(0,3,actmatrix->GetElement(0,3)); 00082 transform->GetMatrix()->SetElement(1,3,actmatrix->GetElement(1,3)); 00083 transform->GetMatrix()->SetElement(2,3,actmatrix->GetElement(2,3)); 00084 00085 actor->Delete(); 00086 mapper->Delete(); 00087 reader->Delete(); 00088 //poly->Delete(); 00089 00090 00091 return transform; 00092 00093 }
double* CutModelSaveBinInfo::getRange | ( | ) | [inline] |
Definition at line 91 of file CutModelSaveBinInfo.h.
References _range.
Referenced by CutModelManager::Redo().
00091 { 00092 return _range; 00093 }
std::string CutModelSaveBinInfo::getSTDFileName | ( | ) | throw ( CutModelException) [inline] |
Definition at line 58 of file CutModelSaveBinInfo.h.
References _stdFilename.
Referenced by getPolyDataTransform().
00058 { 00059 if(_stdFilename==""){ 00060 throw new CutModelException("Filename undoredo does not exists"); 00061 } 00062 return _stdFilename; 00063 }
vtkTransform * CutModelSaveBinInfo::getTransformFromMatrixFile | ( | ) | throw ( CutModelException) |
Definition at line 101 of file CutModelSaveBinInfo.cxx.
References _matrixFilename.
Referenced by CutModelManager::Redo(), and CutModelManager::Undo().
00101 { 00102 vtkMatrix4x4* matrix = vtkMatrix4x4::New(); 00103 fstream binary_file(_matrixFilename.c_str(),ios::binary|ios::in); 00104 binary_file.read(reinterpret_cast<char *>(matrix),sizeof(vtkMatrix4x4)); 00105 binary_file.close(); 00106 00107 vtkTransform* transform = vtkTransform::New(); 00108 transform->SetMatrix(matrix); 00109 00110 return transform; 00111 }
void CutModelSaveBinInfo::saveMatrix4x4 | ( | vtkMatrix4x4 * | matrix | ) |
Definition at line 96 of file CutModelSaveBinInfo.cxx.
References _matrixFilename.
Referenced by CutModelManager::AddActionUndo().
00096 { 00097 fstream binary_file(_matrixFilename.c_str(),ios::out|ios::binary); 00098 binary_file.write(reinterpret_cast<char *>(matrix),sizeof(vtkMatrix4x4)); 00099 binary_file.close(); 00100 }
void CutModelSaveBinInfo::savePolyData | ( | vtkPolyData * | polydata | ) |
Definition at line 42 of file CutModelSaveBinInfo.cxx.
References _stdFilename.
00042 { 00043 vtkPolyDataWriter * writer = vtkPolyDataWriter ::New(); 00044 writer->SetFileName(_stdFilename.c_str()); 00045 writer->SetInput(polydata); 00046 writer->SetFileTypeToBinary(); 00047 writer->Write(); 00048 writer->Delete(); 00049 }
void CutModelSaveBinInfo::setCurrentShape | ( | int | currentshape | ) | [inline] |
Definition at line 73 of file CutModelSaveBinInfo.h.
References _currentshape.
Referenced by CutModelManager::AddActionUndo().
00073 { 00074 _currentshape=currentshape; 00075 }
void CutModelSaveBinInfo::setIsInside | ( | bool | isinside | ) | [inline] |
Definition at line 87 of file CutModelSaveBinInfo.h.
References _isinside.
Referenced by CutModelManager::ExecuteCut().
00087 { 00088 _isinside = isinside; 00089 }
void CutModelSaveBinInfo::setRange | ( | double * | range | ) | [inline] |
Definition at line 84 of file CutModelSaveBinInfo.h.
References _range.
Referenced by CutModelManager::ExecuteCut().
00084 { 00085 _range = range; 00086 }
UNDOTYPE CutModelSaveBinInfo::_actiontype [private] |
Definition at line 101 of file CutModelSaveBinInfo.h.
Referenced by CutModelSaveBinInfo(), and getActionType().
int CutModelSaveBinInfo::_currentshape [private] |
Definition at line 102 of file CutModelSaveBinInfo.h.
Referenced by getCurrentShape(), and setCurrentShape().
int CutModelSaveBinInfo::_id [private] |
Definition at line 100 of file CutModelSaveBinInfo.h.
Referenced by CutModelSaveBinInfo(), and getId().
bool CutModelSaveBinInfo::_isinside [private] |
Definition at line 104 of file CutModelSaveBinInfo.h.
Referenced by getIsInside(), and setIsInside().
std::string CutModelSaveBinInfo::_matrixFilename [private] |
Definition at line 106 of file CutModelSaveBinInfo.h.
Referenced by CutModelSaveBinInfo(), getTransformFromMatrixFile(), and saveMatrix4x4().
double* CutModelSaveBinInfo::_range [private] |
Definition at line 103 of file CutModelSaveBinInfo.h.
Referenced by getRange(), and setRange().
std::string CutModelSaveBinInfo::_stdFilename [private] |
Definition at line 105 of file CutModelSaveBinInfo.h.
Referenced by CutModelSaveBinInfo(), getSTDFileName(), and savePolyData().