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
public abstract class MBExpression extends FunctionImpl
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 viewExpressions 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
Fields Modifier and Type Field Description static List<String>
colors
static List<String>
decisions
static List
featureData
protected FilterFactory
ff
static List
heatMap
protected JSONArray
json
static List
lookUp
static List
math
protected String
name
protected MBObjectParser
parse
static List
ramps
static List
string
protected MBStyleTransformer
transformer
static List
types
static List
variableBindings
static List
zoom
-
Fields inherited from class FunctionImpl
functionName
-
Fields inherited from interface Expression
NIL
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
MBExpression(JSONArray json)
Please use factory methodcreate(JSONArray)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static boolean
canCreate(String name)
static MBExpression
create(JSONArray json)
Factory method used to produce the correct MBExpression subclass for the provided JSONArray.abstract Expression
getExpression()
Determines which expression to use.String
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.Expression
transformLiteral(Expression ex)
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 Detail
-
json
protected final JSONArray json
-
name
protected final String name
-
ff
protected final FilterFactory ff
-
parse
protected final MBObjectParser parse
-
transformer
protected final MBStyleTransformer transformer
-
featureData
public static final List featureData
-
heatMap
public static final List heatMap
-
lookUp
public static final List lookUp
-
math
public static final List math
-
ramps
public static final List ramps
-
string
public static final List string
-
types
public static final List types
-
variableBindings
public static final List variableBindings
-
zoom
public static final List zoom
-
-
Constructor Detail
-
MBExpression
protected MBExpression(JSONArray json)
Please use factory methodcreate(JSONArray)
- Parameters:
json
- definition
-
-
Method Detail
-
getName
public String 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
public static MBExpression create(JSONArray json)
Factory method used to produce the correct MBExpression subclass for the provided JSONArray.- Parameters:
json
- definition- Returns:
- MBExpression
-
canCreate
public static boolean canCreate(String name)
-
getExpression
public abstract Expression getExpression()
Determines which expression to use.
-
transformLiteral
public Expression transformLiteral(Expression ex)
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
public static Expression transformExpression(JSONArray json)
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
-
-