Computer Assited Medical Intervention Tool Kit  version 3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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-2014 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 
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
virtual void setRenderingModes(const RenderingModes)=0
::Component * myComponent
the managed Component
Definition: ComponentDC.h:98
A cell has an unique index in the physical model object, is composed by atoms, and different basic pr...
Definition: Cell.h:41
The manager of the physical model data.
Definition: PMManagerDC.h:97
unsigned int nrOfAtoms
nr of atoms
Definition: StructuralComponentDC.h:186
void pointPicked(vtkIdType pointId, bool)
reimplemented to save the last pick point id
setColor
Definition: sdk/libraries/core/component/Component.h:643
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:169
StructuralComponentDCProperties * myProp
the SC DC properties
Definition: StructuralComponentDC.h:224
StructuralComponent * getSC()
convenient methods
Definition: StructuralComponentDC.h:228
setPointSet
Definition: sdk/libraries/core/component/Component.h:547
std::vector< AtomDC * > atomDCs
list of atom DCs.
Definition: StructuralComponentDC.h:208
virtual QObject * getPropertyObject()
show all properties
Definition: ComponentDC.h:85
A Component represents something that could be included in the explorer view, the interactive 3D view...
Definition: sdk/libraries/core/component/Component.h:292
virtual void addChild(InterfaceNode *)
add a child Component (sub item in the hierarchy), and modify the child's parent to be equal to this ...
virtual void initRepresentation()
the concrete building of the 3D objects (Slice/Geometry): none in this case, everything is done by in...
Definition: MeshComponent.h:106
The popup menu of the structural component data component.
Definition: StructuralComponentDCPopup.h:41
The manager of the Component data.
Definition: ComponentDC.h:43
virtual QMenu * getPopupMenu(QWidget *parent=0)
get the popup menu to display (always return NULL, overwrite this method if you want to give here you...
Definition: sdk/libraries/core/component/Component.h:529
The manager of the Atom data.
Definition: AtomDC.h:74
void cellPicked(vtkIdType cellId, bool)
reimplemented to save the last pick point id
virtual void setSelected(const bool b, const bool recursive=true)
Update the selection flag.
const EnhancedModes setActorColor
Definition: sdk/libraries/core/component/Component.h:636
virtual void destroyPointData()
destroy all the point data
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:44
virtual void removeChild(InterfaceNode *)
remove from the the sub item vector.
StructuralComponentDCPopup * myPopupMenu
the popup menu
Definition: StructuralComponentDC.h:199
virtual void setEnhancedModes(const EnhancedModes)=0
set the enhanced mode
A 3D representation of a vtkPointSet to be displayed in a InteractiveViewer, this class implements th...
Definition: Geometry.h:126
virtual void createPointData()
create all the point data to display specific information (only works for SCs that have a surface rep...
virtual QPixmap getIcon()
Get the pixmap that will be displayed for this node.
Definition: sdk/libraries/core/component/Component.h:804
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:48
static QPixmap * myPixmap
the StructuralComponentDC pixmap
Definition: StructuralComponentDC.h:221
vtkSmartPointer< vtkDoubleArray > pointData
the point data array
Definition: StructuralComponentDC.h:189
The class StructuralComponentDCProperties defines an QObject that allows user interaction with proper...
Definition: StructuralComponentDCProperties.h:47