BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
model.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/ba3d/model/model.h
6 //! @brief Defines Model class
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_GUI_BA3D_MODEL_MODEL_H
16 #define BORNAGAIN_GUI_BA3D_MODEL_MODEL_H
17 
19 #include "GUI/ba3d/view/camera.h"
20 #include <QVector>
21 
22 namespace GUI::RealSpace {
23 
24 class Canvas;
25 class Object;
26 
27 class Model : public QObject {
28  Q_OBJECT
29  friend class Canvas;
30  friend class Camera;
31  friend class Object;
32 
33 public:
34  Model();
35  ~Model() override;
36 
37  void clearOpaque();
38  void clearBlend();
39 
41 
42  void add(Object*); //!< add an opaque object, the model takes ownership
43  void addBlend(Object*); //!< add a transparent object, the model takes ownership
44  void rem(Object*); //!< removes an object, the caller becomes responsible
45 
46  void releaseGeometries(); //!< may be called any time
47 
48  bool modelIsEmpty();
49 
50  virtual void cameraUpdated(Camera const&) {}
51 
52  Camera::Position defCamPos; //!< default camera params
53 
54 signals:
55  void updated(bool withEye);
56 
57 private:
58  QVector<Object*> objects, objectsBlend;
59 
60  void draw(Canvas&) const;
61  void drawBlend(Canvas&) const;
62 };
63 
64 } // namespace GUI::RealSpace
65 
66 #endif // BORNAGAIN_GUI_BA3D_MODEL_MODEL_H
Defines Camera class.
QVector< Object * > objectsBlend
Definition: model.h:58
static Particles::Particle * newParticle(Particles::EShape k, float R)
Definition: model.cpp:53
void addBlend(Object *)
add a transparent object, the model takes ownership
Definition: model.cpp:136
~Model() override
Definition: model.cpp:26
void add(Object *)
add an opaque object, the model takes ownership
Definition: model.cpp:128
virtual void cameraUpdated(Camera const &)
Definition: model.h:50
void draw(Canvas &) const
Definition: model.cpp:170
void drawBlend(Canvas &) const
Definition: model.cpp:176
void updated(bool withEye)
void releaseGeometries()
may be called any time
Definition: model.cpp:157
Camera::Position defCamPos
default camera params
Definition: model.h:52
QVector< Object * > objects
Definition: model.h:58
void rem(Object *)
removes an object, the caller becomes responsible
Definition: model.cpp:144
A geometric object.
Definition: object.h:28
Defines Particle class.