A toolkit for working with phylogenetic data.
v0.20.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ColorNormalization Class Referenceabstract

#include <genesis/utils/tools/color/normalization.hpp>

Inherited by ColorNormalizationBoundary, and ColorNormalizationLinear.

Detailed Description

Base class for color normalization.

Definition at line 52 of file normalization.hpp.

Public Member Functions

 ColorNormalization ()=default
 
 ColorNormalization (ColorNormalization const &)=default
 
 ColorNormalization (ColorNormalization &&)=default
 
virtual ~ColorNormalization ()=default
 
bool is_valid () const
 Return whether ranges and other values are correct. More...
 
double mask_value () const
 Mask value that identifies invalid values. More...
 
ColorNormalizationmask_value (double value)
 Mask value that identifies invalid values. More...
 
double operator() (double value) const
 Normalize a value into range [ 0.0, 1.0 ]. More...
 
std::vector< double > operator() (std::vector< double > const &values) const
 Return the normalized values for a vector of values. More...
 
template<class ForwardIterator >
std::vector< double > operator() (ForwardIterator first, ForwardIterator last) const
 Return the normalized values for a range of values. More...
 
ColorNormalizationoperator= (ColorNormalization const &)=default
 
ColorNormalizationoperator= (ColorNormalization &&)=default
 

Protected Member Functions

virtual bool is_valid_ () const =0
 Return whether ranges and other values are correct. More...
 
virtual double normalize_ (double value) const =0
 Normalization function. More...
 

Constructor & Destructor Documentation

ColorNormalization ( )
default
virtual ~ColorNormalization ( )
virtualdefault
ColorNormalization ( ColorNormalization const &  )
default

Member Function Documentation

bool is_valid ( ) const
inline

Return whether ranges and other values are correct.

Definition at line 91 of file normalization.hpp.

virtual bool is_valid_ ( ) const
protectedpure virtual

Return whether ranges and other values are correct.

Implemented in ColorNormalizationLinear, ColorNormalizationBoundary, ColorNormalizationDiverging, and ColorNormalizationLogarithmic.

double mask_value ( ) const
inline

Mask value that identifies invalid values.

When querying a value that compares equal to the mask value, the color functions return mask_color() instead of a Color from the palette. This is meant as a simple means of filtering and visualizing invalid values.

The mask value is initialized to quiet_NaN, so that it never compares equal to anything. Thus, it is not used by default has to be explicitly set to a different value.

Definition at line 83 of file normalization.hpp.

ColorNormalization& mask_value ( double  value)
inline

Mask value that identifies invalid values.

When querying a value that compares equal to the mask value, the color functions return mask_color() instead of a Color from the palette. This is meant as a simple means of filtering and visualizing invalid values.

The mask value is initialized to quiet_NaN, so that it never compares equal to anything. Thus, it is not used by default has to be explicitly set to a different value.

Definition at line 103 of file normalization.hpp.

virtual double normalize_ ( double  value) const
protectedpure virtual

Normalization function.

Return a value in range [ 0.0, 1.0 ] for valid values, or outside of this for clipping values. Derived classes need to override this to provide their specific normalization.

By having this function separated from the operator(), we implement a non-virtual interface.

Implemented in ColorNormalizationLinear, ColorNormalizationBoundary, ColorNormalizationDiverging, and ColorNormalizationLogarithmic.

double operator() ( double  value) const
inline

Normalize a value into range [ 0.0, 1.0 ].

The function first checks whether the value is finite or mask_value(), and returns quiet_NaN if so. If not, the normalization is applied.

Definition at line 119 of file normalization.hpp.

std::vector<double> operator() ( std::vector< double > const &  values) const
inline

Return the normalized values for a vector of values.

Simply applies operator() ( double value ) to all values.

Definition at line 132 of file normalization.hpp.

std::vector<double> operator() ( ForwardIterator  first,
ForwardIterator  last 
) const
inline

Return the normalized values for a range of values.

Simply applies operator() ( double value ) to all values.

Definition at line 144 of file normalization.hpp.

ColorNormalization& operator= ( ColorNormalization const &  )
default
ColorNormalization& operator= ( ColorNormalization &&  )
default

The documentation for this class was generated from the following file: