Index: OpenLayers.js
===================================================================
--- OpenLayers.js (revision 2133)
+++ OpenLayers.js (working copy)
@@ -23,23 +23,23 @@
*
*--------------------------------------------------------------------------*/
-/**
-*
+/**
+*
* Contains portions of Rico
-*
-* Copyright 2005 Sabre Airline Solutions
-*
+*
+* Copyright 2005 Sabre Airline Solutions
+*
* Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License. You
* may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
-* permissions and limitations under the License.
+* permissions and limitations under the License.
*
**/
@@ -111,11 +111,11 @@
* license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the
* full text of the license. */
-/*
+/*
* @requires OpenLayers/BaseTypes.js
* @requires OpenLayers/Lang/en.js
* @requires OpenLayers/Console.js
- */
+ */
(function() {
/**
@@ -125,13 +125,13 @@
* case with single file builds.
*/
var singleFile = (typeof OpenLayers == "object" && OpenLayers.singleFile);
-
+
/**
* Namespace: OpenLayers
* The OpenLayers object provides a namespace for all things OpenLayers
*/
window.OpenLayers = {
-
+
/**
* Property: _scriptName
* {String} Relative path of this script.
@@ -146,9 +146,9 @@
* {String} Path to this script
*/
_getScriptLocation: function () {
- var scriptLocation = "";
+ var scriptLocation = "";
var isOL = new RegExp("(^|(.*?\\/))(" + OpenLayers._scriptName + ")(\\?|$)");
-
+
var scripts = document.getElementsByTagName('script');
for (var i=0, len=scripts.length; i";
+ "'>";
} else {
var s = document.createElement("script");
s.src = host + jsfiles[i];
- var h = document.getElementsByTagName("head").length ?
- document.getElementsByTagName("head")[0] :
+ var h = document.getElementsByTagName("head").length ?
+ document.getElementsByTagName("head")[0] :
document.body;
h.appendChild(s);
}
@@ -423,7 +423,7 @@
*/
OpenLayers.Util = {};
-/**
+/**
* Function: getElement
* This is the old $() from prototype
*/
@@ -443,7 +443,7 @@
return elements;
};
-/**
+/**
* Maintain existing definition of $.
*/
if(typeof window.$ === "undefined") {
@@ -497,7 +497,7 @@
};
-/**
+/**
* Function: removeItem
* Remove an object from an array. Iterates through the array
* to find the item, then removes it.
@@ -505,7 +505,7 @@
* Parameters:
* array - {Array}
* item - {Object}
- *
+ *
* Return
* {Array} A reference to the array
*/
@@ -523,7 +523,7 @@
* Function: clearArray
* *Deprecated*. This function will disappear in 3.0.
* Please use "array.length = 0" instead.
- *
+ *
* Parameters:
* array - {Array}
*/
@@ -536,14 +536,14 @@
array.length = 0;
};
-/**
+/**
* Function: indexOf
* Seems to exist already in FF, but not in MOZ.
- *
+ *
* Parameters:
* array - {Array}
* obj - {Object}
- *
+ *
* Returns:
* {Integer} The index at, which the object was found in the array.
* If not found, returns -1.
@@ -555,29 +555,29 @@
return i;
}
}
- return -1;
+ return -1;
};
/**
* Function: modifyDOMElement
- *
- * Modifies many properties of a DOM element all at once. Passing in
+ *
+ * Modifies many properties of a DOM element all at once. Passing in
* null to an individual parameter will avoid setting the attribute.
*
* Parameters:
* id - {String} The element id attribute to set.
* px - {} The left and top style position.
* sz - {} The width and height style attributes.
- * position - {String} The position attribute. eg: absolute,
+ * 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.
+ * overflow - {String} The style.overview attribute.
* opacity - {Float} Fractional value (0.0 - 1.0)
*/
-OpenLayers.Util.modifyDOMElement = function(element, id, px, sz, position,
+OpenLayers.Util.modifyDOMElement = function(element, id, px, sz, position,
border, overflow, opacity) {
if (id) {
@@ -609,32 +609,32 @@
}
};
-/**
+/**
* Function: createDiv
* Creates 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.
* Note - zIndex is NOT set on the resulting div.
- *
+ *
* Parameters:
* id - {String} An identifier for this element. If no id is
- * passed an identifier will be created
+ * passed an identifier will be created
* automatically.
- * px - {} The element left and top position.
+ * px - {} The element left and top position.
* sz - {} The element width and height.
- * imgURL - {String} A url pointing to an image to use as a
+ * 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.
+ * 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:
+ *
+ * Returns:
* {DOMElement} A DOM Div created with the specified attributes.
*/
-OpenLayers.Util.createDiv = function(id, px, sz, imgURL, position,
+OpenLayers.Util.createDiv = function(id, px, sz, imgURL, position,
border, overflow, opacity) {
var dom = document.createElement('div');
@@ -650,7 +650,7 @@
if (!position) {
position = "absolute";
}
- OpenLayers.Util.modifyDOMElement(dom, id, px, sz, position,
+ OpenLayers.Util.modifyDOMElement(dom, id, px, sz, position,
border, overflow, opacity);
return dom;
@@ -659,7 +659,7 @@
/**
* Function: createImage
* Creates an img element with specific attribute values.
- *
+ *
* Parameters:
* id - {String} The id field for the img. If none assigned one will be
* automatically generated.
@@ -671,7 +671,7 @@
* opacity - {Float} Fractional value (0.0 - 1.0)
* delayDisplay - {Boolean} If true waits until the image has been
* loaded.
- *
+ *
* Returns:
* {DOMElement} A DOM Image created with the specified attributes.
*/
@@ -687,18 +687,18 @@
if (!position) {
position = "relative";
}
- OpenLayers.Util.modifyDOMElement(image, id, px, sz, position,
+ OpenLayers.Util.modifyDOMElement(image, id, px, sz, position,
border, null, opacity);
if(delayDisplay) {
image.style.display = "none";
- OpenLayers.Event.observe(image, "load",
+ OpenLayers.Event.observe(image, "load",
OpenLayers.Function.bind(OpenLayers.Util.onImageLoad, image));
- OpenLayers.Event.observe(image, "error",
+ OpenLayers.Event.observe(image, "error",
OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError, image));
-
+
}
-
+
//set special properties
image.style.alt = id;
image.galleryImg = "no";
@@ -707,17 +707,17 @@
}
-
+
return image;
};
/**
* Function: setOpacity
- * *Deprecated*. This function has been deprecated. Instead, please use
- *
- * or
+ * *Deprecated*. This function has been deprecated. Instead, please use
+ *
+ * or
*
- *
+ *
* Set the opacity of a DOM Element
* Note that for this function to work in IE, elements must "have layout"
* according to:
@@ -739,23 +739,23 @@
*/
OpenLayers.Util.onImageLoad = function() {
// The complex check here is to solve issues described in #480.
- // Every time a map view changes, it increments the 'viewRequestID'
+ // Every time a map view changes, it increments the 'viewRequestID'
// property. As the requests for the images for the new map view are sent
- // out, they are tagged with this unique viewRequestID.
- //
- // If an image has no viewRequestID property set, we display it regardless,
- // but if it does have a viewRequestID property, we check that it matches
+ // out, they are tagged with this unique viewRequestID.
+ //
+ // If an image has no viewRequestID property set, we display it regardless,
+ // but if it does have a viewRequestID property, we check that it matches
// the viewRequestID set on the map.
- //
+ //
// If the viewRequestID on the map has changed, that means that the user
// has changed the map view since this specific request was sent out, and
// therefore this tile does not need to be displayed (so we do not execute
// this code that turns its display on).
//
if (!this.viewRequestID ||
- (this.map && this.viewRequestID == this.map.viewRequestID)) {
+ (this.map && this.viewRequestID == this.map.viewRequestID)) {
this.style.backgroundColor ="transparent";
- this.style.display = "";
+ this.style.display = "";
}
};
@@ -774,7 +774,7 @@
OpenLayers.IMAGE_RELOAD_ATTEMPTS = 0;
/**
- * Function: onImageLoadError
+ * Function: onImageLoadError
*/
OpenLayers.Util.onImageLoadError = function() {
this._attempts = (this._attempts) ? (this._attempts + 1) : 1;
@@ -816,7 +816,7 @@
* 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 the png alpha hack is necessary and possible, false otherwise.
*/
@@ -825,25 +825,25 @@
var arVersion = navigator.appVersion.split("MSIE");
var version = parseFloat(arVersion[1]);
var filter = false;
-
- // IEs4Lin dies when trying to access document.body.filters, because
+
+ // IEs4Lin dies when trying to access document.body.filters, because
// the property is there, but requires a DLL that can't be provided. This
// means that we need to wrap this in a try/catch so that this can
// continue.
-
- try {
+
+ try {
filter = !!(document.body.filters);
- } catch (e) {}
-
- OpenLayers.Util.alphaHackNeeded = (filter &&
+ } catch (e) {}
+
+ OpenLayers.Util.alphaHackNeeded = (filter &&
(version >= 5.5) && (version < 7));
}
return OpenLayers.Util.alphaHackNeeded;
};
-/**
+/**
* Function: modifyAlphaImageDiv
- *
+ *
* div - {DOMElement} Div containing Alpha-adjusted Image
* id - {String}
* px - {}
@@ -853,9 +853,9 @@
* border - {String}
* sizing {String} 'crop', 'scale', or 'image'. Default is "scale"
* opacity - {Float} Fractional value (0.0 - 1.0)
- */
-OpenLayers.Util.modifyAlphaImageDiv = function(div, id, px, sz, imgURL,
- position, border, sizing,
+ */
+OpenLayers.Util.modifyAlphaImageDiv = function(div, id, px, sz, imgURL,
+ position, border, sizing,
opacity) {
OpenLayers.Util.modifyDOMElement(div, id, px, sz, position,
@@ -866,9 +866,9 @@
if (imgURL) {
img.src = imgURL;
}
- OpenLayers.Util.modifyDOMElement(img, div.id + "_innerImage", null, sz,
+ OpenLayers.Util.modifyDOMElement(img, div.id + "_innerImage", null, sz,
"relative", border);
-
+
if (OpenLayers.Util.alphaHack()) {
if(div.style.display != "none") {
div.style.display = "inline-block";
@@ -876,11 +876,11 @@
if (sizing == null) {
sizing = "scale";
}
-
+
div.style.filter = "progid:DXImageTransform.Microsoft" +
".AlphaImageLoader(src='" + img.src + "', " +
"sizingMethod='" + sizing + "')";
- if (parseFloat(div.style.opacity) >= 0.0 &&
+ if (parseFloat(div.style.opacity) >= 0.0 &&
parseFloat(div.style.opacity) < 1.0) {
div.style.filter += " alpha(opacity=" + div.style.opacity * 100 + ")";
}
@@ -889,9 +889,9 @@
}
};
-/**
+/**
* Function: createAlphaImageDiv
- *
+ *
* id - {String}
* px - {}
* sz - {}
@@ -902,17 +902,17 @@
* opacity - {Float} Fractional value (0.0 - 1.0)
* delayDisplay - {Boolean} If true waits until the image has been
* loaded.
- *
+ *
* Returns:
- * {DOMElement} A DOM Div created with a DOM Image inside it. If the hack is
+ * {DOMElement} A DOM Div created with a DOM Image inside it. If the hack is
* needed for transparency in IE, it is added.
- */
-OpenLayers.Util.createAlphaImageDiv = function(id, px, sz, imgURL,
- position, border, sizing,
+ */
+OpenLayers.Util.createAlphaImageDiv = function(id, px, sz, imgURL,
+ position, border, sizing,
opacity, delayDisplay) {
-
+
var div = OpenLayers.Util.createDiv();
- var img = OpenLayers.Util.createImage(null, null, null, null, null, null,
+ var img = OpenLayers.Util.createImage(null, null, null, null, null, null,
null, false);
div.appendChild(img);
@@ -924,23 +924,23 @@
OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError, div));
}
- OpenLayers.Util.modifyAlphaImageDiv(div, id, px, sz, imgURL, position,
+ OpenLayers.Util.modifyAlphaImageDiv(div, id, px, sz, imgURL, position,
border, sizing, opacity);
-
+
return div;
};
-/**
+/**
* Function: upperCaseObject
- * Creates a new hashtable and copies over all the keys from the
+ * 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.
- *
- * Parameters:
+ *
+ * Parameters:
* object - {Object}
- *
- * Returns:
+ *
+ * Returns:
* {Object} A new Object with all the same keys but uppercased
*/
OpenLayers.Util.upperCaseObject = function (object) {
@@ -951,12 +951,12 @@
return uObject;
};
-/**
+/**
* Function: applyDefaults
* Takes an object and copies any properties that don't exist from
* another properties, by analogy with OpenLayers.Util.extend() from
* Prototype.js.
- *
+ *
* Parameters:
* to - {Object} The destination object.
* from - {Object} The source object. Any properties of this object that
@@ -992,27 +992,27 @@
&& from.hasOwnProperty('toString') && !to.hasOwnProperty('toString')) {
to.toString = from.toString;
}
-
+
return to;
};
/**
* Function: getParameterString
- *
+ *
* Parameters:
* params - {Object}
- *
+ *
* Returns:
- * {String} A concatenation of the properties of an object in
- * http parameter notation.
+ * {String} A concatenation of the properties of an object in
+ * http parameter notation.
* (ex. "key1=value1&key2=value2&key3=value3")
* 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).
+ * of being URL escaped (foo%3Abar).
*/
OpenLayers.Util.getParameterString = function(params) {
var paramsArray = [];
-
+
for (var key in params) {
var value = params[key];
if ((value != null) && (typeof value != 'function')) {
@@ -1032,7 +1032,7 @@
paramsArray.push(encodeURIComponent(key) + "=" + encodedValue);
}
}
-
+
return paramsArray.join("&");
};
@@ -1042,9 +1042,9 @@
*/
OpenLayers.ImgPath = '';
-/**
+/**
* Function: getImagesLocation
- *
+ *
* Returns:
* {String} The fully formatted image location string
*/
@@ -1053,18 +1053,18 @@
};
-/**
+/**
* Function: Try
- * Execute functions until one of them doesn't throw an error.
+ * 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.
+ * 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.
*/
@@ -1083,15 +1083,15 @@
};
-/**
+/**
* Function: getNodes
- *
+ *
* These could/should be made namespace aware?
- *
+ *
* Parameters:
* p - {}
* tagName - {String}
- *
+ *
* Returns:
* {Array}
*/
@@ -1110,11 +1110,11 @@
/**
* Function: _getNodes
- *
+ *
* Parameters:
* nodes - {Array}
* tagName - {String}
- *
+ *
* Returns:
* {Array}
*/
@@ -1133,12 +1133,12 @@
/**
* Function: getTagText
- *
+ *
* Parameters:
* parent - {}
* item - {String}
* index - {Integer}
- *
+ *
* Returns:
* {String}
*/
@@ -1150,28 +1150,28 @@
index=0;
}
if (result[index].childNodes.length > 1) {
- return result.childNodes[1].nodeValue;
+ return result.childNodes[1].nodeValue;
}
else if (result[index].childNodes.length == 1) {
- return result[index].firstChild.nodeValue;
+ return result[index].firstChild.nodeValue;
}
- } else {
- return "";
+ } else {
+ return "";
}
};
/**
* Function: getXmlNodeValue
- *
+ *
* Parameters:
* node - {XMLNode}
- *
+ *
* Returns:
* {String} The text value of the given node, without breaking in firefox or IE
*/
OpenLayers.Util.getXmlNodeValue = function(node) {
var val = null;
- OpenLayers.Util.Try(
+ OpenLayers.Util.Try(
function() {
val = node.text;
if (!val) {
@@ -1180,20 +1180,20 @@
if (!val) {
val = node.firstChild.nodeValue;
}
- },
+ },
function() {
val = node.textContent;
- });
+ });
return val;
};
-/**
+/**
* Function: mouseLeft
- *
+ *
* Parameters:
* evt - {Event}
* div - {HTMLDivElement}
- *
+ *
* Returns:
* {Boolean}
*/
@@ -1255,10 +1255,10 @@
/**
* Function: rad
- *
+ *
* Parameters:
* x - {Float}
- *
+ *
* Returns:
* {Float}
*/
@@ -1269,11 +1269,11 @@
* Given two objects representing points with geographic coordinates, this
* calculates the distance between those points on the surface of an
* ellipsoid.
- *
+ *
* Parameters:
* p1 - {} (or any object with both .lat, .lon properties)
* p2 - {} (or any object with both .lat, .lon properties)
- *
+ *
* Returns:
* {Float} The distance (in km) between the two input points as measured on an
* ellipsoid. Note that the input point objects must be in geographic
@@ -1320,14 +1320,14 @@
/**
* Function: getParameters
- * Parse the parameters from a URL or from the current page itself into a
+ * 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.
- *
+ *
* Parameters:
* url - {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.
*/
@@ -1343,7 +1343,7 @@
url.indexOf('#') : url.length;
paramsString = url.substring(start, end);
}
-
+
var parameters = {};
var pairs = paramsString.split(/[&;]/);
for(var i=0, len=pairs.length; i
- *
+ *
* Parameters:
* url - {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.
*/
@@ -1402,10 +1402,10 @@
* Create a unique identifier for this session. Each time this function
* is called, a counter is incremented. The return will be the optional
* prefix (defaults to "id_") appended with the counter value.
- *
+ *
* Parameters:
* prefix {String} Optionsal string to prefix unique id. Default is "id_".
- *
+ *
* Returns:
* {String} A unique id string, built on the passed in prefix.
*/
@@ -1413,8 +1413,8 @@
if (prefix == null) {
prefix = "id_";
}
- OpenLayers.Util.lastSeqID += 1;
- return prefix + OpenLayers.Util.lastSeqID;
+ OpenLayers.Util.lastSeqID += 1;
+ return prefix + OpenLayers.Util.lastSeqID;
};
/**
@@ -1426,7 +1426,7 @@
* The hardcoded table is maintain in a CS-MAP source code module named CSdataU.c
* The hardcoded table of PROJ.4 units are in pj_units.c.
*/
-OpenLayers.INCHES_PER_UNIT = {
+OpenLayers.INCHES_PER_UNIT = {
'inches': 1.0,
'ft': 12.0,
'mi': 63360.0,
@@ -1512,8 +1512,8 @@
"ch": OpenLayers.INCHES_PER_UNIT["IntnlChain"], //International Chain
"link": OpenLayers.INCHES_PER_UNIT["IntnlLink"], //International Link
"us-in": OpenLayers.INCHES_PER_UNIT["inches"], //U.S. Surveyor's Inch
- "us-ft": OpenLayers.INCHES_PER_UNIT["Foot"], //U.S. Surveyor's Foot
- "us-yd": OpenLayers.INCHES_PER_UNIT["Yard"], //U.S. Surveyor's Yard
+ "us-ft": OpenLayers.INCHES_PER_UNIT["Foot"], //U.S. Surveyor's Foot
+ "us-yd": OpenLayers.INCHES_PER_UNIT["Yard"], //U.S. Surveyor's Yard
"us-ch": OpenLayers.INCHES_PER_UNIT["GunterChain"], //U.S. Surveyor's Chain
"us-mi": OpenLayers.INCHES_PER_UNIT["Mile"], //U.S. Surveyor's Statute Mile
"ind-yd": OpenLayers.INCHES_PER_UNIT["IndianYd37"], //Indian Yard
@@ -1521,7 +1521,7 @@
"ind-ch": 20.11669506 / OpenLayers.METERS_PER_INCH //Indian Chain
});
-/**
+/**
* Constant: DOTS_PER_INCH
* {Integer} 72 (A sensible default)
*/
@@ -1529,32 +1529,32 @@
/**
* Function: normalizeScale
- *
+ *
* Parameters:
* scale - {float}
- *
+ *
* Returns:
- * {Float} A normalized scale value, in 1 / X format.
+ * {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
+ * in, it just returns scale directly. Otherwise, it returns
* 1 / scale
*/
OpenLayers.Util.normalizeScale = function (scale) {
- var normScale = (scale > 1.0) ? (1.0 / scale)
+ var normScale = (scale > 1.0) ? (1.0 / scale)
: scale;
return normScale;
};
/**
* Function: getResolutionFromScale
- *
+ *
* Parameters:
* scale - {Float}
* units - {String} Index into OpenLayers.INCHES_PER_UNIT hashtable.
* Default is degrees
- *
+ *
* Returns:
- * {Float} The corresponding resolution given passed-in scale and unit
+ * {Float} The corresponding resolution given passed-in scale and unit
* parameters.
*/
OpenLayers.Util.getResolutionFromScale = function (scale, units) {
@@ -1572,14 +1572,14 @@
/**
* Function: getScaleFromResolution
- *
+ *
* Parameters:
* resolution - {Float}
* units - {String} Index into OpenLayers.INCHES_PER_UNIT hashtable.
* Default is degrees
- *
+ *
* Returns:
- * {Float} The corresponding scale given passed-in resolution and unit
+ * {Float} The corresponding scale given passed-in resolution and unit
* parameters.
*/
OpenLayers.Util.getScaleFromResolution = function (resolution, units) {
@@ -1595,13 +1595,13 @@
/**
* Function: safeStopPropagation
- * *Deprecated*. This function has been deprecated. Please use directly
- * passing 'true' as the 2nd
+ * *Deprecated*. This function has been deprecated. Please use directly
+ * passing 'true' as the 2nd
* argument (preventDefault)
- *
+ *
* Safely stop the propagation of an event *without* preventing
* the default browser action from occurring.
- *
+ *
* Parameter:
* evt - {Event}
*/
@@ -1611,11 +1611,11 @@
/**
* Function: pagePositon
- * Calculates the position of an element on the page.
+ * Calculates the position of an element on the page.
*
* Parameters:
* forElement - {DOMElement}
- *
+ *
* Returns:
* {Array} two item array, L value then T value.
*/
@@ -1631,7 +1631,7 @@
break;
}
}
-
+
valueT += element.offsetTop || 0;
valueL += element.offsetLeft || 0;
@@ -1652,25 +1652,25 @@
valueL -= element.scrollLeft || 0;
element = element.parentNode;
}
-
+
return [valueL, valueT];
};
-/**
+/**
* Function: isEquivalentUrl
- * Test two URLs for equivalence.
- *
+ * Test two URLs for equivalence.
+ *
* Setting 'ignoreCase' allows for case-independent comparison.
- *
- * Comparison is based on:
+ *
+ * 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)
+ * - Pathname (for relative <-> absolute comparison)
* - Arguments (so they can be out of order)
- *
+ *
* Parameters:
* url1 - {String}
* url2 - {String}
@@ -1714,22 +1714,22 @@
for(var key in urlObj2.args) {
return false;
}
-
+
return true;
};
/**
* Function: createUrlObject
- *
+ *
* Parameters:
* url - {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
+ * {Object} An object with separate url, a, port, host, and args parsed out
* and ready for comparison
*/
OpenLayers.Util.createUrlObject = function(url, options) {
@@ -1750,21 +1750,21 @@
url = fullUrl + parts.join("/") + "/" + url;
}
}
-
+
if (options.ignoreCase) {
- url = url.toLowerCase();
+ url = url.toLowerCase();
}
var a = document.createElement('a');
a.href = url;
-
+
var urlObject = {};
-
+
//host (without port)
urlObject.host = a.host.split(":").shift();
//protocol
- urlObject.protocol = a.protocol;
+ urlObject.protocol = a.protocol;
//port (get uniform browser behavior with port 80 here)
if(options.ignorePort80) {
@@ -1774,8 +1774,8 @@
}
//hash
- urlObject.hash = (options.ignoreHash || a.hash === "#") ? "" : a.hash;
-
+ urlObject.hash = (options.ignoreHash || a.hash === "#") ? "" : a.hash;
+
//args
var queryString = a.search;
if (!queryString) {
@@ -1786,30 +1786,30 @@
//pathname (uniform browser behavior with leading "/")
urlObject.pathname = (a.pathname.charAt(0) == "/") ? a.pathname : "/" + a.pathname;
-
- return urlObject;
+
+ return urlObject;
};
-
+
/**
* Function: removeTail
* Takes a url and removes everything after the ? and #
- *
+ *
* Parameters:
* url - {String} The url to process
- *
+ *
* Returns:
* {String} The string with all queryString and Hash removed
*/
OpenLayers.Util.removeTail = function(url) {
var head = null;
-
+
var qMark = url.indexOf("?");
var hashMark = url.indexOf("#");
if (qMark == -1) {
head = (hashMark != -1) ? url.substr(0,hashMark) : url;
} else {
- head = (hashMark != -1) ? url.substr(0,Math.min(qMark, hashMark))
+ head = (hashMark != -1) ? url.substr(0,Math.min(qMark, hashMark))
: url.substr(0, qMark);
}
return head;
@@ -1818,24 +1818,24 @@
/**
* Function: getBrowserName
- *
+ *
* Returns:
- * {String} A string which specifies which is the current
- * browser in which we are running.
- *
+ * {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
+ *
+ * If we are unable to property identify the browser, we
* return an empty string.
*/
OpenLayers.Util.getBrowserName = function() {
var browserName = "";
-
+
var ua = navigator.userAgent.toLowerCase();
if ( ua.indexOf( "opera" ) != -1 ) {
browserName = "opera";
@@ -1850,46 +1850,46 @@
browserName = "mozilla";
}
}
-
+
return browserName;
};
-
+
/**
* Method: getRenderedDimensions
* Renders the contentHTML offscreen to determine actual dimensions for
* popup sizing. As we need layout to determine dimensions the content
- * is rendered -9999px to the left and absolute to ensure the
+ * is rendered -9999px to the left and absolute to ensure the
* scrollbars do not flicker
- *
+ *
* Parameters:
* contentHTML
- * size - {} If either the 'w' or 'h' properties is
- * specified, we fix that dimension of the div to be measured. This is
- * useful in the case where we have a limit in one dimension and must
+ * size - {} If either the 'w' or 'h' properties is
+ * specified, we fix that dimension of the div to be measured. This is
+ * useful in the case where we have a limit in one dimension and must
* therefore meaure the flow in the other dimension.
* options - {Object}
* displayClass - {String} Optional parameter. A CSS class name(s) string
* to provide the CSS context of the rendered content.
- * containerElement - {DOMElement} Optional parameter. Insert the HTML to
- * this node instead of the body root when calculating dimensions.
- *
+ * containerElement - {DOMElement} Optional parameter. Insert the HTML to
+ * this node instead of the body root when calculating dimensions.
+ *
* Returns:
* {OpenLayers.Size}
*/
OpenLayers.Util.getRenderedDimensions = function(contentHTML, size, options) {
-
+
var w, h;
-
+
// create temp container div with restricted size
var container = document.createElement("div");
container.style.visibility = "hidden";
-
- var containerElement = (options && options.containerElement)
- ? options.containerElement : document.body;
+ var containerElement = (options && options.containerElement)
+ ? options.containerElement : document.body;
+
//fix a dimension, if specified.
if (size) {
if (size.w) {
@@ -1905,11 +1905,11 @@
if (options && options.displayClass) {
container.className = options.displayClass;
}
-
+
// create temp content div and assign content
var content = document.createElement("div");
content.innerHTML = contentHTML;
-
+
// we need overflow visible when calculating the size
content.style.overflow = "visible";
if (content.childNodes) {
@@ -1918,13 +1918,13 @@
content.childNodes[i].style.overflow = "visible";
}
}
-
- // add content to restricted container
+
+ // add content to restricted container
container.appendChild(content);
-
+
// append container to body for rendering
containerElement.appendChild(container);
-
+
// Opera and IE7 can't handle a node with position:aboslute if it inherits
// position:absolute from a parent.
var parentHasPositionAbsolute = false;
@@ -1943,14 +1943,14 @@
if(!parentHasPositionAbsolute) {
container.style.position = "absolute";
}
-
+
// calculate scroll width of content and add corners and shadow width
if (!w) {
w = parseInt(content.scrollWidth);
-
+
// update container width to allow height to adjust
container.style.width = w + "px";
- }
+ }
// capture height and add shadow and corner image widths
if (!h) {
h = parseInt(content.scrollHeight);
@@ -1959,35 +1959,35 @@
// remove elements
container.removeChild(content);
containerElement.removeChild(container);
-
+
return new OpenLayers.Size(w, h);
};
/**
* APIFunction: getScrollbarWidth
* This function has been modified by the OpenLayers from the original version,
- * written by Matthew Eernisse and released under the Apache 2
+ * written by Matthew Eernisse and released under the Apache 2
* license here:
- *
+ *
* http://www.fleegix.org/articles/2006/05/30/getting-the-scrollbar-width-in-pixels
- *
- * It has been modified simply to cache its value, since it is physically
- * impossible that this code could ever run in more than one browser at
- * once.
- *
+ *
+ * It has been modified simply to cache its value, since it is physically
+ * impossible that this code could ever run in more than one browser at
+ * once.
+ *
* Returns:
* {Integer}
*/
OpenLayers.Util.getScrollbarWidth = function() {
-
+
var scrollbarWidth = OpenLayers.Util._scrollbarWidth;
-
+
if (scrollbarWidth == null) {
var scr = null;
var inn = null;
var wNoScroll = 0;
var wScroll = 0;
-
+
// Outer scrolling div
scr = document.createElement('div');
scr.style.position = 'absolute';
@@ -1997,28 +1997,28 @@
scr.style.height = '50px';
// Start with no scrollbar
scr.style.overflow = 'hidden';
-
+
// Inner content div
inn = document.createElement('div');
inn.style.width = '100%';
inn.style.height = '200px';
-
+
// Put the inner div in the scrolling div
scr.appendChild(inn);
// Append the scrolling div to the doc
document.body.appendChild(scr);
-
+
// Width of the inner div sans scrollbar
wNoScroll = inn.offsetWidth;
-
+
// Add the scrollbar
scr.style.overflow = 'scroll';
// Width of the inner div width scrollbar
wScroll = inn.offsetWidth;
-
+
// Remove the scrolling div from the doc
document.body.removeChild(document.body.lastChild);
-
+
// Pixel width of the scroller
OpenLayers.Util._scrollbarWidth = (wNoScroll - wScroll);
scrollbarWidth = OpenLayers.Util._scrollbarWidth;
@@ -2046,7 +2046,7 @@
* Note 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.
- *
+ *
*/
OpenLayers.Console = {
/**
@@ -2055,7 +2055,7 @@
* included. We explicitly require the Firebug Lite script to trigger
* functionality of the OpenLayers.Console methods.
*/
-
+
/**
* APIFunction: log
* Log an object in the console. The Firebug Lite console logs string
@@ -2065,7 +2065,7 @@
* will be used in string substitution. Any additional arguments (beyond
* the number substituted in a format string) will be appended in a space-
* delimited line.
- *
+ *
* Parameters:
* object - {Object}
*/
@@ -2077,7 +2077,7 @@
* where it was called.
*
* May be called with multiple arguments as with OpenLayers.Console.log().
- *
+ *
* Parameters:
* object - {Object}
*/
@@ -2089,7 +2089,7 @@
* coding and a hyperlink to the line where it was called.
*
* May be called with multiple arguments as with OpenLayers.Console.log().
- *
+ *
* Parameters:
* object - {Object}
*/
@@ -2101,7 +2101,7 @@
* color coding and a hyperlink to the line where it was called.
*
* May be called with multiple arguments as with OpenLayers.Console.log().
- *
+ *
* Parameters:
* object - {Object}
*/
@@ -2113,12 +2113,12 @@
* coding and a hyperlink to the line where it was called.
*
* May be called with multiple arguments as with OpenLayers.Console.log().
- *
+ *
* Parameters:
* object - {Object}
*/
error: function() {},
-
+
/**
* APIFunction: userError
* A single interface for showing error messages to the user. The default
@@ -2126,7 +2126,7 @@
* reassigning OpenLayers.Console.userError to a different function.
*
* Expects a single error message
- *
+ *
* Parameters:
* object - {Object}
*/
@@ -2140,7 +2140,7 @@
* the console and throw an exception.
*
* May be called with multiple arguments as with OpenLayers.Console.log().
- *
+ *
* Parameters:
* object - {Object}
*/
@@ -2150,7 +2150,7 @@
* APIFunction: dir
* Prints an interactive listing of all properties of the object. This
* looks identical to the view that you would see in the DOM tab.
- *
+ *
* Parameters:
* object - {Object}
*/
@@ -2161,7 +2161,7 @@
* Prints the XML source tree of an HTML or XML element. This looks
* identical to the view that you would see in the HTML tab. You can click
* on any node to inspect it in the HTML tab.
- *
+ *
* Parameters:
* object - {Object}
*/
@@ -2174,7 +2174,7 @@
* as well as the values that were passed as arguments to each function.
* You can click each function to take you to its source in the Script tab,
* and click each argument value to inspect it in the DOM or HTML tabs.
- *
+ *
*/
trace: function() {},
@@ -2185,7 +2185,7 @@
* to close the block.
*
* May be called with multiple arguments as with OpenLayers.Console.log().
- *
+ *
* Parameters:
* object - {Object}
*/
@@ -2197,7 +2197,7 @@
* OpenLayers.Console.group
*/
groupEnd: function() {},
-
+
/**
* APIFunction: time
* Creates a new timer under the given name. Call
@@ -2225,7 +2225,7 @@
* contain the text to be printed in the header of the profile report.
*
* This function is not currently implemented in Firebug Lite.
- *
+ *
* Parameters:
* title - {String} Optional title for the profiler
*/
@@ -2234,7 +2234,7 @@
/**
* APIFunction: profileEnd
* Turns off the JavaScript profiler and prints its report.
- *
+ *
* This function is not currently implemented in Firebug Lite.
*/
profileEnd: function() {},
@@ -2293,8 +2293,8 @@
* @requires OpenLayers/Lang/en.js
* @requires OpenLayers/Console.js
*/
-
-/**
+
+/**
* Header: OpenLayers Base Types
* OpenLayers custom string, number and function functions are described here.
*/
@@ -2307,12 +2307,12 @@
/**
* APIFunction: startsWith
- * Test whether a string starts with another string.
- *
+ * Test whether a string starts with another string.
+ *
* Parameters:
* str - {String} The string to test.
* sub - {Sring} The substring to look for.
- *
+ *
* Returns:
* {Boolean} The first string starts with the second.
*/
@@ -2323,43 +2323,43 @@
/**
* APIFunction: contains
* Test whether a string contains another string.
- *
+ *
* Parameters:
* str - {String} The string to test.
* sub - {String} The substring to look for.
- *
+ *
* Returns:
* {Boolean} The first string contains the second.
*/
contains: function(str, sub) {
return (str.indexOf(sub) != -1);
},
-
+
/**
* APIFunction: trim
* Removes leading and trailing whitespace characters from a string.
- *
+ *
* Parameters:
* str - {String} The (potentially) space padded string. This string is not
* modified.
- *
+ *
* Returns:
- * {String} A trimmed version of the string with all leading and
+ * {String} A trimmed version of the string with all leading and
* trailing spaces removed.
*/
trim: function(str) {
return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
},
-
+
/**
* APIFunction: camelize
- * Camel-case a hyphenated string.
+ * Camel-case a hyphenated string.
* Ex. "chicken-head" becomes "chickenHead", and
* "-chicken-head" becomes "ChickenHead".
*
* Parameters:
* str - {String} The string to be camelized. The original is not modified.
- *
+ *
* Returns:
* {String} The string, camelized
*/
@@ -2372,7 +2372,7 @@
}
return camelizedString;
},
-
+
/**
* APIFunction: format
* Given a string with tokens in the form ${token}, return a string
@@ -2399,7 +2399,7 @@
context = window;
}
- // Example matching:
+ // Example matching:
// str = ${foo.bar}
// match = foo.bar
var replacer = function(str, match) {
@@ -2425,13 +2425,13 @@
}
// If replacement is undefined, return the string 'undefined'.
- // This is a workaround for a bugs in browsers not properly
+ // This is a workaround for a bugs in browsers not properly
// dealing with non-participating groups in regular expressions:
// http://blog.stevenlevithan.com/archives/npcg-javascript
if (typeof replacement == 'undefined') {
return 'undefined';
} else {
- return replacement;
+ return replacement;
}
};
@@ -2444,13 +2444,13 @@
* Examples: ${a}, ${a.b.c}, ${a-b}, ${5}
*/
tokenRegEx: /\$\{([\w.]+?)\}/g,
-
+
/**
* Property: OpenLayers.String.numberRegEx
* Used to test strings as numbers.
*/
numberRegEx: /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,
-
+
/**
* APIFunction: OpenLayers.String.isNumeric
* Determine whether a string contains only a numeric value.
@@ -2469,14 +2469,14 @@
isNumeric: function(value) {
return OpenLayers.String.numberRegEx.test(value);
},
-
+
/**
* APIFunction: numericIf
* Converts a string that appears to be a numeric value into a number.
- *
+ *
* Returns
* {Number|String} a Number if the passed value is a number, a String
- * otherwise.
+ * otherwise.
*/
numericIf: function(value) {
return OpenLayers.String.isNumeric(value) ? parseFloat(value) : value;
@@ -2487,11 +2487,11 @@
if (!String.prototype.startsWith) {
/**
* APIMethod: String.startsWith
- * *Deprecated*. Whether or not a string starts with another string.
- *
+ * *Deprecated*. Whether or not a string starts with another string.
+ *
* Parameters:
* sStart - {Sring} The string we're testing for.
- *
+ *
* Returns:
* {Boolean} Whether or not this string starts with the string passed in.
*/
@@ -2506,10 +2506,10 @@
/**
* APIMethod: String.contains
* *Deprecated*. Whether or not a string contains another string.
- *
+ *
* Parameters:
* str - {String} The string that we're testing for.
- *
+ *
* Returns:
* {Boolean} Whether or not this string contains with the string passed in.
*/
@@ -2524,9 +2524,9 @@
/**
* APIMethod: String.trim
* *Deprecated*. Removes leading and trailing whitespace characters from a string.
- *
+ *
* Returns:
- * {String} A trimmed version of the string - all leading and
+ * {String} A trimmed version of the string - all leading and
* trailing spaces removed
*/
String.prototype.trim = function() {
@@ -2539,10 +2539,10 @@
if (!String.prototype.camelize) {
/**
* APIMethod: String.camelize
- * *Deprecated*. Camel-case a hyphenated string.
+ * *Deprecated*. Camel-case a hyphenated string.
* Ex. "chicken-head" becomes "chickenHead", and
* "-chicken-head" becomes "ChickenHead".
- *
+ *
* Returns:
* {String} The string, camelized
*/
@@ -2564,21 +2564,21 @@
* Decimal separator to use when formatting numbers.
*/
decimalSeparator: ".",
-
+
/**
* Property: thousandsSeparator
* Thousands separator to use when formatting numbers.
*/
thousandsSeparator: ",",
-
+
/**
* APIFunction: limitSigDigs
* Limit the number of significant digits on a float.
- *
+ *
* Parameters:
* num - {Float}
* sig - {Integer}
- *
+ *
* Returns:
* {Float} The number, rounded to the specified number of significant
* digits.
@@ -2590,11 +2590,11 @@
}
return fig;
},
-
+
/**
* APIFunction: format
* Formats a number for output.
- *
+ *
* Parameters:
* num - {Float}
* dec - {Integer} Number of decimal places to round to.
@@ -2608,9 +2608,9 @@
* {String} A string representing the formatted number.
*/
format: function(num, dec, tsep, dsep) {
- dec = (typeof dec != "undefined") ? dec : 0;
+ dec = (typeof dec != "undefined") ? dec : 0;
tsep = (typeof tsep != "undefined") ? tsep :
- OpenLayers.Number.thousandsSeparator;
+ OpenLayers.Number.thousandsSeparator;
dsep = (typeof dsep != "undefined") ? dsep :
OpenLayers.Number.decimalSeparator;
@@ -2623,15 +2623,15 @@
// integer where we do not want to touch the decimals
dec = 0;
}
-
+
var integer = parts[0];
if (tsep) {
- var thousands = /(-?[0-9]+)([0-9]{3})/;
- while(thousands.test(integer)) {
- integer = integer.replace(thousands, "$1" + tsep + "$2");
+ var thousands = /(-?[0-9]+)([0-9]{3})/;
+ while(thousands.test(integer)) {
+ integer = integer.replace(thousands, "$1" + tsep + "$2");
}
}
-
+
var str;
if (dec == 0) {
str = integer;
@@ -2651,10 +2651,10 @@
* APIMethod: Number.limitSigDigs
* *Deprecated*. Limit the number of significant digits on an integer. Does *not*
* work with floats!
- *
+ *
* Parameters:
* sig - {Integer}
- *
+ *
* Returns:
* {Integer} The number, rounded to the specified number of significant digits.
* If null, 0, or negative value passed in, returns 0
@@ -2675,11 +2675,11 @@
* APIFunction: bind
* Bind a function to an object. Method to easily create closures with
* 'this' altered.
- *
+ *
* Parameters:
* func - {Function} Input function.
* object - {Object} The object to bind to the input function (as this).
- *
+ *
* Returns:
* {Function} A closure with 'this' set to the passed in object.
*/
@@ -2695,16 +2695,16 @@
return func.apply(object, newArgs);
};
},
-
+
/**
* APIFunction: bindAsEventListener
* Bind a function to an object, and configure it to receive the event
- * object as first parameter when called.
- *
+ * object as first parameter when called.
+ *
* Parameters:
* func - {Function} Input function to serve as an event listener.
* object - {Object} A reference to this.
- *
+ *
* Returns:
* {Function}
*/
@@ -2718,12 +2718,12 @@
if (!Function.prototype.bind) {
/**
* APIMethod: Function.bind
- * *Deprecated*. Bind a function to an object.
+ * *Deprecated*. Bind a function to an object.
* Method to easily create closures with 'this' altered.
- *
+ *
* Parameters:
* object - {Object} the this parameter
- *
+ *
* Returns:
* {Function} A closure with 'this' altered to the first
* argument.
@@ -2741,11 +2741,11 @@
/**
* APIMethod: Function.bindAsEventListener
* *Deprecated*. Bind a function to an object, and configure it to receive the
- * event object as first parameter when called.
- *
+ * event object as first parameter when called.
+ *
* Parameters:
* object - {Object} A reference to this.
- *
+ *
* Returns:
* {Function}
*/
@@ -2802,11 +2802,11 @@
selected.push(val);
}
}
- }
+ }
}
return selected;
}
-
+
};
/* ======================================================================
OpenLayers/BaseTypes/Class.js
@@ -2818,13 +2818,13 @@
/**
* Constructor: OpenLayers.Class
- * 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
+ * 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 syntax:
* > var MyClass = OpenLayers.Class(prototype);
*
@@ -2945,7 +2945,7 @@
* {Number} width
*/
w: 0.0,
-
+
/**
* APIProperty: h
* {Number} height
@@ -2971,7 +2971,7 @@
* Return the string representation of a size object
*
* Returns:
- * {String} The string representation of OpenLayers.Size object.
+ * {String} The string representation of OpenLayers.Size object.
* (ex. "w=55,h=66")
*/
toString:function() {
@@ -2998,7 +2998,7 @@
* Parameters:
* sz - {}
*
- * Returns:
+ * Returns:
* {Boolean} The passed in size has the same h and w properties as this one.
* Note that if sz passed in is null, returns false.
*
@@ -3031,7 +3031,7 @@
* Instances 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 case:
* > bounds = new OpenLayers.Bounds();
* > bounds.extend(new OpenLayers.LonLat(4,5));
@@ -3063,7 +3063,7 @@
* {Number} Maximum vertical coordinate.
*/
top: null,
-
+
/**
* Property: centerLonLat
* {} A cached center location. This should not be
@@ -3106,7 +3106,7 @@
* {} A fresh copy of the bounds
*/
clone:function() {
- return new OpenLayers.Bounds(this.left, this.bottom,
+ return new OpenLayers.Bounds(this.left, this.bottom,
this.right, this.top);
},
@@ -3119,25 +3119,25 @@
*
* Returns:
* {Boolean} The passed-in bounds object has the same left,
- * right, top, bottom components as this. Note that if bounds
+ * right, top, bottom components as this. Note that if bounds
* passed in is null, returns false.
*/
equals:function(bounds) {
var equals = false;
if (bounds != null) {
- equals = ((this.left == bounds.left) &&
+ equals = ((this.left == bounds.left) &&
(this.right == bounds.right) &&
- (this.top == bounds.top) &&
+ (this.top == bounds.top) &&
(this.bottom == bounds.bottom));
}
return equals;
},
- /**
+ /**
* APIMethod: toString
- *
+ *
* Returns:
- * {String} String representation of bounds object.
+ * {String} String representation of bounds object.
* (ex."left-bottom=(5,42) right-top=(10,45)")
*/
toString:function() {
@@ -3153,32 +3153,32 @@
*/
toArray: function() {
return [this.left, this.bottom, this.right, this.top];
- },
+ },
- /**
+ /**
* APIMethod: toBBOX
- *
+ *
* Parameters:
* decimal - {Integer} How many significant digits in the bbox coords?
* Default is 6
- *
+ *
* Returns:
* {String} Simple String representation of bounds object.
* (ex. "5,42,10,45")
*/
toBBOX:function(decimal) {
if (decimal== null) {
- decimal = 6;
+ decimal = 6;
}
var mult = Math.pow(10, decimal);
- var bbox = Math.round(this.left * mult) / mult + "," +
- Math.round(this.bottom * mult) / mult + "," +
- Math.round(this.right * mult) / mult + "," +
+ var bbox = Math.round(this.left * mult) / mult + "," +
+ Math.round(this.bottom * mult) / mult + "," +
+ Math.round(this.right * mult) / mult + "," +
Math.round(this.top * mult) / mult;
return bbox;
},
-
+
/**
* APIMethod: toGeometry
* Create a new polygon geometry based on this bounds.
@@ -3197,10 +3197,10 @@
])
]);
},
-
+
/**
* APIMethod: getWidth
- *
+ *
* Returns:
* {Float} The width of the bounds
*/
@@ -3210,7 +3210,7 @@
/**
* APIMethod: getHeight
- *
+ *
* Returns:
* {Float} The height of the bounds (top minus bottom).
*/
@@ -3220,7 +3220,7 @@
/**
* APIMethod: getSize
- *
+ *
* Returns:
* {} The size of the box.
*/
@@ -3230,7 +3230,7 @@
/**
* APIMethod: getCenterPixel
- *
+ *
* Returns:
* {} The center of the bounds in pixel space.
*/
@@ -3241,7 +3241,7 @@
/**
* APIMethod: getCenterLonLat
- *
+ *
* Returns:
* {} The center of the bounds in map space.
*/
@@ -3256,12 +3256,12 @@
/**
* Method: scale
- * Scales the bounds around a pixel or lonlat. Note that the new
+ * Scales the bounds around a pixel or lonlat. Note that the new
* bounds may return non-integer properties, even if a pixel
- * is passed.
- *
+ * is passed.
+ *
* Parameters:
- * ratio - {Float}
+ * ratio - {Float}
* origin - { or }
* Default is center.
*
@@ -3276,7 +3276,7 @@
}
var bounds = [];
-
+
var origx,origy;
// get origin coordinates
@@ -3292,17 +3292,17 @@
var bottom = (this.bottom - origy) * ratio + origy;
var right = (this.right - origx) * ratio + origx;
var top = (this.top - origy) * ratio + origy;
-
+
return new OpenLayers.Bounds(left, bottom, right, top);
},
/**
* APIMethod: add
- *
+ *
* Parameters:
* x - {Float}
* y - {Float}
- *
+ *
* Returns:
* {} A new bounds whose coordinates are the same as
* this, but shifted by the passed-in x and y values.
@@ -3316,13 +3316,13 @@
return new OpenLayers.Bounds(this.left + x, this.bottom + y,
this.right + x, this.top + y);
},
-
+
/**
* APIMethod: extend
* Extend the bounds to include the point, lonlat, or bounds specified.
* Note, this function assumes that left < right and bottom < top.
- *
- * Parameters:
+ *
+ * Parameters:
* object - {Object} Can be LonLat, Point, or Bounds
*/
extend:function(object) {
@@ -3330,7 +3330,7 @@
if (object) {
// clear cached center location
switch(object.CLASS_NAME) {
- case "OpenLayers.LonLat":
+ case "OpenLayers.LonLat":
bounds = new OpenLayers.Bounds(object.lon, object.lat,
object.lon, object.lat);
break;
@@ -3338,12 +3338,12 @@
bounds = new OpenLayers.Bounds(object.x, object.y,
object.x, object.y);
break;
-
- case "OpenLayers.Bounds":
+
+ case "OpenLayers.Bounds":
bounds = object;
break;
}
-
+
if (bounds) {
this.centerLonLat = null;
if ( (this.left == null) || (bounds.left < this.left)) {
@@ -3351,11 +3351,11 @@
}
if ( (this.bottom == null) || (bounds.bottom < this.bottom) ) {
this.bottom = bounds.bottom;
- }
+ }
if ( (this.right == null) || (bounds.right > this.right) ) {
this.right = bounds.right;
}
- if ( (this.top == null) || (bounds.top > this.top) ) {
+ if ( (this.top == null) || (bounds.top > this.top) ) {
this.top = bounds.top;
}
}
@@ -3364,7 +3364,7 @@
/**
* APIMethod: containsLonLat
- *
+ *
* Parameters:
* ll - {}
* inclusive - {Boolean} Whether or not to include the border.
@@ -3379,7 +3379,7 @@
/**
* APIMethod: containsPixel
- *
+ *
* Parameters:
* px - {}
* inclusive - {Boolean} Whether or not to include the border. Default is
@@ -3391,10 +3391,10 @@
containsPixel:function(px, inclusive) {
return this.contains(px.x, px.y, inclusive);
},
-
+
/**
* APIMethod: contains
- *
+ *
* Parameters:
* x - {Float}
* y - {Float}
@@ -3420,12 +3420,12 @@
var contains = false;
if (inclusive) {
- contains = ((x >= this.left) && (x <= this.right) &&
+ contains = ((x >= this.left) && (x <= this.right) &&
(y >= this.bottom) && (y <= this.top));
} else {
- contains = ((x > this.left) && (x < this.right) &&
+ contains = ((x > this.left) && (x < this.right) &&
(y > this.bottom) && (y < this.top));
- }
+ }
return contains;
},
@@ -3434,7 +3434,7 @@
* Determine whether the target bounds intersects this bounds. Bounds are
* considered intersecting if any of their edges intersect or if one
* bounds contains the other.
- *
+ *
* Parameters:
* bounds - {} The target bounds.
* inclusive - {Boolean} Treat coincident borders as intersecting. Default
@@ -3455,7 +3455,7 @@
this.top == bounds.bottom ||
this.bottom == bounds.top
);
-
+
// if the two bounds only touch at an edge, and inclusive is false,
// then the bounds don't *really* intersect.
if (inclusive || !mightTouch) {
@@ -3481,11 +3481,11 @@
}
return intersects;
},
-
+
/**
* APIMethod: containsBounds
* Determine whether the target bounds is contained within this bounds.
- *
+ *
* bounds - {} The target bounds.
* partial - {Boolean} If any of the target corners is within this bounds
* consider the bounds contained. Default is false. If true, the
@@ -3494,7 +3494,7 @@
* true.
*
* Returns:
- * {Boolean} The passed-in bounds object is contained within this bounds.
+ * {Boolean} The passed-in bounds object is contained within this bounds.
*/
containsBounds:function(bounds, partial, inclusive) {
if (partial == null) {
@@ -3507,39 +3507,39 @@
var bottomRight = this.contains(bounds.right, bounds.bottom, inclusive);
var topLeft = this.contains(bounds.left, bounds.top, inclusive);
var topRight = this.contains(bounds.right, bounds.top, inclusive);
-
+
return (partial) ? (bottomLeft || bottomRight || topLeft || topRight)
: (bottomLeft && bottomRight && topLeft && topRight);
},
- /**
+ /**
* APIMethod: determineQuadrant
- *
+ *
* Parameters:
* lonlat - {}
- *
+ *
* Returns:
* {String} The quadrant ("br" "tr" "tl" "bl") of the bounds in which the
* coordinate lies.
*/
determineQuadrant: function(lonlat) {
-
+
var quadrant = "";
var center = this.getCenterLonLat();
-
+
quadrant += (lonlat.lat < center.lat) ? "b" : "t";
quadrant += (lonlat.lon < center.lon) ? "l" : "r";
-
- return quadrant;
+
+ return quadrant;
},
-
+
/**
* APIMethod: transform
- * Transform the Bounds object from source to dest.
+ * Transform the Bounds object from source to dest.
*
- * Parameters:
- * source - {} Source projection.
- * dest - {} Destination projection.
+ * Parameters:
+ * source - {} Source projection.
+ * dest - {} Destination projection.
*
* Returns:
* {} Itself, for use in chaining operations.
@@ -3564,68 +3564,68 @@
/**
* APIMethod: wrapDateLine
- *
+ *
* Parameters:
* maxExtent - {}
* options - {Object} Some possible options are:
- * leftTolerance - {float} Allow for a margin of error
- * with the 'left' value of this
+ * leftTolerance - {float} Allow for a margin of error
+ * with the 'left' value of this
* bound.
* Default is 0.
- * rightTolerance - {float} Allow for a margin of error
- * with the 'right' value of
+ * rightTolerance - {float} Allow for a margin of error
+ * with the 'right' value of
* this bound.
* Default is 0.
- *
+ *
* Returns:
- * {} A copy of this bounds, but wrapped around the
- * "dateline" (as specified by the borders of
- * maxExtent). Note that this function only returns
- * a different bounds value if this bounds is
- * *entirely* outside of the maxExtent. If this
- * bounds straddles the dateline (is part in/part
- * out of maxExtent), the returned bounds will be
+ * {} A copy of this bounds, but wrapped around the
+ * "dateline" (as specified by the borders of
+ * maxExtent). Note that this function only returns
+ * a different bounds value if this bounds is
+ * *entirely* outside of the maxExtent. If this
+ * bounds straddles the dateline (is part in/part
+ * out of maxExtent), the returned bounds will be
* merely a copy of this one.
*/
- wrapDateLine: function(maxExtent, options) {
+ wrapDateLine: function(maxExtent, options) {
options = options || {};
-
+
var leftTolerance = options.leftTolerance || 0;
var rightTolerance = options.rightTolerance || 0;
var newBounds = this.clone();
-
+
if (maxExtent) {
//shift right?
- while ( newBounds.left < maxExtent.left &&
- (newBounds.right - rightTolerance) <= maxExtent.left ) {
+ while ( newBounds.left < maxExtent.left &&
+ (newBounds.right - rightTolerance) <= maxExtent.left ) {
newBounds = newBounds.add(maxExtent.getWidth(), 0);
}
//shift left?
- while ( (newBounds.left + leftTolerance) >= maxExtent.right &&
- newBounds.right > maxExtent.right ) {
+ while ( (newBounds.left + leftTolerance) >= maxExtent.right &&
+ newBounds.right > maxExtent.right ) {
newBounds = newBounds.add(-maxExtent.getWidth(), 0);
}
}
-
+
return newBounds;
},
CLASS_NAME: "OpenLayers.Bounds"
});
-/**
+/**
* APIFunction: fromString
- * Alternative constructor that builds a new OpenLayers.Bounds from a
+ * Alternative constructor that builds a new OpenLayers.Bounds from a
* parameter string
- *
- * Parameters:
+ *
+ * Parameters:
* str - {String}Comma-separated bounds string. (ex. "5,42,10,45")
- *
+ *
* Returns:
- * {} New bounds object built from the
+ * {} New bounds object built from the
* passed-in String.
*/
OpenLayers.Bounds.fromString = function(str) {
@@ -3633,11 +3633,11 @@
return OpenLayers.Bounds.fromArray(bounds);
};
-/**
+/**
* APIFunction: fromArray
* Alternative constructor that builds a new OpenLayers.Bounds
* from an array
- *
+ *
* Parameters:
* bbox - {Array(Float)} Array of bounds values (ex. [5,42,10,45])
*
@@ -3651,13 +3651,13 @@
parseFloat(bbox[3]));
};
-/**
+/**
* APIFunction: fromSize
* Alternative constructor that builds a new OpenLayers.Bounds
* from a size
- *
+ *
* Parameters:
- * size - {}
+ * size - {}
*
* Returns:
* {} New bounds object built from the passed-in size.
@@ -3677,16 +3677,16 @@
* quadrant - {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
+ * {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.Bounds.oppositeQuadrant = function(quadrant) {
var opp = "";
-
+
opp += (quadrant.charAt(0) == 't') ? 'b' : 't';
opp += (quadrant.charAt(1) == 'l') ? 'r' : 'l';
-
+
return opp;
};
/* ======================================================================
@@ -3704,10 +3704,10 @@
/**
* APIFunction: visible
- *
- * Parameters:
+ *
+ * Parameters:
* element - {DOMElement}
- *
+ *
* Returns:
* {Boolean} Is the element visible?
*/
@@ -3718,14 +3718,14 @@
/**
* APIFunction: toggle
* Toggle the visibility of element(s) passed in
- *
+ *
* Parameters:
* element - {DOMElement} Actually user can pass any number of elements
*/
toggle: function() {
for (var i=0, len=arguments.length; i"lon=5,lat=42")
*/
toString:function() {
return ("lon=" + this.lon + ",lat=" + this.lat);
},
- /**
+ /**
* APIMethod: toShortString
- *
+ *
* Returns:
- * {String} Shortened String representation of OpenLayers.LonLat object.
+ * {String} Shortened String representation of OpenLayers.LonLat object.
* (ex. "5, 42")
*/
toShortString:function() {
return (this.lon + ", " + this.lat);
},
- /**
+ /**
* APIMethod: clone
- *
+ *
* Returns:
- * {} New OpenLayers.LonLat object with the same lon
+ * {} New OpenLayers.LonLat object with the same lon
* and lat values
*/
clone:function() {
return new OpenLayers.LonLat(this.lon, this.lat);
},
- /**
+ /**
* APIMethod: add
- *
+ *
* Parameters:
* lon - {Float}
* lat - {Float}
- *
+ *
* Returns:
- * {} A new OpenLayers.LonLat object with the lon and
- * lat passed-in added to this's.
+ * {} A new OpenLayers.LonLat object with the lon and
+ * lat passed-in added to this's.
*/
add:function(lon, lat) {
if ( (lon == null) || (lat == null) ) {
@@ -4038,15 +4038,15 @@
return new OpenLayers.LonLat(this.lon + lon, this.lat + lat);
},
- /**
+ /**
* APIMethod: equals
- *
+ *
* Parameters:
* ll - {}
- *
+ *
* Returns:
- * {Boolean} Boolean value indicating whether the passed-in
- * object has the same lon and lat
+ * {Boolean} Boolean value indicating whether the passed-in
+ * object has the same lon and lat
* components as this.
* Note: if ll passed in is null, returns false
*/
@@ -4064,9 +4064,9 @@
* Transform the LonLat object from source to dest. This transformation is
* *in place*: if you want a *new* lonlat, use .clone() first.
*
- * Parameters:
- * source - {} Source projection.
- * dest - {} Destination projection.
+ * Parameters:
+ * source - {} Source projection.
+ * dest - {} Destination projection.
*
* Returns:
* {} Itself, for use in chaining operations.
@@ -4078,56 +4078,56 @@
this.lat = point.y;
return this;
},
-
+
/**
* APIMethod: wrapDateLine
- *
+ *
* Parameters:
* maxExtent - {}
- *
+ *
* Returns:
- * {} A copy of this lonlat, but wrapped around the
- * "dateline" (as specified by the borders of
+ * {} A copy of this lonlat, but wrapped around the
+ * "dateline" (as specified by the borders of
* maxExtent)
*/
- wrapDateLine: function(maxExtent) {
+ wrapDateLine: function(maxExtent) {
var newLonLat = this.clone();
-
+
if (maxExtent) {
//shift right?
while (newLonLat.lon < maxExtent.left) {
newLonLat.lon += maxExtent.getWidth();
- }
-
+ }
+
//shift left?
while (newLonLat.lon > maxExtent.right) {
newLonLat.lon -= maxExtent.getWidth();
- }
+ }
}
-
+
return newLonLat;
},
CLASS_NAME: "OpenLayers.LonLat"
});
-/**
+/**
* Function: fromString
- * Alternative constructor that builds a new from a
+ * Alternative constructor that builds a new from a
* parameter string
- *
+ *
* Parameters:
- * str - {String} Comma-separated Lon,Lat coordinate string.
+ * str - {String} Comma-separated Lon,Lat coordinate string.
* (ex. "5,40")
- *
+ *
* Returns:
- * {} New object built from the
+ * {} New object built from the
* passed-in String.
*/
OpenLayers.LonLat.fromString = function(str) {
var pair = str.split(",");
- return new OpenLayers.LonLat(parseFloat(pair[0]),
+ return new OpenLayers.LonLat(parseFloat(pair[0]),
parseFloat(pair[1]));
};
/* ======================================================================
@@ -4147,7 +4147,7 @@
* This class represents a screen coordinate, in x and y coordinates
*/
OpenLayers.Pixel = OpenLayers.Class({
-
+
/**
* APIProperty: x
* {Number} The x coordinate
@@ -4159,7 +4159,7 @@
* {Number} The y coordinate
*/
y: 0.0,
-
+
/**
* Constructor: OpenLayers.Pixel
* Create a new OpenLayers.Pixel instance
@@ -4175,7 +4175,7 @@
this.x = parseFloat(x);
this.y = parseFloat(y);
},
-
+
/**
* Method: toString
* Cast this object into a string
@@ -4195,9 +4195,9 @@
* {} A clone pixel
*/
clone:function() {
- return new OpenLayers.Pixel(this.x, this.y);
+ return new OpenLayers.Pixel(this.x, this.y);
},
-
+
/**
* APIMethod: equals
* Determine whether one pixel is equivalent to another
@@ -4226,7 +4226,7 @@
* y - {Integer}
*
* Returns:
- * {} A new Pixel with this pixel's x&y augmented by the
+ * {} A new Pixel with this pixel's x&y augmented by the
* values passed in.
*/
add:function(x, y) {
@@ -4240,12 +4240,12 @@
/**
* APIMethod: offset
- *
+ *
* Parameters
* px - {}
- *
+ *
* Returns:
- * {} A new Pixel with this pixel's x&y augmented by the
+ * {} A new Pixel with this pixel's x&y augmented by the
* x&y values of the pixel passed in.
*/
offset:function(px) {
@@ -4269,62 +4269,62 @@
/**
* Class: OpenLayers.Icon
- *
+ *
* The icon represents a graphical icon on the screen. Typically used in
* conjunction with a to represent markers on a screen.
*
- * An icon has a url, size and position. It also contains an offset which
+ * 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.
- *
+ * the desired offset.
+ *
*/
OpenLayers.Icon = OpenLayers.Class({
-
- /**
- * Property: url
+
+ /**
+ * Property: url
* {String} image url
*/
url: null,
-
- /**
- * Property: size
- * {}
+
+ /**
+ * Property: size
+ * {}
*/
size: null,
- /**
- * Property: offset
+ /**
+ * Property: offset
* {} distance in pixels to offset the image when being rendered
*/
- offset: null,
-
- /**
- * Property: calculateOffset
- * {} Function to calculate the offset (based on the size)
+ offset: null,
+
+ /**
+ * Property: calculateOffset
+ * {} Function to calculate the offset (based on the size)
*/
- calculateOffset: null,
-
- /**
- * Property: imageDiv
- * {DOMElement}
+ calculateOffset: null,
+
+ /**
+ * Property: imageDiv
+ * {DOMElement}
*/
imageDiv: null,
- /**
- * Property: px
- * {}
+ /**
+ * Property: px
+ * {}
*/
px: null,
-
- /**
+
+ /**
* Constructor: OpenLayers.Icon
- * Creates an icon, which is an image tag in a div.
+ * Creates an icon, which is an image tag in a div.
*
- * url - {String}
- * size - {}
+ * url - {String}
+ * size - {}
* offset - {}
- * calculateOffset - {Function}
+ * calculateOffset - {Function}
*/
initialize: function(url, size, offset, calculateOffset) {
this.url = url;
@@ -4335,39 +4335,39 @@
var id = OpenLayers.Util.createUniqueID("OL_Icon_");
this.imageDiv = OpenLayers.Util.createAlphaImageDiv(id);
},
-
- /**
+
+ /**
* Method: destroy
- * Nullify references and remove event listeners to prevent circular
+ * Nullify references and remove event listeners to prevent circular
* references and memory leaks
*/
destroy: function() {
// erase any drawn elements
this.erase();
- OpenLayers.Event.stopObservingElement(this.imageDiv.firstChild);
+ OpenLayers.Event.stopObservingElement(this.imageDiv.firstChild);
this.imageDiv.innerHTML = "";
this.imageDiv = null;
},
- /**
+ /**
* Method: clone
- *
+ *
* Returns:
* {} A fresh copy of the icon.
*/
clone: function() {
- return new OpenLayers.Icon(this.url,
- this.size,
- this.offset,
+ return new OpenLayers.Icon(this.url,
+ this.size,
+ this.offset,
this.calculateOffset);
},
-
+
/**
* Method: setSize
- *
+ *
* Parameters:
- * size - {}
+ * size - {}
*/
setSize: function(size) {
if (size != null) {
@@ -4375,12 +4375,12 @@
}
this.draw();
},
-
+
/**
* Method: setUrl
- *
+ *
* Parameters:
- * url - {String}
+ * url - {String}
*/
setUrl: function(url) {
if (url != null) {
@@ -4389,28 +4389,28 @@
this.draw();
},
- /**
+ /**
* Method: draw
* Move the div to the given pixel.
- *
+ *
* Parameters:
- * px - {}
- *
+ * px - {}
+ *
* Returns:
* {DOMElement} A new DOM Image of this icon set at the location passed-in
*/
draw: function(px) {
- OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,
- null,
- null,
- this.size,
- this.url,
+ OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,
+ null,
+ null,
+ this.size,
+ this.url,
"absolute");
this.moveTo(px);
return this.imageDiv;
- },
+ },
- /**
+ /**
* Method: erase
* Erase the underlying image element.
*
@@ -4419,27 +4419,27 @@
if (this.imageDiv != null && this.imageDiv.parentNode != null) {
OpenLayers.Element.remove(this.imageDiv);
}
- },
-
- /**
+ },
+
+ /**
* Method: setOpacity
* Change the icon's opacity
*
* Parameters:
- * opacity - {float}
+ * opacity - {float}
*/
setOpacity: function(opacity) {
- OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv, null, null, null,
+ OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv, null, null, null,
null, null, null, null, opacity);
},
-
+
/**
* Method: moveTo
* move icon to passed in px.
*
* Parameters:
- * px - {}
+ * px - {}
*/
moveTo: function (px) {
//if no px passed in, use stored location
@@ -4452,39 +4452,39 @@
this.display(false);
} else {
if (this.calculateOffset) {
- this.offset = this.calculateOffset(this.size);
+ this.offset = this.calculateOffset(this.size);
}
var offsetPx = this.px.offset(this.offset);
OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv, null, offsetPx);
}
}
},
-
- /**
+
+ /**
* Method: display
* Hide or show the icon
*
* Parameters:
- * display - {Boolean}
+ * display - {Boolean}
*/
display: function(display) {
- this.imageDiv.style.display = (display) ? "" : "none";
+ this.imageDiv.style.display = (display) ? "" : "none";
},
-
+
/**
* APIMethod: isDrawn
- *
+ *
* Returns:
* {Boolean} Whether or not the icon is drawn.
*/
isDrawn: function() {
// nodeType 11 for ie, whose nodes *always* have a parentNode
// (of type document fragment)
- var isDrawn = (this.imageDiv && this.imageDiv.parentNode &&
- (this.imageDiv.parentNode.nodeType != 11));
+ var isDrawn = (this.imageDiv && this.imageDiv.parentNode &&
+ (this.imageDiv.parentNode.nodeType != 11));
- return isDrawn;
+ return isDrawn;
},
CLASS_NAME: "OpenLayers.Icon"
@@ -4501,104 +4501,104 @@
/**
* Class: OpenLayers.Popup
* A popup is a small div that can opened and closed on the map.
- * Typically opened in response to clicking on a marker.
+ * Typically opened in response to clicking on a marker.
* See . Popup's don't require their own
* layer and are added the the map using the
* method.
*
* Example:
* (code)
- * popup = new OpenLayers.Popup("chicken",
+ * popup = new OpenLayers.Popup("chicken",
* new OpenLayers.LonLat(5,40),
* new OpenLayers.Size(200,200),
* "example popup",
* true);
- *
+ *
* map.addPopup(popup);
* (end)
*/
OpenLayers.Popup = OpenLayers.Class({
- /**
- * Property: events
- * {} custom event manager
+ /**
+ * Property: events
+ * {} custom event manager
*/
events: null,
-
+
/** Property: id
* {String} the unique identifier assigned to this popup.
*/
id: "",
- /**
- * Property: lonlat
+ /**
+ * Property: lonlat
* {} the position of this popup on the map
*/
lonlat: null,
- /**
- * Property: div
+ /**
+ * Property: div
* {DOMElement} the div that contains this popup.
*/
div: null,
- /**
- * Property: contentSize
+ /**
+ * Property: contentSize
* {} the width and height of the content.
*/
- contentSize: null,
+ contentSize: null,
- /**
- * Property: size
+ /**
+ * Property: size
* {} the width and height of the popup.
*/
- size: null,
+ size: null,
- /**
- * Property: contentHTML
+ /**
+ * Property: contentHTML
* {String} An HTML string for this popup to display.
*/
contentHTML: null,
-
- /**
- * Property: backgroundColor
+
+ /**
+ * Property: backgroundColor
* {String} the background color used by the popup.
*/
backgroundColor: "",
-
- /**
- * Property: opacity
+
+ /**
+ * Property: opacity
* {float} the opacity of this popup (between 0.0 and 1.0)
*/
opacity: "",
- /**
- * Property: border
+ /**
+ * Property: border
* {String} the border size of the popup. (eg 2px)
*/
border: "",
-
- /**
- * Property: contentDiv
+
+ /**
+ * Property: contentDiv
* {DOMElement} a reference to the element that holds the content of
* the div.
*/
contentDiv: null,
-
- /**
- * Property: groupDiv
+
+ /**
+ * Property: groupDiv
* {DOMElement} First and only child of 'div'. The group Div contains the
* 'contentDiv' and the 'closeDiv'.
*/
groupDiv: null,
- /**
+ /**
* Property: closeDiv
* {DOMElement} the optional closer image
*/
closeDiv: null,
- /**
+ /**
* APIProperty: autoSize
* {Boolean} Resize the popup to auto-fit the contents.
* Default is false.
@@ -4617,40 +4617,40 @@
*/
maxSize: null,
- /**
+ /**
* Property: displayClass
* {String} The CSS class of the popup.
*/
displayClass: "olPopup",
- /**
+ /**
* Property: contentDisplayClass
* {String} The CSS class of the popup content div.
*/
contentDisplayClass: "olPopupContent",
- /**
- * Property: padding
- * {int or } An extra opportunity to specify internal
+ /**
+ * Property: padding
+ * {int or } An extra opportunity to specify internal
* padding of the content div inside the popup. This was originally
- * confused with the css padding as specified in style.css's
+ * confused with the css padding as specified in style.css's
* 'olPopupContent' class. We would like to get rid of this altogether,
* except that it does come in handy for the framed and anchoredbubble
- * popups, who need to maintain yet another barrier between their
- * content and the outer border of the popup itself.
- *
- * Note that in order to not break API, we must continue to support
- * this property being set as an integer. Really, though, we'd like to
+ * popups, who need to maintain yet another barrier between their
+ * content and the outer border of the popup itself.
+ *
+ * Note that in order to not break API, we must continue to support
+ * this property being set as an integer. Really, though, we'd like to
* have this specified as a Bounds object so that user can specify
* distinct left, top, right, bottom paddings. With the 3.0 release
* we can make this only a bounds.
*/
padding: 0,
- /**
+ /**
* Property: disableFirefoxOverflowHack
- * {Boolean} The hack for overflow in Firefox causes all elements
- * to be re-drawn, which causes Flash elements to be
+ * {Boolean} The hack for overflow in Firefox causes all elements
+ * to be re-drawn, which causes Flash elements to be
* re-initialized, which is troublesome.
* With this property the hack can be disabled.
*/
@@ -4658,8 +4658,8 @@
/**
* Method: fixPadding
- * To be removed in 3.0, this function merely helps us to deal with the
- * case where the user may have set an integer value for padding,
+ * To be removed in 3.0, this function merely helps us to deal with the
+ * case where the user may have set an integer value for padding,
* instead of an object.
*/
fixPadding: function() {
@@ -4677,17 +4677,17 @@
* Default is false.
*/
panMapIfOutOfView: false,
-
+
/**
- * APIProperty: keepInMap
- * {Boolean} If panMapIfOutOfView is false, and this property is true,
+ * APIProperty: keepInMap
+ * {Boolean} If panMapIfOutOfView is false, and this property is true,
* contrain the popup such that it always fits in the available map
* space. By default, this is not set on the base class. If you are
* creating popups that are near map edges and not allowing pannning,
* and especially if you have a popup which has a
* fixedRelativePosition, setting this to false may be a smart thing to
* do. Subclasses may want to override this setting.
- *
+ *
* Default is false.
*/
keepInMap: false,
@@ -4698,24 +4698,24 @@
* Default is false.
*/
closeOnMove: false,
-
- /**
- * Property: map
+
+ /**
+ * Property: map
* {} this gets set in Map.js when the popup is added to the map
*/
map: null,
- /**
+ /**
* Constructor: OpenLayers.Popup
* Create a popup.
- *
- * Parameters:
+ *
+ * Parameters:
* id - {String} a unqiue identifier for this popup. If null is passed
- * an identifier will be automatically generated.
+ * an identifier will be automatically generated.
* lonlat - {} The position on the map the popup will
* be shown.
* contentSize - {} The size of the content.
- * contentHTML - {String} An HTML string to display inside the
+ * contentHTML - {String} An HTML string to display inside the
* popup.
* closeBox - {Boolean} Whether to display a close box inside
* the popup.
@@ -4729,28 +4729,28 @@
this.id = id;
this.lonlat = lonlat;
- this.contentSize = (contentSize != null) ? contentSize
+ this.contentSize = (contentSize != null) ? contentSize
: new OpenLayers.Size(
OpenLayers.Popup.WIDTH,
OpenLayers.Popup.HEIGHT);
- if (contentHTML != null) {
+ if (contentHTML != null) {
this.contentHTML = contentHTML;
}
this.backgroundColor = OpenLayers.Popup.COLOR;
this.opacity = OpenLayers.Popup.OPACITY;
this.border = OpenLayers.Popup.BORDER;
- this.div = OpenLayers.Util.createDiv(this.id, null, null,
+ this.div = OpenLayers.Util.createDiv(this.id, null, null,
null, null, null, "hidden");
this.div.className = this.displayClass;
-
+
var groupDivId = this.id + "_GroupDiv";
- this.groupDiv = OpenLayers.Util.createDiv(groupDivId, null, null,
+ this.groupDiv = OpenLayers.Util.createDiv(groupDivId, null, null,
null, "relative", null,
"hidden");
var id = this.div.id + "_contentDiv";
- this.contentDiv = OpenLayers.Util.createDiv(id, null, this.contentSize.clone(),
+ this.contentDiv = OpenLayers.Util.createDiv(id, null, this.contentSize.clone(),
null, "relative");
this.contentDiv.className = this.contentDisplayClass;
this.groupDiv.appendChild(this.contentDiv);
@@ -4758,12 +4758,12 @@
if (closeBox) {
this.addCloseBox(closeBoxCallback);
- }
+ }
this.registerEvents();
},
- /**
+ /**
* Method: destroy
* nullify references to prevent circular references and memory leaks
*/
@@ -4773,24 +4773,24 @@
this.lonlat = null;
this.size = null;
this.contentHTML = null;
-
+
this.backgroundColor = null;
this.opacity = null;
this.border = null;
-
+
if (this.closeOnMove && this.map) {
this.map.events.unregister("movestart", this, this.hide);
}
this.events.destroy();
this.events = null;
-
+
if (this.closeDiv) {
- OpenLayers.Event.stopObservingElement(this.closeDiv);
+ OpenLayers.Event.stopObservingElement(this.closeDiv);
this.groupDiv.removeChild(this.closeDiv);
}
this.closeDiv = null;
-
+
this.div.removeChild(this.groupDiv);
this.groupDiv = null;
@@ -4799,7 +4799,7 @@
}
this.map = null;
this.div = null;
-
+
this.autoSize = null;
this.minSize = null;
this.maxSize = null;
@@ -4807,13 +4807,13 @@
this.panMapIfOutOfView = null;
},
- /**
+ /**
* Method: draw
* Constructs the elements that make up the popup.
*
* Parameters:
* px - {} the position the popup in pixels.
- *
+ *
* Returns:
* {DOMElement} Reference to a div that contains the drawn popup
*/
@@ -4824,12 +4824,12 @@
}
}
- // this assumes that this.map already exists, which is okay because
+ // this assumes that this.map already exists, which is okay because
// this.draw is only called once the popup has been added to the map.
if (this.closeOnMove) {
this.map.events.register("movestart", this, this.hide);
}
-
+
//listen to movestart, moveend to disable overflow (FF bug)
if (!this.disableFirefoxOverflowHack && OpenLayers.Util.getBrowserName() == 'firefox') {
this.map.events.register("movestart", this, function() {
@@ -4859,33 +4859,33 @@
this.setOpacity();
this.setBorder();
this.setContentHTML();
-
+
if (this.panMapIfOutOfView) {
this.panIntoView();
- }
+ }
return this.div;
},
- /**
+ /**
* Method: updatePosition
- * if the popup has a lonlat and its map members set,
+ * if the popup has a lonlat and its map members set,
* then have it move itself to its proper position
*/
updatePosition: function() {
if ((this.lonlat) && (this.map)) {
var px = this.map.getLayerPxFromLonLat(this.lonlat);
if (px) {
- this.moveTo(px);
- }
+ this.moveTo(px);
+ }
}
},
/**
* Method: moveTo
- *
+ *
* Parameters:
- * px - {} the top and left position of the popup div.
+ * px - {} the top and left position of the popup div.
*/
moveTo: function(px) {
if ((px != null) && (this.div != null)) {
@@ -4897,7 +4897,7 @@
/**
* Method: visible
*
- * Returns:
+ * Returns:
* {Boolean} Boolean indicating whether or not the popup is visible
*/
visible: function() {
@@ -4925,7 +4925,7 @@
if (this.panMapIfOutOfView) {
this.panIntoView();
- }
+ }
},
/**
@@ -4938,17 +4938,17 @@
/**
* Method: setSize
- * Used to adjust the size of the popup.
+ * Used to adjust the size of the popup.
*
* Parameters:
- * contentSize - {} the new size for the popup's
+ * contentSize - {} the new size for the popup's
* contents div (in pixels).
*/
- setSize:function(contentSize) {
- this.size = contentSize.clone();
-
- // if our contentDiv has a css 'padding' set on it by a stylesheet, we
- // must add that to the desired "size".
+ setSize:function(contentSize) {
+ this.size = contentSize.clone();
+
+ // if our contentDiv has a css 'padding' set on it by a stylesheet, we
+ // must add that to the desired "size".
var contentDivPadding = this.getContentDivPadding();
var wPadding = contentDivPadding.left + contentDivPadding.right;
var hPadding = contentDivPadding.top + contentDivPadding.bottom;
@@ -4964,18 +4964,18 @@
wPadding += closeDivWidth + contentDivPadding.right;
}
- //increase size of the main popup div to take into account the
- // users's desired padding and close div.
+ //increase size of the main popup div to take into account the
+ // users's desired padding and close div.
this.size.w += wPadding;
this.size.h += hPadding;
- //now if our browser is IE, we need to actually make the contents
- // div itself bigger to take its own padding into effect. this makes
+ //now if our browser is IE, we need to actually make the contents
+ // div itself bigger to take its own padding into effect. this makes
// me want to shoot someone, but so it goes.
if (OpenLayers.Util.getBrowserName() == "msie") {
- this.contentSize.w +=
+ this.contentSize.w +=
contentDivPadding.left + contentDivPadding.right;
- this.contentSize.h +=
+ this.contentSize.h +=
contentDivPadding.bottom + contentDivPadding.top;
}
@@ -4987,26 +4987,26 @@
this.contentDiv.style.width = contentSize.w + "px";
this.contentDiv.style.height = contentSize.h + "px";
}
- },
+ },
/**
* APIMethod: updateSize
- * Auto size the popup so that it precisely fits its contents (as
+ * Auto size the popup so that it precisely fits its contents (as
* determined by this.contentDiv.innerHTML). Popup size will, of
* course, be limited by the available space on the current map
*/
updateSize: function() {
-
+
// determine actual render dimensions of the contents by putting its
// contents into a fake contentDiv (for the CSS) and then measuring it
- var preparedHTML = "
" +
- this.contentDiv.innerHTML +
+ var preparedHTML = "
" +
+ this.contentDiv.innerHTML +
"
";
-
+
var containerElement = (this.map) ? this.map.layerContainerDiv
- : document.body;
+ : document.body;
var realSize = OpenLayers.Util.getRenderedDimensions(
- preparedHTML, null, {
+ preparedHTML, null, {
displayClass: this.displayClass,
containerElement: containerElement
}
@@ -5017,25 +5017,25 @@
var newSize = null;
if (safeSize.equals(realSize)) {
- //real size of content is small enough to fit on the map,
+ //real size of content is small enough to fit on the map,
// so we use real size.
newSize = realSize;
} else {
- //make a new OL.Size object with the clipped dimensions
+ //make a new OL.Size object with the clipped dimensions
// set or null if not clipped.
var fixedSize = new OpenLayers.Size();
fixedSize.w = (safeSize.w < realSize.w) ? safeSize.w : null;
fixedSize.h = (safeSize.h < realSize.h) ? safeSize.h : null;
-
+
if (fixedSize.w && fixedSize.h) {
- //content is too big in both directions, so we will use
- // max popup size (safeSize), knowing well that it will
- // overflow both ways.
+ //content is too big in both directions, so we will use
+ // max popup size (safeSize), knowing well that it will
+ // overflow both ways.
newSize = safeSize;
} else {
- //content is clipped in only one direction, so we need to
+ //content is clipped in only one direction, so we need to
// run getRenderedDimensions() again with a fixed dimension
var clippedSize = OpenLayers.Util.getRenderedDimensions(
preparedHTML, fixedSize, {
@@ -5043,17 +5043,17 @@
containerElement: containerElement
}
);
-
- //if the clipped size is still the same as the safeSize,
- // that means that our content must be fixed in the
- // offending direction. If overflow is 'auto', this means
- // we are going to have a scrollbar for sure, so we must
+
+ //if the clipped size is still the same as the safeSize,
+ // that means that our content must be fixed in the
+ // offending direction. If overflow is 'auto', this means
+ // we are going to have a scrollbar for sure, so we must
// adjust for that.
//
var currentOverflow = OpenLayers.Element.getStyle(
this.contentDiv, "overflow"
);
- if ( (currentOverflow != "hidden") &&
+ if ( (currentOverflow != "hidden") &&
(clippedSize.equals(safeSize)) ) {
var scrollBar = OpenLayers.Util.getScrollbarWidth();
if (fixedSize.w) {
@@ -5062,12 +5062,12 @@
clippedSize.w += scrollBar;
}
}
-
+
newSize = this.getSafeContentSize(clippedSize);
}
- }
- this.setSize(newSize);
- },
+ }
+ this.setSize(newSize);
+ },
/**
* Method: setBackgroundColor
@@ -5076,28 +5076,28 @@
* Parameters:
* color - {String} the background color. eg "#FFBBBB"
*/
- setBackgroundColor:function(color) {
+ setBackgroundColor:function(color) {
if (color != undefined) {
- this.backgroundColor = color;
+ this.backgroundColor = color;
}
-
+
if (this.div != null) {
this.div.style.backgroundColor = this.backgroundColor;
}
- },
-
+ },
+
/**
* Method: setOpacity
* Sets the opacity of the popup.
- *
+ *
* Parameters:
- * opacity - {float} A value between 0.0 (transparent) and 1.0 (solid).
+ * opacity - {float} A value between 0.0 (transparent) and 1.0 (solid).
*/
- setOpacity:function(opacity) {
+ setOpacity:function(opacity) {
if (opacity != undefined) {
- this.opacity = opacity;
+ this.opacity = opacity;
}
-
+
if (this.div != null) {
// for Mozilla and Safari
this.div.style.opacity = this.opacity;
@@ -5105,25 +5105,25 @@
// for IE
this.div.style.filter = 'alpha(opacity=' + this.opacity*100 + ')';
}
- },
-
+ },
+
/**
* Method: setBorder
* Sets the border style of the popup.
*
* Parameters:
- * border - {String} The border style value. eg 2px
+ * border - {String} The border style value. eg 2px
*/
- setBorder:function(border) {
+ setBorder:function(border) {
if (border != undefined) {
this.border = border;
}
-
+
if (this.div != null) {
this.div.style.border = this.border;
}
- },
-
+ },
+
/**
* Method: setContentHTML
* Allows the user to set the HTML content of the popup.
@@ -5136,15 +5136,15 @@
if (contentHTML != null) {
this.contentHTML = contentHTML;
}
-
- if ((this.contentDiv != null) &&
+
+ if ((this.contentDiv != null) &&
(this.contentHTML != null) &&
(this.contentHTML != this.contentDiv.innerHTML)) {
-
+
this.contentDiv.innerHTML = this.contentHTML;
-
+
if (this.autoSize) {
-
+
//if popup has images, listen for when they finish
// loading and resize accordingly
this.registerImageListeners();
@@ -5152,31 +5152,31 @@
//auto size the popup to its current contents
this.updateSize();
}
- }
+ }
},
-
+
/**
* Method: registerImageListeners
* Called when an image contained by the popup loaded. this function
* updates the popup size, then unregisters the image load listener.
- */
- registerImageListeners: function() {
+ */
+ registerImageListeners: function() {
- // As the images load, this function will call updateSize() to
+ // As the images load, this function will call updateSize() to
// resize the popup to fit the content div (which presumably is now
// bigger than when the image was not loaded).
- //
+ //
// If the 'panMapIfOutOfView' property is set, we will pan the newly
// resized popup back into view.
- //
- // Note that this function, when called, will have 'popup' and
+ //
+ // Note that this function, when called, will have 'popup' and
// 'img' properties in the context.
//
var onImgLoad = function() {
-
+
this.popup.updateSize();
-
+
if ( this.popup.visible() && this.popup.panMapIfOutOfView ) {
this.popup.panIntoView();
}
@@ -5184,12 +5184,12 @@
OpenLayers.Event.stopObserving(
this.img, "load", this.img._onImageLoad
);
-
+
};
- //cycle through the images and if their size is 0x0, that means that
- // they haven't been loaded yet, so we attach the listener, which
- // will fire when the images finish loading and will resize the
+ //cycle through the images and if their size is 0x0, that means that
+ // they haven't been loaded yet, so we attach the listener, which
+ // will fire when the images finish loading and will resize the
// popup accordingly to its new size.
var images = this.contentDiv.getElementsByTagName("img");
for (var i = 0, len = images.length; i < len; i++) {
@@ -5206,27 +5206,27 @@
img._onImgLoad = OpenLayers.Function.bind(onImgLoad, context);
OpenLayers.Event.observe(img, 'load', img._onImgLoad);
- }
- }
+ }
+ }
},
/**
* APIMethod: getSafeContentSize
- *
+ *
* Parameters:
* size - {} Desired size to make the popup.
- *
+ *
* Returns:
* {} A size to make the popup which is neither smaller
- * than the specified minimum size, nor bigger than the maximum
+ * than the specified minimum size, nor bigger than the maximum
* size (which is calculated relative to the size of the viewport).
*/
getSafeContentSize: function(size) {
var safeContentSize = size.clone();
- // if our contentDiv has a css 'padding' set on it by a stylesheet, we
- // must add that to the desired "size".
+ // if our contentDiv has a css 'padding' set on it by a stylesheet, we
+ // must add that to the desired "size".
var contentDivPadding = this.getContentDivPadding();
var wPadding = contentDivPadding.left + contentDivPadding.right;
var hPadding = contentDivPadding.top + contentDivPadding.bottom;
@@ -5243,25 +5243,25 @@
// prevent the popup from being smaller than a specified minimal size
if (this.minSize) {
- safeContentSize.w = Math.max(safeContentSize.w,
+ safeContentSize.w = Math.max(safeContentSize.w,
(this.minSize.w - wPadding));
- safeContentSize.h = Math.max(safeContentSize.h,
+ safeContentSize.h = Math.max(safeContentSize.h,
(this.minSize.h - hPadding));
}
// prevent the popup from being bigger than a specified maximum size
if (this.maxSize) {
- safeContentSize.w = Math.min(safeContentSize.w,
+ safeContentSize.w = Math.min(safeContentSize.w,
(this.maxSize.w - wPadding));
- safeContentSize.h = Math.min(safeContentSize.h,
+ safeContentSize.h = Math.min(safeContentSize.h,
(this.maxSize.h - hPadding));
}
-
- //make sure the desired size to set doesn't result in a popup that
+
+ //make sure the desired size to set doesn't result in a popup that
// is bigger than the map's viewport.
//
if (this.map && this.map.size) {
-
+
var extraX = 0, extraY = 0;
if (this.keepInMap && !this.panMapIfOutOfView) {
var px = this.map.getPixelFromLonLat(this.lonlat);
@@ -5282,39 +5282,39 @@
extraX = px.x;
extraY = px.y;
break;
- default:
+ default:
extraX = px.x;
extraY = this.map.size.h - px.y;
break;
}
- }
-
- var maxY = this.map.size.h -
- this.map.paddingForPopups.top -
- this.map.paddingForPopups.bottom -
+ }
+
+ var maxY = this.map.size.h -
+ this.map.paddingForPopups.top -
+ this.map.paddingForPopups.bottom -
hPadding - extraY;
-
- var maxX = this.map.size.w -
- this.map.paddingForPopups.left -
- this.map.paddingForPopups.right -
+
+ var maxX = this.map.size.w -
+ this.map.paddingForPopups.left -
+ this.map.paddingForPopups.right -
wPadding - extraX;
-
+
safeContentSize.w = Math.min(safeContentSize.w, maxX);
safeContentSize.h = Math.min(safeContentSize.h, maxY);
}
-
+
return safeContentSize;
},
-
+
/**
* Method: getContentDivPadding
- * Glorious, oh glorious hack in order to determine the css 'padding' of
- * the contentDiv. IE/Opera return null here unless we actually add the
- * popup's main 'div' element (which contains contentDiv) to the DOM.
- * So we make it invisible and then add it to the document temporarily.
+ * Glorious, oh glorious hack in order to determine the css 'padding' of
+ * the contentDiv. IE/Opera return null here unless we actually add the
+ * popup's main 'div' element (which contains contentDiv) to the DOM.
+ * So we make it invisible and then add it to the document temporarily.
*
- * Once we've taken the padding readings we need, we then remove it
- * from the DOM (it will actually get added to the DOM in
+ * Once we've taken the padding readings we need, we then remove it
+ * from the DOM (it will actually get added to the DOM in
* Map.js's addPopup)
*
* Returns:
@@ -5326,27 +5326,27 @@
var contentDivPadding = this._contentDivPadding;
if (!contentDivPadding) {
- if (this.div.parentNode == null) {
- //make the div invisible and add it to the page
- this.div.style.display = "none";
- document.body.appendChild(this.div);
- }
-
- //read the padding settings from css, put them in an OL.Bounds
+ if (this.div.parentNode == null) {
+ //make the div invisible and add it to the page
+ this.div.style.display = "none";
+ document.body.appendChild(this.div);
+ }
+
+ //read the padding settings from css, put them in an OL.Bounds
contentDivPadding = new OpenLayers.Bounds(
OpenLayers.Element.getStyle(this.contentDiv, "padding-left"),
OpenLayers.Element.getStyle(this.contentDiv, "padding-bottom"),
OpenLayers.Element.getStyle(this.contentDiv, "padding-right"),
OpenLayers.Element.getStyle(this.contentDiv, "padding-top")
);
-
+
//cache the value
this._contentDivPadding = contentDivPadding;
if (this.div.parentNode == document.body) {
- //remove the div from the page and make it visible again
- document.body.removeChild(this.div);
- this.div.style.display = "";
+ //remove the div from the page and make it visible again
+ document.body.removeChild(this.div);
+ this.div.style.display = "";
}
}
return contentDivPadding;
@@ -5354,7 +5354,7 @@
/**
* Method: addCloseBox
- *
+ *
* Parameters:
* callback - {Function} The callback to be called when the close button
* is clicked.
@@ -5364,12 +5364,12 @@
this.closeDiv = OpenLayers.Util.createDiv(
this.id + "_close", null, new OpenLayers.Size(17, 17)
);
- this.closeDiv.className = "olPopupCloseBox";
-
+ this.closeDiv.className = "olPopupCloseBox";
+
// use the content div's css padding to determine if we should
// padd the close div
var contentDivPadding = this.getContentDivPadding();
-
+
this.closeDiv.style.right = contentDivPadding.right + "px";
this.closeDiv.style.top = contentDivPadding.top + "px";
this.groupDiv.appendChild(this.closeDiv);
@@ -5378,7 +5378,7 @@
this.hide();
OpenLayers.Event.stop(e);
};
- OpenLayers.Event.observe(this.closeDiv, "click",
+ OpenLayers.Event.observe(this.closeDiv, "click",
OpenLayers.Function.bindAsEventListener(closePopup, this));
},
@@ -5387,58 +5387,58 @@
* Pans the map such that the popup is totaly viewable (if necessary)
*/
panIntoView: function() {
-
+
var mapSize = this.map.getSize();
-
- //start with the top left corner of the popup, in px,
+
+ //start with the top left corner of the popup, in px,
// relative to the viewport
var origTL = this.map.getViewPortPxFromLayerPx( new OpenLayers.Pixel(
parseInt(this.div.style.left),
parseInt(this.div.style.top)
));
var newTL = origTL.clone();
-
+
//new left (compare to margins, using this.size to calculate right)
if (origTL.x < this.map.paddingForPopups.left) {
newTL.x = this.map.paddingForPopups.left;
- } else
+ } else
if ( (origTL.x + this.size.w) > (mapSize.w - this.map.paddingForPopups.right)) {
newTL.x = mapSize.w - this.map.paddingForPopups.right - this.size.w;
}
-
+
//new top (compare to margins, using this.size to calculate bottom)
if (origTL.y < this.map.paddingForPopups.top) {
newTL.y = this.map.paddingForPopups.top;
- } else
+ } else
if ( (origTL.y + this.size.h) > (mapSize.h - this.map.paddingForPopups.bottom)) {
newTL.y = mapSize.h - this.map.paddingForPopups.bottom - this.size.h;
}
-
+
var dx = origTL.x - newTL.x;
var dy = origTL.y - newTL.y;
-
+
this.map.pan(dx, dy);
},
- /**
+ /**
* Method: registerEvents
* Registers events on the popup.
*
- * Do this in a separate function so that subclasses can
+ * Do this in a separate function so that subclasses can
* choose to override it if they wish to deal differently
* with mouse events
- *
+ *
* Note in the following handler functions that some special
- * care is needed to deal correctly with mousing and popups.
- *
+ * care is needed to deal correctly with mousing and popups.
+ *
* Because the user might select the zoom-rectangle option and
* then drag it over a popup, we need a safe way to allow the
* mousemove and mouseup events to pass through the popup when
* they are initiated from outside.
- *
+ *
* Otherwise, we want to essentially kill the event propagation
- * for all other events, though we have to do so carefully,
- * without disabling basic html functionality, like clicking on
+ * for all other events, though we have to do so carefully,
+ * without disabling basic html functionality, like clicking on
* hyperlinks or drag-selecting text.
*/
registerEvents:function() {
@@ -5453,31 +5453,31 @@
"dblclick": this.ondblclick,
scope: this
});
-
+
},
- /**
- * Method: onmousedown
+ /**
+ * Method: onmousedown
* When mouse goes down within the popup, make a note of
- * it locally, and then do not propagate the mousedown
+ * it locally, and then do not propagate the mousedown
* (but do so safely so that user can select text inside)
- *
+ *
* Parameters:
- * evt - {Event}
+ * evt - {Event}
*/
onmousedown: function (evt) {
this.mousedown = true;
OpenLayers.Event.stop(evt, true);
},
- /**
+ /**
* Method: onmousemove
- * If the drag was started within the popup, then
+ * If the drag was started within the popup, then
* do not propagate the mousemove (but do so safely
* so that user can select text inside)
- *
+ *
* Parameters:
- * evt - {Event}
+ * evt - {Event}
*/
onmousemove: function (evt) {
if (this.mousedown) {
@@ -5485,15 +5485,15 @@
}
},
- /**
+ /**
* Method: onmouseup
- * When mouse comes up within the popup, after going down
- * in it, reset the flag, and then (once again) do not
- * propagate the event, but do so safely so that user can
+ * When mouse comes up within the popup, after going down
+ * in it, reset the flag, and then (once again) do not
+ * propagate the event, but do so safely so that user can
* select text inside
- *
+ *
* Parameters:
- * evt - {Event}
+ * evt - {Event}
*/
onmouseup: function (evt) {
if (this.mousedown) {
@@ -5505,32 +5505,32 @@
/**
* Method: onclick
* Ignore clicks, but allowing default browser handling
- *
+ *
* Parameters:
- * evt - {Event}
+ * evt - {Event}
*/
onclick: function (evt) {
OpenLayers.Event.stop(evt, true);
},
- /**
+ /**
* Method: onmouseout
* When mouse goes out of the popup set the flag to false so that
* if they let go and then drag back in, we won't be confused.
- *
+ *
* Parameters:
- * evt - {Event}
+ * evt - {Event}
*/
onmouseout: function (evt) {
this.mousedown = false;
},
-
- /**
+
+ /**
* Method: ondblclick
* Ignore double-clicks, but allowing default browser handling
- *
+ *
* Parameters:
- * evt - {Event}
+ * evt - {Event}
*/
ondblclick: function (evt) {
OpenLayers.Event.stop(evt, true);
@@ -5558,13 +5558,13 @@
* one of the protocol subclasses instead.
*/
OpenLayers.Protocol = OpenLayers.Class({
-
+
/**
* Property: format
* {} The format used by this protocol.
*/
format: null,
-
+
/**
* Property: options
* {Object} Any options sent to the constructor.
@@ -5578,7 +5578,7 @@
* true.
*/
autoDestroy: true,
-
+
/**
* Constructor: OpenLayers.Protocol
* Abstract class for vector protocols. Create instances of a subclass.
@@ -5601,7 +5601,7 @@
this.options = null;
this.format = null;
},
-
+
/**
* APIMethod: read
* Construct a request for reading new features.
@@ -5616,8 +5616,8 @@
*/
read: function() {
},
-
-
+
+
/**
* APIMethod: create
* Construct a request for writing newly created features.
@@ -5634,7 +5634,7 @@
*/
create: function() {
},
-
+
/**
* APIMethod: update
* Construct a request updating modified features.
@@ -5651,7 +5651,7 @@
*/
update: function() {
},
-
+
/**
* APIMethod: delete
* Construct a request deleting a removed feature.
@@ -5699,8 +5699,8 @@
*/
abort: function(response) {
},
-
- CLASS_NAME: "OpenLayers.Protocol"
+
+ CLASS_NAME: "OpenLayers.Protocol"
});
/**
@@ -5784,37 +5784,37 @@
* full text of the license. */
/**
- * Class: OpenLayers.Renderer
+ * Class: OpenLayers.Renderer
* This is the base class for all renderers.
*
* This is based on a merger code written by Paul Spencer and Bertil Chapuis.
* It is largely composed of virtual functions that are to be implemented
* in technology-specific subclasses, but there is some generic code too.
- *
+ *
* The functions that *are* implemented here merely deal with the maintenance
- * of the size and extent variables, as well as the cached 'resolution'
- * value.
- *
+ * of the size and extent variables, as well as the cached 'resolution'
+ * value.
+ *
* A note to the user that all subclasses should use getResolution() instead
- * of directly accessing this.resolution in order to correctly use the
+ * of directly accessing this.resolution in order to correctly use the
* cacheing system.
*
*/
OpenLayers.Renderer = OpenLayers.Class({
- /**
+ /**
* Property: container
- * {DOMElement}
+ * {DOMElement}
*/
container: null,
-
+
/**
* Property: root
* {DOMElement}
*/
root: null,
- /**
+ /**
* Property: extent
* {}
*/
@@ -5823,44 +5823,44 @@
/**
* Property: locked
* {Boolean} If the renderer is currently in a state where many things
- * are changing, the 'locked' property is set to true. This means
+ * are changing, the 'locked' property is set to true. This means
* that renderers can expect at least one more drawFeature event to be
* called with the 'locked' property set to 'true': In some renderers,
* this might make sense to use as a 'only update local information'
- * flag.
- */
+ * flag.
+ */
locked: false,
-
- /**
+
+ /**
* Property: size
- * {}
+ * {}
*/
size: null,
-
+
/**
* Property: resolution
* {Float} cache of current map resolution
*/
resolution: null,
-
+
/**
- * Property: map
+ * Property: map
* {} Reference to the map -- this is set in Vector's setMap()
*/
map: null,
-
+
/**
- * Constructor: OpenLayers.Renderer
+ * Constructor: OpenLayers.Renderer
*
* Parameters:
- * containerID - {}
+ * containerID - {}
* options - {Object} options for this renderer. See sublcasses for
* supported options.
*/
initialize: function(containerID, options) {
this.container = OpenLayers.Util.getElement(containerID);
},
-
+
/**
* APIMethod: destroy
*/
@@ -5875,20 +5875,20 @@
/**
* APIMethod: supported
* This should be overridden by specific subclasses
- *
+ *
* Returns:
* {Boolean} Whether or not the browser supports the renderer class
*/
supported: function() {
return false;
- },
-
+ },
+
/**
* Method: setExtent
* Set the visible part of the layer.
*
- * Resolution has probably changed, so we nullify the resolution
- * cache (this.resolution) -- this way it will be re-computed when
+ * Resolution has probably changed, so we nullify the resolution
+ * cache (this.resolution) -- this way it will be re-computed when
* next it is needed.
* We nullify the resolution cache (this.resolution) if resolutionChanged
* is set to true - this way it will be re-computed on the next
@@ -5904,27 +5904,27 @@
this.resolution = null;
}
},
-
+
/**
* Method: setSize
* Sets the size of the drawing surface.
- *
- * Resolution has probably changed, so we nullify the resolution
- * cache (this.resolution) -- this way it will be re-computed when
+ *
+ * Resolution has probably changed, so we nullify the resolution
+ * cache (this.resolution) -- this way it will be re-computed when
* next it is needed.
*
* Parameters:
- * size - {}
+ * size - {}
*/
setSize: function(size) {
this.size = size.clone();
this.resolution = null;
},
-
- /**
+
+ /**
* Method: getResolution
* Uses cached copy of resolution if available to minimize computing
- *
+ *
* Returns:
* The current map's resolution
*/
@@ -5932,7 +5932,7 @@
this.resolution = this.resolution || this.map.getResolution();
return this.resolution;
},
-
+
/**
* Method: drawFeature
* Draw the feature. The optional style argument can be used
@@ -5940,9 +5940,9 @@
* be called from layer.drawFeature().
*
* Parameters:
- * feature - {}
+ * feature - {}
* style - {