codac
Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
codac::ColorMap Class Reference

Associates colors to a range of values. More...

#include <codac_ColorMap.h>

Collaboration diagram for codac::ColorMap:
Collaboration graph
[legend]

Public Member Functions

 ColorMap (InterpolMode interpol_mode=InterpolMode::RGB)
 Creates a color map. More...
 
 ~ColorMap ()
 ColorMap destructor.
 
const ColorMapoperator= (const ColorMap &x)
 Returns a copy of a ColorMap. More...
 
void add_color_point (rgb color, float index)
 Adds a RGB color point to the map. More...
 
void add_color_point (hsv color, float index)
 Adds a HSV color point to the map. More...
 
void reverse ()
 Reverses the keys of the color map.
 
void set_opacity (float alpha)
 Sets a constant opacity to all colors of the map. More...
 
bool is_opaque () const
 Returns true of all colors are opaque. More...
 
rgb color (double r) const
 Evaluates the color map at \(r\), \(r\in[0,1]\). More...
 
rgb color (double t, const Trajectory &f) const
 Evaluates the color map at \(f(t)\), \(t\in[t_0,t_f]\). More...
 
void displayColorMap (const std::string &fig_name="Color map") const
 Creates a VIBesFig with the colors of the map. More...
 

Static Public Attributes

static const ColorMap HAXBY
 predefined HAXBY color map (mainly used for DEM)
 
static const ColorMap DEFAULT
 a predefined default color map
 
static const ColorMap BLUE_TUBE
 a predefined color map for tubes
 
static const ColorMap RED_TUBE
 a predefined color map for tubes
 
static const ColorMap RAINBOW
 a predefined color map
 

Protected Attributes

InterpolMode m_interpol_mode = InterpolMode::RGB
 interpolation mode
 
std::map< float, rgbm_colormap
 map of colors
 

Detailed Description

Associates colors to a range of values.

Constructor & Destructor Documentation

◆ ColorMap()

codac::ColorMap::ColorMap ( InterpolMode  interpol_mode = InterpolMode::RGB)

Creates a color map.

Parameters
interpol_modemode defining in which color space the color interpolation will be made (RGB by default)

Member Function Documentation

◆ operator=()

const ColorMap& codac::ColorMap::operator= ( const ColorMap x)

Returns a copy of a ColorMap.

Parameters
xthe ColorMap object to be copied
Returns
a new ColorMap object with same values

◆ add_color_point() [1/2]

void codac::ColorMap::add_color_point ( rgb  color,
float  index 
)

Adds a RGB color point to the map.

Parameters
colorRGB color to be added
indexkey associated to the color (any float value)

◆ add_color_point() [2/2]

void codac::ColorMap::add_color_point ( hsv  color,
float  index 
)

Adds a HSV color point to the map.

Parameters
colorHSV color to be added
indexkey associated to the color (any float value)

◆ set_opacity()

void codac::ColorMap::set_opacity ( float  alpha)

Sets a constant opacity to all colors of the map.

Parameters
alphaopacity value, between 0. (transparent) and 1. (opaque)

◆ is_opaque()

bool codac::ColorMap::is_opaque ( ) const

Returns true of all colors are opaque.

Returns
opacity test of the map

◆ color() [1/2]

rgb codac::ColorMap::color ( double  r) const

Evaluates the color map at \(r\), \(r\in[0,1]\).

If r is not a key of the map, an interpolation is made to compute the corresponding color, according to the selected mode.

Parameters
rinput, between 0 and 1
Returns
an RGB color

◆ color() [2/2]

rgb codac::ColorMap::color ( double  t,
const Trajectory f 
) const

Evaluates the color map at \(f(t)\), \(t\in[t_0,t_f]\).

If \(f(t)\) is not a key of the map, an interpolation is made to compute the corresponding color, according to the selected mode.

Parameters
tinput, between 0 and 1
fthe trajectory function
Returns
an RGB color

◆ displayColorMap()

void codac::ColorMap::displayColorMap ( const std::string &  fig_name = "Color map") const

Creates a VIBesFig with the colors of the map.

Parameters
fig_namea reference to the figure that will be displayed in the window's title

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