DGtal 1.3.0
Loading...
Searching...
No Matches
TickedColorMap.h
1
17#pragma once
18
31#if defined(TickedColorMap_RECURSES)
32#error Recursive header files inclusion detected in TickedColorMap.h
33#else // defined(TickedColorMap_RECURSES)
35#define TickedColorMap_RECURSES
36
37#if !defined TickedColorMap_h
39#define TickedColorMap_h
40
42// Inclusions
43#include <iostream>
44#include <vector>
45#include <utility>
46#include <algorithm>
47#include "DGtal/base/Common.h"
48#include "DGtal/io/Color.h"
49#include "DGtal/io/colormaps/CColorMap.h"
51
52namespace DGtal
53{
54
56 // template class TickedColorMap
77 template <typename TValue, typename TColorMap>
79 {
80
81 public:
82
84 typedef TValue Value;
85
87 typedef TColorMap ColorMap;
88
91
92 // ----------------------- Standard services ------------------------------
93 public:
94
104 TickedColorMap(const Value & aMin,
105 const Value & aMax,
106 const Color &color = Color::White );
107
116 TickedColorMap( const ColorMap & other,
117 const Color & color = Color::White );
118
128 Color operator()( const Value & value ) const;
129
134
140
147
148 // ----------------------- Interface --------------------------------------
149 public:
150
158 void addTick(const Value position,
159 const Value thickness);
160
167 void addRegularTicks(const unsigned int nbTicks,
168 const Value thickness);
169
176 void finalize();
177
182 {
183 return myColorMap;
184 }
185
190 void selfDisplay ( std::ostream & out ) const;
191
196 bool isValid() const;
197
203 const Value & min() const;
204
210 const Value & max() const;
211
212
213 // ------------------------- Hidden services ------------------------------
214 protected:
215
222 std::vector< std::pair<Value,Value> > myTicks;
223
229
230 }; // end of class TickedColorMap2d
231
232
238 template <typename TValue, typename CMAP >
239 std::ostream&
240 operator<< ( std::ostream & out, const TickedColorMap<TValue,CMAP> & object );
241
242} // namespace DGtal
243
244
246// Includes inline functions.
247#include "DGtal/io/colormaps/TickedColorMap.ih"
248
249// //
251
252#endif // !defined TickedColorMap_h
253
254#undef TickedColorMap_RECURSES
255#endif // else defined(TickedColorMap_RECURSES)
Structure representing an RGB triple with alpha component.
Definition: Color.h:68
static const Color White
Definition: Color.h:415
Aim: This class adapts any colormap to add "ticks" in the colormap colors.
BOOST_CONCEPT_ASSERT((concepts::CColorMap< ColorMap >))
TickedColorMap(const Value &aMin, const Value &aMax, const Color &color=Color::White)
Color operator()(const Value &value) const
void selfDisplay(std::ostream &out) const
TValue Value
Value type.
const Value & min() const
void addTick(const Value position, const Value thickness)
const Value & max() const
TickedColorMap(const ColorMap &other, const Color &color=Color::White)
void addRegularTicks(const unsigned int nbTicks, const Value thickness)
TickedColorMap(const TickedColorMap &other)
BOOST_STATIC_ASSERT((concepts::ConceptUtils::SameType< Value, typename ColorMap::Value >::value))
bool isValid() const
ColorMap * colormap() const
TColorMap ColorMap
Adapted colormap type.
TickedColorMap & operator=(const TickedColorMap &other)
std::vector< std::pair< Value, Value > > myTicks
Sorted vector of ticks.
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
Aim: Defines the concept describing a color map. A color map converts a value within a given range in...
Definition: CColorMap.h:94