Class 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SymbolMBLayer.Alignment
Interpreted differently when applied to different fields.static class
SymbolMBLayer.IconTextFit
static class
SymbolMBLayer.Justification
static class
SymbolMBLayer.SymbolPlacement
static class
SymbolMBLayer.TextAnchor
Text justification options.static class
SymbolMBLayer.TextTransform
static class
SymbolMBLayer.TranslateAnchor
-
Nested classes/interfaces inherited from class MBLayer
MBLayer.Visibility
-
-
Field Summary
Fields Modifier and Type Field Description protected static int
MARK_ICON_DEFAULT_SIZE
The default base size (pixels) to use to render GeoTools marks in a MB style.protected static 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 GeoToolsMark
rather than an actual sprite sheet location.
-
Constructor Summary
Constructors Constructor Description SymbolMBLayer(JSONObject json)
Create a "symbol" type layer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AnchorPoint
anchorPoint()
Layout "text-anchor" provided asAnchorPoint
.AnchorPoint
anchorPointByProperty(String propertyName)
protected SemanticType
defaultSemanticType()
Boolean
getIconAllowOverlap()
(Optional) Defaults to false.Color
getIconColor()
(Optional) Defaults to #000000.Number
getIconHaloBlur()
(Optional) Units in pixels.Color
getIconHaloColor()
(Optional) Defaults to rgba(0, 0, 0, 0).Number
getIconHaloWidth()
(Optional) Units in pixels.Boolean
getIconIgnorePlacement()
(Optional) Defaults to false.String
getIconImage()
(Optional) A string with {tokens} replaced, referencing the data property to pull from.Boolean
getIconKeepUpright()
(Optional) Defaults to false.double[]
getIconOffset()
(Optional) Defaults to 0,0.Number
getIconOpacity()
(Optional) Defaults to 1.Boolean
getIconOptional()
(Optional) Defaults to false.Number
getIconPadding()
(Optional) Units in pixels.Number
getIconRotate()
(Optional) Units in degrees.SymbolMBLayer.Alignment
getIconRotationAlignment()
Optional enum.Number
getIconSize()
(Optional) Defaults to 1.SymbolMBLayer.IconTextFit
getIconTextFit()
(Optional) One of none, width, height, both.List<Number>
getIconTextFitPadding()
(Optional) Units in pixels.int[]
getIconTranslate()
(Optional) Units in pixels.SymbolMBLayer.TranslateAnchor
getIconTranslateAnchor()
(Optional) One of map, viewport.Integer
getLabelPriority()
Boolean
getSymbolAvoidEdges()
(Optional) Defaults to false.SymbolMBLayer.SymbolPlacement
getSymbolPlacement()
(Optional) One of point, line.Number
getSymbolSpacing()
(Optional) Units in pixels.Boolean
getTextAllowOverlap()
(Optional) Defaults to false.SymbolMBLayer.TextAnchor
getTextAnchor()
Part of the text placed closest to the anchor (requires text-field).Color
getTextColor()
Defaults to #000000.String
getTextField()
(Optional) Value to use for a text label.List<String>
getTextFont()
(Optional) Font stack to use for displaying text.Number
getTextHaloBlur()
(Optional) Units in pixels.Color
getTextHaloColor()
Defaults to rgba(0, 0, 0, 0).Number
getTextHaloWidth()
(Optional) Units in pixels.Boolean
getTextIgnorePlacement()
Defaults to false.SymbolMBLayer.Justification
getTextJustify()
Optional enum.Boolean
getTextKeepUpright()
(Optional) Defaults to true.Number
getTextLetterSpacing()
(Optional) Units in ems.Number
getTextLineHeight()
(Optional) Units in ems.Number
getTextMaxAngle()
(Optional) Units in degrees.Number
getTextMaxWidth()
(Optional) Units in ems.double[]
getTextOffset()
(Optional) Units in ems.Number
getTextOpacity()
(Optional) Defaults to 1.Boolean
getTextOptional()
Defaults to false.Number
getTextPadding()
(Optional) Units in pixels.SymbolMBLayer.Alignment
getTextPitchAlignment()
Optional enum.Number
getTextRotate()
(Optional) Units in degrees.SymbolMBLayer.Alignment
getTextRotationAlignment()
Optional enum.Number
getTextSize()
(Optional) Units in pixels.SymbolMBLayer.TextTransform
getTextTransform()
One of none, uppercase, lowercase.int[]
getTextTranslate()
(Optional) Units in pixels.SymbolMBLayer.TranslateAnchor
getTextTranslateAnchor()
(Optional) One of map, viewport.String
getType()
Rendering type of this layer.boolean
hasIconImage()
boolean
hasTextMaxWidth()
boolean
hasTextTransform()
Returns true if the a text-transform property explicitly providedExpression
iconAllowOverlap()
WrapsgetIconAllowOverlap()
in a GeoTools expression.AnchorPoint
iconAnchorPoint()
Expression
iconColor()
Access icon-color as literal or function expression, defaults to black.Expression
iconHaloBlur()
Access icon-halo-blur as literal or function expressionExpression
iconHaloColor()
Access icon-halo-color as literal or function expression, defaults to black.Expression
iconHaloWidth()
Access icon-halo-width as literal or function expressionExpression
iconIgnorePlacement()
WrapsgetIconIgnorePlacement()
in a GeoTools expression.Expression
iconImage()
Access icon-image as literal or function expressionExpression
iconKeepUpright()
WrapsgetIconKeepUpright()
in a GeoTools expression.Point
iconOffset()
Access icon-offsetDisplacement
iconOffsetDisplacement()
MapsgetIconOffset()
to aDisplacement
Expression
iconOpacity()
Access icon-opacity as literal or function expressionExpression
iconOptional()
Optional enum.Expression
iconPadding()
Access icon-padding as literal or function expressionExpression
iconRotate()
Access icon-rotate as literal or function expressionExpression
iconRotationAlignment()
ConvertsgetIconRotationAlignment()
to a GeoTools expression.Expression
iconSize()
Access icon-size, defaults to 1.Expression
iconTextFit()
WrapsgetIconTextFit()
in a GeoTools expression.Expression
iconTextFitPadding()
(Optional) Units in pixels.Point
iconTranslate()
Units in pixels.Expression
iconTranslateAnchor()
ConvertsgetIconTranslateAnchor()
to a GeoTools expression.Displacement
iconTranslateDisplacement()
MapsgetIconTranslate()
to aDisplacement
void
setLabelPriority(Integer labelPriority)
Expression
symbolAvoidEdges()
WrapsgetSymbolAvoidEdges()
in a GeoTools expression.Expression
symbolPlacement()
(Optional) One of point, line.Expression
symbolSpacing()
Access symbol-spacing, defaults to 250.Expression
textAllowOverlap()
WrapsgetTextAllowOverlap()
in a GeoToolsExpression
.Expression
textAnchor()
ConvertsgetTextAnchor()
to a GeoTools expression.Expression
textColor()
Access text-color as literal or function expression, defaults to black.Expression
textField()
Access text-field as literal or function expressionExpression
textFont()
Access text-font as a literal or function expression.Expression
textHaloBlur()
Access text-halo-blur as literal or function expressionExpression
textHaloColor()
Access text-halo-color as literal or function expression, defaults to black.Expression
textHaloWidth()
Access text-halo-width as literal or function expressionExpression
textIgnorePlacement()
WrapsgetTextIgnorePlacement()
in a GeoTools expression Defaults to false.Expression
textJustify()
ConvertsgetTextJustify()
to a GeoTools expression.Expression
textKeepUpright()
WrapsgetTextKeepUpright()
in a GeoTools expression (Optional) Defaults to true.Expression
textLetterSpacing()
Access text-line-height as literal or function expressionExpression
textLineHeight()
Access text-line-height as literal or function expressionExpression
textMaxAngle()
Access text-max-angle as literal or function expressionExpression
textMaxWidth()
Access text-max-width as literal or function expressionPoint
textOffset()
Access text-offsetDisplacement
textOffsetDisplacement()
MapsgetTextOffset()
to aDisplacement
.Expression
textOpacity()
Access text-opacity as literal or function expressionExpression
textOptional()
WrapsgetTextOptional()
in a GeoTools expression.Expression
textPadding()
Access text-padding as literal or function expressionExpression
textPitchAlignment()
ConvertsgetTextPitchAlignment()
to a GeoTools expression.Expression
textRotate()
Access text-rotate as literal or function expressionExpression
textRotationAlignment()
ConvertsgetTextRotationAlignment()
to a GeoTools expression.Expression
textSize()
Access text-size as literal or function expressionExpression
textTransform()
ConvertsgetTextTransform()
to a GeoTools expression.Point
textTranslate()
(Optional) Units in pixels.Expression
textTranslateAnchor()
ConvertsgetTextTranslateAnchor()
to a GeoTools expression.Displacement
textTranslateDisplacement()
MapsgetTextTranslate()
to aDisplacement
.List<FeatureTypeStyle>
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 Detail
-
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 GeoToolsMark
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:
- Constant Field Values
-
-
Method Detail
-
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.LINEDistance 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()
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
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
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
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()
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
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 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
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()
ConvertsgetIconRotationAlignment()
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()
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
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()
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
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()
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
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()
ConvertsgetTextPitchAlignment()
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()
ConvertsgetTextRotationAlignment()
to a GeoTools expression.- Returns:
- A GeoTools expression that evaluates to "map", "viewport", or "auto".
- See Also:
getTextRotationAlignment()
-
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()
ConvertsgetTextJustify()
to a GeoTools expression. Returns an expression that evaluates to one of "left", "right", or "center".- Returns:
- Expression of text justification
- See Also:
getTextJustify()
-
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()
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:
getTextAnchor()
-
anchorPoint
public AnchorPoint anchorPoint()
Layout "text-anchor" provided asAnchorPoint
.- 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()
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
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()
ConvertsgetTextTransform()
to a GeoTools expression. Returns an expression that evaluates to one of "uppercase", "lowercase", "none".- Returns:
- Expression providing text transformation
- See Also:
getTextTransform()
-
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()
MapsgetTextOffset()
to aDisplacement
.- 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
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
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()
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
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()
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
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()
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
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()
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:
getIconTranslateAnchor()
-
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()
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
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()
ConvertsgetTextTranslateAnchor()
to a GeoTools expression. Returns an expression that evaluates to one of "map", "viewport".- Returns:
- Expresesion of text translate anchor
- See Also:
getTextTranslateAnchor()
-
transformInternal
public List<FeatureTypeStyle> transformInternal(MBStyle styleContext)
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
public String getType()
Rendering type of this layer.
-
getLabelPriority
public Integer getLabelPriority()
-
setLabelPriority
public void setLabelPriority(Integer labelPriority)
-
-