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 Listprotected final FilterFactorystatic final Listprotected final JSONArraystatic final Liststatic final Listprotected final Stringprotected final MBObjectParserstatic final Liststatic final Listprotected final MBStyleTransformerstatic final Liststatic final Liststatic final ListFields inherited from class FunctionImpl
functionNameFields inherited from interface Expression
NIL -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMBExpression(JSONArray json) Please use factory methodcreate(JSONArray) -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanstatic MBExpressioncreate(JSONArray json) Factory method used to produce the correct MBExpression subclass for the provided JSONArray.abstract ExpressionDetermines which expression to use.getName()Gets the name of this function.protected voidthrowInsufficientArgumentCount(String expression, int argCount) protected voidthrowUnexpectedArgumentCount(String expression, int argCount) static ExpressiontransformExpression(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, toStringMethods inherited from class ExpressionAbstract
evaluateMethods 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:FunctionImplGets the name of this function.- Specified by:
getNamein interfaceFunction- Overrides:
getNamein 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
-