Class LineMBLayer

Object
MBLayer
LineMBLayer

public class LineMBLayer extends MBLayer
MBLayer wrapper for "line" layers.

Example of line JSON:

      {   "type": "line",
          "source": "http://localhost:8080/geoserver/ne/roads",
          "source-layer": "road"
          "id": "roads",
          "paint": {
              "line-color": "#6655ae",
              "line-width": 2,
              "line-opacity": 1
          },
      },
 
Author:
Reggie Beckwith (Boundless)
  • Constructor Details

    • LineMBLayer

      public LineMBLayer(JSONObject json)
  • Method Details

    • defaultSemanticType

      protected SemanticType defaultSemanticType()
    • getLineCap

      public LineMBLayer.LineCap getLineCap()
      Display of line endings.

      Supports piecewise constant functions.

      Returns:
      One of butt, round, square, optional defaults to butt.
    • lineCap

      public Expression lineCap()
      Maps getLineCap() to Stroke.getLineCap() values of "butt", "round", and "square" Literals. Defaults to butt.

      Since piecewise constant functions is supported a RecodeFunction may be generated.

      Returns:
      Expression for Stroke.getLineCap() use.
    • getLineJoin

      public LineMBLayer.LineJoin getLineJoin()
      Optional enum. One of bevel, round, miter. Defaults to miter. The display of lines when joining.
      Returns:
      The line join
    • lineJoin

      public Expression lineJoin()
      Maps getLineJoin() to Stroke.getLineJoin() values of "mitre", "round", and "bevel" Literals. Defaults to "mitre".

      Since piecewise constant functions is supported a RecodeFunction may be generated.

      Returns:
      Expression for Stroke.getLineJoin() use.
    • getLineMiterLimit

      public Number getLineMiterLimit()
      (Optional) Used to automatically convert miter joins to bevel joins for sharp angles.

      Defaults to 2. Requires line-join = miter.

      Returns:
      The threshold at which miter joins are converted to bevel joins.
    • lineMiterLimit

      public Expression lineMiterLimit()
      Maps getLineMiterLimit() to an Expression. (Optional) Used to automatically convert miter joins to bevel joins for sharp angles.

      Defaults to 2. Requires line-join = miter.

      Returns:
      Expression for getLineMiterLimit()
    • getLineRoundLimit

      public Number getLineRoundLimit()
      (Optional) Used to automatically convert round joins to bevel joins for sharp angles.

      Defaults to 1.05. Requires line-join = round.

      Returns:
      The threshold at which round joins are converted to bevel joins.
    • lineRoundLimit

      public Expression lineRoundLimit()
      Maps getLineRoundLimit() to an Expression.

      (Optional) Used to automatically convert round joins to bevel joins for sharp angles.

      Defaults to 1.05. Requires line-join = round.

      Returns:
      Expression providing threshold at which round joins are converted to bevel joins.
    • getLineOpacity

      public Number getLineOpacity()
      (Optional) The opacity at which the line will be drawn.

      Defaults to 1.

      Returns:
      The line opacity
    • lineOpacity

      public Expression lineOpacity()
      Maps getLineOpacity() to an Expression.

      (Optional) The opacity at which the line will be drawn.

      Defaults to 1.

      Returns:
      opacity for line (literal or function), defaults to 1.
    • getLineColor

      public Color getLineColor()
      (Optional) The color with which the line will be drawn.

      Defaults to Color.BLACK, disabled by line-pattern.

      Returns:
      color to draw the line, optional defaults to black.
    • lineColor

      public Expression lineColor()
      Maps getLineColor() to an Expression.

      (Optional) The color with which the line will be drawn.

      Defaults to Color.BLACK, disabled by line-pattern.

      Returns:
      color to draw the line, optional defaults to black.
    • getLineTranslate

      public int[] getLineTranslate()
      (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.
    • lineTranslateDisplacement

      public Displacement lineTranslateDisplacement()
      Maps getLineTranslate() to a Displacement.

      (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, as a Displacement.
    • getLineTranslateAnchor

      public LineMBLayer.LineTranslateAnchor getLineTranslateAnchor()
      (Optional) Controls the translation reference point.

      LineMBLayer.LineTranslateAnchor.MAP: The fill is translated relative to the map.

      LineMBLayer.LineTranslateAnchor.VIEWPORT: The fill is translated relative to the viewport.

      Defaults to LineMBLayer.LineTranslateAnchor.MAP. Requires fill-translate.

      Returns:
      The translation reference point.
    • lineTranslateAnchor

      public Expression lineTranslateAnchor()
      Wraps getLineTranslateAnchor() in a GeoTools expression. Returns an expression that evaluates to "map" or "viewport".
      Returns:
      Expression providing translation reference point.
    • getLineWidth

      public Number getLineWidth()
      (Optional) Stroke thickness.

      Units in pixels. Defaults to 1.

      Returns:
      The stroke thickness.
    • lineWidth

      public Expression lineWidth()
      Convert getLineWidth() to an Expression.

      (Optional) Stroke thickness. Units in pixels. Defaults to 1.

      Returns:
      The stroke thickness.
    • getLineGapWidth

      public Number getLineGapWidth()
      (Optional) Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap.

      Units in pixels. Defaults to 0.

      Returns:
      The inner gap between the sides of the line casing
    • lineGapWidth

      public Expression lineGapWidth()
      Converts getLineGapWidth() to an Expression.

      (Optional) Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap.

      Units in pixels. Defaults to 0.

      Returns:
      The inner gap between the sides of the line casing
    • getLineOffset

      public Number getLineOffset()
      (Optional) The line's offset. For linear features, a positive value offsets the line to the right, relative to the direction of the line, and a negative value to the left. For polygon features, a positive value results in an inset, and a negative value results in an outset.

      Units in pixels. Defaults to 0.

      Returns:
      The line's offset.
    • lineOffset

      public Expression lineOffset()
      Converts getLineOffset() to an Expression.

      (Optional) The line's offset. For linear features, a positive value offsets the line to the right, relative to the direction of the line, and a negative value to the left. For polygon features, a positive value results in an inset, and a negative value results in an outset.

      Units in pixels. Defaults to 0.

      Returns:
      The line's offset.
    • getLineBlur

      public Number getLineBlur()
      (Optional) Blur applied to the line, in pixels.

      Units in pixels. Defaults to 0.

      Returns:
      The line blur.
    • lineBlur

      public Expression lineBlur()
      Converts getLineBlur() to an Expression.

      (Optional) Blur applied to the line, in pixels.

      Units in pixels. Defaults to 0.

      Returns:
      The line blur.
    • getLineDasharray

      public List<Double> getLineDasharray()
      (Optional) Specifies the lengths of the alternating dashes and gaps that form the dash pattern. The lengths are later scaled by the line width. To convert a dash length to pixels, multiply the length by the current line width.

      Units in line widths. Disabled by line-pattern.

      Returns:
      A list of dash and gap lengths defining the pattern for a dashed line.
    • lineDasharray

      public List<Expression> lineDasharray()
      Converts getLineDasharray() to a List of Expressions

      (Optional) Specifies the lengths of the alternating dashes and gaps that form the dash pattern. The lengths are later scaled by the line width. To convert a dash length to pixels, multiply the length by the current line width.

      Units in line widths. Disabled by line-pattern.

      Returns:
      A list of dash and gap lengths defining the pattern for a dashed line.
    • getLinePattern

      public String getLinePattern()
      (Optional) Name of image in sprite to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512).

      Units in line widths. Disabled by line-pattern.

      Returns:
      The name of the sprite to use for the line pattern.
    • linePattern

      public Expression linePattern()
      Converts getLinePattern() to an Expression.

      (Optional) Name of image in sprite to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512).

      Units in line widths. Disabled by line-pattern.

      Returns:
      Expression providing name of the sprite to use for the line pattern.
    • hasLinePattern

      public boolean hasLinePattern()
      Returns:
      True if the layer has a line-pattern explicitly provided.
    • hasLineGapWidth

      public boolean hasLineGapWidth()
      Returns:
      True if the layer has a line-gap-width explicitly provided.
    • transformInternal

      public List<FeatureTypeStyle> transformInternal(MBStyle styleContext)
      Transform LineMBLayer to GeoTools FeatureTypeStyle.
      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