]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GPortController.cxx
Move box and refresh position ... ports don't refresh automatically their position...
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsVtkGUIEditorGraphic / GPortController.cxx
index 33794ce4468e1b054701803e7ec7ee2ea7cd9e5a..c9c196b2ad776da0d7103006618c9234291cd4f0 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==GINPUTPORT )
+                       {
+                               _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;
+       }
 
        //=========================================================================