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 "manualViewRotationTool.h"
28 // ----------------------------------------------------------------------------
29 // ----------------------------------------------------------------------------
30 // ----------------------------------------------------------------------------
32 manualViewRotationTool::manualViewRotationTool()
36 // ----------------------------------------------------------------------------
37 manualViewRotationTool::~manualViewRotationTool()
42 // ----------------------------------------------------------------------------
43 manualViewRotationTool * manualViewRotationTool :: Clone()
45 manualViewRotationTool * clone = new manualViewRotationTool();
46 CopyAttributesTo(clone);
50 // ---------------------------------------------------------------------------
51 void manualViewRotationTool::CopyAttributesTo( manualViewRotationTool * cloneObject)
53 manualViewBaseContour::CopyAttributesTo(cloneObject);
56 // ----------------------------------------------------------------------------
57 int manualViewRotationTool::GetType() // virtual
62 // ----------------------------------------------------------------------------
63 void manualViewRotationTool::GetMinMax(double &minX,double &minY, double &maxX, double &maxY)
65 manualPoint *mpA,*mpB;
69 np = GetNumberOfPoints( );
73 mpA = _manContModel->GetManualPoint(0);
74 mpB = _manContModel->GetManualPoint(1);
75 difX = mpA->GetX() - mpB->GetX();
76 difY = mpA->GetY() - mpB->GetY();
77 radio = sqrt( difX*difX + difY*difY );
78 minX=mpA->GetX()-radio;
79 minY=mpA->GetY()-radio;
80 maxX=mpA->GetX()+radio;
81 maxY=mpA->GetY()+radio;
92 // ----------------------------------------------------------------------------
94 void manualViewRotationTool::InitMove(int x, int y, int z) // virtual
100 TransfromCoordViewWorld(XX,YY,ZZ);
102 if (_manContModel->GetSizeLstPoints()==3)
104 mp = _manContModel->GetManualPoint(0);
105 _dp0[0]= mp->GetX() - XX;
106 _dp0[1]= mp->GetY() - YY;
109 mp = _manContModel->GetManualPoint(1);
110 _dp1[0]= mp->GetX() - XX;
111 _dp1[1]= mp->GetY() - YY;
114 mp = _manContModel->GetManualPoint(2);
115 _dp2[0]= mp->GetX() - XX;
116 _dp2[1]= mp->GetY() - YY;
122 // ----------------------------------------------------------------------------
123 void manualViewRotationTool::MoveContour(int x, int y, int z) // virtual
129 TransfromCoordViewWorld(XX,YY,ZZ);
131 mp = _manContModel->GetManualPoint(0);
132 mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
134 mp = _manContModel->GetManualPoint(1);
135 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]);