ol/style/Stroke~Stroke
import Stroke from 'ol/style/Stroke.js';
Set stroke style for vector features. Note that the defaults given are the Canvas defaults, which will be used if option is not defined. The get functions return whatever was entered in the options; they will not return the default.
-
new Stroke(options)
-
Name Type Description colorColor | ColorLike | undefined A color, gradient or pattern. See
ColorandColorLikefor possible formats. Default null; if null, the Canvas/renderer default black will be used.lineCapCanvasLineCap (defaults to 'round') Line cap style:
butt,round, orsquare.lineJoinCanvasLineJoin (defaults to 'round') Line join style:
bevel,round, ormiter.lineDashArray.<number> | undefined Line dash pattern. Default is
null(no dash).lineDashOffsetnumber (defaults to 0) Line dash offset.
miterLimitnumber (defaults to 10) Miter limit.
offsetnumber | undefined Line offset in pixels along the normal. A positive value offsets the line to the right, relative to the direction of the line. Default is
undefined(no offset).widthnumber | undefined Width.
Methods
-
clone(){Stroke}
-
Clones the style.
Returns:
The cloned style.
-
Get the stroke color.
Returns:
Color.
-
getLineCap(){CanvasLineCap | undefined}
-
Get the line cap type for the stroke.
Returns:
Line cap.
-
getLineDash(){Array.<number> | null}
-
Get the line dash style for the stroke.
Returns:
Line dash.
-
getLineDashOffset(){number | undefined}
-
Get the line dash offset for the stroke.
Returns:
Line dash offset.
-
getLineJoin(){CanvasLineJoin | undefined}
-
Get the line join type for the stroke.
Returns:
Line join.
-
getMiterLimit(){number | undefined}
-
Get the miter limit for the stroke.
Returns:
Miter limit.
-
getOffset(){number | undefined}
-
Get the line offset in pixels.
Returns:
Offset.
-
getWidth(){number | undefined}
-
Get the stroke width.
Returns:
Width.
-
setColor(color)
-
Set the color.
Name Type Description colorColor | ColorLike Color.
-
setLineCap(lineCap)
-
Set the line cap.
Name Type Description lineCapCanvasLineCap | undefined Line cap.
-
setLineDash(lineDash)
-
Set the line dash.
Name Type Description lineDashArray.<number> | null Line dash.
-
setLineDashOffset(lineDashOffset)
-
Set the line dash offset.
Name Type Description lineDashOffsetnumber | undefined Line dash offset.
-
setLineJoin(lineJoin)
-
Set the line join.
Name Type Description lineJoinCanvasLineJoin | undefined Line join.
-
setMiterLimit(miterLimit)
-
Set the miter limit.
Name Type Description miterLimitnumber | undefined Miter limit.
-
setOffset(offset)
-
Set the line offset in pixels.
Name Type Description offsetnumber | undefined Offset.
-
setWidth(width)
-
Set the width.
Name Type Description widthnumber | undefined Width.
© 2005-present, OpenLayers Contributors All rights reserved.Licensed under the BSD 2-Clause License.
https://openlayers.org/en/latest/apidoc/module-ol_style_Stroke-Stroke.html