Computer Assited Medical Intervention Tool Kit  version 3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
AtomDC.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 AtomDC_H
27 #define AtomDC_H
28 
29 #include <set>
30 #include <camitkcore/Component.h> // Nico: Because someone has the wonderfull idea to name another class Component.h (in PML), here it refers to camitk one, not pml
31 #include <GeometricObject.h>
32 
33 #include <vtkFollower.h>
34 #include <vtkSmartPointer.h>
35 class QPixmap;
36 class QMenu;
37 
38 #include "PMComponentAPI.h"
39 class PMManagerDC;
40 class Atom;
42 class AtomDCProperties;
43 class AtomDCPopup;
44 class AtomDecoration;
45 
46 namespace std {
47 
51  typedef std::pair<camitk::InterfaceNode *, unsigned int> IndexInParentItemPair;
58  typedef std::map <camitk::InterfaceNode *, unsigned int> IndexInParentItemMap;
60  typedef std::map <camitk::InterfaceNode *, unsigned int>::iterator IndexInParentItemMapIterator;
61 }
75 Q_OBJECT
76 public:
77  AtomDC(camitk::Component *parent, PMManagerDC * pmManagerDC, Atom *);
78  virtual ~AtomDC();
79 
82 
85  virtual void setParent(InterfaceNode *);
86 
87  virtual QPixmap getIcon();
88 
90  void pointPicked(vtkIdType, bool);
91 
93  virtual void setSelected(const bool, const bool recursive=false);
94 
96  virtual void setEnhancedModes(const EnhancedModes);
97 
99  virtual void setName(const QString &);
100 
102  virtual void setPointSet(vtkSmartPointer<vtkPointSet>);
103 
105  virtual QMenu * getPopupMenu(QWidget* parent);
106 
108  virtual QWidget * getPropertyWidget(QWidget* parent = 0);
109 
111  virtual QObject * getPropertyObject();
112 
114  virtual bool doubleClicked();
116 
118  void setPosition(double, double, double);
119 
121  void getPosition(double &, double &, double &);
122 
127  void updatePosition();
128 
130  void resetAlreadyMovedFlag();
131 
133  Atom * getAtom();
134 
136  virtual PMManagerDC * getPMManagerDC() { return myPMManagerDC; }
137 
142  unsigned int registerIndexInSCDC(const std::IndexInParentItemPair);
143 
147  unsigned int unregisterIndexInSCDC(StructuralComponentDC *);
148 
150  int getOrderNumberInSCDC(StructuralComponentDC *);
151 
153  void addPointData(StructuralComponentDC *, double *);
154 
156  void clearPointData();
157 
159  void updatePointData(const double);
160 
167  AtomDecoration *getDecoration(const QString & name, camitk::GeometricObject::Geometry t);
168 
169  private:
170 
173 
175  virtual void initRepresentation();
176 
186 
190  std::IndexInParentItemMap mySCDCindexes;
191 
194 
197 
199  static QPixmap * myPixmap;
200 
202  std::vector<double *> pointData;
203 
205  std::set<StructuralComponentDC *> pointDataSC;
206 
208  QMap<QString, AtomDecoration*> decorations;
209 
212 
213 };
214 
215 inline Atom * AtomDC::getAtom() {
216  return myAtom;
217 }
218 
219 #endif
The manager of the physical model data.
Definition: PMManagerDC.h:97
This class allows you to display a geometric object (arrow, sphere, ...) positionned on an atom...
Definition: AtomDecoration.h:46
virtual bool doubleClicked()
this method is called each time the InterfaceNode is double clicked by the user.
Definition: sdk/libraries/core/component/Component.h:783
std::set< StructuralComponentDC * > pointDataSC
list of all the SC who asked for a point data in this AtomDC
Definition: AtomDC.h:205
Atom * getAtom()
get the atom this dc is representing
Definition: AtomDC.h:215
virtual void pointPicked(vtkIdType, bool)
an inherited class can redefine this method something specific.
Definition: sdk/libraries/core/component/Component.h:606
STL namespace.
#define PHYSICALMODEL_COMPONENT_API
Definition: PMComponentAPI.h:54
QMap< QString, AtomDecoration * > decorations
list of decorations attached to this AtomDC
Definition: AtomDC.h:208
The popup menu of the atom data component.
Definition: AtomDCPopup.h:38
The class AtomDCProperties defines an object that allows interaction of some properties of an atom...
Definition: AtomDCProperties.h:47
setPointSet
Definition: sdk/libraries/core/component/Component.h:547
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 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
AtomDCProperties * myProp
the atom'properties
Definition: AtomDC.h:196
Geometry
the geometric type
Definition: GeometricObject.h:59
virtual void setSelected(const bool b, const bool recursive=true)
Update the selection flag.
Atom * myAtom
The atom the dc is representing.
Definition: AtomDC.h:172
PMManagerDC * myPMManagerDC
the PMManagerDC
Definition: AtomDC.h:211
static QPixmap * myPixmap
the AtomDC pixmap
Definition: AtomDC.h:199
bool alreadyMoved
true if the atom has been already moved by another SC This is a way to solve the bug which occurs whe...
Definition: AtomDC.h:185
virtual void initRepresentation()=0
Instanciate the concrete representation (either InterfaceGeometry or InterfaceBitMap) if needed...
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 setEnhancedModes(const EnhancedModes)=0
set the enhanced mode
std::IndexInParentItemMap mySCDCindexes
correspondance between a SCDC and the order number of this atom dc in a particular SCDC (parent items...
Definition: AtomDC.h:190
std::vector< double * > pointData
list of all the point data adresses
Definition: AtomDC.h:202
virtual QObject * getPropertyObject()
Get the property object that could be understood by PropertyEditor.
Definition: sdk/libraries/core/component/Component.h:450
virtual QPixmap getIcon()
Get the pixmap that will be displayed for this node.
Definition: sdk/libraries/core/component/Component.h:804
virtual void setName(const QString &)
set the name to be displayed
Definition: sdk/libraries/core/component/Component.h:814
virtual void setParent(InterfaceNode *)
set the parent Component. This method automatically remove this Component from its previous (if alrea...
AtomDCPopup * myPopupMenu
the popup menu
Definition: AtomDC.h:193
virtual PMManagerDC * getPMManagerDC()
get the PMManagerDC (given during instanciation), allows to get PML/Component maps ...
Definition: AtomDC.h:136