BornAgain  1.19.0
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/coregui/Models/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_COREGUI_MODELS_INTENSITYDATAITEM_H
16 #define BORNAGAIN_GUI_COREGUI_MODELS_INTENSITYDATAITEM_H
17 
19 
20 class BasicAxisItem;
21 class AmplitudeAxisItem;
22 class MaskContainerItem;
24 
25 class BA_CORE_API_ IntensityDataItem : public DataItem {
26 public:
27  static const QString P_PROJECTIONS_FLAG;
28  static const QString P_TITLE;
29  static const QString P_IS_INTERPOLATED;
30  static const QString P_GRADIENT;
31  static const QString P_XAXIS;
32  static const QString P_YAXIS;
33  static const QString P_ZAXIS;
34  static const QString T_MASKS;
35  static const QString T_PROJECTIONS;
36 
38 
39  void setOutputData(OutputData<double>* data) override;
40 
41  // TODO: consider using index-based functions for axes' handlers
42 
43  int getNbinsX() const;
44  int getNbinsY() const;
45 
46  //! returns lower and upper zoom ranges of x-axis
47  double getLowerX() const;
48  double getUpperX() const;
49 
50  //! returns min and max range of x-axis as given by IntensityData
51  double getXmin() const;
52  double getXmax() const;
53 
54  //! returns lower and upper zoom ranges of y-axis
55  double getLowerY() const;
56  double getUpperY() const;
57 
58  //! returns min and max range of y-axis as given by IntensityData
59  double getYmin() const;
60  double getYmax() const;
61 
62  //! returns lower and upper zoom ranges of z-axis
63  double getLowerZ() const;
64  double getUpperZ() const;
65 
66  QString getGradient() const;
67  bool isLogz() const;
68  bool isInterpolated() const;
69  QString getXaxisTitle() const;
70  QString getYaxisTitle() const;
71 
72  //! return true if min, max range of Z-axis is locked (change not allowed)
73  bool isZAxisLocked() const;
74  void setZAxisLocked(bool state);
75 
76  void updateDataRange();
77  void computeDataRange();
78  QPair<double, double> dataRange() const;
79 
80  const BasicAxisItem* xAxisItem() const;
81  BasicAxisItem* xAxisItem();
82  const BasicAxisItem* yAxisItem() const;
83  BasicAxisItem* yAxisItem();
84  const AmplitudeAxisItem* zAxisItem() const;
85  AmplitudeAxisItem* zAxisItem();
86 
87  void resetView();
88 
89  MaskContainerItem* maskContainerItem();
90  const MaskContainerItem* maskContainerItem() const;
91  ProjectionContainerItem* projectionContainerItem();
92  const ProjectionContainerItem* projectionContainerItem() const;
93 
94  bool hasMasks() const;
95  bool hasProjections() const;
96 
97  void setXaxisTitle(const QString& title) override;
98  void setYaxisTitle(const QString& title) override;
99  void setAxesRangeToData() override;
100  void updateAxesUnits(const InstrumentItem* instrument) override;
101  std::vector<int> shape() const override;
102 
103  //! Returns data to the state defined by user (imported)
104  //! data.
105  void reset(ImportDataInfo data) override;
106 
107 public slots:
108  void setLowerX(double value);
109  void setUpperX(double value);
110  void setLowerY(double value);
111  void setUpperY(double value);
112  void setLowerAndUpperZ(double zmin, double zmax);
113  void setLowerZ(double zmin);
114  void setUpperZ(double zmax);
115  void setLogz(bool logz);
116  void setInterpolated(bool interp);
117 
118 private:
119  void updateAxesZoomLevel();
120  void updateAxesLabels();
121 };
122 
123 #endif // BORNAGAIN_GUI_COREGUI_MODELS_INTENSITYDATAITEM_H
Declares class DataItem.
Provides common functionality for IntensityDataItem and SpecularDataItem.
Definition: DataItem.h:29
virtual void setAxesRangeToData()=0
virtual void updateAxesUnits(const InstrumentItem *instrument)=0
virtual void setOutputData(OutputData< double > *data)=0
The given pointer becomes owned by this class!!
Definition: DataItem.cpp:24
virtual void setXaxisTitle(const QString &title)=0
virtual std::vector< int > shape() const =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.
static const QString P_ZAXIS
static const QString P_YAXIS
static const QString T_PROJECTIONS
static const QString P_PROJECTIONS_FLAG
static const QString P_TITLE
static const QString P_XAXIS
static const QString P_GRADIENT
static const QString T_MASKS
static const QString P_IS_INTERPOLATED
Container holding various masks as children.
Definition: MaskItems.h:24
A container to hold ProjectionItems, intended to store projections of color map on X,...
QCPColorGradient getGradient(const QString &gradientName)
void setLogz(QCPColorScale *scale, bool isLogz)