X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=lib%2FEditorGraphicBBS%2FbbsVtkGUIEditorGraphic%2FGObjectController.cxx;h=645997b25ed8c7d07df31afb2a71a25d523e5b96;hb=5cf9c7b92a97ee411e6a441beca8a06d2bffc8b3;hp=0dffa0ec1a4d4d929ca092bde21663c4445e8e50;hpb=878ac6ad472bc459f4e364c16890e5026c401944;p=bbtkGEditor.git diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx index 0dffa0e..645997b 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx @@ -64,178 +64,70 @@ namespace bbtk bool GObjectController::OnMouseMove() { + int X,Y; + wxVTKRenderWindowInteractor *_wxVTKiren; + _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); + _wxVTKiren->GetEventPosition( X , Y ); + int state = _view->getState(); - /********************** VIRTUAL *************************/ - - if ( _vtkInteractorStyleBaseView!=NULL) + //Evaluate new state + if( state == NOTHING_HAPPENS) { - int X,Y; - wxVTKRenderWindowInteractor *_wxVTKiren; - _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); - _wxVTKiren->GetEventPosition( X , Y ); - - int state = _view->getState(); - - //Evaluate new state - if(!_model->hasChanged() && state == DRAG) + if(_view->isPointInside(X,Y)) { - moveObject(X,Y); - _model->setChanged(); - } - - if(!_model->hasChanged() && state == NOTHING_HAPPENS) - { - if(_view->isPointInside(X,Y)) - { - _view->setState(HIGHLIGHTED); - _model->setChanged(); - } - } - if(!_model->hasChanged() && state==HIGHLIGHTED) + _view->setState(HIGHLIGHTED); + } + } + if( state==HIGHLIGHTED) + { + if(!_view->isPointInside(X,Y)) { - if(!_view->isPointInside(X,Y)) - { - _view->setState(NOTHING_HAPPENS); - _model->setChanged(); - } + _view->setState(NOTHING_HAPPENS); } - - _model->notifyObservers(_id); - } - - /**/ + + _model->notifyObservers(getId()); + return true; } //========================================================================= - bool GObjectController::OnLeftButtonDown() + bool GObjectController::OnLeftButtonDown()//virtual { - /********************** VIRTUAL ************************* - - if ( _vtkInteractorStyleBaseView!=NULL ) - { - int X,Y; - wxVTKRenderWindowInteractor *wxVTKiren; - wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); - wxVTKiren->GetEventPosition(X,Y); - - int state = _model->getState(); + int state = _view->getState(); - //Evaluate new state - if(!_model->hasChanged() && state==HIGHLIGHTED) - { - _view->isStartDragging(true); - _model->setState(DRAG); - _model->setChanged(); - } - - if( !_model->hasChanged() && state == SELECTED) - { - if(_view->isPointInside(X,Y)) - { - _view->isStartDragging(true); - _model->setState(DRAG); - _model->setChanged(); - } - } - - _model->notifyObservers(); + //Evaluate new state + if(state == HIGHLIGHTED) + { + _isLeftClickDown=true; + _view->setState(SELECTED); } - - */ - return true; } //========================================================================= - bool GObjectController::OnLeftButtonUp() + bool GObjectController::OnLeftButtonUp()//virtual { - /********************** VIRTUAL ************************* - - 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==CLICKED) - { - _model->setState(SELECTED); - _model->setChanged(); - } - - if( !_model->hasChanged() && state == DRAG) - { - _model->setState(SELECTED); - _model->setChanged(); - } - - _model->notifyObservers(); - - } - - */ return true; } //========================================================================= - bool GObjectController::OnLeftDClick() + bool GObjectController::OnLeftDClick()//virtual { - /********************** VIRTUAL ************************* - - if ( _vtkInteractorStyleBaseView!=NULL ) - { - int X,Y; - wxVTKRenderWindowInteractor *wxVTKiren; - wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); - wxVTKiren->GetEventPosition(X,Y); - _model->notifyObservers(); - } - - */ return true; } //========================================================================= - - bool GObjectController::OnRightButtonDown() + + bool GObjectController::OnMiddleButtonDown()//virtual { - /********************** VIRTUAL *************************/ - - if( _vtkInteractorStyleBaseView!= NULL ) - { - int X,Y; - wxVTKRenderWindowInteractor *wxVTKiren; - wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor(); - wxVTKiren->GetEventPosition(X, Y); - - int state = _view->getState(); - - //Evaluate new state - if( !_model->hasChanged() && state == SELECTED) - { - _view->setState(NOTHING_HAPPENS); - _model->setChanged(); - } - - _model->notifyObservers(_id); - } - - /**/ - return true; - } //========================================================================= @@ -270,14 +162,28 @@ namespace bbtk int GObjectController::getId() { - return _id; + return _model->getObjectId(); } //========================================================================= void GObjectController::setId(int id) { - _id = id; + _model->setObjectId(id); + } + + //========================================================================= + + std::string GObjectController::getStatusText() + { + return _model->getStatusText(); + } + + //========================================================================= + + void GObjectController::removeFromScene() + { + _view->removeFromScene(); } //=========================================================================