LuciadCPillar 2023.1.04
luciad::StyleExpressionFactory Class Referencefinal

This factory allows you to create style expressions that can be used when styling data. More...

#include <luciad/layers/styles/expressions/StyleExpressionFactory.h>

Public Types

template<typename T >
using Numeric = std::enable_if_t< std::is_same_v< T, double >||std::is_same_v< T, Coordinate >, T >
 This represents all the types on which numeric operations can be applied. More...
 
template<typename T >
using NumericAndColor = std::enable_if_t< std::is_same_v< T, double >||std::is_same_v< T, Coordinate >||std::is_same_v< T, Color >, T >
 This represents the operations that can be applied on numeric types and on Color. More...
 
template<typename T , typename U >
using NumericAndColorFunctionResult = std::enable_if_t< std::is_same_v< U, double >||std::is_same_v< T, U >, NumericAndColor< T > >
 This represents all functions returning a 'numeric' or 'Color'. More...
 
template<typename T >
using Supported = std::enable_if_t< std::is_same_v< T, double >||std::is_same_v< T, bool >||std::is_same_v< T, Coordinate >||std::is_same_v< T, Color >, T >
 This represents all the types that may be used within the expression factory. More...
 

Public Member Functions

 StyleExpressionFactory ()=delete
 
 ~StyleExpressionFactory ()=delete
 

Static Public Member Functions

static StyleExpression< double > abs (StyleExpression< double > value)
 Creates an expression that returns an expression with the absolute value. More...
 
template<typename T >
static StyleExpression< Numeric< T > > acos (StyleExpression< T > operand)
 Creates an expression that takes the arccosine of another expression. More...
 
template<typename T , typename U = T>
static StyleExpression< NumericAndColorFunctionResult< T, U > > add (StyleExpression< T > first, StyleExpression< U > second)
 Creates an expression that adds the values of the two provided expressions. More...
 
static StyleExpression< bool > andOp (StyleExpression< bool > value1, StyleExpression< bool > value2)
 Creates an expression that is the boolean 'and' of its parts. More...
 
template<typename T >
static StyleExpression< Numeric< T > > asin (StyleExpression< T > operand)
 Creates an expression that takes the arcsine of another expression. More...
 
template<typename T >
static StyleExpression< Numeric< T > > atan (StyleExpression< T > operand)
 Creates an expression that takes the arcsine of another expression. More...
 
static StyleExpression< bool > between (StyleExpression< double > lowerBound, StyleExpression< double > upperBound, StyleExpression< double > value)
 Creates an expression that evaluates whether the result of the operand is between a lower and upper bound (inclusive). More...
 
template<typename T >
static StyleExpression< Supported< T > > cases (StyleExpression< T > defaultExpression, std::vector< StyleExpression< bool > > conditions, std::vector< StyleExpression< T > > expressions)
 Creates a case expression, which has a list of condition expressions and a list of corresponding result expressions, and evaluates to the first result expression whose corresponding condition is true. More...
 
template<typename T , typename U = T>
static StyleExpression< NumericAndColorFunctionResult< T, U > > clamp (StyleExpression< T > operand, StyleExpression< U > lowerBound, StyleExpression< U > upperBound)
 Creates an expression that limits an operand to a range. More...
 
static StyleExpression< ColorcolorAttribute (std::string attributeName)
 Creates an attribute expression that represents a color. More...
 
template<typename T >
static StyleExpression< Supported< T > > constant (T value)
 Creates an expression that represents a 'constant' value. More...
 
static StyleExpression< CoordinatecoordinateAttribute (std::string attributeName)
 Creates an attribute expression that represents a coordinate. More...
 
template<typename T >
static StyleExpression< Numeric< T > > cos (StyleExpression< T > operand)
 Creates an expression that takes the cosine of another expression. More...
 
static StyleExpression< CoordinatecrossProduct (StyleExpression< Coordinate > first, StyleExpression< Coordinate > second)
 Creates an expression that calculates the cross product of two expressions representing Coordinate. More...
 
static StyleExpression< ColordefaultColor ()
 Creates an expression representing the default color that is applied to a mesh. More...
 
template<typename T >
static StyleExpression< double > distance (StyleExpression< Numeric< T > > first, StyleExpression< T > second)
 Creates an expression that calculates the Euclidean distance between two expressions representing points. More...
 
template<typename T , typename U = T>
static StyleExpression< NumericAndColorFunctionResult< T, U > > divide (StyleExpression< T > first, StyleExpression< U > second)
 Creates an expression that divides the value of the first expression by the value of the second expression. More...
 
template<typename T >
static StyleExpression< double > dotProduct (StyleExpression< Numeric< T > > first, StyleExpression< T > second)
 Creates an expression that calculates the dot product of the given expressions. More...
 
static StyleExpression< double > doubleAttribute (std::string attributeName)
 Creates an attribute expression that represents a double. More...
 
static StyleExpression< bool > eq (StyleExpression< double > first, StyleExpression< double > second, StyleExpression< double > threshold)
 Creates an expression that evaluates whether the two given expression evaluate to close values, given some threshold. More...
 
template<typename T >
static StyleExpression< bool > eq (StyleExpression< Supported< T > > first, StyleExpression< T > second)
 Creates an expression that evaluates whether the two given expression evaluate to the same value. More...
 
template<typename T , typename U = T>
static StyleExpression< NumericAndColorFunctionResult< T, U > > fraction (StyleExpression< T > operand, StyleExpression< U > lowerBound, StyleExpression< U > upperBound)
 Creates an expression that calculates the fraction of the given operand in the range [lowerBound, upperBound] evaluates to (operand - lowerBound) / (upperBound - lowerBound). More...
 
static StyleExpression< bool > frontFacing ()
 Creates an expression that determines whether a part of a mesh is facing to or away from the camera. More...
 
static StyleExpression< bool > gt (StyleExpression< double > first, StyleExpression< double > second)
 Creates an expression that evaluates whether the result of the first expression is strictly greater than the result of the second expression. More...
 
static StyleExpression< bool > gte (StyleExpression< double > first, StyleExpression< double > second)
 Creates an expression that evaluates whether the result of the first expression is greater than or equal to the result of the second expression. More...
 
template<typename T >
static StyleExpression< Supported< T > > ifThenElse (StyleExpression< bool > condition, StyleExpression< T > thenExpression, StyleExpression< T > elseExpression)
 Creates an expression that implements if-then-else logic. More...
 
static StyleExpression< double > length (StyleExpression< Coordinate > operand)
 Creates an expression that calculates the length of a Coordinate. More...
 
template<typename T >
static StyleExpression< Numeric< T > > log (StyleExpression< T > operand)
 Creates an expression that takes the natural logarithm of another expression. More...
 
static StyleExpression< bool > lt (StyleExpression< double > first, StyleExpression< double > second)
 Creates an expression that evaluates whether the result of the first expression is strictly less than the result of the second expression. More...
 
static StyleExpression< bool > lte (StyleExpression< double > first, StyleExpression< double > second)
 Creates an expression that evaluates whether the result of the first expression is less than or equal to the result of the second expression. More...
 
template<typename T >
static StyleExpression< NumericAndColor< T > > map (StyleExpression< double > indexExpression, std::vector< StyleExpression< T > > values, StyleExpression< T > defaultExpression)
 Creates an expression that maps an index onto an expression. More...
 
template<typename T , typename U = T>
static StyleExpression< NumericAndColorFunctionResult< T, U > > max (StyleExpression< T > first, StyleExpression< U > second)
 Creates an expression that returns the maximum of the given expressions. More...
 
template<typename T , typename U = T>
static StyleExpression< NumericAndColorFunctionResult< T, U > > min (StyleExpression< T > first, StyleExpression< U > second)
 Creates an expression that returns the minimum of the given expressions. More...
 
template<typename T >
static StyleExpression< NumericAndColor< T > > mix (StyleExpression< T > first, StyleExpression< T > second, StyleExpression< double > fraction)
 Creates an expression that calculates an interpolated or extrapolated result between the result of first and second based on the result of fraction. More...
 
template<typename T >
static StyleExpression< NumericAndColor< T > > mixMap (StyleExpression< double > fraction, std::vector< StyleExpression< T > > values)
 Creates an expression that creates an interpolated value according to a provided fraction. More...
 
template<typename T , typename U = T>
static StyleExpression< NumericAndColorFunctionResult< T, U > > multiply (StyleExpression< T > first, StyleExpression< U > second)
 Creates an expression that multiplies the values of the two provided expressions. More...
 
template<typename T >
static StyleExpression< bool > neq (StyleExpression< Supported< T > > first, StyleExpression< T > second)
 Creates an expression that evaluates whether the two given expression do not evaluate to the same value. More...
 
static StyleExpression< Coordinatenormalize (StyleExpression< Coordinate > operand)
 Creates an expression that normalizes a Coordinate. More...
 
static StyleExpression< bool > notOp (StyleExpression< bool > value)
 Creates an expression that is the boolean 'not' of the given expression. More...
 
static StyleExpression< bool > orOp (StyleExpression< bool > value1, StyleExpression< bool > value2)
 Creates an expression that is the boolean 'or' of its parts. More...
 
template<typename T >
static StyleExpression< Supported< T > > parameter (std::shared_ptr< Observable< T > > observable)
 Creates a parameter expression that is a style expression that can be changed at runtime. More...
 
static StyleExpression< CoordinatepositionAttribute ()
 Creates an expression that represents the position of the data that is styled. More...
 
template<typename T >
static StyleExpression< Numeric< T > > pow (StyleExpression< T > first, StyleExpression< T > second)
 Creates an expression that returns the result of the first expression raised to the power of the result of the second expression. More...
 
template<typename T >
static StyleExpression< Numeric< T > > sin (StyleExpression< T > operand)
 Creates an expression that takes the sine of another expression. More...
 
template<typename T , typename U = T>
static StyleExpression< NumericAndColorFunctionResult< T, U > > subtract (StyleExpression< T > first, StyleExpression< U > second)
 Creates an expression that subtracts the value of the second expression from the value of the first expression. More...
 
template<typename T >
static StyleExpression< Numeric< T > > tan (StyleExpression< T > operand)
 Creates an expression that takes the tangent of another expression. More...
 

Detailed Description

This factory allows you to create style expressions that can be used when styling data.

Example:

if (value1 < value2) {
  return "Color(255, 55, 55, 127)";
else {
  return "Color(55, 255, 55, 127)";
}

can be converted to an expression:

auto expression = ef::ifThenElse(ef::lt(ef::constant(value1), ef::constant(value2)), // comparison
ef::constant(Color(255, 55, 55, 127)), // then
ef::constant(Color(55, 255, 55, 127))); // else
Represents a color based on RGBA (red, green, blue, alpha).
Definition: Color.h:15
Since
2022.0

Member Typedef Documentation

◆ Numeric

template<typename T >
using luciad::StyleExpressionFactory::Numeric = std::enable_if_t<std::is_same_v<T, double> || std::is_same_v<T, Coordinate>, T>

This represents all the types on which numeric operations can be applied.

◆ NumericAndColor

template<typename T >
using luciad::StyleExpressionFactory::NumericAndColor = std::enable_if_t<std::is_same_v<T, double> || std::is_same_v<T, Coordinate> || std::is_same_v<T, Color>, T>

This represents the operations that can be applied on numeric types and on Color.

Note that for Color the numeric operation is applied on each of the color components interpreted using its normalized values ([0, 1]).

◆ NumericAndColorFunctionResult

template<typename T , typename U >
using luciad::StyleExpressionFactory::NumericAndColorFunctionResult = std::enable_if_t<std::is_same_v<U, double> || std::is_same_v<T, U>, NumericAndColor<T> >

This represents all functions returning a 'numeric' or 'Color'.

The function accepts NumericAndColor for its arguments or a combination of a NumericAndColor and a double.

Note that for Color the numeric operation is applied on each of the color components interpreted using its normalized values ([0, 1]).

◆ Supported

template<typename T >
using luciad::StyleExpressionFactory::Supported = std::enable_if_t<std::is_same_v<T, double> || std::is_same_v<T, bool> || std::is_same_v<T, Coordinate> || std::is_same_v<T, Color>, T>

This represents all the types that may be used within the expression factory.

Constructor & Destructor Documentation

◆ StyleExpressionFactory()

luciad::StyleExpressionFactory::StyleExpressionFactory ( )
delete

◆ ~StyleExpressionFactory()

luciad::StyleExpressionFactory::~StyleExpressionFactory ( )
delete

Member Function Documentation

◆ abs()

static StyleExpression< double > luciad::StyleExpressionFactory::abs ( StyleExpression< double >  value)
static

Creates an expression that returns an expression with the absolute value.

Parameters
valuethe input for the abs function
Returns
the absolute value of the given expression

◆ acos()

template<typename T >
static StyleExpression< Numeric< T > > luciad::StyleExpressionFactory::acos ( StyleExpression< T >  operand)
static

Creates an expression that takes the arccosine of another expression.

Parameters
operandthe expression of which to take the arccosine. For Coordinate, the function is applied to the individual element values.
Template Parameters
Tthe type of the operand. Can be double, Coordinate.
Returns
an expression that takes the arccosine of another expression, in radians. Results in a double, Coordinate.

◆ add()

template<typename T , typename U = T>
static StyleExpression< NumericAndColorFunctionResult< T, U > > luciad::StyleExpressionFactory::add ( StyleExpression< T >  first,
StyleExpression< U >  second 
)
static

Creates an expression that adds the values of the two provided expressions.

If both expressions are of the same type, the values are added as expected. If the first expression is of type Coordinate or Color, and second expression is of type double, then the value of second expression is added to every sub element of the first expression (note that for Color, each component is treated as a normalized value ([0, 1])).

Parameters
firstthe first expression to be added
secondthe second expression to be added
Template Parameters
Tthe type of the value of the first expression. Can be double, Coordinate or Color.
Uthe type of the value of the second expression. Can be the same as T, or double.
Returns
an expression of the same type as first.

◆ andOp()

static StyleExpression< bool > luciad::StyleExpressionFactory::andOp ( StyleExpression< bool >  value1,
StyleExpression< bool >  value2 
)
static

Creates an expression that is the boolean 'and' of its parts.

Parameters
value1the first expression to which the 'and' operator is applied
value2the second expression to which the 'and' operator is applied
Returns
an expression that is the boolean 'and' of the given expressions

◆ asin()

template<typename T >
static StyleExpression< Numeric< T > > luciad::StyleExpressionFactory::asin ( StyleExpression< T >  operand)
static

Creates an expression that takes the arcsine of another expression.

Parameters
operandthe expression of which to take the arcsine. For Coordinate, the function is applied to the individual element values.
Template Parameters
Tthe type of the operand. Can be double, Coordinate.
Returns
an expression that takes the arcsine of another expression, in radians. Results in a double, Coordinate.

◆ atan()

template<typename T >
static StyleExpression< Numeric< T > > luciad::StyleExpressionFactory::atan ( StyleExpression< T >  operand)
static

Creates an expression that takes the arcsine of another expression.

Parameters
operandthe expression of which to take the arctangent. For Coordinate, the function is applied to the individual element values.
Template Parameters
Tthe type of the operand. Can be double, Coordinate.
Returns
an expression that takes the arctangent of another expression, in radians. Results in a double, Coordinate.

◆ between()

static StyleExpression< bool > luciad::StyleExpressionFactory::between ( StyleExpression< double >  lowerBound,
StyleExpression< double >  upperBound,
StyleExpression< double >  value 
)
static

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].

Parameters
lowerBounda double expression representing the lowerBound
upperBounda double expression representing the upperBound
valuethe double expression to test
Returns
an expression that evaluates to true if and only if value is in the range [lowerBound, upperBound].

◆ cases()

template<typename T >
static StyleExpression< Supported< T > > luciad::StyleExpressionFactory::cases ( StyleExpression< T >  defaultExpression,
std::vector< StyleExpression< bool > >  conditions,
std::vector< StyleExpression< T > >  expressions 
)
static

Creates a case expression, which has a list of condition expressions and a list of corresponding result expressions, and evaluates to the first result expression whose corresponding condition is true.

If none of the condition expressions are true, then the case expression evaluates to its default expression.

Parameters
defaultExpressionthe default expression
conditionsa list of conditions
expressionsa list of corresponding expressions, must be the same size as conditions
Template Parameters
Tthe type of the value of the expressions. Can be bool, double, Coordinate or Color.
Returns
an expression of the same type as defaultExpression

◆ clamp()

template<typename T , typename U = T>
static StyleExpression< NumericAndColorFunctionResult< T, U > > luciad::StyleExpressionFactory::clamp ( StyleExpression< T >  operand,
StyleExpression< U >  lowerBound,
StyleExpression< U >  upperBound 
)
static

Creates an expression that limits an operand to a range.

The type of the bounds has to be the same. For Coordinate or Color, the clamping is applied to each component independently, either using the corresponding component in the bound (if of the same type as operand) or the bound value if double (note that for Color, each component is treated as a normalized value ([0, 1])).

Parameters
operandthe operand to evaluate. Should result in a double, point or color.
lowerBounda double expression representing the lowerBound
upperBounda double expression representing the upperBound
Template Parameters
Tthe type of the operand: double, Coordinate or Color.
Uthe type of lowerBound and upperBound. Must be equal to T, or double.
Returns
an expression (of the same type as operand) that limits the value of range to the range [lowerBound, upperBound]. If operand is a Color or Coordinate and bounds are doubles, the operation is applies to the individual element values.

◆ colorAttribute()

static StyleExpression< Color > luciad::StyleExpressionFactory::colorAttribute ( std::string  attributeName)
static

Creates an attribute expression that represents a color.

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, and on the data itself.

For example, for OGC 3D tiles point cloud data, there is no fixed set of available attributes, but data files can define certain attributes, like 'color' or 'intensity' for each of the points in the point cloud. When these attributes are known up-front, you can use them as part of the style expression, for example to give each point its actual color, or to create a color based on the intensity value.

You can discover which attributes you can use in the documentation of the model decoder of the format that is used. For example:

When you display 3D tiles data, the layer only loads a subset of the available attributes in memory by default. To make sure that all required attributes are loaded, you must specify which attributes are used in the style expressions.

Parameters
attributeNamethe name of the attribute.
Returns
a color expression that represents the value for the given attribute

◆ constant()

template<typename T >
static StyleExpression< Supported< T > > luciad::StyleExpressionFactory::constant ( value)
static

Creates an expression that represents a 'constant' value.

Parameters
valuea value for the constant.
Template Parameters
Tthe type of the constant: double, bool, Coordinate or Color.
Returns
an expression that represents a constant value.

◆ coordinateAttribute()

static StyleExpression< Coordinate > luciad::StyleExpressionFactory::coordinateAttribute ( std::string  attributeName)
static

Creates an attribute expression that represents a coordinate.

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, and on the data itself.

For example, for OGC 3D tiles point cloud data, there is no fixed set of available attributes, but data files can define certain attributes, like 'color' or 'intensity' for each of the points in the point cloud. When these attributes are known up-front, you can use them as part of the style expression, for example to give each point its actual color, or to create a color based on the intensity value.

You can discover which attributes you can use in the documentation of the model decoder of the format that is used. For example:

When you display 3D tiles data, the layer only loads a subset of the available attributes in memory by default. To make sure that all required attributes are loaded, you must specify which attributes are used in the style expressions.

Parameters
attributeNamethe name of the attribute.
Returns
a coordinate expression that represents the value for the given attribute

◆ cos()

template<typename T >
static StyleExpression< Numeric< T > > luciad::StyleExpressionFactory::cos ( StyleExpression< T >  operand)
static

Creates an expression that takes the cosine of another expression.

Parameters
operandthe expression of which to take the cosine. For Coordinate, the function is applied to the individual element values. Values assumed to be in radians.
Template Parameters
Tthe type of the operand. Can be double or Coordinate.
Returns
an expression that takes the cosine of another expression. Results in a double, Coordinate.

◆ crossProduct()

static StyleExpression< Coordinate > luciad::StyleExpressionFactory::crossProduct ( StyleExpression< Coordinate first,
StyleExpression< Coordinate second 
)
static

Creates an expression that calculates the cross product of two expressions representing Coordinate.

Parameters
firstThe first expression to evaluate.
secondThe second expression to evaluate.
Returns
An expression that calculates the cross product of the given expressions. Results in a Coordinate (vector).

◆ defaultColor()

static StyleExpression< Color > luciad::StyleExpressionFactory::defaultColor ( )
static

Creates 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.

Returns
an expression representing the default color that is applied to a mesh.

◆ distance()

template<typename T >
static StyleExpression< double > luciad::StyleExpressionFactory::distance ( StyleExpression< Numeric< T > >  first,
StyleExpression< T >  second 
)
static

Creates an expression that calculates the Euclidean distance between two expressions representing points.

The distance is defined as follows for the following supported types:

  • double: the distance between the double values: abs(second - first).
  • Coordinate: the regular cartesian distance: sqrt(x*x + y*y + z*z).
Parameters
firstthe first expression
secondthe second expression
Template Parameters
Tthe type of expressions: double, Coordinate.
Returns
an expression that calculates the Euclidean distance between two expressions.

◆ divide()

template<typename T , typename U = T>
static StyleExpression< NumericAndColorFunctionResult< T, U > > luciad::StyleExpressionFactory::divide ( StyleExpression< T >  first,
StyleExpression< U >  second 
)
static

Creates an expression that divides the value of the first expression by the value of the second expression.

If both expressions are of the same type, the values are divided component by component. If the first expression is of type Coordinate or Color, and second expression is of type double, then every sub element of the first expression is divided by the value of second expression (note that for Color, each component is treated as a normalized value ([0, 1])).

Parameters
firstthe dividend expression
secondthe divisor expression
Template Parameters
Tthe type of the value of the first expression. Can be double, Coordinate or Color.
Uthe type of the value of the second expression. Can be the same as T, or double.
Returns
an expression of the same type as first.

◆ dotProduct()

template<typename T >
static StyleExpression< double > luciad::StyleExpressionFactory::dotProduct ( StyleExpression< Numeric< T > >  first,
StyleExpression< T >  second 
)
static

Creates 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 doubles or Coordinate. Coordinates interpreted as vectors for this operation.

Parameters
firstThe first expression to evaluate. Should result in a double, Coordinate.
secondThe second expression to evaluate. Should result in the same type as first.
Template Parameters
Tthe type of the first and second expressions: double, Coordinate.
Returns
An expression that calculates the dot product of the given expressions. Results in a double.

◆ doubleAttribute()

static StyleExpression< double > luciad::StyleExpressionFactory::doubleAttribute ( std::string  attributeName)
static

Creates an attribute expression that represents a double.

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, and on the data itself.

For example, for OGC 3D tiles point cloud data, there is no fixed set of available attributes, but data files can define certain attributes, like 'color' or 'intensity' for each of the points in the point cloud. When these attributes are known up-front, you can use them as part of the style expression, for example to give each point its actual color, or to create a color based on the intensity value.

You can discover which attributes you can use in the documentation of the model decoder of the format that is used. For example:

When you display 3D tiles data, the layer only loads a subset of the available attributes in memory by default. To make sure that all required attributes are loaded, you must specify which attributes are used in the style expressions.

Parameters
attributeNamethe name of the attribute.
Returns
a double expression that represents the value for the given attribute

◆ eq() [1/2]

static StyleExpression< bool > luciad::StyleExpressionFactory::eq ( StyleExpression< double >  first,
StyleExpression< double >  second,
StyleExpression< double >  threshold 
)
static

Creates an expression that evaluates whether the two given expression evaluate to close values, given some threshold.

The size of the threshold depends on the values you want to compare:

  • when you want to compare floating point values, you need to take into account that during rendering the values are represented as 32-bit floating point (float) values. So the size of the threshold depends on the magnitude of the values that are used, and the float precision.
  • when you want to compare values that represent integers, this method should be used with a threshold of 0.5.
Parameters
firstThe first expression to evaluate
secondThe second expression to evaluate
thresholdThe Expression describing the maximum threshold before considering both values too far from each other.
Returns
An expression that evaluates to true if the two expressions evaluate to close values, given the maximum threshold.

◆ eq() [2/2]

template<typename T >
static StyleExpression< bool > luciad::StyleExpressionFactory::eq ( StyleExpression< Supported< T > >  first,
StyleExpression< T >  second 
)
static

Creates an expression that evaluates whether the two given expression evaluate to the same value.

Note: in most cases, it is advised to use a threshold when comparing values. This can be done using the eq method that also takes a threshold expression as parameter.

Parameters
firstthe first expression to be compared
secondthe second expression to be compared
Template Parameters
Tthe type of the value of both expressions. Can be bool, double, Coordinate or Color.
Returns
a boolean expression that evaluates to true if and only if both expressions evaluate to the same value.

◆ fraction()

template<typename T , typename U = T>
static StyleExpression< NumericAndColorFunctionResult< T, U > > luciad::StyleExpressionFactory::fraction ( StyleExpression< T >  operand,
StyleExpression< U >  lowerBound,
StyleExpression< U >  upperBound 
)
inlinestatic

Creates an expression that calculates the fraction of the given operand in the range [lowerBound, upperBound] evaluates to (operand - lowerBound) / (upperBound - lowerBound).

For values of operand outside the range [lowerBound, upperBound], the results will lie outside the range [0, 1]. If the operand is of type Coordinate or Color and the bounds are of type double, the result will be of the same type as the operand with fraction being applied on each component (note that for Color, each component is treated as a normalized value ([0, 1])).

Parameters
operandthe operand to evaluate
lowerBoundthe lowerBound to evaluate.
upperBoundthe upperBoundBound to evaluate.
Template Parameters
Tthe type of the operand: double, Coordinate or Color.
Uthe type of lowerBound and upperBound. Must be equal to T, or double.
Returns
an expression of the same type as operand

◆ frontFacing()

static StyleExpression< bool > luciad::StyleExpressionFactory::frontFacing ( )
static

Creates an expression that determines whether a part of a mesh is facing to or away from the camera.

You can for example use it in a color expression to distinguish front-facing from back-facing pixels, and render those differently. 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 MeshStyle::Builder::facetCulling with FacetCullingType::BackfaceCulling as parameter.

Returns
an expression that determines whether a part of a mesh is facing to or away from the camera.

◆ gt()

static StyleExpression< bool > luciad::StyleExpressionFactory::gt ( StyleExpression< double >  first,
StyleExpression< double >  second 
)
static

Creates an expression that evaluates whether the result of the first expression is strictly greater than the result of the second expression.

Parameters
firstthe first double expression to be compared
secondthe second double expression to be compared
Returns
a boolean expression that evaluates to true if and only if first evaluates to a double greater than second

◆ gte()

static StyleExpression< bool > luciad::StyleExpressionFactory::gte ( StyleExpression< double >  first,
StyleExpression< double >  second 
)
static

Creates an expression that evaluates whether the result of the first expression is greater than or equal to the result of the second expression.

Parameters
firstthe first double expression to be compared
secondthe second double expression to be compared
Returns
a boolean expression that evaluates to true if and only if first evaluates to a double greater than or equal to second

◆ ifThenElse()

template<typename T >
static StyleExpression< Supported< T > > luciad::StyleExpressionFactory::ifThenElse ( StyleExpression< bool >  condition,
StyleExpression< T >  thenExpression,
StyleExpression< T >  elseExpression 
)
static

Creates an expression that implements if-then-else logic.

Parameters
conditionthe expression that decides which of the other expressions to take
thenExpressionthe expression whose result will be returned if condition is true
elseExpressionthe expression whose result will be returned if condition is false
Template Parameters
Tthe type of the value of thenExpression and elseExpression. Can be bool, double, Coordinate or Color.
Returns
an expression that return the result of one of the other expressions, based on the condition

◆ length()

static StyleExpression< double > luciad::StyleExpressionFactory::length ( StyleExpression< Coordinate operand)
static

Creates an expression that calculates the length of a Coordinate.

Parameters
operandThe expression to evaluate.
Returns
an expression that computes the length as a number.

◆ log()

template<typename T >
static StyleExpression< Numeric< T > > luciad::StyleExpressionFactory::log ( StyleExpression< T >  operand)
static

Creates an expression that takes the natural logarithm of another expression.

Parameters
operandThe expression of which to take the natural logarithm. Should result in a double, Coordinate.
Template Parameters
Tthe type of the operand expression: double, Coordinate.
Returns
an expression that takes the natural logarithm of another expression.

◆ lt()

static StyleExpression< bool > luciad::StyleExpressionFactory::lt ( StyleExpression< double >  first,
StyleExpression< double >  second 
)
static

Creates an expression that evaluates whether the result of the first expression is strictly less than the result of the second expression.

Parameters
firstthe first double expression to be compared
secondthe second double expression to be compared
Returns
a boolean expression that evaluates to true if and only if first evaluates to a double less than second

◆ lte()

static StyleExpression< bool > luciad::StyleExpressionFactory::lte ( StyleExpression< double >  first,
StyleExpression< double >  second 
)
static

Creates an expression that evaluates whether the result of the first expression is less than or equal to the result of the second expression.

Parameters
firstthe first double expression to be compared
secondthe second double expression to be compared
Returns
a boolean expression that evaluates to true if and only if first evaluates to a double less than or equal to second

◆ map()

template<typename T >
static StyleExpression< NumericAndColor< T > > luciad::StyleExpressionFactory::map ( StyleExpression< double >  indexExpression,
std::vector< StyleExpression< T > >  values,
StyleExpression< T >  defaultExpression 
)
static

Creates an expression that maps an index onto an expression.

The expression first determines an index, then evaluates the expression corresponding to the index. The indexExpression must evaluate to an integer value in the range [0, size(values) - 1] to be valid.

Parameters
indexExpressionThe expression that calculates the index to use.
valuesan array of value expressions
defaultExpressionThe expression used as default when the computed index is either not an integer or out of range.
Template Parameters
Tthe type of expressions in values: double, Coordinate or Color.
Returns
An expression that maps an index onto an expression.

◆ max()

template<typename T , typename U = T>
static StyleExpression< NumericAndColorFunctionResult< T, U > > luciad::StyleExpressionFactory::max ( StyleExpression< T >  first,
StyleExpression< U >  second 
)
static

Creates an expression that returns the maximum of the given expressions.

Parameters
firstThe first expression to evaluate. Should result in a double, point or color.
secondThe second expression to evaluate. Should result in the same type as first or a double.
Template Parameters
Tthe type of the first expression: double, Coordinate or Color.
Uthe type of the second expression. Must be equal to T, or double.
Returns
an expression that resolves to the maximum of the two provided expressions. When a double is used with another type, the operation is applied to the individual element values and the result is of the other type (note that for Color, each component is treated as a normalized value ([0, 1])).

◆ min()

template<typename T , typename U = T>
static StyleExpression< NumericAndColorFunctionResult< T, U > > luciad::StyleExpressionFactory::min ( StyleExpression< T >  first,
StyleExpression< U >  second 
)
static

Creates an expression that returns the minimum of the given expressions.

Parameters
firstThe first expression to evaluate. Should result in a double, point or color.
secondThe second expression to evaluate. Should result in the same type as first or a double.
Template Parameters
Tthe type of the first expression: double, Coordinate or Color.
Uthe type of the second expression. Must be equal to T, or double.
Returns
an expression that resolves to the minimum of the two provided expressions. When a double is used with another type, the operation is applied to the individual element values and the result is of the other type (note that for Color, each component is treated as a normalized value ([0, 1])).

◆ mix()

template<typename T >
static StyleExpression< NumericAndColor< T > > luciad::StyleExpressionFactory::mix ( StyleExpression< T >  first,
StyleExpression< T >  second,
StyleExpression< double >  fraction 
)
static

Creates an expression that calculates an interpolated or extrapolated result between the result of first and second based on the result of fraction.

Parameters
firstthe first expression that is mixed
secondthe second expression that is mixed
fractionthe mixing fraction. In range [0, 1] for interpolation. May also be a value outside that interval for extrapolation.
Template Parameters
Tthe type of the value to mix. Can be double, Coordinate or Color.
Returns
an expression that calculates an interpolated or extrapolated result between the result of first and second based on the result of the fraction expression. Results in a double, point or color depending on the type of the operands.

◆ mixMap()

template<typename T >
static StyleExpression< NumericAndColor< T > > luciad::StyleExpressionFactory::mixMap ( StyleExpression< double >  fraction,
std::vector< StyleExpression< T > >  values 
)
static

Creates an expression that creates an interpolated value according to a provided fraction.

This expression is not limited to doubles, but can also be used to interpolate points or colors.

Parameters
fractiona fraction, in range [0,1]
valuesan array of value expressions
Template Parameters
Tthe type of values. Can be double, Coordinate or Color.
Returns
an expression that creates an interpolated value.

◆ multiply()

template<typename T , typename U = T>
static StyleExpression< NumericAndColorFunctionResult< T, U > > luciad::StyleExpressionFactory::multiply ( StyleExpression< T >  first,
StyleExpression< U >  second 
)
static

Creates an expression that multiplies the values of the two provided expressions.

If both expressions are of the same type, the values are multiplied component by component. If the first expression is of type Coordinate or Color, and second expression is of type double, then the value of second expression is multiplied with every sub element of the first expression (note that for Color, each component is treated as a normalized value ([0, 1])).

Parameters
firstthe first expression to be multiplied
secondthe second expression to be multiplied
Template Parameters
Tthe type of the value of the first expression. Can be double, Coordinate or Color.
Uthe type of the value of the second expression. Can be the same as T, or double.
Returns
an expression of the same type as first.

◆ neq()

template<typename T >
static StyleExpression< bool > luciad::StyleExpressionFactory::neq ( StyleExpression< Supported< T > >  first,
StyleExpression< T >  second 
)
static

Creates an expression that evaluates whether the two given expression do not evaluate to the same value.

Parameters
firstthe first expression to be compared
secondthe second expression to be compared
Template Parameters
Tthe type of the value of both expressions. Can be bool, double, Coordinate or Color.
Returns
a boolean expression that evaluates to true if and only if the expressions evaluate to different values

◆ normalize()

static StyleExpression< Coordinate > luciad::StyleExpressionFactory::normalize ( StyleExpression< Coordinate operand)
static

Creates an expression that normalizes a Coordinate.

Parameters
operandThe expression to evaluate.
Returns
an expression the computes the normalized Coordinate.

◆ notOp()

static StyleExpression< bool > luciad::StyleExpressionFactory::notOp ( StyleExpression< bool >  value)
static

Creates an expression that is the boolean 'not' of the given expression.

Parameters
valuea boolean expression
Returns
an expression that is the boolean 'not' of the given expression

◆ orOp()

static StyleExpression< bool > luciad::StyleExpressionFactory::orOp ( StyleExpression< bool >  value1,
StyleExpression< bool >  value2 
)
static

Creates an expression that is the boolean 'or' of its parts.

Parameters
value1the first expression to which the 'or' operator is applied
value2the second expression to which the 'or' operator is applied
Returns
an expression that is the boolean 'or' of the given expressions

◆ parameter()

template<typename T >
static StyleExpression< Supported< T > > luciad::StyleExpressionFactory::parameter ( std::shared_ptr< Observable< T > >  observable)
static

Creates a parameter expression that is a style expression that can be changed at runtime.

When it is changed, the styling will be updated to reflect the new value without having to re-create the expressions in which it is used. This makes it possible to make changes to the styling with almost-zero overhead.

Parameters
observablean object that represents a mutable value. Users can hold on to this Observable in order to change the parameter value.
Template Parameters
Tthe type of the constant: double, bool, Coordinate or Color.
Returns
a new parameter expression

◆ positionAttribute()

static StyleExpression< Coordinate > luciad::StyleExpressionFactory::positionAttribute ( )
static

Creates an expression that represents the position of the data that is styled.

For example, for point clouds it represents for the position of an individual point in that point cloud. This for example makes it possible to adapt the transparency of points of a point cloud depending on their distance from an other location.

Returns
a coordinate expression that represents the position of the data that is being styled.

◆ pow()

template<typename T >
static StyleExpression< Numeric< T > > luciad::StyleExpressionFactory::pow ( StyleExpression< T >  first,
StyleExpression< T >  second 
)
static

Creates 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.

Parameters
firstThe first expression to evaluate. Should result in a double, Coordinate or Color.
secondThe second expression to evaluate. Should result in the same type as first.
Template Parameters
Tthe type of the expressions: double, Coordinate.
Returns
An expression that returns the result of the first expression to the power of the result of the second expression. Results in a double, Coordinate depending on the type of the operands.

◆ sin()

template<typename T >
static StyleExpression< Numeric< T > > luciad::StyleExpressionFactory::sin ( StyleExpression< T >  operand)
static

Creates an expression that takes the sine of another expression.

Parameters
operandthe expression of which to take the sine. For Coordinate, the function is applied to the individual element values. Values assumed to be in radians.
Template Parameters
Tthe type of the operand. Can be double, Coordinate.
Returns
an expression that takes the sine of another expression. Results in a double, Coordinate.

◆ subtract()

template<typename T , typename U = T>
static StyleExpression< NumericAndColorFunctionResult< T, U > > luciad::StyleExpressionFactory::subtract ( StyleExpression< T >  first,
StyleExpression< U >  second 
)
static

Creates an expression that subtracts the value of the second expression from the value of the first expression.

If both expressions are of the same type, the values are subtracted as expected. If the first expression is of type Coordinate or Color, and second expression is of type double, then the value of second expression is subtracted from every sub element of the first expression (note that for Color, each component is treated as a normalized value ([0, 1])).

Parameters
firstthe expression to be subtracted from
secondthe expression to be subtracted
Template Parameters
Tthe type of the value of the first expression. Can be double, Coordinate or Color.
Uthe type of the value of the second expression. Can be the same as T, or double.
Returns
an expression of the same type as first.

◆ tan()

template<typename T >
static StyleExpression< Numeric< T > > luciad::StyleExpressionFactory::tan ( StyleExpression< T >  operand)
static

Creates an expression that takes the tangent of another expression.

Parameters
operandthe expression of which to take the tangent. For Coordinate, the function is applied to the individual element values. Values assumed to be in radians.
Template Parameters
Tthe type of the operand. Can be double, Coordinate.
Returns
an expression that takes the tangent of another expression. Results in a double, Coordinate.