Computer Assited Medical Intervention Tool Kit  version 3.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
PMManagerDC.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 PMManagerDC_H
27 #define PMManagerDC_H
28 
29 // camitk
30 #include <MeshComponent.h>
31 #include <InterfaceGeometry.h>
32 #include <Geometry.h>
33 
34 #include "PMComponentAPI.h"
35 
36 // pml classes
37 class PhysicalModel;
38 #include <pml/Component.h>
39 #include <pml/MultiComponent.h>
41 class Atom;
42 class Cell;
43 #include <pml/RenderingMode.h>
44 
45 // CamiTK component classes
46 class ComponentDC;
47 class MultiComponentDC;
49 class AtomDC;
50 class CellDC;
51 
52 class LoadsManager;
53 class PMManagerDCPopup;
54 class AtomDCWidget;
55 
56 namespace std {
60 typedef std::pair< ::Component *, ComponentDC *> ComponentDCPair;
68 typedef std::map < ::Component *, ComponentDC *> ComponentDCMap;
70 typedef std::map < ::Component *, ComponentDC *>::iterator ComponentDCMapIterator;
71 
75 typedef std::pair<Atom *, AtomDC *> AtomDCPair;
81 typedef std::map <Atom *, AtomDC *> AtomDCMap;
83 typedef std::map <Atom *, AtomDC *>::iterator AtomDCMapIterator;
84 }
98  Q_OBJECT
99 public:
101  PMManagerDC(const QString &) throw(camitk::AbortException);
102 
104  PMManagerDC(PhysicalModel *, const QString &);
105 
107  virtual ~PMManagerDC();
108 
110  bool getModified() const;
111 
113  virtual void setName(const QString &);
114 
116  virtual QMenu * getPopupMenu(QWidget* parent);
117 
119  void progressOneStep();
120 
122  virtual QPixmap getIcon();
123 
135  void createPointData();
136 
138  void destroyPointData();
139 
143 
145  PhysicalModel *getPhysicalModel();
146 
148  virtual double getBoundingRadius();
149 
151  virtual void getBounds(double bounds[6]);
152 
154  void computeBoundingRadius();
155 
157  InterfaceGeometry::RenderingModes toDCRenderingMode(::RenderingMode::Mode);
158 
160  ::RenderingMode::Mode toPMRenderingMode(camitk::InterfaceGeometry::RenderingModes);
161 
163  ComponentDC * getDC(::Component *);
164 
166  MultiComponentDC * getDC(MultiComponent *);
167 
170 
172  CellDC * getDC(Cell *);
173 
175  AtomDC * getDC(Atom *);
176 
178  void addMultiComponentDCPair(std::ComponentDCPair);
179 
181  void addStructuralComponentDCPair(std::ComponentDCPair);
182 
184  void addCellDCPair(std::ComponentDCPair);
185 
187  void addAtomDCPair(std::AtomDCPair);
188 
190  virtual vtkSmartPointer< vtkPointSet > getPointSet();
192 
195 
199  QWidget *getAtomDCWidget(AtomDC *adc = NULL, QWidget *parent = NULL);
200 
202  LoadsManager * getLoadsManager();
203 
205 
206 private:
207 
209  void buildPhysicalModelDCs();
210 
214  virtual void initRepresentation();
215 
217  unsigned int nrOfDoneSteps;
218 
220  unsigned int nrOfSteps;
221 
224 
226  static QPixmap * myPixmap;
227 
229  std::ComponentDCMap myMCDCMap;
230 
232  std::ComponentDCMap mySCDCMap;
233 
235  std::ComponentDCMap myCDCMap;
236 
238  std::AtomDCMap myADCMap;
239 
242 
245 
248 
251 };
252 
253 
254 // -------------------- getPhysicalModel --------------------
256  return myPM;
257 }
258 
259 // -------------------- getBoundingRadius --------------------
261  return initialBoundingRadius;
262 }
263 
264 // -------------------- getLoadsManager --------------------
266  return myLoadsManager;
267 }
268 
269 // -------------------- C / DC Map --------------------
271  if (mc->isInstanceOf("StructuralComponent"))
272  return (ComponentDC *) getDC(dynamic_cast<StructuralComponent *>(mc));
273  else if (mc->isInstanceOf("MultiComponent"))
274  return (ComponentDC *) getDC(dynamic_cast<MultiComponent *>(mc));
275  else
276  return NULL;
277 }
278 
279 // -------------------- MC / DC Map --------------------
280 inline void PMManagerDC::addMultiComponentDCPair(std::ComponentDCPair p) {
281  myMCDCMap.insert(p);
282 }
283 
284 // -------------------- SC / DC Map --------------------
285 inline void PMManagerDC::addStructuralComponentDCPair(std::ComponentDCPair p) {
286  mySCDCMap.insert(p);
287 }
288 
289 // -------------------- Atom / DC Map --------------------
290 inline void PMManagerDC::addAtomDCPair(std::AtomDCPair p) {
291  myADCMap.insert(p);
292 }
293 
295  if (!a)
296  return NULL;
297  std::AtomDCMapIterator result = myADCMap.find(a);
298  return (result == myADCMap.end()) ? NULL : (result->second);
299 }
300 
301 
302 #endif
double initialBoundingRadius
the bounding sphere radius calculated just after the PML is loaded
Definition: PMManagerDC.h:250
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
virtual double getBoundingRadius()
compute the object's bounding sphere radius,
Definition: sdk/libraries/core/component/Component.cpp:501
The class AtomDCWidget defines a widget controling the properties of an instance of an AtomDC...
Definition: AtomDCWidget.h:57
LoadsManager * getLoadsManager()
get the load manager
Definition: PMManagerDC.h:265
Exception class to handle abortion in component instanciation.
Definition: AbortException.h:43
The popup menu of the Physical Manager data component.
Definition: PMManagerDCPopup.h:43
std::ComponentDCMap mySCDCMap
the SC / DC map
Definition: PMManagerDC.h:232
STL namespace.
#define PHYSICALMODEL_COMPONENT_API
Definition: PMComponentAPI.h:54
void addAtomDCPair(std::AtomDCPair)
add the A/DC pair
Definition: PMManagerDC.h:290
std::ComponentDCMap myMCDCMap
the MC / DC map
Definition: PMManagerDC.h:229
Basic component to manage any kind of mesh.
Definition: MeshComponent.h:48
The manager of the MultiComponent data.
Definition: MultiComponentDC.h:50
virtual bool isInstanceOf(const char *) const =0
pure virtual method, implemented in the child-class
PhysicalModel * getPhysicalModel()
get the current managed PhysicalModel
Definition: PMManagerDC.h:255
Mode
This is a duplicate of RenderingMode Mode....
Definition: RenderingMode.h:40
virtual void initRepresentation()
the concrete building of the 3D objects (Slice/Geometry): none in this case, everything is done by in...
Definition: MeshComponent.h:205
The manager of the Component data.
Definition: ComponentDC.h:43
This class manages the applied all loads (see LML), deformation add-on, atom data monitoring and atom...
Definition: LoadsManager.h:69
PMManagerDCPopup * myPopupMenu
the popup menu
Definition: PMManagerDC.h:223
static QPixmap * myPixmap
the PMManagerDC icon
Definition: PMManagerDC.h:226
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:565
The manager of the Atom data.
Definition: AtomDC.h:74
void addStructuralComponentDCPair(std::ComponentDCPair)
add the SC/DC pair
Definition: PMManagerDC.h:285
AtomDCWidget * myAtomDCWidget
the atomdc widget
Definition: PMManagerDC.h:241
void addMultiComponentDCPair(std::ComponentDCPair)
add the MC/DC pair
Definition: PMManagerDC.h:280
LoadsManager * myLoadsManager
the load manager
Definition: PMManagerDC.h:247
A component is something that composed something and could also be a part of something.
Definition: modeling/libraries/pml/Component.h:48
The manager of the Structural component data.
Definition: StructuralComponentDC.h:83
virtual bool getModified() const
set the modified flag
Definition: sdk/libraries/core/component/Component.h:959
An atom has an unique index in the physical model object, a 3D position, and different basic properti...
Definition: Atom.h:44
ComponentDC * getDC(::Component *)
get the DC of a particular Component
Definition: PMManagerDC.h:270
This is the main class of this project.
Definition: PhysicalModel.h:74
virtual double getBoundingRadius()
get the bounding sphere radius (calculated when loaded)
Definition: PMManagerDC.h:260
virtual vtkSmartPointer< vtkPointSet > getPointSet()=0
The manager of the Cell data.
Definition: CellDC.h:47
virtual QPixmap getIcon()
Get the pixmap that will be displayed for this node.
Definition: sdk/libraries/core/component/Component.h:937
PhysicalModel * myPM
the physical model managed here
Definition: PMManagerDC.h:244
A structural component is composed either by cell or by atoms.
Definition: StructuralComponent.h:48
std::AtomDCMap myADCMap
the A / DC map
Definition: PMManagerDC.h:238
virtual void setName(const QString &)
set the name to be displayed
Definition: sdk/libraries/core/component/Component.h:947
unsigned int nrOfSteps
Total Number of Step.
Definition: PMManagerDC.h:220
unsigned int nrOfDoneSteps
Number of Step done yet.
Definition: PMManagerDC.h:217
A multi-component stores other components, hence providing a way to have an tree representation of co...
Definition: MultiComponent.h:44
virtual void getBounds(double *bounds)
compute the object's bounding box [xmin,xmax, ymin,ymax, zmin,zmax], see Component.cpp
Definition: sdk/libraries/core/component/Component.cpp:476
std::ComponentDCMap myCDCMap
the Cell / DC map
Definition: PMManagerDC.h:235