BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
FootprintItems.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Models/FootprintItems.cpp
6 //! @brief Implements FootprintItem classes
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 
18 
19 namespace {
20 const QString footprint_value_name = "Width ratio";
21 const QString footprint_value_tooltip = "The ratio of beam and sample full widths";
22 } // namespace
23 
24 // Base class
25 /* ------------------------------------------------ */
26 
28 
30 
31 // Footprint none
32 /* ------------------------------------------------ */
33 
35 
37 
38 std::unique_ptr<IFootprintFactor> FootprintNoneItem::createFootprint() const
39 {
40  return {};
41 }
42 
43 // Gaussian footprint
44 /* ------------------------------------------------ */
45 
46 const QString FootprintGaussianItem::P_VALUE = footprint_value_name;
47 
49 {
50  addProperty(P_VALUE, 0.0)
52  .setToolTip(footprint_value_tooltip);
53 }
54 
56 
57 std::unique_ptr<IFootprintFactor> FootprintGaussianItem::createFootprint() const
58 {
59  return std::make_unique<FootprintGauss>(getItemValue(P_VALUE).toDouble());
60 }
61 
62 // Square footprint
63 /* ------------------------------------------------ */
64 
65 const QString FootprintSquareItem::P_VALUE = footprint_value_name;
66 
68 {
69  addProperty(P_VALUE, 0.0)
71  .setToolTip(footprint_value_tooltip);
72 }
73 
75 
76 std::unique_ptr<IFootprintFactor> FootprintSquareItem::createFootprint() const
77 {
78  return std::make_unique<FootprintSquare>(getItemValue(P_VALUE).toDouble());
79 }
Defines class FootprintGauss.
Declares FootprintItem classes.
Defines class FootprintSquare.
virtual ~FootprintGaussianItem()
std::unique_ptr< IFootprintFactor > createFootprint() const override
static const QString P_VALUE
virtual ~FootprintItem()
FootprintItem(const QString &model_type)
virtual ~FootprintNoneItem()
std::unique_ptr< IFootprintFactor > createFootprint() const override
virtual ~FootprintSquareItem()
static const QString P_VALUE
std::unique_ptr< IFootprintFactor > createFootprint() const override
static RealLimits nonnegative()
Creates an object which can have only positive values with 0. included.
Definition: RealLimits.cpp:115
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)
SessionItem & setLimits(const RealLimits &value)
std::string model_type
Definition: types.h:23