BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
RotationItems.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/Sample/RotationItems.h
6 //! @brief Defines class RotationItems
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2021
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_GUI_MODEL_SAMPLE_ROTATIONITEMS_H
16 #define BORNAGAIN_GUI_MODEL_SAMPLE_ROTATIONITEMS_H
17 
19 #include <memory>
20 
21 class IRotation;
22 class RotMatrix;
23 class Streamer;
24 
25 using std::unique_ptr;
26 
27 class RotationItem {
28 public:
29  virtual ~RotationItem() = default;
30  RotMatrix rotation() const;
31 
32  virtual void serialize(Streamer& s) = 0;
33  virtual DoubleDescriptors rotationValues() const = 0;
34 
35 protected:
36  RotationItem();
37  virtual unique_ptr<IRotation> createRotation() const = 0;
38 };
39 
40 class XRotationItem : public RotationItem {
41 public:
42  XRotationItem();
43  void serialize(Streamer& s) override;
44  DoubleDescriptors rotationValues() const override { return {m_angle}; };
45 
46  DoubleDescriptor angle() const;
47 
48 protected:
49  unique_ptr<IRotation> createRotation() const override;
50 
51 private:
53 };
54 
55 class YRotationItem : public RotationItem {
56 public:
57  YRotationItem();
58  void serialize(Streamer& s) override;
59  DoubleDescriptors rotationValues() const override { return {m_angle}; };
60 
61  DoubleDescriptor angle() const;
62 
63 protected:
64  unique_ptr<IRotation> createRotation() const override;
65 
66 private:
68 };
69 
70 class ZRotationItem : public RotationItem {
71 public:
72  ZRotationItem();
73  void serialize(Streamer& s) override;
74  DoubleDescriptors rotationValues() const override { return {m_angle}; };
75 
76  DoubleDescriptor angle() const;
77 
78 protected:
79  unique_ptr<IRotation> createRotation() const override;
80 
81 private:
83 };
84 
86 public:
88  void serialize(Streamer& s) override;
89  DoubleDescriptors rotationValues() const override { return {m_alpha, m_beta, m_gamma}; };
90 
91  DoubleDescriptor alpha() const;
92  DoubleDescriptor beta() const;
93  DoubleDescriptor gamma() const;
94 
95 protected:
96  unique_ptr<IRotation> createRotation() const override;
97 
98 private:
102 };
103 
104 #endif // BORNAGAIN_GUI_MODEL_SAMPLE_ROTATIONITEMS_H
QList< DoubleDescriptor > DoubleDescriptors
Defines class DoubleProperty.
Describes properties of a double value which are necessary to allow GUI representation,...
Class for representing a double value, its attributes and its accessors.
DoubleDescriptors rotationValues() const override
Definition: RotationItems.h:89
DoubleProperty m_alpha
Definition: RotationItems.h:99
unique_ptr< IRotation > createRotation() const override
DoubleDescriptor alpha() const
DoubleProperty m_gamma
void serialize(Streamer &s) override
DoubleProperty m_beta
DoubleDescriptor gamma() const
DoubleDescriptor beta() const
RotMatrix rotation() const
virtual void serialize(Streamer &s)=0
virtual DoubleDescriptors rotationValues() const =0
virtual unique_ptr< IRotation > createRotation() const =0
virtual ~RotationItem()=default
Supports serialization to or deserialization from QXmlStream.
Definition: Streamer.h:36
unique_ptr< IRotation > createRotation() const override
DoubleDescriptors rotationValues() const override
Definition: RotationItems.h:44
void serialize(Streamer &s) override
DoubleProperty m_angle
Definition: RotationItems.h:52
DoubleDescriptor angle() const
DoubleDescriptor angle() const
DoubleProperty m_angle
Definition: RotationItems.h:67
void serialize(Streamer &s) override
DoubleDescriptors rotationValues() const override
Definition: RotationItems.h:59
unique_ptr< IRotation > createRotation() const override
DoubleDescriptors rotationValues() const override
Definition: RotationItems.h:74
DoubleDescriptor angle() const
unique_ptr< IRotation > createRotation() const override
DoubleProperty m_angle
Definition: RotationItems.h:82
void serialize(Streamer &s) override