#827 Refactored CategoryMapper function names and added comments

This commit is contained in:
Magne Sjaastad
2016-09-06 15:35:17 +02:00
parent 8c67ee0a0d
commit 3e40db6ef0
4 changed files with 26 additions and 27 deletions

View File

@@ -18,14 +18,17 @@ class CategoryMapper : public cvf::ScalarMapper
public:
CategoryMapper();
void setCategories(const cvf::IntArray& categoryValues);
void setCategories(const cvf::IntArray& categoryValues, const std::vector<cvf::String>& categoryNames);
void setCategories(const std::vector<int>& categoryValues);
void setCategoriesWithNames(const std::vector<int>& categoryValues, const std::vector<cvf::String>& categoryNames);
void setColors(const cvf::Color3ubArray& colorArray);
// Colors in color array are cycled, if category count is larger than color count, colors are reused
void setCycleColors(const cvf::Color3ubArray& colorArray);
// Colors are interpolated to make sure all categories get a unique color
void setInterpolateColors(const cvf::Color3ubArray& colorArray);
size_t categoryCount() const;
const cvf::String textForCategoryIndex(size_t index) const;
// Overrides used from legend
virtual cvf::Vec2f mapToTextureCoord(double scalarValue) const;
virtual bool updateTexture(cvf::TextureImage* image) const;
@@ -37,13 +40,17 @@ public:
virtual double domainValue(double normalizedValue) const;
private:
friend class CategoryLegend;
size_t categoryCount() const;
const cvf::String textForCategoryIndex(size_t index) const;
int categoryIndexForCategory(double domainValue) const;
private:
cvf::Color3ubArray m_colors;
cvf::uint m_textureSize; // The size of texture that updateTexture() is will produce.
cvf::IntArray m_categoryValues;
std::vector<int> m_categoryValues;
std::vector<cvf::String> m_categoryNames;
};