X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FEditorGraphicBBS%2FbbsVtkGUIEditorGraphic%2FGObjectController.cxx;h=645997b25ed8c7d07df31afb2a71a25d523e5b96;hb=5cf9c7b92a97ee411e6a441beca8a06d2bffc8b3;hp=f00541cc38624a249b5b7d4008233d6f849dc905;hpb=64fc9f949ff91d6e9d448ca0567e6205ee4d5be4;p=bbtkGEditor.git diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx index f00541c..645997b 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx @@ -47,9 +47,11 @@ namespace bbtk } //========================================================================= + GObjectController::~GObjectController() { } + //========================================================================= void GObjectController::setModelAndView(GObjectModel* model, vtkGObjectView* view) @@ -57,6 +59,133 @@ namespace bbtk _model = model; _view = view; } + + //========================================================================= + + bool GObjectController::OnMouseMove() + { + int X,Y; + wxVTKRenderWindowInteractor *_wxVTKiren; + _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); + _wxVTKiren->GetEventPosition( X , Y ); + int state = _view->getState(); + + //Evaluate new state + if( state == NOTHING_HAPPENS) + { + if(_view->isPointInside(X,Y)) + { + _view->setState(HIGHLIGHTED); + } + } + if( state==HIGHLIGHTED) + { + if(!_view->isPointInside(X,Y)) + { + _view->setState(NOTHING_HAPPENS); + } + } + + _model->notifyObservers(getId()); + + + return true; + } + + //========================================================================= + + bool GObjectController::OnLeftButtonDown()//virtual + { + int state = _view->getState(); + + //Evaluate new state + if(state == HIGHLIGHTED) + { + _isLeftClickDown=true; + _view->setState(SELECTED); + } + return true; + } + + //========================================================================= + + bool GObjectController::OnLeftButtonUp()//virtual + { + + return true; + } + + //========================================================================= + + bool GObjectController::OnLeftDClick()//virtual + { + + return true; + } + + //========================================================================= + + bool GObjectController::OnMiddleButtonDown()//virtual + { + return true; + } + + //========================================================================= + + void GObjectController::moveObject(int X,int Y) + { + _view->moveObject(X,Y); + } + + //========================================================================= + + int GObjectController::getGObjectType() + { + return _model->getGObjectType(); + } + + //========================================================================= + + GObjectModel* GObjectController::getModel() + { + return _model; + } + + //========================================================================= + + vtkGObjectView* GObjectController::getView() + { + return _view; + } + + //========================================================================= + + int GObjectController::getId() + { + return _model->getObjectId(); + } + + //========================================================================= + + void GObjectController::setId(int id) + { + _model->setObjectId(id); + } + + //========================================================================= + + std::string GObjectController::getStatusText() + { + return _model->getStatusText(); + } + + //========================================================================= + + void GObjectController::removeFromScene() + { + _view->removeFromScene(); + } + //========================================================================= } // EO namespace bbtk