Skip to content
Snippets Groups Projects
Commit 832d58e3 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

use it ...

parent 802f3727
No related branches found
No related tags found
1 merge request!2675simplification and renaming of catalog classes
...@@ -251,12 +251,13 @@ void updateDetector(Scatter2DInstrumentItem* instrument_item, const IDetector& d ...@@ -251,12 +251,13 @@ void updateDetector(Scatter2DInstrumentItem* instrument_item, const IDetector& d
void setBackground(InstrumentItem* instrument_item, const ISimulation& simulation) void setBackground(InstrumentItem* instrument_item, const ISimulation& simulation)
{ {
const auto* bg = simulation.background(); const auto* bg = simulation.background();
PolyItem<BackgroundItemCatalog>& ib = instrument_item->backgroundSelection();
if (const auto* constant_bg = dynamic_cast<const ConstantBackground*>(bg)) { if (const auto* constant_bg = dynamic_cast<const ConstantBackground*>(bg)) {
auto* constant_bg_item = instrument_item->setBackgroundItemType<ConstantBackgroundItem>(); auto* constant_bg_item = ib.createCertainItem<ConstantBackgroundItem>();
double value = constant_bg->backgroundValue(); double value = constant_bg->backgroundValue();
constant_bg_item->setBackgroundValue(value); constant_bg_item->setBackgroundValue(value);
} else if (dynamic_cast<const PoissonBackground*>(bg)) } else if (dynamic_cast<const PoissonBackground*>(bg))
instrument_item->setBackgroundItemType<PoissonBackgroundItem>(); ib.createCertainItem<PoissonBackgroundItem>();
} }
Scatter2DInstrumentItem* createScatter2DInstrumentItem(const ScatteringSimulation& simulation) Scatter2DInstrumentItem* createScatter2DInstrumentItem(const ScatteringSimulation& simulation)
......
...@@ -66,11 +66,6 @@ public: ...@@ -66,11 +66,6 @@ public:
template <typename T> bool is() const { return dynamic_cast<const T*>(this) != nullptr; } template <typename T> bool is() const { return dynamic_cast<const T*>(this) != nullptr; }
template <typename T> T* setBackgroundItemType()
{
return backgroundSelection().createCertainItem<T>();
}
PolyItem<BackgroundItemCatalog>& backgroundSelection() { return m_background; } PolyItem<BackgroundItemCatalog>& backgroundSelection() { return m_background; }
BackgroundItem* backgroundItem() const { return m_background.certainItem(); } BackgroundItem* backgroundItem() const { return m_background.certainItem(); }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment