mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-01 03:37:15 -06:00
Improve performance when creating multiple plots
This commit is contained in:
parent
cf7f00880a
commit
317c737a22
@ -146,11 +146,33 @@ void RiaPlotWindowRedrawScheduler::performScheduledUpdatesAndReplots()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaPlotWindowRedrawScheduler::blockScheduledUpdatesAndReplots()
|
||||
{
|
||||
m_blockScheduledUpdatesAndReplots = true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaPlotWindowRedrawScheduler::unblockScheduledUpdatesAndReplots()
|
||||
{
|
||||
m_blockScheduledUpdatesAndReplots = false;
|
||||
startTimer( 0 );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaPlotWindowRedrawScheduler::slotUpdateAndReplotScheduledItemsWhenReady()
|
||||
{
|
||||
if ( m_blockScheduledUpdatesAndReplots )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( caf::ProgressState::isActive() )
|
||||
{
|
||||
startTimer( 100 );
|
||||
|
@ -48,6 +48,9 @@ public:
|
||||
void clearAllScheduledUpdates();
|
||||
void performScheduledUpdatesAndReplots();
|
||||
|
||||
void blockScheduledUpdatesAndReplots();
|
||||
void unblockScheduledUpdatesAndReplots();
|
||||
|
||||
private slots:
|
||||
void slotUpdateAndReplotScheduledItemsWhenReady();
|
||||
|
||||
@ -64,4 +67,5 @@ private:
|
||||
std::set<QPointer<RiuPlotWidget>> m_plotWidgetsToReplot;
|
||||
|
||||
QScopedPointer<QTimer> m_plotWindowUpdateTimer;
|
||||
bool m_blockScheduledUpdatesAndReplots = false;
|
||||
};
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaPlotWindowRedrawScheduler.h"
|
||||
#include "RiaStdStringTools.h"
|
||||
#include "RiaSummaryAddressAnalyzer.h"
|
||||
#include "RiaSummaryTools.h"
|
||||
@ -68,6 +69,9 @@ void RicAppendSummaryPlotsForObjectsFeature::appendPlots( RimSummaryMultiPlot*
|
||||
|
||||
caf::ProgressInfo info( sumAddressCollections.size(), "Appending plots..." );
|
||||
|
||||
summaryMultiPlot->startBatchAddOperation();
|
||||
RiaPlotWindowRedrawScheduler::instance()->blockScheduledUpdatesAndReplots();
|
||||
|
||||
for ( auto summaryAdrCollection : sumAddressCollections )
|
||||
{
|
||||
auto duplicatedPlots = RicSummaryPlotBuilder::duplicateSummaryPlots( plotsForOneInstance );
|
||||
@ -108,11 +112,16 @@ void RicAppendSummaryPlotsForObjectsFeature::appendPlots( RimSummaryMultiPlot*
|
||||
summaryMultiPlot->addPlot( duplicatedPlot );
|
||||
duplicatedPlot->resolveReferencesRecursively();
|
||||
}
|
||||
|
||||
duplicatedPlot->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
info.incrementProgress();
|
||||
}
|
||||
summaryMultiPlot->endBatchAddOperation();
|
||||
|
||||
RiaPlotWindowRedrawScheduler::instance()->clearAllScheduledUpdates();
|
||||
RiaPlotWindowRedrawScheduler::instance()->unblockScheduledUpdatesAndReplots();
|
||||
|
||||
summaryMultiPlot->loadDataAndUpdate();
|
||||
|
||||
summaryMultiPlot->updatePlotTitles();
|
||||
}
|
||||
@ -273,6 +282,13 @@ bool RicAppendSummaryPlotsForObjectsFeature::isSelectionCompatibleWithPlot( cons
|
||||
errorText = "Source plot must contain at least one region to be able to duplicate a selection of regions";
|
||||
}
|
||||
}
|
||||
else if ( selectionType == RimSummaryAddressCollection::CollectionContentType::NETWORK )
|
||||
{
|
||||
if ( analyzer.networkNames().empty() )
|
||||
{
|
||||
errorText = "Source plot must contain at least one network to be able to duplicate a selection of networks";
|
||||
}
|
||||
}
|
||||
|
||||
if ( !errorText.isEmpty() )
|
||||
{
|
||||
@ -294,6 +310,7 @@ std::vector<RimSummaryPlot*>
|
||||
|
||||
std::string wellNameToMatch;
|
||||
std::string groupNameToMatch;
|
||||
std::string networkNameToMatch;
|
||||
int regionToMatch = -1;
|
||||
int caseIdToMatch = -1;
|
||||
int ensembleIdToMatch = -1;
|
||||
@ -317,6 +334,10 @@ std::vector<RimSummaryPlot*>
|
||||
{
|
||||
if ( !myAnalyser.regionNumbers().empty() ) regionToMatch = *( myAnalyser.regionNumbers().begin() );
|
||||
}
|
||||
else if ( objectType == RimSummaryAddressCollection::CollectionContentType::NETWORK )
|
||||
{
|
||||
if ( !myAnalyser.networkNames().empty() ) networkNameToMatch = *( myAnalyser.networkNames().begin() );
|
||||
}
|
||||
else if ( objectType == RimSummaryAddressCollection::CollectionContentType::SUMMARY_CASE )
|
||||
{
|
||||
if ( !sourcePlots.empty() )
|
||||
@ -368,6 +389,10 @@ std::vector<RimSummaryPlot*>
|
||||
{
|
||||
isMatching = true;
|
||||
}
|
||||
else if ( !networkNameToMatch.empty() && a.networkName() == networkNameToMatch )
|
||||
{
|
||||
isMatching = true;
|
||||
}
|
||||
else if ( regionToMatch != -1 && a.regionNumber() == regionToMatch )
|
||||
{
|
||||
isMatching = true;
|
||||
|
Loading…
Reference in New Issue
Block a user