From 203d4a2abdda0a52ae04c173a7515025caf8668c Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Fri, 10 Nov 2023 17:33:47 +0100
Subject: [PATCH] rm PlotEventInfo

---
 GUI/View/PlotSpecular/SpecularPlot.cpp | 15 -------
 GUI/View/PlotSpecular/SpecularPlot.h   |  3 --
 GUI/View/PlotUtil/ColorMap.cpp         | 23 -----------
 GUI/View/PlotUtil/ColorMap.h           |  3 --
 GUI/View/PlotUtil/PlotEventInfo.cpp    | 28 -------------
 GUI/View/PlotUtil/PlotEventInfo.h      | 56 --------------------------
 GUI/View/PlotUtil/ScientificPlot.h     |  4 --
 7 files changed, 132 deletions(-)
 delete mode 100644 GUI/View/PlotUtil/PlotEventInfo.cpp
 delete mode 100644 GUI/View/PlotUtil/PlotEventInfo.h

diff --git a/GUI/View/PlotSpecular/SpecularPlot.cpp b/GUI/View/PlotSpecular/SpecularPlot.cpp
index 64b66c6d181..0fd2fe26cde 100644
--- a/GUI/View/PlotSpecular/SpecularPlot.cpp
+++ b/GUI/View/PlotSpecular/SpecularPlot.cpp
@@ -24,7 +24,6 @@
 #include "GUI/Support/Tool/UpdateTimer.h"
 #include "GUI/Support/Util/QCP_Util.h"
 #include "GUI/View/PlotUtil/PlotConstants.h"
-#include "GUI/View/PlotUtil/PlotEventInfo.h"
 
 namespace {
 
@@ -80,19 +79,6 @@ Data1DItem* SpecularPlot::currentData1DItem() const
     return data1DItems().first();
 }
 
-PlotEventInfo SpecularPlot::eventInfo(double xpos, double ypos) const
-{
-    PlotEventInfo result(plotType());
-
-    result.setX(xpos);
-    result.setValue(ypos);
-
-    result.setInAxesRange(axesRangeContains(xpos, ypos));
-    result.setNx(bin(result.x(), m_plot->graph()));
-
-    return result;
-}
-
 QString SpecularPlot::infoString(const QPointF& pos) const
 {
     double x = m_plot->xAxis->pixelToCoord(pos.x());
@@ -108,7 +94,6 @@ QString SpecularPlot::infoString(const QPointF& pos) const
 	.arg(ix, 2);
 }
 
-
 void SpecularPlot::setLog()
 {
     if (!currentData1DItem())
diff --git a/GUI/View/PlotSpecular/SpecularPlot.h b/GUI/View/PlotSpecular/SpecularPlot.h
index 6c477405b7c..fcf448dcfe6 100644
--- a/GUI/View/PlotSpecular/SpecularPlot.h
+++ b/GUI/View/PlotSpecular/SpecularPlot.h
@@ -44,9 +44,6 @@ public:
     QSize sizeHint() const override { return QSize(500, 400); }
     QSize minimumSizeHint() const override { return QSize(128, 128); }
 
-    //! Returns PlotEventInfo corresponding to given axes coordinates.
-    PlotEventInfo eventInfo(double xpos, double ypos) const override;
-
     //! sets logarithmic scale
     void setLog();
 
diff --git a/GUI/View/PlotUtil/ColorMap.cpp b/GUI/View/PlotUtil/ColorMap.cpp
index 4e7b2f44c72..640ed9cc73c 100644
--- a/GUI/View/PlotUtil/ColorMap.cpp
+++ b/GUI/View/PlotUtil/ColorMap.cpp
@@ -22,7 +22,6 @@
 #include "GUI/Support/Tool/UpdateTimer.h"
 #include "GUI/Support/Util/QCP_Util.h"
 #include "GUI/View/PlotUtil/PlotConstants.h"
-#include "GUI/View/PlotUtil/PlotEventInfo.h"
 #include <qcustomplot.h>
 
 namespace {
@@ -149,28 +148,6 @@ QRectF ColorMap::viewportRectangleInWidgetCoordinates() // only used by Mask/Sce
     return {left, top, right - left, bottom - top};
 }
 
-PlotEventInfo ColorMap::eventInfo(double xpos, double ypos) const
-{
-    PlotEventInfo result(plotType());
-    const Data2DItem* ii = data2DItem();
-    if (!ii)
-        return result;
-
-    int nx(0), ny(0);
-    m_colorMap->data()->coordToCell(xpos, ypos, &nx, &ny);
-
-    result.setX(xpos);
-    result.setY(ypos);
-    result.setNx(nx);
-    result.setNy(ny);
-
-    result.setInAxesRange(axesRangeContains(xpos, ypos));
-    result.setValue(m_colorMap->data()->cell(result.nx(), result.ny()));
-    result.setLogValueAxis(ii->isLog());
-
-    return result;
-}
-
 QString ColorMap::infoString(const QPointF& pos) const
 {
     double x = m_plot->xAxis->pixelToCoord(pos.x());
diff --git a/GUI/View/PlotUtil/ColorMap.h b/GUI/View/PlotUtil/ColorMap.h
index ffd628cd50b..ba1ac38d2d9 100644
--- a/GUI/View/PlotUtil/ColorMap.h
+++ b/GUI/View/PlotUtil/ColorMap.h
@@ -44,9 +44,6 @@ public:
     //! Returns rectangle representing current axes zoom state in widget coordinates
     QRectF viewportRectangleInWidgetCoordinates();
 
-    //! Returns PlotEventInfo corresponding to given axes coordinates.
-    PlotEventInfo eventInfo(double xpos, double ypos) const override;
-
     QString infoString(const QPointF& pos) const override;
 
 signals:
diff --git a/GUI/View/PlotUtil/PlotEventInfo.cpp b/GUI/View/PlotUtil/PlotEventInfo.cpp
deleted file mode 100644
index 45d1e0a71ff..00000000000
--- a/GUI/View/PlotUtil/PlotEventInfo.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-//  ************************************************************************************************
-//
-//  BornAgain: simulate and fit reflection and scattering
-//
-//! @file      GUI/View/PlotUtil/PlotEventInfo.cpp
-//! @brief     Implementation of the class PlotEventInfo
-//!
-//! @homepage  http://www.bornagainproject.org
-//! @license   GNU General Public License v3 or higher (see COPYING)
-//! @copyright Forschungszentrum Jülich GmbH 2018
-//! @authors   Scientific Computing Group at MLZ (see CITATION, AUTHORS)
-//
-//  ************************************************************************************************
-
-#include "GUI/View/PlotUtil/PlotEventInfo.h"
-#include "Base/Py/PyFmt.h"
-
-PlotEventInfo::PlotEventInfo(PLOT_TYPE type)
-    : m_in_axes_range(false)
-    , m_log_valued_axis(false)
-    , m_x(0.0)
-    , m_y(0.0)
-    , m_value(0.0)
-    , m_nx(0)
-    , m_ny(0)
-    , m_info_type(type)
-{
-}
diff --git a/GUI/View/PlotUtil/PlotEventInfo.h b/GUI/View/PlotUtil/PlotEventInfo.h
deleted file mode 100644
index 841410d76dd..00000000000
--- a/GUI/View/PlotUtil/PlotEventInfo.h
+++ /dev/null
@@ -1,56 +0,0 @@
-//  ************************************************************************************************
-//
-//  BornAgain: simulate and fit reflection and scattering
-//
-//! @file      GUI/View/PlotUtil/PlotEventInfo.h
-//! @brief     Defines the class PlotEventInfo
-//!
-//! @homepage  http://www.bornagainproject.org
-//! @license   GNU General Public License v3 or higher (see COPYING)
-//! @copyright Forschungszentrum Jülich GmbH 2018
-//! @authors   Scientific Computing Group at MLZ (see CITATION, AUTHORS)
-//
-//  ************************************************************************************************
-
-#ifndef BORNAGAIN_GUI_VIEW_PLOTUTIL_PLOTEVENTINFO_H
-#define BORNAGAIN_GUI_VIEW_PLOTUTIL_PLOTEVENTINFO_H
-
-#include "GUI/View/PlotUtil/ScientificPlot.h"
-#include <QString>
-
-//! Contains parameters of mouse position in 1D or 2D plot.
-
-class PlotEventInfo {
-    using PLOT_TYPE = ScientificPlot::PLOT_TYPE;
-
-public:
-    PlotEventInfo(PLOT_TYPE type);
-
-    // setters, getters
-    void setInAxesRange(bool flag) { m_in_axes_range = flag; }
-    bool inAxesRange() const { return m_in_axes_range; }
-
-    void setLogValueAxis(bool flag) { m_log_valued_axis = flag; }
-    bool isLogValueAxis() const { return m_log_valued_axis; }
-
-    void setX(double x) { m_x = x; }
-    double x() const { return m_x; }
-    void setY(double y) { m_y = y; }
-    double y() const { return m_y; }
-
-    void setValue(double value) { m_value = value; }
-    double value() const { return m_value; }
-
-    void setNx(int nx) { m_nx = nx; }
-    int nx() const { return m_nx; }
-    void setNy(int ny) { m_ny = ny; }
-    int ny() const { return m_ny; }
-
-private:
-    bool m_in_axes_range, m_log_valued_axis;
-    double m_x, m_y, m_value;
-    int m_nx, m_ny;
-    PLOT_TYPE m_info_type;
-};
-
-#endif // BORNAGAIN_GUI_VIEW_PLOTUTIL_PLOTEVENTINFO_H
diff --git a/GUI/View/PlotUtil/ScientificPlot.h b/GUI/View/PlotUtil/ScientificPlot.h
index cc98d84c758..2211f4ab28b 100644
--- a/GUI/View/PlotUtil/ScientificPlot.h
+++ b/GUI/View/PlotUtil/ScientificPlot.h
@@ -18,7 +18,6 @@
 #include <QWidget>
 
 class PlotEventHelper;
-class PlotEventInfo;
 class QCustomPlot;
 class QMouseEvent;
 
@@ -32,9 +31,6 @@ public:
     explicit ScientificPlot(QWidget* parent, PLOT_TYPE plot_type);
     ~ScientificPlot() override;
 
-    //! Returns plot descriptor corresponding to given axes coordinates.
-    virtual PlotEventInfo eventInfo(double xpos, double ypos) const = 0;
-
     QCustomPlot* customPlot() { return m_plot; }
     const QCustomPlot* customPlot() const { return m_plot; }
 
-- 
GitLab