A style that is applied to a
Cesium3DTileset
.
Evaluates an expression defined using the 3D Tiles Styling language.
Name | Type | Description |
---|---|---|
style |
String | Object | optional The url of a style or an object defining a style. |
Examples:
tileset.style = new Cesium.Cesium3DTileStyle({
color : {
conditions : [
['${Height} >= 100', 'color("purple", 0.5)'],
['${Height} >= 50', 'color("red")'],
['true', 'color("blue")']
]
},
show : '${Height} > 0',
meta : {
description : '"Building id ${id} has height ${Height}."'
}
});
tileset.style = new Cesium.Cesium3DTileStyle({
color : 'vec4(${Temperature})',
pointSize : '${Temperature} * 2.0'
});
See:
Members
-
color : StyleExpression
-
Gets or sets the
StyleExpression
object used to evaluate the style'scolor
property.The expression must return a
Color
.Examples:
var style = new Cesium3DTileStyle({ color : '(${Temperature} > 90) ? color("red") : color("white")' }); style.color.evaluateColor(frameState, feature, result); // returns a Cesium.Color object
var style = new Cesium.Cesium3DTileStyle(); // Override color expression with a custom function style.color = { evaluateColor : function(frameState, feature, result) { return Cesium.Color.clone(Cesium.Color.WHITE, result); } };
-
meta : StyleExpression
-
Gets or sets the object containing application-specific expression that can be explicitly evaluated, e.g., for display in a UI.
Example:
var style = new Cesium3DTileStyle({ meta : { description : '"Building id ${id} has height ${Height}."' } }); style.meta.description.evaluate(frameState, feature); // returns a String with the substituted variables
-
pointSize : StyleExpression
-
Gets or sets the
StyleExpression
object used to evaluate the style'spointSize
property.The expression must return or convert to a
Number
.Examples:
var style = new Cesium3DTileStyle({ pointSize : '(${Temperature} > 90) ? 2.0 : 1.0' }); style.pointSize.evaluate(frameState, feature); // returns a Number
var style = new Cesium.Cesium3DTileStyle(); // Override pointSize expression with a custom function style.pointSize = { evaluate : function(frameState, feature) { return 1.0; } };
-
When
true
, the style is ready and its expressions can be evaluated. When a style is constructed with an object, as opposed to a url, this istrue
immediately.-
Default Value:
false
-
readonlyreadyPromise : Promise.<Cesium3DTileStyle>
-
Gets the promise that will be resolved when the the style is ready and its expressions can be evaluated.
-
show : StyleExpression
-
Gets or sets the
StyleExpression
object used to evaluate the style'sshow
property.The expression must return or convert to a
Boolean
.Examples:
var style = new Cesium3DTileStyle({ show : '(regExp("^Chest").test(${County})) && (${YearBuilt} >= 1970)' }); style.show.evaluate(frameState, feature); // returns true or false depending on the feature's properties
var style = new Cesium.Cesium3DTileStyle(); // Override show expression with a custom function style.show = { evaluate : function(frameState, feature) { return true; } };
-
Gets the object defining the style using the 3D Tiles Styling language.
-
Default Value:
undefined