new Expression(expression, defines)
Style expression applied to Cesium3DTile set.
Calculates an expression defined using the 3D Tiles style language.
Implement StyleExpression interface.
| Name | Type | Description |
|---|---|---|
expression |
String |
optional
Expressions defined using the 3D tile style language. |
defines |
Object |
optional
Defined in the style. |
Examples
var expression = new SuperMap3D.Expression('(regExp("^Chest").test(${County})) && (${YearBuilt} >= 1970)');
expression.evaluate(frameState, feature); // returns true or false depending on the feature's properties
var expression = new SuperMap3D.Expression('(${Temperature} > 90) ? color("red") : color("white")');
expression.evaluateColor(frameState, feature, result); // returns a SuperMap3D.Color object
Members
-
readonly expressionString
-
Retrieve the 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 of type 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 frameStateFrameState Frame status.
featureCesium3DTileFeature Its properties can be used as characteristics of variables in expressions.
resultObject 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 and choose to use the provided feature attributes.
This is equivalent to Expression#evaluate, but always returns a Color object.
Name Type Description frameStateFrameState Frame status.
featureCesium3DTileFeature Feature whose attributes can be used as variables in expressions.
resultColor optional The object that stores the results.
Returns:
Type Description Color The modified result parameters, or a new color instance (if not provided).