Class: Style

ol.style.Style


import Style from 'ol/style/style';

Container for vector feature rendering styles. Any changes made to the style or its children through set*() methods will not take effect until the feature or layer that uses the style is re-rendered.

new ol.style.Style(opt_options)

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

Style options.

Name Type Description
geometry undefined | string | ol.geom.Geometry | ol.StyleGeometryFunction

Feature property or geometry or function returning a geometry to render for this style.

fill ol.style.Fill | undefined

Fill style.

image ol.style.Image | undefined

Image style.

renderer ol.StyleRenderFunction | undefined

Custom renderer. When configured, fill, stroke and image will be ignored, and the provided function will be called with each render frame for each geometry.

stroke ol.style.Stroke | undefined

Stroke style.

text ol.style.Text | undefined

Text style.

zIndex number | undefined

Z index.

Methods

clone(){ol.style.Style}

src/ol/style/style.js, line 85

Clones the style.

Returns:
The cloned style.

getFill(){ol.style.Fill}

src/ol/style/style.js, line 151

Get the fill style.

Returns:
Fill style.

getGeometry(){string|ol.geom.Geometry|ol.StyleGeometryFunction}

src/ol/style/style.js, line 130

Get the geometry to be rendered.

Returns:
Feature property or geometry or function that returns the geometry that will be rendered with this style.

getGeometryFunction(){ol.StyleGeometryFunction}

src/ol/style/style.js, line 141

Get the function used to generate a geometry for rendering.

Returns:
Function that is called with a feature and returns the geometry to render instead of the feature's geometry.

getImage(){ol.style.Image}

src/ol/style/style.js, line 171

Get the image style.

Returns:
Image style.

getRenderer(){ol.StyleRenderFunction|null}

src/ol/style/style.js, line 107

Get the custom renderer function that was configured with #setRenderer or the renderer constructor option.

Returns:
Custom renderer function.

getStroke(){ol.style.Stroke}

src/ol/style/style.js, line 191

Get the stroke style.

Returns:
Stroke style.

getText(){ol.style.Text}

src/ol/style/style.js, line 211

Get the text style.

Returns:
Text style.

getZIndex(){number|undefined}

src/ol/style/style.js, line 231

Get the z-index for the style.

Returns:
ZIndex.

setFill(fill)

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

Set the fill style.

Name Type Description
fill ol.style.Fill

Fill style.

setGeometry(geometry)

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

Set a geometry that is rendered instead of the feature's geometry.

Name Type Description
geometry string | ol.geom.Geometry | ol.StyleGeometryFunction

Feature property or geometry or function returning a geometry to render for this style.

setImage(image)

src/ol/style/style.js, line 181

Set the image style.

Name Type Description
image ol.style.Image

Image style.

setRenderer(renderer)

src/ol/style/style.js, line 118

Sets a custom renderer function for this style. When set, fill, stroke and image options of the style will be ignored.

Name Type Description
renderer ol.StyleRenderFunction | null

Custom renderer function.

setStroke(stroke)

src/ol/style/style.js, line 201

Set the stroke style.

Name Type Description
stroke ol.style.Stroke

Stroke style.

setText(text)

src/ol/style/style.js, line 221

Set the text style.

Name Type Description
text ol.style.Text

Text style.

setZIndex(zIndex)

src/ol/style/style.js, line 268

Set the z-index.

Name Type Description
zIndex number | undefined

ZIndex.