map.js
Abstract API atop various mapping providers.
- Objects
- Methods
- OAT.Map::addTypeControl()
- OAT.Map::addMapControl()
- OAT.Map::setMapType(type)
- OAT.Map::centerAndZoom(lat, long, zoom)
- OAT.Map::setZoom(zoom)
- OAT.Map::getZoom()
- OAT.Map::addMarker(group, lat, long, file, w, h, callback)
- OAT.Map::removeMarker(marker)
- OAT.Map::removeMarkers(group)
- OAT.Map::openWindow(marker, something)
- OAT.Map::closeWindow()
- OAT.Map::optimalPosition(pointArray)
- OAT.Map::geoCode(address, callback)
- Constants
- Example
Objects
OAT.Map(something, provider, optionsObject, specificOptions)
Creates a map as a child of something. provider is one of TYPE_ constants. optionsObject may contain:
- fix - one of FIX_ constants, used when markers are too close to each other
- fixDistance - distance for shifting markers
- fixEpsilon - euclidean distance limit of markers to be taken as identical (in degrees). The specificOptions object may contain any engine-specific options, such as {draggableCursor:crosshair} for Google Maps.
Methods
OAT.Map::addTypeControl()
Adds a 'map type' control to the map.
OAT.Map::addMapControl()
Adds a 'map navigation' control to the map.
OAT.Map::setMapType(type)
Sets map type to one of MAP_ constants.
OAT.Map::centerAndZoom(lat, long, zoom)
Pans the map to given lat and long coordinates and zooms. zoom ranges from 0 (far) to 16 (close).
OAT.Map::setZoom(zoom)
Changes current zoom level.
OAT.Map::getZoom()
Returns current zoom level.
OAT.Map::addMarker(group, lat, long, file, w, h, callback)
Adds a marker to the map. Marker belongs to marker group group(any internal value) and is located at coordinates specified in lat and long. file specifies an image file name (wandhare its dimensions), false when default image should be used. Finally, callback is a function to be executed when user clicks marker.
OAT.Map::removeMarker(marker)
Removes existing marker.
OAT.Map::removeMarkers(group)
Removes all markers which belong to group.
OAT.Map::openWindow(marker, something)
Opens window, anchored to marker. something is a DOM node to be appended into window.
OAT.Map::closeWindow()
Closes opened window.
OAT.Map::optimalPosition(pointArray)
Zooms map so all points specified in pointArray (array of 2-element arrays) can be visible simultaneously.
OAT.Map::geoCode(address, callback)
Performs a geocoding lookup of address. When result is returned, callback is executed. Its only argument is false when no result was found, or an array of[lat,long].
Constants
OAT.MapData.TYPE_
Constants specifying maps provider
- OAT.MapData.TYPE_G - specifies Google Maps
- OAT.MapData.TYPE_Y - specifies Yahoo! Maps
- OAT.MapData.TYPE_MS - specifies Microsoft Virtual Earth Maps
- OAT.MapData.TYPE_OL - specifies OpenLayers Maps
OAT.MapData.MAP_
Constants specifying map types.
- OAT.MapData.MAP_MAP - specifies normal
- OAT.MapData.MAP_ORTO - specifies orthographic
- OAT.MapData.MAP_HYB - specifies hybrid
OAT.MapData.FIX_
Constants specifying how markers that are too close to each other will be handled.
- OAT.MapData.FIX_NONE - unhandled
- OAT.MapData.FIX_ROUND1 - specifies arranged into a circle, with one marker in the middle
- OAT.MapData.FIX_ROUND2 - specifies arranged into a circle
- OAT.MapData.FIX_STACK - specifies stacked
Example
var obj = { fix:OAT.MapData.FIX_ROUND1, fixDistance:20, fixEpsilon:0.5 } var map = new OAT.Map("myDiv",OAT.MapData.TYPE_G,obj); map.centerAndZoom(0,0,8); /* africa, middle zoom */ map.addTypeControl(); map.addMapControl(); map.setMapType(OAT.MapData.MAP_ORTO); /* aerial */
Referenced by...