new Expression(expression, defines)
Parameters:
expression
(String)
使用三維平鋪樣式語言定義的表達式。
defines
(Object)
在樣式中定義。
Examples
var expression = new bmgl.Expression('(regExp("^Chest").test(${County})) && (${YearBuilt} >= 1970)');
expression.evaluate(feature); // returns true or false depending on the feature's properties
var expression = new bmgl.Expression('(${Temperature} > 90) ? color("red") : color("white")');
expression.evaluateColor(feature, result); // returns a bmgl.Color object
Members
(readonly) expression : String
獲取在三維平鋪樣式語言中定義的表達式。
-
Default Value:
undefined
Methods
evaluate(feature, result) → {Boolean|Number|String|RegExp|Cartesian2|Cartesian3|Cartesian4|Color}
計算表達式的結果,可以選擇使用提供的功能的屬性。如果3D Tiles Styling language中表達式的結果屬于
Boolean
、Number
或String
類型,則返回相應的javascript基元類型。如果結果是RegExp
,將返回一個javascriptRegExp
對象。如果結果是Cartesian2
、Cartesian3
或Cartesian4
,則返回Cartesian2
、Cartesian3
或Cartesian4
對象。如果result
參數是Color
,則Cartesian4
值將轉換為Color
,然后返回。
Parameters:
result
(Object)
存儲結果的對象。
使用提供的功能的屬性(可選)計算顏色表達式的結果。
這相當于Expression#evaluate
但始終返回Color
對象。