BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
FootprintItemCatalog.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/CatDevice/FootprintItemCatalog.cpp
6 //! @brief Implements class FootprintItemCatalog
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 new FootprintNoneItem();
24  case Type::Gaussian:
25  return new FootprintGaussianItem();
26  case Type::Square:
27  return new FootprintSquareItem();
28  }
29  ASSERT(false);
30 }
31 
32 QVector<FootprintItemCatalog::Type> FootprintItemCatalog::types()
33 {
35 }
36 
38 {
39  switch (type) {
40  case Type::None:
41  return {"None", ""};
42  case Type::Gaussian:
43  return {"Gaussian footprint", ""};
44  case Type::Square:
45  return {"Square footprint", ""};
46  }
47  ASSERT(false);
48 }
49 
51 {
52  if (dynamic_cast<const FootprintNoneItem*>(item))
53  return Type::None;
54  if (dynamic_cast<const FootprintGaussianItem*>(item))
55  return Type::Gaussian;
56  if (dynamic_cast<const FootprintSquareItem*>(item))
57  return Type::Square;
58 
59  ASSERT(false);
60 }
Defines class FootprintItemCatalog.
Declares FootprintItem classes.
static UiInfo uiInfo(Type t)
UiInfo on the given type.
static Type type(const FootprintItem *item)
Returns the enum type of the given item.
static FootprintItem * create(Type type)
Creates the item of the given type.
static QVector< Type > types()
Available types of items.