From f7bef85786126809d6ba56f3eb0ddb2f5a2f544d Mon Sep 17 00:00:00 2001 From: "eduardo.davila@creatis.insa-lyon.fr" Date: Fri, 20 Dec 2024 14:42:55 +0100 Subject: [PATCH] Clean code --- .../wxWindows/widgets/vtkBaseData.cxx | 12 ++++++---- .../interface/wxWindows/widgets/vtkBaseData.h | 2 +- .../wxWindows/widgets/wxMPRBaseData.cxx | 24 ++++++++++++------- .../wxWindows/widgets/wxMPRBaseData.h | 4 ++-- 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.cxx index 7fb65bf..d2b2e7c 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.cxx @@ -96,7 +96,7 @@ void vtkBaseData::Configure() // virtual } //------------------------------------------------------------------- -void vtkBaseData::SetZ(double z) +void vtkBaseData::SetZ(double z, bool withObserver) // default withObserver=true { //int maxZ; // int dim[3]; @@ -105,7 +105,8 @@ void vtkBaseData::SetZ(double z) int ext[6]; double *origin; vtkImageData* img = _marImageData->GetImageData(); - if(img!=NULL){ + if(img!=NULL) + { /*img->GetWholeExtent(ext); maxZ=ext[5]-ext[4]+1; if (z>=maxZ) @@ -128,8 +129,11 @@ void vtkBaseData::SetZ(double z) z = ext[4] + origin[2]; } _z=z; -// _observable->InvokeEvent(3); - } + if (withObserver==true) + { + _observable->InvokeEvent(3); + } // if withObserver + } // if img } //------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.h index 211ade4..f4fe07b 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.h @@ -41,7 +41,7 @@ public: void SetMarImageData(marImageData *marimagedata); virtual void Configure(); double GetZ(); - void SetZ(double z); + void SetZ(double z, bool withObserver=true); int GetT(); void SetT(double t); virtual double GetX(); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx index 4ee946b..05bcbd7 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx @@ -134,13 +134,14 @@ double vtkMPRBaseData::GetY() /** ** Calculates the value of the slider and the layer in the image that is spouse to show **/ -void vtkMPRBaseData::SetX(double x) +void vtkMPRBaseData::SetX(double x, bool withObserver) // default withObserver=true { //int dim[3]; int ext[6]; double *origin; vtkImageData *img = _marImageData->GetImageData(); - if(img!=NULL){ + if(img!=NULL) + { /*img->GetDimensions(dim); if (x<0) { @@ -162,21 +163,25 @@ void vtkMPRBaseData::SetX(double x) x=ext[1] + origin[0]; } _x=x; -// _observable->InvokeEvent(1); - } + if (withObserver==true) + { + _observable->InvokeEvent(1); + } // if withObserver + } // if img } //------------------------------------------------------------------- /** ** Calculates the value of the slider and the layer in the image that is spouse to show **/ -void vtkMPRBaseData::SetY(double y) +void vtkMPRBaseData::SetY(double y, bool withObserver) // default withObserver=true { //int dim[3]; int ext[6]; double* origin; vtkImageData* img = _marImageData->GetImageData(); - if(img!=NULL){ + if(img!=NULL) + { /*img->GetDimensions(dim); if (y<0) { @@ -198,8 +203,11 @@ void vtkMPRBaseData::SetY(double y) y=ext[3] + origin[1]; } _y=y; -// _observable->InvokeEvent(2); - } + if (withObserver==true) + { + _observable->InvokeEvent(2); + } // if withObserver + }// if img } //------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.h index d2124d8..88baa71 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.h @@ -96,8 +96,8 @@ public: int GetMaxPositionZ( ); double GetX(); double GetY(); - void SetX(double x); - void SetY(double y); + void SetX(double x, bool withObserver=true); + void SetY(double y, bool withObserver=true); void GetDimensionExtention(int *x1,int *x2,int *y1,int *y2,int *z1,int *z2); vtkTransform* GetTransformOrientation(); void SetNormal(double nx, double ny, double nz); -- 2.47.1