GConnectorController.cxx
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00037 #include "GConnectorController.h"
00038
00039 #ifdef _DEBUG
00040 #define new DEBUG_NEW
00041 #endif
00042 namespace bbtk
00043 {
00044
00045
00046
00047 GConnectorController::GConnectorController()
00048 {
00049
00050 }
00051
00052
00053
00054 GConnectorController::~GConnectorController()
00055 {
00056 }
00057
00058
00059
00060 bool GConnectorController::OnMouseMove()
00061 {
00062
00063 if ( _vtkInteractorStyleBaseView!=NULL)
00064 {
00065 int X,Y;
00066 wxVTKRenderWindowInteractor *_wxVTKiren;
00067 _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
00068 _wxVTKiren->GetEventPosition( X , Y );
00069
00070 if ( (_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==0) &&(_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==0) )
00071 {
00072 _controller->MouseMove(X,Y);
00073 }
00074
00075 }
00076 return true;
00077 }
00078
00079
00080
00081 bool GConnectorController::OnLeftButtonDown()
00082 {
00083
00084 if ( _vtkInteractorStyleBaseView!=NULL )
00085 {
00086 int X,Y;
00087 wxVTKRenderWindowInteractor *wxVTKiren;
00088 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
00089 wxVTKiren->GetEventPosition(X,Y);
00090
00091 _controller->SetKeyBoardMoving( false );
00092 _controller->MouseClickLeft(X,Y);
00093
00094 }
00095 return true;
00096 }
00097
00098
00099
00100 bool GConnectorController::OnLeftButtonUp()
00101 {
00102 if( _vtkInteractorStyleBaseView!= NULL )
00103 {
00104 int X,Y;
00105 wxVTKRenderWindowInteractor *wxVTKiren;
00106 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
00107 wxVTKiren->GetEventPosition(X, Y);
00108
00109 _controller->MouseReleaseLeft(X,Y);
00110 if(_controller->GetManualViewBaseContour()->GetSelected()==true)
00111 {
00112 _view->setState(SELECTED);
00113 _model->notifyObservers(getId(),ADD_TO_SELECTED);
00114 }
00115
00116 }
00117 return true;
00118
00119 }
00120
00121
00122
00123 bool GConnectorController::OnLeftDClick()
00124 {
00125
00126 if ( _vtkInteractorStyleBaseView!=NULL )
00127 {
00128 int X,Y;
00129 wxVTKRenderWindowInteractor *wxVTKiren;
00130 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
00131 wxVTKiren->GetEventPosition(X,Y);
00132
00133 _controller->MouseDLeft(X,Y);
00134
00135 }
00136 return true;
00137 }
00138
00139
00140
00141 bool GConnectorController::OnRightButtonDown()
00142 {
00143 if( _vtkInteractorStyleBaseView!= NULL )
00144 {
00145 int X,Y;
00146 wxVTKRenderWindowInteractor *wxVTKiren;
00147 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
00148 wxVTKiren->GetEventPosition(X, Y);
00149
00150 _controller->MouseClickRight(X,Y);
00151
00152 }
00153 return true;
00154 }
00155
00156
00157
00158 bool GConnectorController::OnRightButtonUp()
00159 {
00160 return true;
00161 }
00162
00163
00164
00165 bool GConnectorController::OnMiddleButtonDown()
00166 {
00167 if ( _vtkInteractorStyleBaseView!=NULL )
00168 {
00169 int X,Y,Z=900;
00170 wxVTKRenderWindowInteractor *wxVTKiren;
00171 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
00172 wxVTKiren->GetEventPosition(X, Y);
00173 _controller->GetManualViewBaseContour()->InitMove( X, Y,Z);
00174 }
00175 return true;
00176 }
00177
00178 bool GConnectorController::OnMiddleButtonUp()
00179 {
00180 return true;
00181 }
00182
00183
00184
00185 manualConnectorContourController* GConnectorController::getManualContourController()
00186 {
00187 return _controller;
00188 }
00189
00190
00191
00192 void GConnectorController::setManualContourController(manualConnectorContourController* controller)
00193 {
00194 _controller = controller;
00195 _controller->SetVtkInteractorStyleBaseView(_vtkInteractorStyleBaseView);
00196 }
00197
00198
00199
00200 void GConnectorController::removeFromScene()
00201 {
00202 GConnectorModel *conMod = (GConnectorModel*)_model;
00203 conMod->disconnectConnection();
00204
00205 _controller->SetEditable(false);
00206 _controller->DeleteContour();
00207 }
00208
00209
00210
00211 void GConnectorController::endContourCreation()
00212 {
00213 _controller->endContourCreation();
00214 }
00215
00216
00217
00218 }
00219
00220
00221