Merge pull request #8387 from OPM/qtcharts-summary-plots

Closes #8228 

Major refactoring of summary plotting. Now possible to create plots both with Qwt and QtChart as plotting tool.
This commit is contained in:
Kristian Bendiksen
2022-01-17 13:14:21 +01:00
committed by GitHub
parent d9bb82de91
commit 258fbddc10
145 changed files with 7245 additions and 2932 deletions

View File

@@ -21,6 +21,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RiaFeatureCommandContext.h
${CMAKE_CURRENT_LIST_DIR}/RiaStringListSerializer.h
${CMAKE_CURRENT_LIST_DIR}/RiaNncDefines.h
${CMAKE_CURRENT_LIST_DIR}/RiaPlotDefines.h
${CMAKE_CURRENT_LIST_DIR}/RiaStimPlanModelDefines.h
${CMAKE_CURRENT_LIST_DIR}/RiaResultNames.h
${CMAKE_CURRENT_LIST_DIR}/RiaNumberFormat.h
@@ -49,6 +50,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RiaFeatureCommandContext.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaStringListSerializer.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaNncDefines.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaPlotDefines.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaStimPlanModelDefines.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaResultNames.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaNumberFormat.cpp

View File

@@ -70,15 +70,6 @@ void caf::AppEnum<RiaDefines::DepthTypeEnum>::setUp()
setDefault( RiaDefines::DepthTypeEnum::MEASURED_DEPTH );
}
template <>
void caf::AppEnum<RiaDefines::PlotAxis>::setUp()
{
addItem( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, "PLOT_AXIS_LEFT", "Left" );
addItem( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT, "PLOT_AXIS_RIGHT", "Right" );
setDefault( RiaDefines::PlotAxis::PLOT_AXIS_LEFT );
}
template <>
void caf::AppEnum<RiaDefines::PhaseType>::setUp()
{
@@ -240,30 +231,6 @@ RiaDefines::EclipseUnitSystem RiaDefines::fromDepthUnit( DepthUnitType depthUnit
return RiaDefines::EclipseUnitSystem::UNITS_UNKNOWN;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RiaDefines::minimumDefaultValuePlot()
{
return -10.0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RiaDefines::minimumDefaultLogValuePlot()
{
return 1.0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RiaDefines::maximumDefaultValuePlot()
{
return 100.0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -107,18 +107,6 @@ enum class DepthTypeEnum
TRUE_VERTICAL_DEPTH_RKB
};
// Defines relate to plotting
enum class PlotAxis
{
PLOT_AXIS_LEFT,
PLOT_AXIS_RIGHT,
PLOT_AXIS_BOTTOM
};
double minimumDefaultValuePlot();
double minimumDefaultLogValuePlot();
double maximumDefaultValuePlot();
enum class PhaseType
{
OIL_PHASE,

View File

@@ -0,0 +1,75 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022- Equinor 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiaPlotDefines.h"
#include "cafAppEnum.h"
namespace caf
{
template <>
void caf::AppEnum<RiaDefines::PlotAxis>::setUp()
{
addItem( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, "PLOT_AXIS_LEFT", "Left" );
addItem( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT, "PLOT_AXIS_RIGHT", "Right" );
addItem( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, "PLOT_AXIS_BOTTOM", "Bottom" );
addItem( RiaDefines::PlotAxis::PLOT_AXIS_TOP, "PLOT_AXIS_TOP", "Top" );
setDefault( RiaDefines::PlotAxis::PLOT_AXIS_LEFT );
}
}; // namespace caf
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RiaDefines::minimumDefaultValuePlot()
{
return -10.0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RiaDefines::minimumDefaultLogValuePlot()
{
return 1.0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RiaDefines::maximumDefaultValuePlot()
{
return 100.0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaDefines::isHorizontal( RiaDefines::PlotAxis axis )
{
return !isVertical( axis );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaDefines::isVertical( RiaDefines::PlotAxis axis )
{
return ( axis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT || axis == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT );
}

View File

@@ -0,0 +1,39 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022- Equinor 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
// Defines relate to plotting
namespace RiaDefines
{
enum class PlotAxis
{
PLOT_AXIS_LEFT,
PLOT_AXIS_RIGHT,
PLOT_AXIS_BOTTOM,
PLOT_AXIS_TOP
};
double minimumDefaultValuePlot();
double minimumDefaultLogValuePlot();
double maximumDefaultValuePlot();
bool isHorizontal( PlotAxis axis );
bool isVertical( PlotAxis axis );
}; // namespace RiaDefines

View File

@@ -19,7 +19,7 @@
#include "RiuMultiPlotBook.h"
#include "RiuMultiPlotPage.h"
#include "RiuQwtPlotWidget.h"
#include "RiuPlotWidget.h"
#include <QCoreApplication>
#include <QDebug>
@@ -61,7 +61,7 @@ void RiaPlotWindowRedrawScheduler::scheduleMultiPlotPageUpdate( RiuMultiPlotPage
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaPlotWindowRedrawScheduler::schedulePlotWidgetReplot( RiuQwtPlotWidget* plotWidget )
void RiaPlotWindowRedrawScheduler::schedulePlotWidgetReplot( RiuPlotWidget* plotWidget )
{
m_plotWidgetsToReplot.push_back( plotWidget );
@@ -92,13 +92,13 @@ void RiaPlotWindowRedrawScheduler::performScheduledUpdatesAndReplots()
{
std::vector<QPointer<RiuMultiPlotBook>> plotWindowsToUpdate;
std::vector<QPointer<RiuMultiPlotPage>> plotPagesToUpdate;
std::vector<QPointer<RiuQwtPlotWidget>> plotWidgetsToReplot;
std::vector<QPointer<RiuPlotWidget>> plotWidgetsToReplot;
plotWindowsToUpdate.swap( m_plotWindowsToUpdate );
plotPagesToUpdate.swap( m_plotPagesToUpdate );
plotWidgetsToReplot.swap( m_plotWidgetsToReplot );
std::set<QPointer<RiuQwtPlotWidget>> updatedPlots;
std::set<QPointer<RiuPlotWidget>> updatedPlots;
std::set<QPointer<RiuMultiPlotBook>> updatedPlotWindows;
std::set<QPointer<RiuMultiPlotPage>> updatedPlotPages;
@@ -127,7 +127,7 @@ void RiaPlotWindowRedrawScheduler::performScheduledUpdatesAndReplots()
}
// Perform update and replot. Make sure we handle legend update
for ( QPointer<RiuQwtPlotWidget> plot : plotWidgetsToReplot )
for ( QPointer<RiuPlotWidget> plot : plotWidgetsToReplot )
{
if ( !plot.isNull() && !updatedPlots.count( plot ) )
{

View File

@@ -28,7 +28,7 @@
class RiuMultiPlotPage;
class RiuMultiPlotBook;
class RiuQwtPlotWidget;
class RiuPlotWidget;
class RiaPlotWindowRedrawScheduler : public QObject
{
@@ -38,7 +38,7 @@ public:
static RiaPlotWindowRedrawScheduler* instance();
void scheduleMultiPlotWindowUpdate( RiuMultiPlotBook* plotWindow );
void scheduleMultiPlotPageUpdate( RiuMultiPlotPage* plotWindow );
void schedulePlotWidgetReplot( RiuQwtPlotWidget* plotWidget );
void schedulePlotWidgetReplot( RiuPlotWidget* plotWidget );
void clearAllScheduledUpdates();
void performScheduledUpdatesAndReplots();
@@ -46,13 +46,13 @@ private slots:
void slotUpdateAndReplotScheduledItemsWhenReady();
private:
RiaPlotWindowRedrawScheduler() = default;
RiaPlotWindowRedrawScheduler() = default;
~RiaPlotWindowRedrawScheduler() override = default;
void startTimer( int msecs );
private:
std::vector<QPointer<RiuQwtPlotWidget>> m_plotWidgetsToReplot;
std::vector<QPointer<RiuPlotWidget>> m_plotWidgetsToReplot;
std::vector<QPointer<RiuMultiPlotBook>> m_plotWindowsToUpdate;
std::vector<QPointer<RiuMultiPlotPage>> m_plotPagesToUpdate;
QScopedPointer<QTimer> m_plotWindowUpdateTimer;