manualConnectorContourController.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 "manualConnectorContourController.h"
00038
00039 namespace bbtk
00040 {
00041
00042
00043
00044 manualConnectorContourController::manualConnectorContourController()
00045 {
00046 }
00047
00048
00049
00050 manualConnectorContourController::~manualConnectorContourController()
00051 {
00052 }
00053
00054
00055
00056 void manualConnectorContourController::MouseMove(int x, int y)
00057 {
00058 int z=GetZ();
00059 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
00060 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
00061 if (GetState()==1){ SetPoint( _bakIdPoint , x , y ,z); }
00062 if (GetState()==5){ SetPoint( _bakIdPoint , x , y ,z); }
00063 if ( GetState()==6 && !IsEditable() && GetPosibleToMove() &&IsMoving() )
00064 {
00065
00066 }
00067 if (GetState()!=7 || GetManualViewBaseContour()->GetPosibleSelected() ){
00068 GetManualViewBaseContour()->Refresh();
00069 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
00070 }
00071 if (!IsEditable())
00072 {
00073 GetManualViewBaseContour()->RemoveControlPoints();
00074 GetManualViewBaseContour()->Refresh();
00075 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
00076 }
00077
00078 }
00079
00080
00081
00082 void manualConnectorContourController::MouseClickRight(int x, int y)
00083 {
00084 SetCompleteCreation( true );
00085 SetKeyBoardMoving( false );
00086 GetManualContourModel()->SetCloseContour(false);
00087
00088 SetEditable( false );
00089 SetPosibleToMove( false );
00090 SetState(0);
00091
00092 }
00093
00094
00095
00096 void manualConnectorContourController::MouseClickLeft(int x, int y)
00097 {
00098
00099 bool ok = false;
00100 int z = GetZ();
00101 int size= GetManualViewBaseContour()->GetNumberOfPoints();
00102
00103
00104 vtkRenderWindowInteractor *vtkrenderwindowinteractor = _vtkInteractorStyleBaseView->GetInteractor();
00105 if( IsEditable() )
00106 {
00107 if ( (_vtkInteractorStyleBaseView!=NULL) && (GetState()==0) && ( (vtkrenderwindowinteractor!=NULL) && (vtkrenderwindowinteractor->GetShiftKey()==1) ) )
00108 {
00109 ok=true;
00110 InsertPoint(x,y,z);
00111 size++;
00112 }
00113
00114 if ((GetState()==0) && (size==0) && (_easyCreation==true) )
00115 {
00116 ok=true;
00117 SetState(1);
00118 GetManualContourModel()->SetCloseContour(false);
00119 AddPoint(x,y,z);
00120 }
00121
00122
00123 if ((GetState()==1) && (_easyCreation==true) && GetNumberOfPointsManualContour()==2)
00124 {
00125 ok=true;
00126 endContourCreation();
00127 }
00128
00129
00130 if ((GetState()==1) && (_easyCreation==true) )
00131 {
00132 ok=true;
00133 AddPoint(x,y,z);
00134 _bakIdPoint=GetNumberOfPointsManualContour() - 1;
00135 }
00136
00137
00138 if ((GetState()==0) && GetManualViewBaseContour()->GetPosibleSelected() )
00139 {
00140 ok=true;
00141 InsertPoint(x,y,z);
00142 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
00143 SetState(6);
00144 }
00145
00146 if ( (GetState()==0 || GetState()==6) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) )
00147 {
00148 ok=true;
00149 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
00150 if(_bakIdPoint!=0 && _bakIdPoint!=GetManualViewBaseContour()->GetNumberOfPoints()-1)
00151 {
00152 SetState(5);
00153 }
00154 }
00155
00156 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)==-1 ) )
00157 {
00158
00159 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
00160 SetState(7);
00161 }
00162 }else{
00163 SetPosibleToMove( true );
00164 GetManualViewBaseContour()->SetSelected( GetManualViewBaseContour()->GetPosibleSelected() );
00165 }
00166
00167 if ( GetState() == 0 && GetManualViewBaseContour()->GetPosibleSelected() )
00168 {
00169 SetMoving( true );
00170 ok=true;
00171 GetManualViewBaseContour()->InitMove(x,y,z);
00172 SetState(6);
00173 }
00174 if (ok==true)
00175 {
00176 GetManualViewBaseContour()->Refresh();
00177 }
00178 }
00179
00180
00181
00182 void manualConnectorContourController::endContourCreation()
00183 {
00184 SetCompleteCreation( true );
00185 SetKeyBoardMoving( false );
00186 GetManualContourModel()->SetCloseContour(false);
00187
00188 SetEditable( false );
00189 SetPosibleToMove( false );
00190 SetState(0);
00191 }
00192
00193
00194
00195
00196 }
00197
00198
00199