]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewCircle.cpp
Support #1768 CREATIS Licence insertion
[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 // EED08
34
35 manualViewCircle::manualViewCircle()
36 {
37 //      _sizePointsContour=5;   // default 100
38 }
39 // ----------------------------------------------------------------------------
40 manualViewCircle::~manualViewCircle()
41 {
42 }
43
44
45 // ----------------------------------------------------------------------------
46 manualViewCircle * manualViewCircle :: Clone()
47 {
48         manualViewCircle * clone = new manualViewCircle();
49         CopyAttributesTo(clone);
50         return clone;
51 }
52
53 // ---------------------------------------------------------------------------
54
55 void manualViewCircle::CopyAttributesTo( manualViewCircle * cloneObject)
56 {
57         // Fathers object
58         manualViewBaseContour::CopyAttributesTo(cloneObject);
59 }
60
61
62 // ----------------------------------------------------------------------------
63 int manualViewCircle::GetType() // virtual
64 {
65         return 3;
66 }
67
68 // ----------------------------------------------------------------------------
69
70 void manualViewCircle::GetMinMax(double &minX,double &minY, double &maxX, double &maxY)
71 {
72         manualPoint     *mpA,*mpB;
73     unsigned int  np;
74         double radio;
75         double difX,difY;
76     np  = GetNumberOfPoints( );
77         if (np==2)
78         {
79                 mpA             = _manContModel->GetManualPoint(0);
80                 mpB             = _manContModel->GetManualPoint(1);
81                 difX    = mpA->GetX() - mpB->GetX();
82                 difY    = mpA->GetY() - mpB->GetY();
83                 radio   = sqrt( difX*difX + difY*difY );
84                 minX=mpA->GetX()-radio;
85                 minY=mpA->GetY()-radio;
86                 maxX=mpA->GetX()+radio;
87                 maxY=mpA->GetY()+radio;
88         } else {
89                 minX=0;
90                 maxX=0;
91                 minY=0;
92                 maxY=0;
93         }
94 }
95
96
97 // ----------------------------------------------------------------------------
98
99 void manualViewCircle::InitMove(int x, int y, int z)  // virtual
100 {
101         manualPoint *mp;
102         double XX=x;
103         double YY=y;
104         double ZZ=z;
105         TransfromCoordViewWorld(XX,YY,ZZ);
106
107         if (_manContModel->GetSizeLstPoints()==2){
108                 mp = _manContModel->GetManualPoint(0);
109                 _dp0[0]= mp->GetX() - XX;
110                 _dp0[1]= mp->GetY() - YY;
111                 _dp0[2]= mp->GetZ();
112
113                 mp = _manContModel->GetManualPoint(1);
114                 _dp1[0]= mp->GetX() - XX;
115                 _dp1[1]= mp->GetY() - YY;
116                 _dp1[2]= mp->GetZ();
117 /*
118                 mp = _manContModel->GetManualPoint(2);
119                 _dp2[0]= mp->GetX() - XX;
120                 _dp2[1]= mp->GetY() - YY;
121                 _dp2[2]= mp->GetZ();
122
123                 mp = _manContModel->GetManualPoint(3);
124                 _dp3[0]= mp->GetX() - XX;
125                 _dp3[1]= mp->GetY() - YY;
126                 _dp3[2]= mp->GetZ();
127 */
128         }
129 }
130
131
132 // ----------------------------------------------------------------------------
133 void manualViewCircle::MoveContour(int x, int y, int z) // virtual
134 {
135         manualPoint *mp;
136         double XX=x;
137         double YY=y;
138         double ZZ=z;
139         TransfromCoordViewWorld(XX,YY,ZZ);
140
141         mp = _manContModel->GetManualPoint(0);
142         mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
143
144         mp = _manContModel->GetManualPoint(1);
145         mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]);
146
147 //      mp = _manContModel->GetManualPoint(2);
148 //      mp->SetPoint(_dp2[0]+XX,_dp2[1]+YY,_dp0[2]);
149
150 //      mp = _manContModel->GetManualPoint(3);
151 //      mp->SetPoint(_dp3[0]+XX,_dp3[1]+YY,_dp0[2]);
152
153         UpdateViewPoint(0);
154         UpdateViewPoint(1);
155 //      UpdateViewPoint(2);
156 //      UpdateViewPoint(3);
157
158 }