BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
MaskUnitsConverter.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/Device/MaskUnitsConverter.h
6 //! @brief Defines class MaskUnitsConverter
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_DEVICE_MASKUNITSCONVERTER_H
16 #define BORNAGAIN_GUI_MODEL_DEVICE_MASKUNITSCONVERTER_H
17 
18 class IntensityDataItem;
19 class SessionItem;
20 class IAxis;
21 class Datafield;
22 class QString;
23 class MaskItem;
24 
25 //! The MaskUnitsConverter converts coordinates of all masks from one units to anoter.
26 //! I.e. masks in 'mm' into masks in 'deg'. This is done in two steps.
27 //! On first step masks are converted from native coordinates (as given by axes of Datafield)
28 //! into bin-fraction coordinates.
29 //! On second step masks are converted from bin-fraction coordinates into current axes of
30 //! Datafield.
31 
33 public:
35 
37 
38  void convertToNbins(IntensityDataItem* intensityData);
39  void convertFromNbins(IntensityDataItem* intensityData);
40 
41 private:
42  enum class Axis { X, Y };
43 
44  void convertIntensityDataItem(IntensityDataItem* intensityData);
45  void convertMask(MaskItem* maskItem);
46 
47  void convertCoordinate(SessionItem* maskItem, const QString& xname, const QString& yname);
48 
49  double convert(double value, Axis axis);
50 
51  const Datafield* m_data;
53 };
54 
55 #endif // BORNAGAIN_GUI_MODEL_DEVICE_MASKUNITSCONVERTER_H
A base class for all mask items.
Definition: MaskItems.h:27
The MaskUnitsConverter converts coordinates of all masks from one units to anoter....
void convertIntensityDataItem(IntensityDataItem *intensityData)
Converts all masks on board of IntensityDataItem from/to bin-fraction coordinates.
void convertMask(MaskItem *maskItem)
Converts single mask from/to bin-fraction coordinates.
EConvertionDirection m_direction
double convert(double value, Axis axis)
Convert value of axis from/to bin-fraction coordinates.
void convertToNbins(IntensityDataItem *intensityData)
Converts all masks on board of IntensityDataItem into bin-fraction coordinates.
const Datafield * m_data
void convertFromNbins(IntensityDataItem *intensityData)
Converts all masks on board of IntensityDataItem from bin-fraction coordinates to coordinates of axes...
void convertCoordinate(SessionItem *maskItem, const QString &xname, const QString &yname)
Convert (x,y) coordinates registered as property (i.e. under P_XPOS, P_YPOS) from/to bin-fraction coo...
Base class for a GUI data item.
Definition: SessionItem.h:204