Skip to content
Snippets Groups Projects
Commit a4845463 authored by t.knopff's avatar t.knopff
Browse files

Make DetectorItem::P_RESOLUTION_FUNCTION private

parent 5dc9c3f9
No related branches found
No related tags found
1 merge request!96Refactor model: detector items
......@@ -93,6 +93,16 @@ void DetectorItem::importMasks(const MaskContainerItem* maskContainer)
model()->copyItem(maskContainer, this, T_MASKS);
}
SessionItem* DetectorItem::setResolutionFunctionType(const QString& model_type)
{
return setGroupProperty(P_RESOLUTION_FUNCTION, model_type);
}
SessionItem* DetectorItem::resolutionFunctionItem() const
{
return getItem(P_RESOLUTION_FUNCTION);
}
void DetectorItem::register_resolution_function()
{
auto item = addGroupProperty(P_RESOLUTION_FUNCTION, "Resolution function group");
......
......@@ -25,9 +25,9 @@ class DetectorItem;
class BA_CORE_API_ DetectorItem : public SessionItem {
private:
static const QString T_MASKS;
static const QString P_RESOLUTION_FUNCTION;
public:
static const QString P_RESOLUTION_FUNCTION;
static const QString P_ANALYZER_DIRECTION;
static const QString P_ANALYZER_EFFICIENCY;
static const QString P_ANALYZER_TOTAL_TRANSMISSION;
......@@ -57,6 +57,9 @@ public:
void importMasks(const MaskContainerItem* maskContainer);
SessionItem* setResolutionFunctionType(const QString& model_type);
SessionItem* resolutionFunctionItem() const;
protected:
void register_resolution_function();
void update_resolution_function_tooltips();
......
......@@ -322,8 +322,8 @@ void TransformFromDomain::setDetectorResolution(DetectorItem* detector_item,
if (auto p_convfunc = dynamic_cast<const ConvolutionDetectorResolution*>(p_resfunc)) {
if (auto resfunc = dynamic_cast<const ResolutionFunction2DGaussian*>(
p_convfunc->getResolutionFunction2D())) {
SessionItem* item = detector_item->setGroupProperty(DetectorItem::P_RESOLUTION_FUNCTION,
"ResolutionFunction2DGaussian");
SessionItem* item = detector_item->setResolutionFunctionType
("ResolutionFunction2DGaussian");
double scale(1.0);
if (detector_item->modelType() == "SphericalDetector")
scale = 1. / Units::deg;
......
......@@ -108,7 +108,7 @@ void RectangularDetectorEditor::init_editors()
m_yAxisEditor->setItem(detectorItem()->yAxisItem());
m_resolutionFunctionEditor->clearEditor();
auto resFuncGroup = detectorItem()->getItem(RectangularDetectorItem::P_RESOLUTION_FUNCTION);
auto resFuncGroup = detectorItem()->resolutionFunctionItem();
m_resolutionFunctionEditor->setItem(resFuncGroup);
m_alignmentEditor->clearEditor();
......
......@@ -52,7 +52,7 @@ void SphericalDetectorEditor::subscribeToItem()
auto alphaAxisItem = detectorItem()->alphaAxisItem();
m_alphaAxisEditor->setItem(alphaAxisItem);
auto resFuncGroup = detectorItem()->getItem(SphericalDetectorItem::P_RESOLUTION_FUNCTION);
auto resFuncGroup = detectorItem()->resolutionFunctionItem();
m_resolutionFunctionEditor->setItem(resFuncGroup);
}
......
......@@ -38,8 +38,7 @@ TEST_F(TestDetectorItems, test_resolutionFunction)
DetectorItem* detectorItem = instrument->detectorItem();
detectorItem->setGroupProperty(DetectorItem::P_RESOLUTION_FUNCTION,
"ResolutionFunction2DGaussian");
detectorItem->setResolutionFunctionType("ResolutionFunction2DGaussian");
auto detector = detectorItem->createDetector();
auto convol =
......
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