1 #include "manualCircleControler.h"
3 // ----------------------------------------------------------------------------
4 // ----------------------------------------------------------------------------
5 // ----------------------------------------------------------------------------
9 // _state = 0 // ..nothing..
10 // _state = 5 // move point
11 // _state = 6 // move all
12 // _state = 7 // Empty mouse drag
14 manualCircleControler::manualCircleControler()
17 // ----------------------------------------------------------------------------
18 manualCircleControler::~manualCircleControler()
21 // ----------------------------------------------------------------------------
22 manualCircleControler * manualCircleControler :: Clone() // virtual
24 manualCircleControler * clone = new manualCircleControler();
25 CopyAttributesTo(clone);
29 // ---------------------------------------------------------------------------
30 void manualCircleControler::CopyAttributesTo( manualCircleControler * cloneObject)
33 manualContourBaseControler::CopyAttributesTo(cloneObject);
36 // ----------------------------------------------------------------------------
37 void manualCircleControler::Configure() //virtual
39 // this->GetManualContourModel()->SetNumberOfPointsSpline(5);
42 // ----------------------------------------------------------------------------
43 void manualCircleControler::MouseClickLeft(int x, int y){
47 { // move control point
48 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
49 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
55 if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
56 GetManualViewBaseContour()->InitMove(x,y,z);
60 // firstime create 2 control points and move one control point
61 int size=GetManualViewBaseContour()->GetNumberOfPoints();
66 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
80 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
85 GetManualViewBaseContour()->Refresh();
87 // ----------------------------------------------------------------------------
89 void manualCircleControler::MouseMove(int x, int y) // virtual
92 // this->_vtkInteractorStyleBaseView->
94 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
95 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
97 if (GetState()==1){ SetPoint( bakIdPoint , x , y ,z); }
98 if (GetState()==5){ SetPoint( bakIdPoint , x , y ,z); }
101 GetManualViewBaseContour()->MoveContour(x,y,z);
103 GetManualViewBaseContour()->Refresh();
107 // ----------------------------------------------------------------------------
108 void manualCircleControler::DeleteActualMousePoint(int x, int y) // virtual
111 // ----------------------------------------------------------------------------
113 void manualCircleControler::InitRoi(int ww, int hh, double porcentage)
118 if (GetManualContourModel()->GetSizeLstPoints() ==0)
127 double pp1=porcentage;
128 double pp2=1-porcentage;
130 // mp = GetManualContourModel()->GetManualPoint(2);
131 // zz=(int)mp->GetZ();
132 // mp->SetPoint(ww*pp1,hh*pp1,zz);
134 mp = GetManualContourModel()->GetManualPoint(1);
136 mp->SetPoint(ww*pp2,hh*pp1,zz);
138 mp = GetManualContourModel()->GetManualPoint(0);
140 mp->SetPoint(ww*pp2,hh*pp2,zz);
142 // mp = GetManualContourModel()->GetManualPoint(3);
143 // zz=(int)mp->GetZ();
144 // mp->SetPoint(ww*pp1,hh*pp2,zz);
146 GetManualViewBaseContour() ->UpdateViewPoint(0);
147 GetManualViewBaseContour() ->UpdateViewPoint(1);
148 // GetManualViewBaseContour() ->UpdateViewPoint(2);
149 // GetManualViewBaseContour() ->UpdateViewPoint(3);
152 GetManualViewBaseContour()->Refresh();
155 // ----------------------------------------------------------------------------
157 void manualCircleControler::SetRoi(int x1, int y1,int x2, int y2)
160 InitRoi( 0 , 0 , 0.2 );
161 mp = GetManualContourModel()->GetManualPoint(2);
165 mp = GetManualContourModel()->GetManualPoint(1);
169 mp = GetManualContourModel()->GetManualPoint(0);
173 mp = GetManualContourModel()->GetManualPoint(3);
177 GetManualViewBaseContour() ->UpdateViewPoint(0);
178 GetManualViewBaseContour() ->UpdateViewPoint(1);
179 GetManualViewBaseContour() ->UpdateViewPoint(2);
180 GetManualViewBaseContour() ->UpdateViewPoint(3);