| Name | Type | Description |
|---|---|---|
expression |
string | optional 使用 3D Tiles Styling 语言定义的表达式。 |
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
获取在 3D Tiles Styling 语言中定义的表达式。
-
Default Value:
undefined
Methods
evaluate(feature, result) → boolean|number|string|RegExp|Cartesian2|Cartesian3|Cartesian4|Color
计算表达式的结果,可选择使用提供的特性的属性。如果
中的
3D 瓦片样式语言
的类型为
Boolean、Number 或 String,对应的 JavaScript
原始类型。如果结果是 RegExp,则为 Javascript RegExp
对象。如果结果是 Cartesian2、Cartesian3 或 Cartesian4,
将返回 Cartesian2、Cartesian3 或 Cartesian4 对象。如果 result 参数为
a Color,则 Cartesian4 值将转换为 Color,然后返回。
| Name | Type | Description |
|---|---|---|
feature |
Cesium3DTileFeature | 其属性可用作表达式中的变量的特征。 |
result |
object | optional 要在其上存储结果的对象。 |
Returns:
计算表达式的结果。
evaluateColor(特征, result) → Color
计算 Color 表达式的结果,可选择使用提供的特性的属性。
这等效于 Expression#evaluate,但始终返回 Color 对象。
| Name | Type | Description |
|---|---|---|
特征 |
Cesium3DTileFeature | 其属性可用作表达式中的变量的特征。 |
result |
Color | optional 存储结果的对象 |
Returns:
修改后的结果参数或者新的 Color 实例(如果未提供)。
