BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
DataProperties.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/Data/DataProperties.h
6 //! @brief Defines class DataProperties and its descendants
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_DATA_DATAPROPERTIES_H
16 #define BORNAGAIN_GUI_MODEL_DATA_DATAPROPERTIES_H
17 
18 #include "3rdparty/GUI/qcustomplot/qcustomplot.h"
20 
21 class DataItem;
22 
23 //! Implements a link to DataItem. If path name
24 //! of a DataItem changes, the link becomes invalid.
25 //! Also serves as a base for Data1DProperties
26 class BA_CORE_API_ DataProperties : public SessionItem {
27 private:
28  static constexpr auto P_DATALINK{"data link"};
29 
30 public:
31  void setDataItem(DataItem* item);
32  DataItem* dataItem();
33 
34 protected:
35  DataProperties(const QString& model_type);
36 };
37 
38 //! Holds data required for 1D DataItem representation
40 private:
41  static constexpr auto P_COLOR{"Color"};
42  static constexpr auto P_SCATTER{"Scatter"};
43  static constexpr auto P_LINE{"Line"};
44 
45 public:
46  static constexpr auto M_TYPE{"DataItem1DProperties"};
47 
49 
50  //! Creates and returns a color object from color name
51  QColor color();
52 
53  //! Returns the name of the color
54  QString colorName() const;
55 
56  //! Returns set up color ComboProperty.
57  void setColorProperty(const QString& color_name);
58 
59  //! Returns a QCP scatter object from its name
60  QCPScatterStyle::ScatterShape scatter();
61 
62  //! Returns a QCP line object from its name
63  QCPGraph::LineStyle line();
64 
65  //! Set up scatter for qcustomplot.
66  void setScatterProperty(const QString& scatter_name);
67 
68  //! Set up line for qcustomplot.
69  void setLineProperty(const QString& line_name);
70 
71  //! Returns the name of the color, which follows the color of passes property
72  //! container. If the container is nullptr or has the last-in-queue color,
73  //! Returns default color.
74  static const QString& nextColorName(Data1DProperties* properties);
75 };
76 
77 #endif // BORNAGAIN_GUI_MODEL_DATA_DATAPROPERTIES_H
Defines class SessionItem.
Holds data required for 1D DataItem representation.
void setColorProperty(const QString &color_name)
Returns set up color ComboProperty.
static constexpr auto P_COLOR
static const QString & nextColorName(Data1DProperties *properties)
Returns the name of the color, which follows the color of passes property container....
QColor color()
Creates and returns a color object from color name.
QCPScatterStyle::ScatterShape scatter()
Returns a QCP scatter object from its name.
void setLineProperty(const QString &line_name)
Set up line for qcustomplot.
static constexpr auto M_TYPE
static constexpr auto P_SCATTER
QString colorName() const
Returns the name of the color.
static constexpr auto P_LINE
QCPGraph::LineStyle line()
Returns a QCP line object from its name.
void setScatterProperty(const QString &scatter_name)
Set up scatter for qcustomplot.
Abstract base class for IntensityDataItem and SpecularDataItem. Owns one simulated data set of type D...
Definition: DataItem.h:34
Implements a link to DataItem. If path name of a DataItem changes, the link becomes invalid....
Base class for a GUI data item.
Definition: SessionItem.h:204