Class for mapping a value to a color.
#include <DataAnalysis/Color/colorscale.h>
◆ ColorScale() [1/2]
◆ ColorScale() [2/2]
◆ ~ColorScale()
◆ clone()
- Returns
- A clone of this object.
- Note
- Subclasses would normally return their own type rather than the Clonable type. The C++ language rules allow a more derived type to be returned from a virtual function and the compiler will still treat it as a valid override.
We redeclare this function only so that the more derived return type is available without casting.
Implements ObjectGroup.
◆ getCacheId()
QString getCacheId |
( |
| ) |
const |
- Returns
- A string which is a semi-human readable representation of the color scale. It will be more or less unique for different settings and is intended to be used as a cache ID for things that need a string identifier for the current settings.
◆ getMaximum()
double getMaximum |
( |
| ) |
const |
- Returns
- The highest value in the color scale. This maps to the value 1 in the color spectrum returned from getSpectrum().
◆ getMinimum()
double getMinimum |
( |
| ) |
const |
- Returns
- The lowest value in the color scale. This maps to the value 0 in the color spectrum returned from getSpectrum().
◆ getSpectrum()
- Returns
- The color spectrum being used by the color scale.
◆ mapToColor()
QColor mapToColor |
( |
double |
d | ) |
const |
- Parameters
-
d | The value for which the associated color is to be obtained. |
This function maps the value d into the color space defined by the scale's color spectrum. A color spectrum operates on a fixed linear range from 0 to 1, whereas a color scale maps a floating linear scale between two arbitrary values into this [0,1] range.
- Returns
- The color that the value d maps to.
◆ operator!=()
- Parameters
-
scale | The scale to compare against. |
- Returns
- True if scale and this spectrum are not the same.
- Note
- See the comments for the equality operator regarding items in the object group having data or not.
◆ operator=()
◆ operator==()
- Parameters
-
scale | The color scale to compare against. |
- Returns
- True if scale and this color scale are the same.
◆ rangeIsValid()
bool rangeIsValid |
( |
| ) |
const |
- Returns
- True if the color scale range maximum is greater than the minimum.
◆ setMaximum()
void setMaximum |
( |
double |
maximum | ) |
|
- Parameters
-
maximum | The highest value in the color scale. |
No check is made as to whether maximum is greater than the current minimum, since the minimum might be getting set after this call. For a safer way to set both the minimum and maximum, see setRange().
◆ setMinimum()
void setMinimum |
( |
double |
minimum | ) |
|
- Parameters
-
minimum | The lowest value in the color scale. |
No check is made as to whether minimum is less than the current maximum, since the maximum might be getting set after this call. For a safer way to set both the minimum and maximum, see setRange().
◆ setRange()
void setRange |
( |
double |
minimum, |
|
|
double |
maximum |
|
) |
| |
- Parameters
-
minimum | The lowest value in the color scale. |
maximum | The hightest value in the color scale. |
Note that minimum must be strictly less than the maximum or else this function will do nothing (ie the previous values will be retained).
◆ setSpectrum()
- Parameters
-
spectrum | The new color spectrum to use. |
◆ setUseLog10()
void setUseLog10 |
( |
bool |
val | ) |
|