EMS.Map

This defines the standard WhereIs map.  Instances of EMS.Map are interactive maps embedded in a web page.

To create a basic map include the following in your document

<script type="text/javascript" src="<baseURL>/js/ems/?token=<token>"></script>

then use the following command to create a map.

map = new EMS.Map('map-div', options);

’map-div’ is the id of the div you want to place the map inside of.  You may also use a DOMElement as well.

By default EMS.Map will be initialized with the following controls

The set of controls that is initialized can be controled using the controls option.  For example

map = new EMS.Map('map-div', {controls: []});

would initialize the map with no default controls.

By default five layers are created

  • A street layer
  • A photo layer
  • A hybrid layer
  • A route layer
  • A markers layer

These maybe referenced through the method respectively

map.getLayerByName(EMS.Layer.STREET);
map.getLayerByName(EMS.Layer.PHOTO);
map.getLayerByName(EMS.Layer.HYBRID);
map.getLayerByName(EMS.Layer.ROUTE);
map.getLayerByName(EMS.Layer.MARKERS);

Much like with the controls the layers can be initialized manually.  It is not recommended you do this however.  Simply pass a layers option during the map creation.  eg:

map = new EMS.Map('map-div', {layers: []});

The following events are available.

  • ”addlayer” : called when a layer is added to a map
  • ”removelayer” : called when a layer is removed from a map
  • ”changelayer” : called when a layer is changed.
  • ”zoomend” : called when the map has been zoomed
  • ”popupopen” : called when a popup is opened.
  • ”popupclose” : called when a popup is closed.
  • ”addmarker” : called when a marker is added to a map.
  • ”removemarker” : called when a marker is removed from a map.
  • ”clearmarkers” : called when all markers are cleared from a map.
  • ”mouseover” : called when the cursor is moused into the map.
  • ”mouseout” : called when the cursor is moved out of the map rea.
  • ”mousemove” : called when the cursor moved in the map area.
  • ”dragstart” : called when a drag operation is started.
  • ”dragend” : called when a drag operation is ended.
  • ”changebaselayer” : called when the base layer is changed.
  • ”inactiveclick” : called is the map is inactive and the user clicks on the map area.
  • ”resize” : called if the map is resized.

Inherits from

Summary
EMS.MapThis defines the standard WhereIs map.
Properties
minZoomLevel{Integer}|{EMS.Zoom} Minimum (most zoomed out) level.
maxZoomLevel{Integer}|{EMS.Zoom} Maximum (most zoomed in) level.
fullsizeControls{Boolean} a flag indicating whether to use fullsize controls.
Constants
EVENT_TYPES{Array}
Constructor
EMS.MapConstructs a map.
Functions
deactivateMake the map unresponsive to all mouse and keyboard input.
activateMake the map respond to mouse and keyboard input again.
updateSizeThis function should be called by any external code which dynamically changes the size of the map div (because mozilla wont let us catch the “onresize” for an element)
getMinZoomLevel{Integer} Returns the minimum zoom level.
getMaxZoomLevel{Integer} Returns the maximum zoom level.
addMarkerShortcut method for adding a marker to the map.
removeMarkerShortcut method for removing a marker from the map.
clearMarkersShortcut method for clearing all markers from the map.
getMarkers
setRouteShortcut method for setting the route.
getRouteShortcut method for getting the current route, which might be null if not set.
clearRouteShortcut method for clearing any route from the current map.
getLayerByNameFinds a layer by a given name.

Properties

minZoomLevel

{Integer}|{EMS.Zoom} Minimum (most zoomed out) level.

maxZoomLevel

{Integer}|{EMS.Zoom} Maximum (most zoomed in) level.

fullsizeControls

{Boolean} a flag indicating whether to use fullsize controls.  If true, the controls will be fullsize, if false they will be small.  If not set they will be handled dynamically.

Constants

EVENT_TYPES

{Array}

Constructor

EMS.Map

Constructs a map.

Parameters

div{Mixed} is either a {String} which represents the HTML id or a {DOMElement} to place the map into.  This will also accept a {JQuery} object and inject the map into the first item in object.
options{Object} properties that can be used to override current map properties.  Available parameters include:
onInita callback function to which the map object should be passed once initialised.
controlsspecifies a list of controls that should be displayed.
zoom{Number} specifies a zoom level EMS.Zoom.MINIMUM and EMS.Zoom.MAXIMUM.
center{EMS.LonLat} specifies the maps center point
showMaxExtent{Boolean} When set to true (default) and no center is provided the full map of Australia will display.  If set to false no map will be displayed until a center point or bounds are set.  If you find Australia flashing up before going to your location set this to false.
fullsizeControls{Boolean} specifies if the default map controls should be used or the fullsize map controls.

Functions

deactivate

deactivate: function()

Make the map unresponsive to all mouse and keyboard input.

Will still respond to the inactiveclick event however.

activate

activate: function()

Make the map respond to mouse and keyboard input again.

updateSize

updateSize: function()

This function should be called by any external code which dynamically changes the size of the map div (because mozilla wont let us catch the “onresize” for an element)

getMinZoomLevel

getMinZoomLevel: function()

Returns

{Integer} Returns the minimum zoom level.

getMaxZoomLevel

getMaxZoomLevel: function()

Returns

{Integer} Returns the maximum zoom level.

addMarker

addMarker: function(marker)

Shortcut method for adding a marker to the map.

Parameters

marker{<EMS.Marker>}

removeMarker

removeMarker: function(marker)

Shortcut method for removing a marker from the map.

Parameters

marker{<EMS.Marker>}

clearMarkers

clearMarkers: function()

Shortcut method for clearing all markers from the map.  If multiple markers layers are present, it will clear them all.

getMarkers

getMarkers: function()

Returns

{Array}returns all the markers on the map.  This will never return null, even if no markers layer has been defined, it will always return an empty array.

setRoute

setRoute: function(route)

Shortcut method for setting the route.  This simply delegates to the route layer.

Parameters

route{Object} route object.

getRoute

getRoute: function()

Shortcut method for getting the current route, which might be null if not set.  This simply delegates to the route layer.

Returns

{<EMS.Route>}this current route, this may return null.

clearRoute

clearRoute: function()

Shortcut method for clearing any route from the current map.  This simply delegates to the route layer.

getLayerByName

getLayerByName: function(name)

Finds a layer by a given name.

Parameters

name{EMS.Layer}|{String} is the name of the layer.  See EMS.Layer for default defined names.

Returns

{OpenLayers.Layer} If one exists for the given name, null otherwise.

deactivate: function()
Make the map unresponsive to all mouse and keyboard input.
activate: function()
Make the map respond to mouse and keyboard input again.
updateSize: function()
This function should be called by any external code which dynamically changes the size of the map div (because mozilla wont let us catch the “onresize” for an element)
getMinZoomLevel: function()
{Integer} Returns the minimum zoom level.
getMaxZoomLevel: function()
{Integer} Returns the maximum zoom level.
addMarker: function(marker)
Shortcut method for adding a marker to the map.
removeMarker: function(marker)
Shortcut method for removing a marker from the map.
clearMarkers: function()
Shortcut method for clearing all markers from the map.
getMarkers: function()
setRoute: function(route)
Shortcut method for setting the route.
getRoute: function()
Shortcut method for getting the current route, which might be null if not set.
clearRoute: function()
Shortcut method for clearing any route from the current map.
getLayerByName: function(name)
Finds a layer by a given name.
Constructs a map.
Displays a zoombar.
A control for switching between various layers.
This control sets up mouse handling facilities for the map.
This is the pan buttons for panning north, south, east and west on the map.
Copyright indicator control.
Displays a scale control on the screen showing the current scale.
Displays a small overview map showing a zoomed out view of the current main map.
Instances of OpenLayers.Map are interactive maps embedded in a web page.
Minimum (most zoomed out) value.
Maximum (most zoomed in) value.
Defines the namespace for EMS.Layer.
Close