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 98 of file ColorSet.h.

Constructor & Destructor Documentation

◆ AbstractColorSet()

bpp::AbstractColorSet::AbstractColorSet ( )
inline

Definition at line 105 of file ColorSet.h.

◆ ~AbstractColorSet()

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

Definition at line 106 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 109 of file ColorSet.h.

References colors_.

◆ 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 116 of file ColorSet.h.

References colors_.

◆ getColorNames()

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

Implements bpp::ColorSet.

Definition at line 124 of file ColorSet.h.

References colors_, and bpp::MapTools::getKeys().

◆ getNumberOfColors()

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

Implements bpp::ColorSet.

Definition at line 126 of file ColorSet.h.

References colors_.

Member Data Documentation

◆ colors_


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