应用于
Cesium3DTileset
的样式的表达式。
Evaluates an expression defined using the 3D Tiles Styling language.
Implements the StyleExpression
interface.
Name | Type | Description |
---|---|---|
expression |
String | optional 使用三维平铺样式语言定义的表达式。 |
defines |
Object | optional 在样式中定义。 |
Examples:
var expression = new Cesium.Expression('(regExp("^Chest").test(${County})) && (${YearBuilt} >= 1970)');
expression.evaluate(feature); // returns true or false depending on the feature's properties
var expression = new Cesium.Expression('(${Temperature} > 90) ? color("red") : color("white")');
expression.evaluateColor(feature, result); // returns a Cesium.Color object
Members
获取在三维平铺样式语言中定义的表达式。
-
Default Value:
undefined
Methods
evaluate(feature, result) → Boolean|Number|String|RegExp|Cartesian2|Cartesian3|Cartesian4|Color
计算表达式的
result
,可选地使用提供的功能的属性。如果
中的表达式
3D Tiles Styling language
类型为Boolean
、Number
或String
,对应的JavaScript
将返回基元类型。如果结果是RegExp
,则为Javascript RegExp
对象将被返回。如果结果是Cartesian2
、Cartesian3
或Cartesian4
,
将返回Cartesian2
、Cartesian3
或Cartesian4
对象。如果结果参数是
一个Color
,Cartesian4
值被转换为Color
,然后返回。Name | Type | Description |
---|---|---|
feature |
Cesium3DTileFeature | 其属性可以用作表达式中变量的特性。 |
result |
Object | optional 要将结果存储到的对象。 |
Returns:
计算表达式的结果。
evaluateColor(feature, result) → Color
计算颜色表达式的结果,可选地使用提供的功能的属性。
This is equivalent to Expression#evaluate
but always returns a Color
object.
Name | Type | Description |
---|---|---|
feature |
Cesium3DTileFeature | 其属性可以用作表达式中变量的特性。 |
result |
Color | optional 存储结果的对象 |
Returns:
如果未提供修改的结果参数或新的颜色实例。