Deprecated. Use ALKMaps.Marker2 instead. Instances of ALKMaps.Marker are a combination of a ALKMaps.LonLat and an ALKMaps.Icon.
Markers are generally added to a special layer called ALKMaps.Layer.Markers.
var markers = new ALKMaps.Layer.Markers( "Markers" ); map.addLayer(markers); var size = new ALKMaps.Size(21,25); var offset = new ALKMaps.Pixel(-(size.w/2), -size.h); var icon = new ALKMaps.Icon('https://www.example.com/img/marker.png', size, offset); markers.addMarker(new ALKMaps.Marker(new ALKMaps.LonLat(0,0),icon)); markers.addMarker(new ALKMaps.Marker(new ALKMaps.LonLat(0,0),icon.clone()));
Note that if you pass an icon into the Marker constructor, it will take that icon and use it. This means that you should not share icons between markers -- you use them once, but you should clone() for any additional markers using that same icon.
ALKMaps. | Deprecated. |
Properties | |
icon | {ALKMaps.Icon} The icon used by this marker. |
lonlat | {ALKMaps.LonLat} location of object |
map | {ALKMaps.Map} the map this marker is attached to |
labelDiv | {DOMElement} |
label | {String} Label text or tool tip. |
mouseOver | {Boolean} When a label is supplied, if mouseOver is true, label will show; otherwise label will always show. |
labelClass | {String} |
displayClass | {string} This property is used for CSS related to the drawing of the Control. |
events | {ALKMaps.Events} the event handler. |
eventListeners | {Object} If set as an option at construction, the eventListeners object will be registered with <OpenLayers.Events.on>. |
div | {DOMElement} |
labelOffset | {String} Deprecated. |
offset | {ALKMaps.Pixel} Label offset in pixel. |
Constructor | |
ALKMaps. | |
Functions | |
destroy | Destroy the marker. |
draw | Calls draw on the icon, and returns that output. |
erase | Erases any drawn elements for this marker. |
moveTo | Move the marker to the new location. |
isDrawn | {Boolean} Whether or not the marker is drawn. |
onScreen | {Boolean} Whether or not the marker is currently visible on screen. |
inflate | Englarges the markers icon by the specified ratio. |
setOpacity | Change the opacity of the marker by changing the opacity of its icon |
setUrl | Change URL of the Icon Image. |
display | Hide or show the icon |
onmouseover | When mouse comes up within the popup, after going down in it, reset the flag, and then (once again) do not propagate the event, but do so safely so that user can select text inside |
onmouseout | When mouse goes out of the popup set the flag to false so that if they let go and then drag back in, we won’t be confused. |
setLabel | Set new label |
setLabelVisibility | Toggle label visibility |
getLabelVisibility | Get label visibility |
defaultIcon | Creates a default ALKMaps.Icon. |
{ALKMaps.Icon} The icon used by this marker.
{ALKMaps.LonLat} location of object
{ALKMaps.Map} the map this marker is attached to
{ALKMaps.Events} the event handler. markerover - Triggered when mouse is over a marker. Listeners will receive an object with event property. markerout - Triggered when mouse is out a marker. Listeners will receive an object with a event property. markerclick - Triggered when mouse clicks on a marker. The event object passed to listeners will have event property.
icon | {ALKMaps.Icon} the icon for this marker |
lonlat | {ALKMaps.LonLat} the position of this marker |
label | {String} the position of this marker |
options | {Object} |
draw: function( px )
Calls draw on the icon, and returns that output.
px | {ALKMaps.Pixel} |
{DOMElement} A new DOM Image with this marker’s icon set at the location passed-in
ALKMaps.Marker.defaultIcon = function()
Creates a default ALKMaps.Icon.
{ALKMaps.Icon} A default ALKMaps.Icon to use for a marker
Destroy the marker.
destroy: function()
Calls draw on the icon, and returns that output.
draw: function( px )
Erases any drawn elements for this marker.
erase: function()
Move the marker to the new location.
moveTo: function ( px )
{Boolean} Whether or not the marker is drawn.
isDrawn: function()
{Boolean} Whether or not the marker is currently visible on screen.
onScreen:function()
Englarges the markers icon by the specified ratio.
inflate: function( inflate )
Change the opacity of the marker by changing the opacity of its icon
setOpacity: function( opacity )
Change URL of the Icon Image.
setUrl: function( url )
Hide or show the icon
display: function( display )
When mouse comes up within the popup, after going down in it, reset the flag, and then (once again) do not propagate the event, but do so safely so that user can select text inside
onmouseover: function ( evt )
When mouse goes out of the popup set the flag to false so that if they let go and then drag back in, we won’t be confused.
onmouseout: function ( evt )
Set new label
setLabel: function ( label )
Toggle label visibility
setLabelVisibility: function ( visibility )
Get label visibility
getLabelVisibility: function ()
Creates a default ALKMaps.Icon.
ALKMaps.Marker.defaultIcon = function()