[fusion-commits] r1825 - trunk/lib/OpenLayers
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Fri Apr 3 10:46:08 EDT 2009
Author: madair
Date: 2009-04-03 10:46:07 -0400 (Fri, 03 Apr 2009)
New Revision: 1825
Modified:
trunk/lib/OpenLayers/OpenLayers.js
Log:
closes #238: error was due to OL regression in the Bounds.intersects() method that didn't pick up the overlapped but not contained case. OL at rev 9176
Modified: trunk/lib/OpenLayers/OpenLayers.js
===================================================================
--- trunk/lib/OpenLayers/OpenLayers.js 2009-04-01 15:09:35 UTC (rev 1824)
+++ trunk/lib/OpenLayers/OpenLayers.js 2009-04-03 14:46:07 UTC (rev 1825)
@@ -146,28 +146,22 @@
* {String} Path to this script
*/
_getScriptLocation: function () {
- var scriptLocation = "";
- var scriptName = OpenLayers._scriptName;
+ var scriptLocation = "";
+ var isOL = new RegExp("(^|(.*?\\/))(" + OpenLayers._scriptName + ")(\\?|$)");
var scripts = document.getElementsByTagName('script');
for (var i=0, len=scripts.length; i<len; i++) {
var src = scripts[i].getAttribute('src');
if (src) {
- var index = src.lastIndexOf(scriptName);
- // set path length for src up to a query string
- var pathLength = src.lastIndexOf('?');
- if (pathLength < 0) {
- pathLength = src.length;
- }
- // is it found, at the end of the URL?
- if ((index > -1) && (index + scriptName.length == pathLength)) {
- scriptLocation = src.slice(0, pathLength - scriptName.length);
+ var match = src.match(isOL);
+ if(match) {
+ scriptLocation = match[1];
break;
}
}
}
return scriptLocation;
- }
+ }
};
/**
* OpenLayers.singleFile is a flag indicating this file is being included
@@ -194,9 +188,9 @@
"Rico/Corner.js",
"Rico/Color.js",
"OpenLayers/Ajax.js",
+ "OpenLayers/Events.js",
"OpenLayers/Request.js",
"OpenLayers/Request/XMLHttpRequest.js",
- "OpenLayers/Events.js",
"OpenLayers/Projection.js",
"OpenLayers/Map.js",
"OpenLayers/Layer.js",
@@ -278,6 +272,7 @@
"OpenLayers/Control/SelectFeature.js",
"OpenLayers/Control/NavigationHistory.js",
"OpenLayers/Control/Measure.js",
+ "OpenLayers/Control/WMSGetFeatureInfo.js",
"OpenLayers/Geometry.js",
"OpenLayers/Geometry/Rectangle.js",
"OpenLayers/Geometry/Collection.js",
@@ -296,6 +291,7 @@
"OpenLayers/Renderer/Canvas.js",
"OpenLayers/Renderer/VML.js",
"OpenLayers/Layer/Vector.js",
+ "OpenLayers/Layer/Vector/RootContainer.js",
"OpenLayers/Strategy.js",
"OpenLayers/Strategy/Fixed.js",
"OpenLayers/Strategy/Cluster.js",
@@ -330,6 +326,8 @@
"OpenLayers/Format/GeoRSS.js",
"OpenLayers/Format/WFS.js",
"OpenLayers/Format/WFSDescribeFeatureType.js",
+ "OpenLayers/Format/WMSDescribeLayer.js",
+ "OpenLayers/Format/WMSDescribeLayer/v1_1.js",
"OpenLayers/Format/WKT.js",
"OpenLayers/Format/OSM.js",
"OpenLayers/Format/GPX.js",
@@ -1238,7 +1236,7 @@
if (precision == 0) {
number = parseFloat(number);
} else {
- number = parseFloat(parseFloat(number).toPrecision(precision))
+ number = parseFloat(parseFloat(number).toPrecision(precision));
}
return number;
};
@@ -2885,15 +2883,19 @@
if(typeof arguments[i] == "function") {
// make the class passed as the first argument the superclass
if(i == 0 && len > 1) {
+ initialize = arguments[i].prototype.initialize;
// replace the initialize method with an empty function,
// because we do not want to create a real instance here
- initialize = arguments[i].prototype.initialize;
arguments[i].prototype.initialize = function() {};
// the line below makes sure that the new class has a
// superclass
extended = new arguments[i];
// restore the original initialize method
- arguments[i].prototype.initialize = initialize;
+ if(initialize === undefined) {
+ delete arguments[i].prototype.initialize;
+ } else {
+ arguments[i].prototype.initialize = initialize;
+ }
}
// get the prototype of the superclass
parent = arguments[i].prototype;
@@ -3457,59 +3459,67 @@
},
/**
- * APIMethod: touchesBounds
- *
- * Parameters:
- * bounds - {<OpenLayers.Bounds>}
- *
- * Returns:
- * {Boolean} The passed-in OpenLayers.Bounds object touches this bounds
- * at a single edge, and therefore do not inclusively intersect.
- */
- touchesBounds:function(bounds) {
- return (this.left == bounds.right ||
- this.right == bounds.left ||
- this.top == bounds.bottom ||
- this.bottom == bounds.top);
- },
-
- /**
* APIMethod: intersectsBounds
+ * 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 - {<OpenLayers.Bounds>}
- * inclusive - {Boolean} Whether or not to include the border. Default
- * is true.
+ * bounds - {<OpenLayers.Bounds>} The target bounds.
+ * inclusive - {Boolean} Treat coincident borders as intersecting. Default
+ * is true. If false, bounds that do not overlap but only touch at the
+ * border will not be considered as intersecting.
*
* Returns:
- * {Boolean} The passed-in OpenLayers.Bounds object intersects this bounds.
- * Simple math just check if either contains the other, allowing for
- * partial.
+ * {Boolean} The passed-in bounds object intersects this bounds.
*/
intersectsBounds:function(bounds, inclusive) {
if (inclusive == null) {
inclusive = true;
}
var intersects = false;
+ var mightTouch = (
+ this.left == bounds.right ||
+ this.right == bounds.left ||
+ 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 || !this.touchesBounds(bounds)) {
+ if (inclusive || !mightTouch) {
// otherwise, if one of the boundaries even partially contains another,
// inclusive of the edges, then they do intersect.
- intersects = this.containsBounds(bounds, true, true) ||
- bounds.containsBounds(this, true, true);
+ var inBottom = (
+ ((bounds.bottom >= this.bottom) && (bounds.bottom <= this.top)) ||
+ ((this.bottom >= bounds.bottom) && (this.bottom <= bounds.top))
+ );
+ var inTop = (
+ ((bounds.top >= this.bottom) && (bounds.top <= this.top)) ||
+ ((this.top > bounds.bottom) && (this.top < bounds.top))
+ );
+ var inLeft = (
+ ((bounds.left >= this.left) && (bounds.left <= this.right)) ||
+ ((this.left >= bounds.left) && (this.left <= bounds.right))
+ );
+ var inRight = (
+ ((bounds.right >= this.left) && (bounds.right <= this.right)) ||
+ ((this.right >= bounds.left) && (this.right <= bounds.right))
+ );
+ intersects = ((inBottom || inTop) && (inLeft || inRight));
}
return intersects;
},
/**
* APIMethod: containsBounds
+ * Determine whether the target bounds is contained within this bounds.
*
- * bounds - {<OpenLayers.Bounds>}
- * partial - {Boolean} If true, only part of passed-in bounds needs be
- * within this bounds. If false, the entire passed-in bounds must be
- * within. Default is false
- * inclusive - {Boolean} Whether or not to include the border. Default is
+ * bounds - {<OpenLayers.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
+ * entire target bounds must be contained within this bounds.
+ * inclusive - {Boolean} Treat shared edges as contained. Default is
* true.
*
* Returns:
@@ -4674,6 +4684,20 @@
* Default is false.
*/
panMapIfOutOfView: false,
+
+ /**
+ * 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,
/**
* APIProperty: closeOnMove
@@ -5244,22 +5268,44 @@
// is bigger than the map's viewport.
//
if (this.map && this.map.size) {
-
- // Note that there *was* a reference to a
- // 'OpenLayers.Popup.SCROLL_BAR_WIDTH' constant here, with special
- // tolerance for it and everything... but it was never defined in
- // the first place, so I don't know what to think.
+
+ var extraX = 0, extraY = 0;
+ if (this.keepInMap && !this.panMapIfOutOfView) {
+ var px = this.map.getPixelFromLonLat(this.lonlat);
+ switch (this.relativePosition) {
+ case "tr":
+ extraX = px.x;
+ extraY = this.map.size.h - px.y;
+ break;
+ case "tl":
+ extraX = this.map.size.w - px.x;
+ extraY = this.map.size.h - px.y;
+ break;
+ case "bl":
+ extraX = this.map.size.w - px.x;
+ extraY = px.y;
+ break;
+ case "br":
+ extraX = px.x;
+ extraY = px.y;
+ break;
+ 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 -
- hPadding;
-
+ hPadding - extraY;
+
var maxX = this.map.size.w -
this.map.paddingForPopups.left -
this.map.paddingForPopups.right -
- wPadding;
-
+ wPadding - extraX;
+
safeContentSize.w = Math.min(safeContentSize.w, maxX);
safeContentSize.h = Math.min(safeContentSize.h, maxY);
}
@@ -5538,6 +5584,12 @@
*/
container: null,
+ /**
+ * Property: root
+ * {DOMElement}
+ */
+ root: null,
+
/**
* Property: extent
* {<OpenLayers.Bounds>}
@@ -5748,304 +5800,33 @@
* geometry - {<OpenLayers.Geometry>}
*/
eraseGeometry: function(geometry) {},
-
- CLASS_NAME: "OpenLayers.Renderer"
-});
-/* ======================================================================
- OpenLayers/Request.js
- ====================================================================== */
-
-/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD
- * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the
- * full text of the license. */
-
-/**
- * Namespace: OpenLayers.Request
- * The OpenLayers.Request namespace contains convenience methods for working
- * with XMLHttpRequests. These methods work with a cross-browser
- * W3C compliant <OpenLayers.Request.XMLHttpRequest> class.
- */
-OpenLayers.Request = {
/**
- * Constant: DEFAULT_CONFIG
- * {Object} Default configuration for all requests.
- */
- DEFAULT_CONFIG: {
- method: "GET",
- url: window.location.href,
- async: true,
- user: undefined,
- password: undefined,
- params: null,
- proxy: OpenLayers.ProxyHost,
- headers: {},
- data: null,
- callback: function() {},
- success: null,
- failure: null,
- scope: null
- },
-
- /**
- * APIMethod: issue
- * Create a new XMLHttpRequest object, open it, set any headers, bind
- * a callback to done state, and send any data. It is recommended that
- * you use one <GET>, <POST>, <PUT>, <DELETE>, <OPTIONS>, or <HEAD>.
- * This method is only documented to provide detail on the configuration
- * options available to all request methods.
- *
+ * Method: moveRoot
+ * moves this renderer's root to a (different) renderer.
+ * To be implemented by subclasses that require a common renderer root for
+ * feature selection.
+ *
* Parameters:
- * config - {Object} Object containing properties for configuring the
- * request. Allowed configuration properties are described below.
- * This object is modified and should not be reused.
- *
- * Allowed config properties:
- * method - {String} One of GET, POST, PUT, DELETE, HEAD, or
- * OPTIONS. Default is GET.
- * url - {String} URL for the request.
- * async - {Boolean} Open an asynchronous request. Default is true.
- * user - {String} User for relevant authentication scheme. Set
- * to null to clear current user.
- * password - {String} Password for relevant authentication scheme.
- * Set to null to clear current password.
- * proxy - {String} Optional proxy. Defaults to
- * <OpenLayers.ProxyHost>.
- * params - {Object} Any key:value pairs to be appended to the
- * url as a query string. Assumes url doesn't already include a query
- * string or hash. Typically, this is only appropriate for <GET>
- * requests where the query string will be appended to the url.
- * Parameter values that are arrays will be
- * concatenated with a comma (note that this goes against form-encoding)
- * as is done with <OpenLayers.Util.getParameterString>.
- * headers - {Object} Object with header:value pairs to be set on
- * the request.
- * data - {String | Document} Optional data to send with the request.
- * Typically, this is only used with <POST> and <PUT> requests.
- * Make sure to provide the appropriate "Content-Type" header for your
- * data. For <POST> and <PUT> requests, the content type defaults to
- * "application-xml". If your data is a different content type, or
- * if you are using a different HTTP method, set the "Content-Type"
- * header to match your data type.
- * callback - {Function} Function to call when request is done.
- * To determine if the request failed, check request.status (200
- * indicates success).
- * success - {Function} Optional function to call if request status is in
- * the 200s. This will be called in addition to callback above and
- * would typically only be used as an alternative.
- * failure - {Function} Optional function to call if request status is not
- * in the 200s. This will be called in addition to callback above and
- * would typically only be used as an alternative.
- * scope - {Object} If callback is a public method on some object,
- * set the scope to that object.
- *
- * Returns:
- * {XMLHttpRequest} Request object. To abort the request before a response
- * is received, call abort() on the request object.
+ * renderer - {<OpenLayers.Renderer>} target renderer for the moved root
*/
- issue: function(config) {
- // apply default config - proxy host may have changed
- var defaultConfig = OpenLayers.Util.extend(
- this.DEFAULT_CONFIG,
- {proxy: OpenLayers.ProxyHost}
- );
- config = OpenLayers.Util.applyDefaults(config, defaultConfig);
+ moveRoot: function(renderer) {},
- // create request, open, and set headers
- var request = new OpenLayers.Request.XMLHttpRequest();
- var url = config.url;
- if(config.params) {
- var paramString = OpenLayers.Util.getParameterString(config.params);
- if(paramString.length > 0) {
- var separator = (url.indexOf('?') > -1) ? '&' : '?';
- url += separator + paramString;
- }
- }
- if(config.proxy && (url.indexOf("http") == 0)) {
- url = config.proxy + encodeURIComponent(url);
- }
- request.open(
- config.method, url, config.async, config.user, config.password
- );
- for(var header in config.headers) {
- request.setRequestHeader(header, config.headers[header]);
- }
-
- // bind callbacks to readyState 4 (done)
- var complete = (config.scope) ?
- OpenLayers.Function.bind(config.callback, config.scope) :
- config.callback;
-
- // optional success callback
- var success;
- if(config.success) {
- success = (config.scope) ?
- OpenLayers.Function.bind(config.success, config.scope) :
- config.success;
- }
-
- // optional failure callback
- var failure;
- if(config.failure) {
- failure = (config.scope) ?
- OpenLayers.Function.bind(config.failure, config.scope) :
- config.failure;
- }
-
- request.onreadystatechange = function() {
- if(request.readyState == OpenLayers.Request.XMLHttpRequest.DONE) {
- complete(request);
- if(success && (!request.status ||
- (request.status >= 200 && request.status < 300))) {
- success(request);
- }
- if(failure && (request.status &&
- (request.status < 200 || request.status >= 300))) {
- failure(request);
- }
- }
- };
-
- // send request (optionally with data) and return
- // call in a timeout for asynchronous requests so the return is
- // available before readyState == 4 for cached docs
- if(config.async === false) {
- request.send(config.data);
- } else {
- window.setTimeout(function(){
- request.send(config.data);
- }, 0);
- }
- return request;
- },
-
/**
- * APIMethod: GET
- * Send an HTTP GET request. Additional configuration properties are
- * documented in the <issue> method, with the method property set
- * to GET.
- *
- * Parameters:
- * config - {Object} Object with properties for configuring the request.
- * See the <issue> method for documentation of allowed properties.
- * This object is modified and should not be reused.
+ * Method: getRenderLayerId
+ * Gets the layer that this renderer's output appears on. If moveRoot was
+ * used, this will be different from the id of the layer containing the
+ * features rendered by this renderer.
*
* Returns:
- * {XMLHttpRequest} Request object.
+ * {String} the id of the output layer.
*/
- GET: function(config) {
- config = OpenLayers.Util.extend(config, {method: "GET"});
- return OpenLayers.Request.issue(config);
+ getRenderLayerId: function() {
+ return this.container.id;
},
-
- /**
- * APIMethod: POST
- * Send a POST request. Additional configuration properties are
- * documented in the <issue> method, with the method property set
- * to POST and "Content-Type" header set to "application/xml".
- *
- * Parameters:
- * config - {Object} Object with properties for configuring the request.
- * See the <issue> method for documentation of allowed properties. The
- * default "Content-Type" header will be set to "application-xml" if
- * none is provided. This object is modified and should not be reused.
- *
- * Returns:
- * {XMLHttpRequest} Request object.
- */
- POST: function(config) {
- config = OpenLayers.Util.extend(config, {method: "POST"});
- // set content type to application/xml if it isn't already set
- config.headers = config.headers ? config.headers : {};
- if(!("CONTENT-TYPE" in OpenLayers.Util.upperCaseObject(config.headers))) {
- config.headers["Content-Type"] = "application/xml";
- }
- return OpenLayers.Request.issue(config);
- },
-
- /**
- * APIMethod: PUT
- * Send an HTTP PUT request. Additional configuration properties are
- * documented in the <issue> method, with the method property set
- * to PUT and "Content-Type" header set to "application/xml".
- *
- * Parameters:
- * config - {Object} Object with properties for configuring the request.
- * See the <issue> method for documentation of allowed properties. The
- * default "Content-Type" header will be set to "application-xml" if
- * none is provided. This object is modified and should not be reused.
- *
- * Returns:
- * {XMLHttpRequest} Request object.
- */
- PUT: function(config) {
- config = OpenLayers.Util.extend(config, {method: "PUT"});
- // set content type to application/xml if it isn't already set
- config.headers = config.headers ? config.headers : {};
- if(!("CONTENT-TYPE" in OpenLayers.Util.upperCaseObject(config.headers))) {
- config.headers["Content-Type"] = "application/xml";
- }
- return OpenLayers.Request.issue(config);
- },
-
- /**
- * APIMethod: DELETE
- * Send an HTTP DELETE request. Additional configuration properties are
- * documented in the <issue> method, with the method property set
- * to DELETE.
- *
- * Parameters:
- * config - {Object} Object with properties for configuring the request.
- * See the <issue> method for documentation of allowed properties.
- * This object is modified and should not be reused.
- *
- * Returns:
- * {XMLHttpRequest} Request object.
- */
- DELETE: function(config) {
- config = OpenLayers.Util.extend(config, {method: "DELETE"});
- return OpenLayers.Request.issue(config);
- },
-
- /**
- * APIMethod: HEAD
- * Send an HTTP HEAD request. Additional configuration properties are
- * documented in the <issue> method, with the method property set
- * to HEAD.
- *
- * Parameters:
- * config - {Object} Object with properties for configuring the request.
- * See the <issue> method for documentation of allowed properties.
- * This object is modified and should not be reused.
- *
- * Returns:
- * {XMLHttpRequest} Request object.
- */
- HEAD: function(config) {
- config = OpenLayers.Util.extend(config, {method: "HEAD"});
- return OpenLayers.Request.issue(config);
- },
-
- /**
- * APIMethod: OPTIONS
- * Send an HTTP OPTIONS request. Additional configuration properties are
- * documented in the <issue> method, with the method property set
- * to OPTIONS.
- *
- * Parameters:
- * config - {Object} Object with properties for configuring the request.
- * See the <issue> method for documentation of allowed properties.
- * This object is modified and should not be reused.
- *
- * Returns:
- * {XMLHttpRequest} Request object.
- */
- OPTIONS: function(config) {
- config = OpenLayers.Util.extend(config, {method: "OPTIONS"});
- return OpenLayers.Request.issue(config);
- }
-};
+ CLASS_NAME: "OpenLayers.Renderer"
+});
/* ======================================================================
OpenLayers/Control.js
====================================================================== */
@@ -6197,14 +5978,14 @@
* properties of this event depends on exactly what happened.
*
* All event objects have at least the following properties:
- * - *object* {Object} A reference to control.events.object (a reference
+ * object - {Object} A reference to control.events.object (a reference
* to the control).
- * - *element* {DOMElement} A reference to control.events.element (which
+ * element - {DOMElement} A reference to control.events.element (which
* will be null unless documented otherwise).
*
* Supported map event types:
- * - *activate* Triggered when activated.
- * - *deactivate* Triggered when deactivated.
+ * activate - Triggered when activated.
+ * deactivate - Triggered when deactivated.
*/
EVENT_TYPES: ["activate", "deactivate"],
@@ -6550,6 +6331,20 @@
* {String} Relative position of the popup ("br", "tr", "tl" or "bl").
*/
relativePosition: null,
+
+ /**
+ * 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 set. 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.
+ *
+ * For anchored popups, default is true, since subclasses will
+ * usually want this functionality.
+ */
+ keepInMap: true,
/**
* Parameter: anchor
@@ -6732,12 +6527,6 @@
OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, {
/**
- * Property: root
- * {DOMElement} root element of canvas.
- */
- root: null,
-
- /**
* Property: canvas
* {Canvas} The canvas context object.
*/
@@ -6912,6 +6701,10 @@
drawExternalGraphic: function(pt, style) {
var img = new Image();
img.src = style.externalGraphic;
+
+ if(style.graphicTitle) {
+ img.title=style.graphicTitle;
+ }
var width = style.graphicWidth || style.graphicHeight;
var height = style.graphicHeight || style.graphicWidth;
@@ -7531,12 +7324,6 @@
rendererRoot: null,
/**
- * Property: root
- * {DOMElement}
- */
- root: null,
-
- /**
* Property: xmlns
* {String}
*/
@@ -8133,6 +7920,35 @@
createNode: function(type, id) {},
/**
+ * Method: moveRoot
+ * moves this renderer's root to a different renderer.
+ *
+ * Parameters:
+ * renderer - {<OpenLayers.Renderer>} target renderer for the moved root
+ */
+ moveRoot: function(renderer) {
+ var root = this.root;
+ if(renderer.root.parentNode == this.rendererRoot) {
+ root = renderer.root;
+ }
+ root.parentNode.removeChild(root);
+ renderer.rendererRoot.appendChild(root);
+ },
+
+ /**
+ * Method: getRenderLayerId
+ * Gets the layer that this renderer's output appears on. If moveRoot was
+ * used, this will be different from the id of the layer containing the
+ * features rendered by this renderer.
+ *
+ * Returns:
+ * {String} the id of the output layer.
+ */
+ getRenderLayerId: function() {
+ return this.root.parentNode.parentNode.id;
+ },
+
+ /**
* Method: isComplexSymbol
* Determines if a symbol cannot be rendered using drawCircle
*
@@ -8164,323 +7980,6 @@
"triangle": [0,10, 10,10, 5,0, 0,10]
};
/* ======================================================================
- OpenLayers/Request/XMLHttpRequest.js
- ====================================================================== */
-
-// Copyright 2007 Sergey Ilinsky (http://www.ilinsky.com)
-//
-// 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
-//
-// 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.
-
-/**
- * @requires OpenLayers/Request.js
- */
-
-(function () {
-
- // Save reference to earlier defined object implementation (if any)
- var oXMLHttpRequest = window.XMLHttpRequest;
-
- // Define on browser type
- var bGecko = !!window.controllers,
- bIE = window.document.all && !window.opera;
-
- // Constructor
- function cXMLHttpRequest() {
- this._object = oXMLHttpRequest ? new oXMLHttpRequest : new window.ActiveXObject('Microsoft.XMLHTTP');
- };
-
- // BUGFIX: Firefox with Firebug installed would break pages if not executed
- if (bGecko && oXMLHttpRequest.wrapped)
- cXMLHttpRequest.wrapped = oXMLHttpRequest.wrapped;
-
- // Constants
- cXMLHttpRequest.UNSENT = 0;
- cXMLHttpRequest.OPENED = 1;
- cXMLHttpRequest.HEADERS_RECEIVED = 2;
- cXMLHttpRequest.LOADING = 3;
- cXMLHttpRequest.DONE = 4;
-
- // Public Properties
- cXMLHttpRequest.prototype.readyState = cXMLHttpRequest.UNSENT;
- cXMLHttpRequest.prototype.responseText = "";
- cXMLHttpRequest.prototype.responseXML = null;
- cXMLHttpRequest.prototype.status = 0;
- cXMLHttpRequest.prototype.statusText = "";
-
- // Instance-level Events Handlers
- cXMLHttpRequest.prototype.onreadystatechange = null;
-
- // Class-level Events Handlers
- cXMLHttpRequest.onreadystatechange = null;
- cXMLHttpRequest.onopen = null;
- cXMLHttpRequest.onsend = null;
- cXMLHttpRequest.onabort = null;
-
- // Public Methods
- cXMLHttpRequest.prototype.open = function(sMethod, sUrl, bAsync, sUser, sPassword) {
-
- // Save async parameter for fixing Gecko bug with missing readystatechange in synchronous requests
- this._async = bAsync;
-
- // Set the onreadystatechange handler
- var oRequest = this,
- nState = this.readyState;
-
- // BUGFIX: IE - memory leak on page unload (inter-page leak)
- if (bIE) {
- var fOnUnload = function() {
- if (oRequest._object.readyState != cXMLHttpRequest.DONE)
- fCleanTransport(oRequest);
- };
- if (bAsync)
- window.attachEvent("onunload", fOnUnload);
- }
-
- this._object.onreadystatechange = function() {
- if (bGecko && !bAsync)
- return;
-
- // Synchronize state
- oRequest.readyState = oRequest._object.readyState;
-
- //
- fSynchronizeValues(oRequest);
-
- // BUGFIX: Firefox fires unneccesary DONE when aborting
- if (oRequest._aborted) {
- // Reset readyState to UNSENT
- oRequest.readyState = cXMLHttpRequest.UNSENT;
-
- // Return now
- return;
- }
-
- if (oRequest.readyState == cXMLHttpRequest.DONE) {
- //
- fCleanTransport(oRequest);
-// Uncomment this block if you need a fix for IE cache
-/*
- // BUGFIX: IE - cache issue
- if (!oRequest._object.getResponseHeader("Date")) {
- // Save object to cache
- oRequest._cached = oRequest._object;
-
- // Instantiate a new transport object
- cXMLHttpRequest.call(oRequest);
-
- // Re-send request
- oRequest._object.open(sMethod, sUrl, bAsync, sUser, sPassword);
- oRequest._object.setRequestHeader("If-Modified-Since", oRequest._cached.getResponseHeader("Last-Modified") || new window.Date(0));
- // Copy headers set
- if (oRequest._headers)
- for (var sHeader in oRequest._headers)
- if (typeof oRequest._headers[sHeader] == "string") // Some frameworks prototype objects with functions
- oRequest._object.setRequestHeader(sHeader, oRequest._headers[sHeader]);
-
- oRequest._object.onreadystatechange = function() {
- // Synchronize state
- oRequest.readyState = oRequest._object.readyState;
-
- if (oRequest._aborted) {
- //
- oRequest.readyState = cXMLHttpRequest.UNSENT;
-
- // Return
- return;
- }
-
- if (oRequest.readyState == cXMLHttpRequest.DONE) {
- // Clean Object
- fCleanTransport(oRequest);
-
- // get cached request
- if (oRequest.status == 304)
- oRequest._object = oRequest._cached;
-
- //
- delete oRequest._cached;
-
- //
- fSynchronizeValues(oRequest);
-
- //
- fReadyStateChange(oRequest);
-
- // BUGFIX: IE - memory leak in interrupted
- if (bIE && bAsync)
- window.detachEvent("onunload", fOnUnload);
- }
- };
- oRequest._object.send(null);
-
- // Return now - wait untill re-sent request is finished
- return;
- };
-*/
- // BUGFIX: IE - memory leak in interrupted
- if (bIE && bAsync)
- window.detachEvent("onunload", fOnUnload);
- }
-
- // BUGFIX: Some browsers (Internet Explorer, Gecko) fire OPEN readystate twice
- if (nState != oRequest.readyState)
- fReadyStateChange(oRequest);
-
- nState = oRequest.readyState;
- };
-
- // Add method sniffer
- if (cXMLHttpRequest.onopen)
- cXMLHttpRequest.onopen.apply(this, arguments);
-
- this._object.open(sMethod, sUrl, bAsync, sUser, sPassword);
-
- // BUGFIX: Gecko - missing readystatechange calls in synchronous requests
- if (!bAsync && bGecko) {
- this.readyState = cXMLHttpRequest.OPENED;
-
- fReadyStateChange(this);
- }
- };
- cXMLHttpRequest.prototype.send = function(vData) {
- // Add method sniffer
- if (cXMLHttpRequest.onsend)
- cXMLHttpRequest.onsend.apply(this, arguments);
-
- // BUGFIX: Safari - fails sending documents created/modified dynamically, so an explicit serialization required
- // BUGFIX: IE - rewrites any custom mime-type to "text/xml" in case an XMLNode is sent
- // BUGFIX: Gecko - fails sending Element (this is up to the implementation either to standard)
- if (vData && vData.nodeType) {
- vData = window.XMLSerializer ? new window.XMLSerializer().serializeToString(vData) : vData.xml;
- if (!this._headers["Content-Type"])
- this._object.setRequestHeader("Content-Type", "application/xml");
- }
-
- this._object.send(vData);
-
- // BUGFIX: Gecko - missing readystatechange calls in synchronous requests
- if (bGecko && !this._async) {
- this.readyState = cXMLHttpRequest.OPENED;
-
- // Synchronize state
- fSynchronizeValues(this);
-
- // Simulate missing states
- while (this.readyState < cXMLHttpRequest.DONE) {
- this.readyState++;
- fReadyStateChange(this);
- // Check if we are aborted
- if (this._aborted)
- return;
- }
- }
- };
- cXMLHttpRequest.prototype.abort = function() {
- // Add method sniffer
- if (cXMLHttpRequest.onabort)
- cXMLHttpRequest.onabort.apply(this, arguments);
-
- // BUGFIX: Gecko - unneccesary DONE when aborting
- if (this.readyState > cXMLHttpRequest.UNSENT)
- this._aborted = true;
-
- this._object.abort();
-
- // BUGFIX: IE - memory leak
- fCleanTransport(this);
- };
- cXMLHttpRequest.prototype.getAllResponseHeaders = function() {
- return this._object.getAllResponseHeaders();
- };
- cXMLHttpRequest.prototype.getResponseHeader = function(sName) {
- return this._object.getResponseHeader(sName);
- };
- cXMLHttpRequest.prototype.setRequestHeader = function(sName, sValue) {
- // BUGFIX: IE - cache issue
- if (!this._headers)
- this._headers = {};
- this._headers[sName] = sValue;
-
- return this._object.setRequestHeader(sName, sValue);
- };
- cXMLHttpRequest.prototype.toString = function() {
- return '[' + "object" + ' ' + "XMLHttpRequest" + ']';
- };
- cXMLHttpRequest.toString = function() {
- return '[' + "XMLHttpRequest" + ']';
- };
-
- // Helper function
- function fReadyStateChange(oRequest) {
- // Execute onreadystatechange
- if (oRequest.onreadystatechange)
- oRequest.onreadystatechange.apply(oRequest);
-
- // Sniffing code
- if (cXMLHttpRequest.onreadystatechange)
- cXMLHttpRequest.onreadystatechange.apply(oRequest);
- };
-
- function fGetDocument(oRequest) {
- var oDocument = oRequest.responseXML;
- // Try parsing responseText
- if (bIE && oDocument && !oDocument.documentElement && oRequest.getResponseHeader("Content-Type").match(/[^\/]+\/[^\+]+\+xml/)) {
- oDocument = new ActiveXObject('Microsoft.XMLDOM');
- oDocument.loadXML(oRequest.responseText);
- }
- // Check if there is no error in document
- if (oDocument)
- if ((bIE && oDocument.parseError != 0) || (oDocument.documentElement && oDocument.documentElement.tagName == "parsererror"))
- return null;
- return oDocument;
- };
-
- function fSynchronizeValues(oRequest) {
- try { oRequest.responseText = oRequest._object.responseText; } catch (e) {}
- try { oRequest.responseXML = fGetDocument(oRequest._object); } catch (e) {}
- try { oRequest.status = oRequest._object.status; } catch (e) {}
- try { oRequest.statusText = oRequest._object.statusText; } catch (e) {}
- };
-
- function fCleanTransport(oRequest) {
- // BUGFIX: IE - memory leak (on-page leak)
- oRequest._object.onreadystatechange = new window.Function;
-
- // Delete private properties
- delete oRequest._headers;
- };
-
- // Internet Explorer 5.0 (missing apply)
- if (!window.Function.prototype.apply) {
- window.Function.prototype.apply = function(oRequest, oArguments) {
- if (!oArguments)
- oArguments = [];
- oRequest.__func = this;
- oRequest.__func(oArguments[0], oArguments[1], oArguments[2], oArguments[3], oArguments[4]);
- delete oRequest.__func;
- };
- };
-
- // Register new object with window
- /**
- * Class: OpenLayers.Request.XMLHttpRequest
- * Standard-compliant (W3C) cross-browser implementation of the
- * XMLHttpRequest object. From
- * http://code.google.com/p/xmlhttprequest/.
- */
- OpenLayers.Request.XMLHttpRequest = cXMLHttpRequest;
-})();
-/* ======================================================================
OpenLayers/Tween.js
====================================================================== */
@@ -8807,687 +8306,6 @@
CLASS_NAME: "OpenLayers.Easing.Quad"
};
/* ======================================================================
- OpenLayers/Ajax.js
- ====================================================================== */
-
-/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD
- * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the
- * full text of the license. */
-
-/**
- * @requires OpenLayers/Request/XMLHttpRequest.js
- * @requires OpenLayers/Console.js
- */
-
-OpenLayers.ProxyHost = "";
-//OpenLayers.ProxyHost = "examples/proxy.cgi?url=";
-
-/**
- * Ajax reader for OpenLayers
- *
- * @uri url to do remote XML http get
- * @param {String} 'get' format params (x=y&a=b...)
- * @who object to handle callbacks for this request
- * @complete the function to be called on success
- * @failure the function to be called on failure
- *
- * example usage from a caller:
- *
- * caps: function(request) {
- * -blah-
- * },
- *
- * OpenLayers.loadURL(url,params,this,caps);
- *
- * Notice the above example does not provide an error handler; a default empty
- * handler is provided which merely logs the error if a failure handler is not
- * supplied
- *
- */
-
-
-/**
- * Function: OpenLayers.nullHandler
- * @param {} request
- */
-OpenLayers.nullHandler = function(request) {
- OpenLayers.Console.userError(OpenLayers.i18n("unhandledRequest", {'statusText':request.statusText}));
-};
-
-/**
- * APIFunction: loadURL
- * Background load a document. For more flexibility in using XMLHttpRequest,
- * see the <OpenLayers.Request> methods.
- *
- * Parameters:
- * uri - {String} URI of source doc
- * params - {String} or {Object} GET params. Either a string in the form
- * "?hello=world&foo=bar" (do not forget the leading question mark)
- * or an object in the form {'hello': 'world', 'foo': 'bar}
- * caller - {Object} object which gets callbacks
- * onComplete - {Function} Optional callback for success. The callback
- * will be called with this set to caller and will receive the request
- * object as an argument. Note that if you do not specify an onComplete
- * function, <OpenLayers.nullHandler> will be called (which pops up a
- * user friendly error message dialog).
- * onFailure - {Function} Optional callback for failure. In the event of
- * a failure, the callback will be called with this set to caller and will
- * receive the request object as an argument. Note that if you do not
- * specify an onComplete function, <OpenLayers.nullHandler> will be called
- * (which pops up a user friendly error message dialog).
- *
- * Returns:
- * {<OpenLayers.Request.XMLHttpRequest>} The request object. To abort loading,
- * call request.abort().
- */
-OpenLayers.loadURL = function(uri, params, caller,
- onComplete, onFailure) {
-
- if(typeof params == 'string') {
- params = OpenLayers.Util.getParameters(params);
- }
- var success = (onComplete) ? onComplete : OpenLayers.nullHandler;
- var failure = (onFailure) ? onFailure : OpenLayers.nullHandler;
-
- return OpenLayers.Request.GET({
- url: uri, params: params,
- success: success, failure: failure, scope: caller
- });
-};
-
-/**
- * Function: parseXMLString
- * Parse XML into a doc structure
- *
- * Parameters:
- * text - {String}
- *
- * Returns:
- * {?} Parsed AJAX Responsev
- */
-OpenLayers.parseXMLString = function(text) {
-
- //MS sucks, if the server is bad it dies
- var index = text.indexOf('<');
- if (index > 0) {
- text = text.substring(index);
- }
-
- var ajaxResponse = OpenLayers.Util.Try(
- function() {
- var xmldom = new ActiveXObject('Microsoft.XMLDOM');
- xmldom.loadXML(text);
- return xmldom;
- },
- function() {
- return new DOMParser().parseFromString(text, 'text/xml');
- },
- function() {
- var req = new XMLHttpRequest();
- req.open("GET", "data:" + "text/xml" +
- ";charset=utf-8," + encodeURIComponent(text), false);
- if (req.overrideMimeType) {
- req.overrideMimeType("text/xml");
- }
- req.send(null);
- return req.responseXML;
- }
- );
-
- return ajaxResponse;
-};
-
-
-/**
- * Namespace: OpenLayers.Ajax
- */
-OpenLayers.Ajax = {
-
- /**
- * Method: emptyFunction
- */
- emptyFunction: function () {},
-
- /**
- * Method: getTransport
- *
- * Returns:
- * {Object} Transport mechanism for whichever browser we're in, or false if
- * none available.
- */
- getTransport: function() {
- return OpenLayers.Util.Try(
- function() {return new XMLHttpRequest();},
- function() {return new ActiveXObject('Msxml2.XMLHTTP');},
- function() {return new ActiveXObject('Microsoft.XMLHTTP');}
- ) || false;
- },
-
- /**
- * Property: activeRequestCount
- * {Integer}
- */
- activeRequestCount: 0
-};
-
-/**
- * Namespace: OpenLayers.Ajax.Responders
- * {Object}
- */
-OpenLayers.Ajax.Responders = {
-
- /**
- * Property: responders
- * {Array}
- */
- responders: [],
-
- /**
- * Method: register
- *
- * Parameters:
- * responderToAdd - {?}
- */
- register: function(responderToAdd) {
- for (var i = 0; i < this.responders.length; i++){
- if (responderToAdd == this.responders[i]){
- return;
- }
- }
- this.responders.push(responderToAdd);
- },
-
- /**
- * Method: unregister
- *
- * Parameters:
- * responderToRemove - {?}
- */
- unregister: function(responderToRemove) {
- OpenLayers.Util.removeItem(this.reponders, responderToRemove);
- },
-
- /**
- * Method: dispatch
- *
- * Parameters:
- * callback - {?}
- * request - {?}
- * transport - {?}
- */
- dispatch: function(callback, request, transport) {
- var responder;
- for (var i = 0; i < this.responders.length; i++) {
- responder = this.responders[i];
-
- if (responder[callback] &&
- typeof responder[callback] == 'function') {
- try {
- responder[callback].apply(responder,
- [request, transport]);
- } catch (e) {}
- }
- }
- }
-};
-
-OpenLayers.Ajax.Responders.register({
- /**
- * Function: onCreate
- */
- onCreate: function() {
- OpenLayers.Ajax.activeRequestCount++;
- },
-
- /**
- * Function: onComplete
- */
- onComplete: function() {
- OpenLayers.Ajax.activeRequestCount--;
- }
-});
-
-/**
- * Class: OpenLayers.Ajax.Base
- */
-OpenLayers.Ajax.Base = OpenLayers.Class({
-
- /**
- * Constructor: OpenLayers.Ajax.Base
- *
- * Parameters:
- * options - {Object}
- */
- initialize: function(options) {
- this.options = {
- method: 'post',
- asynchronous: true,
- contentType: 'application/xml',
- parameters: ''
- };
- OpenLayers.Util.extend(this.options, options || {});
-
- this.options.method = this.options.method.toLowerCase();
-
- if (typeof this.options.parameters == 'string') {
- this.options.parameters =
- OpenLayers.Util.getParameters(this.options.parameters);
- }
- }
-});
-
-/**
- * Class: OpenLayers.Ajax.Request
- * *Deprecated*. Use <OpenLayers.Request> method instead.
- *
- * Inherit:
- * - <OpenLayers.Ajax.Base>
- */
-OpenLayers.Ajax.Request = OpenLayers.Class(OpenLayers.Ajax.Base, {
-
- /**
- * Property: _complete
- *
- * {Boolean}
- */
- _complete: false,
-
- /**
- * Constructor: OpenLayers.Ajax.Request
- *
- * Parameters:
- * url - {String}
- * options - {Object}
- */
- initialize: function(url, options) {
- OpenLayers.Ajax.Base.prototype.initialize.apply(this, [options]);
-
- if (OpenLayers.ProxyHost && OpenLayers.String.startsWith(url, "http")) {
- url = OpenLayers.ProxyHost + encodeURIComponent(url);
- }
-
- this.transport = OpenLayers.Ajax.getTransport();
- this.request(url);
- },
-
- /**
- * Method: request
- *
- * Parameters:
- * url - {String}
- */
- request: function(url) {
- this.url = url;
- this.method = this.options.method;
- var params = OpenLayers.Util.extend({}, this.options.parameters);
-
- if (this.method != 'get' && this.method != 'post') {
- // simulate other verbs over post
- params['_method'] = this.method;
- this.method = 'post';
- }
-
- this.parameters = params;
-
- if (params = OpenLayers.Util.getParameterString(params)) {
- // when GET, append parameters to URL
- if (this.method == 'get') {
- this.url += ((this.url.indexOf('?') > -1) ? '&' : '?') + params;
- } else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) {
- params += '&_=';
- }
- }
- try {
- var response = new OpenLayers.Ajax.Response(this);
- if (this.options.onCreate) {
- this.options.onCreate(response);
- }
-
- OpenLayers.Ajax.Responders.dispatch('onCreate',
- this,
- response);
-
- this.transport.open(this.method.toUpperCase(),
- this.url,
- this.options.asynchronous);
-
- if (this.options.asynchronous) {
- window.setTimeout(
- OpenLayers.Function.bind(this.respondToReadyState, this, 1),
- 10);
- }
-
- this.transport.onreadystatechange =
- OpenLayers.Function.bind(this.onStateChange, this);
- this.setRequestHeaders();
-
- this.body = this.method == 'post' ?
- (this.options.postBody || params) : null;
- this.transport.send(this.body);
-
- // Force Firefox to handle ready state 4 for synchronous requests
- if (!this.options.asynchronous &&
- this.transport.overrideMimeType) {
- this.onStateChange();
- }
- } catch (e) {
- this.dispatchException(e);
- }
- },
-
- /**
- * Method: onStateChange
- */
- onStateChange: function() {
- var readyState = this.transport.readyState;
- if (readyState > 1 && !((readyState == 4) && this._complete)) {
- this.respondToReadyState(this.transport.readyState);
- }
- },
-
- /**
- * Method: setRequestHeaders
- */
- setRequestHeaders: function() {
- var headers = {
- 'X-Requested-With': 'XMLHttpRequest',
- 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*',
- 'OpenLayers': true
- };
-
- if (this.method == 'post') {
- headers['Content-type'] = this.options.contentType +
- (this.options.encoding ? '; charset=' + this.options.encoding : '');
-
- /* Force "Connection: close" for older Mozilla browsers to work
- * around a bug where XMLHttpRequest sends an incorrect
- * Content-length header. See Mozilla Bugzilla #246651.
- */
- if (this.transport.overrideMimeType &&
- (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005) {
- headers['Connection'] = 'close';
- }
- }
- // user-defined headers
- if (typeof this.options.requestHeaders == 'object') {
- var extras = this.options.requestHeaders;
-
- if (typeof extras.push == 'function') {
- for (var i = 0, length = extras.length; i < length; i += 2) {
- headers[extras[i]] = extras[i+1];
- }
- } else {
- for (var i in extras) {
- headers[i] = extras[i];
- }
- }
- }
-
- for (var name in headers) {
- this.transport.setRequestHeader(name, headers[name]);
- }
- },
-
- /**
- * Method: success
- *
- * Returns:
- * {Boolean} -
- */
- success: function() {
- var status = this.getStatus();
- return !status || (status >=200 && status < 300);
- },
-
- /**
- * Method: getStatus
- *
- * Returns:
- * {Integer} - Status
- */
- getStatus: function() {
- try {
- return this.transport.status || 0;
- } catch (e) {
- return 0;
- }
- },
-
- /**
- * Method: respondToReadyState
- *
- * Parameters:
- * readyState - {?}
- */
- respondToReadyState: function(readyState) {
- var state = OpenLayers.Ajax.Request.Events[readyState];
- var response = new OpenLayers.Ajax.Response(this);
-
- if (state == 'Complete') {
- try {
- this._complete = true;
- (this.options['on' + response.status] ||
- this.options['on' + (this.success() ? 'Success' : 'Failure')] ||
- OpenLayers.Ajax.emptyFunction)(response);
- } catch (e) {
- this.dispatchException(e);
- }
-
- var contentType = response.getHeader('Content-type');
- }
-
- try {
- (this.options['on' + state] ||
- OpenLayers.Ajax.emptyFunction)(response);
- OpenLayers.Ajax.Responders.dispatch('on' + state,
- this,
- response);
- } catch (e) {
- this.dispatchException(e);
- }
-
- if (state == 'Complete') {
- // avoid memory leak in MSIE: clean up
- this.transport.onreadystatechange = OpenLayers.Ajax.emptyFunction;
- }
- },
-
- /**
- * Method: getHeader
- *
- * Parameters:
- * name - {String} Header name
- *
- * Returns:
- * {?} - response header for the given name
- */
- getHeader: function(name) {
- try {
- return this.transport.getResponseHeader(name);
- } catch (e) {
- return null;
- }
- },
-
- /**
- * Method: dispatchException
- * If the optional onException function is set, execute it
- * and then dispatch the call to any other listener registered
- * for onException.
- *
- * If no optional onException function is set, we suspect that
- * the user may have also not used
- * OpenLayers.Ajax.Responders.register to register a listener
- * for the onException call. To make sure that something
- * gets done with this exception, only dispatch the call if there
- * are listeners.
- *
- * If you explicitly want to swallow exceptions, set
- * request.options.onException to an empty function (function(){})
- * or register an empty function with <OpenLayers.Ajax.Responders>
- * for onException.
- *
- * Parameters:
- * exception - {?}
- */
- dispatchException: function(exception) {
- var handler = this.options.onException;
- if(handler) {
- // call options.onException and alert any other listeners
- handler(this, exception);
- OpenLayers.Ajax.Responders.dispatch('onException', this, exception);
- } else {
- // check if there are any other listeners
- var listener = false;
- var responders = OpenLayers.Ajax.Responders.responders;
- for (var i = 0; i < responders.length; i++) {
- if(responders[i].onException) {
- listener = true;
- break;
- }
- }
- if(listener) {
- // call all listeners
- OpenLayers.Ajax.Responders.dispatch('onException', this, exception);
- } else {
- // let the exception through
- throw exception;
- }
- }
- }
-});
-
-/**
- * Property: Events
- * {Array(String)}
- */
-OpenLayers.Ajax.Request.Events =
- ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
-
-/**
- * Class: OpenLayers.Ajax.Response
- */
-OpenLayers.Ajax.Response = OpenLayers.Class({
-
- /**
- * Property: status
- *
- * {Integer}
- */
- status: 0,
-
-
- /**
- * Property: statusText
- *
- * {String}
- */
- statusText: '',
-
- /**
- * Constructor: OpenLayers.Ajax.Response
- *
- * Parameters:
- * request - {Object}
- */
- initialize: function(request) {
- this.request = request;
- var transport = this.transport = request.transport,
- readyState = this.readyState = transport.readyState;
-
- if ((readyState > 2 &&
- !(!!(window.attachEvent && !window.opera))) ||
- readyState == 4) {
- this.status = this.getStatus();
- this.statusText = this.getStatusText();
- this.responseText = transport.responseText == null ?
- '' : String(transport.responseText);
- }
-
- if(readyState == 4) {
- var xml = transport.responseXML;
- this.responseXML = xml === undefined ? null : xml;
- }
- },
-
- /**
- * Method: getStatus
- */
- getStatus: OpenLayers.Ajax.Request.prototype.getStatus,
-
- /**
- * Method: getStatustext
- *
- * Returns:
- * {String} - statusText
- */
- getStatusText: function() {
- try {
- return this.transport.statusText || '';
- } catch (e) {
- return '';
- }
- },
-
- /**
- * Method: getHeader
- */
- getHeader: OpenLayers.Ajax.Request.prototype.getHeader,
-
- /**
- * Method: getResponseHeader
- *
- * Returns:
- * {?} - response header for given name
- */
- getResponseHeader: function(name) {
- return this.transport.getResponseHeader(name);
- }
-});
-
-
-/**
- * Function: getElementsByTagNameNS
- *
- * Parameters:
- * parentnode - {?}
- * nsuri - {?}
- * nsprefix - {?}
- * tagname - {?}
- *
- * Returns:
- * {?}
- */
-OpenLayers.Ajax.getElementsByTagNameNS = function(parentnode, nsuri,
- nsprefix, tagname) {
- var elem = null;
- if (parentnode.getElementsByTagNameNS) {
- elem = parentnode.getElementsByTagNameNS(nsuri, tagname);
- } else {
- elem = parentnode.getElementsByTagName(nsprefix + ':' + tagname);
- }
- return elem;
-};
-
-
-/**
- * Function: serializeXMLToString
- * Wrapper function around XMLSerializer, which doesn't exist/work in
- * IE/Safari. We need to come up with a way to serialize in those browser:
- * for now, these browsers will just fail. #535, #536
- *
- * Parameters:
- * xmldom {XMLNode} xml dom to serialize
- *
- * Returns:
- * {?}
- */
-OpenLayers.Ajax.serializeXMLToString = function(xmldom) {
- var serializer = new XMLSerializer();
- var data = serializer.serializeToString(xmldom);
- return data;
-};
-/* ======================================================================
OpenLayers/Control/ArgParser.js
====================================================================== */
@@ -9683,11 +8501,21 @@
/**
* APIProperty: slideFactor
* {Integer} Number of pixels by which we'll pan the map in any direction
- * on clicking the arrow buttons.
+ * on clicking the arrow buttons. If you want to pan by some ratio
+ * of the map dimensions, use <slideRatio> instead.
*/
slideFactor: 50,
/**
+ * APIProperty: slideRatio
+ * {Number} The fraction of map width/height by which we'll pan the map
+ * on clicking the arrow buttons. Default is null. If set, will
+ * override <slideFactor>. E.g. if slideRatio is .5, then the Pan Up
+ * button will pan up half the map height.
+ */
+ slideRatio: null,
+
+ /**
* Property: buttons
* {Array(DOMElement)} Array of Button Divs
*/
@@ -9716,11 +8544,7 @@
*/
destroy: function() {
OpenLayers.Control.prototype.destroy.apply(this, arguments);
- while(this.buttons.length) {
- var btn = this.buttons.shift();
- btn.map = null;
- OpenLayers.Event.stopObservingElement(btn);
- }
+ this.removeButtons();
this.buttons = null;
this.position = null;
},
@@ -9790,14 +8614,49 @@
OpenLayers.Function.bindAsEventListener(this.doubleClick, btn));
btn.action = id;
btn.map = this.map;
- btn.slideFactor = this.slideFactor;
+
+ if(!this.slideRatio){
+ var slideFactorPixels = this.slideFactor;
+ var getSlideFactor = function() {
+ return slideFactorPixels;
+ };
+ } else {
+ var slideRatio = this.slideRatio;
+ var getSlideFactor = function(dim) {
+ return this.map.getSize()[dim] * slideRatio;
+ };
+ }
+ btn.getSlideFactor = getSlideFactor;
+
//we want to remember/reference the outer div
this.buttons.push(btn);
return btn;
},
/**
+ * Method: _removeButton
+ *
+ * Parameters:
+ * btn - {Object}
+ */
+ _removeButton: function(btn) {
+ OpenLayers.Event.stopObservingElement(btn);
+ btn.map = null;
+ this.div.removeChild(btn);
+ OpenLayers.Util.removeItem(this.buttons, btn);
+ },
+
+ /**
+ * Method: removeButtons
+ */
+ removeButtons: function() {
+ for(var i=this.buttons.length-1; i>=0; --i) {
+ this._removeButton(this.buttons[i]);
+ }
+ },
+
+ /**
* Method: doubleClick
*
* Parameters:
@@ -9824,16 +8683,16 @@
switch (this.action) {
case "panup":
- this.map.pan(0, -this.slideFactor);
+ this.map.pan(0, -this.getSlideFactor("h"));
break;
case "pandown":
- this.map.pan(0, this.slideFactor);
+ this.map.pan(0, this.getSlideFactor("h"));
break;
case "panleft":
- this.map.pan(-this.slideFactor, 0);
+ this.map.pan(-this.getSlideFactor("w"), 0);
break;
case "panright":
- this.map.pan(this.slideFactor, 0);
+ this.map.pan(this.getSlideFactor("w"), 0);
break;
case "zoomin":
this.map.zoomIn();
@@ -10319,7 +9178,6 @@
initialize: function (object, element, eventTypes, fallThrough, options) {
OpenLayers.Util.extend(this, options);
this.object = object;
- this.element = element;
this.fallThrough = fallThrough;
this.listeners = {};
@@ -10340,7 +9198,7 @@
// if a dom element is specified, add a listeners list
// for browser events on the element and register them
- if (this.element != null) {
+ if (element != null) {
this.attachToElement(element);
}
},
@@ -10383,6 +9241,10 @@
* element - {HTMLDOMElement} a DOM element to attach browser events to
*/
attachToElement: function (element) {
+ if(this.element) {
+ OpenLayers.Event.stopObservingElement(this.element);
+ }
+ this.element = element;
for (var i=0, len=this.BROWSER_EVENTS.length; i<len; i++) {
var eventType = this.BROWSER_EVENTS[i];
@@ -10559,7 +9421,13 @@
* chain of listeners will stop getting called.
*/
triggerEvent: function (type, evt) {
+ var listeners = this.listeners[type];
+ // fast path
+ if(!listeners || listeners.length == 0) {
+ return;
+ }
+
// prep evt object with object & div references
if (evt == null) {
evt = {};
@@ -10573,25 +9441,21 @@
// execute all callbacks registered for specified type
// get a clone of the listeners array to
// allow for splicing during callbacks
- var listeners = (this.listeners[type]) ?
- this.listeners[type].slice() : null;
- if ((listeners != null) && (listeners.length > 0)) {
- var continueChain;
- for (var i=0, len=listeners.length; i<len; i++) {
- var callback = listeners[i];
- // bind the context to callback.obj
- continueChain = callback.func.apply(callback.obj, [evt]);
-
- if ((continueChain != undefined) && (continueChain == false)) {
- // if callback returns false, execute no more callbacks.
- break;
- }
+ var listeners = listeners.slice(), continueChain;
+ for (var i=0, len=listeners.length; i<len; i++) {
+ var callback = listeners[i];
+ // bind the context to callback.obj
+ continueChain = callback.func.apply(callback.obj, [evt]);
+
+ if ((continueChain != undefined) && (continueChain == false)) {
+ // if callback returns false, execute no more callbacks.
+ break;
}
- // don't fall through to other DOM elements
- if (!this.fallThrough) {
- OpenLayers.Event.stop(evt, true);
- }
}
+ // don't fall through to other DOM elements
+ if (!this.fallThrough) {
+ OpenLayers.Event.stop(evt, true);
+ }
return continueChain;
},
@@ -11556,6 +10420,9 @@
if (style.externalGraphic) {
pos = this.getPosition(node);
+ if (style.graphicTitle) {
+ node.setAttributeNS(null, "title", style.graphicTitle);
+ }
if (style.graphicWidth && style.graphicHeight) {
node.setAttributeNS(null, "preserveAspectRatio", "none");
}
@@ -11636,7 +10503,7 @@
if (style.pointerEvents) {
node.setAttributeNS(null, "pointer-events", style.pointerEvents);
}
-
+
if (style.cursor != null) {
node.setAttributeNS(null, "cursor", style.cursor);
}
@@ -12394,6 +11261,9 @@
if (node._geometryClass == "OpenLayers.Geometry.Point") {
if (style.externalGraphic) {
this.drawGraphic(node, geometry, style);
+ if (style.graphicTitle) {
+ node.title=style.graphicTitle;
+ }
// modify style/options for fill and stroke styling below
style.fillColor = "none";
options.isStroked = false;
@@ -13051,6 +11921,26 @@
},
/**
+ * Method: moveRoot
+ * moves this renderer's root to a different renderer.
+ *
+ * Parameters:
+ * renderer - {<OpenLayers.Renderer>} target renderer for the moved root
+ * root - {DOMElement} optional root node. To be used when this renderer
+ * holds roots from multiple layers to tell this method which one to
+ * detach
+ *
+ * Returns:
+ * {Boolean} true if successful, false otherwise
+ */
+ moveRoot: function(renderer) {
+ var layer = this.map.getLayer(this.container.id);
+ layer && this.clear();
+ OpenLayers.Renderer.Elements.prototype.moveRoot.apply(this, arguments);
+ layer && layer.redraw();
+ },
+
+ /**
* Method: importSymbol
* add a new symbol definition from the rendererer's symbol hash
*
@@ -13806,10 +12696,37 @@
* events on the map
*/
events: null,
+
+ /**
+ * APIProperty: allOverlays
+ * {Boolean} Allow the map to function with "overlays" only. Defaults to
+ * false. If true, the lowest layer in the draw order will act as
+ * the base layer. In addition, if set to true, all layers will
+ * have isBaseLayer set to false when they are added to the map.
+ *
+ * Note:
+ * If you set map.allOverlays to true, then you *cannot* use
+ * map.setBaseLayer or layer.setIsBaseLayer. With allOverlays true,
+ * the lowest layer in the draw layer is the base layer. So, to change
+ * the base layer, use <setLayerIndex> or <raiseLayer> to set the layer
+ * index to 0.
+ */
+ allOverlays: false,
/**
* APIProperty: div
- * {DOMElement} The element that contains the map
+ * {DOMElement|String} The element that contains the map (or an id for
+ * that element). If the <OpenLayers.Map> constructor is called
+ * with two arguments, this should be provided as the first argument.
+ * Alternatively, the map constructor can be called with the options
+ * object as the only argument. In this case (one argument), a
+ * div property may or may not be provided. If the div property
+ * is not provided, the map can be rendered to a container later
+ * using the <render> method.
+ *
+ * Note: If you calling <render> after map construction, do not use
+ * <maxResolution> auto. Instead, divide your <maxExtent> by your
+ * maximum expected dimension.
*/
div: null,
@@ -14060,6 +12977,15 @@
panMethod: OpenLayers.Easing.Expo.easeOut,
/**
+ * Property: panDuration
+ * {Integer} The number of steps to be passed to the
+ * OpenLayers.Tween.start() method when the map is
+ * panned.
+ * Default is 50.
+ */
+ panDuration: 50,
+
+ /**
* Property: paddingForPopups
* {<OpenLayers.Bounds>} Outside margin of the popup. Used to prevent
* the popup from getting too close to the map border.
@@ -14068,13 +12994,16 @@
/**
* Constructor: OpenLayers.Map
- * Constructor for a new OpenLayers.Map instance.
+ * Constructor for a new OpenLayers.Map instance. There are two possible
+ * ways to call the map constructor. See the examples below.
*
* Parameters:
* div - {String} Id of an element in your page that will contain the map.
+ * May be omitted if the <div> option is provided or if you intend
+ * to use <render> later.
* options - {Object} Optional object with properties to tag onto the map.
*
- * Examples:
+ * Examples (method one):
* (code)
* // create a map with default options in an element with the id "map1"
* var map = new OpenLayers.Map("map1");
@@ -14088,8 +13017,33 @@
* };
* var map = new OpenLayers.Map("map2", options);
* (end)
+ *
+ * Examples (method two - single argument):
+ * (code)
+ * // create a map with non-default options
+ * var map = new OpenLayers.Map({
+ * div: "map_id",
+ * maxExtent: new OpenLayers.Bounds(-200000, -200000, 200000, 200000),
+ * maxResolution: 156543,
+ * units: 'm',
+ * projection: "EPSG:41001"
+ * });
+ *
+ * // create a map without a reference to a container - call render later
+ * var map = new OpenLayers.Map({
+ * maxExtent: new OpenLayers.Bounds(-200000, -200000, 200000, 200000),
+ * maxResolution: 156543,
+ * units: 'm',
+ * projection: "EPSG:41001"
+ * });
*/
initialize: function (div, options) {
+
+ // If only one argument is provided, check if it is an object.
+ if(arguments.length === 1 && typeof div === "object") {
+ options = div;
+ div = options && options.div;
+ }
// Simple-type defaults are set in class definition.
// Now set complex-type defaults
@@ -14109,6 +13063,12 @@
this.id = OpenLayers.Util.createUniqueID("OpenLayers.Map_");
this.div = OpenLayers.Util.getElement(div);
+ if(!this.div) {
+ this.div = document.createElement("div");
+ this.div.style.height = "1px";
+ this.div.style.width = "1px";
+ }
+
OpenLayers.Element.addClass(this.div, 'olMap');
// the viewPortDiv is the outermost div we modify
@@ -14204,8 +13164,24 @@
// always call map.destroy()
OpenLayers.Event.observe(window, 'unload', this.unloadDestroy);
-
},
+
+ /**
+ * APIMethod: render
+ * Render the map to a specified container.
+ *
+ * Parameters:
+ * div - {String|DOMElement} The container that the map should be rendered
+ * to. If different than the current container, the map viewport
+ * will be moved from the current to the new container.
+ */
+ render: function(div) {
+ this.div = OpenLayers.Util.getElement(div);
+ this.events.attachToElement(this.div);
+ this.viewPortDiv.parentNode.removeChild(this.viewPortDiv);
+ this.div.appendChild(this.viewPortDiv);
+ this.updateSize();
+ },
/**
* Method: unloadDestroy
@@ -14494,7 +13470,10 @@
OpenLayers.Console.warn(msg);
return false;
}
- }
+ }
+ if(this.allOverlays) {
+ layer.isBaseLayer = false;
+ }
this.events.triggerEvent("preaddlayer", {layer: layer});
@@ -14510,7 +13489,7 @@
this.layers.push(layer);
layer.setMap(this);
- if (layer.isBaseLayer) {
+ if (layer.isBaseLayer || (this.allOverlays && !this.baseLayer)) {
if (this.baseLayer == null) {
// set the first baselaye we add as the baselayer
this.setBaseLayer(layer);
@@ -14584,7 +13563,7 @@
if(setNewBaseLayer) {
for(var i=0, len=this.layers.length; i<len; i++) {
var iLayer = this.layers[i];
- if (iLayer.isBaseLayer) {
+ if (iLayer.isBaseLayer || this.allOverlays) {
this.setBaseLayer(iLayer);
break;
}
@@ -14649,6 +13628,13 @@
this.events.triggerEvent("changelayer", {
layer: layer, property: "order"
});
+ if(this.allOverlays) {
+ if(idx === 0) {
+ this.setBaseLayer(layer);
+ } else if(this.baseLayer !== this.layers[0]) {
+ this.setBaseLayer(this.layers[0]);
+ }
+ }
}
},
@@ -15097,7 +14083,7 @@
lon: lonlat.lon,
lat: lonlat.lat
};
- this.panTween.start(from, to, 50, {
+ this.panTween.start(from, to, this.panDuration, {
callbacks: {
start: OpenLayers.Function.bind(function(lonlat) {
this.events.triggerEvent("movestart");
@@ -15125,10 +14111,11 @@
/**
* APIMethod: setCenter
+ * Set the map center (and optionally, the zoom level).
*
* Parameters:
- * lonlat - {<OpenLayers.LonLat>}
- * zoom - {Integer}
+ * lonlat - {<OpenLayers.LonLat>} The new center location.
+ * zoom - {Integer} Optional zoom level.
* dragging - {Boolean} Specifies whether or not to trigger
* movestart/end events
* forceZoomChange - {Boolean} Specifies whether or not to trigger zoom
@@ -15259,7 +14246,7 @@
for (var i=0, len=this.layers.length; i<len; i++) {
var layer = this.layers[i];
- if (!layer.isBaseLayer) {
+ if (layer !== this.baseLayer && !layer.isBaseLayer) {
var inRange = layer.calculateInRange();
if (layer.inRange != inRange) {
// the inRange property has changed. If the layer is
@@ -16151,6 +15138,342 @@
/* ======================================================================
+ OpenLayers/Request.js
+ ====================================================================== */
+
+/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD
+ * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Events.js
+ */
+
+/**
+ * Namespace: OpenLayers.Request
+ * The OpenLayers.Request namespace contains convenience methods for working
+ * with XMLHttpRequests. These methods work with a cross-browser
+ * W3C compliant <OpenLayers.Request.XMLHttpRequest> class.
+ */
+OpenLayers.Request = {
+
+ /**
+ * Constant: DEFAULT_CONFIG
+ * {Object} Default configuration for all requests.
+ */
+ DEFAULT_CONFIG: {
+ method: "GET",
+ url: window.location.href,
+ async: true,
+ user: undefined,
+ password: undefined,
+ params: null,
+ proxy: OpenLayers.ProxyHost,
+ headers: {},
+ data: null,
+ callback: function() {},
+ success: null,
+ failure: null,
+ scope: null
+ },
+
+ /**
+ * APIProperty: events
+ * {<OpenLayers.Events>} An events object that handles all
+ * events on the {<OpenLayers.Request>} object.
+ *
+ * All event listeners will receive an event object with three properties:
+ * request - {<OpenLayers.Request.XMLHttpRequest>} The request object.
+ * config - {Object} The config object sent to the specific request method.
+ * requestUrl - {String} The request url.
+ *
+ * Supported event types:
+ * complete - Triggered when we have a response from the request, if a
+ * listener returns false, no further response processing will take
+ * place.
+ * success - Triggered when the HTTP response has a success code (200-299).
+ * failure - Triggered when the HTTP response does not have a success code.
+ */
+ events: new OpenLayers.Events(this, null, ["complete", "success", "failure"]),
+
+ /**
+ * APIMethod: issue
+ * Create a new XMLHttpRequest object, open it, set any headers, bind
+ * a callback to done state, and send any data. It is recommended that
+ * you use one <GET>, <POST>, <PUT>, <DELETE>, <OPTIONS>, or <HEAD>.
+ * This method is only documented to provide detail on the configuration
+ * options available to all request methods.
+ *
+ * Parameters:
+ * config - {Object} Object containing properties for configuring the
+ * request. Allowed configuration properties are described below.
+ * This object is modified and should not be reused.
+ *
+ * Allowed config properties:
+ * method - {String} One of GET, POST, PUT, DELETE, HEAD, or
+ * OPTIONS. Default is GET.
+ * url - {String} URL for the request.
+ * async - {Boolean} Open an asynchronous request. Default is true.
+ * user - {String} User for relevant authentication scheme. Set
+ * to null to clear current user.
+ * password - {String} Password for relevant authentication scheme.
+ * Set to null to clear current password.
+ * proxy - {String} Optional proxy. Defaults to
+ * <OpenLayers.ProxyHost>.
+ * params - {Object} Any key:value pairs to be appended to the
+ * url as a query string. Assumes url doesn't already include a query
+ * string or hash. Typically, this is only appropriate for <GET>
+ * requests where the query string will be appended to the url.
+ * Parameter values that are arrays will be
+ * concatenated with a comma (note that this goes against form-encoding)
+ * as is done with <OpenLayers.Util.getParameterString>.
+ * headers - {Object} Object with header:value pairs to be set on
+ * the request.
+ * data - {String | Document} Optional data to send with the request.
+ * Typically, this is only used with <POST> and <PUT> requests.
+ * Make sure to provide the appropriate "Content-Type" header for your
+ * data. For <POST> and <PUT> requests, the content type defaults to
+ * "application-xml". If your data is a different content type, or
+ * if you are using a different HTTP method, set the "Content-Type"
+ * header to match your data type.
+ * callback - {Function} Function to call when request is done.
+ * To determine if the request failed, check request.status (200
+ * indicates success).
+ * success - {Function} Optional function to call if request status is in
+ * the 200s. This will be called in addition to callback above and
+ * would typically only be used as an alternative.
+ * failure - {Function} Optional function to call if request status is not
+ * in the 200s. This will be called in addition to callback above and
+ * would typically only be used as an alternative.
+ * scope - {Object} If callback is a public method on some object,
+ * set the scope to that object.
+ *
+ * Returns:
+ * {XMLHttpRequest} Request object. To abort the request before a response
+ * is received, call abort() on the request object.
+ */
+ issue: function(config) {
+ // apply default config - proxy host may have changed
+ var defaultConfig = OpenLayers.Util.extend(
+ this.DEFAULT_CONFIG,
+ {proxy: OpenLayers.ProxyHost}
+ );
+ config = OpenLayers.Util.applyDefaults(config, defaultConfig);
+
+ // create request, open, and set headers
+ var request = new OpenLayers.Request.XMLHttpRequest();
+ var url = config.url;
+ if(config.params) {
+ var paramString = OpenLayers.Util.getParameterString(config.params);
+ if(paramString.length > 0) {
+ var separator = (url.indexOf('?') > -1) ? '&' : '?';
+ url += separator + paramString;
+ }
+ }
+ if(config.proxy && (url.indexOf("http") == 0)) {
+ url = config.proxy + encodeURIComponent(url);
+ }
+ request.open(
+ config.method, url, config.async, config.user, config.password
+ );
+ for(var header in config.headers) {
+ request.setRequestHeader(header, config.headers[header]);
+ }
+
+ // bind callbacks to readyState 4 (done)
+ var complete = (config.scope) ?
+ OpenLayers.Function.bind(config.callback, config.scope) :
+ config.callback;
+
+ // optional success callback
+ var success;
+ if(config.success) {
+ success = (config.scope) ?
+ OpenLayers.Function.bind(config.success, config.scope) :
+ config.success;
+ }
+
+ // optional failure callback
+ var failure;
+ if(config.failure) {
+ failure = (config.scope) ?
+ OpenLayers.Function.bind(config.failure, config.scope) :
+ config.failure;
+ }
+
+ var events = this.events;
+
+ request.onreadystatechange = function() {
+ if(request.readyState == OpenLayers.Request.XMLHttpRequest.DONE) {
+ var proceed = events.triggerEvent(
+ "complete",
+ {request: request, config: config, requestUrl: url}
+ );
+ if(proceed !== false) {
+ complete(request);
+ if (!request.status || (request.status >= 200 && request.status < 300)) {
+ events.triggerEvent(
+ "success",
+ {request: request, config: config, requestUrl: url}
+ );
+ if(success) {
+ success(request);
+ }
+ }
+ if(request.status && (request.status < 200 || request.status >= 300)) {
+ events.triggerEvent(
+ "failure",
+ {request: request, config: config, requestUrl: url}
+ );
+ if(failure) {
+ failure(request);
+ }
+ }
+ }
+ }
+ };
+
+ // send request (optionally with data) and return
+ // call in a timeout for asynchronous requests so the return is
+ // available before readyState == 4 for cached docs
+ if(config.async === false) {
+ request.send(config.data);
+ } else {
+ window.setTimeout(function(){
+ request.send(config.data);
+ }, 0);
+ }
+ return request;
+ },
+
+ /**
+ * APIMethod: GET
+ * Send an HTTP GET request. Additional configuration properties are
+ * documented in the <issue> method, with the method property set
+ * to GET.
+ *
+ * Parameters:
+ * config - {Object} Object with properties for configuring the request.
+ * See the <issue> method for documentation of allowed properties.
+ * This object is modified and should not be reused.
+ *
+ * Returns:
+ * {XMLHttpRequest} Request object.
+ */
+ GET: function(config) {
+ config = OpenLayers.Util.extend(config, {method: "GET"});
+ return OpenLayers.Request.issue(config);
+ },
+
+ /**
+ * APIMethod: POST
+ * Send a POST request. Additional configuration properties are
+ * documented in the <issue> method, with the method property set
+ * to POST and "Content-Type" header set to "application/xml".
+ *
+ * Parameters:
+ * config - {Object} Object with properties for configuring the request.
+ * See the <issue> method for documentation of allowed properties. The
+ * default "Content-Type" header will be set to "application-xml" if
+ * none is provided. This object is modified and should not be reused.
+ *
+ * Returns:
+ * {XMLHttpRequest} Request object.
+ */
+ POST: function(config) {
+ config = OpenLayers.Util.extend(config, {method: "POST"});
+ // set content type to application/xml if it isn't already set
+ config.headers = config.headers ? config.headers : {};
+ if(!("CONTENT-TYPE" in OpenLayers.Util.upperCaseObject(config.headers))) {
+ config.headers["Content-Type"] = "application/xml";
+ }
+ return OpenLayers.Request.issue(config);
+ },
+
+ /**
+ * APIMethod: PUT
+ * Send an HTTP PUT request. Additional configuration properties are
+ * documented in the <issue> method, with the method property set
+ * to PUT and "Content-Type" header set to "application/xml".
+ *
+ * Parameters:
+ * config - {Object} Object with properties for configuring the request.
+ * See the <issue> method for documentation of allowed properties. The
+ * default "Content-Type" header will be set to "application-xml" if
+ * none is provided. This object is modified and should not be reused.
+ *
+ * Returns:
+ * {XMLHttpRequest} Request object.
+ */
+ PUT: function(config) {
+ config = OpenLayers.Util.extend(config, {method: "PUT"});
+ // set content type to application/xml if it isn't already set
+ config.headers = config.headers ? config.headers : {};
+ if(!("CONTENT-TYPE" in OpenLayers.Util.upperCaseObject(config.headers))) {
+ config.headers["Content-Type"] = "application/xml";
+ }
+ return OpenLayers.Request.issue(config);
+ },
+
+ /**
+ * APIMethod: DELETE
+ * Send an HTTP DELETE request. Additional configuration properties are
+ * documented in the <issue> method, with the method property set
+ * to DELETE.
+ *
+ * Parameters:
+ * config - {Object} Object with properties for configuring the request.
+ * See the <issue> method for documentation of allowed properties.
+ * This object is modified and should not be reused.
+ *
+ * Returns:
+ * {XMLHttpRequest} Request object.
+ */
+ DELETE: function(config) {
+ config = OpenLayers.Util.extend(config, {method: "DELETE"});
+ return OpenLayers.Request.issue(config);
+ },
+
+ /**
+ * APIMethod: HEAD
+ * Send an HTTP HEAD request. Additional configuration properties are
+ * documented in the <issue> method, with the method property set
+ * to HEAD.
+ *
+ * Parameters:
+ * config - {Object} Object with properties for configuring the request.
+ * See the <issue> method for documentation of allowed properties.
+ * This object is modified and should not be reused.
+ *
+ * Returns:
+ * {XMLHttpRequest} Request object.
+ */
+ HEAD: function(config) {
+ config = OpenLayers.Util.extend(config, {method: "HEAD"});
+ return OpenLayers.Request.issue(config);
+ },
+
+ /**
+ * APIMethod: OPTIONS
+ * Send an HTTP OPTIONS request. Additional configuration properties are
+ * documented in the <issue> method, with the method property set
+ * to OPTIONS.
+ *
+ * Parameters:
+ * config - {Object} Object with properties for configuring the request.
+ * See the <issue> method for documentation of allowed properties.
+ * This object is modified and should not be reused.
+ *
+ * Returns:
+ * {XMLHttpRequest} Request object.
+ */
+ OPTIONS: function(config) {
+ config = OpenLayers.Util.extend(config, {method: "OPTIONS"});
+ return OpenLayers.Request.issue(config);
+ }
+
+};
+/* ======================================================================
OpenLayers/Tile/Image.js
====================================================================== */
@@ -16450,13 +15773,12 @@
OpenLayers.Util.modifyDOMElement(this.frame,
null, this.position, this.size);
- var imageSize = this.layer.getImageSize();
if (this.layerAlphaHack) {
OpenLayers.Util.modifyAlphaImageDiv(this.imgDiv,
- null, null, imageSize, this.url);
+ null, null, this.size, this.url);
} else {
OpenLayers.Util.modifyDOMElement(this.imgDiv,
- null, null, imageSize) ;
+ null, null, this.size) ;
this.imgDiv.src = this.url;
}
return true;
@@ -16483,12 +15805,11 @@
initImgDiv: function() {
var offset = this.layer.imageOffset;
- var size = this.layer.getImageSize();
if (this.layerAlphaHack) {
this.imgDiv = OpenLayers.Util.createAlphaImageDiv(null,
offset,
- size,
+ this.size,
null,
"relative",
null,
@@ -16498,7 +15819,7 @@
} else {
this.imgDiv = OpenLayers.Util.createImage(null,
offset,
- size,
+ this.size,
null,
"relative",
null,
@@ -17922,6 +17243,10 @@
window.clearTimeout(this.timerId);
this.timerId = null;
}
+ if(this.rightclickTimerId != null) {
+ window.clearTimeout(this.rightclickTimerId);
+ this.rightclickTimerId = null;
+ }
},
/**
@@ -19198,19 +18523,19 @@
* properties of this event depends on exactly what happened.
*
* All event objects have at least the following properties:
- * - *object* {Object} A reference to layer.events.object.
- * - *element* {DOMElement} A reference to layer.events.element.
+ * object - {Object} A reference to layer.events.object.
+ * element - {DOMElement} A reference to layer.events.element.
*
* Supported map event types:
- * - *loadstart* Triggered when layer loading starts.
- * - *loadend* Triggered when layer loading ends.
- * - *loadcancel* Triggered when layer loading is canceled.
- * - *visibilitychanged* Triggered when layer visibility is changed.
- * - *move* Triggered when layer moves (triggered with every mousemove
- * during a drag).
- * - *moveend* Triggered when layer is done moving, object passed as
- * argument has a zoomChanged boolean property which tells that the
- * zoom has changed.
+ * loadstart - Triggered when layer loading starts.
+ * loadend - Triggered when layer loading ends.
+ * loadcancel - Triggered when layer loading is canceled.
+ * visibilitychanged - Triggered when layer visibility is changed.
+ * move - Triggered when layer moves (triggered with every mousemove
+ * during a drag).
+ * moveend - Triggered when layer is done moving, object passed as
+ * argument has a zoomChanged boolean property which tells that the
+ * zoom has changed.
*/
EVENT_TYPES: ["loadstart", "loadend", "loadcancel", "visibilitychanged",
"move", "moveend"],
@@ -19453,6 +18778,7 @@
this.div = OpenLayers.Util.createDiv(this.id);
this.div.style.width = "100%";
this.div.style.height = "100%";
+ this.div.dir = "ltr";
this.events = new OpenLayers.Events(this, this.div,
this.EVENT_TYPES);
@@ -20412,6 +19738,1004 @@
});
/* ======================================================================
+ OpenLayers/Request/XMLHttpRequest.js
+ ====================================================================== */
+
+// Copyright 2007 Sergey Ilinsky (http://www.ilinsky.com)
+//
+// 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
+//
+// 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.
+
+/**
+ * @requires OpenLayers/Request.js
+ */
+
+(function () {
+
+ // Save reference to earlier defined object implementation (if any)
+ var oXMLHttpRequest = window.XMLHttpRequest;
+
+ // Define on browser type
+ var bGecko = !!window.controllers,
+ bIE = window.document.all && !window.opera;
+
+ // Constructor
+ function cXMLHttpRequest() {
+ this._object = oXMLHttpRequest ? new oXMLHttpRequest : new window.ActiveXObject('Microsoft.XMLHTTP');
+ };
+
+ // BUGFIX: Firefox with Firebug installed would break pages if not executed
+ if (bGecko && oXMLHttpRequest.wrapped)
+ cXMLHttpRequest.wrapped = oXMLHttpRequest.wrapped;
+
+ // Constants
+ cXMLHttpRequest.UNSENT = 0;
+ cXMLHttpRequest.OPENED = 1;
+ cXMLHttpRequest.HEADERS_RECEIVED = 2;
+ cXMLHttpRequest.LOADING = 3;
+ cXMLHttpRequest.DONE = 4;
+
+ // Public Properties
+ cXMLHttpRequest.prototype.readyState = cXMLHttpRequest.UNSENT;
+ cXMLHttpRequest.prototype.responseText = "";
+ cXMLHttpRequest.prototype.responseXML = null;
+ cXMLHttpRequest.prototype.status = 0;
+ cXMLHttpRequest.prototype.statusText = "";
+
+ // Instance-level Events Handlers
+ cXMLHttpRequest.prototype.onreadystatechange = null;
+
+ // Class-level Events Handlers
+ cXMLHttpRequest.onreadystatechange = null;
+ cXMLHttpRequest.onopen = null;
+ cXMLHttpRequest.onsend = null;
+ cXMLHttpRequest.onabort = null;
+
+ // Public Methods
+ cXMLHttpRequest.prototype.open = function(sMethod, sUrl, bAsync, sUser, sPassword) {
+
+ // Save async parameter for fixing Gecko bug with missing readystatechange in synchronous requests
+ this._async = bAsync;
+
+ // Set the onreadystatechange handler
+ var oRequest = this,
+ nState = this.readyState;
+
+ // BUGFIX: IE - memory leak on page unload (inter-page leak)
+ if (bIE) {
+ var fOnUnload = function() {
+ if (oRequest._object.readyState != cXMLHttpRequest.DONE)
+ fCleanTransport(oRequest);
+ };
+ if (bAsync)
+ window.attachEvent("onunload", fOnUnload);
+ }
+
+ this._object.onreadystatechange = function() {
+ if (bGecko && !bAsync)
+ return;
+
+ // Synchronize state
+ oRequest.readyState = oRequest._object.readyState;
+
+ //
+ fSynchronizeValues(oRequest);
+
+ // BUGFIX: Firefox fires unneccesary DONE when aborting
+ if (oRequest._aborted) {
+ // Reset readyState to UNSENT
+ oRequest.readyState = cXMLHttpRequest.UNSENT;
+
+ // Return now
+ return;
+ }
+
+ if (oRequest.readyState == cXMLHttpRequest.DONE) {
+ //
+ fCleanTransport(oRequest);
+// Uncomment this block if you need a fix for IE cache
+/*
+ // BUGFIX: IE - cache issue
+ if (!oRequest._object.getResponseHeader("Date")) {
+ // Save object to cache
+ oRequest._cached = oRequest._object;
+
+ // Instantiate a new transport object
+ cXMLHttpRequest.call(oRequest);
+
+ // Re-send request
+ oRequest._object.open(sMethod, sUrl, bAsync, sUser, sPassword);
+ oRequest._object.setRequestHeader("If-Modified-Since", oRequest._cached.getResponseHeader("Last-Modified") || new window.Date(0));
+ // Copy headers set
+ if (oRequest._headers)
+ for (var sHeader in oRequest._headers)
+ if (typeof oRequest._headers[sHeader] == "string") // Some frameworks prototype objects with functions
+ oRequest._object.setRequestHeader(sHeader, oRequest._headers[sHeader]);
+
+ oRequest._object.onreadystatechange = function() {
+ // Synchronize state
+ oRequest.readyState = oRequest._object.readyState;
+
+ if (oRequest._aborted) {
+ //
+ oRequest.readyState = cXMLHttpRequest.UNSENT;
+
+ // Return
+ return;
+ }
+
+ if (oRequest.readyState == cXMLHttpRequest.DONE) {
+ // Clean Object
+ fCleanTransport(oRequest);
+
+ // get cached request
+ if (oRequest.status == 304)
+ oRequest._object = oRequest._cached;
+
+ //
+ delete oRequest._cached;
+
+ //
+ fSynchronizeValues(oRequest);
+
+ //
+ fReadyStateChange(oRequest);
+
+ // BUGFIX: IE - memory leak in interrupted
+ if (bIE && bAsync)
+ window.detachEvent("onunload", fOnUnload);
+ }
+ };
+ oRequest._object.send(null);
+
+ // Return now - wait untill re-sent request is finished
+ return;
+ };
+*/
+ // BUGFIX: IE - memory leak in interrupted
+ if (bIE && bAsync)
+ window.detachEvent("onunload", fOnUnload);
+ }
+
+ // BUGFIX: Some browsers (Internet Explorer, Gecko) fire OPEN readystate twice
+ if (nState != oRequest.readyState)
+ fReadyStateChange(oRequest);
+
+ nState = oRequest.readyState;
+ };
+
+ // Add method sniffer
+ if (cXMLHttpRequest.onopen)
+ cXMLHttpRequest.onopen.apply(this, arguments);
+
+ this._object.open(sMethod, sUrl, bAsync, sUser, sPassword);
+
+ // BUGFIX: Gecko - missing readystatechange calls in synchronous requests
+ if (!bAsync && bGecko) {
+ this.readyState = cXMLHttpRequest.OPENED;
+
+ fReadyStateChange(this);
+ }
+ };
+ cXMLHttpRequest.prototype.send = function(vData) {
+ // Add method sniffer
+ if (cXMLHttpRequest.onsend)
+ cXMLHttpRequest.onsend.apply(this, arguments);
+
+ // BUGFIX: Safari - fails sending documents created/modified dynamically, so an explicit serialization required
+ // BUGFIX: IE - rewrites any custom mime-type to "text/xml" in case an XMLNode is sent
+ // BUGFIX: Gecko - fails sending Element (this is up to the implementation either to standard)
+ if (vData && vData.nodeType) {
+ vData = window.XMLSerializer ? new window.XMLSerializer().serializeToString(vData) : vData.xml;
+ if (!this._headers["Content-Type"])
+ this._object.setRequestHeader("Content-Type", "application/xml");
+ }
+
+ this._object.send(vData);
+
+ // BUGFIX: Gecko - missing readystatechange calls in synchronous requests
+ if (bGecko && !this._async) {
+ this.readyState = cXMLHttpRequest.OPENED;
+
+ // Synchronize state
+ fSynchronizeValues(this);
+
+ // Simulate missing states
+ while (this.readyState < cXMLHttpRequest.DONE) {
+ this.readyState++;
+ fReadyStateChange(this);
+ // Check if we are aborted
+ if (this._aborted)
+ return;
+ }
+ }
+ };
+ cXMLHttpRequest.prototype.abort = function() {
+ // Add method sniffer
+ if (cXMLHttpRequest.onabort)
+ cXMLHttpRequest.onabort.apply(this, arguments);
+
+ // BUGFIX: Gecko - unneccesary DONE when aborting
+ if (this.readyState > cXMLHttpRequest.UNSENT)
+ this._aborted = true;
+
+ this._object.abort();
+
+ // BUGFIX: IE - memory leak
+ fCleanTransport(this);
+ };
+ cXMLHttpRequest.prototype.getAllResponseHeaders = function() {
+ return this._object.getAllResponseHeaders();
+ };
+ cXMLHttpRequest.prototype.getResponseHeader = function(sName) {
+ return this._object.getResponseHeader(sName);
+ };
+ cXMLHttpRequest.prototype.setRequestHeader = function(sName, sValue) {
+ // BUGFIX: IE - cache issue
+ if (!this._headers)
+ this._headers = {};
+ this._headers[sName] = sValue;
+
+ return this._object.setRequestHeader(sName, sValue);
+ };
+ cXMLHttpRequest.prototype.toString = function() {
+ return '[' + "object" + ' ' + "XMLHttpRequest" + ']';
+ };
+ cXMLHttpRequest.toString = function() {
+ return '[' + "XMLHttpRequest" + ']';
+ };
+
+ // Helper function
+ function fReadyStateChange(oRequest) {
+ // Execute onreadystatechange
+ if (oRequest.onreadystatechange)
+ oRequest.onreadystatechange.apply(oRequest);
+
+ // Sniffing code
+ if (cXMLHttpRequest.onreadystatechange)
+ cXMLHttpRequest.onreadystatechange.apply(oRequest);
+ };
+
+ function fGetDocument(oRequest) {
+ var oDocument = oRequest.responseXML;
+ // Try parsing responseText
+ if (bIE && oDocument && !oDocument.documentElement && oRequest.getResponseHeader("Content-Type").match(/[^\/]+\/[^\+]+\+xml/)) {
+ oDocument = new ActiveXObject('Microsoft.XMLDOM');
+ oDocument.loadXML(oRequest.responseText);
+ }
+ // Check if there is no error in document
+ if (oDocument)
+ if ((bIE && oDocument.parseError != 0) || (oDocument.documentElement && oDocument.documentElement.tagName == "parsererror"))
+ return null;
+ return oDocument;
+ };
+
+ function fSynchronizeValues(oRequest) {
+ try { oRequest.responseText = oRequest._object.responseText; } catch (e) {}
+ try { oRequest.responseXML = fGetDocument(oRequest._object); } catch (e) {}
+ try { oRequest.status = oRequest._object.status; } catch (e) {}
+ try { oRequest.statusText = oRequest._object.statusText; } catch (e) {}
+ };
+
+ function fCleanTransport(oRequest) {
+ // BUGFIX: IE - memory leak (on-page leak)
+ oRequest._object.onreadystatechange = new window.Function;
+
+ // Delete private properties
+ delete oRequest._headers;
+ };
+
+ // Internet Explorer 5.0 (missing apply)
+ if (!window.Function.prototype.apply) {
+ window.Function.prototype.apply = function(oRequest, oArguments) {
+ if (!oArguments)
+ oArguments = [];
+ oRequest.__func = this;
+ oRequest.__func(oArguments[0], oArguments[1], oArguments[2], oArguments[3], oArguments[4]);
+ delete oRequest.__func;
+ };
+ };
+
+ // Register new object with window
+ /**
+ * Class: OpenLayers.Request.XMLHttpRequest
+ * Standard-compliant (W3C) cross-browser implementation of the
+ * XMLHttpRequest object. From
+ * http://code.google.com/p/xmlhttprequest/.
+ */
+ OpenLayers.Request.XMLHttpRequest = cXMLHttpRequest;
+})();
+/* ======================================================================
+ OpenLayers/Ajax.js
+ ====================================================================== */
+
+/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD
+ * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Request/XMLHttpRequest.js
+ * @requires OpenLayers/Console.js
+ */
+
+OpenLayers.ProxyHost = "";
+//OpenLayers.ProxyHost = "examples/proxy.cgi?url=";
+
+/**
+ * Ajax reader for OpenLayers
+ *
+ * @uri url to do remote XML http get
+ * @param {String} 'get' format params (x=y&a=b...)
+ * @who object to handle callbacks for this request
+ * @complete the function to be called on success
+ * @failure the function to be called on failure
+ *
+ * example usage from a caller:
+ *
+ * caps: function(request) {
+ * -blah-
+ * },
+ *
+ * OpenLayers.loadURL(url,params,this,caps);
+ *
+ * Notice the above example does not provide an error handler; a default empty
+ * handler is provided which merely logs the error if a failure handler is not
+ * supplied
+ *
+ */
+
+
+/**
+ * Function: OpenLayers.nullHandler
+ * @param {} request
+ */
+OpenLayers.nullHandler = function(request) {
+ OpenLayers.Console.userError(OpenLayers.i18n("unhandledRequest", {'statusText':request.statusText}));
+};
+
+/**
+ * APIFunction: loadURL
+ * Background load a document. For more flexibility in using XMLHttpRequest,
+ * see the <OpenLayers.Request> methods.
+ *
+ * Parameters:
+ * uri - {String} URI of source doc
+ * params - {String} or {Object} GET params. Either a string in the form
+ * "?hello=world&foo=bar" (do not forget the leading question mark)
+ * or an object in the form {'hello': 'world', 'foo': 'bar}
+ * caller - {Object} object which gets callbacks
+ * onComplete - {Function} Optional callback for success. The callback
+ * will be called with this set to caller and will receive the request
+ * object as an argument. Note that if you do not specify an onComplete
+ * function, <OpenLayers.nullHandler> will be called (which pops up a
+ * user friendly error message dialog).
+ * onFailure - {Function} Optional callback for failure. In the event of
+ * a failure, the callback will be called with this set to caller and will
+ * receive the request object as an argument. Note that if you do not
+ * specify an onComplete function, <OpenLayers.nullHandler> will be called
+ * (which pops up a user friendly error message dialog).
+ *
+ * Returns:
+ * {<OpenLayers.Request.XMLHttpRequest>} The request object. To abort loading,
+ * call request.abort().
+ */
+OpenLayers.loadURL = function(uri, params, caller,
+ onComplete, onFailure) {
+
+ if(typeof params == 'string') {
+ params = OpenLayers.Util.getParameters(params);
+ }
+ var success = (onComplete) ? onComplete : OpenLayers.nullHandler;
+ var failure = (onFailure) ? onFailure : OpenLayers.nullHandler;
+
+ return OpenLayers.Request.GET({
+ url: uri, params: params,
+ success: success, failure: failure, scope: caller
+ });
+};
+
+/**
+ * Function: parseXMLString
+ * Parse XML into a doc structure
+ *
+ * Parameters:
+ * text - {String}
+ *
+ * Returns:
+ * {?} Parsed AJAX Responsev
+ */
+OpenLayers.parseXMLString = function(text) {
+
+ //MS sucks, if the server is bad it dies
+ var index = text.indexOf('<');
+ if (index > 0) {
+ text = text.substring(index);
+ }
+
+ var ajaxResponse = OpenLayers.Util.Try(
+ function() {
+ var xmldom = new ActiveXObject('Microsoft.XMLDOM');
+ xmldom.loadXML(text);
+ return xmldom;
+ },
+ function() {
+ return new DOMParser().parseFromString(text, 'text/xml');
+ },
+ function() {
+ var req = new XMLHttpRequest();
+ req.open("GET", "data:" + "text/xml" +
+ ";charset=utf-8," + encodeURIComponent(text), false);
+ if (req.overrideMimeType) {
+ req.overrideMimeType("text/xml");
+ }
+ req.send(null);
+ return req.responseXML;
+ }
+ );
+
+ return ajaxResponse;
+};
+
+
+/**
+ * Namespace: OpenLayers.Ajax
+ */
+OpenLayers.Ajax = {
+
+ /**
+ * Method: emptyFunction
+ */
+ emptyFunction: function () {},
+
+ /**
+ * Method: getTransport
+ *
+ * Returns:
+ * {Object} Transport mechanism for whichever browser we're in, or false if
+ * none available.
+ */
+ getTransport: function() {
+ return OpenLayers.Util.Try(
+ function() {return new XMLHttpRequest();},
+ function() {return new ActiveXObject('Msxml2.XMLHTTP');},
+ function() {return new ActiveXObject('Microsoft.XMLHTTP');}
+ ) || false;
+ },
+
+ /**
+ * Property: activeRequestCount
+ * {Integer}
+ */
+ activeRequestCount: 0
+};
+
+/**
+ * Namespace: OpenLayers.Ajax.Responders
+ * {Object}
+ */
+OpenLayers.Ajax.Responders = {
+
+ /**
+ * Property: responders
+ * {Array}
+ */
+ responders: [],
+
+ /**
+ * Method: register
+ *
+ * Parameters:
+ * responderToAdd - {?}
+ */
+ register: function(responderToAdd) {
+ for (var i = 0; i < this.responders.length; i++){
+ if (responderToAdd == this.responders[i]){
+ return;
+ }
+ }
+ this.responders.push(responderToAdd);
+ },
+
+ /**
+ * Method: unregister
+ *
+ * Parameters:
+ * responderToRemove - {?}
+ */
+ unregister: function(responderToRemove) {
+ OpenLayers.Util.removeItem(this.reponders, responderToRemove);
+ },
+
+ /**
+ * Method: dispatch
+ *
+ * Parameters:
+ * callback - {?}
+ * request - {?}
+ * transport - {?}
+ */
+ dispatch: function(callback, request, transport) {
+ var responder;
+ for (var i = 0; i < this.responders.length; i++) {
+ responder = this.responders[i];
+
+ if (responder[callback] &&
+ typeof responder[callback] == 'function') {
+ try {
+ responder[callback].apply(responder,
+ [request, transport]);
+ } catch (e) {}
+ }
+ }
+ }
+};
+
+OpenLayers.Ajax.Responders.register({
+ /**
+ * Function: onCreate
+ */
+ onCreate: function() {
+ OpenLayers.Ajax.activeRequestCount++;
+ },
+
+ /**
+ * Function: onComplete
+ */
+ onComplete: function() {
+ OpenLayers.Ajax.activeRequestCount--;
+ }
+});
+
+/**
+ * Class: OpenLayers.Ajax.Base
+ */
+OpenLayers.Ajax.Base = OpenLayers.Class({
+
+ /**
+ * Constructor: OpenLayers.Ajax.Base
+ *
+ * Parameters:
+ * options - {Object}
+ */
+ initialize: function(options) {
+ this.options = {
+ method: 'post',
+ asynchronous: true,
+ contentType: 'application/xml',
+ parameters: ''
+ };
+ OpenLayers.Util.extend(this.options, options || {});
+
+ this.options.method = this.options.method.toLowerCase();
+
+ if (typeof this.options.parameters == 'string') {
+ this.options.parameters =
+ OpenLayers.Util.getParameters(this.options.parameters);
+ }
+ }
+});
+
+/**
+ * Class: OpenLayers.Ajax.Request
+ * *Deprecated*. Use <OpenLayers.Request> method instead.
+ *
+ * Inherit:
+ * - <OpenLayers.Ajax.Base>
+ */
+OpenLayers.Ajax.Request = OpenLayers.Class(OpenLayers.Ajax.Base, {
+
+ /**
+ * Property: _complete
+ *
+ * {Boolean}
+ */
+ _complete: false,
+
+ /**
+ * Constructor: OpenLayers.Ajax.Request
+ *
+ * Parameters:
+ * url - {String}
+ * options - {Object}
+ */
+ initialize: function(url, options) {
+ OpenLayers.Ajax.Base.prototype.initialize.apply(this, [options]);
+
+ if (OpenLayers.ProxyHost && OpenLayers.String.startsWith(url, "http")) {
+ url = OpenLayers.ProxyHost + encodeURIComponent(url);
+ }
+
+ this.transport = OpenLayers.Ajax.getTransport();
+ this.request(url);
+ },
+
+ /**
+ * Method: request
+ *
+ * Parameters:
+ * url - {String}
+ */
+ request: function(url) {
+ this.url = url;
+ this.method = this.options.method;
+ var params = OpenLayers.Util.extend({}, this.options.parameters);
+
+ if (this.method != 'get' && this.method != 'post') {
+ // simulate other verbs over post
+ params['_method'] = this.method;
+ this.method = 'post';
+ }
+
+ this.parameters = params;
+
+ if (params = OpenLayers.Util.getParameterString(params)) {
+ // when GET, append parameters to URL
+ if (this.method == 'get') {
+ this.url += ((this.url.indexOf('?') > -1) ? '&' : '?') + params;
+ } else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) {
+ params += '&_=';
+ }
+ }
+ try {
+ var response = new OpenLayers.Ajax.Response(this);
+ if (this.options.onCreate) {
+ this.options.onCreate(response);
+ }
+
+ OpenLayers.Ajax.Responders.dispatch('onCreate',
+ this,
+ response);
+
+ this.transport.open(this.method.toUpperCase(),
+ this.url,
+ this.options.asynchronous);
+
+ if (this.options.asynchronous) {
+ window.setTimeout(
+ OpenLayers.Function.bind(this.respondToReadyState, this, 1),
+ 10);
+ }
+
+ this.transport.onreadystatechange =
+ OpenLayers.Function.bind(this.onStateChange, this);
+ this.setRequestHeaders();
+
+ this.body = this.method == 'post' ?
+ (this.options.postBody || params) : null;
+ this.transport.send(this.body);
+
+ // Force Firefox to handle ready state 4 for synchronous requests
+ if (!this.options.asynchronous &&
+ this.transport.overrideMimeType) {
+ this.onStateChange();
+ }
+ } catch (e) {
+ this.dispatchException(e);
+ }
+ },
+
+ /**
+ * Method: onStateChange
+ */
+ onStateChange: function() {
+ var readyState = this.transport.readyState;
+ if (readyState > 1 && !((readyState == 4) && this._complete)) {
+ this.respondToReadyState(this.transport.readyState);
+ }
+ },
+
+ /**
+ * Method: setRequestHeaders
+ */
+ setRequestHeaders: function() {
+ var headers = {
+ 'X-Requested-With': 'XMLHttpRequest',
+ 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*',
+ 'OpenLayers': true
+ };
+
+ if (this.method == 'post') {
+ headers['Content-type'] = this.options.contentType +
+ (this.options.encoding ? '; charset=' + this.options.encoding : '');
+
+ /* Force "Connection: close" for older Mozilla browsers to work
+ * around a bug where XMLHttpRequest sends an incorrect
+ * Content-length header. See Mozilla Bugzilla #246651.
+ */
+ if (this.transport.overrideMimeType &&
+ (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005) {
+ headers['Connection'] = 'close';
+ }
+ }
+ // user-defined headers
+ if (typeof this.options.requestHeaders == 'object') {
+ var extras = this.options.requestHeaders;
+
+ if (typeof extras.push == 'function') {
+ for (var i = 0, length = extras.length; i < length; i += 2) {
+ headers[extras[i]] = extras[i+1];
+ }
+ } else {
+ for (var i in extras) {
+ headers[i] = extras[i];
+ }
+ }
+ }
+
+ for (var name in headers) {
+ this.transport.setRequestHeader(name, headers[name]);
+ }
+ },
+
+ /**
+ * Method: success
+ *
+ * Returns:
+ * {Boolean} -
+ */
+ success: function() {
+ var status = this.getStatus();
+ return !status || (status >=200 && status < 300);
+ },
+
+ /**
+ * Method: getStatus
+ *
+ * Returns:
+ * {Integer} - Status
+ */
+ getStatus: function() {
+ try {
+ return this.transport.status || 0;
+ } catch (e) {
+ return 0;
+ }
+ },
+
+ /**
+ * Method: respondToReadyState
+ *
+ * Parameters:
+ * readyState - {?}
+ */
+ respondToReadyState: function(readyState) {
+ var state = OpenLayers.Ajax.Request.Events[readyState];
+ var response = new OpenLayers.Ajax.Response(this);
+
+ if (state == 'Complete') {
+ try {
+ this._complete = true;
+ (this.options['on' + response.status] ||
+ this.options['on' + (this.success() ? 'Success' : 'Failure')] ||
+ OpenLayers.Ajax.emptyFunction)(response);
+ } catch (e) {
+ this.dispatchException(e);
+ }
+
+ var contentType = response.getHeader('Content-type');
+ }
+
+ try {
+ (this.options['on' + state] ||
+ OpenLayers.Ajax.emptyFunction)(response);
+ OpenLayers.Ajax.Responders.dispatch('on' + state,
+ this,
+ response);
+ } catch (e) {
+ this.dispatchException(e);
+ }
+
+ if (state == 'Complete') {
+ // avoid memory leak in MSIE: clean up
+ this.transport.onreadystatechange = OpenLayers.Ajax.emptyFunction;
+ }
+ },
+
+ /**
+ * Method: getHeader
+ *
+ * Parameters:
+ * name - {String} Header name
+ *
+ * Returns:
+ * {?} - response header for the given name
+ */
+ getHeader: function(name) {
+ try {
+ return this.transport.getResponseHeader(name);
+ } catch (e) {
+ return null;
+ }
+ },
+
+ /**
+ * Method: dispatchException
+ * If the optional onException function is set, execute it
+ * and then dispatch the call to any other listener registered
+ * for onException.
+ *
+ * If no optional onException function is set, we suspect that
+ * the user may have also not used
+ * OpenLayers.Ajax.Responders.register to register a listener
+ * for the onException call. To make sure that something
+ * gets done with this exception, only dispatch the call if there
+ * are listeners.
+ *
+ * If you explicitly want to swallow exceptions, set
+ * request.options.onException to an empty function (function(){})
+ * or register an empty function with <OpenLayers.Ajax.Responders>
+ * for onException.
+ *
+ * Parameters:
+ * exception - {?}
+ */
+ dispatchException: function(exception) {
+ var handler = this.options.onException;
+ if(handler) {
+ // call options.onException and alert any other listeners
+ handler(this, exception);
+ OpenLayers.Ajax.Responders.dispatch('onException', this, exception);
+ } else {
+ // check if there are any other listeners
+ var listener = false;
+ var responders = OpenLayers.Ajax.Responders.responders;
+ for (var i = 0; i < responders.length; i++) {
+ if(responders[i].onException) {
+ listener = true;
+ break;
+ }
+ }
+ if(listener) {
+ // call all listeners
+ OpenLayers.Ajax.Responders.dispatch('onException', this, exception);
+ } else {
+ // let the exception through
+ throw exception;
+ }
+ }
+ }
+});
+
+/**
+ * Property: Events
+ * {Array(String)}
+ */
+OpenLayers.Ajax.Request.Events =
+ ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
+
+/**
+ * Class: OpenLayers.Ajax.Response
+ */
+OpenLayers.Ajax.Response = OpenLayers.Class({
+
+ /**
+ * Property: status
+ *
+ * {Integer}
+ */
+ status: 0,
+
+
+ /**
+ * Property: statusText
+ *
+ * {String}
+ */
+ statusText: '',
+
+ /**
+ * Constructor: OpenLayers.Ajax.Response
+ *
+ * Parameters:
+ * request - {Object}
+ */
+ initialize: function(request) {
+ this.request = request;
+ var transport = this.transport = request.transport,
+ readyState = this.readyState = transport.readyState;
+
+ if ((readyState > 2 &&
+ !(!!(window.attachEvent && !window.opera))) ||
+ readyState == 4) {
+ this.status = this.getStatus();
+ this.statusText = this.getStatusText();
+ this.responseText = transport.responseText == null ?
+ '' : String(transport.responseText);
+ }
+
+ if(readyState == 4) {
+ var xml = transport.responseXML;
+ this.responseXML = xml === undefined ? null : xml;
+ }
+ },
+
+ /**
+ * Method: getStatus
+ */
+ getStatus: OpenLayers.Ajax.Request.prototype.getStatus,
+
+ /**
+ * Method: getStatustext
+ *
+ * Returns:
+ * {String} - statusText
+ */
+ getStatusText: function() {
+ try {
+ return this.transport.statusText || '';
+ } catch (e) {
+ return '';
+ }
+ },
+
+ /**
+ * Method: getHeader
+ */
+ getHeader: OpenLayers.Ajax.Request.prototype.getHeader,
+
+ /**
+ * Method: getResponseHeader
+ *
+ * Returns:
+ * {?} - response header for given name
+ */
+ getResponseHeader: function(name) {
+ return this.transport.getResponseHeader(name);
+ }
+});
+
+
+/**
+ * Function: getElementsByTagNameNS
+ *
+ * Parameters:
+ * parentnode - {?}
+ * nsuri - {?}
+ * nsprefix - {?}
+ * tagname - {?}
+ *
+ * Returns:
+ * {?}
+ */
+OpenLayers.Ajax.getElementsByTagNameNS = function(parentnode, nsuri,
+ nsprefix, tagname) {
+ var elem = null;
+ if (parentnode.getElementsByTagNameNS) {
+ elem = parentnode.getElementsByTagNameNS(nsuri, tagname);
+ } else {
+ elem = parentnode.getElementsByTagName(nsprefix + ':' + tagname);
+ }
+ return elem;
+};
+
+
+/**
+ * Function: serializeXMLToString
+ * Wrapper function around XMLSerializer, which doesn't exist/work in
+ * IE/Safari. We need to come up with a way to serialize in those browser:
+ * for now, these browsers will just fail. #535, #536
+ *
+ * Parameters:
+ * xmldom {XMLNode} xml dom to serialize
+ *
+ * Returns:
+ * {?}
+ */
+OpenLayers.Ajax.serializeXMLToString = function(xmldom) {
+ var serializer = new XMLSerializer();
+ var data = serializer.serializeToString(xmldom);
+ return data;
+};
+/* ======================================================================
OpenLayers/Control/DragPan.js
====================================================================== */
@@ -20838,6 +21162,7 @@
* graphicZIndex - {Number} The integer z-index value to use in rendering.
* graphicName - {String} Named graphic to use when rendering points. Supported values include "circle" (default),
* "square", "star", "x", "cross", "triangle".
+ * graphicTitle - {String} Tooltip for an external graphic. Only supported in Firefox and Internet Explorer.
* backgroundGraphic - {String} Url to a graphic to be used as the background under an externalGraphic.
* backgroundGraphicZIndex - {Number} The integer z-index value to use in rendering the background graphic.
* backgroundXOffset - {Number} The x offset (in pixels) for the background graphic.
@@ -22908,7 +23233,7 @@
* Constant: EVENT_TYPES
*
* Supported event types:
- * - *featureadded* Triggered when a feature is added
+ * featureadded - Triggered when a feature is added
*/
EVENT_TYPES: ["featureadded"],
@@ -23016,10 +23341,10 @@
* properties of this event depends on exactly what happened.
*
* Supported control event types (in addition to those from <OpenLayers.Control>):
- * - *measure* Triggered when a measurement sketch is complete. Listeners
+ * measure - Triggered when a measurement sketch is complete. Listeners
* will receive an event with measure, units, order, and geometry
* properties.
- * - *measurepartial* Triggered when a new point is added to the
+ * measurepartial - Triggered when a new point is added to the
* measurement sketch. Listeners receive an event with measure,
* units, order, and geometry.
*/
@@ -25252,7 +25577,7 @@
var rules = this.rules;
var symbolizer, value;
for (var i=0, len=rules.length; i<len; i++) {
- var symbolizer = rules[i].symbolizer;
+ symbolizer = rules[i].symbolizer;
for (var key in symbolizer) {
value = symbolizer[key];
if (typeof value == "object") {
@@ -25546,7 +25871,7 @@
},
/**
- * Method: defaultRightDblClick
+ * Method: defaultDblRightClick
*
* Parameters:
* evt - {Event}
@@ -27122,10 +27447,9 @@
* {<OpenLayers.Rule>}
*/
initialize: function(options) {
- this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
this.symbolizer = {};
-
OpenLayers.Util.extend(this, options);
+ this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
},
/**
@@ -27199,6 +27523,33 @@
}
return context;
},
+
+ /**
+ * APIMethod: clone
+ * Clones this rule.
+ *
+ * Returns:
+ * {<OpenLayers.Rule>} Clone of this rule.
+ */
+ clone: function() {
+ var options = OpenLayers.Util.extend({}, this);
+ // clone symbolizer
+ options.symbolizer = {};
+ for(var key in this.symbolizer) {
+ value = this.symbolizer[key];
+ type = typeof value;
+ if(type === "object") {
+ options.symbolizer[key] = OpenLayers.Util.extend({}, value);
+ } else if(type === "string") {
+ options.symbolizer[key] = value;
+ }
+ }
+ // clone filter
+ options.filter = this.filter && this.filter.clone();
+ // clone context
+ options.context = this.context && OpenLayers.Util.extend({}, this.context);
+ return new OpenLayers.Rule(options);
+ },
CLASS_NAME: "OpenLayers.Rule"
});
@@ -27625,11 +27976,13 @@
/**
* APIMethod: move
- * Moves a collection in place
+ * Moves a geometry by the given displacement along positive x and y axes.
+ * This modifies the position of the geometry and clears the cached
+ * bounds.
*
* Parameters:
- * x - {Float} The x-displacement (in map units)
- * y - {Float} The y-displacement (in map units)
+ * x - {Float} Distance to move geometry in positive x direction.
+ * y - {Float} Distance to move geometry in positive y direction.
*/
move: function(x, y) {
for(var i=0, len=this.components.length; i<len; i++) {
@@ -27721,15 +28074,16 @@
return best;
},
- /**
+ /**
* APIMethod: equals
- * Tests for equivalent geometries
- *
+ * Determine whether another geometry is equivalent to this one. Geometries
+ * are considered equivalent if all components have the same coordinates.
+ *
* Parameters:
- * geometry - {<OpenLayers.Geometry>}
+ * geom - {<OpenLayers.Geometry>} The geometry to test.
*
* Returns:
- * {Boolean} The coordinates are equivalent
+ * {Boolean} The supplied geometry is equivalent to this geometry.
*/
equals: function(geometry) {
var equivalent = true;
@@ -27948,18 +28302,17 @@
},
/**
- * APIMethod: equals
- *
- * Parameters:
- * xy - {<OpenLayers.Geometry>}
- *
- * Returns:
- * {Boolean} Boolean value indicating whether the passed-in
- * {<OpenLayers.Geometry>} object has the same components as this
- * note that if ll passed in is null, returns false
- *
- */
- equals:function(geom) {
+ * APIMethod: equals
+ * Determine whether another geometry is equivalent to this one. Geometries
+ * are considered equivalent if all components have the same coordinates.
+ *
+ * Parameters:
+ * geom - {<OpenLayers.Geometry.Point>} The geometry to test.
+ *
+ * Returns:
+ * {Boolean} The supplied geometry is equivalent to this geometry.
+ */
+ equals: function(geom) {
var equals = false;
if (geom != null) {
equals = ((this.x == geom.x && this.y == geom.y) ||
@@ -27981,11 +28334,13 @@
/**
* APIMethod: move
- * Moves a point in place
+ * Moves a geometry by the given displacement along positive x and y axes.
+ * This modifies the position of the geometry and clears the cached
+ * bounds.
*
* Parameters:
- * x - {Float}
- * y - {Float}
+ * x - {Float} Distance to move geometry in positive x direction.
+ * y - {Float} Distance to move geometry in positive y direction.
*/
move: function(x, y) {
this.x = this.x + x;
@@ -28143,62 +28498,62 @@
* properties of this event depends on exactly what happened.
*
* All event objects have at least the following properties:
- * - *object* {Object} A reference to layer.events.object.
- * - *element* {DOMElement} A reference to layer.events.element.
+ * object - {Object} A reference to layer.events.object.
+ * element - {DOMElement} A reference to layer.events.element.
*
* Supported map event types (in addition to those from <OpenLayers.Layer>):
- * - *beforefeatureadded* Triggered before a feature is added. Listeners
+ * beforefeatureadded - Triggered before a feature is added. Listeners
* will receive an object with a *feature* property referencing the
* feature to be added. To stop the feature from being added, a
* listener should return false.
- * - *beforefeaturesadded* Triggered before an array of features is added.
+ * beforefeaturesadded - Triggered before an array of features is added.
* Listeners will receive an object with a *features* property
* referencing the feature to be added. To stop the features from
* being added, a listener should return false.
- * - *featureadded* Triggered after a feature is added. The event
+ * featureadded - Triggered after a feature is added. The event
* object passed to listeners will have a *feature* property with a
* reference to the added feature.
- * - *featuresadded* Triggered after features are added. The event
+ * featuresadded - Triggered after features are added. The event
* object passed to listeners will have a *features* property with a
* reference to an array of added features.
- * - *beforefeatureremoved* Triggered before a feature is removed. Listeners
+ * beforefeatureremoved - Triggered before a feature is removed. Listeners
* will receive an object with a *feature* property referencing the
* feature to be removed.
- * - *featureremoved* Triggerd after a feature is removed. The event
+ * featureremoved - Triggerd after a feature is removed. The event
* object passed to listeners will have a *feature* property with a
* reference to the removed feature.
- * - *featuresremoved* Triggered after features are removed. The event
+ * featuresremoved - Triggered after features are removed. The event
* object passed to listeners will have a *features* property with a
* reference to an array of removed features.
- * - *featureselected* Triggered after a feature is selected. Listeners
+ * featureselected - Triggered after a feature is selected. Listeners
* will receive an object with a *feature* property referencing the
* selected feature.
- * - *featureunselected* Triggered after a feature is unselected.
+ * featureunselected - Triggered after a feature is unselected.
* Listeners will receive an object with a *feature* property
* referencing the unselected feature.
- * - *beforefeaturemodified* Triggered when a feature is selected to
+ * beforefeaturemodified - Triggered when a feature is selected to
* be modified. Listeners will receive an object with a *feature*
* property referencing the selected feature.
- * - *featuremodified* Triggered when a feature has been modified.
+ * featuremodified - Triggered when a feature has been modified.
* Listeners will receive an object with a *feature* property referencing
* the modified feature.
- * - *afterfeaturemodified* Triggered when a feature is finished being modified.
+ * afterfeaturemodified - Triggered when a feature is finished being modified.
* Listeners will receive an object with a *feature* property referencing
* the modified feature.
- * - *vertexmodified* Triggered when a vertex within any feature geometry
+ * vertexmodified - Triggered when a vertex within any feature geometry
* has been modified. Listeners will receive an object with a
* *feature* property referencing the modified feature, a *vertex*
* property referencing the vertex modified (always a point geometry),
* and a *pixel* property referencing the pixel location of the
* modification.
- * - *sketchmodified* Triggered when a feature sketch bound for this layer
+ * sketchmodified - Triggered when a feature sketch bound for this layer
* is modified. Listeners will receive an object with a *vertex*
* property referencing the modified vertex.
- * - *sketchcomplete* Triggered when a feature sketch bound for this layer
+ * sketchcomplete - Triggered when a feature sketch bound for this layer
* is complete. Listeners will receive an object with a *feature*
* property referencing the sketch feature. By returning false, a
* listener can stop the sketch feature from being added to the layer.
- * - *refresh* Triggered when something wants a strategy to ask the protocol
+ * refresh - Triggered when something wants a strategy to ask the protocol
* for a new set of features.
*/
EVENT_TYPES: ["beforefeatureadded", "beforefeaturesadded",
@@ -28409,7 +28764,7 @@
* the refresh event.
*/
refresh: function(obj) {
- if(this.inRange && this.visibility) {
+ if(this.calculateInRange() && this.visibility) {
this.events.triggerEvent("refresh", obj);
}
},
@@ -28555,6 +28910,23 @@
}
}
},
+
+ /**
+ * APIMethod: display
+ * Hide or show the Layer
+ *
+ * Parameters:
+ * display - {Boolean}
+ */
+ display: function(display) {
+ OpenLayers.Layer.prototype.display.apply(this, arguments);
+ // we need to set the display style of the root in case it is attached
+ // to a foreign layer
+ var currentDisplay = this.div.style.display;
+ if(currentDisplay != this.renderer.root.style.display) {
+ this.renderer.root.style.display = currentDisplay;
+ }
+ },
/**
* APIMethod: addFeatures
@@ -30058,11 +30430,13 @@
/**
* APIMethod: move
- * Moves a collection in place
+ * Moves a geometry by the given displacement along positive x and y axes.
+ * This modifies the position of the geometry and clears the cached
+ * bounds.
*
* Parameters:
- * x - {Float} The x-displacement (in map units)
- * y - {Float} The y-displacement (in map units)
+ * x - {Float} Distance to move geometry in positive x direction.
+ * y - {Float} Distance to move geometry in positive y direction.
*/
move: function(x, y) {
for(var i = 0, len=this.components.length; i<len - 1; i++) {
More information about the fusion-commits
mailing list