Computer Assited Medical Intervention Tool Kit  version 4.0
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-2016 Univ. Grenoble Alpes, 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 
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 
84  Q_OBJECT
85 public:
93  StructuralComponentDC(camitk::Component *parent, PMManagerDC * pmManagerDC, StructuralComponent *sc, bool delayRepresentationInit = false);
94 
96  virtual ~StructuralComponentDC();
97 
103  virtual QPixmap getIcon();
105 
107  virtual void setPointSet(vtkSmartPointer<vtkPointSet>);
108 
110  virtual void cellPicked(vtkIdType, bool);
111 
113  virtual void pointPicked(vtkIdType, bool);
114 
116  virtual void setSelected(const bool, const bool recursive=false);
117 
119  virtual void setEnhancedModes(const EnhancedModes);
120 
122  virtual void setRenderingModes(const RenderingModes);
123 
124  virtual void setActorColor(const RenderingModes, const double, const double, const double);
125 
126  virtual void setActorColor(const RenderingModes, double[4]);
127 
128  virtual void setColor(const double, const double, const double);
129 
130  virtual void setColor(const double, const double, const double, const double);
131 
133  virtual void addChild(InterfaceNode *);
134 
136  virtual void removeChild(InterfaceNode *);
137 
139  virtual QMenu * getPopupMenu(QWidget* parent);
140 
142  virtual QObject * getPropertyObject();
144 
152  void updatePosition(AtomDC *, int atomOrderNr = -1);
153 
158  virtual void createPointData();
159 
161  virtual void destroyPointData();
162 
165  static vtkSmartPointer<vtkUnstructuredGrid> structuralComponentToVtk(StructuralComponent *, std::AtomVtkPointsIndexMap *);
166 
169  static vtkSmartPointer<vtkUnstructuredGrid> structuralComponentToVtk(StructuralComponent *);
170 
172  StructuralComponent *getSC();
173 
175  StructuralComponent::ComposedBy composedBy();
176 
178  camitk::Geometry * cellsToGeometry();
179 
181  void updateAtoms();
182 
183 protected:
184 
186  unsigned int nrOfAtoms;
187 
189  vtkSmartPointer<vtkDoubleArray> pointData;
190 
191 private:
193  camitk::Geometry * atomsToGeometry();
194 
196  virtual void initRepresentation();
197 
200 
208  std::vector <AtomDC *> atomDCs;
209 
215  unsigned int nrOfParts;
216 
218  std::vector <unsigned int> cellIdToBeRemoved;
219 
221  static QPixmap * myPixmap;
222 
225 
226 };
227 
229  return dynamic_cast<StructuralComponent *>(myComponent);
230 }
231 #endif
std::pair< Atom *, unsigned int > AtomVtkPointsIndexPair
definition of a couple (=STL pair) [Atom *, unsigned int] this associates an atom to its index in the...
Definition: StructuralComponentDC.h:62
A cell has an unique index in the physical model object, is composed by atoms, and different basic pr...
Definition: Cell.h:46
The manager of the physical model data.
Definition: PMManagerDC.h:97
unsigned int nrOfAtoms
nr of atoms
Definition: StructuralComponentDC.h:186
STL namespace.
unsigned int nrOfParts
cumulative nr of cell and points.
Definition: StructuralComponentDC.h:215
#define PHYSICALMODEL_COMPONENT_API
Definition: PMComponentAPI.h:54
ComposedBy
What this structural component is made of.
Definition: StructuralComponent.h:173
StructuralComponentDCProperties * myProp
the SC DC properties
Definition: StructuralComponentDC.h:224
StructuralComponent * getSC()
convenient methods
Definition: StructuralComponentDC.h:228
std::vector< AtomDC * > atomDCs
list of atom DCs.
Definition: StructuralComponentDC.h:208
A Component represents something that could be included in the explorer view, the interactive 3D view...
Definition: sdk/libraries/core/component/Component.h:299
std::map< Atom *, unsigned int >::iterator AtomVtkPointsIndexMapIterator
the iterator corresponding to the AtomVtkPointsMap
Definition: StructuralComponentDC.h:70
The popup menu of the structural component data component.
Definition: StructuralComponentDCPopup.h:41
The manager of the Component data.
Definition: ComponentDC.h:43
The manager of the Atom data.
Definition: AtomDC.h:74
The manager of the Structural component data.
Definition: StructuralComponentDC.h:83
An atom has an unique index in the physical model object, a 3D position, and different basic properti...
Definition: Atom.h:49
StructuralComponentDCPopup * myPopupMenu
the popup menu
Definition: StructuralComponentDC.h:199
A 3D representation of a vtkPointSet to be displayed in a InteractiveViewer, this class implements th...
Definition: Geometry.h:126
static QPixmap * myPixmap
the StructuralComponentDC pixmap
Definition: StructuralComponentDC.h:221
std::vector< unsigned int > cellIdToBeRemoved
cell ids in the vtk structures to be removed
Definition: StructuralComponentDC.h:218
A structural component is composed either by cell or by atoms.
Definition: StructuralComponent.h:52
vtkSmartPointer< vtkDoubleArray > pointData
the point data array
Definition: StructuralComponentDC.h:189
std::map< Atom *, unsigned int > AtomVtkPointsIndexMap
definition of the association map (=STL map) AtomVtkPointsIndexMap.
Definition: StructuralComponentDC.h:68
The class StructuralComponentDCProperties defines an QObject that allows user interaction with proper...
Definition: StructuralComponentDCProperties.h:47