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){
48 int size= GetManualViewBaseContour()->GetNumberOfPoints();
50 // Insert a Control Point with shift+ClickLeft
51 vtkRenderWindowInteractor *vtkrenderwindowinteractor = _vtkInteractorStyleBaseView->GetInteractor();
55 if ( (_vtkInteractorStyleBaseView!=NULL) && (GetState()==0) && ( (vtkrenderwindowinteractor!=NULL) && (vtkrenderwindowinteractor->GetShiftKey()==1) ) )
61 // Start to Insert Control Points with ClickLeft (Empty contour)
62 if ((GetState()==0) && (size==0) && (_easyCreation==true) )
66 GetManualContourModel()->SetCloseContour(false);
69 // Continuie to Insert Control Points with ClickLeft (After being empty the contour)
70 if ((GetState()==1) && (_easyCreation==true) )
74 _bakIdPoint=GetNumberOfPointsManualContour() - 1;
76 // Insert Control Points IF Contour si Selected
77 if ((GetState()==0) && GetManualViewBaseContour()->GetPosibleSelected() )
81 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
84 // Chose id of Control Point to be move
85 if ( (GetState()==0 || GetState()==6) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) )
88 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
91 // If nothing selected _state=7
92 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)==-1 ) )
95 _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
99 SetPosibleToMove( true );
100 GetManualViewBaseContour()->SetSelected( GetManualViewBaseContour()->GetPosibleSelected() );
103 if ( GetState() == 0 && GetManualViewBaseContour()->GetPosibleSelected() )
107 GetManualViewBaseContour()->InitMove(x,y,z);
112 GetManualViewBaseContour()->Refresh();
115 // ----------------------------------------------------------------------------
116 void manualContourControler::MouseMove(int x, int y) // virtual
119 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
120 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
121 if (GetState()==1){ SetPoint( _bakIdPoint , x , y ,z); }
122 if (GetState()==5){ SetPoint( _bakIdPoint , x , y ,z); }
123 if ( GetState()==6 && !IsEditable() && GetPosibleToMove() &&IsMoving() )
125 GetManualViewBaseContour()->MoveContour(x,y,z);
127 if (GetState()!=7 || GetManualViewBaseContour()->GetPosibleSelected() ){
128 GetManualViewBaseContour()->Refresh();
129 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
133 GetManualViewBaseContour()->RemoveControlPoints();
134 // GetManualViewBaseContour()->RemoveTextActor();
135 GetManualViewBaseContour()->Refresh();
136 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
141 // ----------------------------------------------------------------------------
142 void manualContourControler::MouseDLeft( int x, int y)//virtual
144 manualContourBaseControler::MouseDLeft( x, y);
148 GetManualViewBaseContour()->AddControlPoints();
149 GetManualViewBaseContour()->AddTextActor();
150 GetManualViewBaseContour()->Refresh();
151 this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
154 // ----------------------------------------------------------------------------
155 void manualContourControler::SetEasyCreation(bool easyCreation)
157 _easyCreation=easyCreation;
159 // ----------------------------------------------------------------------------
160 bool manualContourControler::GetEasyCreation()
162 return _easyCreation;