/usr/include/camitk-3.2/components/physicalmodel/AtomDC.h is in libcamitk3-dev 3.2.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | /*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2013 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
#ifndef AtomDC_H
#define AtomDC_H
#include <set>
#include <Component.h>
#include <GeometricObject.h>
#include <vtkFollower.h>
#include <vtkSmartPointer.h>
class QPixmap;
class QMenu;
#include "PMComponentAPI.h"
class PMManagerDC;
class Atom;
class StructuralComponentDC;
class AtomDCProperties;
class AtomDCPopup;
class AtomDecoration;
namespace std {
/** definition of a couple (=STL pair) [InterfaceNode *, unsigned int]
* this associates a parent data component with a subItem order number
*/
typedef std::pair<camitk::InterfaceNode *, unsigned int> IndexInParentItemPair;
/** definition of the association set (=map in STL) IndexInParentItemMap.
* IndexInParentItemMap allows a DC to associate all its parent DCs with
* its order numbers in these parent DCs.
* The key is the parent DC, so that it is simple to retrieve the order number of
* a this DC in a particular parent item.
*/
typedef std::map <camitk::InterfaceNode *, unsigned int> IndexInParentItemMap;
/** the iterator corresponding to the IndexInParentItemMap map */
typedef std::map <camitk::InterfaceNode *, unsigned int>::iterator IndexInParentItemMapIterator;
}
/**The manager of the Atom data.
* AtomDC are only created in the StructuralComponentDC constructor,
* which garanties that each atom has ONE AND ONLY ONE DC.
* But as Atom can be referenced by more than one Component (StructuralComponent or Cell)
* AtomDC is a particular type of DC that can have more than one parent DC (setParent is
* rewritten here).
*
*
*/
class PHYSICALMODEL_COMPONENT_API AtomDC : public camitk::Component {
Q_OBJECT
public:
AtomDC(camitk::Component *parent, PMManagerDC * pmManagerDC, Atom *);
virtual ~AtomDC();
/// @name Redefined from camitk::Component
///@{
/** An AtomDC can have more than one parent...
* myParentDC is the first DC (atom list).
*/
virtual void setParent(InterfaceNode *);
virtual QPixmap getIcon();
/// picking is selecting/unselecting
void pointPicked(vtkIdType, bool);
/// when seleceted add a sphere glyph around the atom position and set the enhanced mode to Normal
virtual void setSelected(const bool, const bool recursive=false);
/// do nothing here (the enhanced mode is controled by the setSelected method)
virtual void setEnhancedModes(const EnhancedModes);
/// set the name of the atom as well as the name of the DC
virtual void setName(const QString &);
/// if the vtkPointSet is modified externally (e.g. by an operator), change the PM structure
virtual void setPointSet(vtkSmartPointer<vtkPointSet>);
/// Overriden method so that we actually can build a popup menu with different actions
virtual QMenu * getPopupMenu(QWidget* parent);
/// reimplement this method to give the property widget to the app
virtual QWidget * getPropertyWidget(QWidget* parent = 0);
/// reimplement this method to give the property object to the property editor
virtual QObject * getPropertyObject();
/// overloaded method, allows to set the point when double clicked
virtual bool doubleClicked();
///@}
/// set a new position for this atom
void setPosition(double, double, double);
/// get the current position for this atom
void getPosition(double &, double &, double &);
/** update the position of the 3D representation and launch the update position cascade process
* (updating all the 3D representation of all the SC/cells containing this atom, then of
* all the SC containing all the cells containing this atom...)
*/
void updatePosition();
/// reset the alreadyMoved flag to false, see alreadyMoved property
void resetAlreadyMovedFlag();
/// get the atom this dc is representing
Atom * getAtom();
/// get the PMManagerDC (given during instanciation), allows to get PML/Component maps
virtual PMManagerDC * getPMManagerDC() { return myPMManagerDC; }
/** register a StructuralComponentDC and this AtomDC corresponding order number in it (NOTE: this
* method replace the previous index if there was one)
* @return the new number of registered SCDC
*/
unsigned int registerIndexInSCDC(const std::IndexInParentItemPair);
/** unregister a StructuralComponentDC item from the map
* @return the new number of registered SCDC
*/
unsigned int unregisterIndexInSCDC(StructuralComponentDC *);
/// knowing a StructuralComponentDC get the order number of this AtomDC in it (return -1 if not found)
int getOrderNumberInSCDC(StructuralComponentDC *);
/// add a ptr to a pointData for this atom corresponding to the given SCDC
void addPointData(StructuralComponentDC *, double *);
/// clear the point data ptr list
void clearPointData();
/// update point data value
void updatePointData(const double);
/** get a decoration of the AtomDC using its name.
* If the AtomDC has no decoration using this name, create a new one using the given type.
*
* @param name the decoration name
* @param t the decoration type
*/
AtomDecoration *getDecoration(const QString & name, camitk::GeometricObject::Geometry t);
private:
/// The atom the dc is representing
Atom *myAtom;
/// the concrete building of the geometry
virtual void initRepresentation();
/** true if the atom has been already moved by another SC
* This is a way to solve the bug which occurs when 2 selected
* cells has this atom in common. The call of setRealTransformation()
* being sequencial, the first cell will move the atom first, and
* then the second cell will move it again...
* Set to false when setTranform(...) is called with the identity.
* Set to true when updatePosition is called
*/
bool alreadyMoved;
/** correspondance between a SCDC and the order number of this atom dc in a
* particular SCDC (parent items).
*/
std::IndexInParentItemMap mySCDCindexes;
/// the popup menu
AtomDCPopup * myPopupMenu;
/// the atom'properties
AtomDCProperties * myProp;
/// the AtomDC pixmap
static QPixmap * myPixmap;
/// list of all the point data adresses
std::vector<double *> pointData;
/// list of all the SC who asked for a point data in this AtomDC
std::set<StructuralComponentDC *> pointDataSC;
/// list of decorations attached to this AtomDC
QMap<QString, AtomDecoration*> decorations;
/// the PMManagerDC
PMManagerDC *myPMManagerDC;
};
inline Atom * AtomDC::getAtom() {
return myAtom;
}
#endif
|