bpp-core3  3.0.0
bpp::AbstractColorSet Class Reference

Partial implementation of the ColorSet interface. More...

#include <Bpp/Graphics/ColorSet.h>

+ Inheritance diagram for bpp::AbstractColorSet:
+ Collaboration diagram for bpp::AbstractColorSet:

Public Member Functions

 AbstractColorSet ()
 
virtual ~AbstractColorSet ()
 
const RGBColorgetColor (const std::string &name) const
 Get the color object corresponding to a given name. More...
 
const RGBColorgetColor (unsigned int index) const
 Get the ith color object in the set. More...
 
std::vector< std::string > getColorNames () const
 
size_t getNumberOfColors () const
 

Protected Attributes

std::map< std::string, RGBColorcolors_
 

Detailed Description

Partial implementation of the ColorSet interface.

Derivative classes just have to fill the colors_ map in the constructor of the class.

Definition at line 62 of file ColorSet.h.

Constructor & Destructor Documentation

◆ AbstractColorSet()

bpp::AbstractColorSet::AbstractColorSet ( )
inline

Definition at line 69 of file ColorSet.h.

◆ ~AbstractColorSet()

virtual bpp::AbstractColorSet::~AbstractColorSet ( )
inlinevirtual

Definition at line 70 of file ColorSet.h.

Member Function Documentation

◆ getColor() [1/2]

const RGBColor& bpp::AbstractColorSet::getColor ( const std::string &  name) const
inlinevirtual

Get the color object corresponding to a given name.

Parameters
nameThe name of the color to look for.
Returns
The color associated to the given name.
Exceptions
Exceptionif the name is not assigned to any color.

Implements bpp::ColorSet.

Definition at line 73 of file ColorSet.h.

◆ getColor() [2/2]

const RGBColor& bpp::AbstractColorSet::getColor ( unsigned int  index) const
inlinevirtual

Get the ith color object in the set.

Parameters
indexThe index of the color to look for.
Returns
The color associated to the given index.
Exceptions
IndexOutOfBoundsExceptionif the index is not assigned to any color.

Implements bpp::ColorSet.

Definition at line 80 of file ColorSet.h.

◆ getColorNames()

std::vector<std::string> bpp::AbstractColorSet::getColorNames ( ) const
inlinevirtual
Returns
All valid color names.

Implements bpp::ColorSet.

Definition at line 88 of file ColorSet.h.

References bpp::MapTools::getKeys().

◆ getNumberOfColors()

size_t bpp::AbstractColorSet::getNumberOfColors ( ) const
inlinevirtual
Returns
The total number of colors available.

Implements bpp::ColorSet.

Definition at line 90 of file ColorSet.h.

Member Data Documentation

◆ colors_

std::map<std::string, RGBColor> bpp::AbstractColorSet::colors_
protected

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