BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
Lattice2DItems.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Models/Lattice2DItems.cpp
6 //! @brief Implements 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 
16 #include "Base/Const/Units.h"
18 
19 namespace {
20 const QString axis_rotation_tooltip =
21  "Rotation of lattice with respect to x-axis of reference frame \n"
22  "(beam direction) in degrees";
23 }
24 
25 const QString Lattice2DItem::P_LATTICE_ROTATION_ANGLE = QString::fromStdString("Xi");
26 
27 Lattice2DItem::Lattice2DItem(const QString& modelType) : SessionItem(modelType) {}
28 
30 {
31  return createLattice()->unitCellArea();
32 }
33 
34 const QString BasicLattice2DItem::P_LATTICE_LENGTH1 = QString::fromStdString("LatticeLength1");
35 const QString BasicLattice2DItem::P_LATTICE_LENGTH2 = QString::fromStdString("LatticeLength2");
36 const QString BasicLattice2DItem::P_LATTICE_ANGLE = QString::fromStdString("Alpha");
37 
39 {
40  setToolTip("Two dimensional lattice");
42  ->setToolTip("Length of first lattice vector in nanometers");
44  ->setToolTip("Length of second lattice vector in nanometers");
45  addProperty(P_LATTICE_ANGLE, 90.0)->setToolTip("Angle between lattice vectors in degrees");
47 }
48 
49 std::unique_ptr<Lattice2D> BasicLattice2DItem::createLattice() const
50 {
51  return std::make_unique<BasicLattice2D>(
55 }
56 
57 // --------------------------------------------------------------------------------------------- //
58 
59 const QString SquareLattice2DItem::P_LATTICE_LENGTH = QString::fromStdString("LatticeLength");
60 
62 {
64  ->setToolTip("Length of first and second lattice vectors in nanometers");
66 }
67 
68 std::unique_ptr<Lattice2D> SquareLattice2DItem::createLattice() const
69 {
70  return std::make_unique<SquareLattice2D>(
71  getItemValue(P_LATTICE_LENGTH).toDouble(),
73 }
74 
75 // --------------------------------------------------------------------------------------------- //
76 
77 const QString HexagonalLattice2DItem::P_LATTICE_LENGTH = QString::fromStdString("LatticeLength");
78 
80 {
82  ->setToolTip("Length of first and second lattice vectors in nanometers");
84 }
85 
86 std::unique_ptr<Lattice2D> HexagonalLattice2DItem::createLattice() const
87 {
88  return std::make_unique<HexagonalLattice2D>(
89  getItemValue(P_LATTICE_LENGTH).toDouble(),
91 }
Defines classes Lattice2DItems.
Defines classes of Lattice2D family.
Defines some unit conversion factors and other constants in namespace Units.
std::unique_ptr< Lattice2D > createLattice() const
static const QString P_LATTICE_ANGLE
static const QString P_LATTICE_LENGTH2
static const QString P_LATTICE_LENGTH1
static const QString P_LATTICE_LENGTH
std::unique_ptr< Lattice2D > createLattice() const
static const QString P_LATTICE_ROTATION_ANGLE
Lattice2DItem(const QString &modelType)
double unitCellArea() const
virtual std::unique_ptr< Lattice2D > createLattice() const =0
SessionItem * addProperty(const QString &name, const QVariant &variant)
Add new property item and register new tag.
QVariant getItemValue(const QString &tag) const
Directly access value of item under given tag.
SessionItem & setToolTip(const QString &tooltip)
std::unique_ptr< Lattice2D > createLattice() const
static const QString P_LATTICE_LENGTH
double deg2rad(double angle)
Definition: Units.h:59