diff --git a/GUI/Model/Device/InstrumentItems.cpp b/GUI/Model/Device/InstrumentItems.cpp index 5594e31cdeedbf22b9336876a494dc7ccf675809..01c34f4eafa99b24c50356bbd8d4089935eb441e 100644 --- a/GUI/Model/Device/InstrumentItems.cpp +++ b/GUI/Model/Device/InstrumentItems.cpp @@ -67,11 +67,11 @@ const QString ExpandInfoGroupbox("ExpandInfoGroupbox"); const QString ExpandPolarizerAlanyzerGroupbox("ExpandPolarizerAlanyzerGroupbox"); const QString Id("Id"); const QString Name("Name"); -const QString Polarization("Polarization"); // OBSOLETE since c21 +const QString Polarization("Polarization"); // OBSOLETE since v21 const QString PolarizerBlochVector("PolarizerBlochVector"); const QString Scan("Scan"); const QString ScanParameters("ScanParameters"); -const QString WithPolarizerAnalyzer("WithPolarizerAnalyzer"); +const QString WithPolarizerAnalyzer("WithPolarizerAnalyzer"); // OBSOLETE since v21 const QString WithPolarizer("WithPolarizer"); const QString WithAnalyzer("WithAnalyzer"); const QString ZAxis("ZAxis"); @@ -94,8 +94,7 @@ void setBeamDistribution(ParameterDistribution::WhichParameter which, // ************************************************************************************************ InstrumentItem::InstrumentItem() - : m_withPolarizerAnalyzer(false) - , m_withPolarizer(false) + : m_withPolarizer(false) , m_withAnalyzer(false) { m_id = QUuid::createUuid().toString(); @@ -438,10 +437,10 @@ ISimulation* SpecularInstrumentItem::createSimulation(const MultiLayer& sample) std::unique_ptr<Scale> axis = axis_item->itemToAxis(Units::deg, *converted_axis); std::unique_ptr<IBeamScan> scan = createScan(*axis); - if (withPolarizerAnalyzer()) { + if (withPolarizer()) scan->setPolarization(m_polarizerBlochVector); + if (withAnalyzer()) scan->setAnalyzer(m_analyzerBlochVector); - } auto* result = new SpecularSimulation(*scan, sample); if (const auto background = backgroundItem()->createBackground()) @@ -631,10 +630,10 @@ ISimulation* OffspecInstrumentItem::createSimulation(const MultiLayer& sample) c BasicAxisItem* const axis_item = scanItem()->inclinationAxisItem(); std::unique_ptr<Scale> axis = axis_item->itemToRegularAxis(Units::deg); std::unique_ptr<IBeamScan> scan = createScan(*axis); - if (withPolarizerAnalyzer()) { + if (withPolarizer()) scan->setPolarization(m_polarizerBlochVector); + if (withAnalyzer()) scan->setAnalyzer(m_analyzerBlochVector); - } auto* result = new OffspecSimulation(*scan, sample, *detector); if (const auto background = backgroundItem()->createBackground()) @@ -728,11 +727,11 @@ std::unique_ptr<const ICoordSystem> GISASInstrumentItem::createCoordSystem() con ISimulation* GISASInstrumentItem::createSimulation(const MultiLayer& sample) const { const auto beam = beamItem()->createBeam(); - if (withPolarizerAnalyzer()) + if (withPolarizer()) beam->setPolarization(m_polarizerBlochVector); const auto detector = detectorItem()->createDetector(); detector->setDetectorNormal(beam->ki()); - if (withPolarizerAnalyzer()) + if (withAnalyzer()) detector->setAnalyzer(m_analyzerBlochVector); auto* result = new ScatteringSimulation(*beam, sample, *detector); diff --git a/GUI/Model/Device/InstrumentItems.h b/GUI/Model/Device/InstrumentItems.h index e3918e3bdeeb2be32483f96e2bfe756054123de8..e7e07fd4c8169eb63f73cb15679e66c2b4bec5f8 100644 --- a/GUI/Model/Device/InstrumentItems.h +++ b/GUI/Model/Device/InstrumentItems.h @@ -87,7 +87,6 @@ public: SelectionProperty<BackgroundItemCatalog>& backgroundSelection() { return m_background; } BackgroundItem* backgroundItem() const { return m_background.currentItem(); } - bool withPolarizerAnalyzer() const { return m_withPolarizerAnalyzer; } bool withPolarizer() const { return m_withPolarizer; } void setWithPolarizer(bool with) { m_withPolarizer = with; } bool withAnalyzer() const { return m_withAnalyzer; } @@ -119,7 +118,6 @@ protected: QString m_id; QString m_name; QString m_description; - bool m_withPolarizerAnalyzer; bool m_withPolarizer; bool m_withAnalyzer; SelectionProperty<BackgroundItemCatalog> m_background; diff --git a/GUI/Model/Model/ParameterTreeUtil.cpp b/GUI/Model/Model/ParameterTreeUtil.cpp index 5fc9d8a481ba4e334be50f42dc732d7c5a65dbec..aa398c927da0374f81827c0775104325854f0337 100644 --- a/GUI/Model/Model/ParameterTreeUtil.cpp +++ b/GUI/Model/Model/ParameterTreeUtil.cpp @@ -440,10 +440,14 @@ void ParameterTreeBuilder::addBackground(ParameterLabelItem* instrumentLabel, void ParameterTreeBuilder::addPolarization(ParameterLabelItem* instrumentLabel, InstrumentItem* instrument) { - if (!instrument->withPolarizerAnalyzer()) + if (!instrument->withPolarizer() && !instrument->withAnalyzer()) return; auto* label = new ParameterLabelItem("Polarization analysis", instrumentLabel); - addParameterItem(label, instrument->polarizerBlochVector()); - addParameterItem(label, instrument->analyzerBlochVector()); + + if (instrument->withPolarizer()) + addParameterItem(label, instrument->polarizerBlochVector()); + + if (instrument->withAnalyzer()) + addParameterItem(label, instrument->analyzerBlochVector()); }