BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
FitParameterItem.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/Job/FitParameterItem.h
6 //! @brief Defines class FitParameterItem
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 
15 #ifndef BORNAGAIN_GUI_MODEL_JOB_FITPARAMETERITEM_H
16 #define BORNAGAIN_GUI_MODEL_JOB_FITPARAMETERITEM_H
17 
18 #include "Fit/Param/AttLimits.h"
20 
22 
23 //! FitParameterItems is a collection of items to define fit parameters in GUI.
24 
25 //! The FitParameterItem class represents a fit parameter in GUI. Contains links to corresponding
26 //! ParameterItem's in a tuning tree.
27 
28 class FitParameterItem : public SessionItem {
29 private:
30  static constexpr auto P_TYPE{"Type"};
31  static constexpr auto P_START_VALUE{"Value"};
32  static constexpr auto P_MIN{"Min"};
33  static constexpr auto P_MAX{"Max"};
34  static constexpr auto T_LINK{"Link tag"};
35 
36 public:
37  static constexpr auto M_TYPE{"FitParameter"};
38 
40 
41  void initMinMaxValues(const RealLimits& limits);
42 
43  AttLimits attLimits() const;
44 
45  bool isValid() const;
46 
47  double startValue() const;
48  void setStartValue(double start_value);
49  SessionItem* startValueItem() const;
50 
51  double minimum() const;
52  void setMinimum(double minimum);
53  SessionItem* minimumItem() const;
54 
55  double maximum() const;
56  void setMaximum(double maximum);
57  SessionItem* maximumItem() const;
58 
59  void addLink(const QString& title, const QString& link);
60  void removeLink(const QString& link);
61 
62  QVector<FitParameterLinkItem*> linkItems() const;
63  QStringList links() const;
64 
65  SessionItem* typeItem() const;
66 
67 private:
68  QString parameterType() const;
69  void onTypeChange();
70  void setLimitEnabled(const QString& name, bool enabled);
71  bool isLimited() const;
72  bool isFree() const;
73  bool isLowerLimited() const;
74  bool isUpperLimited() const;
75  bool isFixed() const;
76 };
77 
78 #endif // BORNAGAIN_GUI_MODEL_JOB_FITPARAMETERITEM_H
Defines class SessionItem.
FitParameterItems is a collection of items to define fit parameters in GUI.
double minimum() const
SessionItem * minimumItem() const
void setMaximum(double maximum)
double maximum() const
SessionItem * maximumItem() const
bool isLimited() const
QVector< FitParameterLinkItem * > linkItems() const
void setLimitEnabled(const QString &name, bool enabled)
Set limit property with given name to the enabled state.
bool isUpperLimited() const
void setStartValue(double start_value)
SessionItem * typeItem() const
void removeLink(const QString &link)
QStringList links() const
static constexpr auto T_LINK
static constexpr auto M_TYPE
void onTypeChange()
Enables/disables min, max properties on FitParameterItem's type.
static constexpr auto P_MIN
static constexpr auto P_START_VALUE
bool isLowerLimited() const
double startValue() const
void setMinimum(double minimum)
void initMinMaxValues(const RealLimits &limits)
Inits P_MIN and P_MAX taking into account current value and external limits.
QString parameterType() const
SessionItem * startValueItem() const
static constexpr auto P_MAX
void addLink(const QString &title, const QString &link)
AttLimits attLimits() const
Constructs Limits correspodning to current GUI settings.
static constexpr auto P_TYPE
The FitParameterLinkItem class holds a link to ParameterItem in tuning tree.
Base class for a GUI data item.
Definition: SessionItem.h:204
RealLimits limits() const
QString const & name(EShape k)
Definition: particles.cpp:20