--- /srv/reproducible-results/rbuild-debian/r-b-build.QO7Iruup/b1/openlayers_2.13.1+ds2-10_armhf.changes
+++ /srv/reproducible-results/rbuild-debian/r-b-build.QO7Iruup/b2/openlayers_2.13.1+ds2-10_armhf.changes
├── Files
│ @@ -1,2 +1,2 @@
│
│ - 9e3c6a14afbb7683194770a347211734 713124 javascript optional libjs-openlayers_2.13.1+ds2-10_all.deb
│ + cbb0f00fa1d37ad5edad1a9e6ffce0d1 704676 javascript optional libjs-openlayers_2.13.1+ds2-10_all.deb
├── libjs-openlayers_2.13.1+ds2-10_all.deb
│ ├── file list
│ │ @@ -1,3 +1,3 @@
│ │ -rw-r--r-- 0 0 0 4 2023-01-14 13:27:41.000000 debian-binary
│ │ -rw-r--r-- 0 0 0 3680 2023-01-14 13:27:41.000000 control.tar.xz
│ │ --rw-r--r-- 0 0 0 709252 2023-01-14 13:27:41.000000 data.tar.xz
│ │ +-rw-r--r-- 0 0 0 700804 2023-01-14 13:27:41.000000 data.tar.xz
│ ├── control.tar.xz
│ │ ├── control.tar
│ │ │ ├── ./md5sums
│ │ │ │ ├── ./md5sums
│ │ │ │ │┄ Files differ
│ ├── data.tar.xz
│ │ ├── data.tar
│ │ │ ├── ./usr/share/javascript/openlayers/OpenLayers.js
│ │ │ │ ├── js-beautify {}
│ │ │ │ │ @@ -136,14 +136,141 @@
│ │ │ │ │ * (code)
│ │ │ │ │ *
│ │ │ │ │ * (end code)
│ │ │ │ │ */
│ │ │ │ │ ImgPath: ''
│ │ │ │ │ };
│ │ │ │ │ /* ======================================================================
│ │ │ │ │ + OpenLayers/BaseTypes/Class.js
│ │ │ │ │ + ====================================================================== */
│ │ │ │ │ +
│ │ │ │ │ +/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
│ │ │ │ │ + * full list of contributors). Published under the 2-clause BSD license.
│ │ │ │ │ + * See license.txt in the OpenLayers distribution or repository for the
│ │ │ │ │ + * full text of the license. */
│ │ │ │ │ +
│ │ │ │ │ +/**
│ │ │ │ │ + * @requires OpenLayers/SingleFile.js
│ │ │ │ │ + */
│ │ │ │ │ +
│ │ │ │ │ +/**
│ │ │ │ │ + * Constructor: OpenLayers.Class
│ │ │ │ │ + * Base class used to construct all other classes. Includes support for
│ │ │ │ │ + * multiple inheritance.
│ │ │ │ │ + *
│ │ │ │ │ + * This constructor is new in OpenLayers 2.5. At OpenLayers 3.0, the old
│ │ │ │ │ + * syntax for creating classes and dealing with inheritance
│ │ │ │ │ + * will be removed.
│ │ │ │ │ + *
│ │ │ │ │ + * To create a new OpenLayers-style class, use the following syntax:
│ │ │ │ │ + * (code)
│ │ │ │ │ + * var MyClass = OpenLayers.Class(prototype);
│ │ │ │ │ + * (end)
│ │ │ │ │ + *
│ │ │ │ │ + * To create a new OpenLayers-style class with multiple inheritance, use the
│ │ │ │ │ + * following syntax:
│ │ │ │ │ + * (code)
│ │ │ │ │ + * var MyClass = OpenLayers.Class(Class1, Class2, prototype);
│ │ │ │ │ + * (end)
│ │ │ │ │ + *
│ │ │ │ │ + * Note that instanceof reflection will only reveal Class1 as superclass.
│ │ │ │ │ + *
│ │ │ │ │ + */
│ │ │ │ │ +OpenLayers.Class = function() {
│ │ │ │ │ + var len = arguments.length;
│ │ │ │ │ + var P = arguments[0];
│ │ │ │ │ + var F = arguments[len - 1];
│ │ │ │ │ +
│ │ │ │ │ + var C = typeof F.initialize == "function" ?
│ │ │ │ │ + F.initialize :
│ │ │ │ │ + function() {
│ │ │ │ │ + P.prototype.initialize.apply(this, arguments);
│ │ │ │ │ + };
│ │ │ │ │ +
│ │ │ │ │ + if (len > 1) {
│ │ │ │ │ + var newArgs = [C, P].concat(
│ │ │ │ │ + Array.prototype.slice.call(arguments).slice(1, len - 1), F);
│ │ │ │ │ + OpenLayers.inherit.apply(null, newArgs);
│ │ │ │ │ + } else {
│ │ │ │ │ + C.prototype = F;
│ │ │ │ │ + }
│ │ │ │ │ + return C;
│ │ │ │ │ +};
│ │ │ │ │ +
│ │ │ │ │ +/**
│ │ │ │ │ + * Function: OpenLayers.inherit
│ │ │ │ │ + *
│ │ │ │ │ + * Parameters:
│ │ │ │ │ + * C - {Object} the class that inherits
│ │ │ │ │ + * P - {Object} the superclass to inherit from
│ │ │ │ │ + *
│ │ │ │ │ + * In addition to the mandatory C and P parameters, an arbitrary number of
│ │ │ │ │ + * objects can be passed, which will extend C.
│ │ │ │ │ + */
│ │ │ │ │ +OpenLayers.inherit = function(C, P) {
│ │ │ │ │ + var F = function() {};
│ │ │ │ │ + F.prototype = P.prototype;
│ │ │ │ │ + C.prototype = new F;
│ │ │ │ │ + var i, l, o;
│ │ │ │ │ + for (i = 2, l = arguments.length; i < l; i++) {
│ │ │ │ │ + o = arguments[i];
│ │ │ │ │ + if (typeof o === "function") {
│ │ │ │ │ + o = o.prototype;
│ │ │ │ │ + }
│ │ │ │ │ + OpenLayers.Util.extend(C.prototype, o);
│ │ │ │ │ + }
│ │ │ │ │ +};
│ │ │ │ │ +
│ │ │ │ │ +/**
│ │ │ │ │ + * APIFunction: extend
│ │ │ │ │ + * Copy all properties of a source object to a destination object. Modifies
│ │ │ │ │ + * the passed in destination object. Any properties on the source object
│ │ │ │ │ + * that are set to undefined will not be (re)set on the destination object.
│ │ │ │ │ + *
│ │ │ │ │ + * Parameters:
│ │ │ │ │ + * destination - {Object} The object that will be modified
│ │ │ │ │ + * source - {Object} The object with properties to be set on the destination
│ │ │ │ │ + *
│ │ │ │ │ + * Returns:
│ │ │ │ │ + * {Object} The destination object.
│ │ │ │ │ + */
│ │ │ │ │ +OpenLayers.Util = OpenLayers.Util || {};
│ │ │ │ │ +OpenLayers.Util.extend = function(destination, source) {
│ │ │ │ │ + destination = destination || {};
│ │ │ │ │ + if (source) {
│ │ │ │ │ + for (var property in source) {
│ │ │ │ │ + var value = source[property];
│ │ │ │ │ + if (value !== undefined) {
│ │ │ │ │ + destination[property] = value;
│ │ │ │ │ + }
│ │ │ │ │ + }
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * IE doesn't include the toString property when iterating over an object's
│ │ │ │ │ + * properties with the for(property in object) syntax. Explicitly check if
│ │ │ │ │ + * the source has its own toString property.
│ │ │ │ │ + */
│ │ │ │ │ +
│ │ │ │ │ + /*
│ │ │ │ │ + * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
│ │ │ │ │ + * prototype object" when calling hawOwnProperty if the source object
│ │ │ │ │ + * is an instance of window.Event.
│ │ │ │ │ + */
│ │ │ │ │ +
│ │ │ │ │ + var sourceIsEvt = typeof window.Event == "function" &&
│ │ │ │ │ + source instanceof window.Event;
│ │ │ │ │ +
│ │ │ │ │ + if (!sourceIsEvt &&
│ │ │ │ │ + source.hasOwnProperty && source.hasOwnProperty("toString")) {
│ │ │ │ │ + destination.toString = source.toString;
│ │ │ │ │ + }
│ │ │ │ │ + }
│ │ │ │ │ + return destination;
│ │ │ │ │ +};
│ │ │ │ │ +/* ======================================================================
│ │ │ │ │ OpenLayers/BaseTypes.js
│ │ │ │ │ ====================================================================== */
│ │ │ │ │
│ │ │ │ │ /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
│ │ │ │ │ * full list of contributors). Published under the 2-clause BSD license.
│ │ │ │ │ * See license.txt in the OpenLayers distribution or repository for the
│ │ │ │ │ * full text of the license. */
│ │ │ │ │ @@ -603,141 +730,14 @@
│ │ │ │ │ }
│ │ │ │ │ }
│ │ │ │ │ return selected;
│ │ │ │ │ }
│ │ │ │ │
│ │ │ │ │ };
│ │ │ │ │ /* ======================================================================
│ │ │ │ │ - OpenLayers/BaseTypes/Class.js
│ │ │ │ │ - ====================================================================== */
│ │ │ │ │ -
│ │ │ │ │ -/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
│ │ │ │ │ - * full list of contributors). Published under the 2-clause BSD license.
│ │ │ │ │ - * See license.txt in the OpenLayers distribution or repository for the
│ │ │ │ │ - * full text of the license. */
│ │ │ │ │ -
│ │ │ │ │ -/**
│ │ │ │ │ - * @requires OpenLayers/SingleFile.js
│ │ │ │ │ - */
│ │ │ │ │ -
│ │ │ │ │ -/**
│ │ │ │ │ - * Constructor: OpenLayers.Class
│ │ │ │ │ - * Base class used to construct all other classes. Includes support for
│ │ │ │ │ - * multiple inheritance.
│ │ │ │ │ - *
│ │ │ │ │ - * This constructor is new in OpenLayers 2.5. At OpenLayers 3.0, the old
│ │ │ │ │ - * syntax for creating classes and dealing with inheritance
│ │ │ │ │ - * will be removed.
│ │ │ │ │ - *
│ │ │ │ │ - * To create a new OpenLayers-style class, use the following syntax:
│ │ │ │ │ - * (code)
│ │ │ │ │ - * var MyClass = OpenLayers.Class(prototype);
│ │ │ │ │ - * (end)
│ │ │ │ │ - *
│ │ │ │ │ - * To create a new OpenLayers-style class with multiple inheritance, use the
│ │ │ │ │ - * following syntax:
│ │ │ │ │ - * (code)
│ │ │ │ │ - * var MyClass = OpenLayers.Class(Class1, Class2, prototype);
│ │ │ │ │ - * (end)
│ │ │ │ │ - *
│ │ │ │ │ - * Note that instanceof reflection will only reveal Class1 as superclass.
│ │ │ │ │ - *
│ │ │ │ │ - */
│ │ │ │ │ -OpenLayers.Class = function() {
│ │ │ │ │ - var len = arguments.length;
│ │ │ │ │ - var P = arguments[0];
│ │ │ │ │ - var F = arguments[len - 1];
│ │ │ │ │ -
│ │ │ │ │ - var C = typeof F.initialize == "function" ?
│ │ │ │ │ - F.initialize :
│ │ │ │ │ - function() {
│ │ │ │ │ - P.prototype.initialize.apply(this, arguments);
│ │ │ │ │ - };
│ │ │ │ │ -
│ │ │ │ │ - if (len > 1) {
│ │ │ │ │ - var newArgs = [C, P].concat(
│ │ │ │ │ - Array.prototype.slice.call(arguments).slice(1, len - 1), F);
│ │ │ │ │ - OpenLayers.inherit.apply(null, newArgs);
│ │ │ │ │ - } else {
│ │ │ │ │ - C.prototype = F;
│ │ │ │ │ - }
│ │ │ │ │ - return C;
│ │ │ │ │ -};
│ │ │ │ │ -
│ │ │ │ │ -/**
│ │ │ │ │ - * Function: OpenLayers.inherit
│ │ │ │ │ - *
│ │ │ │ │ - * Parameters:
│ │ │ │ │ - * C - {Object} the class that inherits
│ │ │ │ │ - * P - {Object} the superclass to inherit from
│ │ │ │ │ - *
│ │ │ │ │ - * In addition to the mandatory C and P parameters, an arbitrary number of
│ │ │ │ │ - * objects can be passed, which will extend C.
│ │ │ │ │ - */
│ │ │ │ │ -OpenLayers.inherit = function(C, P) {
│ │ │ │ │ - var F = function() {};
│ │ │ │ │ - F.prototype = P.prototype;
│ │ │ │ │ - C.prototype = new F;
│ │ │ │ │ - var i, l, o;
│ │ │ │ │ - for (i = 2, l = arguments.length; i < l; i++) {
│ │ │ │ │ - o = arguments[i];
│ │ │ │ │ - if (typeof o === "function") {
│ │ │ │ │ - o = o.prototype;
│ │ │ │ │ - }
│ │ │ │ │ - OpenLayers.Util.extend(C.prototype, o);
│ │ │ │ │ - }
│ │ │ │ │ -};
│ │ │ │ │ -
│ │ │ │ │ -/**
│ │ │ │ │ - * APIFunction: extend
│ │ │ │ │ - * Copy all properties of a source object to a destination object. Modifies
│ │ │ │ │ - * the passed in destination object. Any properties on the source object
│ │ │ │ │ - * that are set to undefined will not be (re)set on the destination object.
│ │ │ │ │ - *
│ │ │ │ │ - * Parameters:
│ │ │ │ │ - * destination - {Object} The object that will be modified
│ │ │ │ │ - * source - {Object} The object with properties to be set on the destination
│ │ │ │ │ - *
│ │ │ │ │ - * Returns:
│ │ │ │ │ - * {Object} The destination object.
│ │ │ │ │ - */
│ │ │ │ │ -OpenLayers.Util = OpenLayers.Util || {};
│ │ │ │ │ -OpenLayers.Util.extend = function(destination, source) {
│ │ │ │ │ - destination = destination || {};
│ │ │ │ │ - if (source) {
│ │ │ │ │ - for (var property in source) {
│ │ │ │ │ - var value = source[property];
│ │ │ │ │ - if (value !== undefined) {
│ │ │ │ │ - destination[property] = value;
│ │ │ │ │ - }
│ │ │ │ │ - }
│ │ │ │ │ -
│ │ │ │ │ - /**
│ │ │ │ │ - * IE doesn't include the toString property when iterating over an object's
│ │ │ │ │ - * properties with the for(property in object) syntax. Explicitly check if
│ │ │ │ │ - * the source has its own toString property.
│ │ │ │ │ - */
│ │ │ │ │ -
│ │ │ │ │ - /*
│ │ │ │ │ - * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
│ │ │ │ │ - * prototype object" when calling hawOwnProperty if the source object
│ │ │ │ │ - * is an instance of window.Event.
│ │ │ │ │ - */
│ │ │ │ │ -
│ │ │ │ │ - var sourceIsEvt = typeof window.Event == "function" &&
│ │ │ │ │ - source instanceof window.Event;
│ │ │ │ │ -
│ │ │ │ │ - if (!sourceIsEvt &&
│ │ │ │ │ - source.hasOwnProperty && source.hasOwnProperty("toString")) {
│ │ │ │ │ - destination.toString = source.toString;
│ │ │ │ │ - }
│ │ │ │ │ - }
│ │ │ │ │ - return destination;
│ │ │ │ │ -};
│ │ │ │ │ -/* ======================================================================
│ │ │ │ │ OpenLayers/BaseTypes/Bounds.js
│ │ │ │ │ ====================================================================== */
│ │ │ │ │
│ │ │ │ │ /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
│ │ │ │ │ * full list of contributors). Published under the 2-clause BSD license.
│ │ │ │ │ * See license.txt in the OpenLayers distribution or repository for the
│ │ │ │ │ * full text of the license. */
│ │ │ │ │ @@ -4426,155 +4426,14 @@
│ │ │ │ │ } else {
│ │ │ │ │ str += coordinate < 0 ? OpenLayers.i18n("S") : OpenLayers.i18n("N");
│ │ │ │ │ }
│ │ │ │ │ return str;
│ │ │ │ │ };
│ │ │ │ │
│ │ │ │ │ /* ======================================================================
│ │ │ │ │ - OpenLayers/Util/vendorPrefix.js
│ │ │ │ │ - ====================================================================== */
│ │ │ │ │ -
│ │ │ │ │ -/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
│ │ │ │ │ - * full list of contributors). Published under the 2-clause BSD license.
│ │ │ │ │ - * See license.txt in the OpenLayers distribution or repository for the
│ │ │ │ │ - * full text of the license. */
│ │ │ │ │ -
│ │ │ │ │ -/**
│ │ │ │ │ - * @requires OpenLayers/SingleFile.js
│ │ │ │ │ - */
│ │ │ │ │ -
│ │ │ │ │ -OpenLayers.Util = OpenLayers.Util || {};
│ │ │ │ │ -/**
│ │ │ │ │ - * Namespace: OpenLayers.Util.vendorPrefix
│ │ │ │ │ - * A collection of utility functions to detect vendor prefixed features
│ │ │ │ │ - */
│ │ │ │ │ -OpenLayers.Util.vendorPrefix = (function() {
│ │ │ │ │ - "use strict";
│ │ │ │ │ -
│ │ │ │ │ - var VENDOR_PREFIXES = ["", "O", "ms", "Moz", "Webkit"],
│ │ │ │ │ - divStyle = document.createElement("div").style,
│ │ │ │ │ - cssCache = {},
│ │ │ │ │ - jsCache = {};
│ │ │ │ │ -
│ │ │ │ │ -
│ │ │ │ │ - /**
│ │ │ │ │ - * Function: domToCss
│ │ │ │ │ - * Converts a upper camel case DOM style property name to a CSS property
│ │ │ │ │ - * i.e. transformOrigin -> transform-origin
│ │ │ │ │ - * or WebkitTransformOrigin -> -webkit-transform-origin
│ │ │ │ │ - *
│ │ │ │ │ - * Parameters:
│ │ │ │ │ - * prefixedDom - {String} The property to convert
│ │ │ │ │ - *
│ │ │ │ │ - * Returns:
│ │ │ │ │ - * {String} The CSS property
│ │ │ │ │ - */
│ │ │ │ │ - function domToCss(prefixedDom) {
│ │ │ │ │ - if (!prefixedDom) {
│ │ │ │ │ - return null;
│ │ │ │ │ - }
│ │ │ │ │ - return prefixedDom.
│ │ │ │ │ - replace(/([A-Z])/g, function(c) {
│ │ │ │ │ - return "-" + c.toLowerCase();
│ │ │ │ │ - }).
│ │ │ │ │ - replace(/^ms-/, "-ms-");
│ │ │ │ │ - }
│ │ │ │ │ -
│ │ │ │ │ - /**
│ │ │ │ │ - * APIMethod: css
│ │ │ │ │ - * Detect which property is used for a CSS property
│ │ │ │ │ - *
│ │ │ │ │ - * Parameters:
│ │ │ │ │ - * property - {String} The standard (unprefixed) CSS property name
│ │ │ │ │ - *
│ │ │ │ │ - * Returns:
│ │ │ │ │ - * {String} The standard CSS property, prefixed property or null if not
│ │ │ │ │ - * supported
│ │ │ │ │ - */
│ │ │ │ │ - function css(property) {
│ │ │ │ │ - if (cssCache[property] === undefined) {
│ │ │ │ │ - var domProperty = property.
│ │ │ │ │ - replace(/(-[\s\S])/g, function(c) {
│ │ │ │ │ - return c.charAt(1).toUpperCase();
│ │ │ │ │ - });
│ │ │ │ │ - var prefixedDom = style(domProperty);
│ │ │ │ │ - cssCache[property] = domToCss(prefixedDom);
│ │ │ │ │ - }
│ │ │ │ │ - return cssCache[property];
│ │ │ │ │ - }
│ │ │ │ │ -
│ │ │ │ │ - /**
│ │ │ │ │ - * APIMethod: js
│ │ │ │ │ - * Detect which property is used for a JS property/method
│ │ │ │ │ - *
│ │ │ │ │ - * Parameters:
│ │ │ │ │ - * obj - {Object} The object to test on
│ │ │ │ │ - * property - {String} The standard (unprefixed) JS property name
│ │ │ │ │ - *
│ │ │ │ │ - * Returns:
│ │ │ │ │ - * {String} The standard JS property, prefixed property or null if not
│ │ │ │ │ - * supported
│ │ │ │ │ - */
│ │ │ │ │ - function js(obj, property) {
│ │ │ │ │ - if (jsCache[property] === undefined) {
│ │ │ │ │ - var tmpProp,
│ │ │ │ │ - i = 0,
│ │ │ │ │ - l = VENDOR_PREFIXES.length,
│ │ │ │ │ - prefix,
│ │ │ │ │ - isStyleObj = (typeof obj.cssText !== "undefined");
│ │ │ │ │ -
│ │ │ │ │ - jsCache[property] = null;
│ │ │ │ │ - for (; i < l; i++) {
│ │ │ │ │ - prefix = VENDOR_PREFIXES[i];
│ │ │ │ │ - if (prefix) {
│ │ │ │ │ - if (!isStyleObj) {
│ │ │ │ │ - // js prefix should be lower-case, while style
│ │ │ │ │ - // properties have upper case on first character
│ │ │ │ │ - prefix = prefix.toLowerCase();
│ │ │ │ │ - }
│ │ │ │ │ - tmpProp = prefix + property.charAt(0).toUpperCase() + property.slice(1);
│ │ │ │ │ - } else {
│ │ │ │ │ - tmpProp = property;
│ │ │ │ │ - }
│ │ │ │ │ -
│ │ │ │ │ - if (obj[tmpProp] !== undefined) {
│ │ │ │ │ - jsCache[property] = tmpProp;
│ │ │ │ │ - break;
│ │ │ │ │ - }
│ │ │ │ │ - }
│ │ │ │ │ - }
│ │ │ │ │ - return jsCache[property];
│ │ │ │ │ - }
│ │ │ │ │ -
│ │ │ │ │ - /**
│ │ │ │ │ - * APIMethod: style
│ │ │ │ │ - * Detect which property is used for a DOM style property
│ │ │ │ │ - *
│ │ │ │ │ - * Parameters:
│ │ │ │ │ - * property - {String} The standard (unprefixed) style property name
│ │ │ │ │ - *
│ │ │ │ │ - * Returns:
│ │ │ │ │ - * {String} The standard style property, prefixed property or null if not
│ │ │ │ │ - * supported
│ │ │ │ │ - */
│ │ │ │ │ - function style(property) {
│ │ │ │ │ - return js(divStyle, property);
│ │ │ │ │ - }
│ │ │ │ │ -
│ │ │ │ │ - return {
│ │ │ │ │ - css: css,
│ │ │ │ │ - js: js,
│ │ │ │ │ - style: style,
│ │ │ │ │ -
│ │ │ │ │ - // used for testing
│ │ │ │ │ - cssCache: cssCache,
│ │ │ │ │ - jsCache: jsCache
│ │ │ │ │ - };
│ │ │ │ │ -}());
│ │ │ │ │ -/* ======================================================================
│ │ │ │ │ OpenLayers/Events.js
│ │ │ │ │ ====================================================================== */
│ │ │ │ │
│ │ │ │ │ /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
│ │ │ │ │ * full list of contributors). Published under the 2-clause BSD license.
│ │ │ │ │ * See license.txt in the OpenLayers distribution or repository for the
│ │ │ │ │ * full text of the license. */
│ │ │ │ │ @@ -5743,14 +5602,484 @@
│ │ │ │ │
│ │ │ │ │ OpenLayers.Event.observe(element, 'MSPointerUp', cb);
│ │ │ │ │ },
│ │ │ │ │
│ │ │ │ │ CLASS_NAME: "OpenLayers.Events"
│ │ │ │ │ });
│ │ │ │ │ /* ======================================================================
│ │ │ │ │ + OpenLayers/Handler.js
│ │ │ │ │ + ====================================================================== */
│ │ │ │ │ +
│ │ │ │ │ +/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
│ │ │ │ │ + * full list of contributors). Published under the 2-clause BSD license.
│ │ │ │ │ + * See license.txt in the OpenLayers distribution or repository for the
│ │ │ │ │ + * full text of the license. */
│ │ │ │ │ +
│ │ │ │ │ +/**
│ │ │ │ │ + * @requires OpenLayers/BaseTypes/Class.js
│ │ │ │ │ + * @requires OpenLayers/Events.js
│ │ │ │ │ + */
│ │ │ │ │ +
│ │ │ │ │ +/**
│ │ │ │ │ + * Class: OpenLayers.Handler
│ │ │ │ │ + * Base class to construct a higher-level handler for event sequences. All
│ │ │ │ │ + * handlers have activate and deactivate methods. In addition, they have
│ │ │ │ │ + * methods named like browser events. When a handler is activated, any
│ │ │ │ │ + * additional methods named like a browser event is registered as a
│ │ │ │ │ + * listener for the corresponding event. When a handler is deactivated,
│ │ │ │ │ + * those same methods are unregistered as event listeners.
│ │ │ │ │ + *
│ │ │ │ │ + * Handlers also typically have a callbacks object with keys named like
│ │ │ │ │ + * the abstracted events or event sequences that they are in charge of
│ │ │ │ │ + * handling. The controls that wrap handlers define the methods that
│ │ │ │ │ + * correspond to these abstract events - so instead of listening for
│ │ │ │ │ + * individual browser events, they only listen for the abstract events
│ │ │ │ │ + * defined by the handler.
│ │ │ │ │ + *
│ │ │ │ │ + * Handlers are created by controls, which ultimately have the responsibility
│ │ │ │ │ + * of making changes to the the state of the application. Handlers
│ │ │ │ │ + * themselves may make temporary changes, but in general are expected to
│ │ │ │ │ + * return the application in the same state that they found it.
│ │ │ │ │ + */
│ │ │ │ │ +OpenLayers.Handler = OpenLayers.Class({
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * Property: id
│ │ │ │ │ + * {String}
│ │ │ │ │ + */
│ │ │ │ │ + id: null,
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * APIProperty: control
│ │ │ │ │ + * {}. The control that initialized this handler. The
│ │ │ │ │ + * control is assumed to have a valid map property - that map is used
│ │ │ │ │ + * in the handler's own setMap method.
│ │ │ │ │ + */
│ │ │ │ │ + control: null,
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * Property: map
│ │ │ │ │ + * {}
│ │ │ │ │ + */
│ │ │ │ │ + map: null,
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * APIProperty: keyMask
│ │ │ │ │ + * {Integer} Use bitwise operators and one or more of the OpenLayers.Handler
│ │ │ │ │ + * constants to construct a keyMask. The keyMask is used by
│ │ │ │ │ + * . If the keyMask matches the combination of keys
│ │ │ │ │ + * down on an event, checkModifiers returns true.
│ │ │ │ │ + *
│ │ │ │ │ + * Example:
│ │ │ │ │ + * (code)
│ │ │ │ │ + * // handler only responds if the Shift key is down
│ │ │ │ │ + * handler.keyMask = OpenLayers.Handler.MOD_SHIFT;
│ │ │ │ │ + *
│ │ │ │ │ + * // handler only responds if Ctrl-Shift is down
│ │ │ │ │ + * handler.keyMask = OpenLayers.Handler.MOD_SHIFT |
│ │ │ │ │ + * OpenLayers.Handler.MOD_CTRL;
│ │ │ │ │ + * (end)
│ │ │ │ │ + */
│ │ │ │ │ + keyMask: null,
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * Property: active
│ │ │ │ │ + * {Boolean}
│ │ │ │ │ + */
│ │ │ │ │ + active: false,
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * Property: evt
│ │ │ │ │ + * {Event} This property references the last event handled by the handler.
│ │ │ │ │ + * Note that this property is not part of the stable API. Use of the
│ │ │ │ │ + * evt property should be restricted to controls in the library
│ │ │ │ │ + * or other applications that are willing to update with changes to
│ │ │ │ │ + * the OpenLayers code.
│ │ │ │ │ + */
│ │ │ │ │ + evt: null,
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * Property: touch
│ │ │ │ │ + * {Boolean} Indicates the support of touch events. When touch events are
│ │ │ │ │ + * started touch will be true and all mouse related listeners will do
│ │ │ │ │ + * nothing.
│ │ │ │ │ + */
│ │ │ │ │ + touch: false,
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * Constructor: OpenLayers.Handler
│ │ │ │ │ + * Construct a handler.
│ │ │ │ │ + *
│ │ │ │ │ + * Parameters:
│ │ │ │ │ + * control - {} The control that initialized this
│ │ │ │ │ + * handler. The control is assumed to have a valid map property; that
│ │ │ │ │ + * map is used in the handler's own setMap method. If a map property
│ │ │ │ │ + * is present in the options argument it will be used instead.
│ │ │ │ │ + * callbacks - {Object} An object whose properties correspond to abstracted
│ │ │ │ │ + * events or sequences of browser events. The values for these
│ │ │ │ │ + * properties are functions defined by the control that get called by
│ │ │ │ │ + * the handler.
│ │ │ │ │ + * options - {Object} An optional object whose properties will be set on
│ │ │ │ │ + * the handler.
│ │ │ │ │ + */
│ │ │ │ │ + initialize: function(control, callbacks, options) {
│ │ │ │ │ + OpenLayers.Util.extend(this, options);
│ │ │ │ │ + this.control = control;
│ │ │ │ │ + this.callbacks = callbacks;
│ │ │ │ │ +
│ │ │ │ │ + var map = this.map || control.map;
│ │ │ │ │ + if (map) {
│ │ │ │ │ + this.setMap(map);
│ │ │ │ │ + }
│ │ │ │ │ +
│ │ │ │ │ + this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
│ │ │ │ │ + },
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * Method: setMap
│ │ │ │ │ + */
│ │ │ │ │ + setMap: function(map) {
│ │ │ │ │ + this.map = map;
│ │ │ │ │ + },
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * Method: checkModifiers
│ │ │ │ │ + * Check the keyMask on the handler. If no is set, this always
│ │ │ │ │ + * returns true. If a is set and it matches the combination
│ │ │ │ │ + * of keys down on an event, this returns true.
│ │ │ │ │ + *
│ │ │ │ │ + * Returns:
│ │ │ │ │ + * {Boolean} The keyMask matches the keys down on an event.
│ │ │ │ │ + */
│ │ │ │ │ + checkModifiers: function(evt) {
│ │ │ │ │ + if (this.keyMask == null) {
│ │ │ │ │ + return true;
│ │ │ │ │ + }
│ │ │ │ │ + /* calculate the keyboard modifier mask for this event */
│ │ │ │ │ + var keyModifiers =
│ │ │ │ │ + (evt.shiftKey ? OpenLayers.Handler.MOD_SHIFT : 0) |
│ │ │ │ │ + (evt.ctrlKey ? OpenLayers.Handler.MOD_CTRL : 0) |
│ │ │ │ │ + (evt.altKey ? OpenLayers.Handler.MOD_ALT : 0) |
│ │ │ │ │ + (evt.metaKey ? OpenLayers.Handler.MOD_META : 0);
│ │ │ │ │ +
│ │ │ │ │ + /* if it differs from the handler object's key mask,
│ │ │ │ │ + bail out of the event handler */
│ │ │ │ │ + return (keyModifiers == this.keyMask);
│ │ │ │ │ + },
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * APIMethod: activate
│ │ │ │ │ + * Turn on the handler. Returns false if the handler was already active.
│ │ │ │ │ + *
│ │ │ │ │ + * Returns:
│ │ │ │ │ + * {Boolean} The handler was activated.
│ │ │ │ │ + */
│ │ │ │ │ + activate: function() {
│ │ │ │ │ + if (this.active) {
│ │ │ │ │ + return false;
│ │ │ │ │ + }
│ │ │ │ │ + // register for event handlers defined on this class.
│ │ │ │ │ + var events = OpenLayers.Events.prototype.BROWSER_EVENTS;
│ │ │ │ │ + for (var i = 0, len = events.length; i < len; i++) {
│ │ │ │ │ + if (this[events[i]]) {
│ │ │ │ │ + this.register(events[i], this[events[i]]);
│ │ │ │ │ + }
│ │ │ │ │ + }
│ │ │ │ │ + this.active = true;
│ │ │ │ │ + return true;
│ │ │ │ │ + },
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * APIMethod: deactivate
│ │ │ │ │ + * Turn off the handler. Returns false if the handler was already inactive.
│ │ │ │ │ + *
│ │ │ │ │ + * Returns:
│ │ │ │ │ + * {Boolean} The handler was deactivated.
│ │ │ │ │ + */
│ │ │ │ │ + deactivate: function() {
│ │ │ │ │ + if (!this.active) {
│ │ │ │ │ + return false;
│ │ │ │ │ + }
│ │ │ │ │ + // unregister event handlers defined on this class.
│ │ │ │ │ + var events = OpenLayers.Events.prototype.BROWSER_EVENTS;
│ │ │ │ │ + for (var i = 0, len = events.length; i < len; i++) {
│ │ │ │ │ + if (this[events[i]]) {
│ │ │ │ │ + this.unregister(events[i], this[events[i]]);
│ │ │ │ │ + }
│ │ │ │ │ + }
│ │ │ │ │ + this.touch = false;
│ │ │ │ │ + this.active = false;
│ │ │ │ │ + return true;
│ │ │ │ │ + },
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * Method: startTouch
│ │ │ │ │ + * Start touch events, this method must be called by subclasses in
│ │ │ │ │ + * "touchstart" method. When touch events are started will be
│ │ │ │ │ + * true and all mouse related listeners will do nothing.
│ │ │ │ │ + */
│ │ │ │ │ + startTouch: function() {
│ │ │ │ │ + if (!this.touch) {
│ │ │ │ │ + this.touch = true;
│ │ │ │ │ + var events = [
│ │ │ │ │ + "mousedown", "mouseup", "mousemove", "click", "dblclick",
│ │ │ │ │ + "mouseout"
│ │ │ │ │ + ];
│ │ │ │ │ + for (var i = 0, len = events.length; i < len; i++) {
│ │ │ │ │ + if (this[events[i]]) {
│ │ │ │ │ + this.unregister(events[i], this[events[i]]);
│ │ │ │ │ + }
│ │ │ │ │ + }
│ │ │ │ │ + }
│ │ │ │ │ + },
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * Method: callback
│ │ │ │ │ + * Trigger the control's named callback with the given arguments
│ │ │ │ │ + *
│ │ │ │ │ + * Parameters:
│ │ │ │ │ + * name - {String} The key for the callback that is one of the properties
│ │ │ │ │ + * of the handler's callbacks object.
│ │ │ │ │ + * args - {Array(*)} An array of arguments (any type) with which to call
│ │ │ │ │ + * the callback (defined by the control).
│ │ │ │ │ + */
│ │ │ │ │ + callback: function(name, args) {
│ │ │ │ │ + if (name && this.callbacks[name]) {
│ │ │ │ │ + this.callbacks[name].apply(this.control, args);
│ │ │ │ │ + }
│ │ │ │ │ + },
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * Method: register
│ │ │ │ │ + * register an event on the map
│ │ │ │ │ + */
│ │ │ │ │ + register: function(name, method) {
│ │ │ │ │ + // TODO: deal with registerPriority in 3.0
│ │ │ │ │ + this.map.events.registerPriority(name, this, method);
│ │ │ │ │ + this.map.events.registerPriority(name, this, this.setEvent);
│ │ │ │ │ + },
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * Method: unregister
│ │ │ │ │ + * unregister an event from the map
│ │ │ │ │ + */
│ │ │ │ │ + unregister: function(name, method) {
│ │ │ │ │ + this.map.events.unregister(name, this, method);
│ │ │ │ │ + this.map.events.unregister(name, this, this.setEvent);
│ │ │ │ │ + },
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * Method: setEvent
│ │ │ │ │ + * With each registered browser event, the handler sets its own evt
│ │ │ │ │ + * property. This property can be accessed by controls if needed
│ │ │ │ │ + * to get more information about the event that the handler is
│ │ │ │ │ + * processing.
│ │ │ │ │ + *
│ │ │ │ │ + * This allows modifier keys on the event to be checked (alt, shift, ctrl,
│ │ │ │ │ + * and meta cannot be checked with the keyboard handler). For a
│ │ │ │ │ + * control to determine which modifier keys are associated with the
│ │ │ │ │ + * event that a handler is currently processing, it should access
│ │ │ │ │ + * (code)handler.evt.altKey || handler.evt.shiftKey ||
│ │ │ │ │ + * handler.evt.ctrlKey || handler.evt.metaKey(end).
│ │ │ │ │ + *
│ │ │ │ │ + * Parameters:
│ │ │ │ │ + * evt - {Event} The browser event.
│ │ │ │ │ + */
│ │ │ │ │ + setEvent: function(evt) {
│ │ │ │ │ + this.evt = evt;
│ │ │ │ │ + return true;
│ │ │ │ │ + },
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * Method: destroy
│ │ │ │ │ + * Deconstruct the handler.
│ │ │ │ │ + */
│ │ │ │ │ + destroy: function() {
│ │ │ │ │ + // unregister event listeners
│ │ │ │ │ + this.deactivate();
│ │ │ │ │ + // eliminate circular references
│ │ │ │ │ + this.control = this.map = null;
│ │ │ │ │ + },
│ │ │ │ │ +
│ │ │ │ │ + CLASS_NAME: "OpenLayers.Handler"
│ │ │ │ │ +});
│ │ │ │ │ +
│ │ │ │ │ +/**
│ │ │ │ │ + * Constant: OpenLayers.Handler.MOD_NONE
│ │ │ │ │ + * If set as the , returns false if any key is down.
│ │ │ │ │ + */
│ │ │ │ │ +OpenLayers.Handler.MOD_NONE = 0;
│ │ │ │ │ +
│ │ │ │ │ +/**
│ │ │ │ │ + * Constant: OpenLayers.Handler.MOD_SHIFT
│ │ │ │ │ + * If set as the , returns false if Shift is down.
│ │ │ │ │ + */
│ │ │ │ │ +OpenLayers.Handler.MOD_SHIFT = 1;
│ │ │ │ │ +
│ │ │ │ │ +/**
│ │ │ │ │ + * Constant: OpenLayers.Handler.MOD_CTRL
│ │ │ │ │ + * If set as the , returns false if Ctrl is down.
│ │ │ │ │ + */
│ │ │ │ │ +OpenLayers.Handler.MOD_CTRL = 2;
│ │ │ │ │ +
│ │ │ │ │ +/**
│ │ │ │ │ + * Constant: OpenLayers.Handler.MOD_ALT
│ │ │ │ │ + * If set as the , returns false if Alt is down.
│ │ │ │ │ + */
│ │ │ │ │ +OpenLayers.Handler.MOD_ALT = 4;
│ │ │ │ │ +
│ │ │ │ │ +/**
│ │ │ │ │ + * Constant: OpenLayers.Handler.MOD_META
│ │ │ │ │ + * If set as the , returns false if Cmd is down.
│ │ │ │ │ + */
│ │ │ │ │ +OpenLayers.Handler.MOD_META = 8;
│ │ │ │ │ +
│ │ │ │ │ +
│ │ │ │ │ +/* ======================================================================
│ │ │ │ │ + OpenLayers/Util/vendorPrefix.js
│ │ │ │ │ + ====================================================================== */
│ │ │ │ │ +
│ │ │ │ │ +/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
│ │ │ │ │ + * full list of contributors). Published under the 2-clause BSD license.
│ │ │ │ │ + * See license.txt in the OpenLayers distribution or repository for the
│ │ │ │ │ + * full text of the license. */
│ │ │ │ │ +
│ │ │ │ │ +/**
│ │ │ │ │ + * @requires OpenLayers/SingleFile.js
│ │ │ │ │ + */
│ │ │ │ │ +
│ │ │ │ │ +OpenLayers.Util = OpenLayers.Util || {};
│ │ │ │ │ +/**
│ │ │ │ │ + * Namespace: OpenLayers.Util.vendorPrefix
│ │ │ │ │ + * A collection of utility functions to detect vendor prefixed features
│ │ │ │ │ + */
│ │ │ │ │ +OpenLayers.Util.vendorPrefix = (function() {
│ │ │ │ │ + "use strict";
│ │ │ │ │ +
│ │ │ │ │ + var VENDOR_PREFIXES = ["", "O", "ms", "Moz", "Webkit"],
│ │ │ │ │ + divStyle = document.createElement("div").style,
│ │ │ │ │ + cssCache = {},
│ │ │ │ │ + jsCache = {};
│ │ │ │ │ +
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * Function: domToCss
│ │ │ │ │ + * Converts a upper camel case DOM style property name to a CSS property
│ │ │ │ │ + * i.e. transformOrigin -> transform-origin
│ │ │ │ │ + * or WebkitTransformOrigin -> -webkit-transform-origin
│ │ │ │ │ + *
│ │ │ │ │ + * Parameters:
│ │ │ │ │ + * prefixedDom - {String} The property to convert
│ │ │ │ │ + *
│ │ │ │ │ + * Returns:
│ │ │ │ │ + * {String} The CSS property
│ │ │ │ │ + */
│ │ │ │ │ + function domToCss(prefixedDom) {
│ │ │ │ │ + if (!prefixedDom) {
│ │ │ │ │ + return null;
│ │ │ │ │ + }
│ │ │ │ │ + return prefixedDom.
│ │ │ │ │ + replace(/([A-Z])/g, function(c) {
│ │ │ │ │ + return "-" + c.toLowerCase();
│ │ │ │ │ + }).
│ │ │ │ │ + replace(/^ms-/, "-ms-");
│ │ │ │ │ + }
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * APIMethod: css
│ │ │ │ │ + * Detect which property is used for a CSS property
│ │ │ │ │ + *
│ │ │ │ │ + * Parameters:
│ │ │ │ │ + * property - {String} The standard (unprefixed) CSS property name
│ │ │ │ │ + *
│ │ │ │ │ + * Returns:
│ │ │ │ │ + * {String} The standard CSS property, prefixed property or null if not
│ │ │ │ │ + * supported
│ │ │ │ │ + */
│ │ │ │ │ + function css(property) {
│ │ │ │ │ + if (cssCache[property] === undefined) {
│ │ │ │ │ + var domProperty = property.
│ │ │ │ │ + replace(/(-[\s\S])/g, function(c) {
│ │ │ │ │ + return c.charAt(1).toUpperCase();
│ │ │ │ │ + });
│ │ │ │ │ + var prefixedDom = style(domProperty);
│ │ │ │ │ + cssCache[property] = domToCss(prefixedDom);
│ │ │ │ │ + }
│ │ │ │ │ + return cssCache[property];
│ │ │ │ │ + }
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * APIMethod: js
│ │ │ │ │ + * Detect which property is used for a JS property/method
│ │ │ │ │ + *
│ │ │ │ │ + * Parameters:
│ │ │ │ │ + * obj - {Object} The object to test on
│ │ │ │ │ + * property - {String} The standard (unprefixed) JS property name
│ │ │ │ │ + *
│ │ │ │ │ + * Returns:
│ │ │ │ │ + * {String} The standard JS property, prefixed property or null if not
│ │ │ │ │ + * supported
│ │ │ │ │ + */
│ │ │ │ │ + function js(obj, property) {
│ │ │ │ │ + if (jsCache[property] === undefined) {
│ │ │ │ │ + var tmpProp,
│ │ │ │ │ + i = 0,
│ │ │ │ │ + l = VENDOR_PREFIXES.length,
│ │ │ │ │ + prefix,
│ │ │ │ │ + isStyleObj = (typeof obj.cssText !== "undefined");
│ │ │ │ │ +
│ │ │ │ │ + jsCache[property] = null;
│ │ │ │ │ + for (; i < l; i++) {
│ │ │ │ │ + prefix = VENDOR_PREFIXES[i];
│ │ │ │ │ + if (prefix) {
│ │ │ │ │ + if (!isStyleObj) {
│ │ │ │ │ + // js prefix should be lower-case, while style
│ │ │ │ │ + // properties have upper case on first character
│ │ │ │ │ + prefix = prefix.toLowerCase();
│ │ │ │ │ + }
│ │ │ │ │ + tmpProp = prefix + property.charAt(0).toUpperCase() + property.slice(1);
│ │ │ │ │ + } else {
│ │ │ │ │ + tmpProp = property;
│ │ │ │ │ + }
│ │ │ │ │ +
│ │ │ │ │ + if (obj[tmpProp] !== undefined) {
│ │ │ │ │ + jsCache[property] = tmpProp;
│ │ │ │ │ + break;
│ │ │ │ │ + }
│ │ │ │ │ + }
│ │ │ │ │ + }
│ │ │ │ │ + return jsCache[property];
│ │ │ │ │ + }
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * APIMethod: style
│ │ │ │ │ + * Detect which property is used for a DOM style property
│ │ │ │ │ + *
│ │ │ │ │ + * Parameters:
│ │ │ │ │ + * property - {String} The standard (unprefixed) style property name
│ │ │ │ │ + *
│ │ │ │ │ + * Returns:
│ │ │ │ │ + * {String} The standard style property, prefixed property or null if not
│ │ │ │ │ + * supported
│ │ │ │ │ + */
│ │ │ │ │ + function style(property) {
│ │ │ │ │ + return js(divStyle, property);
│ │ │ │ │ + }
│ │ │ │ │ +
│ │ │ │ │ + return {
│ │ │ │ │ + css: css,
│ │ │ │ │ + js: js,
│ │ │ │ │ + style: style,
│ │ │ │ │ +
│ │ │ │ │ + // used for testing
│ │ │ │ │ + cssCache: cssCache,
│ │ │ │ │ + jsCache: jsCache
│ │ │ │ │ + };
│ │ │ │ │ +}());
│ │ │ │ │ +/* ======================================================================
│ │ │ │ │ OpenLayers/Animation.js
│ │ │ │ │ ====================================================================== */
│ │ │ │ │
│ │ │ │ │ /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
│ │ │ │ │ * full list of contributors). Published under the 2-clause BSD license.
│ │ │ │ │ * See license.txt in the OpenLayers distribution or repository for the
│ │ │ │ │ * full text of the license. */
│ │ │ │ │ @@ -13956,14 +14285,996 @@
│ │ │ │ │ this.popup = null;
│ │ │ │ │ }
│ │ │ │ │ },
│ │ │ │ │
│ │ │ │ │ CLASS_NAME: "OpenLayers.Feature"
│ │ │ │ │ });
│ │ │ │ │ /* ======================================================================
│ │ │ │ │ + OpenLayers/Symbolizer.js
│ │ │ │ │ + ====================================================================== */
│ │ │ │ │ +
│ │ │ │ │ +/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
│ │ │ │ │ + * full list of contributors). Published under the 2-clause BSD license.
│ │ │ │ │ + * See license.txt in the OpenLayers distribution or repository for the
│ │ │ │ │ + * full text of the license. */
│ │ │ │ │ +
│ │ │ │ │ +/**
│ │ │ │ │ + * @requires OpenLayers/BaseTypes/Class.js
│ │ │ │ │ + */
│ │ │ │ │ +
│ │ │ │ │ +/**
│ │ │ │ │ + * Class: OpenLayers.Symbolizer
│ │ │ │ │ + * Base class representing a symbolizer used for feature rendering.
│ │ │ │ │ + */
│ │ │ │ │ +OpenLayers.Symbolizer = OpenLayers.Class({
│ │ │ │ │ +
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * APIProperty: zIndex
│ │ │ │ │ + * {Number} The zIndex determines the rendering order for a symbolizer.
│ │ │ │ │ + * Symbolizers with larger zIndex values are rendered over symbolizers
│ │ │ │ │ + * with smaller zIndex values. Default is 0.
│ │ │ │ │ + */
│ │ │ │ │ + zIndex: 0,
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * Constructor: OpenLayers.Symbolizer
│ │ │ │ │ + * Instances of this class are not useful. See one of the subclasses.
│ │ │ │ │ + *
│ │ │ │ │ + * Parameters:
│ │ │ │ │ + * config - {Object} An object containing properties to be set on the
│ │ │ │ │ + * symbolizer. Any documented symbolizer property can be set at
│ │ │ │ │ + * construction.
│ │ │ │ │ + *
│ │ │ │ │ + * Returns:
│ │ │ │ │ + * A new symbolizer.
│ │ │ │ │ + */
│ │ │ │ │ + initialize: function(config) {
│ │ │ │ │ + OpenLayers.Util.extend(this, config);
│ │ │ │ │ + },
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * APIMethod: clone
│ │ │ │ │ + * Create a copy of this symbolizer.
│ │ │ │ │ + *
│ │ │ │ │ + * Returns a symbolizer of the same type with the same properties.
│ │ │ │ │ + */
│ │ │ │ │ + clone: function() {
│ │ │ │ │ + var Type = eval(this.CLASS_NAME);
│ │ │ │ │ + return new Type(OpenLayers.Util.extend({}, this));
│ │ │ │ │ + },
│ │ │ │ │ +
│ │ │ │ │ + CLASS_NAME: "OpenLayers.Symbolizer"
│ │ │ │ │ +
│ │ │ │ │ +});
│ │ │ │ │ +
│ │ │ │ │ +/* ======================================================================
│ │ │ │ │ + OpenLayers/Request/XMLHttpRequest.js
│ │ │ │ │ + ====================================================================== */
│ │ │ │ │ +
│ │ │ │ │ +// XMLHttpRequest.js Copyright (C) 2010 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,
│ │ │ │ │ + bIE7 = bIE && window.navigator.userAgent.match(/MSIE 7.0/);
│ │ │ │ │ +
│ │ │ │ │ + // Enables "XMLHttpRequest()" call next to "new XMLHttpReques()"
│ │ │ │ │ + function fXMLHttpRequest() {
│ │ │ │ │ + this._object = oXMLHttpRequest && !bIE7 ? new oXMLHttpRequest : new window.ActiveXObject("Microsoft.XMLHTTP");
│ │ │ │ │ + this._listeners = [];
│ │ │ │ │ + };
│ │ │ │ │ +
│ │ │ │ │ + // Constructor
│ │ │ │ │ + function cXMLHttpRequest() {
│ │ │ │ │ + return new fXMLHttpRequest;
│ │ │ │ │ + };
│ │ │ │ │ + cXMLHttpRequest.prototype = fXMLHttpRequest.prototype;
│ │ │ │ │ +
│ │ │ │ │ + // 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 = '';
│ │ │ │ │ +
│ │ │ │ │ + // Priority proposal
│ │ │ │ │ + cXMLHttpRequest.prototype.priority = "NORMAL";
│ │ │ │ │ +
│ │ │ │ │ + // 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) {
│ │ │ │ │ + // Delete headers, required when object is reused
│ │ │ │ │ + delete this._headers;
│ │ │ │ │ +
│ │ │ │ │ + // When bAsync parameter value is omitted, use true as default
│ │ │ │ │ + if (arguments.length < 3)
│ │ │ │ │ + bAsync = true;
│ │ │ │ │ +
│ │ │ │ │ + // 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,
│ │ │ │ │ + fOnUnload;
│ │ │ │ │ +
│ │ │ │ │ + // BUGFIX: IE - memory leak on page unload (inter-page leak)
│ │ │ │ │ + if (bIE && bAsync) {
│ │ │ │ │ + fOnUnload = function() {
│ │ │ │ │ + if (nState != cXMLHttpRequest.DONE) {
│ │ │ │ │ + fCleanTransport(oRequest);
│ │ │ │ │ + // Safe to abort here since onreadystatechange handler removed
│ │ │ │ │ + oRequest.abort();
│ │ │ │ │ + }
│ │ │ │ │ + };
│ │ │ │ │ + window.attachEvent("onunload", fOnUnload);
│ │ │ │ │ + }
│ │ │ │ │ +
│ │ │ │ │ + // Add method sniffer
│ │ │ │ │ + if (cXMLHttpRequest.onopen)
│ │ │ │ │ + cXMLHttpRequest.onopen.apply(this, arguments);
│ │ │ │ │ +
│ │ │ │ │ + if (arguments.length > 4)
│ │ │ │ │ + this._object.open(sMethod, sUrl, bAsync, sUser, sPassword);
│ │ │ │ │ + else
│ │ │ │ │ + if (arguments.length > 3)
│ │ │ │ │ + this._object.open(sMethod, sUrl, bAsync, sUser);
│ │ │ │ │ + else
│ │ │ │ │ + this._object.open(sMethod, sUrl, bAsync);
│ │ │ │ │ +
│ │ │ │ │ + this.readyState = cXMLHttpRequest.OPENED;
│ │ │ │ │ + fReadyStateChange(this);
│ │ │ │ │ +
│ │ │ │ │ + this._object.onreadystatechange = function() {
│ │ │ │ │ + if (bGecko && !bAsync)
│ │ │ │ │ + return;
│ │ │ │ │ +
│ │ │ │ │ + // Synchronize state
│ │ │ │ │ + oRequest.readyState = oRequest._object.readyState;
│ │ │ │ │ +
│ │ │ │ │ + //
│ │ │ │ │ + fSynchronizeValues(oRequest);
│ │ │ │ │ +
│ │ │ │ │ + // BUGFIX: Firefox fires unnecessary DONE when aborting
│ │ │ │ │ + if (oRequest._aborted) {
│ │ │ │ │ + // Reset readyState to UNSENT
│ │ │ │ │ + oRequest.readyState = cXMLHttpRequest.UNSENT;
│ │ │ │ │ +
│ │ │ │ │ + // Return now
│ │ │ │ │ + return;
│ │ │ │ │ + }
│ │ │ │ │ +
│ │ │ │ │ + if (oRequest.readyState == cXMLHttpRequest.DONE) {
│ │ │ │ │ + // Free up queue
│ │ │ │ │ + delete oRequest._data;
│ │ │ │ │ + /* if (bAsync)
│ │ │ │ │ + fQueue_remove(oRequest);*/
│ │ │ │ │ + //
│ │ │ │ │ + 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
│ │ │ │ │ + if (sUser) {
│ │ │ │ │ + if (sPassword)
│ │ │ │ │ + oRequest._object.open(sMethod, sUrl, bAsync, sUser, sPassword);
│ │ │ │ │ + else
│ │ │ │ │ + oRequest._object.open(sMethod, sUrl, bAsync, sUser);
│ │ │ │ │ + }
│ │ │ │ │ + else
│ │ │ │ │ + oRequest._object.open(sMethod, sUrl, bAsync);
│ │ │ │ │ + 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 until 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;
│ │ │ │ │ + }
│ │ │ │ │ + };
│ │ │ │ │ +
│ │ │ │ │ + function fXMLHttpRequest_send(oRequest) {
│ │ │ │ │ + oRequest._object.send(oRequest._data);
│ │ │ │ │ +
│ │ │ │ │ + // BUGFIX: Gecko - missing readystatechange calls in synchronous requests
│ │ │ │ │ + if (bGecko && !oRequest._async) {
│ │ │ │ │ + oRequest.readyState = cXMLHttpRequest.OPENED;
│ │ │ │ │ +
│ │ │ │ │ + // Synchronize state
│ │ │ │ │ + fSynchronizeValues(oRequest);
│ │ │ │ │ +
│ │ │ │ │ + // Simulate missing states
│ │ │ │ │ + while (oRequest.readyState < cXMLHttpRequest.DONE) {
│ │ │ │ │ + oRequest.readyState++;
│ │ │ │ │ + fReadyStateChange(oRequest);
│ │ │ │ │ + // Check if we are aborted
│ │ │ │ │ + if (oRequest._aborted)
│ │ │ │ │ + return;
│ │ │ │ │ + }
│ │ │ │ │ + }
│ │ │ │ │ + };
│ │ │ │ │ + cXMLHttpRequest.prototype.send = function(vData) {
│ │ │ │ │ + // Add method sniffer
│ │ │ │ │ + if (cXMLHttpRequest.onsend)
│ │ │ │ │ + cXMLHttpRequest.onsend.apply(this, arguments);
│ │ │ │ │ +
│ │ │ │ │ + if (!arguments.length)
│ │ │ │ │ + vData = null;
│ │ │ │ │ +
│ │ │ │ │ + // 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._data = vData;
│ │ │ │ │ + /*
│ │ │ │ │ + // Add to queue
│ │ │ │ │ + if (this._async)
│ │ │ │ │ + fQueue_add(this);
│ │ │ │ │ + else*/
│ │ │ │ │ + fXMLHttpRequest_send(this);
│ │ │ │ │ + };
│ │ │ │ │ + cXMLHttpRequest.prototype.abort = function() {
│ │ │ │ │ + // Add method sniffer
│ │ │ │ │ + if (cXMLHttpRequest.onabort)
│ │ │ │ │ + cXMLHttpRequest.onabort.apply(this, arguments);
│ │ │ │ │ +
│ │ │ │ │ + // BUGFIX: Gecko - unnecessary DONE when aborting
│ │ │ │ │ + if (this.readyState > cXMLHttpRequest.UNSENT)
│ │ │ │ │ + this._aborted = true;
│ │ │ │ │ +
│ │ │ │ │ + this._object.abort();
│ │ │ │ │ +
│ │ │ │ │ + // BUGFIX: IE - memory leak
│ │ │ │ │ + fCleanTransport(this);
│ │ │ │ │ +
│ │ │ │ │ + this.readyState = cXMLHttpRequest.UNSENT;
│ │ │ │ │ +
│ │ │ │ │ + delete this._data;
│ │ │ │ │ + /* if (this._async)
│ │ │ │ │ + fQueue_remove(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);
│ │ │ │ │ + };
│ │ │ │ │ +
│ │ │ │ │ + // EventTarget interface implementation
│ │ │ │ │ + cXMLHttpRequest.prototype.addEventListener = function(sName, fHandler, bUseCapture) {
│ │ │ │ │ + for (var nIndex = 0, oListener; oListener = this._listeners[nIndex]; nIndex++)
│ │ │ │ │ + if (oListener[0] == sName && oListener[1] == fHandler && oListener[2] == bUseCapture)
│ │ │ │ │ + return;
│ │ │ │ │ + // Add listener
│ │ │ │ │ + this._listeners.push([sName, fHandler, bUseCapture]);
│ │ │ │ │ + };
│ │ │ │ │ +
│ │ │ │ │ + cXMLHttpRequest.prototype.removeEventListener = function(sName, fHandler, bUseCapture) {
│ │ │ │ │ + for (var nIndex = 0, oListener; oListener = this._listeners[nIndex]; nIndex++)
│ │ │ │ │ + if (oListener[0] == sName && oListener[1] == fHandler && oListener[2] == bUseCapture)
│ │ │ │ │ + break;
│ │ │ │ │ + // Remove listener
│ │ │ │ │ + if (oListener)
│ │ │ │ │ + this._listeners.splice(nIndex, 1);
│ │ │ │ │ + };
│ │ │ │ │ +
│ │ │ │ │ + cXMLHttpRequest.prototype.dispatchEvent = function(oEvent) {
│ │ │ │ │ + var oEventPseudo = {
│ │ │ │ │ + 'type': oEvent.type,
│ │ │ │ │ + 'target': this,
│ │ │ │ │ + 'currentTarget': this,
│ │ │ │ │ + 'eventPhase': 2,
│ │ │ │ │ + 'bubbles': oEvent.bubbles,
│ │ │ │ │ + 'cancelable': oEvent.cancelable,
│ │ │ │ │ + 'timeStamp': oEvent.timeStamp,
│ │ │ │ │ + 'stopPropagation': function() {}, // There is no flow
│ │ │ │ │ + 'preventDefault': function() {}, // There is no default action
│ │ │ │ │ + 'initEvent': function() {} // Original event object should be initialized
│ │ │ │ │ + };
│ │ │ │ │ +
│ │ │ │ │ + // Execute onreadystatechange
│ │ │ │ │ + if (oEventPseudo.type == "readystatechange" && this.onreadystatechange)
│ │ │ │ │ + (this.onreadystatechange.handleEvent || this.onreadystatechange).apply(this, [oEventPseudo]);
│ │ │ │ │ +
│ │ │ │ │ + // Execute listeners
│ │ │ │ │ + for (var nIndex = 0, oListener; oListener = this._listeners[nIndex]; nIndex++)
│ │ │ │ │ + if (oListener[0] == oEventPseudo.type && !oListener[2])
│ │ │ │ │ + (oListener[1].handleEvent || oListener[1]).apply(this, [oEventPseudo]);
│ │ │ │ │ + };
│ │ │ │ │ +
│ │ │ │ │ + //
│ │ │ │ │ + cXMLHttpRequest.prototype.toString = function() {
│ │ │ │ │ + return '[' + "object" + ' ' + "XMLHttpRequest" + ']';
│ │ │ │ │ + };
│ │ │ │ │ +
│ │ │ │ │ + cXMLHttpRequest.toString = function() {
│ │ │ │ │ + return '[' + "XMLHttpRequest" + ']';
│ │ │ │ │ + };
│ │ │ │ │ +
│ │ │ │ │ + // Helper function
│ │ │ │ │ + function fReadyStateChange(oRequest) {
│ │ │ │ │ + // Sniffing code
│ │ │ │ │ + if (cXMLHttpRequest.onreadystatechange)
│ │ │ │ │ + cXMLHttpRequest.onreadystatechange.apply(oRequest);
│ │ │ │ │ +
│ │ │ │ │ + // Fake event
│ │ │ │ │ + oRequest.dispatchEvent({
│ │ │ │ │ + 'type': "readystatechange",
│ │ │ │ │ + 'bubbles': false,
│ │ │ │ │ + 'cancelable': false,
│ │ │ │ │ + 'timeStamp': new Date + 0
│ │ │ │ │ + });
│ │ │ │ │ + };
│ │ │ │ │ +
│ │ │ │ │ + function fGetDocument(oRequest) {
│ │ │ │ │ + var oDocument = oRequest.responseXML,
│ │ │ │ │ + sResponse = oRequest.responseText;
│ │ │ │ │ + // Try parsing responseText
│ │ │ │ │ + if (bIE && sResponse && oDocument && !oDocument.documentElement && oRequest.getResponseHeader("Content-Type").match(/[^\/]+\/[^\+]+\+xml/)) {
│ │ │ │ │ + oDocument = new window.ActiveXObject("Microsoft.XMLDOM");
│ │ │ │ │ + oDocument.async = false;
│ │ │ │ │ + oDocument.validateOnParse = false;
│ │ │ │ │ + oDocument.loadXML(sResponse);
│ │ │ │ │ + }
│ │ │ │ │ + // Check if there is no error in document
│ │ │ │ │ + if (oDocument)
│ │ │ │ │ + if ((bIE && oDocument.parseError != 0) || !oDocument.documentElement || (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;
│ │ │ │ │ + };
│ │ │ │ │ + /*
│ │ │ │ │ + // Queue manager
│ │ │ │ │ + var oQueuePending = {"CRITICAL":[],"HIGH":[],"NORMAL":[],"LOW":[],"LOWEST":[]},
│ │ │ │ │ + aQueueRunning = [];
│ │ │ │ │ + function fQueue_add(oRequest) {
│ │ │ │ │ + oQueuePending[oRequest.priority in oQueuePending ? oRequest.priority : "NORMAL"].push(oRequest);
│ │ │ │ │ + //
│ │ │ │ │ + setTimeout(fQueue_process);
│ │ │ │ │ + };
│ │ │ │ │ +
│ │ │ │ │ + function fQueue_remove(oRequest) {
│ │ │ │ │ + for (var nIndex = 0, bFound = false; nIndex < aQueueRunning.length; nIndex++)
│ │ │ │ │ + if (bFound)
│ │ │ │ │ + aQueueRunning[nIndex - 1] = aQueueRunning[nIndex];
│ │ │ │ │ + else
│ │ │ │ │ + if (aQueueRunning[nIndex] == oRequest)
│ │ │ │ │ + bFound = true;
│ │ │ │ │ + if (bFound)
│ │ │ │ │ + aQueueRunning.length--;
│ │ │ │ │ + //
│ │ │ │ │ + setTimeout(fQueue_process);
│ │ │ │ │ + };
│ │ │ │ │ +
│ │ │ │ │ + function fQueue_process() {
│ │ │ │ │ + if (aQueueRunning.length < 6) {
│ │ │ │ │ + for (var sPriority in oQueuePending) {
│ │ │ │ │ + if (oQueuePending[sPriority].length) {
│ │ │ │ │ + var oRequest = oQueuePending[sPriority][0];
│ │ │ │ │ + oQueuePending[sPriority] = oQueuePending[sPriority].slice(1);
│ │ │ │ │ + //
│ │ │ │ │ + aQueueRunning.push(oRequest);
│ │ │ │ │ + // Send request
│ │ │ │ │ + fXMLHttpRequest_send(oRequest);
│ │ │ │ │ + break;
│ │ │ │ │ + }
│ │ │ │ │ + }
│ │ │ │ │ + }
│ │ │ │ │ + };
│ │ │ │ │ + */
│ │ │ │ │ + // 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/.
│ │ │ │ │ + */
│ │ │ │ │ + if (!OpenLayers.Request) {
│ │ │ │ │ + /**
│ │ │ │ │ + * This allows for OpenLayers/Request.js to be included
│ │ │ │ │ + * before or after this script.
│ │ │ │ │ + */
│ │ │ │ │ + OpenLayers.Request = {};
│ │ │ │ │ + }
│ │ │ │ │ + OpenLayers.Request.XMLHttpRequest = cXMLHttpRequest;
│ │ │ │ │ +})();
│ │ │ │ │ +/* ======================================================================
│ │ │ │ │ + OpenLayers/Request.js
│ │ │ │ │ + ====================================================================== */
│ │ │ │ │ +
│ │ │ │ │ +/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
│ │ │ │ │ + * full list of contributors). Published under the 2-clause BSD license.
│ │ │ │ │ + * See license.txt in the OpenLayers distribution or repository for the
│ │ │ │ │ + * full text of the license. */
│ │ │ │ │ +
│ │ │ │ │ +/**
│ │ │ │ │ + * @requires OpenLayers/Events.js
│ │ │ │ │ + * @requires OpenLayers/Request/XMLHttpRequest.js
│ │ │ │ │ + */
│ │ │ │ │ +
│ │ │ │ │ +/**
│ │ │ │ │ + * TODO: deprecate me
│ │ │ │ │ + * Use OpenLayers.Request.proxy instead.
│ │ │ │ │ + */
│ │ │ │ │ +OpenLayers.ProxyHost = "";
│ │ │ │ │ +
│ │ │ │ │ +/**
│ │ │ │ │ + * Namespace: OpenLayers.Request
│ │ │ │ │ + * The OpenLayers.Request namespace contains convenience methods for working
│ │ │ │ │ + * with XMLHttpRequests. These methods work with a cross-browser
│ │ │ │ │ + * W3C compliant class.
│ │ │ │ │ + */
│ │ │ │ │ +if (!OpenLayers.Request) {
│ │ │ │ │ + /**
│ │ │ │ │ + * This allows for OpenLayers/Request/XMLHttpRequest.js to be included
│ │ │ │ │ + * before or after this script.
│ │ │ │ │ + */
│ │ │ │ │ + OpenLayers.Request = {};
│ │ │ │ │ +}
│ │ │ │ │ +OpenLayers.Util.extend(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
│ │ │ │ │ + },
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * Constant: URL_SPLIT_REGEX
│ │ │ │ │ + */
│ │ │ │ │ + URL_SPLIT_REGEX: /([^:]*:)\/\/([^:]*:?[^@]*@)?([^:\/\?]*):?([^\/\?]*)/,
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * APIProperty: events
│ │ │ │ │ + * {} An events object that handles all
│ │ │ │ │ + * events on the {} object.
│ │ │ │ │ + *
│ │ │ │ │ + * All event listeners will receive an event object with three properties:
│ │ │ │ │ + * request - {} 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),
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * Method: makeSameOrigin
│ │ │ │ │ + * Using the specified proxy, returns a same origin url of the provided url.
│ │ │ │ │ + *
│ │ │ │ │ + * Parameters:
│ │ │ │ │ + * url - {String} An arbitrary url
│ │ │ │ │ + * proxy {String|Function} The proxy to use to make the provided url a
│ │ │ │ │ + * same origin url.
│ │ │ │ │ + *
│ │ │ │ │ + * Returns
│ │ │ │ │ + * {String} the same origin url. If no proxy is provided, the returned url
│ │ │ │ │ + * will be the same as the provided url.
│ │ │ │ │ + */
│ │ │ │ │ + makeSameOrigin: function(url, proxy) {
│ │ │ │ │ + var sameOrigin = url.indexOf("http") !== 0;
│ │ │ │ │ + var urlParts = !sameOrigin && url.match(this.URL_SPLIT_REGEX);
│ │ │ │ │ + if (urlParts) {
│ │ │ │ │ + var location = window.location;
│ │ │ │ │ + sameOrigin =
│ │ │ │ │ + urlParts[1] == location.protocol &&
│ │ │ │ │ + urlParts[3] == location.hostname;
│ │ │ │ │ + var uPort = urlParts[4],
│ │ │ │ │ + lPort = location.port;
│ │ │ │ │ + if (uPort != 80 && uPort != "" || lPort != "80" && lPort != "") {
│ │ │ │ │ + sameOrigin = sameOrigin && uPort == lPort;
│ │ │ │ │ + }
│ │ │ │ │ + }
│ │ │ │ │ + if (!sameOrigin) {
│ │ │ │ │ + if (proxy) {
│ │ │ │ │ + if (typeof proxy == "function") {
│ │ │ │ │ + url = proxy(url);
│ │ │ │ │ + } else {
│ │ │ │ │ + url = proxy + encodeURIComponent(url);
│ │ │ │ │ + }
│ │ │ │ │ + }
│ │ │ │ │ + }
│ │ │ │ │ + return url;
│ │ │ │ │ + },
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * 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 , , , , , or .
│ │ │ │ │ + * 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
│ │ │ │ │ + * .
│ │ │ │ │ + * 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
│ │ │ │ │ + * 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 .
│ │ │ │ │ + * 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 and requests.
│ │ │ │ │ + * Make sure to provide the appropriate "Content-Type" header for your
│ │ │ │ │ + * data. For and 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 = config || {};
│ │ │ │ │ + config.headers = config.headers || {};
│ │ │ │ │ + config = OpenLayers.Util.applyDefaults(config, defaultConfig);
│ │ │ │ │ + config.headers = OpenLayers.Util.applyDefaults(config.headers, defaultConfig.headers);
│ │ │ │ │ + // Always set the "X-Requested-With" header to signal that this request
│ │ │ │ │ + // was issued through the XHR-object. Since header keys are case
│ │ │ │ │ + // insensitive and we want to allow overriding of the "X-Requested-With"
│ │ │ │ │ + // header through the user we cannot use applyDefaults, but have to
│ │ │ │ │ + // check manually whether we were called with a "X-Requested-With"
│ │ │ │ │ + // header.
│ │ │ │ │ + var customRequestedWithHeader = false,
│ │ │ │ │ + headerKey;
│ │ │ │ │ + for (headerKey in config.headers) {
│ │ │ │ │ + if (config.headers.hasOwnProperty(headerKey)) {
│ │ │ │ │ + if (headerKey.toLowerCase() === 'x-requested-with') {
│ │ │ │ │ + customRequestedWithHeader = true;
│ │ │ │ │ + }
│ │ │ │ │ + }
│ │ │ │ │ + }
│ │ │ │ │ + if (customRequestedWithHeader === false) {
│ │ │ │ │ + // we did not have a custom "X-Requested-With" header
│ │ │ │ │ + config.headers['X-Requested-With'] = 'XMLHttpRequest';
│ │ │ │ │ + }
│ │ │ │ │ +
│ │ │ │ │ + // create request, open, and set headers
│ │ │ │ │ + var request = new OpenLayers.Request.XMLHttpRequest();
│ │ │ │ │ + var url = OpenLayers.Util.urlAppend(config.url,
│ │ │ │ │ + OpenLayers.Util.getParameterString(config.params || {}));
│ │ │ │ │ + url = OpenLayers.Request.makeSameOrigin(url, config.proxy);
│ │ │ │ │ + request.open(
│ │ │ │ │ + config.method, url, config.async, config.user, config.password
│ │ │ │ │ + );
│ │ │ │ │ + for (var header in config.headers) {
│ │ │ │ │ + request.setRequestHeader(header, config.headers[header]);
│ │ │ │ │ + }
│ │ │ │ │ +
│ │ │ │ │ + var events = this.events;
│ │ │ │ │ +
│ │ │ │ │ + // we want to execute runCallbacks with "this" as the
│ │ │ │ │ + // execution scope
│ │ │ │ │ + var self = this;
│ │ │ │ │ +
│ │ │ │ │ + request.onreadystatechange = function() {
│ │ │ │ │ + if (request.readyState == OpenLayers.Request.XMLHttpRequest.DONE) {
│ │ │ │ │ + var proceed = events.triggerEvent(
│ │ │ │ │ + "complete", {
│ │ │ │ │ + request: request,
│ │ │ │ │ + config: config,
│ │ │ │ │ + requestUrl: url
│ │ │ │ │ + }
│ │ │ │ │ + );
│ │ │ │ │ + if (proceed !== false) {
│ │ │ │ │ + self.runCallbacks({
│ │ │ │ │ + request: request,
│ │ │ │ │ + config: config,
│ │ │ │ │ + requestUrl: url
│ │ │ │ │ + });
│ │ │ │ │ + }
│ │ │ │ │ + }
│ │ │ │ │ + };
│ │ │ │ │ +
│ │ │ │ │ + // 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() {
│ │ │ │ │ + if (request.readyState !== 0) { // W3C: 0-UNSENT
│ │ │ │ │ + request.send(config.data);
│ │ │ │ │ + }
│ │ │ │ │ + }, 0);
│ │ │ │ │ + }
│ │ │ │ │ + return request;
│ │ │ │ │ + },
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * Method: runCallbacks
│ │ │ │ │ + * Calls the complete, success and failure callbacks. Application
│ │ │ │ │ + * can listen to the "complete" event, have the listener
│ │ │ │ │ + * display a confirm window and always return false, and
│ │ │ │ │ + * execute OpenLayers.Request.runCallbacks if the user
│ │ │ │ │ + * hits "yes" in the confirm window.
│ │ │ │ │ + *
│ │ │ │ │ + * Parameters:
│ │ │ │ │ + * options - {Object} Hash containing request, config and requestUrl keys
│ │ │ │ │ + */
│ │ │ │ │ + runCallbacks: function(options) {
│ │ │ │ │ + var request = options.request;
│ │ │ │ │ + var config = options.config;
│ │ │ │ │ +
│ │ │ │ │ + // 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;
│ │ │ │ │ + }
│ │ │ │ │ +
│ │ │ │ │ + if (OpenLayers.Util.createUrlObject(config.url).protocol == "file:" &&
│ │ │ │ │ + request.responseText) {
│ │ │ │ │ + request.status = 200;
│ │ │ │ │ + }
│ │ │ │ │ + complete(request);
│ │ │ │ │ +
│ │ │ │ │ + if (!request.status || (request.status >= 200 && request.status < 300)) {
│ │ │ │ │ + this.events.triggerEvent("success", options);
│ │ │ │ │ + if (success) {
│ │ │ │ │ + success(request);
│ │ │ │ │ + }
│ │ │ │ │ + }
│ │ │ │ │ + if (request.status && (request.status < 200 || request.status >= 300)) {
│ │ │ │ │ + this.events.triggerEvent("failure", options);
│ │ │ │ │ + if (failure) {
│ │ │ │ │ + failure(request);
│ │ │ │ │ + }
│ │ │ │ │ + }
│ │ │ │ │ + },
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * APIMethod: GET
│ │ │ │ │ + * Send an HTTP GET request. Additional configuration properties are
│ │ │ │ │ + * documented in the method, with the method property set
│ │ │ │ │ + * to GET.
│ │ │ │ │ + *
│ │ │ │ │ + * Parameters:
│ │ │ │ │ + * config - {Object} Object with properties for configuring the request.
│ │ │ │ │ + * See the 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 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 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 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 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 method, with the method property set
│ │ │ │ │ + * to DELETE.
│ │ │ │ │ + *
│ │ │ │ │ + * Parameters:
│ │ │ │ │ + * config - {Object} Object with properties for configuring the request.
│ │ │ │ │ + * See the 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 method, with the method property set
│ │ │ │ │ + * to HEAD.
│ │ │ │ │ + *
│ │ │ │ │ + * Parameters:
│ │ │ │ │ + * config - {Object} Object with properties for configuring the request.
│ │ │ │ │ + * See the 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 method, with the method property set
│ │ │ │ │ + * to OPTIONS.
│ │ │ │ │ + *
│ │ │ │ │ + * Parameters:
│ │ │ │ │ + * config - {Object} Object with properties for configuring the request.
│ │ │ │ │ + * See the 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/Feature/Vector.js
│ │ │ │ │ ====================================================================== */
│ │ │ │ │
│ │ │ │ │ /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
│ │ │ │ │ * full list of contributors). Published under the 2-clause BSD license.
│ │ │ │ │ * See license.txt in the OpenLayers distribution or repository for the
│ │ │ │ │ * full text of the license. */
│ │ │ │ │ @@ -14923,3827 +16234,1461 @@
│ │ │ │ │ * {Array} prefixes of the sld symbolizers. These are the
│ │ │ │ │ * same as the main geometry types
│ │ │ │ │ */
│ │ │ │ │ OpenLayers.Style.SYMBOLIZER_PREFIXES = ['Point', 'Line', 'Polygon', 'Text',
│ │ │ │ │ 'Raster'
│ │ │ │ │ ];
│ │ │ │ │ /* ======================================================================
│ │ │ │ │ - OpenLayers/StyleMap.js
│ │ │ │ │ + OpenLayers/Protocol.js
│ │ │ │ │ ====================================================================== */
│ │ │ │ │
│ │ │ │ │ /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
│ │ │ │ │ * full list of contributors). Published under the 2-clause BSD license.
│ │ │ │ │ * See license.txt in the OpenLayers distribution or repository for the
│ │ │ │ │ * full text of the license. */
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ * @requires OpenLayers/BaseTypes/Class.js
│ │ │ │ │ - * @requires OpenLayers/Style.js
│ │ │ │ │ - * @requires OpenLayers/Feature/Vector.js
│ │ │ │ │ */
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Class: OpenLayers.StyleMap
│ │ │ │ │ + * Class: OpenLayers.Protocol
│ │ │ │ │ + * Abstract vector layer protocol class. Not to be instantiated directly. Use
│ │ │ │ │ + * one of the protocol subclasses instead.
│ │ │ │ │ */
│ │ │ │ │ -OpenLayers.StyleMap = OpenLayers.Class({
│ │ │ │ │ +OpenLayers.Protocol = OpenLayers.Class({
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Property: styles
│ │ │ │ │ - * {Object} Hash of {}, keyed by names of well known
│ │ │ │ │ - * rendering intents (e.g. "default", "temporary", "select", "delete").
│ │ │ │ │ + * Property: format
│ │ │ │ │ + * {} The format used by this protocol.
│ │ │ │ │ */
│ │ │ │ │ - styles: null,
│ │ │ │ │ + format: null,
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Property: extendDefault
│ │ │ │ │ - * {Boolean} if true, every render intent will extend the symbolizers
│ │ │ │ │ - * specified for the "default" intent at rendering time. Otherwise, every
│ │ │ │ │ - * rendering intent will be treated as a completely independent style.
│ │ │ │ │ + * Property: options
│ │ │ │ │ + * {Object} Any options sent to the constructor.
│ │ │ │ │ */
│ │ │ │ │ - extendDefault: true,
│ │ │ │ │ + options: null,
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Constructor: OpenLayers.StyleMap
│ │ │ │ │ - *
│ │ │ │ │ + * Property: autoDestroy
│ │ │ │ │ + * {Boolean} The creator of the protocol can set autoDestroy to false
│ │ │ │ │ + * to fully control when the protocol is destroyed. Defaults to
│ │ │ │ │ + * true.
│ │ │ │ │ + */
│ │ │ │ │ + autoDestroy: true,
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * Property: defaultFilter
│ │ │ │ │ + * {} Optional default filter to read requests
│ │ │ │ │ + */
│ │ │ │ │ + defaultFilter: null,
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * Constructor: OpenLayers.Protocol
│ │ │ │ │ + * Abstract class for vector protocols. Create instances of a subclass.
│ │ │ │ │ + *
│ │ │ │ │ * Parameters:
│ │ │ │ │ - * style - {Object} Optional. Either a style hash, or a style object, or
│ │ │ │ │ - * a hash of style objects (style hashes) keyed by rendering
│ │ │ │ │ - * intent. If just one style hash or style object is passed,
│ │ │ │ │ - * this will be used for all known render intents (default,
│ │ │ │ │ - * select, temporary)
│ │ │ │ │ - * options - {Object} optional hash of additional options for this
│ │ │ │ │ - * instance
│ │ │ │ │ + * options - {Object} Optional object whose properties will be set on the
│ │ │ │ │ + * instance.
│ │ │ │ │ */
│ │ │ │ │ - initialize: function(style, options) {
│ │ │ │ │ - this.styles = {
│ │ │ │ │ - "default": new OpenLayers.Style(
│ │ │ │ │ - OpenLayers.Feature.Vector.style["default"]),
│ │ │ │ │ - "select": new OpenLayers.Style(
│ │ │ │ │ - OpenLayers.Feature.Vector.style["select"]),
│ │ │ │ │ - "temporary": new OpenLayers.Style(
│ │ │ │ │ - OpenLayers.Feature.Vector.style["temporary"]),
│ │ │ │ │ - "delete": new OpenLayers.Style(
│ │ │ │ │ - OpenLayers.Feature.Vector.style["delete"])
│ │ │ │ │ - };
│ │ │ │ │ + initialize: function(options) {
│ │ │ │ │ + options = options || {};
│ │ │ │ │ + OpenLayers.Util.extend(this, options);
│ │ │ │ │ + this.options = options;
│ │ │ │ │ + },
│ │ │ │ │
│ │ │ │ │ - // take whatever the user passed as style parameter and convert it
│ │ │ │ │ - // into parts of stylemap.
│ │ │ │ │ - if (style instanceof OpenLayers.Style) {
│ │ │ │ │ - // user passed a style object
│ │ │ │ │ - this.styles["default"] = style;
│ │ │ │ │ - this.styles["select"] = style;
│ │ │ │ │ - this.styles["temporary"] = style;
│ │ │ │ │ - this.styles["delete"] = style;
│ │ │ │ │ - } else if (typeof style == "object") {
│ │ │ │ │ - for (var key in style) {
│ │ │ │ │ - if (style[key] instanceof OpenLayers.Style) {
│ │ │ │ │ - // user passed a hash of style objects
│ │ │ │ │ - this.styles[key] = style[key];
│ │ │ │ │ - } else if (typeof style[key] == "object") {
│ │ │ │ │ - // user passsed a hash of style hashes
│ │ │ │ │ - this.styles[key] = new OpenLayers.Style(style[key]);
│ │ │ │ │ - } else {
│ │ │ │ │ - // user passed a style hash (i.e. symbolizer)
│ │ │ │ │ - this.styles["default"] = new OpenLayers.Style(style);
│ │ │ │ │ - this.styles["select"] = new OpenLayers.Style(style);
│ │ │ │ │ - this.styles["temporary"] = new OpenLayers.Style(style);
│ │ │ │ │ - this.styles["delete"] = new OpenLayers.Style(style);
│ │ │ │ │ - break;
│ │ │ │ │ - }
│ │ │ │ │ - }
│ │ │ │ │ + /**
│ │ │ │ │ + * Method: mergeWithDefaultFilter
│ │ │ │ │ + * Merge filter passed to the read method with the default one
│ │ │ │ │ + *
│ │ │ │ │ + * Parameters:
│ │ │ │ │ + * filter - {}
│ │ │ │ │ + */
│ │ │ │ │ + mergeWithDefaultFilter: function(filter) {
│ │ │ │ │ + var merged;
│ │ │ │ │ + if (filter && this.defaultFilter) {
│ │ │ │ │ + merged = new OpenLayers.Filter.Logical({
│ │ │ │ │ + type: OpenLayers.Filter.Logical.AND,
│ │ │ │ │ + filters: [this.defaultFilter, filter]
│ │ │ │ │ + });
│ │ │ │ │ + } else {
│ │ │ │ │ + merged = filter || this.defaultFilter || undefined;
│ │ │ │ │ }
│ │ │ │ │ - OpenLayers.Util.extend(this, options);
│ │ │ │ │ + return merged;
│ │ │ │ │ },
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Method: destroy
│ │ │ │ │ + * APIMethod: destroy
│ │ │ │ │ + * Clean up the protocol.
│ │ │ │ │ */
│ │ │ │ │ destroy: function() {
│ │ │ │ │ - for (var key in this.styles) {
│ │ │ │ │ - this.styles[key].destroy();
│ │ │ │ │ - }
│ │ │ │ │ - this.styles = null;
│ │ │ │ │ + this.options = null;
│ │ │ │ │ + this.format = null;
│ │ │ │ │ },
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Method: createSymbolizer
│ │ │ │ │ - * Creates the symbolizer for a feature for a render intent.
│ │ │ │ │ - *
│ │ │ │ │ + * APIMethod: read
│ │ │ │ │ + * Construct a request for reading new features.
│ │ │ │ │ + *
│ │ │ │ │ * Parameters:
│ │ │ │ │ - * feature - {} The feature to evaluate the rules
│ │ │ │ │ - * of the intended style against.
│ │ │ │ │ - * intent - {String} The intent determines the symbolizer that will be
│ │ │ │ │ - * used to draw the feature. Well known intents are "default"
│ │ │ │ │ - * (for just drawing the features), "select" (for selected
│ │ │ │ │ - * features) and "temporary" (for drawing features).
│ │ │ │ │ - *
│ │ │ │ │ + * options - {Object} Optional object for configuring the request.
│ │ │ │ │ + *
│ │ │ │ │ * Returns:
│ │ │ │ │ - * {Object} symbolizer hash
│ │ │ │ │ + * {} An
│ │ │ │ │ + * object, the same object will be passed to the callback function passed
│ │ │ │ │ + * if one exists in the options object.
│ │ │ │ │ */
│ │ │ │ │ - createSymbolizer: function(feature, intent) {
│ │ │ │ │ - if (!feature) {
│ │ │ │ │ - feature = new OpenLayers.Feature.Vector();
│ │ │ │ │ - }
│ │ │ │ │ - if (!this.styles[intent]) {
│ │ │ │ │ - intent = "default";
│ │ │ │ │ - }
│ │ │ │ │ - feature.renderIntent = intent;
│ │ │ │ │ - var defaultSymbolizer = {};
│ │ │ │ │ - if (this.extendDefault && intent != "default") {
│ │ │ │ │ - defaultSymbolizer = this.styles["default"].createSymbolizer(feature);
│ │ │ │ │ - }
│ │ │ │ │ - return OpenLayers.Util.extend(defaultSymbolizer,
│ │ │ │ │ - this.styles[intent].createSymbolizer(feature));
│ │ │ │ │ + read: function(options) {
│ │ │ │ │ + options = options || {};
│ │ │ │ │ + options.filter = this.mergeWithDefaultFilter(options.filter);
│ │ │ │ │ },
│ │ │ │ │
│ │ │ │ │ +
│ │ │ │ │ /**
│ │ │ │ │ - * Method: addUniqueValueRules
│ │ │ │ │ - * Convenience method to create comparison rules for unique values of a
│ │ │ │ │ - * property. The rules will be added to the style object for a specified
│ │ │ │ │ - * rendering intent. This method is a shortcut for creating something like
│ │ │ │ │ - * the "unique value legends" familiar from well known desktop GIS systems
│ │ │ │ │ - *
│ │ │ │ │ + * APIMethod: create
│ │ │ │ │ + * Construct a request for writing newly created features.
│ │ │ │ │ + *
│ │ │ │ │ * Parameters:
│ │ │ │ │ - * renderIntent - {String} rendering intent to add the rules to
│ │ │ │ │ - * property - {String} values of feature attributes to create the
│ │ │ │ │ - * rules for
│ │ │ │ │ - * symbolizers - {Object} Hash of symbolizers, keyed by the desired
│ │ │ │ │ - * property values
│ │ │ │ │ - * context - {Object} An optional object with properties that
│ │ │ │ │ - * symbolizers' property values should be evaluated
│ │ │ │ │ - * against. If no context is specified, feature.attributes
│ │ │ │ │ - * will be used
│ │ │ │ │ + * features - {Array({})} or
│ │ │ │ │ + * {}
│ │ │ │ │ + * options - {Object} Optional object for configuring the request.
│ │ │ │ │ + *
│ │ │ │ │ + * Returns:
│ │ │ │ │ + * {} An
│ │ │ │ │ + * object, the same object will be passed to the callback function passed
│ │ │ │ │ + * if one exists in the options object.
│ │ │ │ │ */
│ │ │ │ │ - addUniqueValueRules: function(renderIntent, property, symbolizers, context) {
│ │ │ │ │ - var rules = [];
│ │ │ │ │ - for (var value in symbolizers) {
│ │ │ │ │ - rules.push(new OpenLayers.Rule({
│ │ │ │ │ - symbolizer: symbolizers[value],
│ │ │ │ │ - context: context,
│ │ │ │ │ - filter: new OpenLayers.Filter.Comparison({
│ │ │ │ │ - type: OpenLayers.Filter.Comparison.EQUAL_TO,
│ │ │ │ │ - property: property,
│ │ │ │ │ - value: value
│ │ │ │ │ - })
│ │ │ │ │ - }));
│ │ │ │ │ - }
│ │ │ │ │ - this.styles[renderIntent].addRules(rules);
│ │ │ │ │ - },
│ │ │ │ │ + create: function() {},
│ │ │ │ │
│ │ │ │ │ - CLASS_NAME: "OpenLayers.StyleMap"
│ │ │ │ │ -});
│ │ │ │ │ -/* ======================================================================
│ │ │ │ │ - OpenLayers/Kinetic.js
│ │ │ │ │ - ====================================================================== */
│ │ │ │ │ + /**
│ │ │ │ │ + * APIMethod: update
│ │ │ │ │ + * Construct a request updating modified features.
│ │ │ │ │ + *
│ │ │ │ │ + * Parameters:
│ │ │ │ │ + * features - {Array({})} or
│ │ │ │ │ + * {}
│ │ │ │ │ + * options - {Object} Optional object for configuring the request.
│ │ │ │ │ + *
│ │ │ │ │ + * Returns:
│ │ │ │ │ + * {} An
│ │ │ │ │ + * object, the same object will be passed to the callback function passed
│ │ │ │ │ + * if one exists in the options object.
│ │ │ │ │ + */
│ │ │ │ │ + update: function() {},
│ │ │ │ │
│ │ │ │ │ -/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
│ │ │ │ │ - * full list of contributors). Published under the 2-clause BSD license.
│ │ │ │ │ - * See license.txt in the OpenLayers distribution or repository for the
│ │ │ │ │ - * full text of the license. */
│ │ │ │ │ + /**
│ │ │ │ │ + * APIMethod: delete
│ │ │ │ │ + * Construct a request deleting a removed feature.
│ │ │ │ │ + *
│ │ │ │ │ + * Parameters:
│ │ │ │ │ + * feature - {}
│ │ │ │ │ + * options - {Object} Optional object for configuring the request.
│ │ │ │ │ + *
│ │ │ │ │ + * Returns:
│ │ │ │ │ + * {} An
│ │ │ │ │ + * object, the same object will be passed to the callback function passed
│ │ │ │ │ + * if one exists in the options object.
│ │ │ │ │ + */
│ │ │ │ │ + "delete": function() {},
│ │ │ │ │
│ │ │ │ │ -/**
│ │ │ │ │ - * @requires OpenLayers/BaseTypes/Class.js
│ │ │ │ │ - * @requires OpenLayers/Animation.js
│ │ │ │ │ - */
│ │ │ │ │ + /**
│ │ │ │ │ + * APIMethod: commit
│ │ │ │ │ + * Go over the features and for each take action
│ │ │ │ │ + * based on the feature state. Possible actions are create,
│ │ │ │ │ + * update and delete.
│ │ │ │ │ + *
│ │ │ │ │ + * Parameters:
│ │ │ │ │ + * features - {Array({})}
│ │ │ │ │ + * options - {Object} Object whose possible keys are "create", "update",
│ │ │ │ │ + * "delete", "callback" and "scope", the values referenced by the
│ │ │ │ │ + * first three are objects as passed to the "create", "update", and
│ │ │ │ │ + * "delete" methods, the value referenced by the "callback" key is
│ │ │ │ │ + * a function which is called when the commit operation is complete
│ │ │ │ │ + * using the scope referenced by the "scope" key.
│ │ │ │ │ + *
│ │ │ │ │ + * Returns:
│ │ │ │ │ + * {Array({})} An array of
│ │ │ │ │ + * objects.
│ │ │ │ │ + */
│ │ │ │ │ + commit: function() {},
│ │ │ │ │
│ │ │ │ │ -OpenLayers.Kinetic = OpenLayers.Class({
│ │ │ │ │ + /**
│ │ │ │ │ + * Method: abort
│ │ │ │ │ + * Abort an ongoing request.
│ │ │ │ │ + *
│ │ │ │ │ + * Parameters:
│ │ │ │ │ + * response - {}
│ │ │ │ │ + */
│ │ │ │ │ + abort: function(response) {},
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Property: threshold
│ │ │ │ │ - * In most cases changing the threshold isn't needed.
│ │ │ │ │ - * In px/ms, default to 0.
│ │ │ │ │ + * Method: createCallback
│ │ │ │ │ + * Returns a function that applies the given public method with resp and
│ │ │ │ │ + * options arguments.
│ │ │ │ │ + *
│ │ │ │ │ + * Parameters:
│ │ │ │ │ + * method - {Function} The method to be applied by the callback.
│ │ │ │ │ + * response - {} The protocol response object.
│ │ │ │ │ + * options - {Object} Options sent to the protocol method
│ │ │ │ │ */
│ │ │ │ │ - threshold: 0,
│ │ │ │ │ + createCallback: function(method, response, options) {
│ │ │ │ │ + return OpenLayers.Function.bind(function() {
│ │ │ │ │ + method.apply(this, [response, options]);
│ │ │ │ │ + }, this);
│ │ │ │ │ + },
│ │ │ │ │ +
│ │ │ │ │ + CLASS_NAME: "OpenLayers.Protocol"
│ │ │ │ │ +});
│ │ │ │ │
│ │ │ │ │ +/**
│ │ │ │ │ + * Class: OpenLayers.Protocol.Response
│ │ │ │ │ + * Protocols return Response objects to their users.
│ │ │ │ │ + */
│ │ │ │ │ +OpenLayers.Protocol.Response = OpenLayers.Class({
│ │ │ │ │ /**
│ │ │ │ │ - * Property: deceleration
│ │ │ │ │ - * {Float} the deseleration in px/ms², default to 0.0035.
│ │ │ │ │ + * Property: code
│ │ │ │ │ + * {Number} - OpenLayers.Protocol.Response.SUCCESS or
│ │ │ │ │ + * OpenLayers.Protocol.Response.FAILURE
│ │ │ │ │ */
│ │ │ │ │ - deceleration: 0.0035,
│ │ │ │ │ + code: null,
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Property: nbPoints
│ │ │ │ │ - * {Integer} the number of points we use to calculate the kinetic
│ │ │ │ │ - * initial values.
│ │ │ │ │ + * Property: requestType
│ │ │ │ │ + * {String} The type of request this response corresponds to. Either
│ │ │ │ │ + * "create", "read", "update" or "delete".
│ │ │ │ │ */
│ │ │ │ │ - nbPoints: 100,
│ │ │ │ │ + requestType: null,
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Property: delay
│ │ │ │ │ - * {Float} time to consider to calculate the kinetic initial values.
│ │ │ │ │ - * In ms, default to 200.
│ │ │ │ │ + * Property: last
│ │ │ │ │ + * {Boolean} - true if this is the last response expected in a commit,
│ │ │ │ │ + * false otherwise, defaults to true.
│ │ │ │ │ */
│ │ │ │ │ - delay: 200,
│ │ │ │ │ + last: true,
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Property: points
│ │ │ │ │ - * List of points use to calculate the kinetic initial values.
│ │ │ │ │ + * Property: features
│ │ │ │ │ + * {Array({})} or {}
│ │ │ │ │ + * The features returned in the response by the server. Depending on the
│ │ │ │ │ + * protocol's read payload, either features or data will be populated.
│ │ │ │ │ */
│ │ │ │ │ - points: undefined,
│ │ │ │ │ + features: null,
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Property: timerId
│ │ │ │ │ - * ID of the timer.
│ │ │ │ │ + * Property: data
│ │ │ │ │ + * {Object}
│ │ │ │ │ + * The data returned in the response by the server. Depending on the
│ │ │ │ │ + * protocol's read payload, either features or data will be populated.
│ │ │ │ │ */
│ │ │ │ │ - timerId: undefined,
│ │ │ │ │ + data: null,
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Constructor: OpenLayers.Kinetic
│ │ │ │ │ - *
│ │ │ │ │ - * Parameters:
│ │ │ │ │ - * options - {Object}
│ │ │ │ │ + * Property: reqFeatures
│ │ │ │ │ + * {Array({})} or {}
│ │ │ │ │ + * The features provided by the user and placed in the request by the
│ │ │ │ │ + * protocol.
│ │ │ │ │ */
│ │ │ │ │ - initialize: function(options) {
│ │ │ │ │ - OpenLayers.Util.extend(this, options);
│ │ │ │ │ - },
│ │ │ │ │ + reqFeatures: null,
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Method: begin
│ │ │ │ │ - * Begins the dragging.
│ │ │ │ │ + * Property: priv
│ │ │ │ │ */
│ │ │ │ │ - begin: function() {
│ │ │ │ │ - OpenLayers.Animation.stop(this.timerId);
│ │ │ │ │ - this.timerId = undefined;
│ │ │ │ │ - this.points = [];
│ │ │ │ │ - },
│ │ │ │ │ + priv: null,
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Method: update
│ │ │ │ │ - * Updates during the dragging.
│ │ │ │ │ - *
│ │ │ │ │ - * Parameters:
│ │ │ │ │ - * xy - {} The new position.
│ │ │ │ │ + * Property: error
│ │ │ │ │ + * {Object} The error object in case a service exception was encountered.
│ │ │ │ │ */
│ │ │ │ │ - update: function(xy) {
│ │ │ │ │ - this.points.unshift({
│ │ │ │ │ - xy: xy,
│ │ │ │ │ - tick: new Date().getTime()
│ │ │ │ │ - });
│ │ │ │ │ - if (this.points.length > this.nbPoints) {
│ │ │ │ │ - this.points.pop();
│ │ │ │ │ - }
│ │ │ │ │ - },
│ │ │ │ │ + error: null,
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Method: end
│ │ │ │ │ - * Ends the dragging, start the kinetic.
│ │ │ │ │ + * Constructor: OpenLayers.Protocol.Response
│ │ │ │ │ *
│ │ │ │ │ * Parameters:
│ │ │ │ │ - * xy - {} The last position.
│ │ │ │ │ - *
│ │ │ │ │ - * Returns:
│ │ │ │ │ - * {Object} An object with two properties: "speed", and "theta". The
│ │ │ │ │ - * "speed" and "theta" values are to be passed to the move
│ │ │ │ │ - * function when starting the animation.
│ │ │ │ │ + * options - {Object} Optional object whose properties will be set on the
│ │ │ │ │ + * instance.
│ │ │ │ │ */
│ │ │ │ │ - end: function(xy) {
│ │ │ │ │ - var last, now = new Date().getTime();
│ │ │ │ │ - for (var i = 0, l = this.points.length, point; i < l; i++) {
│ │ │ │ │ - point = this.points[i];
│ │ │ │ │ - if (now - point.tick > this.delay) {
│ │ │ │ │ - break;
│ │ │ │ │ - }
│ │ │ │ │ - last = point;
│ │ │ │ │ - }
│ │ │ │ │ - if (!last) {
│ │ │ │ │ - return;
│ │ │ │ │ - }
│ │ │ │ │ - var time = new Date().getTime() - last.tick;
│ │ │ │ │ - var dist = Math.sqrt(Math.pow(xy.x - last.xy.x, 2) +
│ │ │ │ │ - Math.pow(xy.y - last.xy.y, 2));
│ │ │ │ │ - var speed = dist / time;
│ │ │ │ │ - if (speed == 0 || speed < this.threshold) {
│ │ │ │ │ - return;
│ │ │ │ │ - }
│ │ │ │ │ - var theta = Math.asin((xy.y - last.xy.y) / dist);
│ │ │ │ │ - if (last.xy.x <= xy.x) {
│ │ │ │ │ - theta = Math.PI - theta;
│ │ │ │ │ - }
│ │ │ │ │ - return {
│ │ │ │ │ - speed: speed,
│ │ │ │ │ - theta: theta
│ │ │ │ │ - };
│ │ │ │ │ + initialize: function(options) {
│ │ │ │ │ + OpenLayers.Util.extend(this, options);
│ │ │ │ │ },
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Method: move
│ │ │ │ │ - * Launch the kinetic move pan.
│ │ │ │ │ + * Method: success
│ │ │ │ │ *
│ │ │ │ │ - * Parameters:
│ │ │ │ │ - * info - {Object} An object with two properties, "speed", and "theta".
│ │ │ │ │ - * These values are those returned from the "end" call.
│ │ │ │ │ - * callback - {Function} Function called on every step of the animation,
│ │ │ │ │ - * receives x, y (values to pan), end (is the last point).
│ │ │ │ │ + * Returns:
│ │ │ │ │ + * {Boolean} - true on success, false otherwise
│ │ │ │ │ */
│ │ │ │ │ - move: function(info, callback) {
│ │ │ │ │ - var v0 = info.speed;
│ │ │ │ │ - var fx = Math.cos(info.theta);
│ │ │ │ │ - var fy = -Math.sin(info.theta);
│ │ │ │ │ -
│ │ │ │ │ - var initialTime = new Date().getTime();
│ │ │ │ │ -
│ │ │ │ │ - var lastX = 0;
│ │ │ │ │ - var lastY = 0;
│ │ │ │ │ -
│ │ │ │ │ - var timerCallback = function() {
│ │ │ │ │ - if (this.timerId == null) {
│ │ │ │ │ - return;
│ │ │ │ │ - }
│ │ │ │ │ -
│ │ │ │ │ - var t = new Date().getTime() - initialTime;
│ │ │ │ │ -
│ │ │ │ │ - var p = (-this.deceleration * Math.pow(t, 2)) / 2.0 + v0 * t;
│ │ │ │ │ - var x = p * fx;
│ │ │ │ │ - var y = p * fy;
│ │ │ │ │ -
│ │ │ │ │ - var args = {};
│ │ │ │ │ - args.end = false;
│ │ │ │ │ - var v = -this.deceleration * t + v0;
│ │ │ │ │ -
│ │ │ │ │ - if (v <= 0) {
│ │ │ │ │ - OpenLayers.Animation.stop(this.timerId);
│ │ │ │ │ - this.timerId = null;
│ │ │ │ │ - args.end = true;
│ │ │ │ │ - }
│ │ │ │ │ -
│ │ │ │ │ - args.x = x - lastX;
│ │ │ │ │ - args.y = y - lastY;
│ │ │ │ │ - lastX = x;
│ │ │ │ │ - lastY = y;
│ │ │ │ │ - callback(args.x, args.y, args.end);
│ │ │ │ │ - };
│ │ │ │ │ -
│ │ │ │ │ - this.timerId = OpenLayers.Animation.start(
│ │ │ │ │ - OpenLayers.Function.bind(timerCallback, this)
│ │ │ │ │ - );
│ │ │ │ │ + success: function() {
│ │ │ │ │ + return this.code > 0;
│ │ │ │ │ },
│ │ │ │ │
│ │ │ │ │ - CLASS_NAME: "OpenLayers.Kinetic"
│ │ │ │ │ + CLASS_NAME: "OpenLayers.Protocol.Response"
│ │ │ │ │ });
│ │ │ │ │ +
│ │ │ │ │ +OpenLayers.Protocol.Response.SUCCESS = 1;
│ │ │ │ │ +OpenLayers.Protocol.Response.FAILURE = 0;
│ │ │ │ │ /* ======================================================================
│ │ │ │ │ - OpenLayers/Icon.js
│ │ │ │ │ + OpenLayers/Geometry.js
│ │ │ │ │ ====================================================================== */
│ │ │ │ │
│ │ │ │ │ /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
│ │ │ │ │ * full list of contributors). Published under the 2-clause BSD license.
│ │ │ │ │ * See license.txt in the OpenLayers distribution or repository for the
│ │ │ │ │ * full text of the license. */
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ * @requires OpenLayers/BaseTypes/Class.js
│ │ │ │ │ */
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Class: OpenLayers.Icon
│ │ │ │ │ - *
│ │ │ │ │ - * The icon represents a graphical icon on the screen. Typically used in
│ │ │ │ │ - * conjunction with a to represent markers on a screen.
│ │ │ │ │ + * Class: OpenLayers.Geometry
│ │ │ │ │ + * A Geometry is a description of a geographic object. Create an instance of
│ │ │ │ │ + * this class with the constructor. This is a base class,
│ │ │ │ │ + * typical geometry types are described by subclasses of this class.
│ │ │ │ │ *
│ │ │ │ │ - * An icon has a url, size and position. It also contains an offset which
│ │ │ │ │ - * allows the center point to be represented correctly. This can be
│ │ │ │ │ - * provided either as a fixed offset or a function provided to calculate
│ │ │ │ │ - * the desired offset.
│ │ │ │ │ - *
│ │ │ │ │ + * Note that if you use the method, you must
│ │ │ │ │ + * explicitly include the OpenLayers.Format.WKT in your build.
│ │ │ │ │ */
│ │ │ │ │ -OpenLayers.Icon = OpenLayers.Class({
│ │ │ │ │ -
│ │ │ │ │ - /**
│ │ │ │ │ - * Property: url
│ │ │ │ │ - * {String} image url
│ │ │ │ │ - */
│ │ │ │ │ - url: null,
│ │ │ │ │ -
│ │ │ │ │ - /**
│ │ │ │ │ - * Property: size
│ │ │ │ │ - * {|Object} An OpenLayers.Size or
│ │ │ │ │ - * an object with a 'w' and 'h' properties.
│ │ │ │ │ - */
│ │ │ │ │ - size: null,
│ │ │ │ │ -
│ │ │ │ │ - /**
│ │ │ │ │ - * Property: offset
│ │ │ │ │ - * {|Object} distance in pixels to offset the
│ │ │ │ │ - * image when being rendered. An OpenLayers.Pixel or an object
│ │ │ │ │ - * with a 'x' and 'y' properties.
│ │ │ │ │ - */
│ │ │ │ │ - offset: null,
│ │ │ │ │ +OpenLayers.Geometry = OpenLayers.Class({
│ │ │ │ │
│ │ │ │ │ - /**
│ │ │ │ │ - * Property: calculateOffset
│ │ │ │ │ - * {Function} Function to calculate the offset (based on the size)
│ │ │ │ │ + /**
│ │ │ │ │ + * Property: id
│ │ │ │ │ + * {String} A unique identifier for this geometry.
│ │ │ │ │ */
│ │ │ │ │ - calculateOffset: null,
│ │ │ │ │ + id: null,
│ │ │ │ │
│ │ │ │ │ - /**
│ │ │ │ │ - * Property: imageDiv
│ │ │ │ │ - * {DOMElement}
│ │ │ │ │ + /**
│ │ │ │ │ + * Property: parent
│ │ │ │ │ + * {}This is set when a Geometry is added as component
│ │ │ │ │ + * of another geometry
│ │ │ │ │ */
│ │ │ │ │ - imageDiv: null,
│ │ │ │ │ + parent: null,
│ │ │ │ │
│ │ │ │ │ - /**
│ │ │ │ │ - * Property: px
│ │ │ │ │ - * {|Object} An OpenLayers.Pixel or an object
│ │ │ │ │ - * with a 'x' and 'y' properties.
│ │ │ │ │ + /**
│ │ │ │ │ + * Property: bounds
│ │ │ │ │ + * {} The bounds of this geometry
│ │ │ │ │ */
│ │ │ │ │ - px: null,
│ │ │ │ │ + bounds: null,
│ │ │ │ │
│ │ │ │ │ - /**
│ │ │ │ │ - * Constructor: OpenLayers.Icon
│ │ │ │ │ - * Creates an icon, which is an image tag in a div.
│ │ │ │ │ - *
│ │ │ │ │ - * url - {String}
│ │ │ │ │ - * size - {|Object} An OpenLayers.Size or an
│ │ │ │ │ - * object with a 'w' and 'h'
│ │ │ │ │ - * properties.
│ │ │ │ │ - * offset - {|Object} An OpenLayers.Pixel or an
│ │ │ │ │ - * object with a 'x' and 'y'
│ │ │ │ │ - * properties.
│ │ │ │ │ - * calculateOffset - {Function}
│ │ │ │ │ + /**
│ │ │ │ │ + * Constructor: OpenLayers.Geometry
│ │ │ │ │ + * Creates a geometry object.
│ │ │ │ │ */
│ │ │ │ │ - initialize: function(url, size, offset, calculateOffset) {
│ │ │ │ │ - this.url = url;
│ │ │ │ │ - this.size = size || {
│ │ │ │ │ - w: 20,
│ │ │ │ │ - h: 20
│ │ │ │ │ - };
│ │ │ │ │ - this.offset = offset || {
│ │ │ │ │ - x: -(this.size.w / 2),
│ │ │ │ │ - y: -(this.size.h / 2)
│ │ │ │ │ - };
│ │ │ │ │ - this.calculateOffset = calculateOffset;
│ │ │ │ │ -
│ │ │ │ │ - var id = OpenLayers.Util.createUniqueID("OL_Icon_");
│ │ │ │ │ - this.imageDiv = OpenLayers.Util.createAlphaImageDiv(id);
│ │ │ │ │ + initialize: function() {
│ │ │ │ │ + this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
│ │ │ │ │ },
│ │ │ │ │
│ │ │ │ │ - /**
│ │ │ │ │ + /**
│ │ │ │ │ * Method: destroy
│ │ │ │ │ - * Nullify references and remove event listeners to prevent circular
│ │ │ │ │ - * references and memory leaks
│ │ │ │ │ + * Destroy this geometry.
│ │ │ │ │ */
│ │ │ │ │ destroy: function() {
│ │ │ │ │ - // erase any drawn elements
│ │ │ │ │ - this.erase();
│ │ │ │ │ -
│ │ │ │ │ - OpenLayers.Event.stopObservingElement(this.imageDiv.firstChild);
│ │ │ │ │ - this.imageDiv.innerHTML = "";
│ │ │ │ │ - this.imageDiv = null;
│ │ │ │ │ + this.id = null;
│ │ │ │ │ + this.bounds = null;
│ │ │ │ │ },
│ │ │ │ │
│ │ │ │ │ - /**
│ │ │ │ │ - * Method: clone
│ │ │ │ │ + /**
│ │ │ │ │ + * APIMethod: clone
│ │ │ │ │ + * Create a clone of this geometry. Does not set any non-standard
│ │ │ │ │ + * properties of the cloned geometry.
│ │ │ │ │ *
│ │ │ │ │ * Returns:
│ │ │ │ │ - * {} A fresh copy of the icon.
│ │ │ │ │ + * {} An exact clone of this geometry.
│ │ │ │ │ */
│ │ │ │ │ clone: function() {
│ │ │ │ │ - return new OpenLayers.Icon(this.url,
│ │ │ │ │ - this.size,
│ │ │ │ │ - this.offset,
│ │ │ │ │ - this.calculateOffset);
│ │ │ │ │ + return new OpenLayers.Geometry();
│ │ │ │ │ },
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Method: setSize
│ │ │ │ │ + * Method: setBounds
│ │ │ │ │ + * Set the bounds for this Geometry.
│ │ │ │ │ *
│ │ │ │ │ * Parameters:
│ │ │ │ │ - * size - {|Object} An OpenLayers.Size or
│ │ │ │ │ - * an object with a 'w' and 'h' properties.
│ │ │ │ │ + * bounds - {}
│ │ │ │ │ */
│ │ │ │ │ - setSize: function(size) {
│ │ │ │ │ - if (size != null) {
│ │ │ │ │ - this.size = size;
│ │ │ │ │ + setBounds: function(bounds) {
│ │ │ │ │ + if (bounds) {
│ │ │ │ │ + this.bounds = bounds.clone();
│ │ │ │ │ }
│ │ │ │ │ - this.draw();
│ │ │ │ │ },
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Method: setUrl
│ │ │ │ │ - *
│ │ │ │ │ - * Parameters:
│ │ │ │ │ - * url - {String}
│ │ │ │ │ + * Method: clearBounds
│ │ │ │ │ + * Nullify this components bounds and that of its parent as well.
│ │ │ │ │ */
│ │ │ │ │ - setUrl: function(url) {
│ │ │ │ │ - if (url != null) {
│ │ │ │ │ - this.url = url;
│ │ │ │ │ + clearBounds: function() {
│ │ │ │ │ + this.bounds = null;
│ │ │ │ │ + if (this.parent) {
│ │ │ │ │ + this.parent.clearBounds();
│ │ │ │ │ }
│ │ │ │ │ - this.draw();
│ │ │ │ │ },
│ │ │ │ │
│ │ │ │ │ - /**
│ │ │ │ │ - * Method: draw
│ │ │ │ │ - * Move the div to the given pixel.
│ │ │ │ │ + /**
│ │ │ │ │ + * Method: extendBounds
│ │ │ │ │ + * Extend the existing bounds to include the new bounds.
│ │ │ │ │ + * If geometry's bounds is not yet set, then set a new Bounds.
│ │ │ │ │ *
│ │ │ │ │ * Parameters:
│ │ │ │ │ - * px - {|Object} An OpenLayers.Pixel or an
│ │ │ │ │ - * object with a 'x' and 'y' properties.
│ │ │ │ │ - *
│ │ │ │ │ - * Returns:
│ │ │ │ │ - * {DOMElement} A new DOM Image of this icon set at the location passed-in
│ │ │ │ │ + * newBounds - {}
│ │ │ │ │ */
│ │ │ │ │ - draw: function(px) {
│ │ │ │ │ - OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,
│ │ │ │ │ - null,
│ │ │ │ │ - null,
│ │ │ │ │ - this.size,
│ │ │ │ │ - this.url,
│ │ │ │ │ - "absolute");
│ │ │ │ │ - this.moveTo(px);
│ │ │ │ │ - return this.imageDiv;
│ │ │ │ │ + extendBounds: function(newBounds) {
│ │ │ │ │ + var bounds = this.getBounds();
│ │ │ │ │ + if (!bounds) {
│ │ │ │ │ + this.setBounds(newBounds);
│ │ │ │ │ + } else {
│ │ │ │ │ + this.bounds.extend(newBounds);
│ │ │ │ │ + }
│ │ │ │ │ },
│ │ │ │ │
│ │ │ │ │ - /**
│ │ │ │ │ - * Method: erase
│ │ │ │ │ - * Erase the underlying image element.
│ │ │ │ │ + /**
│ │ │ │ │ + * APIMethod: getBounds
│ │ │ │ │ + * Get the bounds for this Geometry. If bounds is not set, it
│ │ │ │ │ + * is calculated again, this makes queries faster.
│ │ │ │ │ + *
│ │ │ │ │ + * Returns:
│ │ │ │ │ + * {}
│ │ │ │ │ */
│ │ │ │ │ - erase: function() {
│ │ │ │ │ - if (this.imageDiv != null && this.imageDiv.parentNode != null) {
│ │ │ │ │ - OpenLayers.Element.remove(this.imageDiv);
│ │ │ │ │ + getBounds: function() {
│ │ │ │ │ + if (this.bounds == null) {
│ │ │ │ │ + this.calculateBounds();
│ │ │ │ │ }
│ │ │ │ │ + return this.bounds;
│ │ │ │ │ },
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Method: setOpacity
│ │ │ │ │ - * Change the icon's opacity
│ │ │ │ │ - *
│ │ │ │ │ - * Parameters:
│ │ │ │ │ - * opacity - {float}
│ │ │ │ │ + * APIMethod: calculateBounds
│ │ │ │ │ + * Recalculate the bounds for the geometry.
│ │ │ │ │ */
│ │ │ │ │ - setOpacity: function(opacity) {
│ │ │ │ │ - OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv, null, null, null,
│ │ │ │ │ - null, null, null, null, opacity);
│ │ │ │ │ -
│ │ │ │ │ + calculateBounds: function() {
│ │ │ │ │ + //
│ │ │ │ │ + // This should be overridden by subclasses.
│ │ │ │ │ + //
│ │ │ │ │ },
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Method: moveTo
│ │ │ │ │ - * move icon to passed in px.
│ │ │ │ │ + * APIMethod: distanceTo
│ │ │ │ │ + * Calculate the closest distance between two geometries (on the x-y plane).
│ │ │ │ │ *
│ │ │ │ │ * Parameters:
│ │ │ │ │ - * px - {|Object} the pixel position to move to.
│ │ │ │ │ - * An OpenLayers.Pixel or an object with a 'x' and 'y' properties.
│ │ │ │ │ - */
│ │ │ │ │ - moveTo: function(px) {
│ │ │ │ │ - //if no px passed in, use stored location
│ │ │ │ │ - if (px != null) {
│ │ │ │ │ - this.px = px;
│ │ │ │ │ - }
│ │ │ │ │ -
│ │ │ │ │ - if (this.imageDiv != null) {
│ │ │ │ │ - if (this.px == null) {
│ │ │ │ │ - this.display(false);
│ │ │ │ │ - } else {
│ │ │ │ │ - if (this.calculateOffset) {
│ │ │ │ │ - this.offset = this.calculateOffset(this.size);
│ │ │ │ │ - }
│ │ │ │ │ - OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv, null, {
│ │ │ │ │ - x: this.px.x + this.offset.x,
│ │ │ │ │ - y: this.px.y + this.offset.y
│ │ │ │ │ - });
│ │ │ │ │ - }
│ │ │ │ │ - }
│ │ │ │ │ - },
│ │ │ │ │ -
│ │ │ │ │ - /**
│ │ │ │ │ - * Method: display
│ │ │ │ │ - * Hide or show the icon
│ │ │ │ │ + * geometry - {} The target geometry.
│ │ │ │ │ + * options - {Object} Optional properties for configuring the distance
│ │ │ │ │ + * calculation.
│ │ │ │ │ *
│ │ │ │ │ - * Parameters:
│ │ │ │ │ - * display - {Boolean}
│ │ │ │ │ - */
│ │ │ │ │ - display: function(display) {
│ │ │ │ │ - this.imageDiv.style.display = (display) ? "" : "none";
│ │ │ │ │ - },
│ │ │ │ │ -
│ │ │ │ │ -
│ │ │ │ │ - /**
│ │ │ │ │ - * APIMethod: isDrawn
│ │ │ │ │ + * Valid options depend on the specific geometry type.
│ │ │ │ │ *
│ │ │ │ │ * Returns:
│ │ │ │ │ - * {Boolean} Whether or not the icon is drawn.
│ │ │ │ │ - */
│ │ │ │ │ - isDrawn: function() {
│ │ │ │ │ - // nodeType 11 for ie, whose nodes *always* have a parentNode
│ │ │ │ │ - // (of type document fragment)
│ │ │ │ │ - var isDrawn = (this.imageDiv && this.imageDiv.parentNode &&
│ │ │ │ │ - (this.imageDiv.parentNode.nodeType != 11));
│ │ │ │ │ -
│ │ │ │ │ - return isDrawn;
│ │ │ │ │ - },
│ │ │ │ │ -
│ │ │ │ │ - CLASS_NAME: "OpenLayers.Icon"
│ │ │ │ │ -});
│ │ │ │ │ -/* ======================================================================
│ │ │ │ │ - OpenLayers/Marker.js
│ │ │ │ │ - ====================================================================== */
│ │ │ │ │ -
│ │ │ │ │ -/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
│ │ │ │ │ - * full list of contributors). Published under the 2-clause BSD license.
│ │ │ │ │ - * See license.txt in the OpenLayers distribution or repository for the
│ │ │ │ │ - * full text of the license. */
│ │ │ │ │ -
│ │ │ │ │ -
│ │ │ │ │ -/**
│ │ │ │ │ - * @requires OpenLayers/BaseTypes/Class.js
│ │ │ │ │ - * @requires OpenLayers/Events.js
│ │ │ │ │ - * @requires OpenLayers/Icon.js
│ │ │ │ │ - */
│ │ │ │ │ -
│ │ │ │ │ -/**
│ │ │ │ │ - * Class: OpenLayers.Marker
│ │ │ │ │ - * Instances of OpenLayers.Marker are a combination of a
│ │ │ │ │ - * and an .
│ │ │ │ │ - *
│ │ │ │ │ - * Markers are generally added to a special layer called
│ │ │ │ │ - * .
│ │ │ │ │ - *
│ │ │ │ │ - * Example:
│ │ │ │ │ - * (code)
│ │ │ │ │ - * var markers = new OpenLayers.Layer.Markers( "Markers" );
│ │ │ │ │ - * map.addLayer(markers);
│ │ │ │ │ - *
│ │ │ │ │ - * var size = new OpenLayers.Size(21,25);
│ │ │ │ │ - * var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
│ │ │ │ │ - * var icon = new OpenLayers.Icon('http://www.openlayers.org/dev/img/marker.png', size, offset);
│ │ │ │ │ - * markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,0),icon));
│ │ │ │ │ - * markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,0),icon.clone()));
│ │ │ │ │ - *
│ │ │ │ │ - * (end)
│ │ │ │ │ - *
│ │ │ │ │ - * Note that if you pass an icon into the Marker constructor, it will take
│ │ │ │ │ - * that icon and use it. This means that you should not share icons between
│ │ │ │ │ - * markers -- you use them once, but you should clone() for any additional
│ │ │ │ │ - * markers using that same icon.
│ │ │ │ │ - */
│ │ │ │ │ -OpenLayers.Marker = OpenLayers.Class({
│ │ │ │ │ -
│ │ │ │ │ - /**
│ │ │ │ │ - * Property: icon
│ │ │ │ │ - * {} The icon used by this marker.
│ │ │ │ │ - */
│ │ │ │ │ - icon: null,
│ │ │ │ │ -
│ │ │ │ │ - /**
│ │ │ │ │ - * Property: lonlat
│ │ │ │ │ - * {} location of object
│ │ │ │ │ - */
│ │ │ │ │ - lonlat: null,
│ │ │ │ │ -
│ │ │ │ │ - /**
│ │ │ │ │ - * Property: events
│ │ │ │ │ - * {} the event handler.
│ │ │ │ │ - */
│ │ │ │ │ - events: null,
│ │ │ │ │ -
│ │ │ │ │ - /**
│ │ │ │ │ - * Property: map
│ │ │ │ │ - * {} the map this marker is attached to
│ │ │ │ │ + * {Number | Object} The distance between this geometry and the target.
│ │ │ │ │ + * If details is true, the return will be an object with distance,
│ │ │ │ │ + * x0, y0, x1, and x2 properties. The x0 and y0 properties represent
│ │ │ │ │ + * the coordinates of the closest point on this geometry. The x1 and y1
│ │ │ │ │ + * properties represent the coordinates of the closest point on the
│ │ │ │ │ + * target geometry.
│ │ │ │ │ */
│ │ │ │ │ - map: null,
│ │ │ │ │ + distanceTo: function(geometry, options) {},
│ │ │ │ │
│ │ │ │ │ - /**
│ │ │ │ │ - * Constructor: OpenLayers.Marker
│ │ │ │ │ + /**
│ │ │ │ │ + * APIMethod: getVertices
│ │ │ │ │ + * Return a list of all points in this geometry.
│ │ │ │ │ *
│ │ │ │ │ * Parameters:
│ │ │ │ │ - * lonlat - {} the position of this marker
│ │ │ │ │ - * icon - {} the icon for this marker
│ │ │ │ │ + * nodes - {Boolean} For lines, only return vertices that are
│ │ │ │ │ + * endpoints. If false, for lines, only vertices that are not
│ │ │ │ │ + * endpoints will be returned. If not provided, all vertices will
│ │ │ │ │ + * be returned.
│ │ │ │ │ + *
│ │ │ │ │ + * Returns:
│ │ │ │ │ + * {Array} A list of all vertices in the geometry.
│ │ │ │ │ */
│ │ │ │ │ - initialize: function(lonlat, icon) {
│ │ │ │ │ - this.lonlat = lonlat;
│ │ │ │ │ -
│ │ │ │ │ - var newIcon = (icon) ? icon : OpenLayers.Marker.defaultIcon();
│ │ │ │ │ - if (this.icon == null) {
│ │ │ │ │ - this.icon = newIcon;
│ │ │ │ │ - } else {
│ │ │ │ │ - this.icon.url = newIcon.url;
│ │ │ │ │ - this.icon.size = newIcon.size;
│ │ │ │ │ - this.icon.offset = newIcon.offset;
│ │ │ │ │ - this.icon.calculateOffset = newIcon.calculateOffset;
│ │ │ │ │ - }
│ │ │ │ │ - this.events = new OpenLayers.Events(this, this.icon.imageDiv);
│ │ │ │ │ - },
│ │ │ │ │ + getVertices: function(nodes) {},
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * APIMethod: destroy
│ │ │ │ │ - * Destroy the marker. You must first remove the marker from any
│ │ │ │ │ - * layer which it has been added to, or you will get buggy behavior.
│ │ │ │ │ - * (This can not be done within the marker since the marker does not
│ │ │ │ │ - * know which layer it is attached to.)
│ │ │ │ │ - */
│ │ │ │ │ - destroy: function() {
│ │ │ │ │ - // erase any drawn features
│ │ │ │ │ - this.erase();
│ │ │ │ │ -
│ │ │ │ │ - this.map = null;
│ │ │ │ │ -
│ │ │ │ │ - this.events.destroy();
│ │ │ │ │ - this.events = null;
│ │ │ │ │ -
│ │ │ │ │ - if (this.icon != null) {
│ │ │ │ │ - this.icon.destroy();
│ │ │ │ │ - this.icon = null;
│ │ │ │ │ - }
│ │ │ │ │ - },
│ │ │ │ │ -
│ │ │ │ │ - /**
│ │ │ │ │ - * Method: draw
│ │ │ │ │ - * Calls draw on the icon, and returns that output.
│ │ │ │ │ + * Method: atPoint
│ │ │ │ │ + * Note - This is only an approximation based on the bounds of the
│ │ │ │ │ + * geometry.
│ │ │ │ │ *
│ │ │ │ │ * Parameters:
│ │ │ │ │ - * px - {}
│ │ │ │ │ + * lonlat - {|Object} OpenLayers.LonLat or an
│ │ │ │ │ + * object with a 'lon' and 'lat' properties.
│ │ │ │ │ + * toleranceLon - {float} Optional tolerance in Geometric Coords
│ │ │ │ │ + * toleranceLat - {float} Optional tolerance in Geographic Coords
│ │ │ │ │ *
│ │ │ │ │ * Returns:
│ │ │ │ │ - * {DOMElement} A new DOM Image with this marker's icon set at the
│ │ │ │ │ - * location passed-in
│ │ │ │ │ + * {Boolean} Whether or not the geometry is at the specified location
│ │ │ │ │ */
│ │ │ │ │ - draw: function(px) {
│ │ │ │ │ - return this.icon.draw(px);
│ │ │ │ │ - },
│ │ │ │ │ + atPoint: function(lonlat, toleranceLon, toleranceLat) {
│ │ │ │ │ + var atPoint = false;
│ │ │ │ │ + var bounds = this.getBounds();
│ │ │ │ │ + if ((bounds != null) && (lonlat != null)) {
│ │ │ │ │
│ │ │ │ │ - /**
│ │ │ │ │ - * Method: erase
│ │ │ │ │ - * Erases any drawn elements for this marker.
│ │ │ │ │ - */
│ │ │ │ │ - erase: function() {
│ │ │ │ │ - if (this.icon != null) {
│ │ │ │ │ - this.icon.erase();
│ │ │ │ │ + var dX = (toleranceLon != null) ? toleranceLon : 0;
│ │ │ │ │ + var dY = (toleranceLat != null) ? toleranceLat : 0;
│ │ │ │ │ +
│ │ │ │ │ + var toleranceBounds =
│ │ │ │ │ + new OpenLayers.Bounds(this.bounds.left - dX,
│ │ │ │ │ + this.bounds.bottom - dY,
│ │ │ │ │ + this.bounds.right + dX,
│ │ │ │ │ + this.bounds.top + dY);
│ │ │ │ │ +
│ │ │ │ │ + atPoint = toleranceBounds.containsLonLat(lonlat);
│ │ │ │ │ }
│ │ │ │ │ + return atPoint;
│ │ │ │ │ },
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Method: moveTo
│ │ │ │ │ - * Move the marker to the new location.
│ │ │ │ │ - *
│ │ │ │ │ - * Parameters:
│ │ │ │ │ - * px - {|Object} the pixel position to move to.
│ │ │ │ │ - * An OpenLayers.Pixel or an object with a 'x' and 'y' properties.
│ │ │ │ │ + * Method: getLength
│ │ │ │ │ + * Calculate the length of this geometry. This method is defined in
│ │ │ │ │ + * subclasses.
│ │ │ │ │ + *
│ │ │ │ │ + * Returns:
│ │ │ │ │ + * {Float} The length of the collection by summing its parts
│ │ │ │ │ */
│ │ │ │ │ - moveTo: function(px) {
│ │ │ │ │ - if ((px != null) && (this.icon != null)) {
│ │ │ │ │ - this.icon.moveTo(px);
│ │ │ │ │ - }
│ │ │ │ │ - this.lonlat = this.map.getLonLatFromLayerPx(px);
│ │ │ │ │ + getLength: function() {
│ │ │ │ │ + //to be overridden by geometries that actually have a length
│ │ │ │ │ + //
│ │ │ │ │ + return 0.0;
│ │ │ │ │ },
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * APIMethod: isDrawn
│ │ │ │ │ + * Method: getArea
│ │ │ │ │ + * Calculate the area of this geometry. This method is defined in subclasses.
│ │ │ │ │ *
│ │ │ │ │ * Returns:
│ │ │ │ │ - * {Boolean} Whether or not the marker is drawn.
│ │ │ │ │ + * {Float} The area of the collection by summing its parts
│ │ │ │ │ */
│ │ │ │ │ - isDrawn: function() {
│ │ │ │ │ - var isDrawn = (this.icon && this.icon.isDrawn());
│ │ │ │ │ - return isDrawn;
│ │ │ │ │ + getArea: function() {
│ │ │ │ │ + //to be overridden by geometries that actually have an area
│ │ │ │ │ + //
│ │ │ │ │ + return 0.0;
│ │ │ │ │ },
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Method: onScreen
│ │ │ │ │ + * APIMethod: getCentroid
│ │ │ │ │ + * Calculate the centroid of this geometry. This method is defined in subclasses.
│ │ │ │ │ *
│ │ │ │ │ * Returns:
│ │ │ │ │ - * {Boolean} Whether or not the marker is currently visible on screen.
│ │ │ │ │ + * {} The centroid of the collection
│ │ │ │ │ */
│ │ │ │ │ - onScreen: function() {
│ │ │ │ │ -
│ │ │ │ │ - var onScreen = false;
│ │ │ │ │ - if (this.map) {
│ │ │ │ │ - var screenBounds = this.map.getExtent();
│ │ │ │ │ - onScreen = screenBounds.containsLonLat(this.lonlat);
│ │ │ │ │ - }
│ │ │ │ │ - return onScreen;
│ │ │ │ │ + getCentroid: function() {
│ │ │ │ │ + return null;
│ │ │ │ │ },
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Method: inflate
│ │ │ │ │ - * Englarges the markers icon by the specified ratio.
│ │ │ │ │ + * Method: toString
│ │ │ │ │ + * Returns a text representation of the geometry. If the WKT format is
│ │ │ │ │ + * included in a build, this will be the Well-Known Text
│ │ │ │ │ + * representation.
│ │ │ │ │ *
│ │ │ │ │ - * Parameters:
│ │ │ │ │ - * inflate - {float} the ratio to enlarge the marker by (passing 2
│ │ │ │ │ - * will double the size).
│ │ │ │ │ + * Returns:
│ │ │ │ │ + * {String} String representation of this geometry.
│ │ │ │ │ */
│ │ │ │ │ - inflate: function(inflate) {
│ │ │ │ │ - if (this.icon) {
│ │ │ │ │ - this.icon.setSize({
│ │ │ │ │ - w: this.icon.size.w * inflate,
│ │ │ │ │ - h: this.icon.size.h * inflate
│ │ │ │ │ - });
│ │ │ │ │ + toString: function() {
│ │ │ │ │ + var string;
│ │ │ │ │ + if (OpenLayers.Format && OpenLayers.Format.WKT) {
│ │ │ │ │ + string = OpenLayers.Format.WKT.prototype.write(
│ │ │ │ │ + new OpenLayers.Feature.Vector(this)
│ │ │ │ │ + );
│ │ │ │ │ + } else {
│ │ │ │ │ + string = Object.prototype.toString.call(this);
│ │ │ │ │ }
│ │ │ │ │ + return string;
│ │ │ │ │ },
│ │ │ │ │
│ │ │ │ │ - /**
│ │ │ │ │ - * Method: setOpacity
│ │ │ │ │ - * Change the opacity of the marker by changin the opacity of
│ │ │ │ │ - * its icon
│ │ │ │ │ - *
│ │ │ │ │ - * Parameters:
│ │ │ │ │ - * opacity - {float} Specified as fraction (0.4, etc)
│ │ │ │ │ - */
│ │ │ │ │ - setOpacity: function(opacity) {
│ │ │ │ │ - this.icon.setOpacity(opacity);
│ │ │ │ │ - },
│ │ │ │ │ -
│ │ │ │ │ - /**
│ │ │ │ │ - * Method: setUrl
│ │ │ │ │ - * Change URL of the Icon Image.
│ │ │ │ │ - *
│ │ │ │ │ - * url - {String}
│ │ │ │ │ - */
│ │ │ │ │ - setUrl: function(url) {
│ │ │ │ │ - this.icon.setUrl(url);
│ │ │ │ │ - },
│ │ │ │ │ -
│ │ │ │ │ - /**
│ │ │ │ │ - * Method: display
│ │ │ │ │ - * Hide or show the icon
│ │ │ │ │ - *
│ │ │ │ │ - * display - {Boolean}
│ │ │ │ │ - */
│ │ │ │ │ - display: function(display) {
│ │ │ │ │ - this.icon.display(display);
│ │ │ │ │ - },
│ │ │ │ │ -
│ │ │ │ │ - CLASS_NAME: "OpenLayers.Marker"
│ │ │ │ │ + CLASS_NAME: "OpenLayers.Geometry"
│ │ │ │ │ });
│ │ │ │ │
│ │ │ │ │ +/**
│ │ │ │ │ + * Function: OpenLayers.Geometry.fromWKT
│ │ │ │ │ + * Generate a geometry given a Well-Known Text string. For this method to
│ │ │ │ │ + * work, you must include the OpenLayers.Format.WKT in your build
│ │ │ │ │ + * explicitly.
│ │ │ │ │ + *
│ │ │ │ │ + * Parameters:
│ │ │ │ │ + * wkt - {String} A string representing the geometry in Well-Known Text.
│ │ │ │ │ + *
│ │ │ │ │ + * Returns:
│ │ │ │ │ + * {} A geometry of the appropriate class.
│ │ │ │ │ + */
│ │ │ │ │ +OpenLayers.Geometry.fromWKT = function(wkt) {
│ │ │ │ │ + var geom;
│ │ │ │ │ + if (OpenLayers.Format && OpenLayers.Format.WKT) {
│ │ │ │ │ + var format = OpenLayers.Geometry.fromWKT.format;
│ │ │ │ │ + if (!format) {
│ │ │ │ │ + format = new OpenLayers.Format.WKT();
│ │ │ │ │ + OpenLayers.Geometry.fromWKT.format = format;
│ │ │ │ │ + }
│ │ │ │ │ + var result = format.read(wkt);
│ │ │ │ │ + if (result instanceof OpenLayers.Feature.Vector) {
│ │ │ │ │ + geom = result.geometry;
│ │ │ │ │ + } else if (OpenLayers.Util.isArray(result)) {
│ │ │ │ │ + var len = result.length;
│ │ │ │ │ + var components = new Array(len);
│ │ │ │ │ + for (var i = 0; i < len; ++i) {
│ │ │ │ │ + components[i] = result[i].geometry;
│ │ │ │ │ + }
│ │ │ │ │ + geom = new OpenLayers.Geometry.Collection(components);
│ │ │ │ │ + }
│ │ │ │ │ + }
│ │ │ │ │ + return geom;
│ │ │ │ │ +};
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Function: defaultIcon
│ │ │ │ │ - * Creates a default .
│ │ │ │ │ - *
│ │ │ │ │ + * Method: OpenLayers.Geometry.segmentsIntersect
│ │ │ │ │ + * Determine whether two line segments intersect. Optionally calculates
│ │ │ │ │ + * and returns the intersection point. This function is optimized for
│ │ │ │ │ + * cases where seg1.x2 >= seg2.x1 || seg2.x2 >= seg1.x1. In those
│ │ │ │ │ + * obvious cases where there is no intersection, the function should
│ │ │ │ │ + * not be called.
│ │ │ │ │ + *
│ │ │ │ │ + * Parameters:
│ │ │ │ │ + * seg1 - {Object} Object representing a segment with properties x1, y1, x2,
│ │ │ │ │ + * and y2. The start point is represented by x1 and y1. The end point
│ │ │ │ │ + * is represented by x2 and y2. Start and end are ordered so that x1 < x2.
│ │ │ │ │ + * seg2 - {Object} Object representing a segment with properties x1, y1, x2,
│ │ │ │ │ + * and y2. The start point is represented by x1 and y1. The end point
│ │ │ │ │ + * is represented by x2 and y2. Start and end are ordered so that x1 < x2.
│ │ │ │ │ + * options - {Object} Optional properties for calculating the intersection.
│ │ │ │ │ + *
│ │ │ │ │ + * Valid options:
│ │ │ │ │ + * point - {Boolean} Return the intersection point. If false, the actual
│ │ │ │ │ + * intersection point will not be calculated. If true and the segments
│ │ │ │ │ + * intersect, the intersection point will be returned. If true and
│ │ │ │ │ + * the segments do not intersect, false will be returned. If true and
│ │ │ │ │ + * the segments are coincident, true will be returned.
│ │ │ │ │ + * tolerance - {Number} If a non-null value is provided, if the segments are
│ │ │ │ │ + * within the tolerance distance, this will be considered an intersection.
│ │ │ │ │ + * In addition, if the point option is true and the calculated intersection
│ │ │ │ │ + * is within the tolerance distance of an end point, the endpoint will be
│ │ │ │ │ + * returned instead of the calculated intersection. Further, if the
│ │ │ │ │ + * intersection is within the tolerance of endpoints on both segments, or
│ │ │ │ │ + * if two segment endpoints are within the tolerance distance of eachother
│ │ │ │ │ + * (but no intersection is otherwise calculated), an endpoint on the
│ │ │ │ │ + * first segment provided will be returned.
│ │ │ │ │ + *
│ │ │ │ │ * Returns:
│ │ │ │ │ - * {} A default OpenLayers.Icon to use for a marker
│ │ │ │ │ + * {Boolean | } The two segments intersect.
│ │ │ │ │ + * If the point argument is true, the return will be the intersection
│ │ │ │ │ + * point or false if none exists. If point is true and the segments
│ │ │ │ │ + * are coincident, return will be true (and the instersection is equal
│ │ │ │ │ + * to the shorter segment).
│ │ │ │ │ */
│ │ │ │ │ -OpenLayers.Marker.defaultIcon = function() {
│ │ │ │ │ - return new OpenLayers.Icon(OpenLayers.Util.getImageLocation("marker.png"), {
│ │ │ │ │ - w: 21,
│ │ │ │ │ - h: 25
│ │ │ │ │ - }, {
│ │ │ │ │ - x: -10.5,
│ │ │ │ │ - y: -25
│ │ │ │ │ - });
│ │ │ │ │ +OpenLayers.Geometry.segmentsIntersect = function(seg1, seg2, options) {
│ │ │ │ │ + var point = options && options.point;
│ │ │ │ │ + var tolerance = options && options.tolerance;
│ │ │ │ │ + var intersection = false;
│ │ │ │ │ + var x11_21 = seg1.x1 - seg2.x1;
│ │ │ │ │ + var y11_21 = seg1.y1 - seg2.y1;
│ │ │ │ │ + var x12_11 = seg1.x2 - seg1.x1;
│ │ │ │ │ + var y12_11 = seg1.y2 - seg1.y1;
│ │ │ │ │ + var y22_21 = seg2.y2 - seg2.y1;
│ │ │ │ │ + var x22_21 = seg2.x2 - seg2.x1;
│ │ │ │ │ + var d = (y22_21 * x12_11) - (x22_21 * y12_11);
│ │ │ │ │ + var n1 = (x22_21 * y11_21) - (y22_21 * x11_21);
│ │ │ │ │ + var n2 = (x12_11 * y11_21) - (y12_11 * x11_21);
│ │ │ │ │ + if (d == 0) {
│ │ │ │ │ + // parallel
│ │ │ │ │ + if (n1 == 0 && n2 == 0) {
│ │ │ │ │ + // coincident
│ │ │ │ │ + intersection = true;
│ │ │ │ │ + }
│ │ │ │ │ + } else {
│ │ │ │ │ + var along1 = n1 / d;
│ │ │ │ │ + var along2 = n2 / d;
│ │ │ │ │ + if (along1 >= 0 && along1 <= 1 && along2 >= 0 && along2 <= 1) {
│ │ │ │ │ + // intersect
│ │ │ │ │ + if (!point) {
│ │ │ │ │ + intersection = true;
│ │ │ │ │ + } else {
│ │ │ │ │ + // calculate the intersection point
│ │ │ │ │ + var x = seg1.x1 + (along1 * x12_11);
│ │ │ │ │ + var y = seg1.y1 + (along1 * y12_11);
│ │ │ │ │ + intersection = new OpenLayers.Geometry.Point(x, y);
│ │ │ │ │ + }
│ │ │ │ │ + }
│ │ │ │ │ + }
│ │ │ │ │ + if (tolerance) {
│ │ │ │ │ + var dist;
│ │ │ │ │ + if (intersection) {
│ │ │ │ │ + if (point) {
│ │ │ │ │ + var segs = [seg1, seg2];
│ │ │ │ │ + var seg, x, y;
│ │ │ │ │ + // check segment endpoints for proximity to intersection
│ │ │ │ │ + // set intersection to first endpoint within the tolerance
│ │ │ │ │ + outer: for (var i = 0; i < 2; ++i) {
│ │ │ │ │ + seg = segs[i];
│ │ │ │ │ + for (var j = 1; j < 3; ++j) {
│ │ │ │ │ + x = seg["x" + j];
│ │ │ │ │ + y = seg["y" + j];
│ │ │ │ │ + dist = Math.sqrt(
│ │ │ │ │ + Math.pow(x - intersection.x, 2) +
│ │ │ │ │ + Math.pow(y - intersection.y, 2)
│ │ │ │ │ + );
│ │ │ │ │ + if (dist < tolerance) {
│ │ │ │ │ + intersection.x = x;
│ │ │ │ │ + intersection.y = y;
│ │ │ │ │ + break outer;
│ │ │ │ │ + }
│ │ │ │ │ + }
│ │ │ │ │ + }
│ │ │ │ │ +
│ │ │ │ │ + }
│ │ │ │ │ + } else {
│ │ │ │ │ + // no calculated intersection, but segments could be within
│ │ │ │ │ + // the tolerance of one another
│ │ │ │ │ + var segs = [seg1, seg2];
│ │ │ │ │ + var source, target, x, y, p, result;
│ │ │ │ │ + // check segment endpoints for proximity to intersection
│ │ │ │ │ + // set intersection to first endpoint within the tolerance
│ │ │ │ │ + outer: for (var i = 0; i < 2; ++i) {
│ │ │ │ │ + source = segs[i];
│ │ │ │ │ + target = segs[(i + 1) % 2];
│ │ │ │ │ + for (var j = 1; j < 3; ++j) {
│ │ │ │ │ + p = {
│ │ │ │ │ + x: source["x" + j],
│ │ │ │ │ + y: source["y" + j]
│ │ │ │ │ + };
│ │ │ │ │ + result = OpenLayers.Geometry.distanceToSegment(p, target);
│ │ │ │ │ + if (result.distance < tolerance) {
│ │ │ │ │ + if (point) {
│ │ │ │ │ + intersection = new OpenLayers.Geometry.Point(p.x, p.y);
│ │ │ │ │ + } else {
│ │ │ │ │ + intersection = true;
│ │ │ │ │ + }
│ │ │ │ │ + break outer;
│ │ │ │ │ + }
│ │ │ │ │ + }
│ │ │ │ │ + }
│ │ │ │ │ + }
│ │ │ │ │ + }
│ │ │ │ │ + return intersection;
│ │ │ │ │ };
│ │ │ │ │
│ │ │ │ │ +/**
│ │ │ │ │ + * Function: OpenLayers.Geometry.distanceToSegment
│ │ │ │ │ + *
│ │ │ │ │ + * Parameters:
│ │ │ │ │ + * point - {Object} An object with x and y properties representing the
│ │ │ │ │ + * point coordinates.
│ │ │ │ │ + * segment - {Object} An object with x1, y1, x2, and y2 properties
│ │ │ │ │ + * representing endpoint coordinates.
│ │ │ │ │ + *
│ │ │ │ │ + * Returns:
│ │ │ │ │ + * {Object} An object with distance, along, x, and y properties. The distance
│ │ │ │ │ + * will be the shortest distance between the input point and segment.
│ │ │ │ │ + * The x and y properties represent the coordinates along the segment
│ │ │ │ │ + * where the shortest distance meets the segment. The along attribute
│ │ │ │ │ + * describes how far between the two segment points the given point is.
│ │ │ │ │ + */
│ │ │ │ │ +OpenLayers.Geometry.distanceToSegment = function(point, segment) {
│ │ │ │ │ + var result = OpenLayers.Geometry.distanceSquaredToSegment(point, segment);
│ │ │ │ │ + result.distance = Math.sqrt(result.distance);
│ │ │ │ │ + return result;
│ │ │ │ │ +};
│ │ │ │ │
│ │ │ │ │ +/**
│ │ │ │ │ + * Function: OpenLayers.Geometry.distanceSquaredToSegment
│ │ │ │ │ + *
│ │ │ │ │ + * Usually the distanceToSegment function should be used. This variant however
│ │ │ │ │ + * can be used for comparisons where the exact distance is not important.
│ │ │ │ │ + *
│ │ │ │ │ + * Parameters:
│ │ │ │ │ + * point - {Object} An object with x and y properties representing the
│ │ │ │ │ + * point coordinates.
│ │ │ │ │ + * segment - {Object} An object with x1, y1, x2, and y2 properties
│ │ │ │ │ + * representing endpoint coordinates.
│ │ │ │ │ + *
│ │ │ │ │ + * Returns:
│ │ │ │ │ + * {Object} An object with squared distance, along, x, and y properties.
│ │ │ │ │ + * The distance will be the shortest distance between the input point and
│ │ │ │ │ + * segment. The x and y properties represent the coordinates along the
│ │ │ │ │ + * segment where the shortest distance meets the segment. The along
│ │ │ │ │ + * attribute describes how far between the two segment points the given
│ │ │ │ │ + * point is.
│ │ │ │ │ + */
│ │ │ │ │ +OpenLayers.Geometry.distanceSquaredToSegment = function(point, segment) {
│ │ │ │ │ + var x0 = point.x;
│ │ │ │ │ + var y0 = point.y;
│ │ │ │ │ + var x1 = segment.x1;
│ │ │ │ │ + var y1 = segment.y1;
│ │ │ │ │ + var x2 = segment.x2;
│ │ │ │ │ + var y2 = segment.y2;
│ │ │ │ │ + var dx = x2 - x1;
│ │ │ │ │ + var dy = y2 - y1;
│ │ │ │ │ + var along = ((dx * (x0 - x1)) + (dy * (y0 - y1))) /
│ │ │ │ │ + (Math.pow(dx, 2) + Math.pow(dy, 2));
│ │ │ │ │ + var x, y;
│ │ │ │ │ + if (along <= 0.0) {
│ │ │ │ │ + x = x1;
│ │ │ │ │ + y = y1;
│ │ │ │ │ + } else if (along >= 1.0) {
│ │ │ │ │ + x = x2;
│ │ │ │ │ + y = y2;
│ │ │ │ │ + } else {
│ │ │ │ │ + x = x1 + along * dx;
│ │ │ │ │ + y = y1 + along * dy;
│ │ │ │ │ + }
│ │ │ │ │ + return {
│ │ │ │ │ + distance: Math.pow(x - x0, 2) + Math.pow(y - y0, 2),
│ │ │ │ │ + x: x,
│ │ │ │ │ + y: y,
│ │ │ │ │ + along: along
│ │ │ │ │ + };
│ │ │ │ │ +};
│ │ │ │ │ /* ======================================================================
│ │ │ │ │ - OpenLayers/Renderer.js
│ │ │ │ │ + OpenLayers/Format.js
│ │ │ │ │ ====================================================================== */
│ │ │ │ │
│ │ │ │ │ /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
│ │ │ │ │ * full list of contributors). Published under the 2-clause BSD license.
│ │ │ │ │ * See license.txt in the OpenLayers distribution or repository for the
│ │ │ │ │ * full text of the license. */
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ * @requires OpenLayers/BaseTypes/Class.js
│ │ │ │ │ + * @requires OpenLayers/Util.js
│ │ │ │ │ */
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Class: OpenLayers.Renderer
│ │ │ │ │ - * This is the base class for all renderers.
│ │ │ │ │ - *
│ │ │ │ │ - * This is based on a merger code written by Paul Spencer and Bertil Chapuis.
│ │ │ │ │ - * It is largely composed of virtual functions that are to be implemented
│ │ │ │ │ - * in technology-specific subclasses, but there is some generic code too.
│ │ │ │ │ - *
│ │ │ │ │ - * The functions that *are* implemented here merely deal with the maintenance
│ │ │ │ │ - * of the size and extent variables, as well as the cached 'resolution'
│ │ │ │ │ - * value.
│ │ │ │ │ - *
│ │ │ │ │ - * A note to the user that all subclasses should use getResolution() instead
│ │ │ │ │ - * of directly accessing this.resolution in order to correctly use the
│ │ │ │ │ - * cacheing system.
│ │ │ │ │ - *
│ │ │ │ │ + * Class: OpenLayers.Format
│ │ │ │ │ + * Base class for format reading/writing a variety of formats. Subclasses
│ │ │ │ │ + * of OpenLayers.Format are expected to have read and write methods.
│ │ │ │ │ */
│ │ │ │ │ -OpenLayers.Renderer = OpenLayers.Class({
│ │ │ │ │ -
│ │ │ │ │ - /**
│ │ │ │ │ - * Property: container
│ │ │ │ │ - * {DOMElement}
│ │ │ │ │ - */
│ │ │ │ │ - container: null,
│ │ │ │ │ +OpenLayers.Format = OpenLayers.Class({
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Property: root
│ │ │ │ │ - * {DOMElement}
│ │ │ │ │ - */
│ │ │ │ │ - root: null,
│ │ │ │ │ -
│ │ │ │ │ - /**
│ │ │ │ │ - * Property: extent
│ │ │ │ │ - * {}
│ │ │ │ │ + * Property: options
│ │ │ │ │ + * {Object} A reference to options passed to the constructor.
│ │ │ │ │ */
│ │ │ │ │ - extent: null,
│ │ │ │ │ + options: null,
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Property: locked
│ │ │ │ │ - * {Boolean} If the renderer is currently in a state where many things
│ │ │ │ │ - * are changing, the 'locked' property is set to true. This means
│ │ │ │ │ - * that renderers can expect at least one more drawFeature event to be
│ │ │ │ │ - * called with the 'locked' property set to 'true': In some renderers,
│ │ │ │ │ - * this might make sense to use as a 'only update local information'
│ │ │ │ │ - * flag.
│ │ │ │ │ - */
│ │ │ │ │ - locked: false,
│ │ │ │ │ -
│ │ │ │ │ - /**
│ │ │ │ │ - * Property: size
│ │ │ │ │ - * {}
│ │ │ │ │ + * APIProperty: externalProjection
│ │ │ │ │ + * {} When passed a externalProjection and
│ │ │ │ │ + * internalProjection, the format will reproject the geometries it
│ │ │ │ │ + * reads or writes. The externalProjection is the projection used by
│ │ │ │ │ + * the content which is passed into read or which comes out of write.
│ │ │ │ │ + * In order to reproject, a projection transformation function for the
│ │ │ │ │ + * specified projections must be available. This support may be
│ │ │ │ │ + * provided via proj4js or via a custom transformation function. See
│ │ │ │ │ + * {} for more information on
│ │ │ │ │ + * custom transformations.
│ │ │ │ │ */
│ │ │ │ │ - size: null,
│ │ │ │ │ + externalProjection: null,
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Property: resolution
│ │ │ │ │ - * {Float} cache of current map resolution
│ │ │ │ │ + * APIProperty: internalProjection
│ │ │ │ │ + * {} When passed a externalProjection and
│ │ │ │ │ + * internalProjection, the format will reproject the geometries it
│ │ │ │ │ + * reads or writes. The internalProjection is the projection used by
│ │ │ │ │ + * the geometries which are returned by read or which are passed into
│ │ │ │ │ + * write. In order to reproject, a projection transformation function
│ │ │ │ │ + * for the specified projections must be available. This support may be
│ │ │ │ │ + * provided via proj4js or via a custom transformation function. See
│ │ │ │ │ + * {} for more information on
│ │ │ │ │ + * custom transformations.
│ │ │ │ │ */
│ │ │ │ │ - resolution: null,
│ │ │ │ │ + internalProjection: null,
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Property: map
│ │ │ │ │ - * {} Reference to the map -- this is set in Vector's setMap()
│ │ │ │ │ + * APIProperty: data
│ │ │ │ │ + * {Object} When is true, this is the parsed string sent to
│ │ │ │ │ + * .
│ │ │ │ │ */
│ │ │ │ │ - map: null,
│ │ │ │ │ + data: null,
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Property: featureDx
│ │ │ │ │ - * {Number} Feature offset in x direction. Will be calculated for and
│ │ │ │ │ - * applied to the current feature while rendering (see
│ │ │ │ │ - * ).
│ │ │ │ │ + * APIProperty: keepData
│ │ │ │ │ + * {Object} Maintain a reference () to the most recently read data.
│ │ │ │ │ + * Default is false.
│ │ │ │ │ */
│ │ │ │ │ - featureDx: 0,
│ │ │ │ │ + keepData: false,
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Constructor: OpenLayers.Renderer
│ │ │ │ │ + * Constructor: OpenLayers.Format
│ │ │ │ │ + * Instances of this class are not useful. See one of the subclasses.
│ │ │ │ │ *
│ │ │ │ │ * Parameters:
│ │ │ │ │ - * containerID - {}
│ │ │ │ │ - * options - {Object} options for this renderer. See sublcasses for
│ │ │ │ │ - * supported options.
│ │ │ │ │ + * options - {Object} An optional object with properties to set on the
│ │ │ │ │ + * format
│ │ │ │ │ + *
│ │ │ │ │ + * Valid options:
│ │ │ │ │ + * keepData - {Boolean} If true, upon , the data property will be
│ │ │ │ │ + * set to the parsed object (e.g. the json or xml object).
│ │ │ │ │ + *
│ │ │ │ │ + * Returns:
│ │ │ │ │ + * An instance of OpenLayers.Format
│ │ │ │ │ */
│ │ │ │ │ - initialize: function(containerID, options) {
│ │ │ │ │ - this.container = OpenLayers.Util.getElement(containerID);
│ │ │ │ │ + initialize: function(options) {
│ │ │ │ │ OpenLayers.Util.extend(this, options);
│ │ │ │ │ + this.options = options;
│ │ │ │ │ },
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ * APIMethod: destroy
│ │ │ │ │ + * Clean up.
│ │ │ │ │ */
│ │ │ │ │ - destroy: function() {
│ │ │ │ │ - this.container = null;
│ │ │ │ │ - this.extent = null;
│ │ │ │ │ - this.size = null;
│ │ │ │ │ - this.resolution = null;
│ │ │ │ │ - this.map = null;
│ │ │ │ │ - },
│ │ │ │ │ + destroy: function() {},
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * APIMethod: supported
│ │ │ │ │ - * This should be overridden by specific subclasses
│ │ │ │ │ + * Method: read
│ │ │ │ │ + * Read data from a string, and return an object whose type depends on the
│ │ │ │ │ + * subclass.
│ │ │ │ │ *
│ │ │ │ │ + * Parameters:
│ │ │ │ │ + * data - {string} Data to read/parse.
│ │ │ │ │ + *
│ │ │ │ │ * Returns:
│ │ │ │ │ - * {Boolean} Whether or not the browser supports the renderer class
│ │ │ │ │ + * Depends on the subclass
│ │ │ │ │ */
│ │ │ │ │ - supported: function() {
│ │ │ │ │ - return false;
│ │ │ │ │ + read: function(data) {
│ │ │ │ │ + throw new Error('Read not implemented.');
│ │ │ │ │ },
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Method: setExtent
│ │ │ │ │ - * Set the visible part of the layer.
│ │ │ │ │ - *
│ │ │ │ │ - * Resolution has probably changed, so we nullify the resolution
│ │ │ │ │ - * cache (this.resolution) -- this way it will be re-computed when
│ │ │ │ │ - * next it is needed.
│ │ │ │ │ - * We nullify the resolution cache (this.resolution) if resolutionChanged
│ │ │ │ │ - * is set to true - this way it will be re-computed on the next
│ │ │ │ │ - * getResolution() request.
│ │ │ │ │ + * Method: write
│ │ │ │ │ + * Accept an object, and return a string.
│ │ │ │ │ *
│ │ │ │ │ * Parameters:
│ │ │ │ │ - * extent - {}
│ │ │ │ │ - * resolutionChanged - {Boolean}
│ │ │ │ │ + * object - {Object} Object to be serialized
│ │ │ │ │ *
│ │ │ │ │ * Returns:
│ │ │ │ │ - * {Boolean} true to notify the layer that the new extent does not exceed
│ │ │ │ │ - * the coordinate range, and the features will not need to be redrawn.
│ │ │ │ │ - * False otherwise.
│ │ │ │ │ + * {String} A string representation of the object.
│ │ │ │ │ */
│ │ │ │ │ - setExtent: function(extent, resolutionChanged) {
│ │ │ │ │ - this.extent = extent.clone();
│ │ │ │ │ - if (this.map.baseLayer && this.map.baseLayer.wrapDateLine) {
│ │ │ │ │ - var ratio = extent.getWidth() / this.map.getExtent().getWidth(),
│ │ │ │ │ - extent = extent.scale(1 / ratio);
│ │ │ │ │ - this.extent = extent.wrapDateLine(this.map.getMaxExtent()).scale(ratio);
│ │ │ │ │ - }
│ │ │ │ │ - if (resolutionChanged) {
│ │ │ │ │ - this.resolution = null;
│ │ │ │ │ - }
│ │ │ │ │ - return true;
│ │ │ │ │ + write: function(object) {
│ │ │ │ │ + throw new Error('Write not implemented.');
│ │ │ │ │ },
│ │ │ │ │
│ │ │ │ │ - /**
│ │ │ │ │ - * Method: setSize
│ │ │ │ │ - * Sets the size of the drawing surface.
│ │ │ │ │ - *
│ │ │ │ │ - * Resolution has probably changed, so we nullify the resolution
│ │ │ │ │ - * cache (this.resolution) -- this way it will be re-computed when
│ │ │ │ │ - * next it is needed.
│ │ │ │ │ - *
│ │ │ │ │ - * Parameters:
│ │ │ │ │ - * size - {}
│ │ │ │ │ + CLASS_NAME: "OpenLayers.Format"
│ │ │ │ │ +});
│ │ │ │ │ +/* ======================================================================
│ │ │ │ │ + OpenLayers/Geometry/Point.js
│ │ │ │ │ + ====================================================================== */
│ │ │ │ │ +
│ │ │ │ │ +/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
│ │ │ │ │ + * full list of contributors). Published under the 2-clause BSD license.
│ │ │ │ │ + * See license.txt in the OpenLayers distribution or repository for the
│ │ │ │ │ + * full text of the license. */
│ │ │ │ │ +
│ │ │ │ │ +/**
│ │ │ │ │ + * @requires OpenLayers/Geometry.js
│ │ │ │ │ + */
│ │ │ │ │ +
│ │ │ │ │ +/**
│ │ │ │ │ + * Class: OpenLayers.Geometry.Point
│ │ │ │ │ + * Point geometry class.
│ │ │ │ │ + *
│ │ │ │ │ + * Inherits from:
│ │ │ │ │ + * -
│ │ │ │ │ + */
│ │ │ │ │ +OpenLayers.Geometry.Point = OpenLayers.Class(OpenLayers.Geometry, {
│ │ │ │ │ +
│ │ │ │ │ + /**
│ │ │ │ │ + * APIProperty: x
│ │ │ │ │ + * {float}
│ │ │ │ │ */
│ │ │ │ │ - setSize: function(size) {
│ │ │ │ │ - this.size = size.clone();
│ │ │ │ │ - this.resolution = null;
│ │ │ │ │ - },
│ │ │ │ │ + x: null,
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Method: getResolution
│ │ │ │ │ - * Uses cached copy of resolution if available to minimize computing
│ │ │ │ │ - *
│ │ │ │ │ - * Returns:
│ │ │ │ │ - * {Float} The current map's resolution
│ │ │ │ │ + * APIProperty: y
│ │ │ │ │ + * {float}
│ │ │ │ │ */
│ │ │ │ │ - getResolution: function() {
│ │ │ │ │ - this.resolution = this.resolution || this.map.getResolution();
│ │ │ │ │ - return this.resolution;
│ │ │ │ │ - },
│ │ │ │ │ + y: null,
│ │ │ │ │
│ │ │ │ │ /**
│ │ │ │ │ - * Method: drawFeature
│ │ │ │ │ - * Draw the feature. The optional style argument can be used
│ │ │ │ │ - * to override the feature's own style. This method should only
│ │ │ │ │ - * be called from layer.drawFeature().
│ │ │ │ │ + * Constructor: OpenLayers.Geometry.Point
│ │ │ │ │ + * Construct a point geometry.
│ │ │ │ │ *
│ │ │ │ │ * Parameters:
│ │ │ │ │ - * feature - {}
│ │ │ │ │ - * style - {