FreedoPModelStyle

new Freedo.FreedoPModelStyle(style)

A style that is applied to a FreedoPModelset.

Evaluates an expression defined using the 3D Tiles Styling language.

Name Type Description
style Resource | String | Object optional The url of a style or an object defining a style.
Examples:
tileset.style = new Freedo.FreedoPModelStyle({
    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 Freedo.FreedoPModelStyle({
    color : 'vec4(${Temperature})',
    pointSize : '${Temperature} * 2.0'
});
See:

Members

Gets or sets the StyleExpression object used to evaluate the style's anchorLineColor 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.

This expression is only applicable to point features in a Vector tile.

Examples:
const style = new Freedo.FreedoPModelStyle();
// Override anchorLineColor expression with a string
style.anchorLineColor = 'color("blue")';
const style = new Freedo.FreedoPModelStyle();
// Override anchorLineColor expression with a condition
style.anchorLineColor = {
    conditions : [
        ['${height} > 2', 'color("cyan")'],
        ['true', 'color("blue")']
    ]
};
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Freedo's standard deprecation policy.

Gets or sets the StyleExpression object used to evaluate the style's anchorLineEnabled property. Alternatively a string or object defining a boolean 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 Boolean.

This expression is only applicable to point features in a Vector tile.

Examples:
const style = new Freedo.FreedoPModelStyle();
// Override anchorLineEnabled expression with a string
style.anchorLineEnabled = 'true';
const style = new Freedo.FreedoPModelStyle();
// Override anchorLineEnabled expression with a condition
style.anchorLineEnabled = {
    conditions : [
        ['${height} > 2', 'true'],
        ['true', 'false']
    ]
};
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Freedo's standard deprecation policy.

Gets or sets the StyleExpression object used to evaluate the style's backgroundColor 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.

This expression is only applicable to point features in a Vector tile.

Examples:
const style = new Freedo.FreedoPModelStyle();
// Override backgroundColor expression with a string
style.backgroundColor = 'color("blue")';
const style = new Freedo.FreedoPModelStyle();
// Override backgroundColor expression with a condition
style.backgroundColor = {
    conditions : [
        ['${height} > 2', 'color("cyan")'],
        ['true', 'color("blue")']
    ]
};
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Freedo's standard deprecation policy.

Gets or sets the StyleExpression object used to evaluate the style's backgroundEnabled property. Alternatively a string or object defining a boolean 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 Boolean.

This expression is only applicable to point features in a Vector tile.

Examples:
const style = new Freedo.FreedoPModelStyle();
// Override backgroundEnabled expression with a string
style.backgroundEnabled = 'true';
const style = new Freedo.FreedoPModelStyle();
// Override backgroundEnabled expression with a condition
style.backgroundEnabled = {
    conditions : [
        ['${height} > 2', 'true'],
        ['true', 'false']
    ]
};
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Freedo's standard deprecation policy.

Gets or sets the StyleExpression object used to evaluate the style's backgroundPadding property. Alternatively a string or object defining a vec2 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 Cartesian2.

This expression is only applicable to point features in a Vector tile.

Example:
const style = new Freedo.FreedoPModelStyle();
// Override backgroundPadding expression with a string
style.backgroundPadding = 'vec2(5.0, 7.0)';
style.backgroundPadding.evaluate(feature); // returns a Cartesian2
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Freedo's standard deprecation policy.

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.

This expression is applicable to all tile formats.

Examples:
const style = new FreedoPModelStyle({
    color : '(${Temperature} > 90) ? color("red") : color("white")'
});
style.color.evaluateColor(feature, result); // returns a Freedo.Color object
const style = new Freedo.FreedoPModelStyle();
// Override color expression with a custom function
style.color = {
    evaluateColor : function(feature, result) {
        return Freedo.Color.clone(Freedo.Color.WHITE, result);
    }
};
const style = new Freedo.FreedoPModelStyle();
// Override color expression with a string
style.color = 'color("blue")';
const style = new Freedo.FreedoPModelStyle();
// Override color expression with a condition
style.color = {
    conditions : [
        ['${height} > 2', 'color("cyan")'],
        ['true', 'color("blue")']
    ]
};
Gets or sets the StyleExpression object used to evaluate the style's disableDepthTestDistance property. Alternatively a string or object defining a number 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 Number.

This expression is only applicable to point features in a Vector tile.

Example:
const style = new Freedo.FreedoPModelStyle();
// Override disableDepthTestDistance expression with a string
style.disableDepthTestDistance = '1000.0';
style.disableDepthTestDistance.evaluate(feature); // returns a Number
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Freedo's standard deprecation policy.

Gets or sets the StyleExpression object used to evaluate the style's distanceDisplayCondition property. Alternatively a string or object defining a vec2 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 Cartesian2.

This expression is only applicable to point features in a Vector tile.

Example:
const style = new Freedo.FreedoPModelStyle();
// Override distanceDisplayCondition expression with a string
style.distanceDisplayCondition = 'vec2(0.0, 5.5e6)';
style.distanceDisplayCondition.evaluate(feature); // returns a Cartesian2
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Freedo's standard deprecation policy.

Gets or sets the StyleExpression object used to evaluate the style's font property. Alternatively a string or object defining a string 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 String.

This expression is only applicable to point features in a Vector tile.

Examples:
const style = new FreedoPModelStyle({
    font : '(${Temperature} > 90) ? "30px Helvetica" : "24px Helvetica"'
});
style.font.evaluate(feature); // returns a String
const style = new Freedo.FreedoPModelStyle();
// Override font expression with a custom function
style.font = {
    evaluate : function(feature) {
        return '24px Helvetica';
    }
};
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Freedo's standard deprecation policy.

Gets or sets the StyleExpression object used to evaluate the style's heightOffset property. Alternatively a string or object defining a number 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 Number.

This expression is only applicable to point features in a Vector tile.

Examples:
const style = new Freedo.FreedoPModelStyle();
// Override heightOffset expression with a string
style.heightOffset = '2.0';
const style = new Freedo.FreedoPModelStyle();
// Override heightOffset expression with a condition
style.heightOffset = {
    conditions : [
        ['${height} > 2', '4.0'],
        ['true', '2.0']
    ]
};
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Freedo's standard deprecation policy.

Gets or sets the StyleExpression object used to evaluate the style's horizontalOrigin property. Alternatively a string or object defining a number 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 HorizontalOrigin.

This expression is only applicable to point features in a Vector tile.

Examples:
const style = new FreedoPModelStyle({
    horizontalOrigin : HorizontalOrigin.LEFT
});
style.horizontalOrigin.evaluate(feature); // returns a HorizontalOrigin
const style = new Freedo.FreedoPModelStyle();
// Override horizontalOrigin expression with a custom function
style.horizontalOrigin = {
    evaluate : function(feature) {
        return HorizontalOrigin.CENTER;
    }
};
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Freedo's standard deprecation policy.

Gets or sets the StyleExpression object used to evaluate the style's image property. Alternatively a string or object defining a string 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 String.

This expression is only applicable to point features in a Vector tile.

Examples:
const style = new FreedoPModelStyle({
    image : '(${Temperature} > 90) ? "/url/to/image1" : "/url/to/image2"'
});
style.image.evaluate(feature); // returns a String
const style = new Freedo.FreedoPModelStyle();
// Override image expression with a custom function
style.image = {
    evaluate : function(feature) {
        return '/url/to/image';
    }
};
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Freedo's standard deprecation policy.

Gets or sets the StyleExpression object used to evaluate the style's labelColor 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.

This expression is only applicable to point features in a Vector tile.

Examples:
const style = new Freedo.FreedoPModelStyle();
// Override labelColor expression with a string
style.labelColor = 'color("blue")';
const style = new Freedo.FreedoPModelStyle();
// Override labelColor expression with a condition
style.labelColor = {
    conditions : [
        ['${height} > 2', 'color("cyan")'],
        ['true', 'color("blue")']
    ]
};
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Freedo's standard deprecation policy.

Gets or sets the StyleExpression object used to evaluate the style's labelHorizontalOrigin property. Alternatively a string or object defining a number 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 HorizontalOrigin.

This expression is only applicable to point features in a Vector tile.

Examples:
const style = new FreedoPModelStyle({
    labelHorizontalOrigin : HorizontalOrigin.LEFT
});
style.labelHorizontalOrigin.evaluate(feature); // returns a HorizontalOrigin
const style = new Freedo.FreedoPModelStyle();
// Override labelHorizontalOrigin expression with a custom function
style.labelHorizontalOrigin = {
    evaluate : function(feature) {
        return HorizontalOrigin.CENTER;
    }
};
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Freedo's standard deprecation policy.

Gets or sets the StyleExpression object used to evaluate the style's labelOutlineColor 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.

This expression is only applicable to point features in a Vector tile.

Examples:
const style = new Freedo.FreedoPModelStyle();
// Override labelOutlineColor expression with a string
style.labelOutlineColor = 'color("blue")';
const style = new Freedo.FreedoPModelStyle();
// Override labelOutlineColor expression with a condition
style.labelOutlineColor = {
    conditions : [
        ['${height} > 2', 'color("cyan")'],
        ['true', 'color("blue")']
    ]
};
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Freedo's standard deprecation policy.

Gets or sets the StyleExpression object used to evaluate the style's labelOutlineWidth property. Alternatively a string or object defining a number 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 Number.

This expression is only applicable to point features in a Vector tile.

Examples:
const style = new Freedo.FreedoPModelStyle();
// Override labelOutlineWidth expression with a string
style.labelOutlineWidth = '5';
const style = new Freedo.FreedoPModelStyle();
// Override labelOutlineWidth expression with a condition
style.labelOutlineWidth = {
    conditions : [
        ['${height} > 2', '5'],
        ['true', '0']
    ]
};
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Freedo's standard deprecation policy.

Gets or sets the StyleExpression object used to evaluate the style's label style property. Alternatively a string or object defining a number 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 LabelStyle.

This expression is only applicable to point features in a Vector tile.

Examples:
const style = new FreedoPModelStyle({
    labelStyle : '(${Temperature} > 90) ? ' + LabelStyle.FILL_AND_OUTLINE + ' : ' + LabelStyle.FILL
});
style.labelStyle.evaluate(feature); // returns a LabelStyle
const style = new Freedo.FreedoPModelStyle();
// Override labelStyle expression with a custom function
style.labelStyle = {
    evaluate : function(feature) {
        return LabelStyle.FILL;
    }
};
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Freedo's standard deprecation policy.

Gets or sets the StyleExpression object used to evaluate the style's labelText property. Alternatively a string or object defining a string 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 String.

This expression is only applicable to point features in a Vector tile.

Examples:
const style = new FreedoPModelStyle({
    labelText : '(${Temperature} > 90) ? ">90" : "<=90"'
});
style.labelText.evaluate(feature); // returns a String
const style = new Freedo.FreedoPModelStyle();
// Override labelText expression with a custom function
style.labelText = {
    evaluate : function(feature) {
        return 'Example label text';
    }
};
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Freedo's standard deprecation policy.

Gets or sets the StyleExpression object used to evaluate the style's labelVerticalOrigin property. Alternatively a string or object defining a number 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 VerticalOrigin.

This expression is only applicable to point features in a Vector tile.

Examples:
const style = new FreedoPModelStyle({
    labelVerticalOrigin : VerticalOrigin.TOP
});
style.labelVerticalOrigin.evaluate(feature); // returns a VerticalOrigin
const style = new Freedo.FreedoPModelStyle();
// Override labelVerticalOrigin expression with a custom function
style.labelVerticalOrigin = {
    evaluate : function(feature) {
        return VerticalOrigin.CENTER;
    }
};
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Freedo's standard deprecation policy.

Gets or sets the object containing application-specific expression that can be explicitly evaluated, e.g., for display in a UI.
Example:
const style = new FreedoPModelStyle({
    meta : {
        description : '"Building id ${id} has height ${Height}."'
    }
});
style.meta.description.evaluate(feature); // returns a String with the substituted variables
Gets or sets the StyleExpression object used to evaluate the style's pointOutlineColor 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.

This expression is only applicable to point features in a Vector tile.

Examples:
const style = new Freedo.FreedoPModelStyle();
// Override pointOutlineColor expression with a string
style.pointOutlineColor = 'color("blue")';
const style = new Freedo.FreedoPModelStyle();
// Override pointOutlineColor expression with a condition
style.pointOutlineColor = {
    conditions : [
        ['${height} > 2', 'color("cyan")'],
        ['true', 'color("blue")']
    ]
};
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Freedo's standard deprecation policy.

Gets or sets the StyleExpression object used to evaluate the style's pointOutlineWidth property. Alternatively a string or object defining a number 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 Number.

This expression is only applicable to point features in a Vector tile.

Examples:
const style = new Freedo.FreedoPModelStyle();
// Override pointOutlineWidth expression with a string
style.pointOutlineWidth = '5';
const style = new Freedo.FreedoPModelStyle();
// Override pointOutlineWidth expression with a condition
style.pointOutlineWidth = {
    conditions : [
        ['${height} > 2', '5'],
        ['true', '0']
    ]
};
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Freedo's standard deprecation policy.

Gets or sets the StyleExpression object used to evaluate the style's pointSize property. Alternatively a string or object defining a point size 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 Number.

This expression is only applicable to point features in a Vector tile or a Point Cloud tile.

Examples:
const style = new FreedoPModelStyle({
    pointSize : '(${Temperature} > 90) ? 2.0 : 1.0'
});
style.pointSize.evaluate(feature); // returns a Number
const style = new Freedo.FreedoPModelStyle();
// Override pointSize expression with a custom function
style.pointSize = {
    evaluate : function(feature) {
        return 1.0;
    }
};
const style = new Freedo.FreedoPModelStyle();
// Override pointSize expression with a number
style.pointSize = 1.0;
const style = new Freedo.FreedoPModelStyle();
// Override pointSize expression with a string
style.pointSize = '${height} / 10';
const style = new Freedo.FreedoPModelStyle();
// Override pointSize expression with a condition
style.pointSize =  {
    conditions : [
        ['${height} > 2', '1.0'],
        ['true', '2.0']
    ]
};

readonly ready : 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

readonly readyPromise : Promise.<FreedoPModelStyle>

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 scaleByDistance property. Alternatively a string or object defining a vec4 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 Cartesian4.

This expression is only applicable to point features in a Vector tile.

Example:
const style = new Freedo.FreedoPModelStyle();
// Override scaleByDistance expression with a string
style.scaleByDistance = 'vec4(1.5e2, 2.0, 1.5e7, 0.5)';
style.scaleByDistance.evaluate(feature); // returns a Cartesian4
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Freedo's standard deprecation policy.

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.

This expression is applicable to all tile formats.

Examples:
const style = new FreedoPModelStyle({
    show : '(regExp("^Chest").test(${County})) && (${YearBuilt} >= 1970)'
});
style.show.evaluate(feature); // returns true or false depending on the feature's properties
const style = new Freedo.FreedoPModelStyle();
// Override show expression with a custom function
style.show = {
    evaluate : function(feature) {
        return true;
    }
};
const style = new Freedo.FreedoPModelStyle();
// Override show expression with a boolean
style.show = true;
};
const style = new Freedo.FreedoPModelStyle();
// Override show expression with a string
style.show = '${Height} > 0';
};
const style = new Freedo.FreedoPModelStyle();
// Override show expression with a condition
style.show = {
    conditions: [
        ['${height} > 2', 'false'],
        ['true', 'true']
    ];
};

readonly style : Object

Gets the object defining the style using the 3D Tiles Styling language.
Default Value: {}
Gets or sets the StyleExpression object used to evaluate the style's translucencyByDistance property. Alternatively a string or object defining a vec4 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 Cartesian4.

This expression is only applicable to point features in a Vector tile.

Example:
const style = new Freedo.FreedoPModelStyle();
// Override translucencyByDistance expression with a string
style.translucencyByDistance = 'vec4(1.5e2, 1.0, 1.5e7, 0.2)';
style.translucencyByDistance.evaluate(feature); // returns a Cartesian4
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Freedo's standard deprecation policy.

Gets or sets the StyleExpression object used to evaluate the style's verticalOrigin property. Alternatively a string or object defining a number 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 VerticalOrigin.

This expression is only applicable to point features in a Vector tile.

Examples:
const style = new FreedoPModelStyle({
    verticalOrigin : VerticalOrigin.TOP
});
style.verticalOrigin.evaluate(feature); // returns a VerticalOrigin
const style = new Freedo.FreedoPModelStyle();
// Override verticalOrigin expression with a custom function
style.verticalOrigin = {
    evaluate : function(feature) {
        return VerticalOrigin.CENTER;
    }
};
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Freedo's standard deprecation policy.