+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+// AD:02-09
+
+// _state = 0 // ..nothing..
+// _state = 5 // move point
+// _state = 6 // move all
+// _state = 7 // Empty mouse drag
+
+manualLineControler::manualLineControler()
+{
+}
+// ----------------------------------------------------------------------------
+manualLineControler::~manualLineControler()
+{
+}
+// ----------------------------------------------------------------------------
+manualLineControler * manualLineControler :: Clone() // virtual
+{
+ manualLineControler * clone = new manualLineControler();
+ CopyAttributesTo(clone);
+ return clone;
+}
+
+// ---------------------------------------------------------------------------
+void manualLineControler::CopyAttributesTo( manualLineControler * cloneObject)
+{
+ // Fathers object
+ manualContourBaseControler::CopyAttributesTo(cloneObject);
+}
+
+// ----------------------------------------------------------------------------
+void manualLineControler::MouseClickLeft(int x, int y){
+ int z = GetZ();
+ if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
+ bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+ SetState(5);
+ }
+ if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
+ GetManualViewBaseContour()->InitMove(x,y,z);
+ SetState(6);
+ }
+ int size=GetManualViewBaseContour()->GetNumberOfPoints();
+ if (GetState()==0) {
+ if (size==0){
+ AddPoint(x,y,z);
+ AddPoint(x,y,z);
+ } else {
+ SetPoint(0,x,y,z);
+ SetPoint(1,x,y,z);
+ }
+ bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+ SetState(5);
+ }
+ GetManualViewBaseContour()->Refresh();
+}
+// ----------------------------------------------------------------------------
+
+void manualLineControler::MouseMove(int x, int y) // virtual
+{
+ int z=GetZ();
+
+ GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
+ GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
+
+ if (GetState()==5)
+ {
+ SetPoint( bakIdPoint , x , y ,z);
+ }
+ if (GetState()==6)
+ {
+ GetManualViewBaseContour()->MoveContour(x,y,z);
+ }
+ GetManualViewBaseContour()->Refresh();
+}
+
+
+// ----------------------------------------------------------------------------
+void manualLineControler::DeleteActualMousePoint(int x, int y) // virtual
+{
+}
+// ----------------------------------------------------------------------------
+
+void manualLineControler::InitRoi(int ww, int hh, double porcentage)
+{
+ int zz;
+ manualPoint *mp;
+
+ if (GetManualContourModel()->GetSizeLstPoints() ==0)
+ {
+ zz = GetZ();
+ AddPoint(0,0,zz);
+ AddPoint(0,0,zz);
+ }
+
+ double pp1=porcentage;
+ double pp2=1-porcentage;
+
+ mp = GetManualContourModel()->GetManualPoint(0);
+ zz=(int)mp->GetZ();
+ mp->SetPoint(ww*pp2,hh*pp2,zz);
+
+ mp = GetManualContourModel()->GetManualPoint(1);
+ zz=(int)mp->GetZ();
+ mp->SetPoint(ww*pp2,hh*pp1,zz);
+
+ GetManualViewBaseContour() ->UpdateViewPoint(0);
+ GetManualViewBaseContour() ->UpdateViewPoint(1);
+
+ SetState(0);
+ GetManualViewBaseContour()->Refresh();
+}