Class FillMBLayer

Object
MBLayer
FillMBLayer

public class FillMBLayer extends MBLayer
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)
  • Constructor Details

    • FillMBLayer

      public FillMBLayer(JSONObject json)
  • Method Details

    • defaultSemanticType

      protected SemanticType defaultSemanticType()
    • getFillAntialias

      public Expression getFillAntialias()
      (Optional) Whether or not the fill should be antialiased.

      Defaults to true.

      Returns:
      Whether the fill should be antialiased.
    • getFillOpacity

      public Number getFillOpacity() throws MBFormatException
      (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

      public Expression fillOpacity() throws MBFormatException
      Access fill-opacity, defaults to 1.
      Returns:
      The opacity of the layer.
      Throws:
      MBFormatException - JSON provided inconsistent with specification
    • getFillColor

      public Color 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

      public Expression fillColor()
      Access fill-color as literal or function expression, defaults to black.
      Returns:
      The fill color.
    • getFillOutlineColor

      public 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

      public Expression 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

      public Point fillTranslate()
      Access fill-translate as Point.
      Returns:
      The geometry's offset, in pixels.
    • fillTranslateDisplacement

      public Displacement 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

      public FillMBLayer.FillTranslateAnchor getFillTranslateAnchor()
      (Optional) Controls the translation reference point. Requires fill-translate.
      Returns:
      One of 'map','viewport', defaults to 'map'.
    • fillPattern

      public Expression 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

      public List<FeatureTypeStyle> transformInternal(MBStyle styleContext)
      Transform MBFillLayer to GeoTools FeatureTypeStyle.

      Notes:

      • stroke-width is assumed to be 1 (not specified by MapBox style)
      Specified by:
      transformInternal in class MBLayer
      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

      public String getType()
      Rendering type of this layer.
      Specified by:
      getType in class MBLayer
      Returns:
      TYPE