![]() |
Vault
4.1
|
VColorMapper is an abstract base class that defines the API for looking up the colors assigned to a particular data value (string, integer, Vs64, or double). More...
#include <vcolor.h>
Public Member Functions | |
virtual void | readColors (const VSettingsNode &mapperNode, VStringVector *errorList) |
virtual VColorPair | getColors (const VString &stringValue) const =0 |
virtual VColorPair | getColors (int intValue) const =0 |
virtual VColorPair | getColors (Vs64 int64Value) const =0 |
virtual VColorPair | getColors (VDouble doubleValue) const =0 |
void | setDefaultColors (const VColorPair &defaultColors) |
Protected Member Functions | |
virtual void | _readColorElement (const VSettingsNode &colorNode)=0 |
VColorPair | _readColorPair (const VSettingsNode &colorNode) |
Protected Attributes | |
VColorPair | mDefaultColors |
VColorMapper is an abstract base class that defines the API for looking up the colors assigned to a particular data value (string, integer, Vs64, or double).
Concrete subclasses are defined that cover the particular ways that colors can be mapped for the different types, including mapped values and ranges. If a given instance of color map does not support the specified value type directly, it will convert it (for example, if the map defines colors for integers, but you ask for the color for a string, it will try to convert the string to an integer and look that up). When a color is not found for a data value, the default color is returned. If you need to map colors for other data types, convert them to these types. For example, use strings or ints for enums and booleans, and use Vs64 for durations or instants. (The XML syntax allows you to use duration and instant strings, and it will convert them into Vs64 values in a mapper, so your runtime code can lookup up a color for the Vs64 value returned by VDuration::getDurationMilliseconds() or VInstant::getValue().)
Note: I am using the word "mapper" here primarily to avoid collision/confusion with the STL "map" type. It looks weird to have a map of maps. This way, a color palette has a map that finds "mappers" from their names.