From 0a452a50af918849a6592cd67895bd7d287334a8 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Mon, 10 Jul 2023 18:26:30 +0200
Subject: [PATCH] inline fcts itemXrange etc

---
 GUI/View/PlotUtil/ColorMap.cpp  | 12 ++++++++++--
 GUI/View/PlotUtil/RangeUtil.cpp | 23 -----------------------
 GUI/View/PlotUtil/RangeUtil.h   |  6 ------
 3 files changed, 10 insertions(+), 31 deletions(-)

diff --git a/GUI/View/PlotUtil/ColorMap.cpp b/GUI/View/PlotUtil/ColorMap.cpp
index 8c301db291c..6b6ed4895ea 100644
--- a/GUI/View/PlotUtil/ColorMap.cpp
+++ b/GUI/View/PlotUtil/ColorMap.cpp
@@ -31,6 +31,14 @@ const int replot_update_interval = 10;
 const int colorbar_width_logz = 50;
 const int colorbar_width = 80;
 
+// Converts xmin (low edge of first bin) and xmax (upper edge of last bin) to the
+// range expected by QCPColorMapData::setRange.
+QCPRange qcpRange(double xmin, double xmax, int nbins)
+{
+    double dx = (xmax - xmin) / nbins;
+    return QCPRange(xmin + dx / 2., xmax - dx / 2.);
+}
+
 } // namespace
 
 ColorMap::ColorMap(QWidget* parent)
@@ -328,8 +336,8 @@ void ColorMap::setAxesRangeFromItem()
     m_customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);
     m_customPlot->axisRect()->setupFullAxesBox(true);
     m_colorMap->data()->setSize(ii->xSize(), ii->ySize());
-    m_colorMap->data()->setRange(GUI::View::RangeUtil::itemXrange(ii),
-                                 GUI::View::RangeUtil::itemYrange(ii));
+    m_colorMap->data()->setRange(qcpRange(ii->xMin(), ii->xMax(), ii->xSize()),
+                                 qcpRange(ii->yMin(), ii->yMax(), ii->ySize()));
     replot();
 }
 
diff --git a/GUI/View/PlotUtil/RangeUtil.cpp b/GUI/View/PlotUtil/RangeUtil.cpp
index 14bfcc306cd..9c96e56027d 100644
--- a/GUI/View/PlotUtil/RangeUtil.cpp
+++ b/GUI/View/PlotUtil/RangeUtil.cpp
@@ -19,34 +19,11 @@
 #include "GUI/Support/Util/StyleUtil.h"
 #include <qcustomplot.h>
 
-namespace {
-
-// Converts xmin (low edge of first bin) and xmax (upper edge of last bin) to the
-// range expected by QCPColorMapData::setRange.
-QCPRange qcpRange(double xmin, double xmax, int nbins)
-{
-    double dx = (xmax - xmin) / nbins;
-    return QCPRange(xmin + dx / 2., xmax - dx / 2.);
-}
-
-} // namespace
-
-
-QCPRange GUI::View::RangeUtil::itemXrange(const IntensityDataItem* item)
-{
-    return qcpRange(item->xMin(), item->xMax(), item->xSize());
-}
-
 QCPRange GUI::View::RangeUtil::itemZoomX(const IntensityDataItem* item)
 {
     return QCPRange(item->lowerX(), item->upperX());
 }
 
-QCPRange GUI::View::RangeUtil::itemYrange(const IntensityDataItem* item)
-{
-    return qcpRange(item->yMin(), item->yMax(), item->ySize());
-}
-
 QCPRange GUI::View::RangeUtil::itemZoomY(const IntensityDataItem* item)
 {
     return QCPRange(item->lowerY(), item->upperY());
diff --git a/GUI/View/PlotUtil/RangeUtil.h b/GUI/View/PlotUtil/RangeUtil.h
index 8a176a32396..b2f765aa585 100644
--- a/GUI/View/PlotUtil/RangeUtil.h
+++ b/GUI/View/PlotUtil/RangeUtil.h
@@ -26,15 +26,9 @@ class QCPRange;
 
 namespace GUI::View::RangeUtil {
 
-//! Returns x-axis range.
-QCPRange itemXrange(const IntensityDataItem* item);
-
 //! Returns x-axis vizible range (zoom).
 QCPRange itemZoomX(const IntensityDataItem* item);
 
-//! Returns y-axis range.
-QCPRange itemYrange(const IntensityDataItem* item);
-
 //! Returns y-axis vizible range (zoom).
 QCPRange itemZoomY(const IntensityDataItem* item);
 
-- 
GitLab