Fix curve highlight for non-ensemble curves

This commit is contained in:
Magne Sjaastad 2024-12-05 07:53:14 +01:00
parent 39d19c9826
commit 996a10f781
3 changed files with 24 additions and 2 deletions

View File

@ -335,6 +335,17 @@ size_t RimSummaryEnsembleTools::calculateEnsembleParametersIntersectionHash( con
return commonAddressCount; return commonAddressCount;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimSummaryEnsembleTools::isEnsembleCurve( RimPlotCurve* sourceCurve )
{
auto summaryCurve = dynamic_cast<RimSummaryCurve*>( sourceCurve );
if ( !summaryCurve ) return false;
return summaryCurve->isEnsembleCurve();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -38,6 +38,7 @@ std::vector<RigEnsembleParameter> createVariationSortedEnsembleParameters( const
size_t calculateEnsembleParametersIntersectionHash( const std::vector<RimSummaryCase*>& summaryCases ); size_t calculateEnsembleParametersIntersectionHash( const std::vector<RimSummaryCase*>& summaryCases );
bool isEnsembleCurve( RimPlotCurve* sourceCurve );
void highlightCurvesForSameRealization( RimPlotCurve* sourceCurve ); void highlightCurvesForSameRealization( RimPlotCurve* sourceCurve );
void resetHighlightAllPlots(); void resetHighlightAllPlots();

View File

@ -935,9 +935,19 @@ void RiuQwtPlotWidget::selectClosestPlotItem( const QPoint& pos, bool toggleItem
{ {
bool updateCurveOrder = false; bool updateCurveOrder = false;
resetPlotItemHighlighting( updateCurveOrder ); resetPlotItemHighlighting( updateCurveOrder );
if ( auto curve = dynamic_cast<RiuPlotCurve*>( closestItem ) )
auto curve = dynamic_cast<RiuPlotCurve*>( 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 else
{ {