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
15
#include "
GUI/Model/CatDevice/FootprintItemCatalog.h
"
16
#include "Base/Util/Assert.h"
17
#include "
GUI/Model/Device/FootprintItems.h
"
18
19
FootprintItem
*
FootprintItemCatalog::create
(
Type
type)
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
{
34
return
{
Type::None
,
Type::Gaussian
,
Type::Square
};
35
}
36
37
FootprintItemCatalog::UiInfo
FootprintItemCatalog::uiInfo
(
Type
type)
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
50
FootprintItemCatalog::Type
FootprintItemCatalog::type
(
const
FootprintItem
* item)
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
}
FootprintItemCatalog.h
Defines class FootprintItemCatalog.
FootprintItems.h
Declares FootprintItem classes.
FootprintGaussianItem
Definition:
FootprintItems.h:36
FootprintItemCatalog::uiInfo
static UiInfo uiInfo(Type t)
UiInfo on the given type.
Definition:
FootprintItemCatalog.cpp:37
FootprintItemCatalog::type
static Type type(const FootprintItem *item)
Returns the enum type of the given item.
Definition:
FootprintItemCatalog.cpp:50
FootprintItemCatalog::Type
Type
Definition:
FootprintItemCatalog.h:28
FootprintItemCatalog::Type::None
@ None
FootprintItemCatalog::Type::Square
@ Square
FootprintItemCatalog::Type::Gaussian
@ Gaussian
FootprintItemCatalog::create
static FootprintItem * create(Type type)
Creates the item of the given type.
Definition:
FootprintItemCatalog.cpp:19
FootprintItemCatalog::types
static QVector< Type > types()
Available types of items.
Definition:
FootprintItemCatalog.cpp:32
FootprintItem
Definition:
FootprintItems.h:24
FootprintNoneItem
Definition:
FootprintItems.h:31
FootprintSquareItem
Definition:
FootprintItems.h:44
FootprintItemCatalog::UiInfo
Definition:
FootprintItemCatalog.h:30
GUI
Model
CatDevice
FootprintItemCatalog.cpp
Generated by
1.9.1