Computer Assited Medical Intervention Tool Kit  version 3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Geometry.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2013 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
6  *
7  * Visit http://camitk.imag.fr for more information
8  *
9  * This file is part of CamiTK.
10  *
11  * CamiTK is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * CamiTK is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License version 3 for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22  *
23  * $CAMITK_LICENCE_END$
24  ****************************************************************************/
25 
26 #ifndef GEOMETRY_H
27 #define GEOMETRY_H
28 
29 // -- Core stuff
30 #include "CamiTKAPI.h"
31 #include "InterfaceGeometry.h"
32 
33 #include <QMap>
34 
35 //-- VTK Classes
36 class vtkPointSet;
37 class vtkAlgorithmOutput;
38 class vtkDataSetMapper;
39 class vtkActor;
40 class vtkProp;
41 class vtkTexture;
42 class vtkGlyph3D;
43 class vtkTransform;
44 class vtkTubeFilter;
45 class vtkCastToConcrete;
46 class vtkTextMapper;
47 class vtkSphereSource;
48 
49 namespace camitk
50 {
124 
125  public:
137  Geometry(QString label, vtkSmartPointer<vtkPointSet> pointSet, const InterfaceGeometry::RenderingModes mode = InterfaceGeometry::Surface);
138 
140  virtual ~Geometry();
141 
143  virtual const QString getLabel() const {
144  return label;
145  }
146 
148  virtual void setLabel(QString newName) {
149  label = newName;
150  updateLabel();
151  }
152 
157  virtual vtkSmartPointer<vtkPointSet> getPointSet() {
160  return pointSet;
161  }
162 
164  virtual void setPointSet(vtkSmartPointer<vtkPointSet> ds);
165 
167  virtual vtkSmartPointer<vtkAlgorithmOutput> getDataPort() const {
168  return dataOutput;
169  }
170 
172  virtual void setDataConnection(vtkSmartPointer<vtkAlgorithmOutput>);
173 
175  virtual void setPointData(vtkSmartPointer<vtkDataArray>);
176 
181  virtual vtkSmartPointer<vtkActor> getActor(const RenderingModes);
182 
184  virtual vtkSmartPointer<vtkProp> getProp(const QString &);
185 
187  virtual unsigned int getNumberOfProp() const;
188 
190  virtual vtkSmartPointer<vtkProp> getProp(unsigned int);
191 
195  virtual bool addProp(const QString &, vtkSmartPointer<vtkProp>);
196 
200  virtual bool removeProp(const QString &);
201 
203  virtual void setTexture(vtkSmartPointer<vtkTexture> texture);
204 
206  virtual void pointPicked(vtkIdType, bool) {};
207 
209  virtual void cellPicked(vtkIdType, bool) {};
210 
212 
215 
217  virtual void getBounds(double bounds[6]);
218 
220  virtual double getBoundingRadius();
221 
223  virtual void setPointPosition(const unsigned int orderNumber, const double x, const double y, const double z);
224 
226 
227 
230 
232  virtual void setRenderingModes(const RenderingModes rMode) { renderingModes = rMode; }
233 
235  virtual const RenderingModes getRenderingModes() const { return renderingModes; }
236 
238  virtual void setEnhancedModes(const EnhancedModes );
239 
241  virtual const EnhancedModes getEnhancedModes() const { return enhancedModes; }
242 
244  virtual void setActorColor(const RenderingModes, double [4]);
245 
247  virtual void setActorColor(const RenderingModes, const double, const double, const double);
248 
250  virtual void getActorColor(const RenderingModes, double [4]);
251 
253  virtual void setColor(const double, const double, const double);
254 
256  virtual void setColor(const double, const double, const double, const double);
257 
259  virtual void setActorOpacity(const RenderingModes, const double);
260 
262  virtual double getActorOpacity(const RenderingModes) const;
263 
265  virtual void setOpacity(const double);
266 
268  virtual void setGlyphType(const GlyphTypes type, const double size = 0.0);
269 
271  virtual void setLinesAsTubes(bool tubes = false);
272 
274 
275 
276  private:
277 
280  vtkSmartPointer<vtkPointSet> pointSet;
283 
285  vtkSmartPointer<vtkAlgorithmOutput> dataOutput;
286 
288  vtkSmartPointer<vtkAlgorithmOutput> customPipelineOutput;
289 
291  vtkSmartPointer<vtkCastToConcrete> concreteData;
292 
294  vtkSmartPointer<vtkDataSetMapper> mapper;
295 
297  QMap<QString, vtkSmartPointer<vtkProp> > extraProp;
298 
300  vtkSmartPointer<vtkTextMapper> labelActorMapper;
301 
303  vtkSmartPointer<vtkActor> surfaceActor;
304 
306  vtkSmartPointer<vtkActor> wireframeActor;
307 
309  vtkSmartPointer<vtkActor> pointsActor;
310 
312  vtkSmartPointer<vtkTexture> texture;
313 
315  vtkSmartPointer<vtkTubeFilter> tube;
317 
321  InterfaceGeometry::RenderingModes renderingModes;
322 
324  InterfaceGeometry::EnhancedModes enhancedModes;
325 
327  double alphaShaded;
328 
330  QString label;
331 
333  double glyphSize;
334 
336  void buildLabel();
337 
339  void updateLabel();
340 
342  void buildGlyph(const GlyphTypes type);
343 
345  vtkSmartPointer<vtkSphereSource> sphereGeom;
347 
351  double surfaceColor[4];
353  double wireframeColor[4];
354  double pointsColor[4];
356 
362  double oldPointsColor[4];
364 protected:
365  vtkSmartPointer< vtkPointSet > New();
366 };
367 
368 
369 
370 }
371 
372 #endif