DGtal 1.3.0
|
Aim: This class adapts any colormap to add "ticks" in the colormap colors. More...
#include <DGtal/io/colormaps/TickedColorMap.h>
Public Types | |
typedef TValue | Value |
Value type. More... | |
typedef TColorMap | ColorMap |
Adapted colormap type. More... | |
Public Member Functions | |
BOOST_CONCEPT_ASSERT ((concepts::CColorMap< ColorMap >)) | |
BOOST_STATIC_ASSERT ((concepts::ConceptUtils::SameType< Value, typename ColorMap::Value >::value)) | |
TickedColorMap (const Value &aMin, const Value &aMax, const Color &color=Color::White) | |
TickedColorMap (const ColorMap &other, const Color &color=Color::White) | |
Color | operator() (const Value &value) const |
~TickedColorMap () | |
TickedColorMap (const TickedColorMap &other) | |
TickedColorMap & | operator= (const TickedColorMap &other) |
void | addTick (const Value position, const Value thickness) |
void | addRegularTicks (const unsigned int nbTicks, const Value thickness) |
void | finalize () |
ColorMap * | colormap () const |
void | selfDisplay (std::ostream &out) const |
bool | isValid () const |
const Value & | min () const |
const Value & | max () const |
Protected Member Functions | |
TickedColorMap () | |
Protected Attributes | |
Value | myMin |
Value | myMax |
ColorMap * | myColorMap |
Color | myTickColor |
std::vector< std::pair< Value, Value > > | myTicks |
Sorted vector of ticks. More... | |
Aim: This class adapts any colormap to add "ticks" in the colormap colors.
Description of template class 'TickedColorMap'
Ticks are characterized by a position and a width in the adapted colormap range. When the value falls in a tick, the colormap color is replaced by the color provided in the constructor.
For example, on a colormap, this class can be used to create white ticks with regular spacing, or locate zero-crossing of a curvature map for instance (i.e. with a single tick at zero).
This class is a model of concepts::CColorMap.
TValue | The type of the range values. |
TColorMap | The type of colormap to Adapt (the value type of TColorMap must be TValue). |
Definition at line 78 of file TickedColorMap.h.
typedef TColorMap DGtal::TickedColorMap< TValue, TColorMap >::ColorMap |
Adapted colormap type.
Definition at line 87 of file TickedColorMap.h.
typedef TValue DGtal::TickedColorMap< TValue, TColorMap >::Value |
Value type.
Definition at line 84 of file TickedColorMap.h.
DGtal::TickedColorMap< TValue, TColorMap >::TickedColorMap | ( | const Value & | aMin, |
const Value & | aMax, | ||
const Color & | color = Color::White |
||
) |
Constructor.
aMin | The lower bound of the value range. |
aMax | The upper bound of the value range. |
color | the color of the ticks. |
DGtal::TickedColorMap< TValue, TColorMap >::TickedColorMap | ( | const ColorMap & | other, |
const Color & | color = Color::White |
||
) |
Constructor from colormap
other | the background colormap (copied). |
color | the color of the ticks. |
DGtal::TickedColorMap< TValue, TColorMap >::~TickedColorMap | ( | ) |
Destructor.
DGtal::TickedColorMap< TValue, TColorMap >::TickedColorMap | ( | const TickedColorMap< TValue, TColorMap > & | other | ) |
Copy constructor.
other | the object to clone. |
|
protected |
Constructor. Forbidden by default (protected to avoid g++ warnings).
void DGtal::TickedColorMap< TValue, TColorMap >::addRegularTicks | ( | const unsigned int | nbTicks, |
const Value | thickness | ||
) |
Add regularly spaced ticks in the range [myMin,myMax].
nbTicks | the number of regular ticks. |
thickness | ticks thickness. |
Referenced by main(), and testCMAP().
void DGtal::TickedColorMap< TValue, TColorMap >::addTick | ( | const Value | position, |
const Value | thickness | ||
) |
Add a tick at a given position of the range [myMin, myMax].
position | tick position. |
thickness | tick thickness. |
Referenced by testCMAP(), and testTickedColorMap().
DGtal::TickedColorMap< TValue, TColorMap >::BOOST_CONCEPT_ASSERT | ( | (concepts::CColorMap< ColorMap >) | ) |
DGtal::TickedColorMap< TValue, TColorMap >::BOOST_STATIC_ASSERT | ( | (concepts::ConceptUtils::SameType< Value, typename ColorMap::Value >::value) | ) |
|
inline |
Definition at line 181 of file TickedColorMap.h.
References DGtal::TickedColorMap< TValue, TColorMap >::myColorMap.
Referenced by main(), and testCMAP().
void DGtal::TickedColorMap< TValue, TColorMap >::finalize | ( | ) |
Finalize the insert ticks (this will sort the tick vector). This method must be called before any color access if you change the tick set.
Referenced by main(), testCMAP(), and testTickedColorMap().
bool DGtal::TickedColorMap< TValue, TColorMap >::isValid | ( | ) | const |
Checks the validity/consistency of the object.
const Value & DGtal::TickedColorMap< TValue, TColorMap >::max | ( | ) | const |
Returns the upper bound of the value range.
const Value & DGtal::TickedColorMap< TValue, TColorMap >::min | ( | ) | const |
Returns the lower bound of the value range.
Color DGtal::TickedColorMap< TValue, TColorMap >::operator() | ( | const Value & | value | ) | const |
Computes the color associated with a value in a given range.
value | A value within the value range. |
TickedColorMap & DGtal::TickedColorMap< TValue, TColorMap >::operator= | ( | const TickedColorMap< TValue, TColorMap > & | other | ) |
Assignment.
other | the object to copy. |
void DGtal::TickedColorMap< TValue, TColorMap >::selfDisplay | ( | std::ostream & | out | ) | const |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
|
protected |
Underlying colormap.
Definition at line 218 of file TickedColorMap.h.
Referenced by DGtal::TickedColorMap< TValue, TColorMap >::colormap().
|
protected |
The lower bound of the value range.
Definition at line 217 of file TickedColorMap.h.
|
protected |
The lower bound of the value range.
Definition at line 216 of file TickedColorMap.h.
|
protected |
The tick color.
Definition at line 219 of file TickedColorMap.h.
|
protected |
Sorted vector of ticks.
Definition at line 222 of file TickedColorMap.h.