| Name | Type | Description |
|---|---|---|
expression |
String | optional 使用三维瓦片样式语言定义的表达式。 |
defines |
Object | optional 在样式中定义。 |
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
-
获取三维瓦片样式语言中定义的表达式。
-
Default Value:
undefined
Methods
-
evaluate(frameState, feature, result) → Boolean|Number|String|RegExp|Cartesian2|Cartesian3|Cartesian4|Color
-
计算表达式的结果,可选择使用所提供的特性的属性。如果3D Tiles样式语言中的表达式的结果为
Boolean、Number或String类型,则返回相应的javascript原语类型。如果结果是一个RegExp,则返回一个JavascriptRegExp对象。如果结果是Cartesian2、Cartesian3或Cartesian4,则返回一个Cartesian2、Cartesian3或Cartesian4对象。 如果result参数是Color,Cartesian4值被转换为Color,然后返回。Name Type Description frameStateFrameState 帧状态。 featureCesium3DTileFeature 其属性可以用作表达式中的变量的特性。 resultObject optional 存储结果的对象。 Returns:
表达式的运算结果。 -
evaluateColor(frameState, 特征, result) → Color
-
评估颜色表达式的结果,可选择使用所提供的特征属性。
这与
Expression#evaluate等价,但总是始终一个Color对象。Name Type Description frameStateFrameState 帧状态。 特征Cesium3DTileFeature 其属性可在表达式中用作变量的特征。 resultColor optional 存储结果的对象。 Returns:
修改后的结果参数,或一个新的颜色实例(如果没有提供)。
