23 #include <tulip/Observable.h>
24 #include <tulip/Color.h>
78 ColorScale(
const std::vector<Color> &colors,
const bool gradient =
true);
88 ColorScale(
const std::map<float, Color> &colorMap,
const bool gradient =
true);
111 return colorMap.size();
126 virtual void setColorScale(
const std::vector<Color> &colors,
const bool gradient =
true);
155 return !colorMap.empty();
202 return (gradient == cs.gradient) && (colorMap == cs.colorMap);
210 return (gradient != cs.gradient) || (colorMap != cs.colorMap);
229 std::map<float, Color> colorMap;
This class represents a color scale to perform color mapping. The color scale can be either a gradien...
void setGradient(const bool g)
specify whether the color scale must be considered as a gradient
virtual void setColorScale(const std::vector< Color > &colors, const bool gradient=true)
Configures the color scale with regular stop points.
unsigned int getStopsCount()
Gets the number of stops points into the color scale.
virtual void setColorAtPos(const float pos, const Color &color)
Adds a color to the color scale at specific position.
bool operator!=(const ColorScale &cs) const
Tests color scale difference with another one.
bool operator==(const std::vector< Color > &colors) const
Tests color scale equality with a regular one defined by a vector of colors.
bool hasRegularStops() const
Tests if the color scale has regular stop points, meaning the distance between each consecutive stop ...
bool colorScaleInitialized() const
Returns true is the color scale was initialized.
ColorScale(const std::vector< Color > &colors, const bool gradient=true)
const std::map< float, Color > & getColorMap() const
Returns a map corresponding to the color scale. The index of the map is the position for the correspo...
void setColorMap(const std::map< float, Color > &colorMap)
Sets the map of stop points and colors used to perform color mapping.
ColorScale(const std::map< float, Color > &colorMap, const bool gradient=true)
virtual Color getColorAtPos(const float pos) const
Returns the color for a given position in the color scale.
bool operator==(const ColorScale &cs) const
Tests color scale equality with another one.
void setColorMapTransparency(unsigned char transparency)
Sets the transparency of all the colors in the underlying map.
void clear()
Clears the color scale.
bool isGradient() const
Returns true if the color scale is a gradient.
The Observable class is the base of Tulip's observation system.