Cesium3DTileStyle

new Cesium.Cesium3DTileStyle(style)

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

Gets or sets the StyleExpression object used to evaluate the style's color property. Alternatively a string or object defining a color style can be used. The getter will return the internal Expression or ConditionsExpression, which may differ from the value provided to the setter.

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);
    }
};
var style = new Cesium.Cesium3DTileStyle();
// Override color expression with a string
style.color = 'color("blue")';
var style = new Cesium.Cesium3DTileStyle();
// Override color expression with a condition
style.color = {
    conditions : [
        ['${height} > 2', 'color("cyan")'],
        ['true', 'color("blue")']
    ]
};
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
Gets or sets the StyleExpression object used to evaluate the style's pointSize property. Alternatively a number, string, or object defining a pointSize style can be used. The getter will return the internal Expression or ConditionsExpression, which may differ from the value provided to the setter.

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;
    }
};
var style = new Cesium.Cesium3DTileStyle();
// Override pointSize expression with a number
style.pointSize = 1.0;
var style = new Cesium.Cesium3DTileStyle();
// Override pointSize expression with a string
style.pointSize = '${height} / 10';
var style = new Cesium.Cesium3DTileStyle();
// Override pointSize expression with a condition
style.pointSize =  {
    conditions : [
        ['${height} > 2', '1.0'],
        ['true', '2.0']
    ]
};

readonlyready : Boolean

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 is true 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.
Gets or sets the StyleExpression object used to evaluate the style's show property. Alternatively a boolean, string, or object defining a show style can be used. The getter will return the internal Expression or ConditionsExpression, which may differ from the value provided to the setter.

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;
    }
};
var style = new Cesium.Cesium3DTileStyle();
// Override show expression with a boolean
style.show = true;
};
var style = new Cesium.Cesium3DTileStyle();
// Override show expression with a string
style.show = '${Height} > 0';
};
var style = new Cesium.Cesium3DTileStyle();
// Override show expression with a condition
style.show = {
    conditions: [
        ['${height} > 2', 'false'],
        ['true', 'true']
    ];
};

readonlystyle : Object

Gets the object defining the style using the 3D Tiles Styling language.
Default Value: undefined