OpenLayersThe OpenLayers object provides a namespace for all things OpenLayers Summary | The OpenLayers object provides a namespace for all things OpenLayers | | | | {String} Relative path of this script. | | | | Return the path to this script. | | | | | | | | | | This is the old $() from prototype | | Remove an object from an array. | | | | Seems to exist already in FF, but not in MOZ. | | Modifies many properties of a DOM element all at once. | | Creates a new div and optionally set some standard attributes. | | | | Creates an img element with specific attribute values. | | | | | | {String} The color tiles with load errors will turn. | | {Integer} How many times should we try to reload an image before giving up? | | | | Checks whether it’s necessary (and possible) to use the png alpha hack which allows alpha transparency for png images under Internet Explorer. | | | | | | Creates a new hashtable and copies over all the keys from the passed-in object, but storing them under an uppercased version of the key at which they were stored. | | Takes a hashtable and copies any keys that don’t exist from another hashtable, by analogy with OpenLayers.Util.extend() from Prototype.js. | | | | | | {String} The fully formatted image location string | | Execute functions until one of them doesn’t throw an error. | | These could/should be made namespace aware? | | | | | | | | | | | | | | Parse the parameters from a URL or from the current page itself into a JavaScript Object. | | | | {Integer} The ever-incrementing count variable. | | prefix {String} String to prefix unique id. | | | | {Object} Constant inches per unit -- borrowed from MapServer mapscale.c | | {Integer} 72 (A sensible default) | | | | | | | | | | | | Calculates the position of an element on the page. | | Test two URLs for equivalence. | | | | Takes a url and removes everything after the ? | | {String} A string which specifies which is the current browser in which we are running. | | The OpenLayers.Console namespace is used for debugging and error logging. | | | | OpenLayers custom string, number and function functions are described here. | | OpenLayers I18n strings in various langauges. | | | | Base class used to construct all other classes. | | | | | | Instances of this class represent a width/height pair | | | | Create an instance of OpenLayers.Size | | Return the string representation of a size object | | Instances of this class represent bounding boxes. | | | | | | | | | | | | | | Construct a new bounds object. | | Create a cloned instance of this bounds. | | Test a two bounds for equivalence. | | Get the opposite quadrant for a given quadrant string. | | | | This class represents a longitude and latitude pair | | | | Create a new map location. | | Return a readable string version of the lonlat | | | | This class represents a screen coordinate, in x and y coordinates | | | | Create a new OpenLayers.Pixel instance | | Cast this object into a string | | Background load a document. | | Parse XML into a doc structure | | | | | | | | {Object} Transport mechanism for whichever browser we’re in, or false if none available. | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Wrapper function around XMLSerializer, which doesn’t exist/work in IE/Safari. | | Controls affect the display or behavior of the map. | | | | | | { OpenLayers.Map} this gets set in the addControl() function in OpenLayers.Map | | | | {OpenLayers.Control.TYPES} Controls can have a ‘type’. | | {string} This property is used for CSS related to the drawing of the Control. | | | | | | | | Create an OpenLayers Control. | | The destroy method is used to perform any clean up before the control is dereferenced. | | Set the map property for the control. | | The draw method is called when the control is ready to be displayed on the page. | | Sets the left and top style attributes to the passed in pixel coordinates. | | Explicitly activates a control and it’s associated handler if one has been set. | | Deactivates a control and it’s associated handler if any. | | The icon represents a graphical icon on the screen. | | | | | | | | | | | | | | | | | | Creates an icon, which is an image tag in a div. | | Nullify references and remove event listeners to prevent circular references and memory leaks | | | | | | Move the div to the given pixel. | | Change the icon’s opacity | | move icon to passed in px. | | | | | | | | | | Set the map property for the control. | | As soon as a baseLayer has been loaded, we center and zoom ...and remove the handler. | | As soon as all the layers are loaded, cycle through them and hide or show them. | | | | | | {Array(DOMElement)} Array of Button Divs | | | | | | | | | | | | | | | | | | | | | | Utility functions for event handling. | | | | {Object} A hashtable cache of the event observers. | | | | | | | | | | | | | | | | | | | | | | | | Cross browser event element detection. | | Determine whether event was caused by a left click. | | Stops an event from propagating. | | | | | | Given the id of an element to stop observing, cycle through the element’s cached observers, calling stopObserving on each one, skipping those entries which can no longer be removed. | | | | | | Cycle through all the element entries in the events cache and call stopObservingElement on each. | | | | | | {Array(String)} supported events | | | | {Object} Hashtable of Array(Function): events listener functions | | {Object} the code object issuing application events | | {DOMElement} the DOM element receiving browser events | | {Array(String)} list of support application events | | {Function} bound event handler attached to elements | | | | Construct an OpenLayers.Events object. | | | | Remove all listeners for a given event type. | | Basically just a wrapper to the triggerEvent() function, but takes care to set a property ‘xy’ on the event with the current mouse position. | | | | Class for coordinate transformations between coordinate systems. | | | | This class offers several methods for interacting with a wrapped pro4js projection object. | | This is a class designed to designate a single tile, however it is explicitly designed to do relatively little. | | | | {Array(String)} Supported application event types | | | | | | | | {String} url of the request. | | | | | | {Boolean} Is the tile loading? | | | | | | Clear whatever is currently in the tile, then return whether or not it should actually be re-drawn. | | | | Clear the tile of any bounds/position-related data so that it can be reused in a new location. | | Take the pixel locations of the corner of the tile, and pass them to the base layer and ask for the location of those pixels, so that displaying tiles over Google works fine. | | Create an overview map to display the extent of your main map and provide additional navigation control. | | | | | | {DOMElement} The DOM element that contains the overview map | | | | Create a new overview map | | Render the control in the browser. | | | | | | | | | | | | | | | | | | Hide all the contents of the control, shrink the size, add the maximize icon | | Hide/Show the toggle depending on whether the control is minimized | | Update the overview map after layers move. | | Determines if the overview map is suitable given the extent and resolution of the main map. | | Construct the map that this control contains | | Updates the extent rectangle position and size to match the map extent | | Updates the map extent to match the extent rectangle position and size | | Get extent rectangle pixel bounds | | Set extent rectangle pixel bounds. | | Get the rect bounds from the map bounds. | | Get the map bounds from the rect bounds. | | Get a map location from a pixel location | | Get a pixel location from a map location | | Base class to construct a higher-level handler for event sequences. | | | | | | | | | | {Event} This property references the last event handled by the handler. | | | | | | | | Check the keyMask on the handler. | | Trigger the control’s named callback with the given arguments | | register an event on the map | | unregister an event from the map | | With each registered browser event, the handler sets its own evt property. | | | | | | If set as the <keyMask>, checkModifiers returns false if any key is down. | | If set as the <keyMask>, checkModifiers returns false if Shift is down. | | If set as the <keyMask>, checkModifiers returns false if Ctrl is down. | | | | Instances of OpenLayers.Map are interactive maps embedded in a web page. | | | | {Object} Base z-indexes for different classes of thing | | {Array(String)} supported application event types | | | | {String} Unique identifier for the map | | | | {HTMLDivElement} The element that represents the map viewport | | { OpenLayers.LonLat} The lonlat at which the later container was re-initialized (on-zoom) | | {HTMLDivElement} The element that contains the layers. | | | | | | {Array(<OpenLayers.Popup>)} List of popups associated with the map | | | | {Integer} The current zoom level of the map | | {String} Used to store a unique identifier that changes when the map view changes. | | | | Constructor for a new OpenLayers.Map instance. | | Function that is called to destroy the map on page unload. | | | | | | | | | | This function takes care to recenter the layerContainerDiv. | | | | | | | | {Integer} 256 Default tile width (unless otherwise specified) | | {Integer} 256 Default tile height (unless otherwise specified) | | | | | | | | | | | | | | | | | | Calls draw on the icon, and returns that output. | | Move the marker to the new location. | | {Boolean} Whether or not the marker is currently visible on screen. | | Englarges the markers icon by the specified ratio. | | Change the opacity of the marker by changin the opacity of its icon | | | | | | Instances of OpenLayers.Tile.Image are used to manage the image tiles used by various layers. | | | | {String} The URL of the image being requested. | | {DOMElement} The div element which wraps the image. | | {DOMElement} The image element is appended to the frame. | | | | | | Check that a tile should be drawn, and draw it. | | Clear the tile of any bounds/position-related data so that it can be reused in a new location. | | Creates the imgDiv property on the tile. | | Make sure that the image that just loaded is the one this tile is meant to display, since panning/zooming might have changed the tile’s URL in the meantime. | | A handler for mouse clicks. | | | | {Number} The id of the timeout waiting to clear the <delayedEvent>. | | | | | | Create a new click handler. | | | | | | | | Determine whether the event is within the optional pixel tolerance. | | Clear the timer and set timerId to null. | | | | The drag handler is used to deal with sequences of browser events related to dragging. | | | | {Boolean} When a mousedown event is received, we want to record it, but not set ‘dragging’ until the mouse moves after starting. | | | | | | | | | | | | Returns OpenLayers.Handler.Drag | | This method is called during the handling of the mouse down event. | | This method is called during the handling of the mouse move event. | | This method is called during the handling of the mouse up event. | | This method is called during the handling of the mouse out event. | | | | | | | | | | The drag handler captures the click event. | | | | | | Handler for wheel up/down events. | | | | | | { OpenLayers.Pixel} mousePosition is necessary because evt.clientX/Y is buggy in Moz on wheel events, so we cache and use the value from the last mousemove. | | | | | | | | Catch the wheel event and handle it xbrowserly | | Update the stored mousePosition on every move. | | | | | | | | | | {Array(String)} Supported application event types | | | | {Boolean} The layer’s images have an alpha channel. | | {Boolean} The current map resolution is within the layer’s min/max range. | | { OpenLayers.Pixel} For layers with a gutter, the image offset represents displacement due to the gutter. | | {Object} An optional object whose properties will be set on the layer. | | | | | | Destroy is a destructor: this is to alleviate cyclic references which the Javascript garbage cleaner can not take care of on its own. | | | | | | Set the map property for the layer. | | {Boolean} The layer is displayable at the current map’s current resolution. | | This method’s responsibility is to set up the ‘resolutions’ array for the layer -- this array is what the layer will use to interface between the zoom levels of the map and the resolution display of the layer. | | Calculates the max extent which includes all of the data for the layer. | | | | This function will take a bounds, and if wrapDateLine option is set on the layer, it will return a bounds which is wrapped around the world. | | | | | | | | | | | | | | | | Allow the user to change the box’s color and border width | | | | {Boolean} Whether or not the marker is currently visible on screen. | | | | | | | | {OpenLayers.Control.TYPES} | | | | | | Creates a Drag handler, using <OpenLayers.Control.PanMap.panMap> and <OpenLayers.Control.PanMap.panMapDone> as callbacks. | | | | Finish the panning operation. | | Handler for dragging a rectangle across the map. | | | | | | | | | | | | | | | | | | Remove the zoombox from the screen and nullify our reference to it. | | | | | | | | | | {Float} Used to hash URL param strings for multi-WMS server selection. | | | | {Array(String) or String} This is either an array of url strings or a single url string. | | {Object} Hashtable of key/value parameters | | | | | | selectUrl() implements the standard floating-point multiplicative hash function described by Knuth, and hashes the contents of the given param string into a float between 0 and 1. | | Combine url with layer’s params and these newParams. | | | | | | | | {Boolean} internal state of drawing. | | | | | | | | This method removes all markers from a layer. | | Calculate the pixel location for the marker, create it, and add it to the layer’s div | | | | | | {OpenLayers.Control.TYPE} | | | | | | | | Base class for layers that use a lattice of tiles. | | | | {Array(Array( OpenLayers.Tile))} This is an array of rows, each row is an array of tiles. | | | | | | Go through and remove all tiles from the grid, calling destroy() on each of them to kill circular references | | This function is called whenever the map is moved. | | | | | | | | Starts at the top right corner of the grid and proceeds in a spiral towards the center, adding tiles one at a time to the beginning of a queue. | | This function takes a tile as input and adds the appropriate hooks to the tile so that the layer can keep track of the loading tiles. | | This function takes a tile as input and removes the tile hooks that were added in addTileMonitoringHooks() | | | | | | Shift grid work in the other dimension | | When the size of the map or the buffer changes, we may need to remove some excess rows and columns. | | For singleTile layers, this will replace the tile with the a new one with updated tileSize and extent. | | The navigation control handles map browsing with mouse events (dragging, double-clicking, and scrolling the wheel). | | | | | | | | | | | | Create a new navigation control | | | | | | | | | | | | User spun scroll wheel up | | User spun scroll wheel down | | Instances of OpenLayers.Layer.MapGuide are used to display data from a MapGuide OS instance. | | | | {Object} Hashtable of default parameter key/value pairs | | | | | | Instances of OpenLayers.Layer.MapServer are used to display data from a MapServer CGI instance. | | | | {Object} Hashtable of default parameter key/value pairs | | | | Create a new MapServer layer object | | Create a clone of this layer | | Creates a tile, initializes it, and adds it to the layer div. | | Return a query string for this layer | | combine the layer’s url with its params and these newParams. | | Instances of OpenLayers.Layer.WMS are used to display data from OGC Web Mapping Services. | | | | {Object} Hashtable of default parameter key/value pairs | | | | | | | | Create a new WMS layer object | | | | Create a clone of this layer | | Return a GetMap query string for this layer | | addTile creates a tile, initializes it, and adds it to the layer div. | | Combine the layer’s url with its params and these newParams. |
_scriptName{String} Relative path of this script.
_getScriptLocation_getScriptLocation: function () |
Return the path to this script. ReturnsPath to this script
UtilSummary | | | This is the old $() from prototype | | Remove an object from an array. | | | | Seems to exist already in FF, but not in MOZ. | | Modifies many properties of a DOM element all at once. | | Creates a new div and optionally set some standard attributes. | | | | Creates an img element with specific attribute values. | | | | | | {String} The color tiles with load errors will turn. | | {Integer} How many times should we try to reload an image before giving up? | | | | Checks whether it’s necessary (and possible) to use the png alpha hack which allows alpha transparency for png images under Internet Explorer. | | | | | | Creates a new hashtable and copies over all the keys from the passed-in object, but storing them under an uppercased version of the key at which they were stored. | | Takes a hashtable and copies any keys that don’t exist from another hashtable, by analogy with OpenLayers.Util.extend() from Prototype.js. | | | | | | {String} The fully formatted image location string | | Execute functions until one of them doesn’t throw an error. | | These could/should be made namespace aware? | | | | | | | | | | | | | | Parse the parameters from a URL or from the current page itself into a JavaScript Object. | | | | {Integer} The ever-incrementing count variable. | | prefix {String} String to prefix unique id. | | | | {Object} Constant inches per unit -- borrowed from MapServer mapscale.c | | {Integer} 72 (A sensible default) | | | | | | | | | | | | Calculates the position of an element on the page. | | Test two URLs for equivalence. | | | | Takes a url and removes everything after the ? | | {String} A string which specifies which is the current browser in which we are running. |
getElementOpenLayers.Util.getElement = function() |
This is the old $() from prototype
removeItemOpenLayers.Util.removeItem = function( | array, | | item | ) |
|
Remove an object from an array. Iterates through the array to find the item, then removes it. ParametersReturn {Array} A reference to the array
clearArrayOpenLayers.Util.clearArray = function( | array | ) |
|
Deprecated. This function will disappear in 3.0. Please use “array.length = 0” instead. Parameters
indexOfOpenLayers.Util.indexOf = function( | array, | | obj | ) |
|
Seems to exist already in FF, but not in MOZ. ParametersReturns{Integer} The index at, which the object was found in the array. If not found, returns -1.v
modifyDOMElementOpenLayers.Util.modifyDOMElement = function( | element, | | id, | | px, | | sz, | | position, | | border, | | overflow, | | opacity | ) |
|
Modifies many properties of a DOM element all at once. Passing in null to an individual parameter will avoid setting the attribute. Parametersid | {String} The element id attribute to set. | px | {OpenLayers.Pixel} The left and top style position. | sz | {OpenLayers.Size} The width and height style attributes. | position | {String} The position attribute. eg: absolute, relative, etc. | border | {String} The style.border attribute. eg: solid black 2px | overflow | {String} The style.overview attribute. | opacity | {Float} Fractional value (0.0 - 1.0) |
createDivCreates a new div and optionally set some standard attributes. Null may be passed to each parameter if you do not wish to set a particular attribute.d
zIndex is NOT setParametersid | {String} An identifier for this element. If no id is passed an identifier will be created automatically. | px | {OpenLayers.Pixel} The element left and top position. | sz | {OpenLayers.Size} The element width and height. | imgURL | {String} A url pointing to an image to use as a background image. | position | {String} The style.position value. eg: absolute, relative etc. | border | {String} The the style.border value. eg: 2px solid black | overflow | {String} The style.overflow value. Eg. hidden | opacity | {Float} Fractional value (0.0 - 1.0) |
Returns{DOMElement} A DOM Div created with the specified attributes.
createImageOpenLayers.Util.createImage = function( | id, | | px, | | sz, | | imgURL, | | position, | | border, | | opacity, | | delayDisplay | ) |
|
Creates an img element with specific attribute values. Parametersid | {String} The id field for the img. If none assigned one will be automatically generated. | px | {OpenLayers.Pixel} The left and top positions. | sz | {OpenLayers.Size} The style.width and style.height values. | imgURL | {String} The url to use as the image source. | position | {String} The style.position value. | border | {String} The border to place around the image. | delayDisplay | {Boolean} If true waits until the image has been loaded. | opacity | {Float} Fractional value (0.0 - 1.0) |
Returns{DOMElement} A DOM Image created with the specified attributes.
setOpacityOpenLayers.Util.setOpacity = function( | element, | | opacity | ) |
|
Deprecated. This function has been deprecated. Instead, please use OpenLayers.Util.modifyDOMElement() or OpenLayers.Util.modifyAlphaImageDiv() Set the opacity of a DOM Element Note that for this function to work in IE, elements must “have layout” according to: http://msdn.microsoft.com- /workshop- /author- /dhtml- /reference- /properties- /haslayout.asp Parameterselement | {DOMElement} Set the opacity on this DOM element | opacity | {Float} Opacity value (0.0 - 1.0) |
onImageLoadOpenLayers.Util.onImageLoad = function() |
onImageLoadErrorColor{String} The color tiles with load errors will turn. Default is “pink”
onImageLoadErrorColor{Integer} How many times should we try to reload an image before giving up? Default is 0
onImageLoadErrorOpenLayers.Util.onImageLoadError = function() |
alphaHackOpenLayers.Util.alphaHack = function() |
Checks whether it’s necessary (and possible) to use the png alpha hack which allows alpha transparency for png images under Internet Explorer. Returns{Boolean} true if alpha has is necessary and possible, false otherwise.
modifyAlphaImageDivOpenLayers.Util.modifyAlphaImageDiv = function( | div, | | id, | | px, | | sz, | | imgURL, | | position, | | border, | | sizing, | | opacity | ) |
|
div | {DOMElement} Div containing Alpha-adjusted Image | id | {String} | px | {OpenLayers.Pixel} | sz | {OpenLayers.Size} | imgURL | {String} | position | {String} | border | {String} sizing {String} ‘crop’, ‘scale’, or ‘image’. Default is “scale” | opacity | {Float} Fractional value (0.0 - 1.0) |
createAlphaImageDivOpenLayers.Util.createAlphaImageDiv = function( | id, | | px, | | sz, | | imgURL, | | position, | | border, | | sizing, | | opacity, | | delayDisplay | ) |
|
id | {String} | px | {OpenLayers.Pixel} | sz | {OpenLayers.Size} | imgURL | {String} | position | {String} | border | {String} sizing {String} ‘crop’, ‘scale’, or ‘image’. Default is “scale” delayDisplay{Boolean} |
Returns{DOMElement} A DOM Div created with a DOM Image inside it. If the hack is needed for transparency in IE, it is added.
upperCaseObjectOpenLayers.Util.upperCaseObject = function ( | object | ) |
|
Creates a new hashtable and copies over all the keys from the passed-in object, but storing them under an uppercased version of the key at which they were stored. ParametersReturns{Object} A new Object with all the same keys but uppercased
applyDefaultsOpenLayers.Util.applyDefaults = function ( | to, | | from | ) |
|
Takes a hashtable and copies any keys that don’t exist from another hashtable, by analogy with OpenLayers.Util.extend() from Prototype.js. Parameters
getParameterStringOpenLayers.Util.getParameterString = function( | params | ) |
|
ParametersReturns{String} A concatenation of the properties of an object in http parameter notation. (ex. <i>”key1=value1&key2=value2&key3=value3”</i>) If a parameter is actually a list, that parameter will then be set to a comma-seperated list of values (foo,bar) instead of being URL escaped (foo%3Abar).
getImagesLocationOpenLayers.Util.getImagesLocation = function() |
Returns{String} The fully formatted image location string
TryOpenLayers.Util.Try = function() |
Execute functions until one of them doesn’t throw an error. Capitalized because “try” is a reserved word in JavaScript. Taken directly from OpenLayers.Util.Try() Parameters[*] | {Function} Any number of parameters may be passed to Try() It will attempt to execute each of them until one of them successfully executes. If none executes successfully, returns null. |
Returns{*} The value returned by the first successfully executed function.
getNodesOpenLayers.Util.getNodes=function( | p, | | tagName | ) |
|
These could/should be made namespace aware? ParametersReturns{Array}
_getNodesOpenLayers.Util._getNodes=function( | nodes, | | tagName | ) |
|
Parametersnodes | {Array} | tagName | {String} |
Returns{Array}
getTagTextOpenLayers.Util.getTagText = function ( | parent, | | item, | | index | ) |
|
Parametersparent | {} | item | {String} | index | {Integer} |
Returns{String}
getXmlNodeValueOpenLayers.Util.getXmlNodeValue = function( | node | ) |
|
ParametersReturns{String} The text value of the given node, without breaking in firefox or IE
mouseLeftOpenLayers.Util.mouseLeft = function ( | evt, | | div | ) |
|
Parametersevt | {Event} | div | {HTMLDivElement} |
Returns{Boolean}
radOpenLayers.Util.rad = function( | x | ) |
|
ParametersReturns{Float}
distVincentyOpenLayers.Util.distVincenty=function( | p1, | | p2 | ) |
|
ParametersReturns{Float}
getParametersOpenLayers.Util.getParameters = function( | url | ) |
|
Parse the parameters from a URL or from the current page itself into a JavaScript Object. Note that parameter values with commas are separated out into an Array. Parametersurl | {String} Optional url used to extract the query string. If null, query string is taken from page location. |
Returns{Object} An object of key/value pairs from the query string.
getArgsOpenLayers.Util.getArgs = function( | url | ) |
|
Deprecated | Will be removed in 3.0. Please use instead OpenLayers.Util.getParameters |
Parametersurl | {String} Optional url used to extract the query string. If null, query string is taken from page location. |
Returns{Object} An object of key/value pairs from the query string.
lastSeqID{Integer} The ever-incrementing count variable. Used for generating unique ids.
createUniqueIDOpenLayers.Util.createUniqueID = function( | prefix | ) |
|
Parametersprefix {String} String to prefix unique id. If null, default is “id_” Returns{String} A unique id string, built on the passed in prefix
INCHES_PER_UNIT{Object} Constant inches per unit -- borrowed from MapServer mapscale.c
DOTS_PER_INCH{Integer} 72 (A sensible default)
normalzeScaleParametersReturns{Float} A normalized scale value, in 1 / X format. This means that if a value less than one ( already 1/x) is passed in, it just returns scale directly. Otherwise, it returns 1 / scale
getResolutionFromScaleOpenLayers.Util.getResolutionFromScale = function ( | scale, | | units | ) |
|
Parametersscale | {Float} | units | {String} Index into OpenLayers.INCHES_PER_UNIT hashtable. Default is degrees |
Returns{Float} The corresponding resolution given passed-in scale and unit parameters.
getScaleFromResolutionOpenLayers.Util.getScaleFromResolution = function ( | resolution, | | units | ) |
|
Parametersresolution | {Float} | units | {String} Index into OpenLayers.INCHES_PER_UNIT hashtable. Default is degrees |
Returns{Float} The corresponding scale given passed-in resolution and unit parameters.
safeStopPropagationOpenLayers.Util.safeStopPropagation = function( | evt | ) |
|
Deprecated. This function has been deprecated. Please use directly OpenLayers.Event.stop() passing ‘true’ as the 2nd argument (preventDefault) Safely stop the propagation of an event without preventing the default browser action from occurring. Parameter
pagePositonCalculates the position of an element on the page. ParametersReturns:´ {Array} two item array, L value then T value.
isEquivalentUrlOpenLayers.Util.isEquivalentUrl = function( | url1, | | url2, | | options | ) |
|
Test two URLs for equivalence. Setting ‘ignoreCase’ allows for case-independent comparison. Comparison is based on- Protocol
- Host (evaluated without the port)
- Port (set ‘ignorePort80’ to ignore “80” values)
- Hash ( set ‘ignoreHash’ to disable)
- Pathname (for relative <-> absolute comparison)
- Arguments (so they can be out of order)
Parametersurl1 | {String} | url2 | {String} | options | {Object} Allows for customization of comparison: | ’ignoreCase’ | Default is True | ’ignorePort80’ | Default is True | ’ignoreHash’ | Default is True |
Returns{Boolean} Whether or not the two URLs are equivalent
createUrlObjectOpenLayers.Util.createUrlObject = function( | url, | | options | ) |
|
Parametersurl | {String} | options | {Object} A hash of options. Can be one of: ignoreCase: lowercase url, ignorePort80: don’t include explicit port if port is 80, ignoreHash: Don’t include part of url after the hash (#). |
Returns{Object} An object with separate url, a, port, host, and args parsed out and ready for comparison
removeTailOpenLayers.Util.removeTail = function( | url | ) |
|
Takes a url and removes everything after the ? and # Parametersurl | {String} The url to process |
Returns{String} The string with all queryString and Hash removed
getBrowserNameOpenLayers.Util.getBrowserName = function() |
Returns{String} A string which specifies which is the current browser in which we are running. Currently-supported browser detection and codes- ’opera’ -- Opera
- ’msie’ -- Internet Explorer
- ’safari’ -- Safari
- ’firefox’ -- FireFox
- ’mozilla’ -- Mozilla
If we are unable to property identify the browser, we return an empty string.
OpenLayers. ConsoleThe OpenLayers.Console namespace is used for debugging and error logging. If the Firebug Lite (../Firebug/firebug.js) is included before this script, calls to OpenLayers.Console methods will get redirected to window.console. This makes use of the Firebug extension where available and allows for cross-browser debugging Firebug style. NoteNote that behavior will differ with the Firebug extention and Firebug Lite. Most notably, the Firebug Lite console does not currently allow for hyperlinks to code or for clicking on object to explore their properties. Summary | | | OpenLayers custom string, number and function functions are described here. | | OpenLayers I18n strings in various langauges. | | | | Base class used to construct all other classes. | | | | |
OpenLayers Base TypesOpenLayers custom string, number and function functions are described here.
OpenLayers StringsOpenLayers I18n strings in various langauges. Default language is English, langcode=’en’
OpenLayers. ClassOpenLayers.Class = function() |
Base class used to construct all other classes. Includes support for multiple inheritance. This constructor is new in OpenLayers 2.5. At OpenLayers 3.0, the old syntax for creating classes and dealing with inheritance will be removed. To create a new OpenLayers-style class, use the following syntaxvar MyClass = OpenLayers.Class(prototype);
To create a new OpenLayers-style class with multiple inheritance, use the following syntax: var MyClass = OpenLayers.Class(Class1, Class2, prototype);
isPrototypeDeprecated. This is no longer needed and will be removed at 3.0.
OpenLayers.SizeInstances of this class represent a width/height pair Summary | | | Create an instance of OpenLayers.Size | | Return the string representation of a size object |
OpenLayers.SizeCreate an instance of OpenLayers.Size Parametersw | {Number} width | h | {Number} height |
toStringReturn the string representation of a size object Returns{String} The string representation of OpenLayers.Size object. (ex. <i>”w=55,h=66”</i>)
OpenLayers. BoundsInstances of this class represent bounding boxes. Data stored as left, bottom, right, top floats. All values are initialized to null, however, you should make sure you set them before using the bounds for anything. Possible use casebounds = new OpenLayers.Bounds(); bounds.extend(new OpenLayers.LonLat(4,5)); bounds.extend(new OpenLayers.LonLat(5,6)); bounds.toBBOX(); // returns 4,5,5,6
Summary | | | | | | | | | | | | | Construct a new bounds object. | | Create a cloned instance of this bounds. | | Test a two bounds for equivalence. | | Get the opposite quadrant for a given quadrant string. |
OpenLayers. BoundsConstruct a new bounds object. Parametersleft | {Number} The left bounds of the box. Note that for width calculations, this is assumed to be less than the right value. | bottom | {Number} The bottom bounds of the box. Note that for height calculations, this is assumed to be more than the top value. | right | {Number} The right bounds. | top | {Number} The top bounds. |
cloneCreate a cloned instance of this bounds. Returns{OpenLayers.Bounds} A fresh copy of the bounds
equalsTest a two bounds for equivalence. ParametersReturns{Boolean} The passed-in bounds object has the same left, right, top, bottom components as this. Note that if bounds passed in is null, returns false.
oppositeQuadrantOpenLayers.Bounds.oppositeQuadrant = function( | quadrant | ) |
|
Get the opposite quadrant for a given quadrant string. Parametersquadrant | {String} two character quadrant shortstring |
Returns{String} The opposing quadrant (“br” “tr” “tl” “bl”). For Example, if you pass in “bl” it returns “tr”, if you pass in “br” it returns “tl”, etc.
OpenLayers. LonLatThis class represents a longitude and latitude pair Summary | | | Create a new map location. | | Return a readable string version of the lonlat | | |
OpenLayers. LonLatCreate a new map location. Parameterslon | {Number} The x-axis coordinate in map units. If your map is in a geographic projection, this will be the Longitude. Otherwise, it will be the x coordinate of the map location in your map units. | lat | {Number} The y-axis coordinate in map units. If your map is in a geographic projection, this will be the Latitude. Otherwise, it will be the y coordinate of the map location in your map units. |
toStringReturn a readable string version of the lonlat Returns{String} String representation of OpenLayers.LonLat object. (ex. <i>”lon=5,lat=42”</i>)
fromStringOpenLayers.LonLat.fromString = function( | str | ) |
|
Alternative constructor that builds a new OpenLayers.LonLat from a parameter string Parametersstr | {String} Comma-separated Lon,Lat coordinate string. (ex. <i>”5,40”</i>) |
Returns{OpenLayers.LonLat} New OpenLayers.LonLat object built from the passed-in String.
OpenLayers. PixelThis class represents a screen coordinate, in x and y coordinates Summary | | | Create a new OpenLayers.Pixel instance | | Cast this object into a string | | Background load a document. | | Parse XML into a doc structure |
OpenLayers. PixelCreate a new OpenLayers.Pixel instance Parametersx | {Number} The x coordinate | y | {Number} The y coordinate |
ReturnsAn instance of OpenLayers.Pixel
toStringCast this object into a string Returns{String} The string representation of Pixel. ex: “x=200.4,y=242.2”
loadURLOpenLayers.loadURL = function( | uri, | | params, | | caller, | | onComplete, | | onFailure | ) |
|
Background load a document. Parametersuri | {String} URI of source doc | params | {String} Params on get (doesnt seem to work) | caller | {Object} object which gets callbacks | onComplete | {Function} callback for success | onFailure | {Function} callback for failure |
Both callbacks optional (though silly)
parseXMLStringOpenLayers.parseXMLString = function( | text | ) |
|
Parse XML into a doc structure ParametersReturns{?} Parsed AJAX Responsev
OpenLayers.AjaxSummary | | | | | {Object} Transport mechanism for whichever browser we’re in, or false if none available. | | | | |
emptyFunctionemptyFunction: function () |
getTransportReturns{Object} Transport mechanism for whichever browser we’re in, or false if none available.
OpenLayers. Ajax. Responders
registerregister: function( | responderToAdd | ) |
|
Parameters
dispatchdispatch: function( | callback, | | request, | | transport, | | json | ) |
|
Parameterscallback | {?} | request | {?} | transport | {?} | json | {?} |
setOptionssetOptions: function( | options | ) |
|
Parameters
responseIsSuccessresponseIsSuccess: function() |
Returns{Boolean}
responseIsFailureresponseIsFailure: function() |
Returns{Boolean}
OpenLayers. Ajax. RequestInheritSummary | | | | | | | | | | | | | | | | | | | | | | | | | Wrapper function around XMLSerializer, which doesn’t exist/work in IE/Safari. |
OpenLayers. Ajax. RequestParametersurl | {String} | options | {Object} |
setRequestHeaderssetRequestHeaders: function() |
onStateChangeonStateChange: function() |
respondToReadyStaterespondToReadyState: function( | readyState | ) |
|
Parameters
dispatchExceptiondispatchException: function( | exception | ) |
|
Parameters
getElementsByTagNameNSOpenLayers.Ajax.getElementsByTagNameNS = function( | parentnode, | | nsuri, | | nsprefix, | | tagname | ) |
|
Parametersparentnode | {?} | nsuri | {?} | nsprefix | {?} | tagname | {?} |
Returns{?}
serializeXMLToStringOpenLayers.Ajax.serializeXMLToString = function( | xmldom | ) |
|
Wrapper function around XMLSerializer, which doesn’t exist/work in IE/Safari. We need to come up with a way to serialize in those browser: for now, these browsers will just fail. #535, #536 Parametersxmldom {XMLNode} xml dom to serialize Returns{?}
OpenLayers. ControlControls affect the display or behavior of the map. They allow everything from panning and zooming to displaying a scale indicator. Controls by default are added to the map they are contained within however it is possible to add a control to an external div by passing the div in the options parameter. ExampleThe following example shows how to add many of the common controls to a map. var map = new OpenLayers.Map('map', { controls: [] });
map.addControl(new OpenLayers.Control.PanZoomBar()); map.addControl(new OpenLayers.Control.MouseToolbar()); map.addControl(new OpenLayers.Control.LayerSwitcher({'ascending':false})); map.addControl(new OpenLayers.Control.Permalink()); map.addControl(new OpenLayers.Control.Permalink('permalink')); map.addControl(new OpenLayers.Control.MousePosition()); map.addControl(new OpenLayers.Control.OverviewMap()); map.addControl(new OpenLayers.Control.KeyboardDefaults());
The next code fragment is a quick example of how to intercept shift-mouse click to display the extent of the bounding box dragged out by the user. Usually controls are not created in exactly this manner. See the source for a more complete example: var control = new OpenLayers.Control(); OpenLayers.Util.extend(control, { draw: function () { // this Handler.Box will intercept the shift-mousedown // before Control.MouseDefault gets to see it this.box = new OpenLayers.Handler.Box( control, {"done": this.notice}, {keyMask: OpenLayers.Handler.MOD_SHIFT}); this.box.activate(); },
notice: function (bounds) { alert(bounds); } }); map.addControl(control);
Summary | | | | | { OpenLayers.Map} this gets set in the addControl() function in OpenLayers.Map | | | | {OpenLayers.Control.TYPES} Controls can have a ‘type’. | | {string} This property is used for CSS related to the drawing of the Control. | | | | | | | | Create an OpenLayers Control. | | The destroy method is used to perform any clean up before the control is dereferenced. | | Set the map property for the control. | | The draw method is called when the control is ready to be displayed on the page. | | Sets the left and top style attributes to the passed in pixel coordinates. | | Explicitly activates a control and it’s associated handler if one has been set. | | Deactivates a control and it’s associated handler if any. |
map{OpenLayers.Map} this gets set in the addControl() function in OpenLayers.Map
type{OpenLayers.Control.TYPES} Controls can have a ‘type’. The type determines the type of interactions which are possible with them when they are placed into a toolbar.
displayClass{string} This property is used for CSS related to the drawing of the Control.
OpenLayers. ControlCreate an OpenLayers Control. The options passed as a parameter directly extend the control. For example passing the following: var control = new OpenLayers.Control({div: myDiv});
Overrides the default div attribute value of null. Parameters
destroyThe destroy method is used to perform any clean up before the control is dereferenced. Typically this is where event listeners are removed to prevent memory leaks.
setMapSet the map property for the control. This is done through an accessor so that subclasses can override this and take special action once they have their map variable set. Parameters
drawThe draw method is called when the control is ready to be displayed on the page. If a div has not been created one is created. Controls with a visual component will almost always want to override this method to customize the look of control. ParametersReturns{DOMElement} A reference to the DIV DOMElement containing the control
moveToSets the left and top style attributes to the passed in pixel coordinates. Parameters
activateExplicitly activates a control and it’s associated handler if one has been set. Controls can be deactivated by calling the deactivate() method. Returns{Boolean} True if the control was successfully activated or false if the control was already active.
deactivateDeactivates a control and it’s associated handler if any. The exact effect of this depends on the control itself. Returns{Boolean} True if the control was effectively deactivated or false if the control was already inactive.
OpenLayers.IconThe icon represents a graphical icon on the screen. Typically used in conjunction with a OpenLayers.Marker to represent markers on a screen. An icon has a url, size and position. It also contains an offset which allows the center point to be represented correctly. This can be provided either as a fixed offset or a function provided to calculate the desired offset. Summary | | | | | | | | | | | | | | | | | Creates an icon, which is an image tag in a div. | | Nullify references and remove event listeners to prevent circular references and memory leaks | | | | | | Move the div to the given pixel. | | Change the icon’s opacity | | move icon to passed in px. | | |
offset{OpenLayers.Pixel} distance in pixels to offset the image when being rendered
calculateOffset{OpenLayers.Pixel} Function to calculate the offset (based on the size)
OpenLayers.IconCreates an icon, which is an image tag in a div.
destroyNullify references and remove event listeners to prevent circular references and memory leaks
drawMove the div to the given pixel. ParametersReturns{DOMElement} A new DOM Image of this icon set at the location passed-in
setOpacitysetOpacity: function( | opacity | ) |
|
Change the icon’s opacity Parameters
moveTomove icon to passed in px. Parameters
displaydisplay: function( | display | ) |
|
Hide or show the icon Parameters
OpenLayers. Control. ArgParserInherits fromSummary | | | | | Set the map property for the control. | | As soon as a baseLayer has been loaded, we center and zoom ...and remove the handler. | | As soon as all the layers are loaded, cycle through them and hide or show them. |
OpenLayers. Control. ArgParser
setMapSet the map property for the control. Parameters
setCenterAs soon as a baseLayer has been loaded, we center and zoom ...and remove the handler.
configureLayersconfigureLayers: function() |
As soon as all the layers are loaded, cycle through them and hide or show them.
OpenLayers. PanZoomInherits fromSummary | | | {Array(DOMElement)} Array of Button Divs | | | | | | | | | | | | | | | | | | | | |
buttons{Array(DOMElement)} Array of Button Divs
OpenLayers. Control. PanZoom
drawParametersReturns{DOMElement} A reference to the container div for the PanZoom control.
_addButton_addButton:function( | id, | | img, | | xy, | | sz | ) |
|
ParametersReturns{DOMElement} A Div (an alphaImageDiv, to be precise) that contains the image of the button, and has all the proper event handlers set.
doubleClickdoubleClick: function ( | evt | ) |
|
ParametersReturns{Boolean}
buttonDownbuttonDown: function ( | evt | ) |
|
Parameters
OpenLayers. EventUtility functions for event handling. Summary | | | {Object} A hashtable cache of the event observers. | | | | | | | | | | | | | | | | | | | | | | | | Cross browser event element detection. | | Determine whether event was caused by a left click. | | Stops an event from propagating. | | | | | | Given the id of an element to stop observing, cycle through the element’s cached observers, calling stopObserving on each one, skipping those entries which can no longer be removed. | | | | | | Cycle through all the element entries in the events cache and call stopObservingElement on each. |
observers{Object} A hashtable cache of the event observers. Keyed by element._eventCacheID
elementCross browser event element detection. ParametersReturns{DOMElement} The element that caused the event
isLeftClickisLeftClick: function( | event | ) |
|
Determine whether event was caused by a left click. ParametersReturns{Boolean}
stopstop: function( | event, | | allowDefault | ) |
|
Stops an event from propagating. Parametersevent | {Event} | allowDefault | {Boolean} If true, we stop the event chain but still allow the default browser behaviour (text selection, radio-button clicking, etc) Default false |
findElementfindElement: function( | event, | | tagName | ) |
|
Parametersevent | {Event} | tagName | {String} |
Returns{DOMElement} The first node with the given tagName, starting from the node the event was triggered on and traversing the DOM upwards
observeobserve: function( | elementParam, | | name, | | observer, | | useCapture | ) |
|
ParameterselementParam | {DOMElement || String} | name | {String} | observer | {function} | useCapture | {Boolean} |
stopObservingElementstopObservingElement: function( | elementParam | ) |
|
Given the id of an element to stop observing, cycle through the element’s cached observers, calling stopObserving on each one, skipping those entries which can no longer be removed. parameterselementParam | {DOMElement || String} |
_removeElementObservers_removeElementObservers: function( | elementObservers | ) |
|
ParameterselementObservers | {Array(Object)} Array of (element, name, observer, usecapture) objects, taken directly from hashtable |
stopObservingstopObserving: function( | elementParam, | | name, | | observer, | | useCapture | ) |
|
ParameterselementParam | {DOMElement || String} | name | {String} | observer | {function} | useCapture | {Boolean} |
Returns{Boolean} Whether or not the event observer was removed
unloadCacheCycle through all the element entries in the events cache and call stopObservingElement on each.
OpenLayers. EventsSummary | | | {Array(String)} supported events | | | | {Object} Hashtable of Array(Function): events listener functions | | {Object} the code object issuing application events | | {DOMElement} the DOM element receiving browser events | | {Array(String)} list of support application events | | {Function} bound event handler attached to elements | | | | Construct an OpenLayers.Events object. | | | | Remove all listeners for a given event type. | | Basically just a wrapper to the triggerEvent() function, but takes care to set a property ‘xy’ on the event with the current mouse position. | | |
BROWSER_EVENTS{Array(String)} supported events
listeners{Object} Hashtable of Array(Function): events listener functions
object{Object} the code object issuing application events
element{DOMElement} the DOM element receiving browser events
eventTypes{Array(String)} list of support application events
eventHandler{Function} bound event handler attached to elements
OpenLayers. EventsConstruct an OpenLayers.Events object. Parametersobject | {Object} The js object to which this Events object is being | added element | {DOMElement} A dom element to respond to browser events | eventTypes | {Array(String)} Array of custom application events | fallThrough | {Boolean} Allow events to fall through after these have been handled? |
attachToElementattachToElement: function ( | element | ) |
|
Parameterselement | {HTMLDOMElement} a DOM element to attach browser events to |
removeRemove all listeners for a given event type. If type is not registered, does nothing. Parameters
handleBrowserEventhandleBrowserEvent: function ( | evt | ) |
|
Basically just a wrapper to the triggerEvent() function, but takes care to set a property ‘xy’ on the event with the current mouse position. Parameters
getMousePositiongetMousePosition: function ( | evt | ) |
|
ParametersReturns {OpenLayers.Pixel} The current xy coordinate of the mouse, adjusted for offsets
OpenLayers. ProjectionClass for coordinate transformations between coordinate systems. Depends on the proj4js library. If proj4js is not available, then this is just an empty stub. Summary | | | This class offers several methods for interacting with a wrapped pro4js projection object. |
OpenLayers. ProjectionThis class offers several methods for interacting with a wrapped pro4js projection object. Parametersoptions | {Object} An optional object with properties to set on the format |
ReturnsAn instance of OpenLayers.Projection
OpenLayers.TileThis is a class designed to designate a single tile, however it is explicitly designed to do relatively little. Tiles store information about themselves -- such as the URL that they are related to, and their size - but do not add themselves to the layer div automatically, for example. Create a new tile with the OpenLayers.Tile constructor, or a subclass. TBD 3.0 | remove reference to url in above paragraph |
Summary | | | {Array(String)} Supported application event types | | | | | | | | {String} url of the request. | | | | | | {Boolean} Is the tile loading? | | | | | | Clear whatever is currently in the tile, then return whether or not it should actually be re-drawn. | | | | Clear the tile of any bounds/position-related data so that it can be reused in a new location. | | Take the pixel locations of the corner of the tile, and pass them to the base layer and ask for the location of those pixels, so that displaying tiles over Google works fine. |
EVENT_TYPES{Array(String)} Supported application event types
url{String} url of the request. TBD 3.0 Deprecated. The base tile class does not need an url. This should be handled in subclasses. Does not belong here.
isLoading{Boolean} Is the tile loading?
drawClear whatever is currently in the tile, then return whether or not it should actually be re-drawn. Returns{Boolean} Whether or not the tile should actually be drawn. Note that this is not really the best way of doing things, but such is the way the code has been developed. Subclasses call this and depend on the return to know if they should draw or not.
moveTomoveTo: function ( | bounds, | | position, | | redraw | ) |
|
Reposition the tile. Parameters
clearClear the tile of any bounds/position-related data so that it can be reused in a new location. To be implemented by subclasses.
getBoundsFromBaseLayergetBoundsFromBaseLayer: function( | position | ) |
|
Take the pixel locations of the corner of the tile, and pass them to the base layer and ask for the location of those pixels, so that displaying tiles over Google works fine. ParametersReturns
OpenLayers. Control. OverviewMapCreate an overview map to display the extent of your main map and provide additional navigation control. Create a new overview map with the OpenLayers.Control.OverviewMap constructor. Inerits fromSummary | | | | | {DOMElement} The DOM element that contains the overview map | | | | Create a new overview map | | Render the control in the browser. | | | | | | | | | | | | | | | | | | Hide all the contents of the control, shrink the size, add the maximize icon | | Hide/Show the toggle depending on whether the control is minimized | | Update the overview map after layers move. | | Determines if the overview map is suitable given the extent and resolution of the main map. | | Construct the map that this control contains | | Updates the extent rectangle position and size to match the map extent | | Updates the map extent to match the extent rectangle position and size | | Get extent rectangle pixel bounds | | Set extent rectangle pixel bounds. | | Get the rect bounds from the map bounds. | | Get the map bounds from the rect bounds. | | Get a map location from a pixel location | | Get a pixel location from a map location |
element{DOMElement} The DOM element that contains the overview map
OpenLayers. Control. OverviewMapCreate a new overview map Parametersobject | {Object} Properties of this object will be set on the overview map object. Note, to set options on the map object contained in this control, set <mapOptions> as one of the options properties. |
drawRender the control in the browser.
baseLayerDrawbaseLayerDraw: function() |
Draw the base layer | called if unable to complete in the initial draw |
rectMouseOutrectMouseOut: function ( | evt | ) |
|
Handle browser events Parameters
rectMouseDownrectMouseDown: function ( | evt | ) |
|
Handle browser events Parameters
rectMouseMoverectMouseMove: function( | evt | ) |
|
Handle browser events Parameters
rectMouseUprectMouseUp: function( | evt | ) |
|
Handle browser events Parameters
rectDblClickrectDblClick: function( | evt | ) |
|
Handle browser events Parameters
mapDivClickmapDivClick: function( | evt | ) |
|
Handle browser events Parameters
maximizeControlmaximizeControl: function( | e | ) |
|
Unhide the control. Called when the control is in the map viewport. Parameters
minimizeControlminimizeControl: function( | e | ) |
|
Hide all the contents of the control, shrink the size, add the maximize icon Parameters
showToggleshowToggle: function( | minimize | ) |
|
Hide/Show the toggle depending on whether the control is minimized Parameters
updateUpdate the overview map after layers move.
isSuitableOverviewisSuitableOverview: function() |
Determines if the overview map is suitable given the extent and resolution of the main map.
createMapConstruct the map that this control contains
updateRectToMapupdateRectToMap: function() |
Updates the extent rectangle position and size to match the map extent
updateMapToRectupdateMapToRect: function() |
Updates the map extent to match the extent rectangle position and size
getRectPxBoundsgetRectPxBounds: function() |
Get extent rectangle pixel bounds Returns{OpenLayers.Bounds} A bounds which is the extent rectangle’s pixel bounds (relative to the parent element)
setRectPxBoundssetRectPxBounds: function( | pxBounds | ) |
|
Set extent rectangle pixel bounds. Parameters
getRectBoundsFromMapBoundsgetRectBoundsFromMapBounds: function( | lonLatBounds | ) |
|
Get the rect bounds from the map bounds. ParametersReturns{OpenLayers.Bounds}A bounds which is the passed-in map lon/lat extent translated into pixel bounds for the overview map
getMapBoundsFromRectBoundsgetMapBoundsFromRectBounds: function( | pxBounds | ) |
|
Get the map bounds from the rect bounds. ParametersReturns{OpenLayers.Bounds} Bounds which is the passed-in overview rect bounds translated into lon/lat bounds for the overview map
getLonLatFromOverviewPxgetLonLatFromOverviewPx: function( | overviewMapPx | ) |
|
Get a map location from a pixel location ParametersReturns{OpenLayers.LonLat} Location which is the passed-in overview map OpenLayers.Pixel, translated into lon/lat by the overview map
getOverviewPxFromLonLatgetOverviewPxFromLonLat: function( | lonlat | ) |
|
Get a pixel location from a map location ParametersReturns{OpenLayers.Pixel} Location which is the passed-in OpenLayers.LonLat, translated into overview map pixels
OpenLayers. HandlerBase class to construct a higher-level handler for event sequences. All handlers have activate and deactivate methods. In addition, they have methods named like browser events. When a handler is activated, any additional methods named like a browser event is registered as a listener for the corresponding event. When a handler is deactivated, those same methods are unregistered as event listeners. Handlers also typically have a callbacks object with keys named like the abstracted events or event sequences that they are in charge of handling. The controls that wrap handlers define the methods that correspond to these abstract events - so instead of listening for individual browser events, they only listen for the abstract events defined by the handler. Handlers are created by controls, which ultimately have the responsibility of making changes to the the state of the application. Handlers themselves may make temporary changes, but in general are expected to return the application in the same state that they found it. Summary | | | | | | | | | {Event} This property references the last event handled by the handler. | | | | | | | | Check the keyMask on the handler. | | Trigger the control’s named callback with the given arguments | | register an event on the map | | unregister an event from the map | | With each registered browser event, the handler sets its own evt property. | | | | | | If set as the <keyMask>, checkModifiers returns false if any key is down. | | If set as the <keyMask>, checkModifiers returns false if Shift is down. | | If set as the <keyMask>, checkModifiers returns false if Ctrl is down. | | |
evt{Event} This property references the last event handled by the handler. Note that this property is not part of the stable API. Use of the evt property should be restricted to controls in the library or other applications that are willing to update with changes to the OpenLayers code.
OpenLayers. HandlerConstruct a handler. Parameterscontrol | {OpenLayers.Control} The control that initialized this handler. The control is assumed to have a valid map property; that map is used in the handler’s own setMap method. | callbacks | {Object} An object whose properties correspond to abstracted events or sequences of browser events. The values for these properties are functions defined by the control that get called by the handler. | options | {Object} An optional object whose properties will be set on the handler. |
checkModifierscheckModifiers: function ( | evt | ) |
|
Check the keyMask on the handler. If no <keyMask> is set, this always returns true. If a <keyMask> is set and it matches the combination of keys down on an event, this returns true. Returns{Boolean} The keyMask matches the keys down on an event.
callbackcallback: function ( | name, | | args | ) |
|
Trigger the control’s named callback with the given arguments Parametersname | {String} The key for the callback that is one of the properties of the handler’s callbacks object. | args | {Array(*)} An array of arguments (any type) with which to call the callback (defined by the control). |
registerregister: function ( | name, | | method | ) |
|
register an event on the map
unregisterunregister: function ( | name, | | method | ) |
|
unregister an event from the map
setEventWith each registered browser event, the handler sets its own evt property. This property can be accessed by controls if needed to get more information about the event that the handler is processing. This allows modifier keys on the event to be checked (alt, shift, and ctrl cannot be checked with the keyboard handler). For a control to determine which modifier keys are associated with the event that a handler is currently processing, it should access (code)handler.evt.altKey || handler.evt.shiftKey || handler.evt.ctrlKey(end). Parametersevt | {Event} The browser event. |
OpenLayers. Handler. MOD_NONEIf set as the <keyMask>, checkModifiers returns false if any key is down.
OpenLayers. Handler. MOD_SHIFTIf set as the <keyMask>, checkModifiers returns false if Shift is down.
OpenLayers. Handler. MOD_CTRLIf set as the <keyMask>, checkModifiers returns false if Ctrl is down.
OpenLayers. Handler. MOD_ALTIf set as the <keyMask>, checkModifiers returns false if Alt is down.
OpenLayers.MapInstances of OpenLayers.Map are interactive maps embedded in a web page. Create a new map with the OpenLayers.Map constructor. On their own maps do not provide much functionality. To extend a map it’s necessary to add controls (OpenLayers.Control) and layers (OpenLayers.Layer) to the map. Summary | | | {Object} Base z-indexes for different classes of thing | | {Array(String)} supported application event types | | | | {String} Unique identifier for the map | | | | {HTMLDivElement} The element that represents the map viewport | | { OpenLayers.LonLat} The lonlat at which the later container was re-initialized (on-zoom) | | {HTMLDivElement} The element that contains the layers. | | | | | | {Array(<OpenLayers.Popup>)} List of popups associated with the map | | | | {Integer} The current zoom level of the map | | {String} Used to store a unique identifier that changes when the map view changes. | | | | Constructor for a new OpenLayers.Map instance. | | Function that is called to destroy the map on page unload. | | | | | | | | | | This function takes care to recenter the layerContainerDiv. | | | | | | | | {Integer} 256 Default tile width (unless otherwise specified) | | {Integer} 256 Default tile height (unless otherwise specified) |
Z_INDEX_BASE{Object} Base z-indexes for different classes of thing
EVENT_TYPES{Array(String)} supported application event types
id{String} Unique identifier for the map
viewPortDiv{HTMLDivElement} The element that represents the map viewport
layerContainerOrigin{OpenLayers.LonLat} The lonlat at which the later container was re-initialized (on-zoom)
layerContainerDiv{HTMLDivElement} The element that contains the layers.
popups{Array(<OpenLayers.Popup>)} List of popups associated with the map
zoom{Integer} The current zoom level of the map
viewRequestID{String} Used to store a unique identifier that changes when the map view changes. viewRequestID should be used when adding data asynchronously to the map: viewRequestID is incremented when you initiate your request (right now during changing of baselayers and changing of zooms). It is stored here in the map and also in the data that will be coming back asynchronously. Before displaying this data on request completion, we check that the viewRequestID of the data is still the same as that of the map. Fix for #480
OpenLayers.MapConstructor for a new OpenLayers.Map instance. Parametersdiv | {String} Id of an element in your page that will contain the map. | options | {Object} Optional object with properties to tag onto the map. |
Examples// create a map with default options in an element with the id "map1" var map = new OpenLayers.Map("map1");
// create a map with non-default options in an element with id "map2" var options = { maxExtent: new OpenLayers.Bounds(-200000, -200000, 200000, 200000), maxResolution: 156543, units: 'meters', projection: "EPSG:41001" }; var map = new OpenLayers.Map("map2", options);
unloadDestroyFunction that is called to destroy the map on page unload. stored here so that if map is manually destroyed, we can unregister this.
setLayerZIndexsetLayerZIndex: function ( | layer, | | zIdx | ) |
|
Parameters
addControlToMapaddControlToMap: function ( | control, | | px | ) |
|
Parameters
calculateBoundscalculateBounds: function( | center, | | resolution | ) |
|
Parameterscenter | {OpenLayers.LonLat} Default is this.getCenter() | resolution | {float} Default is this.getResolution() |
Returns{OpenLayers.Bounds} A bounds based on resolution, center, and current mapsize.
centerLayerContainercenterLayerContainer: function ( | lonlat | ) |
|
This function takes care to recenter the layerContainerDiv. Parameters
isValidZoomLevelisValidZoomLevel: function( | zoomLevel | ) |
|
ParametersReturns{Boolean} Whether or not the zoom level passed in is non-null and within the min/max range of zoom levels.
isValidLonLatisValidLonLat: function( | lonlat | ) |
|
ParametersReturns{Boolean} Whether or not the lonlat passed in is non-null and within the maxExtent bounds
TILE_WIDTH{Integer} 256 Default tile width (unless otherwise specified)
TILE_HEIGHT{Integer} 256 Default tile height (unless otherwise specified)
OpenLayers. MarkerInstances of OpenLayers.Marker are a combination of a OpenLayers.LonLat and an OpenLayers.Icon. Markers are generally added to a special layer called OpenLayers.Layer.Markers. Examplevar markers = new OpenLayers.Layer.Markers( "Markers" ); map.addLayer(markers);
var size = new OpenLayers.Size(10,17); var offset = new OpenLayers.Pixel(-(size.w/2), -size.h); var icon = new OpenLayers.Icon('http://boston.openguides.org/markers/AQUA.png',size,offset); markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,0),icon)); markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,0),icon.clone()));
Note that if you pass an icon into the Marker constructor, it will take that icon and use it. This means that you should not share icons between markers -- you use them once, but you should clone() for any additional markers using that same icon. Summary | | | | | | | | | | | | | | | Calls draw on the icon, and returns that output. | | Move the marker to the new location. | | {Boolean} Whether or not the marker is currently visible on screen. | | Englarges the markers icon by the specified ratio. | | Change the opacity of the marker by changin the opacity of its icon | | | | |
drawCalls draw on the icon, and returns that output. ParametersReturns{DOMElement} A new DOM Image with this marker’s icon set at the location passed-in
moveToMove the marker to the new location. Parameters
onScreenReturns{Boolean} Whether or not the marker is currently visible on screen.
inflateinflate: function( | inflate | ) |
|
Englarges the markers icon by the specified ratio. Parametersinflate | {float} the ratio to enlarge the marker by (passing 2 will double the size). |
setOpacitysetOpacity: function( | opacity | ) |
|
Change the opacity of the marker by changin the opacity of its icon Parametersopacity | {float} Specified as fraction (0.4, etc) |
displaydisplay: function( | display | ) |
|
Hide or show the icon
defaultIconOpenLayers.Marker.defaultIcon = function() |
Creates a default OpenLayers.Icon. Returns{OpenLayers.Icon} A default OpenLayers.Icon to use for a marker
OpenLayers. Tile. ImageInstances of OpenLayers.Tile.Image are used to manage the image tiles used by various layers. Create a new image tile with the OpenLayers.Tile.Image constructor. Inherits fromSummary | | | {String} The URL of the image being requested. | | {DOMElement} The div element which wraps the image. | | {DOMElement} The image element is appended to the frame. | | | | | | Check that a tile should be drawn, and draw it. | | Clear the tile of any bounds/position-related data so that it can be reused in a new location. | | Creates the imgDiv property on the tile. | | Make sure that the image that just loaded is the one this tile is meant to display, since panning/zooming might have changed the tile’s URL in the meantime. |
url{String} The URL of the image being requested. No default. Filled in by layer.getURL() function.
imgDiv{DOMElement} The div element which wraps the image.
frame{DOMElement} The image element is appended to the frame. Any gutter on the image will be hidden behind the frame.
drawCheck that a tile should be drawn, and draw it. Returns{Boolean} Always returns true.
clearClear the tile of any bounds/position-related data so that it can be reused in a new location.
initImgDivCreates the imgDiv property on the tile.
checkImgURLMake sure that the image that just loaded is the one this tile is meant to display, since panning/zooming might have changed the tile’s URL in the meantime. If the tile URL did change before the image loaded, set the imgDiv display to ‘none’, as either (a) it will be reset to visible when the new URL loads in the image, or (b) we don’t want to display this tile after all because its new bounds are outside our maxExtent. This function should no longer be neccesary with the improvements to Grid.js in OpenLayers 2.3. The lack of a good isEquivilantURL function caused problems in 2.2, but it’s possible that with the improved isEquivilant URL function, this might be neccesary at some point. See discussion in the thread at http://openlayers.org- /pipermail- /dev- /2007-January- /000205.html
OpenLayers. Handler. ClickA handler for mouse clicks. The intention of this handler is to give controls more flexibility with handling clicks. Browsers trigger click events twice for a double-click. In addition, the mousedown, mousemove, mouseup sequence fires a click event. With this handler, controls can decide whether to ignore clicks associated with a double click. By setting a <pixelTolerance>, controls can also ignore clicks that include a drag. Create a new instance with the OpenLayers.Handler.Click constructor. Inherits fromSummary | | | {Number} The id of the timeout waiting to clear the <delayedEvent>. | | | | | | Create a new click handler. | | | | | | | | Determine whether the event is within the optional pixel tolerance. | | Clear the timer and set timerId to null. | | |
timerId{Number} The id of the timeout waiting to clear the <delayedEvent>.
OpenLayers. Handler. ClickCreate a new click handler. Parameterscontrol | {OpenLayers.Control} The control that is making use of this handler. If a handler is being used without a control, the handler’s setMap method must be overridden to deal properly with the map. | callbacks | {Object} An object with keys corresponding to callbacks that will be called by the handler. The callbacks should expect to recieve a single argument, the click event. Callbacks for ‘click’ and ‘dblclick’ are supported. | options | {Object} Optional object whose properties will be set on the handler. |
mousedownHandle mousedown. Only registered as a listener if pixelTolerance is a non-zero value at construction. Returns{Boolean} Continue propagating this event.
dblclickHandle dblclick. For a dblclick, we get two clicks in some browsers (FF) and one in others (IE). So we need to always register for dblclick to properly handle single clicks. Returns{Boolean} Continue propagating this event.
clickHandle click. Returns{Boolean} Continue propagating this event.
passesTolerancepassesTolerance: function( | evt | ) |
|
Determine whether the event is within the optional pixel tolerance. Note that the pixel tolerance check only works if mousedown events get to the listeners registered here. If they are stopped by other elements, the <pixelTolerance> will have no effect here (this method will always return true). Returns{Boolean} The click is within the pixel tolerance (if specified).
clearTimerClear the timer and set timerId to null.
delayedCalldelayedCall: function( | evt | ) |
|
Sets timerId to null. And optionally triggers the click callback if evt is set.
OpenLayers. Handler.DragThe drag handler is used to deal with sequences of browser events related to dragging. The handler is used by controls that want to know when a drag sequence begins, when a drag is happening, and when it has finished. Controls that use the drag handler typically construct it with callbacks for ‘down’, ‘move’, and ‘done’. Callbacks for these keys are called when the drag begins, with each move, and when the drag is done. In addition, controls can have callbacks keyed to ‘up’ and ‘out’ if they care to differentiate between the types of events that correspond with the end of a drag sequence. Create a new drag handler with the OpenLayers.Handler.Drag constructor. Inherits fromSummary | | | {Boolean} When a mousedown event is received, we want to record it, but not set ‘dragging’ until the mouse moves after starting. | | | | | | | | | | | | Returns OpenLayers.Handler.Drag | | This method is called during the handling of the mouse down event. | | This method is called during the handling of the mouse move event. | | This method is called during the handling of the mouse up event. | | This method is called during the handling of the mouse out event. | | | | | | | | | | The drag handler captures the click event. | | | | |
started{Boolean} When a mousedown event is received, we want to record it, but not set ‘dragging’ until the mouse moves after starting.
OpenLayers. Handler.DragReturns OpenLayers.Handler.Drag Parameterscontrol | {OpenLayers.Control} The control that is making use of this handler. If a handler is being used without a control, the handlers setMap method must be overridden to deal properly with the map. | callbacks | {Object} An object containing a single function to be called when the drag operation is finished. The callback should expect to recieve a single argument, the pixel location of the event. Callbacks for ‘move’ and ‘done’ are supported. You can also speficy callbacks for ‘down’, ‘up’, and ‘out’ to respond to those events. | options | {Object} |
downThis method is called during the handling of the mouse down event. Subclasses can do their own processing here. Parametersevt | {Event} The mouse down event |
moveThis method is called during the handling of the mouse move event. Subclasses can do their own processing here. Parametersevt | {Event} The mouse move event |
upThis method is called during the handling of the mouse up event. Subclasses can do their own processing here. Parametersevt | {Event} The mouse up event |
outThis method is called during the handling of the mouse out event. Subclasses can do their own processing here. Parametersevt | {Event} The mouse out event |
mousedownmousedown: function ( | evt | ) |
|
Handle mousedown events ParametersReturns{Boolean} Let the event propagate.
mousemovemousemove: function ( | evt | ) |
|
Handle mousemove events ParametersReturns{Boolean} Let the event propagate.
mouseupHandle mouseup events ParametersReturns{Boolean} Let the event propagate.
mouseoutHandle mouseout events ParametersReturns{Boolean} Let the event propagate.
clickThe drag handler captures the click event. If something else registers for clicks on the same element, its listener will not be called after a drag. ParametersReturns{Boolean} Let the event propagate.
activateActivate the handler. Returns{Boolean} The handler was successfully activated.
deactivateDeactivate the handler. Returns{Boolean} The handler was successfully deactivated.
OpenLayers. Handler. MouseWheelHandler for wheel up/down events. Inherits fromSummary | | | | | { OpenLayers.Pixel} mousePosition is necessary because evt.clientX/Y is buggy in Moz on wheel events, so we cache and use the value from the last mousemove. | | | | | | | | Catch the wheel event and handle it xbrowserly | | Update the stored mousePosition on every move. | | | | |
mousePosition{OpenLayers.Pixel} mousePosition is necessary because evt.clientX/Y is buggy in Moz on wheel events, so we cache and use the value from the last mousemove.
OpenLayers. Handler. MouseWheelParameterscontrol | {OpenLayers.Control} | callbacks | {Object} An object containing a single function to be called when the drag operation is finished. The callback should expect to recieve a single argument, the point geometry. | options | {Object} |
onWheelEventonWheelEvent: function( | e | ) |
|
Catch the wheel event and handle it xbrowserly Parameters
mousemovemousemove: function ( | evt | ) |
|
Update the stored mousePosition on every move. Parametersevt | {Event} The browser event |
Returns{Boolean} Allow event propagation
deactivatedeactivate: function ( | evt | ) |
|
OpenLayers. LayerSummary | | | {Array(String)} Supported application event types | | | | {Boolean} The layer’s images have an alpha channel. | | {Boolean} The current map resolution is within the layer’s min/max range. | | { OpenLayers.Pixel} For layers with a gutter, the image offset represents displacement due to the gutter. | | {Object} An optional object whose properties will be set on the layer. | | | | | | Destroy is a destructor: this is to alleviate cyclic references which the Javascript garbage cleaner can not take care of on its own. | | | | | | Set the map property for the layer. | | {Boolean} The layer is displayable at the current map’s current resolution. | | This method’s responsibility is to set up the ‘resolutions’ array for the layer -- this array is what the layer will use to interface between the zoom levels of the map and the resolution display of the layer. | | Calculates the max extent which includes all of the data for the layer. | | | | This function will take a bounds, and if wrapDateLine option is set on the layer, it will return a bounds which is wrapped around the world. |
EVENT_TYPES{Array(String)} Supported application event types
alpha{Boolean} The layer’s images have an alpha channel. Default is false.
inRange{Boolean} The current map resolution is within the layer’s min/max range. This is set in <OpenLayers.Map.setCenter> whenever the zoom changes.
imageOffset{OpenLayers.Pixel} For layers with a gutter, the image offset represents displacement due to the gutter.
options{Object} An optional object whose properties will be set on the layer. Any of the layer properties can be set as a property of the options object and sent to the constructor when the layer is created.
OpenLayers. LayerParametersname | {String} The layer name | options | {Object} Hashtable of extra options to tag onto the layer |
destroydestroy: function( | setNewBaseLayer | ) |
|
Destroy is a destructor: this is to alleviate cyclic references which the Javascript garbage cleaner can not take care of on its own. ParameterssetNewBaseLayer | {Boolean} Set a new base layer when this layer has been destroyed. Default is true. |
moveTomoveTo:function( | bounds, | | zoomChanged, | | dragging | ) |
|
Parametersbound | {OpenLayers.Bounds} | zoomChanged | {Boolean} Tells when zoom has changed, as layers have to do some init work in that case. | dragging | {Boolean} |
setMapSet the map property for the layer. This is done through an accessor so that subclasses can override this and take special action once they have their map variable set. Here we take care to bring over any of the necessary default properties from the map. Parameters
calculateInRangecalculateInRange: function() |
Returns{Boolean} The layer is displayable at the current map’s current resolution.
initResolutionsinitResolutions: function() |
This method’s responsibility is to set up the ‘resolutions’ array for the layer -- this array is what the layer will use to interface between the zoom levels of the map and the resolution display of the layer. The user has several options that determine how the array is set up. For a detailed explanation, see the following wiki from the openlayers.org homepage: http://trac.openlayers.org/wiki/SettingZoomLevels
getDataExtentgetDataExtent: function () |
Calculates the max extent which includes all of the data for the layer. This function is to be implemented by subclasses. Returns{OpenLayers.Bounds}
setZIndexsetZIndex: function ( | zIndex | ) |
|
Parameters
adjustBoundsadjustBounds: function ( | bounds | ) |
|
This function will take a bounds, and if wrapDateLine option is set on the layer, it will return a bounds which is wrapped around the world. We do not wrap for bounds which cross the maxExtent.left/right, only bounds which are entirely to the left or entirely to the right. Parameters
OpenLayers. Marker.BoxInherits fromSummary | | | | | | | | | | | | | Allow the user to change the box’s color and border width | | | | {Boolean} Whether or not the marker is currently visible on screen. | | |
setBordersetBorder: function ( | color, | | width | ) |
|
Allow the user to change the box’s color and border width Parameterscolor | {String} Default is “red” | width | {int} Default is 2 |
drawParametersReturns{DOMElement} A new DOM Image with this marker´s icon set at the location passed-in
onScreenRreturn{Boolean} Whether or not the marker is currently visible on screen.
displaydisplay: function( | display | ) |
|
Hide or show the icon Parameters
OpenLayers. Control. DragPanDragPan control. Inherits fromSummary | | | {OpenLayers.Control.TYPES} | | | | | | Creates a Drag handler, using <OpenLayers.Control.PanMap.panMap> and <OpenLayers.Control.PanMap.panMapDone> as callbacks. | | | | Finish the panning operation. |
type{OpenLayers.Control.TYPES}
drawCreates a Drag handler, using <OpenLayers.Control.PanMap.panMap> and <OpenLayers.Control.PanMap.panMapDone> as callbacks.
panMapDoneFinish the panning operation. Only call setCenter (through panMap) if the map has actually been moved. Parameters
OpenLayers. Handler.BoxHandler for dragging a rectangle across the map. Box is displayed on mouse down, moves on mouse move, and is finished on mouse up. Inherits fromSummary | | | | | | | | | | | | | | | | | Remove the zoombox from the screen and nullify our reference to it. | | | | |
OpenLayers. Handler.BoxParameterscontrol | {OpenLayers.Control} | callbacks | {Object} An object containing a single function to be called when the drag operation is finished. The callback should expect to recieve a single argument, the point geometry. | options | {Object} |
removeBoxRemove the zoombox from the screen and nullify our reference to it.
OpenLayers. Layer. HTTPRequestInherits fromSummary | | | {Float} Used to hash URL param strings for multi-WMS server selection. | | | | {Array(String) or String} This is either an array of url strings or a single url string. | | {Object} Hashtable of key/value parameters | | | | | | selectUrl() implements the standard floating-point multiplicative hash function described by Knuth, and hashes the contents of the given param string into a float between 0 and 1. | | Combine url with layer’s params and these newParams. |
URL_HASH_FACTOR{Float} Used to hash URL param strings for multi-WMS server selection. Set to the Golden Ratio per Knuth’s recommendation.
url{Array(String) or String} This is either an array of url strings or a single url string.
params{Object} Hashtable of key/value parameters
OpenLayers. Layer. HTTPRequestParametersname | {String} | url | {Array(String) or String} | params | {Object} | options | {Object} Hashtable of extra options to tag onto the layer |
selectUrlselectUrl: function( | paramString, | | urls | ) |
|
selectUrl() implements the standard floating-point multiplicative hash function described by Knuth, and hashes the contents of the given param string into a float between 0 and 1. This float is then scaled to the size of the provided urls array, and used to select a URL. ParametersparamString | {String} | urls | {Array(String)} |
Returns{String} An entry from the urls array, deterministically selected based on the paramString.
getFullRequestStringgetFullRequestString:function( | newParams, | | altUrl | ) |
|
Combine url with layer’s params and these newParams. does checking on the serverPath variable, allowing for cases when it is supplied with trailing ? or &, as well as cases where not. return in formatted string like this”server?key1=value1&key2=value2&key3=value3” WARNING: The altUrl parameter is deprecated and will be removed in 3.0. ParametersnewParams | {Object} | altUrl | {String} Use this as the url instead of the layer’s url |
Returns{String}
OpenLayers. Layer. MarkersInherits fromSummary | | | | | {Boolean} internal state of drawing. | | | | | | | | This method removes all markers from a layer. | | Calculate the pixel location for the marker, create it, and add it to the layer’s div |
drawn{Boolean} internal state of drawing. This is a workaround for the fact that the map does not call moveTo with a zoomChanged when the map is first starting up. This lets us catch the case where we have never drawn the layer, and draw it even if the zoom hasn’t changed.
OpenLayers. Layer. MarkersCreate a Markers layer. Parametersname | {String} | options | {Object} Hashtable of extra options to tag onto the layer |
moveTomoveTo:function( | bounds, | | zoomChanged, | | dragging | ) |
|
Parameters
clearMarkersThis method removes all markers from a layer. The markers are not destroyed by this function, but are removed from the list of markers.
drawMarkerdrawMarker: function( | marker | ) |
|
Calculate the pixel location for the marker, create it, and add it to the layer’s div Parameters
OpenLayers. Control. ZoomBoxInherits fromSummary | | | {OpenLayers.Control.TYPE} | | | | | | |
type{OpenLayers.Control.TYPE}
zoomBoxzoomBox: function ( | position | ) |
|
Parameters
OpenLayers. Layer.GridBase class for layers that use a lattice of tiles. Create a new grid layer with the OpenLayers.Layer.Grid constructor. Inherits fromSummary | | | {Array(Array( OpenLayers.Tile))} This is an array of rows, each row is an array of tiles. | | | | | | Go through and remove all tiles from the grid, calling destroy() on each of them to kill circular references | | This function is called whenever the map is moved. | | | | | | | | Starts at the top right corner of the grid and proceeds in a spiral towards the center, adding tiles one at a time to the beginning of a queue. | | This function takes a tile as input and adds the appropriate hooks to the tile so that the layer can keep track of the loading tiles. | | This function takes a tile as input and removes the tile hooks that were added in addTileMonitoringHooks() | | | | | | Shift grid work in the other dimension | | When the size of the map or the buffer changes, we may need to remove some excess rows and columns. | | For singleTile layers, this will replace the tile with the a new one with updated tileSize and extent. |
grid{Array(Array(OpenLayers.Tile))} This is an array of rows, each row is an array of tiles.
OpenLayers. Layer.GridCreate a new grid layer Parametersname | {String} | url | {String} | params | {Object} | options | {Object} Hashtable of extra options to tag onto the layer |
clearGridGo through and remove all tiles from the grid, calling destroy() on each of them to kill circular references
moveTomoveTo:function( | bounds, | | zoomChanged, | | dragging | ) |
|
This function is called whenever the map is moved. All the moving of actual ‘tiles’ is done by the map, but moveTo’s role is to accept a bounds and make sure the data that that bounds requires is pre-loaded. Parameters
getGridBoundsgetGridBounds: function() |
Deprecated. This function will be removed in 3.0. Please use getTilesBounds() instead. Returns{OpenLayers.Bounds} A Bounds object representing the bounds of all the currently loaded tiles (including those partially or not at all seen onscreen)
initSingleTileinitSingleTile: function( | bounds | ) |
|
Parameters
initGriddedTilesinitGriddedTiles:function( | bounds | ) |
|
Parameters
spiralTileLoadspiralTileLoad: function() |
Starts at the top right corner of the grid and proceeds in a spiral towards the center, adding tiles one at a time to the beginning of a queue. Once all the grid’s tiles have been added to the queue, we go back and iterate through the queue (thus reversing the spiral order from outside-in to inside-out), calling draw() on each tile.
addTileMonitoringHooksaddTileMonitoringHooks: function( | tile | ) |
|
This function takes a tile as input and adds the appropriate hooks to the tile so that the layer can keep track of the loading tiles. Parameters
removeTileMonitoringHooksremoveTileMonitoringHooks: function( | tile | ) |
|
This function takes a tile as input and removes the tile hooks that were added in addTileMonitoringHooks() Parameters
moveGriddedTilesmoveGriddedTiles: function( | bounds | ) |
|
Parameters
shiftRowshiftRow:function( | prepend | ) |
|
Shifty grid work Parametersprepend | {Boolean} if true, prepend to beginning. if false, then append to end |
shiftColumnshiftColumn: function( | prepend | ) |
|
Shift grid work in the other dimension Parametersprepend | {Boolean} if true, prepend to beginning. if false, then append to end |
removeExcessTilesremoveExcessTiles: function( | rows, | | columns | ) |
|
When the size of the map or the buffer changes, we may need to remove some excess rows and columns. Parametersrows | {Integer} Maximum number of rows we want our grid to have. | colums | {Integer} Maximum number of columns we want our grid to have. |
onMapResizeFor singleTile layers, this will replace the tile with the a new one with updated tileSize and extent.
OpenLayers. Control. NavigationThe navigation control handles map browsing with mouse events (dragging, double-clicking, and scrolling the wheel). Create a new navigation control with the OpenLayers.Control.Navigation control. Note that this control is added to the map by default (if no controls array is sent in the options object to the OpenLayers.Map constructor). InheritsSummary | | | | | | | | | | | Create a new navigation control | | | | | | | | | | | | User spun scroll wheel up | | User spun scroll wheel down |
OpenLayers. Control. NavigationCreate a new navigation control Parametersoptions | {Object} An optional object whose properties will be set on the control |
defaultDblClickdefaultDblClick: function ( | evt | ) |
|
Parameters
wheelChangewheelChange: function( | evt, | | deltaZ | ) |
|
Parameters
wheelUpUser spun scroll wheel up Parameters
wheelDownUser spun scroll wheel down Parameters
OpenLayers. Layer. MapGuideInstances of OpenLayers.Layer.MapGuide are used to display data from a MapGuide OS instance. Inherits fromSummary | | | {Object} Hashtable of default parameter key/value pairs | | | | |
DEFAULT_PARAMS{Object} Hashtable of default parameter key/value pairs
initGriddedTilesinitGriddedTiles:function( | bounds | ) |
|
Parameters
OpenLayers. Layer. MapServerInstances of OpenLayers.Layer.MapServer are used to display data from a MapServer CGI instance. Inherits fromSummary | | | {Object} Hashtable of default parameter key/value pairs | | | | Create a new MapServer layer object | | Create a clone of this layer | | Creates a tile, initializes it, and adds it to the layer div. | | Return a query string for this layer | | combine the layer’s url with its params and these newParams. |
DEFAULT_PARAMS{Object} Hashtable of default parameter key/value pairs
OpenLayers. Layer. MapServerCreate a new MapServer layer object Parametersname | {String} A name for the layer | url | {String} Base url for the MapServer CGI (e.g. http://www2.dmsolutions.ca/cgi-bin/mapserv) | params | {Object} An object with key/value pairs representing the GetMap query string parameters and parameter values. | options | {Ojbect} Hashtable of extra options to tag onto the layer |
addTileaddTile:function( | bounds, | | position | ) |
|
Creates a tile, initializes it, and adds it to the layer div. ParametersReturns{OpenLayers.Tile.Image} The added OpenLayers.Tile.Image
getURLgetURL: function ( | bounds | ) |
|
Return a query string for this layer ParametersReturns{String} A string with the layer’s url and parameters and also the passed-in bounds and appropriate tile size specified as parameters.
getFullRequestStringgetFullRequestString:function( | newParams, | | altUrl | ) |
|
combine the layer’s url with its params and these newParams. ParameternewParams | {Object} New parameters that should be added to the request string. | altUrl | {String} (optional) Replace the URL in the full request string with the provided URL. |
Returns{String} A string with the layer’s url and parameters embedded in it.
OpenLayers. Layer.WMSInstances of OpenLayers.Layer.WMS are used to display data from OGC Web Mapping Services. Create a new WMS layer with the OpenLayers.Layer.WMS constructor. Inherits fromSummary | | | {Object} Hashtable of default parameter key/value pairs | | | | | | | | Create a new WMS layer object | | | | Create a clone of this layer | | Return a GetMap query string for this layer | | addTile creates a tile, initializes it, and adds it to the layer div. | | Combine the layer’s url with its params and these newParams. |
DEFAULT_PARAMS{Object} Hashtable of default parameter key/value pairs
reprojectDeprecated. See http://trac.openlayers.org/wiki/SpatialMercator for information on the replacement for this functionality. {Boolean} Try to reproject this layer if its coordinate reference system is different than that of the base layer. Default is true. Set this in the layer options. Should be set to false in most cases.
OpenLayers. Layer.WMSCreate a new WMS layer object Examplevar wms = new OpenLayers.Layer.WMS("NASA Global Mosaic", "http://wms.jpl.nasa.gov/wms.cgi", {layers: "modis,global_mosaic"});
Parametersname | {String} A name for the layer | url | {String} Base url for the WMS (e.g. http://wms.jpl.nasa.gov/wms.cgi) | params | {Object} An object with key/value pairs representing the GetMap query string parameters and parameter values. | options | {Ojbect} Hashtable of extra options to tag onto the layer |
getURLgetURL: function ( | bounds | ) |
|
Return a GetMap query string for this layer ParametersReturns{String} A string with the layer’s url and parameters and also the passed-in bounds and appropriate tile size specified as parameters.
addTileaddTile:function( | bounds, | | position | ) |
|
addTile creates a tile, initializes it, and adds it to the layer div. ParametersReturns{OpenLayers.Tile.Image} The added OpenLayers.Tile.Image
getFullRequestStringgetFullRequestString:function( | newParams | ) |
|
Combine the layer’s url with its params and these newParams. Add the SRS parameter from projection -- this is probably more eloquently done via a setProjection() method, but this works for now and always. ParametersReturns{String}
|