BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
LayerItem.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/Sample/LayerItem.h
6 //! @brief Defines class LayerItem
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_GUI_MODEL_SAMPLE_LAYERITEM_H
16 #define BORNAGAIN_GUI_MODEL_SAMPLE_LAYERITEM_H
17 
23 #include <QColor>
24 #include <QUuid>
25 #include <QVector>
26 #include <memory>
27 #include <variant>
28 
30 class ParticleLayoutItem;
31 class ItemWithParticles;
32 class QXmlStreamReader;
33 class QXmlStreamWriter;
34 class Streamer;
35 
36 class LayerItem : public ItemWithMaterial {
37 public:
38  explicit LayerItem(const MaterialItems* materials);
39 
40  void setLayerName(const QString& name);
41  QString layerName() const;
42 
43  QVector<ItemWithMaterial*> itemsWithMaterial();
44  QVector<ItemWithParticles*> itemsWithParticles() const;
45 
47 
49  void setBasicRoughness();
50  void clearRoughness();
51 
52  UIntDescriptor numSlices() const;
53 
54  QVector<ParticleLayoutItem*> layouts() const;
56  void removeLayout(ParticleLayoutItem* layout);
57 
58  QColor color() const;
59  void setColor(const QColor& color);
60 
61  void setIsTopLayer(bool b);
62  bool isTopLayer() const;
63 
64  void setIsBottomLayer(bool b);
65  bool isBottomLayer() const;
66 
67  void serialize(Streamer& s);
68 
69 private:
70  QString m_name;
73  QColor m_color;
74  bool m_isTopLayer = false;
75  bool m_isBottomLayer = false;
76  QVector<ParticleLayoutItem*> m_layouts;
77  std::unique_ptr<LayerBasicRoughnessItem> m_topRoughness;
78 };
79 
80 #endif // BORNAGAIN_GUI_MODEL_SAMPLE_LAYERITEM_H
Defines class DoubleProperty.
Defines abstract item with a material property.
Defines classes LayerRoughnessItems.
Defines class SelectionDescriptor.
Defines class UIntProperty.
Describes properties of a double value which are necessary to allow GUI representation,...
Class for representing a double value, its attributes and its accessors.
QColor m_color
Definition: LayerItem.h:73
LayerItem(const MaterialItems *materials)
Definition: LayerItem.cpp:55
UIntProperty m_numSlices
Definition: LayerItem.h:71
bool m_isBottomLayer
Definition: LayerItem.h:75
void setIsTopLayer(bool b)
Definition: LayerItem.cpp:163
void clearRoughness()
Definition: LayerItem.cpp:126
void setLayerName(const QString &name)
Definition: LayerItem.cpp:70
QColor color() const
Definition: LayerItem.cpp:153
UIntDescriptor numSlices() const
Definition: LayerItem.cpp:131
ParticleLayoutItem * addLayout()
Definition: LayerItem.cpp:141
bool isTopLayer() const
Definition: LayerItem.cpp:168
void setColor(const QColor &color)
Definition: LayerItem.cpp:158
std::unique_ptr< LayerBasicRoughnessItem > m_topRoughness
Definition: LayerItem.h:77
void setIsBottomLayer(bool b)
Definition: LayerItem.cpp:173
void setBasicRoughness()
Definition: LayerItem.cpp:121
DoubleProperty m_thickness
Definition: LayerItem.h:72
QVector< ItemWithParticles * > itemsWithParticles() const
Definition: LayerItem.cpp:89
bool isBottomLayer() const
Definition: LayerItem.cpp:178
QString m_name
Definition: LayerItem.h:70
QVector< ParticleLayoutItem * > layouts() const
Definition: LayerItem.cpp:136
bool m_isTopLayer
Definition: LayerItem.h:74
QVector< ParticleLayoutItem * > m_layouts
Definition: LayerItem.h:76
DoubleDescriptor thickness() const
Definition: LayerItem.cpp:97
void removeLayout(ParticleLayoutItem *layout)
Definition: LayerItem.cpp:147
QVector< ItemWithMaterial * > itemsWithMaterial()
Definition: LayerItem.cpp:80
void serialize(Streamer &s)
Definition: LayerItem.cpp:183
QString layerName() const
Definition: LayerItem.cpp:75
SelectionDescriptor< LayerBasicRoughnessItem * > roughness()
Definition: LayerItem.cpp:102
Describes a selection (various possibilities and the current one).
Supports serialization to or deserialization from QXmlStream.
Definition: Streamer.h:36
Describes properties of a uint value which are necessary to allow GUI representation,...
Class for representing a uint value, its attributes and its accessors.
Definition: UIntProperty.h:39
QString const & name(EShape k)
Definition: particles.cpp:20