BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
Data1DViewItem.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Models/Data1DViewItem.h
6 //! @brief Defines class Data1DViewItem
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_DATA1DVIEWITEM_H
16 #define BORNAGAIN_GUI_COREGUI_MODELS_DATA1DVIEWITEM_H
17 
19 
20 class AmplitudeAxisItem;
21 class BasicAxisItem;
23 class Data1DProperties;
24 class DataItem;
25 class JobItem;
26 template <class T> class OutputData;
27 
28 //! View model for 1D DataItem. Can represent several items
29 //! at once. In current implementation the first of carried
30 //! items determines axes' limits.
31 
32 class BA_CORE_API_ Data1DViewItem : public SessionItem {
33 public:
34  static const QString P_TITLE;
35  static const QString P_XAXIS;
36  static const QString P_YAXIS;
37  static const QString P_AXES_UNITS;
38  static const QString T_DATA_PROPERTIES;
39 
41 
42  //! Number of bins in data
43  int getNbins() const;
44 
45  //! returns lower and upper zoom ranges of x-axis
46  double getLowerX() const;
47  double getUpperX() const;
48 
49  //! returns lower and upper zoom ranges of y-axis
50  double getLowerY() const;
51  double getUpperY() const;
52 
53  bool isLog() const;
54  QString getXaxisTitle() const;
55  QString getYaxisTitle() const;
56 
57  const BasicAxisItem* xAxisItem() const;
58  BasicAxisItem* xAxisItem();
59  const AmplitudeAxisItem* yAxisItem() const;
60  AmplitudeAxisItem* yAxisItem();
61 
62  void resetView();
63 
64  void setXaxisTitle(const QString& title);
65  void setYaxisTitle(const QString& title);
66  void setAxesRangeToData();
67 
68  //! Returns data view to default state (no dimensional units, default axes' names)
69  void resetToDefault();
70 
71  //! Returns point data for drawing
72  QPair<QVector<double>, QVector<double>> graphData(Data1DProperties* property_item);
73 
74  //! Sets job item (for unit conversion) if DataItemView
75  //! is dynamically created outside of JobModel
76  void setJobItem(JobItem* job_item) { m_job_item = job_item; }
77 
78  //! Returns either parenting JobItem or
79  //! job item set with DataItem1DView::setJobItem.
80  JobItem* jobItem();
81 
82  void setLowerX(double value);
83  void setUpperX(double value);
84  void setLowerY(double value);
85  void setUpperY(double value);
86  void setLog(bool log_flag);
87 
88  DataPropertyContainer* propertyContainerItem();
89 
90 private:
91  QPair<double, double> dataRange(const OutputData<double>* data) const;
92 
94 };
95 
96 #endif // BORNAGAIN_GUI_COREGUI_MODELS_DATA1DVIEWITEM_H
Defines class SessionItem.
Holds data required for 1D DataItem representation.
View model for 1D DataItem.
static const QString P_YAXIS
JobItem * m_job_item
static const QString P_TITLE
static const QString P_AXES_UNITS
void setJobItem(JobItem *job_item)
Sets job item (for unit conversion) if DataItemView is dynamically created outside of JobModel.
static const QString P_XAXIS
static const QString T_DATA_PROPERTIES
Provides common functionality for IntensityDataItem and SpecularDataItem.
Definition: DataItem.h:29
Templated class to store data of type double or CumulativeValue in multi-dimensional space.
Definition: OutputData.h:32