mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Refactor: extract code for detecting logarithmic result
This commit is contained in:
parent
e9b070c57f
commit
ea3fdef281
@ -71,6 +71,19 @@ bool RiaResultNames::isPerCellFaceResult( const QString& resultName )
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaResultNames::isLogarithmicResult( const QString& resultName )
|
||||
{
|
||||
QStringList subStringsToMatch{ "TRAN", "MULT", "PERM" };
|
||||
|
||||
for ( const auto& s : subStringsToMatch )
|
||||
if ( resultName.contains( s, Qt::CaseInsensitive ) ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -27,6 +27,7 @@
|
||||
namespace RiaResultNames
|
||||
{
|
||||
bool isPerCellFaceResult( const QString& resultName );
|
||||
bool isLogarithmicResult( const QString& resultName );
|
||||
|
||||
QString undefinedResultName();
|
||||
QString undefinedGridFaultName();
|
||||
|
@ -20,6 +20,8 @@
|
||||
|
||||
#include "RimEclipseCellColors.h"
|
||||
|
||||
#include "RiaResultNames.h"
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
@ -184,19 +186,7 @@ RimRegularLegendConfig* RimEclipseCellColors::createLegendForResult( const QStri
|
||||
bool useDiscreteLogLevels,
|
||||
bool isCategoryResult )
|
||||
{
|
||||
bool useLog = false;
|
||||
{
|
||||
QStringList subStringsToMatch{ "TRAN", "MULT", "PERM" };
|
||||
|
||||
for ( const auto& s : subStringsToMatch )
|
||||
{
|
||||
if ( resultName.contains( s, Qt::CaseInsensitive ) )
|
||||
{
|
||||
useLog = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
bool useLog = RiaResultNames::isLogarithmicResult( resultName );
|
||||
|
||||
RimRegularLegendConfig::ColorRangesType colorRangeType = RimRegularLegendConfig::ColorRangesType::UNDEFINED;
|
||||
if ( isCategoryResult )
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "RiaColorTools.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaOptionItemFactory.h"
|
||||
#include "RiaResultNames.h"
|
||||
|
||||
#include "RimEnsembleCurveFilter.h"
|
||||
#include "RimEnsembleCurveFilterCollection.h"
|
||||
@ -831,7 +832,7 @@ void RimEnsembleWellLogCurveSet::updateEnsembleCurves( const std::vector<RimWell
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleWellLogCurveSet::setLogScaleFromSelectedResult( const QString resVar )
|
||||
{
|
||||
if ( resVar.toUpper().contains( "PERM" ) )
|
||||
if ( RiaResultNames::isLogarithmicResult( resVar ) )
|
||||
{
|
||||
RimWellLogTrack* track = nullptr;
|
||||
this->firstAncestorOrThisOfType( track );
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include "RiaColorTables.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaResultNames.h"
|
||||
#include "RiaSimWellBranchTools.h"
|
||||
|
||||
#include "RiaWellLogUnitTools.h"
|
||||
@ -829,18 +830,11 @@ void RimWellLogExtractionCurve::defineUiTreeOrdering( caf::PdmUiTreeOrdering& ui
|
||||
void RimWellLogExtractionCurve::setLogScaleFromSelectedResult()
|
||||
{
|
||||
QString resVar = m_eclipseResultDefinition->resultVariable();
|
||||
|
||||
if ( resVar.toUpper().contains( "PERM" ) )
|
||||
if ( RiaResultNames::isLogarithmicResult( resVar ) )
|
||||
{
|
||||
RimWellLogTrack* track = nullptr;
|
||||
this->firstAncestorOrThisOfType( track );
|
||||
if ( track )
|
||||
{
|
||||
if ( track->curveCount() == 1 )
|
||||
{
|
||||
track->setLogarithmicScale( true );
|
||||
}
|
||||
}
|
||||
if ( track && track->curveCount() == 1 ) track->setLogarithmicScale( true );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user