diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.cpp index f869e6136b..53b1b0bd97 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.cpp @@ -416,16 +416,29 @@ void RimSummaryEnsembleTools::highlightCurvesForSummaryCases( const std::vector< if ( plot->curveSets().empty() ) continue; std::vector curvesForSameRealization; + std::vector curvesInScope; for ( const auto& curveSet : plot->curveSets() ) { + std::vector curvesInCurveSet; + bool curveSetContainsSourceCase = false; + for ( auto ensembleCurve : curveSet->curves() ) { + curvesInCurveSet.push_back( ensembleCurve ); + auto summaryCaseY = ensembleCurve->summaryCaseY(); if ( std::find( sourceCases.begin(), sourceCases.end(), summaryCaseY ) != sourceCases.end() ) { curvesForSameRealization.push_back( ensembleCurve ); + curveSetContainsSourceCase = true; } } + + // Only curve sets containing a selected case participate in dimming, so curves from other ensembles are left unchanged. + if ( curveSetContainsSourceCase ) + { + curvesInScope.insert( curvesInScope.end(), curvesInCurveSet.begin(), curvesInCurveSet.end() ); + } } bool updateCurveOrder = false; @@ -437,7 +450,7 @@ void RimSummaryEnsembleTools::highlightCurvesForSummaryCases( const std::vector< curvesForSameRealization.erase( std::unique( curvesForSameRealization.begin(), curvesForSameRealization.end() ), curvesForSameRealization.end() ); - plotWidget->highlightCurvesUpdateOrder( curvesForSameRealization ); + plotWidget->highlightCurvesUpdateOrder( curvesForSameRealization, curvesInScope ); } plotWidget->replot(); diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp index c8cf92869f..7990e9dfa3 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp @@ -1098,9 +1098,9 @@ void RiuQwtPlotWidget::replot() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::highlightCurvesUpdateOrder( const std::vector& curves ) +void RiuQwtPlotWidget::highlightCurvesUpdateOrder( const std::vector& curves, const std::vector& curvesInScope ) { - highlightPlotCurves( curves ); + highlightPlotCurves( curves, curvesInScope ); updateCurveOrder(); } @@ -1108,7 +1108,7 @@ void RiuQwtPlotWidget::highlightCurvesUpdateOrder( const std::vector& curves ) +void RiuQwtPlotWidget::highlightPlotCurves( const std::vector& curves, const std::vector& curvesInScope ) { if ( !m_plotDefinition || !m_plotDefinition->isCurveHighlightSupported() ) { @@ -1128,6 +1128,12 @@ void RiuQwtPlotWidget::highlightPlotCurves( const std::vector& cu // manipulation if ( !currentRimPlotCurve ) continue; + // When a scope is provided, only curves inside the scope are processed. Curves outside the scope are left untouched. + if ( !curvesInScope.empty() && std::find( curvesInScope.begin(), curvesInScope.end(), currentRimPlotCurve ) == curvesInScope.end() ) + { + continue; + } + auto* plotCurve = dynamic_cast( plotItem ); if ( plotCurve ) { diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h index 6fa3842dfb..50b4dbd2be 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h @@ -162,9 +162,9 @@ public: QwtAxisId toQwtPlotAxis( RiuPlotAxis axis ) const; - void highlightPlotItem( const QwtPlotItem* plotItem ); - void highlightCurvesUpdateOrder( const std::vector& curves ); - void resetPlotItemHighlighting( bool doUpdateCurveOrder = true ); + void highlightPlotItem( const QwtPlotItem* plotItem ); + void highlightCurvesUpdateOrder( const std::vector& curves, const std::vector& curvesInScope = {} ); + void resetPlotItemHighlighting( bool doUpdateCurveOrder = true ); std::vector> highlightedCurves() const; void replot() override; @@ -211,7 +211,7 @@ private: void highlightPlotAxes( QwtAxisId axisIdX, QwtAxisId axisIdY ); void highlightPlotItemsForQwtAxis( QwtAxisId axisId ); - void highlightPlotCurves( const std::vector& curves ); + void highlightPlotCurves( const std::vector& curves, const std::vector& curvesInScope = {} ); void highlightPlotShapeItems( const std::set& closestItems ); void resetPlotCurveHighlighting(); void resetPlotShapeItemHighlighting();