From 45f2dea7622f526ecec9dedab9280126446ae416 Mon Sep 17 00:00:00 2001
From: Gennady Pospelov <g.pospelov@fz-juelich.de>
Date: Fri, 23 Jan 2015 13:33:22 +0100
Subject: [PATCH] Azimuthal angle is added in real time view

---
 Core/Algorithms/src/Simulation.cpp                        | 6 ++++++
 GUI/coregui/Models/BeamItem.cpp                           | 4 ++--
 GUI/coregui/Models/ParameterModelBuilder.cpp              | 8 ++++++--
 .../Components/InstrumentWidgets/BeamEditorWidget.cpp     | 3 ++-
 .../Views/Components/OutputDataWidgets/centralplot.cpp    | 2 +-
 5 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/Core/Algorithms/src/Simulation.cpp b/Core/Algorithms/src/Simulation.cpp
index 3b91648109f..7239270e663 100644
--- a/Core/Algorithms/src/Simulation.cpp
+++ b/Core/Algorithms/src/Simulation.cpp
@@ -221,6 +221,12 @@ void Simulation::setInstrument(const Instrument& instrument)
 
 void Simulation::setBeamParameters(double lambda, double alpha_i, double phi_i)
 {
+    if (lambda<=0.0) {
+        throw ClassInitializationException(
+                "Simulation::setBeamParameters() "
+                "-> Error. Incoming wavelength <= 0.");
+    }
+
     m_instrument.setBeamParameters(lambda, alpha_i, phi_i);
 }
 
diff --git a/GUI/coregui/Models/BeamItem.cpp b/GUI/coregui/Models/BeamItem.cpp
index 3c15b925090..62b4c463db7 100644
--- a/GUI/coregui/Models/BeamItem.cpp
+++ b/GUI/coregui/Models/BeamItem.cpp
@@ -15,8 +15,8 @@ BeamItem::BeamItem(ParameterizedItem *parent)
 {
     setItemName(Constants::BeamType);
     registerProperty(P_INTENSITY, 1e+08);
-    registerProperty(P_WAVELENGTH, 0.1, PropertyAttribute(AttLimits::lowerLimited(1e-3), 3));
-    registerProperty(P_AZIMUTHAL_ANGLE, AngleProperty::Degrees(0.0));
+    registerProperty(P_WAVELENGTH, 0.1, PropertyAttribute(AttLimits::lowerLimited(1e-4), 4));
+    registerProperty(P_AZIMUTHAL_ANGLE, AngleProperty::Degrees(0.0), PropertyAttribute(AttLimits::limited(-90.0, 90.0), 3));
     registerProperty(P_INCLINATION_ANGLE, AngleProperty::Degrees(0.2));
 }
 
diff --git a/GUI/coregui/Models/ParameterModelBuilder.cpp b/GUI/coregui/Models/ParameterModelBuilder.cpp
index 0a48936dc1f..812dbe52912 100644
--- a/GUI/coregui/Models/ParameterModelBuilder.cpp
+++ b/GUI/coregui/Models/ParameterModelBuilder.cpp
@@ -145,8 +145,12 @@ QStandardItem *ParameterModelBuilder::iterateInstrumentModel(InstrumentModel *in
             insertRowIntoItem(standardItem, BeamItem::P_WAVELENGTH, beamItem->getRegisteredProperty(BeamItem::P_WAVELENGTH), beamItem);
 
             double v = beamItem->getRegisteredProperty(BeamItem::P_INCLINATION_ANGLE).value<AngleProperty>().getValue();
-            QVariant variant(v);
-            insertRowIntoItem(standardItem, BeamItem::P_INCLINATION_ANGLE, variant, beamItem);
+            QVariant variant_inclination(v);
+            insertRowIntoItem(standardItem, BeamItem::P_INCLINATION_ANGLE, variant_inclination, beamItem);
+
+            v = beamItem->getRegisteredProperty(BeamItem::P_AZIMUTHAL_ANGLE).value<AngleProperty>().getValue();
+            insertRowIntoItem(standardItem, BeamItem::P_AZIMUTHAL_ANGLE, QVariant(v), beamItem);
+
         }
     }
 
diff --git a/GUI/coregui/Views/Components/InstrumentWidgets/BeamEditorWidget.cpp b/GUI/coregui/Views/Components/InstrumentWidgets/BeamEditorWidget.cpp
index 5db00a9207b..1e17101288a 100644
--- a/GUI/coregui/Views/Components/InstrumentWidgets/BeamEditorWidget.cpp
+++ b/GUI/coregui/Views/Components/InstrumentWidgets/BeamEditorWidget.cpp
@@ -37,7 +37,8 @@ BeamEditorWidget::BeamEditorWidget(QWidget *parent)
     m_intensityText->setValidator(m_intensityValidator);
 
     m_wavelengthSpinBox->setSingleStep(0.1);
-    m_wavelengthSpinBox->setDecimals(3);
+    m_wavelengthSpinBox->setDecimals(4);
+    m_wavelengthSpinBox->setMinimum(0.0001);
     m_wavelengthSpinBox->setMaximum(100.);
 
     m_beamTypeCombo->addItem("Monochromatic");
diff --git a/GUI/coregui/Views/Components/OutputDataWidgets/centralplot.cpp b/GUI/coregui/Views/Components/OutputDataWidgets/centralplot.cpp
index 003cda5d1fa..7aa4447fd3b 100644
--- a/GUI/coregui/Views/Components/OutputDataWidgets/centralplot.cpp
+++ b/GUI/coregui/Views/Components/OutputDataWidgets/centralplot.cpp
@@ -239,7 +239,7 @@ void CentralPlot::drawPlot(OutputDataItem *outputDataItem, QCPColorGradient grad
     OutputData<double>::const_iterator it_max = std::max_element(data->begin(), data->end());
     OutputData<double>::const_iterator it_min = std::min_element(data->begin(), data->end());
 
-    std::cout << "CentralPlot::drawPlot min max" << (*it_min) << " "<< (*it_max) << std::endl;
+    qDebug() << "CentralPlot::drawPlot min max" << (*it_min) << " "<< (*it_max);
 
 
     this->setInteractions(QCP::iRangeDrag|QCP::iRangeZoom); // this will also allow rescaling the color scale by dragging/zooming
-- 
GitLab