From c5ce7457fe37b2dfee0912b81280324e56282e03 Mon Sep 17 00:00:00 2001 From: jean-pierre roux Date: Wed, 31 Mar 2010 12:41:56 +0000 Subject: [PATCH] Remove deprecated + re indent --- .../CutModule/interface/CutModelMainPanel.cxx | 23 ++--- .../src/CutModule/kernel/CutModelData.cxx | 89 ++++++++----------- .../CutModule/kernel/CutModelFigureCube.cxx | 2 +- .../src/CutModule/kernel/CutModelFigureCube.h | 2 +- .../kernel/CutModelFigureCylinder.cxx | 2 +- .../CutModule/kernel/CutModelFigureCylinder.h | 2 +- .../CutModule/kernel/CutModelFigureSphere.cxx | 2 +- .../CutModule/kernel/CutModelFigureSphere.h | 2 +- 8 files changed, 52 insertions(+), 72 deletions(-) diff --git a/lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.cxx b/lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.cxx index 188d243..c667375 100644 --- a/lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.cxx +++ b/lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.cxx @@ -3,8 +3,8 @@ Program: wxMaracas Module: $RCSfile: CutModelMainPanel.cxx,v $ Language: C++ -Date: $Date: 2010/03/05 17:54:39 $ -Version: $Revision: 1.7 $ +Date: $Date: 2010/03/31 12:41:56 $ +Version: $Revision: 1.8 $ Copyright: (c) 2002, 2003 License: @@ -255,16 +255,14 @@ void CutModelMainPanel::onUndo() { try{ checkInvariant(); - int result = cutmanager->Undo(); + int result = cutmanager->Undo(); // result unused// JPR }catch(CutModelException e){ showErrorDialog(e.getCause()); } - } void CutModelMainPanel::onRedo(){ - try{ checkInvariant(); int result = cutmanager->Redo(); @@ -272,7 +270,6 @@ void CutModelMainPanel::onRedo(){ }catch(CutModelException e){ showErrorDialog(e.getCause()); } - } void CutModelMainPanel::changeOpacity(int id,int opacity){ @@ -294,9 +291,11 @@ void CutModelMainPanel::ShowViewBox(int id,bool check){ showErrorDialog(e.getCause()); } } + void CutModelMainPanel::ShowPopUpMenu(int id){ showErrorDialog("test"); } + void CutModelMainPanel::changeColor(int id,double r,double g,double b){ try{ @@ -306,8 +305,8 @@ void CutModelMainPanel::changeColor(int id,double r,double g,double b){ }catch(CutModelException e){ showErrorDialog(e.getCause()); } - } + void CutModelMainPanel::ChangeShape(int id,int selection){ try{ checkInvariant(); @@ -344,8 +343,8 @@ void CutModelMainPanel::ExecuteAll(){ for(i = 0; i < (int)viewpanels.size(); i++){ viewpanels[i]->ExecuteCut(); } - } + vtkImageData* CutModelMainPanel::GetResultImage(){ try{ checkInvariant(); @@ -409,12 +408,9 @@ void CutModelMainPanel::addPolygonCutterTab(){ Connect(btnExecutePolygonCut->GetId(), wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)(&PolygonCutterEventHandlerCutModel::onExecuteCutPolygon)); sizer->Add(btnExecutePolygonCut, 0, wxALIGN_LEFT); - _notebook->AddPage(panel, _T("Polygon Cutter"), false); - } - void PolygonCutterEventHandlerCutModel::onCheckChanged(wxCommandEvent& event){ CutModelMainPanel::getInstance()->onCheckChanged(); } @@ -423,8 +419,6 @@ void PolygonCutterEventHandlerCutModel::onExecuteCutPolygon(wxCommandEvent& even CutModelMainPanel::getInstance()->onExecuteCutPolygon(); } - - /** ** **/ @@ -451,7 +445,6 @@ ToolBarCutModel::ToolBarCutModel(wxWindow * parent) _evthand = new ToolBarEventHandlerCutModel(); this->SetEventHandler(_evthand); - } ToolBarCutModel::~ToolBarCutModel(void){ @@ -479,11 +472,9 @@ void ToolBarEventHandlerCutModel::onExecuteAll(wxCommandEvent& event){ CutModelMainPanel::getInstance()->ExecuteAll(); } - BEGIN_EVENT_TABLE(ToolBarEventHandlerCutModel, wxEvtHandler) EVT_MENU(10, ToolBarEventHandlerCutModel::onAdd) EVT_MENU(20, ToolBarEventHandlerCutModel::onUndo) EVT_MENU(30, ToolBarEventHandlerCutModel::onRedo) EVT_MENU(40, ToolBarEventHandlerCutModel::onExecuteAll) END_EVENT_TABLE() - diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelData.cxx b/lib/maracasVisuLib/src/CutModule/kernel/CutModelData.cxx index d4b46fb..63fa928 100644 --- a/lib/maracasVisuLib/src/CutModule/kernel/CutModelData.cxx +++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelData.cxx @@ -3,8 +3,8 @@ Program: wxMaracas Module: $RCSfile: CutModelData.cxx,v $ Language: C++ - Date: $Date: 2009/11/25 16:35:37 $ - Version: $Revision: 1.5 $ + Date: $Date: 2010/03/31 12:41:58 $ + Version: $Revision: 1.6 $ Copyright: (c) 2002, 2003 License: @@ -22,8 +22,8 @@ CutModelData::CutModelData(int id, vtkRenderWindowInteractor* interactor, vtkCommand* observer, vtkImageData* img){ initializeData(id, interactor, observer, img); - } + CutModelData::CutModelData(){ } @@ -37,6 +37,7 @@ void CutModelData::initializeData(int id, vtkRenderWindowInteractor* interactor, ChangeShape(0); checkInvariant(); } + CutModelData::~CutModelData(){ checkInvariant(); _boxWidgetVolume->RemoveAllObservers(); @@ -53,11 +54,11 @@ CutModelData::~CutModelData(){ inversModel->Delete(); _id = -1; } + void CutModelData::RefreshViewBox(){ } void CutModelData::createBoxWidget(vtkRenderWindowInteractor* interactor, vtkCommand* observer){ - _boxWidgetVolume = vtkBoxWidget::New(); _boxWidgetVolume->SetInteractor( interactor ); //_boxWidgetVolume->SetPlaceFactor(1); @@ -73,6 +74,7 @@ void CutModelData::createBoxWidget(vtkRenderWindowInteractor* interactor, vtkCom //_boxWidgetVolume->GetHandleProperty()->SetOpacity(0.5); //_boxWidgetVolume->GetOutlineProperty()->SetOpacity(0.5); } + void CutModelData::setTransform(vtkImageData* img)throw( CutModelException){ currentmatrix = vtkTransform::New(); @@ -84,7 +86,6 @@ void CutModelData::setTransform(vtkImageData* img)throw( CutModelException){ int *ext = img->GetExtent(); double *spc = img->GetSpacing(); - matrix->SetElement(0,0,(ext[1]-ext[0])/4*spc[0]); matrix->SetElement(1,1,(ext[3]-ext[2])/4*spc[1]); matrix->SetElement(2,2,(ext[5]-ext[4])/4*spc[2]); @@ -97,31 +98,32 @@ void CutModelData::setTransform(vtkImageData* img)throw( CutModelException){ matrix->SetElement(1,3,orgy); matrix->SetElement(2,3,orgz); - currentmatrix->SetMatrix(matrix); - _boxWidgetVolume->SetTransform(currentmatrix); - + _boxWidgetVolume->SetTransform(currentmatrix); } + void CutModelData::createActor(){ _Mapper = vtkPolyDataMapper::New(); _Actor = vtkActor::New(); _Actor->SetMapper(_Mapper); _Actor->GetProperty()->SetColor(1, 0, 0); - _Actor->GetProperty()->SetOpacity(0.5); - + _Actor->GetProperty()->SetOpacity(0.5); } + void CutModelData::udapteActorDirection()throw( CutModelException){ checkInvariant(); _boxWidgetVolume->GetTransform(currentmatrix); _Actor->SetUserMatrix(currentmatrix->GetMatrix());//SetUserTransform(currentmatrix ); } + void CutModelData::createShapes(){ _cubefigure = new CutModelFigureCube(); _cylinderfigure = new CutModelFigureCylinder(); _spherefigure = new CutModelFigureSphere(); } + void CutModelData::changeOpacity(int opacity)throw( CutModelException){ checkInvariant(); _Actor->GetProperty()->SetOpacity((double)opacity/100.0); @@ -148,7 +150,6 @@ void CutModelData::ChangeShape(int selection)throw( CutModelException){ }else{ throw CutModelException("Shape type not found"); } - _currentshape=selection; } @@ -170,8 +171,7 @@ void CutModelData::checkInvariant()throw( CutModelException){ } if(_spherefigure==NULL){ throw CutModelException("Sphere not created"); - } - + } } vtkActor* CutModelData::getActor()throw( CutModelException){ @@ -183,6 +183,7 @@ void CutModelData::changeColor(double r,double g,double b)throw( CutModelExcepti checkInvariant(); _Actor->GetProperty()->SetColor( r,g,b ); } + CutModelFigure* CutModelData::getCurentCuttingModel(){ checkInvariant(); @@ -196,9 +197,9 @@ CutModelFigure* CutModelData::getCurentCuttingModel(){ throw CutModelException("Shape type not found"); } } + void CutModelData::ExecuteCut( double* range, bool isinside, vtkImageData* copyimage)throw( CutModelException) { - wxBusyCursor wait; CutModelFigure* actualCuttingModel = getCurentCuttingModel(); @@ -209,19 +210,18 @@ void CutModelData::ExecuteCut( double* range, bool isinside, vtkImageData* copyi actualCuttingModel->SetInversVtkTransform(getModelTransformInvers()); bool inside; - bool volInt, volExt; - int xx,yy,zz; - unsigned short* pOrg; - int ext[6]; - double spc[3]; - long int contAfter = 0; - long int contBefor = 0; + //bool volInt, volExt; // unused + int xx,yy,zz; + unsigned short* pOrg; + int ext[6]; + //double spc[3]; // unused + //long int contAfter = 0; // unused + //long int contBefor = 0; // unused double minvalue = range[0]; double value = range[1]; double maxvalue = range[2]; - - + copyimage->GetExtent(ext); for (xx=ext[0];xxSetVtkTransform(getModelTransform(copyimage)); - + actualCuttingModel->SetInversVtkTransform(getModelTransformInvers()); bool inside; - bool volInt, volExt; - int xx,yy,zz; + // bool volInt, volExt; // unused // JPRx + int xx,yy,zz; unsigned short* pOrg; - int ext[6]; - double spc[3]; - long int contAfter = 0; - long int contBefor = 0; - + int ext[6]; + //double spc[3]; // unused // JPRx + //long int contAfter = 0; // unused // JPRx + //long int contBefor = 0; // unused // JPRx + double value; - - copyimage->GetExtent(ext); - + for (xx=ext[0];xxGetSpacing(); modeltransform->Identity(); - vtkMatrix4x4* matrix = currentmatrix->GetMatrix(); + vtkMatrix4x4* matrix = currentmatrix->GetMatrix(); vtkMatrix4x4* matrixmodel = modeltransform->GetMatrix(); matrixmodel->SetElement(0,0,matrix->GetElement(0,0)/spc[0]); matrixmodel->SetElement(1,0,matrix->GetElement(1,0)/spc[0]); @@ -316,7 +311,6 @@ vtkTransform* CutModelData::getModelTransform(vtkImageData* copyimage){ matrixmodel->SetElement(2,3,matrix->GetElement(2,3)/spc[2]); /* - double* pos = currentmatrix->GetPosition(); modeltransform->Translate(pos[0]/spc[0],pos[1]/spc[1],pos[2]/spc[2]); @@ -329,20 +323,16 @@ vtkTransform* CutModelData::getModelTransform(vtkImageData* copyimage){ //modeltransform->RotateX(orient[0]); double* orient = currentmatrix->GetOrientationWXYZ(); modeltransform->RotateWXYZ(orient[0],orient[1],orient[2],orient[3]); - */ - modeltransform->Update(); return modeltransform; - - } -void CutModelData::setTransform(vtkTransform* transform, vtkImageData* img)throw( CutModelException){ - - double *spc = img->GetSpacing(); +void CutModelData::setTransform(vtkTransform* transform, vtkImageData* img)throw( CutModelException){ + + double *spc = img->GetSpacing(); // spc unused // JPR currentmatrix->Identity(); @@ -356,7 +346,7 @@ void CutModelData::setTransform(vtkTransform* transform, vtkImageData* img)throw currentmatrix->Scale(scal[0]/spc[0],scal[1]/spc[1],scal[2]/spc[2]); currentmatrix->Update(); */ - + _boxWidgetVolume->SetTransform(transform); /*vtkMatrix4x4* matrix = transform->GetMatrix(); @@ -374,11 +364,10 @@ void CutModelData::setTransform(vtkTransform* transform, vtkImageData* img)throw matrixcurrent->SetElement(1,3,matrix->GetElement(1,3)/spc[1]); matrixcurrent->SetElement(2,3,matrix->GetElement(2,3)/spc[2]); */ - udapteActorDirection(); getModelTransform(img); - } + vtkTransform* CutModelData::getModelTransformInvers(){ inversModel->Identity (); inversModel->Concatenate ( modeltransform ); diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCube.cxx b/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCube.cxx index 48b10a8..bbcfcf4 100644 --- a/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCube.cxx +++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCube.cxx @@ -41,7 +41,7 @@ double CutModelFigureCube::GetTheoricVolume() // virtual } //---------------------------------------------------------------------------- -char *CutModelFigureCube::GetName() // virtual +const char *CutModelFigureCube::GetName() // virtual { return "Cube"; } diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCube.h b/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCube.h index 31858cc..474606d 100644 --- a/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCube.h +++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCube.h @@ -12,7 +12,7 @@ public: virtual bool IfPointInside(double x, double y, double z); virtual double GetTheoricVolume(); virtual vtkPolyData* getPolyData(); - virtual char *GetName(); + virtual const char *GetName(); private: vtkCubeSource* _vtkcube; protected: diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCylinder.cxx b/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCylinder.cxx index 4ef0a77..84e2faf 100644 --- a/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCylinder.cxx +++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCylinder.cxx @@ -35,7 +35,7 @@ double CutModelFigureCylinder::GetTheoricVolume() // virtual return piTMP*(_sx/2)*(_sz/2)*_sy; } //---------------------------------------------------------------------------- -char *CutModelFigureCylinder::GetName() // virtual +const char *CutModelFigureCylinder::GetName() // virtual { return "Cylinder"; } diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCylinder.h b/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCylinder.h index 410a4fa..df845e3 100644 --- a/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCylinder.h +++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureCylinder.h @@ -12,7 +12,7 @@ public: virtual bool IfPointInside(double x, double y, double z); virtual double GetTheoricVolume(); virtual vtkPolyData* getPolyData(); - virtual char *GetName(); + virtual const char *GetName(); private: vtkCylinderSource* _vtkcylinder; diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureSphere.cxx b/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureSphere.cxx index a0e1ee5..48e4c53 100644 --- a/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureSphere.cxx +++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureSphere.cxx @@ -38,7 +38,7 @@ double CutModelFigureSphere::GetTheoricVolume() // virtual return (4.0/3.0) * piTMP * (_sx/2)*(_sy/2)*(_sz/2); } //---------------------------------------------------------------------------- -char *CutModelFigureSphere::GetName() // virtual +const char *CutModelFigureSphere::GetName() // virtual { return "Sphere"; } diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureSphere.h b/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureSphere.h index 4ce69c6..845146a 100644 --- a/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureSphere.h +++ b/lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureSphere.h @@ -11,7 +11,7 @@ public: virtual ~CutModelFigureSphere(); virtual bool IfPointInside(double x, double y, double z); virtual double GetTheoricVolume(); - virtual char *GetName(); + virtual const char *GetName(); virtual vtkPolyData* getPolyData(); private: vtkSphereSource* _vtksphere; -- 2.45.2