Overview | Modules | Class Hierarchy | Classes | Members
# tlp::ColorScale Class Reference `#include <ColorScale.h>` Inherits tlp::Observable. Inheritance diagram for tlp::ColorScale: [legend] Collaboration diagram for tlp::ColorScale: [legend] List of all members. ## Detailed Description Use this class to create a color scale and perform color mapping. The color scale can be either gradient or predefined colors steps. If the color scale is a gradient, returned color are interpolated in function of the position. If the color scale isn't a gradient returned colors are the predefined colors steps.
     \// Creating the color scale.
     ColorScale colorScale;
     \// Color scale initialization : from blue to red with gradient.
     vector<color> colors;
     colors.push_back(Color(0,0,255));
     colors.push_back(Color(255,0,0));
     colorScale.setColorScale(colors,true);

     \//Get the color for the position 0.5 eq Color(127,0,127).
     colorScale.getColorAtPos(0.5);
     \//Reinit the color scale : from blue to red without gradient.
     vector<color> newColors;
     newColors.push_back(Color(0,0,255));
     newColors.push_back(Color(255,0,0));
     colorScale.setColorScale(colors,false);
     \//Get the color for the position 0.3 eq Color(0,0,255).
     colorScale.getColorAtPos(0.3);
     \//Get the color for the position 0.7 eq Color(255,0,0).
     colorScale.getColorAtPos(0.7);
## Public Member Functions ColorScale () ColorScale (const ColorScale &scale) virtual ~ColorScale () virtual void setColorScale (const std::vector< Color > colors, const bool gradient=true) Configure the color scale. This method is used to configure the color scale. If the scale was previously configured the old configuration is lost. virtual Color getColorAtPos (const float pos) const Compute the color for the given value. bool colorScaleInitialized () const Return true is the color scale was initialized. std::map< float, Color > getColorMap () const Return a map corresponding to the color scale. The index of the map is the position for the corresponding color in the color scale. bool isGradient () Return true if the color scale use gradient. ## Protected Attributes std::map< float, Color > colorMap bool gradient bool colorScaleSet ## Constructor & Destructor Documentation
tlp::ColorScale::ColorScale | ( |  | ) |
tlp::ColorScale::ColorScale | ( | const ColorScale & | scale | ) |
virtual tlp::ColorScale::~ColorScale | ( |  | ) | `[virtual]`
## Member Function Documentation
bool tlp::ColorScale::colorScaleInitialized | ( |  | ) | const`[inline]`
| Return true is the color scale was initialized.
virtual Color tlp::ColorScale::getColorAtPos | ( | const float | pos | ) | const`[virtual]`
  | Compute the color for the given value. Parameters:
  | pos | This value define the position of the color in the scale and must be between 0 and 1.0.
Returns: The color corresponding to the position in the scale if the position is beetween 0 and 1.0. If the position is smaller than 0 the color corresponding to the position 0 is returned and if the position is greater than 1.0 the color corresponding to the position 1.0 is returned.
std::map<float, Color> tlp::ColorScale::getColorMap | ( |  | ) | const`[inline]`
| Return a map corresponding to the color scale. The index of the map is the position for the corresponding color in the color scale.
bool tlp::ColorScale::isGradient | ( |  | ) | `[inline]`
| Return true if the color scale use gradient.
virtual void tlp::ColorScale::setColorScale | ( | const std::vector< Color > | colors,
|  | const bool | gradient = `true`
| ) | `[virtual]`
  | Configure the color scale. This method is used to configure the color scale. If the scale was previously configured the old configuration is lost. Parameters:
  | colors | The colors to use in the color scale.
  | gradient | If set to true perform a
## Member Data Documentation
std::map<float, Color> tlp::ColorScale::colorMap`[protected]`
bool tlp::ColorScale::colorScaleSet`[protected]`
bool tlp::ColorScale::gradient`[protected]`

Tulip Software by LaBRI Visualization Team 2001 - 2010