mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-11 07:56:08 -06:00
#6040 Facies import: use limestone color for calcite.
This commit is contained in:
parent
ed6b96777d
commit
304e370747
@ -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;
|
||||
}
|
||||
|
@ -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 );
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user