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 authored and GitHub committed 2022-03-31 12:34:07 +02:00
1 parent 2eb1713866
commit ebba37a623
15 files changed
+227 -39

No files matched your search

@@ -51,9 +51,17 @@ void RiaPlotWindowRedrawScheduler::scheduleMultiPlotWindowUpdate( RiuMultiPlotBo
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaPlotWindowRedrawScheduler::scheduleMultiPlotPageUpdate( RiuMultiPlotPage* plotPage )
void RiaPlotWindowRedrawScheduler::scheduleMultiPlotPageUpdate( RiuMultiPlotPage* plotPage,
RiaDefines::MultiPlotPageUpdateType updateType )
{
m_plotPagesToUpdate.push_back( plotPage );
if ( m_plotPagesToUpdate.count( plotPage ) == 0 )
{
m_plotPagesToUpdate[plotPage] = updateType;
}
else
{
m_plotPagesToUpdate[plotPage] = m_plotPagesToUpdate[plotPage] | updateType;
}
startTimer( 0 );
}
@@ -90,17 +98,16 @@ void RiaPlotWindowRedrawScheduler::clearAllScheduledUpdates()
//--------------------------------------------------------------------------------------------------
void RiaPlotWindowRedrawScheduler::performScheduledUpdatesAndReplots()
{
std::vector<QPointer<RiuMultiPlotBook>> plotWindowsToUpdate;
std::vector<QPointer<RiuMultiPlotPage>> plotPagesToUpdate;
std::vector<QPointer<RiuPlotWidget>> plotWidgetsToReplot;
std::vector<QPointer<RiuMultiPlotBook>> plotWindowsToUpdate;
std::vector<QPointer<RiuPlotWidget>> plotWidgetsToReplot;
std::map<QPointer<RiuMultiPlotPage>, RiaDefines::MultiPlotPageUpdateType> pagesToUpdate;
pagesToUpdate.swap( m_plotPagesToUpdate );
plotWindowsToUpdate.swap( m_plotWindowsToUpdate );
plotPagesToUpdate.swap( m_plotPagesToUpdate );
plotWidgetsToReplot.swap( m_plotWidgetsToReplot );
std::set<QPointer<RiuPlotWidget>> updatedPlots;
std::set<QPointer<RiuMultiPlotBook>> updatedPlotWindows;
std::set<QPointer<RiuMultiPlotPage>> updatedPlotPages;
for ( QPointer<RiuMultiPlotBook> plotWindow : plotWindowsToUpdate )
{
@@ -108,8 +115,7 @@ void RiaPlotWindowRedrawScheduler::performScheduledUpdatesAndReplots()
{
for ( RiuMultiPlotPage* page : plotWindow->pages() )
{
plotPagesToUpdate.erase( std::remove( plotPagesToUpdate.begin(), plotPagesToUpdate.end(), page ),
plotPagesToUpdate.end() );
if ( pagesToUpdate.count( page ) > 0 ) pagesToUpdate.erase( page );
}
plotWindow->performUpdate();
@@ -117,16 +123,13 @@ void RiaPlotWindowRedrawScheduler::performScheduledUpdatesAndReplots()
}
}
for ( QPointer<RiuMultiPlotPage> plotPage : plotPagesToUpdate )
for ( auto& [page, updateType] : pagesToUpdate )
{
if ( !plotPage.isNull() && !updatedPlotPages.count( plotPage ) )
{
plotPage->performUpdate();
updatedPlotPages.insert( plotPage );
}
if ( page.isNull() ) continue;
page->performUpdate( updateType );
}
// Perform update and replot. Make sure we handle legend update
for ( QPointer<RiuPlotWidget> plot : plotWidgetsToReplot )
{
if ( !plot.isNull() && !updatedPlots.count( plot ) )