Class SymbolMBLayer
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Interpreted differently when applied to different fields.static enum
static enum
static enum
static enum
Text justification options.static enum
static enum
Nested classes/interfaces inherited from class MBLayer
MBLayer.Visibility
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final int
The default base size (pixels) to use to render GeoTools marks in a MB style.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 GeoToolsMark
rather than an actual sprite sheet location. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionLayout "text-anchor" provided asAnchorPoint
.anchorPointByProperty
(String propertyName) protected SemanticType
(Optional) Defaults to false.(Optional) Defaults to #000000.(Optional) Units in pixels.(Optional) Defaults to rgba(0, 0, 0, 0).(Optional) Units in pixels.(Optional) Defaults to false.(Optional) A string with {tokens} replaced, referencing the data property to pull from.(Optional) Defaults to false.double[]
(Optional) Defaults to 0,0.(Optional) Defaults to 1.(Optional) Defaults to false.(Optional) Units in pixels.(Optional) Units in degrees.Optional enum.(Optional) Defaults to 1.(Optional) One of none, width, height, both.(Optional) Units in pixels.int[]
(Optional) Units in pixels.(Optional) One of map, viewport.(Optional) Defaults to false.(Optional) One of point, line.(Optional) Units in pixels.(Optional) Defaults to false.Part of the text placed closest to the anchor (requires text-field).Defaults to #000000.(Optional) Value to use for a text label.(Optional) Font stack to use for displaying text.(Optional) Units in pixels.Defaults to rgba(0, 0, 0, 0).(Optional) Units in pixels.Defaults to false.Optional enum.(Optional) Defaults to true.(Optional) Units in ems.(Optional) Units in ems.(Optional) Units in degrees.(Optional) Units in ems.double[]
(Optional) Units in ems.(Optional) Defaults to 1.Defaults to false.(Optional) Units in pixels.Optional enum.(Optional) Units in degrees.Optional enum.(Optional) Units in pixels.One of none, uppercase, lowercase.int[]
(Optional) Units in pixels.(Optional) One of map, viewport.getType()
Rendering type of this layer.boolean
boolean
boolean
Returns true if the a text-transform property explicitly providedWrapsgetIconAllowOverlap()
in a GeoTools expression.Access icon-color as literal or function expression, defaults to black.Access icon-halo-blur as literal or function expressionAccess icon-halo-color as literal or function expression, defaults to black.Access icon-halo-width as literal or function expressionWrapsgetIconIgnorePlacement()
in a GeoTools expression.Access icon-image as literal or function expressionWrapsgetIconKeepUpright()
in a GeoTools expression.Access icon-offsetMapsgetIconOffset()
to aDisplacement
Access icon-opacity as literal or function expressionOptional enum.Access icon-padding as literal or function expressionAccess icon-rotate as literal or function expressionConvertsgetIconRotationAlignment()
to a GeoTools expression.iconSize()
Access icon-size, defaults to 1.WrapsgetIconTextFit()
in a GeoTools expression.(Optional) Units in pixels.Units in pixels.ConvertsgetIconTranslateAnchor()
to a GeoTools expression.MapsgetIconTranslate()
to aDisplacement
void
setLabelPriority
(Integer labelPriority) WrapsgetSymbolAvoidEdges()
in a GeoTools expression.(Optional) One of point, line.Access symbol-spacing, defaults to 250.WrapsgetTextAllowOverlap()
in a GeoToolsExpression
.ConvertsgetTextAnchor()
to a GeoTools expression.Access text-color as literal or function expression, defaults to black.Access text-field as literal or function expressiontextFont()
Access text-font as a literal or function expression.Access text-halo-blur as literal or function expressionAccess text-halo-color as literal or function expression, defaults to black.Access text-halo-width as literal or function expressionWrapsgetTextIgnorePlacement()
in a GeoTools expression Defaults to false.ConvertsgetTextJustify()
to a GeoTools expression.WrapsgetTextKeepUpright()
in a GeoTools expression (Optional) Defaults to true.Access text-line-height as literal or function expressionAccess text-line-height as literal or function expressionAccess text-max-angle as literal or function expressionAccess text-max-width as literal or function expressionAccess text-offsetMapsgetTextOffset()
to aDisplacement
.Access text-opacity as literal or function expressionWrapsgetTextOptional()
in a GeoTools expression.Access text-padding as literal or function expressionConvertsgetTextPitchAlignment()
to a GeoTools expression.Access text-rotate as literal or function expressionConvertsgetTextRotationAlignment()
to a GeoTools expression.textSize()
Access text-size as literal or function expressionConvertsgetTextTransform()
to a GeoTools expression.(Optional) Units in pixels.ConvertsgetTextTranslateAnchor()
to a GeoTools expression.MapsgetTextTranslate()
to aDisplacement
.transformInternal
(MBStyle styleContext) TransformSymbolMBLayer
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
-
Field Details
-
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 GeoToolsMark
rather than an actual sprite sheet location. -
MARK_ICON_DEFAULT_SIZE
protected static final int MARK_ICON_DEFAULT_SIZEThe 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
- Returns:
- The default semantic type.
-
getSymbolPlacement
(Optional) One of point, line. Defaults to point.Label placement relative to its geometry.
- Returns:
- SymbolPlacement
-
symbolPlacement
(Optional) One of point, line. Defaults to point.Label placement relative to its geometry.
- Returns:
- SymbolPlacement
-
getSymbolSpacing
(Optional) Units in pixels. Defaults to 250. Requires SymbolPlacement.LINEDistance between two symbol anchors.
- Returns:
- Number representing distance between two symbol anchors
- Throws:
MBFormatException
- JSON provided inconsistent with specification
-
symbolSpacing
Access symbol-spacing, defaults to 250.- Returns:
- Number representing distance between two symbol anchors
- Throws:
MBFormatException
- JSON provided inconsistent with specification
-
getSymbolAvoidEdges
(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
WrapsgetSymbolAvoidEdges()
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
(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
WrapsgetIconAllowOverlap()
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
(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
WrapsgetIconIgnorePlacement()
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
(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
Optional enum. One of map, viewport, auto. Defaults to auto. Requires icon-image. In combination with symbol-placement, determines the rotationWraps
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
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
ConvertsgetIconRotationAlignment()
to a GeoTools expression. Returns an expression that evaluates to one of "map", "viewport", or "auto".- Returns:
- Expression providing icon rotation alignment.
-
getIconSize
(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
Access icon-size, defaults to 1.- Returns:
- Expression of icon size.
- Throws:
MBFormatException
- JSON provided inconsistent with specification
-
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
WrapsgetIconTextFit()
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
(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
(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
(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
- Returns:
- True if the layer has a icon-image explicitly provided.
- Throws:
MBFormatException
-
iconImage
Access icon-image as literal or function expression- Returns:
- The name of the icon image
- Throws:
MBFormatException
- JSON provided inconsistent with specification
-
getIconRotate
(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
Access icon-rotate as literal or function expression- Returns:
- The icon rotation
- Throws:
MBFormatException
- JSON provided inconsistent with specification
-
getIconPadding
(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
Access icon-padding as literal or function expression- Returns:
- Padding around the icon for collision-detection.
- Throws:
MBFormatException
- JSON provided inconsistent with specification
-
getIconKeepUpright
(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
WrapsgetIconKeepUpright()
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
(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
Access icon-offset- Returns:
- Offset of the icon from its anchor
- Throws:
MBFormatException
- JSON provided inconsistent with specification
-
iconOffsetDisplacement
MapsgetIconOffset()
to aDisplacement
(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
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
ConvertsgetTextPitchAlignment()
to a GeoTools expression. Returns an expression that evaluates to one of "map", "viewport", or "auto".- Returns:
- Expression of text pitch 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
ConvertsgetTextRotationAlignment()
to a GeoTools expression.- Returns:
- A GeoTools expression that evaluates to "map", "viewport", or "auto".
- See Also:
-
getTextField
(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
Access text-field as literal or function expression- Returns:
- Value to use for a text label
- Throws:
MBFormatException
- JSON definition inconsistent with specification
-
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
Access text-font as a literal or function expression.- Returns:
- The font to use for the label
- Throws:
MBFormatException
-
getTextSize
(Optional) Units in pixels. Defaults to 16. Requires text-field.Font size.
- Returns:
- The font size
- Throws:
MBFormatException
- JSON definition inconsistent with specification
-
textSize
Access text-size as literal or function expression- Returns:
- The font size
- Throws:
MBFormatException
- JSON definition inconsistent with specification
-
getTextMaxWidth
(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
Access text-max-width as literal or function expression- Returns:
- Maximum label width
- Throws:
MBFormatException
- JSON definition inconsistent with specification
-
hasTextMaxWidth
- Returns:
- True if the layer has a text-max-width explicitly provided.
- Throws:
MBFormatException
-
getTextLineHeight
(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
Access text-line-height as literal or function expression- Returns:
- Label line height
- Throws:
MBFormatException
- JSON definition inconsistent with specification
-
getTextLetterSpacing
(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
Access text-line-height as literal or function expression- Returns:
- Spacing between label characters
- Throws:
MBFormatException
- JSON definition inconsistent with specification
-
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
ConvertsgetTextJustify()
to a GeoTools expression. Returns an expression that evaluates to one of "left", "right", or "center".- Returns:
- Expression of text justification
- See Also:
-
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
ConvertsgetTextAnchor()
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
Layout "text-anchor" provided asAnchorPoint
.- Returns:
- AnchorPoint defined by "text-anchor".
-
iconAnchorPoint
-
anchorPointByProperty
-
getTextMaxAngle
(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
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
(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
Access text-rotate as literal or function expression- Returns:
- Rotation angle of the label
- Throws:
MBFormatException
- JSON definition inconsistent with specification
-
getTextPadding
(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
Access text-padding as literal or function expression- Returns:
- Padding around the label for detecting collisions
- Throws:
MBFormatException
- JSON definition inconsistent with specification
-
getTextKeepUpright
(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
WrapsgetTextKeepUpright()
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
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
ConvertsgetTextTransform()
to a GeoTools expression. Returns an expression that evaluates to one of "uppercase", "lowercase", "none".- Returns:
- Expression providing text transformation
- See Also:
-
getTextOffset
(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
Access text-offset- Returns:
- Offset of the label from its anchor.
- Throws:
MBFormatException
- JSON definition inconsistent with specification
-
textOffsetDisplacement
MapsgetTextOffset()
to aDisplacement
.- Returns:
- (Optional) Units in ems. Defaults to 0,0. Requires text-field.
-
getTextAllowOverlap
(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
WrapsgetTextAllowOverlap()
in a GeoToolsExpression
.(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
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
WrapsgetTextIgnorePlacement()
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
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
WrapsgetTextOptional()
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
(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
Access icon-opacity as literal or function expression- Returns:
- Opacity of the icon
- Throws:
MBFormatException
- JSON definition inconsistent with specification
-
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
Access icon-color as literal or function expression, defaults to black.- Returns:
- Color of the icon as an Expression
-
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
Access icon-halo-color as literal or function expression, defaults to black.- Returns:
- Color of the icon's halo.
-
getIconHaloWidth
(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
Access icon-halo-width as literal or function expression- Returns:
- Width of the icon halo
- Throws:
MBFormatException
- JSON definition inconsistent with specification
-
getIconHaloBlur
(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
Access icon-halo-blur as literal or function expression- Returns:
- Size of the halo fade
- Throws:
MBFormatException
- JSON definition inconsistent with specification
-
getIconTranslate
(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
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
MapsgetIconTranslate()
to aDisplacement
(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
(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
ConvertsgetIconTranslateAnchor()
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
(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
Access text-opacity as literal or function expression- Returns:
- Opacity of the label
- Throws:
MBFormatException
- JSON definition inconsistent with specification
-
getTextColor
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
Access text-color as literal or function expression, defaults to black.- Returns:
- The label color.
-
getTextHaloColor
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
Access text-halo-color as literal or function expression, defaults to black.- Returns:
- The label halo color.
-
getTextHaloWidth
(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
Access text-halo-width as literal or function expression- Returns:
- Size of the label halo
- Throws:
MBFormatException
- JSON definition inconsistent with specification
-
getTextHaloBlur
(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
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
(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
MapsgetTextTranslate()
to aDisplacement
.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
(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
ConvertsgetTextTranslateAnchor()
to a GeoTools expression. Returns an expression that evaluates to one of "map", "viewport".- Returns:
- Expresesion of text translate anchor
- See Also:
-
transformInternal
TransformSymbolMBLayer
to GeoTools FeatureTypeStyle.- 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. -
getLabelPriority
-
setLabelPriority
-