Class: Stroke

ol.style.Stroke


import Stroke from 'ol/style/stroke';

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 ol.style.Stroke(opt_options)

src/ol/style/stroke.js, line 17
Name Type Description
options

Options.

Name Type Description
color ol.Color | ol.ColorLike | undefined

A color, gradient or pattern. See ol.color and ol.colorlike for possible formats. Default null; if null, the Canvas/renderer default black will be used.

lineCap string | undefined

Line cap style: butt, round, or square. Default is round.

lineJoin string | undefined

Line join style: bevel, round, or miter. Default is round.

lineDash Array.<number> | undefined

Line dash pattern. Default is undefined (no dash). Please note that Internet Explorer 10 and lower do not support the setLineDash method on the CanvasRenderingContext2D and therefore this option will have no visual effect in these browsers.

lineDashOffset number | undefined

Line dash offset. Default is '0'.

miterLimit number | undefined

Miter limit. Default is 10.

width number | undefined

Width.

Methods

clone(){ol.style.Stroke}

src/ol/style/stroke.js, line 76

Clones the style.

Returns:
The cloned style.

getColor(){ol.Color|ol.ColorLike}

src/ol/style/stroke.js, line 95

Get the stroke color.

Returns:
Color.

getLineCap(){string|undefined}

src/ol/style/stroke.js, line 105

Get the line cap type for the stroke.

Returns:
Line cap.

getLineDash(){Array.<number>}

src/ol/style/stroke.js, line 115

Get the line dash style for the stroke.

Returns:
Line dash.

getLineDashOffset(){number|undefined}

src/ol/style/stroke.js, line 125

Get the line dash offset for the stroke.

Returns:
Line dash offset.

getLineJoin(){string|undefined}

src/ol/style/stroke.js, line 135

Get the line join type for the stroke.

Returns:
Line join.

getMiterLimit(){number|undefined}

src/ol/style/stroke.js, line 145

Get the miter limit for the stroke.

Returns:
Miter limit.

getWidth(){number|undefined}

src/ol/style/stroke.js, line 155

Get the stroke width.

Returns:
Width.

setColor(color)

src/ol/style/stroke.js, line 166

Set the color.

Name Type Description
color ol.Color | ol.ColorLike

Color.

setLineCap(lineCap)

src/ol/style/stroke.js, line 178

Set the line cap.

Name Type Description
lineCap string | undefined

Line cap.

setLineDash(lineDash)

src/ol/style/stroke.js, line 196

Set the line dash.

Please note that Internet Explorer 10 and lower do not support the setLineDash method on the CanvasRenderingContext2D and therefore this property will have no visual effect in these browsers.

Name Type Description
lineDash Array.<number>

Line dash.

setLineDashOffset(lineDashOffset)

src/ol/style/stroke.js, line 208

Set the line dash offset.

Name Type Description
lineDashOffset number | undefined

Line dash offset.

setLineJoin(lineJoin)

src/ol/style/stroke.js, line 220

Set the line join.

Name Type Description
lineJoin string | undefined

Line join.

setMiterLimit(miterLimit)

src/ol/style/stroke.js, line 232

Set the miter limit.

Name Type Description
miterLimit number | undefined

Miter limit.

setWidth(width)

src/ol/style/stroke.js, line 244

Set the width.

Name Type Description
width number | undefined

Width.