public class SymbolMBLayer extends MBLayer
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.
Modifier and Type | Class and 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 |
MBLayer.Visibility
Modifier and Type | Field and 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 GeoTools
Mark
rather than an actual sprite sheet location. |
Constructor and Description |
---|
SymbolMBLayer(JSONObject json)
Create a "symbol" type layer.
|
Modifier and Type | Method and Description |
---|---|
AnchorPoint |
anchorPoint()
Layout "text-anchor" provided as
AnchorPoint . |
AnchorPoint |
anchorPointByProperty(String propertyName) |
protected SemanticType |
defaultSemanticType()
Default
SemanticType to use when generating MBLayer.getFilter() . |
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 provided
|
Expression |
iconAllowOverlap()
Wraps
getIconAllowOverlap() 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 expression
|
Expression |
iconHaloColor()
Access icon-halo-color as literal or function expression, defaults to black.
|
Expression |
iconHaloWidth()
Access icon-halo-width as literal or function expression
|
Expression |
iconIgnorePlacement()
Wraps
getIconIgnorePlacement() in a GeoTools expression. |
Expression |
iconImage()
Access icon-image as literal or function expression
|
Expression |
iconKeepUpright()
Wraps
getIconKeepUpright() in a GeoTools expression. |
Point |
iconOffset()
Access icon-offset
|
Displacement |
iconOffsetDisplacement()
Maps
getIconOffset() to a Displacement
(Optional) Defaults to 0,0. |
Expression |
iconOpacity()
Access icon-opacity as literal or function expression
|
Expression |
iconOptional()
Optional enum.
|
Expression |
iconPadding()
Access icon-padding as literal or function expression
|
Expression |
iconRotate()
Access icon-rotate as literal or function expression
|
Expression |
iconRotationAlignment()
Converts
getIconRotationAlignment() to a GeoTools expression. |
Expression |
iconSize()
Access icon-size, defaults to 1.
|
Expression |
iconTextFit()
Wraps
getIconTextFit() in a GeoTools expression. |
Expression |
iconTextFitPadding()
(Optional) Units in pixels.
|
Point |
iconTranslate()
Units in pixels.
|
Expression |
iconTranslateAnchor()
Converts
getIconTranslateAnchor() to a GeoTools expression. |
Displacement |
iconTranslateDisplacement()
Maps
getIconTranslate() to a Displacement
(Optional) Units in pixels. |
void |
setLabelPriority(Integer labelPriority) |
Expression |
symbolAvoidEdges()
Wraps
getSymbolAvoidEdges() in a GeoTools expression. |
Expression |
symbolPlacement()
(Optional) One of point, line.
|
Expression |
symbolSpacing()
Access symbol-spacing, defaults to 250.
|
Expression |
textAllowOverlap()
Wraps
getTextAllowOverlap() in a GeoTools Expression . |
Expression |
textAnchor()
Converts
getTextAnchor() 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 expression
|
Expression |
textFont()
Access text-font as a literal or function expression.
|
Expression |
textHaloBlur()
Access text-halo-blur as literal or function expression
|
Expression |
textHaloColor()
Access text-halo-color as literal or function expression, defaults to black.
|
Expression |
textHaloWidth()
Access text-halo-width as literal or function expression
|
Expression |
textIgnorePlacement()
Wraps
getTextIgnorePlacement() in a GeoTools expression Defaults to false. |
Expression |
textJustify()
Converts
getTextJustify() to a GeoTools expression. |
Expression |
textKeepUpright()
Wraps
getTextKeepUpright() in a GeoTools expression (Optional) Defaults to true. |
Expression |
textLetterSpacing()
Access text-line-height as literal or function expression
|
Expression |
textLineHeight()
Access text-line-height as literal or function expression
|
Expression |
textMaxAngle()
Access text-max-angle as literal or function expression
|
Expression |
textMaxWidth()
Access text-max-width as literal or function expression
|
Point |
textOffset()
Access text-offset
|
Displacement |
textOffsetDisplacement()
Maps
getTextOffset() to a Displacement . |
Expression |
textOpacity()
Access text-opacity as literal or function expression
|
Expression |
textOptional()
Wraps
getTextOptional() in a GeoTools expression. |
Expression |
textPadding()
Access text-padding as literal or function expression
|
Expression |
textPitchAlignment()
Converts
getTextPitchAlignment() to a GeoTools expression. |
Expression |
textRotate()
Access text-rotate as literal or function expression
|
Expression |
textRotationAlignment()
Converts
getTextRotationAlignment() to a GeoTools expression. |
Expression |
textSize()
Access text-size as literal or function expression
|
Expression |
textTransform()
Converts
getTextTransform() to a GeoTools expression. |
Point |
textTranslate()
(Optional) Units in pixels.
|
Expression |
textTranslateAnchor()
Converts
getTextTranslateAnchor() to a GeoTools expression. |
Displacement |
textTranslateDisplacement()
Maps
getTextTranslate() to a Displacement . |
List<FeatureTypeStyle> |
transformInternal(MBStyle styleContext)
Transform
SymbolMBLayer to GeoTools FeatureTypeStyle. |
create, equals, filter, getFilter, getId, getJson, getLayout, getMaxZoom, getMetadata, getMinZoom, getPaint, getRef, getSource, getSourceLayer, getVisibility, hashCode, layout, paint, toString, transform, transform, visibility
protected static final Set<String> MARK_SHEET_ALIASES
Mark
rather than an actual sprite sheet location.protected static final int MARK_ICON_DEFAULT_SIZE
public SymbolMBLayer(JSONObject json)
json
- JSON symbol definition.protected SemanticType defaultSemanticType()
MBLayer
SemanticType
to use when generating MBLayer.getFilter()
.
Use ANY to match all geometry, or fill in LINE, POINT, POLYGON if needed.
public SymbolMBLayer.SymbolPlacement getSymbolPlacement()
Label placement relative to its geometry.
public Expression symbolPlacement()
Label placement relative to its geometry.
public Number getSymbolSpacing() throws MBFormatException
Distance between two symbol anchors.
MBFormatException
- JSON provided inconsistent with specificationpublic Expression symbolSpacing() throws MBFormatException
MBFormatException
- JSON provided inconsistent with specificationpublic Boolean getSymbolAvoidEdges() throws MBFormatException
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.
MBFormatException
- JSON provided inconsistent with specificationpublic Expression symbolAvoidEdges()
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.
MBFormatException
- JSON definition inconsistent with specificationpublic Boolean getIconAllowOverlap() throws MBFormatException
If true, the icon will be visible even if it collides with other previously drawn symbols.
MBFormatException
- JSON provided inconsistent with specificationpublic Expression iconAllowOverlap() throws MBFormatException
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.
MBFormatException
public Boolean getIconIgnorePlacement() throws MBFormatException
If true, other symbols can be visible even if they collide with the icon.
MBFormatException
- JSON provided inconsistent with specificationpublic Expression iconIgnorePlacement()
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.
MBFormatException
- JSON provided inconsistent with specificationpublic Boolean getIconOptional() throws MBFormatException
If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not.
MBFormatException
- JSON provided inconsistent with specificationpublic Expression iconOptional()
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.
MBFormatException
- JSON provided inconsistent with specificationpublic SymbolMBLayer.Alignment getIconRotationAlignment()
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.
public Expression iconRotationAlignment()
getIconRotationAlignment()
to a GeoTools expression. Returns an expression
that evaluates to one of "map", "viewport", or "auto".public Number getIconSize() throws MBFormatException
Scale factor for icon. 1 is original size, 3 triples the size.
MBFormatException
- JSON provided inconsistent with specificationpublic Expression iconSize()
MBFormatException
- JSON provided inconsistent with specificationpublic SymbolMBLayer.IconTextFit getIconTextFit()
public Expression iconTextFit()
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.
public List<Number> getIconTextFitPadding()
Size of the additional area added to dimensions determined by icon-text-fit, in clockwise order: top, right, bottom, left.
public Expression iconTextFitPadding()
Size of the additional area added to dimensions determined by icon-text-fit, in clockwise order: top, right, bottom, left.
public String getIconImage() throws MBFormatException
MBFormatException
- JSON provided inconsistent with specificationpublic boolean hasIconImage() throws MBFormatException
MBFormatException
public Expression iconImage()
MBFormatException
- JSON provided inconsistent with specificationpublic Number getIconRotate() throws MBFormatException
Rotates the icon clockwise.
MBFormatException
- JSON provided inconsistent with specificationpublic Expression iconRotate() throws MBFormatException
MBFormatException
- JSON provided inconsistent with specificationpublic Number getIconPadding() throws MBFormatException
Size of the additional area around the icon bounding box used for detecting symbol collisions.
MBFormatException
- JSON provided inconsistent with specificationpublic Expression iconPadding() throws MBFormatException
MBFormatException
- JSON provided inconsistent with specificationpublic Boolean getIconKeepUpright() throws MBFormatException
If true, the icon may be flipped to prevent it from being rendered upside-down.
MBFormatException
- JSON provided inconsistent with specificationpublic Expression iconKeepUpright()
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.
MBFormatException
- JSON provided inconsistent with specificationpublic double[] getIconOffset() throws MBFormatException
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.
MBFormatException
- JSON provided inconsistent with specificationpublic Point iconOffset() throws MBFormatException
MBFormatException
- JSON provided inconsistent with specificationpublic Displacement iconOffsetDisplacement()
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.
public SymbolMBLayer.Alignment getTextPitchAlignment()
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.
public Expression textPitchAlignment()
getTextPitchAlignment()
to a GeoTools expression. Returns an expression
that evaluates to one of "map", "viewport", or "auto".public SymbolMBLayer.Alignment getTextRotationAlignment()
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.
public Expression textRotationAlignment()
getTextRotationAlignment()
to a GeoTools expression.getTextRotationAlignment()
public String getTextField() throws MBFormatException
MBFormatException
- JSON definition inconsistent with specificationpublic Expression textField() throws MBFormatException
MBFormatException
- JSON definition inconsistent with specificationpublic List<String> getTextFont()
Defaults to ["Open Sans Regular","Arial Unicode MS Regular"]
. Requires
text-field.
public Expression textFont() throws MBFormatException
MBFormatException
public Number getTextSize() throws MBFormatException
Font size.
MBFormatException
- JSON definition inconsistent with specificationpublic Expression textSize() throws MBFormatException
MBFormatException
- JSON definition inconsistent with specificationpublic Number getTextMaxWidth() throws MBFormatException
The maximum line width for text wrapping.
MBFormatException
- JSON definition inconsistent with specificationpublic Expression textMaxWidth() throws MBFormatException
MBFormatException
- JSON definition inconsistent with specificationpublic boolean hasTextMaxWidth() throws MBFormatException
MBFormatException
public Number getTextLineHeight() throws MBFormatException
Text leading value for multi-line text.
MBFormatException
- JSON definition inconsistent with specificationpublic Expression textLineHeight() throws MBFormatException
MBFormatException
- JSON definition inconsistent with specificationpublic Number getTextLetterSpacing() throws MBFormatException
Text tracking amount.
MBFormatException
- JSON definition inconsistent with specificationpublic Expression textLetterSpacing() throws MBFormatException
MBFormatException
- JSON definition inconsistent with specificationpublic SymbolMBLayer.Justification getTextJustify()
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.
public Expression textJustify()
getTextJustify()
to a GeoTools expression. Returns an expression that
evaluates to one of "left", "right", or "center".getTextJustify()
public SymbolMBLayer.TextAnchor getTextAnchor()
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.
public Expression textAnchor()
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".getTextAnchor()
public AnchorPoint anchorPoint()
AnchorPoint
.public AnchorPoint iconAnchorPoint()
public AnchorPoint anchorPointByProperty(String propertyName)
public Number getTextMaxAngle() throws MBFormatException
Maximum angle change between adjacent characters.
MBFormatException
- JSON definition inconsistent with specificationpublic Expression textMaxAngle()
MBFormatException
- JSON definition inconsistent with specificationpublic Number getTextRotate() throws MBFormatException
Rotates the text clockwise.
MBFormatException
- JSON definition inconsistent with specificationpublic Expression textRotate() throws MBFormatException
MBFormatException
- JSON definition inconsistent with specificationpublic Number getTextPadding() throws MBFormatException
Size of the additional area around the text bounding box used for detecting symbol collisions.
MBFormatException
- JSON definition inconsistent with specificationpublic Expression textPadding() throws MBFormatException
MBFormatException
- JSON definition inconsistent with specificationpublic Boolean getTextKeepUpright() throws MBFormatException
If true, the text may be flipped vertically to prevent it from being rendered upside-down.
MBFormatException
- JSON definition inconsistent with specificationpublic Expression textKeepUpright()
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.
MBFormatException
- JSON definition inconsistent with specificationpublic SymbolMBLayer.TextTransform getTextTransform()
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.
public boolean hasTextTransform()
public Expression textTransform()
getTextTransform()
to a GeoTools expression. Returns an expression that
evaluates to one of "uppercase", "lowercase", "none".getTextTransform()
public double[] getTextOffset() throws MBFormatException
Offset distance of text from its anchor. Positive values indicate right and down, while negative values indicate left and up.
MBFormatException
- JSON definition inconsistent with specificationpublic Point textOffset() throws MBFormatException
MBFormatException
- JSON definition inconsistent with specificationpublic Displacement textOffsetDisplacement()
getTextOffset()
to a Displacement
.public Boolean getTextAllowOverlap() throws MBFormatException
If true, the text will be visible even if it collides with other previously drawn symbols.
MBFormatException
- JSON definition inconsistent with specificationpublic Expression textAllowOverlap() throws MBFormatException
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.
MBFormatException
public Boolean getTextIgnorePlacement() throws MBFormatException
If true, other symbols can be visible even if they collide with the text.
MBFormatException
- JSON definition inconsistent with specificationpublic Expression textIgnorePlacement()
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.
MBFormatException
- JSON definition inconsistent with specificationpublic Boolean getTextOptional() throws MBFormatException
If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not.
MBFormatException
- JSON definition inconsistent with specificationpublic Expression textOptional()
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.
MBFormatException
- JSON definition inconsistent with specificationpublic Number getIconOpacity() throws MBFormatException
The opacity at which the icon will be drawn.
MBFormatException
- JSON definition inconsistent with specificationpublic Expression iconOpacity() throws MBFormatException
MBFormatException
- JSON definition inconsistent with specificationpublic Color getIconColor()
The color of the icon. This can only be used with sdf icons.
public Expression iconColor()
public Color getIconHaloColor()
The color of the icon's halo. Icon halos can only be used with SDF icons.
public Expression iconHaloColor()
public Number getIconHaloWidth() throws MBFormatException
Distance of halo to the icon outline.
MBFormatException
- JSON definition inconsistent with specificationpublic Expression iconHaloWidth()
MBFormatException
- JSON definition inconsistent with specificationpublic Number getIconHaloBlur() throws MBFormatException
Fade out the halo towards the outside.
MBFormatException
- JSON definition inconsistent with specificationpublic Expression iconHaloBlur()
MBFormatException
- JSON definition inconsistent with specificationpublic int[] getIconTranslate() throws MBFormatException
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.
MBFormatException
- JSON definition inconsistent with specificationpublic Point iconTranslate()
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.
MBFormatException
- JSON definition inconsistent with specificationpublic Displacement iconTranslateDisplacement()
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.
public SymbolMBLayer.TranslateAnchor getIconTranslateAnchor()
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
.
public Expression iconTranslateAnchor()
getIconTranslateAnchor()
to a GeoTools expression. Returns an expression
that evaluates to one of "map", "viewport".getIconTranslateAnchor()
public Number getTextOpacity() throws MBFormatException
The opacity at which the text will be drawn.
MBFormatException
- JSON definition inconsistent with specificationpublic Expression textOpacity() throws MBFormatException
MBFormatException
- JSON definition inconsistent with specificationpublic Color getTextColor() throws MBFormatException
The color with which the text will be drawn.
MBFormatException
- JSON definition inconsistent with specificationpublic Expression textColor()
public Color getTextHaloColor() throws MBFormatException
The color of the text's halo, which helps it stand out from backgrounds.
MBFormatException
- JSON definition inconsistent with specificationpublic Expression textHaloColor()
public Number getTextHaloWidth() throws MBFormatException
Distance of halo to the font outline. Max text halo width is 1/4 of the font-size.
MBFormatException
- JSON definition inconsistent with specificationpublic Expression textHaloWidth() throws MBFormatException
MBFormatException
- JSON definition inconsistent with specificationpublic Number getTextHaloBlur() throws MBFormatException
The halo's fadeout distance towards the outside.
MBFormatException
- JSON definition inconsistent with specificationpublic Expression textHaloBlur() throws MBFormatException
MBFormatException
- JSON definition inconsistent with specificationpublic int[] getTextTranslate()
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.
MBFormatException
- JSON definition inconsistent with specificationpublic Point textTranslate()
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.
MBFormatException
- JSON definition inconsistent with specificationpublic Displacement textTranslateDisplacement()
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.
public SymbolMBLayer.TranslateAnchor getTextTranslateAnchor()
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
.
public Expression textTranslateAnchor()
getTextTranslateAnchor()
to a GeoTools expression. Returns an expression
that evaluates to one of "map", "viewport".getTextTranslateAnchor()
public List<FeatureTypeStyle> transformInternal(MBStyle styleContext)
SymbolMBLayer
to GeoTools FeatureTypeStyle.transformInternal
in class MBLayer
styleContext
- The MBStyle to which this layer belongs, used as a context for things
like resolving sprite and glyph names to full urls.public String getType()
public Integer getLabelPriority()
public void setLabelPriority(Integer labelPriority)
Copyright © 1996–2022 Geotools. All rights reserved.