From d578771a40e17bb5113187a753d188b7bfe5e7da Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 5 Jan 2022 13:31:58 +0100 Subject: [PATCH] #8411 Flow Cell Results : Set useful default legend --- ApplicationLibCode/Application/RiaResultNames.cpp | 11 +++++++++++ ApplicationLibCode/Application/RiaResultNames.h | 1 + .../ProjectDataModel/RimEclipseCellColors.cpp | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/ApplicationLibCode/Application/RiaResultNames.cpp b/ApplicationLibCode/Application/RiaResultNames.cpp index a1e8dbbe51..0e96b96946 100644 --- a/ApplicationLibCode/Application/RiaResultNames.cpp +++ b/ApplicationLibCode/Application/RiaResultNames.cpp @@ -84,6 +84,17 @@ bool RiaResultNames::isLogarithmicResult( const QString& resultName ) return false; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiaResultNames::isFlowResultWithBothPosAndNegValues( const QString& resultName ) +{ + if ( resultName.startsWith( "FLR", Qt::CaseInsensitive ) ) return true; + if ( resultName.startsWith( "FLO", Qt::CaseInsensitive ) ) return true; + + return false; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/RiaResultNames.h b/ApplicationLibCode/Application/RiaResultNames.h index 3b61434fa7..1d0974375a 100644 --- a/ApplicationLibCode/Application/RiaResultNames.h +++ b/ApplicationLibCode/Application/RiaResultNames.h @@ -28,6 +28,7 @@ namespace RiaResultNames { bool isPerCellFaceResult( const QString& resultName ); bool isLogarithmicResult( const QString& resultName ); +bool isFlowResultWithBothPosAndNegValues( const QString& resultName ); QString undefinedResultName(); QString undefinedGridFaultName(); diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCellColors.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseCellColors.cpp index b57b37133a..3219429b31 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCellColors.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCellColors.cpp @@ -208,6 +208,12 @@ RimRegularLegendConfig* RimEclipseCellColors::createLegendForResult( const QStri newLegend->resetUserDefinedValues(); } + if ( RiaResultNames::isFlowResultWithBothPosAndNegValues( resultName ) ) + { + colorRangeType = RimRegularLegendConfig::ColorRangesType::BLUE_WHITE_RED; + newLegend->setCenterLegendAroundZero( true ); + } + if ( colorRangeType != RimRegularLegendConfig::ColorRangesType::UNDEFINED ) { RimColorLegend* colorLegend = RimRegularLegendConfig::mapToColorLegend( colorRangeType );