ExpressionScope

interface ExpressionScope

Inheritors

Types

Link copied to clipboard
data class CaseBranch<Output>
Link copied to clipboard
data class FormatStyle(val textFont: Expression<String>? = null, val textColor: Expression<String>? = null, val fontScale: Expression<Number>? = null)
Link copied to clipboard
data class MatchBranch<Label, Output>

Functions

Link copied to clipboard
open fun abs(value: Expression<Number>): Expression<Number>
Link copied to clipboard
Link copied to clipboard
open fun acos(value: Expression<Number>): Expression<Number>
Link copied to clipboard
open fun all(vararg expressions: Expression<Boolean>): Expression<Boolean>
Link copied to clipboard
open fun any(vararg expressions: Expression<Boolean>): Expression<Boolean>
Link copied to clipboard
open fun <T> array(value: Expression<*>, type: Expression<String>? = null, length: Expression<Number>? = null): Expression<List<T>>

Asserts that the input is an array (optionally with a specific item type and length). If, when the input expression is evaluated, it is not of the asserted type, then this assertion will cause the whole expression to be aborted.

Link copied to clipboard
open fun asin(value: Expression<Number>): Expression<Number>
Link copied to clipboard
open fun <T> at(index: Expression<Number>, array: Expression<List<T>>): Expression<T>

Retrieves an item from an array.

Link copied to clipboard
open fun atan(value: Expression<Number>): Expression<Number>
Link copied to clipboard
open fun boolean(value: Expression<*>, vararg fallbacks: Expression<*>): Expression<Boolean>

Asserts that the input value is a boolean. If multiple values are provided, each one is evaluated in order until a boolean is obtained. If none of the inputs are booleans, the expression is an error.

Link copied to clipboard
open fun <T> case(vararg branches: ExpressionScope.CaseBranch<T>, fallback: Expression<T>): Expression<T>

Selects the first output whose corresponding test condition evaluates to true, or the fallback value otherwise.

Link copied to clipboard
open fun ceil(value: Expression<Number>): Expression<Number>
Link copied to clipboard
open fun <T> coalesce(vararg values: Expression<T?>): Expression<T>

Evaluates each expression in turn until the first non-null value is obtained, and returns that value.

Link copied to clipboard
open fun collator(caseSensitive: Expression<Boolean>? = null, diacriticSensitive: Expression<Boolean>? = null, locale: Expression<String>? = null): Expression<TCollator>

Returns a collator for use in locale-dependent comparison operations. The caseSensitive and diacriticSensitive options default to false. The locale argument specifies the IETF language tag of the locale to use. If none is provided, the default locale is used. If the requested locale is not available, the collator will use a system-defined fallback locale. Use resolvedLocale to test the results of locale fallback behavior.

Link copied to clipboard
open fun concat(vararg strings: Expression<String>): Expression<String>
Link copied to clipboard
open fun const(color: Color): Expression<Color>
open fun const(bool: Boolean): Expression<Boolean>
open fun const(number: Number): Expression<Number>
open fun const(string: String): Expression<String>
Link copied to clipboard
open fun cos(value: Expression<Number>): Expression<Number>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun e(): Expression<Number>
Link copied to clipboard
open infix fun Expression<*>.eq(other: Expression<*>): Expression<Boolean>
open fun eq(left: Expression<String>, right: Expression<String>, collator: Expression<TCollator>? = null): Expression<Boolean>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Returns a formatted string for displaying mixed-format text in the text-field property. The input may contain a string literal or expression, including an 'image' expression. Strings may be followed by a style override object that supports the following properties:

Link copied to clipboard
Link copied to clipboard
@JvmName(name = "getAtIndex")
open operator fun <T> Expression<List<T>>.get(index: Expression<Number>): Expression<T>

open fun <T> get(key: Expression<String>, obj: Expression<Map<String, *>>? = null): Expression<T>

Retrieves a property value from the current feature's properties, or from another object if a second argument is provided. Returns null if the requested property is missing.

Link copied to clipboard
@JvmName(name = "gtNumber")
open infix fun Expression<Number>.gt(other: Expression<Number>): Expression<Boolean>
@JvmName(name = "gtString")
open infix fun Expression<String>.gt(other: Expression<String>): Expression<Boolean>
open fun gt(left: Expression<String>, right: Expression<String>, collator: Expression<TCollator>? = null): Expression<Boolean>
Link copied to clipboard
@JvmName(name = "gteNumber")
open infix fun Expression<Number>.gte(other: Expression<Number>): Expression<Boolean>
@JvmName(name = "gteString")
open infix fun Expression<String>.gte(other: Expression<String>): Expression<Boolean>
open fun gte(left: Expression<String>, right: Expression<String>, collator: Expression<TCollator>? = null): Expression<Boolean>
Link copied to clipboard
open fun has(key: Expression<String>, obj: Expression<Map<String, *>>? = null): Expression<Boolean>

Tests for the presence of an property value in the current feature's properties, or from another object if a second argument is provided.

Link copied to clipboard
Link copied to clipboard
open fun <T> id(): Expression<T>
Link copied to clipboard

Returns an image type for use in icon-image, *-pattern entries and as a section in the unformatted expression. If set, the image argument will check that the requested image exists in the style and will return either the resolved image name or null, depending on whether or not the image is currently in the style. This validation process is synchronous and requires the image to have been added to the style before requesting it in the image argument.

Link copied to clipboard
@JvmName(name = "inListInfix")
open infix fun Expression<*>.in(other: Expression<List<*>>): Expression<Boolean>
@JvmName(name = "inStringInfix")
open infix fun Expression<String>.in(other: Expression<String>): Expression<Boolean>

@JvmName(name = "inList")
open fun in(needle: Expression<*>, haystack: Expression<List<*>>): Expression<Boolean>

Determines whether an item exists in an array.

@JvmName(name = "inString")
open fun in(needle: Expression<String>, haystack: Expression<String>): Expression<Boolean>

Determines whether a substring exists in a string.

Link copied to clipboard
open fun indexOf(value: Expression<*>, array: Expression<List<*>>, start: Expression<Number>? = null): Expression<Number>

Returns the first position at which an item can be found in an array or a substring can be found in a string, or -1 if the input cannot be found. Accepts an optional index from where to begin the search. In a string, a UTF-16 surrogate pair counts as a single position.

Link copied to clipboard
open fun insets(insets: Insets): Expression<Insets>
open fun insets(top: Number, right: Number, bottom: Number, left: Number): Expression<Insets>
Link copied to clipboard
@JvmName(name = "interpolateColor")
open fun interpolate(type: Expression<TInterpolationType>, input: Expression<Number>, vararg stops: Pair<Number, Expression<Color>>): Expression<Color>
@JvmName(name = "interpolatePoint")
open fun interpolate(type: Expression<TInterpolationType>, input: Expression<Number>, vararg stops: Pair<Number, Expression<Point>>): Expression<Point>
@JvmName(name = "interpolateNumber")
open fun interpolate(type: Expression<TInterpolationType>, input: Expression<Number>, vararg stops: Pair<Number, Expression<Number>>): Expression<Number>
@JvmName(name = "interpolateNumbers")
open fun interpolate(type: Expression<TInterpolationType>, input: Expression<Number>, vararg stops: Pair<Number, Expression<List<Number>>>): Expression<List<Number>>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
@JvmName(name = "lengthOfString")
open fun length(value: Expression<String>): Expression<Number>
@JvmName(name = "lengthOfList")
open fun length(value: Expression<List<*>>): Expression<Number>

Gets the length of an array or string. In a string, a UTF-16 surrogate pair counts as a single position.

Link copied to clipboard
open fun <T> let(name: String, value: Expression<*>, expression: Expression<T>): Expression<T>

Binds expressions to named variables, which can then be referenced in the result expression using var.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun <T> literal(values: List<Expression<T>>): Expression<List<T>>

Produces a literal array value.

open fun <T> literal(values: Map<String, Expression<T>>): Expression<Map<String, T>>

Produces a literal object value.

Link copied to clipboard
open fun ln(value: Expression<Number>): Expression<Number>
Link copied to clipboard
open fun ln2(): Expression<Number>
Link copied to clipboard
Link copied to clipboard
open fun log2(value: Expression<Number>): Expression<Number>
Link copied to clipboard
@JvmName(name = "ltNumber")
open infix fun Expression<Number>.lt(other: Expression<Number>): Expression<Boolean>
@JvmName(name = "ltString")
open infix fun Expression<String>.lt(other: Expression<String>): Expression<Boolean>
open fun lt(left: Expression<String>, right: Expression<String>, collator: Expression<TCollator>? = null): Expression<Boolean>
Link copied to clipboard
@JvmName(name = "lteNumber")
open infix fun Expression<Number>.lte(other: Expression<Number>): Expression<Boolean>
@JvmName(name = "lteString")
open infix fun Expression<String>.lte(other: Expression<String>): Expression<Boolean>
open fun lte(left: Expression<String>, right: Expression<String>, collator: Expression<TCollator>? = null): Expression<Boolean>
Link copied to clipboard
@JvmName(name = "matchNumbers")
open fun <T> match(input: Expression<Number>, fallback: Expression<T>, vararg branches: ExpressionScope.MatchBranch<Number, T>): Expression<T>
@JvmName(name = "matchStrings")
open fun <T> match(input: Expression<String>, fallback: Expression<T>, vararg branches: ExpressionScope.MatchBranch<String, T>): Expression<T>

Selects the output whose label value matches the input value, or the fallback value if no match is found. The input can be any expression (e.g. "get", "building_type"). Each label must be either:

Link copied to clipboard
open fun max(vararg numbers: Expression<Number>): Expression<Number>
Link copied to clipboard
open fun min(vararg numbers: Expression<Number>): Expression<Number>
Link copied to clipboard
open operator fun Expression<Number>.minus(other: Expression<Number>): Expression<Number>
Link copied to clipboard
open infix fun Expression<*>.neq(other: Expression<*>): Expression<Boolean>
open fun neq(left: Expression<String>, right: Expression<String>, collator: Expression<TCollator>? = null): Expression<Boolean>
Link copied to clipboard
open fun <T> nil(): Expression<T>
Link copied to clipboard
@JvmName(name = "notOperator")
open operator fun Expression<Boolean>.not(): Expression<Boolean>
open fun not(expression: Expression<Boolean>): Expression<Boolean>
Link copied to clipboard
open fun number(value: Expression<*>, vararg fallbacks: Expression<*>): Expression<Number>

Asserts that the input value is a number. If multiple values are provided, each one is evaluated in order until a number is obtained. If none of the inputs are numbers, the expression is an error.

Link copied to clipboard
open fun numberFormat(number: Expression<Number>, locale: Expression<String>? = null, currency: Expression<String>? = null, minFractionDigits: Expression<Number>? = null, maxFractionDigits: Expression<Number>? = null): Expression<String>

Converts the input number into a string representation using the providing formatting rules. If set, the locale argument specifies the locale to use, as a BCP 47 language tag. If set, the currency argument specifies an ISO 4217 code to use for currency-style formatting. If set, the min-fraction-digits and max-fraction-digits arguments specify the minimum and maximum number of fractional digits to include.

Link copied to clipboard
open fun <T> object(value: Expression<*>, vararg fallbacks: Expression<*>): Expression<Map<String, T>>

Asserts that the input value is an object. If multiple values are provided, each one is evaluated in order until an object is obtained. If none of the inputs are objects, the expression is an error.

Link copied to clipboard
open fun pi(): Expression<Number>
Link copied to clipboard
open operator fun Expression<Number>.plus(other: Expression<Number>): Expression<Number>
Link copied to clipboard
open fun point(point: Point): Expression<Point>
open fun point(x: Number, y: Number): Expression<Point>
Link copied to clipboard
Link copied to clipboard
open fun product(vararg numbers: Expression<Number>): Expression<Number>
Link copied to clipboard
open fun <T> properties(): Expression<Map<String, T>>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun sin(value: Expression<Number>): Expression<Number>
Link copied to clipboard
@JvmName(name = "sliceString")
open fun slice(value: Expression<String>, start: Expression<Number>, length: Expression<Number>? = null): Expression<String>

Returns a substring from a string from a specified start index, or between a start index and an end index if set. The return value is inclusive of the start index but not of the end index. A UTF-16 surrogate pair counts as a single position.

@JvmName(name = "sliceList")
open fun <T> slice(value: Expression<List<T>>, start: Expression<Number>, length: Expression<Number>? = null): Expression<T>

Returns an item from an list from a specified start index, or between a start index and an end index if set. The return value is inclusive of the start index but not of the end index.

Link copied to clipboard
open fun sqrt(value: Expression<Number>): Expression<Number>
Link copied to clipboard
open fun <Output> step(input: Expression<Number>, fallback: Expression<Output>, vararg stops: Pair<Number, Expression<Output>>): Expression<Output>
Link copied to clipboard
open fun string(value: Expression<*>, vararg fallbacks: Expression<*>): Expression<String>

Asserts that the input value is a string. If multiple values are provided, each one is evaluated in order until a string is obtained. If none of the inputs are strings, the expression is an error.

Link copied to clipboard
open fun sum(vararg numbers: Expression<Number>): Expression<Number>
Link copied to clipboard
open fun tan(value: Expression<Number>): Expression<Number>
Link copied to clipboard
Link copied to clipboard
open operator fun Expression<Number>.times(other: Expression<Number>): Expression<Number>
Link copied to clipboard
open fun toBoolean(value: Expression<*>): Expression<Boolean>

Converts the input value to a boolean. The result is false when then input is an empty string, 0, false, null, or NaN; otherwise it is true.

Link copied to clipboard
open fun toColor(value: Expression<*>, vararg fallbacks: Expression<*>): Expression<Color>

Converts the input value to a color. If multiple values are provided, each one is evaluated in order until the first successful conversion is obtained. If none of the inputs can be converted, the expression is an error.

Link copied to clipboard
open fun toNumber(value: Expression<*>, vararg fallbacks: Expression<*>): Expression<Number>

Converts the input value to a number, if possible. If the input is null or false, the result is 0. If the input is true, the result is 1. If the input is a string, it is converted to a number as specified by the "ToNumber Applied to the String Type" algorithm of the ECMAScript Language Specification. If multiple values are provided, each one is evaluated in order until the first successful conversion is obtained. If none of the inputs can be converted, the expression is an error.

Link copied to clipboard
Link copied to clipboard
open fun toString(value: Expression<*>): Expression<String>

Converts the input value to a string. If the input is null, the result is "". If the input is a boolean, the result is "true" or "false". If the input is a number, it is converted to a string as specified by the "NumberToString" algorithm of the ECMAScript Language Specification. If the input is a color, it is converted to a string of the form "rgba(r,g,b,a)", where r, g, and b are numerals ranging from 0 to 255, and a ranges from 0 to 1. Otherwise, the input is converted to a string in the format specified by the JSON.stringify function of the ECMAScript Language Specification.

Link copied to clipboard
open fun typeof(expression: Expression<*>): Expression<String>

Returns a string describing the type of the given value.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun <T> var(name: String): Expression<T>

References variable bound using let.

Link copied to clipboard
Link copied to clipboard
open fun zoom(): Expression<Number>