|
Robot Simulator of the Robotics Group for Self-Organization of Control
0.8.0
|
A store for colors with a set of aliases. More...
#include <colorschema.h>
Public Types | |
| typedef HashMap< std::string, Color > | ColorMap |
| typedef std::vector< std::string > | AliasVector |
| typedef HashMap< std::string, AliasVector > | AliasMap |
Public Member Functions | |
| ColorSchema () | |
| Color | color (const std::string &name_or_id_or_alias) const |
| retrieves a color with the given name/id/alias if no color is found that matches the id/alias then the default color is returned. More... | |
| Color | color (const std::string &name_or_id_or_alias, int alias_set) const |
| retrieves a color with the given name/id/alias from given alias_set if not found then the default alias_set (0) is checked More... | |
| bool | color (Color &color, const std::string &name_or_id_or_alias, int alias_set=0) const |
| call by reference version returns false if color not found More... | |
| bool | existsColor (const std::string &name) const |
| checks whether color with the name exists (no aliases are checked) More... | |
| int | loadPalette (const std::string &gplfilename) |
| loads a gpl (gimp pallette file) and returns the number loaded colors The name of the colors should not contain white spaces! More... | |
| int | loadAliases (const std::string &filename, int alias_set_offset=0) |
| loads aliases from text file with lines containing: aliasname colorname/id [alias-set] More... | |
| void | addColor (const Color &color, const std::string &name) |
| adds a color to the color store (to add the id call the function twice with id as name) More... | |
| bool | addAlias (const std::string &name, const std::string &alias, int alias_set=0) |
| adds a color alias (into the given alias-set) More... | |
| void | setDefaultColor (const Color &c) |
| const Color & | getDefaultColor () const |
| std::string | getLoadErrorString (int value) const |
| returns error string for value returned by loadPalette and loadAliases More... | |
| void | print (std::ostream &out) const |
| prints all colors and aliases More... | |
Protected Member Functions | |
| bool | getColor (Color &, const std::string &name) const |
A store for colors with a set of aliases.
The alias-sets are numbered where the 0'th plays the role of a default set.
| typedef HashMap<std::string, AliasVector > AliasMap |
| typedef std::vector<std::string> AliasVector |
| ColorSchema | ( | ) |
| bool addAlias | ( | const std::string & | name, |
| const std::string & | alias, | ||
| int | alias_set = 0 |
||
| ) |
adds a color alias (into the given alias-set)
| name | name/id of existing color |
| alias | new name |
| void addColor | ( | const Color & | color, |
| const std::string & | name | ||
| ) |
adds a color to the color store (to add the id call the function twice with id as name)
| Color color | ( | const std::string & | name_or_id_or_alias | ) | const |
retrieves a color with the given name/id/alias if no color is found that matches the id/alias then the default color is returned.
Always the alias-set 0 is checked first
| Color color | ( | const std::string & | name_or_id_or_alias, |
| int | alias_set | ||
| ) | const |
retrieves a color with the given name/id/alias from given alias_set if not found then the default alias_set (0) is checked
| bool color | ( | Color & | color, |
| const std::string & | name_or_id_or_alias, | ||
| int | alias_set = 0 |
||
| ) | const |
call by reference version returns false if color not found
| bool existsColor | ( | const std::string & | name | ) | const |
checks whether color with the name exists (no aliases are checked)
|
protected |
| const Color & getDefaultColor | ( | ) | const |
| std::string getLoadErrorString | ( | int | value | ) | const |
returns error string for value returned by loadPalette and loadAliases
| int loadAliases | ( | const std::string & | filename, |
| int | alias_set_offset = 0 |
||
| ) |
loads aliases from text file with lines containing:
aliasname colorname/id [alias-set]
| alias_set_offset | number that is added to the alias_set number in the file |
| int loadPalette | ( | const std::string & | gplfilename | ) |
loads a gpl (gimp pallette file) and returns the number loaded colors The name of the colors should not contain white spaces!
| void print | ( | std::ostream & | out | ) | const |
prints all colors and aliases
| void setDefaultColor | ( | const Color & | c | ) |