]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewCircle.cpp
#3138 creaMaracasVisu Feature New Normal - branch vtk7itk4wx3
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / manualContour / manualViewCircle.cpp
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 #                        pour la Sant�)
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8 #
9 #  This software is governed by the CeCILL-B license under French law and
10 #  abiding by the rules of distribution of free software. You can  use,
11 #  modify and/ or redistribute the software under the terms of the CeCILL-B
12 #  license as circulated by CEA, CNRS and INRIA at the following URL
13 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 #  or in the file LICENSE.txt.
15 #
16 #  As a counterpart to the access to the source code and  rights to copy,
17 #  modify and redistribute granted by the license, users are provided only
18 #  with a limited warranty  and the software's author,  the holder of the
19 #  economic rights,  and the successive licensors  have only  limited
20 #  liability.
21 #
22 #  The fact that you are presently reading this means that you have had
23 #  knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
25
26 #include "manualViewCircle.h"
27
28
29 // ----------------------------------------------------------------------------
30 // ----------------------------------------------------------------------------
31 // ----------------------------------------------------------------------------
32
33 manualViewCircle::manualViewCircle()
34 {
35 //      _sizePointsContour=5;   // default 100
36 }
37 // ----------------------------------------------------------------------------
38 manualViewCircle::~manualViewCircle()
39 {
40 }
41
42 // ----------------------------------------------------------------------------
43 manualViewCircle * manualViewCircle :: Clone()
44 {
45         manualViewCircle * clone = new manualViewCircle();
46         CopyAttributesTo(clone);
47         return clone;
48 }
49
50 // ---------------------------------------------------------------------------
51 void manualViewCircle::CopyAttributesTo( manualViewCircle * cloneObject)
52 {
53         // Fathers object
54         manualViewBaseContour::CopyAttributesTo(cloneObject);
55 }
56
57 // ----------------------------------------------------------------------------
58 int manualViewCircle::GetType() // virtual
59 {
60         return 3;
61 }
62
63 // ----------------------------------------------------------------------------
64
65 void manualViewCircle::GetMinMax(double &minX,double &minY, double &maxX, double &maxY)
66 {
67         manualPoint     *mpA,*mpB;
68     unsigned int  np;
69         double radio;
70         double difX,difY;
71     np  = GetNumberOfPoints( );
72         if (np==2)
73         {
74                 mpA             = _manContModel->GetManualPoint(0);
75                 mpB             = _manContModel->GetManualPoint(1);
76                 difX    = mpA->GetX() - mpB->GetX();
77                 difY    = mpA->GetY() - mpB->GetY();
78                 radio   = sqrt( difX*difX + difY*difY );
79                 minX=mpA->GetX()-radio;
80                 minY=mpA->GetY()-radio;
81                 maxX=mpA->GetX()+radio;
82                 maxY=mpA->GetY()+radio;
83         } else {
84                 minX    = 0;
85                 maxX    = 0;
86                 minY    = 0;
87                 maxY    = 0;
88         } // if np
89 }
90
91
92 // ----------------------------------------------------------------------------
93
94 void manualViewCircle::InitMove(int x, int y, int z)  // virtual
95 {
96         manualPoint *mp;
97         double          XX = x;
98         double          YY = y;
99         double          ZZ = z;
100         TransfromCoordViewWorld(XX,YY,ZZ);
101         if (_manContModel->GetSizeLstPoints()==2)
102         {
103                 mp = _manContModel->GetManualPoint(0);
104                 _dp0[0] = mp->GetX() - XX;
105                 _dp0[1] = mp->GetY() - YY;
106                 _dp0[2] = mp->GetZ();
107                 mp              = _manContModel->GetManualPoint(1);
108                 _dp1[0] = mp->GetX() - XX;
109                 _dp1[1] = mp->GetY() - YY;
110                 _dp1[2] = mp->GetZ();
111 /*
112                 mp = _manContModel->GetManualPoint(2);
113                 _dp2[0]= mp->GetX() - XX;
114                 _dp2[1]= mp->GetY() - YY;
115                 _dp2[2]= mp->GetZ();
116                 mp = _manContModel->GetManualPoint(3);
117                 _dp3[0]= mp->GetX() - XX;
118                 _dp3[1]= mp->GetY() - YY;
119                 _dp3[2]= mp->GetZ();
120 */
121         } // if 
122 }
123
124 // ----------------------------------------------------------------------------
125 void manualViewCircle::MoveContour(int x, int y, int z) // virtual
126 {
127 printf("EED  manualViewCircle::MoveContour %p \n", this);
128         manualPoint *mp;
129         double XX=x;
130         double YY=y;
131         double ZZ=z;
132         TransfromCoordViewWorld(XX,YY,ZZ);
133         mp = _manContModel->GetManualPoint(0);
134         mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
135         mp = _manContModel->GetManualPoint(1);
136         mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]);
137 //      mp = _manContModel->GetManualPoint(2);
138 //      mp->SetPoint(_dp2[0]+XX,_dp2[1]+YY,_dp0[2]);
139 //      mp = _manContModel->GetManualPoint(3);
140 //      mp->SetPoint(_dp3[0]+XX,_dp3[1]+YY,_dp0[2]);
141         UpdateViewPoint(0);
142         UpdateViewPoint(1);
143 //      UpdateViewPoint(2);
144 //      UpdateViewPoint(3);
145 }
146
147 // ----------------------------------------------------------------------------
148 bool manualViewCircle::ShowLineVersion()
149 {
150         return false;
151 }
152
153