BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
ItemWithParticlesCatalog Class Reference

Description

Definition at line 24 of file ItemWithParticlesCatalog.h.

Classes

struct  UiInfo
 

Public Types

using CatalogedType = ItemWithParticles
 
enum class  Type : uint8_t { Particle = 1 , Composition = 2 , CoreShell = 3 , MesoCrystal = 4 }
 

Static Public Member Functions

static QVector< TypeassemblyTypes ()
 Available types of assembly items, sorted as expected in the UI (e.g. in combo box) More...
 
static ItemWithParticlescreate (Type type, const MaterialItems *materials)
 Creates the item of the given type. More...
 
static Type type (const ItemWithParticles *item)
 Returns the enum type of the given item. More...
 
static QVector< Typetypes ()
 Available types of items, sorted as expected in the UI (e.g. in combo box) More...
 
static UiInfo uiInfo (Type t)
 UiInfo on the given type. More...
 

Member Typedef Documentation

◆ CatalogedType

Member Enumeration Documentation

◆ Type

enum ItemWithParticlesCatalog::Type : uint8_t
strong
Enumerator
Particle 
Composition 
CoreShell 
MesoCrystal 

Definition at line 29 of file ItemWithParticlesCatalog.h.

29 : uint8_t { Particle = 1, Composition = 2, CoreShell = 3, MesoCrystal = 4 };

Member Function Documentation

◆ assemblyTypes()

QVector< ItemWithParticlesCatalog::Type > ItemWithParticlesCatalog::assemblyTypes ( )
static

Available types of assembly items, sorted as expected in the UI (e.g. in combo box)

Definition at line 42 of file ItemWithParticlesCatalog.cpp.

References Composition, CoreShell, and MesoCrystal.

Referenced by MesoCrystalForm::createBasisCombo().

◆ create()

ItemWithParticles * ItemWithParticlesCatalog::create ( Type  type,
const MaterialItems materials 
)
static

Creates the item of the given type.

If type is "None", a nullptr is returned.

Definition at line 21 of file ItemWithParticlesCatalog.cpp.

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 }
static Type type(const ItemWithParticles *item)
Returns the enum type of the given item.

References Composition, CoreShell, MesoCrystal, Particle, and type().

Referenced by SampleEditorController::createAndInitParticle().

Here is the call graph for this function:

◆ type()

ItemWithParticlesCatalog::Type ItemWithParticlesCatalog::type ( const ItemWithParticles item)
static

Returns the enum type of the given item.

Definition at line 66 of file ItemWithParticlesCatalog.cpp.

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 }

References Composition, CoreShell, MesoCrystal, and Particle.

Referenced by create(), MesoCrystalForm::createBasisCombo(), and uiInfo().

◆ types()

QVector< ItemWithParticlesCatalog::Type > ItemWithParticlesCatalog::types ( )
static

Available types of items, sorted as expected in the UI (e.g. in combo box)

Definition at line 37 of file ItemWithParticlesCatalog.cpp.

References Composition, CoreShell, MesoCrystal, and Particle.

◆ uiInfo()

ItemWithParticlesCatalog::UiInfo ItemWithParticlesCatalog::uiInfo ( Type  t)
static

UiInfo on the given type.

Definition at line 47 of file ItemWithParticlesCatalog.cpp.

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 }

References Composition, CoreShell, MesoCrystal, Particle, and type().

Referenced by LayerEditorUtils::createAddParticleButton(), and MesoCrystalForm::createBasisCombo().

Here is the call graph for this function:

The documentation for this class was generated from the following files: