DGtal  0.9.2
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)
34 
35 #define RandomColorMap_RECURSES
36 
37 #if !defined RandomColorMap_h
38 
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 
82  RandomColorMap & operator= ( const RandomColorMap & anOther );
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 
133  ~RandomColorMap();
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 
174  RandomColorMap();
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)
std::vector< unsigned int > myFreeColorIndex
std::vector< unsigned int > myColorIndex
Aim: access to random color from a gradientColorMap.
RandomColorMap & operator=(const RandomColorMap &anOther)
bool isValid() const
void selfDisplay(std::ostream &out) const
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
const unsigned int & max() const
GradientColorMap< unsigned int > * myGradientMap
Color operator()(const unsigned int &aValue) const
DGtal is the top-level namespace which contains all DGtal functions and types.
const unsigned int & min() const
Structure representing an RGB triple with alpha component.
Definition: Color.h:66
static const Color White
Definition: Color.h:390
static const Color Red
Definition: Color.h:391
void associateRandomIndexColor()
void addColor(const Color &aColor)