BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
AxesItems.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/Device/AxesItems.h
6 //! @brief Defines various axis items
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_DEVICE_AXESITEMS_H
16 #define BORNAGAIN_GUI_MODEL_DEVICE_AXESITEMS_H
17 
19 #include "GUI/Model/Descriptor/DoubleDescriptor.h" // no forward declaration < used in many children
20 #include <memory>
21 
22 class IAxis;
23 class Streamer;
24 
25 class BasicAxisItem : public SessionItem {
26 private:
27  static constexpr auto P_IS_VISIBLE{"Visibility"};
28  static constexpr auto P_NBINS{"Nbins"};
29  static constexpr auto P_MIN_DEG{"Min [deg]"};
30  static constexpr auto P_MAX_DEG{"Max [deg]"};
31  static constexpr auto P_TITLE{"Title"};
32  static constexpr auto P_TITLE_IS_VISIBLE{"Title Visibility"};
33 
34 public:
35  static constexpr auto M_TYPE{"BasicAxis"};
36 
37  BasicAxisItem();
38  ~BasicAxisItem() override;
39 
40  virtual void serialize(Streamer& s);
41 
42  int binCount() const;
43  void setBinCount(size_t value);
44  SessionItem* binsItem() const;
45 
46  DoubleDescriptor min(const QString& unit = QString()) const;
47  void setLowerBound(double value);
48  SessionItem* minItem() const;
49 
50  DoubleDescriptor max(const QString& unit = QString()) const;
51  void setUpperBound(double value);
52  SessionItem* maxItem() const;
53 
54  /// either lower bound or upper bound property name
55  static bool isBoundsPropertiesName(const QString& name);
56 
57  QString title() const;
58  void setTitle(const QString& title);
59  SessionItem* titleItem() const;
60  static bool isTitlePropertyName(const QString& name);
61  bool isTitleVisible() const;
62  static bool isTitleVisiblePropertyName(const QString& name);
63 
64  virtual std::unique_ptr<IAxis> createAxis(double scale) const;
65 
66  SessionItem* visibilityItem() const;
67  bool visibilityValue() const;
68  void setVisibilityValue(bool b);
69  static bool isVisibilityPropertyName(const QString& name);
70 
71 protected:
72  explicit BasicAxisItem(const QString& type);
73 };
74 
76 private:
77  static constexpr auto P_IS_LOGSCALE{"log10"};
78  static constexpr auto P_LOCK_MIN_MAX{"Lock (min, max)"};
79 
80 public:
81  static constexpr auto M_TYPE{"AmplitudeAxis"};
82 
84  void serialize(Streamer& s) override;
85 
86  bool isLogScale() const;
87  void setLogScale(bool value);
88  SessionItem* logScaleItem() const;
89  static bool isLogScalePropertyName(const QString& name);
90 
91  bool isLocked() const;
92  void setLocked(bool locked);
93 };
94 
95 #endif // BORNAGAIN_GUI_MODEL_DEVICE_AXESITEMS_H
Defines class DoubleDescriptor.
Defines class SessionItem.
static bool isLogScalePropertyName(const QString &name)
Definition: AxesItems.cpp:193
static constexpr auto M_TYPE
Definition: AxesItems.h:81
static constexpr auto P_LOCK_MIN_MAX
Definition: AxesItems.h:78
static constexpr auto P_IS_LOGSCALE
Definition: AxesItems.h:77
bool isLogScale() const
Definition: AxesItems.cpp:178
void serialize(Streamer &s) override
Definition: AxesItems.cpp:170
SessionItem * logScaleItem() const
Definition: AxesItems.cpp:188
bool isLocked() const
Definition: AxesItems.cpp:198
void setLogScale(bool value)
Definition: AxesItems.cpp:183
void setLocked(bool locked)
Definition: AxesItems.cpp:203
SessionItem * maxItem() const
Definition: AxesItems.cpp:70
bool isTitleVisible() const
Definition: AxesItems.cpp:100
SessionItem * binsItem() const
Definition: AxesItems.cpp:36
void setVisibilityValue(bool b)
Definition: AxesItems.cpp:126
DoubleDescriptor min(const QString &unit=QString()) const
Definition: AxesItems.cpp:41
static bool isVisibilityPropertyName(const QString &name)
Definition: AxesItems.cpp:131
static constexpr auto P_NBINS
Definition: AxesItems.h:28
static bool isBoundsPropertiesName(const QString &name)
either lower bound or upper bound property name
Definition: AxesItems.cpp:75
SessionItem * visibilityItem() const
Definition: AxesItems.cpp:116
bool visibilityValue() const
Definition: AxesItems.cpp:121
SessionItem * minItem() const
Definition: AxesItems.cpp:53
QString title() const
Definition: AxesItems.cpp:80
int binCount() const
Definition: AxesItems.cpp:26
void setBinCount(size_t value)
Definition: AxesItems.cpp:31
virtual void serialize(Streamer &s)
Definition: AxesItems.cpp:149
~BasicAxisItem() override
static constexpr auto P_IS_VISIBLE
Definition: AxesItems.h:27
static constexpr auto P_TITLE
Definition: AxesItems.h:31
SessionItem * titleItem() const
Definition: AxesItems.cpp:90
static constexpr auto P_MAX_DEG
Definition: AxesItems.h:30
void setLowerBound(double value)
Definition: AxesItems.cpp:48
static constexpr auto P_TITLE_IS_VISIBLE
Definition: AxesItems.h:32
void setUpperBound(double value)
Definition: AxesItems.cpp:65
static bool isTitlePropertyName(const QString &name)
Definition: AxesItems.cpp:95
static constexpr auto P_MIN_DEG
Definition: AxesItems.h:29
static constexpr auto M_TYPE
Definition: AxesItems.h:35
virtual std::unique_ptr< IAxis > createAxis(double scale) const
Definition: AxesItems.cpp:110
DoubleDescriptor max(const QString &unit=QString()) const
Definition: AxesItems.cpp:58
static bool isTitleVisiblePropertyName(const QString &name)
Definition: AxesItems.cpp:105
void setTitle(const QString &title)
Definition: AxesItems.cpp:85
Describes properties of a double value which are necessary to allow GUI representation,...
Base class for a GUI data item.
Definition: SessionItem.h:204
QVariant value() const
Get value.
Supports serialization to or deserialization from QXmlStream.
Definition: Streamer.h:36
QString const & name(EShape k)
Definition: particles.cpp:20