mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge pull request #8765 from OPM/summarymultiplot_performance2
Summary Multiplot performance improvements and fixes
This commit is contained in:
@@ -93,13 +93,21 @@ void RimEnsembleCurveSetCollection::loadDataAndUpdate( bool updateParentPlot )
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleCurveSetCollection::setParentPlotAndReplot( RiuPlotWidget* plot )
|
||||
{
|
||||
setParentPlotNoReplot( plot );
|
||||
|
||||
if ( plot ) plot->replot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleCurveSetCollection::setParentPlotNoReplot( RiuPlotWidget* plot )
|
||||
{
|
||||
for ( RimEnsembleCurveSet* curveSet : m_curveSets )
|
||||
{
|
||||
curveSet->setParentPlotNoReplot( plot );
|
||||
}
|
||||
|
||||
if ( plot ) plot->replot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -44,6 +44,7 @@ public:
|
||||
|
||||
void loadDataAndUpdate( bool updateParentPlot );
|
||||
void setParentPlotAndReplot( RiuPlotWidget* plot );
|
||||
void setParentPlotNoReplot( RiuPlotWidget* plot );
|
||||
void detachPlotCurves();
|
||||
void reattachPlotCurves();
|
||||
|
||||
|
||||
@@ -125,13 +125,21 @@ void RimSummaryCurveCollection::loadDataAndUpdate( bool updateParentPlot )
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurveCollection::setParentPlotAndReplot( RiuPlotWidget* plot )
|
||||
{
|
||||
setParentPlotNoReplot( plot );
|
||||
|
||||
if ( plot ) plot->replot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurveCollection::setParentPlotNoReplot( RiuPlotWidget* plot )
|
||||
{
|
||||
for ( RimSummaryCurve* curve : m_curves )
|
||||
{
|
||||
curve->setParentPlotNoReplot( plot );
|
||||
}
|
||||
|
||||
if ( plot ) plot->replot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -64,6 +64,7 @@ public:
|
||||
|
||||
private:
|
||||
void setParentPlotAndReplot( RiuPlotWidget* plot );
|
||||
void setParentPlotNoReplot( RiuPlotWidget* plot );
|
||||
void detachPlotCurves();
|
||||
void reattachPlotCurves();
|
||||
|
||||
|
||||
@@ -52,7 +52,6 @@ CAF_PDM_SOURCE_INIT( RimSummaryMultiPlot, "MultiSummaryPlot" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryMultiPlot::RimSummaryMultiPlot()
|
||||
: duplicatePlot( this )
|
||||
, refreshTree( this )
|
||||
{
|
||||
CAF_PDM_InitObject( "Multi Summary Plot" );
|
||||
this->setDeletable( true );
|
||||
@@ -117,7 +116,6 @@ void RimSummaryMultiPlot::insertPlot( RimPlot* plot, size_t index )
|
||||
{
|
||||
sumPlot->curvesChanged.connect( this, &RimSummaryMultiPlot::onSubPlotChanged );
|
||||
RimMultiPlot::insertPlot( plot, index );
|
||||
signalRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,10 +148,30 @@ void RimSummaryMultiPlot::removePlot( RimPlot* plot )
|
||||
if ( sumPlot )
|
||||
{
|
||||
RimMultiPlot::removePlot( plot );
|
||||
signalRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::removePlotNoUpdate( RimPlot* plot )
|
||||
{
|
||||
RimSummaryPlot* sumPlot = dynamic_cast<RimSummaryPlot*>( plot );
|
||||
CVF_ASSERT( sumPlot != nullptr );
|
||||
if ( sumPlot )
|
||||
{
|
||||
RimMultiPlot::removePlotNoUpdate( plot );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::updateAfterPlotRemove()
|
||||
{
|
||||
onPlotAdditionOrRemoval();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -387,6 +405,21 @@ std::vector<RimSummaryPlot*> RimSummaryMultiPlot::summaryPlots() const
|
||||
return typedPlots;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryPlot*> RimSummaryMultiPlot::visibleSummaryPlots() const
|
||||
{
|
||||
std::vector<RimSummaryPlot*> visiblePlots;
|
||||
|
||||
for ( auto plot : summaryPlots() )
|
||||
{
|
||||
if ( plot->showWindow() ) visiblePlots.push_back( plot );
|
||||
}
|
||||
|
||||
return visiblePlots;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -535,14 +568,6 @@ void RimSummaryMultiPlot::duplicate()
|
||||
duplicatePlot.send( this );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::signalRefresh()
|
||||
{
|
||||
refreshTree.send( this );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -46,7 +46,6 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep
|
||||
|
||||
public:
|
||||
caf::Signal<RimSummaryMultiPlot*> duplicatePlot;
|
||||
caf::Signal<RimSummaryMultiPlot*> refreshTree;
|
||||
|
||||
public:
|
||||
RimSummaryMultiPlot();
|
||||
@@ -66,6 +65,9 @@ public:
|
||||
void insertPlot( RimPlot* plot, size_t index ) override;
|
||||
void removePlot( RimPlot* plot ) override;
|
||||
|
||||
void removePlotNoUpdate( RimPlot* plot ) override;
|
||||
void updateAfterPlotRemove() override;
|
||||
|
||||
std::vector<caf::PdmFieldHandle*> fieldsToShowInToolbar();
|
||||
|
||||
void syncAxisRanges();
|
||||
@@ -75,6 +77,7 @@ public:
|
||||
void summaryPlotItemInfos( QList<caf::PdmOptionItemInfo>* optionInfos ) const;
|
||||
|
||||
std::vector<RimSummaryPlot*> summaryPlots() const;
|
||||
std::vector<RimSummaryPlot*> visibleSummaryPlots() const;
|
||||
|
||||
protected:
|
||||
bool handleGlobalKeyEvent( QKeyEvent* keyEvent ) override;
|
||||
@@ -93,7 +96,6 @@ private:
|
||||
void updatePlotWindowTitle() override;
|
||||
|
||||
void duplicate();
|
||||
void signalRefresh();
|
||||
|
||||
void onSubPlotChanged( const caf::SignalEmitter* emitter );
|
||||
|
||||
|
||||
@@ -55,7 +55,6 @@ void RimSummaryMultiPlotCollection::initAfterRead()
|
||||
for ( auto& plot : m_summaryMultiPlots )
|
||||
{
|
||||
plot->duplicatePlot.connect( this, &RimSummaryMultiPlotCollection::onDuplicatePlot );
|
||||
plot->refreshTree.connect( this, &RimSummaryMultiPlotCollection::onRefreshTree );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +81,6 @@ void RimSummaryMultiPlotCollection::addSummaryMultiPlot( RimSummaryMultiPlot* pl
|
||||
{
|
||||
m_summaryMultiPlots().push_back( plot );
|
||||
plot->duplicatePlot.connect( this, &RimSummaryMultiPlotCollection::onDuplicatePlot );
|
||||
plot->refreshTree.connect( this, &RimSummaryMultiPlotCollection::onRefreshTree );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -141,14 +139,7 @@ void RimSummaryMultiPlotCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering
|
||||
{
|
||||
for ( auto& plot : m_summaryMultiPlots() )
|
||||
{
|
||||
if ( plot->summaryPlots().size() == 1 )
|
||||
{
|
||||
uiTreeOrdering.add( plot->summaryPlots()[0] );
|
||||
}
|
||||
else
|
||||
{
|
||||
uiTreeOrdering.add( plot );
|
||||
}
|
||||
uiTreeOrdering.add( plot );
|
||||
}
|
||||
uiTreeOrdering.skipRemainingChildren( true );
|
||||
}
|
||||
|
||||
@@ -1586,7 +1586,10 @@ void RimSummaryPlot::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderin
|
||||
void RimSummaryPlot::onLoadDataAndUpdate()
|
||||
{
|
||||
updatePlotTitle();
|
||||
updateMdiWindowVisibility();
|
||||
|
||||
RimMultiPlot* plotWindow = nullptr;
|
||||
firstAncestorOrThisOfType( plotWindow );
|
||||
if ( plotWindow == nullptr ) updateMdiWindowVisibility();
|
||||
|
||||
if ( m_summaryCurveCollection )
|
||||
{
|
||||
@@ -1623,18 +1626,17 @@ void RimSummaryPlot::onLoadDataAndUpdate()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::updateZoomInParentPlot()
|
||||
{
|
||||
if ( plotWidget() )
|
||||
{
|
||||
for ( const auto& axisProperty : m_axisProperties )
|
||||
{
|
||||
updateZoomForAxis( axisProperty->plotAxisType() );
|
||||
}
|
||||
if ( !plotWidget() ) return;
|
||||
|
||||
plotWidget()->updateAxes();
|
||||
updateZoomFromParentPlot();
|
||||
plotWidget()->updateZoomDependentCurveProperties();
|
||||
plotWidget()->scheduleReplot();
|
||||
for ( const auto& axisProperty : m_axisProperties )
|
||||
{
|
||||
updateZoomForAxis( axisProperty->plotAxisType() );
|
||||
}
|
||||
|
||||
plotWidget()->updateAxes();
|
||||
updateZoomFromParentPlot();
|
||||
plotWidget()->updateZoomDependentCurveProperties();
|
||||
plotWidget()->scheduleReplot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -2180,7 +2182,7 @@ RiuPlotWidget* RimSummaryPlot::doCreatePlotViewWidget( QWidget* mainWindowParent
|
||||
|
||||
if ( useQtCharts )
|
||||
{
|
||||
m_summaryPlot = std::make_unique<RiuSummaryQtChartsPlot>( this );
|
||||
m_summaryPlot = std::make_unique<RiuSummaryQtChartsPlot>( this, mainWindowParent );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2207,12 +2209,12 @@ RiuPlotWidget* RimSummaryPlot::doCreatePlotViewWidget( QWidget* mainWindowParent
|
||||
|
||||
if ( m_summaryCurveCollection )
|
||||
{
|
||||
m_summaryCurveCollection->setParentPlotAndReplot( plotWidget() );
|
||||
m_summaryCurveCollection->setParentPlotNoReplot( plotWidget() );
|
||||
}
|
||||
|
||||
if ( m_ensembleCurveSetCollection )
|
||||
{
|
||||
m_ensembleCurveSetCollection->setParentPlotAndReplot( plotWidget() );
|
||||
m_ensembleCurveSetCollection->setParentPlotNoReplot( plotWidget() );
|
||||
}
|
||||
|
||||
this->connect( plotWidget(), SIGNAL( plotZoomed() ), SLOT( onPlotZoomed() ) );
|
||||
@@ -2220,6 +2222,8 @@ RiuPlotWidget* RimSummaryPlot::doCreatePlotViewWidget( QWidget* mainWindowParent
|
||||
updatePlotTitle();
|
||||
}
|
||||
|
||||
plotWidget()->setParent( mainWindowParent );
|
||||
|
||||
return plotWidget();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user