Class: RegularShape

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 ol.style.RegularShape(options)

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

Options.

Name Type Description
fill ol.style.Fill | undefined

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. Required.

radius number | undefined

Radius of a regular polygon.

radius1 number | undefined

Outer radius of a star.

radius2 number | undefined

Inner radius of a star.

angle number | undefined

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

snapToPixel boolean | undefined

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. Default value is true.

stroke ol.style.Stroke | undefined

Stroke style.

rotation number | undefined

Rotation in radians (positive rotation clockwise). Default is 0.

rotateWithView boolean | undefined

Whether to rotate the shape with the view. Default is false.

atlasManager ol.style.AtlasManager | undefined

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.

Subclasses

Extends

Methods

clone(){ol.style.RegularShape}

src/ol/style/regularshape.js, line 145

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(){Array.<number>}

src/ol/style/regularshape.js, line 168

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

Returns:
Anchor.

getAngle(){number}

src/ol/style/regularshape.js, line 178

Get the angle used in generating the shape.

Returns:
Shape's rotation in radians.

getFill(){ol.style.Fill}

src/ol/style/regularshape.js, line 188

Get the fill style for the shape.

Returns:
Fill style.

getImage(pixelRatio){HTMLCanvasElement|HTMLVideoElement|Image}

src/ol/style/regularshape.js, line 205

Get the image element for the symbolizer.

Name Type Description
pixelRatio number

Pixel ratio.

Returns:
Image element.

getOpacity(){number} inherited

src/ol/style/image.js, line 55

Get the symbolizer opacity.

Returns:
Opacity.

getOrigin(){Array.<number>}

src/ol/style/regularshape.js, line 238

Get the origin of the symbolizer.

Returns:
Origin.

getPoints(){number}

src/ol/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}

src/ol/style/regularshape.js, line 258

Get the (primary) radius for the shape.

Returns:
Radius.

getRadius2(){number|undefined}

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

Get the secondary radius for the shape.

Returns:
Radius2.

getRotateWithView(){boolean} inherited

src/ol/style/image.js, line 65

Determine whether the symbolizer rotates with the map.

Returns:
Rotate with map.

getRotation(){number} inherited

src/ol/style/image.js, line 75

Get the symoblizer rotation.

Returns:
Rotation.

getScale(){number} inherited

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

Get the symbolizer scale.

Returns:
Scale.

getSize(){ol.Size}

src/ol/style/regularshape.js, line 277

Get the size of the symbolizer (in pixels).

Returns:
Size.

getSnapToPixel(){boolean} inherited

src/ol/style/image.js, line 95

Determine whether the symbolizer should be snapped to a pixel.

Returns:
The symbolizer should snap to a pixel.

getStroke(){ol.style.Stroke}

src/ol/style/regularshape.js, line 287

Get the stroke style for the shape.

Returns:
Stroke style.

setOpacity(opacity) inherited

src/ol/style/image.js, line 169

Set the opacity.

Name Type Description
opacity number

Opacity.

setRotation(rotation) inherited

src/ol/style/image.js, line 190

Set the rotation.

Name Type Description
rotation number

Rotation.

setScale(scale) inherited

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

Set the scale.

Name Type Description
scale number

Scale.