From 2baf67a88aaa3feeb43d946b8f8f6e1241a0d165 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Wed, 9 Aug 2023 11:42:31 +0200
Subject: [PATCH] rm NominalNormal::GENERIC

---
 Device/Detector/RectangularDetector.cpp  |  1 -
 Device/Detector/RectangularDetector.h    |  2 +-
 GUI/Model/FromCore/ItemizeSimulation.cpp | 13 +------------
 GUI/Model/Model/ParameterTreeUtil.cpp    | 13 +++----------
 auto/Wrap/libBornAgainDevice.py          | 10 ++++------
 auto/Wrap/libBornAgainDevice_wrap.cpp    | 13 ++++++-------
 6 files changed, 15 insertions(+), 37 deletions(-)

diff --git a/Device/Detector/RectangularDetector.cpp b/Device/Detector/RectangularDetector.cpp
index 5c8e7270b2e..a3fe6c539ba 100644
--- a/Device/Detector/RectangularDetector.cpp
+++ b/Device/Detector/RectangularDetector.cpp
@@ -30,7 +30,6 @@ RectangularDetector::RectangularDetector(const Frame& frame)
     , m_v0(0.0)
     , m_direction(R3(0.0, -1.0, 0.0))
     , m_distance(0.0)
-    , m_detector_arrangement(GENERIC)
 {
 }
 
diff --git a/Device/Detector/RectangularDetector.h b/Device/Detector/RectangularDetector.h
index fad7c1a8291..5e855097106 100644
--- a/Device/Detector/RectangularDetector.h
+++ b/Device/Detector/RectangularDetector.h
@@ -25,7 +25,7 @@ class RectangularPixel;
 class RectangularDetector : public IDetector {
 public:
     //! Nominal detector normal along x-axis (X), direct beam (T), or reflected beam (R).
-    enum NominalNormal { GENERIC, X, T, R };
+    enum NominalNormal { X, T, R };
 
     //! Rectangular detector constructor
     //! @param nxbins Number of bins (pixels) in x-direction
diff --git a/GUI/Model/FromCore/ItemizeSimulation.cpp b/GUI/Model/FromCore/ItemizeSimulation.cpp
index 247861b582d..87d75561377 100644
--- a/GUI/Model/FromCore/ItemizeSimulation.cpp
+++ b/GUI/Model/FromCore/ItemizeSimulation.cpp
@@ -252,18 +252,7 @@ void setRectangularDetector(RectangularDetectorItem* detectorItem,
     detectorItem->setHeight(detector.height());
 
     detectorItem->setDetectorAlignment(detector.getDetectorArrangment());
-    if (detector.getDetectorArrangment() == RectangularDetector::GENERIC) {
-        R3 normal = detector.getNormalVector();
-        detectorItem->setNormalVector(normal);
-
-        R3 direction = detector.getDirectionVector();
-        detectorItem->setDirectionVector(direction);
-
-        detectorItem->setU0(detector.getU0());
-        detectorItem->setV0(detector.getV0());
-    }
-
-    else if (detector.getDetectorArrangment() == RectangularDetector::X) {
+    if (detector.getDetectorArrangment() == RectangularDetector::X) {
         detectorItem->setDistance(detector.getDistance());
         detectorItem->setU0(detector.getU0());
         detectorItem->setV0(detector.getV0());
diff --git a/GUI/Model/Model/ParameterTreeUtil.cpp b/GUI/Model/Model/ParameterTreeUtil.cpp
index aa398c927da..f5ec2c89137 100644
--- a/GUI/Model/Model/ParameterTreeUtil.cpp
+++ b/GUI/Model/Model/ParameterTreeUtil.cpp
@@ -392,16 +392,9 @@ void ParameterTreeBuilder::addDetector(ParameterLabelItem* parentLabel, Detector
         addParameterItem(label, rectDetector->width());
         addParameterItem(label, rectDetector->height());
         addResolutionFunction(label);
-        if (rectDetector->detectorAlignment() == RectangularDetector::GENERIC) {
-            addParameterItem(label, rectDetector->normalVector());
-            addParameterItem(label, rectDetector->directionVector());
-            addParameterItem(label, rectDetector->u0());
-            addParameterItem(label, rectDetector->v0());
-        } else {
-            addParameterItem(label, rectDetector->u0());
-            addParameterItem(label, rectDetector->v0());
-            addParameterItem(label, rectDetector->distance());
-        }
+        addParameterItem(label, rectDetector->u0());
+        addParameterItem(label, rectDetector->v0());
+        addParameterItem(label, rectDetector->distance());
     } else if (auto* spherDetector = dynamic_cast<SphericalDetectorItem*>(detector)) {
         auto* label = new ParameterLabelItem("Detector (spherical)", parentLabel);
         auto* phiLabel = new ParameterLabelItem("Phi axis", label);
diff --git a/auto/Wrap/libBornAgainDevice.py b/auto/Wrap/libBornAgainDevice.py
index 00a819da059..cec949b9ca1 100644
--- a/auto/Wrap/libBornAgainDevice.py
+++ b/auto/Wrap/libBornAgainDevice.py
@@ -2774,13 +2774,11 @@ class RectangularDetector(IDetector):
 
     thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
     __repr__ = _swig_repr
-    GENERIC = _libBornAgainDevice.RectangularDetector_GENERIC
+    X = _libBornAgainDevice.RectangularDetector_X
     
-    PERPENDICULAR_TO_SAMPLE = _libBornAgainDevice.RectangularDetector_PERPENDICULAR_TO_SAMPLE
+    T = _libBornAgainDevice.RectangularDetector_T
     
-    PERPENDICULAR_TO_DIRECT_BEAM = _libBornAgainDevice.RectangularDetector_PERPENDICULAR_TO_DIRECT_BEAM
-    
-    PERPENDICULAR_TO_REFLECTED_BEAM = _libBornAgainDevice.RectangularDetector_PERPENDICULAR_TO_REFLECTED_BEAM
+    R = _libBornAgainDevice.RectangularDetector_R
     
 
     def __init__(self, *args):
@@ -2852,7 +2850,7 @@ class RectangularDetector(IDetector):
         return _libBornAgainDevice.RectangularDetector_getDistance(self)
 
     def getDetectorArrangment(self):
-        r"""getDetectorArrangment(RectangularDetector self) -> RectangularDetector::DetectorPlacement"""
+        r"""getDetectorArrangment(RectangularDetector self) -> RectangularDetector::NominalNormal"""
         return _libBornAgainDevice.RectangularDetector_getDetectorArrangment(self)
 
     def regionOfInterestPixel(self):
diff --git a/auto/Wrap/libBornAgainDevice_wrap.cpp b/auto/Wrap/libBornAgainDevice_wrap.cpp
index e47d9a95d71..d7feb28c8a0 100644
--- a/auto/Wrap/libBornAgainDevice_wrap.cpp
+++ b/auto/Wrap/libBornAgainDevice_wrap.cpp
@@ -35169,7 +35169,7 @@ SWIGINTERN PyObject *_wrap_RectangularDetector_getDetectorArrangment(PyObject *s
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject *swig_obj[1] ;
-  RectangularDetector::DetectorPlacement result;
+  RectangularDetector::NominalNormal result;
   
   if (!args) SWIG_fail;
   swig_obj[0] = args;
@@ -35178,7 +35178,7 @@ SWIGINTERN PyObject *_wrap_RectangularDetector_getDetectorArrangment(PyObject *s
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "RectangularDetector_getDetectorArrangment" "', argument " "1"" of type '" "RectangularDetector const *""'"); 
   }
   arg1 = reinterpret_cast< RectangularDetector * >(argp1);
-  result = (RectangularDetector::DetectorPlacement)((RectangularDetector const *)arg1)->getDetectorArrangment();
+  result = (RectangularDetector::NominalNormal)((RectangularDetector const *)arg1)->getDetectorArrangment();
   resultobj = SWIG_From_int(static_cast< int >(result));
   return resultobj;
 fail:
@@ -37767,7 +37767,7 @@ static PyMethodDef SwigMethods[] = {
 	 { "RectangularDetector_getV0", _wrap_RectangularDetector_getV0, METH_O, "RectangularDetector_getV0(RectangularDetector self) -> double"},
 	 { "RectangularDetector_getDirectionVector", _wrap_RectangularDetector_getDirectionVector, METH_O, "RectangularDetector_getDirectionVector(RectangularDetector self) -> R3"},
 	 { "RectangularDetector_getDistance", _wrap_RectangularDetector_getDistance, METH_O, "RectangularDetector_getDistance(RectangularDetector self) -> double"},
-	 { "RectangularDetector_getDetectorArrangment", _wrap_RectangularDetector_getDetectorArrangment, METH_O, "RectangularDetector_getDetectorArrangment(RectangularDetector self) -> RectangularDetector::DetectorPlacement"},
+	 { "RectangularDetector_getDetectorArrangment", _wrap_RectangularDetector_getDetectorArrangment, METH_O, "RectangularDetector_getDetectorArrangment(RectangularDetector self) -> RectangularDetector::NominalNormal"},
 	 { "RectangularDetector_regionOfInterestPixel", _wrap_RectangularDetector_regionOfInterestPixel, METH_O, "RectangularDetector_regionOfInterestPixel(RectangularDetector self) -> RectangularPixel const *"},
 	 { "RectangularDetector_swigregister", RectangularDetector_swigregister, METH_O, NULL},
 	 { "RectangularDetector_swiginit", RectangularDetector_swiginit, METH_VARARGS, NULL},
@@ -38769,10 +38769,9 @@ SWIG_init(void) {
   // thread safe initialization
   swig::container_owner_attribute();
   
-  SWIG_Python_SetConstant(d, "RectangularDetector_GENERIC",SWIG_From_int(static_cast< int >(RectangularDetector::GENERIC)));
-  SWIG_Python_SetConstant(d, "RectangularDetector_PERPENDICULAR_TO_SAMPLE",SWIG_From_int(static_cast< int >(RectangularDetector::PERPENDICULAR_TO_SAMPLE)));
-  SWIG_Python_SetConstant(d, "RectangularDetector_PERPENDICULAR_TO_DIRECT_BEAM",SWIG_From_int(static_cast< int >(RectangularDetector::PERPENDICULAR_TO_DIRECT_BEAM)));
-  SWIG_Python_SetConstant(d, "RectangularDetector_PERPENDICULAR_TO_REFLECTED_BEAM",SWIG_From_int(static_cast< int >(RectangularDetector::PERPENDICULAR_TO_REFLECTED_BEAM)));
+  SWIG_Python_SetConstant(d, "RectangularDetector_X",SWIG_From_int(static_cast< int >(RectangularDetector::X)));
+  SWIG_Python_SetConstant(d, "RectangularDetector_T",SWIG_From_int(static_cast< int >(RectangularDetector::T)));
+  SWIG_Python_SetConstant(d, "RectangularDetector_R",SWIG_From_int(static_cast< int >(RectangularDetector::R)));
   SWIG_Python_SetConstant(d, "unknown1D",SWIG_From_int(static_cast< int >(IO::unknown1D)));
   SWIG_Python_SetConstant(d, "csv1D",SWIG_From_int(static_cast< int >(IO::csv1D)));
   SWIG_Python_SetConstant(d, "csv1D_2cols",SWIG_From_int(static_cast< int >(IO::csv1D_2cols)));
-- 
GitLab