DGtal  1.5.beta
RandomColorMap.h
1 
17 #pragma once
18 
31 #if defined(RandomColorMap_RECURSES)
32 #error Recursive header files inclusion detected in RandomColorMap.h
33 #else // defined(RandomColorMap_RECURSES)
35 #define RandomColorMap_RECURSES
36 
37 #if !defined RandomColorMap_h
39 #define RandomColorMap_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "DGtal/io/colormaps/GradientColorMap.h"
47 
48 namespace DGtal
49 {
50 
52 // class RandomColorMap
60 {
61  // ----------------------- Standard services ------------------------------
62 public:
63 
64 
65  typedef unsigned int Value;
66 
67 
68 
74  RandomColorMap ( const RandomColorMap & other );
75 
83 
84 
90  RandomColorMap(const unsigned int &aFirstIndex, const unsigned int & aLastIndex,
91  const Color &aFirstColor=Color::White, const Color &aLastColor=Color::Red);
92 
93 
94  // RandomColorMap(const unsigned int &aFirstIndex, const unsigned int & aLastIndex);
95 
96 
97 
103  void addColor( const Color & aColor ) ;
104 
105 
112  Color operator()( const unsigned int & aValue ) const;
113 
114 
120  const unsigned int & min() const;
121 
127  const unsigned int & max() const;
128 
129 
134 
135  // ----------------------- Interface --------------------------------------
136 public:
137 
142  void selfDisplay ( std::ostream & out ) const;
143 
148  bool isValid() const;
149 
150  // ------------------------- Protected Datas ------------------------------
151 protected:
152  unsigned int myMin;
153  unsigned int myMax;
158  // ------------------------- Private Datas --------------------------------
159 private:
161  std::vector<unsigned int> myColorIndex;
162  std::vector<unsigned int> myFreeColorIndex;
163 
164 
166 
167  // ------------------------- Hidden services ------------------------------
168 protected:
169 
175 
176 private:
177 
178 
179  // ------------------------- Internals ------------------------------------
180 private:
181 
182 }; // end of class RandomColorMap
183 
184 
191 std::ostream&
192 operator<< ( std::ostream & out, const RandomColorMap & object );
193 
194 
195 } // namespace DGtal
196 
197 
199 // Includes inline functions.
200 #include "DGtal/io/colormaps/RandomColorMap.ih"
201 
202 
203 // //
205 
206 #endif // !defined RandomColorMap_h
207 
208 #undef RandomColorMap_RECURSES
209 #endif // else defined(RandomColorMap_RECURSES)
Structure representing an RGB triple with alpha component.
Definition: Color.h:68
static const Color Red
Definition: Color.h:416
static const Color White
Definition: Color.h:415
Aim: access to random color from a gradientColorMap.
RandomColorMap & operator=(const RandomColorMap &anOther)
bool isValid() const
const unsigned int & max() const
void addColor(const Color &aColor)
RandomColorMap(const RandomColorMap &other)
Color operator()(const unsigned int &aValue) const
std::vector< unsigned int > myColorIndex
void associateRandomIndexColor()
void selfDisplay(std::ostream &out) const
GradientColorMap< unsigned int > * myGradientMap
const unsigned int & min() const
RandomColorMap(const unsigned int &aFirstIndex, const unsigned int &aLastIndex, const Color &aFirstColor=Color::White, const Color &aLastColor=Color::Red)
std::vector< unsigned int > myFreeColorIndex
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)