#6252 Category Colors : Name and corresponding color do not match

Set category data directly to the category mapper with no reverse ordering
When drawing the color legend, always draw categories with lower index first
This commit is contained in:
Magne Sjaastad
2020-08-14 08:52:59 +02:00
parent e61b97f836
commit d276d0eefe
7 changed files with 30 additions and 51 deletions

View File

@@ -214,7 +214,7 @@ RimRegularLegendConfig::~RimRegularLegendConfig()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimRegularLegendConfig::setNamedCategories( const std::vector<QString>& categoryNames, bool inverse )
void RimRegularLegendConfig::setNamedCategories( const std::vector<QString>& categoryNames )
{
std::list<int> nameIndices;
std::list<cvf::String> names;
@@ -222,16 +222,8 @@ void RimRegularLegendConfig::setNamedCategories( const std::vector<QString>& cat
int categoriesCount = static_cast<int>( categoryNames.size() );
for ( int i = 0; i < categoriesCount; i++ )
{
if ( !inverse )
{
nameIndices.push_back( i );
names.push_back( cvfqt::Utils::toString( categoryNames[i] ) );
}
else
{
nameIndices.push_front( i );
names.push_front( cvfqt::Utils::toString( categoryNames[i] ) );
}
nameIndices.push_back( i );
names.push_back( cvfqt::Utils::toString( categoryNames[i] ) );
}
m_categories = std::vector<int>( nameIndices.begin(), nameIndices.end() );
@@ -766,22 +758,6 @@ void RimRegularLegendConfig::setIntegerCategories( const std::vector<int>& categ
updateLegend();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimRegularLegendConfig::setNamedCategories( const std::vector<QString>& categoryNames )
{
setNamedCategories( categoryNames, false );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimRegularLegendConfig::setNamedCategoriesInverse( const std::vector<QString>& categoryNames )
{
setNamedCategories( categoryNames, true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------