]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewCircle.cpp
879d119773a885879c7af8bf39e56a9c002579e0
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / manualContour / manualViewCircle.cpp
1 #include "manualViewCircle.h"
2
3
4 // ----------------------------------------------------------------------------
5 // ----------------------------------------------------------------------------
6 // ----------------------------------------------------------------------------
7
8 // EED08
9
10 manualViewCircle::manualViewCircle()
11 {
12 //      _sizePointsContour=5;   // default 100
13 }
14 // ----------------------------------------------------------------------------
15 manualViewCircle::~manualViewCircle()
16 {
17 }
18
19
20 // ----------------------------------------------------------------------------
21 manualViewCircle * manualViewCircle :: Clone()
22 {
23         manualViewCircle * clone = new manualViewCircle();
24         CopyAttributesTo(clone);
25         return clone;
26 }
27
28 // ---------------------------------------------------------------------------
29
30 void manualViewCircle::CopyAttributesTo( manualViewCircle * cloneObject)
31 {
32         // Fathers object
33         manualViewBaseContour::CopyAttributesTo(cloneObject);
34 }
35
36
37 // ----------------------------------------------------------------------------
38 int manualViewCircle::GetType() // virtual
39 {
40         return 3;
41 }
42
43 // ----------------------------------------------------------------------------
44
45 void manualViewCircle::GetMinMax(double &minX,double &minY, double &maxX, double &maxY)
46 {
47         manualPoint     *mpA,*mpB;
48     unsigned int  np;
49         double radio;
50         double difX,difY;
51     np  = GetNumberOfPoints( );
52         if (np==2)
53         {
54                 mpA             = _manContModel->GetManualPoint(0);
55                 mpB             = _manContModel->GetManualPoint(1);
56                 difX    = mpA->GetX() - mpB->GetX();
57                 difY    = mpA->GetY() - mpB->GetY();
58                 radio   = sqrt( difX*difX + difY*difY );
59                 minX=mpA->GetX()-radio;
60                 minY=mpA->GetY()-radio;
61                 maxX=mpA->GetX()+radio;
62                 maxY=mpA->GetY()+radio;
63         } else {
64                 minX=0;
65                 maxX=0;
66                 minY=0;
67                 maxY=0;
68         }
69 }
70
71
72 // ----------------------------------------------------------------------------
73
74 void manualViewCircle::InitMove(int x, int y, int z)  // virtual
75 {
76         manualPoint *mp;
77         double XX=x;
78         double YY=y;
79         double ZZ=z;
80         TransfromCoordViewWorld(XX,YY,ZZ);
81
82         if (_manContModel->GetSizeLstPoints()==2){
83                 mp = _manContModel->GetManualPoint(0);
84                 _dp0[0]= mp->GetX() - XX;
85                 _dp0[1]= mp->GetY() - YY;
86                 _dp0[2]= mp->GetZ();
87
88                 mp = _manContModel->GetManualPoint(1);
89                 _dp1[0]= mp->GetX() - XX;
90                 _dp1[1]= mp->GetY() - YY;
91                 _dp1[2]= mp->GetZ();
92 /*
93                 mp = _manContModel->GetManualPoint(2);
94                 _dp2[0]= mp->GetX() - XX;
95                 _dp2[1]= mp->GetY() - YY;
96                 _dp2[2]= mp->GetZ();
97
98                 mp = _manContModel->GetManualPoint(3);
99                 _dp3[0]= mp->GetX() - XX;
100                 _dp3[1]= mp->GetY() - YY;
101                 _dp3[2]= mp->GetZ();
102 */
103         }
104 }
105
106
107 // ----------------------------------------------------------------------------
108 void manualViewCircle::MoveContour(int x, int y, int z) // virtual
109 {
110         manualPoint *mp;
111         double XX=x;
112         double YY=y;
113         double ZZ=z;
114         TransfromCoordViewWorld(XX,YY,ZZ);
115
116         mp = _manContModel->GetManualPoint(0);
117         mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
118
119         mp = _manContModel->GetManualPoint(1);
120         mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]);
121
122 //      mp = _manContModel->GetManualPoint(2);
123 //      mp->SetPoint(_dp2[0]+XX,_dp2[1]+YY,_dp0[2]);
124
125 //      mp = _manContModel->GetManualPoint(3);
126 //      mp->SetPoint(_dp3[0]+XX,_dp3[1]+YY,_dp0[2]);
127
128         UpdateViewPoint(0);
129         UpdateViewPoint(1);
130 //      UpdateViewPoint(2);
131 //      UpdateViewPoint(3);
132
133 }