Skip to content
Snippets Groups Projects
Commit 54d77cc4 authored by Yurov, Dmitry's avatar Yurov, Dmitry
Browse files

Replaced DetectorItem::getSize with getXSize and getYSize

Redmine: #2051
parent 625209bf
No related branches found
No related tags found
No related merge requests found
......@@ -34,7 +34,8 @@ public:
std::unique_ptr<IDetector2D> createDetector() const;
virtual void setSize(int nx, int ny) = 0;
virtual void setXSize(int nx) = 0;
virtual void setYSize(int ny) = 0;
void clearMasks();
......
......@@ -134,9 +134,13 @@ void RectangularDetectorItem::setDetectorAlignment(const QString& alignment)
setItemValue(RectangularDetectorItem::P_ALIGNMENT, combo_property.variant());
}
void RectangularDetectorItem::setSize(int nx, int ny)
void RectangularDetectorItem::setXSize(int nx)
{
getItem(RectangularDetectorItem::P_X_AXIS)->setItemValue(BasicAxisItem::P_NBINS, nx);
}
void RectangularDetectorItem::setYSize(int ny)
{
getItem(RectangularDetectorItem::P_Y_AXIS)->setItemValue(BasicAxisItem::P_NBINS, ny);
}
......
......@@ -35,7 +35,8 @@ public:
RectangularDetectorItem();
void setDetectorAlignment(const QString& alignment);
void setSize(int nx, int ny) override;
void setXSize(int nx) override;
void setYSize(int ny) override;
private:
std::unique_ptr<IDetector2D> createDomainDetector() const override;
......
......@@ -65,9 +65,13 @@ std::unique_ptr<IDetector2D> SphericalDetectorItem::createDomainDetector() const
return std::move(result);
}
void SphericalDetectorItem::setSize(int nx, int ny)
void SphericalDetectorItem::setXSize(int nx)
{
getItem(SphericalDetectorItem::P_PHI_AXIS)->setItemValue(BasicAxisItem::P_NBINS, nx);
}
void SphericalDetectorItem::setYSize(int ny)
{
getItem(SphericalDetectorItem::P_ALPHA_AXIS)->setItemValue(BasicAxisItem::P_NBINS, ny);
}
......
......@@ -24,7 +24,8 @@ public:
static const QString P_ALPHA_AXIS;
SphericalDetectorItem();
void setSize(int nx, int ny) override;
void setXSize(int nx) override;
void setYSize(int ny) override;
protected:
std::unique_ptr<IDetector2D> createDomainDetector() const override;
......
......@@ -143,9 +143,11 @@ void ImportDataUtils::SetInstrumentShapeToData(InstrumentItem& instrumentItem,
{
auto dataShape = RealDataShape(realDataItemItem);
if(auto offspecInstrument = dynamic_cast<OffSpecInstrumentItem*>(&instrumentItem)) {
offspecInstrument->detectorItem()->setSize(dataShape.first, dataShape.second);
offspecInstrument->detectorItem()->setXSize(dataShape.first);
offspecInstrument->detectorItem()->setYSize(dataShape.second);
} else if (auto gisasInstrument = dynamic_cast<GISASInstrumentItem*>(&instrumentItem)) {
gisasInstrument->detectorItem()->setSize(dataShape.first, dataShape.second);
gisasInstrument->detectorItem()->setXSize(dataShape.first);
gisasInstrument->detectorItem()->setYSize(dataShape.second);
} else {
throw GUIHelpers::Error("ImportDataUtils::SetInstrumentShapeToData() -> Error."
"Not supported instrument type");
......
......@@ -130,7 +130,8 @@ void GUIPerformanceTest::test_real_time()
*sample);
if (auto instrument2DItem = dynamic_cast<Instrument2DItem*>(m_models->instrumentModel()->instrumentItem())) {
instrument2DItem->detectorItem()->setSize(50, 50);
instrument2DItem->detectorItem()->setXSize(50);
instrument2DItem->detectorItem()->setYSize(50);
} else {
throw GUIHelpers::Error("GUISaveLoadProject::run_job() -> Error. ApplicationModels is "
"in unexpected state");
......
......@@ -90,7 +90,8 @@ int GUISaveLoadProject::run_job()
*sample);
if (auto instrument2DItem = dynamic_cast<Instrument2DItem*>(m_models->instrumentModel()->instrumentItem())) {
instrument2DItem->detectorItem()->setSize(50, 50);
instrument2DItem->detectorItem()->setXSize(50);
instrument2DItem->detectorItem()->setYSize(50);
} else {
throw GUIHelpers::Error("GUISaveLoadProject::run_job() -> Error. ApplicationModels is "
"in unexpected state");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment