BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
DetectorMaskDelegate.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Views/InstrumentWidgets/DetectorMaskDelegate.cpp
6 //! @brief Implements class DetectorMaskDelegate
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 
25 
27  : QObject(parent)
28  , m_tempIntensityDataModel(new SessionModel("TempIntensityDataModel", this))
29  , m_instrumentModel(nullptr)
30  , m_detectorItem(nullptr)
31  , m_intensityItem(nullptr)
32 {
33 }
34 
36  InstrumentModel* instrumentModel,
37  DetectorItem* detectorItem)
38 {
39  m_instrumentModel = instrumentModel;
40  m_detectorItem = detectorItem;
41 
44 
47 
51 }
52 
53 //! Creates IntensityDataItem from DetectorItem for later usage in MaskEditor.
54 //! As amplitude, value 1.0 is set for each bin.
55 //! The object additionally tuned to appear nicely on ColorMap plot.
57 {
62 
63  auto zAxisItem = m_intensityItem->zAxisItem();
64  zAxisItem->setItemValue(BasicAxisItem::P_IS_VISIBLE, false);
65  zAxisItem->setLowerBound(0.0);
66  zAxisItem->setUpperBound(2.0);
67  zAxisItem->setLogScale(false);
68  zAxisItem->setItemValue(AmplitudeAxisItem::P_LOCK_MIN_MAX, true);
69 
70  // creating output data corresponding to the detector
71  auto instrument = dynamic_cast<const GISASInstrumentItem*>(
72  ModelPath::ancestor(m_detectorItem, "GISASInstrument"));
74 
77 }
#define ASSERT(condition)
Definition: Assert.h:31
Defines various axis items.
Defines classes DetectorItems.
Defines class DetectorMaskDelegate.
Defines InstrumentItems classes.
Defines class InstrumentModel.
Defines class IntensityDataItem.
Defines class JobItemUtils.
Defines class MaskEditor.
Defines MaskItems classes.
Defines ModelPath namespace.
static const QString P_LOCK_MIN_MAX
Definition: AxesItems.h:56
static const QString P_IS_VISIBLE
Definition: AxesItems.h:25
OutputData< double > * getOutputData()
Definition: DataItem.h:36
static const QString P_AXES_UNITS
Definition: DataItem.h:34
MaskContainerItem * maskContainerItem() const
void createMaskContainer()
void createIntensityDataItem()
Creates IntensityDataItem from DetectorItem for later usage in MaskEditor.
void initMaskEditorContext(MaskEditor *maskEditor, InstrumentModel *instrumentModel, DetectorItem *detectorItem)
SessionModel * m_tempIntensityDataModel
IntensityDataItem * m_intensityItem
DetectorItem * m_detectorItem
DetectorMaskDelegate(QObject *parent)
InstrumentModel * m_instrumentModel
static const QString P_PROJECTIONS_FLAG
const AmplitudeAxisItem * zAxisItem() const
static const QString P_IS_INTERPOLATED
Main class to draw masks on top of intensity data map.
Definition: MaskEditor.h:31
void setMaskContext(SessionModel *model, const QModelIndex &maskContainerIndex, IntensityDataItem *intensityItem)
Main method to setup context for mask editing.
Definition: MaskEditor.cpp:50
void setAllTo(const T &value)
Sets content of output data to specific value.
Definition: OutputData.h:476
void setItemValue(const QString &tag, const QVariant &variant)
Directly set value of item under given tag.
void setEnabled(bool enabled)
SessionItem * getItem(const QString &tag="", int row=0) const
Returns item in given row of given tag.
virtual void clear()
T * insertItem(SessionItem *parent=nullptr, int row=-1, QString tag="")
Definition: SessionModel.h:125
QModelIndex indexOfItem(SessionItem *item) const
void createDefaultDetectorMap(DataItem *intensityItem, const InstrumentItem *instrumentItem)
const SessionItem * ancestor(const SessionItem *item, const QString &requiredModelType)
Returns ancestor of given modelType for given item.
Definition: ModelPath.cpp:87