Computer Assited Medical Intervention Tool Kit  version 4.0
LoadsManager.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2016 Univ. Grenoble Alpes, 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 LOADSMANAGER_H
27 #define LOADSMANAGER_H
28 
29 #include <QString>
30 #include <QSet>
31 #include <vector>
32 
33 #include "PMComponentAPI.h"
34 
35 class QDockWidget;
36 
37 class QWidget;
38 
39 // class used in this file
40 class Loads;
41 class Load;
42 class AtomDecoration;
43 class PhysicalModel;
44 class Loads;
45 class PMManagerDC;
46 class LoadsMovie;
47 class LoadsEditor;
48 class LoadsSimulation;
49 class Atom;
50 
51 namespace std {
55 typedef std::pair<Atom *, double> AtomDataPair;
57 typedef std::vector<std::AtomDataPair> AtomDataVector;
58 }
59 
70 
71 public:
74 
76  ~LoadsManager();
77 
81 
87  bool open(const QString&);
88 
90  void save();
91 
93  void saveAs(const QString&);
94 
96  Loads * getLoads();
97 
99  void setLoads(Loads *);
100 
102  void deleteAllLoads();
103 
107  void close();
108 
110  void addLoad(Load *);
111 
113  void editLoads();
114 
116  void previewLoads();
117 
119  void addLoad();
121 
125  LoadsSimulation * getLoadsSimulation();
128 
130  void simulation();
131 
133  void addSimulationTab(QWidget*);
134 
136  void pause();
137 
139  void rewind();
141 
145 
148  void updateTime();
149 
151  void setDisplayLoads(bool);
152 
154  void updateLoadsDisplay();
155 
157  bool displayLoads() const;
159 
163  enum AtomDataDisplayType {
170  RELATIVE_ENERGY_NORM_ERROR
171  };
172 
174  void setAtomDataDisplay(AtomDataDisplayType);
175 
177  AtomDataDisplayType getAtomDataDisplay() const;
178 
180  void setReferencePML(const QString&);
181 
183  PhysicalModel * getReferencePM() const;
184 
189  void setAtomData(std::AtomDataVector &values, QString name = "Add-On Monitor");
190 
192  std::AtomDataVector & getAtomData();
193 
195  void updateAtomDataScale(double min, double max);
197 
202  bool isModified() const;
204 
206  void setChangedFlagOff();
207 
209  bool getLoadsChangedFlag();
210 
212  bool userWantsToSave();
213 
215  PMManagerDC * getPMManagerDC();
216 
218  QString getAnimationMotorAddonLocation();
219 
221  void setAnimationMotorAddonLocation(QString);
222 
224  void userConstrainedAtomDataScale ( bool constrained);
225 
227  bool getUserConstrainedAtomDataScale();
228 
233  void getAtomDataScale ( double* min , double* max);
234 
236 
237 private:
238 
241 
243  QSet <AtomDecoration *> representation3D;
244 
247 
249  QString fileName;
250 
253 
255  bool changed;
256 
259 
262 
265 
268 
270  QDockWidget *simDock;
271 
274 
276  bool showLoads;
277 
280 
283 
285  QString atomDataName;
286 
296  void addDecoration(Atom *a, Load *ld, double time, double defaultSize, double *max, double *min, double *val);
297 
300 
302  double min;
303 
305  double max;
306 };
307 
309  return myPMManagerDC;
310 }
311 
313  return simulationDialog;
314 }
315 
316 inline bool LoadsManager::isModified() const {
317  return changed;
318 }
319 
320 inline bool LoadsManager::displayLoads() const {
321  return showLoads;
322 }
323 
325  return referencePM;
326 }
327 
329  return atomDataDisplay;
330 }
331 
333  loadsChangedFlag = false;
334 }
335 
337  return loadsChangedFlag;
338 }
339 
341  return atomData;
342 }
343 
344 #endif
PMManagerDC * getPMManagerDC()
get the current physical model
Definition: LoadsManager.h:308
std::AtomDataVector & getAtomData()
get the current list of all the atom data
Definition: LoadsManager.h:340
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
LoadsSimulation * getLoadsSimulation()
Definition: LoadsManager.h:312
QString atomDataName
name of the add-on atom data
Definition: LoadsManager.h:285
bool displayLoads() const
return true only if the loads are currently being displayed in 3D
Definition: LoadsManager.h:320
LoadsSimulation * simulationDialog
the simulation dialog
Definition: LoadsManager.h:267
std::pair< Atom *, double > AtomDataPair
definition of a couple (=STL pair) [Atom *, double] this associates an atom to a given data (scalar v...
Definition: LoadsManager.h:55
bool loadsChangedFlag
has the load list been changed since the last simulation
Definition: LoadsManager.h:258
QString fileName
the current name of managed file
Definition: LoadsManager.h:249
AtomDataDisplayType getAtomDataDisplay() const
get current atom display type
Definition: LoadsManager.h:328
STL namespace.
#define PHYSICALMODEL_COMPONENT_API
Definition: PMComponentAPI.h:54
QString motorAddonLocation
the current animation motor add-on location
Definition: LoadsManager.h:273
QDockWidget * simDock
the dock widget where the simulation dialog is
Definition: LoadsManager.h:270
void setChangedFlagOff()
set the Loads changed flag to false;
Definition: LoadsManager.h:332
bool getLoadsChangedFlag()
return the loads changed flag value;
Definition: LoadsManager.h:336
This class makes it possible to manage a list of "Load".
Definition: Loads.h:71
std::vector< std::AtomDataPair > AtomDataVector
a vector of atom data
Definition: LoadsManager.h:57
AtomDataDisplayType atomDataDisplay
which atom data are to display: none, displacements, distances, ...
Definition: LoadsManager.h:279
bool changed
had the load list been changed since the last time it was saved
Definition: LoadsManager.h:255
double min
current minimum value of the data scale
Definition: LoadsManager.h:302
do not display any atom data
Definition: LoadsManager.h:166
This class manages the applied all loads (see LML), deformation add-on, atom data monitoring and atom...
Definition: LoadsManager.h:69
display add-on atom data (i.e. atom data computed by the add-on)
Definition: LoadsManager.h:167
QSet< AtomDecoration * > representation3D
List of arrow and sphere representing the loads in 3D.
Definition: LoadsManager.h:243
An atom has an unique index in the physical model object, a 3D position, and different basic properti...
Definition: Atom.h:49
bool constrainedAtomDataScale
current state of the data scale
Definition: LoadsManager.h:299
Loads * myLoads
all the managed loads
Definition: LoadsManager.h:252
AtomDataDisplayType
Definition: LoadsManager.h:165
display distances from the reference PML
Definition: LoadsManager.h:169
This is the main class of this project.
Definition: PhysicalModel.h:86
This dialog allows one to run a simulation using a simulation motor.
Definition: LoadsSimulation.h:53
PhysicalModel * referencePM
the physical model to use as the reference for some atom data display
Definition: LoadsManager.h:282
bool showLoads
are the load currently displayed in 3D?
Definition: LoadsManager.h:276
Class that describes a load to be used in the simulation.
Definition: Load.h:53
This dialog allows one to see the simulation It plays the impload, allowing the user to see the evolu...
Definition: LoadsMovie.h:42
A clean dialog to edit (add, modify, delete), loads and their parameters, directly from Core...
Definition: LoadsEditor.h:40
display total displacements from initial position
Definition: LoadsManager.h:168
double max
current maximum value of the data scale
Definition: LoadsManager.h:305
std::AtomDataVector atomData
List of atom data values (one value per atom)
Definition: LoadsManager.h:246
bool isModified() const
return the current state regarding modification since the last save
Definition: LoadsManager.h:316
PhysicalModel * getReferencePM() const
return the reference physical model to use for some computations
Definition: LoadsManager.h:324
PMManagerDC * myPMManagerDC
the PM manager DC
Definition: LoadsManager.h:240
LoadsEditor * loadsEditor
the dialog where all the loads are shown, and can be modified
Definition: LoadsManager.h:261
LoadsMovie * previewDialog
the preview (simulation animation dialog)
Definition: LoadsManager.h:264