38 : p_material_model(material_model)
39 , p_sample_model(sample_model)
40 , p_sld_model(sld_model)
41 , p_scene_item(scene_item)
133 if (identifiers.size() == 0)
170 output.insert(output.end(), child_output.begin(), child_output.end());
172 }
else if (
dynamic_cast<LayerItem*
>(children.at(i))) {
173 auto child =
dynamic_cast<LayerItem*
>(children.at(i));
174 output.push_back(child->identifier());
188 for (
auto& identifier : identifiers) {
190 auto layer_element_controller =
191 std::make_unique<LayerElementController>(layer_element_item);
192 layer_element_controller->autoPopulate();
194 layer_element_controller->connectToModel();
195 layer_element_controller->setSampleItemId(identifier);
261 layer_controller->layerElementItem()->setProperty(
265 layer_controller->layerElementItem()->setProperty(
268 layer_controller->layerElementItem()->setProperty(
271 layer_controller->layerElementItem()->setProperty(
Property to carry text, color and identifier.
std::string identifier() const
void setOnItemRemoved(Callbacks::item_tagrow_t f, Callbacks::slot_t client) override
Sets callback to be notified on item remove.
void setOnItemInserted(Callbacks::item_tagrow_t f, Callbacks::slot_t client) override
Sets callback to be notified on item insert.
void setOnModelDestroyed(Callbacks::model_t f, Callbacks::slot_t client) override
Sets the callback for notifications on model destruction.
void setOnDataChange(Callbacks::item_int_t f, Callbacks::slot_t client) override
Sets callback to be notified on item's data change.
void unsubscribe(Callbacks::slot_t client) override
Removes given client from all subscriptions.
The main object representing an editable/displayable/serializable entity.
SessionItem * parent() const
Returns parent item. Will return nullptr if item doesn't have a parent.
int childrenCount() const
Returns total number of children in all tags.
std::vector< SessionItem * > children() const
Returns vector of children formed from all chidlren from all tags.
T property(const std::string &tag) const
Returns data stored in property item.
T * item(const std::string &tag) const
Returns first item under given tag casted to a specified type.
void setProperty(const std::string &tag, const T &value)
Sets value to property item.
Main class to hold hierarchy of SessionItem objects.
ModelMapper * mapper()
Returns model mapper. Can be used to subscribe to various model's signal.
SessionItem * findItem(const identifier_type &id)
Returns SessionItem for given identifier.
SessionItem * rootItem() const
Returns root item of the model.
void clear(std::function< void(SessionItem *)> callback={})
Removes all items from the model.
Aggregate to hold (tag, row) information for SessionModel.
Custom graphics scene to show QCustomPlot with additional elements on top.
void widthChanged(std::string id, double value) const
void roughnessChanged(std::string id, double value) const
void heightChanged(std::string id, double value) const
static const std::string P_SIDE_BRUSH_COLOR
static const std::string P_TOP_BRUSH_COLOR
static const std::string P_HEIGHT
static const std::string P_WIDTH
static const std::string P_ROUGHNESS
Layer with name, thickness and reference to material.
static const std::string P_MATERIAL
static const std::string P_THICKNESS
static const std::string P_ROUGHNESS
static const std::string P_COLOR
Model to hold MaterialItems.
Multi layer capable of holding layers and other multi-layers.
static const std::string P_NREPETITIONS
Item to represent the roughness of the layer.
static const std::string P_SIGMA
void updateThicknessFromView(std::string identifier, double value)
Update the material and layer models from the view items.
void disconnectMaterialModel() const
Disconnect with signals of MaterialModel.
MaterialModel * p_material_model
void connectMaterialModel()
Connect with signals of MaterialModel.
void clearScene()
Remove all LayerElementControllers and their items from scene and memory.
layer_ctrl_vec m_layer_controllers
void updateRoughnessFromView(std::string identifier, double value)
Update the material and layer models from the view items.
void disconnectSLDElementModel() const
Disconnect with signals of SLDViewModel.
void updateSLDFromView(std::string identifier, double value)
Update the material and layer models from the view items.
string_vec getIdentifierVector(ModelView::SessionItem *item)
Get the identifiers of all layeritems in the sample model in order of appearance.
void disconnectLayerControllers()
Disconnect the layer controllers.
void disconnectLayerModel() const
Disconnect with signals of SampleModel.
void connectLayerControllers()
Connect the layer controllers.
std::vector< std::string > string_vec
void setScene(GraphicsScene *scene)
Set the scene of the current controller to be passed to the LayerElementControllers.
void connectLayerModel()
Connect with signals of SampleModel.
void connectSLDElementModel()
Connect with signals of SLDViewModel.
void updateToView(ModelView::SessionItem *item=nullptr)
Update the view items with the changes in the material or layer models.
SampleModel * p_sample_model
GraphicsScene * p_scene_item
void buildSLD()
Updates all material properties in LayerItems to get new material colors and labels.
SLDElementModel * p_sld_model
void buildLayerControllers(string_vec &identifiers)
Build and set up the layer controllers.
The model of the sld layer visual representation.
LayerElementItem * addLayer()
Add a layer item.
Represents material based on scattering length density.
static const std::string P_SLD_REAL
Model to hold layers and multi-layers.
materialitems.h Collection of materials to populate MaterialModel.
Based on Qt example "codeeditor" Copyright (C) 2016 The Qt Company Ltd.