BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
DetectorMaskDelegate Class Reference

The DetectorMaskDelegate class provides synchronization between DetectorItem (defined in InstrumentModel) and temporary IntensityDataItem (defined in temporary SessionModel). More...

Inheritance diagram for DetectorMaskDelegate:
[legend]
Collaboration diagram for DetectorMaskDelegate:
[legend]

Public Member Functions

 DetectorMaskDelegate (QObject *parent)
 
void initMaskEditorContext (MaskEditor *maskEditor, InstrumentModel *instrumentModel, DetectorItem *detectorItem)
 

Private Member Functions

void createIntensityDataItem ()
 Creates IntensityDataItem from DetectorItem for later usage in MaskEditor. More...
 

Private Attributes

DetectorItemm_detectorItem
 
InstrumentModelm_instrumentModel
 
IntensityDataItemm_intensityItem
 
SessionModelm_tempIntensityDataModel
 

Detailed Description

The DetectorMaskDelegate class provides synchronization between DetectorItem (defined in InstrumentModel) and temporary IntensityDataItem (defined in temporary SessionModel).

The later one is used by MaskEditor for mask drawing.

Definition at line 31 of file DetectorMaskDelegate.h.

Constructor & Destructor Documentation

◆ DetectorMaskDelegate()

DetectorMaskDelegate::DetectorMaskDelegate ( QObject *  parent)

Definition at line 26 of file DetectorMaskDelegate.cpp.

27  : QObject(parent)
28  , m_tempIntensityDataModel(new SessionModel("TempIntensityDataModel", this))
29  , m_instrumentModel(nullptr)
30  , m_detectorItem(nullptr)
31  , m_intensityItem(nullptr)
32 {
33 }
SessionModel * m_tempIntensityDataModel
IntensityDataItem * m_intensityItem
DetectorItem * m_detectorItem
InstrumentModel * m_instrumentModel

Member Function Documentation

◆ createIntensityDataItem()

void DetectorMaskDelegate::createIntensityDataItem ( )
private

Creates IntensityDataItem from DetectorItem for later usage in MaskEditor.

As amplitude, value 1.0 is set for each bin. The object additionally tuned to appear nicely on ColorMap plot.

Definition at line 56 of file DetectorMaskDelegate.cpp.

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 }
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
static const QString P_PROJECTIONS_FLAG
const AmplitudeAxisItem * zAxisItem() const
static const QString P_IS_INTERPOLATED
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
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

References ModelPath::ancestor(), SessionModel::clear(), JobItemUtils::createDefaultDetectorMap(), SessionItem::getItem(), DataItem::getOutputData(), SessionModel::insertItem(), m_detectorItem, m_intensityItem, m_tempIntensityDataModel, DataItem::P_AXES_UNITS, IntensityDataItem::P_IS_INTERPOLATED, BasicAxisItem::P_IS_VISIBLE, AmplitudeAxisItem::P_LOCK_MIN_MAX, IntensityDataItem::P_PROJECTIONS_FLAG, OutputData< T >::setAllTo(), SessionItem::setEnabled(), SessionItem::setItemValue(), and IntensityDataItem::zAxisItem().

Referenced by initMaskEditorContext().

Here is the call graph for this function:

◆ initMaskEditorContext()

void DetectorMaskDelegate::initMaskEditorContext ( MaskEditor maskEditor,
InstrumentModel instrumentModel,
DetectorItem detectorItem 
)

Definition at line 35 of file DetectorMaskDelegate.cpp.

38 {
39  m_instrumentModel = instrumentModel;
40  m_detectorItem = detectorItem;
41 
44 
47 
51 }
#define ASSERT(condition)
Definition: Assert.h:31
MaskContainerItem * maskContainerItem() const
void createMaskContainer()
void createIntensityDataItem()
Creates IntensityDataItem from DetectorItem for later usage in MaskEditor.
void setMaskContext(SessionModel *model, const QModelIndex &maskContainerIndex, IntensityDataItem *intensityItem)
Main method to setup context for mask editing.
Definition: MaskEditor.cpp:50
QModelIndex indexOfItem(SessionItem *item) const

References ASSERT, createIntensityDataItem(), DetectorItem::createMaskContainer(), SessionModel::indexOfItem(), m_detectorItem, m_instrumentModel, m_intensityItem, DetectorItem::maskContainerItem(), and MaskEditor::setMaskContext().

Referenced by ExtendedDetectorDialog::setDetectorContext().

Here is the call graph for this function:

Member Data Documentation

◆ m_detectorItem

DetectorItem* DetectorMaskDelegate::m_detectorItem
private

Definition at line 45 of file DetectorMaskDelegate.h.

Referenced by createIntensityDataItem(), and initMaskEditorContext().

◆ m_instrumentModel

InstrumentModel* DetectorMaskDelegate::m_instrumentModel
private

Definition at line 44 of file DetectorMaskDelegate.h.

Referenced by initMaskEditorContext().

◆ m_intensityItem

IntensityDataItem* DetectorMaskDelegate::m_intensityItem
private

Definition at line 46 of file DetectorMaskDelegate.h.

Referenced by createIntensityDataItem(), and initMaskEditorContext().

◆ m_tempIntensityDataModel

SessionModel* DetectorMaskDelegate::m_tempIntensityDataModel
private

Definition at line 43 of file DetectorMaskDelegate.h.

Referenced by createIntensityDataItem().


The documentation for this class was generated from the following files: