diff --git a/GUI/Model/CatJob/MinimizerItemCatalog.h b/GUI/Model/CatJob/MinimizerItemCatalog.h index 8011ae429bb499aa297df80c2be039c210d3d5da..c14ed1f5ff30fb6cd891bc5657faf477954a688c 100644 --- a/GUI/Model/CatJob/MinimizerItemCatalog.h +++ b/GUI/Model/CatJob/MinimizerItemCatalog.h @@ -17,8 +17,6 @@ #include "GUI/Util/ComboProperty.h" -class MinimizerItem; - //! The MinimizerItemCatalog class is a static class to provide MinimizerItem //! with the list of available minimizers/algorithms. diff --git a/GUI/Model/Device/RectangularDetectorItem.cpp b/GUI/Model/Device/RectangularDetectorItem.cpp index cf3fca3ce21c2fce3610b9f1e6d421d67e025230..97fba5e21bfcef19b67b206f29275bd34515822c 100644 --- a/GUI/Model/Device/RectangularDetectorItem.cpp +++ b/GUI/Model/Device/RectangularDetectorItem.cpp @@ -114,14 +114,15 @@ RectangularDetectorItem::RectangularDetectorItem() m_distance.init("Distance", "Distance from the sample origin to the detector plane", default_detector_distance, "mm", "distance"); - m_detectorAlignment = RectangularDetector::PERPENDICULAR_TO_DIRECT_BEAM; + m_detectorAlignment.fromList(alignment_names_map.keys(), + alignment_names_map.key(RectangularDetector::PERPENDICULAR_TO_DIRECT_BEAM)); updateTooltips(); } void RectangularDetectorItem::serialize(Streamer& s) { - int alignment = m_detectorAlignment; +// int alignment = m_detectorAlignment_TEMP; s.assertVersion(0); // base class members @@ -134,7 +135,7 @@ void RectangularDetectorItem::serialize(Streamer& s) Serialize::rwProperty(s, Tag::Width, m_width); Serialize::rwProperty(s, Tag::Height, m_height); - Serialize::rwValue(s, Tag::Alignment, alignment); +// Serialize::rwValue(s, Tag::Alignment, alignment); m_normalVector.rwProperty(s, Tag::NormalVector); m_directionVector.rwProperty(s, Tag::DirectionVector); @@ -143,21 +144,28 @@ void RectangularDetectorItem::serialize(Streamer& s) Serialize::rwProperty(s, Tag::Distance, m_distance); if (s.xmlReader()) { - setDetectorAlignment(static_cast<RectangularDetector::EDetectorArrangement>(alignment)); +// setDetectorAlignment(static_cast<RectangularDetector::EDetectorArrangement>(alignment)); m_resolutionFunction->setUnit("mm"); } } +void RectangularDetectorItem::setDetectorAlignment(const QString &alignment) +{ + ASSERT(alignment_names_map.keys().contains(alignment)); + setDetectorAlignment(alignment_names_map.value(alignment)); +} + void RectangularDetectorItem::setDetectorAlignment( RectangularDetector::EDetectorArrangement alignment) { - m_detectorAlignment = alignment; + m_detectorAlignment.setCurrentValue(alignment_names_map.key(alignment)); updateTooltips(); } RectangularDetector::EDetectorArrangement RectangularDetectorItem::detectorAlignment() const { - return m_detectorAlignment; + ASSERT(alignment_names_map.keys().contains(m_detectorAlignment.currentValue())); + return alignment_names_map.value(m_detectorAlignment.currentValue()); } int RectangularDetectorItem::xSize() const @@ -193,7 +201,7 @@ RectangularDetectorItem::detectorAlignmentSelection() const const_cast<RectangularDetectorItem*>(this)->setDetectorAlignment(alignments()[newIndex]); }; - d.currentIndexGetter = [&]() { return alignments().indexOf(m_detectorAlignment); }; + d.currentIndexGetter = [&]() { return alignments().indexOf(detectorAlignment()); }; return d; } @@ -202,7 +210,7 @@ std::unique_ptr<IDetector> RectangularDetectorItem::createDomainDetector() const auto result = std::make_unique<RectangularDetector>(xSize(), width(), ySize(), height()); // distance and alignment - switch (m_detectorAlignment) { + switch (detectorAlignment()) { case RectangularDetector::GENERIC: result->setDetectorPosition(m_normalVector, m_u0, m_v0, m_directionVector); break; @@ -228,7 +236,7 @@ std::unique_ptr<IDetector> RectangularDetectorItem::createDomainDetector() const void RectangularDetectorItem::updateTooltips() { - switch (m_detectorAlignment) { + switch (detectorAlignment()) { case RectangularDetector::GENERIC: m_u0.setTooltip( "u-coordinate of point of intersection of normal vector and detector plane"); diff --git a/GUI/Model/Device/RectangularDetectorItem.h b/GUI/Model/Device/RectangularDetectorItem.h index 2c0d8f6bad38b9d8022bb62e735a703333e6b1ea..17c8fb9d5228de13d4219dc46d472efd001e19ad 100644 --- a/GUI/Model/Device/RectangularDetectorItem.h +++ b/GUI/Model/Device/RectangularDetectorItem.h @@ -39,7 +39,9 @@ public: const DoubleProperty& height() const { return m_height; } void setHeight(double v) { m_height.setValue(v); } + void setDetectorAlignment(const QString& alignment); void setDetectorAlignment(RectangularDetector::EDetectorArrangement alignment); + RectangularDetector::EDetectorArrangement detectorAlignment() const; SelectionDescriptor<RectangularDetector::EDetectorArrangement> detectorAlignmentSelection() const; @@ -69,11 +71,10 @@ private: void updateTooltips(); private: - RectangularDetector::EDetectorArrangement m_detectorAlignment; + ComboProperty m_detectorAlignment; int m_xSize; int m_ySize; -protected: VectorProperty m_normalVector; VectorProperty m_directionVector;