]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GPortController.cxx
Important change in the project to visualize the contour when the output was selected...
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsVtkGUIEditorGraphic / GPortController.cxx
index 33794ce4468e1b054701803e7ec7ee2ea7cd9e5a..7e66a83ecfe11dbe44a366f80583dfc4c0b15d83 100644 (file)
@@ -52,6 +52,65 @@ namespace bbtk
        }
        //=========================================================================
 
+       bool GPortController::OnLeftButtonDown()
+       {
+               
+               if ( _vtkInteractorStyleBaseView!=NULL )
+               {
+                       int X,Y;
+                       wxVTKRenderWindowInteractor *wxVTKiren;
+                       wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
+                       wxVTKiren->GetEventPosition(X,Y);
+
+                       int state  = _model->getState();
+                       
+                       int portType = ((GPortModel*)_model)->getPortType();
+
+                       //Evaluate new state
+                       if(!_model->hasChanged() && state==HIGHLIGHTED && portType==GOUTPUTPORT )
+                       {
+                               _model->setState(CREATING_CONTOUR);
+                               _model->setChanged();
+                       }
+
+                       _model->notifyObservers();
+
+               }
+               return true;
+       }
+       //=========================================================================
+       bool GPortController::OnLeftButtonUp()
+       {
+               if ( _vtkInteractorStyleBaseView!=NULL )
+               {
+                       int X,Y;
+                       wxVTKRenderWindowInteractor *wxVTKiren;
+                       wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
+                       wxVTKiren->GetEventPosition(X,Y);
+
+                       int state  = _model->getState();
+                       
+                       //Evaluate new state
+                       if(!_model->hasChanged() && state==CREATING_CONTOUR)
+                       {
+                               if(_view->isPointInside(X,Y))
+                               {
+                                       _model->setChanged();
+                                       _model->notifyObservers(INIT_CREATION_CONTOUR);
+                               }
+                               else
+                               {
+                                       _model->setState(NOTHING_HAPPENS);
+                                       _model->setChanged();
+                                       _model->notifyObservers();
+                               }
+                       }
+
+                       
+
+               }
+               return true;
+       }
 
        //=========================================================================