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;
-
}
//=========================================================================
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();
}
//=========================================================================