BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
GUIExamplesFactory Class Reference

Class that generates GUI model from. More...

Static Public Member Functions

static SessionItemcreateSampleItems (const QString &name, SampleModel *sampleModel, MaterialModel *materialModel)
 Populate sample model with. More...
 
static bool isValidExampleName (const QString &name)
 

Static Private Attributes

static QMap< QString, QString > m_name_to_registry = init_NameToRegistry()
 correspondence of GUI example name and name from StandardSamples registry More...
 

Detailed Description

Class that generates GUI model from.

Definition at line 25 of file GUIExamplesFactory.h.

Member Function Documentation

◆ createSampleItems()

SessionItem * GUIExamplesFactory::createSampleItems ( const QString &  name,
SampleModel sampleModel,
MaterialModel materialModel 
)
static

Populate sample model with.

Definition at line 63 of file GUIExamplesFactory.cpp.

65 {
66  QString exampleName = m_name_to_registry[name];
67 
68  SampleBuilderFactory factory;
69  const std::unique_ptr<MultiLayer> sample(factory.createSampleByName(exampleName.toStdString()));
70 
71  return GUIObjectBuilder::populateSampleModel(sampleModel, materialModel, *sample.get(), name);
72 }
static QMap< QString, QString > m_name_to_registry
correspondence of GUI example name and name from StandardSamples registry
Factory to create standard pre-defined samples.
MultiLayer * createSampleByName(const std::string &name)
Retrieves a SampleBuilder from the registry, does the build, and returns the result.
SessionItem * populateSampleModel(SampleModel *sampleModel, MaterialModel *materialModel, const MultiLayer &sample, const QString &sample_name="")
QString const & name(EShape k)
Definition: particles.cpp:21

References SampleBuilderFactory::createSampleByName(), m_name_to_registry, RealSpace::Particles::name(), and GUIObjectBuilder::populateSampleModel().

Referenced by DesignerScene::dropEvent().

Here is the call graph for this function:

◆ isValidExampleName()

bool GUIExamplesFactory::isValidExampleName ( const QString &  name)
static

Definition at line 57 of file GUIExamplesFactory.cpp.

58 {
59  return m_name_to_registry.contains(name);
60 }

References m_name_to_registry, and RealSpace::Particles::name().

Referenced by DesignerScene::dropEvent().

Here is the call graph for this function:

Member Data Documentation

◆ m_name_to_registry

QMap< QString, QString > GUIExamplesFactory::m_name_to_registry = init_NameToRegistry()
staticprivate

correspondence of GUI example name and name from StandardSamples registry

Definition at line 33 of file GUIExamplesFactory.h.

Referenced by createSampleItems(), and isValidExampleName().


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