Package org.geotools.mbstyle.function
Class ZoomLevelFunction
- Object
-
- ExpressionAbstract
-
- DefaultExpression
-
- FunctionExpressionImpl
-
- ZoomLevelFunction
-
- All Implemented Interfaces:
Expression
,Function
,FunctionExpression
,Factory
public class ZoomLevelFunction extends FunctionExpressionImpl
Function that takes a scale denominator and a srid and outputs the zoom level.Note: EPSG:3857 is currently the only supported srid, and zoom levels are assumed to be at the equator.
Example:ff.function("zoomLevel", ff.function("env", ff.literal("wms_scale_denominator")), ff.literal("EPSG:3857") );
The above function would evaluate to the zoomLevel that corresponds to the current environment's wms_scale_denominator, for EPSG:3857.
Example 2:ff.function("zoomLevel", ff.literal(136494.693347), ff.literal("EPSG:3857") );
The above function would evaluate to a zoomLevel of 12.
-
-
Field Summary
Fields Modifier and Type Field Description static double
EPSG_3857_O_SCALE
Scale denominator of the root tile.static String
MBSTYLE_ROOT_TILE_PIXELS_KEY
Name of the system variable controllingROOT_TILE_PIXELS
static FunctionName
NAME
static int
ROOT_TILE_PIXELS
Number of pixels in the side of the root tile.-
Fields inherited from class FunctionExpressionImpl
fallback, functionName, name, params
-
Fields inherited from interface Expression
NIL
-
-
Constructor Summary
Constructors Constructor Description ZoomLevelFunction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
evaluate(Object feature)
Subclass should override, default implementation returns null.int
getArgCount()
-
Methods inherited from class FunctionExpressionImpl
accept, equals, functionName, getExpression, getFallbackValue, getFunctionName, getImplementationHints, getName, getParameters, hashCode, setFallbackValue, setParameters, toString
-
Methods inherited from class DefaultExpression
isAttributeExpression, isExpression, isFunctionExpression, isGeometryExpression, isLiteralExpression, isMathExpression
-
Methods inherited from class ExpressionAbstract
evaluate
-
Methods inherited from interface Expression
evaluate
-
-
-
-
Field Detail
-
NAME
public static final FunctionName NAME
-
MBSTYLE_ROOT_TILE_PIXELS_KEY
public static final String MBSTYLE_ROOT_TILE_PIXELS_KEY
Name of the system variable controllingROOT_TILE_PIXELS
- See Also:
- Constant Field Values
-
ROOT_TILE_PIXELS
public static final int ROOT_TILE_PIXELS
Number of pixels in the side of the root tile. Assumes 512 if not otherwise configured.
-
EPSG_3857_O_SCALE
public static final double EPSG_3857_O_SCALE
Scale denominator of the root tile. Changes based on the ROOT_TILE_PIXELS value.
-
-
Method Detail
-
getArgCount
public int getArgCount()
-
evaluate
public Object evaluate(Object feature)
Description copied from class:ExpressionAbstract
Subclass should override, default implementation returns null.- Specified by:
evaluate
in interfaceExpression
- Overrides:
evaluate
in classFunctionExpressionImpl
- Returns:
- default implementation returns null
-
-