X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FEditorGraphicBBS%2FbbsVtkGUIEditorGraphic%2FGObjectController.cxx;h=645997b25ed8c7d07df31afb2a71a25d523e5b96;hb=a6d479881eeb637cd06afa3b2177e430fa05571e;hp=2c90897a2a4bebb8fdfdaf6c6c60f1d678fa9b6c;hpb=eaf825847b9ac4bd762deafa59a7df1c2ceba433;p=bbtkGEditor.git diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx index 2c90897..645997b 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx @@ -64,170 +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( state == DRAG) + if(_view->isPointInside(X,Y)) { - moveObject(X,Y); - } - - if( state == NOTHING_HAPPENS) - { - if(_view->isPointInside(X,Y)) - { - _view->setState(HIGHLIGHTED); - } - } - if( state==HIGHLIGHTED) + _view->setState(HIGHLIGHTED); + } + } + if( state==HIGHLIGHTED) + { + if(!_view->isPointInside(X,Y)) { - if(!_view->isPointInside(X,Y)) - { - _view->setState(NOTHING_HAPPENS); - } + _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); - } - - if( !_model->hasChanged() && state == SELECTED) - { - if(_view->isPointInside(X,Y)) - { - _view->isStartDragging(true); - _model->setState(DRAG); - } - } - - _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); - } - - if( !_model->hasChanged() && state == DRAG) - { - _model->setState(SELECTED); - } - - _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( state == SELECTED) - { - _view->setState(NOTHING_HAPPENS); - } - - _model->notifyObservers(_id); - } - - /**/ - return true; - } //========================================================================= @@ -262,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(); } //=========================================================================