Computer Assited Medical Intervention Tool Kit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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-2013 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 <Component.h>
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 }
62 
73 Q_OBJECT
74 public:
75  AtomDC(camitk::Component *parent, PMManagerDC * pmManagerDC, Atom *);
76  virtual ~AtomDC();
77 
80 
83  virtual void setParent(InterfaceNode *);
84 
85  virtual QPixmap getIcon();
86 
88  void pointPicked(vtkIdType, bool);
89 
91  virtual void setSelected(const bool, const bool recursive=false);
92 
94  virtual void setEnhancedModes(const EnhancedModes);
95 
97  virtual void setName(const QString &);
98 
100  virtual void setPointSet(vtkSmartPointer<vtkPointSet>);
101 
103  virtual QMenu * getPopupMenu(QWidget* parent);
104 
106  virtual QWidget * getPropertyWidget(QWidget* parent = 0);
107 
109  virtual QObject * getPropertyObject();
110 
112  virtual bool doubleClicked();
114 
116  void setPosition(double, double, double);
117 
119  void getPosition(double &, double &, double &);
120 
125  void updatePosition();
126 
128  void resetAlreadyMovedFlag();
129 
131  Atom * getAtom();
132 
134  virtual PMManagerDC * getPMManagerDC() { return myPMManagerDC; }
135 
140  unsigned int registerIndexInSCDC(const std::IndexInParentItemPair);
141 
145  unsigned int unregisterIndexInSCDC(StructuralComponentDC *);
146 
148  int getOrderNumberInSCDC(StructuralComponentDC *);
149 
151  void addPointData(StructuralComponentDC *, double *);
152 
154  void clearPointData();
155 
157  void updatePointData(const double);
158 
165  AtomDecoration *getDecoration(const QString & name, camitk::GeometricObject::Geometry t);
166 
167  private:
168 
170  Atom *myAtom;
171 
173  virtual void initRepresentation();
174 
184 
188  std::IndexInParentItemMap mySCDCindexes;
189 
192 
195 
197  static QPixmap * myPixmap;
198 
200  std::vector<double *> pointData;
201 
203  std::set<StructuralComponentDC *> pointDataSC;
204 
206  QMap<QString, AtomDecoration*> decorations;
207 
210 
211 };
212 
213 inline Atom * AtomDC::getAtom() {
214  return myAtom;
215 }
216 
217 #endif