From 996a10f781db1a0c9af5d1d30f4be4f2904e0d20 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 5 Dec 2024 07:53:14 +0100 Subject: [PATCH] Fix curve highlight for non-ensemble curves --- .../Summary/RimSummaryEnsembleTools.cpp | 11 +++++++++++ .../Summary/RimSummaryEnsembleTools.h | 1 + .../UserInterface/RiuQwtPlotWidget.cpp | 14 ++++++++++++-- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.cpp index e1a107334a..49142e9525 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.cpp @@ -335,6 +335,17 @@ size_t RimSummaryEnsembleTools::calculateEnsembleParametersIntersectionHash( con return commonAddressCount; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimSummaryEnsembleTools::isEnsembleCurve( RimPlotCurve* sourceCurve ) +{ + auto summaryCurve = dynamic_cast( sourceCurve ); + if ( !summaryCurve ) return false; + + return summaryCurve->isEnsembleCurve(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.h index 37843a6a8f..5974b668b4 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsembleTools.h @@ -38,6 +38,7 @@ std::vector createVariationSortedEnsembleParameters( const size_t calculateEnsembleParametersIntersectionHash( const std::vector& summaryCases ); +bool isEnsembleCurve( RimPlotCurve* sourceCurve ); void highlightCurvesForSameRealization( RimPlotCurve* sourceCurve ); void resetHighlightAllPlots(); diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp index fed3552ddd..203b17c0dd 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp @@ -935,9 +935,19 @@ void RiuQwtPlotWidget::selectClosestPlotItem( const QPoint& pos, bool toggleItem { bool updateCurveOrder = false; resetPlotItemHighlighting( updateCurveOrder ); - if ( auto curve = dynamic_cast( closestItem ) ) + + auto curve = dynamic_cast( closestItem ); + if ( curve && curve->ownerRimCurve() ) { - RimSummaryEnsembleTools::highlightCurvesForSameRealization( curve->ownerRimCurve() ); + const auto rimCurve = curve->ownerRimCurve(); + if ( RimSummaryEnsembleTools::isEnsembleCurve( rimCurve ) ) + { + RimSummaryEnsembleTools::highlightCurvesForSameRealization( rimCurve ); + } + else + { + highlightCurvesUpdateOrder( { rimCurve } ); + } } else {