Use consistent formation colors in RFT plots based on formations file order

Palette colors for formations missing from the legend were assigned by position in the per-well zone list, so the same formation could get different colors for different wells. Assign them by order of first appearance in the formations file instead.
This commit is contained in:
Magne Sjaastad committed 2026-10-15 18:01:46 +02:00
1 parent fc6dfb9697
commit 3fea49441d
6 files changed
+60 -11

No files matched your search

@@ -69,7 +69,8 @@ std::optional<double> toOptionalDouble( const QStringList& columns, int index )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::expected<RifWellPathFormationReader::WellFormations, QString> RifWellPathFormationReader::readWellFormations( const QString& filePath )
std::expected<RifWellPathFormationReader::WellFormations, QString> RifWellPathFormationReader::readWellFormations( const QString& filePath,
QStringList* zoneOrder )
{
QFile file( filePath );
if ( !file.open( QFile::ReadOnly | QFile::Text ) )
@@ -77,14 +78,14 @@ std::expected<RifWellPathFormationReader::WellFormations, QString> RifWellPathFo
return std::unexpected( QString( "Failed to open %1" ).arg( filePath ) );
}
return parseWellFormations( QString::fromUtf8( file.readAll() ), filePath );
return parseWellFormations( QString::fromUtf8( file.readAll() ), filePath, zoneOrder );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::expected<RifWellPathFormationReader::WellFormations, QString> RifWellPathFormationReader::parseWellFormations( const QString& content,
const QString& filePath )
std::expected<RifWellPathFormationReader::WellFormations, QString>
RifWellPathFormationReader::parseWellFormations( const QString& content, const QString& filePath, QStringList* zoneOrder )
{
const auto parseFailure = QString( "Failed to parse %1 as a well pick file" ).arg( filePath );
@@ -170,6 +171,7 @@ std::expected<RifWellPathFormationReader::WellFormations, QString> RifWellPathFo
}
formationsPerWell[wellName].push_back( formation );
if ( zoneOrder && !unitName.isEmpty() && !zoneOrder->contains( unitName ) ) zoneOrder->push_back( unitName );
}
if ( formationsPerWell.empty() )