Class: RegularShape

ol/style/RegularShape~RegularShape


import RegularShape from 'ol/style/RegularShape';

Set regular shape style for vector features. The resulting shape will be a regular polygon when radius is provided, or a star when radius1 and radius2 are provided.

new RegularShape(options)

style/RegularShape.js, line 54
Name Type Description
options

Options.

Name Type Description
fill module:ol/style/Fill~Fill

Fill style.

points number

Number of points for stars and regular polygons. In case of a polygon, the number of points is the number of sides.

radius number

Radius of a regular polygon.

radius1 number

Outer radius of a star.

radius2 number

Inner radius of a star.

angle number (defaults to 0)

Shape's angle in radians. A value of 0 will have one of the shape's point facing up.

displacement Array.<number> (defaults to [0,0])

Displacement of the shape

stroke module:ol/style/Stroke~Stroke

Stroke style.

rotation number (defaults to 0)

Rotation in radians (positive rotation clockwise).

rotateWithView boolean (defaults to false)

Whether to rotate the shape with the view.

Subclasses

Extends

Methods

clone(){module:ol/style/RegularShape~RegularShape}

style/RegularShape.js, line 156

Clones the style.

Returns:
The cloned style.

getAnchor(){Array.<number>}

style/RegularShape.js, line 177

Get the anchor point in pixels. The anchor determines the center point for the symbolizer.

Returns:
Anchor.

getAngle(){number}

style/RegularShape.js, line 186

Get the angle used in generating the shape.

Returns:
Shape's rotation in radians.

getDisplacement(){Array.<number>} inherited

style/Image.js, line 119

Get the displacement of the shape

Returns:
Shape's center displacement

getFill(){module:ol/style/Fill~Fill}

style/RegularShape.js, line 195

Get the fill style for the shape.

Returns:
Fill style.

getImage(pixelRatio){HTMLCanvasElement|HTMLVideoElement|HTMLImageElement}

style/RegularShape.js, line 210

Get the image element for the symbolizer.

Name Type Description
pixelRatio number

Pixel ratio.

Returns:
Image element.

getOpacity(){number} inherited

style/Image.js, line 83

Get the symbolizer opacity.

Returns:
Opacity.

getOrigin(){Array.<number>}

style/RegularShape.js, line 239

Get the origin of the symbolizer.

Returns:
Origin.

getPoints(){number}

style/RegularShape.js, line 248

Get the number of points for generating the shape.

Returns:
Number of points for stars and regular polygons.

getRadius(){number}

style/RegularShape.js, line 257

Get the (primary) radius for the shape.

Returns:
Radius.

getRadius2(){number|undefined}

style/RegularShape.js, line 266

Get the secondary radius for the shape.

Returns:
Radius2.

getRotateWithView(){boolean} inherited

style/Image.js, line 92

Determine whether the symbolizer rotates with the map.

Returns:
Rotate with map.

getRotation(){number} inherited

style/Image.js, line 101

Get the symoblizer rotation.

Returns:
Rotation.

getScale(){number} inherited

style/Image.js, line 110

Get the symbolizer scale.

Returns:
Scale.

getSize(){module:ol/size~Size}

style/RegularShape.js, line 274

Get the size of the symbolizer (in pixels).

Returns:
Size.

getStroke(){module:ol/style/Stroke~Stroke}

style/RegularShape.js, line 283

Get the stroke style for the shape.

Returns:
Stroke style.

setOpacity(opacity) inherited

style/Image.js, line 200

Set the opacity.

Name Type Description
opacity number

Opacity.

setRotateWithView(rotateWithView) inherited

style/Image.js, line 210

Set whether to rotate the style with the view.

Name Type Description
rotateWithView boolean

Rotate with map.

setRotation(rotation) inherited

style/Image.js, line 220

Set the rotation.

Name Type Description
rotation number

Rotation.

setScale(scale) inherited

style/Image.js, line 229

Set the scale.

Name Type Description
scale number

Scale.