MEPP2 Project
|
This templated class may be used to (linearly) convert scalar values in a given range into a color in a gradient defined by two or more colors. More...
#include <GradientColorMap.h>
Public Types | |
using | Value = PValue |
Public Member Functions | |
GradientColorMap ()=delete | |
GradientColorMap (const Value &_min, const Value &_max, const Color &_firstColor, const Color &_lastColor) | |
GradientColorMap (const GradientColorMap &_other) | |
~GradientColorMap ()=default | |
Color | operator() (const Value &_value) const |
GradientColorMap & | operator= (const GradientColorMap &_other) |
void | addColor (const Color &_color) |
void | clear () |
const Value & | minValue () const |
const Value & | maxValue () const |
Static Public Member Functions | |
static Color | getColor (const std::vector< Color > &_colors, const Value &_min, const Value &_max, const Value &_value) |
Protected Attributes | |
Value | myMin |
Value | myMax |
std::vector< Color > | myColors |
This templated class may be used to (linearly) convert scalar values in a given range into a color in a gradient defined by two or more colors.
class GradientColorMap
The GradientColorMap can be used either as a functor object (the value range is given at the object's construction, together with the reference color) which converts a value into a Color structure, or it can be used through a static method taking both the range and the value as parameters.
The code below shows a possible use of this class.
PValue | The type of the range values. |
Sebas tien .Four ey@g reyc. ensi caen. fr
) Groupe de Recherche en Informatique, Image, Automatique et Instrumentation de Caen - GREYC (CNRS, UMR 6072), ENSICAEN, France Definition at line 59 of file GradientColorMap.h.
using FEVV::GradientColorMap< PValue >::Value = PValue |
Definition at line 63 of file GradientColorMap.h.
|
delete |
Constructor.
|
inline |
Constructor.
_min | The lower bound of the value range. |
_max | The upper bound of the value range. |
_firstColor | The "left" color of the gradient. |
_lastColor | The "right" color of the gradient. |
Definition at line 15 of file GradientColorMap.inl.
|
inline |
Copy constructor.
_other | The object to clone. |
Definition at line 32 of file GradientColorMap.inl.
|
default |
Destructor.
|
inline |
Adds a color to the list of color steps.
_color | A color. |
Definition at line 65 of file GradientColorMap.inl.
|
inline |
Clears the list of colors.
Definition at line 72 of file GradientColorMap.inl.
|
inlinestatic |
Computes the color associated with a value in a given range.
_colors | The gradients boundary colors. |
_min | The lower bound of the value range. |
_max | The upper bound of the value range. |
_value | A value within the value range. |
Definition at line 93 of file GradientColorMap.inl.
|
inline |
Returns the upper bound of the value range.
Definition at line 86 of file GradientColorMap.inl.
|
inline |
Returns the lower bound of the value range.
Definition at line 79 of file GradientColorMap.inl.
|
inline |
Computes the color associated with a value in a given range.
_value | A value within the value range. |
Definition at line 58 of file GradientColorMap.inl.
FEVV::GradientColorMap< PValue > & FEVV::GradientColorMap< PValue >::operator= | ( | const GradientColorMap< PValue > & | _other | ) |
Assignment.
_other | The object to copy. |
Definition at line 42 of file GradientColorMap.inl.
|
protected |
The gradients boundary colors.
Definition at line 161 of file GradientColorMap.h.
|
protected |
The upper bound of the value range.
Definition at line 160 of file GradientColorMap.h.
|
protected |
The lower bound of the value range.
Definition at line 159 of file GradientColorMap.h.