new Cesium3DTileStyle(style)
The style applied to Cesium3DTile set. Calculate expressions defined using 3D Tiles Styling language.
| Name | Type | Description |
|---|---|---|
style |
String | Object |
optional
The URL of the object that defines the style or style. |
Examples
tileset.style = new SuperMap3D.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 SuperMap3D.Cesium3DTileStyle({
color : 'vec4(${Temperature})',
pointSize : '${Temperature} * 2.0'
});
Members
-
anchorLineColorStyleExpression
-
Gets or sets the StyleExpression object used to evaluate the style anchorLineColor property. You can also use strings or objects that define color styles. The getter will return an internal Expression or ConditionsExpression, which may differ from the value provided to the setter.
The expression must return the Color type.
This expression only applies to point features in vector tiles.
Examples
const style = new Cesium.Cesium3DTileStyle(); // Override anchorLineColor expression with a string style.anchorLineColor = 'color("blue")';const style = new Cesium.Cesium3DTileStyle(); // Override anchorLineColor expression with a condition style.anchorLineColor = { conditions : [ ['${height} > 2', 'color("cyan")'], ['true', 'color("blue")'] ] }; -
anchorLineEnabledStyleExpression
-
Gets or sets the StyleExpression object used to evaluate the style anchorLineEnabled property. You can also use strings or define boolean style objects. The getter will return an internal Expression or ConditionsExpression, which may differ from the value provided to the setter.
The expression must return a Boolean type.
This expression only applies to point features in vector tiles.
Examples
const style = new Cesium.Cesium3DTileStyle(); // Override anchorLineEnabled expression with a string style.anchorLineEnabled = 'true';const style = new Cesium.Cesium3DTileStyle(); // Override anchorLineEnabled expression with a condition style.anchorLineEnabled = { conditions : [ ['${height} > 2', 'true'], ['true', 'false'] ] }; -
backgroundColorStyleExpression
-
Gets or sets the StyleExpression object used to evaluate the style backgroundColor property. You can also use strings or objects that define color styles. The getter will return an internal Expression or ConditionsExpression, which may differ from the value provided to the setter.
The expression must return the Color type.
This expression only applies to point features in vector tiles.
Examples
const style = new Cesium.Cesium3DTileStyle(); // Override backgroundColor expression with a string style.backgroundColor = 'color("blue")';const style = new Cesium.Cesium3DTileStyle(); // Override backgroundColor expression with a condition style.backgroundColor = { conditions : [ ['${height} > 2', 'color("cyan")'], ['true', 'color("blue")'] ] }; -
backgroundEnabledStyleExpression
-
Gets or sets the StyleExpression object used to evaluate the style backgroundEnabled property. You can also use strings or define boolean style objects. The getter will return an internal Expression or ConditionsExpression, which may differ from the value provided to the setter.
The expression must return a Boolean type.
This expression only applies to point features in vector tiles.
Examples
const style = new Cesium.Cesium3DTileStyle(); // Override backgroundEnabled expression with a string style.backgroundEnabled = 'true';const style = new Cesium.Cesium3DTileStyle(); // Override backgroundEnabled expression with a condition style.backgroundEnabled = { conditions : [ ['${height} > 2', 'true'], ['true', 'false'] ] }; -
backgroundPaddingStyleExpression
-
Gets or sets the StyleExpression object used to evaluate the style backgroundPadding property. You can also use strings or define vec2 style objects. The getter will return an internal Expression or ConditionsExpression, which may differ from the value provided to the setter.
The expression must return the Cartesian2 type.
This expression only applies to point features in vector tiles.
Example
const style = new Cesium.Cesium3DTileStyle(); // Override backgroundPadding expression with a string style.backgroundPadding = 'vec2(5.0, 7.0)'; style.backgroundPadding.evaluate(feature); // returns a Cartesian2 -
colorStyleExpression
-
Gets or sets the StyleExpression object used to evaluate the color property of a style. You can also use strings or objects that define color styles. The getter will return an internal Expression or ConditionsExpression, which may differ from the value provided to the setter.
The expression must return the Color type.
This expression applies to all tile formats.
Examples
const style = new Cesium3DTileStyle({ color : '(${Temperature} > 90) ? color("red") : color("white")' }); style.color.evaluateColor(feature, result); // returns a Cesium.Color objectconst style = new Cesium.Cesium3DTileStyle(); // Override color expression with a custom function style.color = { evaluateColor : function(feature, result) { return Cesium.Color.clone(Cesium.Color.WHITE, result); } };const style = new Cesium.Cesium3DTileStyle(); // Override color expression with a string style.color = 'color("blue")';const style = new Cesium.Cesium3DTileStyle(); // Override color expression with a condition style.color = { conditions : [ ['${height} > 2', 'color("cyan")'], ['true', 'color("blue")'] ] }; -
disableDepthTestDistanceStyleExpression
-
Gets or sets the StyleExpression object used to evaluate the style disabling DepthTestDistance property. You can also use strings or objects that define numerical styles. The getter will return an internal Expression or ConditionsExpression, which may differ from the value provided to the setter.
The expression must return the Number type.
This expression only applies to point features in vector tiles.
Example
const style = new Cesium.Cesium3DTileStyle(); // Override disableDepthTestDistance expression with a string style.disableDepthTestDistance = '1000.0'; style.disableDepthTestDistance.evaluate(feature); // returns a Number -
distanceDisplayConditionStyleExpression
-
Gets or sets the StyleExpression object used to evaluate the distanceDisplayCondition property of the style. You can also use strings or define vec2 style objects. The getter will return an internal Expression or ConditionsExpression, which may differ from the value provided to the setter.
The expression must return the Cartesian2 type.
This expression only applies to point features in vector tiles.
Example
const style = new Cesium.Cesium3DTileStyle(); // Override distanceDisplayCondition expression with a string style.distanceDisplayCondition = 'vec2(0.0, 5.5e6)'; style.distanceDisplayCondition.evaluate(feature); // returns a Cartesian2 -
fontStyleExpression
-
Gets or sets the StyleExpression object used to evaluate the font properties of a style. You can also use strings or objects that define string styles. The getter will return an internal Expression or ConditionsExpression, which may differ from the value provided to the setter.
The expression must return a String type.
This expression only applies to point features in vector tiles.
Examples
const style = new Cesium3DTileStyle({ font : '(${Temperature} > 90) ? "30px Helvetica" : "24px Helvetica"' }); style.font.evaluate(feature); // returns a Stringconst style = new Cesium.Cesium3DTileStyle(); // Override font expression with a custom function style.font = { evaluate : function(feature) { return '24px Helvetica'; } }; -
heightOffsetStyleExpression
-
Gets or sets the StyleExpression object used to evaluate the style height offset property. You can also use strings or objects that define numerical styles. The getter will return an internal Expression or ConditionsExpression, which may differ from the value provided to the setter.
The expression must return the Number type.
This expression only applies to point features in vector tiles.
Examples
const style = new Cesium.Cesium3DTileStyle(); // Override heightOffset expression with a string style.heightOffset = '2.0';const style = new Cesium.Cesium3DTileStyle(); // Override heightOffset expression with a condition style.heightOffset = { conditions : [ ['${height} > 2', '4.0'], ['true', '2.0'] ] }; -
horizontalOriginStyleExpression
-
Gets or sets the StyleExpression object used to evaluate the horizontalOrigin property of the style. You can also use strings or objects that define numerical styles. The getter will return an internal Expression or ConditionsExpression, which may differ from the value provided to the setter.
The expression must return HorizontalOrigin type.
This expression only applies to point features in vector tiles.
Examples
const style = new Cesium3DTileStyle({ horizontalOrigin : HorizontalOrigin.LEFT }); style.horizontalOrigin.evaluate(feature); // returns a HorizontalOriginconst style = new Cesium.Cesium3DTileStyle(); // Override horizontalOrigin expression with a custom function style.horizontalOrigin = { evaluate : function(feature) { return HorizontalOrigin.CENTER; } }; -
imageStyleExpression
-
Gets or sets the StyleExpression object used to evaluate the style image property. You can also use strings or objects that define string styles. The getter will return an internal Expression or ConditionsExpression, which may differ from the value provided to the setter.
The expression must return a String type.
This expression only applies to point features in vector tiles.
Examples
const style = new Cesium3DTileStyle({ image : '(${Temperature} > 90) ? "/url/to/image1" : "/url/to/image2"' }); style.image.evaluate(feature); // returns a Stringconst style = new Cesium.Cesium3DTileStyle(); // Override image expression with a custom function style.image = { evaluate : function(feature) { return '/url/to/image'; } }; -
labelColorStyleExpression
-
Gets or sets the StyleExpression object used to evaluate the labelColor property of the style. You can also use strings or objects that define color styles. The getter will return an internal Expression or ConditionsExpression, which may differ from the value provided to the setter.
The expression must return the Color type.
This expression only applies to point features in vector tiles.
Examples
const style = new Cesium.Cesium3DTileStyle(); // Override labelColor expression with a string style.labelColor = 'color("blue")';const style = new Cesium.Cesium3DTileStyle(); // Override labelColor expression with a condition style.labelColor = { conditions : [ ['${height} > 2', 'color("cyan")'], ['true', 'color("blue")'] ] }; -
labelHorizontalOriginStyleExpression
-
Gets or sets the StyleExpression object used to evaluate the labelHorizontalOrigin property of the style. You can also use strings or objects that define numerical styles. The getter will return an internal Expression or ConditionsExpression, which may differ from the value provided to the setter.
The expression must return HorizontalOrigin type.
This expression only applies to point features in vector tiles.
Examples
const style = new Cesium3DTileStyle({ labelHorizontalOrigin : HorizontalOrigin.LEFT }); style.labelHorizontalOrigin.evaluate(feature); // Return a HorizontalOriginconst style = new Cesium.Cesium3DTileStyle(); // Override the labelHorizontalOrigin expression using a custom function style.labelHorizontalOrigin = { evaluate : function(feature) { return HorizontalOrigin.CENTER; } }; -
labelOutlineColorStyleExpression
-
Gets or sets the StyleExpression object used to evaluate the labelOutlineColor property of the style. You can also use strings or objects that define color styles. The getter will return an internal Expression or ConditionsExpression, which may differ from the value provided to the setter.
The expression must return the Color type.
This expression only applies to point features in vector tiles.
Examples
const style = new Cesium.Cesium3DTileStyle(); // Override labelOutlineColor expression with a string style.labelOutlineColor = 'color("blue")';const style = new Cesium.Cesium3DTileStyle(); // Override labelOutlineColor expression with a condition style.labelOutlineColor = { conditions : [ ['${height} > 2', 'color("cyan")'], ['true', 'color("blue")'] ] }; -
labelOutlineWidthStyleExpression
-
Gets or sets the StyleExpression object used to evaluate the labelOutlineWidth property of the style. You can also use strings or objects that define numerical styles. The getter will return an internal Expression or ConditionsExpression, which may differ from the value provided to the setter.
The expression must return the Number type.
This expression only applies to point features in vector tiles.
Examples
const style = new Cesium.Cesium3DTileStyle(); // Override labelOutlineWidth expression with a string style.labelOutlineWidth = '5';const style = new Cesium.Cesium3DTileStyle(); // Override labelOutlineWidth expression with a condition style.labelOutlineWidth = { conditions : [ ['${height} > 2', '5'], ['true', '0'] ] }; -
labelStyleStyleExpression
-
Get or set the StyleExpression object used to evaluate the style label style property. You can also use strings or objects that define numerical styles. The getter will return an internal Expression or ConditionsExpression, which may differ from the value provided to the setter.
The expression must return the LabelStyle type.
This expression only applies to point features in vector tiles.
Examples
const style = new Cesium3DTileStyle({ labelStyle : `(\${Temperature} > 90) ? ${LabelStyle.FILL_AND_OUTLINE} : ${LabelStyle.FILL}` }); style.labelStyle.evaluate(feature); // returns a LabelStyleconst style = new Cesium.Cesium3DTileStyle(); // Override labelStyle expression with a custom function style.labelStyle = { evaluate : function(feature) { return LabelStyle.FILL; } }; -
labelTextStyleExpression
-
Gets or sets the StyleExpression object used to evaluate the labelText property of the style. You can also use strings or objects that define string styles. The getter will return an internal Expression or ConditionsExpression, which may differ from the value provided to the setter.
The expression must return a String type.
This expression only applies to point features in vector tiles.
Examples
const style = new Cesium3DTileStyle({ labelText : '(${Temperature} > 90) ? ">90" : "<=90"' }); style.labelText.evaluate(feature); // returns a Stringconst style = new Cesium.Cesium3DTileStyle(); // Override labelText expression with a custom function style.labelText = { evaluate : function(feature) { return 'Example label text'; } }; -
labelVerticalOriginStyleExpression
-
Gets or sets the StyleExpression object used to evaluate the labelVerticalOrigin property of the style. You can also use strings or objects that define numerical styles. The getter will return an internal Expression or ConditionsExpression, which may differ from the value provided to the setter.
The expression must return the VerticalOrigin type.
This expression only applies to point features in vector tiles.
Examples
const style = new Cesium3DTileStyle({ labelVerticalOrigin : VerticalOrigin.TOP }); style.labelVerticalOrigin.evaluate(feature); // returns a VerticalOriginconst style = new Cesium.Cesium3DTileStyle(); // Override labelVerticalOrigin expression with a custom function style.labelVerticalOrigin = { evaluate : function(feature) { return VerticalOrigin.CENTER; } }; -
metaStyleExpression
-
Get or set objects that contain application specific expressions that can be explicitly evaluated, such as for display in the UI.
Example
const style = new Cesium3DTileStyle({ meta : { description : '"Building id ${id} has height ${Height}."' } }); style.meta.description.evaluate(feature); // Return a string with replacement variables -
pointOutlineColorStyleExpression
-
Gets or sets the StyleExpression object used to evaluate the pointOutlineColor property of the style. You can also use strings or objects that define color styles. The getter will return an internal Expression or ConditionsExpression, which may differ from the value provided to the setter.
The expression must return the Color type.
This expression only applies to point features in vector tiles.
Examples
const style = new Cesium.Cesium3DTileStyle(); // Override pointOutlineColor expression with a string style.pointOutlineColor = 'color("blue")';const style = new Cesium.Cesium3DTileStyle(); // Override pointOutlineColor expression with a condition style.pointOutlineColor = { conditions : [ ['${height} > 2', 'color("cyan")'], ['true', 'color("blue")'] ] }; -
pointOutlineWidthStyleExpression
-
Gets or sets the StyleExpression object used to evaluate the pointOutlineWidth property of the style. You can also use strings or objects that define numerical styles. The getter will return an internal Expression or ConditionsExpression, which may differ from the value provided to the setter.
The expression must return the Number type.
This expression only applies to point features in vector tiles.
Examples
const style = new Cesium.Cesium3DTileStyle(); // Override pointOutlineWidth expression with a string style.pointOutlineWidth = '5';const style = new Cesium.Cesium3DTileStyle(); // Override pointOutlineWidth expression with a condition style.pointOutlineWidth = { conditions : [ ['${height} > 2', '5'], ['true', '0'] ] }; -
pointSizeStyleExpression
-
Gets or sets the StyleExpression object used to evaluate the pointSize property of the style. You can also use strings or objects that define point size styles. The getter will return an internal Expression or ConditionsExpression, which may differ from the value provided to the setter.
The expression must return the Number type.
This expression only applies to point features in vector tiles or point cloud tiles.
Examples
const style = new Cesium3DTileStyle({ pointSize : '(${Temperature} > 90) ? 2.0 : 1.0' }); style.pointSize.evaluate(feature); // returns a Numberconst style = new Cesium.Cesium3DTileStyle(); // Override pointSize expression with a custom function style.pointSize = { evaluate : function(feature) { return 1.0; } };const style = new Cesium.Cesium3DTileStyle(); // Override pointSize expression with a number style.pointSize = 1.0;const style = new Cesium.Cesium3DTileStyle(); // Override pointSize expression with a string style.pointSize = '${height} / 10';const style = new Cesium.Cesium3DTileStyle(); // Override pointSize expression with a condition style.pointSize = { conditions : [ ['${height} > 2', '1.0'], ['true', '2.0'] ] }; -
scaleByDistanceStyleExpression
-
Gets or sets the StyleExpression object used to evaluate the scaleByDistance property of the style. You can also use strings or define vec4 style objects. The getter will return an internal Expression or ConditionsExpression, which may differ from the value provided to the setter.
The expression must return the Cartesian4 type.
This expression only applies to point features in vector tiles.
Example
const style = new Cesium.Cesium3DTileStyle(); // Override scaleByDistance expression with a string style.scaleByDistance = 'vec4(1.5e2, 2.0, 1.5e7, 0.5)'; style.scaleByDistance.evaluate(feature); // returns a Cartesian4 -
showStyleExpression
-
Gets or sets the StyleExpression object used to evaluate the style show property. Boolean values, strings, or objects that define a show style can also be used. The getter will return an internal Expression or ConditionsExpression, which may differ from the value provided to the setter.
The expression must return or be converted to Boolean type.
This expression applies to all tile formats.
Examples
const style = new Cesium3DTileStyle({ show : '(regExp("^Chest").test(${County})) && (${YearBuilt} >= 1970)' }); style.show.evaluate(feature); // returns true or false depending on the feature's propertiesconst style = new Cesium.Cesium3DTileStyle(); // Override show expression with a custom function style.show = { evaluate : function(feature) { return true; } };const style = new Cesium.Cesium3DTileStyle(); // Override show expression with a boolean style.show = true; };const style = new Cesium.Cesium3DTileStyle(); // Override show expression with a string style.show = '${Height} > 0'; };const style = new Cesium.Cesium3DTileStyle(); // Override show expression with a condition style.show = { conditions: [ ['${height} > 2', 'false'], ['true', 'true'] ]; }; -
readonly styleObject
-
Obtain the use of 3D Tile Styling language
- Default Value: undefined
translucencyByDistanceStyleExpression
Gets or sets the StyleExpression object used to evaluate the transucencyByDistance property of the style. You can also use strings or define vec4 style objects. The getter will return an internal Expression or ConditionsExpression, which may differ from the value provided to the setter.
The expression must return the Cartesian4 type.
This expression only applies to point features in vector tiles.
Example
const style = new Cesium.Cesium3DTileStyle();
// Override translucencyByDistance expression with a string
style.translucencyByDistance = 'vec4(1.5e2, 1.0, 1.5e7, 0.2)';
style.translucencyByDistance.evaluate(feature); // returns a Cartesian4
verticalOriginStyleExpression
Gets or sets the StyleExpression object used to evaluate the verticalOrigin property of the style. You can also use strings or objects that define numerical styles. The getter will return an internal Expression or ConditionsExpression, which may differ from the value provided to the setter.
The expression must return the VerticalOrigin type.
This expression only applies to point features in vector tiles.
Examples
const style = new Cesium3DTileStyle({
verticalOrigin : VerticalOrigin.TOP
});
style.verticalOrigin.evaluate(feature); // returns a VerticalOrigin
const style = new Cesium.Cesium3DTileStyle();
// Override verticalOrigin expression with a custom function
style.verticalOrigin = {
evaluate : function(feature) {
return VerticalOrigin.CENTER;
}
};
Methods
-
static fromJSON(value){Cesium3DTileStyle}
-
Create Cesium3DTileStyle object from JSON object.
Name Type Description valueobject JSON object containing style information.
Returns:
Type Description Cesium3DTileStyle Created Cesium3DTileStyle object. -
static toJSON(value){object}
-
Convert Cesium3DTileStyle object to JSON object.
Name Type Description valueCesium3DTileStyle The Cesium3DTileStyle object to be converted.
Returns:
Type Description object The converted JSON object.