1 #include "manualLineControler.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 manualLineControler::manualLineControler()
17 // ----------------------------------------------------------------------------
18 manualLineControler::~manualLineControler()
21 // ----------------------------------------------------------------------------
22 manualLineControler * manualLineControler :: Clone() // virtual
24 manualLineControler * clone = new manualLineControler();
25 CopyAttributesTo(clone);
29 // ---------------------------------------------------------------------------
30 void manualLineControler::CopyAttributesTo( manualLineControler * cloneObject)
33 manualContourBaseControler::CopyAttributesTo(cloneObject);
37 // ----------------------------------------------------------------------------
38 void manualLineControler::MouseClickLeft(int x, int y){
42 { // move control point
43 if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
44 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
50 if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
51 GetManualViewBaseContour()->InitMove(x,y,z);
55 // fist time create 2 control points and move a control point
56 int size=GetManualViewBaseContour()->GetNumberOfPoints();
61 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
76 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
81 GetManualViewBaseContour()->Refresh();
83 // ----------------------------------------------------------------------------
85 void manualLineControler::MouseMove(int x, int y) // virtual
89 GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
90 GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
92 if (GetState()==1) { SetPoint( bakIdPoint , x , y ,z); }
93 if (GetState()==5) { SetPoint( bakIdPoint , x , y ,z); }
97 GetManualViewBaseContour()->MoveContour(x,y,z);
99 GetManualViewBaseContour()->Refresh();
103 // ----------------------------------------------------------------------------
104 void manualLineControler::DeleteActualMousePoint(int x, int y) // virtual
107 // ----------------------------------------------------------------------------
109 void manualLineControler::InitRoi(int ww, int hh, double porcentage)
114 if (GetManualContourModel()->GetSizeLstPoints() ==0)
121 double pp1=porcentage;
122 double pp2=1-porcentage;
124 mp = GetManualContourModel()->GetManualPoint(0);
126 mp->SetPoint(ww*pp2,hh*pp2,zz);
128 mp = GetManualContourModel()->GetManualPoint(1);
130 mp->SetPoint(ww*pp2,hh*pp1,zz);
132 GetManualViewBaseContour() ->UpdateViewPoint(0);
133 GetManualViewBaseContour() ->UpdateViewPoint(1);
136 GetManualViewBaseContour()->Refresh();