Appearance
KBE3D / KBCore / Cesium / ConditionsExpression
类: ConditionsExpression
An expression for a style applied to a Cesium3DTileset. <p> Evaluates a conditions expression defined using the 3D Tiles Styling language. </p> <p> Implements the StyleExpression interface. </p>
示例
ts
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参数
The conditions expression defined using the 3D Tiles Styling language.
参数
Defines in the style.
属性
conditionsExpression
readonlyconditionsExpression:any
Gets the conditions expression defined in the 3D Tiles Styling language.
方法
evaluate()
evaluate(
feature:Cesium3DTileFeature,result?:any):string|number|boolean|RegExp|Color|Cartesian3|Cartesian2|Cartesian4
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 <code>Boolean</code>, <code>Number</code>, or <code>String</code>, the corresponding JavaScript primitive type will be returned. If the result is a <code>RegExp</code>, a Javascript <code>RegExp</code> object will be returned. If the result is a <code>Cartesian2</code>, <code>Cartesian3</code>, or <code>Cartesian4</code>, a Cartesian2, Cartesian3, or Cartesian4 object will be returned. If the <code>result</code> argument is a Color, the Cartesian4 value is converted to a Color and then returned.
参数
feature
The feature whose properties may be used as variables in the expression.
result?
any
The object onto which to store the result.
返回
string | number | boolean | RegExp | Color | Cartesian3 | Cartesian2 | Cartesian4
The result of evaluating the expression.
evaluateColor()
evaluateColor(
feature:Cesium3DTileFeature,result?:Color):Color
Evaluates the result of a Color expression, using the values defined by a feature. <p> This is equivalent to ConditionsExpression#evaluate but always returns a Color object. </p>
参数
feature
The feature whose properties may be used as variables in the expression.
result?
The object in which to store the result
返回
The modified result parameter or a new Color instance if one was not provided.
构造函数
构造函数
new ConditionsExpression(
conditionsExpression?:any,defines?:any):ConditionsExpression
参数
conditionsExpression?
any
defines?
any
返回
ConditionsExpression
