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 "manualViewPoints.h"
28 // ----------------------------------------------------------------------------
29 manualViewPoints::manualViewPoints()
33 // ----------------------------------------------------------------------------
34 manualViewPoints::~manualViewPoints()
36 int i,size=_copyViewPoints.size();
39 delete _copyViewPoints[i];
41 _copyViewPoints.clear();
45 // ----------------------------------------------------------------------------
46 manualViewPoints * manualViewPoints::Clone()
48 manualViewPoints * clone = new manualViewPoints();
49 CopyAttributesTo(clone);
53 // ---------------------------------------------------------------------------
54 void manualViewPoints::CopyAttributesTo( manualViewPoints * cloneObject)
57 manualViewBaseContour::CopyAttributesTo(cloneObject);
60 // ----------------------------------------------------------------------------
61 int manualViewPoints::GetType() // VIRTUAL
67 // ----------------------------------------------------------------------------
68 bool manualViewPoints::ifTouchContour(int x,int y,int z) //VIRTUAL
74 TransfromCoordViewWorld(xx,yy,zz);
81 int id = _manContModel->GetIdPoint(xx,yy,zz,_range,2);
92 // ----------------------------------------------------------------------------
93 void manualViewPoints::Refresh() // VIRTUAL
96 manualViewBaseContour::Refresh();
99 // ----------------------------------------------------------------------------
100 void manualViewPoints::RefreshContour() // VIRTUAL
102 int np = GetNumberOfPoints();
103 int copynp= _copyViewPoints.size();
110 manualViewPoint *mvp = new manualViewPoint(_wxvtkbaseview);
111 vtkActor *actor = mvp->CreateVtkPointActor();
112 _wxvtkbaseview->GetRenderer()->AddActor( actor );
114 _copyViewPoints.push_back(mvp);
118 manualViewPoint *t = _copyViewPoints[0];
119 _wxvtkbaseview->GetRenderer()->RemoveActor( t->GetVtkActor() );
120 std::vector<manualViewPoint*>::iterator itNum = _copyViewPoints.begin();
121 _copyViewPoints.erase(itNum);
124 copynp= _copyViewPoints.size();
131 double xx = _manContModel->GetManualPoint(i)->GetX();
132 double yy = _manContModel->GetManualPoint(i)->GetY();
135 //EED 21 mars 2012 FLIP probleme ..PLOP..
136 // double zz = 900; // RaC REVISAR !!
138 double zz = -900; // RaC REVISAR !!
140 manualViewPoint *mv = _copyViewPoints[i];
142 //Paints new Rectangular points bigger than the actual control points
143 mv->SetPositionXY(xx, yy, _range*2, zz);
145 vtkActor *_pointVtkActor = mv->GetVtkActor();
147 _pointVtkActor->GetProperty()->SetDiffuseColor( _coulorNormal_r , _coulorNormal_g , _coulorNormal_b );
148 if (_posibleSelected || (_posibleSelected && GetEditable() ) )
150 _pointVtkActor->GetProperty()->SetDiffuseColor( _coulorEdit_r , _coulorEdit_g , _coulorEdit_b );
154 _pointVtkActor->GetProperty()->SetDiffuseColor( _coulorSelection_r , _coulorSelection_g , _coulorSelection_b );
157 //IF you want to customize the points which are going to be painted
158 //mv->UpdateColorActor(_colorViewPoints_r,_colorViewPoints_g,_colorViewPoints_b);
159 //mv->SetWidthLine(1.3);
163 // ----------------------------------------------------------------------------
164 void manualViewPoints::ConstructVTKObjects() // VIRTUAL
169 // ----------------------------------------------------------------------------
170 void manualViewPoints::AddSplineActor() // VIRTUAL
172 int i,size=_copyViewPoints.size();
175 _wxvtkbaseview->GetRenderer()->AddActor( _copyViewPoints[i]->GetVtkActor() );
179 // ----------------------------------------------------------------------------
180 void manualViewPoints::RemoveSplineActor() // VIRTUAL
182 int i,size=_copyViewPoints.size();
185 _wxvtkbaseview->GetRenderer()->RemoveActor(_copyViewPoints[i]->GetVtkActor());