1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
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
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.
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
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 # ------------------------------------------------------------------------ */
26 #include "manualViewCircle.h"
29 // ----------------------------------------------------------------------------
30 // ----------------------------------------------------------------------------
31 // ----------------------------------------------------------------------------
33 manualViewCircle::manualViewCircle()
35 // _sizePointsContour=5; // default 100
37 // ----------------------------------------------------------------------------
38 manualViewCircle::~manualViewCircle()
42 // ----------------------------------------------------------------------------
43 manualViewCircle * manualViewCircle :: Clone()
45 manualViewCircle * clone = new manualViewCircle();
46 CopyAttributesTo(clone);
50 // ---------------------------------------------------------------------------
51 void manualViewCircle::CopyAttributesTo( manualViewCircle * cloneObject)
54 manualViewBaseContour::CopyAttributesTo(cloneObject);
57 // ----------------------------------------------------------------------------
58 int manualViewCircle::GetType() // virtual
63 // ----------------------------------------------------------------------------
65 void manualViewCircle::GetMinMax(double &minX,double &minY, double &maxX, double &maxY)
67 manualPoint *mpA,*mpB;
71 np = GetNumberOfPoints( );
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;
92 // ----------------------------------------------------------------------------
94 void manualViewCircle::InitMove(int x, int y, int z) // virtual
100 TransfromCoordViewWorld(XX,YY,ZZ);
101 if (_manContModel->GetSizeLstPoints()==2)
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();
112 mp = _manContModel->GetManualPoint(2);
113 _dp2[0]= mp->GetX() - XX;
114 _dp2[1]= mp->GetY() - YY;
116 mp = _manContModel->GetManualPoint(3);
117 _dp3[0]= mp->GetX() - XX;
118 _dp3[1]= mp->GetY() - YY;
124 // ----------------------------------------------------------------------------
125 void manualViewCircle::MoveContour(int x, int y, int z) // virtual
127 printf("EED manualViewCircle::MoveContour %p \n", this);
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]);
143 // UpdateViewPoint(2);
144 // UpdateViewPoint(3);
147 // ----------------------------------------------------------------------------
148 bool manualViewCircle::ShowLineVersion()