A library for working with phylogenetic and population genetic data.
v0.32.0
ColorNormalizationLinear Class Reference

#include <genesis/utils/color/norm_linear.hpp>

Inherits ColorNormalization.

Inherited by ColorNormalizationDiverging, and ColorNormalizationLogarithmic.

Detailed Description

Default Color normalization, using a sequential linear scaling in the range [ min, max ].

Definition at line 59 of file norm_linear.hpp.

Public Member Functions

 ColorNormalizationLinear ()=default
 Constructor that sets min == 0.0 and max == 1.0. More...
 
 ColorNormalizationLinear (ColorNormalizationLinear &&)=default
 
 ColorNormalizationLinear (ColorNormalizationLinear const &)=default
 
 ColorNormalizationLinear (double min, double max)
 Constructor that sets min() and max() to the provided values. More...
 
template<class ForwardIterator >
 ColorNormalizationLinear (ForwardIterator first, ForwardIterator last)
 Constructor that sets min() and max() to the min and max of the provided range. More...
 
 ColorNormalizationLinear (std::vector< double > const &values)
 Constructor that sets min() and max() to the min and max of the provided values. More...
 
virtual ~ColorNormalizationLinear () override=default
 
template<class ForwardIterator >
ColorNormalizationLinearautoscale (ForwardIterator first, ForwardIterator last)
 Set the min and max of the Palette so that they reflect the min and max valid values that are found in the range [ first, last ). More...
 
ColorNormalizationLinearautoscale (std::vector< double > const &values)
 
template<class ForwardIterator >
ColorNormalizationLinearautoscale_max (ForwardIterator first, ForwardIterator last)
 Same as autoscale(), but only updates the max_value(). More...
 
ColorNormalizationLinearautoscale_max (std::vector< double > const &values)
 
template<class ForwardIterator >
ColorNormalizationLinearautoscale_min (ForwardIterator first, ForwardIterator last)
 Same as autoscale(), but only updates the min_value(). More...
 
ColorNormalizationLinearautoscale_min (std::vector< double > const &values)
 
double max_value () const
 Minimum value, that is, where to end the color scale. More...
 
ColorNormalizationLinearmax_value (double value)
 Minimum value, that is, where to end the color scale. More...
 
double min_value () const
 Minimum value, that is, where to begin the color scale. More...
 
ColorNormalizationLinearmin_value (double value)
 Minimum value, that is, where to begin the color scale. More...
 
ColorNormalizationLinearoperator= (ColorNormalizationLinear &&)=default
 
ColorNormalizationLinearoperator= (ColorNormalizationLinear const &)=default
 
ColorNormalizationLinearscale (double min, double max)
 
- Public Member Functions inherited from ColorNormalization
 ColorNormalization ()=default
 
 ColorNormalization (ColorNormalization &&)=default
 
 ColorNormalization (ColorNormalization const &)=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...
 
template<class ForwardIterator >
std::vector< double > operator() (ForwardIterator first, ForwardIterator last) const
 Return the normalized values for a range of values. More...
 
std::vector< double > operator() (std::vector< double > const &values) const
 Return the normalized values for a vector of values. More...
 
ColorNormalizationoperator= (ColorNormalization &&)=default
 
ColorNormalizationoperator= (ColorNormalization const &)=default
 

Protected Member Functions

template<class ForwardIterator >
ColorNormalizationLinearautoscale_ (ForwardIterator first, ForwardIterator last, bool set_min, bool set_max)
 
virtual bool is_valid_ () const override
 Return whether the ranges are correct. More...
 
virtual void is_valid_or_throw_ () const
 Throw if the ranges are incorrect. More...
 
virtual double normalize_ (double value) const override
 Normalization function. More...
 
virtual void update_hook_ (double min, double max)
 Called whenever the min and max are set automatically. Gives derived classes a chance to update their values. More...
 

Constructor & Destructor Documentation

◆ ColorNormalizationLinear() [1/6]

Constructor that sets min == 0.0 and max == 1.0.

◆ ColorNormalizationLinear() [2/6]

ColorNormalizationLinear ( double  min,
double  max 
)
inline

Constructor that sets min() and max() to the provided values.

Definition at line 76 of file norm_linear.hpp.

◆ ColorNormalizationLinear() [3/6]

ColorNormalizationLinear ( std::vector< double > const &  values)
inlineexplicit

Constructor that sets min() and max() to the min and max of the provided values.

Definition at line 86 of file norm_linear.hpp.

◆ ColorNormalizationLinear() [4/6]

ColorNormalizationLinear ( ForwardIterator  first,
ForwardIterator  last 
)
inline

Constructor that sets min() and max() to the min and max of the provided range.

Definition at line 95 of file norm_linear.hpp.

◆ ~ColorNormalizationLinear()

virtual ~ColorNormalizationLinear ( )
overridevirtualdefault

◆ ColorNormalizationLinear() [5/6]

◆ ColorNormalizationLinear() [6/6]

Member Function Documentation

◆ autoscale() [1/2]

ColorNormalizationLinear& autoscale ( ForwardIterator  first,
ForwardIterator  last 
)
inline

Set the min and max of the Palette so that they reflect the min and max valid values that are found in the range [ first, last ).

The provided iterator range needs to contain values that are convertible and comparable to double. Any non-finite values or values that are equal to the mask_value() are skipped. If then no value is found at all, the min and max are not changed.

In derived classes, other values might also be set from this. For example, ColorNormalizationLinearDiverging also sets the mid value accordingly.

Definition at line 179 of file norm_linear.hpp.

◆ autoscale() [2/2]

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

Definition at line 146 of file norm_linear.hpp.

◆ autoscale_()

ColorNormalizationLinear& autoscale_ ( ForwardIterator  first,
ForwardIterator  last,
bool  set_min,
bool  set_max 
)
inlineprotected

Definition at line 232 of file norm_linear.hpp.

◆ autoscale_max() [1/2]

ColorNormalizationLinear& autoscale_max ( ForwardIterator  first,
ForwardIterator  last 
)
inline

Same as autoscale(), but only updates the max_value().

Definition at line 199 of file norm_linear.hpp.

◆ autoscale_max() [2/2]

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

Definition at line 162 of file norm_linear.hpp.

◆ autoscale_min() [1/2]

ColorNormalizationLinear& autoscale_min ( ForwardIterator  first,
ForwardIterator  last 
)
inline

Same as autoscale(), but only updates the min_value().

Definition at line 189 of file norm_linear.hpp.

◆ autoscale_min() [2/2]

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

Definition at line 154 of file norm_linear.hpp.

◆ is_valid_()

virtual bool is_valid_ ( ) const
inlineoverrideprotectedvirtual

Return whether the ranges are correct.

Implements ColorNormalization.

Reimplemented in ColorNormalizationDiverging, and ColorNormalizationLogarithmic.

Definition at line 283 of file norm_linear.hpp.

◆ is_valid_or_throw_()

virtual void is_valid_or_throw_ ( ) const
inlineprotectedvirtual

Throw if the ranges are incorrect.

Reimplemented in ColorNormalizationDiverging, and ColorNormalizationLogarithmic.

Definition at line 291 of file norm_linear.hpp.

◆ max_value() [1/2]

double max_value ( ) const
inline

Minimum value, that is, where to end the color scale.

Definition at line 123 of file norm_linear.hpp.

◆ max_value() [2/2]

ColorNormalizationLinear& max_value ( double  value)
inline

Minimum value, that is, where to end the color scale.

Definition at line 218 of file norm_linear.hpp.

◆ min_value() [1/2]

double min_value ( ) const
inline

Minimum value, that is, where to begin the color scale.

Definition at line 115 of file norm_linear.hpp.

◆ min_value() [2/2]

ColorNormalizationLinear& min_value ( double  value)
inline

Minimum value, that is, where to begin the color scale.

Definition at line 208 of file norm_linear.hpp.

◆ normalize_()

virtual double normalize_ ( double  value) const
inlineoverrideprotectedvirtual

Normalization function.

Return a value in range [ 0.0, 1.0 ]. Derived classes can override this to provide their specific normalization.

Implements ColorNormalization.

Reimplemented in ColorNormalizationDiverging, and ColorNormalizationLogarithmic.

Definition at line 304 of file norm_linear.hpp.

◆ operator=() [1/2]

◆ operator=() [2/2]

ColorNormalizationLinear& operator= ( ColorNormalizationLinear const &  )
default

◆ scale()

ColorNormalizationLinear& scale ( double  min,
double  max 
)
inline

Definition at line 135 of file norm_linear.hpp.

◆ update_hook_()

virtual void update_hook_ ( double  min,
double  max 
)
inlineprotectedvirtual

Called whenever the min and max are set automatically. Gives derived classes a chance to update their values.

Reimplemented in ColorNormalizationDiverging.

Definition at line 327 of file norm_linear.hpp.


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