From 34a94b6794859c84a324f1d30e158d63ec3cf8c8 Mon Sep 17 00:00:00 2001 From: Tobias Knopff <t.knopff@fz-juelich.de> Date: Mon, 31 May 2021 11:36:32 +0200 Subject: [PATCH] Make RectangularDetectorItem::P_DISTANCE private --- GUI/Models/RectangularDetectorItem.cpp | 10 ++++++++++ GUI/Models/RectangularDetectorItem.h | 6 ++++-- GUI/Models/TransformFromDomain.cpp | 8 ++++---- .../InstrumentWidgets/RectangularDetectorEditor.cpp | 4 ++-- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/GUI/Models/RectangularDetectorItem.cpp b/GUI/Models/RectangularDetectorItem.cpp index f665db74434..ee5b61ee239 100644 --- a/GUI/Models/RectangularDetectorItem.cpp +++ b/GUI/Models/RectangularDetectorItem.cpp @@ -259,6 +259,16 @@ void RectangularDetectorItem::setDirectBeamV0(const double v0) setItemValue(P_DBEAM_V0, v0); } +SessionItem* RectangularDetectorItem::distanceItem() const +{ + return getItem(P_DISTANCE); +} + +void RectangularDetectorItem::setDistance(const double distance) +{ + setItemValue(P_DISTANCE, distance); +} + std::unique_ptr<IDetector2D> RectangularDetectorItem::createDomainDetector() const { // basic axes parameters diff --git a/GUI/Models/RectangularDetectorItem.h b/GUI/Models/RectangularDetectorItem.h index 955cbf3f1b8..85289bc2e5d 100644 --- a/GUI/Models/RectangularDetectorItem.h +++ b/GUI/Models/RectangularDetectorItem.h @@ -32,10 +32,9 @@ private: static const QString P_V0; static const QString P_DBEAM_U0; static const QString P_DBEAM_V0; - -public: static const QString P_DISTANCE; +public: RectangularDetectorItem(); void setDetectorAlignment(const QString& alignment); @@ -73,6 +72,9 @@ public: SessionItem* directBeamV0Item() const; void setDirectBeamV0(double dbeam_v0); + SessionItem* distanceItem() const; + void setDistance(double distance); + 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 69e12eb6d12..7d1674d9462 100644 --- a/GUI/Models/TransformFromDomain.cpp +++ b/GUI/Models/TransformFromDomain.cpp @@ -400,28 +400,28 @@ void TransformFromDomain::setRectangularDetector(RectangularDetectorItem* detect 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->setDistance(detector.getDistance()); detector_item->setU0(detector.getU0()); detector_item->setV0(detector.getV0()); } else if (detector.getDetectorArrangment() == RectangularDetector::PERPENDICULAR_TO_DIRECT_BEAM) { detector_item->setDetectorAlignment("Perpendicular to direct beam"); - detector_item->setItemValue(RectangularDetectorItem::P_DISTANCE, detector.getDistance()); + detector_item->setDistance(detector.getDistance()); detector_item->setDirectBeamU0(detector.getU0()); detector_item->setDirectBeamV0(detector.getV0()); } else if (detector.getDetectorArrangment() == RectangularDetector::PERPENDICULAR_TO_REFLECTED_BEAM) { detector_item->setDetectorAlignment("Perpendicular to reflected beam"); - detector_item->setItemValue(RectangularDetectorItem::P_DISTANCE, detector.getDistance()); + detector_item->setDistance(detector.getDistance()); detector_item->setU0(detector.getU0()); detector_item->setV0(detector.getV0()); } else if (detector.getDetectorArrangment() == RectangularDetector::PERPENDICULAR_TO_REFLECTED_BEAM_DPOS) { detector_item->setDetectorAlignment("Perpendicular to reflected beam (dpos)"); - detector_item->setItemValue(RectangularDetectorItem::P_DISTANCE, detector.getDistance()); + detector_item->setDistance(detector.getDistance()); detector_item->setDirectBeamU0(detector.getDirectBeamU0()); detector_item->setDirectBeamV0(detector.getDirectBeamV0()); diff --git a/GUI/Views/InstrumentWidgets/RectangularDetectorEditor.cpp b/GUI/Views/InstrumentWidgets/RectangularDetectorEditor.cpp index 41360726e60..c2eec10c031 100644 --- a/GUI/Views/InstrumentWidgets/RectangularDetectorEditor.cpp +++ b/GUI/Views/InstrumentWidgets/RectangularDetectorEditor.cpp @@ -149,7 +149,7 @@ void RectangularDetectorEditor::init_alignment_editors() m_positionsEditor->show(); m_positionsEditor->addItem(detectorItem()->directBeamU0Item()); m_positionsEditor->addItem(detectorItem()->directBeamV0Item()); - m_positionsEditor->addItem(detectorItem()->getItem(RectangularDetectorItem::P_DISTANCE)); + m_positionsEditor->addItem(detectorItem()->distanceItem()); } else if (alignment.getValue() == "Perpendicular to sample x-axis" || alignment.getValue() == "Perpendicular to reflected beam") { @@ -157,6 +157,6 @@ void RectangularDetectorEditor::init_alignment_editors() m_positionsEditor->addItem(detectorItem()->u0Item()); m_positionsEditor->addItem(detectorItem()->v0Item()); - m_positionsEditor->addItem(detectorItem()->getItem(RectangularDetectorItem::P_DISTANCE)); + m_positionsEditor->addItem(detectorItem()->distanceItem()); } } -- GitLab