new Cesium.ConditionsExpression(conditionsExpression, defines)

An expression for a style applied to a Cesium3DTileset.

使用 3D Tiles Styling language.

Implements the StyleExpression interface.

Name Type Description
conditionsExpression object optional 使用3D Tiles Styling语言定义的条件表达式.
defines object optional 在样式中定义.
Example:
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

Members

readonly conditionsExpression : object

获得在 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

使用特性定义的值来评价颜色表达式的结果.

这相当于 ConditionsExpression#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.