7147 vfp show plot data (#7154)

* #7147 VFP plots: refactor to separate data extraction and display.
* #7147 VFP Plots: Add "Show Plot Data" functionality.
* #7147 VFP plots: Move defines to separate file
* #7147 VFP plots: Minor adjustments
* #7147 VFP Plot: Show table number in title and auto-generated name.
* #7147 VFP Plot: Add "Show Plot Data" to context menu.
* Remove unused member.
* #7147 VFP Plot: Disable broken curve selection.
* Revert "#7147 VFP Plot: Add "Show Plot Data" to context menu."
This reverts commit 5f3b2f362fcea7fc6de5fd2c614919079629bf1c.
* #7147 VFP Plot: Use event filter to show context menu
* Janitor : Use context menu launcher for WellAllocationPlot and CrossPlot

Co-authored-by: Magne Sjaastad <magne.sjaastad@ceetronsolutions.com>
This commit is contained in:
Kristian Bendiksen
2021-01-12 20:51:57 +01:00
committed by GitHub
parent 7b5bc5c2cd
commit 1f7cb2b973
14 changed files with 656 additions and 344 deletions

View File

@@ -27,6 +27,7 @@
#include "RimPlotAxisPropertiesInterface.h"
#include "RimRegularLegendConfig.h"
#include "RiuContextMenuLauncher.h"
#include "RiuGuiTheme.h"
#include "RiuPlotAnnotationTool.h"
#include "RiuQwtCurvePointTracker.h"
@@ -105,6 +106,16 @@ RiuGridCrossQwtPlot::RiuGridCrossQwtPlot( RimGridCrossPlot* plot, QWidget* paren
this->canvas()->installEventFilter( this );
setInternalQwtLegendVisible( true );
{
caf::CmdFeatureMenuBuilder menuBuilder;
menuBuilder << "RicSwapGridCrossPlotDataSetAxesFeature";
menuBuilder << "Separator";
menuBuilder << "RicShowPlotDataFeature";
new RiuContextMenuLauncher( this, menuBuilder );
}
}
//--------------------------------------------------------------------------------------------------
@@ -170,28 +181,6 @@ void RiuGridCrossQwtPlot::setInternalQwtLegendVisible( bool visible )
this->insertLegend( nullptr );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridCrossQwtPlot::contextMenuEvent( QContextMenuEvent* event )
{
QMenu menu;
caf::CmdFeatureMenuBuilder menuBuilder;
emit plotSelected( false );
menuBuilder << "RicSwapGridCrossPlotDataSetAxesFeature";
menuBuilder << "Separator";
menuBuilder << "RicShowPlotDataFeature";
menuBuilder.appendToMenu( &menu );
if ( menu.actions().size() > 0 )
{
menu.exec( event->globalPos() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -62,8 +62,6 @@ public:
void setInternalQwtLegendVisible( bool visible );
protected:
void contextMenuEvent( QContextMenuEvent* ) override;
bool curveText( const QwtPlotCurve* curve, QString* curveTitle, QString* xParamName, QString* yParamName ) const;
bool isZoomerActive() const override;
void endZoomOperations() override;

View File

@@ -43,7 +43,6 @@
#include "qwt_plot_grid.h"
#include "qwt_plot_layout.h"
#include "qwt_plot_marker.h"
#include "qwt_plot_picker.h"
#include "qwt_plot_renderer.h"
#include "qwt_plot_shapeitem.h"
#include "qwt_scale_draw.h"

View File

@@ -40,7 +40,6 @@ class QwtPlotCurve;
class QwtPlotGrid;
class QwtPlotItem;
class QwtPlotMarker;
class QwtPlotPicker;
class QEvent;
class QLabel;
@@ -179,7 +178,6 @@ private:
QPoint m_clickPosition;
std::map<QwtPlot::Axis, QString> m_axisTitles;
std::map<QwtPlot::Axis, bool> m_axisTitlesEnabled;
QPointer<QwtPlotPicker> m_plotPicker;
const int m_overlayMargins;
QString m_plotTitle;
bool m_plotTitleEnabled;

View File

@@ -0,0 +1,63 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- 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 "RiuVfpQwtPlot.h"
#include "RiuQwtPlotTools.h"
#include "RimVfpPlot.h"
#include "cafCmdFeatureMenuBuilder.h"
#include <QContextMenuEvent>
#include <QEvent>
#include <QMenu>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuVfpQwtPlot::RiuVfpQwtPlot( RimVfpPlot* plot, QWidget* parent /*= nullptr*/ )
: RiuQwtPlotWidget( plot, parent )
{
RiuQwtPlotTools::setCommonPlotBehaviour( this );
// Remove event filter to disable unwanted highlighting
// on left click in plot.
removeEventFilter( this );
canvas()->removeEventFilter( this );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuVfpQwtPlot::contextMenuEvent( QContextMenuEvent* event )
{
QMenu menu;
caf::CmdFeatureMenuBuilder menuBuilder;
emit plotSelected( false );
menuBuilder << "RicShowPlotDataFeature";
menuBuilder.appendToMenu( &menu );
if ( menu.actions().size() > 0 )
{
menu.exec( event->globalPos() );
}
}

View File

@@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- 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
#include "RiuInterfaceToViewWindow.h"
#include "RiuQwtPlotWidget.h"
class RimVfpPlot;
//==================================================================================================
//
//
//
//==================================================================================================
class RiuVfpQwtPlot : public RiuQwtPlotWidget
{
public:
RiuVfpQwtPlot( RimVfpPlot* plot, QWidget* parent = nullptr );
protected:
void contextMenuEvent( QContextMenuEvent* ) override;
};

View File

@@ -32,7 +32,6 @@
#include "cvfColor3.h"
#include <QBoxLayout>
#include <QContextMenuEvent>
#include <QLabel>
#include <QMenu>
@@ -75,16 +74,16 @@ RiuWellAllocationPlot::RiuWellAllocationPlot( RimWellAllocationPlot* plotDefinit
m_legendWidget = new RiuNightchartsWidget( this );
new RiuPlotObjectPicker( m_legendWidget, m_plotDefinition->plotLegend() );
caf::CmdFeatureMenuBuilder menuBuilder;
menuBuilder << "RicShowTotalAllocationDataFeature";
new RiuContextMenuLauncher( m_legendWidget, menuBuilder );
caf::CmdFeatureMenuBuilder menuForSubWidgets;
menuForSubWidgets << "RicShowTotalAllocationDataFeature";
new RiuContextMenuLauncher( m_legendWidget, menuForSubWidgets );
leftColumnLayout->addWidget( m_legendWidget );
m_legendWidget->showPie( false );
QWidget* totalFlowAllocationWidget = m_plotDefinition->totalWellFlowPlot()->createViewWidget( this );
new RiuPlotObjectPicker( totalFlowAllocationWidget, m_plotDefinition->totalWellFlowPlot() );
new RiuContextMenuLauncher( totalFlowAllocationWidget, menuBuilder );
new RiuContextMenuLauncher( totalFlowAllocationWidget, menuForSubWidgets );
leftColumnLayout->addWidget( totalFlowAllocationWidget, Qt::AlignTop );
leftColumnLayout->addWidget( m_plotDefinition->tofAccumulatedPhaseFractionsPlot()->createViewWidget( this ),
@@ -94,6 +93,16 @@ RiuWellAllocationPlot::RiuWellAllocationPlot( RimWellAllocationPlot* plotDefinit
QWidget* wellFlowWidget = m_plotDefinition->accumulatedWellFlowPlot()->createPlotWidget();
plotWidgetsLayout->addWidget( wellFlowWidget );
{
caf::CmdFeatureMenuBuilder menuBuilder;
menuBuilder << "RicShowContributingWellsFromPlotFeature";
menuBuilder << "RicShowCumulativePhasePlotFeature";
menuBuilder << "RicShowTotalAllocationDataFeature";
new RiuContextMenuLauncher( this, menuBuilder );
}
}
//--------------------------------------------------------------------------------------------------
@@ -176,25 +185,6 @@ QSize RiuWellAllocationPlot::minimumSizeHint() const
return QSize( 0, 100 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellAllocationPlot::contextMenuEvent( QContextMenuEvent* event )
{
QMenu menu;
caf::CmdFeatureMenuBuilder menuBuilder;
menuBuilder << "RicShowContributingWellsFromPlotFeature";
menuBuilder << "RicShowCumulativePhasePlotFeature";
menuBuilder.appendToMenu( &menu );
if ( menu.actions().size() > 0 )
{
menu.exec( event->globalPos() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -63,8 +63,6 @@ protected:
QSize sizeHint() const override;
QSize minimumSizeHint() const override;
void contextMenuEvent( QContextMenuEvent* ) override;
private:
void setDefaults();