DGtal  0.9.2
HueShadeColorMap.h
1 
17 #pragma once
18 
31 #if defined(HueShadeColorMap_RECURSES)
32 #error Recursive header files inclusion detected in HueShadeColorMap.h
33 #else // defined(HueShadeColorMap_RECURSES)
34 
35 #define HueShadeColorMap_RECURSES
36 
37 #if !defined HueShadeColorMap_h
38 
39 #define HueShadeColorMap_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "Board/Board.h"
46 #include "DGtal/io/Color.h"
47 
49 
50 namespace DGtal
51 {
52 
54  // template class HueShadeColorMap
89  template <typename PValue, int DefaultCycles = 1 >
91  {
92 
93  public:
94 
95  typedef PValue Value;
96 
97  // ----------------------- Standard services ------------------------------
98  public:
99 
107  HueShadeColorMap( const PValue & min,
108  const PValue & max,
109  const unsigned int cycles = DefaultCycles );
110 
118  Color operator()( const PValue & value ) const;
119 
124 
129  HueShadeColorMap ( const HueShadeColorMap & other );
130 
136  HueShadeColorMap & operator= ( const HueShadeColorMap & other );
137 
138  // ----------------------- Interface --------------------------------------
139  public:
140 
145  void selfDisplay ( std::ostream & out ) const;
146 
151  bool isValid() const;
152 
158  const PValue & min() const;
159 
165  const PValue & max() const;
166 
167 
173  void setCycles( int cycles );
174 
175  // ----------------------- Static methods ---------------------------------
176 
177 
188  static Color getColor( const unsigned int cycles,
189  const PValue & min,
190  const PValue & max,
191  const PValue & value );
192 
193  // ------------------------- Protected Datas ------------------------------
194  private:
195 
196  // ------------------------- Private Datas --------------------------------
197  private:
198 
199  // ------------------------- Hidden services ------------------------------
200  protected:
201 
202  PValue myMin;
203  PValue myMax;
204  unsigned int myCycles;
211 
212  // ------------------------- Internals ------------------------------------
213  private:
214 
226  static void HSVtoRGB(double &r, double &g, double &b,
227  double h, const double s, const double v);
228 
229 
230  }; // end of class HueShadeColorMap
231 
232 
239  template <typename PValue, int DefaultCycles >
240  std::ostream&
241  operator<< ( std::ostream & out, const HueShadeColorMap<PValue,DefaultCycles> & object );
242 
243 } // namespace DGtal
244 
245 
247 // Includes inline functions.
248 #include "DGtal/io/colormaps/HueShadeColorMap.ih"
249 
250 // //
252 
253 #endif // !defined HueShadeColorMap_h
254 
255 #undef HueShadeColorMap_RECURSES
256 #endif // else defined(HueShadeColorMap_RECURSES)
void setCycles(int cycles)
static Color getColor(const unsigned int cycles, const PValue &min, const PValue &max, const PValue &value)
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
void selfDisplay(std::ostream &out) const
const PValue & min() const
const PValue & max() const
static void HSVtoRGB(double &r, double &g, double &b, double h, const double s, const double v)
DGtal is the top-level namespace which contains all DGtal functions and types.
HueShadeColorMap & operator=(const HueShadeColorMap &other)
Structure representing an RGB triple with alpha component.
Definition: Color.h:66
Color operator()(const PValue &value) const