Package org.geotools.mbstyle.expression
Class MBExpression
Object
ExpressionAbstract
FunctionImpl
MBExpression
- All Implemented Interfaces:
Expression
,Function
- Direct Known Subclasses:
MBColor
,MBDecision
,MBFeatureData
,MBHeatmap
,MBLookup
,MBMath
,MBRampsScalesCurves
,MBString
,MBTypes
,MBVariableBinding
,MBZoom
The value for any layout property, paint property, or filter may be specified as an expression. An expression defines
a formula for computing the value of the property using the operators described below: -Mathematical operators for
performing arithmetic and other operations on numeric values -Logical operators for manipulating boolean values and
making conditional decisions -String operators for manipulating strings -Data operators, providing access to the
properties of source features -Camera operators, providing access to the parameters defining the current map view
Expressions are represented as JSON arrays. The first element of an expression array is a string naming the expression operator, e.g. "*"or "case". Subsequent elements (if any) are the arguments to the expression. Each argument is either a literal value (a string, number, boolean, or null), or another expression array.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final List
protected final FilterFactory
static final List
protected final JSONArray
static final List
static final List
protected final String
protected final MBObjectParser
static final List
static final List
protected final MBStyleTransformer
static final List
static final List
static final List
Fields inherited from class FunctionImpl
functionName
Fields inherited from interface Expression
NIL
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
MBExpression
(JSONArray json) Please use factory methodcreate(JSONArray)
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
static MBExpression
create
(JSONArray json) Factory method used to produce the correct MBExpression subclass for the provided JSONArray.abstract Expression
Determines which expression to use.getName()
Gets the name of this function.protected void
throwInsufficientArgumentCount
(String expression, int argCount) protected void
throwUnexpectedArgumentCount
(String expression, int argCount) static Expression
transformExpression
(JSONArray json) Creates an MBExpression and calls the associated function.A function to evaluate a given parameter as an expression and use the MBStyleTransformer to transform Mapbox tokens into CQL expressions.Methods inherited from class FunctionImpl
accept, dispatchArguments, equals, evaluate, functionName, getFallbackValue, getFunctionName, getParameters, getParameterValue, getParameterValue, hashCode, setFallbackValue, setName, setParameters, toString
Methods inherited from class ExpressionAbstract
evaluate
Methods inherited from interface Expression
evaluate
-
Field Details
-
json
protected final JSONArray json -
name
-
ff
-
parse
-
transformer
-
colors
-
decisions
-
featureData
-
heatMap
-
lookUp
-
math
-
ramps
-
string
-
types
-
variableBindings
-
zoom
-
-
Constructor Details
-
MBExpression
protected MBExpression(JSONArray json) Please use factory methodcreate(JSONArray)
- Parameters:
json
- definition
-
-
Method Details
-
getName
Description copied from class:FunctionImpl
Gets the name of this function.- Specified by:
getName
in interfaceFunction
- Overrides:
getName
in classFunctionImpl
- Returns:
- the name of the function.
-
create
Factory method used to produce the correct MBExpression subclass for the provided JSONArray.- Parameters:
json
- definition- Returns:
- MBExpression
-
canCreate
-
getExpression
Determines which expression to use. -
transformLiteral
A function to evaluate a given parameter as an expression and use the MBStyleTransformer to transform Mapbox tokens into CQL expressions.- Returns:
- cq; text expression
-
transformExpression
Creates an MBExpression and calls the associated function. -
throwUnexpectedArgumentCount
protected void throwUnexpectedArgumentCount(String expression, int argCount) throws MBFormatException - Throws:
MBFormatException
-
throwInsufficientArgumentCount
protected void throwInsufficientArgumentCount(String expression, int argCount) throws MBFormatException - Throws:
MBFormatException
-