BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
The controller of the sld layer visual representation. More...
Public Types | |
using | layer_ctrl_vec = std::vector< std::unique_ptr< LayerElementController > > |
using | string_vec = std::vector< std::string > |
Public Member Functions | |
SLDElementController (MaterialModel *material_model, SampleModel *sample_model, SLDElementModel *sld_model, GraphicsScene *scene_item) | |
Contructor. More... | |
~SLDElementController () | |
void | setScene (GraphicsScene *scene) |
Set the scene of the current controller to be passed to the LayerElementControllers. More... | |
Private Member Functions | |
void | buildLayerControllers (string_vec &identifiers) |
Build and set up the layer controllers. More... | |
void | buildSLD () |
Updates all material properties in LayerItems to get new material colors and labels. More... | |
void | clearScene () |
Remove all LayerElementControllers and their items from scene and memory. More... | |
void | connectLayerControllers () |
Connect the layer controllers. More... | |
void | connectLayerModel () |
Connect with signals of SampleModel. More... | |
void | connectMaterialModel () |
Connect with signals of MaterialModel. More... | |
void | connectSLDElementModel () |
Connect with signals of SLDViewModel. More... | |
void | disconnectLayerControllers () |
Disconnect the layer controllers. More... | |
void | disconnectLayerModel () const |
Disconnect with signals of SampleModel. More... | |
void | disconnectMaterialModel () const |
Disconnect with signals of MaterialModel. More... | |
void | disconnectSLDElementModel () const |
Disconnect with signals of SLDViewModel. More... | |
string_vec | getIdentifierVector (ModelView::SessionItem *item) |
Get the identifiers of all layeritems in the sample model in order of appearance. More... | |
void | updateRoughnessFromView (std::string identifier, double value) |
Update the material and layer models from the view items. More... | |
void | updateSLDFromView (std::string identifier, double value) |
Update the material and layer models from the view items. More... | |
void | updateThicknessFromView (std::string identifier, double value) |
Update the material and layer models from the view items. More... | |
void | updateToView (ModelView::SessionItem *item=nullptr) |
Update the view items with the changes in the material or layer models. More... | |
Private Attributes | |
layer_ctrl_vec | m_layer_controllers |
MaterialModel * | p_material_model |
SampleModel * | p_sample_model |
GraphicsScene * | p_scene_item |
SLDElementModel * | p_sld_model |
The controller of the sld layer visual representation.
Definition at line 33 of file sldelementcontroller.h.
using gui2::SLDElementController::layer_ctrl_vec = std::vector<std::unique_ptr<LayerElementController> > |
Definition at line 38 of file sldelementcontroller.h.
using gui2::SLDElementController::string_vec = std::vector<std::string> |
Definition at line 37 of file sldelementcontroller.h.
gui2::SLDElementController::SLDElementController | ( | MaterialModel * | material_model, |
SampleModel * | sample_model, | ||
SLDElementModel * | sld_model, | ||
GraphicsScene * | scene_item | ||
) |
Contructor.
Definition at line 36 of file sldelementcontroller.cpp.
References buildSLD(), connectLayerModel(), connectMaterialModel(), and connectSLDElementModel().
gui2::SLDElementController::~SLDElementController | ( | ) |
Definition at line 49 of file sldelementcontroller.cpp.
References clearScene().
|
private |
Build and set up the layer controllers.
Definition at line 181 of file sldelementcontroller.cpp.
References gui2::SLDElementModel::addLayer(), m_layer_controllers, p_scene_item, and p_sld_model.
Referenced by buildSLD().
|
private |
Updates all material properties in LayerItems to get new material colors and labels.
Definition at line 116 of file sldelementcontroller.cpp.
References buildLayerControllers(), ModelView::SessionItem::children(), ModelView::SessionItem::childrenCount(), clearScene(), connectLayerControllers(), connectSLDElementModel(), disconnectSLDElementModel(), getIdentifierVector(), p_material_model, p_sample_model, p_scene_item, p_sld_model, ModelView::SessionModel::rootItem(), and updateToView().
Referenced by SLDElementController(), connectLayerModel(), setScene(), and updateToView().
|
private |
Remove all LayerElementControllers and their items from scene and memory.
Definition at line 143 of file sldelementcontroller.cpp.
References ModelView::SessionModel::clear(), m_layer_controllers, p_scene_item, and p_sld_model.
Referenced by ~SLDElementController(), and buildSLD().
|
private |
Connect the layer controllers.
Definition at line 214 of file sldelementcontroller.cpp.
References gui2::LayerElementController::heightChanged(), m_layer_controllers, gui2::LayerElementController::roughnessChanged(), updateRoughnessFromView(), updateSLDFromView(), updateThicknessFromView(), and gui2::LayerElementController::widthChanged().
Referenced by buildSLD().
|
private |
Connect with signals of SampleModel.
Definition at line 68 of file sldelementcontroller.cpp.
References buildSLD(), ModelView::SessionModel::mapper(), p_sample_model, ModelView::ModelMapper::setOnDataChange(), ModelView::ModelMapper::setOnItemInserted(), ModelView::ModelMapper::setOnItemRemoved(), ModelView::ModelMapper::setOnModelDestroyed(), and updateToView().
Referenced by SLDElementController().
|
private |
Connect with signals of MaterialModel.
Definition at line 55 of file sldelementcontroller.cpp.
References ModelView::SessionModel::mapper(), p_material_model, ModelView::ModelMapper::setOnDataChange(), ModelView::ModelMapper::setOnModelDestroyed(), and updateToView().
Referenced by SLDElementController().
|
private |
Connect with signals of SLDViewModel.
Definition at line 84 of file sldelementcontroller.cpp.
References ModelView::SessionModel::mapper(), p_sld_model, and ModelView::ModelMapper::setOnModelDestroyed().
Referenced by SLDElementController(), and buildSLD().
|
private |
Disconnect the layer controllers.
Definition at line 227 of file sldelementcontroller.cpp.
References gui2::LayerElementController::heightChanged(), m_layer_controllers, gui2::LayerElementController::roughnessChanged(), updateRoughnessFromView(), updateSLDFromView(), updateThicknessFromView(), and gui2::LayerElementController::widthChanged().
|
private |
Disconnect with signals of SampleModel.
Definition at line 97 of file sldelementcontroller.cpp.
References ModelView::SessionModel::mapper(), p_sample_model, and ModelView::ModelMapper::unsubscribe().
|
private |
Disconnect with signals of MaterialModel.
Definition at line 91 of file sldelementcontroller.cpp.
References ModelView::SessionModel::mapper(), p_material_model, and ModelView::ModelMapper::unsubscribe().
|
private |
Disconnect with signals of SLDViewModel.
Definition at line 103 of file sldelementcontroller.cpp.
References ModelView::SessionModel::mapper(), p_sld_model, and ModelView::ModelMapper::unsubscribe().
Referenced by buildSLD().
|
private |
Get the identifiers of all layeritems in the sample model in order of appearance.
Definition at line 160 of file sldelementcontroller.cpp.
References ModelView::SessionItem::children(), ModelView::SessionItem::childrenCount(), and gui2::MultiLayerItem::P_NREPETITIONS.
Referenced by buildSLD().
void gui2::SLDElementController::setScene | ( | GraphicsScene * | scene | ) |
Set the scene of the current controller to be passed to the LayerElementControllers.
Definition at line 109 of file sldelementcontroller.cpp.
References buildSLD(), and p_scene_item.
|
private |
Update the material and layer models from the view items.
Definition at line 302 of file sldelementcontroller.cpp.
References ModelView::SessionModel::findItem(), ModelView::SessionItem::item(), gui2::LayerItem::P_ROUGHNESS, p_sample_model, gui2::RoughnessItem::P_SIGMA, and ModelView::SessionItem::setProperty().
Referenced by connectLayerControllers(), and disconnectLayerControllers().
|
private |
Update the material and layer models from the view items.
Definition at line 292 of file sldelementcontroller.cpp.
References ModelView::SessionModel::findItem(), ModelView::ExternalProperty::identifier(), gui2::LayerItem::P_MATERIAL, p_material_model, p_sample_model, gui2::SLDMaterialItem::P_SLD_REAL, and ModelView::SessionItem::setProperty().
Referenced by connectLayerControllers(), and disconnectLayerControllers().
|
private |
Update the material and layer models from the view items.
Definition at line 285 of file sldelementcontroller.cpp.
References ModelView::SessionModel::findItem(), p_sample_model, gui2::LayerItem::P_THICKNESS, and ModelView::SessionItem::setProperty().
Referenced by connectLayerControllers(), and disconnectLayerControllers().
|
private |
Update the view items with the changes in the material or layer models.
Definition at line 240 of file sldelementcontroller.cpp.
References buildSLD(), ModelView::SessionModel::findItem(), ModelView::ExternalProperty::identifier(), m_layer_controllers, gui2::MaterialBaseItem::P_COLOR, gui2::LayerElementItem::P_HEIGHT, gui2::LayerItem::P_MATERIAL, p_material_model, gui2::LayerItem::P_ROUGHNESS, gui2::LayerElementItem::P_ROUGHNESS, p_sample_model, gui2::LayerElementItem::P_SIDE_BRUSH_COLOR, gui2::RoughnessItem::P_SIGMA, gui2::SLDMaterialItem::P_SLD_REAL, gui2::LayerItem::P_THICKNESS, gui2::LayerElementItem::P_TOP_BRUSH_COLOR, gui2::LayerElementItem::P_WIDTH, ModelView::SessionItem::parent(), ModelView::SessionItem::property(), and ModelView::SessionItem::setProperty().
Referenced by buildSLD(), connectLayerModel(), and connectMaterialModel().
|
private |
Definition at line 70 of file sldelementcontroller.h.
Referenced by buildLayerControllers(), clearScene(), connectLayerControllers(), disconnectLayerControllers(), and updateToView().
|
private |
Definition at line 66 of file sldelementcontroller.h.
Referenced by buildSLD(), connectMaterialModel(), disconnectMaterialModel(), updateSLDFromView(), and updateToView().
|
private |
Definition at line 67 of file sldelementcontroller.h.
Referenced by buildSLD(), connectLayerModel(), disconnectLayerModel(), updateRoughnessFromView(), updateSLDFromView(), updateThicknessFromView(), and updateToView().
|
private |
Definition at line 69 of file sldelementcontroller.h.
Referenced by buildLayerControllers(), buildSLD(), clearScene(), and setScene().
|
private |
Definition at line 68 of file sldelementcontroller.h.
Referenced by buildLayerControllers(), buildSLD(), clearScene(), connectSLDElementModel(), and disconnectSLDElementModel().