Computer Assited Medical Intervention Tool Kit  version 5.0
PMLExplorerWidget.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2021 Univ. Grenoble Alpes, CNRS, Grenoble INP, TIMC, 38000 Grenoble, France
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 PMLEXPLORERWIDGET_H
27 #define PMLEXPLORERWIDGET_H
28 
29 // Qt includes
30 #include <QWidget>
31 #include <QMap>
32 class QTreeWidgetItem;
33 
34 // Qt Designer generated .ui
35 namespace Ui {
36 class ui_PmlExplorerWidget;
37 }
38 
39 namespace camitk {
40 class ObjectController;
41 }
42 
43 // CamiTK forward declaration
44 class PMLComponent;
45 class CamiTKPropertyList;
46 
47 // Pml forward declaration
48 class PhysicalModel;
49 class MultiComponent;
51 class Atom;
52 class Cell;
53 class Component;
54 
55 
66 class PMLExplorerWidget : public QWidget {
67  Q_OBJECT
68 
69 public:
72 
74  ~PMLExplorerWidget() override; //{ if (this->ui) delete ui; }
75 
77  void updateTarget(PMLComponent* comp);
78 
79 public slots:
81  void propertyChanged();
82 
84  void createNewProperty();
85 
87  void showAtomGlyphToggled(bool);
88 
89 private slots:
90 
93  void selectItems();
94 
95 private:
98 
101 
103  Ui::ui_PmlExplorerWidget* ui;
104 
107  QMap<QTreeWidgetItem*, Component*> widgetComponentMap;
108 
111  QMap<QTreeWidgetItem*, Atom*> widgetAtomMap;
112 
119  QMap<QTreeWidgetItem*, QObject*> widgetPropertiesMap;
120 
123  QMap<Atom*, QObject*> atomPropertiesMap;
124 
126  void updateProperty(QTreeWidgetItem*);
127 
130 
132  QTreeWidgetItem* editedItem;
133 
136 
139 
141  void init(PMLComponent*);
142 
144  QTreeWidgetItem* physicalModelItem;
145 
147  QTreeWidgetItem* atomsItem;
148 
150  QTreeWidgetItem* exclusiveComponentItem;
151 
153  QTreeWidgetItem* informativeComponentItem;
154 
159 
164  QTreeWidgetItem* buildMultiComponentTreeWidgetItem(MultiComponent* multiComponent, QTreeWidgetItem* parent);
165 
170  QTreeWidgetItem* buildStructuralComponentTreeWidgetItem(StructuralComponent* sc, QTreeWidgetItem* parent);
171 
176  QTreeWidgetItem* buildCellTreeWidgetItem(Cell* cell, QTreeWidgetItem* parent);
177 
182  QTreeWidgetItem* buildAtomTreeWidgetItem(Atom* atom, QTreeWidgetItem* parent);
184 
189 
192 
195 
198 
200 };
201 
202 
203 #endif // PMLEXPLORERWIDGET_H
PMLExplorerWidget::buildCellTreeWidgetItem
QTreeWidgetItem * buildCellTreeWidgetItem(Cell *cell, QTreeWidgetItem *parent)
Add an entry for the current cell to the widget.
Definition: PMLExplorerWidget.cpp:183
PMLComponent::selectSC
void selectSC(StructuralComponent *sc, bool showAtomGlyph)
Select the given structural component in the 3D structure by highlighting all its atoms and cells.
Definition: PMLComponent.cpp:473
Cell.h
PMLComponent::getPointId
vtkIdType getPointId(const Atom *a)
get the point Id from the corresponding atom, this is the opposite of pml->getAtom(id)
Definition: PMLComponent.h:290
PMLExplorerWidget::showAtomGlyphToggled
void showAtomGlyphToggled(bool)
This slot is connected to the corresponding UI Checkbox, update the showAtomGlyph state.
Definition: PMLExplorerWidget.cpp:207
StructuralComponent::getNumberOfStructures
unsigned int getNumberOfStructures() const
get the number of structures
Definition: StructuralComponent.h:252
PMLExplorerWidget::ui
Ui::ui_PmlExplorerWidget * ui
The graphical user interface automatically generated by the moc and QtDesigner.
Definition: PMLExplorerWidget.h:103
PMLExplorerWidget::createCellPropertyList
CamiTKPropertyList * createCellPropertyList(Cell *)
Creates a CamiTKPropertyList for this cell or get the existing one.
Definition: PMLExplorerWidget.cpp:485
ObjectController
Definition: objectcontroller.h:47
PMLExplorerWidget::widgetPropertiesMap
QMap< QTreeWidgetItem *, QObject * > widgetPropertiesMap
Map QTreeWidgetItem <-> CamiTKPropertyList for all PML components (Cell, SC, MC).
Definition: PMLExplorerWidget.h:119
MultiComponent::getSubComponent
Component * getSubComponent(const unsigned int) const
get a subcomponent by its order number (index in the list of subcomponents)
Definition: MultiComponent.h:114
CamiTKPropertyList
This class holds a list of CamiTK Properties and can be used as an editable QObject for the ObjectCon...
Definition: CamiTKPropertyList.h:35
PMLExplorerWidget::editedItem
QTreeWidgetItem * editedItem
item being currently edited
Definition: PMLExplorerWidget.h:132
Atom
An atom has an unique index in the physical model object, a 3D position, and different basic properti...
Definition: Atom.h:49
PMLComponent::getPhysicalModel
PhysicalModel * getPhysicalModel()
Definition: PMLComponent.cpp:104
PMLExplorerWidget::selectItems
void selectItems()
The slot defined to select the QTreeWidgetItem in its corresponding pml element (SC,...
Definition: PMLExplorerWidget.cpp:213
CellProperties.h
PMLExplorerWidget::physicalModelItem
QTreeWidgetItem * physicalModelItem
The main tree widget items, at the base of the structure.
Definition: PMLExplorerWidget.h:144
Properties::getField
std::string getField(unsigned int) const
get the name of field of given index
Definition: Properties.cpp:68
PMLExplorerWidget::createNewProperty
void createNewProperty()
called when the user click on new in the object controller
Definition: PMLExplorerWidget.cpp:377
CamiTKPropertyList::addProperty
virtual bool addProperty(camitk::Property *)
Add a new CamiTK property to the component.
Definition: CamiTKPropertyList.cpp:48
Cell::getProperties
CellProperties * getProperties()
return the property
Definition: Cell.cpp:226
a
#define a
PMLComponent::selectAtom
void selectAtom(const Atom *atom)
Select the given atom in the 3D structure.
Definition: PMLComponent.cpp:441
PMLExplorerWidget::exclusiveComponentItem
QTreeWidgetItem * exclusiveComponentItem
the exclusive component MC tree widget item
Definition: PMLExplorerWidget.h:150
PMLExplorerWidget::widgetComponentMap
QMap< QTreeWidgetItem *, Component * > widgetComponentMap
A pml::component <-> QTreeWidgetItem map to find out, once selected the corresponding pml::Component ...
Definition: PMLExplorerWidget.h:107
Structure::getIndex
unsigned int getIndex() const
get the structure unique index (stored in its property)
Definition: Structure.cpp:30
camitk::Component::setModified
virtual void setModified(bool modified=true)
set the modified flag
Definition: sdk/libraries/core/component/Component.h:943
MultiComponent::getNumberOfSubComponents
unsigned int getNumberOfSubComponents() const
return the number of subcomponents
Definition: MultiComponent.h:111
PMLExplorerWidget::atomPropertiesMap
QMap< Atom *, QObject * > atomPropertiesMap
Map QTreeWidgetItem <-> CamiTKPropertyList for atom For the atoms, there is only one CamiTKPropertyLi...
Definition: PMLExplorerWidget.h:123
CamiTKPropertyList.h
PMLExplorerWidget::createMCPropertyList
CamiTKPropertyList * createMCPropertyList(MultiComponent *)
Creates a CamiTKPropertyList for this MC or get the existing one.
Definition: PMLExplorerWidget.cpp:579
StructuralComponent
A structural component is composed either by cell or by atoms.
Definition: StructuralComponent.h:52
PMLExplorerWidget
This class is the Pml explore action widget presented/controller.
Definition: PMLExplorerWidget.h:66
Structure
Pure virtual class that represent an element of the structure. This implies that every structure coul...
Definition: Structure.h:43
PMLComponent::updateSelection
void updateSelection()
Update the POINTS and CELLS selection for the whole 3D structure by telling the corresponding extract...
Definition: PMLComponent.cpp:513
camitk::Property
This class describes a property that can be used in components and actions or any class that needs to...
Definition: Property.h:303
Atom.h
PMLExplorerWidget::buildAtomTreeWidgetItem
QTreeWidgetItem * buildAtomTreeWidgetItem(Atom *atom, QTreeWidgetItem *parent)
Add an entry for the current atom to the widget.
Definition: PMLExplorerWidget.cpp:171
Log.h
PMLExplorerWidget.h
PMLExplorerWidget::physicalModel
PhysicalModel * physicalModel
The PML Component to explore with the action.
Definition: PMLExplorerWidget.h:100
camitk::InterfaceGeometry::getPointSet
virtual vtkSmartPointer< vtkPointSet > getPointSet()=0
PMLExplorerWidget::objectController
camitk::ObjectController * objectController
the QObject are displaying properties in the ObjectController
Definition: PMLExplorerWidget.h:129
PhysicalModel
This is the main class of this project. Following a nice concept, a physical model is able to represe...
Definition: PhysicalModel.h:86
camitk::ObjectController::setObject
void setObject(QObject *object)
mutatorMethod of the object at unroll in the property browser
Definition: ObjectController.cpp:576
camitk::ObjectController
The object controller class.
Definition: ObjectController.h:185
Component::getProperties
Properties * getProperties()
get the component structural properties (guarantied to be non NULL)
Definition: modeling/libraries/pml/Component.h:188
PMLExplorerWidget::showAtomGlyph
bool showAtomGlyph
the state of the show atom glyph checkbox
Definition: PMLExplorerWidget.h:135
Ui
Definition: SettingsDialog.h:31
PMLExplorerWidget::propertyChanged
void propertyChanged()
called when the user click on apply in the object controller
Definition: PMLExplorerWidget.cpp:604
Cell
A cell has an unique index in the physical model object, is composed by atoms, and different basic pr...
Definition: Cell.h:46
PMLExplorerWidget::buildMultiComponentTreeWidgetItem
QTreeWidgetItem * buildMultiComponentTreeWidgetItem(MultiComponent *multiComponent, QTreeWidgetItem *parent)
Recursive method to add an entry for the current multicomponent to the widget.
Definition: PMLExplorerWidget.cpp:127
Component::getName
const std::string getName() const
get the name of the component
Definition: modeling/libraries/pml/Component.h:147
PMLExplorerWidget::updateTarget
void updateTarget(PMLComponent *comp)
Update the widget content as the input selected component changed.
Definition: PMLExplorerWidget.cpp:258
Properties::getString
std::string getString(std::string attName) const
field accessor: get the field attName as a string value, if field does not exist, empty string is ret...
Definition: Properties.h:178
StructuralComponent.h
PMLComponent
This class manages a physical model (PML) CamiTK component.
Definition: PMLComponent.h:103
StructuralComponent::getColor
double * getColor() const
Get the color.
Definition: StructuralComponent.cpp:116
PMLExplorerWidget::atomsItem
QTreeWidgetItem * atomsItem
the atom SC tree widget item
Definition: PMLExplorerWidget.h:147
camitk::Component::getName
QString getName() const override
get the name to be displayed
Definition: sdk/libraries/core/component/Component.h:907
StructuralComponent::composedBy
virtual ComposedBy composedBy()
return the type of structure composing the structural component: a structural component is either a l...
Definition: StructuralComponent.cpp:296
StructuralComponent::CELLS
@ CELLS
the structural component is made of cells
Definition: StructuralComponent.h:175
PMLExplorerWidget::buildPhysicalModelTreeWidgetItem
void buildPhysicalModelTreeWidgetItem()
Parse the basic contents of the PML component: its atoms, exclusive and informative components and ca...
Definition: PMLExplorerWidget.cpp:90
PMLComponent::selectCell
void selectCell(Cell *cell, bool showAtomGlyph)
Select the given cell in the 3D structure.
Definition: PMLComponent.cpp:447
PMLExplorerWidget::buildStructuralComponentTreeWidgetItem
QTreeWidgetItem * buildStructuralComponentTreeWidgetItem(StructuralComponent *sc, QTreeWidgetItem *parent)
Add an entry for the current structural component to the widget.
Definition: PMLExplorerWidget.cpp:149
ObjectController.h
PMLExplorerWidget::PMLExplorerWidget
PMLExplorerWidget(PMLComponent *comp)
Constructor.
Definition: PMLExplorerWidget.cpp:54
PMLExplorerWidget::createAtomPropertyList
CamiTKPropertyList * createAtomPropertyList(Atom *)
Definition: PMLExplorerWidget.cpp:431
PMLExplorerWidget::widgetAtomMap
QMap< QTreeWidgetItem *, Atom * > widgetAtomMap
A pml::Atom <-> QTreeWidgetItem map to find out, once selected the corresponding pml::Atom associated...
Definition: PMLExplorerWidget.h:111
PMLExplorerWidget::createSCPropertyList
CamiTKPropertyList * createSCPropertyList(StructuralComponent *)
Creates a CamiTKPropertyList for this SC or get the existing one.
Definition: PMLExplorerWidget.cpp:527
StructuralComponent::getStructure
Structure * getStructure(const unsigned int) const
get a structure by its index (fisrt structure is at index 0)
Definition: StructuralComponent.h:220
camitk::ObjectController::BUTTON
@ BUTTON
It is like the GROUPBOX but the buttons allow the user to control the comput display of arborescence.
Definition: ObjectController.h:197
PMLComponent::getIcon
virtual QPixmap getIcon()
get the pixmap for physical model component
Definition: PMLComponent.cpp:584
PhysicalModel.h
Component
A component is something that composed something and could also be a part of something.
Definition: modeling/libraries/pml/Component.h:48
Component::setName
void setName(const std::string)
set the name of the component
Definition: modeling/libraries/pml/Component.h:150
physicalModel
Definition: Atom.h:36
camitk::Property::setReadOnly
void setReadOnly(bool)
set this property as read-only
Definition: Property.cpp:82
camitk::Property::setGroupName
void setGroupName(QString groupName)
Set the group name.
Definition: Property.cpp:163
Structure::hasIndex
bool hasIndex
indicate if the Structure has an index (which is not the case all the time)
Definition: Structure.h:61
MultiComponent.h
StructureProperties::toString
static std::string toString(const GeometricType)
return the string equivalent to this geometric type
Definition: StructureProperties.cpp:72
StructuralComponent::getProperties
StructuralComponentProperties * getProperties()
get the structural component properties of this SC
Definition: StructuralComponent.h:274
Properties::set
void set(std::string attName, double val)
field modificator: set field attName using a double value
Definition: Properties.h:200
PMLExplorerWidget::updateProperty
void updateProperty(QTreeWidgetItem *)
build a QObject from physical model properties
Definition: PMLExplorerWidget.cpp:325
camitk::Component::refresh
virtual void refresh()
refresh all the viewer that are currently displaying this Component At the end the InterfaceNode modi...
Definition: sdk/libraries/core/component/Component.cpp:286
PMLExplorerWidget::~PMLExplorerWidget
~PMLExplorerWidget() override
Destructor.
Definition: PMLExplorerWidget.cpp:76
camitk::Component::addProperty
bool addProperty(Property *) override
Add a new CamiTK property to the component.
Definition: sdk/libraries/core/component/Component.cpp:517
PMLComponent.h
StructuralComponent::ATOMS
@ ATOMS
the structural component is made of atoms
Definition: StructuralComponent.h:176
PMLExplorerWidget::init
void init(PMLComponent *)
initialize component, physicalmodel and interaction
Definition: PMLExplorerWidget.cpp:291
Structure::setName
void setName(std::string)
set the name of the structure
Definition: Structure.cpp:44
PMLComponent::selectMC
void selectMC(MultiComponent *mc, bool showAtomGlyph)
Select the given multi component in the 3D structure by highlighting all its structural components.
Definition: PMLComponent.cpp:500
PMLComponent::unselectItems
void unselectItems()
Unselect all the SC, MC, Atoms and Cells previously selected on the 3D structure.
Definition: PMLComponent.cpp:551
MultiComponent
A multi-component stores other components, hence providing a way to have an tree representation of co...
Definition: MultiComponent.h:44
StructureProperties::getType
GeometricType getType() const
Return the type of force.
Definition: StructureProperties.h:160
PMLComponent::refreshDisplay
void refreshDisplay()
Refresh the display of the component according to the selected 3D items by the user.
Definition: PMLComponent.cpp:349
PMLExplorerWidget::informativeComponentItem
QTreeWidgetItem * informativeComponentItem
the informative component MC tree widget item
Definition: PMLExplorerWidget.h:153
camitk
Definition: Action.cpp:35
PMLExplorerWidget::pmlComponent
PMLComponent * pmlComponent
The PML Component associated with the action.
Definition: PMLExplorerWidget.h:97