mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5832 Add color legend data with import from LYR file.
This commit is contained in:
committed by
Kristian Bendiksen
parent
3e5c77e79e
commit
6cb86d4792
@@ -44,10 +44,80 @@ QString RigFormationNames::formationNameFromKLayerIdx( size_t Kidx )
|
||||
return m_formationNames[idx];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigFormationNames::formationColorFromKLayerIdx( size_t Kidx, cvf::Color3f* formationColor )
|
||||
{
|
||||
int idx = formationIndexFromKLayerIdx( Kidx );
|
||||
|
||||
if ( idx == -1 || idx >= static_cast<int>( m_formationColors.size() ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( m_formationColors[idx] == undefinedColor() ) return false;
|
||||
|
||||
*formationColor = m_formationColors[idx];
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFormationNames::appendFormationRange( const QString& name, int kStartIdx, int kEndIdx )
|
||||
{
|
||||
appendFormationRangeWithColor( name, undefinedColor(), kStartIdx, kEndIdx );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFormationNames::appendFormationRange( const QString& name, cvf::Color3f color, int kStartIdx, int kEndIdx )
|
||||
{
|
||||
appendFormationRangeWithColor( name, color, kStartIdx, kEndIdx );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFormationNames::appendFormationRangeHeight( const QString& name, int kLayerCount )
|
||||
{
|
||||
if ( kLayerCount < 1 ) return;
|
||||
|
||||
int kStartIdx = static_cast<int>( m_nameIndexPrKLayer.size() );
|
||||
int kEndIdx = kStartIdx + kLayerCount;
|
||||
|
||||
appendFormationRangeWithColor( name, undefinedColor(), kStartIdx, kEndIdx );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFormationNames::appendFormationRangeHeight( const QString& name, cvf::Color3f color, int kLayerCount )
|
||||
{
|
||||
if ( kLayerCount < 1 ) return;
|
||||
|
||||
int kStartIdx = static_cast<int>( m_nameIndexPrKLayer.size() );
|
||||
int kEndIdx = kStartIdx + kLayerCount;
|
||||
|
||||
appendFormationRangeWithColor( name, color, kStartIdx, kEndIdx );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3f RigFormationNames::undefinedColor()
|
||||
{
|
||||
static cvf::Color3f noColor( -1.0f, -1.0f, -1.0f );
|
||||
|
||||
return noColor;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFormationNames::appendFormationRangeWithColor( const QString& name, cvf::Color3f color, int kStartIdx, int kEndIdx )
|
||||
{
|
||||
CVF_ASSERT( kStartIdx <= kEndIdx );
|
||||
|
||||
@@ -64,25 +134,6 @@ void RigFormationNames::appendFormationRange( const QString& name, int kStartIdx
|
||||
{
|
||||
m_nameIndexPrKLayer[kIdx] = nameIdx;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFormationNames::appendFormationRangeHeight( const QString& name, int kLayerCount )
|
||||
{
|
||||
if ( kLayerCount < 1 ) return;
|
||||
|
||||
int nameIdx = static_cast<int>( m_formationNames.size() );
|
||||
|
||||
m_formationNames.push_back( name );
|
||||
|
||||
int kStartIdx = static_cast<int>( m_nameIndexPrKLayer.size() );
|
||||
|
||||
m_nameIndexPrKLayer.resize( kStartIdx + kLayerCount, -1 );
|
||||
|
||||
for ( int kIdx = kStartIdx; kIdx < kStartIdx + kLayerCount; ++kIdx )
|
||||
{
|
||||
m_nameIndexPrKLayer[kIdx] = nameIdx;
|
||||
}
|
||||
|
||||
m_formationColors.push_back( color );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user