BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
IntensityDataItem.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/Data/IntensityDataItem.h
6 //! @brief Defines class IntensityDataItem
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_INTENSITYDATAITEM_H
16 #define BORNAGAIN_GUI_MODEL_DATA_INTENSITYDATAITEM_H
17 
20 
21 class BasicAxisItem;
22 class AmplitudeAxisItem;
23 class MaskContainerItem;
25 
26 class BA_CORE_API_ IntensityDataItem : public DataItem {
27 private:
28  static constexpr auto P_PROJECTIONS{"Projections"};
29  static constexpr auto P_TITLE{"Title"};
30  static constexpr auto P_IS_INTERPOLATED{"Interpolation"};
31  static constexpr auto P_GRADIENT{"Gradient"};
32  static constexpr auto P_XAXIS{"x-axis"};
33  static constexpr auto P_YAXIS{"y-axis"};
34  static constexpr auto P_ZAXIS{"color-axis"};
35  static constexpr auto T_MASKS{"Mask tag"};
36  static constexpr auto T_PROJECTIONS{"Projection tag"};
37 
38 public:
39  static constexpr auto M_TYPE{"IntensityData"};
40 
42 
43  void setDatafield(Datafield* data) override;
44 
45  // TODO: consider using index-based functions for axes' handlers
46 
47  int xSize() const;
48  int ySize() const;
49 
50  //! Returns lower and upper zoom ranges of x-axis
51  double getLowerX() const;
52  double getUpperX() const;
53 
54  //! Returns min and max range of x-axis as given by IntensityData
55  double xMin() const;
56  double xMax() const;
57 
58  //! Returns lower and upper zoom ranges of y-axis
59  double getLowerY() const;
60  double getUpperY() const;
61 
62  //! Returns min and max range of y-axis as given by IntensityData
63  double yMin() const;
64  double yMax() const;
65 
66  //! Returns lower and upper zoom ranges of z-axis
67  double getLowerZ() const;
68  double getUpperZ() const;
69 
70  QString getGradientValue() const;
71  ComboProperty getGradient() const;
72  void setGradient(const ComboProperty& gradient);
73  SelectionDescriptor<QString> gradient() const;
74 
75  bool isLogz() const;
76  bool isInterpolated() const;
77  QString getXaxisTitle() const;
78  QString getYaxisTitle() const;
79 
80  //! Returns true if min, max range of Z-axis is locked (change not allowed)
81  bool isZAxisLocked() const;
82  void setZAxisLocked(bool state);
83 
84  void updateDataRange();
85  void computeDataRange();
86  QPair<double, double> dataRange() const;
87 
88  const BasicAxisItem* xAxisItem() const;
89  BasicAxisItem* xAxisItem();
90  const BasicAxisItem* yAxisItem() const;
91  BasicAxisItem* yAxisItem();
92  const AmplitudeAxisItem* zAxisItem() const;
93  AmplitudeAxisItem* zAxisItem();
94 
95  void resetView();
96 
97  MaskContainerItem* maskContainerItem();
98  const MaskContainerItem* maskContainerItem() const;
99  MaskContainerItem* getOrCreateMaskContainerItem();
100 
101  ProjectionContainerItem* projectionContainerItem();
102  const ProjectionContainerItem* projectionContainerItem() const;
103  ProjectionContainerItem* getOrCreateProjectionContainerItem();
104 
105  bool hasMasks() const;
106  bool hasProjections() const;
107 
108  void setXaxisTitle(const QString& title) override;
109  void setYaxisTitle(const QString& title) override;
110  void setAxesRangeToData() override;
111  void updateCoords(const InstrumentItem* instrument) override;
112  std::vector<int> shape() const override;
113 
114  //! Returns data to the state defined by user (imported) data.
115  void reset(ImportDataInfo data) override;
116 
117  static bool isInterpolatedPropertyName(const QString& name);
118  static bool isGradientPropertyName(const QString& name);
119  static bool isXaxisPropertyName(const QString& name);
120  static bool isYaxisPropertyName(const QString& name);
121  static bool isZaxisPropertyName(const QString& name);
122 
123 public slots:
124  void setLowerX(double value);
125  void setUpperX(double value);
126  void setLowerY(double value);
127  void setUpperY(double value);
128  void setLowerAndUpperZ(double zmin, double zmax);
129  void setLowerZ(double zmin);
130  void setUpperZ(double zmax);
131  void setLogz(bool logz);
132  void setInterpolated(bool interp);
133 
134 private:
135  void updateAxesZoomLevel();
136  void updateAxesLabels();
137 };
138 
139 #endif // BORNAGAIN_GUI_MODEL_DATA_INTENSITYDATAITEM_H
Declares class DataItem.
Defines class SelectionDescriptor.
Custom property to define list of string values with multiple selections. Intended for QVariant.
Definition: ComboProperty.h:25
Abstract base class for IntensityDataItem and SpecularDataItem. Owns one simulated data set of type D...
Definition: DataItem.h:34
virtual void setAxesRangeToData()=0
virtual void setDatafield(Datafield *data)=0
The given pointer becomes owned by this class!!
Definition: DataItem.cpp:20
virtual void setXaxisTitle(const QString &title)=0
virtual std::vector< int > shape() const =0
virtual void updateCoords(const InstrumentItem *instrument)=0
virtual void setYaxisTitle(const QString &title)=0
virtual void reset(ImportDataInfo data)=0
Resets data to the state defined by user (imported) data.
Carries information about loaded data.
Abstract base class for instrument-specific item classes.
Container holding various masks as children.
Definition: MaskItems.h:202
A container to hold ProjectionItems, intended to store projections of color map on X,...
Describes a selection (various possibilities and the current one).
QString const & name(EShape k)
Definition: particles.cpp:20
void setLogz(QCPColorScale *scale, bool isLogz)
Definition: RangeUtils.cpp:110
QCPColorGradient getGradient(const QString &gradientName)
Definition: RangeUtils.cpp:64