]> Creatis software - creaMaracasVisu.git/commitdiff
*** empty log message ***
authorvperez <vperez>
Sun, 8 Nov 2009 16:55:11 +0000 (16:55 +0000)
committervperez <vperez>
Sun, 8 Nov 2009 16:55:11 +0000 (16:55 +0000)
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModelRotationTool.cpp [new file with mode: 0644]
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModelRotationTool.h [new file with mode: 0644]
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualRotationToolControler.cpp [new file with mode: 0644]
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualRotationToolControler.h [new file with mode: 0644]
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewRotationTool.cpp [new file with mode: 0644]
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewRotationTool.h [new file with mode: 0644]

diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModelRotationTool.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModelRotationTool.cpp
new file mode 100644 (file)
index 0000000..f874199
--- /dev/null
@@ -0,0 +1,117 @@
+#include "manualContourModelRotationTool.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+manualContourModelRotationTool::manualContourModelRotationTool()
+{
+}
+
+//----------------------------------------------------------------
+
+manualContourModelRotationTool::~manualContourModelRotationTool()
+{
+}
+
+
+// ----------------------------------------------------------------------------
+manualContourModelRotationTool * manualContourModelRotationTool :: Clone()  // virtual
+{
+       manualContourModelRotationTool * clone = new manualContourModelRotationTool();
+       CopyAttributesTo(clone);
+       return clone;
+}
+
+// ---------------------------------------------------------------------------
+void manualContourModelRotationTool::CopyAttributesTo( manualContourModelRotationTool * cloneObject)
+{
+       // Fathers object
+       manualContourModelRotationTool::CopyAttributesTo(cloneObject);
+}
+
+//----------------------------------------------------------------
+int manualContourModelRotationTool::GetTypeModel() //virtual
+{
+       return 8;
+}
+
+//----------------------------------------------------------------
+void manualContourModelRotationTool::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtal
+{
+       int nps = GetNumberOfPointsSpline();
+       //Spline points of the circle
+       if(i<nps-2)
+       {
+               double angle = _deltaAngle*i;
+               *x = _radio*cos(angle) + _centerX;
+               *y = _radio*sin(angle) + _centerY;
+               *z = _centerZ;
+       }
+       //Spline points of the reference line
+       if(i==nps-2)
+       {
+               *x = _centerX;
+               *y = _centerY;
+               *z = _centerZ;
+       }
+       //Spline points of the movable line
+       if(i==nps-1)
+       {
+               manualPoint *mpA= GetManualPoint(2);
+               *x = mpA->GetX();
+               *y = mpA->GetY();
+               *z = _centerZ;
+       }
+       
+}
+
+// ---------------------------------------------------------------------------
+void manualContourModelRotationTool:: UpdateSpline()
+{      
+       manualPoint     *mpA,*mpB,*mpC;
+       double difX,difY;
+       double x, y; 
+    int np     = GetSizeLstPoints( );
+       int nps = GetNumberOfPointsSpline();
+       _deltaAngle=(3.14159265*2)/(nps-1-2);
+
+       if (np==3)
+       {
+               mpA                     = GetManualPoint(0);
+               mpB                     = GetManualPoint(1);
+               mpC                     = GetManualPoint(2);
+               difX            = mpA->GetX() - mpB->GetX();
+               difY            = mpA->GetY() - mpB->GetY();
+               _radio          = sqrt( difX*difX + difY*difY );
+               _centerX        = mpA->GetX();
+               _centerY        = mpA->GetY();
+               _centerZ        = mpA->GetZ();
+
+               x= mpC->GetX() - mpA->GetX();
+               y= mpC->GetY() - mpA->GetY();
+               _angle= atan(y/x)*180/(3.14159265);
+               //cout << "Scale" <<_radio <<endl;
+               //cout << "Angle" <<_angle <<endl;
+       } 
+       else 
+       {
+               _radio          = -1;
+               _centerX        = -1;
+               _centerY        = -1;
+               _centerZ        = -1;
+               _angle          = -1;
+       }
+}
+
+//----------------------------------------------------------------
+double manualContourModelRotationTool::getRadio()
+{
+       return _radio;
+}
+
+//----------------------------------------------------------------
+double manualContourModelRotationTool::getAngle()
+{
+       return _angle;
+}
\ No newline at end of file
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModelRotationTool.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModelRotationTool.h
new file mode 100644 (file)
index 0000000..3233317
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef manualContourModelRotationTool_h
+#define manualContourModelRotationTool_h
+
+#include "manualContourModel.h"
+#include "manualContourModelCircle.h"
+#include "manualContourModelLine.h"
+class creaMaracasVisu_EXPORT manualContourModelRotationTool : public manualContourModel
+{
+public:
+       manualContourModelRotationTool();
+       virtual ~manualContourModelRotationTool();
+       virtual manualContourModelRotationTool *Clone();
+       void CopyAttributesTo( manualContourModelRotationTool *cloneObject);
+       virtual void GetSpline_i_Point(int i, double *x, double *y, double *z);
+       double getRadio();
+       double getAngle();
+
+private:
+       double          _deltaAngle;
+       double          _radio;
+       double          _centerX;
+       double          _centerY;
+       double          _centerZ;
+       double          _angle;
+
+       virtual int             GetTypeModel();
+       virtual void    UpdateSpline();
+};
+
+#endif // manualContourModelCircle_h
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualRotationToolControler.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualRotationToolControler.cpp
new file mode 100644 (file)
index 0000000..7785b97
--- /dev/null
@@ -0,0 +1,137 @@
+#include "manualRotationToolControler.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+// _state = 0  // ..nothing..
+// _state = 5  // move point
+// _state = 6  // move all
+// _state = 7  // Empty mouse drag
+
+manualRotationToolControler::manualRotationToolControler()
+{
+
+}
+
+// ----------------------------------------------------------------------------
+manualRotationToolControler::~manualRotationToolControler()
+{
+
+}
+
+// ----------------------------------------------------------------------------
+manualRotationToolControler * manualRotationToolControler :: Clone()  // virtual
+{
+       manualRotationToolControler * clone = new manualRotationToolControler();
+       CopyAttributesTo(clone);
+       return clone;
+}
+
+// ---------------------------------------------------------------------------
+void manualRotationToolControler::CopyAttributesTo( manualRotationToolControler * cloneObject)
+{
+       // Fathers object
+       manualContourBaseControler::CopyAttributesTo(cloneObject);
+}
+
+// ----------------------------------------------------------------------------
+void manualRotationToolControler::Configure() //virtual
+{
+
+}
+
+// ----------------------------------------------------------------------------
+void manualRotationToolControler::MouseClickLeft(int x, int y)
+{
+       int z = GetZ();
+       
+       if( IsEditable() )
+       {       // move control point
+         if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
+                 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+                 SetState(5);
+         }
+       }// IsEditable
+       
+       // move contour
+       if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true))        {
+               GetManualViewBaseContour()->InitMove(x,y,z);
+               SetState(6);
+       }
+       
+       // firstime create 3 control points and move one control point
+       int size=GetManualViewBaseContour()->GetNumberOfPoints();
+       if (GetState()==0) {
+               if (size==0){
+                       AddPoint(x,y,z);
+                       AddPoint(x,y,z);
+                       bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+                       AddPoint(x,y,z);
+                       SetState(1);
+               }
+       }       
+       
+       GetManualViewBaseContour()->Refresh();
+}
+
+// ----------------------------------------------------------------------------
+void manualRotationToolControler::MouseMove(int x, int y) // virtual
+{
+       int z=GetZ();
+
+       GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
+       GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
+
+       if (GetState()==1){     SetPoint( bakIdPoint , x , y ,z); }
+       if (GetState()==5){     SetPoint( bakIdPoint , x , y ,z); }
+       
+       if (GetState()==6){
+               GetManualViewBaseContour()->MoveContour(x,y,z);
+       }
+       GetManualViewBaseContour()->Refresh();
+}
+
+// ----------------------------------------------------------------------------
+void manualRotationToolControler::DeleteActualMousePoint(int x, int y)  // virtual
+{
+}
+
+// ----------------------------------------------------------------------------
+void manualRotationToolControler::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);
+               AddPoint(0,0,zz);
+       }
+
+       double pp1=porcentage;
+       double pp2=1-porcentage;
+
+       mp = GetManualContourModel()->GetManualPoint(2);
+       zz=(int)mp->GetZ();
+       mp->SetPoint(ww*pp1,hh*pp1,zz);
+
+       mp = GetManualContourModel()->GetManualPoint(1);
+       zz=(int)mp->GetZ();
+       cout <<  ww*pp2 <<hh*pp1 << zz<<endl;
+       mp->SetPoint(ww*pp2,hh*pp1,zz);
+
+       mp = GetManualContourModel()->GetManualPoint(0);
+       zz=(int)mp->GetZ();
+       cout <<  ww*pp2 <<hh*pp2 << zz<<endl;
+       mp->SetPoint(ww*pp2,hh*pp2,zz);
+
+       GetManualViewBaseContour() ->UpdateViewPoint(0);
+       GetManualViewBaseContour() ->UpdateViewPoint(1);
+       GetManualViewBaseContour() ->UpdateViewPoint(2);
+
+       SetState(0);
+       GetManualViewBaseContour()->Refresh();
+}
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualRotationToolControler.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualRotationToolControler.h
new file mode 100644 (file)
index 0000000..fbd09a6
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef manualRotationToolControler_h
+#define manualRotationToolControler_h
+
+#include "manualContourControler.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+// EED08
+class creaMaracasVisu_EXPORT manualRotationToolControler: public manualContourControler
+{
+public:
+       manualRotationToolControler();
+       virtual ~manualRotationToolControler();
+       virtual manualRotationToolControler * Clone();
+       void CopyAttributesTo( manualRotationToolControler *cloneObject );
+
+       virtual void MouseClickLeft(int x, int y);
+       virtual void MouseMove(int x, int y );
+       virtual void DeleteActualMousePoint(int x, int y);
+                       void InitRoi(int ww, int hh, double porcentage);
+//                     void SetRoi(int x1, int y1,int x2, int y2);
+       virtual void Configure();
+
+
+private:
+       int     bakIdPoint;
+};
+
+#endif // manualNewRotationControler_h
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewRotationTool.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewRotationTool.cpp
new file mode 100644 (file)
index 0000000..c5b2821
--- /dev/null
@@ -0,0 +1,118 @@
+#include "manualViewRotationTool.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+manualViewRotationTool::manualViewRotationTool()
+{      
+
+}
+// ----------------------------------------------------------------------------
+manualViewRotationTool::~manualViewRotationTool()
+{
+
+}
+
+// ----------------------------------------------------------------------------
+manualViewRotationTool * manualViewRotationTool :: Clone()
+{
+       manualViewRotationTool * clone = new manualViewRotationTool();
+       CopyAttributesTo(clone);
+       return clone;
+}
+
+// ---------------------------------------------------------------------------
+void manualViewRotationTool::CopyAttributesTo( manualViewRotationTool * cloneObject)
+{
+       manualViewBaseContour::CopyAttributesTo(cloneObject);
+}
+
+// ----------------------------------------------------------------------------
+int manualViewRotationTool::GetType() // virtual
+{
+       return 8;
+}
+
+// ----------------------------------------------------------------------------
+void manualViewRotationTool::GetMinMax(double &minX,double &minY, double &maxX, double &maxY)
+{
+       manualPoint     *mpA,*mpB;
+    unsigned int  np;
+       double radio;
+       double difX,difY;
+    np = GetNumberOfPoints( );
+       
+       if (np==3)
+       {
+               mpA             = _manContModel->GetManualPoint(0);
+               mpB             = _manContModel->GetManualPoint(1);
+               difX    = mpA->GetX() - mpB->GetX();
+               difY    = mpA->GetY() - mpB->GetY();
+               radio   = sqrt( difX*difX + difY*difY );
+               minX=mpA->GetX()-radio;
+               minY=mpA->GetY()-radio;
+               maxX=mpA->GetX()+radio;
+               maxY=mpA->GetY()+radio;
+       } 
+       else 
+       {
+               minX=0;
+               maxX=0;
+               minY=0;
+               maxY=0;
+       }
+}
+
+// ----------------------------------------------------------------------------
+
+void manualViewRotationTool::InitMove(int x, int y, int z)  // virtual
+{
+       manualPoint *mp;
+       double XX=x;
+       double YY=y;
+       double ZZ=z;
+       TransfromCoordViewWorld(XX,YY,ZZ);
+
+       if (_manContModel->GetSizeLstPoints()==3)
+       {
+               mp = _manContModel->GetManualPoint(0);
+               _dp0[0]= mp->GetX() - XX;
+               _dp0[1]= mp->GetY() - YY;
+               _dp0[2]= mp->GetZ();
+
+               mp = _manContModel->GetManualPoint(1);
+               _dp1[0]= mp->GetX() - XX;
+               _dp1[1]= mp->GetY() - YY;
+               _dp1[2]= mp->GetZ();
+
+               mp = _manContModel->GetManualPoint(2);
+               _dp2[0]= mp->GetX() - XX;
+               _dp2[1]= mp->GetY() - YY;
+               _dp2[2]= mp->GetZ();
+
+       }
+}
+
+// ----------------------------------------------------------------------------
+void manualViewRotationTool::MoveContour(int x, int y, int z) // virtual
+{
+       manualPoint *mp;
+       double XX=x;
+       double YY=y;
+       double ZZ=z;
+       TransfromCoordViewWorld(XX,YY,ZZ);
+
+       mp = _manContModel->GetManualPoint(0);
+       mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
+
+       mp = _manContModel->GetManualPoint(1);
+       mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]);
+
+       mp = _manContModel->GetManualPoint(2);
+       mp->SetPoint(_dp2[0]+XX,_dp2[1]+YY,_dp0[2]);
+
+       UpdateViewPoint(0);
+       UpdateViewPoint(1);
+       UpdateViewPoint(2);
+}
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewRotationTool.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewRotationTool.h
new file mode 100644 (file)
index 0000000..cbbf08b
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef manualViewRotationTool_h
+#define manualViewRotationTool_h
+#include "manualViewLine.h"
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+
+class creaMaracasVisu_EXPORT manualViewRotationTool: public manualViewContour
+{
+public:
+       manualViewRotationTool();
+       virtual ~manualViewRotationTool();
+
+       virtual int GetType();
+       virtual manualViewRotationTool * Clone();
+       void CopyAttributesTo( manualViewRotationTool *cloneObject );
+
+       virtual void InitMove(int x, int y, int z);
+       virtual void MoveContour(int x, int y, int z);
+       void GetMinMax(double &minX,double &minY, double &maxX, double &maxY);
+
+private:
+       double                          _dp0[3];
+       double                          _dp1[3];
+       double                          _dp2[3];
+};
+
+
+#endif // manualViewRotationTool_h