Class: Style

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

Name Type Description
options

Style options.

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

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

fill ol.style.Fill | undefined experimental

Fill style.

image ol.style.Image | undefined experimental

Image style.

stroke ol.style.Stroke | undefined experimental

Stroke style.

text ol.style.Text | undefined experimental

Text style.

zIndex number | undefined experimental

Z index.

Methods

Clones the style.

Returns:
The cloned style.

getFill(){ol.style.Fill} experimental

Get the fill style.

Returns:
Fill style.

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

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

Get the image style.

Returns:
Image style.

getStroke(){ol.style.Stroke} experimental

Get the stroke style.

Returns:
Stroke style.

getText(){ol.style.Text} experimental

Get the text style.

Returns:
Text style.

getZIndex(){number|undefined} experimental

Get the z-index for the style.

Returns:
ZIndex.

setFill(fill) experimental

Set the fill style.

Name Type Description
fill ol.style.Fill

Fill style.

setGeometry(geometry) experimental

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

Set the image style.

Name Type Description
image ol.style.Image

Image style.

setStroke(stroke) experimental

Set the stroke style.

Name Type Description
stroke ol.style.Stroke

Stroke style.

setText(text) experimental

Set the text style.

Name Type Description
text ol.style.Text

Text style.

setZIndex(zIndex) experimental

Set the z-index.

Name Type Description
zIndex number | undefined

ZIndex.