This defines the standard WhereIs map. Instances of EMS.Map are interactive maps embedded in a web page.
<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.
map = new EMS.Map('map-div', {controls: []});would initialize the map with no default controls.
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.
| EMS.Map | This 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.Map | Constructs a map. |
| Functions | |
| deactivate | Make the map unresponsive to all mouse and keyboard input. |
| activate | Make the map respond to mouse and keyboard input again. |
| updateSize | 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 | {Integer} Returns the minimum zoom level. |
| getMaxZoomLevel | {Integer} Returns the maximum zoom level. |
| addMarker | Shortcut method for adding a marker to the map. |
| removeMarker | Shortcut method for removing a marker from the map. |
| clearMarkers | Shortcut method for clearing all markers from the map. |
| getMarkers | |
| setRoute | Shortcut method for setting the route. |
| getRoute | Shortcut method for getting the current route, which might be null if not set. |
| clearRoute | Shortcut method for clearing any route from the current map. |
| getLayerByName | Finds a layer by a given name. |
{Integer}|{EMS.Zoom} Minimum (most zoomed out) level.
{Integer}|{EMS.Zoom} Maximum (most zoomed in) level.
Constructs a map.
| 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: |
| onInit | a callback function to which the map object should be passed once initialised. |
| controls | specifies 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. |
getLayerByName: function( name )
Finds a layer by a given name.
| name | {EMS.Layer}|{String} is the name of the layer. See EMS.Layer for default defined names. |
{OpenLayers.Layer} If one exists for the given name, null otherwise.
Make the map unresponsive to all mouse and keyboard input.
deactivate: function()
Make the map respond to mouse and keyboard input again.
activate: 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)
updateSize: function()
{Integer} Returns the minimum zoom level.
getMinZoomLevel: function()
{Integer} Returns the maximum zoom level.
getMaxZoomLevel: function()
Shortcut method for adding a marker to the map.
addMarker: function( marker )
Shortcut method for removing a marker from the map.
removeMarker: function( marker )
Shortcut method for clearing all markers from the map.
clearMarkers: function()
getMarkers: function()
Shortcut method for setting the route.
setRoute: function( route )
Shortcut method for getting the current route, which might be null if not set.
getRoute: function()
Shortcut method for clearing any route from the current map.
clearRoute: function()
Finds a layer by a given name.
getLayerByName: function( name )