]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx
2343 creaMaracasVisu Bug New Normal Interaction between ColorLayer and manualPaint
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / ThresholdImageView / LayerImageBase.cxx
index f8c66939b65e5f5ee5423a0d4747430bc1616f68..a90e7348b627ad847a9c3895c11f0db14977ff9e 100644 (file)
@@ -41,8 +41,9 @@
 ColorLayerImageBasevtkInteractor::ColorLayerImageBasevtkInteractor(LayerImageBase* layerImageBase)
 {
     _state=false;
+    _stateKey=false;
     _layerImageBase=layerImageBase;
-
+       
 }
 
 //---------------------------------------------------------------------------------------------
@@ -50,15 +51,39 @@ ColorLayerImageBasevtkInteractor::~ColorLayerImageBasevtkInteractor()
 {
 }
 
+//---------------------------------------------------------------------------------------------
+bool ColorLayerImageBasevtkInteractor::OnChar() 
+{
+       return true;
+}
+
 
 //---------------------------------------------------------------------------------------------
 bool ColorLayerImageBasevtkInteractor::OnMouseMove()   // vitual
 {
-       printf("EED ColorLayerImageBasevtkInteractor::OnMouseMove \n");
+       printf("EED ColorLayerImageBasevtkInteractor::OnMouseMove start \n");
+
+       vtkRenderWindowInteractor *interactor = _vtkInteractorStyleBaseView->GetInteractor();
+
+       // For example in ManualPaint Action
+        // This is not working, because the order of insertion events mecanism (_vtkInteractorStyleBaseView)
+        // Layer first Paint after.
+        // the only way to make it works is to take the axes an paint.  this force a first SetParent_refresh_waiting()
+//     if ( this->_vtkInteractorStyleBaseView->GetParent_refresh_waiting() == true )
+
+       if ( interactor->GetControlKey()==1 )  // EED This if for ManaulPaint Interaction compatibility
+        {
+               printf("EED ColorLayerImageBasevtkInteractor::OnMouseMove need Refresh \n" );
+               _layerImageBase->onThreshold();
+                       _layerImageBase->GetvtkImageReslice()->Modified();
+       } 
+        else {
+       printf("EED ColorLayerImageBasevtkInteractor::OnMouseMove NOT need Refresh \n" );
+       }       
+
        
        if (_state==true)
        {
-
                wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*) _vtkInteractorStyleBaseView->GetWxVtk2DBaseView();
                wxVTKRenderWindowInteractor *wxVTKiren = wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor();
                int px, py;
@@ -79,7 +104,6 @@ bool ColorLayerImageBasevtkInteractor::OnMouseMove()   // vitual
                _layerImageBase->onThreshold();
 //             _layerImageBase->Refresh();
 
-
                this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
 
                if  (_vtkInteractorStyleBaseView->GetRefresh_waiting()==true)
@@ -91,7 +115,7 @@ bool ColorLayerImageBasevtkInteractor::OnMouseMove()   // vitual
        return true;
 }
 
-
+//---------------------------------------------------------------------------------------------
 bool  ColorLayerImageBasevtkInteractor::OnRightButtonDown() // virtual
 {
        printf("EED ColorLayerImageBasevtkInteractor::OnRightButtonDown \n");
@@ -99,6 +123,7 @@ bool  ColorLayerImageBasevtkInteractor::OnRightButtonDown() // virtual
        return true;
 }
 
+//---------------------------------------------------------------------------------------------
 bool  ColorLayerImageBasevtkInteractor::OnRightButtonUp()  // virtual
 {
        printf("EED ColorLayerImageBasevtkInteractor::OnRightButtonUp \n");