BornAgain
1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Class to modify a sample from the layer oriented sample editor.
Use this class to modify the sample model. It takes care of notifications and creating undo/redo commands. It operates on one MultiLayerItem (which is a sample).
Definition at line 50 of file SampleEditorController.h.
Signals | |
void | aboutToRemoveItem (SampleItem item) |
void | modified () |
void | requestViewInRealSpace (SampleItem item) |
Private Member Functions | |
ItemWithParticles * | createAndInitParticle (FormFactorItemCatalog::Type formFactorType) const |
ItemWithParticles * | createAndInitParticle (ItemWithParticlesCatalog::Type itemType) const |
Private Attributes | |
ProjectDocument * | m_document |
MultiLayerForm * | m_sampleForm |
MultiLayerItem * | m_sampleItem |
QUndoStack | m_undoStack |
SampleEditorController::SampleEditorController | ( | ProjectDocument * | document, |
MultiLayerItem * | multi | ||
) |
Definition at line 41 of file SampleEditorController.cpp.
|
signal |
Referenced by removeLayerFromUndo(), removeLayout(), removeParticle(), and LayerOrientedSampleEditor::setCurrentSample().
void SampleEditorController::addLayer | ( | LayerItem * | before | ) |
Definition at line 63 of file SampleEditorController.cpp.
References MultiLayerItem::layers(), m_sampleItem, and m_undoStack.
void SampleEditorController::addLayerFromUndo | ( | int | atIndex | ) |
Definition at line 70 of file SampleEditorController.cpp.
References MultiLayerItem::addLayer(), MultiLayerItem::layers(), m_sampleForm, m_sampleItem, materialItems(), modified(), MultiLayerForm::onLayerAdded(), LayerEditorUtils::predefinedLayerColors(), LayerItem::setColor(), ItemWithMaterial::setMaterial(), and MultiLayerForm::updateUnits().
Referenced by CommandAddLayer::redo().
void SampleEditorController::addLayout | ( | LayerForm * | layerItem | ) |
Definition at line 123 of file SampleEditorController.cpp.
References LayerItem::addLayout(), LayerForm::layerItem(), m_sampleForm, modified(), LayerForm::onLayoutAdded(), and MultiLayerForm::updateUnits().
Referenced by LayerForm::LayerForm().
void SampleEditorController::addParticle | ( | ParticleCompositionItem * | composition, |
FormFactorItemCatalog::Type | type | ||
) |
Definition at line 210 of file SampleEditorController.cpp.
References ParticleCompositionItem::addParticle(), createAndInitParticle(), m_sampleForm, modified(), and MultiLayerForm::updateUnits().
void SampleEditorController::addParticle | ( | ParticleCompositionItem * | composition, |
ItemWithParticlesCatalog::Type | type | ||
) |
Definition at line 194 of file SampleEditorController.cpp.
References ParticleCompositionItem::addParticle(), createAndInitParticle(), m_sampleForm, modified(), and MultiLayerForm::updateUnits().
void SampleEditorController::addParticle | ( | ParticleLayoutItem * | layout, |
FormFactorItemCatalog::Type | t | ||
) |
Definition at line 162 of file SampleEditorController.cpp.
References ParticleLayoutItem::addParticle(), createAndInitParticle(), m_sampleForm, modified(), and MultiLayerForm::updateUnits().
void SampleEditorController::addParticle | ( | ParticleLayoutItem * | layout, |
ItemWithParticlesCatalog::Type | type | ||
) |
Definition at line 178 of file SampleEditorController.cpp.
References ParticleLayoutItem::addParticle(), createAndInitParticle(), m_sampleForm, modified(), and MultiLayerForm::updateUnits().
Referenced by ParticleCompositionForm::ParticleCompositionForm(), and ParticleLayoutForm::ParticleLayoutForm().
|
private |
Definition at line 227 of file SampleEditorController.cpp.
References FormFactorItemCatalog::create(), and materialItems().
Referenced by addParticle(), and setMesoCrystalBasis().
|
private |
Definition at line 236 of file SampleEditorController.cpp.
References MesoCrystalItem::basisParticle(), ItemWithParticlesCatalog::create(), and materialItems().
MaterialItems * SampleEditorController::materialItems | ( | ) | const |
The materials of the current document.
Definition at line 363 of file SampleEditorController.cpp.
References m_sampleItem, and MultiLayerItem::materialItems().
Referenced by LayerForm::LayerForm(), addLayerFromUndo(), createAndInitParticle(), setCoreFormFactor(), and setShellFormFactor().
|
signal |
Referenced by addLayerFromUndo(), addLayout(), addParticle(), onStoppedToMoveLayer(), removeLayerFromUndo(), removeLayout(), removeParticle(), selectInterference(), MaterialInplaceForm::selectMaterial(), selectMaterial(), setCoreFormFactor(), setCurrentIndex(), LayerOrientedSampleEditor::setCurrentSample(), setDouble(), setDoubleFromUndo(), setInt(), setIntegrateOverXi(), setMaterialValue(), setMesoCrystalBasis(), setSampleDescription(), setSampleName(), setShellFormFactor(), and CommandRemoveLayer::undo().
void SampleEditorController::onStartingToMoveLayer | ( | ) |
Definition at line 416 of file SampleEditorController.cpp.
References m_sampleForm, and MultiLayerForm::showAddLayerButtons().
Referenced by LayerForm::LayerForm().
void SampleEditorController::onStoppedToMoveLayer | ( | QWidget * | widgetToMove, |
QWidget * | moveAboveThisWidget | ||
) |
Definition at line 422 of file SampleEditorController.cpp.
References MultiLayerForm::findNextLayerForm(), LayerForm::layerItem(), m_sampleForm, m_sampleItem, modified(), MultiLayerItem::moveLayer(), MultiLayerForm::onLayerMoved(), and MultiLayerForm::showAddLayerButtons().
Referenced by LayerForm::LayerForm().
ProjectDocument * SampleEditorController::projectDocument | ( | ) | const |
The current document.
Definition at line 368 of file SampleEditorController.cpp.
References m_document.
void SampleEditorController::removeLayer | ( | LayerItem * | layerItem | ) |
Definition at line 135 of file SampleEditorController.cpp.
References m_undoStack.
Referenced by LayerForm::LayerForm().
void SampleEditorController::removeLayerFromUndo | ( | int | atIndex | ) |
Definition at line 140 of file SampleEditorController.cpp.
References aboutToRemoveItem(), MultiLayerItem::layers(), m_sampleForm, m_sampleItem, modified(), MultiLayerForm::onAboutToRemoveLayer(), MultiLayerItem::removeLayer(), and MultiLayerForm::updateRowVisibilities().
Referenced by CommandRemoveLayer::redo(), and CommandAddLayer::undo().
void SampleEditorController::removeLayout | ( | LayerForm * | layerItem, |
ParticleLayoutItem * | layout | ||
) |
Definition at line 150 of file SampleEditorController.cpp.
References aboutToRemoveItem(), LayerForm::layerItem(), modified(), LayerForm::onAboutToRemoveLayout(), and LayerItem::removeLayout().
Referenced by ParticleLayoutForm::ParticleLayoutForm().
void SampleEditorController::removeParticle | ( | ItemWithParticles * | item | ) |
Definition at line 285 of file SampleEditorController.cpp.
References aboutToRemoveItem(), m_sampleForm, and modified().
Referenced by MesoCrystalForm::MesoCrystalForm(), ParticleCompositionForm::ParticleCompositionForm(), ParticleCoreShellForm::ParticleCoreShellForm(), and ParticleForm::ParticleForm().
|
signal |
Referenced by LayerForm::LayerForm(), MesoCrystalForm::MesoCrystalForm(), MultiLayerForm::MultiLayerForm(), ParticleCompositionForm::ParticleCompositionForm(), ParticleCoreShellForm::ParticleCoreShellForm(), ParticleForm::ParticleForm(), ParticleLayoutForm::ParticleLayoutForm(), LayerOrientedSampleEditor::setCurrentSample(), ParticleCoreShellForm::showCoreInRealSpace(), and ParticleCoreShellForm::showShellInRealSpace().
MultiLayerForm * SampleEditorController::sampleForm | ( | ) | const |
The current form.
Definition at line 53 of file SampleEditorController.cpp.
References m_sampleForm.
Referenced by CommandRemoveLayer::undo().
MultiLayerItem * SampleEditorController::sampleItem | ( | ) | const |
The item on which this controller operates.
Definition at line 58 of file SampleEditorController.cpp.
References m_sampleItem.
Referenced by CommandRemoveLayer::CommandRemoveLayer(), LayerForm::enableStructureEditing(), MaterialInplaceForm::selectMaterial(), CommandRemoveLayer::undo(), LayerForm::updateLayerPositionDependentElements(), and LayerForm::updateTitle().
void SampleEditorController::selectInterference | ( | InterferenceForm * | widget, |
int | newIndex | ||
) |
Definition at line 472 of file SampleEditorController.cpp.
References ParticleLayoutItem::interference(), InterferenceForm::layoutItem(), m_sampleForm, modified(), InterferenceForm::onInterferenceTypeChanged(), and MultiLayerForm::updateUnits().
Referenced by InterferenceForm::InterferenceForm().
void SampleEditorController::selectMaterial | ( | ItemWithMaterial * | item, |
const QString & | newMaterialIdentifier | ||
) |
Definition at line 373 of file SampleEditorController.cpp.
References m_sampleForm, modified(), and ItemWithMaterial::setMaterial().
Referenced by MaterialInplaceForm::selectMaterial().
void SampleEditorController::setCoreFormFactor | ( | ParticleCoreShellForm * | widget, |
FormFactorItemCatalog::Type | type | ||
) |
Definition at line 257 of file SampleEditorController.cpp.
References ParticleCoreShellForm::coreShellItem(), FormFactorItemCatalog::create(), ParticleCoreShellItem::createCore(), ParticleCoreShellForm::createCoreWidgets(), m_sampleForm, materialItems(), modified(), ParticleItem::setFormFactor(), and MultiLayerForm::updateUnits().
Referenced by ParticleCoreShellForm::onCoreComboChanged().
void SampleEditorController::setCurrentIndex | ( | AbstractSelectionContainerForm * | widget, |
int | index, | ||
const AbstractSelectionDescriptor & | d | ||
) |
Definition at line 349 of file SampleEditorController.cpp.
References AbstractSelectionContainerForm::createContent(), m_sampleForm, modified(), AbstractSelectionDescriptor::setCurrentIndex(), and MultiLayerForm::updateUnits().
Referenced by AbstractSelectionContainerForm::initUI().
void SampleEditorController::setDensityRelatedValue | ( | InterferenceItem * | interferenceItem, |
double | newValue, | ||
DoubleDescriptor | d | ||
) |
Set an interference function's value which affects the total particle density of the containing particle layout.
Some values in interference settings affect the total density in the particle layout which contains this interference function. Call this method to provide all the related updating (data & UI).
Definition at line 402 of file SampleEditorController.cpp.
References m_sampleForm, and setDouble().
Referenced by LatticeTypeSelectionForm::createContent(), and InterferenceForm::createInterferenceWidgets().
void SampleEditorController::setDouble | ( | double | newValue, |
DoubleDescriptor | d | ||
) |
Definition at line 310 of file SampleEditorController.cpp.
References DoubleDescriptor::get, DoubleDescriptor::label, m_undoStack, modified(), DoubleDescriptor::path, and DoubleDescriptor::set.
Referenced by LayerEditorUtils::addMultiPropertyToGrid(), FormLayouter::insertValue(), setDensityRelatedValue(), and setMaterialValue().
void SampleEditorController::setDoubleFromUndo | ( | double | newValue, |
const QString & | path | ||
) |
Definition at line 317 of file SampleEditorController.cpp.
References MultiLayerForm::ensureVisible(), m_sampleForm, modified(), DoubleDescriptor::set, DoubleSpinBox::setBaseValue(), and DoubleSpinBox::valueDescriptor().
Referenced by CommandChangeValue::redo(), and CommandChangeValue::undo().
void SampleEditorController::setInt | ( | int | newValue, |
UIntDescriptor | d | ||
) |
Definition at line 343 of file SampleEditorController.cpp.
References modified(), and UIntDescriptor::set.
void SampleEditorController::setIntegrateOverXi | ( | LatticeTypeSelectionForm * | widget, |
bool | newValue | ||
) |
Definition at line 492 of file SampleEditorController.cpp.
References LatticeTypeSelectionForm::interferenceItem(), modified(), LatticeTypeSelectionForm::onIntegrateOverXiChanged(), and Interference2DAbstractLatticeItem::setXiIntegration().
Referenced by LatticeTypeSelectionForm::createContent().
void SampleEditorController::setMaterialValue | ( | ItemWithMaterial * | item, |
double | newValue, | ||
DoubleDescriptor | d | ||
) |
Definition at line 388 of file SampleEditorController.cpp.
References m_sampleForm, ItemWithMaterial::materialIdentifier(), modified(), and setDouble().
Referenced by MaterialInplaceForm::createWidgets().
void SampleEditorController::setMesoCrystalBasis | ( | MesoCrystalForm * | widget, |
FormFactorItemCatalog::Type | type | ||
) |
Definition at line 462 of file SampleEditorController.cpp.
References createAndInitParticle(), MesoCrystalForm::createBasisWidgets(), m_sampleForm, MesoCrystalForm::mesoCrystalItem(), modified(), MesoCrystalItem::setBasis(), and MultiLayerForm::updateUnits().
void SampleEditorController::setMesoCrystalBasis | ( | MesoCrystalForm * | widget, |
ItemWithParticlesCatalog::Type | type | ||
) |
Definition at line 452 of file SampleEditorController.cpp.
References createAndInitParticle(), MesoCrystalForm::createBasisWidgets(), m_sampleForm, MesoCrystalForm::mesoCrystalItem(), modified(), MesoCrystalItem::setBasis(), and MultiLayerForm::updateUnits().
Referenced by MesoCrystalForm::onBasisComboChanged().
void SampleEditorController::setMultiLayerForm | ( | MultiLayerForm * | view | ) |
Set the current form.
The form can change e.g. when a different sample gets the current one in the layer editor. Also nullptr is allowed.
Definition at line 48 of file SampleEditorController.cpp.
References m_sampleForm.
void SampleEditorController::setSampleDescription | ( | const QString & | description | ) |
Definition at line 446 of file SampleEditorController.cpp.
References m_sampleItem, modified(), and MultiLayerItem::setDescription().
Referenced by MultiLayerForm::MultiLayerForm().
void SampleEditorController::setSampleName | ( | const QString & | name | ) |
Definition at line 440 of file SampleEditorController.cpp.
References m_sampleItem, modified(), GUI::RealSpace::Particles::name(), and MultiLayerItem::setSampleName().
Referenced by MultiLayerForm::MultiLayerForm().
void SampleEditorController::setShellFormFactor | ( | ParticleCoreShellForm * | widget, |
FormFactorItemCatalog::Type | type | ||
) |
Definition at line 271 of file SampleEditorController.cpp.
References ParticleCoreShellForm::coreShellItem(), FormFactorItemCatalog::create(), ParticleCoreShellItem::createShell(), ParticleCoreShellForm::createShellWidgets(), m_sampleForm, materialItems(), modified(), ParticleItem::setFormFactor(), and MultiLayerForm::updateUnits().
Referenced by ParticleCoreShellForm::onShellComboChanged().
QUndoStack * SampleEditorController::undoStack | ( | ) |
The contained undo stack.
Definition at line 358 of file SampleEditorController.cpp.
References m_undoStack.
|
private |
Definition at line 133 of file SampleEditorController.h.
Referenced by projectDocument().
|
private |
Definition at line 132 of file SampleEditorController.h.
Referenced by addLayerFromUndo(), addLayout(), addParticle(), onStartingToMoveLayer(), onStoppedToMoveLayer(), removeLayerFromUndo(), removeParticle(), sampleForm(), selectInterference(), selectMaterial(), setCoreFormFactor(), setCurrentIndex(), setDensityRelatedValue(), setDoubleFromUndo(), setMaterialValue(), setMesoCrystalBasis(), setMultiLayerForm(), and setShellFormFactor().
|
private |
Definition at line 131 of file SampleEditorController.h.
Referenced by addLayer(), addLayerFromUndo(), materialItems(), onStoppedToMoveLayer(), removeLayerFromUndo(), sampleItem(), setSampleDescription(), and setSampleName().
|
private |
Definition at line 130 of file SampleEditorController.h.
Referenced by addLayer(), removeLayer(), setDouble(), and undoStack().