cee::ug::ColorMapper

class ColorMapper : public RefCountedObject

Controlling the color mapping and the color setup of the legend.

Public Types

enum ColorScheme

Color scheme used for the color mapper.

Values:

enumerator NORMAL

Normal.

enumerator NORMAL_INVERTED

Normal inverted.

enumerator BLACK_TO_WHITE

Black to white.

enumerator WHITE_TO_BLACK

White to black.

enumerator GREEN_TO_BROWN

Green to brown.

enumerator WHITE_TO_BROWN

White to brown.

enumerator METAL_CASTING

Metal casting.

enumerator BLUE_TO_WHITE_TO_RED

Blue to white to red.

enumerator THERMAL_1

Thermal 1.

enumerator THERMAL_2

Thermal 2.

enumerator THERMAL_3

Thermal 3.

enumerator CUSTOM

Custom.

enum MappingType

MappingType of color mapper.

Values:

enumerator FILLED_CONTOURS_UNIFORM

Filled contours color mapping, discrete mapping with uniform size for the legend levels.

enumerator FILLED_CONTOURS

Filled contours color mapping, customized level values for each level.

enumerator CONTINUOUS

Color mapping using a continuous legend.

Public Functions

MappingType type() const

Returns the type of the current color mapper.

void setTypeFilledContoursUniform(unsigned int numColors)

Sets the color mapping to filled contours with uniformly distributed levels.

Sets the color mapper to filled contours (ColorMapper::FILLED_CONTOURS_UNIFORM). The numColors parameter specifies the number of discrete colors to use when doing color mapping of the scalars.

There will be (numColors + 1) level values: min and max value and (numColors - 1) values between the specified number of levels.

The level values will be evenly spaced between the min and max range of the scalar result.

Note! numColors must be at least 1

void setTypeFilledContours(const std::vector<double> &values)

Sets the color mapping to filled contours with the provided level values.

Sets the color mapper to filled contours (ColorMapper::FILLED_CONTOURS).

The values array specifies all the level values. The first item (values[0]) is the minimum range value, and the last item (values[values.size() - 1]) is the maximum range value. The other values (values[1] to values[values.size() - 2]) specifies the level values between the colors of the legend and where the contours will be on the model.

The legend will have (values.size() - 1) different colors. numberOfFilledContoursColors() will return (values.size() - 1).

Note! values must have at least two items, resulting in a legend with one color.

void setTypeContinuous()

Sets color mapping to continuous.

This will create a continuous (gradient) legend with a smooth interpolation between the colors

To use custom colors for the continuous legend, use the setCustomContinuousColorsAtValues() method.

ColorScheme colorScheme() const

Returns the current color scheme for this scalar result.

See also

ColorScheme

void setColorScheme(ColorScheme scheme)

Sets the coloring scheme to use for the color legend.

See also

ColorScheme

Color3f aboveRangeColor() const

Returns the current above range color.

This color can be set by setAboveRangeColor() but will be reset to follow the color legend when using the setColorScheme() method.

void setAboveRangeColor(const Color3f &aboveColor)

Sets the color of all values above the current range of the scalar settings/color legend.

This method allows the user to specify a color other than the top color of the color legend to use for values that are above the top indicated color.

Using the setColorScheme() method will reset the above color to match the given color scheme.

bool isAboveRangeMaskingEnabled() const

Returns if the above range parts of the model should be rendered (default) or not.

void enableAboveRangeMasking(bool enableMasking)

Sets if the above range parts of the model should be rendered (default) or not.

Color3f belowRangeColor() const

Returns the current below range color.

This color can be set by setBelowRangeColor() but will be reset to follow the color legend when using the setColorScheme() method.

void setBelowRangeColor(const Color3f &belowColor)

Sets the color of all values below the current range of the scalar settings/color legend.

This method allows the user to specify a color other than the bottom color of the color legend to use for values that are below the bottom indicated color.

Using the setColorScheme() method will reset the above color to match the given color scheme.

bool isBelowRangeMaskingEnabled() const

Returns if the below range parts of the model should be rendered (default) or not.

void enableBelowRangeMasking(bool enableMasking)

Sets if the below range parts of the model should be rendered (default) or not.

Color3f undefinedColor() const

Returns the color that will be used for undefined values (cee::UNDEFINED_DOUBLE).

void setUndefinedColor(const Color3f &undefinedColor)

Sets the color to use for undefined values (cee::UNDEFINED_DOUBLE).

This color will be used for all items that have an undefined result. The default is (0.588, 0.588, 0.588)

bool isUndefinedMaskingEnabled() const

Returns if the undefined parts of the model should be rendered (default) or not.

void enableUndefinedMasking(bool enableMasking)

Sets if the undefined parts of the model should be rendered (default) or not.

void setTextureSize(unsigned int textureSize)

Sets the maximum texture size to use.

Note: Only for experimental use. Should usually be left at the default (currently 1024) Should be a power of two.

unsigned int numberOfFilledContoursColors() const

Returns the number of discrete colors used when mapping scalars as filled contours.

The return value is only valid when the color mapper is ColorMapper::FILLED_CONTOURS_UNIFORM. For other color mappers, this function always returns 0.

std::vector<Color3f> filledContoursColors() const

Returns the array of colors for the custom filled contour levels.

The returned array with have numberOfFilledContoursColors() items and be the same as specified in the setTypeFilledContoursUniform() method or one less than the number of values specified in the setTypeFilledContours() method.

std::vector<double> filledContoursLevelValues() const

Returns an array with the level values for filled contours modes.

The returned array with have (numberOfFilledContoursColors() + 1) values.

The first value (values[0]) will be the minimum range value, and the last value (values[values.size() - 1]) will be the maximum range value. The other values (values[1] to values[values.size() - 2]) specifies the level values between the colors of the legend and where the contours will be on the model.

void setCustomFilledContoursColors(const std::vector<Color3f> &levelColors)

Sets custom color scheme for filled contours uniform legends.

Setup the legend with the given colors. The first color in the array is the bottom color of the legend.

Note! The levelColors array must have the same size as the current number of levels Note! The type() must be FILLED_CONTOURS_UNIFORM or FILLED_CONTOURS

std::vector<double> customContinuousValues() const

Returns the array of values for a custom continuous color mapper.

std::vector<Color3f> customContinuousColors() const

Returns the array of colors for a custom continuous color mapper.

void setCustomContinuousColorsAtValues(const std::vector<double> &values, const std::vector<Color3f> &colorAtValues)

Sets custom color scheme for a continuous color legend.

Setup the legend with the given colors at the given values. The two arrays must match in size.

Please note that there is no correlation between the values specified and the tick marks on the legend. The values specify the position of the color on the legend. The tick marks will be distributed on round numbers.

Note! The type() must be CONTINUOUS

std::vector<double> customContinuousTickMarks() const

Returns the custom tick mark values for continuous mapping type.

void setCustomContinuousTickMarks(const std::vector<double> &tickMarkValues)

Sets the custom tick mark values for continuous mapper.

Sets the values to show as tick marks on the color legend. Note that min/max values are not automatically added and must be included in the array if needed.

Note! Only valid for CONTINUOUS mapper (type() == CONTINUOUS)