Tulip
6.0.0
Large graphs analysis and drawing
|
#include <ColorScale.h>
Public Member Functions | |
ColorScale () | |
ColorScale (const ColorScale &scale) | |
ColorScale (const std::map< float, Color > &colorMap, const bool gradient=true) | |
ColorScale (const std::vector< Color > &colors, const bool gradient=true) | |
void | clear () |
bool | colorScaleInitialized () const |
virtual Color | getColorAtPos (const float pos) const |
const std::map< float, Color > & | getColorMap () const |
unsigned int | getStopsCount () |
bool | hasRegularStops () const |
bool | isGradient () const |
bool | operator!= (const ColorScale &cs) const |
ColorScale & | operator= (const ColorScale &scale) |
bool | operator== (const ColorScale &cs) const |
bool | operator== (const std::vector< Color > &colors) const |
virtual void | setColorAtPos (const float pos, const Color &color) |
void | setColorMap (const std::map< float, Color > &colorMap) |
void | setColorMapTransparency (unsigned char transparency) |
virtual void | setColorScale (const std::vector< Color > &colors, const bool gradient=true) |
void | setGradient (const bool g) |
Public Member Functions inherited from tlp::Observable | |
void | addListener (Observable &listener) const |
void | addListener (Observable *const listener) const |
void | addObserver (Observable &observer) const |
void | addObserver (Observable *const observer) const |
unsigned int | countListeners () const |
unsigned int | countObservers () const |
unsigned int | getReceived () const |
unsigned int | getSent () const |
void | removeListener (Observable &listener) const |
void | removeListener (Observable *const listener) const |
void | removeObserver (Observable &observer) const |
void | removeObserver (Observable *const observer) const |
Protected Attributes | |
std::map< float, Color > | colorMap |
bool | gradient |
Additional Inherited Members | |
Static Public Member Functions inherited from tlp::Observable | |
static void | disableEventNotification () |
static void | enableEventNotification () |
static tlp::node | getNode (const tlp::Observable *obs) |
static Observable * | getObject (tlp::node n) |
static const tlp::VectorGraph & | getObservableGraph () |
static unsigned int | getScheduled (tlp::node n) |
static void | holdObservers () |
static bool | isAlive (tlp::node n) |
static unsigned int | observersHoldCounter () |
static void | unholdObservers () |
Protected Member Functions inherited from tlp::Observable | |
Observable (const Observable &) | |
bool | hasOnlookers () const |
void | observableDeleted () |
Observable & | operator= (const Observable &) |
void | sendEvent (const Event &message) |
virtual void | treatEvent (const Event &message) |
virtual void | treatEvents (const std::vector< Event > &events) |
This class represents a color scale to perform color mapping. The color scale can be either a gradient or defined by colors associated to consecutive intervals. If the color scale is a gradient, returned colors are interpolated in function of a position between 0.0 and 1.0. If the color scale is not a gradient returned colors are computed according to the interval the position belongs to.
Definition at line 62 of file ColorScale.h.
tlp::ColorScale::ColorScale | ( | ) |
Initializes a color scale with a default set of colors.
tlp::ColorScale::ColorScale | ( | const std::vector< Color > & | colors, |
const bool | gradient = true |
||
) |
Initializes a color scale with a set of colors passed as parameter.
colors | a vector of colors defining the color scale (first color is at position 0.0, last color at position 1.0) |
gradient | specifies if the color scale should be a gradient or not |
tlp::ColorScale::ColorScale | ( | const std::map< float, Color > & | colorMap, |
const bool | gradient = true |
||
) |
Initializes a color scale with a map of stop points and colors passed as parameter.
colorMap | a map of stop points and colors defining the color scale (The keys of the map must be between 0.0 and 1.0, other ones will be ignored.) |
gradient | specifies if the color scale should be a gradient or not |
|
inline |
|
inline |
Returns true is the color scale was initialized.
Definition at line 154 of file ColorScale.h.
|
virtual |
Returns the color for a given position in the color scale.
This method computes the color associated to a specific position in the color scale and returns it.
pos | This value defines the position of the color in the scale and must be between 0.0 and 1.0 (it will be clamped otherwise) |
|
inline |
Returns a map corresponding to the color scale. The index of the map is the position for the corresponding color in the color scale. The index is comprised between 0 and 1.
Definition at line 164 of file ColorScale.h.
|
inline |
Gets the number of stops points into the color scale.
Definition at line 110 of file ColorScale.h.
bool tlp::ColorScale::hasRegularStops | ( | ) | const |
Tests if the color scale has regular stop points, meaning the distance between each consecutive stop is constant.
|
inline |
Returns true if the color scale is a gradient.
Definition at line 180 of file ColorScale.h.
|
inline |
Tests color scale difference with another one.
Definition at line 209 of file ColorScale.h.
|
inline |
Tests color scale equality with another one.
Definition at line 201 of file ColorScale.h.
bool tlp::ColorScale::operator== | ( | const std::vector< Color > & | colors | ) | const |
Tests color scale equality with a regular one defined by a vector of colors.
|
virtual |
Adds a color to the color scale at specific position.
This method adds a color to the color scale at a specific position.
pos | the position in the color scale (0.0 <= pos <= 1.0) |
color | the color to add at the specified position |
void tlp::ColorScale::setColorMap | ( | const std::map< float, Color > & | colorMap | ) |
Sets the map of stop points and colors used to perform color mapping.
void tlp::ColorScale::setColorMapTransparency | ( | unsigned char | transparency | ) |
Sets the transparency of all the colors in the underlying map.
|
virtual |
Configures the color scale with regular stop points.
This method configures the color scale from a vector of colors and associates regular stop points to them.
colors | the colors to use in the color scale |
gradient | if set to true, color scale is a gradient |
|
inline |
specify whether the color scale must be considered as a gradient
Definition at line 187 of file ColorScale.h.