manualLineControler.cpp

Go to the documentation of this file.
00001 #include "manualLineControler.h"
00002 
00003 // ----------------------------------------------------------------------------
00004 // ----------------------------------------------------------------------------
00005 // ----------------------------------------------------------------------------
00006 
00007 // AD:02-09
00008 
00009 // _state = 0  // ..nothing..
00010 // _state = 5  // move point
00011 // _state = 6  // move all
00012 // _state = 7  // Empty mouse drag
00013 
00014 manualLineControler::manualLineControler()
00015 {
00016 }
00017 // ----------------------------------------------------------------------------
00018 manualLineControler::~manualLineControler()
00019 {
00020 }
00021 // ----------------------------------------------------------------------------
00022 manualLineControler * manualLineControler :: Clone()  // virtual 
00023 {
00024         manualLineControler * clone = new manualLineControler();
00025         CopyAttributesTo(clone);
00026         return clone;
00027 }
00028 
00029 // ---------------------------------------------------------------------------
00030 void manualLineControler::CopyAttributesTo( manualLineControler * cloneObject)
00031 {
00032         // Fathers object
00033         manualContourBaseControler::CopyAttributesTo(cloneObject);
00034 }
00035 
00036 
00037 // ----------------------------------------------------------------------------
00038 void manualLineControler::MouseClickLeft(int x, int y){
00039         int z = GetZ();
00040         
00041         if( IsEditable() )
00042         {       // move control point
00043           if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
00044                   bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);   
00045                   SetState(5);
00046           }
00047         } //IsEditable
00048         
00049         // move contour
00050         if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true))        { 
00051                 GetManualViewBaseContour()->InitMove(x,y,z);
00052                 SetState(6);
00053         }
00054         
00055         // fist time create 2 control points and move a control point
00056         int size=GetManualViewBaseContour()->GetNumberOfPoints();
00057         if (GetState()==0) { 
00058                 if (size==0){
00059                         AddPoint(x,y,z); 
00060                         AddPoint(x,y,z); 
00061                         bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);     
00062                         SetState(1);
00063                 }
00064         }
00065         
00066         
00067 /*EED 21 Avril 2009             
00068         if (GetState()==0) { 
00069                 if (size==0){
00070                         AddPoint(x,y,z); 
00071                         AddPoint(x,y,z); 
00072                 } else {
00073                         SetPoint(0,x,y,z); 
00074                         SetPoint(1,x,y,z); 
00075                 }
00076                 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);     
00077                 SetState(5);
00078         }
00079 */
00080         
00081         GetManualViewBaseContour()->Refresh();
00082 }
00083 // ----------------------------------------------------------------------------
00084 
00085 void manualLineControler::MouseMove(int x, int y) // virtual
00086 {
00087         int z=GetZ();
00088 
00089         GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
00090         GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
00091 
00092         if (GetState()==1) { SetPoint( bakIdPoint , x , y ,z); }
00093         if (GetState()==5) { SetPoint( bakIdPoint , x , y ,z); }
00094         
00095         if (GetState()==6)
00096         {       
00097                 GetManualViewBaseContour()->MoveContour(x,y,z);
00098         }
00099         GetManualViewBaseContour()->Refresh();
00100 }
00101 
00102 
00103 // ----------------------------------------------------------------------------
00104 void manualLineControler::DeleteActualMousePoint(int x, int y)  // virtual
00105 { 
00106 }
00107 // ----------------------------------------------------------------------------
00108 
00109 void manualLineControler::InitRoi(int ww, int hh, double porcentage)
00110 {
00111         int zz;
00112         manualPoint *mp;
00113 
00114         if (GetManualContourModel()->GetSizeLstPoints() ==0)
00115         {
00116                 zz = GetZ();
00117                 AddPoint(0,0,zz);
00118                 AddPoint(0,0,zz);
00119         }
00120 
00121         double pp1=porcentage;
00122         double pp2=1-porcentage;
00123 
00124         mp = GetManualContourModel()->GetManualPoint(0);
00125         zz=(int)mp->GetZ();
00126         mp->SetPoint(ww*pp2,hh*pp2,zz);
00127 
00128         mp = GetManualContourModel()->GetManualPoint(1);
00129         zz=(int)mp->GetZ();
00130         mp->SetPoint(ww*pp2,hh*pp1,zz);
00131 
00132         GetManualViewBaseContour() ->UpdateViewPoint(0);
00133         GetManualViewBaseContour() ->UpdateViewPoint(1);
00134 
00135         SetState(0);
00136         GetManualViewBaseContour()->Refresh();  
00137 }       

Generated on 18 Mar 2010 for creaMaracasVisu_lib by  doxygen 1.6.1