ScalarSettings

class cee.ug.ScalarSettings()

Specification of how to render scalar results on the model, on cutting planes, on isosurfaces and on particle traces.

Use this object to control the visual appearance of scalar results in the 3D viewer. You can specify which colorScheme to use for the color legend and how many levels (unique colors) it should have with levelCount. You can also control the legend’s scaling, either by using autoRangeMode or by specifying rangeMinimum and rangeMaximum.

Example: Setup a custom color legend

var modelSpec = myModel.modelSpec;

var resultId = modelSpec.fringesResultId;
if (resultId >= 0) {
    var scalarSettings = myModel.getScalarSettingsById(resultId);

    var min = myModel.getScalarResultMinimumValue(resultId);
    var max = myModel.getScalarResultMaximumValue(resultId);
    var range = max - min;

    // Setup custom scale 50% -> 100% of the range using a green to brown legend.
    scalarSettings.setRange(min + range*0.5, max);
    scalarSettings.colorScheme = cee.ug.ColorScheme.WHITE_TO_BROWN;
    scalarSettings.levelCount = 3;
}

This code sample produces the following image in the 3D Viewer:

../../_images/ScalarSettings_custom.png

Accessors

  • aboveRangeColor

  • autoRangeMode

  • belowRangeColor

  • colorMarkerArray

  • colorScheme

  • customContinuousColorArr

  • customContinuousValueArr

  • customFilledContoursColorArr

  • filledContoursColorArr

  • filteringRangeMaximum

  • filteringRangeMinimum

  • isAutoRangeEnabled

  • isFilteringEnabled

  • legendVisibilityMode

  • levelCount

  • logarithmicMapping

  • nodeAveragedValues

  • numericFormat

  • numericPrecision

  • rangeMaximum

  • rangeMinimum

  • resultId

  • scalingConstantTerm

  • scalingFirstDegreeTerm

  • undefinedColor


Accessors

cee.ug.aboveRangeColor()

The color for the parts of the model that are above the current range.

Default is undefined, which means that the top color of the colorScheme will be used.

Note: Changing the colorScheme will set aboveRangeColor and belowRangeColor to undefined.

Return type:

Color3Like

cee.ug.aboveRangeColor(color)
Arguments:
  • color (Color3Like) – None

Return type:

void

cee.ug.autoRangeMode()

Auto range mode. Set this value with setAutoRange.

To disable auto range, set a manual range with setRange.

Return type:

AutoRangeMode

cee.ug.belowRangeColor()

The color for the parts of the model that are below the current range.

Default is undefined, which means that the bottom color of the colorScheme will be used.

Note: Changing the colorScheme will set aboveRangeColor and belowRangeColor to undefined.

Return type:

Color3Like

cee.ug.belowRangeColor(color)
Arguments:
  • color (Color3Like) – None

Return type:

void

cee.ug.colorMarkerArray()

Additional color legend markers that can be shown above or below the main markers in the legend.

Useful for describing above, below and undefined colors.

Example: Add a “No result” marker below the color legend:

scalarSettings.colorMarkerArray = [
    {
        position: cee.ug.LegendColorMarkerPosition.BELOW,
        color: new cee.Color3(0.5, 0.5, 0.5),
        description: "No result"
    }
];
Return type:

unknown

cee.ug.colorMarkerArray(colorMarkers)
Arguments:
  • colorMarkers (unknown) – None

Return type:

void

cee.ug.colorScheme()

The color scheme to use for the color legend and mapped colors on the model.

Use this property to set the color scheme to any of the pre-defined color schemes.

The colorScheme cannot be set to CUSTOM with this property. This is done with the setCustomContinuousColorArr() method or customFilledContoursColorArr property. colorScheme will return CUSTOM if one if these setters are used.

Note: Changing the colorScheme will set aboveRangeColor and belowRangeColor to undefined.

Return type:

ColorScheme

cee.ug.colorScheme(colorScheme)
Arguments:
  • colorScheme (ColorScheme) – None

Return type:

void

cee.ug.customContinuousColorArr()

Get the custom continuous color array if defined.

This is setup with the setCustomContinuousColorArr() method.

Return type:

[Color3Like]

cee.ug.customContinuousValueArr()

Get the custom continuous value array if defined.

This is setup with the setCustomContinuousColorArr() method.

Return type:

[number]

cee.ug.customFilledContoursColorArr()

Setup the color legend with the given level colors.

The color scheme will be set to CUSTOM, and the number of levels will be set to the length of the provided array.

Return type:

[Color3Like]

cee.ug.customFilledContoursColorArr(colorArr)
Arguments:
  • colorArr ([Color3Like]) – None

Return type:

void

cee.ug.filledContoursColorArr()

Get the colors of the current color legend (if in levels mode)

If levelCount > 0, this will return the colors for each level on the color legend, starting from the bottom of the legend.

Note: If not using customFilledContoursColorArr, the color legend info needs to be received from the server before this method will return valid info, so make sure the current update of display model is fully completed.

Return type:

[Color3Like]

cee.ug.filteringRangeMaximum()

The maximum value the result needs to have to be visible when filtering is enabled. This will be undefined if filtering is disabled.

Return type:

number

cee.ug.filteringRangeMinimum()

The minimum value the result needs to have to be visible when filtering is enabled. This will be undefined if filtering is disabled.

Return type:

number

cee.ug.isAutoRangeEnabled()

Whether auto range is enabled.

Return type:

boolean

cee.ug.isFilteringEnabled()

Whether filtering of this scalar result is enabled.

Return type:

boolean

cee.ug.legendVisibilityMode()

Specifies the visibility of the color legend.

The legend can be set to appear if used by any part in the model (AUTO, default), to always be shown (ALWAYS) or to never be shown (NEVER)

Return type:

LegendVisibilityMode

cee.ug.legendVisibilityMode(mode)
Arguments:
  • mode (LegendVisibilityMode) – None

Return type:

void

cee.ug.levelCount()

The number of levels (unique colors) in the color legend.

If you want a continuous (smooth) legend, set the number of levels to 0. This will create a continuous legend with tick marks at round numbers.

Return type:

number

cee.ug.levelCount(numLevels)
Arguments:
  • numLevels (number) – None

Return type:

void

cee.ug.logarithmicMapping()

If true, a logarithmic range will be used for the color legend and results mapping. If false, a linear mapping will be used.

Return type:

boolean

cee.ug.logarithmicMapping(logarithmicMapping)
Arguments:
  • logarithmicMapping (boolean) – None

Return type:

void

cee.ug.nodeAveragedValues()

Specify if the scalar result should be shown as a node averaged result or not.

If false (default) the result is shown as is computed. If true, a node averaged result will be shown that is derived from the original result.

Return type:

boolean

cee.ug.nodeAveragedValues(useNodeAveraging)
Arguments:
  • useNodeAveraging (boolean) – None

Return type:

void

cee.ug.numericFormat()

The numerical format to use for the numbers on the color legend tick marks

Legal options: ‘g’: (default) (using the .toPrecision JS function). ‘f’: fixed notation (1234.0) (using the .toFixed() JS function) ‘e’: scientific notation (1.234e4) (using the .toExponential JS function)

The precision is controlled by the numericPrecision property.

Return type:

string

cee.ug.numericFormat(numericFormat)
Arguments:
  • numericFormat (string) – None

Return type:

void

cee.ug.numericPrecision()

Set the precision to use for the numbers on the color legend tick marks

See numericFormat for the different options.

Return type:

number

cee.ug.numericPrecision(precision)
Arguments:
  • precision (number) – None

Return type:

void

cee.ug.rangeMaximum()

The maximum range of the scalar result if auto range is disabled. This is undefined if auto range is enabled.

To set a manual range, use the setRange function.

Return type:

number

cee.ug.rangeMinimum()

The minimum range of the scalar result if auto range is disabled. This is undefined if auto range is enabled.

To set a manual range, use the setRange function.

Return type:

number

cee.ug.resultId()

The id (>=0) of the scalar result. This id corresponds to the id in ModelDirectory.scalarResultArray.

Return type:

number

cee.ug.scalingConstantTerm()

Constant scaling term used for custom scaling of the legend.

The value shown on the legend tick marks is:

legendValue = scalingConstantTerm + scalarValue*scalingFirstDegreeTerm
Return type:

number

cee.ug.scalingConstantTerm(scalingConstantTerm)
Arguments:
  • scalingConstantTerm (number) – None

Return type:

void

cee.ug.scalingFirstDegreeTerm()

First degree term used for custom scaling of the legend.

The value shown on the legend tick marks is:

legendValue = scalingConstantTerm + scalarValue*scalingFirstDegreeTerm
Return type:

number

cee.ug.scalingFirstDegreeTerm(scalingFirstDegreeTerm)
Arguments:
  • scalingFirstDegreeTerm (number) – None

Return type:

void

cee.ug.undefinedColor()

The color of the parts of the model with an undefined result.

Return type:

Color3Like

cee.ug.undefinedColor(color)
Arguments:
  • color (Color3Like) – None

Return type:

void

Methods

disableFiltering

ScalarSettings.disableFiltering()

Disables any filtering of the results.

Return type:

void

getAsProperties

ScalarSettings.getAsProperties()

Gets the settings for this object as a Plain Old JavaScript Object (POJO).

Return type:

ScalarSettingsProperties

mapToColor

ScalarSettings.mapToColor(scalarValue)
Arguments:
  • scalarValue (number) – None

Maps the given domain value to a color using the current scalar settings

Return type:

Color3Like

setAutoRange

ScalarSettings.setAutoRange(mode)
Arguments:
  • mode (AutoRangeMode) – None

Sets the automatic full range of the scalar result.

Set this to AutoRangeMode.ALL_ITEMS to use the full range for the result (this is the default) or to AutoRangeMode.VISIBLE_ITEMS to limit the range to the currently visible parts

Return type:

void

setCustomContinuousColorArr

ScalarSettings.setCustomContinuousColorArr(colorArr[, valueArr])
Arguments:
  • colorArr ([Color3Like]) – None

  • valueArr ([number]) – optional None

Sets custom color scheme for a continuous color legend.

Specify an array of colors to use to create the interpolated continuous legend.

If values are specified (valueArr) the color will be set at that value and interpolated between the values. If no values are provided the specified colors will be distributed evenly between min and max.

The range will be adjusted if needed to include the specified values (if any).

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! colorScheme will be set to ColorScheme.CUSTOM and the levelCount to 0.

Return type:

void

setFilteringRange

ScalarSettings.setFilteringRange(minValue, maxValue)
Arguments:
  • minValue (number) – None

  • maxValue (number) – None

Specifies to show only the results whose value lies within the given range.

When enabled, only results whose value is within the given filter range <minValue, maxValue> will be drawn. All other results will be discarded and not drawn.

The filtering will be done on a per-element basis, so an element (and thus all its surface) is either fully visible or not visible. If you have a per-node or per-element-node result, the element is visible if at least one of the nodes is within range.

Return type:

void

setFromProperties

ScalarSettings.setFromProperties(props)
Arguments:

Applies the settings in the given properties object to this scalar settings

Return type:

void

setRange

ScalarSettings.setRange(min, max)
Arguments:
  • min (number) – None

  • max (number) – None

Sets a user defined range of the scalar result.

This function will disable auto range.

Return type:

void