28 const QString abundance_tooltip =
"Proportion of this type of particles normalized to the \n"
29 "total number of particles in the layout";
31 const QString position_tooltip =
"Relative position of the particle's reference point \n"
32 "in the coordinate system of the parent (nm)";
41 setToolTip(
"Composition of particles with fixed positions");
51 QStringList() <<
"Particle"
52 <<
"ParticleCoreShell"
53 <<
"ParticleComposition"
79 auto P_composition = std::make_unique<ParticleComposition>();
80 P_composition->setAbundance(abundance);
81 QVector<SessionItem*> childlist =
children();
82 for (
int i = 0; i < childlist.size(); ++i) {
83 if (childlist[i]->
modelType() ==
"Particle") {
84 auto* particle_item =
static_cast<ParticleItem*
>(childlist[i]);
87 P_composition->addParticle(*P_particle);
89 }
else if (childlist[i]->
modelType() ==
"ParticleCoreShell") {
92 if (P_particle_coreshell) {
93 P_composition->addParticle(*P_particle_coreshell);
95 }
else if (childlist[i]->
modelType() ==
"ParticleComposition") {
98 if (P_child_composition) {
99 P_composition->addParticle(*P_child_composition);
101 }
else if (childlist[i]->
modelType() ==
"MesoCrystal") {
105 P_composition->addParticle(*P_child_meso);
111 return P_composition;
Defines class MesoCrystalItem.
Defines class MesoCrystal.
Defines ModelPath namespace.
Defines class ParticleCompositionItem.
Defines class ParticleCoreShellItem.
Defines ParticleCoreShell.
Defines class ParticleItem.
Defines namespace SessionItemUtils.
Defines class TransformToDomain.
Defines class VectorItem.
std::unique_ptr< MesoCrystal > createMesoCrystal() const
void setOnParentChange(std::function< void(SessionItem *)> f, const void *caller=0)
Calls back when parent has changed, reports newParent.
ParticleCompositionItem()
VectorItem * positionItem() const
static const QString T_PARTICLES
std::unique_ptr< ParticleComposition > createParticleComposition() const
std::unique_ptr< ParticleCoreShell > createParticleCoreShell() const
std::unique_ptr< Particle > createParticle() const
static const QString P_ABUNDANCE
static const QString T_TRANSFORMATION
static const QString P_POSITION
static RealLimits limited(double left_bound_value, double right_bound_value)
Creates an object bounded from the left and right.
SessionItem * addProperty(const QString &name, const QVariant &variant)
Add new property item and register new tag.
SessionItem & setDecimals(int n)
bool registerTag(const QString &name, int min=0, int max=-1, QStringList modelTypes={})
Add new tag to this item with given name, min, max and types.
QVariant getItemValue(const QString &tag) const
Directly access value of item under given tag.
ModelMapper * mapper()
Returns the current model mapper of this item. Creates new one if necessary.
SessionItem * parent() const
Returns parent of this item.
void setDefaultTag(const QString &tag)
Set default tag.
void addTranslator(const IPathTranslator &translator)
void setItemValue(const QString &tag, const QVariant &variant)
Directly set value of item under given tag.
QVector< SessionItem * > children() const
Returns vector of all children.
SessionItem & setToolTip(const QString &tooltip)
QString modelType() const
Get model type.
void setEnabled(bool enabled)
SessionItem * getItem(const QString &tag="", int row=0) const
Returns item in given row of given tag.
SessionItem & setLimits(const RealLimits &value)
bool HasOwnAbundance(const SessionItem *item)
void setTransformationInfo(IParticle *result, const SessionItem &item)