Telogis.GeoBase.Widgets.Map |
Widgets.Map inherits from Widgets.AbstractWidget.
Represents a displayed map on the page -- the main component of the GeoStream mapping framework. A MapLayers.TileLayer is implicitly created with the map; other layers can be constructed later. All layers belonging to the map can be accessed by subscripting the map variable with their IDs, like so:
var Map = Telogis.GeoBase.Widgets.Map; var ObjectLayer = Telogis.GeoBase.MapLayers.ObjectLayer; var map = new Map ({id: 'main_map'}); new ObjectLayer ({id: 'pin_layer', map: map}); var layer = map ['pin_layer'];
Name | Description | |||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Widgets.Map(config) | Arguments
|
Name | Description | ||||||
---|---|---|---|---|---|---|---|
_getBaseMaxZoomLevel () | Returns the highest max zoom level that this map supports. ReturnsNumber - the highest max zoom level that this map supports. | ||||||
_getZoomAtIndex (Number index) | Finds the zoom level (magnification factor) associated with the given zoom index. Arguments
Number - The zoom corresponding to the given zoom index. | ||||||
_getZoomLevels () | Gets all the different zoom levels (magnification factors) supported by the Widgets.Map. ReturnsArray - The current zoom levels supported by the Widgets.Map | ||||||
addListener (Object listener) | Registers an object with the Widgets.Map so that it is notified whenever the map is updated. Typically, the listener will be either a MapLayers.AbstractLayer or Widgets.MapControl, but user-defined classes may also be used. Arguments
| ||||||
bind (Widgets.Map other, Number zoomDifference) | Binds the map to another so that both pan and zoom synchronously. The calling map is designated the "control" map: calling Widgets.Map.bind on the other map as well allows both to control each other. Arguments
| ||||||
changeSize (Size dsize) | Changes the size of the map by specified amounts in the horizontal and vertical directions. Arguments
| ||||||
destroy () | Frees resources used by the map. While one will typically not have cause to deallocate maps during the lifetime of the page, this is called automatically when the page unloads to prevent leaks in some lesser browsers. | ||||||
disableUI () | Disables the map's user interface so that it will not respond to interactive gestures such as dragging and mouse scrolling. | ||||||
enableUI () | Enables the map's user interface so that it will respond to interactive gestures such as dragging and mouse scrolling. | ||||||
findZoomIndexWhichFits () | returns the zoom index required to fit the BoundingBox, fully on the screen. returns the minimum zoom level if it can't fit on the screen | ||||||
findZoomIndexWhichFits () | returns the zoom index required to fit the BoundingBox, fully on the screen. returns the minimum zoom level if it can't fit on the screen | ||||||
followPosition () | If the browser supports GeoLocation, calling this function will cause the map to recenter on the current location as it changes. Call stopFollowingPosition() to stop the map updating when the position changes. | ||||||
getBoundingBox () | Returns a bounding box in latitude/longitude units that represents the current viewport. ReturnsBoundingBox - A bounding box in latitude/longitude units that represents the current viewport. | ||||||
getBoxingCursor () | Finds the CSS cursor attribute used by Widgets.Map elements when a bounding box is being constructed on them. ReturnsString - The boxing cursor style. | ||||||
getCenter () | Finds the latitude-longitude coordinates of the map's center. ReturnsLatLon - The center of the calling map. | ||||||
getCenterXY () | Finds the x-y coordinates of the map's center. ReturnsPoint - The center of the calling map. | ||||||
getColCount () | Finds the maximum number of tile columns needed to span the map. ReturnsNumber - The map's tile-column count. | ||||||
getCopyrightStyle () | Allows changes to the style of the copyright DIV elements style. ReturnsObject - A reference to the style of the DIV element that contains the copyright. | ||||||
getDefaultCursor () | Finds the CSS cursor attribute used as default by Widgets.Map elements. ReturnsString - The default cursor style. | ||||||
getGesturePoint () | Gets the center point of the current gesture. ReturnsPoint - A point calculated to be central and equidistant from all current touches. | ||||||
getHeight () | Finds the vertical size of the Widgets.Map. ReturnsNumber - The height of the map, in pixels. | ||||||
getLastZoom () | Finds the previous zoom (magnification) of the map. ReturnsNumber - The zoom of the map before the most recent zoom event. | ||||||
getLastZoomIndex () | Finds the last zoom index of the map. ReturnsNumber - The zoom index of the map before the most recent zoom event. | ||||||
getLastZoomLevel () | This function has been deprecated, use Widgets.Map.getLastZoom | ||||||
getLatLon (Point point) | Finds the latitude-longitude coordinates of some pixel point on the map, specified relative to the viewport origin. Arguments
LatLon - The latitude-longitude location of Widgets.Map.getLatLon.point. | ||||||
getMaxZoomIndex () | Finds the maximum zoom index to which the map may be zoomed. ReturnsNumber - The maximum zoom index. If this has not been restricted, it will be the index of the largest of the map's zoom levels. | ||||||
getMinZoomIndex () | Finds the minimum zoom index to which the map may be zoomed. ReturnsNumber - The minimum zoom index. Default is 0. | ||||||
getOrigin () | Finds the pixel-origin of the map's projection. ReturnsPoint - The x- and y- coordinates of the origin of the map's projection. | ||||||
getPan () | Finds the pan offset of the map since it was set up or zoomed. ReturnsPoint - The map's pan offset. | ||||||
getPanCursor () | Finds the CSS cursor attribute used by Widgets.Map elements when a pan can potentially be initiated on them. ReturnsString - The pan cursor style. | ||||||
getPanningCursor () | Finds the CSS cursor attribute used by Widgets.Map elements when they are currently being panned. ReturnsString - The panning cursor style. | ||||||
getRelativeZoom () | returns the relative level of zoom between two zoom indexes - zoom1/zoom2 | ||||||
getResizeAnchor () | Finds the relative screen coordinates, which correspond to the actual point on the map that will stay static on a resize. ReturnsPoint - The resize anchor point on the object that aligns with its designated map location. | ||||||
getRotation () | Finds the pan offset of the map since it was set up or zoomed. ReturnsPoint - The map's pan offset. | ||||||
getRowCount () | Finds the maximum number of tile rows needed to span the map vertically. ReturnsNumber - The map's tile-row count. | ||||||
getScale () | Gets the amount by which the maps appearance has been scaled. ReturnsNumber - The scale of the map such that 1 is 100%, 2 = 200%, .5 = 50%, etc | ||||||
getSize () | Finds the dimensions of the Widgets.Map. ReturnsSize - The size of the map, in pixels. | ||||||
getStartCol () | Finds the index of the first visible column of the map's projection. ReturnsNumber - Which column of the entire set of tiles serves as the start for the map's projection. | ||||||
getStartRow () | Finds the index of the first visible row of the map's projection. ReturnsNumber - Which row of the entire set of tiles serves as the start for the map's projection. | ||||||
getTileCoords (Number row, Number col) | Finds the global tile-grid coordinates of the tile that should be drawn at a specified row and column on the map. Arguments
Point - The coordinates of the top-left corner of the tile. | ||||||
getTileLayer () | Gets the first MapLayers.TileLayer that was added to the Widgets.Map. ReturnsMapLayers.TileLayer - The map's first tile-layer. | ||||||
getTileLayers () | Gets an array of all the MapLayers.TileLayers that have been added to the Widgets.Map. ReturnsArray - An array of the map's tile-layers. | ||||||
getTileOffset () | Finds the offset of a tile in the projection. ReturnsPoint - The pixel offset of each tile from its actual location. The returned offset of a tile this will always be >= 0. | ||||||
getTileSize () | Finds the size (in pixels) of the (square) tiles the projection represents. ReturnsNumber - The tile width corresponding to the projection. | ||||||
getTilesPerSuperTile () | Finds the number of tiles that compose each super-tile in the map's projection. ReturnsNumber - The number of tiles per super-tile. | ||||||
getWidth () | Finds the horizontal size of the Widgets.Map. ReturnsNumber - The width of the map, in pixels. | ||||||
getWorldWidthPixels () | Returns the dimension of the (square) global map, in pixels, at the current zoom level and tile setup. ReturnsNumber - The width (and height) of the map in pixels. | ||||||
getXY (LatLon loc) | Finds the pixel position of a latitude-longitude coordinate pair on the map, relative to the viewport origin. ArgumentsReturnsPoint - The pixel position of the point, from the map's top-left corner. | ||||||
getZoom () | Finds the zoom level (magnification factor) associated with the Widgets.Map's current zoom level. ReturnsNumber - The zoom corresponding to the current zoom index. | ||||||
getZoomIndex () | Finds the Widgets.Map's current zoom index. ReturnsNumber - The index that the Widgets.Map is currently zoomed to. | ||||||
getZoomLevel () | This function has been deprecated, use Widgets.Map.getZoom | ||||||
hideCopyright () | Makes the copyright text in the lower-right corner of the map invisible. | ||||||
hideLayers (Function check) | Hides all of the layers of the map, but not the map container itself. Additionally, a checking callback may be provided that determines whether the hide action should be carried out on a per-layer basis. Arguments
| ||||||
isDragging () | Checks whether the map is currently in the midst of a UI drag. This can be useful for determining whether a layer update method should handle an Widgets.Map.UPDATE_PAN, or wait for an Widgets.Map.UPDATE_END_PAN update. | ||||||
isGesturing () | Returns true if there are two or more touches and they have moved past the threshold amount defined by Constants.GESTURE_THRESHOLD. | ||||||
isUIEnabled () | Finds whether the map is set to respond to user interface events, such as dragging and mouse scrolling. ReturnsBoolean - True if the UI is enabled; false if is disabled. | ||||||
mouseLatLon (Object e) | Finds the latitude-longitude location of the mouse cursor on the map. Arguments
LatLon - The position of the cursor. | ||||||
mouseXY (Object e) | Finds the x-y location of the mouse cursor on the map, relative to its top left corner. Arguments
Point - The position of the cursor. | ||||||
pan (LatLon point, Boolean noUpdate) | Pans the map such that the given point is in the center. Note that this does not regenerate the map projection; rather, it adjusts the projection and positioning of the map container as appropriate to the new position. Arguments | ||||||
panBy (Point delta, Boolean noUpdate) | Pans the map by a set offset. Note that this does not regenerate the map projection; rather, it adjusts the projection and positioning of the map container as appropriate to the new position. Arguments
| ||||||
panToCorner (Point point, Boolean noUpdate) | Pans the map such that the given (x, y) point is in the top left corner. Note that this does not regenerate the map projection; rather, it adjusts the projection and positioning of the map container as appropriate to the new position. Arguments
| ||||||
panToCurrentPosition () | If the browser supports GeoLocation, calling this function will cause the map to recenter on the current location reported by the browser. | ||||||
removeListener (Object listener) | Unregisters a listener from the Widgets.Map so that it is no longer notified whenever the map is updated. Typically, the listener will be either a MapLayers.AbstractLayer or Widgets.MapControl, but user-defined classes may also be used. Arguments
| ||||||
resetOrigin () | Resets the origin of the page to (0, 0). | ||||||
setBackColor (String bgColor) | Sets the background color for the map to display while tiles are loading. Arguments
| ||||||
setBoxingCursor (String css) | Sets the CSS cursor attribute used by Widgets.Map elements when a bounding box is being constructed on them. Arguments
| ||||||
setCenter (LatLon point, Boolean noUpdate) | See pan. Arguments | ||||||
setCopyrightOffset (Point offset) | Sets the offset of the copyright watermark from the map's lower-right corner. Arguments
| ||||||
setCursor (String cursorCSS) | Sets the CSS cursor attribute currently being used by the Widgets.Map. This will be overridden when an action with a specific cursor (for example, panning or constructing a zoom-box) is performed on the map. Arguments
String - The CSS cursor string that was being used before the Widgets.Map.setCursor call was made. | ||||||
setDefaultCursor (String css) | Sets the CSS cursor attribute used as default by Widgets.Map elements. Arguments
| ||||||
setDragBehavior (Number behavior) | Sets the behavior for the map to use when the mouse is dragged on it. Arguments
| ||||||
setHeight (Number height) | Changes the height of the map, without affecting its width. Arguments
| ||||||
setMaxZoomIndex (Number value) | Clamps the maximum zoom index of the map to a certain value which cannot be exceeded. Arguments
| ||||||
setMinZoomIndex (Number value) | Clamps the minimum zoom index of the map to a certain value which cannot be exceeded. Defaults to 0. Arguments
| ||||||
setPanCursor (String css) | Sets the CSS cursor attribute used by Widgets.Map elements when a pan can potentially be initiated on them. Arguments
| ||||||
setPanningCursor (String css) | Sets the CSS cursor attribute used by Widgets.Map elements when they are currently being panned. Arguments
| ||||||
setResizeAnchor (Point resizeAnchor) | Changes the relative screen coordinates, which correspond to the actual point on the map that will stay static on a resize. Arguments
| ||||||
setRightDragBehavior (Number behavior) | Sets the behavior for the map to use when the mouse is dragged on it. Arguments
| ||||||
setSize (Size s, Boolean force) | Resizes the map to the size specified. Resizing is done with respect to the resize anchor if it has values that are different from the default values (0.5, 0.5). Arguments
| ||||||
setUIEnabled (Boolean enabled) | Sets whether the map's user interface is enabled, i.e. whether it will respond to interactive gestures such as dragging and mouse scrolling. Arguments
| ||||||
setWheelBehavior (Number behavior) | Sets the behavior for the map to use when the mouse-wheel is scrolled over it. Arguments
| ||||||
setWidth (Number width) | Changes the width of the map, without affecting its height. Arguments
| ||||||
setZoomIndex (Number index, Boolean noUpdate) | Sets the zoom index. Valid values are by default from 0 to 19 inclusive but if modified using Widgets.Map.setMinZoomIndex or Widgets.Map.setMaxZoomIndex will be Widgets.Map.getMinZoomIndex to Widgets.Map.getMaxZoomIndex inclusive. 0 is the most zoomed out and shows the greatest area; 19 is the most zoomed in and shows the least area but the greatest detail. Arguments
| ||||||
setZoomIndicator (MapLayers.ZoomIndicator zoomIndicator) | Changes the zoom-indicator being used by the map to indicator the focal point of mouse-wheel zooms. Arguments
| ||||||
shade (Widgets.Map other, Object config) | Sets up a MapLayers.ViewportReferenceLayer on another map that represents the calling map's viewport. Arguments
| ||||||
showCopyright () | Makes the copyright text in the lower-right corner of the map visible. | ||||||
showLayers (Function check) | Shows all of the layers of the map, but not the map container itself. Additionally, a checking callback may be provided that determines whether the show action should be carried out on a per-layer basis. Arguments
| ||||||
slowPan (Object e, Boolean noUpdate) | Animates the panning of the map to a specified center in a sinusoidal motion. Generally, this is called on a double mouse click. Arguments
| ||||||
stopFollowingPosition () | If the browser supports GeoLocation and followPosition() was previously called, calling this function will stop the map from recentering when the position changes. | ||||||
touchLatLon (Object e) | Finds the latitude-longitude location of the touch on the map. Arguments
LatLon - The position of the touch. | ||||||
touchXY (Object e) | Finds the x-y location of the touch on the map, relative to its top left corner. Arguments
Point - The position of the touch. | ||||||
update (Number updateType) | Updates the map's layers and controls with a given combination of flags to specify the type of update that has occurred. Arguments
| ||||||
zoomIn () | Increases the zoom index by 1, if possible. | ||||||
zoomOut () | Decreases the zoom index by 1. | ||||||
zoomTo (BoundingBox boundingBox) | Centers the map and zooms in on the specified BoundingBox. Applies an automatic pixel buffer around the BoundingBox to ensure it's fully visible in the viewport. Arguments
|
Name | Type | Description |
---|---|---|
_hasServerInfo | bool | Whether or not the map has received the GeoStream server info or not. If the map has the server info, it will automatically update any listeners attached to it. If the map doesn't have the server info, it will suspend its listeners. |
AddListener | EventHandler | An event that is triggered after a listener has been added to the map with a call to Widgets.Map.addListener. |
container | Element | The parent DOM element to which layers are added. This is clipped to Widgets.Map.frame, and is moved when the map is panned to smoothly adjust all layers appropriately. |
Drag | EventHandler | An event triggered when the map is dragged (also triggers Widgets.Map.Pan). A superevent of AbstractDOMEntity.MouseMove. |
DRAG_PAN | Number | An enumeration code for the map's drag-to-pan interface mode. |
DRAG_ZOOM | Number | An enumeration code for the map's zoom-to-rect interface mode. |
frame | Element | The HTML div element that describes the viewport of the map. Note that this is anchored to the page, unlike Widgets.Map.container, which is moved when the map is panned. |
Pan | EventHandler | An event triggered once the map has been panned. |
PrePan | EventHandler | An event triggered immediately before the map is panned. |
PreRotate | EventHandler | An event triggered immediately before the map is rotated. |
PreZoom | EventHandler | An event triggered immediately before the map is zoomed. This is passed the Pointorigin that the map will zoom about: that is, the point that will remain static during the zoom. |
RemoveListener | EventHandler | An event that is triggered after a listener has been removed from the map with a call to Widgets.Map.removeListener. |
Resize | EventHandler | An event triggered when the map is resized. |
Rotate | EventHandler | An event triggered once the map has been rotated. |
Update | EventHandler | An event triggered when the map's layers are updated. |
UPDATE_CANVAS | Number | An enumeration code for map updates triggered when the contents of the canvas change. |
UPDATE_CLEAR_CACHE | Number | An enumeration code for map updates that clears any cached layer data. |
UPDATE_END_PAN | Number | An enumeration code for map updates triggered when a dragging pan finishes. |
UPDATE_FULL | Number | An enumeration code combining all types of map update. |
UPDATE_PAN | Number | An enumeration code for map updates triggered when the location of the map center changes. |
UPDATE_REDRAW | Number | An enumeration code for map updates that force a redraw of each layer. |
UPDATE_ROTATION | Number | An enumeration code for map updates triggered when the map rotates. |
UPDATE_SIZE | Number | An enumeration code for map updates triggered when the map changes size. |
UPDATE_SIZE | Number | An enumeration code for map updates triggered when the map changes scale. |
UPDATE_SOURCE | Number | An enumeration code for map updates triggered when a layer changes its source data (such as a new tile, or adding a new object) with no change in geometry. |
UPDATE_ZOOM | Number | An enumeration code for map updates triggered when the map changes zoom level. |
WHEEL_ZOOM_TO_CENTER | Number | An enumeration code for the map's zoom-to-center wheel mode. |
WHEEL_ZOOM_TO_CURSOR | Number | An enumeration code for the map's zoom-to-cursor wheel mode. |
Zoom | EventHandler | An event triggered once the map has been zoomed. This is passed the Pointorigin of the map when it is zoomed: that is, the point that remains static during the zoom. |