From 1183e752bbf1fda503f6ab7a2f4beff5871baa93 Mon Sep 17 00:00:00 2001 From: Gennady Pospelov <g.pospelov@fz-juelich.de> Date: Mon, 18 Apr 2016 12:54:42 +0200 Subject: [PATCH] Fixed group is removed from SphericalDetectorItem --- GUI/coregui/Models/SphericalDetectorItem.cpp | 23 ++++++++----------- GUI/coregui/Models/TransformFromDomain.cpp | 4 ++-- .../DetectorMaskDelegate.cpp | 4 ++-- .../SphericalDetectorWidget.cpp | 4 ++-- 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/GUI/coregui/Models/SphericalDetectorItem.cpp b/GUI/coregui/Models/SphericalDetectorItem.cpp index c708b06831a..fc02fe2be9c 100644 --- a/GUI/coregui/Models/SphericalDetectorItem.cpp +++ b/GUI/coregui/Models/SphericalDetectorItem.cpp @@ -29,15 +29,15 @@ const QString SphericalDetectorItem::P_RESOLUTION_FUNCTION = "Type"; SphericalDetectorItem::SphericalDetectorItem() : SessionItem(Constants::SphericalDetectorType) { - addGroupProperty(P_PHI_AXIS, Constants::BasicAxisType); - getGroupItem(P_PHI_AXIS)->getItem(BasicAxisItem::P_TITLE)->setVisible(false); - getGroupItem(P_PHI_AXIS)->setItemValue(BasicAxisItem::P_MIN, -1.0); - getGroupItem(P_PHI_AXIS)->setItemValue(BasicAxisItem::P_MAX, 1.0); + SessionItem *item = addGroupPropertyTmp(P_PHI_AXIS, Constants::BasicAxisType); + item->getItem(BasicAxisItem::P_TITLE)->setVisible(false); + item->setItemValue(BasicAxisItem::P_MIN, -1.0); + item->setItemValue(BasicAxisItem::P_MAX, 1.0); - addGroupProperty(P_ALPHA_AXIS, Constants::BasicAxisType); - getGroupItem(P_ALPHA_AXIS)->getItem(BasicAxisItem::P_TITLE)->setVisible(false); - getGroupItem(P_ALPHA_AXIS)->setItemValue(BasicAxisItem::P_MIN, 0.0); - getGroupItem(P_ALPHA_AXIS)->setItemValue(BasicAxisItem::P_MAX, 2.0); + item = addGroupPropertyTmp(P_ALPHA_AXIS, Constants::BasicAxisType); + item->getItem(BasicAxisItem::P_TITLE)->setVisible(false); + item->setItemValue(BasicAxisItem::P_MIN, 0.0); + item->setItemValue(BasicAxisItem::P_MAX, 2.0); addGroupProperty(P_RESOLUTION_FUNCTION, Constants::ResolutionFunctionGroup); setGroupProperty(P_RESOLUTION_FUNCTION, Constants::ResolutionFunctionNoneType); @@ -45,13 +45,10 @@ SphericalDetectorItem::SphericalDetectorItem() std::unique_ptr<IDetector2D> SphericalDetectorItem::createDetector() const { - -// return GUIHelpers::make_unique<SphericalDetector>(); -// std::unique_ptr<SphericalDetector> result = GUIHelpers::make_unique<SphericalDetector>(); std::unique_ptr<SphericalDetector> result(new SphericalDetector()); auto x_axis = dynamic_cast<BasicAxisItem *>( - getGroupItem(SphericalDetectorItem::P_PHI_AXIS)); + getItem(SphericalDetectorItem::P_PHI_AXIS)); Q_ASSERT(x_axis); int n_x = x_axis->getItemValue(BasicAxisItem::P_NBINS).toInt(); double x_min @@ -60,7 +57,7 @@ std::unique_ptr<IDetector2D> SphericalDetectorItem::createDetector() const = Units::deg2rad(x_axis->getItemValue(BasicAxisItem::P_MAX).toDouble()); auto y_axis = dynamic_cast<BasicAxisItem *>( - getGroupItem(SphericalDetectorItem::P_ALPHA_AXIS)); + getItem(SphericalDetectorItem::P_ALPHA_AXIS)); Q_ASSERT(y_axis); int n_y = y_axis->getItemValue(BasicAxisItem::P_NBINS).toInt(); double y_min diff --git a/GUI/coregui/Models/TransformFromDomain.cpp b/GUI/coregui/Models/TransformFromDomain.cpp index a4e8c705020..364daef61e6 100644 --- a/GUI/coregui/Models/TransformFromDomain.cpp +++ b/GUI/coregui/Models/TransformFromDomain.cpp @@ -301,14 +301,14 @@ void TransformFromDomain::setItemFromSample(SphericalDetectorItem *detectorItem, const IAxis &alpha_axis = detector.getAxis(1); BasicAxisItem *phiAxisItem = dynamic_cast<BasicAxisItem *>( - detectorItem->getGroupItem(SphericalDetectorItem::P_PHI_AXIS)); + detectorItem->getItem(SphericalDetectorItem::P_PHI_AXIS)); Q_ASSERT(phiAxisItem); phiAxisItem->setItemValue(BasicAxisItem::P_NBINS, (int)phi_axis.getSize()); phiAxisItem->setItemValue(BasicAxisItem::P_MIN, Units::rad2deg(phi_axis.getMin())); phiAxisItem->setItemValue(BasicAxisItem::P_MAX, Units::rad2deg(phi_axis.getMax())); BasicAxisItem *alphaAxisItem = dynamic_cast<BasicAxisItem *>( - detectorItem->getGroupItem(SphericalDetectorItem::P_ALPHA_AXIS)); + detectorItem->getItem(SphericalDetectorItem::P_ALPHA_AXIS)); Q_ASSERT(alphaAxisItem); alphaAxisItem->setItemValue(BasicAxisItem::P_NBINS, (int)alpha_axis.getSize()); alphaAxisItem->setItemValue(BasicAxisItem::P_MIN, Units::rad2deg(alpha_axis.getMin())); diff --git a/GUI/coregui/Views/InstrumentWidgets/DetectorMaskDelegate.cpp b/GUI/coregui/Views/InstrumentWidgets/DetectorMaskDelegate.cpp index 42547ae175d..a021897c344 100644 --- a/GUI/coregui/Views/InstrumentWidgets/DetectorMaskDelegate.cpp +++ b/GUI/coregui/Views/InstrumentWidgets/DetectorMaskDelegate.cpp @@ -114,7 +114,7 @@ DetectorMaskDelegate::createOutputData(DetectorItem *detectorItem) if (subDetector->modelType() == Constants::SphericalDetectorType) { auto x_axis = dynamic_cast<BasicAxisItem *>( - subDetector->getGroupItem(SphericalDetectorItem::P_PHI_AXIS)); + subDetector->getItem(SphericalDetectorItem::P_PHI_AXIS)); Q_ASSERT(x_axis); int n_x = x_axis->getItemValue(BasicAxisItem::P_NBINS).toInt(); double x_min @@ -123,7 +123,7 @@ DetectorMaskDelegate::createOutputData(DetectorItem *detectorItem) = x_axis->getItemValue(BasicAxisItem::P_MAX).toDouble(); auto y_axis = dynamic_cast<BasicAxisItem *>( - subDetector->getGroupItem(SphericalDetectorItem::P_ALPHA_AXIS)); + subDetector->getItem(SphericalDetectorItem::P_ALPHA_AXIS)); Q_ASSERT(y_axis); int n_y = y_axis->getItemValue(BasicAxisItem::P_NBINS).toInt(); double y_min diff --git a/GUI/coregui/Views/InstrumentWidgets/SphericalDetectorWidget.cpp b/GUI/coregui/Views/InstrumentWidgets/SphericalDetectorWidget.cpp index f98fef7a231..7c440891d6d 100644 --- a/GUI/coregui/Views/InstrumentWidgets/SphericalDetectorWidget.cpp +++ b/GUI/coregui/Views/InstrumentWidgets/SphericalDetectorWidget.cpp @@ -81,11 +81,11 @@ void SphericalDetectorWidget::setDetectorItem(DetectorItem *detectorItem) detectorItem->getGroupItem(DetectorItem::P_DETECTOR)); Q_ASSERT(sphericalDetector); - SessionItem *phiAxisItem = sphericalDetector->getGroupItem(SphericalDetectorItem::P_PHI_AXIS); + SessionItem *phiAxisItem = sphericalDetector->getItem(SphericalDetectorItem::P_PHI_AXIS); m_phiAxisEditor->addPropertyItems(phiAxisItem, QString("Phi axis")); SessionItem *alphaAxisItem - = sphericalDetector->getGroupItem(SphericalDetectorItem::P_ALPHA_AXIS); + = sphericalDetector->getItem(SphericalDetectorItem::P_ALPHA_AXIS); m_alphaAxisEditor->addPropertyItems(alphaAxisItem, QString("Alpha axis")); SessionItem *resFuncGroup = sphericalDetector->getItem(SphericalDetectorItem::P_RESOLUTION_FUNCTION); -- GitLab