1 #include "manualContourControler.h"
3 // ----------------------------------------------------------------------------
4 // ----------------------------------------------------------------------------
5 // ----------------------------------------------------------------------------
7 // _state = 0 // ..nothing..
8 // _state = 1 // move with add point
10 // _state = 6 // move with insert point
11 // _state = 7 // move with non selection
13 manualContourControler::manualContourControler()
18 // ----------------------------------------------------------------------------
19 manualContourControler::~manualContourControler()
22 // ----------------------------------------------------------------------------
23 manualContourControler * manualContourControler :: Clone() // virtual
25 manualContourControler * clone = new manualContourControler();
26 CopyAttributesTo(clone);
29 // ---------------------------------------------------------------------------
30 void manualContourControler::CopyAttributesTo( manualContourControler * cloneObject)
33 manualContourBaseControler::CopyAttributesTo(cloneObject);
34 cloneObject->SetEasyCreation( this->GetEasyCreation() );
37 // ----------------------------------------------------------------------------
38 void manualContourControler::Configure() //virtual
40 // this->_manContModel->SetNumberOfPointsSpline(100);
43 // ----------------------------------------------------------------------------
44 void manualContourControler::MouseClickLeft(int x, int y)
49 int size= GetManualViewBaseContour()->GetNumberOfPoints();
51 // Insert a Control Point with shift+ClickLeft
52 vtkRenderWindowInteractor *vtkrenderwindowinteractor = _vtkInteractorStyleBaseView->GetInteractor();
56 if ( (_vtkInteractorStyleBaseView!=NULL) && (GetState()==0) && ( (vtkrenderwindowinteractor!=NULL) && (vtkrenderwindowinteractor->GetShiftKey()==1) ) )
62 // Start to Insert Control Points with ClickLeft (Empty contour)
63 if ((GetState()==0) && (size==0) && (_easyCreation==true) )
67 GetManualContourModel()->SetCloseContour(false);
70 // Continuie to Insert Control Points with ClickLeft (After being empty the contour)
71 if ((GetState()==1) && (_easyCreation==true) )
75 _bakIdPoint=GetNumberOfPointsManualContour() - 1;
77 // Insert Control Points IF Contour si Selected
78 if ((GetState()==0) && GetManualViewBaseContour()->GetPosibleSelected() )
82 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
85 // Chose id of Control Point to be move
86 if ( (GetState()==0 || GetState()==6) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) )
89 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
92 // If nothing selected _state=7
93 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)==-1 ) )
96 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
100 SetPosibleToMove( true );
101 GetManualViewBaseContour()->SetSelected( GetManualViewBaseContour()->GetPosibleSelected() );
104 if ( GetState() == 0 && GetManualViewBaseContour()->GetPosibleSelected() )
108 GetManualViewBaseContour()->InitMove(x,y,z);
113 GetManualViewBaseContour()->Refresh();
116 // ----------------------------------------------------------------------------
117 void manualContourControler::MouseMove(int x, int y) // virtual
120 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
121 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
122 if (GetState()==1){ SetPoint( _bakIdPoint , x , y ,z); }
123 if (GetState()==5){ SetPoint( _bakIdPoint , x , y ,z); }
124 if ( GetState()==6 && !IsEditable() && GetPosibleToMove() &&IsMoving() )
126 GetManualViewBaseContour()->MoveContour(x,y,z);
128 if (GetState()!=7 || GetManualViewBaseContour()->GetPosibleSelected() ){
129 GetManualViewBaseContour()->Refresh();
130 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
134 GetManualViewBaseContour()->RemoveControlPoints();
135 // GetManualViewBaseContour()->RemoveTextActor();
136 GetManualViewBaseContour()->Refresh();
137 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
142 // ----------------------------------------------------------------------------
143 void manualContourControler::MouseDLeft( int x, int y)//virtual
145 manualContourBaseControler::MouseDLeft( x, y);
149 GetManualViewBaseContour()->AddControlPoints();
150 GetManualViewBaseContour()->AddTextActor();
151 GetManualViewBaseContour()->Refresh();
152 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
155 // ----------------------------------------------------------------------------
156 void manualContourControler::SetEasyCreation(bool easyCreation)
158 _easyCreation=easyCreation;
160 // ----------------------------------------------------------------------------
161 bool manualContourControler::GetEasyCreation()
163 return _easyCreation;