BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
sldelementcontroller.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file gui2/sldeditor/sldelementcontroller.h
6 //! @brief Defines class CLASS?
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2020
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_GUI2_SLDEDITOR_SLDELEMENTCONTROLLER_H
16 #define BORNAGAIN_GUI2_SLDEDITOR_SLDELEMENTCONTROLLER_H
17 
18 #include "darefl_export.h"
20 #include "mvvm/model/sessionitem.h"
22 #include <QObject>
23 #include <vector>
24 
25 namespace gui2 {
26 
27 class MaterialModel;
28 class SampleModel;
29 class SLDElementModel;
30 class GraphicsScene;
31 
32 //! The controller of the sld layer visual representation
33 class DAREFLCORE_EXPORT SLDElementController : public QObject {
34  Q_OBJECT
35 
36 public:
37  using string_vec = std::vector<std::string>;
38  using layer_ctrl_vec = std::vector<std::unique_ptr<LayerElementController>>;
39 
40  SLDElementController(MaterialModel* material_model, SampleModel* sample_model,
41  SLDElementModel* sld_model, GraphicsScene* scene_item);
43  void setScene(GraphicsScene* scene);
44 
45 private:
46  void connectMaterialModel();
47  void connectLayerModel();
48  void connectSLDElementModel();
49  void disconnectMaterialModel() const;
50  void disconnectLayerModel() const;
51  void disconnectSLDElementModel() const;
52 
53  void buildSLD();
54  void clearScene();
55  string_vec getIdentifierVector(ModelView::SessionItem* item);
56  void buildLayerControllers(string_vec& identifiers);
57  void connectLayerControllers();
58  void disconnectLayerControllers();
59 
60  void updateToView(ModelView::SessionItem* item = nullptr);
61  void updateThicknessFromView(std::string identifier, double value);
62  void updateSLDFromView(std::string identifier, double value);
63  void updateRoughnessFromView(std::string identifier, double value);
64 
65 private:
71 };
72 
73 } // namespace gui2
74 
75 #endif // BORNAGAIN_GUI2_SLDEDITOR_SLDELEMENTCONTROLLER_H
The main object representing an editable/displayable/serializable entity.
Definition: sessionitem.h:38
Main model to hold sample items.
Definition: SampleModel.h:24
Custom graphics scene to show QCustomPlot with additional elements on top.
Definition: graphicsscene.h:34
Model to hold MaterialItems.
Definition: materialmodel.h:35
The controller of the sld layer visual representation.
std::vector< std::string > string_vec
std::vector< std::unique_ptr< LayerElementController > > layer_ctrl_vec
The model of the sld layer visual representation.
Model to hold layers and multi-layers.
Definition: samplemodel.h:24
Defines class CLASS?
Based on Qt example "codeeditor" Copyright (C) 2016 The Qt Company Ltd.
Definition: app_constants.h:20
Defines class CLASS?
Defines class CLASS?