From c26d777bb081e748005f64f9e98ce90f6376b69c Mon Sep 17 00:00:00 2001 From: Lottie Greenwood <lottie.greenwood@stfc.ac.uk> Date: Wed, 4 Jan 2017 09:23:21 +0000 Subject: [PATCH] Added option in mantid.properties for nonorthogonal default Re #12110 --- Framework/Properties/Mantid.properties.template | 3 +++ MantidQt/API/src/QwtScaleDrawNonOrthogonal.cpp | 4 ++-- .../SliceViewer/inc/MantidQtSliceViewer/SliceViewer.h | 2 ++ MantidQt/SliceViewer/src/SliceViewer.cpp | 10 ++++++++-- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Framework/Properties/Mantid.properties.template b/Framework/Properties/Mantid.properties.template index f8d66cc81e8..b48c5203a4b 100644 --- a/Framework/Properties/Mantid.properties.template +++ b/Framework/Properties/Mantid.properties.template @@ -128,6 +128,9 @@ curvefitting.defaultPeak=Gaussian curvefitting.findPeaksFWHM=7 curvefitting.findPeaksTolerance=4 +#Defines whether or not the sliceViewer will show NonOrthogonal view as a default +sliceviewer.nonorthogonal=false + # Network Timeouts (in seconds for various uses within Mantid) network.default.timeout = 30 network.scriptrepo.timeout = 5 diff --git a/MantidQt/API/src/QwtScaleDrawNonOrthogonal.cpp b/MantidQt/API/src/QwtScaleDrawNonOrthogonal.cpp index 97f608c88f3..2517f9323b4 100644 --- a/MantidQt/API/src/QwtScaleDrawNonOrthogonal.cpp +++ b/MantidQt/API/src/QwtScaleDrawNonOrthogonal.cpp @@ -208,7 +208,7 @@ void QwtScaleDrawNonOrthogonal::applyGridLinesX( // sense but we are taking the angle against the y axis in the mathematical // negative sense. angle *= -1.f; - auto offset = angle == 0. ? 0. : heightScreen * std::tan(angle); + auto offset = angle == 0. ? 0. : heightScreen * tan(angle); QPen gridPen(QColor(200, 100, 100, 100)); // grey gridPen.setWidth(3); @@ -230,7 +230,7 @@ void QwtScaleDrawNonOrthogonal::applyGridLinesY( int widthScreen = m_plot->canvas()->width(); auto angle = m_angleX; - auto offset = angle == 0. ? 0. : widthScreen * std::tan(angle); + auto offset = angle == 0. ? 0. : widthScreen * tan(angle); QPen gridPen(QColor(200, 100, 100, 100)); // grey gridPen.setWidth(3); gridPen.setCapStyle(Qt::FlatCap); diff --git a/MantidQt/SliceViewer/inc/MantidQtSliceViewer/SliceViewer.h b/MantidQt/SliceViewer/inc/MantidQtSliceViewer/SliceViewer.h index 46469efedc3..8960779167c 100644 --- a/MantidQt/SliceViewer/inc/MantidQtSliceViewer/SliceViewer.h +++ b/MantidQt/SliceViewer/inc/MantidQtSliceViewer/SliceViewer.h @@ -389,6 +389,8 @@ private: /// NonOrthogonal Fields std::unique_ptr<CoordinateTransform> m_coordinateTransform; bool m_firstNonOrthogonalWorkspaceOpen; + bool m_nonOrthogonalDefault; // sets whether nonOrthogonalview should be shown + // as a default // -------------------------- Controllers ------------------------ boost::shared_ptr<CompositePeaksPresenter> m_peaksPresenter; diff --git a/MantidQt/SliceViewer/src/SliceViewer.cpp b/MantidQt/SliceViewer/src/SliceViewer.cpp index 7bd5bd1146c..8bd58289fb9 100644 --- a/MantidQt/SliceViewer/src/SliceViewer.cpp +++ b/MantidQt/SliceViewer/src/SliceViewer.cpp @@ -85,13 +85,19 @@ SliceViewer::SliceViewer(QWidget *parent) m_data(nullptr), m_X(), m_Y(), m_dimX(0), m_dimY(1), m_logColor(false), m_fastRender(true), m_rebinMode(false), m_rebinLocked(true), m_mdSettings(new MantidQt::API::MdSettings()), m_logger("SliceViewer"), - m_firstNonOrthogonalWorkspaceOpen(true), + m_firstNonOrthogonalWorkspaceOpen(true), m_nonOrthogonalDefault(false), m_peaksPresenter(boost::make_shared<CompositePeaksPresenter>(this)), m_proxyPeaksPresenter( boost::make_shared<ProxyCompositePeaksPresenter>(m_peaksPresenter)), m_peaksSliderWidget(NULL) { ui.setupUi(this); + std::string enableNonOrthogonal; + Kernel::ConfigService::Instance().getValue("sliceviewer.nonorthogonal", + enableNonOrthogonal); + if (enableNonOrthogonal == "true") { + m_nonOrthogonalDefault = true; + } m_inf = std::numeric_limits<double>::infinity(); @@ -703,7 +709,7 @@ void SliceViewer::switchQWTRaster(bool useNonOrthogonal) { m_data->setWorkspace(m_ws); this->setTransparentZeros(false); - if (m_firstNonOrthogonalWorkspaceOpen) { + if (m_firstNonOrthogonalWorkspaceOpen && m_nonOrthogonalDefault) { m_firstNonOrthogonalWorkspaceOpen = false; ui.btnNonOrthogonalToggle->toggle(); } -- GitLab