From e5f593db603761947596d55a8eca1d55fb23baaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Fri, 31 Mar 2017 16:27:05 +0200 Subject: [PATCH] #1375 Reduced window zoom limit to 10 decades instead of 4 --- .../UserInterface/CMakeLists_files.cmake | 1 + .../RiuFlowCharacteristicsPlot.cpp | 3 +- .../UserInterface/RiuQwtPlotZoomer.h | 35 +++++++++++++++++++ .../UserInterface/RiuSummaryQwtPlot.cpp | 5 +-- 4 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 ApplicationCode/UserInterface/RiuQwtPlotZoomer.h diff --git a/ApplicationCode/UserInterface/CMakeLists_files.cmake b/ApplicationCode/UserInterface/CMakeLists_files.cmake index dcf58c1c25..0e99830488 100644 --- a/ApplicationCode/UserInterface/CMakeLists_files.cmake +++ b/ApplicationCode/UserInterface/CMakeLists_files.cmake @@ -23,6 +23,7 @@ ${CEE_CURRENT_LIST_DIR}RiuPropertyViewTabWidget.h ${CEE_CURRENT_LIST_DIR}RiuQwtScalePicker.h ${CEE_CURRENT_LIST_DIR}RiuQwtCurvePointTracker.h ${CEE_CURRENT_LIST_DIR}RiuQwtPlotWheelZoomer.h +${CEE_CURRENT_LIST_DIR}RiuQwtPlotZoomer.h ${CEE_CURRENT_LIST_DIR}RiuRecentFileActionProvider.h ${CEE_CURRENT_LIST_DIR}RiuResultInfoPanel.h ${CEE_CURRENT_LIST_DIR}RiuResultQwtPlot.h diff --git a/ApplicationCode/UserInterface/RiuFlowCharacteristicsPlot.cpp b/ApplicationCode/UserInterface/RiuFlowCharacteristicsPlot.cpp index 5574b44894..d0f80d8203 100644 --- a/ApplicationCode/UserInterface/RiuFlowCharacteristicsPlot.cpp +++ b/ApplicationCode/UserInterface/RiuFlowCharacteristicsPlot.cpp @@ -36,6 +36,7 @@ #include "RiaColorTables.h" #include "qwt_plot_zoneitem.h" #include "qwt_date.h" +#include "RiuQwtPlotZoomer.h" @@ -86,7 +87,7 @@ RiuFlowCharacteristicsPlot::RiuFlowCharacteristicsPlot(RimFlowCharacteristicsPlo void RiuFlowCharacteristicsPlot::addWindowZoom(QwtPlot* plot) { - auto zoomer = new QwtPlotZoomer(plot->canvas()); + auto zoomer = new RiuQwtPlotZoomer(plot->canvas()); zoomer->setRubberBandPen(QColor(Qt::black)); zoomer->setTrackerMode(QwtPicker::AlwaysOff); zoomer->setTrackerPen(QColor(Qt::black)); diff --git a/ApplicationCode/UserInterface/RiuQwtPlotZoomer.h b/ApplicationCode/UserInterface/RiuQwtPlotZoomer.h new file mode 100644 index 0000000000..1cdb0e9903 --- /dev/null +++ b/ApplicationCode/UserInterface/RiuQwtPlotZoomer.h @@ -0,0 +1,35 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017- Statoil ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// +#pragma once + +#include "qwt_plot_zoomer.h" + +class RiuQwtPlotZoomer : public QwtPlotZoomer +{ +public: + RiuQwtPlotZoomer(QWidget * canvas, bool doReplot=true) : QwtPlotZoomer(canvas, doReplot) {} + +protected: + virtual QSizeF minZoomSize() const override + { + return QwtPlotZoomer::minZoomSize() / 10.0e6; + } +}; + + + diff --git a/ApplicationCode/UserInterface/RiuSummaryQwtPlot.cpp b/ApplicationCode/UserInterface/RiuSummaryQwtPlot.cpp index de976a8d87..c6b8dc9f56 100644 --- a/ApplicationCode/UserInterface/RiuSummaryQwtPlot.cpp +++ b/ApplicationCode/UserInterface/RiuSummaryQwtPlot.cpp @@ -47,6 +47,7 @@ #include #include "qwt_plot_magnifier.h" #include "RiuQwtPlotWheelZoomer.h" +#include "RiuQwtPlotZoomer.h" //-------------------------------------------------------------------------------------------------- /// @@ -59,14 +60,14 @@ RiuSummaryQwtPlot::RiuSummaryQwtPlot(RimSummaryPlot* plotDefinition, QWidget* pa setDefaults(); // LeftButton for the zooming - m_zoomerLeft = new QwtPlotZoomer(canvas()); + m_zoomerLeft = new RiuQwtPlotZoomer(canvas()); m_zoomerLeft->setRubberBandPen(QColor(Qt::black)); m_zoomerLeft->setTrackerMode(QwtPicker::AlwaysOff); m_zoomerLeft->setTrackerPen(QColor(Qt::black)); m_zoomerLeft->initMousePattern(1); // Attach a zoomer for the right axis - m_zoomerRight = new QwtPlotZoomer(canvas()); + m_zoomerRight = new RiuQwtPlotZoomer(canvas()); m_zoomerRight->setAxis(xTop, yRight); m_zoomerRight->setTrackerMode(QwtPicker::AlwaysOff); m_zoomerRight->initMousePattern(1);