BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
Lattice2DItems.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/Sample/Lattice2DItems.h
6 //! @brief Defines classes Lattice2DItems
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_MODEL_SAMPLE_LATTICE2DITEMS_H
16 #define BORNAGAIN_GUI_MODEL_SAMPLE_LATTICE2DITEMS_H
17 
19 #include <QVector>
20 #include <memory>
21 
22 class Lattice2D;
23 class DoubleDescriptor;
24 class Streamer;
25 
27 protected:
28  Lattice2DItem();
29 
30 public:
31  virtual ~Lattice2DItem() = default;
32  virtual std::unique_ptr<Lattice2D> createLattice() const = 0;
33  virtual DoubleDescriptors geometryValues(bool withRotationAngle) const = 0;
34  virtual void serialize(Streamer& s) = 0;
35  double unitCellArea() const;
36 
38  void setLatticeRotationAngle(double angle);
39 
40 protected:
42 };
43 
44 // -------------------------------------------------------------------------------------
45 
47 public:
49  std::unique_ptr<Lattice2D> createLattice() const override;
50  void serialize(Streamer& s) override;
51  DoubleDescriptors geometryValues(bool withRotationAngle) const override
52  {
53  if (withRotationAngle)
55  return {m_length1, m_length2, m_angle};
56  }
57 
59  void setLatticeLength1(double length1);
60 
62  void setLatticeLength2(double length2);
63 
65  void setLatticeAngle(double angle);
66 
67 private:
71 };
72 
73 // -------------------------------------------------------------------------------------
74 
76 public:
78  std::unique_ptr<Lattice2D> createLattice() const override;
79  void serialize(Streamer& s) override;
80  DoubleDescriptors geometryValues(bool withRotationAngle) const override
81  {
82  if (withRotationAngle)
84  return {m_length};
85  }
86 
88  void setLatticeLength(double length);
89 
90 private:
92 };
93 
94 // -------------------------------------------------------------------------------------
95 
97 public:
99  std::unique_ptr<Lattice2D> createLattice() const override;
100  void serialize(Streamer& s) override;
101  DoubleDescriptors geometryValues(bool withRotationAngle) const override
102  {
103  if (withRotationAngle)
105  return {m_length};
106  }
107 
109  void setLatticeLength(double length);
110 
111 private:
113 };
114 
115 #endif // BORNAGAIN_GUI_MODEL_SAMPLE_LATTICE2DITEMS_H
QList< DoubleDescriptor > DoubleDescriptors
Defines class DoubleProperty.
DoubleProperty m_angle
DoubleDescriptor latticeAngle() const
DoubleDescriptors geometryValues(bool withRotationAngle) const override
std::unique_ptr< Lattice2D > createLattice() const override
void setLatticeLength2(double length2)
DoubleProperty m_length1
DoubleDescriptor latticeLength2() const
DoubleDescriptor latticeLength1() const
void setLatticeLength1(double length1)
void setLatticeAngle(double angle)
void serialize(Streamer &s) override
DoubleProperty m_length2
Describes properties of a double value which are necessary to allow GUI representation,...
Class for representing a double value, its attributes and its accessors.
DoubleProperty m_length
DoubleDescriptor latticeLength() const
std::unique_ptr< Lattice2D > createLattice() const override
void serialize(Streamer &s) override
DoubleDescriptors geometryValues(bool withRotationAngle) const override
void setLatticeLength(double length)
void setLatticeRotationAngle(double angle)
virtual ~Lattice2DItem()=default
virtual void serialize(Streamer &s)=0
virtual DoubleDescriptors geometryValues(bool withRotationAngle) const =0
double unitCellArea() const
virtual std::unique_ptr< Lattice2D > createLattice() const =0
DoubleDescriptor latticeRotationAngle() const
DoubleProperty m_latticeRotationAngle
DoubleDescriptor latticeLength() const
std::unique_ptr< Lattice2D > createLattice() const override
void setLatticeLength(double length)
void serialize(Streamer &s) override
DoubleDescriptors geometryValues(bool withRotationAngle) const override
DoubleProperty m_length
Supports serialization to or deserialization from QXmlStream.
Definition: Streamer.h:36