DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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 
48 #ifdef _MSC_VER
49 #if defined( max )
50 #undef max
51 #define _HAS_MSVC_MAX_ true
52 #endif
53 #if defined( min )
54 #undef min
55 #define _HAS_MSVC_MIN_ true
56 #endif
57 #endif
58 
60 
61 namespace DGtal
62 {
63 
65  // template class HueShadeColorMap
100  template <typename PValue, int DefaultCycles = 1 >
102  {
103 
104  public:
105 
106  typedef PValue Value;
107 
108  // ----------------------- Standard services ------------------------------
109  public:
110 
118  HueShadeColorMap( const PValue & min,
119  const PValue & max,
120  const unsigned int cycles = DefaultCycles );
121 
129  Color operator()( const PValue & value ) const;
130 
135 
140  HueShadeColorMap ( const HueShadeColorMap & other );
141 
147  HueShadeColorMap & operator= ( const HueShadeColorMap & other );
148 
149  // ----------------------- Interface --------------------------------------
150  public:
151 
156  void selfDisplay ( std::ostream & out ) const;
157 
162  bool isValid() const;
163 
169  const PValue & min() const;
170 
176  const PValue & max() const;
177 
178 
184  void setCycles( int cycles );
185 
186  // ----------------------- Static methods ---------------------------------
187 
188 
199  static Color getColor( const unsigned int cycles,
200  const PValue & min,
201  const PValue & max,
202  const PValue & value );
203 
204  // ------------------------- Protected Datas ------------------------------
205  private:
206 
207  // ------------------------- Private Datas --------------------------------
208  private:
209 
210  // ------------------------- Hidden services ------------------------------
211  protected:
212 
213  PValue myMin;
214  PValue myMax;
215  unsigned int myCycles;
222 
223  // ------------------------- Internals ------------------------------------
224  private:
225 
237  static void HSVtoRGB(double &r, double &g, double &b,
238  double h, const double s, const double v);
239 
240 
241  }; // end of class HueShadeColorMap
242 
243 
250  template <typename PValue, int DefaultCycles >
251  std::ostream&
252  operator<< ( std::ostream & out, const HueShadeColorMap<PValue,DefaultCycles> & object );
253 
254 } // namespace DGtal
255 
256 
258 // Includes inline functions.
259 #include "DGtal/io/colormaps/HueShadeColorMap.ih"
260 
261 // //
263 
264 #endif // !defined HueShadeColorMap_h
265 
266 #undef HueShadeColorMap_RECURSES
267 #endif // else defined(HueShadeColorMap_RECURSES)