codac
codac_ColorMap.h
Go to the documentation of this file.
1 
12 #ifndef __CODAC_COLORMAP_H__
13 #define __CODAC_COLORMAP_H__
14 
15 #include "codac_colors.h"
16 #include "codac_Trajectory.h"
17 
18 namespace codac
19 {
25  enum class InterpolMode { RGB, HSV };
26 
31  class ColorMap
32  {
33  public:
34 
41  ColorMap(InterpolMode interpol_mode = InterpolMode::RGB);
42 
46  ~ColorMap() {};
47 
54  const ColorMap& operator=(const ColorMap& x);
55 
62  void add_color_point(rgb color, float index);
63 
70  void add_color_point(hsv color, float index);
71 
75  void reverse();
76 
82  void set_opacity(float alpha);
83 
89  bool is_opaque() const;
90 
100  rgb color(double r) const;
101 
112  rgb color(double t, const Trajectory& f) const;
113 
119  void displayColorMap(const std::string& fig_name = "Color map") const;
120 
121  static const ColorMap HAXBY;
122  static const ColorMap DEFAULT;
123  static const ColorMap BLUE_TUBE;
124  static const ColorMap RED_TUBE;
125  static const ColorMap RAINBOW;
126 
127 
128  protected:
129 
130  InterpolMode m_interpol_mode = InterpolMode::RGB;
131  std::map<float,rgb> m_colormap;
132  };
133 }
134 
135 #endif
FixPoint of a separator The fixpoint of a separator is computed by calling the "::"separate function ...
Definition: codac_capd_helpers.h:9
static const ColorMap RAINBOW
a predefined color map
Definition: codac_ColorMap.h:125
One dimensional trajectory , defined as a temporal map of values.
Definition: codac_Trajectory.h:34
std::map< float, rgb > m_colormap
map of colors
Definition: codac_ColorMap.h:131
~ColorMap()
ColorMap destructor.
Definition: codac_ColorMap.h:46
Represents an RGB value.
Definition: codac_colors.h:23
static const ColorMap RED_TUBE
a predefined color map for tubes
Definition: codac_ColorMap.h:124
Associates colors to a range of values.
Definition: codac_ColorMap.h:31
static const ColorMap DEFAULT
a predefined default color map
Definition: codac_ColorMap.h:122
static const ColorMap BLUE_TUBE
a predefined color map for tubes
Definition: codac_ColorMap.h:123
Represents an HSV value.
Definition: codac_colors.h:35
InterpolMode
Defines in which color space (HSV, RGB) the color interpolation will be made.
Definition: codac_ColorMap.h:25
static const ColorMap HAXBY
predefined HAXBY color map (mainly used for DEM)
Definition: codac_ColorMap.h:121