Skip to content
Snippets Groups Projects
Commit 2107f0f7 authored by Matthias Puchner's avatar Matthias Puchner
Browse files

reduce SessionModel usage in LayerItem

parent 71846b7b
No related branches found
No related tags found
1 merge request!513Refactor sample model
...@@ -45,21 +45,19 @@ QVector<ItemWithMaterial*> layoutItemsWithMaterial(ParticleLayoutItem* item) ...@@ -45,21 +45,19 @@ QVector<ItemWithMaterial*> layoutItemsWithMaterial(ParticleLayoutItem* item)
if (!item) if (!item)
continue; continue;
if (item->hasModelType<ParticleCompositionItem>()) if (auto* p = dynamic_cast<ParticleCompositionItem*>(item))
itemsWithParticles << polymorphic_cast<ParticleCompositionItem*>(item)->particles(); itemsWithParticles << p->particles();
else if (item->hasModelType<MesoCrystalItem>()) else if (auto* p = dynamic_cast<MesoCrystalItem*>(item))
itemsWithParticles << polymorphic_cast<MesoCrystalItem*>(item)->basisParticle(); itemsWithParticles << p->basisParticle();
else if (item->hasModelType<ParticleItem>()) else if (auto* p = dynamic_cast<ParticleItem*>(item))
ret << dynamic_cast<ParticleItem*>(item); ret << p;
else if (item->hasModelType<ParticleCoreShellItem>()) { else if (auto* p = dynamic_cast<ParticleCoreShellItem*>(item)) {
if (auto* core = dynamic_cast<ParticleCoreShellItem*>(item)->core()) if (p->core())
ret << core; ret << p->core();
if (auto* shell = dynamic_cast<ParticleCoreShellItem*>(item)->shell()) if (p->shell())
ret << shell; ret << p->shell();
} else } else
throw Error("Error in GUI::MaterialUtil::materialProperties: cannot handle " ASSERT(false);
"passed model type '"
+ item->modelType() + "'");
} }
return ret; return ret;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment