new Cesium.Expression(expression, defines)

An expression for a style applied to a Cesium3DTileset.

使用 3D Tiles Styling language.

Implements the StyleExpression interface.

Name Type Description
expression string optional 使用 3D 梯形语言定义的表达式 .
defines object optional 在样式中定义.
Examples:
const expression = new Cesium.Expression('(regExp("^Chest").test(${County})) && (${YearBuilt} >= 1970)');
expression.evaluate(feature); // returns true or false depending on the feature's properties
const expression = new Cesium.Expression('(${Temperature} > 90) ? color("red") : color("white")');
expression.evaluateColor(feature, result); // returns a Cesium.Color object

Members

readonly expression : string

获得3D 梯形语言中的表达式定义.
Default Value: undefined

Methods

evaluate(feature, result)boolean|number|string|RegExp|Cartesian2|Cartesian3|Cartesian4|Color

评估表达式的结果,可选择使用所提供的特性属性。 如果结果是 表达式 3D Tiles Styling language 是类型为 NT 0 Boolean NT 1 , NT 2 NT 3 ,或 NT 4 String NT 5 ,对应的JavaScript 原始类型将返回 。 如果结果为 NT 0 RegExp NT 1 ,则使用Javascript NT 2 RegExp NT 3 object will be returned. If the result is a Cartesian2, Cartesian3, or Cartesian4, a Cartesian2, Cartesian3, or Cartesian4 object will be returned. If the result argument is a Color, the Cartesian4 value is converted to a Color and then returned.
Name Type Description
feature Cesium3DTileFeature 其属性可以作为表达式中的变量的特征.
result object optional 存储结果的对象 .
Returns:
评估表达的结果.

evaluateColor(feature, result)Color

评估颜色表达式的结果,可选择使用提供的特性属性.

这相当于 Expression#evaluate 但总是返回 Color 的对象.

Name Type Description
feature Cesium3DTileFeature 其属性可以作为表达式中的变量的特征.
result Color optional 存储结果的对象
Returns:
未提供修改的结果参数或新颜色实例 .
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.