Merge pull request #8754 from OPM/multiplot_improvements

Summary Multiplot: add new plot from a single curve in an ensemble plot and improve general plot performance
This commit is contained in:
jonjenssen
2022-03-31 12:34:07 +02:00
committed by GitHub
parent 2eb1713866
commit ebba37a623
15 changed files with 227 additions and 39 deletions

View File

@@ -562,7 +562,7 @@ void RiuMultiPlotBook::createPages()
}
CAF_ASSERT( plotWidgets[visibleIndex] );
page->addPlot( plotWidgets[visibleIndex] );
page->performUpdate();
page->performUpdate( RiaDefines::MultiPlotPageUpdateType::ALL );
}
// Set page numbers in title when there's more than one page

View File

@@ -322,10 +322,10 @@ int RiuMultiPlotPage::indexOfPlotWidget( RiuPlotWidget* plotWidget )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMultiPlotPage::scheduleUpdate()
void RiuMultiPlotPage::scheduleUpdate( RiaDefines::MultiPlotPageUpdateType whatToUpdate )
{
CAF_ASSERT( m_plotDefinition );
RiaPlotWindowRedrawScheduler::instance()->scheduleMultiPlotPageUpdate( this );
RiaPlotWindowRedrawScheduler::instance()->scheduleMultiPlotPageUpdate( this, whatToUpdate );
}
//--------------------------------------------------------------------------------------------------
@@ -444,7 +444,7 @@ QLabel* RiuMultiPlotPage::createTitleLabel() const
void RiuMultiPlotPage::showEvent( QShowEvent* event )
{
QWidget::showEvent( event );
performUpdate();
performUpdate( RiaDefines::MultiPlotPageUpdateType::ALL );
}
//--------------------------------------------------------------------------------------------------
@@ -560,12 +560,24 @@ bool RiuMultiPlotPage::showYAxis( int row, int column ) const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMultiPlotPage::performUpdate()
void RiuMultiPlotPage::performUpdate( RiaDefines::MultiPlotPageUpdateType whatToUpdate )
{
applyLook();
updateMarginsFromPageLayout();
reinsertPlotWidgets();
alignCanvasTops();
if ( whatToUpdate == RiaDefines::MultiPlotPageUpdateType::ALL )
{
applyLook();
updateMarginsFromPageLayout();
reinsertPlotWidgets();
alignCanvasTops();
}
else
{
if ( ( whatToUpdate & RiaDefines::MultiPlotPageUpdateType::LEGEND ) == RiaDefines::MultiPlotPageUpdateType::LEGEND )
{
refreshLegends();
alignCanvasTops();
}
}
}
//--------------------------------------------------------------------------------------------------
@@ -573,7 +585,15 @@ void RiuMultiPlotPage::performUpdate()
//--------------------------------------------------------------------------------------------------
void RiuMultiPlotPage::onLegendUpdated()
{
scheduleUpdate();
scheduleUpdate( RiaDefines::MultiPlotPageUpdateType::LEGEND );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMultiPlotPage::refreshLegends()
{
// TODO - might need to do something here, but at the moment it looks like alignCanvasTops() is sufficient
}
//--------------------------------------------------------------------------------------------------

View File

@@ -19,6 +19,8 @@
#include "RiuInterfaceToViewWindow.h"
#include "RiaDefines.h"
#include "cafPdmPointer.h"
#include "cafSelectionChangedReceiver.h"
@@ -76,8 +78,8 @@ public:
bool previewModeEnabled() const;
void setPagePreviewModeEnabled( bool previewMode );
void scheduleUpdate();
void scheduleReplotOfAllPlots();
void scheduleUpdate( RiaDefines::MultiPlotPageUpdateType whatToUpdate = RiaDefines::MultiPlotPageUpdateType::ALL );
void scheduleReplotOfAllPlots();
virtual void updateVerticalScrollBar( double visibleMin, double visibleMax, double totalMin, double totalMax ) {}
void updateSubTitles();
@@ -103,6 +105,7 @@ protected:
virtual bool showYAxis( int row, int column ) const;
virtual void reinsertPlotWidgets();
virtual void refreshLegends();
void updateTitleFont();
@@ -119,7 +122,7 @@ protected:
void applyLook();
private slots:
virtual void performUpdate();
virtual void performUpdate( RiaDefines::MultiPlotPageUpdateType whatToUpdate );
void onLegendUpdated();
protected:

View File

@@ -31,6 +31,7 @@
#include "cafCmdFeatureMenuBuilder.h"
#include <QMenu>
#include <QPointer>
#include <cmath>
@@ -87,6 +88,14 @@ void RiuSummaryPlot::showContextMenu( QPoint pos )
if ( ensemble && ensemble->isEnsemble() )
{
clickedQuantityName = QString::fromStdString( clickedEnsembleCurveSet->summaryAddress().uiText() );
if ( curveClicked )
{
QVariant curveVariant( QVariant::fromValue( static_cast<void*>( summaryCurve ) ) );
menuBuilder.addCmdFeatureWithUserData( "RicNewSummaryPlotFromCurveFeature",
"Create New Plot from Curve",
curveVariant );
}
}
}

View File

@@ -151,7 +151,7 @@ void RiuWellLogPlot::slotSetMinDepth( int value )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::performUpdate()
void RiuWellLogPlot::performUpdate( RiaDefines::MultiPlotPageUpdateType /* whatToUpdate */ )
{
m_horizontalTrackScrollBar->setVisible( false );
m_verticalTrackScrollBar->setVisible( false );

View File

@@ -45,7 +45,7 @@ private:
private slots:
void slotSetMinDepth( int value );
void performUpdate() override;
void performUpdate( RiaDefines::MultiPlotPageUpdateType whatToUpdate ) override;
private:
QPointer<QVBoxLayout> m_verticalTrackScrollBarLayout;