#7609 Start using RimAbstractPlotCollection interface

This commit is contained in:
Kristian Bendiksen 2021-05-03 18:37:58 +02:00
parent 946e886bff
commit d8b80bb988
2 changed files with 30 additions and 61 deletions

View File

@ -26,6 +26,7 @@ class RimAbstractPlotCollection
public:
virtual ~RimAbstractPlotCollection() = default;
virtual void loadDataAndUpdateAllPlots() = 0;
virtual size_t plotCount() const = 0;
virtual void deleteAllPlots() = 0;
virtual void removeRimPlot( RimPlot* plot ) = 0;
@ -65,4 +66,12 @@ public:
removePlot( typedPlot );
}
}
};
void loadDataAndUpdateAllPlots() override
{
for ( auto plot : plots() )
{
plot->loadDataAndUpdate();
}
}
};

View File

@ -19,6 +19,7 @@
#include "RimMainPlotCollection.h"
#include "RimAbstractPlotCollection.h"
#include "RimAnalysisPlotCollection.h"
#include "RimCorrelationPlotCollection.h"
#include "RimCorrelationReportPlot.h"
@ -461,17 +462,19 @@ void RimMainPlotCollection::loadDataAndUpdateAllPlots()
{
RimWellLogPlotCollection* wlpColl = nullptr;
RimSummaryPlotCollection* spColl = nullptr;
RimSummaryCrossPlotCollection* scpColl = nullptr;
RimFlowPlotCollection* flowColl = nullptr;
RimRftPlotCollection* rftColl = nullptr;
RimPltPlotCollection* pltColl = nullptr;
RimGridCrossPlotCollection* gcpColl = nullptr;
RimSaturationPressurePlotCollection* sppColl = nullptr;
RimAnalysisPlotCollection* alsColl = nullptr;
RimCorrelationPlotCollection* corrColl = nullptr;
RimMultiPlotCollection* gpwColl = nullptr;
RimStimPlanModelPlotCollection* frmColl = nullptr;
RimVfpPlotCollection* vfpColl = nullptr;
std::vector<RimAbstractPlotCollection*> plotCollections;
plotCollections.push_back( summaryCrossPlotCollection() );
plotCollections.push_back( gridCrossPlotCollection() );
plotCollections.push_back( analysisPlotCollection() );
plotCollections.push_back( vfpPlotCollection() );
if ( wellLogPlotCollection() )
{
@ -481,10 +484,6 @@ void RimMainPlotCollection::loadDataAndUpdateAllPlots()
{
spColl = summaryPlotCollection();
}
if ( summaryCrossPlotCollection() )
{
scpColl = summaryCrossPlotCollection();
}
if ( flowPlotCollection() )
{
flowColl = flowPlotCollection();
@ -497,18 +496,10 @@ void RimMainPlotCollection::loadDataAndUpdateAllPlots()
{
pltColl = pltPlotCollection();
}
if ( gridCrossPlotCollection() )
{
gcpColl = gridCrossPlotCollection();
}
if ( saturationPressurePlotCollection() )
{
sppColl = saturationPressurePlotCollection();
}
if ( analysisPlotCollection() )
{
alsColl = analysisPlotCollection();
}
if ( correlationPlotCollection() )
{
corrColl = correlationPlotCollection();
@ -521,29 +512,34 @@ void RimMainPlotCollection::loadDataAndUpdateAllPlots()
{
frmColl = stimPlanModelPlotCollection();
}
if ( vfpPlotCollection() )
{
vfpColl = vfpPlotCollection();
}
size_t plotCount = 0;
plotCount += wlpColl ? wlpColl->wellLogPlots().size() : 0;
plotCount += spColl ? spColl->plots().size() : 0;
plotCount += scpColl ? scpColl->plots().size() : 0;
plotCount += flowColl ? flowColl->plotCount() : 0;
plotCount += rftColl ? rftColl->rftPlots().size() : 0;
plotCount += pltColl ? pltColl->pltPlots().size() : 0;
plotCount += gcpColl ? gcpColl->plotCount() : 0;
plotCount += sppColl ? sppColl->plotCount() : 0;
plotCount += alsColl ? alsColl->plotCount() : 0;
plotCount += corrColl ? corrColl->plotCount() + corrColl->reports().size() : 0;
plotCount += gpwColl ? gpwColl->multiPlots().size() : 0;
plotCount += frmColl ? frmColl->stimPlanModelPlots().size() : 0;
plotCount += vfpColl ? vfpColl->plotCount() : 0;
for ( auto coll : plotCollections )
if ( coll ) plotCount += coll->plotCount();
if ( plotCount > 0 )
{
caf::ProgressInfo plotProgress( plotCount, "Loading Plot Data" );
for ( auto coll : plotCollections )
{
if ( coll )
{
plotProgress.setNextProgressIncrement( coll->plotCount() );
coll->loadDataAndUpdateAllPlots();
plotProgress.incrementProgress();
}
}
if ( wlpColl )
{
for ( auto wellLogPlot : wlpColl->wellLogPlots() )
@ -562,15 +558,6 @@ void RimMainPlotCollection::loadDataAndUpdateAllPlots()
}
}
if ( scpColl )
{
for ( auto plot : scpColl->plots() )
{
plot->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
if ( flowColl )
{
plotProgress.setNextProgressIncrement( flowColl->plotCount() );
@ -596,15 +583,6 @@ void RimMainPlotCollection::loadDataAndUpdateAllPlots()
}
}
if ( gcpColl )
{
for ( const auto& gcpPlot : gcpColl->plots() )
{
gcpPlot->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
if ( sppColl )
{
for ( const auto& sppPlot : sppColl->plots() )
@ -614,15 +592,6 @@ void RimMainPlotCollection::loadDataAndUpdateAllPlots()
}
}
if ( alsColl )
{
for ( const auto& alsPlot : alsColl->plots() )
{
alsPlot->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
if ( corrColl )
{
for ( const auto& corrPlot : corrColl->plots() )
@ -654,14 +623,5 @@ void RimMainPlotCollection::loadDataAndUpdateAllPlots()
plotProgress.incrementProgress();
}
}
if ( vfpColl )
{
for ( const auto& vfpPlot : vfpColl->plots() )
{
vfpPlot->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
}
}