Class: Icon

cercalia.Icon


The cercalia.Marker can contain icons. This icons can be created using this class. This icon can include rotation, transparency. modify size, scale
If icon option is not included in the cercalia.Marker constructor, by default cercalia API use a default icon.

new cercalia.Icon(opt_options)

src/cercalia/icon.js, line 22
Name Type Description
options

Icon Options

Name Type Description
src string | undefined

Image path URL. Default cercalia icon: marker.png

size Array.<number> | undefined

Icon dimensions. Default value: [23, 33].

scale number | undefined

Icon image resizing factor. Default value 1.

opacity number | undefined

Icon opacity. Default value 1.

rotation number | undefined

Icon rotation. Default value 0.

rotateWithView boolean | undefined

Whether to rotate the icon with the view. Default false.

anchor Array.<number> | undefined

Anchor. Default value [0.5, 0.5]. (fraction)

anchorUnits ol.style.IconAnchorUnits | undefined

Units in which the anchor value is specified. A value of 'fraction' indicates the x value is a fraction of the icon. A value of 'pixels' indicates the x value in pixels. Default is 'fraction'.

svg string | undefined

SVG string to create a icon. Example:
<svg width="120" height="120" version="1.1" xmlns="http://www.w3.org/2000/svg">
<circle cx="20" cy="20" r="20"/>
</svg>

Extends

Methods

cercalia.Icon.createDefault(){cercalia.Icon}

src/cercalia/icon.js, line 288

Default icon

Returns:
Return default icon

getAnchor(){Array.<number>|undefined}

src/cercalia/icon.js, line 263
Returns:
anchor Return icon anchor

getAnchorUnits(){string}

src/cercalia/icon.js, line 114
Returns:
Anchor Units pixel or fraction.

getClass(){string} inherited

src/cercalia/object.js, line 41
Returns:
Get Class name of object

getIconStyle(){ol.style.Icon}

src/cercalia/icon.js, line 168
Returns:
Icon Style

getId(){string} inherited

src/cercalia/object.js, line 33
Returns:
Unique Id.

getMarker(){cercalia.Marker}

src/cercalia/icon.js, line 129
Returns:
Marker.

getOpacity(){number}

src/cercalia/icon.js, line 245
Returns:
opacity Image opacity.

getRotation(){number}

src/cercalia/icon.js, line 189
Returns:
Icon rotation (degrees).

getSize(){}

src/cercalia/icon.js, line 215
Returns:
size

getSrc(){string}

src/cercalia/icon.js, line 207
Returns:
Image URL

setAnchor(anchor)

src/cercalia/icon.js, line 254

Set icon anchor

Name Type Description
anchor

Anchor.

setOpacity(opacity)

src/cercalia/icon.js, line 233

Returns the icon image source

Name Type Description
opacity number

Opacity.

setRotation(rotation)

src/cercalia/icon.js, line 177

Apply a rotation, degrees.

Name Type Description
rotation number

degrees rotation.

setSize(size)

src/cercalia/icon.js, line 223
Name Type Description
size

Size image source.

setSrc(src)

src/cercalia/icon.js, line 198

Assign the icon image source

Name Type Description
src string

Image URL.