This commit is contained in:
Jacob Støren
2017-03-21 08:49:45 +01:00
parent 888db49d6c
commit c9ca130a2e
2 changed files with 6 additions and 4 deletions

View File

@@ -626,20 +626,22 @@ void RimLegendConfig::setCategoryItems(const std::vector< std::tuple<QString, in
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimLegendConfig::categoryNameFromCategoryValue(int categoryValue) const
QString RimLegendConfig::categoryNameFromCategoryValue(double categoryResultValue) const
{
if (categoryResultValue == HUGE_VAL) return "Undefined";
if (m_categoryNames.size() > 0)
{
for (size_t categoryIndex = 0; categoryIndex < m_categories.size(); categoryIndex++)
{
if (categoryValue == m_categories[categoryIndex])
if (categoryResultValue == m_categories[categoryIndex])
{
return cvfqt::Utils::toQString(m_categoryNames[categoryIndex]);
}
}
}
return QString("%1").arg(categoryValue);
return QString("%1").arg(categoryResultValue);
}
//--------------------------------------------------------------------------------------------------

View File

@@ -111,7 +111,7 @@ public:
void setIntegerCategories(const std::vector<int>& categories);
void setNamedCategoriesInverse(const std::vector<QString>& categoryNames);
void setCategoryItems(const std::vector<std::tuple<QString, int, cvf::Color3ub>>& categories);
QString categoryNameFromCategoryValue(int categoryValue) const;
QString categoryNameFromCategoryValue(double categoryResultValue) const;
void setTitle(const cvf::String& title);