ALKMaps.Layer.VectorMarkers

Instances of ALKMaps.Layer.VectorMarkers are used to render vector marker from a variety of sources.  Create a new vector layer with the ALKMaps.Layer.VectorMarkers constructor.

Inherits from

Summary
ALKMaps.Layer.VectorMarkersInstances of ALKMaps.Layer.VectorMarkers are used to render vector marker from a variety of sources.
Functions
createMarkerCreate a vector marker and add it to the layer.
createMarkersCreate markers.
addMarkersAdd vector markers to the layer.
removeMarkerErase and destroy vector marker from the layer.
clearMarkersErase and destroy all vector markers.

Functions

createMarker

createMarker: function(lonLat,
attributes,
style,
addMarker)

Create a vector marker and add it to the layer.  If style is not provided and marker type is not custom, then one of the predefined styles will be used.  Predefined marker icon styles are default, blue, green and gold.  If style is supplied, this style will override layer style.  If no style is available, user may need to provide a style map for showing custom markers when the layer is created.

Parameters

lonLat{ALKMaps.LonLat} The marker location.
attributes{Object} An optional object that will be mapped to the <attributes> property.
style{Object} An optional style object.
addMarker{Boolean} If it is set to false, the marker will not be added to the layer.

Note: attributes have following reserved properties

  • isMarker - {Boolean} Set to true by the system.  Read-only.
  • markerType - {String} “green”, “gold”, “blue”, “default”, and “custom”.
  • popupSize - {ALKMaps.Size} Popup size
  • popupContentHTML - {String} Popup content
  • anchor- {Object} Popup anchor such as { size: new ALKMaps.Size(21,25), offset: new ALKMaps.Pixel(-11,-25)}.
  • overflow - {String} Popup overflow style such as ‘auto’.
var point = new ALKMaps.LonLat(-74.273297, 39.942892).transform(new ALKMaps.Projection("EPSG:4326"), map.getProjectionObject());
// Uses default marker icon.
var vm = vectorLayer.createMarker(point);
// Uses green marker icon. Predefined icons: blue, green, gold and default.
var vmGreen = vectorLayer.createMarker(point, {markerType: "green"});
// Uses custom style such as layer style map.
var vmCustom = vectorLayer.createMarker(point, {markerType: "custom"});
// Uses this style to override layer level style. Marker type is ignored.
var vmStyle = vectorLayer.createMarker(point,  null, {
    externalGraphic: ALKMaps.IMAGE.MARKER_BLUE,
    graphicHeight: 25,
    graphicWidth: 21,
    graphicXOffset: -11,
    graphicYOffset: -25
});
// Attach popup data to a marker
var vmPopup= vectorLayer.createMarker(point,  {markerType: "gold",
    popupSize: new ALKMaps.Size(200, 80),
    popupContentHTML: "<p><b>Driver status:</b> Dispatched<br/><b>Cell Phone:</b>87654321<br/></p>",
    anchor: { size: new ALKMaps.Size(21,25), offset: new ALKMaps.Pixel(-11,-25)},
    overflow: 'auto'
});

// ...
// Create popup.
feature.createPopup(true);

createMarkers

createMarkers: function(lonLatList,
attributesList,
styleList)

Create markers.  This method calls createMarker method without adding markers to the layer.

Parameters

lonLatList{Array(ALKMaps.LonLat)} The marker locations.
attributesList{Array(<Object>)} An optional object.  It can be an attributes object or an array of attributes.
styleList{Array(<Object>)} An optional style object.  It can be a style object or an array of style object.

addMarkers

addMarkers: function(features,
options)

Add vector markers to the layer.

Parameters

features{Array(ALKMaps.Feature.Vector)}
options{Object}

removeMarker

removeMarker: function(feature,
options)

Erase and destroy vector marker from the layer.

Parameters

features{ALKMaps.Feature.Vector}
options{Object}

clearMarkers

clearMarkers: function(options)

Erase and destroy all vector markers.  Parameters: features - {Array(ALKMaps.Feature.Vector)} An optional array of features to destroy.  If not supplied, all features on the layer will be destroyed. options - {Object}

createMarker: function(lonLat,
attributes,
style,
addMarker)
Create a vector marker and add it to the layer.
createMarkers: function(lonLatList,
attributesList,
styleList)
Create markers.
addMarkers: function(features,
options)
Add vector markers to the layer.
removeMarker: function(feature,
options)
Erase and destroy vector marker from the layer.
clearMarkers: function(options)
Erase and destroy all vector markers.
Instances of ALKMaps.Layer.VectorMarkers are used to render vector marker from a variety of sources.
Instances of ALKMaps.Layer.Vector are used to render vector data from a variety of sources.
This class represents a longitude and latitude pair
Instances of this class represent a width/height pair
Vector features use the ALKMaps.Geometry classes as geometry description.
Close