diff --git a/GUI/coregui/Models/JobItem.cpp b/GUI/coregui/Models/JobItem.cpp index 80b8dc48c7fbde22b6a7957361eda4c9607a0f75..02341365b0025bd077dce18533a37678571311b6 100644 --- a/GUI/coregui/Models/JobItem.cpp +++ b/GUI/coregui/Models/JobItem.cpp @@ -214,9 +214,9 @@ MultiLayerItem* JobItem::multiLayerItem() return dynamic_cast<MultiLayerItem*>(getItem(T_SAMPLE)); } -GISASInstrumentItem* JobItem::instrumentItem() +InstrumentItem* JobItem::instrumentItem() { - return dynamic_cast<GISASInstrumentItem*>(getItem(T_INSTRUMENT)); + return dynamic_cast<InstrumentItem*>(getItem(T_INSTRUMENT)); } void JobItem::setResults(const Simulation* simulation) diff --git a/GUI/coregui/Models/JobItem.h b/GUI/coregui/Models/JobItem.h index 3af4db532afe94c4eb21dadd3acbe6522fcf606a..927f40f0e5749b90e067f8ba405f0e3c185bcfe0 100644 --- a/GUI/coregui/Models/JobItem.h +++ b/GUI/coregui/Models/JobItem.h @@ -16,10 +16,11 @@ #define JOBITEM_H #include "SessionItem.h" + class IntensityDataItem; class Simulation; class MultiLayerItem; -class GISASInstrumentItem; +class InstrumentItem; class SimulationOptionsItem; class FitSuiteItem; class ParameterContainerItem; @@ -83,7 +84,7 @@ public: MultiLayerItem* multiLayerItem(); - GISASInstrumentItem* instrumentItem(); + InstrumentItem* instrumentItem(); SimulationOptionsItem* simulationOptionsItem(); diff --git a/GUI/coregui/Models/JobItemUtils.cpp b/GUI/coregui/Models/JobItemUtils.cpp index d0832f7e0c82bc5b0a46b56a50f109217d94709a..ce7347374508434e4a8ad48f2d6f044751968cdb 100644 --- a/GUI/coregui/Models/JobItemUtils.cpp +++ b/GUI/coregui/Models/JobItemUtils.cpp @@ -71,7 +71,7 @@ void JobItemUtils::setResults(IntensityDataItem* intensityItem, const Simulation //! InstrumentItem is used to get domain's detector map for given units. void JobItemUtils::updateDataAxes(IntensityDataItem* intensityItem, - const GISASInstrumentItem* instrumentItem) + const InstrumentItem* instrumentItem) { Q_ASSERT(intensityItem); @@ -152,7 +152,7 @@ AxesUnits JobItemUtils::preferableGUIAxesUnits(AxesUnits default_units) //! Sets axes units suitable for given instrument. void JobItemUtils::setIntensityItemAxesUnits(IntensityDataItem* intensityItem, - const GISASInstrumentItem* instrumentItem) + const InstrumentItem* instrumentItem) { auto instrument = DomainObjectBuilder::buildInstrument(*instrumentItem); instrument->initDetector(); @@ -166,7 +166,7 @@ void JobItemUtils::setIntensityItemAxesUnits(IntensityDataItem* intensityItem, { ComboProperty combo; - foreach (auto units, detector->validAxesUnits()) + for (auto units : detector->validAxesUnits()) combo << nameFromAxesUnits(units); AxesUnits preferrable_units @@ -212,7 +212,7 @@ void JobItemUtils::createDefaultDetectorMap(IntensityDataItem* intensityItem, } //! creates detector map from instrument description with axes corresponding to given units -OutputData<double>* JobItemUtils::createDetectorMap(const GISASInstrumentItem* instrumentItem, +OutputData<double>* JobItemUtils::createDetectorMap(const InstrumentItem* instrumentItem, AxesUnits units) { auto instrument = DomainObjectBuilder::buildInstrument(*instrumentItem); diff --git a/GUI/coregui/Models/JobItemUtils.h b/GUI/coregui/Models/JobItemUtils.h index ef1d7c267ce8649efcb07b3c3ef4597451fcff7e..47964e28cddf0c7f4820670f4f2ade70c15b40bb 100644 --- a/GUI/coregui/Models/JobItemUtils.h +++ b/GUI/coregui/Models/JobItemUtils.h @@ -21,7 +21,6 @@ class Simulation; class IntensityDataItem; class InstrumentItem; -class GISASInstrumentItem; class JobItem; //! Contains set of convenience methods to set data to the IntensityDataItem from domain simulation. @@ -35,7 +34,7 @@ BA_CORE_API_ void setResults(IntensityDataItem* intensityItem, const Simulation* //! updates axes of OutputData in IntensityData item BA_CORE_API_ void updateDataAxes(IntensityDataItem* intensityItem, - const GISASInstrumentItem* instrumentItem); + const InstrumentItem* instrumentItem); //! loads intensity data from project directory BA_CORE_API_ void loadIntensityData(IntensityDataItem* intensityItem, const QString& projectDir); @@ -53,7 +52,7 @@ BA_CORE_API_ AxesUnits axesUnitsFromName(const QString& name); BA_CORE_API_ AxesUnits preferableGUIAxesUnits(AxesUnits default_units); BA_CORE_API_ void setIntensityItemAxesUnits(IntensityDataItem* intensityItem, - const GISASInstrumentItem* instrumentItem); + const InstrumentItem* instrumentItem); BA_CORE_API_ void setIntensityItemAxesUnits(IntensityDataItem* intensityItem, const IDetector* detector); @@ -63,7 +62,7 @@ BA_CORE_API_ void updateAxesTitle(IntensityDataItem* intensityItem); BA_CORE_API_ void createDefaultDetectorMap(IntensityDataItem* intensityItem, const InstrumentItem* instrumentItem); -BA_CORE_API_ OutputData<double>* createDetectorMap(const GISASInstrumentItem* instrumentItem, +BA_CORE_API_ OutputData<double>* createDetectorMap(const InstrumentItem* instrumentItem, AxesUnits units); } diff --git a/GUI/coregui/Models/JobModelFunctions.cpp b/GUI/coregui/Models/JobModelFunctions.cpp index bdf54a109eb05979445e0a4def6c81ac589f3dc5..c3371c79245c56b3921237dd3b4c2e429c8fb7c1 100644 --- a/GUI/coregui/Models/JobModelFunctions.cpp +++ b/GUI/coregui/Models/JobModelFunctions.cpp @@ -96,7 +96,12 @@ void JobModelFunctions::processInstrumentLink(JobItem *jobItem) void JobModelFunctions::copyMasksToInstrument(JobItem *jobItem) { IntensityDataItem *intensityItem = jobItem->realDataItem()->intensityDataItem(); - jobItem->instrumentItem()->importMasks(intensityItem->maskContainerItem()); + if (auto instrument2DItem = dynamic_cast<Instrument2DItem*>(jobItem->instrumentItem())) { + instrument2DItem->importMasks(intensityItem->maskContainerItem()); + } else { + throw GUIHelpers::Error("JobModelFunctions::copyMasksToInstrument() -> Error. Not " + "implemented instrument type."); + } } //! Crops RealDataItem to the region of interest.