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();
37 for (i=0;i<size; i++){
38 delete _copyViewPoints[i];
40 _copyViewPoints.clear();
44 // ----------------------------------------------------------------------------
45 manualViewPoints * manualViewPoints :: Clone()
47 manualViewPoints * clone = new manualViewPoints();
48 CopyAttributesTo(clone);
52 // ---------------------------------------------------------------------------
53 void manualViewPoints::CopyAttributesTo( manualViewPoints * cloneObject)
56 manualViewBaseContour::CopyAttributesTo(cloneObject);
59 // ----------------------------------------------------------------------------
60 int manualViewPoints::GetType() // VIRTUAL
66 // ----------------------------------------------------------------------------
67 bool manualViewPoints::ifTouchContour(int x,int y,int z) //VIRTUAL
73 TransfromCoordViewWorld(xx,yy,zz);
80 int id = _manContModel->GetIdPoint(xx,yy,zz,_range,2);
90 // ----------------------------------------------------------------------------
91 void manualViewPoints::Refresh() // VIRTUAL
94 manualViewBaseContour::Refresh();
97 // ----------------------------------------------------------------------------
98 void manualViewPoints::RefreshContour() // VIRTUAL
100 int np = GetNumberOfPoints();
101 int copynp= _copyViewPoints.size();
107 manualViewPoint *mvp = new manualViewPoint(_wxvtkbaseview);
108 vtkActor *actor = mvp->CreateVtkPointActor();
109 _wxvtkbaseview->GetRenderer()->AddActor( actor );
111 _copyViewPoints.push_back(mvp);
115 manualViewPoint *t = _copyViewPoints[0];
116 _wxvtkbaseview->GetRenderer()->RemoveActor( t->GetVtkActor() );
117 std::vector<manualViewPoint*>::iterator itNum = _copyViewPoints.begin();
118 _copyViewPoints.erase(itNum);
121 copynp= _copyViewPoints.size();
128 double xx = _manContModel->GetManualPoint(i)->GetX();
129 double yy = _manContModel->GetManualPoint(i)->GetY();
132 //EED 21 mars 2012 FLIP probleme ..PLOP..
133 // double zz = 900; // RaC REVISAR !!
135 double zz = -900; // RaC REVISAR !!
137 manualViewPoint *mv = _copyViewPoints[i];
139 //Paints new Rectangular points bigger than the actual control points
140 mv->SetPositionXY(xx, yy, _range*2, zz);
142 vtkActor *_pointVtkActor = mv->GetVtkActor();
144 _pointVtkActor->GetProperty()->SetDiffuseColor( _coulorNormal_r , _coulorNormal_g , _coulorNormal_b );
145 if (_posibleSelected || (_posibleSelected && GetEditable() ) )
147 _pointVtkActor->GetProperty()->SetDiffuseColor( _coulorEdit_r , _coulorEdit_g , _coulorEdit_b );
151 _pointVtkActor->GetProperty()->SetDiffuseColor( _coulorSelection_r , _coulorSelection_g , _coulorSelection_b );
154 //IF you want to customize the points which are going to be painted
155 //mv->UpdateColorActor(_colorViewPoints_r,_colorViewPoints_g,_colorViewPoints_b);
156 //mv->SetWidthLine(1.3);
160 // ----------------------------------------------------------------------------
161 void manualViewPoints::ConstructVTKObjects() // VIRTUAL
166 // ----------------------------------------------------------------------------
167 void manualViewPoints::AddSplineActor() // VIRTUAL
169 int i,size=_copyViewPoints.size();
172 _wxvtkbaseview->GetRenderer()->AddActor( _copyViewPoints[i]->GetVtkActor() );
176 // ----------------------------------------------------------------------------
177 void manualViewPoints::RemoveSplineActor() // VIRTUAL
179 int i,size=_copyViewPoints.size();
182 _wxvtkbaseview->GetRenderer()->RemoveActor(_copyViewPoints[i]->GetVtkActor());