mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Use set to get unique plots for update
This commit is contained in:
parent
4a1a2fe2be
commit
3545d16fbb
@ -79,7 +79,7 @@ void RiaPlotWindowRedrawScheduler::scheduleMultiPlotPageUpdate( RiuMultiPlotPage
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaPlotWindowRedrawScheduler::schedulePlotWidgetReplot( RiuPlotWidget* plotWidget )
|
||||
{
|
||||
m_plotWidgetsToReplot.push_back( plotWidget );
|
||||
m_plotWidgetsToReplot.insert( plotWidget );
|
||||
|
||||
startTimer( 0 );
|
||||
}
|
||||
@ -107,15 +107,13 @@ void RiaPlotWindowRedrawScheduler::clearAllScheduledUpdates()
|
||||
void RiaPlotWindowRedrawScheduler::performScheduledUpdatesAndReplots()
|
||||
{
|
||||
std::map<QPointer<RiuMultiPlotBook>, RiaDefines::MultiPlotPageUpdateType> plotBooksToUpdate;
|
||||
std::vector<QPointer<RiuPlotWidget>> plotWidgetsToReplot;
|
||||
std::set<QPointer<RiuPlotWidget>> plotWidgetsToReplot;
|
||||
std::map<QPointer<RiuMultiPlotPage>, RiaDefines::MultiPlotPageUpdateType> pagesToUpdate;
|
||||
|
||||
pagesToUpdate.swap( m_plotPagesToUpdate );
|
||||
plotBooksToUpdate.swap( m_plotBooksToUpdate );
|
||||
plotWidgetsToReplot.swap( m_plotWidgetsToReplot );
|
||||
|
||||
std::set<QPointer<RiuPlotWidget>> updatedPlots;
|
||||
|
||||
for ( auto& [plotBook, updateType] : plotBooksToUpdate )
|
||||
{
|
||||
if ( plotBook.isNull() ) continue;
|
||||
@ -137,12 +135,11 @@ void RiaPlotWindowRedrawScheduler::performScheduledUpdatesAndReplots()
|
||||
page->performUpdate( updateType );
|
||||
}
|
||||
|
||||
for ( QPointer<RiuPlotWidget> plot : plotWidgetsToReplot )
|
||||
for ( const QPointer<RiuPlotWidget>& plot : plotWidgetsToReplot )
|
||||
{
|
||||
if ( !plot.isNull() && !updatedPlots.count( plot ) )
|
||||
if ( !plot.isNull() )
|
||||
{
|
||||
plot->replot();
|
||||
updatedPlots.insert( plot );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ private:
|
||||
std::map<QPointer<RiuMultiPlotPage>, RiaDefines::MultiPlotPageUpdateType> m_plotPagesToUpdate;
|
||||
std::map<QPointer<RiuMultiPlotBook>, RiaDefines::MultiPlotPageUpdateType> m_plotBooksToUpdate;
|
||||
|
||||
std::vector<QPointer<RiuPlotWidget>> m_plotWidgetsToReplot;
|
||||
std::set<QPointer<RiuPlotWidget>> m_plotWidgetsToReplot;
|
||||
|
||||
QScopedPointer<QTimer> m_plotWindowUpdateTimer;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user