]> Creatis software - creaMaracasVisu.git/commitdiff
Clean code
authoreduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Fri, 20 Dec 2024 13:42:55 +0000 (14:42 +0100)
committereduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Fri, 20 Dec 2024 13:42:55 +0000 (14:42 +0100)
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.h

index 7fb65bf5ffb83ee2b1139238457129905e4e8221..d2b2e7cdfa60e860adb131b14d5e11b89967cbc8 100644 (file)
@@ -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
 }
 
 //-------------------------------------------------------------------
index 211ade4ecebb432049fe38803b49c82f5ec1cf45..f4fe07be9ecbe88094d35c177be97cab5a641ba1 100644 (file)
@@ -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();
index 4ee946bde1dce2ce120c809538b83447905082a5..05bcbd707b297decbfb4fb490457e0aaac345cc4 100644 (file)
@@ -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
 }
 
 //-------------------------------------------------------------------
index d2124d8b85f9a6a6ee8a776c35a3cd6da298c1b2..88baa716badef0bc7b06003e9728fb88f301a0eb 100644 (file)
@@ -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);