diff --git a/GUI/Models/MesoCrystalItem.h b/GUI/Models/MesoCrystalItem.h index 8d3d6867dca5989a48c2d589eac6a0eddeda96e8..76a1aed0f48923abfe35b860372cd71494663553 100644 --- a/GUI/Models/MesoCrystalItem.h +++ b/GUI/Models/MesoCrystalItem.h @@ -52,6 +52,7 @@ public: ItemWithParticles* basisParticle() const; + template <typename T> T* createBasis(); void setVectorA(const R3& vector_a); void setVectorB(const R3& vector_b); @@ -70,4 +71,11 @@ template <typename T> T* MesoCrystalItem::setOuterShapeType() return setGroupPropertyType<T>(P_OUTER_SHAPE); } +template <typename T> T* MesoCrystalItem::createBasis() +{ + if (basisParticle() != nullptr) + model()->removeItem(basisParticle()); + return model()->insertItem<T>(this, -1, T_BASIS_PARTICLE); +} + #endif // BORNAGAIN_GUI_MODELS_MESOCRYSTALITEM_H