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 // ----------------------------------------------------------------------------
35 manualViewCircle::manualViewCircle()
37 // _sizePointsContour=5; // default 100
39 // ----------------------------------------------------------------------------
40 manualViewCircle::~manualViewCircle()
45 // ----------------------------------------------------------------------------
46 manualViewCircle * manualViewCircle :: Clone()
48 manualViewCircle * clone = new manualViewCircle();
49 CopyAttributesTo(clone);
53 // ---------------------------------------------------------------------------
55 void manualViewCircle::CopyAttributesTo( manualViewCircle * cloneObject)
58 manualViewBaseContour::CopyAttributesTo(cloneObject);
62 // ----------------------------------------------------------------------------
63 int manualViewCircle::GetType() // virtual
68 // ----------------------------------------------------------------------------
70 void manualViewCircle::GetMinMax(double &minX,double &minY, double &maxX, double &maxY)
72 manualPoint *mpA,*mpB;
76 np = GetNumberOfPoints( );
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;
97 // ----------------------------------------------------------------------------
99 void manualViewCircle::InitMove(int x, int y, int z) // virtual
105 TransfromCoordViewWorld(XX,YY,ZZ);
107 if (_manContModel->GetSizeLstPoints()==2){
108 mp = _manContModel->GetManualPoint(0);
109 _dp0[0]= mp->GetX() - XX;
110 _dp0[1]= mp->GetY() - YY;
113 mp = _manContModel->GetManualPoint(1);
114 _dp1[0]= mp->GetX() - XX;
115 _dp1[1]= mp->GetY() - YY;
118 mp = _manContModel->GetManualPoint(2);
119 _dp2[0]= mp->GetX() - XX;
120 _dp2[1]= mp->GetY() - YY;
123 mp = _manContModel->GetManualPoint(3);
124 _dp3[0]= mp->GetX() - XX;
125 _dp3[1]= mp->GetY() - YY;
132 // ----------------------------------------------------------------------------
133 void manualViewCircle::MoveContour(int x, int y, int z) // virtual
139 TransfromCoordViewWorld(XX,YY,ZZ);
141 mp = _manContModel->GetManualPoint(0);
142 mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
144 mp = _manContModel->GetManualPoint(1);
145 mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]);
147 // mp = _manContModel->GetManualPoint(2);
148 // mp->SetPoint(_dp2[0]+XX,_dp2[1]+YY,_dp0[2]);
150 // mp = _manContModel->GetManualPoint(3);
151 // mp->SetPoint(_dp3[0]+XX,_dp3[1]+YY,_dp0[2]);
155 // UpdateViewPoint(2);
156 // UpdateViewPoint(3);