]> Creatis software - creaContours.git/commitdiff
#3334 creaContours Feature New Normal - Control Refresh events from bbtk vtk8itk4wx3-mingw64
authorEduardo DAVILA <davila@localhost.localdomain>
Wed, 8 Jan 2020 08:30:26 +0000 (09:30 +0100)
committerEduardo DAVILA <davila@localhost.localdomain>
Wed, 8 Jan 2020 08:30:26 +0000 (09:30 +0100)
bbtk/src/bbcreaContoursSetViewerPosition.cxx
bbtk/src/bbcreaContoursSetViewerPosition.h
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h

index 582f59b576361275e2599996acecddbbf7560adb..5f0f2337973a046b0379198f6aaebdb07ef2cd70 100644 (file)
@@ -29,48 +29,53 @@ void SetViewerPosition::Process()
 //    bbSetOutputOut( bbGetInputIn() );
 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
   
-       if (bbGetInputwxContourMainFrame()!=NULL)
+
+       if (bbGetInputPosition().size()==3 )
        {
-               if (bbGetInputPosition().size()==3 )
+               int x = bbGetInputPosition()[0];
+               int y = bbGetInputPosition()[1];
+               int z = bbGetInputPosition()[2];
+               if ((backX!=x) || (backY!=y) || (backZ!=z) )   // this prevent to finish contour before start  :-)
                {
-                       double                  slice;
-                       int                     x                       = bbGetInputPosition()[0];
-                       int                     y                       = bbGetInputPosition()[1];
-                       int                     z                       = bbGetInputPosition()[2];
-                       vtkImageData    *img            = bbGetInputwxContourMainFrame()->getImageData();
-                       int                     ext[6];
-                       img->GetExtent(ext);
-                       int dimY=ext[3]-ext[2]+1;
-                       if (bbGetInputDirection()==0)
-                       {
-                               slice = z;
-                               slice = round( slice/bbGetInputJump() ) * bbGetInputJump() + bbGetInputShift();
-                               bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", slice );
-                               bbGetInputwxContourMainFrame()->SetXY(x,y);
-                       } // if Direction1
-
-                       if (bbGetInputDirection()==1)
+                       if (bbGetInputwxContourMainFrame()!=NULL)
                        {
-                               slice = y;
-                               slice = round( slice/bbGetInputJump() ) * bbGetInputJump() + bbGetInputShift();
-                               bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", slice );
-                               bbGetInputwxContourMainFrame()->SetXY(x,dimY-z-1);
-                       } // if Direction1
-
-                       if (bbGetInputDirection()==2)
-                       {
-                               slice = x;
-                               slice = round( slice/bbGetInputJump() ) * bbGetInputJump() + bbGetInputShift();
-                               bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", slice );
-                               bbGetInputwxContourMainFrame()->SetXY(dimY-z-1,y);
-                       } // if Direction1
+                               double                  slice;
+                               vtkImageData    *img            = bbGetInputwxContourMainFrame()->getImageData();
+                               int                     ext[6];
+                               img->GetExtent(ext);
+                               int dimY=ext[3]-ext[2]+1;
+                               if (bbGetInputDirection()==0)
+                               {
+                                       slice = z;
+                                       slice = round( slice/bbGetInputJump() ) * bbGetInputJump() + bbGetInputShift();
+                                       bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", slice );
+                                       bbGetInputwxContourMainFrame()->SetXY(x,y);
+                               } // if Direction1
 
+                               if (bbGetInputDirection()==1)
+                               {
+                                       slice = y;
+                                       slice = round( slice/bbGetInputJump() ) * bbGetInputJump() + bbGetInputShift();
+                                       bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", slice );
+                                       bbGetInputwxContourMainFrame()->SetXY(x,dimY-z-1);
+                               } // if Direction1
 
-                       bbGetInputwxContourMainFrame()->showAxis(true);
-                       bbGetInputwxContourMainFrame()->changeInstant();
-                       bbGetInputwxContourMainFrame()->RefreshInterface();
-               }
-       }
+                               if (bbGetInputDirection()==2)
+                               {
+                                       slice = x;
+                                       slice = round( slice/bbGetInputJump() ) * bbGetInputJump() + bbGetInputShift();
+                                       bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", slice );
+                                       bbGetInputwxContourMainFrame()->SetXY(dimY-z-1,y);
+                               } // if Direction1
+                               bbGetInputwxContourMainFrame()->showAxis(true);
+                               bbGetInputwxContourMainFrame()->changeInstant();
+                               bbGetInputwxContourMainFrame()->RefreshInterface();
+                               backX=x;
+                               backY=y;
+                               backZ=z;
+                       } // if bbGetInputPosition
+               } // if bbGetInputwxContourMainFrame
+       } // if backX  backY  backZ
 
 }
 //===== 
@@ -81,10 +86,14 @@ void SetViewerPosition::bbUserSetDefaultValues()
 
 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
 //    Here we initialize the input 'In' to 0
-   bbSetInputDirection(0);
-   bbSetInputJump(1);
-   bbSetInputShift(0);
-   bbSetInputwxContourMainFrame(NULL);
+       bbSetInputDirection(0);
+       bbSetInputJump(1);
+       bbSetInputShift(0);
+       bbSetInputwxContourMainFrame(NULL);
+
+       backX=-9999;
+       backY=-9999;
+       backZ=-9999;
   
 }
 //===== 
index 934fe44cd0e4a891e3be15de2c9843bd90e0e4cf..c22c97e020c5fa9dfea1c6b9dad0f820c4d5cde2 100644 (file)
@@ -28,6 +28,8 @@ class bbcreaContours_EXPORT SetViewerPosition
 //  BBTK_DECLARE_OUTPUT(Out,double);
   BBTK_PROCESS(Process);
   void Process();
+
+  int backX, backY, backZ;
 //===== 
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
 //===== 
index 9d4319ef7b5f15853dbb424816eaf581188ab312..793e05d9ebf18b600e7363c163ef7dbeaa1edb89 100644 (file)
@@ -3507,7 +3507,6 @@ void wxContourMainFrame::FlipLstOfContours(std::vector<std::string> lstNameThing
        sizeLstNameThings       = lstNameThings.size(); 
        for (i=0 ; i<sizeLstNameThings ; i++)
        {
-               printf("EED wxContourMainFrame::FlipAllContours contour=%d \n", i );
                manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(lstNameThings[i]);
                if (flipDirection==0)
                {
@@ -3535,8 +3534,6 @@ void wxContourMainFrame::FlipLstOfContours(std::vector<std::string> lstNameThing
 
 void wxContourMainFrame::FlipContours(int typeContourFlip, int flipDirection)
 {
-       printf("EED wxContourMainFrame::FlipContours( %d , %d ) \n",typeContourFlip,  flipDirection );
-
        saveState();
        
        if (typeContourFlip==0) // 
@@ -3556,7 +3553,6 @@ void wxContourMainFrame::FlipContours(int typeContourFlip, int flipDirection)
        RefreshInterface();
 }
 
-
 void wxContourMainFrame::SetXY(int x, int y)
 {
        _theViewPanel->SetXY(x,y);
index 2434fb47b25b52f92654e70dbbcbb442dc3f3e6c..fac56dd504ede32872d5c63dc3d24b3a15d2a995 100644 (file)
@@ -336,7 +336,7 @@ private:
        // Attributtes
        //------------------------------------------------------------------------------------------------------------
 
-       int _contourGroup;
+       int                                             _contourGroup;
        static wxContourMainFrame   *instance;
        KernelManagerContour        *kernelManager;
        interfMainPanel             *_pannew;
@@ -352,9 +352,9 @@ private:
 
        wxAuiManager                m_mgr;
        wxAuiNotebook               *notebook;
-       long                    m_notebook_style;
-       long                    m_notebook_theme;
-       int                      _numberOfVariablesStatistics;
+    long                                               m_notebook_style;
+    long                       m_notebook_theme;
+    int                         _numberOfVariablesStatistics;
 
        // Contour Image Mask
        ThresholdImageView                      *_viewMaskImage;