From a4b500c1627e80d874e7bb8055c8c40969efa227 Mon Sep 17 00:00:00 2001 From: Tobias Knopff <t.knopff@fz-juelich.de> Date: Mon, 5 Jul 2021 15:02:08 +0200 Subject: [PATCH] Make SawtoothRippleBoxItem::P_* private --- GUI/Models/FormFactorItems.cpp | 20 ++++++++++++++++++++ GUI/Models/FormFactorItems.h | 8 +++++++- GUI/Models/GUIDomainSampleVisitor.cpp | 10 +++++----- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/GUI/Models/FormFactorItems.cpp b/GUI/Models/FormFactorItems.cpp index 329ea812759..79e836df004 100644 --- a/GUI/Models/FormFactorItems.cpp +++ b/GUI/Models/FormFactorItems.cpp @@ -765,6 +765,26 @@ std::unique_ptr<IFormFactor> SawtoothRippleBoxItem::createFormFactor() const getItemValue(P_HEIGHT).toDouble(), getItemValue(P_ASYMMETRY).toDouble()); } +void SawtoothRippleBoxItem::setLength(const double length) +{ + setItemValue(P_LENGTH, length); +} + +void SawtoothRippleBoxItem::setWidth(const double width) +{ + setItemValue(P_WIDTH, width); +} + +void SawtoothRippleBoxItem::setHeight(const double height) +{ + setItemValue(P_HEIGHT, height); +} + +void SawtoothRippleBoxItem::setAsymmetry(const double asymmetry) +{ + setItemValue(P_ASYMMETRY, asymmetry); +} + /* ------------------------------------------------ */ const QString SawtoothRippleGaussItem::P_LENGTH("Length"); diff --git a/GUI/Models/FormFactorItems.h b/GUI/Models/FormFactorItems.h index d23f7a533f4..a5ed3efe364 100644 --- a/GUI/Models/FormFactorItems.h +++ b/GUI/Models/FormFactorItems.h @@ -356,16 +356,22 @@ public: }; class BA_CORE_API_ SawtoothRippleBoxItem : public FormFactorItem { -public: +private: static const QString P_LENGTH; static const QString P_WIDTH; static const QString P_HEIGHT; static const QString P_ASYMMETRY; +public: static const QString M_TYPE; SawtoothRippleBoxItem(); std::unique_ptr<IFormFactor> createFormFactor() const override; + + void setLength(double length); + void setWidth(double width); + void setHeight(double height); + void setAsymmetry(double asymmetry); }; class BA_CORE_API_ SawtoothRippleGaussItem : public FormFactorItem { diff --git a/GUI/Models/GUIDomainSampleVisitor.cpp b/GUI/Models/GUIDomainSampleVisitor.cpp index 708377c807d..2df1fda43f0 100644 --- a/GUI/Models/GUIDomainSampleVisitor.cpp +++ b/GUI/Models/GUIDomainSampleVisitor.cpp @@ -368,11 +368,11 @@ void GUIDomainSampleVisitor::visit(const FormFactorCosineRippleLorentz* sample) void GUIDomainSampleVisitor::visit(const FormFactorSawtoothRippleBox* sample) { SessionItem* particle_item = m_levelToParentItem[depth() - 1]; - SessionItem* ff_item = AddFormFactorItem<SawtoothRippleBoxItem>(particle_item); - ff_item->setItemValue(SawtoothRippleBoxItem::P_LENGTH, sample->getLength()); - ff_item->setItemValue(SawtoothRippleBoxItem::P_WIDTH, sample->getWidth()); - ff_item->setItemValue(SawtoothRippleBoxItem::P_HEIGHT, sample->getHeight()); - ff_item->setItemValue(SawtoothRippleBoxItem::P_ASYMMETRY, sample->getAsymmetry()); + SawtoothRippleBoxItem* ff_item = AddFormFactorItem<SawtoothRippleBoxItem>(particle_item); + ff_item->setLength(sample->getLength()); + ff_item->setWidth(sample->getWidth()); + ff_item->setHeight(sample->getHeight()); + ff_item->setAsymmetry(sample->getAsymmetry()); m_levelToParentItem[depth()] = particle_item; } -- GitLab