BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
RotationItemCatalog.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/CatSample/RotationItemCatalog.cpp
6 //! @brief Implements class RotationItemCatalog
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 
16 #include "Base/Util/Assert.h"
18 
20 {
21  switch (type) {
22  case Type::None:
23  return nullptr;
24  case Type::X:
25  return new XRotationItem();
26  case Type::Y:
27  return new YRotationItem();
28  case Type::Z:
29  return new ZRotationItem();
30  case Type::Euler:
31  return new EulerRotationItem();
32  }
33  ASSERT(false);
34 }
35 
36 QVector<RotationItemCatalog::Type> RotationItemCatalog::types()
37 {
39 }
40 
42 {
43  switch (type) {
44  case Type::None:
45  return {"None", "", ""};
46  case Type::X:
47  return {"X axis Rotation", "Particle rotation around x-axis", ""};
48  case Type::Y:
49  return {"Y axis Rotation", "Particle rotation around y-axis", ""};
50  case Type::Z:
51  return {"Z axis Rotation", "Particle rotation around z-axis", ""};
52  case Type::Euler:
53  return {"Euler Rotation",
54  "Sequence of three rotations following Euler angles; notation z-x'-z'", ""};
55  }
56  ASSERT(false);
57 }
58 
60 {
61  if (!item)
62  return Type::None;
63 
64  if (dynamic_cast<const XRotationItem*>(item))
65  return Type::X;
66  if (dynamic_cast<const YRotationItem*>(item))
67  return Type::Y;
68  if (dynamic_cast<const ZRotationItem*>(item))
69  return Type::Z;
70  if (dynamic_cast<const EulerRotationItem*>(item))
71  return Type::Euler;
72 
73  ASSERT(false);
74 }
Defines class RotationItemCatalog.
Defines class RotationItems.
static Type type(const RotationItem *item)
Returns the enum type of the given item.
static QVector< Type > types()
Available types of interference items.
static UiInfo uiInfo(Type t)
UiInfo on the given type.
static RotationItem * create(Type type)
Creates the item of the given type.