Aimsun Next Scripting
22
|
Public Types | |
enum | ColorType { eRGB , eHSV } |
Public Member Functions | |
GKColorRamp () | |
~GKColorRamp () | |
const QString & | getName () const |
void | setName (const QString &) |
void | setType (ColorType) |
void | setColors (const QColor &, const QColor &) |
void | setColors (const QColor &, const QColor &, const QColor &) |
void | jet (int) |
void | lines (int) |
void | addColor (const QColor &) |
const QColor | getColor (uint, uint=0) const |
uint | size () const |
Static Public Member Functions | |
static GKColorRamp * | getRamp (const QString &) |
Creates a N colors in a range of colors defined two or more colors. Color 0 will be the from color, color N-1 will be the to color, the other (intermediate) colors will be interpolate among all the available colors.
A ramp of 1 color is posible: only this color will be returned.
Two ramps are created automatically:
Other ramps will be read from XML files in $RESOURCES_HOME/shared/color_ramps. The format of the XML file is: <color_ramp name="RAMP_NAME" type="RAMP_TYPE" coded="RAMP_CODED"> <color>COLOR_DATA</color> <color>COLOR_DATA</color> ... </color_ramp>
Where:
Note that colors are specified in RGB. The RAMP_TYPE is used only in the interpolation.
Example 1: a gray ramp using HEX
Example 2: a gray ramp using DECIMAL
GKColorRamp::GKColorRamp | ( | ) |
GKColorRamp::~GKColorRamp | ( | ) |
void GKColorRamp::addColor | ( | const QColor & | ) |
Adds a color (at the end) to this ramp.
const QColor GKColorRamp::getColor | ( | uint | , |
uint | = 0 |
||
) | const |
The "nbColors" holds how many colors we will use (to know if a interpolation will be needed). If nbColors is 0 then all the possible colors will be used (equivaled to ramp->getColor( pos, ramp->size() ) )
const QString & GKColorRamp::getName | ( | ) | const |
Returns the color ramp name
|
static |
Returns the color ramp by name, if it exists, otherwise returns None.
void GKColorRamp::jet | ( | int | ) |
Configure the color ramp with nbColors following the jet colormap of Matlab.
void GKColorRamp::lines | ( | int | ) |
Configure the color ramp with nbColors following the lines colormap of Matlab.
void GKColorRamp::setColors | ( | const QColor & | , |
const QColor & | |||
) |
Set the two colors to be use to calculate colors in this ramp.
void GKColorRamp::setColors | ( | const QColor & | , |
const QColor & | , | ||
const QColor & | |||
) |
Set the three colors to be use to calculate colors in this ramp.
void GKColorRamp::setName | ( | const QString & | ) |
Sets the color ramp name
void GKColorRamp::setType | ( | ColorType | ) |
Sets the color ramp type, either RGB or HSV.
uint GKColorRamp::size | ( | ) | const |
Returns the number of colors (its size) in this color ramp.