Merge pull request #5431 from OPM/default-log-legend

Color Legend : Set log as default color legend for results based on substring match
This commit is contained in:
Magne Sjaastad 2020-01-29 08:21:37 +01:00 committed by GitHub
commit 256c91572b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -143,11 +143,30 @@ void RimEclipseCellColors::changeLegendConfig( QString resultVarNameOfNewLegend
}
}
// Not found ?
if ( !found )
{
RimRegularLegendConfig* newLegend = new RimRegularLegendConfig;
newLegend->resultVariableName = resultVarNameOfNewLegend;
bool useLog = false;
{
QStringList subStringsToMatch{"TRAN", "MULT", "PERM"};
for ( const auto& s : subStringsToMatch )
{
if ( resultVarNameOfNewLegend.contains( s, Qt::CaseInsensitive ) )
{
useLog = true;
}
}
}
if ( useLog )
{
newLegend->setMappingMode( RimRegularLegendConfig::LOG10_CONTINUOUS );
newLegend->setTickNumberFormat( RimRegularLegendConfig::AUTO );
}
m_legendConfigData.push_back( newLegend );
this->m_legendConfigPtrField = newLegend;