scoop  0.1.4
Scoop - Simple ColoR pAleTtes and mappERs
scoop::CategoricalColorMap< Category, Hash > Class Template Reference

Class for categorical color maps. More...

#include <CategoricalColorMap.hpp>

+ Collaboration diagram for scoop::CategoricalColorMap< Category, Hash >:

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.
 

Detailed Description

template<class Category = int, class Hash = std::hash< int >>
class scoop::CategoricalColorMap< Category, Hash >

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.

Constructor & Destructor Documentation

template<class Category = int, class Hash = std::hash< int >>
scoop::CategoricalColorMap< Category, Hash >::CategoricalColorMap ( void  )
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().

+ Here is the call graph for this function:

template<class Category , class Hash >
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.

Parameters
[in]categoriesinput categories
[in]paletteinput palette

Definition at line 89 of file CategoricalColorMap.hpp.

References scoop::ColorPalette::colors(), scoop::CategoricalColorMap< Category, Hash >::setColor(), and scoop::ColorPalette::size().

+ Here is the call graph for this function:

Member Function Documentation

template<class Category , class Hash >
const Color & scoop::CategoricalColorMap< Category, Hash >::getColor ( const Category &  category) const

Get a color for a category.

Parameters
[in]categoryinput category

Definition at line 108 of file CategoricalColorMap.hpp.

References scoop::CategoricalColorMap< Category, Hash >::_categoriesToColors.

Referenced by scoop::CategoricalColorMap< Category, Hash >::CategoricalColorMap().

+ Here is the caller graph for this function:

template<class Category , class Hash >
void scoop::CategoricalColorMap< Category, Hash >::setColor ( const Category &  category,
const Color &  color 
)

Set a color for a category.

Parameters
[in]categorycategory which will be associated
[in]colorcolor 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().

+ Here is the caller graph for this function:


The documentation for this class was generated from the following file: