]> Creatis software - creaContours.git/blobdiff - bbtk/src/bbcreaContoursSetViewerPosition.cxx
#3334 creaContours Feature New Normal - Control Refresh events from bbtk
[creaContours.git] / bbtk / src / bbcreaContoursSetViewerPosition.cxx
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;
   
 }
 //=====