BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
The LinkInstrumentManager class provides communication between InstrumentModel and RealDataModel. More...
Public Member Functions | |
LinkInstrumentManager (QObject *parent=nullptr) | |
bool | canLinkDataToInstrument (const RealDataItem *realDataItem, const QString &identifier, bool quiet=false) |
quiet defines whether a "not possible" message box is shown if link is not possible. More... | |
QList< RealDataItem * > | linkedRealDataItems (InstrumentItem *instrumentItem) |
Returns list of RealDataItem's linked to given instrument. More... | |
void | setModels (InstrumentModel *instrumentModel, RealDataModel *realDataModel) |
Sets models and builds initial links. More... | |
Private Slots | |
void | onInstrumentAddedOrRemoved () |
Updates map of instruments on insert/remove InstrumentItem event. More... | |
void | onInstrumentChildChange (InstrumentItem *instrument, SessionItem *child) |
Perform actions on instrument children change. More... | |
void | updateInstrumentSubscriptions () |
Set up callbacks to all instrument items. More... | |
Private Attributes | |
InstrumentModel * | m_instrumentModel |
RealDataModel * | m_realDataModel |
The LinkInstrumentManager class provides communication between InstrumentModel and RealDataModel.
Particularly, it notifies RealDataItem about changes in linked instruments to adjust axes of IntensityDataItem.
Definition at line 35 of file LinkInstrumentManager.h.
|
explicit |
Definition at line 33 of file LinkInstrumentManager.cpp.
bool LinkInstrumentManager::canLinkDataToInstrument | ( | const RealDataItem * | realDataItem, |
const QString & | identifier, | ||
bool | quiet = false |
||
) |
quiet defines whether a "not possible" message box is shown if link is not possible.
Returns true if RealDataItem can be linked to the instrument (same number of bins).
Use this e.g. for unit tests. The question for adjusting the instrument is not suppressed by this flag.
Also offers dialog to adjust instrument to match shape of real data.
Definition at line 64 of file LinkInstrumentManager.cpp.
References ImportDataUtils::Compatible(), InstrumentModel::findInstrumentById(), RealDataItem::hasNativeData(), RealDataItem::holdsDimensionalData(), MainWindow::instance(), RealDataItem::isSpecularData(), m_instrumentModel, ImportDataUtils::printShapeMessage(), RealDataItem::shape(), and GUIHelpers::warning().
QList< RealDataItem * > LinkInstrumentManager::linkedRealDataItems | ( | InstrumentItem * | instrumentItem | ) |
Returns list of RealDataItem's linked to given instrument.
Definition at line 151 of file LinkInstrumentManager.cpp.
References ASSERT, InstrumentItem::id(), m_realDataModel, and RealDataModel::realDataItems().
Referenced by onInstrumentChildChange().
|
privateslot |
Updates map of instruments on insert/remove InstrumentItem event.
Definition at line 123 of file LinkInstrumentManager.cpp.
References InstrumentModel::instrumentExists(), m_instrumentModel, m_realDataModel, RealDataModel::realDataItems(), and updateInstrumentSubscriptions().
Referenced by setModels().
|
privateslot |
Perform actions on instrument children change.
Definition at line 105 of file LinkInstrumentManager.cpp.
References InstrumentItem::alignedWith(), ASSERT, and linkedRealDataItems().
Referenced by updateInstrumentSubscriptions().
void LinkInstrumentManager::setModels | ( | InstrumentModel * | instrumentModel, |
RealDataModel * | realDataModel | ||
) |
Sets models and builds initial links.
Definition at line 40 of file LinkInstrumentManager.cpp.
References ASSERT, InstrumentModel::instrumentAddedOrRemoved(), m_instrumentModel, m_realDataModel, onInstrumentAddedOrRemoved(), and updateInstrumentSubscriptions().
Referenced by MainWindow::MainWindow().
|
privateslot |
Set up callbacks to all instrument items.
Definition at line 136 of file LinkInstrumentManager.cpp.
References InstrumentModel::instrumentItems(), m_instrumentModel, and onInstrumentChildChange().
Referenced by onInstrumentAddedOrRemoved(), and setModels().
|
private |
Definition at line 58 of file LinkInstrumentManager.h.
Referenced by canLinkDataToInstrument(), onInstrumentAddedOrRemoved(), setModels(), and updateInstrumentSubscriptions().
|
private |
Definition at line 59 of file LinkInstrumentManager.h.
Referenced by linkedRealDataItems(), onInstrumentAddedOrRemoved(), and setModels().