Class LineMBLayer
-
public class LineMBLayer extends MBLayer
MBLayer wrapper for "line" layers.Example of line JSON:
{ "type": "line", "source": "http://localhost:8080/geoserver/ne/roads", "source-layer": "road" "id": "roads", "paint": { "line-color": "#6655ae", "line-width": 2, "line-opacity": 1 }, },
- Author:
- Reggie Beckwith (Boundless)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LineMBLayer.LineCap
The display of line endings.static class
LineMBLayer.LineJoin
(Optional) The display of lines when joining.static class
LineMBLayer.LineTranslateAnchor
Controls the translation reference point.-
Nested classes/interfaces inherited from class MBLayer
MBLayer.Visibility
-
-
Constructor Summary
Constructors Constructor Description LineMBLayer(JSONObject json)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected SemanticType
defaultSemanticType()
Number
getLineBlur()
(Optional) Blur applied to the line, in pixels.LineMBLayer.LineCap
getLineCap()
Display of line endings.Color
getLineColor()
(Optional) The color with which the line will be drawn.List<Double>
getLineDasharray()
(Optional) Specifies the lengths of the alternating dashes and gaps that form the dash pattern.Number
getLineGapWidth()
(Optional) Draws a line casing outside of a line's actual path.LineMBLayer.LineJoin
getLineJoin()
Optional enum.Number
getLineMiterLimit()
(Optional) Used to automatically convert miter joins to bevel joins for sharp angles.Number
getLineOffset()
(Optional) The line's offset.Number
getLineOpacity()
(Optional) The opacity at which the line will be drawn.String
getLinePattern()
(Optional) Name of image in sprite to use for drawing image lines.Number
getLineRoundLimit()
(Optional) Used to automatically convert round joins to bevel joins for sharp angles.int[]
getLineTranslate()
(Optional) The geometry's offset.LineMBLayer.LineTranslateAnchor
getLineTranslateAnchor()
(Optional) Controls the translation reference point.Number
getLineWidth()
(Optional) Stroke thickness.String
getType()
Rendering type of this layer.boolean
hasLineGapWidth()
boolean
hasLinePattern()
Expression
lineBlur()
ConvertsgetLineBlur()
to an Expression.Expression
lineCap()
MapsgetLineCap()
toStroke.getLineCap()
values of "butt", "round", and "square" Literals.Expression
lineColor()
MapsgetLineColor()
to anExpression
.List<Expression>
lineDasharray()
ConvertsgetLineDasharray()
to a List of ExpressionsExpression
lineGapWidth()
ConvertsgetLineGapWidth()
to an Expression.Expression
lineJoin()
MapsgetLineJoin()
toStroke.getLineJoin()
values of "mitre", "round", and "bevel" Literals.Expression
lineMiterLimit()
MapsgetLineMiterLimit()
to anExpression
.Expression
lineOffset()
ConvertsgetLineOffset()
to an Expression.Expression
lineOpacity()
MapsgetLineOpacity()
to anExpression
.Expression
linePattern()
ConvertsgetLinePattern()
to an Expression.Expression
lineRoundLimit()
MapsgetLineRoundLimit()
to anExpression
.Expression
lineTranslateAnchor()
WrapsgetLineTranslateAnchor()
in a GeoTools expression.Displacement
lineTranslateDisplacement()
MapsgetLineTranslate()
to aDisplacement
.Expression
lineWidth()
ConvertgetLineWidth()
to an Expression.List<FeatureTypeStyle>
transformInternal(MBStyle styleContext)
TransformLineMBLayer
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
-
-
-
-
Method Detail
-
defaultSemanticType
protected SemanticType defaultSemanticType()
-
getLineCap
public LineMBLayer.LineCap getLineCap()
Display of line endings.Supports piecewise constant functions.
- Returns:
- One of butt, round, square, optional defaults to butt.
-
lineCap
public Expression lineCap()
MapsgetLineCap()
toStroke.getLineCap()
values of "butt", "round", and "square" Literals. Defaults to butt.Since piecewise constant functions is supported a
RecodeFunction
may be generated.- Returns:
- Expression for
Stroke.getLineCap()
use.
-
getLineJoin
public LineMBLayer.LineJoin getLineJoin()
Optional enum. One of bevel, round, miter. Defaults to miter. The display of lines when joining.- Returns:
- The line join
-
lineJoin
public Expression lineJoin()
MapsgetLineJoin()
toStroke.getLineJoin()
values of "mitre", "round", and "bevel" Literals. Defaults to "mitre".Since piecewise constant functions is supported a
RecodeFunction
may be generated.- Returns:
- Expression for
Stroke.getLineJoin()
use.
-
getLineMiterLimit
public Number getLineMiterLimit()
(Optional) Used to automatically convert miter joins to bevel joins for sharp angles.Defaults to 2. Requires line-join = miter.
- Returns:
- The threshold at which miter joins are converted to bevel joins.
-
lineMiterLimit
public Expression lineMiterLimit()
MapsgetLineMiterLimit()
to anExpression
. (Optional) Used to automatically convert miter joins to bevel joins for sharp angles.Defaults to 2. Requires line-join = miter.
- Returns:
- Expression for
getLineMiterLimit()
-
getLineRoundLimit
public Number getLineRoundLimit()
(Optional) Used to automatically convert round joins to bevel joins for sharp angles.Defaults to 1.05. Requires line-join = round.
- Returns:
- The threshold at which round joins are converted to bevel joins.
-
lineRoundLimit
public Expression lineRoundLimit()
MapsgetLineRoundLimit()
to anExpression
.(Optional) Used to automatically convert round joins to bevel joins for sharp angles.
Defaults to 1.05. Requires line-join = round.
- Returns:
- Expression providing threshold at which round joins are converted to bevel joins.
-
getLineOpacity
public Number getLineOpacity()
(Optional) The opacity at which the line will be drawn.Defaults to 1.
- Returns:
- The line opacity
-
lineOpacity
public Expression lineOpacity()
MapsgetLineOpacity()
to anExpression
.(Optional) The opacity at which the line will be drawn.
Defaults to 1.
- Returns:
- opacity for line (literal or function), defaults to 1.
-
getLineColor
public Color getLineColor()
(Optional) The color with which the line will be drawn.Defaults to
Color.BLACK
, disabled by line-pattern.- Returns:
- color to draw the line, optional defaults to black.
-
lineColor
public Expression lineColor()
MapsgetLineColor()
to anExpression
.(Optional) The color with which the line will be drawn.
Defaults to
Color.BLACK
, disabled by line-pattern.- Returns:
- color to draw the line, optional defaults to black.
-
getLineTranslate
public int[] getLineTranslate()
(Optional) The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.Units in pixels. Defaults to 0,0.
- Returns:
- The geometry's offset.
-
lineTranslateDisplacement
public Displacement lineTranslateDisplacement()
MapsgetLineTranslate()
to aDisplacement
.(Optional) The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.
Units in pixels. Defaults to 0,0.
- Returns:
- The geometry's offset, as a Displacement.
-
getLineTranslateAnchor
public LineMBLayer.LineTranslateAnchor getLineTranslateAnchor()
(Optional) Controls the translation reference point.LineMBLayer.LineTranslateAnchor.MAP
: The fill is translated relative to the map.LineMBLayer.LineTranslateAnchor.VIEWPORT
: The fill is translated relative to the viewport.Defaults to
LineMBLayer.LineTranslateAnchor.MAP
. Requires fill-translate.- Returns:
- The translation reference point.
-
lineTranslateAnchor
public Expression lineTranslateAnchor()
WrapsgetLineTranslateAnchor()
in a GeoTools expression. Returns an expression that evaluates to "map" or "viewport".- Returns:
- Expression providing translation reference point.
-
getLineWidth
public Number getLineWidth()
(Optional) Stroke thickness.Units in pixels. Defaults to 1.
- Returns:
- The stroke thickness.
-
lineWidth
public Expression lineWidth()
ConvertgetLineWidth()
to an Expression.(Optional) Stroke thickness. Units in pixels. Defaults to 1.
- Returns:
- The stroke thickness.
-
getLineGapWidth
public Number getLineGapWidth()
(Optional) Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap.Units in pixels. Defaults to 0.
- Returns:
- The inner gap between the sides of the line casing
-
lineGapWidth
public Expression lineGapWidth()
ConvertsgetLineGapWidth()
to an Expression.(Optional) Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap.
Units in pixels. Defaults to 0.
- Returns:
- The inner gap between the sides of the line casing
-
getLineOffset
public Number getLineOffset()
(Optional) The line's offset. For linear features, a positive value offsets the line to the right, relative to the direction of the line, and a negative value to the left. For polygon features, a positive value results in an inset, and a negative value results in an outset.Units in pixels. Defaults to 0.
- Returns:
- The line's offset.
-
lineOffset
public Expression lineOffset()
ConvertsgetLineOffset()
to an Expression.(Optional) The line's offset. For linear features, a positive value offsets the line to the right, relative to the direction of the line, and a negative value to the left. For polygon features, a positive value results in an inset, and a negative value results in an outset.
Units in pixels. Defaults to 0.
- Returns:
- The line's offset.
-
getLineBlur
public Number getLineBlur()
(Optional) Blur applied to the line, in pixels.Units in pixels. Defaults to 0.
- Returns:
- The line blur.
-
lineBlur
public Expression lineBlur()
ConvertsgetLineBlur()
to an Expression.(Optional) Blur applied to the line, in pixels.
Units in pixels. Defaults to 0.
- Returns:
- The line blur.
-
getLineDasharray
public List<Double> getLineDasharray()
(Optional) Specifies the lengths of the alternating dashes and gaps that form the dash pattern. The lengths are later scaled by the line width. To convert a dash length to pixels, multiply the length by the current line width.Units in line widths. Disabled by line-pattern.
- Returns:
- A list of dash and gap lengths defining the pattern for a dashed line.
-
lineDasharray
public List<Expression> lineDasharray()
ConvertsgetLineDasharray()
to a List of Expressions(Optional) Specifies the lengths of the alternating dashes and gaps that form the dash pattern. The lengths are later scaled by the line width. To convert a dash length to pixels, multiply the length by the current line width.
Units in line widths. Disabled by line-pattern.
- Returns:
- A list of dash and gap lengths defining the pattern for a dashed line.
-
getLinePattern
public String getLinePattern()
(Optional) Name of image in sprite to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512).Units in line widths. Disabled by line-pattern.
- Returns:
- The name of the sprite to use for the line pattern.
-
linePattern
public Expression linePattern()
ConvertsgetLinePattern()
to an Expression.(Optional) Name of image in sprite to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512).
Units in line widths. Disabled by line-pattern.
- Returns:
- Expression providing name of the sprite to use for the line pattern.
-
hasLinePattern
public boolean hasLinePattern()
- Returns:
- True if the layer has a line-pattern explicitly provided.
-
hasLineGapWidth
public boolean hasLineGapWidth()
- Returns:
- True if the layer has a line-gap-width explicitly provided.
-
transformInternal
public List<FeatureTypeStyle> transformInternal(MBStyle styleContext)
TransformLineMBLayer
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
-
-