OpenLayers.Icon

The icon represents a graphical icon on the screen.  Typically used in conjunction with a OpenLayers.Marker to represent markers on a screen.

An icon has a url, size and position.  It also contains an offset which allows the center point to be represented correctly.  This can be provided either as a fixed offset or a function provided to calculate the desired offset.

Summary
The icon represents a graphical icon on the screen.
{String} image url
{OpenLayers.Pixel} distance in pixels to offset the image when being rendered
{OpenLayers.Pixel} Function to calculate the offset (based on the size)
{DOMElement}
Creates an icon, which is an image tag in a div.
Nullify references and remove event listeners to prevent circular references and memory leaks
{OpenLayers.Icon} A fresh copy of the icon.
Move the div to the given pixel.
Change the icon’s opacity
move icon to passed in px.
Hide or show the icon

Properties

url

{String} image url

offset

{OpenLayers.Pixel} distance in pixels to offset the image when being rendered

calculateOffset

{OpenLayers.Pixel} Function to calculate the offset (based on the size)

imageDiv

{DOMElement}

Constructor

OpenLayers.Icon

Creates an icon, which is an image tag in a div.

url{String}
size{OpenLayers.Size}
calculateOffset{Function}

Functions

destroy

destroy: function()

Nullify references and remove event listeners to prevent circular references and memory leaks

clone

clone: function()

Returns

{OpenLayers.Icon} A fresh copy of the icon.

setSize

setSize: function(size)
size{OpenLayers.Size}

draw

draw: function(px)

Move the div to the given pixel.

Parameters

px{OpenLayers.Pixel}

Returns

{DOMElement} A new DOM Image of this icon set at the location passed-in

setOpacity

setOpacity: function(opacity)

Change the icon’s opacity

Parameters

opacity{float}

moveTo

moveTo: function (px)

move icon to passed in px.

Parameters

px{OpenLayers.Pixel}

display

display: function(display)

Hide or show the icon

Parameters

display{Boolean}
Instances of this class represent a width/height pair
This class represents a screen coordinate, in x and y coordinates
destroy: function()
Nullify references and remove event listeners to prevent circular references and memory leaks
clone: function()
{OpenLayers.Icon} A fresh copy of the icon.
Creates an icon, which is an image tag in a div.
setSize: function(size)
draw: function(px)
Move the div to the given pixel.
setOpacity: function(opacity)
Change the icon’s opacity
moveTo: function (px)
move icon to passed in px.
display: function(display)
Hide or show the icon
Instances of OpenLayers.Marker are a combination of a OpenLayers.LonLat and an OpenLayers.Icon.