//=========================================================================
GPortController::GPortController()
{
-
+ _isLeftClickDown=false;
}
//=========================================================================
bool GPortController::OnLeftButtonDown()
{
- if ( _vtkInteractorStyleBaseView!=NULL )
- {
- int X,Y;
- wxVTKRenderWindowInteractor *wxVTKiren;
- wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
- wxVTKiren->GetEventPosition(X,Y);
-
- int state = _model->getState();
+ int state = _view->getState();
- int portType = ((GPortModel*)_model)->getPortType();
-
- //Evaluate new state
- if(!_model->hasChanged() && state==HIGHLIGHTED && portType==GINPUTPORT )
- {
- _model->setState(CREATING_CONTOUR);
- _model->setChanged();
- }
-
- _model->notifyObservers();
-
+ //Evaluate new state
+ if(state == HIGHLIGHTED)
+ {
+ _isLeftClickDown=true;
}
return true;
}
//=========================================================================
bool GPortController::OnLeftButtonUp()
{
- if ( _vtkInteractorStyleBaseView!=NULL )
+ int state = _view->getState();
+ if(_isLeftClickDown)
{
- 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(state==HIGHLIGHTED)
{
- if(_view->isPointInside(X,Y))
+ int portType = ((GPortModel*)_model)->getPortType();
+
+ //Evaluate new state
+ if(portType==GOUTPUTPORT)
{
- _model->setChanged();
- _model->notifyObservers(INIT_CREATION_CONTOUR);
+ _model->notifyObservers(getId(),INIT_CREATION_CONTOUR);
}
- else
+ else if (portType==GINPUTPORT)
{
- _model->setState(NOTHING_HAPPENS);
- _model->setChanged();
- _model->notifyObservers();
+ _model->notifyObservers(getId(),FIN_CREATION_CONTOUR);
}
}
-
-
-
+ else
+ {
+ _view->setState(NOTHING_HAPPENS);
+ }
+ _isLeftClickDown=false;
}
+
return true;
}
//=========================================================================
+
+
} // EO namespace bbtk
// EOF