1 #include "manualRotationToolControler.h"
3 // ----------------------------------------------------------------------------
4 // ----------------------------------------------------------------------------
5 // ----------------------------------------------------------------------------
7 // _state = 0 // ..nothing..
8 // _state = 5 // move point
9 // _state = 6 // move all
10 // _state = 7 // Empty mouse drag
12 manualRotationToolControler::manualRotationToolControler()
17 // ----------------------------------------------------------------------------
18 manualRotationToolControler::~manualRotationToolControler()
23 // ----------------------------------------------------------------------------
24 manualRotationToolControler * manualRotationToolControler :: Clone() // virtual
26 manualRotationToolControler * clone = new manualRotationToolControler();
27 CopyAttributesTo(clone);
31 // ---------------------------------------------------------------------------
32 void manualRotationToolControler::CopyAttributesTo( manualRotationToolControler * cloneObject)
35 manualContourBaseControler::CopyAttributesTo(cloneObject);
38 // ----------------------------------------------------------------------------
39 void manualRotationToolControler::Configure() //virtual
44 // ----------------------------------------------------------------------------
45 void manualRotationToolControler::MouseClickLeft(int x, int y)
50 { // move control point
51 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
52 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
58 if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
59 GetManualViewBaseContour()->InitMove(x,y,z);
63 // firstime create 3 control points and move one control point
64 int size=GetManualViewBaseContour()->GetNumberOfPoints();
69 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
75 GetManualViewBaseContour()->Refresh();
78 // ----------------------------------------------------------------------------
79 void manualRotationToolControler::MouseMove(int x, int y) // virtual
83 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
84 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
86 if (GetState()==1){ SetPoint( bakIdPoint , x , y ,z); }
87 if (GetState()==5){ SetPoint( bakIdPoint , x , y ,z); }
90 GetManualViewBaseContour()->MoveContour(x,y,z);
92 GetManualViewBaseContour()->Refresh();
95 // ----------------------------------------------------------------------------
96 void manualRotationToolControler::DeleteActualMousePoint(int x, int y) // virtual
100 // ----------------------------------------------------------------------------
101 void manualRotationToolControler::InitRoi(int ww, int hh, double porcentage)
106 if (GetManualContourModel()->GetSizeLstPoints() ==0)
114 double pp1=porcentage;
115 double pp2=1-porcentage;
117 mp = GetManualContourModel()->GetManualPoint(2);
119 mp->SetPoint(ww*pp1,hh*pp1,zz);
121 mp = GetManualContourModel()->GetManualPoint(1);
123 cout << ww*pp2 <<hh*pp1 << zz<<endl;
124 mp->SetPoint(ww*pp2,hh*pp1,zz);
126 mp = GetManualContourModel()->GetManualPoint(0);
128 cout << ww*pp2 <<hh*pp2 << zz<<endl;
129 mp->SetPoint(ww*pp2,hh*pp2,zz);
131 GetManualViewBaseContour() ->UpdateViewPoint(0);
132 GetManualViewBaseContour() ->UpdateViewPoint(1);
133 GetManualViewBaseContour() ->UpdateViewPoint(2);
136 GetManualViewBaseContour()->Refresh();