Package org.geotools.mbstyle.layer
Class BackgroundMBLayer
-
public class BackgroundMBLayer extends MBLayer
The background color or pattern of the map.MBLayer wrapper around a
JSONObjectrepresentation of a "background" type latyer. All methods act as accessors on provided JSON layer, no other state is maintained. This allows modifications to be made cleanly with out chance of side-effect.- get methods: access the json directly
- query methods: provide logic / transforms to GeoTools classes as required.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class MBLayer
MBLayer.Visibility
-
-
Constructor Summary
Constructors Constructor Description BackgroundMBLayer(JSONObject json)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExpressionbackgroundColor()MapsgetBackgroundColor()to anExpression.ExpressionbackgroundOpacity()MapsgetBackgroundOpacity()to anExpression.ExpressionbackgroundPattern()MapsgetBackgroundPattern()to anExpression.protected SemanticTypedefaultSemanticType()ColorgetBackgroundColor()Optional color.NumbergetBackgroundOpacity()Optional number.StringgetBackgroundPattern()Optional string.FillgetFill(MBStyle styleContext)StringgetType()Rendering type of this layer.booleanhasBackgroundPattern()List<FeatureTypeStyle>transformInternal(MBStyle styleContext)TransformBackgroundMBLayerto GeoTools FeatureTypeStyle.-
Methods inherited from class MBLayer
create, equals, filter, getFilter, getId, getJson, getLayout, getMaxZoom, getMetadata, getMinZoom, getPaint, getRef, getSource, getSourceLayer, getVisibility, hashCode, layout, paint, toString, transform, transform, visibility
-
-
-
-
Method Detail
-
defaultSemanticType
protected SemanticType defaultSemanticType()
-
getBackgroundColor
public Color getBackgroundColor()
Optional color. Defaults to #000000. Disabled by background-pattern.- Returns:
- The color with which the background will be drawn.
-
backgroundColor
public Expression backgroundColor()
MapsgetBackgroundColor()to anExpression.Optional color. Defaults to #000000. Disabled by background-pattern.
- Returns:
- The color with which the background will be drawn.
-
getBackgroundPattern
public String getBackgroundPattern()
Optional string. Name of image in sprite to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512).- Returns:
- Name of image in sprite to use for drawing an image background, or null if not defined.
-
hasBackgroundPattern
public boolean hasBackgroundPattern()
- Returns:
- True if the layer has a background-pattern explicitly provided.
-
backgroundPattern
public Expression backgroundPattern()
MapsgetBackgroundPattern()to anExpression.Optional string. Name of image in sprite to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512).
- Returns:
- Name of image in sprite to use for drawing an image background, or null if not defined.
-
getBackgroundOpacity
public Number getBackgroundOpacity()
Optional number. Defaults to 1.- Returns:
- The opacity at which the background will be drawn.
-
backgroundOpacity
public Expression backgroundOpacity()
- Returns:
- The opacity at which the background will be drawn.
-
transformInternal
public List<FeatureTypeStyle> transformInternal(MBStyle styleContext)
TransformBackgroundMBLayerto GeoTools FeatureTypeStyle.- Specified by:
transformInternalin classMBLayer- Parameters:
styleContext- The MBStyle to which this layer belongs, used as a context for things like resolving sprite and glyph names to full urls.- Returns:
- FeatureTypeStyle
-
-