BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
DetectorItemCatalog.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/CatDevice/DetectorItemCatalog.cpp
6 //! @brief Implements class DetectorItemCatalog
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"
19 
21 {
22  switch (type) {
23  case Type::Spherical:
24  return new SphericalDetectorItem();
25  case Type::Rectangular:
26  return new RectangularDetectorItem();
27  }
28  ASSERT(false);
29 }
30 
31 QVector<DetectorItemCatalog::Type> DetectorItemCatalog::types()
32 {
34 }
35 
37 {
38  switch (type) {
39  case Type::Spherical:
40  return {"Spherical detector", ""};
41  case Type::Rectangular:
42  return {"Rectangular detector", ""};
43  }
44  ASSERT(false);
45 }
46 
48 {
49  if (dynamic_cast<const SphericalDetectorItem*>(item))
50  return Type::Spherical;
51  if (dynamic_cast<const RectangularDetectorItem*>(item))
52  return Type::Rectangular;
53 
54  ASSERT(false);
55 }
Defines class DetectorItemCatalog.
Defines class RectangularDetectorItem.
Defines class SphericalDetectorItem.
static UiInfo uiInfo(Type t)
UiInfo on the given type.
static DetectorItem * create(Type type)
Creates the item of the given type.
static Type type(const DetectorItem *item)
Returns the enum type of the given item.
static QVector< Type > types()
Available types of items.