Computer Assited Medical Intervention Tool Kit  version 3.3
 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);
189 
192 
196  QWidget *getAtomDCWidget(AtomDC *adc = NULL, QWidget *parent = NULL);
197 
199  LoadsManager * getLoadsManager();
200 
202 
203 private:
204 
206  void buildPhysicalModelDCs();
207 
211  virtual void initRepresentation();
212 
214  unsigned int nrOfDoneSteps;
215 
217  unsigned int nrOfSteps;
218 
221 
223  static QPixmap * myPixmap;
224 
226  std::ComponentDCMap myMCDCMap;
227 
229  std::ComponentDCMap mySCDCMap;
230 
232  std::ComponentDCMap myCDCMap;
233 
235  std::AtomDCMap myADCMap;
236 
239 
242 
245 
248 };
249 
250 
251 // -------------------- getPhysicalModel --------------------
253  return myPM;
254 }
255 
256 // -------------------- getBoundingRadius --------------------
258  return initialBoundingRadius;
259 }
260 
261 // -------------------- getLoadsManager --------------------
263  return myLoadsManager;
264 }
265 
266 // -------------------- C / DC Map --------------------
268  if (mc->isInstanceOf("StructuralComponent"))
269  return (ComponentDC *) getDC(dynamic_cast<StructuralComponent *>(mc));
270  else if (mc->isInstanceOf("MultiComponent"))
271  return (ComponentDC *) getDC(dynamic_cast<MultiComponent *>(mc));
272  else
273  return NULL;
274 }
275 
276 // -------------------- MC / DC Map --------------------
277 inline void PMManagerDC::addMultiComponentDCPair(std::ComponentDCPair p) {
278  myMCDCMap.insert(p);
279 }
280 
281 // -------------------- SC / DC Map --------------------
282 inline void PMManagerDC::addStructuralComponentDCPair(std::ComponentDCPair p) {
283  mySCDCMap.insert(p);
284 }
285 
286 // -------------------- Atom / DC Map --------------------
287 inline void PMManagerDC::addAtomDCPair(std::AtomDCPair p) {
288  myADCMap.insert(p);
289 }
290 
292  if (!a)
293  return NULL;
294  std::AtomDCMapIterator result = myADCMap.find(a);
295  return (result == myADCMap.end()) ? NULL : (result->second);
296 }
297 
298 
299 #endif
double initialBoundingRadius
the bounding sphere radius calculated just after the PML is loaded
Definition: PMManagerDC.h:247
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
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:262
Exception class to handle abortion in component instanciation.
Definition: AbortException.h:44
The popup menu of the Physical Manager data component.
Definition: PMManagerDCPopup.h:43
std::ComponentDCMap mySCDCMap
the SC / DC map
Definition: PMManagerDC.h:229
STL namespace.
#define PHYSICALMODEL_COMPONENT_API
Definition: PMComponentAPI.h:54
void addAtomDCPair(std::AtomDCPair)
add the A/DC pair
Definition: PMManagerDC.h:287
std::ComponentDCMap myMCDCMap
the MC / DC map
Definition: PMManagerDC.h:226
static QPixmap * myPixmap
the PMManagerDC icon
Definition: PMManagerDC.h:223
Basic component to manage any kind of mesh.
Definition: MeshComponent.h:44
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:252
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:106
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:220
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 addStructuralComponentDCPair(std::ComponentDCPair)
add the SC/DC pair
Definition: PMManagerDC.h:282
AtomDCWidget * myAtomDCWidget
the atomdc widget
Definition: PMManagerDC.h:238
void addMultiComponentDCPair(std::ComponentDCPair)
add the MC/DC pair
Definition: PMManagerDC.h:277
LoadsManager * myLoadsManager
the load manager
Definition: PMManagerDC.h:244
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:826
An atom has an unique index in the physical model object, a 3D position, and different basic properti...
Definition: Atom.h:44
virtual void getBounds(double *bounds)
compute the object's bounding box [xmin,xmax, ymin,ymax, zmin,zmax], see Component.cpp
ComponentDC * getDC(::Component *)
get the DC of a particular Component
Definition: PMManagerDC.h:267
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:257
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:804
PhysicalModel * myPM
the physical model managed here
Definition: PMManagerDC.h:241
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:235
virtual void setName(const QString &)
set the name to be displayed
Definition: sdk/libraries/core/component/Component.h:814
unsigned int nrOfSteps
Total Number of Step.
Definition: PMManagerDC.h:217
unsigned int nrOfDoneSteps
Number of Step done yet.
Definition: PMManagerDC.h:214
A multi-component stores other components, hence providing a way to have an tree representation of co...
Definition: MultiComponent.h:44
std::ComponentDCMap myCDCMap
the Cell / DC map
Definition: PMManagerDC.h:232
virtual double getBoundingRadius()
compute the object's bounding sphere radius,