| IGLib 1.4 The IGLib base library for development of numerical, technical and business applications.

- Main Page
- Namespaces
- Classes
- Files
- Directories

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Protected Attributes | Properties | Private Attributes

# IG::Lib::ColorScale Class Reference

Color scale; linearly mapped values, discrete scaling functionality, value to color mappiong defined through interpolation of table of provided mark colors.Provides mapping from scalar values to colors, defining continuous or discrete color scales. NOT thread safe. More...

Inheritance diagram for IG::Lib::ColorScale:
[legend]
Collaboration diagram for IG::Lib::ColorScale:
[legend]

List of all members.

## Public Member Functions
| ColorScale (double minValue, double maxValue, params color[] definitionColors)
| Constructor. Creates a continuous scale. Discrete scale has 10 cells.
| ColorScale (double minValue, double maxValue, int numCells, params color[] definitionColors)
| Constructor. Creates a discrete scale with the specified number of cells.
| ColorScale (double minValue, double maxValue, int numCells, bool isDiscrete, params color[] definitionColors)
| Constructor.
override double | FromReference (double referenceValue)
| Transforms the specified value from reference domain (interval [0,1]) to actual domain.
override double | ToReference (double actualValue)
| Transforms the specified value from actual domain to reference domain (interval [0,1]).
override color | GetContinuousReferenceColor (double referenceValue)
| Returns the CONTINUOUS color from the current color scale that corresponds to the specified value in the REFERENCE domain (interval [0, 1]). Scale can be continuous or discrete (in the latter case IsDiscrete is true).
override double | GetReferenceCellValue (int cellIndex)
| Returns the reference value (in the interval [0, 1]) corresponding to the specified cell in the discrete color map. This value is used to obtain the uniform (discrete) color of the cell by the methods that produces continuous scale colors (continuous methods are usually basis for scale definitions).
override int | GetReferenceCellIndex (double referenceValue)
| Retuns index of the cell of the discrete color scale that corresponds to the specified value in the reference domain (interval [0, 1]).
## Protected Member Functions
void | SetDefinitionColors (color[] colors)
| Sets the definition colors that define the color scale. Internal table to store these colors is allocated anew and colors are copied to the table.
virtual void | UpdateAuxiliaryData ()
| Updates precalculated auxiliary data that are used for faster calculations.
## Protected Attributes
int | _numDefinitionColors
| Number of specified colors that define the color scale.
double | _intervalLength
| Difference between maximal and minimal value.
## Properties
double | MinValue`[get, set]`
| Lower bound for values for which color scale is defines. To the values below this limit, the lowest-value color is assigned.
double | MaxValue`[get, set]`
| Upper bound for values for which color scale is defines. To the values above this limit, the highest-value color is assigned.
## Private Attributes
color[] | _definitionColors
| Table of definition colors.
double | _minValue
double | _maxvalue

## Detailed Description

Color scale; linearly mapped values, discrete scaling functionality, value to color mappiong defined through interpolation of table of provided mark colors.

Provides mapping from scalar values to colors, defining continuous or discrete color scales.

NOT thread safe.

Mapping from scalar value to color is usually defined continuously on the reference interval of values ranging from 0 to 1.

This class was initially used in GUI building for fadeouts, but has now broader applicaton and is used in all kins of graphical applications. This is also the reason that it is placed in the IG.Lib namespace. Discrete color values are added in 2011 for needs in graphic applications.

A set of colors define the continuous color scale. When a reference value changes from 0 to 1, the corresponding color on the color scale smoothly varies from the first to the last color and passes all eventual intermediate colros.

Discrete color scale is defined on basis of continuous scale in such a way that for whole subranges of values in the reference domain (interval [0, 1]) only a single color is picked. This color corresponds to a particular discrete value in the reference domain, usually in the middle of the subinterval in the reference space that corresponds to a given cell of the color scale.

Values our of range:

For continuous scale, values out of range will produce colors that correspond to either lower or upper bound of the range (dependent in which direction the range is exceeded). For discrete scale, either color of the lower or of the upper cell is produced.

The same object provides methods for getting collors either from continuous or form discrete color scale. There are methods such as GetColor or GetReferenceColor that return colors form either scale, dependent on the current value of the IsDiscrete property.

See also:

http://www.sapdesignguild.org/resources/glossary_color/

$A Igor Jul08 Oct11;

## Constructor & Destructor Documentation

IG::Lib::ColorScale::ColorScale | ( | double | minValue,
|  | double | maxValue,
|  | params color[] | definitionColors
| ) |  | `[inline]`

Constructor. Creates a continuous scale. Discrete scale has 10 cells.

Parameters:

  minValue | Lower bound of the range of values for which color scale is defined.
  maxValue | Upper bound of the range of values for which color scale is defined.

provide colors of continuous or discrete scale.

Parameters:

  definitionColors | A set of colors that define the color scale. Color of the continuous scale will smoothly transition through these values when parameter in the reference domain would run form 0 to 1.

There should be at least one definition color (In this case, the color scale will have a uniform color).

IG::Lib::ColorScale::ColorScale | ( | double | minValue,
|  | double | maxValue,
|  | int | numCells,
|  | params color[] | definitionColors
| ) |  | `[inline]`

Constructor. Creates a discrete scale with the specified number of cells.

Parameters:

  minValue | Lower bound of the range of values for which color scale is defined.
  maxValue | Upper bound of the range of values for which color scale is defined.
  numCells | Nuber of cells in the discrete scale.
  definitionColors | A set of colors that define the color scale. Color of the continuous scale will smoothly transition through these values when parameter in the reference domain would run form 0 to 1.

There should be at least one definition color (In this case, the color scale will have a uniform color).

IG::Lib::ColorScale::ColorScale | ( | double | minValue,
|  | double | maxValue,
|  | int | numCells,
|  | bool | isDiscrete,
|  | params color[] | definitionColors
| ) |  | `[inline]`

Constructor.

Parameters:

  minValue | Lower bound of the range of values for which color scale is defined.
  maxValue | Upper bound of the range of values for which color scale is defined.
  numCells | Nuber of cells in the discrete scale.
    isDiscrete | Determinse whether the main method such as GetColor and provide colors of continuous or discrete scale. Parameters:
    definitionColors | A set of colors that define the color scale. Color of the continuous scale will smoothly transition through these values when parameter in the reference domain would run form 0 to 1.
  There should be at least one definition color (In this case, the color scale will have a uniform color).

## Member Function Documentation

void IG::Lib::ColorScale::SetDefinitionColors | ( | color[] | colors | ) | `[inline, protected]`

Sets the definition colors that define the color scale. Internal table to store these colors is allocated anew and colors are copied to the table.

Parameters:

  colors | Definition colors.

override double IG::Lib::ColorScale::FromReference | ( | double | referenceValue | ) | `[inline]`

Transforms the specified value from reference domain (interval [0,1]) to actual domain.

Parameters:

  referenceValue | Value in the reference domain.

Returns:
  Value in the actual domain corresponding to the specified value in the reference domain.

Implements IG::Lib::IColorScale.

override double IG::Lib::ColorScale::ToReference | ( | double | actualValue | ) | `[inline]`

Transforms the specified value from actual domain to reference domain (interval [0,1]).

Parameters:

  referenceValue | Value in the actual domain.

Returns:
  Value in the reference domain corresponding to the specified value in the actual domain.

Implements IG::Lib::IColorScale.

virtual void IG::Lib::ColorScale::UpdateAuxiliaryData | ( |  | ) | `[inline, protected, virtual]`

Updates precalculated auxiliary data that are used for faster calculations.

override color IG::Lib::ColorScale::GetContinuousReferenceColor | ( | double | referenceValue | ) | `[inline]`

Returns the CONTINUOUS color from the current color scale that corresponds to the specified value in the REFERENCE domain (interval [0, 1]). Scale can be continuous or discrete (in the latter case IsDiscrete is true).

Parameters:

  referenceValue | Value in the reference domain (interval [0, 1]) for which the corresponding color is returned.

Implements IG::Lib::IColorScale.

override double IG::Lib::ColorScale::GetReferenceCellValue | ( | int | cellIndex | ) | `[inline]`

Returns the reference value (in the interval [0, 1]) corresponding to the specified cell in the discrete color map. This value is used to obtain the uniform (discrete) color of the cell by the methods that produces continuous scale colors (continuous methods are usually basis for scale definitions).

Parameters:

  cellIndex | Index of the cell for which the corresponding characteristic value (usually in the middle of the cell interval) is returned.

Implements IG::Lib::IColorScale.

override int IG::Lib::ColorScale::GetReferenceCellIndex | ( | double | referenceValue | ) | `[inline]`

Retuns index of the cell of the discrete color scale that corresponds to the specified value in the reference domain (interval [0, 1]).

Parameters:

  referenceValue | Value in the reference domain (interval [0, 1]) for wihich index of the discrete cell of the color scale is returned.

Implements IG::Lib::IColorScale.

## Member Data Documentation

color [] IG::Lib::ColorScale::_definitionColors`[private]`

Table of definition colors.

int IG::Lib::ColorScale::_numDefinitionColors`[protected]`

Number of specified colors that define the color scale.

double IG::Lib::ColorScale::_minValue`[private]`

double IG::Lib::ColorScale::_maxvalue`[private]`

double IG::Lib::ColorScale::_intervalLength`[protected]`

Difference between maximal and minimal value.

## Property Documentation

double IG::Lib::ColorScale::MinValue`[get, set]`

Lower bound for values for which color scale is defines. To the values below this limit, the lowest-value color is assigned.

double IG::Lib::ColorScale::MaxValue`[get, set]`

Upper bound for values for which color scale is defines. To the values above this limit, the highest-value color is assigned.

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

- ColorScale.cs

All Classes Namespaces Files Functions Variables Enumerations Properties Events