#6946 Fix incorrect colors in facies track for non-zero-indexed color legends

This commit is contained in:
Kristian Bendiksen
2020-11-19 11:00:39 +01:00
committed by Magne Sjaastad
parent b04d2aa99a
commit efef18e03e

View File

@@ -2692,12 +2692,20 @@ void RimWellLogTrack::updateResultPropertyNamesOnPlot()
m_formationCase == nullptr ) m_formationCase == nullptr )
return; return;
// TODO: let the user select the color legend instead of just picking the first one...
std::vector<cvf::Color3ub> colors; std::vector<cvf::Color3ub> colors;
std::vector<QString> namesVector;
// Find the largest category number.
int maxCategoryValue = std::numeric_limits<int>::min();
for ( RimColorLegendItem* legendItem : m_colorShadingLegend()->colorLegendItems() ) for ( RimColorLegendItem* legendItem : m_colorShadingLegend()->colorLegendItems() )
{ {
namesVector.push_back( legendItem->categoryName() ); maxCategoryValue = std::max( maxCategoryValue, legendItem->categoryValue() );
}
// Insert each name at index matching the category number.
std::vector<QString> namesVector( maxCategoryValue + 1 );
for ( RimColorLegendItem* legendItem : m_colorShadingLegend()->colorLegendItems() )
{
namesVector[legendItem->categoryValue()] = legendItem->categoryName();
} }
if ( m_overburdenHeight > 0.0 ) if ( m_overburdenHeight > 0.0 )