Aimsun Next Scripting  22
Public Types | Public Member Functions | Static Public Member Functions | List of all members
GKColorRamp Class Reference

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 GKColorRampgetRamp (const QString &)
 

Detailed Description

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

<color_ramp name="GRAY" type="RBG" coded="HEX">
<color>#000000</color>
<color>#ffffff</color>
</color_ramp>

Example 2: a gray ramp using DECIMAL

<color_ramp name="GRAY" type="RBG" coded="DECIMAL">
<color>0 0 0</color>
<color>255 255 255</color>
</color_ramp>

Member Enumeration Documentation

◆ ColorType

Enumerator
eRGB 
eHSV 

Constructor & Destructor Documentation

◆ GKColorRamp()

GKColorRamp::GKColorRamp ( )

◆ ~GKColorRamp()

GKColorRamp::~GKColorRamp ( )

Member Function Documentation

◆ addColor()

void GKColorRamp::addColor ( const QColor &  )

Adds a color (at the end) to this ramp.

◆ getColor()

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() ) )

◆ getName()

const QString & GKColorRamp::getName ( ) const

Returns the color ramp name

◆ getRamp()

static GKColorRamp * GKColorRamp::getRamp ( const QString &  )
static

Returns the color ramp by name, if it exists, otherwise returns None.

◆ jet()

void GKColorRamp::jet ( int  )

Configure the color ramp with nbColors following the jet colormap of Matlab.

◆ lines()

void GKColorRamp::lines ( int  )

Configure the color ramp with nbColors following the lines colormap of Matlab.

◆ setColors() [1/2]

void GKColorRamp::setColors ( const QColor &  ,
const QColor &   
)

Set the two colors to be use to calculate colors in this ramp.

◆ setColors() [2/2]

void GKColorRamp::setColors ( const QColor &  ,
const QColor &  ,
const QColor &   
)

Set the three colors to be use to calculate colors in this ramp.

◆ setName()

void GKColorRamp::setName ( const QString &  )

Sets the color ramp name

◆ setType()

void GKColorRamp::setType ( ColorType  )

Sets the color ramp type, either RGB or HSV.

◆ size()

uint GKColorRamp::size ( ) const

Returns the number of colors (its size) in this color ramp.

© Aimsun SLU
Aimsun ®