From 7c25677d1832f2e2051cc42615824e048013bc2d Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Fri, 20 May 2022 15:32:39 +0200 Subject: [PATCH] Add support for appending curves for summary case and ensemble by stepping --- .../Summary/RimSummaryMultiPlot.cpp | 34 ++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 01919f0185..19004b588e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -1223,18 +1223,36 @@ void RimSummaryMultiPlot::appendCurveByStepping( int direction ) for ( auto curve : plot->allCurves( RimSummaryDataSourceStepping::Axis::Y_AXIS ) ) { - auto address = curve->summaryAddressY(); - auto sumCase = curve->summaryCaseY(); - address = m_sourceStepping->stepAddress( address, direction ); - addresses.push_back( RimSummaryAddress::wrapFileReaderAddress( address, sumCase->caseId() ) ); + auto address = curve->summaryAddressY(); + auto sumCase = curve->summaryCaseY(); + int sumCaseId = sumCase->caseId(); + if ( m_sourceStepping()->stepDimension() == RimSummaryPlotSourceStepping::SourceSteppingDimension::SUMMARY_CASE ) + { + auto nextSumCase = m_sourceStepping->stepCase( direction ); + if ( nextSumCase ) sumCaseId = nextSumCase->caseId(); + } + else + { + address = m_sourceStepping->stepAddress( address, direction ); + } + addresses.push_back( RimSummaryAddress::wrapFileReaderAddress( address, sumCaseId ) ); } for ( auto curveSet : plot->curveSets() ) { - auto address = curveSet->summaryAddress(); - auto sumEns = curveSet->summaryCaseCollection(); - address = m_sourceStepping->stepAddress( address, direction ); - addresses.push_back( RimSummaryAddress::wrapFileReaderAddress( address, -1, sumEns->ensembleId() ) ); + auto address = curveSet->summaryAddress(); + auto sumEns = curveSet->summaryCaseCollection(); + int sumEnsId = sumEns->ensembleId(); + if ( m_sourceStepping()->stepDimension() == RimSummaryPlotSourceStepping::SourceSteppingDimension::ENSEMBLE ) + { + auto nextEns = m_sourceStepping->stepEnsemble( direction ); + if ( nextEns ) sumEnsId = nextEns->ensembleId(); + } + else + { + address = m_sourceStepping->stepAddress( address, direction ); + } + addresses.push_back( RimSummaryAddress::wrapFileReaderAddress( address, -1, sumEnsId ) ); } plot->handleDroppedObjects( addresses );