Computer Assited Medical Intervention Tool Kit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
StructuralComponentDC.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 StructuralComponentDC_H
27 #define StructuralComponentDC_H
28 
29 #include <pml/StructuralComponent.h>
30 
31 #include "ComponentDC.h"
32 #include "PMComponentAPI.h"
33 #include <algorithm>
34 
35 #include <vtkSmartPointer.h>
36 
38 class QPixmap;
39 
40 class QMenu;
41 
42 class PMManagerDC;
43 
44 class Atom;
45 
46 class AtomDC;
47 
48 class Cell;
49 
50 class vtkUnstructuredGrid;
51 
53 
55 
56 class vtkDoubleArray;
57 
58 namespace std {
62 typedef std::pair<Atom *, unsigned int> AtomVtkPointsIndexPair;
68 typedef std::map <Atom *, unsigned int> AtomVtkPointsIndexMap;
70 typedef std::map <Atom *, unsigned int>::iterator AtomVtkPointsIndexMapIterator;
71 }
72 
81  Q_OBJECT
82  public:
90  StructuralComponentDC(camitk::Component *parent, PMManagerDC * pmManagerDC, StructuralComponent *sc, bool delayRepresentationInit = false);
91 
93  virtual ~StructuralComponentDC();
94 
100 
101  virtual QPixmap getIcon();
102 
104  virtual void setPointSet(vtkSmartPointer<vtkPointSet>);
105 
107  virtual void cellPicked(vtkIdType, bool);
108 
110  virtual void pointPicked(vtkIdType, bool);
111 
113  virtual void setSelected(const bool, const bool recursive=false);
114 
116  virtual void setEnhancedModes(const EnhancedModes);
117 
119  virtual void setRenderingModes(const RenderingModes);
120 
121  virtual void setActorColor(const RenderingModes, const double, const double, const double);
122 
123  virtual void setActorColor(const RenderingModes, double[4]);
124 
125  virtual void setColor(const double, const double, const double);
126 
127  virtual void setColor(const double, const double, const double, const double);
128 
130  virtual void addChild(InterfaceNode *);
131 
133  virtual void removeChild(InterfaceNode *);
134 
136  virtual QMenu * getPopupMenu(QWidget* parent);
137 
139  virtual QObject * getPropertyObject();
141 
149  void updatePosition(AtomDC *, int atomOrderNr = -1);
150 
155  virtual void createPointData();
156 
158  virtual void destroyPointData();
159 
162  static vtkSmartPointer<vtkUnstructuredGrid> structuralComponentToVtk(StructuralComponent *, std::AtomVtkPointsIndexMap *);
163 
166  static vtkSmartPointer<vtkUnstructuredGrid> structuralComponentToVtk(StructuralComponent *);
167 
169  StructuralComponent *getSC();
170 
172  StructuralComponent::ComposedBy composedBy();
173 
175  Geometry * cellsToGeometry();
176 
178  void updateAtoms();
179 
180 protected:
181 
183  unsigned int nrOfAtoms;
184 
186  vtkSmartPointer<vtkDoubleArray> pointData;
187 
188  private:
190  Geometry * atomsToGeometry();
191 
193  virtual void initRepresentation();
194 
197 
205  std::vector <AtomDC *> atomDCs;
206 
212  unsigned int nrOfParts;
213 
215  std::vector <unsigned int> cellIdToBeRemoved;
216 
218  static QPixmap * myPixmap;
219 
222 
223 };
224 
225 inline StructuralComponent * StructuralComponentDC::getSC() {
226  return dynamic_cast<StructuralComponent *>(myComponent);
227 }
228 #endif