BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
SaveProjectionsAssistant.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/Projection/SaveProjectionsAssistant.h
6 //! @brief Defines class SaveProjectionsAssistant
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_VIEW_PROJECTION_SAVEPROJECTIONSASSISTANT_H
16 #define BORNAGAIN_GUI_VIEW_PROJECTION_SAVEPROJECTIONSASSISTANT_H
17 
18 #include <QString>
19 #include <QVector>
20 #include <memory>
21 
22 class IntensityDataItem;
23 class QWidget;
24 class Datafield;
25 class SessionItem;
26 
27 //! Assistant class which save all projections of IndensityDataItem into ASCII file.
28 
30 public:
33 
34  void saveProjections(QWidget* parent, IntensityDataItem* intensityItem);
35 
36 private:
37  struct Projection {
38  double axis_value; //!< value on axis where projection has been made
39  QVector<double> bin_values;
40  };
41 
42  struct ProjectionsData {
44  QVector<double> bin_centers;
45  QVector<Projection> projections;
46  };
47 
48  QString projectionsToString(const QString& projectionsType, IntensityDataItem* intensityItem);
49 
50  std::unique_ptr<Datafield> m_field;
51  ProjectionsData projectionsData(const QString& projectionsType,
52  IntensityDataItem* intensityItem);
53  QVector<SessionItem*> projectionItems(const QString& projectionsType,
54  IntensityDataItem* intensityItem);
55 
57 };
58 
59 #endif // BORNAGAIN_GUI_VIEW_PROJECTION_SAVEPROJECTIONSASSISTANT_H
Assistant class which save all projections of IndensityDataItem into ASCII file.
QString projectionFileHeader(ProjectionsData &projectionsData)
Returns projections header. For projections along x it will be "# x y=6.0194 y=33....
std::unique_ptr< Datafield > m_field
ProjectionsData projectionsData(const QString &projectionsType, IntensityDataItem *intensityItem)
Returns projections data for all projections of given type (horizontal, vertical).
QString projectionsToString(const QString &projectionsType, IntensityDataItem *intensityItem)
Generates multi-line string with projections data of given type (horizontal, vertical).
QVector< SessionItem * > projectionItems(const QString &projectionsType, IntensityDataItem *intensityItem)
Returns vector of ProjectionItems sorted according to axis value.
void saveProjections(QWidget *parent, IntensityDataItem *intensityItem)
Calls file open dialog and writes projection data as ASCII.
Base class for a GUI data item.
Definition: SessionItem.h:204
double axis_value
value on axis where projection has been made