Computer Assited Medical Intervention Tool Kit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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-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 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 
82 
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 
126 
127  LoadsSimulation * getLoadsSimulation();
128 
130  void simulation();
131 
133  void addSimulationTab(QWidget*);
134 
136  void pause();
137 
139  void rewind();
141 
145 
146 
148  void updateTime();
149 
151  void setDisplayLoads(bool);
152 
154  void updateLoadsDisplay();
155 
157  bool displayLoads() const;
159 
163 
164 
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 
188  void setAtomData(std::AtomDataVector &, QString name = "Add-On Monitor");
189 
191  std::AtomDataVector & getAtomData();
192 
194  void updateAtomDataScale(double min, double max);
196 
201 
202  bool isModified() const;
203 
205  void setChangedFlagOff();
206 
208  bool getLoadsChangedFlag();
209 
211  bool userWantsToSave();
212 
214  PMManagerDC * getPMManagerDC();
215 
217  QString getAnimationMotorAddonLocation();
218 
220  void setAnimationMotorAddonLocation(QString);
221 
223  void userConstrainedAtomDataScale ( bool constrained);
224 
226  bool getUserConstrainedAtomDataScale();
227 
232  void getAtomDataScale ( double* min , double* max);
233 
235 
236  private:
237 
240 
242  QSet <AtomDecoration *> representation3D;
243 
245  std::AtomDataVector atomData;
246 
248  QString fileName;
249 
251  Loads * myLoads;
252 
254  bool changed;
255 
258 
261 
264 
267 
269  QDockWidget *simDock;
270 
273 
275  bool showLoads;
276 
279 
281  PhysicalModel *referencePM;
282 
284  QString atomDataName;
285 
290  void addDecoration(Atom *a, Load *ld, double time, double defaultSize, double *max, double *min, double *val);
291 
294 
296  double min;
297 
299  double max;
300 };
301 
303  return myPMManagerDC;
304 }
305 
307  return simulationDialog;
308 }
309 
310 inline bool LoadsManager::isModified() const {
311  return changed;
312 }
313 
314 inline bool LoadsManager::displayLoads() const {
315  return showLoads;
316 }
317 
318 inline PhysicalModel * LoadsManager::getReferencePM() const {
319  return referencePM;
320 }
321 
323  return atomDataDisplay;
324 }
325 
327  loadsChangedFlag = false;
328 }
329 
331  return loadsChangedFlag;
332 }
333 
334 inline std::AtomDataVector & LoadsManager::getAtomData() {
335  return atomData;
336 }
337 
338 #endif