BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
ParticleLayoutItem.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/Sample/ParticleLayoutItem.h
6 //! @brief Defines class ParticleLayoutItem
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2021
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_GUI_MODEL_SAMPLE_PARTICLELAYOUTITEM_H
16 #define BORNAGAIN_GUI_MODEL_SAMPLE_PARTICLELAYOUTITEM_H
17 
21 #include <QUuid>
22 #include <memory>
23 
24 class ItemWithParticles;
25 class Streamer;
26 class MaterialItems;
27 
29 public:
30  ParticleLayoutItem(const MaterialItems* materials);
31 
32  //! The density value which belonging only to the layout.
33  //!
34  //! This is the editable value. If an interference is present, this value may not be the one to
35  //! be used for building the domain layout or to be presented. For the correct value-to-use,
36  //! whether an interference is present or not, use totalDensity().
38 
39  //! The real density.
40  //!
41  //! Returns ownDensity() if the interference is not influencing the density. If the
42  //! interference is defining the density, this is the interference-calculated density.
44  double totalDensityValue() const;
45  DoubleDescriptor weight() const;
46 
47  //! The particles this layout contains.
48  //!
49  //! Note that this is not a hierarchical search! Only the topmost particles are returned, not
50  //! their contained particles. For a hierarchical search use containedItemsWithParticles
51  QVector<ItemWithParticles*> particles() const;
52  void addParticle(ItemWithParticles* particle);
53  void removeParticle(ItemWithParticles* particle);
54 
55  //! Return full hierarchical contained items with particles.
56  //!
57  //! \sa particles()
58  QVector<ItemWithParticles*> containedItemsWithParticles() const;
59 
62  void removeInterference();
63 
64  //! Returns whether total density is defined by the currently selected interference.
65  //!
66  //! Two dimensional interference calculates density automatically; in these cases the "own"
67  //! total density value should not be edited but set by the one from the interference.
69 
70  void serialize(Streamer& s);
71 
72 private:
76  QVector<ItemWithParticles*> m_particles;
78 };
79 
80 #endif // BORNAGAIN_GUI_MODEL_SAMPLE_PARTICLELAYOUTITEM_H
Defines class DoubleProperty.
Defines InterferenceItems's classes.
Defines class SelectionProperty.
Describes properties of a double value which are necessary to allow GUI representation,...
Class for representing a double value, its attributes and its accessors.
DoubleDescriptor ownDensity() const
The density value which belonging only to the layout.
QVector< ItemWithParticles * > m_particles
SelectionProperty< InterferenceItem * > m_interference
const MaterialItems * m_materials
DoubleProperty m_weight
void addParticle(ItemWithParticles *particle)
DoubleProperty m_ownDensity
void removeParticle(ItemWithParticles *particle)
ParticleLayoutItem(const MaterialItems *materials)
bool totalDensityIsDefinedByInterference() const
Returns whether total density is defined by the currently selected interference.
QVector< ItemWithParticles * > containedItemsWithParticles() const
Return full hierarchical contained items with particles.
DoubleDescriptor weight() const
DoubleDescriptor totalDensity() const
The real density.
double totalDensityValue() const
QVector< ItemWithParticles * > particles() const
The particles this layout contains.
SelectionDescriptor< InterferenceItem * > interference() const
void serialize(Streamer &s)
void setInterference(InterferenceItem *interference)
Describes a selection (various possibilities and the current one).
Supports serialization to or deserialization from QXmlStream.
Definition: Streamer.h:36