scoop
0.1.4
Scoop - Simple ColoR pAleTtes and mappERs
|
Class for categorical color maps. More...
#include <CategoricalColorMap.hpp>
Public Member Functions | |
CategoricalColorMap (void) | |
Default constructor. More... | |
CategoricalColorMap (const std::vector< Category > &categories, const ColorPalette &palette) | |
Constructorbased on a vector of categories and a color palette. More... | |
void | setColor (const Category &category, const Color &color) |
Set a color for a category. More... | |
const Color & | getColor (const Category &category) const |
Get a color for a category. More... | |
Protected Attributes | |
std::unordered_map< Category, Color, Hash > | _categoriesToColors |
Container that associates each category to a color. | |
Class for categorical color maps.
This class allows to define a categorical color mapper. It provides the methods needed to establish the relationship between categories and the associated colors. This class is template because it can be use for different types of categories
Definition at line 41 of file CategoricalColorMap.hpp.
|
inline |
Default constructor.
Creates an empty color mapper
Definition at line 49 of file CategoricalColorMap.hpp.
References scoop::CategoricalColorMap< Category, Hash >::getColor(), and scoop::CategoricalColorMap< Category, Hash >::setColor().
scoop::CategoricalColorMap< Category, Hash >::CategoricalColorMap | ( | const std::vector< Category > & | categories, |
const ColorPalette & | palette | ||
) |
Constructorbased on a vector of categories and a color palette.
This size of the provided categories and the palette has to be the same, otherwise an exception will be raised.
[in] | categories | input categories |
[in] | palette | input palette |
Definition at line 89 of file CategoricalColorMap.hpp.
References scoop::ColorPalette::colors(), scoop::CategoricalColorMap< Category, Hash >::setColor(), and scoop::ColorPalette::size().
const Color & scoop::CategoricalColorMap< Category, Hash >::getColor | ( | const Category & | category | ) | const |
Get a color for a category.
[in] | category | input category |
Definition at line 108 of file CategoricalColorMap.hpp.
References scoop::CategoricalColorMap< Category, Hash >::_categoriesToColors.
Referenced by scoop::CategoricalColorMap< Category, Hash >::CategoricalColorMap().
void scoop::CategoricalColorMap< Category, Hash >::setColor | ( | const Category & | category, |
const Color & | color | ||
) |
Set a color for a category.
[in] | category | category which will be associated |
[in] | color | color to be associated to the category |
Definition at line 101 of file CategoricalColorMap.hpp.
References scoop::CategoricalColorMap< Category, Hash >::_categoriesToColors.
Referenced by scoop::CategoricalColorMap< Category, Hash >::CategoricalColorMap().