ALKMaps.Marker

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.

Example

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.

Summary
ALKMaps.MarkerDeprecated.
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.Marker.Label
Functions
destroyDestroy the marker.
drawCalls draw on the icon, and returns that output.
eraseErases any drawn elements for this marker.
moveToMove 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.
inflateEnglarges the markers icon by the specified ratio.
setOpacityChange the opacity of the marker by changing the opacity of its icon
setUrlChange URL of the Icon Image.
displayHide or show the icon
onmouseoverWhen 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
onmouseoutWhen 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.
setLabelSet new label
setLabelVisibilityToggle label visibility
getLabelVisibilityGet label visibility
defaultIconCreates a default ALKMaps.Icon.

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

eventListeners

{Object} If set as an option at construction, the eventListeners object will be registered with <OpenLayers.Events.on>.  Object structure must be a listeners object as shown in the example for the events.on method.

div

{DOMElement}

labelOffset

{String} Deprecated.  Replaced by offset property.

offset

{ALKMaps.Pixel} Label offset in pixel.  Label possition is fixed.  If the label is close to a border of the map, it possition does not change.

Constructor

ALKMaps.Marker.Label

Parameters

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}

Functions

destroy

destroy: function()

Destroy the marker.  You must first remove the marker from any layer which it has been added to, or you will get buggy behavior.  (This can not be done within the marker since the marker does not know which layer it is attached to.)

draw

draw: function(px)

Calls draw on the icon, and returns that output.

Parameters

px{ALKMaps.Pixel}

Returns

{DOMElement} A new DOM Image with this marker’s icon set at the location passed-in

erase

erase: function()

Erases any drawn elements for this marker.

moveTo

moveTo: function (px)

Move the marker to the new location.

Parameters

px{<ALKMaps.Pixel>|Object} the pixel position to move to.  An ALKMaps.Pixel or an object with a ‘x’ and ‘y’ properties.

isDrawn

isDrawn: function()

Returns

{Boolean} Whether or not the marker is drawn.

onScreen

onScreen:function()

Returns

{Boolean} Whether or not the marker is currently visible on screen.

inflate

inflate: function(inflate)

Englarges the markers icon by the specified ratio.

Parameters

inflate{float} the ratio to enlarge the marker by (passing 2 will double the size).

setOpacity

setOpacity: function(opacity)

Change the opacity of the marker by changing the opacity of its icon

Parameters

opacity{float} Specified as fraction (0.4, etc)

setUrl

setUrl: function(url)

Change URL of the Icon Image.

url{String}

display

display: function(display)

Hide or show the icon

display{Boolean}

onmouseover

onmouseover: function (evt)

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

Parameters

evt{Event}

onmouseout

onmouseout: 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.

Parameters

evt{Event}

setLabel

setLabel: function (label)

Set new label

Parameters

label{String}

setLabelVisibility

setLabelVisibility: function (visibility)

Toggle label visibility

Parameters

visibility{Boolean}

getLabelVisibility

getLabelVisibility: function ()

Get label visibility

Returns

visibility{Boolean}

defaultIcon

ALKMaps.Marker.defaultIcon = function()

Creates a default ALKMaps.Icon.

Returns

{ALKMaps.Icon} A default ALKMaps.Icon to use for a marker

The icon represents a graphical icon on the screen.
This class represents a longitude and latitude pair
Instances of ALKMaps.Map are interactive maps embedded in a web page.
destroy: function()
Destroy the marker.
draw: function(px)
Calls draw on the icon, and returns that output.
erase: function()
Erases any drawn elements for this marker.
moveTo: function (px)
Move the marker to the new location.
isDrawn: function()
{Boolean} Whether or not the marker is drawn.
onScreen:function()
{Boolean} Whether or not the marker is currently visible on screen.
inflate: function(inflate)
Englarges the markers icon by the specified ratio.
setOpacity: function(opacity)
Change the opacity of the marker by changing the opacity of its icon
setUrl: function(url)
Change URL of the Icon Image.
display: function(display)
Hide or show the icon
onmouseover: function (evt)
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: 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.
setLabel: function (label)
Set new label
setLabelVisibility: function (visibility)
Toggle label visibility
getLabelVisibility: function ()
Get label visibility
ALKMaps.Marker.defaultIcon = function()
Creates a default ALKMaps.Icon.
Instances of ALKMaps.Marker2 are a combination of a div and other elements.
This class represents a screen coordinate, in x and y coordinates
Close