BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
ItemWithParticlesCatalog.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/CatSample/ItemWithParticlesCatalog.cpp
6 //! @brief Implements class ItemWithParticlesCatalog
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 
20 
22 {
23  switch (type) {
24  case Type::Particle:
25  return new ParticleItem(materials);
26  case Type::Composition:
27  return new ParticleCompositionItem(materials);
28  case Type::CoreShell:
29  return new ParticleCoreShellItem(materials);
30  case Type::MesoCrystal:
31  return new MesoCrystalItem(materials);
32  default:
33  ASSERT(false);
34  }
35 }
36 
37 QVector<ItemWithParticlesCatalog::Type> ItemWithParticlesCatalog::types()
38 {
40 }
41 
42 QVector<ItemWithParticlesCatalog::Type> ItemWithParticlesCatalog::assemblyTypes()
43 {
45 }
46 
48 {
49  switch (type) {
50  case Type::Particle:
51  return {"Particle", "", ""}; // particle is not on UI, only its form factor
52  case Type::Composition:
53  return {"Particle Composition", "Composition of particles with fixed positions",
54  ":/SampleDesignerToolbox/images/ParticleComposition_64x64.png"};
55  case Type::CoreShell:
56  return {"Core shell particle", "A particle with a core/shell geometry",
57  ":/SampleDesignerToolbox/images/ParticleCoreShell_64x64.png"};
58  case Type::MesoCrystal:
59  return {"Meso Crystal", "A 3D crystal structure of nanoparticles",
60  ":/SampleDesignerToolbox/images/Mesocrystal_64x64.png"};
61  default:
62  ASSERT(false);
63  }
64 }
65 
67 {
68  ASSERT(item);
69 
70  if (dynamic_cast<const ParticleItem*>(item))
71  return Type::Particle;
72  if (dynamic_cast<const ParticleCompositionItem*>(item))
73  return Type::Composition;
74  if (dynamic_cast<const MesoCrystalItem*>(item))
75  return Type::MesoCrystal;
76  if (dynamic_cast<const ParticleCoreShellItem*>(item))
77  return Type::CoreShell;
78 
79  ASSERT(false);
80 }
Defines class ItemWithParticlesCatalog.
Defines class MesoCrystalItem.
Defines class ParticleCompositionItem.
Defines class ParticleCoreShellItem.
Defines class ParticleItem.
static QVector< Type > types()
Available types of items, sorted as expected in the UI (e.g. in combo box)
static Type type(const ItemWithParticles *item)
Returns the enum type of the given item.
static QVector< Type > assemblyTypes()
Available types of assembly items, sorted as expected in the UI (e.g. in combo box)
static ItemWithParticles * create(Type type, const MaterialItems *materials)
Creates the item of the given type.
static UiInfo uiInfo(Type t)
UiInfo on the given type.