An expression for a style applied to a
Cesium3DTileset
.
Evaluates a conditions expression defined using the 3D Tiles Styling language.
Implements the StyleExpression
interface.
参数名称 | 类型 | 描述信息 |
---|---|---|
conditionsExpression |
object | 可选 The conditions expression defined using the 3D Tiles Styling language. |
defines |
object | 可选 Defines in the style. |
使用示例:
const expression = new Cesium.ConditionsExpression({
conditions : [
['${Area} > 10, 'color("#FF0000")'],
['${id} !== "1"', 'color("#00FF00")'],
['true', 'color("#FFFFFF")']
]
});
expression.evaluateColor(feature, result); // returns a Cesium.Color object
成员(属性)
Gets the conditions expression defined in the 3D Tiles Styling language.
-
默认值:
undefined
方法
evaluate(feature, result) → boolean|number|string|RegExp|Cartesian2|Cartesian3|Cartesian4|Color
Evaluates the result of an expression, optionally using the provided feature's properties. If the result of
the expression in the
3D Tiles Styling language
is of type
Boolean
, Number
, or String
, the corresponding JavaScript
primitive type will be returned. If the result is a RegExp
, a Javascript RegExp
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.
参数名称 | 类型 | 描述信息 |
---|---|---|
feature |
Cesium3DTileFeature | The feature whose properties may be used as variables in the expression. |
result |
object | 可选 The object onto which to store the result. |
返回值:
The result of evaluating the expression.
evaluateColor(feature, result) → Color
Evaluates the result of a Color expression, using the values defined by a feature.
This is equivalent to ConditionsExpression#evaluate
but always returns a Color
object.
参数名称 | 类型 | 描述信息 |
---|---|---|
feature |
Cesium3DTileFeature | The feature whose properties may be used as variables in the expression. |
result |
Color | 可选 The object in which to store the result |
返回值:
The modified result parameter or a new Color instance if one was not provided.