An alias for string
representing a Color.
Creates an expression that returns an expression with the absolute value.
The expression to evaluate.
An expression that evaluates to the absolute value of the given expression.
An expression that takes the arccosine of another expression.
The range of values returned by acos is [0, PI]
.
|operand|
must be less than or equal to 1
.
The expression of which to take the arccosine. Should result in a number, point or color.
An expression that takes the arccosine of another expression. Results in a number, point or color.
An expression that adds the result of the given expressions.
var _ = ExpressionFactory;
//Evaluates to 3.
var sum = _.add(_.number(1), _.number(2));
//Evaluates to (3, 4, 5).
var point = _.add(_.point({x: 1, y: 2, z: 3}), _.number(2));
The first expression to evaluate. Should result in a number, point or color.
The second expression to evaluate. Should result in the same type as left or a number.
An expression that adds the results of the given expressions. Results in a number, point or color depending on the type of the operands. When a number is used with an other type, the operation is applied to the individual element values and the result is of the other type.
An expression that is the boolean 'and' of the given expressions.
Use this kind of expression as the if-expression in an ifThenElse, as a when-expression in a cases expression or anywhere an expression that resolves to a boolean is required.
The expressions to be 'and'ed together. This can be any number of expressions. Each one should result in a boolean.
An expression that is the boolean 'and' of all given expressions. Results in a boolean.
Creates an expression that evaluates whether the two given expression evaluate to close values, given some threshold. To be used with floating point numbers, depending on the context.
The first expression to evaluate.
The second expression to evaluate.
The Expression describing the maximum threshold before considering both values too far from each other.
An expression that evaluates to true if the two expressions evaluate to close values, given the maximum threshold.
An expression that takes the arcsine of another expression.
The range of values returned by asin is [-PI/2, PI/2]
.
|operand|
must be less than or equal to 1
.
The expression of which to take the arcsine. Should result in a number, point or color.
An expression that takes the arcsine of another expression. Results in a number, point or color.
An expression that takes the arctangent of another expression.
The range of values returned by atan is [-PI/2, PI/2]
.
The expression of which to take the arctangent. Should result in a number, point or color.
An expression that takes the arctangent of another expression. Results in a number, point or color.
Returns an attribute expression. Expressions are evaluated for certain objects. Those object may have attributes ascribed to them. This expression allows access to those attributes by name. Which attributes are available depends on the evaluator of the expression. For example, for parameterized point painting, those attributes are defined in the constructor of the ParameterizedPointPainter.
The name of the attribute to use.
The length of the attribute's vector, 1 if it is a simple number.
An expression that represents the attribute.
Creates an expression that evaluates whether the result of the operand is between a lower and upper bound (inclusive).
In other words, this expression checks whether operand is in the range [lowerBound, upperBound]
.
Use this kind of expression as the if-expression in an ifThenElse, as a when-expression in a cases case expression or anywhere an expression that resolves to a boolean is required.
The operand to evaluate.
The lowerBound to evaluate.
The upperBound to evaluate.
An expression that evaluates to true if the result of operand >= the result of lowerBound and <= the result of upperBound.
Creates an expression representing a boolean.
The value of the boolean.
A boolean constant expression.
Creates a new parameter expression. The difference with boolean is that you can change the value of a parameter later on, and the styling will be updated to reflect the new value without having to re-create the expressions in which it is used. Only booleans may be used as value.
var parameter = ExpressionFactory.booleanParameter(true);
...
parameter.value = false;//Only ever assign booleans.
The initial value of the parameter.
A parameter expression.
Returns an expression that can be used to chain multiple when-then statements together. On the returned case expression, you can add cases by calling when with an expression and subsequently call then with another expression. This creates a chain of if-then-else statements. If no cases match, the result of the default expression is used. The expression given as argument to a when-call should result in boolean.
var defaultExpression = ...;
var someTestExpression = ...;
var someResultExpression = ...;
var someOtherTestExpression = ...;
var someOtherResultExpression = ...;
var caseExpression = ExpressionFactory.cases(defaultExpression);
caseExpression.when(someTestExpression).then(someResultExpression)
.when(someOtherTestExpression).then(someOtherResultExpression);
The expression evaluated if no when-then case is met.
A case expression that can be used to add when-then cases.
Returns an expression that limits an operand to a range. The type of the bounds should be the same.
var _ = ExpressionFactory;
//Evaluates to 47.
var number = _.clamp(_.number(42), _.number(47), _.number(83));
//Evaluates to a point with values clamped between 47 and 83.
var clamped = _.clamp(_.point(p1), _.number(47), _.number(83));
//Evaluates to a point with values of p1 clamped between p2 and p3.
var elementsIndividuallyClamped = _.clamp(_.point(p1), _.point(p2), _.point(p3));
The operand to evaluate. Should result in a number, point or color.
The lowerBound to evaluate. Should result in the same type as operand or a number.
The upperBound to evaluate. Should result in the same type as lowerBound.
An expression that limits a value to the given range. Results in a number, point or color depending on the type of the operands. When a number is used with an other type, the operation is applied to the individual element values and the result is of the other type.
Creates an expression representing a Color.
The value of the color constant, represented by a CSS color string.
A color constant expression.
Creates a new parameter expression. The difference with color is that you can change the value of a parameter later on, and the styling will be updated to reflect the new value without having to re-create the expressions in which it is used. Only colors may be used as value.
var parameter = ExpressionFactory.colorParameter("rgba(47, 83, 127, 1)");
...
parameter.value = "rgba(255, 255, 255, 1)";//Only ever assign colors.
The initial value of the parameter, represented by a CSS color string.
A color parameter expression.
An expression that takes the cosine of another expression.
The expression of which to take the cosine. Should result in a number, point or color. For points or colors, the function is applied to the individual element values. Values assumed to be in radians.
An expression that takes the cosine of another expression. Results in a number, point or color.
An expression that calculates the cross product of two expressions representing vectors.
The first expression to evaluate. Should result in a point (representing a vector).
The second expression to evaluate. Should result in a point (representing a vector).
An expression that calculates the cross product of the given expressions. Results in a point (vector).
Returns an expression representing the default color that is applied to a mesh. The result depends on what is available in the data. It can be the color of a texture, a color attribute, a constant color default, etc.
This type of expression is only supported for mesh styling expressions used by TileSet3DLayer.
An expression that calculates the Euclidean distance between two expressions representing points.
The first expression to evaluate. Should result in a number, point or color.
The second expression to evaluate. Should result in a number, point or color.
An expression that calculates the Euclidean distance between two expressions representing points. Results in a number.
An expression that divides the result of the first expression with the result of the second expression.
var _ = ExpressionFactory;
//Evaluates to 1.
var number = _.divide(_.number(2), _.number(2));
//Evaluates to (1, 2, 3).
var point = _.divide(_.point({x: 2, y: 4, z: 6}), _.number(2));
The first expression to evaluate. Should result in a number, point or color.
The second expression to evaluate. Should result in the same type as left or a number.
An expression that divides the result of the first expression with the result of the second expression. Results in a number, point or color depending on the type of the operands. When a number is used with an other type, the operation is applied to the individual element values and the result is of the other type.
An expression that calculates the dot product of the given expressions. The type of the result of the two given expressions should be the same. You can take the dot product of numbers, points or colors. Points and colors are interpreted as vectors for this operation.
The first expression to evaluate. Should result in a number, point or color.
The second expression to evaluate. Should result in the same type as first.
An expression that calculates the dot product of the given expressions. Results in a number.
Creates an expression that evaluates whether the two given expression evaluate to the same value.
Use this kind of expression as the if-expression in an ifThenElse expression, as a when-expression in a cases expression or anywhere an expression that resolves to a boolean is required.
The first expression to evaluate.
The second expression to evaluate.
An expression that evaluates to true if the two expressions evaluate to the same value.
Creates an expression that evaluates whether the two given expression evaluate to the same value.
Use this kind of expression as the if-expression in an ifThenElse expression, as a when-expression in a cases expression or anywhere an expression that resolves to a boolean is required.
The first expression to evaluate.
The second expression to evaluate.
The Expression describing the maximum threshold before considering both values not equal.
An expression that evaluates to true if the two expressions evaluate to the same value.
Returns an expression that calculates the percentage of the given operand in the range [lowerBound, upperBound]
.
The expression evaluates to (operand - lowerBound) / (upperBound - lowerBound)
.
For values of operand outside the range [lowerBound, upperBound]
, the results will lie outside the range [0, 1]
.
The operand to evaluate. Should result in a number, point or color.
The lowerBound to evaluate. Should result in the same type as operand or a number.
The upperBound to evaluate. Should result in the same type as operand or a number.
An expression that calculates the percentage of the given operand in the range [lowerBound, upperBound]
.
Results in a number, point or color depending on the type of the operands.
When a number is used with an other type,
the operation is applied to the individual element values and the result is of the other type.
Determines whether a pixel is facing to or away from the camera.
Use incolorExpression
to distinguish front-facing from back-facing pixels.
This type of expression is only supported for mesh styling expressions used by TileSet3DLayer.
The facing is determined based on triangle winding.
If you simply wish to hide back-faced triangles, use layer.meshStyle = {facetCulling: FacetCullingType.BACKFACE_CULLING}
.
A boolean expression.
Creates an expression that evaluates whether the result of the first expression is strictly greater than the result of the second expression.
Use this kind of expression as the if-expression in an ifThenElse, as a when-expression in a cases case expression} or anywhere an expression that resolves to a boolean is required.
The first expression to evaluate.
The second expression to evaluate.
An expression that evaluates to true if the result of the first expression is strictly greater than the result of the second expression
Creates an expression that evaluates whether the result of the first expression is greater than or equal to the result of the second expression.
Use this kind of expression as the if-expression in an ifThenElse, as a when-expression in a cases case expression or anywhere an expression that resolves to a boolean is required.
The first expression to evaluate.
The second expression to evaluate.
An expression that evaluates to true if the result of the first expression is greater than or equal to the result of the second expression
Returns an expression that represents an icon. If you want to use headings or draping for parameterized point painting, they should be configured using the ParameterizedPointPainter.
The style describing the icon to use.
An expression that can be used as the icon expression.
An expression that implements if-then-else logic.
The expression that should decide which of the other expressions to take. Should result in a boolean.
The expression whose result will be returned if the ifExpression results in true.
The expression whose result will be returned if the ifExpression results in false. Should result in the same type of value as the thenExpression.
An expression that return the result of one of the other expressions, based on the ifExpression.
Returns an expression that resolves to a boolean based on whether the position is inside a given shape expression. For example:
var _ = ExpressionFactory;
var shape = _.orientedBox(layer.orientedBox);
_.isInside(shape);
results in a contains expression for the bounding oriented box of the layer.
This type of expression is only supported for styling expressions used by TileSet3DLayer. Only orientedBox expressions are supported as shapes.
The shape expression to use for the check.
An expression that represents a contains check on the given shape.
An expression that calculates the length of an expression representing a 3d or 4d vector.
The first expression to evaluate. Should result in a point or color.
Results in an expression that computes the length as a number.
An expression that takes the natural logarithm of another expression.
The expression of which to take the natural logarithm. Should result in a number, point or color.
An expression that takes the natural logarithm of another expression. Results in a number, point or color.
Creates an expression that evaluates whether the result of the first expression is strictly less than the result of the second expression.
Use this kind of expression as the if-expression in an ifThenElse, as a when-expression in a cases case expression. or anywhere an expression that resolves to a boolean is required.
The first expression to evaluate.
The second expression to evaluate.
An expression that evaluates to true if the result of the first expression is strictly less than the result of the second expression
Creates an expression that evaluates whether the result of the first expression is less than or equal to the result of the second expression.
Use this kind of expression as the if-expression in an ifThenElse, as a when-expression in a cases case expression or anywhere an expression that resolves to a boolean is required.
The first expression to evaluate.
The second expression to evaluate.
An expression that evaluates to true if the result of the first expression is less than or equal to the result of the second expression
Returns an expression that maps an index onto an expression. The expression first determines an index, then evaluates the expression corresponding to the index.
For example:
var _ = ExpressionFactory;
_.map(_.number(2), [_.color(red), _.color(green), _.color(blue)], _.color(black)) //returns blue
_.map(_.number(6), [_.color(red), _.color(green), _.color(blue)], _.color(black)) //returns black
Note that when planning to use a large number of icons in the values array, the elements should be icon expressions. Using more complex expressions in the array is possible but then the number of elements is limited. The exact number depends on computer configuration but you can assume it is close to 20.
The expression that calculates the index to use.
An array of value expressions.
The expression used as default when the computed index is not valid.
An expression that maps an index onto an expression.
An expression that returns the maximum of the given expression.
var _ = ExpressionFactory;
//Evaluates to 2.
var number = _.max(_.number(1), _.number(2));
//Evaluates to (2, 2, 3).
var point1 = _.max(_.point({x: 1, y: 2, z: 3}), _.number(2));
//Evaluates to (3, 2, 3).
var point2 = _.max(_.point({x: 1, y: 2, z: 3}), _.point({x: 3, y: 2, z: 1});
The first expression to evaluate. Should result in a number, point or color.
The second expression to evaluate. Should result in the same type as first or a number.
An expression that returns the maximum of the result of the first expression and the result of the second expression. Results in a number, point or color depending on the type of the operands. When a number is used with an other type, the operation is applied to the individual element values and the result is of the other type.
An expression that returns the minimum of the given expressions.
var _ = ExpressionFactory;
//Evaluates to 1.
var number = _.min(_.number(1), _.number(2));
//Evaluates to (1, 2, 2).
var point1 = _.min(_.point({x: 1, y: 2, z: 3}), _.number(2));
//Evaluates to (1, 2, 1).
var point2 = _.min(_.point({x: 1, y: 2, z: 3}), _.point({x: 3, y: 2, z: 1});
The first expression to evaluate. Should result in a number, point or color.
The second expression to evaluate. Should result in the same type as first or a number.
An expression that returns the minimum of the result of the first expression and the result of the second expression. Results in a number, point or color depending on the type of the operands. When a number is used with an other type, the operation is applied to the individual element values and the result is of the other type.
Returns an expression that calculates an interpolated or extrapolated result between the result of first and second based on the result of third. The type of the result of the first two expressions should be the same. You can interpolate between numbers, points or colors. The type of the result of the last expression can be a number or of the same type as the first two. The last argument represents the fraction to use when interpolating or extrapolating.
var _ = ExpressionFactory;
//Evaluates to 83.
var number : _.mix(_.number(47), _.number(83), _.number(1));
//Evaluates to a point halfway between p1 and p2.
var middle = _.mix(_.point(p1), _.point(p2), _.number(0.5));
//Evaluates to a point for which the y-component is close to but not equal to the middle.
var notTheMiddle = _.mix(_.point(p1), _.point(p2), _.point({x: 0.5, y: 0.4, z: 0.5}));
The first expression to evaluate. Should result in a number, point or color.
The second expression to evaluate. Should result in the same type as first.
The third expression to evaluate. Should result in the same type as first or a number.
Represents the fraction.
In range [0,1]
for interpolation, <0
or >1
for extrapolation.
An expression that calculates an interpolated or extrapolated result between the result of first and second based on the result of third. Results in a number, point or color depending on the type of the operands. When a number is used with an other type, the operation is applied to the individual element values and the result is of the other type.
Returns an expression that creates an interpolated value. This expression is not limited to numbers, but can also be used to interpolate points or colors. For example:
var _ = ExpressionFactory;
_.mixmap(_.number(0.75), [_.color(orange), _.color(yellow), _.color(red)])
results in a color between yellow and red.
The fraction, in range [0,1]
.
An array of value expressions.
An expression that creates an interpolated value.
An expression that multiplies the result of the given expressions.
var _ = ExpressionFactory;
//Evaluates to 2.
var number = _.multiply(_.number(1), _.number(2));
//Evaluates to (2, 4, 6).
var point = _.multiply(_.point({x: 1, y: 2, z: 3}), _.number(2));
The first expression to evaluate. Should result in a number, point or color.
The second expression to evaluate. Should result in the same type as left or a number.
An expression that multiplies the results of the given expressions. Results in a number, point or color depending on the type of the operands. When a number is used with an other type, the operation is applied to the individual element values and the result is of the other type.
Creates an expression that evaluates whether the two given expression do not evaluate to the same value.
Use this kind of expression as the if-expression in an ifThenElse, as a when-expression in a cases case expression or anywhere an expression that resolves to a boolean is required.
The first expression to evaluate.
The second expression to evaluate.
An expression that evaluates to false if the two expressions evaluate to the same value.
An expression that normalizes an expression representing a 3d or 4d vector.
The expression to evaluate. Should result in a point or color.
Results in an expression the computes the normalized point or color.
An expression that is the boolean 'not' of the given expression.
Use this kind of expression as the if-expression in an ifThenElse, as a when-expression in a cases expression. or anywhere an expression that resolves to a boolean is required.
The operand. Should result in a boolean.
An expression that is the boolean 'not' of the given expression. Results in a boolean.
Creates an expression representing a number.
The value of the number constant.
A number constant expression.
Creates a new parameter expression. The difference with number is that you can change the value of a parameter later on, and the styling will be updated to reflect the new value without having to re-create the expressions in which it is used. Only numbers may be used as value.
var parameter = ExpressionFactory.numberParameter(47);
...
parameter.value = 83;//Only ever assign numbers.
The initial value of the parameter.
A parameter expression.
An expression that is the boolean 'or' of the given expressions.
Use this kind of expression as the if-expression in an ifThenElse, as a when-expression in a cases expression. or anywhere an expression that resolves to a boolean is required.
The expressions to be 'or'ed together. This can be any number of expressions. Each one should result in a boolean.
An expression that is the boolean 'or' of all given expressions. Results in a boolean.
Creates an expression representing an oriented box.
An oriented box
An expression representing an oriented box.
Creates an expression representing a point.
The value of the point constant.
A point constant expression.
Creates a new parameter expression. The difference with point is that you can change the value of a parameter later on, and the styling will be updated to reflect the new value without having to re-create the expressions in which it is used. Only points may be used as value.
var parameter = ExpressionFactory.pointParameter(p1);
...
parameter.value = p2;//Only ever assign points.
The initial value of the parameter. Can be an object literal with x, y and z properties.
A parameter expression.
Creates an expression that represents the map (or world) position of the feature.
For example, this can be used to style dependent on the distance of the mouse to the feature. Note that the mouse parameter in the code example below needs to be updated when the mouse moves (not shown).
var _ = ExpressionFactory;
var position = _.positionAttribute();
var mouseParam = _.pointParameter({x: 0, y: 0, z: 0});//Initial value. Needs updating.
var distanceToMouse = _.distance(position, mouseParam);//World (Euclidean) distance.
var radiusOfEffect = _.number(1000000);//Only apply when the mouse is (relatively) close to the feature.
var mouseMultiplier = _.ifThenElse(_.lt(distanceToMouse, radiusOfEffect),
_.divide(radiusOfEffect, distanceToMouse),
_.number(1));
var colorExpression = _.multiply(_.color("rgba(127, 127, 127, 1)"), mouseMultiplier);//Brighten as the mouse moves closer.
An expression that represents the position of a feature.
An expression that returns the result of the first expression raised to the power of the result of the second expression. The type of the operands should be the same. The (elements of the) first argument must not be less than 0 and if it is 0, the (corresponding elements of the) second argument must be greater than 0.
The first expression to evaluate. Should result in a number, point or color.
The second expression to evaluate. Should result in the same type as first.
An expression that returns the result of the first expression to the power of the result of the second expression. Results in a number, point or color depending on the type of the operands.
Returns an expression that resolves to a vector pointing downwards (towards the center of the Earth) for everything inside the given shape. It resolves to a zero vector for everything outside the given shape. This expression is useful, for example, as a displacement expression on MeshStyle to displace (parts of) meshes. For example:
var _ = ExpressionFactory;
var shape = _.orientedBox(layer.orientedBox);
_.pushDown(shape);
results in an expression that represents the vector to push down everything inside the bounding oriented box of the layer.
This type of expression is only supported for styling expressions used by TileSet3DLayer. Only orientedBox expressions are supported as shapes.
The shape expression used to define the area and extent of the push down vector.
An expression that represents a displacement based on the given shape.
An expression that takes the sine of another expression.
The expression of which to take the sine. Should result in a number, point or color. For points or colors, the function is applied to the individual element values. Values assumed to be in radians.
An expression that takes the sine of another expression. Results in a number, point or color.
An expression that subtracts the result of the second expression from the result of the first expression.
var _ = ExpressionFactory;
//Evaluates to 1.
var number = _.subtract(_.number(3), _.number(2));
//Evaluates to (1, 2, 3).
var point = _.subtract(_.point({x: 3, y: 4, z: 5}), _.number(2));
The first expression to evaluate. Should result in a number, point or color.
The second expression to evaluate. Should result in the same type as left or a number.
An expression that subtracts the result of the second expression from the result of the first expression. Results in a number, point or color depending on the type of the operands. When a number is used with an other type, the operation is applied to the individual element values and the result is of the other type.
An expression that takes the tangent of another expression.
The expression of which to take the tangent. Should result in a number, point or color. For points or colors, the function is applied to the individual element values. Values assumed to be in radians.
An expression that takes the tangent of another expression. Results in a number, point or color.
The ExpressionFactory allows you to create expressions that can be used in styling and filtering by the LuciadRIA painters.