diff --git a/ApplicationCode/Commands/RicImportFaciesFeature.cpp b/ApplicationCode/Commands/RicImportFaciesFeature.cpp index eefe45ebbe..f8b3d2415c 100644 --- a/ApplicationCode/Commands/RicImportFaciesFeature.cpp +++ b/ApplicationCode/Commands/RicImportFaciesFeature.cpp @@ -91,7 +91,8 @@ void RicImportFaciesFeature::onActionTriggered( bool isChecked ) // Try to find a color from the rock type color legend by fuzzy matching names cvf::Color3f color; - if ( !matchByName( it.second, rockTypeColorLegend, color ) ) + if ( !predefinedColorMatch( it.second, rockTypeColorLegend, color ) && + !matchByName( it.second, rockTypeColorLegend, color ) ) { // No match use a random color color = colorTable.cycledColor3f( it.first ); @@ -118,7 +119,7 @@ void RicImportFaciesFeature::setupActionLook( QAction* actionToSetup ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RicImportFaciesFeature::matchByName( const QString name, RimColorLegend* colorLegend, cvf::Color3f& color ) +bool RicImportFaciesFeature::matchByName( const QString& name, RimColorLegend* colorLegend, cvf::Color3f& color ) { // No match if color legend does not exist if ( !colorLegend ) return false; @@ -167,3 +168,24 @@ int RicImportFaciesFeature::computeEditDistance( const QString& a, const QString return RiaStdStringTools::computeEditDistance( aSimplified.toStdString(), bSimplified.toStdString() ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicImportFaciesFeature::predefinedColorMatch( const QString& name, RimColorLegend* colorLegend, cvf::Color3f& color ) +{ + // Calcite should use limestone color + if ( name.toLower().trimmed() == QString( "calcite" ) ) + { + for ( auto i : colorLegend->colorLegendItems() ) + { + if ( i->categoryName() == QString( "Limestone" ) ) + { + color = i->color(); + return true; + } + } + } + + return false; +} diff --git a/ApplicationCode/Commands/RicImportFaciesFeature.h b/ApplicationCode/Commands/RicImportFaciesFeature.h index 651a2ecac1..115bdc8d39 100644 --- a/ApplicationCode/Commands/RicImportFaciesFeature.h +++ b/ApplicationCode/Commands/RicImportFaciesFeature.h @@ -39,6 +39,7 @@ protected: void setupActionLook( QAction* actionToSetup ) override; private: - int computeEditDistance( const QString& a, const QString& b ); - bool matchByName( const QString name, RimColorLegend* colorLegend, cvf::Color3f& color ); + static int computeEditDistance( const QString& a, const QString& b ); + static bool matchByName( const QString& name, RimColorLegend* colorLegend, cvf::Color3f& color ); + static bool predefinedColorMatch( const QString& name, RimColorLegend* colorLegend, cvf::Color3f& color ); };