diff --git a/GUI/Models/GUIDomainSampleVisitor.cpp b/GUI/Models/GUIDomainSampleVisitor.cpp index 8549d39ccf8518d4a52f795121cb47a1e0b99c94..18b87e14d76860b7f6756967468b8cbdcde95b5e 100644 --- a/GUI/Models/GUIDomainSampleVisitor.cpp +++ b/GUI/Models/GUIDomainSampleVisitor.cpp @@ -95,7 +95,7 @@ void GUIDomainSampleVisitor::visit(const ParticleLayout* sample) SessionItem* parent = m_levelToParentItem[depth() - 1]; auto layout_item = m_sampleModel->insertItem<ParticleLayoutItem>(parent); layout_item->setTotalDensity(sample->totalParticleSurfaceDensity()); - layout_item->setItemValue(ParticleLayoutItem::P_WEIGHT, sample->weight()); + layout_item->setWeight(sample->weight()); m_levelToParentItem[depth()] = layout_item; } diff --git a/GUI/Models/ParticleLayoutItem.cpp b/GUI/Models/ParticleLayoutItem.cpp index 781b7ac3c80141813db64a799c3aed5e47367e2a..288ab04db97a19360f869bf09e5a3d60ee9af61c 100644 --- a/GUI/Models/ParticleLayoutItem.cpp +++ b/GUI/Models/ParticleLayoutItem.cpp @@ -95,6 +95,17 @@ void ParticleLayoutItem::setTotalDensity(double total_density) setItemValue(P_TOTAL_DENSITY, total_density); } +double ParticleLayoutItem::weight() const +{ + return getItemValue(P_WEIGHT).toDouble(); +} + +void ParticleLayoutItem::setWeight(double weight) +{ + + setItemValue(P_WEIGHT, weight); +} + //! Disables/enables total density property, depending on type of interference function. //! Two dimensional interference calculates density automatically, so property should //! be disabled. diff --git a/GUI/Models/ParticleLayoutItem.h b/GUI/Models/ParticleLayoutItem.h index 0996ff094911dc19890960eb73ac4e12b8e663dd..33fb95ae27f27c07b8a1d56064b10b39845f7f66 100644 --- a/GUI/Models/ParticleLayoutItem.h +++ b/GUI/Models/ParticleLayoutItem.h @@ -20,9 +20,9 @@ class BA_CORE_API_ ParticleLayoutItem : public SessionGraphicsItem { private: static const QString P_TOTAL_DENSITY; + static const QString P_WEIGHT; public: - static const QString P_WEIGHT; static const QString T_PARTICLES; static const QString T_INTERFERENCE; @@ -33,6 +33,9 @@ public: double totalDensity() const; void setTotalDensity(double total_density); + double weight() const; + void setWeight(double weight); + private: void updateDensityAppearance(); void updateDensityValue(); diff --git a/GUI/Models/TransformToDomain.cpp b/GUI/Models/TransformToDomain.cpp index ad2d702413f8bde93c95da9853883d941e9a7604..5e12be96b0894a50266c9afd55ad8f8fe899304c 100644 --- a/GUI/Models/TransformToDomain.cpp +++ b/GUI/Models/TransformToDomain.cpp @@ -98,7 +98,7 @@ GUI::Transform::ToDomain::createParticleLayout(const ParticleLayoutItem& item) { auto P_layout = std::make_unique<ParticleLayout>(); double total_density = item.totalDensity(); - auto layout_weight = item.getItemValue(ParticleLayoutItem::P_WEIGHT).value<double>(); + double layout_weight = item.weight(); P_layout->setTotalParticleSurfaceDensity(total_density); P_layout->setWeight(layout_weight); return P_layout;