From 4c5c79643950d921ef32fa03b25f2a171e3825f0 Mon Sep 17 00:00:00 2001
From: Gennady Pospelov <g.pospelov@fz-juelich.de>
Date: Thu, 11 Jan 2018 10:37:43 +0100
Subject: [PATCH] OffSpecInstrumentItem added.

---
 GUI/coregui/Models/InstrumentItems.cpp | 10 ++++++++--
 GUI/coregui/Models/InstrumentItems.h   |  8 +++++++-
 GUI/coregui/Models/ItemFactory.cpp     |  1 +
 GUI/coregui/Models/item_constants.h    |  1 +
 4 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/GUI/coregui/Models/InstrumentItems.cpp b/GUI/coregui/Models/InstrumentItems.cpp
index 3bc1330ad41..56987c371b0 100644
--- a/GUI/coregui/Models/InstrumentItems.cpp
+++ b/GUI/coregui/Models/InstrumentItems.cpp
@@ -36,8 +36,8 @@ const QString GISASInstrumentItem::P_BEAM = "Beam";
 const QString GISASInstrumentItem::P_DETECTOR = "Detector";
 const QString GISASInstrumentItem::P_BACKGROUND = "Background";
 
-GISASInstrumentItem::GISASInstrumentItem()
-    : InstrumentItem(Constants::GISASInstrumentType)
+GISASInstrumentItem::GISASInstrumentItem(const QString& modelType)
+    : InstrumentItem(modelType)
 {
     addGroupProperty(P_BEAM, Constants::BeamType);
 
@@ -105,3 +105,9 @@ QStringList GISASInstrumentItem::translateList(const QStringList& list) const
     }
     return result;
 }
+
+OffSpecInstrumentItem::OffSpecInstrumentItem()
+    : GISASInstrumentItem(Constants::OffSpecInstrumentType)
+{
+
+}
diff --git a/GUI/coregui/Models/InstrumentItems.h b/GUI/coregui/Models/InstrumentItems.h
index 6bbe8eff0d9..ec3943d2324 100644
--- a/GUI/coregui/Models/InstrumentItems.h
+++ b/GUI/coregui/Models/InstrumentItems.h
@@ -37,7 +37,7 @@ public:
     static const QString P_BEAM;
     static const QString P_DETECTOR;
     static const QString P_BACKGROUND;
-    GISASInstrumentItem();
+    explicit GISASInstrumentItem(const QString& modelType = Constants::GISASInstrumentType);
 
     BeamItem* beamItem() const;
     DetectorItem* detectorItem() const;
@@ -54,4 +54,10 @@ public:
     QStringList translateList(const QStringList& list) const override;
 };
 
+class BA_CORE_API_ OffSpecInstrumentItem : public GISASInstrumentItem
+{
+public:
+    OffSpecInstrumentItem();
+};
+
 #endif // INSTRUMENTITEMS_H
diff --git a/GUI/coregui/Models/ItemFactory.cpp b/GUI/coregui/Models/ItemFactory.cpp
index b0d7739a95b..ea20c546deb 100644
--- a/GUI/coregui/Models/ItemFactory.cpp
+++ b/GUI/coregui/Models/ItemFactory.cpp
@@ -78,6 +78,7 @@ ItemFactory::ItemMap_t initializeItemMap() {
     result[Constants::InterferenceFunction2DLatticeType] = &createInstance<InterferenceFunction2DLatticeItem>;
     result[Constants::InterferenceFunction1DLatticeType] = &createInstance<InterferenceFunction1DLatticeItem>;
     result[Constants::GISASInstrumentType] = &createInstance<GISASInstrumentItem>;
+    result[Constants::OffSpecInstrumentType] = &createInstance<OffSpecInstrumentItem>;
     result[Constants::BeamType] = &createInstance<BeamItem>;
     result[Constants::BackgroundNoneType] = &createInstance<BackgroundNoneItem>;
     result[Constants::ConstantBackgroundType] = &createInstance<ConstantBackgroundItem>;
diff --git a/GUI/coregui/Models/item_constants.h b/GUI/coregui/Models/item_constants.h
index da391c90900..d0d3ff0d94a 100644
--- a/GUI/coregui/Models/item_constants.h
+++ b/GUI/coregui/Models/item_constants.h
@@ -40,6 +40,7 @@ const ModelType InterferenceFunction2DParaCrystalType = "Interference2DParaCryst
 const ModelType InterferenceFunction1DLatticeType = "Interference1DLattice";
 const ModelType InterferenceFunction2DLatticeType = "Interference2DLattice";
 const ModelType GISASInstrumentType = "GISASInstrument";
+const ModelType OffSpecInstrumentType = "OffSpecInstrument";
 const ModelType BeamType = "Beam";
 
 const ModelType FormFactorType = "FormFactor";
-- 
GitLab