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 56
Name Type Description
options

Options.

Name Type Default 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 0

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

snapToPixel boolean true

If true integral numbers of pixels are used as the X and Y pixel coordinate when drawing the shape in the output canvas. If false fractional numbers may be used. Using true allows for "sharp" rendering (no blur), while using false allows for "accurate" rendering. Note that accuracy is important if the shape's position is animated. Without it, the shape may jitter noticeably.

stroke module:ol/style/Stroke~Stroke

Stroke style.

rotation number 0

Rotation in radians (positive rotation clockwise).

rotateWithView boolean false

Whether to rotate the shape with the view.

atlasManager module:ol/style/AtlasManager~AtlasManager

The atlas manager to use for this symbol. When using WebGL it is recommended to use an atlas manager to avoid texture switching. If an atlas manager is given, the symbol is added to an atlas. By default no atlas manager is used.

Methods

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

style/RegularShape.js, line 181

Clones the style. If an atlasmanager was provided to the original style it will be used in the cloned style, too.

Returns:
The cloned style.

getAnchor()

style/RegularShape.js, line 203

getAngle(){number}

style/RegularShape.js, line 212

Get the angle used in generating the shape.

Returns:
Shape's rotation in radians.

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

style/RegularShape.js, line 221

Get the fill style for the shape.

Returns:
Fill style.

getImage()

style/RegularShape.js, line 236

getOrigin()

style/RegularShape.js, line 265

getPoints(){number}

style/RegularShape.js, line 274

Get the number of points for generating the shape.

Returns:
Number of points for stars and regular polygons.

getRadius(){number}

style/RegularShape.js, line 283

Get the (primary) radius for the shape.

Returns:
Radius.

getRadius2(){number|undefined}

style/RegularShape.js, line 292

Get the secondary radius for the shape.

Returns:
Radius2.

getSize()

style/RegularShape.js, line 300

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

style/RegularShape.js, line 309

Get the stroke style for the shape.

Returns:
Stroke style.