45 QString
labelWithUnit(
const QString& label, variant<QString, Unit> unit)
47 const QString s = std::holds_alternative<QString>(unit) ? std::get<QString>(unit)
51 return label +
" [" + s +
"]";
56 template <
typename Catalog>
58 const typename Catalog::CatalogedType* p)
60 const auto title = category +
" (" + Catalog::uiInfo(Catalog::type(p)).menuEntry +
")";
64 template <
typename Catalog>
67 const auto title = Catalog::uiInfo(Catalog::type(p)).menuEntry;
77 , m_recreateBackupValues(recreateBackupValues)
90 auto* materialTopLabel =
94 if (item->hasRefractiveIndex()) {
116 auto* layerLabel =
new ParameterLabelItem(
"Layer" + QString::number(iLayer++), label);
117 if (!layer->isTopLayer() && !layer->isBottomLayer())
119 if (!layer->isTopLayer())
120 if (
auto* roughnessItem = layer->roughness().currentItem()) {
124 addParameterItem(roughnessLabel, roughnessItem->lateralCorrelationLength());
128 for (
auto* layout : layer->layouts()) {
129 auto* label =
new ParameterLabelItem(
"Layout" + QString::number(iLayout++), layerLabel);
130 if (!layout->totalDensityIsDefinedByInterference())
136 for (
auto* p : layout->particles())
143 const QString& label)
147 parameterItem->linkToDescriptor(d);
162 ParameterLabelItem* parent,
const std::variant<VectorDescriptor, DoubleDescriptor>& v)
181 const auto* interference = layout->
interference().currentItem();
197 const auto* pdf = itf->probabilityDistribution().currentItem();
198 auto* pdfLabel = addLabel<Profile1DItemCatalog>(label,
"PDF", pdf);
199 for (
const auto& d : pdf->valueDescriptors())
208 const auto* pdf1 = itf->probabilityDistribution1().currentItem();
209 const auto* pdf2 = itf->probabilityDistribution2().currentItem();
210 const bool samePdfTypes =
213 addLabel<Profile2DItemCatalog>(label, samePdfTypes ?
"PDF1" :
"PDF", pdf1);
214 for (
const auto& d : pdf1->valueDescriptors())
217 addLabel<Profile2DItemCatalog>(label, samePdfTypes ?
"PDF2" :
"PDF", pdf2);
218 for (
const auto& d : pdf2->valueDescriptors())
225 const auto* df = itf->decayFunction().currentItem();
226 auto* dfLabel = addLabel<Profile1DItemCatalog>(label,
"Decay function", df);
227 for (
const auto& d : df->valueDescriptors())
233 const auto* df = itf->decayFunction().currentItem();
234 auto* dfLabel = addLabel<Profile2DItemCatalog>(label,
"Decay function", df);
235 for (
const auto& d : df->valueDescriptors())
237 }
else if (
const auto* itf =
256 auto* label = addLabel<ItemWithParticlesCatalog>(parentLabel, p);
264 if (
const auto* particle =
dynamic_cast<const ParticleItem*
>(p)) {
265 const auto* formFactor = particle->formfactor_at_bottom();
266 auto* ffLabel = addLabel<FormFactorItemCatalog>(label,
"Formfactor", formFactor);
267 for (
const auto& d : formFactor->geometryValues())
270 for (
auto* p : particleComposition->particles())
273 auto* l =
addParticle(label, coreShell->core(),
false);
274 l->setTitle(l->title() +
" (Core)");
275 l =
addParticle(label, coreShell->shell(),
false,
false);
276 l->setTitle(l->title() +
" (Shell)");
277 }
else if (
const auto* meso =
dynamic_cast<const MesoCrystalItem*
>(p)) {
282 const auto* outerShape = meso->outerShape().currentItem();
283 auto* ffLabel = addLabel<FormFactorItemCatalog>(label,
"Outer shape", outerShape);
284 for (
const auto& d : outerShape->geometryValues())
287 auto* l =
addParticle(label, meso->basisParticle(),
false);
288 l->setTitle(l->title() +
" (Basis particle)");
297 const auto* lattice = itf->
latticeType().currentItem();
298 auto* label = addLabel<Lattice2DItemCatalog>(parentLabel,
"Lattice", lattice);
299 for (
const auto& d : lattice->geometryValues(!itf->
xiIntegration()))
305 const auto* r = p->
rotation().currentItem();
309 auto* label = addLabel<RotationItemCatalog>(parentLabel,
"Rotation", r);
310 for (
const auto& d : r->rotationValues())
320 auto* beamItem = instrument->beamItem();
357 const QString& label,
bool withMean)
368 for (
const auto& d : distribution->distributionValues(withMean))
388 addResolutionFunction(label);
389 for (
const auto& a : rectDetector->alignmentPropertiesForUI())
400 addResolutionFunction(label);
410 labelWithUnit(
"Constant background", b->backgroundValue().unit));
Defines various axis items.
Defines BackgroundItem classes.
Defines class BeamAngleItems.
Defines class BeamWavelengthItem.
Defines class DistributionItemCatalog.
Defines class InstrumentItem and all its children.
Defines class InterferenceItemCatalog.
Defines InterferenceItems's classes.
Defines class ItemWithParticlesCatalog.
Defines class Lattice2DItemCatalog.
Defines class MaterialItem.
Defines class MesoCrystalItem.
Defines class MultiLayerItem.
Defines classes for ParameterTreeItems.
Defines namespace GUI::Model::ParameterTreeUtils.
Defines class ParticleCompositionItem.
Defines class ParticleCoreShellItem.
Defines class ParticleItem.
Defines class ParticleLayoutItem.
Defines ProfileItemCatalog classes.
Defines class RectangularDetectorItem.
Defines family of ResolutionFunctionItem.
Defines class RotationItemCatalog.
Defines class SphericalDetectorItem.
QString unitAsString(const Unit &unit)
Returns the string for the given unit.
Unit
Defines units, mainly to be able to convert between units.
The BeamDistributionItem handles wavelength, inclination and azimuthal parameter distribution for Bea...
DistributionItem * distribution() const
SelectionDescriptor< ResolutionFunctionItem * > resolutionFunctionSelection() const
static Type type(const DistributionItem *item)
Returns the enum type of the given item.
static UiInfo uiInfo(Type t)
UiInfo on the given type.
Describes properties of a double value which are necessary to allow GUI representation,...
variant< QString, Unit > unit
Unit of the value (internal unit only!)
QString label
A label text (short, no trailing colon)
function< double()> get
function to get the current value
Abstract base class for instrument-specific item classes.
bool withPolarizerAnalyzer() const
bool xiIntegration() const
SelectionDescriptor< Lattice2DItem * > latticeType() const
static Type type(const InterferenceItem *item)
Returns the enum type of the given item.
static UiInfo uiInfo(Type t)
UiInfo on the given type.
DoubleDescriptor abundance() const
SelectionDescriptor< RotationItem * > rotation()
Returns selection descriptor for rotation methods.
VectorDescriptor positionVector() const
MultiLayerItem * sampleItem()
InstrumentItem * instrumentItem() const
ParameterContainerItem * parameterContainerItem()
bool isSpecularJob() const
const QVector< MaterialItem * > & materialItems() const
MaterialItems & materialItems()
QVector< LayerItem * > layers() const
DoubleDescriptor crossCorrLength() const
VectorDescriptor externalFieldVector() const
The ParameterContainerItem is a top item to hold all ParameterItem, represents an entry point to para...
void setBackupValue(const QString &link, double d)
The ParameterItem class represent a tuning value in a parameter tuning tree.
ParameterTreeItems is a collection of items necessary to form a tuning tree for real time widget.
void addLattice(ParameterLabelItem *parentLabel, const Interference2DAbstractLatticeItem *itf)
ParameterLabelItem * addParticle(ParameterLabelItem *parentLabel, ItemWithParticles *p, bool enableAbundance, bool enablePosition=true)
Returns the top label which was created for the particle.
void addPolarization(ParameterLabelItem *instrumentLabel, const InstrumentItem *instrument)
void addMaterials()
add the job's materials
void addBackground(ParameterLabelItem *instrumentLabel, BackgroundItem *backgroundItem)
void addBeamDistribution(ParameterLabelItem *parentLabel, BeamDistributionItem *distributionItem, const QString &label, bool withMean=true)
bool allowMagneticFields() const
void addDetector(ParameterLabelItem *parentLabel, DetectorItem *detector)
ParameterTreeBuilder(JobItem *jobItem, bool recreateBackupValues)
void addParameterItem(ParameterLabelItem *parent, const DoubleDescriptor &d, const QString &label=QString())
void addSample()
add the job's sample
bool m_recreateBackupValues
void addRotation(ParameterLabelItem *parentLabel, ItemWithParticles *p)
ParameterContainerItem * parameterContainer()
void addInterference(ParameterLabelItem *layoutLabel, const ParticleLayoutItem *layout)
SelectionDescriptor< InterferenceItem * > interference() const
static Type type(const CatalogedType *item)
Returns the enum type of the given item.
Describes properties of a 3D vector, consisting of three double values.
QString label
A label text (short, no trailing colon)
QString const & name(EShape k)
QString labelWithUnit(const QString &label, std::variant< QString, Unit > unit)
Create a label with an optional unit in brackets.