BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
ItemWithMaterial.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/Sample/ItemWithMaterial.cpp
6 //! @brief Implements class ItemWithMaterial
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 
16 #include "Base/Util/Assert.h"
19 
21 {
23 }
24 
25 void ItemWithMaterial::setMaterial(const QString& materialIdentifier)
26 {
28 }
29 
30 
32  : m_materialItems(materials)
33 {
34  ASSERT(m_materialItems);
35 }
36 
38 {
39  m_materialIdentifier.clear();
40 }
41 
43 {
44  ASSERT(materialItem());
45  return materialItem()->color();
46 }
47 
49 {
50  ASSERT(materialItem());
51  return materialItem()->matItemName();
52 }
53 
55 {
56  return m_materialIdentifier;
57 }
58 
60 {
61  if (materialIdentifier().isEmpty())
62  return nullptr;
63 
65 }
Defines abstract item with a material property.
Defines class MaterialItem.
Defines class MaterialItems.
QString materialIdentifier() const
QString m_materialIdentifier
void setMaterial(const MaterialItem *materialItem)
Set the material this item shall use. Stores the identifier, not the pointer!
const MaterialItems * m_materialItems
QString materialName() const
ItemWithMaterial(const MaterialItems *materials)
Overhand the material list where the current material has to be searched for.
void setMaterialUndefined()
Set "no material defined".
QColor materialColor() const
MaterialItem * materialItem() const
Returns the material item this item links to.
QString matItemName() const
QColor color() const
QString identifier() const
MaterialItem * materialFromIdentifier(const QString &identifier) const