# new Icon(opts)
Initialization object
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
opts |
object
|
Options |
||
rotateWithView |
boolean
|
<optional> |
If the image should get rotated with the view. |
|
rotation |
number
|
<optional> |
Rotation. |
|
scale |
number
|
<optional> |
Scale. |
|
displacement |
number
|
<optional> |
Displacement. |
|
anchor |
Array.<number>
|
<optional> |
[0.5, 0.5] | Anchor. Default value is the icon center. |
color |
string
|
<optional> |
Color to tint the icon. If not specified, the icon will be left as is. |
|
offset |
Array.<number>
|
<optional> |
[0, 0] | Offset, which, together with the size and the offset origin, define the sub-rectangle to use from the original icon image. |
displacement |
Array.<number>
|
<optional> |
[0,0] | Displacement the icon |
offsetOrigin |
string
|
<optional> |
'top-left' | Origin of the offset: |
opacity |
number
|
<optional> |
1 | Opacity of the icon. |
scale |
number
|
<optional> |
1 | Scale. |
rotateWithView |
boolean
|
<optional> |
false | Whether to rotate the icon with the view. |
rotation |
number
|
<optional> |
0 | Rotation in radians (positive rotation clockwise). |
size |
number
|
<optional> |
Icon size in pixel. Can be used together with |
|
imgSize |
number
|
<optional> |
Image size in pixels. Only required if |
|
src |
string
|
<optional> |
Image source URI. |
- Tutorials:
Classes
Methods
# getAnchor() → {Array.<number>}
Get the anchor point in pixels. The anchor determines the center point for the symbolizer.
Anchor.
Array.<number>
# getDisplacement() → {Array.<number>}
Get the displacement of the shape
Shape's center displacement
Array.<number>
# getRotateWithView() → {boolean}
Determine whether the symbolizer rotates with the map.
Rotate with map.
boolean
# setRotateWithView(rotateWithView)
Set whether to rotate the style with the view.
Parameters:
Name | Type | Description |
---|---|---|
rotateWithView |
boolean
|
Rotate with map. |
# setRotation(rotation)
Set the rotation.
Parameters:
Name | Type | Description |
---|---|---|
rotation |
number
|
Rotation. |