Class: Stroke

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) experimental

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

Options.

Name Type Description
color ol.Color | string | undefined experimental

Color. See ol.color for possible formats. Default null; if null, the Canvas/renderer default black will be used.

lineCap string | undefined experimental

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

lineJoin string | undefined experimental

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

lineDash Array.<number> | undefined experimental

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.

miterLimit number | undefined experimental

Miter limit. Default is 10.

width number | undefined experimental

Width.

Methods

getColor(){ol.Color|string} experimental

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

Get the stroke color.

Returns:
Color.

getLineCap(){string|undefined} experimental

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

Get the line cap type for the stroke.

Returns:
Line cap.

getLineDash(){Array.<number>} experimental

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

Get the line dash style for the stroke.

Returns:
Line dash.

getLineJoin(){string|undefined} experimental

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

Get the line join type for the stroke.

Returns:
Line join.

getMiterLimit(){number|undefined} experimental

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

Get the miter limit for the stroke.

Returns:
Miter limit.

getWidth(){number|undefined} experimental

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

Get the stroke width.

Returns:
Width.

setColor(color) experimental

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

Set the color.

Name Type Description
color ol.Color | string

Color.

setLineCap(lineCap) experimental

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

Set the line cap.

Name Type Description
lineCap string | undefined

Line cap.

setLineDash(lineDash) experimental

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

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.

setLineJoin(lineJoin) experimental

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

Set the line join.

Name Type Description
lineJoin string | undefined

Line join.

setMiterLimit(miterLimit) experimental

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

Set the miter limit.

Name Type Description
miterLimit number | undefined

Miter limit.

setWidth(width) experimental

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

Set the width.

Name Type Description
width number | undefined

Width.