Package org.geotools.mbstyle.layer
Class FillMBLayer
MBLayer wrapper for "Fill" layers.
Example of line JSON:
{ "type": "line", "source": "http://localhost:8080/geoserver/ne/roads", "source-layer": "road" "id": "roads", "paint": { "fill-anitalias": true, "fill-opacity": 1 "fill-color": "#6655ae", "fill-outline-color": "#000000", "fill-translate": [0,0], "fill-translate-anchor": "map", "fill-pattern": "triangle" // Name of image in sprite to use for drawing image fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512). }, },
- Author:
- Reggie Beckwith (Boundless)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Controls the translation reference point.Nested classes/interfaces inherited from class MBLayer
MBLayer.Visibility
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected SemanticType
Access fill-color as literal or function expression, defaults to black.Access fill-opacity, defaults to 1.Access fill-outline-color as literal or function expression, defaults to black.(Optional) Name of image in a sprite to use for drawing image fills.Access fill-translate as Point.Processes the filter-translate into a Displacement.(Optional) Whether or not the fill should be antialiased.(Optional).(Optional) The opacity of the entire fill layer.(Optional).int[]
(Optional) The geometry's offset.(Optional) Controls the translation reference point.getType()
Rendering type of this layer.boolean
transformInternal
(MBStyle styleContext) Transform MBFillLayer to 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
-
Constructor Details
-
FillMBLayer
public FillMBLayer(JSONObject json)
-
-
Method Details
-
defaultSemanticType
-
getFillAntialias
(Optional) Whether or not the fill should be antialiased.Defaults to true.
- Returns:
- Whether the fill should be antialiased.
-
getFillOpacity
(Optional) The opacity of the entire fill layer. In contrast to the fill-color, this value will also affect the 1px stroke around the fill, if the stroke is used.Defaults to 1.
- Returns:
- The opacity of the layer.
- Throws:
MBFormatException
- JSON provided inconsistent with specification
-
fillOpacity
Access fill-opacity, defaults to 1.- Returns:
- The opacity of the layer.
- Throws:
MBFormatException
- JSON provided inconsistent with specification
-
getFillColor
(Optional). The color of the filled part of this layer. This color can be specified as rgba with an alpha component and the color's opacity will not affect the opacity of the 1px stroke, if it is used.Colors are written as JSON strings in a variety of permitted formats.
Defaults to #000000. Disabled by fill-pattern.
- Returns:
- The fill color.
-
fillColor
Access fill-color as literal or function expression, defaults to black.- Returns:
- The fill color.
-
getFillOutlineColor
(Optional). Requires fill-antialias = true. The outline color of the fill.Matches the value of fill-color if unspecified. Disabled by fill-pattern.
- Returns:
- The outline color of the fill.
-
fillOutlineColor
Access fill-outline-color as literal or function expression, defaults to black.- Returns:
- The outline color of the fill.
-
getFillTranslate
public int[] getFillTranslate()(Optional) The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively. Units in pixels. Defaults to 0, 0.- Returns:
- The geometry's offset
-
fillTranslate
Access fill-translate as Point.- Returns:
- The geometry's offset, in pixels.
-
fillTranslateDisplacement
Processes the filter-translate into a Displacement.This should handle both literals and function stops:
filter-translate: [0,0] filter-translate: { property: "building-height", "stops": [[0,[0,0]],[5,[1,2]]] } filter-translate: [ 0, { property: "building-height", "TYPE":"exponential","stops": [[0,0],[30, 5]] }
- Returns:
- The geometry displacement
-
getFillTranslateAnchor
(Optional) Controls the translation reference point.FillMBLayer.FillTranslateAnchor.MAP
: The fill is translated relative to the map.FillMBLayer.FillTranslateAnchor.VIEWPORT
: The fill is translated relative to the viewport.
- Returns:
- One of 'map','viewport', defaults to 'map'.
-
fillPattern
(Optional) Name of image in a sprite to use for drawing image fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512).- Returns:
- name of the sprite for the fill pattern, or null if not defined.
-
hasFillPattern
public boolean hasFillPattern()- Returns:
- True if the layer has a fill-pattern explicitly provided.
-
transformInternal
Transform MBFillLayer to GeoTools FeatureTypeStyle.Notes:
- stroke-width is assumed to be 1 (not specified by MapBox style)
- Specified by:
transformInternal
in 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
-
getType
Rendering type of this layer.
-