From e0aeeefe6a8a8944a394723e5daacacdbf3c769f Mon Sep 17 00:00:00 2001 From: Tobias Knopff <t.knopff@fz-juelich.de> Date: Mon, 31 May 2021 11:00:36 +0200 Subject: [PATCH] Make RectangularDetectorItem::P_(U|V)0 private --- GUI/Models/RectangularDetectorItem.cpp | 20 +++++++++++++++++++ GUI/Models/RectangularDetectorItem.h | 10 ++++++++-- GUI/Models/TransformFromDomain.cpp | 12 +++++------ .../RectangularDetectorEditor.cpp | 8 ++++---- 4 files changed, 38 insertions(+), 12 deletions(-) diff --git a/GUI/Models/RectangularDetectorItem.cpp b/GUI/Models/RectangularDetectorItem.cpp index d8b334c4391..e4cddea3b2b 100644 --- a/GUI/Models/RectangularDetectorItem.cpp +++ b/GUI/Models/RectangularDetectorItem.cpp @@ -219,6 +219,26 @@ void RectangularDetectorItem::setDirectionVector(const kvector_t& direction) item<VectorItem>(P_DIRECTION)->setVector(direction); } +SessionItem* RectangularDetectorItem::u0Item() const +{ + return getItem(P_U0); +} + +void RectangularDetectorItem::setU0(const double u0) +{ + setItemValue(P_U0, u0); +} + +SessionItem* RectangularDetectorItem::v0Item() const +{ + return getItem(P_V0); +} + +void RectangularDetectorItem::setV0(const double v0) +{ + setItemValue(P_V0, v0); +} + std::unique_ptr<IDetector2D> RectangularDetectorItem::createDomainDetector() const { // basic axes parameters diff --git a/GUI/Models/RectangularDetectorItem.h b/GUI/Models/RectangularDetectorItem.h index 3a2c313d354..aa7455e275e 100644 --- a/GUI/Models/RectangularDetectorItem.h +++ b/GUI/Models/RectangularDetectorItem.h @@ -28,10 +28,10 @@ private: static const QString P_ALIGNMENT; static const QString P_NORMAL; static const QString P_DIRECTION; - -public: static const QString P_U0; static const QString P_V0; + +public: static const QString P_DBEAM_U0; static const QString P_DBEAM_V0; static const QString P_DISTANCE; @@ -61,6 +61,12 @@ public: SessionItem* directionVectorItem() const; void setDirectionVector(const kvector_t& direction); + SessionItem* u0Item() const; + void setU0(double u0); + + SessionItem* v0Item() const; + void setV0(double v0); + private: std::unique_ptr<IDetector2D> createDomainDetector() const override; void update_properties_appearance(); diff --git a/GUI/Models/TransformFromDomain.cpp b/GUI/Models/TransformFromDomain.cpp index 5ff59801329..15ae9495954 100644 --- a/GUI/Models/TransformFromDomain.cpp +++ b/GUI/Models/TransformFromDomain.cpp @@ -394,15 +394,15 @@ void TransformFromDomain::setRectangularDetector(RectangularDetectorItem* detect kvector_t direction = detector.getDirectionVector(); detector_item->setDirectionVector(direction); - detector_item->setItemValue(RectangularDetectorItem::P_U0, detector.getU0()); - detector_item->setItemValue(RectangularDetectorItem::P_V0, detector.getV0()); + detector_item->setU0(detector.getU0()); + detector_item->setV0(detector.getV0()); } else if (detector.getDetectorArrangment() == RectangularDetector::PERPENDICULAR_TO_SAMPLE) { detector_item->setDetectorAlignment("Perpendicular to sample x-axis"); detector_item->setItemValue(RectangularDetectorItem::P_DISTANCE, detector.getDistance()); - detector_item->setItemValue(RectangularDetectorItem::P_U0, detector.getU0()); - detector_item->setItemValue(RectangularDetectorItem::P_V0, detector.getV0()); + detector_item->setU0(detector.getU0()); + detector_item->setV0(detector.getV0()); } else if (detector.getDetectorArrangment() == RectangularDetector::PERPENDICULAR_TO_DIRECT_BEAM) { @@ -415,8 +415,8 @@ void TransformFromDomain::setRectangularDetector(RectangularDetectorItem* detect == RectangularDetector::PERPENDICULAR_TO_REFLECTED_BEAM) { detector_item->setDetectorAlignment("Perpendicular to reflected beam"); detector_item->setItemValue(RectangularDetectorItem::P_DISTANCE, detector.getDistance()); - detector_item->setItemValue(RectangularDetectorItem::P_U0, detector.getU0()); - detector_item->setItemValue(RectangularDetectorItem::P_V0, detector.getV0()); + detector_item->setU0(detector.getU0()); + detector_item->setV0(detector.getV0()); } else if (detector.getDetectorArrangment() == RectangularDetector::PERPENDICULAR_TO_REFLECTED_BEAM_DPOS) { diff --git a/GUI/Views/InstrumentWidgets/RectangularDetectorEditor.cpp b/GUI/Views/InstrumentWidgets/RectangularDetectorEditor.cpp index 8e5e60a32e0..1102c02a682 100644 --- a/GUI/Views/InstrumentWidgets/RectangularDetectorEditor.cpp +++ b/GUI/Views/InstrumentWidgets/RectangularDetectorEditor.cpp @@ -135,8 +135,8 @@ void RectangularDetectorEditor::init_alignment_editors() m_normalEditor->show(); m_directionEditor->show(); - m_positionsEditor->addItem(detectorItem()->getItem(RectangularDetectorItem::P_U0)); - m_positionsEditor->addItem(detectorItem()->getItem(RectangularDetectorItem::P_V0)); + m_positionsEditor->addItem(detectorItem()->u0Item()); + m_positionsEditor->addItem(detectorItem()->v0Item()); auto normalVectorItem = detectorItem()->normalVectorItem(); m_normalEditor->setItem(normalVectorItem); @@ -155,8 +155,8 @@ void RectangularDetectorEditor::init_alignment_editors() || alignment.getValue() == "Perpendicular to reflected beam") { m_positionsEditor->show(); - m_positionsEditor->addItem(detectorItem()->getItem(RectangularDetectorItem::P_U0)); - m_positionsEditor->addItem(detectorItem()->getItem(RectangularDetectorItem::P_V0)); + m_positionsEditor->addItem(detectorItem()->u0Item()); + m_positionsEditor->addItem(detectorItem()->v0Item()); m_positionsEditor->addItem(detectorItem()->getItem(RectangularDetectorItem::P_DISTANCE)); } } -- GitLab