An expression for a style applied to a
Cesium3DTileset.
Evaluates an expression defined using the 3D Tiles Styling language.
Implements the StyleExpression interface.
| Name | Type | Description |
|---|---|---|
expression |
String | optional The expression defined using the 3D Tiles Styling language. |
defines |
Object | optional Defines in the style. |
Examples:
var expression = new Cesium.Expression('(regExp("^Chest").test(${County})) && (${YearBuilt} >= 1970)');
expression.evaluate(frameState, feature); // returns true or false depending on the feature's properties
var expression = new Cesium.Expression('(${Temperature} > 90) ? color("red") : color("white")');
expression.evaluateColor(frameState, feature, result); // returns a Cesium.Color object
Members
-
Gets the expression defined in the 3D Tiles Styling language.
-
Default Value:
undefined
Methods
-
evaluate(frameState, feature, result) → Boolean|Number|String|RegExp|Cartesian2|Cartesian3|Cartesian4|Color
-
Evaluates the result of an expression, optionally using the provided feature's properties. If the result of the expression in the 3D Tiles Styling language is of type
Boolean,Number, orString, the corresponding JavaScript primitive type will be returned. If the result is aRegExp, a JavascriptRegExpobject will be returned. If the result is aCartesian2,Cartesian3, orCartesian4, aCartesian2,Cartesian3, orCartesian4object will be returned. If theresultargument is aColor, theCartesian4value is converted to aColorand then returned.Name Type Description frameStateFrameState The frame state. featureCesium3DTileFeature The feature whose properties may be used as variables in the expression. resultObject optional The object onto which to store the result. Returns:
The result of evaluating the expression. -
evaluateColor(frameState, feature, result) → Color
-
Evaluates the result of a Color expression, optionally using the provided feature's properties.
This is equivalent to
Expression#evaluatebut always returns aColorobject.Name Type Description frameStateFrameState The frame state. featureCesium3DTileFeature The feature whose properties may be used as variables in the expression. resultColor optional The object in which to store the result Returns:
The modified result parameter or a new Color instance if one was not provided.
