manualRotationToolControler.cpp

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

Generated on 18 Mar 2010 for creaMaracasVisu_lib by  doxygen 1.6.1