Class: ConditionsExpression

ConditionsExpression

new ConditionsExpression(conditionsExpression, defines)

Style expression applied to Cesium3DTile set.

Evaluate the conditional expression of class definition in 3D Tile Styling language

Implement StyleExpression interface.

Name Type Description
conditionsExpression Object optional

A conditional expression defined using the 3D Tiles style language.

defines Object optional

Defined in the style.

Example
var expression = new SuperMap3D.ConditionsExpression({
    conditions : [
        ['${Area} > 10, 'color("#FF0000")'],
        ['${id} !== "1"', 'color("#00FF00")'],
        ['true', 'color("#FFFFFF")']
    ]
});
expression.evaluateColor(frameState, feature, result); // returns a SuperMap3D.Color object

Members

readonly conditionsExpressionObject

Get the conditional expression defined in the 3D tile style language.

Default Value:
undefined

Methods

evaluate(frameState, feature, result){Boolean|Number|String|RegExp|Cartesian2|Cartesian3|Cartesian4|Color}

The result of the expression can be calculated using the provided properties. If the result of an expression in the 3D Tiles style language is Boolean, Number, or String, the corresponding JavaScript primitive type is returned. If the result is a RegExp, return a Javascript RegExp object. If the result is Cartesian2, Cartesian3, or Cartesian4, then return a Cartesian2, Cartesian3, or Cartesian4 object. If the result parameter is Color, the Cartesian4 value is converted to Color and then returned.

Name Type Description
frameState FrameState

Frame status.

feature Cesium3DTileFeature

Its properties can be used as characteristics of variables in expressions.

result Object optional

The object that stores the results.

Returns:
Type Description
Boolean | Number | String | RegExp | Cartesian2 | Cartesian3 | Cartesian4 | Color The operation result of the expression.

evaluateColor(frameState, feature, result){Color}

Evaluate the results of color expressions using feature defined values.

This is equivalent to ConditionExpression # evaluate, but always returns a Color object.

Name Type Description
frameState FrameState

Frame status.

feature Cesium3DTileFeature

Its properties can be used as characteristics of variables in expressions.

result Color optional

The object that stores the results.

Returns:
Type Description
Color The modified result parameters, or a new color instance (if not provided).