Class SymbolMBLayer

Object
MBLayer
SymbolMBLayer

public class SymbolMBLayer extends MBLayer
A symbol.

MBLayer wrapper around a JSONObject representation of a "symbol" type layer. 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.
  • Field Details

    • MARK_SHEET_ALIASES

      protected static final Set<String> MARK_SHEET_ALIASES
      When any of these strings is provided as the sprite source in an MB style, the style's 'icon-image' will actually be interpreted as the well-known name of a GeoTools Mark rather than an actual sprite sheet location.
    • MARK_ICON_DEFAULT_SIZE

      protected static final int MARK_ICON_DEFAULT_SIZE
      The default base size (pixels) to use to render GeoTools marks in a MB style. This is needed because MB styles have only a relative "size" property that scales the icon, but no absolute reference size.
      See Also:
  • Constructor Details

    • SymbolMBLayer

      public SymbolMBLayer(JSONObject json)
      Create a "symbol" type layer.
      Parameters:
      json - JSON symbol definition.
  • Method Details

    • defaultSemanticType

      protected SemanticType defaultSemanticType()
      Returns:
      The default semantic type.
    • getSymbolPlacement

      public SymbolMBLayer.SymbolPlacement getSymbolPlacement()
      (Optional) One of point, line. Defaults to point.

      Label placement relative to its geometry.

      Returns:
      SymbolPlacement
    • symbolPlacement

      public Expression symbolPlacement()
      (Optional) One of point, line. Defaults to point.

      Label placement relative to its geometry.

      Returns:
      SymbolPlacement
    • getSymbolSpacing

      public Number getSymbolSpacing() throws MBFormatException
      (Optional) Units in pixels. Defaults to 250. Requires SymbolPlacement.LINE

      Distance between two symbol anchors.

      Returns:
      Number representing distance between two symbol anchors
      Throws:
      MBFormatException - JSON provided inconsistent with specification
    • symbolSpacing

      public Expression symbolSpacing() throws MBFormatException
      Access symbol-spacing, defaults to 250.
      Returns:
      Number representing distance between two symbol anchors
      Throws:
      MBFormatException - JSON provided inconsistent with specification
    • getSymbolAvoidEdges

      public Boolean getSymbolAvoidEdges() throws MBFormatException
      (Optional) Defaults to false.

      If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer.

      Returns:
      Whether or not the symbols should avoid edges.
      Throws:
      MBFormatException - JSON provided inconsistent with specification
    • symbolAvoidEdges

      public Expression symbolAvoidEdges()
      Wraps getSymbolAvoidEdges() in a GeoTools expression.

      (Optional) Defaults to false. If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer.

      Returns:
      Whether or not the symbols should avoid edges.
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • getIconAllowOverlap

      public Boolean getIconAllowOverlap() throws MBFormatException
      (Optional) Defaults to false. Requires icon-image.

      If true, the icon will be visible even if it collides with other previously drawn symbols.

      Returns:
      Whether or not the symbols should be allowed to overlap other symbols
      Throws:
      MBFormatException - JSON provided inconsistent with specification
    • iconAllowOverlap

      public Expression iconAllowOverlap() throws MBFormatException
      Wraps getIconAllowOverlap() in a GeoTools expression.

      (Optional) Defaults to false. Requires icon-image.

      If true, the icon will be visible even if it collides with other previously drawn symbols.

      Returns:
      Whether or not the symbols should be allowed to overlap other symbols
      Throws:
      MBFormatException
    • getIconIgnorePlacement

      public Boolean getIconIgnorePlacement() throws MBFormatException
      (Optional) Defaults to false. Requires icon-image.

      If true, other symbols can be visible even if they collide with the icon.

      Returns:
      Whether or not other symbols should be allowed to overlap symbols in this layer.
      Throws:
      MBFormatException - JSON provided inconsistent with specification
    • iconIgnorePlacement

      public Expression iconIgnorePlacement()
      Wraps getIconIgnorePlacement() in a GeoTools expression.

      (Optional) Defaults to false. Requires icon-image. If true, other symbols can be visible even if they collide with the icon.

      Returns:
      Whether or not other symbols should be allowed to overlap symbols in this layer.
      Throws:
      MBFormatException - JSON provided inconsistent with specification
    • getIconOptional

      public Boolean getIconOptional() throws MBFormatException
      (Optional) Defaults to false. Requires icon-image. Requires text-field.

      If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not.

      Returns:
      Whether or not the label may be drawn when the icon is not drawn due to collisions
      Throws:
      MBFormatException - JSON provided inconsistent with specification
    • iconOptional

      public Expression iconOptional()
      Optional enum. One of map, viewport, auto. Defaults to auto. Requires icon-image. In combination with symbol-placement, determines the rotation

      Wraps getIconOptional() in a GeoTools expression. (Optional) Defaults to false. Requires icon-image. Requires text-field.

      If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not.

      Returns:
      Whether or not the label may be drawn when the icon is not drawn due to collisions
      Throws:
      MBFormatException - JSON provided inconsistent with specification
    • getIconRotationAlignment

      public SymbolMBLayer.Alignment getIconRotationAlignment()
      Optional enum. One of map, viewport, auto. Defaults to auto. Requires icon-image. In combination with symbol-placement, determines the rotation behavior of icons.

      Possible values:

      SymbolMBLayer.Alignment.MAP When symbol-placement is set to point, aligns icons east-west. When symbol-placement is set to line, aligns icon x-axes with the line.

      SymbolMBLayer.Alignment.VIEWPORT Produces icons whose x-axes are aligned with the x-axis of the viewport, regardless of the value of symbol-placement.

      SymbolMBLayer.Alignment.AUTO When symbol-placement is set to point, this is equivalent to viewport. When symbol-placement is set to line, this is equivalent to map.

      Returns:
      The icon rotation alignment
    • iconRotationAlignment

      public Expression iconRotationAlignment()
      Converts getIconRotationAlignment() to a GeoTools expression. Returns an expression that evaluates to one of "map", "viewport", or "auto".
      Returns:
      Expression providing icon rotation alignment.
    • getIconSize

      public Number getIconSize() throws MBFormatException
      (Optional) Defaults to 1. Requires icon-image.

      Scale factor for icon. 1 is original size, 3 triples the size.

      Returns:
      The icon size.
      Throws:
      MBFormatException - JSON provided inconsistent with specification
    • iconSize

      public Expression iconSize()
      Access icon-size, defaults to 1.
      Returns:
      Expression of icon size.
      Throws:
      MBFormatException - JSON provided inconsistent with specification
    • getIconTextFit

      public SymbolMBLayer.IconTextFit getIconTextFit()
      (Optional) One of none, width, height, both. Defaults to none. Requires icon-image. Requires text-field. Scales the icon to fit around the associated text.
      Returns:
      How the icon should be scaled to fit the associated text
    • iconTextFit

      public Expression iconTextFit()
      Wraps getIconTextFit() in a GeoTools expression.

      (Optional) One of none, width, height, both. Defaults to none. Requires icon-image. Requires text-field. Scales the icon to fit around the associated text.

      Returns:
      How the icon should be scaled to fit the associated text
    • getIconTextFitPadding

      public List<Number> getIconTextFitPadding()
      (Optional) Units in pixels. Defaults to 0,0,0,0. Requires icon-image. Requires text-field. Requires icon-text-fit = one of both, width, height.

      Size of the additional area added to dimensions determined by icon-text-fit, in clockwise order: top, right, bottom, left.

      Returns:
      The padding to add to icon-text-fit
    • iconTextFitPadding

      public Expression iconTextFitPadding()
      (Optional) Units in pixels. Defaults to 0,0,0,0. Requires icon-image. Requires text-field. Requires icon-text-fit = one of both, width, height.

      Size of the additional area added to dimensions determined by icon-text-fit, in clockwise order: top, right, bottom, left.

      Returns:
      The padding to add to icon-text-fit
    • getIconImage

      public String getIconImage() throws MBFormatException
      (Optional) A string with {tokens} replaced, referencing the data property to pull from.
      Returns:
      The name of the icon image
      Throws:
      MBFormatException - JSON provided inconsistent with specification
    • hasIconImage

      public boolean hasIconImage() throws MBFormatException
      Returns:
      True if the layer has a icon-image explicitly provided.
      Throws:
      MBFormatException
    • iconImage

      public Expression iconImage()
      Access icon-image as literal or function expression
      Returns:
      The name of the icon image
      Throws:
      MBFormatException - JSON provided inconsistent with specification
    • getIconRotate

      public Number getIconRotate() throws MBFormatException
      (Optional) Units in degrees. Defaults to 0. Requires icon-image.

      Rotates the icon clockwise.

      Returns:
      The icon rotation
      Throws:
      MBFormatException - JSON provided inconsistent with specification
    • iconRotate

      public Expression iconRotate() throws MBFormatException
      Access icon-rotate as literal or function expression
      Returns:
      The icon rotation
      Throws:
      MBFormatException - JSON provided inconsistent with specification
    • getIconPadding

      public Number getIconPadding() throws MBFormatException
      (Optional) Units in pixels. Defaults to 2. Requires icon-image.

      Size of the additional area around the icon bounding box used for detecting symbol collisions.

      Returns:
      Padding around the icon for collision-detection.
      Throws:
      MBFormatException - JSON provided inconsistent with specification
    • iconPadding

      public Expression iconPadding() throws MBFormatException
      Access icon-padding as literal or function expression
      Returns:
      Padding around the icon for collision-detection.
      Throws:
      MBFormatException - JSON provided inconsistent with specification
    • getIconKeepUpright

      public Boolean getIconKeepUpright() throws MBFormatException
      (Optional) Defaults to false. Requires icon-image. Requires icon-rotation-alignment = map. Requires symbol-placement = line.

      If true, the icon may be flipped to prevent it from being rendered upside-down.

      Returns:
      Whether to flip the icon if the orientation of the geometry would cause it to be rendered upside-down
      Throws:
      MBFormatException - JSON provided inconsistent with specification
    • iconKeepUpright

      public Expression iconKeepUpright()
      Wraps getIconKeepUpright() in a GeoTools expression.

      (Optional) Defaults to false. Requires icon-image. Requires icon-rotation-alignment = map. Requires symbol-placement = line.

      If true, the icon may be flipped to prevent it from being rendered upside-down.

      Returns:
      Whether to flip the icon if the orientation of the geometry would cause it to be rendered upside-down
      Throws:
      MBFormatException - JSON provided inconsistent with specification
    • getIconOffset

      public double[] getIconOffset() throws MBFormatException
      (Optional) Defaults to 0,0. Requires icon-image.

      Offset distance of icon from its anchor. Positive values indicate right and down, while negative values indicate left and up. When combined with icon-rotate the offset will be as if the rotated direction was up.

      Returns:
      Offset of the icon from its anchor
      Throws:
      MBFormatException - JSON provided inconsistent with specification
    • iconOffset

      public Point iconOffset() throws MBFormatException
      Access icon-offset
      Returns:
      Offset of the icon from its anchor
      Throws:
      MBFormatException - JSON provided inconsistent with specification
    • iconOffsetDisplacement

      public Displacement iconOffsetDisplacement()
      Maps getIconOffset() to a Displacement

      (Optional) Defaults to 0,0. Requires icon-image. Offset distance of icon from its anchor. Positive values indicate right and down, while negative values indicate left and up. When combined with icon-rotate the offset will be as if the rotated direction was up.

      Returns:
      Icon offset
    • getTextPitchAlignment

      public SymbolMBLayer.Alignment getTextPitchAlignment()
      Optional enum. One of map, viewport, auto. Defaults to auto. Requires text-field. Orientation of text when map is pitched.

      Possible values:

      SymbolMBLayer.Alignment.MAP The text is aligned to the plane of the map.

      SymbolMBLayer.Alignment.VIEWPORT The text is aligned to the plane of the viewport.

      SymbolMBLayer.Alignment.AUTO Automatically matches the value of text-rotation-alignment.

      Returns:
      Text alignment when the map is pitched.
    • textPitchAlignment

      public Expression textPitchAlignment()
      Converts getTextPitchAlignment() to a GeoTools expression. Returns an expression that evaluates to one of "map", "viewport", or "auto".
      Returns:
      Expression of text pitch alignment
    • getTextRotationAlignment

      public SymbolMBLayer.Alignment getTextRotationAlignment()
      Optional enum. One of map, viewport, auto. Defaults to auto. Requires text-field. In combination with symbol-placement, determines the rotation behavior of the individual glyphs forming the text.

      Possible values:

      SymbolMBLayer.Alignment.MAP When symbol-placement is set to point, aligns text east-west. When symbol-placement is set to line, aligns text x-axes with the line.

      SymbolMBLayer.Alignment.VIEWPORT Produces glyphs whose x-axes are aligned with the x-axis of the viewport, regardless of the value of symbol-placement.

      SymbolMBLayer.Alignment.AUTO When symbol-placement is set to point, this is equivalent to viewport. When symbol-placement is set to line, this is equivalent to map.

      Returns:
      Text alignment when the map is rotated.
    • textRotationAlignment

      public Expression textRotationAlignment()
      Converts getTextRotationAlignment() to a GeoTools expression.
      Returns:
      A GeoTools expression that evaluates to "map", "viewport", or "auto".
      See Also:
    • getTextField

      public String getTextField() throws MBFormatException
      (Optional) Value to use for a text label. Feature properties are specified using tokens like {field_name}.
      Returns:
      Value to use for a text label
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • textField

      public Expression textField() throws MBFormatException
      Access text-field as literal or function expression
      Returns:
      Value to use for a text label
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • getTextFont

      public List<String> getTextFont()
      (Optional) Font stack to use for displaying text.

      Defaults to ["Open Sans Regular","Arial Unicode MS Regular"]. Requires text-field.

      Returns:
      The font to use for the label
    • textFont

      public Expression textFont() throws MBFormatException
      Access text-font as a literal or function expression.
      Returns:
      The font to use for the label
      Throws:
      MBFormatException
    • getTextSize

      public Number getTextSize() throws MBFormatException
      (Optional) Units in pixels. Defaults to 16. Requires text-field.

      Font size.

      Returns:
      The font size
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • textSize

      public Expression textSize() throws MBFormatException
      Access text-size as literal or function expression
      Returns:
      The font size
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • getTextMaxWidth

      public Number getTextMaxWidth() throws MBFormatException
      (Optional) Units in ems. Defaults to 10. Requires text-field.

      The maximum line width for text wrapping.

      Returns:
      Maximum label width
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • textMaxWidth

      public Expression textMaxWidth() throws MBFormatException
      Access text-max-width as literal or function expression
      Returns:
      Maximum label width
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • hasTextMaxWidth

      public boolean hasTextMaxWidth() throws MBFormatException
      Returns:
      True if the layer has a text-max-width explicitly provided.
      Throws:
      MBFormatException
    • getTextLineHeight

      public Number getTextLineHeight() throws MBFormatException
      (Optional) Units in ems. Defaults to 1.2. Requires text-field.

      Text leading value for multi-line text.

      Returns:
      Label line height
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • textLineHeight

      public Expression textLineHeight() throws MBFormatException
      Access text-line-height as literal or function expression
      Returns:
      Label line height
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • getTextLetterSpacing

      public Number getTextLetterSpacing() throws MBFormatException
      (Optional) Units in ems. Defaults to 0. Requires text-field.

      Text tracking amount.

      Returns:
      Spacing between label characters
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • textLetterSpacing

      public Expression textLetterSpacing() throws MBFormatException
      Access text-line-height as literal or function expression
      Returns:
      Spacing between label characters
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • getTextJustify

      public SymbolMBLayer.Justification getTextJustify()
      Optional enum. One of left, center, right. Defaults to center. Requires text-field.

      Text justification options:

      SymbolMBLayer.Justification.LEFT The text is aligned to the left.

      SymbolMBLayer.Justification.CENTER The text is centered.

      SymbolMBLayer.Justification.RIGHT The text is aligned to the right.

      Returns:
      The label justification.
    • textJustify

      public Expression textJustify()
      Converts getTextJustify() to a GeoTools expression. Returns an expression that evaluates to one of "left", "right", or "center".
      Returns:
      Expression of text justification
      See Also:
    • getTextAnchor

      public SymbolMBLayer.TextAnchor getTextAnchor()
      Part of the text placed closest to the anchor (requires text-field).

      Optional enum. One of center, left, right, top, bottom, top-left, top-right, bottom-left, bottom-right. Defaults to center. Requires text-field. Part of the text placed closest to the anchor.

      SymbolMBLayer.TextAnchor.CENTER The center of the text is placed closest to the anchor.

      SymbolMBLayer.TextAnchor.LEFT The left side of the text is placed closest to the anchor.

      SymbolMBLayer.TextAnchor.RIGHT The right side of the text is placed closest to the anchor.

      SymbolMBLayer.TextAnchor.TOP The top of the text is placed closest to the anchor.

      SymbolMBLayer.TextAnchor.BOTTOM The bottom of the text is placed closest to the anchor.

      SymbolMBLayer.TextAnchor.TOP_LEFT The top left corner of the text is placed closest to the anchor.

      SymbolMBLayer.TextAnchor.TOP_RIGHT The top right corner of the text is placed closest to the anchor.

      SymbolMBLayer.TextAnchor.BOTTOM_LEFT The bottom left corner of the text is placed closest to the anchor.

      SymbolMBLayer.TextAnchor.BOTTOM_RIGHT The bottom right corner of the text is placed closest to the anchor.

      Returns:
      part of the text placed closest to the anchor.
    • textAnchor

      public Expression textAnchor()
      Converts getTextAnchor() to a GeoTools expression. Returns an expression that evaluates to one of "center", "left", or "right", "top", "bottom", "top_left", "top_right", "bottom_left", "bottom_right".
      Returns:
      Expression of text anchor
      See Also:
    • anchorPoint

      public AnchorPoint anchorPoint()
      Layout "text-anchor" provided as AnchorPoint.
      Returns:
      AnchorPoint defined by "text-anchor".
    • iconAnchorPoint

      public AnchorPoint iconAnchorPoint()
    • anchorPointByProperty

      public AnchorPoint anchorPointByProperty(String propertyName)
    • getTextMaxAngle

      public Number getTextMaxAngle() throws MBFormatException
      (Optional) Units in degrees. Defaults to 45. Requires text-field. Requires symbol-placement = line.

      Maximum angle change between adjacent characters.

      Returns:
      Maximum label angle between characters when following a line
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • textMaxAngle

      public Expression textMaxAngle()
      Access text-max-angle as literal or function expression
      Returns:
      Maximum label angle between characters when following a line
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • getTextRotate

      public Number getTextRotate() throws MBFormatException
      (Optional) Units in degrees. Defaults to 0. Requires text-field.

      Rotates the text clockwise.

      Returns:
      Rotation angle of the label
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • textRotate

      public Expression textRotate() throws MBFormatException
      Access text-rotate as literal or function expression
      Returns:
      Rotation angle of the label
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • getTextPadding

      public Number getTextPadding() throws MBFormatException
      (Optional) Units in pixels. Defaults to 2. Requires text-field.

      Size of the additional area around the text bounding box used for detecting symbol collisions.

      Returns:
      Padding around the label for detecting collisions
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • textPadding

      public Expression textPadding() throws MBFormatException
      Access text-padding as literal or function expression
      Returns:
      Padding around the label for detecting collisions
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • getTextKeepUpright

      public Boolean getTextKeepUpright() throws MBFormatException
      (Optional) Defaults to true. Requires text-field. Requires text-rotation-alignment = map. Requires symbol-placement = line.

      If true, the text may be flipped vertically to prevent it from being rendered upside-down.

      Returns:
      Whether to flip the label if the orientation of the geometry would cause it to be rendered upside-down
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • textKeepUpright

      public Expression textKeepUpright()
      Wraps getTextKeepUpright() in a GeoTools expression (Optional) Defaults to true. Requires text-field. Requires text-rotation-alignment = map. Requires symbol-placement = line.

      If true, the text may be flipped vertically to prevent it from being rendered upside-down.

      Returns:
      Boolean
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • getTextTransform

      public SymbolMBLayer.TextTransform getTextTransform()
      One of none, uppercase, lowercase. Defaults to none. Requires text-field.

      Specifies how to capitalize text, similar to the CSS text-transform property.

      SymbolMBLayer.TextTransform.NONE The text is not altered.

      SymbolMBLayer.TextTransform.UPPERCASE Forces all letters to be displayed in uppercase.

      SymbolMBLayer.TextTransform.LOWERCASE Forces all letters to be displayed in lowercase.

      Returns:
      The tranformation to apply to the label
    • hasTextTransform

      public boolean hasTextTransform()
      Returns true if the a text-transform property explicitly provided
      Returns:
      true if text-transform provided
    • textTransform

      public Expression textTransform()
      Converts getTextTransform() to a GeoTools expression. Returns an expression that evaluates to one of "uppercase", "lowercase", "none".
      Returns:
      Expression providing text transformation
      See Also:
    • getTextOffset

      public double[] getTextOffset() throws MBFormatException
      (Optional) Units in ems. Defaults to 0,0. Requires text-field.

      Offset distance of text from its anchor. Positive values indicate right and down, while negative values indicate left and up.

      Returns:
      Offset of the label from its anchor.
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • textOffset

      public Point textOffset() throws MBFormatException
      Access text-offset
      Returns:
      Offset of the label from its anchor.
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • textOffsetDisplacement

      public Displacement textOffsetDisplacement()
      Returns:
      (Optional) Units in ems. Defaults to 0,0. Requires text-field.
    • getTextAllowOverlap

      public Boolean getTextAllowOverlap() throws MBFormatException
      (Optional) Defaults to false. Requires text-field.

      If true, the text will be visible even if it collides with other previously drawn symbols.

      Returns:
      Whether or not the text should be allowed to overlap other symbols
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • textAllowOverlap

      public Expression textAllowOverlap() throws MBFormatException
      Wraps getTextAllowOverlap() in a GeoTools Expression.

      (Optional) Defaults to false. Requires text-field.

      If true, the text will be visible even if it collides with other previously drawn symbols.

      Returns:
      Whether or not the symbols should be allowed to overlap other symbols
      Throws:
      MBFormatException
    • getTextIgnorePlacement

      public Boolean getTextIgnorePlacement() throws MBFormatException
      Defaults to false. Requires text-field.

      If true, other symbols can be visible even if they collide with the text.

      Returns:
      Whether or not other symbols should be allowed to overlap text in this layer.
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • textIgnorePlacement

      public Expression textIgnorePlacement()
      Wraps getTextIgnorePlacement() in a GeoTools expression Defaults to false. Requires text-field.

      If true, other symbols can be visible even if they collide with the text.

      Returns:
      Boolean
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • getTextOptional

      public Boolean getTextOptional() throws MBFormatException
      Defaults to false. Requires text-field. Requires icon-image.

      If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not.

      Returns:
      Whether or not the symbol may be drawn when the label is not drawn due to collisions
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • textOptional

      public Expression textOptional()
      Wraps getTextOptional() in a GeoTools expression.

      Defaults to false. Requires text-field. Defaults to false. Requires text-field. Requires icon-image.

      If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not.

      Returns:
      Boolean
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • getIconOpacity

      public Number getIconOpacity() throws MBFormatException
      (Optional) Defaults to 1. Requires icon-image.

      The opacity at which the icon will be drawn.

      Returns:
      Opacity of the icon
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • iconOpacity

      public Expression iconOpacity() throws MBFormatException
      Access icon-opacity as literal or function expression
      Returns:
      Opacity of the icon
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • getIconColor

      public Color getIconColor()
      (Optional) Defaults to #000000. Requires icon-image.

      The color of the icon. This can only be used with sdf icons.

      Returns:
      Color of the icon.
    • iconColor

      public Expression iconColor()
      Access icon-color as literal or function expression, defaults to black.
      Returns:
      Color of the icon as an Expression
    • getIconHaloColor

      public Color getIconHaloColor()
      (Optional) Defaults to rgba(0, 0, 0, 0). Requires icon-image.

      The color of the icon's halo. Icon halos can only be used with SDF icons.

      Returns:
      Color of the icon's halo.
    • iconHaloColor

      public Expression iconHaloColor()
      Access icon-halo-color as literal or function expression, defaults to black.
      Returns:
      Color of the icon's halo.
    • getIconHaloWidth

      public Number getIconHaloWidth() throws MBFormatException
      (Optional) Units in pixels. Defaults to 0. Requires icon-image.

      Distance of halo to the icon outline.

      Returns:
      Width of the icon halo
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • iconHaloWidth

      public Expression iconHaloWidth()
      Access icon-halo-width as literal or function expression
      Returns:
      Width of the icon halo
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • getIconHaloBlur

      public Number getIconHaloBlur() throws MBFormatException
      (Optional) Units in pixels. Defaults to 0. Requires icon-image.

      Fade out the halo towards the outside.

      Returns:
      Size of the halo fade
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • iconHaloBlur

      public Expression iconHaloBlur()
      Access icon-halo-blur as literal or function expression
      Returns:
      Size of the halo fade
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • getIconTranslate

      public int[] getIconTranslate() throws MBFormatException
      (Optional) Units in pixels. Defaults to 0,0. Requires icon-image.

      Distance that the icon's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.

      Returns:
      Translation of the icon from its origin
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • iconTranslate

      public Point iconTranslate()
      Units in pixels. Defaults to 0,0. Requires icon-image.

      Distance that the icon's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.

      Returns:
      Translation of the icon from its origin
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • iconTranslateDisplacement

      public Displacement iconTranslateDisplacement()
      Maps getIconTranslate() to a Displacement

      (Optional) Units in pixels. Defaults to 0,0. Requires icon-image. Distance that the icon's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.

      Returns:
      Icon translate displacement
    • getIconTranslateAnchor

      public SymbolMBLayer.TranslateAnchor getIconTranslateAnchor()
      (Optional) One of map, viewport. Defaults to map. Requires icon-image. Requires icon-translate.

      Controls the translation reference point.

      SymbolMBLayer.TranslateAnchor.MAP: Icons are translated relative to the map.

      SymbolMBLayer.TranslateAnchor.VIEWPORT: Icons are translated relative to the viewport.

      Defaults to SymbolMBLayer.TranslateAnchor.MAP.

      Returns:
      The location of the translation anchor.
    • iconTranslateAnchor

      public Expression iconTranslateAnchor()
      Converts getIconTranslateAnchor() to a GeoTools expression. Returns an expression that evaluates to one of "map", "viewport".
      Returns:
      an expression that evaluates to one of "map", "viewport".
      See Also:
    • getTextOpacity

      public Number getTextOpacity() throws MBFormatException
      (Optional) Defaults to 1. Requires text-field.

      The opacity at which the text will be drawn.

      Returns:
      Opacity of the label
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • textOpacity

      public Expression textOpacity() throws MBFormatException
      Access text-opacity as literal or function expression
      Returns:
      Opacity of the label
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • getTextColor

      public Color getTextColor() throws MBFormatException
      Defaults to #000000. Requires text-field.

      The color with which the text will be drawn.

      Returns:
      The label color.
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • textColor

      public Expression textColor()
      Access text-color as literal or function expression, defaults to black.
      Returns:
      The label color.
    • getTextHaloColor

      public Color getTextHaloColor() throws MBFormatException
      Defaults to rgba(0, 0, 0, 0). Requires text-field.

      The color of the text's halo, which helps it stand out from backgrounds.

      Returns:
      The label halo color.
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • textHaloColor

      public Expression textHaloColor()
      Access text-halo-color as literal or function expression, defaults to black.
      Returns:
      The label halo color.
    • getTextHaloWidth

      public Number getTextHaloWidth() throws MBFormatException
      (Optional) Units in pixels. Defaults to 0. Requires text-field.

      Distance of halo to the font outline. Max text halo width is 1/4 of the font-size.

      Returns:
      Size of the label halo
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • textHaloWidth

      public Expression textHaloWidth() throws MBFormatException
      Access text-halo-width as literal or function expression
      Returns:
      Size of the label halo
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • getTextHaloBlur

      public Number getTextHaloBlur() throws MBFormatException
      (Optional) Units in pixels. Defaults to 0. Requires text-field.

      The halo's fadeout distance towards the outside.

      Returns:
      Size of the label halo fade
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • textHaloBlur

      public Expression textHaloBlur() throws MBFormatException
      Access text-halo-blur as literal or function expression
      Returns:
      Size of the label halo fade
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • getTextTranslate

      public int[] getTextTranslate()
      (Optional) Units in pixels. Defaults to 0,0. Requires text-field.

      Distance that the text's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.

      Returns:
      The translation of hte lable form its anchor.
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • textTranslate

      public Point textTranslate()
      (Optional) Units in pixels. Defaults to 0,0. Requires text-field.

      Distance that the text's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.

      Returns:
      The translation of hte lable form its anchor.
      Throws:
      MBFormatException - JSON definition inconsistent with specification
    • textTranslateDisplacement

      public Displacement textTranslateDisplacement()
      Maps getTextTranslate() to a Displacement.

      Distance that the text's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up. (Optional) Units in pixels. Defaults to 0,0. Requires text-field.

      Returns:
      Displacement defined by text-translate
    • getTextTranslateAnchor

      public SymbolMBLayer.TranslateAnchor getTextTranslateAnchor()
      (Optional) One of map, viewport. Defaults to map. Requires text-field. Requires text-translate.

      Controls the translation reference point.

      SymbolMBLayer.TranslateAnchor.MAP: The text is translated relative to the map.

      SymbolMBLayer.TranslateAnchor.VIEWPORT: The text is translated relative to the viewport.

      Defaults to SymbolMBLayer.TranslateAnchor.MAP.

      Returns:
      The anchor the tect is translated relative to
    • textTranslateAnchor

      public Expression textTranslateAnchor()
      Converts getTextTranslateAnchor() to a GeoTools expression. Returns an expression that evaluates to one of "map", "viewport".
      Returns:
      Expresesion of text translate anchor
      See Also:
    • transformInternal

      public List<FeatureTypeStyle> transformInternal(MBStyle styleContext)
      Transform SymbolMBLayer 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
    • getLabelPriority

      public Integer getLabelPriority()
    • setLabelPriority

      public void setLabelPriority(Integer labelPriority)