English中文

StyleExpression

new Cesium.StyleExpression()

应用于样式的表达式 An expression for a style applied to a Cesium3DTileset.

该接口的派生类计算表达式 Derived classes of this interface evaluate expressions in the 3D Tiles Styling language.

该类型描述了一个接口,并不打算直接实例化。 This type describes an interface and is not intended to be instantiated directly.

另见: See:

方法 Methods

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,将返回相应的 JavaScript 原始类型。如果结果是 , the corresponding JavaScript primitive type will be returned. If the result is a RegExp, 一个 JavaScript , 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.
名称 Name 类型 Type 说明 Description
feature Cesium3DTileFeature 其属性可用作表达式中的变量的特征。 The feature whose properties may be used as variables in the expression.
result object 可选 optional 用于存储结果的对象。 The object onto which to store the result.
返回: Returns:
计算表达式的结果。 The result of evaluating the expression.

evaluateColor(feature, result)Color

评估颜色表达式的结果,可以选择使用提供的功能的属性。 Evaluates the result of a Color expression, optionally using the provided feature's properties.

这相当于 This is equivalent to StyleExpression#evaluate 但总是返回一个 but always returns a Color object.

名称 Name 类型 Type 说明 Description
feature Cesium3DTileFeature 其属性可用作表达式中的变量的特征。 The feature whose properties may be used as variables in the expression.
result Color 可选 optional 用于存储结果的对象。 The object in which to store the result.
返回: Returns:
修改后的结果参数或新的 Color 实例(如果未提供)。 The modified result parameter or a new Color instance if one was not provided.
需要帮助吗?获得答案的最快方法是从社区和团队那里获得答案 Need help? The fastest way to get answers is from the community and team on the Cesium Forum.