{"diffoscope-json-version": 1, "source1": "/srv/reproducible-results/rbuild-debian/r-b-build.GFeAtFh3/b1/openlayers_2.13.1+ds2-10_i386.changes", "source2": "/srv/reproducible-results/rbuild-debian/r-b-build.GFeAtFh3/b2/openlayers_2.13.1+ds2-10_i386.changes", "unified_diff": null, "details": [{"source1": "Files", "source2": "Files", "unified_diff": "@@ -1,2 +1,2 @@\n \n- e10e99197b80e8001ad4aeb43e1d6b32 721476 javascript optional libjs-openlayers_2.13.1+ds2-10_all.deb\n+ cb91a6b8575e4068f69c2c211e993efc 724396 javascript optional libjs-openlayers_2.13.1+ds2-10_all.deb\n"}, {"source1": "libjs-openlayers_2.13.1+ds2-10_all.deb", "source2": "libjs-openlayers_2.13.1+ds2-10_all.deb", "unified_diff": null, "details": [{"source1": "file list", "source2": "file list", "unified_diff": "@@ -1,3 +1,3 @@\n -rw-r--r-- 0 0 0 4 2023-01-14 13:27:41.000000 debian-binary\n--rw-r--r-- 0 0 0 3680 2023-01-14 13:27:41.000000 control.tar.xz\n--rw-r--r-- 0 0 0 717604 2023-01-14 13:27:41.000000 data.tar.xz\n+-rw-r--r-- 0 0 0 3676 2023-01-14 13:27:41.000000 control.tar.xz\n+-rw-r--r-- 0 0 0 720528 2023-01-14 13:27:41.000000 data.tar.xz\n"}, {"source1": "control.tar.xz", "source2": "control.tar.xz", "unified_diff": null, "details": [{"source1": "control.tar", "source2": "control.tar", "unified_diff": null, "details": [{"source1": "./md5sums", "source2": "./md5sums", "unified_diff": null, "details": [{"source1": "./md5sums", "source2": "./md5sums", "comments": ["Files differ"], "unified_diff": null}]}]}]}, {"source1": "data.tar.xz", "source2": "data.tar.xz", "unified_diff": null, "details": [{"source1": "data.tar", "source2": "data.tar", "unified_diff": null, "details": [{"source1": "./usr/share/javascript/openlayers/OpenLayers.js", "source2": "./usr/share/javascript/openlayers/OpenLayers.js", "unified_diff": null, "details": [{"source1": "js-beautify {}", "source2": "js-beautify {}", "unified_diff": "@@ -52,37 +52,14 @@\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \n * POSSIBILITY OF SUCH DAMAGE.\n */\n /* ======================================================================\n- Rico/license.js\n- ====================================================================== */\n-\n-/**\n- * @license Apache 2 \n- * \n- * Contains portions of Rico \n- * \n- * Copyright 2005 Sabre Airline Solutions \n- *\n- * Licensed under the Apache License, Version 2.0 (the \"License\"); you\n- * may not use this file except in compliance with the License. You\n- * may obtain a copy of the License at\n- *\n- * http://www.apache.org/licenses/LICENSE-2.0 \n- *\n- * Unless required by applicable law or agreed to in writing, software\n- * distributed under the License is distributed on an \"AS IS\" BASIS,\n- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n- * implied. See the License for the specific language governing\n- * permissions and limitations under the License. \n- */\n-/* ======================================================================\n OpenLayers/SingleFile.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n * See license.txt in the OpenLayers distribution or repository for the\n * full text of the license. */\n@@ -286,268 +263,14 @@\n source.hasOwnProperty && source.hasOwnProperty(\"toString\")) {\n destination.toString = source.toString;\n }\n }\n return destination;\n };\n /* ======================================================================\n- OpenLayers/Console.js\n- ====================================================================== */\n-\n-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n- * full list of contributors). Published under the 2-clause BSD license.\n- * See license.txt in the OpenLayers distribution or repository for the\n- * full text of the license. */\n-\n-/**\n- * @requires OpenLayers/BaseTypes/Class.js\n- */\n-\n-/**\n- * Namespace: OpenLayers.Console\n- * The OpenLayers.Console namespace is used for debugging and error logging.\n- * If the Firebug Lite (../Firebug/firebug.js) is included before this script,\n- * calls to OpenLayers.Console methods will get redirected to window.console.\n- * This makes use of the Firebug extension where available and allows for\n- * cross-browser debugging Firebug style.\n- *\n- * Note:\n- * Note that behavior will differ with the Firebug extention and Firebug Lite.\n- * Most notably, the Firebug Lite console does not currently allow for\n- * hyperlinks to code or for clicking on object to explore their properties.\n- * \n- */\n-OpenLayers.Console = {\n- /**\n- * Create empty functions for all console methods. The real value of these\n- * properties will be set if Firebug Lite (../Firebug/firebug.js script) is\n- * included. We explicitly require the Firebug Lite script to trigger\n- * functionality of the OpenLayers.Console methods.\n- */\n-\n- /**\n- * APIFunction: log\n- * Log an object in the console. The Firebug Lite console logs string\n- * representation of objects. Given multiple arguments, they will\n- * be cast to strings and logged with a space delimiter. If the first\n- * argument is a string with printf-like formatting, subsequent arguments\n- * will be used in string substitution. Any additional arguments (beyond\n- * the number substituted in a format string) will be appended in a space-\n- * delimited line.\n- * \n- * Parameters:\n- * object - {Object}\n- */\n- log: function() {},\n-\n- /**\n- * APIFunction: debug\n- * Writes a message to the console, including a hyperlink to the line\n- * where it was called.\n- *\n- * May be called with multiple arguments as with OpenLayers.Console.log().\n- * \n- * Parameters:\n- * object - {Object}\n- */\n- debug: function() {},\n-\n- /**\n- * APIFunction: info\n- * Writes a message to the console with the visual \"info\" icon and color\n- * coding and a hyperlink to the line where it was called.\n- *\n- * May be called with multiple arguments as with OpenLayers.Console.log().\n- * \n- * Parameters:\n- * object - {Object}\n- */\n- info: function() {},\n-\n- /**\n- * APIFunction: warn\n- * Writes a message to the console with the visual \"warning\" icon and\n- * color coding and a hyperlink to the line where it was called.\n- *\n- * May be called with multiple arguments as with OpenLayers.Console.log().\n- * \n- * Parameters:\n- * object - {Object}\n- */\n- warn: function() {},\n-\n- /**\n- * APIFunction: error\n- * Writes a message to the console with the visual \"error\" icon and color\n- * coding and a hyperlink to the line where it was called.\n- *\n- * May be called with multiple arguments as with OpenLayers.Console.log().\n- * \n- * Parameters:\n- * object - {Object}\n- */\n- error: function() {},\n-\n- /**\n- * APIFunction: userError\n- * A single interface for showing error messages to the user. The default\n- * behavior is a Javascript alert, though this can be overridden by\n- * reassigning OpenLayers.Console.userError to a different function.\n- *\n- * Expects a single error message\n- * \n- * Parameters:\n- * error - {Object}\n- */\n- userError: function(error) {\n- alert(error);\n- },\n-\n- /**\n- * APIFunction: assert\n- * Tests that an expression is true. If not, it will write a message to\n- * the console and throw an exception.\n- *\n- * May be called with multiple arguments as with OpenLayers.Console.log().\n- * \n- * Parameters:\n- * object - {Object}\n- */\n- assert: function() {},\n-\n- /**\n- * APIFunction: dir\n- * Prints an interactive listing of all properties of the object. This\n- * looks identical to the view that you would see in the DOM tab.\n- * \n- * Parameters:\n- * object - {Object}\n- */\n- dir: function() {},\n-\n- /**\n- * APIFunction: dirxml\n- * Prints the XML source tree of an HTML or XML element. This looks\n- * identical to the view that you would see in the HTML tab. You can click\n- * on any node to inspect it in the HTML tab.\n- * \n- * Parameters:\n- * object - {Object}\n- */\n- dirxml: function() {},\n-\n- /**\n- * APIFunction: trace\n- * Prints an interactive stack trace of JavaScript execution at the point\n- * where it is called. The stack trace details the functions on the stack,\n- * as well as the values that were passed as arguments to each function.\n- * You can click each function to take you to its source in the Script tab,\n- * and click each argument value to inspect it in the DOM or HTML tabs.\n- * \n- */\n- trace: function() {},\n-\n- /**\n- * APIFunction: group\n- * Writes a message to the console and opens a nested block to indent all\n- * future messages sent to the console. Call OpenLayers.Console.groupEnd()\n- * to close the block.\n- *\n- * May be called with multiple arguments as with OpenLayers.Console.log().\n- * \n- * Parameters:\n- * object - {Object}\n- */\n- group: function() {},\n-\n- /**\n- * APIFunction: groupEnd\n- * Closes the most recently opened block created by a call to\n- * OpenLayers.Console.group\n- */\n- groupEnd: function() {},\n-\n- /**\n- * APIFunction: time\n- * Creates a new timer under the given name. Call\n- * OpenLayers.Console.timeEnd(name)\n- * with the same name to stop the timer and print the time elapsed.\n- *\n- * Parameters:\n- * name - {String}\n- */\n- time: function() {},\n-\n- /**\n- * APIFunction: timeEnd\n- * Stops a timer created by a call to OpenLayers.Console.time(name) and\n- * writes the time elapsed.\n- *\n- * Parameters:\n- * name - {String}\n- */\n- timeEnd: function() {},\n-\n- /**\n- * APIFunction: profile\n- * Turns on the JavaScript profiler. The optional argument title would\n- * contain the text to be printed in the header of the profile report.\n- *\n- * This function is not currently implemented in Firebug Lite.\n- * \n- * Parameters:\n- * title - {String} Optional title for the profiler\n- */\n- profile: function() {},\n-\n- /**\n- * APIFunction: profileEnd\n- * Turns off the JavaScript profiler and prints its report.\n- * \n- * This function is not currently implemented in Firebug Lite.\n- */\n- profileEnd: function() {},\n-\n- /**\n- * APIFunction: count\n- * Writes the number of times that the line of code where count was called\n- * was executed. The optional argument title will print a message in\n- * addition to the number of the count.\n- *\n- * This function is not currently implemented in Firebug Lite.\n- *\n- * Parameters:\n- * title - {String} Optional title to be printed with count\n- */\n- count: function() {},\n-\n- CLASS_NAME: \"OpenLayers.Console\"\n-};\n-\n-/**\n- * Execute an anonymous function to extend the OpenLayers.Console namespace\n- * if the firebug.js script is included. This closure is used so that the\n- * \"scripts\" and \"i\" variables don't pollute the global namespace.\n- */\n-(function() {\n- /**\n- * If Firebug Lite is included (before this script), re-route all\n- * OpenLayers.Console calls to the console object.\n- */\n- var scripts = document.getElementsByTagName(\"script\");\n- for (var i = 0, len = scripts.length; i < len; ++i) {\n- if (scripts[i].src.indexOf(\"firebug.js\") != -1) {\n- if (console) {\n- OpenLayers.Util.extend(OpenLayers.Console, console);\n- break;\n- }\n- }\n- }\n-})();\n-/* ======================================================================\n OpenLayers/BaseTypes.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n * See license.txt in the OpenLayers distribution or repository for the\n * full text of the license. */\n@@ -1866,14 +1589,207 @@\n \n opp += (quadrant.charAt(0) == 't') ? 'b' : 't';\n opp += (quadrant.charAt(1) == 'l') ? 'r' : 'l';\n \n return opp;\n };\n /* ======================================================================\n+ OpenLayers/BaseTypes/Element.js\n+ ====================================================================== */\n+\n+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n+ * full list of contributors). Published under the 2-clause BSD license.\n+ * See license.txt in the OpenLayers distribution or repository for the\n+ * full text of the license. */\n+\n+/**\n+ * @requires OpenLayers/Util.js\n+ * @requires OpenLayers/BaseTypes.js\n+ */\n+\n+/**\n+ * Namespace: OpenLayers.Element\n+ */\n+OpenLayers.Element = {\n+\n+ /**\n+ * APIFunction: visible\n+ * \n+ * Parameters: \n+ * element - {DOMElement}\n+ * \n+ * Returns:\n+ * {Boolean} Is the element visible?\n+ */\n+ visible: function(element) {\n+ return OpenLayers.Util.getElement(element).style.display != 'none';\n+ },\n+\n+ /**\n+ * APIFunction: toggle\n+ * Toggle the visibility of element(s) passed in\n+ * \n+ * Parameters:\n+ * element - {DOMElement} Actually user can pass any number of elements\n+ */\n+ toggle: function() {\n+ for (var i = 0, len = arguments.length; i < len; i++) {\n+ var element = OpenLayers.Util.getElement(arguments[i]);\n+ var display = OpenLayers.Element.visible(element) ? 'none' :\n+ '';\n+ element.style.display = display;\n+ }\n+ },\n+\n+ /**\n+ * APIFunction: remove\n+ * Remove the specified element from the DOM.\n+ * \n+ * Parameters:\n+ * element - {DOMElement}\n+ */\n+ remove: function(element) {\n+ element = OpenLayers.Util.getElement(element);\n+ element.parentNode.removeChild(element);\n+ },\n+\n+ /**\n+ * APIFunction: getHeight\n+ * \n+ * Parameters:\n+ * element - {DOMElement}\n+ * \n+ * Returns:\n+ * {Integer} The offset height of the element passed in\n+ */\n+ getHeight: function(element) {\n+ element = OpenLayers.Util.getElement(element);\n+ return element.offsetHeight;\n+ },\n+\n+ /**\n+ * Function: hasClass\n+ * Tests if an element has the given CSS class name.\n+ *\n+ * Parameters:\n+ * element - {DOMElement} A DOM element node.\n+ * name - {String} The CSS class name to search for.\n+ *\n+ * Returns:\n+ * {Boolean} The element has the given class name.\n+ */\n+ hasClass: function(element, name) {\n+ var names = element.className;\n+ return (!!names && new RegExp(\"(^|\\\\s)\" + name + \"(\\\\s|$)\").test(names));\n+ },\n+\n+ /**\n+ * Function: addClass\n+ * Add a CSS class name to an element. Safe where element already has\n+ * the class name.\n+ *\n+ * Parameters:\n+ * element - {DOMElement} A DOM element node.\n+ * name - {String} The CSS class name to add.\n+ *\n+ * Returns:\n+ * {DOMElement} The element.\n+ */\n+ addClass: function(element, name) {\n+ if (!OpenLayers.Element.hasClass(element, name)) {\n+ element.className += (element.className ? \" \" : \"\") + name;\n+ }\n+ return element;\n+ },\n+\n+ /**\n+ * Function: removeClass\n+ * Remove a CSS class name from an element. Safe where element does not\n+ * have the class name.\n+ *\n+ * Parameters:\n+ * element - {DOMElement} A DOM element node.\n+ * name - {String} The CSS class name to remove.\n+ *\n+ * Returns:\n+ * {DOMElement} The element.\n+ */\n+ removeClass: function(element, name) {\n+ var names = element.className;\n+ if (names) {\n+ element.className = OpenLayers.String.trim(\n+ names.replace(\n+ new RegExp(\"(^|\\\\s+)\" + name + \"(\\\\s+|$)\"), \" \"\n+ )\n+ );\n+ }\n+ return element;\n+ },\n+\n+ /**\n+ * Function: toggleClass\n+ * Remove a CSS class name from an element if it exists. Add the class name\n+ * if it doesn't exist.\n+ *\n+ * Parameters:\n+ * element - {DOMElement} A DOM element node.\n+ * name - {String} The CSS class name to toggle.\n+ *\n+ * Returns:\n+ * {DOMElement} The element.\n+ */\n+ toggleClass: function(element, name) {\n+ if (OpenLayers.Element.hasClass(element, name)) {\n+ OpenLayers.Element.removeClass(element, name);\n+ } else {\n+ OpenLayers.Element.addClass(element, name);\n+ }\n+ return element;\n+ },\n+\n+ /**\n+ * APIFunction: getStyle\n+ * \n+ * Parameters:\n+ * element - {DOMElement}\n+ * style - {?}\n+ * \n+ * Returns:\n+ * {?}\n+ */\n+ getStyle: function(element, style) {\n+ element = OpenLayers.Util.getElement(element);\n+\n+ var value = null;\n+ if (element && element.style) {\n+ value = element.style[OpenLayers.String.camelize(style)];\n+ if (!value) {\n+ if (document.defaultView &&\n+ document.defaultView.getComputedStyle) {\n+\n+ var css = document.defaultView.getComputedStyle(element, null);\n+ value = css ? css.getPropertyValue(style) : null;\n+ } else if (element.currentStyle) {\n+ value = element.currentStyle[OpenLayers.String.camelize(style)];\n+ }\n+ }\n+\n+ var positions = ['left', 'top', 'right', 'bottom'];\n+ if (window.opera &&\n+ (OpenLayers.Util.indexOf(positions, style) != -1) &&\n+ (OpenLayers.Element.getStyle(element, 'position') == 'static')) {\n+ value = 'auto';\n+ }\n+ }\n+\n+ return value == 'auto' ? null : value;\n+ }\n+\n+};\n+/* ======================================================================\n OpenLayers/BaseTypes/LonLat.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n * See license.txt in the OpenLayers distribution or repository for the\n * full text of the license. */\n@@ -2327,14 +2243,268 @@\n }\n return equals;\n },\n \n CLASS_NAME: \"OpenLayers.Size\"\n });\n /* ======================================================================\n+ OpenLayers/Console.js\n+ ====================================================================== */\n+\n+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n+ * full list of contributors). Published under the 2-clause BSD license.\n+ * See license.txt in the OpenLayers distribution or repository for the\n+ * full text of the license. */\n+\n+/**\n+ * @requires OpenLayers/BaseTypes/Class.js\n+ */\n+\n+/**\n+ * Namespace: OpenLayers.Console\n+ * The OpenLayers.Console namespace is used for debugging and error logging.\n+ * If the Firebug Lite (../Firebug/firebug.js) is included before this script,\n+ * calls to OpenLayers.Console methods will get redirected to window.console.\n+ * This makes use of the Firebug extension where available and allows for\n+ * cross-browser debugging Firebug style.\n+ *\n+ * Note:\n+ * Note that behavior will differ with the Firebug extention and Firebug Lite.\n+ * Most notably, the Firebug Lite console does not currently allow for\n+ * hyperlinks to code or for clicking on object to explore their properties.\n+ * \n+ */\n+OpenLayers.Console = {\n+ /**\n+ * Create empty functions for all console methods. The real value of these\n+ * properties will be set if Firebug Lite (../Firebug/firebug.js script) is\n+ * included. We explicitly require the Firebug Lite script to trigger\n+ * functionality of the OpenLayers.Console methods.\n+ */\n+\n+ /**\n+ * APIFunction: log\n+ * Log an object in the console. The Firebug Lite console logs string\n+ * representation of objects. Given multiple arguments, they will\n+ * be cast to strings and logged with a space delimiter. If the first\n+ * argument is a string with printf-like formatting, subsequent arguments\n+ * will be used in string substitution. Any additional arguments (beyond\n+ * the number substituted in a format string) will be appended in a space-\n+ * delimited line.\n+ * \n+ * Parameters:\n+ * object - {Object}\n+ */\n+ log: function() {},\n+\n+ /**\n+ * APIFunction: debug\n+ * Writes a message to the console, including a hyperlink to the line\n+ * where it was called.\n+ *\n+ * May be called with multiple arguments as with OpenLayers.Console.log().\n+ * \n+ * Parameters:\n+ * object - {Object}\n+ */\n+ debug: function() {},\n+\n+ /**\n+ * APIFunction: info\n+ * Writes a message to the console with the visual \"info\" icon and color\n+ * coding and a hyperlink to the line where it was called.\n+ *\n+ * May be called with multiple arguments as with OpenLayers.Console.log().\n+ * \n+ * Parameters:\n+ * object - {Object}\n+ */\n+ info: function() {},\n+\n+ /**\n+ * APIFunction: warn\n+ * Writes a message to the console with the visual \"warning\" icon and\n+ * color coding and a hyperlink to the line where it was called.\n+ *\n+ * May be called with multiple arguments as with OpenLayers.Console.log().\n+ * \n+ * Parameters:\n+ * object - {Object}\n+ */\n+ warn: function() {},\n+\n+ /**\n+ * APIFunction: error\n+ * Writes a message to the console with the visual \"error\" icon and color\n+ * coding and a hyperlink to the line where it was called.\n+ *\n+ * May be called with multiple arguments as with OpenLayers.Console.log().\n+ * \n+ * Parameters:\n+ * object - {Object}\n+ */\n+ error: function() {},\n+\n+ /**\n+ * APIFunction: userError\n+ * A single interface for showing error messages to the user. The default\n+ * behavior is a Javascript alert, though this can be overridden by\n+ * reassigning OpenLayers.Console.userError to a different function.\n+ *\n+ * Expects a single error message\n+ * \n+ * Parameters:\n+ * error - {Object}\n+ */\n+ userError: function(error) {\n+ alert(error);\n+ },\n+\n+ /**\n+ * APIFunction: assert\n+ * Tests that an expression is true. If not, it will write a message to\n+ * the console and throw an exception.\n+ *\n+ * May be called with multiple arguments as with OpenLayers.Console.log().\n+ * \n+ * Parameters:\n+ * object - {Object}\n+ */\n+ assert: function() {},\n+\n+ /**\n+ * APIFunction: dir\n+ * Prints an interactive listing of all properties of the object. This\n+ * looks identical to the view that you would see in the DOM tab.\n+ * \n+ * Parameters:\n+ * object - {Object}\n+ */\n+ dir: function() {},\n+\n+ /**\n+ * APIFunction: dirxml\n+ * Prints the XML source tree of an HTML or XML element. This looks\n+ * identical to the view that you would see in the HTML tab. You can click\n+ * on any node to inspect it in the HTML tab.\n+ * \n+ * Parameters:\n+ * object - {Object}\n+ */\n+ dirxml: function() {},\n+\n+ /**\n+ * APIFunction: trace\n+ * Prints an interactive stack trace of JavaScript execution at the point\n+ * where it is called. The stack trace details the functions on the stack,\n+ * as well as the values that were passed as arguments to each function.\n+ * You can click each function to take you to its source in the Script tab,\n+ * and click each argument value to inspect it in the DOM or HTML tabs.\n+ * \n+ */\n+ trace: function() {},\n+\n+ /**\n+ * APIFunction: group\n+ * Writes a message to the console and opens a nested block to indent all\n+ * future messages sent to the console. Call OpenLayers.Console.groupEnd()\n+ * to close the block.\n+ *\n+ * May be called with multiple arguments as with OpenLayers.Console.log().\n+ * \n+ * Parameters:\n+ * object - {Object}\n+ */\n+ group: function() {},\n+\n+ /**\n+ * APIFunction: groupEnd\n+ * Closes the most recently opened block created by a call to\n+ * OpenLayers.Console.group\n+ */\n+ groupEnd: function() {},\n+\n+ /**\n+ * APIFunction: time\n+ * Creates a new timer under the given name. Call\n+ * OpenLayers.Console.timeEnd(name)\n+ * with the same name to stop the timer and print the time elapsed.\n+ *\n+ * Parameters:\n+ * name - {String}\n+ */\n+ time: function() {},\n+\n+ /**\n+ * APIFunction: timeEnd\n+ * Stops a timer created by a call to OpenLayers.Console.time(name) and\n+ * writes the time elapsed.\n+ *\n+ * Parameters:\n+ * name - {String}\n+ */\n+ timeEnd: function() {},\n+\n+ /**\n+ * APIFunction: profile\n+ * Turns on the JavaScript profiler. The optional argument title would\n+ * contain the text to be printed in the header of the profile report.\n+ *\n+ * This function is not currently implemented in Firebug Lite.\n+ * \n+ * Parameters:\n+ * title - {String} Optional title for the profiler\n+ */\n+ profile: function() {},\n+\n+ /**\n+ * APIFunction: profileEnd\n+ * Turns off the JavaScript profiler and prints its report.\n+ * \n+ * This function is not currently implemented in Firebug Lite.\n+ */\n+ profileEnd: function() {},\n+\n+ /**\n+ * APIFunction: count\n+ * Writes the number of times that the line of code where count was called\n+ * was executed. The optional argument title will print a message in\n+ * addition to the number of the count.\n+ *\n+ * This function is not currently implemented in Firebug Lite.\n+ *\n+ * Parameters:\n+ * title - {String} Optional title to be printed with count\n+ */\n+ count: function() {},\n+\n+ CLASS_NAME: \"OpenLayers.Console\"\n+};\n+\n+/**\n+ * Execute an anonymous function to extend the OpenLayers.Console namespace\n+ * if the firebug.js script is included. This closure is used so that the\n+ * \"scripts\" and \"i\" variables don't pollute the global namespace.\n+ */\n+(function() {\n+ /**\n+ * If Firebug Lite is included (before this script), re-route all\n+ * OpenLayers.Console calls to the console object.\n+ */\n+ var scripts = document.getElementsByTagName(\"script\");\n+ for (var i = 0, len = scripts.length; i < len; ++i) {\n+ if (scripts[i].src.indexOf(\"firebug.js\") != -1) {\n+ if (console) {\n+ OpenLayers.Util.extend(OpenLayers.Console, console);\n+ break;\n+ }\n+ }\n+ }\n+})();\n+/* ======================================================================\n OpenLayers/Lang.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n * See license.txt in the OpenLayers distribution or repository for the\n * full text of the license. */\n@@ -4256,1347 +4426,14 @@\n } else {\n str += coordinate < 0 ? OpenLayers.i18n(\"S\") : OpenLayers.i18n(\"N\");\n }\n return str;\n };\n \n /* ======================================================================\n- OpenLayers/BaseTypes/Element.js\n- ====================================================================== */\n-\n-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n- * full list of contributors). Published under the 2-clause BSD license.\n- * See license.txt in the OpenLayers distribution or repository for the\n- * full text of the license. */\n-\n-/**\n- * @requires OpenLayers/Util.js\n- * @requires OpenLayers/BaseTypes.js\n- */\n-\n-/**\n- * Namespace: OpenLayers.Element\n- */\n-OpenLayers.Element = {\n-\n- /**\n- * APIFunction: visible\n- * \n- * Parameters: \n- * element - {DOMElement}\n- * \n- * Returns:\n- * {Boolean} Is the element visible?\n- */\n- visible: function(element) {\n- return OpenLayers.Util.getElement(element).style.display != 'none';\n- },\n-\n- /**\n- * APIFunction: toggle\n- * Toggle the visibility of element(s) passed in\n- * \n- * Parameters:\n- * element - {DOMElement} Actually user can pass any number of elements\n- */\n- toggle: function() {\n- for (var i = 0, len = arguments.length; i < len; i++) {\n- var element = OpenLayers.Util.getElement(arguments[i]);\n- var display = OpenLayers.Element.visible(element) ? 'none' :\n- '';\n- element.style.display = display;\n- }\n- },\n-\n- /**\n- * APIFunction: remove\n- * Remove the specified element from the DOM.\n- * \n- * Parameters:\n- * element - {DOMElement}\n- */\n- remove: function(element) {\n- element = OpenLayers.Util.getElement(element);\n- element.parentNode.removeChild(element);\n- },\n-\n- /**\n- * APIFunction: getHeight\n- * \n- * Parameters:\n- * element - {DOMElement}\n- * \n- * Returns:\n- * {Integer} The offset height of the element passed in\n- */\n- getHeight: function(element) {\n- element = OpenLayers.Util.getElement(element);\n- return element.offsetHeight;\n- },\n-\n- /**\n- * Function: hasClass\n- * Tests if an element has the given CSS class name.\n- *\n- * Parameters:\n- * element - {DOMElement} A DOM element node.\n- * name - {String} The CSS class name to search for.\n- *\n- * Returns:\n- * {Boolean} The element has the given class name.\n- */\n- hasClass: function(element, name) {\n- var names = element.className;\n- return (!!names && new RegExp(\"(^|\\\\s)\" + name + \"(\\\\s|$)\").test(names));\n- },\n-\n- /**\n- * Function: addClass\n- * Add a CSS class name to an element. Safe where element already has\n- * the class name.\n- *\n- * Parameters:\n- * element - {DOMElement} A DOM element node.\n- * name - {String} The CSS class name to add.\n- *\n- * Returns:\n- * {DOMElement} The element.\n- */\n- addClass: function(element, name) {\n- if (!OpenLayers.Element.hasClass(element, name)) {\n- element.className += (element.className ? \" \" : \"\") + name;\n- }\n- return element;\n- },\n-\n- /**\n- * Function: removeClass\n- * Remove a CSS class name from an element. Safe where element does not\n- * have the class name.\n- *\n- * Parameters:\n- * element - {DOMElement} A DOM element node.\n- * name - {String} The CSS class name to remove.\n- *\n- * Returns:\n- * {DOMElement} The element.\n- */\n- removeClass: function(element, name) {\n- var names = element.className;\n- if (names) {\n- element.className = OpenLayers.String.trim(\n- names.replace(\n- new RegExp(\"(^|\\\\s+)\" + name + \"(\\\\s+|$)\"), \" \"\n- )\n- );\n- }\n- return element;\n- },\n-\n- /**\n- * Function: toggleClass\n- * Remove a CSS class name from an element if it exists. Add the class name\n- * if it doesn't exist.\n- *\n- * Parameters:\n- * element - {DOMElement} A DOM element node.\n- * name - {String} The CSS class name to toggle.\n- *\n- * Returns:\n- * {DOMElement} The element.\n- */\n- toggleClass: function(element, name) {\n- if (OpenLayers.Element.hasClass(element, name)) {\n- OpenLayers.Element.removeClass(element, name);\n- } else {\n- OpenLayers.Element.addClass(element, name);\n- }\n- return element;\n- },\n-\n- /**\n- * APIFunction: getStyle\n- * \n- * Parameters:\n- * element - {DOMElement}\n- * style - {?}\n- * \n- * Returns:\n- * {?}\n- */\n- getStyle: function(element, style) {\n- element = OpenLayers.Util.getElement(element);\n-\n- var value = null;\n- if (element && element.style) {\n- value = element.style[OpenLayers.String.camelize(style)];\n- if (!value) {\n- if (document.defaultView &&\n- document.defaultView.getComputedStyle) {\n-\n- var css = document.defaultView.getComputedStyle(element, null);\n- value = css ? css.getPropertyValue(style) : null;\n- } else if (element.currentStyle) {\n- value = element.currentStyle[OpenLayers.String.camelize(style)];\n- }\n- }\n-\n- var positions = ['left', 'top', 'right', 'bottom'];\n- if (window.opera &&\n- (OpenLayers.Util.indexOf(positions, style) != -1) &&\n- (OpenLayers.Element.getStyle(element, 'position') == 'static')) {\n- value = 'auto';\n- }\n- }\n-\n- return value == 'auto' ? null : value;\n- }\n-\n-};\n-/* ======================================================================\n- Rico/Color.js\n- ====================================================================== */\n-\n-/** \n- * @requires Rico/license.js\n- * @requires OpenLayers/Console.js\n- * @requires OpenLayers/BaseTypes/Class.js\n- * @requires OpenLayers/BaseTypes/Element.js\n- */\n-\n-\n-/*\n- * This file has been edited substantially from the Rico-released version by\n- * the OpenLayers development team.\n- */\n-\n-OpenLayers.Console.warn(\"OpenLayers.Rico is deprecated\");\n-\n-OpenLayers.Rico = OpenLayers.Rico || {};\n-OpenLayers.Rico.Color = OpenLayers.Class({\n-\n- initialize: function(red, green, blue) {\n- this.rgb = {\n- r: red,\n- g: green,\n- b: blue\n- };\n- },\n-\n- setRed: function(r) {\n- this.rgb.r = r;\n- },\n-\n- setGreen: function(g) {\n- this.rgb.g = g;\n- },\n-\n- setBlue: function(b) {\n- this.rgb.b = b;\n- },\n-\n- setHue: function(h) {\n-\n- // get an HSB model, and set the new hue...\n- var hsb = this.asHSB();\n- hsb.h = h;\n-\n- // convert back to RGB...\n- this.rgb = OpenLayers.Rico.Color.HSBtoRGB(hsb.h, hsb.s, hsb.b);\n- },\n-\n- setSaturation: function(s) {\n- // get an HSB model, and set the new hue...\n- var hsb = this.asHSB();\n- hsb.s = s;\n-\n- // convert back to RGB and set values...\n- this.rgb = OpenLayers.Rico.Color.HSBtoRGB(hsb.h, hsb.s, hsb.b);\n- },\n-\n- setBrightness: function(b) {\n- // get an HSB model, and set the new hue...\n- var hsb = this.asHSB();\n- hsb.b = b;\n-\n- // convert back to RGB and set values...\n- this.rgb = OpenLayers.Rico.Color.HSBtoRGB(hsb.h, hsb.s, hsb.b);\n- },\n-\n- darken: function(percent) {\n- var hsb = this.asHSB();\n- this.rgb = OpenLayers.Rico.Color.HSBtoRGB(hsb.h, hsb.s, Math.max(hsb.b - percent, 0));\n- },\n-\n- brighten: function(percent) {\n- var hsb = this.asHSB();\n- this.rgb = OpenLayers.Rico.Color.HSBtoRGB(hsb.h, hsb.s, Math.min(hsb.b + percent, 1));\n- },\n-\n- blend: function(other) {\n- this.rgb.r = Math.floor((this.rgb.r + other.rgb.r) / 2);\n- this.rgb.g = Math.floor((this.rgb.g + other.rgb.g) / 2);\n- this.rgb.b = Math.floor((this.rgb.b + other.rgb.b) / 2);\n- },\n-\n- isBright: function() {\n- var hsb = this.asHSB();\n- return this.asHSB().b > 0.5;\n- },\n-\n- isDark: function() {\n- return !this.isBright();\n- },\n-\n- asRGB: function() {\n- return \"rgb(\" + this.rgb.r + \",\" + this.rgb.g + \",\" + this.rgb.b + \")\";\n- },\n-\n- asHex: function() {\n- return \"#\" + this.rgb.r.toColorPart() + this.rgb.g.toColorPart() + this.rgb.b.toColorPart();\n- },\n-\n- asHSB: function() {\n- return OpenLayers.Rico.Color.RGBtoHSB(this.rgb.r, this.rgb.g, this.rgb.b);\n- },\n-\n- toString: function() {\n- return this.asHex();\n- }\n-\n-});\n-\n-OpenLayers.Rico.Color.createFromHex = function(hexCode) {\n- if (hexCode.length == 4) {\n- var shortHexCode = hexCode;\n- var hexCode = '#';\n- for (var i = 1; i < 4; i++) {\n- hexCode += (shortHexCode.charAt(i) +\n- shortHexCode.charAt(i));\n- }\n- }\n- if (hexCode.indexOf('#') == 0) {\n- hexCode = hexCode.substring(1);\n- }\n- var red = hexCode.substring(0, 2);\n- var green = hexCode.substring(2, 4);\n- var blue = hexCode.substring(4, 6);\n- return new OpenLayers.Rico.Color(parseInt(red, 16), parseInt(green, 16), parseInt(blue, 16));\n-};\n-\n-/**\n- * Factory method for creating a color from the background of\n- * an HTML element.\n- */\n-OpenLayers.Rico.Color.createColorFromBackground = function(elem) {\n-\n- var actualColor =\n- OpenLayers.Element.getStyle(OpenLayers.Util.getElement(elem),\n- \"backgroundColor\");\n-\n- if (actualColor == \"transparent\" && elem.parentNode) {\n- return OpenLayers.Rico.Color.createColorFromBackground(elem.parentNode);\n- }\n- if (actualColor == null) {\n- return new OpenLayers.Rico.Color(255, 255, 255);\n- }\n- if (actualColor.indexOf(\"rgb(\") == 0) {\n- var colors = actualColor.substring(4, actualColor.length - 1);\n- var colorArray = colors.split(\",\");\n- return new OpenLayers.Rico.Color(parseInt(colorArray[0]),\n- parseInt(colorArray[1]),\n- parseInt(colorArray[2]));\n-\n- } else if (actualColor.indexOf(\"#\") == 0) {\n- return OpenLayers.Rico.Color.createFromHex(actualColor);\n- } else {\n- return new OpenLayers.Rico.Color(255, 255, 255);\n- }\n-};\n-\n-OpenLayers.Rico.Color.HSBtoRGB = function(hue, saturation, brightness) {\n-\n- var red = 0;\n- var green = 0;\n- var blue = 0;\n-\n- if (saturation == 0) {\n- red = parseInt(brightness * 255.0 + 0.5);\n- green = red;\n- blue = red;\n- } else {\n- var h = (hue - Math.floor(hue)) * 6.0;\n- var f = h - Math.floor(h);\n- var p = brightness * (1.0 - saturation);\n- var q = brightness * (1.0 - saturation * f);\n- var t = brightness * (1.0 - (saturation * (1.0 - f)));\n-\n- switch (parseInt(h)) {\n- case 0:\n- red = (brightness * 255.0 + 0.5);\n- green = (t * 255.0 + 0.5);\n- blue = (p * 255.0 + 0.5);\n- break;\n- case 1:\n- red = (q * 255.0 + 0.5);\n- green = (brightness * 255.0 + 0.5);\n- blue = (p * 255.0 + 0.5);\n- break;\n- case 2:\n- red = (p * 255.0 + 0.5);\n- green = (brightness * 255.0 + 0.5);\n- blue = (t * 255.0 + 0.5);\n- break;\n- case 3:\n- red = (p * 255.0 + 0.5);\n- green = (q * 255.0 + 0.5);\n- blue = (brightness * 255.0 + 0.5);\n- break;\n- case 4:\n- red = (t * 255.0 + 0.5);\n- green = (p * 255.0 + 0.5);\n- blue = (brightness * 255.0 + 0.5);\n- break;\n- case 5:\n- red = (brightness * 255.0 + 0.5);\n- green = (p * 255.0 + 0.5);\n- blue = (q * 255.0 + 0.5);\n- break;\n- }\n- }\n-\n- return {\n- r: parseInt(red),\n- g: parseInt(green),\n- b: parseInt(blue)\n- };\n-};\n-\n-OpenLayers.Rico.Color.RGBtoHSB = function(r, g, b) {\n-\n- var hue;\n- var saturation;\n- var brightness;\n-\n- var cmax = (r > g) ? r : g;\n- if (b > cmax) {\n- cmax = b;\n- }\n- var cmin = (r < g) ? r : g;\n- if (b < cmin) {\n- cmin = b;\n- }\n- brightness = cmax / 255.0;\n- if (cmax != 0) {\n- saturation = (cmax - cmin) / cmax;\n- } else {\n- saturation = 0;\n- }\n- if (saturation == 0) {\n- hue = 0;\n- } else {\n- var redc = (cmax - r) / (cmax - cmin);\n- var greenc = (cmax - g) / (cmax - cmin);\n- var bluec = (cmax - b) / (cmax - cmin);\n-\n- if (r == cmax) {\n- hue = bluec - greenc;\n- } else if (g == cmax) {\n- hue = 2.0 + redc - bluec;\n- } else {\n- hue = 4.0 + greenc - redc;\n- }\n- hue = hue / 6.0;\n- if (hue < 0) {\n- hue = hue + 1.0;\n- }\n- }\n-\n- return {\n- h: hue,\n- s: saturation,\n- b: brightness\n- };\n-};\n-\n-/* ======================================================================\n- Rico/Corner.js\n- ====================================================================== */\n-\n-/**\n- * @requires OpenLayers/Console.js\n- * @requires Rico/Color.js\n- */\n-\n-\n-/*\n- * This file has been edited substantially from the Rico-released\n- * version by the OpenLayers development team.\n- * \n- * Copyright 2005 Sabre Airline Solutions \n- * \n- * Licensed under the Apache License, Version 2.0 (the \"License\");\n- * you may not use this file except in compliance with the\n- * License. You may obtain a copy of the License at\n- * \n- * http://www.apache.org/licenses/LICENSE-2.0 \n- * \n- * Unless required by applicable law or agreed to in writing, software\n- * distributed under the * License is distributed on an \"AS IS\" BASIS,\n- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or\n- * implied. See the License for the specific language governing\n- * permissions * and limitations under the License.\n- *\n- */\n-\n-OpenLayers.Console.warn(\"OpenLayers.Rico is deprecated\");\n-\n-OpenLayers.Rico = OpenLayers.Rico || {};\n-OpenLayers.Rico.Corner = {\n-\n- round: function(e, options) {\n- e = OpenLayers.Util.getElement(e);\n- this._setOptions(options);\n-\n- var color = this.options.color;\n- if (this.options.color == \"fromElement\") {\n- color = this._background(e);\n- }\n- var bgColor = this.options.bgColor;\n- if (this.options.bgColor == \"fromParent\") {\n- bgColor = this._background(e.offsetParent);\n- }\n- this._roundCornersImpl(e, color, bgColor);\n- },\n-\n- /** This is a helper function to change the background\n- * color of
that has had Rico rounded corners added.\n- *\n- * It seems we cannot just set the background color for the\n- * outer
so each element used to create the\n- * corners must have its background color set individually.\n- *\n- * @param {DOM} theDiv - A child of the outer
that was\n- * supplied to the `round` method.\n- *\n- * @param {String} newColor - The new background color to use.\n- */\n- changeColor: function(theDiv, newColor) {\n-\n- theDiv.style.backgroundColor = newColor;\n-\n- var spanElements = theDiv.parentNode.getElementsByTagName(\"span\");\n-\n- for (var currIdx = 0; currIdx < spanElements.length; currIdx++) {\n- spanElements[currIdx].style.backgroundColor = newColor;\n- }\n- },\n-\n-\n- /** This is a helper function to change the background\n- * opacity of
that has had Rico rounded corners added.\n- *\n- * See changeColor (above) for algorithm explanation\n- *\n- * @param {DOM} theDiv A child of the outer
that was\n- * supplied to the `round` method.\n- *\n- * @param {int} newOpacity The new opacity to use (0-1).\n- */\n- changeOpacity: function(theDiv, newOpacity) {\n-\n- var mozillaOpacity = newOpacity;\n- var ieOpacity = 'alpha(opacity=' + newOpacity * 100 + ')';\n-\n- theDiv.style.opacity = mozillaOpacity;\n- theDiv.style.filter = ieOpacity;\n-\n- var spanElements = theDiv.parentNode.getElementsByTagName(\"span\");\n-\n- for (var currIdx = 0; currIdx < spanElements.length; currIdx++) {\n- spanElements[currIdx].style.opacity = mozillaOpacity;\n- spanElements[currIdx].style.filter = ieOpacity;\n- }\n-\n- },\n-\n- /** this function takes care of redoing the rico cornering\n- * \n- * you can't just call updateRicoCorners() again and pass it a \n- * new options string. you have to first remove the divs that \n- * rico puts on top and below the content div.\n- *\n- * @param {DOM} theDiv - A child of the outer
that was\n- * supplied to the `round` method.\n- *\n- * @param {Object} options - list of options\n- */\n- reRound: function(theDiv, options) {\n-\n- var topRico = theDiv.parentNode.childNodes[0];\n- //theDiv would be theDiv.parentNode.childNodes[1]\n- var bottomRico = theDiv.parentNode.childNodes[2];\n-\n- theDiv.parentNode.removeChild(topRico);\n- theDiv.parentNode.removeChild(bottomRico);\n-\n- this.round(theDiv.parentNode, options);\n- },\n-\n- _roundCornersImpl: function(e, color, bgColor) {\n- if (this.options.border) {\n- this._renderBorder(e, bgColor);\n- }\n- if (this._isTopRounded()) {\n- this._roundTopCorners(e, color, bgColor);\n- }\n- if (this._isBottomRounded()) {\n- this._roundBottomCorners(e, color, bgColor);\n- }\n- },\n-\n- _renderBorder: function(el, bgColor) {\n- var borderValue = \"1px solid \" + this._borderColor(bgColor);\n- var borderL = \"border-left: \" + borderValue;\n- var borderR = \"border-right: \" + borderValue;\n- var style = \"style='\" + borderL + \";\" + borderR + \"'\";\n- el.innerHTML = \"
\" + el.innerHTML + \"
\";\n- },\n-\n- _roundTopCorners: function(el, color, bgColor) {\n- var corner = this._createCorner(bgColor);\n- for (var i = 0; i < this.options.numSlices; i++) {\n- corner.appendChild(this._createCornerSlice(color, bgColor, i, \"top\"));\n- }\n- el.style.paddingTop = 0;\n- el.insertBefore(corner, el.firstChild);\n- },\n-\n- _roundBottomCorners: function(el, color, bgColor) {\n- var corner = this._createCorner(bgColor);\n- for (var i = (this.options.numSlices - 1); i >= 0; i--) {\n- corner.appendChild(this._createCornerSlice(color, bgColor, i, \"bottom\"));\n- }\n- el.style.paddingBottom = 0;\n- el.appendChild(corner);\n- },\n-\n- _createCorner: function(bgColor) {\n- var corner = document.createElement(\"div\");\n- corner.style.backgroundColor = (this._isTransparent() ? \"transparent\" : bgColor);\n- return corner;\n- },\n-\n- _createCornerSlice: function(color, bgColor, n, position) {\n- var slice = document.createElement(\"span\");\n-\n- var inStyle = slice.style;\n- inStyle.backgroundColor = color;\n- inStyle.display = \"block\";\n- inStyle.height = \"1px\";\n- inStyle.overflow = \"hidden\";\n- inStyle.fontSize = \"1px\";\n-\n- var borderColor = this._borderColor(color, bgColor);\n- if (this.options.border && n == 0) {\n- inStyle.borderTopStyle = \"solid\";\n- inStyle.borderTopWidth = \"1px\";\n- inStyle.borderLeftWidth = \"0px\";\n- inStyle.borderRightWidth = \"0px\";\n- inStyle.borderBottomWidth = \"0px\";\n- inStyle.height = \"0px\"; // assumes css compliant box model\n- inStyle.borderColor = borderColor;\n- } else if (borderColor) {\n- inStyle.borderColor = borderColor;\n- inStyle.borderStyle = \"solid\";\n- inStyle.borderWidth = \"0px 1px\";\n- }\n-\n- if (!this.options.compact && (n == (this.options.numSlices - 1))) {\n- inStyle.height = \"2px\";\n- }\n- this._setMargin(slice, n, position);\n- this._setBorder(slice, n, position);\n- return slice;\n- },\n-\n- _setOptions: function(options) {\n- this.options = {\n- corners: \"all\",\n- color: \"fromElement\",\n- bgColor: \"fromParent\",\n- blend: true,\n- border: false,\n- compact: false\n- };\n- OpenLayers.Util.extend(this.options, options || {});\n-\n- this.options.numSlices = this.options.compact ? 2 : 4;\n- if (this._isTransparent()) {\n- this.options.blend = false;\n- }\n- },\n-\n- _whichSideTop: function() {\n- if (this._hasString(this.options.corners, \"all\", \"top\")) {\n- return \"\";\n- }\n- if (this.options.corners.indexOf(\"tl\") >= 0 && this.options.corners.indexOf(\"tr\") >= 0) {\n- return \"\";\n- }\n- if (this.options.corners.indexOf(\"tl\") >= 0) {\n- return \"left\";\n- } else if (this.options.corners.indexOf(\"tr\") >= 0) {\n- return \"right\";\n- }\n- return \"\";\n- },\n-\n- _whichSideBottom: function() {\n- if (this._hasString(this.options.corners, \"all\", \"bottom\")) {\n- return \"\";\n- }\n- if (this.options.corners.indexOf(\"bl\") >= 0 && this.options.corners.indexOf(\"br\") >= 0) {\n- return \"\";\n- }\n-\n- if (this.options.corners.indexOf(\"bl\") >= 0) {\n- return \"left\";\n- } else if (this.options.corners.indexOf(\"br\") >= 0) {\n- return \"right\";\n- }\n- return \"\";\n- },\n-\n- _borderColor: function(color, bgColor) {\n- if (color == \"transparent\") {\n- return bgColor;\n- } else if (this.options.border) {\n- return this.options.border;\n- } else if (this.options.blend) {\n- return this._blend(bgColor, color);\n- } else {\n- return \"\";\n- }\n- },\n-\n-\n- _setMargin: function(el, n, corners) {\n- var marginSize = this._marginSize(n);\n- var whichSide = corners == \"top\" ? this._whichSideTop() : this._whichSideBottom();\n-\n- if (whichSide == \"left\") {\n- el.style.marginLeft = marginSize + \"px\";\n- el.style.marginRight = \"0px\";\n- } else if (whichSide == \"right\") {\n- el.style.marginRight = marginSize + \"px\";\n- el.style.marginLeft = \"0px\";\n- } else {\n- el.style.marginLeft = marginSize + \"px\";\n- el.style.marginRight = marginSize + \"px\";\n- }\n- },\n-\n- _setBorder: function(el, n, corners) {\n- var borderSize = this._borderSize(n);\n- var whichSide = corners == \"top\" ? this._whichSideTop() : this._whichSideBottom();\n- if (whichSide == \"left\") {\n- el.style.borderLeftWidth = borderSize + \"px\";\n- el.style.borderRightWidth = \"0px\";\n- } else if (whichSide == \"right\") {\n- el.style.borderRightWidth = borderSize + \"px\";\n- el.style.borderLeftWidth = \"0px\";\n- } else {\n- el.style.borderLeftWidth = borderSize + \"px\";\n- el.style.borderRightWidth = borderSize + \"px\";\n- }\n- if (this.options.border != false) {\n- el.style.borderLeftWidth = borderSize + \"px\";\n- el.style.borderRightWidth = borderSize + \"px\";\n- }\n- },\n-\n- _marginSize: function(n) {\n- if (this._isTransparent()) {\n- return 0;\n- }\n- var marginSizes = [5, 3, 2, 1];\n- var blendedMarginSizes = [3, 2, 1, 0];\n- var compactMarginSizes = [2, 1];\n- var smBlendedMarginSizes = [1, 0];\n-\n- if (this.options.compact && this.options.blend) {\n- return smBlendedMarginSizes[n];\n- } else if (this.options.compact) {\n- return compactMarginSizes[n];\n- } else if (this.options.blend) {\n- return blendedMarginSizes[n];\n- } else {\n- return marginSizes[n];\n- }\n- },\n-\n- _borderSize: function(n) {\n- var transparentBorderSizes = [5, 3, 2, 1];\n- var blendedBorderSizes = [2, 1, 1, 1];\n- var compactBorderSizes = [1, 0];\n- var actualBorderSizes = [0, 2, 0, 0];\n-\n- if (this.options.compact && (this.options.blend || this._isTransparent())) {\n- return 1;\n- } else if (this.options.compact) {\n- return compactBorderSizes[n];\n- } else if (this.options.blend) {\n- return blendedBorderSizes[n];\n- } else if (this.options.border) {\n- return actualBorderSizes[n];\n- } else if (this._isTransparent()) {\n- return transparentBorderSizes[n];\n- }\n- return 0;\n- },\n-\n- _hasString: function(str) {\n- for (var i = 1; i < arguments.length; i++)\n- if (str.indexOf(arguments[i]) >= 0) {\n- return true;\n- } return false;\n- },\n- _blend: function(c1, c2) {\n- var cc1 = OpenLayers.Rico.Color.createFromHex(c1);\n- cc1.blend(OpenLayers.Rico.Color.createFromHex(c2));\n- return cc1;\n- },\n- _background: function(el) {\n- try {\n- return OpenLayers.Rico.Color.createColorFromBackground(el).asHex();\n- } catch (err) {\n- return \"#ffffff\";\n- }\n- },\n- _isTransparent: function() {\n- return this.options.color == \"transparent\";\n- },\n- _isTopRounded: function() {\n- return this._hasString(this.options.corners, \"all\", \"top\", \"tl\", \"tr\");\n- },\n- _isBottomRounded: function() {\n- return this._hasString(this.options.corners, \"all\", \"bottom\", \"bl\", \"br\");\n- },\n- _hasSingleTextChild: function(el) {\n- return el.childNodes.length == 1 && el.childNodes[0].nodeType == 3;\n- }\n-};\n-/* ======================================================================\n- OpenLayers/Geometry.js\n- ====================================================================== */\n-\n-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n- * full list of contributors). Published under the 2-clause BSD license.\n- * See license.txt in the OpenLayers distribution or repository for the\n- * full text of the license. */\n-\n-/**\n- * @requires OpenLayers/BaseTypes/Class.js\n- */\n-\n-/**\n- * Class: OpenLayers.Geometry\n- * A Geometry is a description of a geographic object. Create an instance of\n- * this class with the constructor. This is a base class,\n- * typical geometry types are described by subclasses of this class.\n- *\n- * Note that if you use the method, you must\n- * explicitly include the OpenLayers.Format.WKT in your build.\n- */\n-OpenLayers.Geometry = OpenLayers.Class({\n-\n- /**\n- * Property: id\n- * {String} A unique identifier for this geometry.\n- */\n- id: null,\n-\n- /**\n- * Property: parent\n- * {}This is set when a Geometry is added as component\n- * of another geometry\n- */\n- parent: null,\n-\n- /**\n- * Property: bounds \n- * {} The bounds of this geometry\n- */\n- bounds: null,\n-\n- /**\n- * Constructor: OpenLayers.Geometry\n- * Creates a geometry object. \n- */\n- initialize: function() {\n- this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + \"_\");\n- },\n-\n- /**\n- * Method: destroy\n- * Destroy this geometry.\n- */\n- destroy: function() {\n- this.id = null;\n- this.bounds = null;\n- },\n-\n- /**\n- * APIMethod: clone\n- * Create a clone of this geometry. Does not set any non-standard\n- * properties of the cloned geometry.\n- * \n- * Returns:\n- * {} An exact clone of this geometry.\n- */\n- clone: function() {\n- return new OpenLayers.Geometry();\n- },\n-\n- /**\n- * Method: setBounds\n- * Set the bounds for this Geometry.\n- * \n- * Parameters:\n- * bounds - {} \n- */\n- setBounds: function(bounds) {\n- if (bounds) {\n- this.bounds = bounds.clone();\n- }\n- },\n-\n- /**\n- * Method: clearBounds\n- * Nullify this components bounds and that of its parent as well.\n- */\n- clearBounds: function() {\n- this.bounds = null;\n- if (this.parent) {\n- this.parent.clearBounds();\n- }\n- },\n-\n- /**\n- * Method: extendBounds\n- * Extend the existing bounds to include the new bounds. \n- * If geometry's bounds is not yet set, then set a new Bounds.\n- * \n- * Parameters:\n- * newBounds - {} \n- */\n- extendBounds: function(newBounds) {\n- var bounds = this.getBounds();\n- if (!bounds) {\n- this.setBounds(newBounds);\n- } else {\n- this.bounds.extend(newBounds);\n- }\n- },\n-\n- /**\n- * APIMethod: getBounds\n- * Get the bounds for this Geometry. If bounds is not set, it \n- * is calculated again, this makes queries faster.\n- * \n- * Returns:\n- * {}\n- */\n- getBounds: function() {\n- if (this.bounds == null) {\n- this.calculateBounds();\n- }\n- return this.bounds;\n- },\n-\n- /** \n- * APIMethod: calculateBounds\n- * Recalculate the bounds for the geometry. \n- */\n- calculateBounds: function() {\n- //\n- // This should be overridden by subclasses.\n- //\n- },\n-\n- /**\n- * APIMethod: distanceTo\n- * Calculate the closest distance between two geometries (on the x-y plane).\n- *\n- * Parameters:\n- * geometry - {} The target geometry.\n- * options - {Object} Optional properties for configuring the distance\n- * calculation.\n- *\n- * Valid options depend on the specific geometry type.\n- * \n- * Returns:\n- * {Number | Object} The distance between this geometry and the target.\n- * If details is true, the return will be an object with distance,\n- * x0, y0, x1, and x2 properties. The x0 and y0 properties represent\n- * the coordinates of the closest point on this geometry. The x1 and y1\n- * properties represent the coordinates of the closest point on the\n- * target geometry.\n- */\n- distanceTo: function(geometry, options) {},\n-\n- /**\n- * APIMethod: getVertices\n- * Return a list of all points in this geometry.\n- *\n- * Parameters:\n- * nodes - {Boolean} For lines, only return vertices that are\n- * endpoints. If false, for lines, only vertices that are not\n- * endpoints will be returned. If not provided, all vertices will\n- * be returned.\n- *\n- * Returns:\n- * {Array} A list of all vertices in the geometry.\n- */\n- getVertices: function(nodes) {},\n-\n- /**\n- * Method: atPoint\n- * Note - This is only an approximation based on the bounds of the \n- * geometry.\n- * \n- * Parameters:\n- * lonlat - {|Object} OpenLayers.LonLat or an\n- * object with a 'lon' and 'lat' properties.\n- * toleranceLon - {float} Optional tolerance in Geometric Coords\n- * toleranceLat - {float} Optional tolerance in Geographic Coords\n- * \n- * Returns:\n- * {Boolean} Whether or not the geometry is at the specified location\n- */\n- atPoint: function(lonlat, toleranceLon, toleranceLat) {\n- var atPoint = false;\n- var bounds = this.getBounds();\n- if ((bounds != null) && (lonlat != null)) {\n-\n- var dX = (toleranceLon != null) ? toleranceLon : 0;\n- var dY = (toleranceLat != null) ? toleranceLat : 0;\n-\n- var toleranceBounds =\n- new OpenLayers.Bounds(this.bounds.left - dX,\n- this.bounds.bottom - dY,\n- this.bounds.right + dX,\n- this.bounds.top + dY);\n-\n- atPoint = toleranceBounds.containsLonLat(lonlat);\n- }\n- return atPoint;\n- },\n-\n- /**\n- * Method: getLength\n- * Calculate the length of this geometry. This method is defined in\n- * subclasses.\n- * \n- * Returns:\n- * {Float} The length of the collection by summing its parts\n- */\n- getLength: function() {\n- //to be overridden by geometries that actually have a length\n- //\n- return 0.0;\n- },\n-\n- /**\n- * Method: getArea\n- * Calculate the area of this geometry. This method is defined in subclasses.\n- * \n- * Returns:\n- * {Float} The area of the collection by summing its parts\n- */\n- getArea: function() {\n- //to be overridden by geometries that actually have an area\n- //\n- return 0.0;\n- },\n-\n- /**\n- * APIMethod: getCentroid\n- * Calculate the centroid of this geometry. This method is defined in subclasses.\n- *\n- * Returns:\n- * {} The centroid of the collection\n- */\n- getCentroid: function() {\n- return null;\n- },\n-\n- /**\n- * Method: toString\n- * Returns a text representation of the geometry. If the WKT format is\n- * included in a build, this will be the Well-Known Text \n- * representation.\n- *\n- * Returns:\n- * {String} String representation of this geometry.\n- */\n- toString: function() {\n- var string;\n- if (OpenLayers.Format && OpenLayers.Format.WKT) {\n- string = OpenLayers.Format.WKT.prototype.write(\n- new OpenLayers.Feature.Vector(this)\n- );\n- } else {\n- string = Object.prototype.toString.call(this);\n- }\n- return string;\n- },\n-\n- CLASS_NAME: \"OpenLayers.Geometry\"\n-});\n-\n-/**\n- * Function: OpenLayers.Geometry.fromWKT\n- * Generate a geometry given a Well-Known Text string. For this method to\n- * work, you must include the OpenLayers.Format.WKT in your build \n- * explicitly.\n- *\n- * Parameters:\n- * wkt - {String} A string representing the geometry in Well-Known Text.\n- *\n- * Returns:\n- * {} A geometry of the appropriate class.\n- */\n-OpenLayers.Geometry.fromWKT = function(wkt) {\n- var geom;\n- if (OpenLayers.Format && OpenLayers.Format.WKT) {\n- var format = OpenLayers.Geometry.fromWKT.format;\n- if (!format) {\n- format = new OpenLayers.Format.WKT();\n- OpenLayers.Geometry.fromWKT.format = format;\n- }\n- var result = format.read(wkt);\n- if (result instanceof OpenLayers.Feature.Vector) {\n- geom = result.geometry;\n- } else if (OpenLayers.Util.isArray(result)) {\n- var len = result.length;\n- var components = new Array(len);\n- for (var i = 0; i < len; ++i) {\n- components[i] = result[i].geometry;\n- }\n- geom = new OpenLayers.Geometry.Collection(components);\n- }\n- }\n- return geom;\n-};\n-\n-/**\n- * Method: OpenLayers.Geometry.segmentsIntersect\n- * Determine whether two line segments intersect. Optionally calculates\n- * and returns the intersection point. This function is optimized for\n- * cases where seg1.x2 >= seg2.x1 || seg2.x2 >= seg1.x1. In those\n- * obvious cases where there is no intersection, the function should\n- * not be called.\n- *\n- * Parameters:\n- * seg1 - {Object} Object representing a segment with properties x1, y1, x2,\n- * and y2. The start point is represented by x1 and y1. The end point\n- * is represented by x2 and y2. Start and end are ordered so that x1 < x2.\n- * seg2 - {Object} Object representing a segment with properties x1, y1, x2,\n- * and y2. The start point is represented by x1 and y1. The end point\n- * is represented by x2 and y2. Start and end are ordered so that x1 < x2.\n- * options - {Object} Optional properties for calculating the intersection.\n- *\n- * Valid options:\n- * point - {Boolean} Return the intersection point. If false, the actual\n- * intersection point will not be calculated. If true and the segments\n- * intersect, the intersection point will be returned. If true and\n- * the segments do not intersect, false will be returned. If true and\n- * the segments are coincident, true will be returned.\n- * tolerance - {Number} If a non-null value is provided, if the segments are\n- * within the tolerance distance, this will be considered an intersection.\n- * In addition, if the point option is true and the calculated intersection\n- * is within the tolerance distance of an end point, the endpoint will be\n- * returned instead of the calculated intersection. Further, if the\n- * intersection is within the tolerance of endpoints on both segments, or\n- * if two segment endpoints are within the tolerance distance of eachother\n- * (but no intersection is otherwise calculated), an endpoint on the\n- * first segment provided will be returned.\n- *\n- * Returns:\n- * {Boolean | } The two segments intersect.\n- * If the point argument is true, the return will be the intersection\n- * point or false if none exists. If point is true and the segments\n- * are coincident, return will be true (and the instersection is equal\n- * to the shorter segment).\n- */\n-OpenLayers.Geometry.segmentsIntersect = function(seg1, seg2, options) {\n- var point = options && options.point;\n- var tolerance = options && options.tolerance;\n- var intersection = false;\n- var x11_21 = seg1.x1 - seg2.x1;\n- var y11_21 = seg1.y1 - seg2.y1;\n- var x12_11 = seg1.x2 - seg1.x1;\n- var y12_11 = seg1.y2 - seg1.y1;\n- var y22_21 = seg2.y2 - seg2.y1;\n- var x22_21 = seg2.x2 - seg2.x1;\n- var d = (y22_21 * x12_11) - (x22_21 * y12_11);\n- var n1 = (x22_21 * y11_21) - (y22_21 * x11_21);\n- var n2 = (x12_11 * y11_21) - (y12_11 * x11_21);\n- if (d == 0) {\n- // parallel\n- if (n1 == 0 && n2 == 0) {\n- // coincident\n- intersection = true;\n- }\n- } else {\n- var along1 = n1 / d;\n- var along2 = n2 / d;\n- if (along1 >= 0 && along1 <= 1 && along2 >= 0 && along2 <= 1) {\n- // intersect\n- if (!point) {\n- intersection = true;\n- } else {\n- // calculate the intersection point\n- var x = seg1.x1 + (along1 * x12_11);\n- var y = seg1.y1 + (along1 * y12_11);\n- intersection = new OpenLayers.Geometry.Point(x, y);\n- }\n- }\n- }\n- if (tolerance) {\n- var dist;\n- if (intersection) {\n- if (point) {\n- var segs = [seg1, seg2];\n- var seg, x, y;\n- // check segment endpoints for proximity to intersection\n- // set intersection to first endpoint within the tolerance\n- outer: for (var i = 0; i < 2; ++i) {\n- seg = segs[i];\n- for (var j = 1; j < 3; ++j) {\n- x = seg[\"x\" + j];\n- y = seg[\"y\" + j];\n- dist = Math.sqrt(\n- Math.pow(x - intersection.x, 2) +\n- Math.pow(y - intersection.y, 2)\n- );\n- if (dist < tolerance) {\n- intersection.x = x;\n- intersection.y = y;\n- break outer;\n- }\n- }\n- }\n-\n- }\n- } else {\n- // no calculated intersection, but segments could be within\n- // the tolerance of one another\n- var segs = [seg1, seg2];\n- var source, target, x, y, p, result;\n- // check segment endpoints for proximity to intersection\n- // set intersection to first endpoint within the tolerance\n- outer: for (var i = 0; i < 2; ++i) {\n- source = segs[i];\n- target = segs[(i + 1) % 2];\n- for (var j = 1; j < 3; ++j) {\n- p = {\n- x: source[\"x\" + j],\n- y: source[\"y\" + j]\n- };\n- result = OpenLayers.Geometry.distanceToSegment(p, target);\n- if (result.distance < tolerance) {\n- if (point) {\n- intersection = new OpenLayers.Geometry.Point(p.x, p.y);\n- } else {\n- intersection = true;\n- }\n- break outer;\n- }\n- }\n- }\n- }\n- }\n- return intersection;\n-};\n-\n-/**\n- * Function: OpenLayers.Geometry.distanceToSegment\n- *\n- * Parameters:\n- * point - {Object} An object with x and y properties representing the\n- * point coordinates.\n- * segment - {Object} An object with x1, y1, x2, and y2 properties\n- * representing endpoint coordinates.\n- *\n- * Returns:\n- * {Object} An object with distance, along, x, and y properties. The distance\n- * will be the shortest distance between the input point and segment.\n- * The x and y properties represent the coordinates along the segment\n- * where the shortest distance meets the segment. The along attribute\n- * describes how far between the two segment points the given point is.\n- */\n-OpenLayers.Geometry.distanceToSegment = function(point, segment) {\n- var result = OpenLayers.Geometry.distanceSquaredToSegment(point, segment);\n- result.distance = Math.sqrt(result.distance);\n- return result;\n-};\n-\n-/**\n- * Function: OpenLayers.Geometry.distanceSquaredToSegment\n- *\n- * Usually the distanceToSegment function should be used. This variant however\n- * can be used for comparisons where the exact distance is not important.\n- *\n- * Parameters:\n- * point - {Object} An object with x and y properties representing the\n- * point coordinates.\n- * segment - {Object} An object with x1, y1, x2, and y2 properties\n- * representing endpoint coordinates.\n- *\n- * Returns:\n- * {Object} An object with squared distance, along, x, and y properties.\n- * The distance will be the shortest distance between the input point and\n- * segment. The x and y properties represent the coordinates along the\n- * segment where the shortest distance meets the segment. The along\n- * attribute describes how far between the two segment points the given\n- * point is.\n- */\n-OpenLayers.Geometry.distanceSquaredToSegment = function(point, segment) {\n- var x0 = point.x;\n- var y0 = point.y;\n- var x1 = segment.x1;\n- var y1 = segment.y1;\n- var x2 = segment.x2;\n- var y2 = segment.y2;\n- var dx = x2 - x1;\n- var dy = y2 - y1;\n- var along = ((dx * (x0 - x1)) + (dy * (y0 - y1))) /\n- (Math.pow(dx, 2) + Math.pow(dy, 2));\n- var x, y;\n- if (along <= 0.0) {\n- x = x1;\n- y = y1;\n- } else if (along >= 1.0) {\n- x = x2;\n- y = y2;\n- } else {\n- x = x1 + along * dx;\n- y = y1 + along * dy;\n- }\n- return {\n- distance: Math.pow(x - x0, 2) + Math.pow(y - y0, 2),\n- x: x,\n- y: y,\n- along: along\n- };\n-};\n-/* ======================================================================\n OpenLayers/Feature.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n * See license.txt in the OpenLayers distribution or repository for the\n * full text of the license. */\n@@ -6332,1348 +5169,5592 @@\n \n },\n 'delete': {\n display: \"none\"\n }\n };\n /* ======================================================================\n- OpenLayers/Format.js\n+ OpenLayers/Style.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n * See license.txt in the OpenLayers distribution or repository for the\n * full text of the license. */\n \n+\n /**\n * @requires OpenLayers/BaseTypes/Class.js\n * @requires OpenLayers/Util.js\n+ * @requires OpenLayers/Feature/Vector.js\n */\n \n /**\n- * Class: OpenLayers.Format\n- * Base class for format reading/writing a variety of formats. Subclasses\n- * of OpenLayers.Format are expected to have read and write methods.\n+ * Class: OpenLayers.Style\n+ * This class represents a UserStyle obtained\n+ * from a SLD, containing styling rules.\n */\n-OpenLayers.Format = OpenLayers.Class({\n+OpenLayers.Style = OpenLayers.Class({\n \n /**\n- * Property: options\n- * {Object} A reference to options passed to the constructor.\n+ * Property: id\n+ * {String} A unique id for this session.\n */\n- options: null,\n+ id: null,\n \n /**\n- * APIProperty: externalProjection\n- * {} When passed a externalProjection and\n- * internalProjection, the format will reproject the geometries it\n- * reads or writes. The externalProjection is the projection used by\n- * the content which is passed into read or which comes out of write.\n- * In order to reproject, a projection transformation function for the\n- * specified projections must be available. This support may be \n- * provided via proj4js or via a custom transformation function. See\n- * {} for more information on\n- * custom transformations.\n+ * APIProperty: name\n+ * {String}\n */\n- externalProjection: null,\n+ name: null,\n \n /**\n- * APIProperty: internalProjection\n- * {} When passed a externalProjection and\n- * internalProjection, the format will reproject the geometries it\n- * reads or writes. The internalProjection is the projection used by\n- * the geometries which are returned by read or which are passed into\n- * write. In order to reproject, a projection transformation function\n- * for the specified projections must be available. This support may be\n- * provided via proj4js or via a custom transformation function. See\n- * {} for more information on\n- * custom transformations.\n+ * Property: title\n+ * {String} Title of this style (set if included in SLD)\n */\n- internalProjection: null,\n+ title: null,\n \n /**\n- * APIProperty: data\n- * {Object} When is true, this is the parsed string sent to\n- * .\n+ * Property: description\n+ * {String} Description of this style (set if abstract is included in SLD)\n */\n- data: null,\n+ description: null,\n \n /**\n- * APIProperty: keepData\n- * {Object} Maintain a reference () to the most recently read data.\n- * Default is false.\n+ * APIProperty: layerName\n+ * {} name of the layer that this style belongs to, usually\n+ * according to the NamedLayer attribute of an SLD document.\n */\n- keepData: false,\n+ layerName: null,\n \n /**\n- * Constructor: OpenLayers.Format\n- * Instances of this class are not useful. See one of the subclasses.\n+ * APIProperty: isDefault\n+ * {Boolean}\n+ */\n+ isDefault: false,\n+\n+ /** \n+ * Property: rules \n+ * {Array()}\n+ */\n+ rules: null,\n+\n+ /**\n+ * APIProperty: context\n+ * {Object} An optional object with properties that symbolizers' property\n+ * values should be evaluated against. If no context is specified,\n+ * feature.attributes will be used\n+ */\n+ context: null,\n+\n+ /**\n+ * Property: defaultStyle\n+ * {Object} hash of style properties to use as default for merging\n+ * rule-based style symbolizers onto. If no rules are defined,\n+ * createSymbolizer will return this style. If is set to\n+ * true, the defaultStyle will only be taken into account if there are\n+ * rules defined.\n+ */\n+ defaultStyle: null,\n+\n+ /**\n+ * Property: defaultsPerSymbolizer\n+ * {Boolean} If set to true, the will extend the symbolizer\n+ * of every rule. Properties of the will also be used to set\n+ * missing symbolizer properties if the symbolizer has stroke, fill or\n+ * graphic set to true. Default is false.\n+ */\n+ defaultsPerSymbolizer: false,\n+\n+ /**\n+ * Property: propertyStyles\n+ * {Hash of Boolean} cache of style properties that need to be parsed for\n+ * propertyNames. Property names are keys, values won't be used.\n+ */\n+ propertyStyles: null,\n+\n+\n+ /** \n+ * Constructor: OpenLayers.Style\n+ * Creates a UserStyle.\n *\n * Parameters:\n+ * style - {Object} Optional hash of style properties that will be\n+ * used as default style for this style object. This style\n+ * applies if no rules are specified. Symbolizers defined in\n+ * rules will extend this default style.\n * options - {Object} An optional object with properties to set on the\n- * format\n+ * style.\n *\n * Valid options:\n- * keepData - {Boolean} If true, upon , the data property will be\n- * set to the parsed object (e.g. the json or xml object).\n- *\n+ * rules - {Array()} List of rules to be added to the\n+ * style.\n+ * \n * Returns:\n- * An instance of OpenLayers.Format\n+ * {}\n */\n- initialize: function(options) {\n+ initialize: function(style, options) {\n+\n OpenLayers.Util.extend(this, options);\n- this.options = options;\n+ this.rules = [];\n+ if (options && options.rules) {\n+ this.addRules(options.rules);\n+ }\n+\n+ // use the default style from OpenLayers.Feature.Vector if no style\n+ // was given in the constructor\n+ this.setDefaultStyle(style ||\n+ OpenLayers.Feature.Vector.style[\"default\"]);\n+\n+ this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + \"_\");\n },\n \n- /**\n+ /** \n * APIMethod: destroy\n- * Clean up.\n+ * nullify references to prevent circular references and memory leaks\n */\n- destroy: function() {},\n+ destroy: function() {\n+ for (var i = 0, len = this.rules.length; i < len; i++) {\n+ this.rules[i].destroy();\n+ this.rules[i] = null;\n+ }\n+ this.rules = null;\n+ this.defaultStyle = null;\n+ },\n \n /**\n- * Method: read\n- * Read data from a string, and return an object whose type depends on the\n- * subclass. \n+ * Method: createSymbolizer\n+ * creates a style by applying all feature-dependent rules to the base\n+ * style.\n * \n * Parameters:\n- * data - {string} Data to read/parse.\n- *\n+ * feature - {} feature to evaluate rules for\n+ * \n * Returns:\n- * Depends on the subclass\n+ * {Object} symbolizer hash\n */\n- read: function(data) {\n- throw new Error('Read not implemented.');\n+ createSymbolizer: function(feature) {\n+ var style = this.defaultsPerSymbolizer ? {} : this.createLiterals(\n+ OpenLayers.Util.extend({}, this.defaultStyle), feature);\n+\n+ var rules = this.rules;\n+\n+ var rule, context;\n+ var elseRules = [];\n+ var appliedRules = false;\n+ for (var i = 0, len = rules.length; i < len; i++) {\n+ rule = rules[i];\n+ // does the rule apply?\n+ var applies = rule.evaluate(feature);\n+\n+ if (applies) {\n+ if (rule instanceof OpenLayers.Rule && rule.elseFilter) {\n+ elseRules.push(rule);\n+ } else {\n+ appliedRules = true;\n+ this.applySymbolizer(rule, style, feature);\n+ }\n+ }\n+ }\n+\n+ // if no other rules apply, apply the rules with else filters\n+ if (appliedRules == false && elseRules.length > 0) {\n+ appliedRules = true;\n+ for (var i = 0, len = elseRules.length; i < len; i++) {\n+ this.applySymbolizer(elseRules[i], style, feature);\n+ }\n+ }\n+\n+ // don't display if there were rules but none applied\n+ if (rules.length > 0 && appliedRules == false) {\n+ style.display = \"none\";\n+ }\n+\n+ if (style.label != null && typeof style.label !== \"string\") {\n+ style.label = String(style.label);\n+ }\n+\n+ return style;\n },\n \n /**\n- * Method: write\n- * Accept an object, and return a string. \n+ * Method: applySymbolizer\n *\n * Parameters:\n- * object - {Object} Object to be serialized\n+ * rule - {}\n+ * style - {Object}\n+ * feature - {}\n *\n * Returns:\n- * {String} A string representation of the object.\n+ * {Object} A style with new symbolizer applied.\n */\n- write: function(object) {\n- throw new Error('Write not implemented.');\n- },\n-\n- CLASS_NAME: \"OpenLayers.Format\"\n-});\n-/* ======================================================================\n- OpenLayers/Geometry/Point.js\n- ====================================================================== */\n+ applySymbolizer: function(rule, style, feature) {\n+ var symbolizerPrefix = feature.geometry ?\n+ this.getSymbolizerPrefix(feature.geometry) :\n+ OpenLayers.Style.SYMBOLIZER_PREFIXES[0];\n \n-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n- * full list of contributors). Published under the 2-clause BSD license.\n- * See license.txt in the OpenLayers distribution or repository for the\n- * full text of the license. */\n+ var symbolizer = rule.symbolizer[symbolizerPrefix] || rule.symbolizer;\n \n-/**\n- * @requires OpenLayers/Geometry.js\n- */\n+ if (this.defaultsPerSymbolizer === true) {\n+ var defaults = this.defaultStyle;\n+ OpenLayers.Util.applyDefaults(symbolizer, {\n+ pointRadius: defaults.pointRadius\n+ });\n+ if (symbolizer.stroke === true || symbolizer.graphic === true) {\n+ OpenLayers.Util.applyDefaults(symbolizer, {\n+ strokeWidth: defaults.strokeWidth,\n+ strokeColor: defaults.strokeColor,\n+ strokeOpacity: defaults.strokeOpacity,\n+ strokeDashstyle: defaults.strokeDashstyle,\n+ strokeLinecap: defaults.strokeLinecap\n+ });\n+ }\n+ if (symbolizer.fill === true || symbolizer.graphic === true) {\n+ OpenLayers.Util.applyDefaults(symbolizer, {\n+ fillColor: defaults.fillColor,\n+ fillOpacity: defaults.fillOpacity\n+ });\n+ }\n+ if (symbolizer.graphic === true) {\n+ OpenLayers.Util.applyDefaults(symbolizer, {\n+ pointRadius: this.defaultStyle.pointRadius,\n+ externalGraphic: this.defaultStyle.externalGraphic,\n+ graphicName: this.defaultStyle.graphicName,\n+ graphicOpacity: this.defaultStyle.graphicOpacity,\n+ graphicWidth: this.defaultStyle.graphicWidth,\n+ graphicHeight: this.defaultStyle.graphicHeight,\n+ graphicXOffset: this.defaultStyle.graphicXOffset,\n+ graphicYOffset: this.defaultStyle.graphicYOffset\n+ });\n+ }\n+ }\n \n-/**\n- * Class: OpenLayers.Geometry.Point\n- * Point geometry class. \n- * \n- * Inherits from:\n- * - \n- */\n-OpenLayers.Geometry.Point = OpenLayers.Class(OpenLayers.Geometry, {\n+ // merge the style with the current style\n+ return this.createLiterals(\n+ OpenLayers.Util.extend(style, symbolizer), feature);\n+ },\n \n- /** \n- * APIProperty: x \n- * {float} \n+ /**\n+ * Method: createLiterals\n+ * creates literals for all style properties that have an entry in\n+ * .\n+ * \n+ * Parameters:\n+ * style - {Object} style to create literals for. Will be modified\n+ * inline.\n+ * feature - {Object}\n+ * \n+ * Returns:\n+ * {Object} the modified style\n */\n- x: null,\n+ createLiterals: function(style, feature) {\n+ var context = OpenLayers.Util.extend({}, feature.attributes || feature.data);\n+ OpenLayers.Util.extend(context, this.context);\n \n- /** \n- * APIProperty: y \n- * {float} \n- */\n- y: null,\n+ for (var i in this.propertyStyles) {\n+ style[i] = OpenLayers.Style.createLiteral(style[i], context, feature, i);\n+ }\n+ return style;\n+ },\n \n /**\n- * Constructor: OpenLayers.Geometry.Point\n- * Construct a point geometry.\n- *\n- * Parameters:\n- * x - {float} \n- * y - {float}\n+ * Method: findPropertyStyles\n+ * Looks into all rules for this style and the defaultStyle to collect\n+ * all the style hash property names containing ${...} strings that have\n+ * to be replaced using the createLiteral method before returning them.\n * \n+ * Returns:\n+ * {Object} hash of property names that need createLiteral parsing. The\n+ * name of the property is the key, and the value is true;\n */\n- initialize: function(x, y) {\n- OpenLayers.Geometry.prototype.initialize.apply(this, arguments);\n+ findPropertyStyles: function() {\n+ var propertyStyles = {};\n \n- this.x = parseFloat(x);\n- this.y = parseFloat(y);\n+ // check the default style\n+ var style = this.defaultStyle;\n+ this.addPropertyStyles(propertyStyles, style);\n+\n+ // walk through all rules to check for properties in their symbolizer\n+ var rules = this.rules;\n+ var symbolizer, value;\n+ for (var i = 0, len = rules.length; i < len; i++) {\n+ symbolizer = rules[i].symbolizer;\n+ for (var key in symbolizer) {\n+ value = symbolizer[key];\n+ if (typeof value == \"object\") {\n+ // symbolizer key is \"Point\", \"Line\" or \"Polygon\"\n+ this.addPropertyStyles(propertyStyles, value);\n+ } else {\n+ // symbolizer is a hash of style properties\n+ this.addPropertyStyles(propertyStyles, symbolizer);\n+ break;\n+ }\n+ }\n+ }\n+ return propertyStyles;\n },\n \n /**\n- * APIMethod: clone\n+ * Method: addPropertyStyles\n+ * \n+ * Parameters:\n+ * propertyStyles - {Object} hash to add new property styles to. Will be\n+ * modified inline\n+ * symbolizer - {Object} search this symbolizer for property styles\n * \n * Returns:\n- * {} An exact clone of this OpenLayers.Geometry.Point\n+ * {Object} propertyStyles hash\n */\n- clone: function(obj) {\n- if (obj == null) {\n- obj = new OpenLayers.Geometry.Point(this.x, this.y);\n+ addPropertyStyles: function(propertyStyles, symbolizer) {\n+ var property;\n+ for (var key in symbolizer) {\n+ property = symbolizer[key];\n+ if (typeof property == \"string\" &&\n+ property.match(/\\$\\{\\w+\\}/)) {\n+ propertyStyles[key] = true;\n+ }\n }\n+ return propertyStyles;\n+ },\n \n- // catch any randomly tagged-on properties\n- OpenLayers.Util.applyDefaults(obj, this);\n-\n- return obj;\n+ /**\n+ * APIMethod: addRules\n+ * Adds rules to this style.\n+ * \n+ * Parameters:\n+ * rules - {Array()}\n+ */\n+ addRules: function(rules) {\n+ Array.prototype.push.apply(this.rules, rules);\n+ this.propertyStyles = this.findPropertyStyles();\n },\n \n- /** \n- * Method: calculateBounds\n- * Create a new Bounds based on the lon/lat\n+ /**\n+ * APIMethod: setDefaultStyle\n+ * Sets the default style for this style object.\n+ * \n+ * Parameters:\n+ * style - {Object} Hash of style properties\n */\n- calculateBounds: function() {\n- this.bounds = new OpenLayers.Bounds(this.x, this.y,\n- this.x, this.y);\n+ setDefaultStyle: function(style) {\n+ this.defaultStyle = style;\n+ this.propertyStyles = this.findPropertyStyles();\n },\n \n /**\n- * APIMethod: distanceTo\n- * Calculate the closest distance between two geometries (on the x-y plane).\n- *\n+ * Method: getSymbolizerPrefix\n+ * Returns the correct symbolizer prefix according to the\n+ * geometry type of the passed geometry\n+ * \n * Parameters:\n- * geometry - {} The target geometry.\n- * options - {Object} Optional properties for configuring the distance\n- * calculation.\n- *\n- * Valid options:\n- * details - {Boolean} Return details from the distance calculation.\n- * Default is false.\n- * edge - {Boolean} Calculate the distance from this geometry to the\n- * nearest edge of the target geometry. Default is true. If true,\n- * calling distanceTo from a geometry that is wholly contained within\n- * the target will result in a non-zero distance. If false, whenever\n- * geometries intersect, calling distanceTo will return 0. If false,\n- * details cannot be returned.\n- *\n+ * geometry - {}\n+ * \n * Returns:\n- * {Number | Object} The distance between this geometry and the target.\n- * If details is true, the return will be an object with distance,\n- * x0, y0, x1, and x2 properties. The x0 and y0 properties represent\n- * the coordinates of the closest point on this geometry. The x1 and y1\n- * properties represent the coordinates of the closest point on the\n- * target geometry.\n+ * {String} key of the according symbolizer\n */\n- distanceTo: function(geometry, options) {\n- var edge = !(options && options.edge === false);\n- var details = edge && options && options.details;\n- var distance, x0, y0, x1, y1, result;\n- if (geometry instanceof OpenLayers.Geometry.Point) {\n- x0 = this.x;\n- y0 = this.y;\n- x1 = geometry.x;\n- y1 = geometry.y;\n- distance = Math.sqrt(Math.pow(x0 - x1, 2) + Math.pow(y0 - y1, 2));\n- result = !details ?\n- distance : {\n- x0: x0,\n- y0: y0,\n- x1: x1,\n- y1: y1,\n- distance: distance\n- };\n- } else {\n- result = geometry.distanceTo(this, options);\n- if (details) {\n- // switch coord order since this geom is target\n- result = {\n- x0: result.x1,\n- y0: result.y1,\n- x1: result.x0,\n- y1: result.y0,\n- distance: result.distance\n- };\n+ getSymbolizerPrefix: function(geometry) {\n+ var prefixes = OpenLayers.Style.SYMBOLIZER_PREFIXES;\n+ for (var i = 0, len = prefixes.length; i < len; i++) {\n+ if (geometry.CLASS_NAME.indexOf(prefixes[i]) != -1) {\n+ return prefixes[i];\n }\n }\n- return result;\n },\n \n- /** \n- * APIMethod: equals\n- * Determine whether another geometry is equivalent to this one. Geometries\n- * are considered equivalent if all components have the same coordinates.\n+ /**\n+ * APIMethod: clone\n+ * Clones this style.\n * \n- * Parameters:\n- * geom - {} The geometry to test. \n- *\n * Returns:\n- * {Boolean} The supplied geometry is equivalent to this geometry.\n+ * {} Clone of this style.\n */\n- equals: function(geom) {\n- var equals = false;\n- if (geom != null) {\n- equals = ((this.x == geom.x && this.y == geom.y) ||\n- (isNaN(this.x) && isNaN(this.y) && isNaN(geom.x) && isNaN(geom.y)));\n+ clone: function() {\n+ var options = OpenLayers.Util.extend({}, this);\n+ // clone rules\n+ if (this.rules) {\n+ options.rules = [];\n+ for (var i = 0, len = this.rules.length; i < len; ++i) {\n+ options.rules.push(this.rules[i].clone());\n+ }\n }\n- return equals;\n+ // clone context\n+ options.context = this.context && OpenLayers.Util.extend({}, this.context);\n+ //clone default style\n+ var defaultStyle = OpenLayers.Util.extend({}, this.defaultStyle);\n+ return new OpenLayers.Style(defaultStyle, options);\n },\n \n+ CLASS_NAME: \"OpenLayers.Style\"\n+});\n+\n+\n+/**\n+ * Function: createLiteral\n+ * converts a style value holding a combination of PropertyName and Literal\n+ * into a Literal, taking the property values from the passed features.\n+ * \n+ * Parameters:\n+ * value - {String} value to parse. If this string contains a construct like\n+ * \"foo ${bar}\", then \"foo \" will be taken as literal, and \"${bar}\"\n+ * will be replaced by the value of the \"bar\" attribute of the passed\n+ * feature.\n+ * context - {Object} context to take attribute values from\n+ * feature - {} optional feature to pass to\n+ * for evaluating functions in the\n+ * context.\n+ * property - {String} optional, name of the property for which the literal is\n+ * being created for evaluating functions in the context.\n+ * \n+ * Returns:\n+ * {String} the parsed value. In the example of the value parameter above, the\n+ * result would be \"foo valueOfBar\", assuming that the passed feature has an\n+ * attribute named \"bar\" with the value \"valueOfBar\".\n+ */\n+OpenLayers.Style.createLiteral = function(value, context, feature, property) {\n+ if (typeof value == \"string\" && value.indexOf(\"${\") != -1) {\n+ value = OpenLayers.String.format(value, context, [feature, property]);\n+ value = (isNaN(value) || !value) ? value : parseFloat(value);\n+ }\n+ return value;\n+};\n+\n+/**\n+ * Constant: OpenLayers.Style.SYMBOLIZER_PREFIXES\n+ * {Array} prefixes of the sld symbolizers. These are the\n+ * same as the main geometry types\n+ */\n+OpenLayers.Style.SYMBOLIZER_PREFIXES = ['Point', 'Line', 'Polygon', 'Text',\n+ 'Raster'\n+];\n+/* ======================================================================\n+ OpenLayers/Rule.js\n+ ====================================================================== */\n+\n+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n+ * full list of contributors). Published under the 2-clause BSD license.\n+ * See license.txt in the OpenLayers distribution or repository for the\n+ * full text of the license. */\n+\n+\n+/**\n+ * @requires OpenLayers/BaseTypes/Class.js\n+ * @requires OpenLayers/Util.js\n+ * @requires OpenLayers/Style.js\n+ */\n+\n+/**\n+ * Class: OpenLayers.Rule\n+ * This class represents an SLD Rule, as being used for rule-based SLD styling.\n+ */\n+OpenLayers.Rule = OpenLayers.Class({\n+\n /**\n- * Method: toShortString\n- *\n- * Returns:\n- * {String} Shortened String representation of Point object. \n- * (ex. \"5, 42\")\n+ * Property: id\n+ * {String} A unique id for this session.\n */\n- toShortString: function() {\n- return (this.x + \", \" + this.y);\n- },\n+ id: null,\n \n /**\n- * APIMethod: move\n- * Moves a geometry by the given displacement along positive x and y axes.\n- * This modifies the position of the geometry and clears the cached\n- * bounds.\n- *\n- * Parameters:\n- * x - {Float} Distance to move geometry in positive x direction. \n- * y - {Float} Distance to move geometry in positive y direction.\n+ * APIProperty: name\n+ * {String} name of this rule\n */\n- move: function(x, y) {\n- this.x = this.x + x;\n- this.y = this.y + y;\n- this.clearBounds();\n- },\n+ name: null,\n \n /**\n- * APIMethod: rotate\n- * Rotate a point around another.\n- *\n- * Parameters:\n- * angle - {Float} Rotation angle in degrees (measured counterclockwise\n- * from the positive x-axis)\n- * origin - {} Center point for the rotation\n+ * Property: title\n+ * {String} Title of this rule (set if included in SLD)\n */\n- rotate: function(angle, origin) {\n- angle *= Math.PI / 180;\n- var radius = this.distanceTo(origin);\n- var theta = angle + Math.atan2(this.y - origin.y, this.x - origin.x);\n- this.x = origin.x + (radius * Math.cos(theta));\n- this.y = origin.y + (radius * Math.sin(theta));\n- this.clearBounds();\n- },\n+ title: null,\n \n /**\n- * APIMethod: getCentroid\n- *\n- * Returns:\n- * {} The centroid of the collection\n+ * Property: description\n+ * {String} Description of this rule (set if abstract is included in SLD)\n */\n- getCentroid: function() {\n- return new OpenLayers.Geometry.Point(this.x, this.y);\n- },\n+ description: null,\n \n /**\n- * APIMethod: resize\n- * Resize a point relative to some origin. For points, this has the effect\n- * of scaling a vector (from the origin to the point). This method is\n- * more useful on geometry collection subclasses.\n+ * Property: context\n+ * {Object} An optional object with properties that the rule should be\n+ * evaluated against. If no context is specified, feature.attributes will\n+ * be used.\n+ */\n+ context: null,\n+\n+ /**\n+ * Property: filter\n+ * {} Optional filter for the rule.\n+ */\n+ filter: null,\n+\n+ /**\n+ * Property: elseFilter\n+ * {Boolean} Determines whether this rule is only to be applied only if\n+ * no other rules match (ElseFilter according to the SLD specification). \n+ * Default is false. For instances of OpenLayers.Rule, if elseFilter is\n+ * false, the rule will always apply. For subclasses, the else property is \n+ * ignored.\n+ */\n+ elseFilter: false,\n+\n+ /**\n+ * Property: symbolizer\n+ * {Object} Symbolizer or hash of symbolizers for this rule. If hash of\n+ * symbolizers, keys are one or more of [\"Point\", \"Line\", \"Polygon\"]. The\n+ * latter if useful if it is required to style e.g. vertices of a line\n+ * with a point symbolizer. Note, however, that this is not implemented\n+ * yet in OpenLayers, but it is the way how symbolizers are defined in\n+ * SLD.\n+ */\n+ symbolizer: null,\n+\n+ /**\n+ * Property: symbolizers\n+ * {Array} Collection of symbolizers associated with this rule. If \n+ * provided at construction, the symbolizers array has precedence\n+ * over the deprecated symbolizer property. Note that multiple \n+ * symbolizers are not currently supported by the vector renderers.\n+ * Rules with multiple symbolizers are currently only useful for\n+ * maintaining elements in an SLD document.\n+ */\n+ symbolizers: null,\n+\n+ /**\n+ * APIProperty: minScaleDenominator\n+ * {Number} or {String} minimum scale at which to draw the feature.\n+ * In the case of a String, this can be a combination of text and\n+ * propertyNames in the form \"literal ${propertyName}\"\n+ */\n+ minScaleDenominator: null,\n+\n+ /**\n+ * APIProperty: maxScaleDenominator\n+ * {Number} or {String} maximum scale at which to draw the feature.\n+ * In the case of a String, this can be a combination of text and\n+ * propertyNames in the form \"literal ${propertyName}\"\n+ */\n+ maxScaleDenominator: null,\n+\n+ /** \n+ * Constructor: OpenLayers.Rule\n+ * Creates a Rule.\n *\n * Parameters:\n- * scale - {Float} Ratio of the new distance from the origin to the old\n- * distance from the origin. A scale of 2 doubles the\n- * distance between the point and origin.\n- * origin - {} Point of origin for resizing\n- * ratio - {Float} Optional x:y ratio for resizing. Default ratio is 1.\n+ * options - {Object} An optional object with properties to set on the\n+ * rule\n * \n * Returns:\n- * {} - The current geometry. \n+ * {}\n */\n- resize: function(scale, origin, ratio) {\n- ratio = (ratio == undefined) ? 1 : ratio;\n- this.x = origin.x + (scale * ratio * (this.x - origin.x));\n- this.y = origin.y + (scale * (this.y - origin.y));\n- this.clearBounds();\n- return this;\n+ initialize: function(options) {\n+ this.symbolizer = {};\n+ OpenLayers.Util.extend(this, options);\n+ if (this.symbolizers) {\n+ delete this.symbolizer;\n+ }\n+ this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + \"_\");\n+ },\n+\n+ /** \n+ * APIMethod: destroy\n+ * nullify references to prevent circular references and memory leaks\n+ */\n+ destroy: function() {\n+ for (var i in this.symbolizer) {\n+ this.symbolizer[i] = null;\n+ }\n+ this.symbolizer = null;\n+ delete this.symbolizers;\n },\n \n /**\n- * APIMethod: intersects\n- * Determine if the input geometry intersects this one.\n- *\n+ * APIMethod: evaluate\n+ * evaluates this rule for a specific feature\n+ * \n * Parameters:\n- * geometry - {} Any type of geometry.\n- *\n+ * feature - {} feature to apply the rule to.\n+ * \n * Returns:\n- * {Boolean} The input geometry intersects this one.\n+ * {Boolean} true if the rule applies, false if it does not.\n+ * This rule is the default rule and always returns true.\n */\n- intersects: function(geometry) {\n- var intersect = false;\n- if (geometry.CLASS_NAME == \"OpenLayers.Geometry.Point\") {\n- intersect = this.equals(geometry);\n- } else {\n- intersect = geometry.intersects(this);\n+ evaluate: function(feature) {\n+ var context = this.getContext(feature);\n+ var applies = true;\n+\n+ if (this.minScaleDenominator || this.maxScaleDenominator) {\n+ var scale = feature.layer.map.getScale();\n }\n- return intersect;\n+\n+ // check if within minScale/maxScale bounds\n+ if (this.minScaleDenominator) {\n+ applies = scale >= OpenLayers.Style.createLiteral(\n+ this.minScaleDenominator, context);\n+ }\n+ if (applies && this.maxScaleDenominator) {\n+ applies = scale < OpenLayers.Style.createLiteral(\n+ this.maxScaleDenominator, context);\n+ }\n+\n+ // check if optional filter applies\n+ if (applies && this.filter) {\n+ // feature id filters get the feature, others get the context\n+ if (this.filter.CLASS_NAME == \"OpenLayers.Filter.FeatureId\") {\n+ applies = this.filter.evaluate(feature);\n+ } else {\n+ applies = this.filter.evaluate(context);\n+ }\n+ }\n+\n+ return applies;\n },\n \n /**\n- * APIMethod: transform\n- * Translate the x,y properties of the point from source to dest.\n+ * Method: getContext\n+ * Gets the context for evaluating this rule\n * \n- * Parameters:\n- * source - {} \n- * dest - {}\n+ * Paramters:\n+ * feature - {} feature to take the context from if\n+ * none is specified.\n+ */\n+ getContext: function(feature) {\n+ var context = this.context;\n+ if (!context) {\n+ context = feature.attributes || feature.data;\n+ }\n+ if (typeof this.context == \"function\") {\n+ context = this.context(feature);\n+ }\n+ return context;\n+ },\n+\n+ /**\n+ * APIMethod: clone\n+ * Clones this rule.\n * \n * Returns:\n- * {} \n+ * {} Clone of this rule.\n */\n- transform: function(source, dest) {\n- if ((source && dest)) {\n- OpenLayers.Projection.transform(\n- this, source, dest);\n- this.bounds = null;\n+ clone: function() {\n+ var options = OpenLayers.Util.extend({}, this);\n+ if (this.symbolizers) {\n+ // clone symbolizers\n+ var len = this.symbolizers.length;\n+ options.symbolizers = new Array(len);\n+ for (var i = 0; i < len; ++i) {\n+ options.symbolizers[i] = this.symbolizers[i].clone();\n+ }\n+ } else {\n+ // clone symbolizer\n+ options.symbolizer = {};\n+ var value, type;\n+ for (var key in this.symbolizer) {\n+ value = this.symbolizer[key];\n+ type = typeof value;\n+ if (type === \"object\") {\n+ options.symbolizer[key] = OpenLayers.Util.extend({}, value);\n+ } else if (type === \"string\") {\n+ options.symbolizer[key] = value;\n+ }\n+ }\n }\n- return this;\n+ // clone filter\n+ options.filter = this.filter && this.filter.clone();\n+ // clone context\n+ options.context = this.context && OpenLayers.Util.extend({}, this.context);\n+ return new OpenLayers.Rule(options);\n },\n \n+ CLASS_NAME: \"OpenLayers.Rule\"\n+});\n+/* ======================================================================\n+ OpenLayers/Symbolizer.js\n+ ====================================================================== */\n+\n+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n+ * full list of contributors). Published under the 2-clause BSD license.\n+ * See license.txt in the OpenLayers distribution or repository for the\n+ * full text of the license. */\n+\n+/**\n+ * @requires OpenLayers/BaseTypes/Class.js\n+ */\n+\n+/**\n+ * Class: OpenLayers.Symbolizer\n+ * Base class representing a symbolizer used for feature rendering.\n+ */\n+OpenLayers.Symbolizer = OpenLayers.Class({\n+\n+\n /**\n- * APIMethod: getVertices\n- * Return a list of all points in this geometry.\n+ * APIProperty: zIndex\n+ * {Number} The zIndex determines the rendering order for a symbolizer.\n+ * Symbolizers with larger zIndex values are rendered over symbolizers\n+ * with smaller zIndex values. Default is 0.\n+ */\n+ zIndex: 0,\n+\n+ /**\n+ * Constructor: OpenLayers.Symbolizer\n+ * Instances of this class are not useful. See one of the subclasses.\n *\n * Parameters:\n- * nodes - {Boolean} For lines, only return vertices that are\n- * endpoints. If false, for lines, only vertices that are not\n- * endpoints will be returned. If not provided, all vertices will\n- * be returned.\n+ * config - {Object} An object containing properties to be set on the \n+ * symbolizer. Any documented symbolizer property can be set at \n+ * construction.\n *\n * Returns:\n- * {Array} A list of all vertices in the geometry.\n+ * A new symbolizer.\n */\n- getVertices: function(nodes) {\n- return [this];\n+ initialize: function(config) {\n+ OpenLayers.Util.extend(this, config);\n },\n \n- CLASS_NAME: \"OpenLayers.Geometry.Point\"\n+ /** \n+ * APIMethod: clone\n+ * Create a copy of this symbolizer.\n+ *\n+ * Returns a symbolizer of the same type with the same properties.\n+ */\n+ clone: function() {\n+ var Type = eval(this.CLASS_NAME);\n+ return new Type(OpenLayers.Util.extend({}, this));\n+ },\n+\n+ CLASS_NAME: \"OpenLayers.Symbolizer\"\n+\n });\n+\n /* ======================================================================\n- OpenLayers/Geometry/Collection.js\n+ OpenLayers/Symbolizer/Point.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n * See license.txt in the OpenLayers distribution or repository for the\n * full text of the license. */\n \n /**\n- * @requires OpenLayers/Geometry.js\n+ * @requires OpenLayers/Symbolizer.js\n */\n \n /**\n- * Class: OpenLayers.Geometry.Collection\n- * A Collection is exactly what it sounds like: A collection of different \n- * Geometries. These are stored in the local parameter (which\n- * can be passed as a parameter to the constructor). \n- * \n- * As new geometries are added to the collection, they are NOT cloned. \n- * When removing geometries, they need to be specified by reference (ie you \n- * have to pass in the *exact* geometry to be removed).\n- * \n- * The and functions here merely iterate through\n- * the components, summing their respective areas and lengths.\n- *\n- * Create a new instance with the constructor.\n- *\n- * Inherits from:\n- * - \n+ * Class: OpenLayers.Symbolizer.Point\n+ * A symbolizer used to render point features.\n */\n-OpenLayers.Geometry.Collection = OpenLayers.Class(OpenLayers.Geometry, {\n+OpenLayers.Symbolizer.Point = OpenLayers.Class(OpenLayers.Symbolizer, {\n \n /**\n- * APIProperty: components\n- * {Array()} The component parts of this geometry\n+ * APIProperty: strokeColor\n+ * {String} Color for line stroke. This is a RGB hex value (e.g. \"#ff0000\"\n+ * for red).\n+ * \n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n */\n- components: null,\n \n /**\n- * Property: componentTypes\n- * {Array(String)} An array of class names representing the types of\n- * components that the collection can include. A null value means the\n- * component types are not restricted.\n+ * APIProperty: strokeOpacity\n+ * {Number} Stroke opacity (0-1).\n+ * \n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n */\n- componentTypes: null,\n \n /**\n- * Constructor: OpenLayers.Geometry.Collection\n- * Creates a Geometry Collection -- a list of geoms.\n- *\n- * Parameters: \n- * components - {Array()} Optional array of geometries\n- *\n+ * APIProperty: strokeWidth\n+ * {Number} Pixel stroke width.\n+ * \n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n */\n- initialize: function(components) {\n- OpenLayers.Geometry.prototype.initialize.apply(this, arguments);\n- this.components = [];\n- if (components != null) {\n- this.addComponents(components);\n- }\n- },\n \n /**\n- * APIMethod: destroy\n- * Destroy this geometry.\n+ * APIProperty: strokeLinecap\n+ * {String} Stroke cap type (\"butt\", \"round\", or \"square\").\n+ * \n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n */\n- destroy: function() {\n- this.components.length = 0;\n- this.components = null;\n- OpenLayers.Geometry.prototype.destroy.apply(this, arguments);\n- },\n \n /**\n- * APIMethod: clone\n- * Clone this geometry.\n- *\n- * Returns:\n- * {} An exact clone of this collection\n+ * Property: strokeDashstyle\n+ * {String} Stroke dash style according to the SLD spec. Note that the\n+ * OpenLayers values for strokeDashstyle (\"dot\", \"dash\", \"dashdot\",\n+ * \"longdash\", \"longdashdot\", or \"solid\") will not work in SLD, but\n+ * most SLD patterns will render correctly in OpenLayers.\n+ * \n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n */\n- clone: function() {\n- var geometry = eval(\"new \" + this.CLASS_NAME + \"()\");\n- for (var i = 0, len = this.components.length; i < len; i++) {\n- geometry.addComponent(this.components[i].clone());\n- }\n \n- // catch any randomly tagged-on properties\n- OpenLayers.Util.applyDefaults(geometry, this);\n+ /**\n+ * APIProperty: fillColor\n+ * {String} RGB hex fill color (e.g. \"#ff0000\" for red).\n+ * \n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n+ */\n \n- return geometry;\n- },\n+ /**\n+ * APIProperty: fillOpacity\n+ * {Number} Fill opacity (0-1).\n+ * \n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n+ */\n \n /**\n- * Method: getComponentsString\n- * Get a string representing the components for this collection\n+ * APIProperty: pointRadius\n+ * {Number} Pixel point radius.\n * \n- * Returns:\n- * {String} A string representation of the components of this geometry\n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n */\n- getComponentsString: function() {\n- var strings = [];\n- for (var i = 0, len = this.components.length; i < len; i++) {\n- strings.push(this.components[i].toShortString());\n- }\n- return strings.join(\",\");\n- },\n \n /**\n- * APIMethod: calculateBounds\n- * Recalculate the bounds by iterating through the components and \n- * calling calling extendBounds() on each item.\n+ * APIProperty: externalGraphic\n+ * {String} Url to an external graphic that will be used for rendering \n+ * points.\n+ * \n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n */\n- calculateBounds: function() {\n- this.bounds = null;\n- var bounds = new OpenLayers.Bounds();\n- var components = this.components;\n- if (components) {\n- for (var i = 0, len = components.length; i < len; i++) {\n- bounds.extend(components[i].getBounds());\n- }\n- }\n- // to preserve old behavior, we only set bounds if non-null\n- // in the future, we could add bounds.isEmpty()\n- if (bounds.left != null && bounds.bottom != null &&\n- bounds.right != null && bounds.top != null) {\n- this.setBounds(bounds);\n- }\n- },\n \n /**\n- * APIMethod: addComponents\n- * Add components to this geometry.\n- *\n- * Parameters:\n- * components - {Array()} An array of geometries to add\n+ * APIProperty: graphicWidth\n+ * {Number} Pixel width for sizing an external graphic.\n+ * \n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n */\n- addComponents: function(components) {\n- if (!(OpenLayers.Util.isArray(components))) {\n- components = [components];\n- }\n- for (var i = 0, len = components.length; i < len; i++) {\n- this.addComponent(components[i]);\n- }\n- },\n \n /**\n- * Method: addComponent\n- * Add a new component (geometry) to the collection. If this.componentTypes\n- * is set, then the component class name must be in the componentTypes array.\n- *\n- * The bounds cache is reset.\n+ * APIProperty: graphicHeight\n+ * {Number} Pixel height for sizing an external graphic.\n * \n- * Parameters:\n- * component - {} A geometry to add\n- * index - {int} Optional index into the array to insert the component\n- *\n- * Returns:\n- * {Boolean} The component geometry was successfully added\n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n */\n- addComponent: function(component, index) {\n- var added = false;\n- if (component) {\n- if (this.componentTypes == null ||\n- (OpenLayers.Util.indexOf(this.componentTypes,\n- component.CLASS_NAME) > -1)) {\n \n- if (index != null && (index < this.components.length)) {\n- var components1 = this.components.slice(0, index);\n- var components2 = this.components.slice(index,\n- this.components.length);\n- components1.push(component);\n- this.components = components1.concat(components2);\n- } else {\n- this.components.push(component);\n- }\n- component.parent = this;\n- this.clearBounds();\n- added = true;\n- }\n- }\n- return added;\n- },\n+ /**\n+ * APIProperty: graphicOpacity\n+ * {Number} Opacity (0-1) for an external graphic.\n+ * \n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n+ */\n \n /**\n- * APIMethod: removeComponents\n- * Remove components from this geometry.\n- *\n- * Parameters:\n- * components - {Array()} The components to be removed\n- *\n- * Returns: \n- * {Boolean} A component was removed.\n+ * APIProperty: graphicXOffset\n+ * {Number} Pixel offset along the positive x axis for displacing an \n+ * external graphic.\n+ * \n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n */\n- removeComponents: function(components) {\n- var removed = false;\n \n- if (!(OpenLayers.Util.isArray(components))) {\n- components = [components];\n- }\n- for (var i = components.length - 1; i >= 0; --i) {\n- removed = this.removeComponent(components[i]) || removed;\n- }\n- return removed;\n- },\n+ /**\n+ * APIProperty: graphicYOffset\n+ * {Number} Pixel offset along the positive y axis for displacing an \n+ * external graphic.\n+ * \n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n+ */\n \n /**\n- * Method: removeComponent\n- * Remove a component from this geometry.\n+ * APIProperty: rotation\n+ * {Number} The rotation of a graphic in the clockwise direction about its \n+ * center point (or any point off center as specified by \n+ * and ).\n+ * \n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n+ */\n+\n+ /**\n+ * APIProperty: graphicName\n+ * {String} Named graphic to use when rendering points. Supported values \n+ * include \"circle\", \"square\", \"star\", \"x\", \"cross\", and \"triangle\".\n+ * \n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n+ */\n+\n+ /**\n+ * Constructor: OpenLayers.Symbolizer.Point\n+ * Create a symbolizer for rendering points.\n *\n * Parameters:\n- * component - {} \n+ * config - {Object} An object containing properties to be set on the \n+ * symbolizer. Any documented symbolizer property can be set at \n+ * construction.\n *\n- * Returns: \n- * {Boolean} The component was removed.\n+ * Returns:\n+ * A new point symbolizer.\n */\n- removeComponent: function(component) {\n+ initialize: function(config) {\n+ OpenLayers.Symbolizer.prototype.initialize.apply(this, arguments);\n+ },\n \n- OpenLayers.Util.removeItem(this.components, component);\n+ CLASS_NAME: \"OpenLayers.Symbolizer.Point\"\n \n- // clearBounds() so that it gets recalculated on the next call\n- // to this.getBounds();\n- this.clearBounds();\n- return true;\n- },\n+});\n+\n+/* ======================================================================\n+ OpenLayers/Symbolizer/Line.js\n+ ====================================================================== */\n+\n+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n+ * full list of contributors). Published under the 2-clause BSD license.\n+ * See license.txt in the OpenLayers distribution or repository for the\n+ * full text of the license. */\n+\n+/**\n+ * @requires OpenLayers/Symbolizer.js\n+ */\n+\n+/**\n+ * Class: OpenLayers.Symbolizer.Line\n+ * A symbolizer used to render line features.\n+ */\n+OpenLayers.Symbolizer.Line = OpenLayers.Class(OpenLayers.Symbolizer, {\n \n /**\n- * APIMethod: getLength\n- * Calculate the length of this geometry\n- *\n- * Returns:\n- * {Float} The length of the geometry\n+ * APIProperty: strokeColor\n+ * {String} Color for line stroke. This is a RGB hex value (e.g. \"#ff0000\"\n+ * for red). \n+ * \n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n */\n- getLength: function() {\n- var length = 0.0;\n- for (var i = 0, len = this.components.length; i < len; i++) {\n- length += this.components[i].getLength();\n- }\n- return length;\n- },\n \n /**\n- * APIMethod: getArea\n- * Calculate the area of this geometry. Note how this function is overridden\n- * in .\n- *\n- * Returns:\n- * {Float} The area of the collection by summing its parts\n+ * APIProperty: strokeOpacity\n+ * {Number} Stroke opacity (0-1).\n+ * \n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n */\n- getArea: function() {\n- var area = 0.0;\n- for (var i = 0, len = this.components.length; i < len; i++) {\n- area += this.components[i].getArea();\n- }\n- return area;\n- },\n \n- /** \n- * APIMethod: getGeodesicArea\n- * Calculate the approximate area of the polygon were it projected onto\n- * the earth.\n- *\n- * Parameters:\n- * projection - {} The spatial reference system\n- * for the geometry coordinates. If not provided, Geographic/WGS84 is\n- * assumed.\n+ /**\n+ * APIProperty: strokeWidth\n+ * {Number} Pixel stroke width.\n * \n- * Reference:\n- * Robert. G. Chamberlain and William H. Duquette, \"Some Algorithms for\n- * Polygons on a Sphere\", JPL Publication 07-03, Jet Propulsion\n- * Laboratory, Pasadena, CA, June 2007 http://trs-new.jpl.nasa.gov/dspace/handle/2014/40409\n- *\n- * Returns:\n- * {float} The approximate geodesic area of the geometry in square meters.\n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n */\n- getGeodesicArea: function(projection) {\n- var area = 0.0;\n- for (var i = 0, len = this.components.length; i < len; i++) {\n- area += this.components[i].getGeodesicArea(projection);\n- }\n- return area;\n- },\n \n /**\n- * APIMethod: getCentroid\n- *\n- * Compute the centroid for this geometry collection.\n+ * APIProperty: strokeLinecap\n+ * {String} Stroke cap type (\"butt\", \"round\", or \"square\").\n+ * \n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n+ */\n+\n+ /**\n+ * Property: strokeDashstyle\n+ * {String} Stroke dash style according to the SLD spec. Note that the\n+ * OpenLayers values for strokeDashstyle (\"dot\", \"dash\", \"dashdot\",\n+ * \"longdash\", \"longdashdot\", or \"solid\") will not work in SLD, but\n+ * most SLD patterns will render correctly in OpenLayers.\n+ * \n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n+ */\n+\n+ /**\n+ * Constructor: OpenLayers.Symbolizer.Line\n+ * Create a symbolizer for rendering lines.\n *\n * Parameters:\n- * weighted - {Boolean} Perform the getCentroid computation recursively,\n- * returning an area weighted average of all geometries in this collection.\n+ * config - {Object} An object containing properties to be set on the \n+ * symbolizer. Any documented symbolizer property can be set at \n+ * construction.\n *\n * Returns:\n- * {} The centroid of the collection\n+ * A new line symbolizer.\n */\n- getCentroid: function(weighted) {\n- if (!weighted) {\n- return this.components.length && this.components[0].getCentroid();\n- }\n- var len = this.components.length;\n- if (!len) {\n- return false;\n- }\n+ initialize: function(config) {\n+ OpenLayers.Symbolizer.prototype.initialize.apply(this, arguments);\n+ },\n \n- var areas = [];\n- var centroids = [];\n- var areaSum = 0;\n- var minArea = Number.MAX_VALUE;\n- var component;\n- for (var i = 0; i < len; ++i) {\n- component = this.components[i];\n- var area = component.getArea();\n- var centroid = component.getCentroid(true);\n- if (isNaN(area) || isNaN(centroid.x) || isNaN(centroid.y)) {\n- continue;\n- }\n- areas.push(area);\n- areaSum += area;\n- minArea = (area < minArea && area > 0) ? area : minArea;\n- centroids.push(centroid);\n- }\n- len = areas.length;\n- if (areaSum === 0) {\n- // all the components in this collection have 0 area\n- // probably a collection of points -- weight all the points the same\n- for (var i = 0; i < len; ++i) {\n- areas[i] = 1;\n- }\n- areaSum = areas.length;\n- } else {\n- // normalize all the areas where the smallest area will get\n- // a value of 1\n- for (var i = 0; i < len; ++i) {\n- areas[i] /= minArea;\n- }\n- areaSum /= minArea;\n- }\n+ CLASS_NAME: \"OpenLayers.Symbolizer.Line\"\n \n- var xSum = 0,\n- ySum = 0,\n- centroid, area;\n- for (var i = 0; i < len; ++i) {\n- centroid = centroids[i];\n- area = areas[i];\n- xSum += centroid.x * area;\n- ySum += centroid.y * area;\n- }\n+});\n \n- return new OpenLayers.Geometry.Point(xSum / areaSum, ySum / areaSum);\n- },\n+/* ======================================================================\n+ OpenLayers/Symbolizer/Polygon.js\n+ ====================================================================== */\n+\n+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n+ * full list of contributors). Published under the 2-clause BSD license.\n+ * See license.txt in the OpenLayers distribution or repository for the\n+ * full text of the license. */\n+\n+/**\n+ * @requires OpenLayers/Symbolizer.js\n+ */\n+\n+/**\n+ * Class: OpenLayers.Symbolizer.Polygon\n+ * A symbolizer used to render line features.\n+ */\n+OpenLayers.Symbolizer.Polygon = OpenLayers.Class(OpenLayers.Symbolizer, {\n \n /**\n- * APIMethod: getGeodesicLength\n- * Calculate the approximate length of the geometry were it projected onto\n- * the earth.\n- *\n- * projection - {} The spatial reference system\n- * for the geometry coordinates. If not provided, Geographic/WGS84 is\n- * assumed.\n+ * APIProperty: strokeColor\n+ * {String} Color for line stroke. This is a RGB hex value (e.g. \"#ff0000\"\n+ * for red).\n * \n- * Returns:\n- * {Float} The appoximate geodesic length of the geometry in meters.\n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n */\n- getGeodesicLength: function(projection) {\n- var length = 0.0;\n- for (var i = 0, len = this.components.length; i < len; i++) {\n- length += this.components[i].getGeodesicLength(projection);\n- }\n- return length;\n- },\n \n /**\n- * APIMethod: move\n- * Moves a geometry by the given displacement along positive x and y axes.\n- * This modifies the position of the geometry and clears the cached\n- * bounds.\n- *\n- * Parameters:\n- * x - {Float} Distance to move geometry in positive x direction. \n- * y - {Float} Distance to move geometry in positive y direction.\n+ * APIProperty: strokeOpacity\n+ * {Number} Stroke opacity (0-1).\n+ * \n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n */\n- move: function(x, y) {\n- for (var i = 0, len = this.components.length; i < len; i++) {\n- this.components[i].move(x, y);\n- }\n- },\n \n /**\n- * APIMethod: rotate\n- * Rotate a geometry around some origin\n- *\n- * Parameters:\n- * angle - {Float} Rotation angle in degrees (measured counterclockwise\n- * from the positive x-axis)\n- * origin - {} Center point for the rotation\n+ * APIProperty: strokeWidth\n+ * {Number} Pixel stroke width.\n+ * \n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n */\n- rotate: function(angle, origin) {\n- for (var i = 0, len = this.components.length; i < len; ++i) {\n- this.components[i].rotate(angle, origin);\n- }\n- },\n \n /**\n- * APIMethod: resize\n- * Resize a geometry relative to some origin. Use this method to apply\n- * a uniform scaling to a geometry.\n- *\n- * Parameters:\n- * scale - {Float} Factor by which to scale the geometry. A scale of 2\n- * doubles the size of the geometry in each dimension\n- * (lines, for example, will be twice as long, and polygons\n- * will have four times the area).\n- * origin - {} Point of origin for resizing\n- * ratio - {Float} Optional x:y ratio for resizing. Default ratio is 1.\n+ * APIProperty: strokeLinecap\n+ * {String} Stroke cap type (\"butt\", \"round\", or \"square\").\n * \n- * Returns:\n- * {} - The current geometry. \n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n */\n- resize: function(scale, origin, ratio) {\n- for (var i = 0; i < this.components.length; ++i) {\n- this.components[i].resize(scale, origin, ratio);\n- }\n- return this;\n- },\n \n /**\n- * APIMethod: distanceTo\n- * Calculate the closest distance between two geometries (on the x-y plane).\n+ * Property: strokeDashstyle\n+ * {String} Stroke dash style according to the SLD spec. Note that the\n+ * OpenLayers values for strokeDashstyle (\"dot\", \"dash\", \"dashdot\",\n+ * \"longdash\", \"longdashdot\", or \"solid\") will not work in SLD, but\n+ * most SLD patterns will render correctly in OpenLayers.\n+ * \n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n+ */\n+\n+ /**\n+ * APIProperty: fillColor\n+ * {String} RGB hex fill color (e.g. \"#ff0000\" for red).\n+ * \n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n+ */\n+\n+ /**\n+ * APIProperty: fillOpacity\n+ * {Number} Fill opacity (0-1).\n+ * \n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n+ */\n+\n+ /**\n+ * Constructor: OpenLayers.Symbolizer.Polygon\n+ * Create a symbolizer for rendering polygons.\n *\n * Parameters:\n- * geometry - {} The target geometry.\n- * options - {Object} Optional properties for configuring the distance\n- * calculation.\n- *\n- * Valid options:\n- * details - {Boolean} Return details from the distance calculation.\n- * Default is false.\n- * edge - {Boolean} Calculate the distance from this geometry to the\n- * nearest edge of the target geometry. Default is true. If true,\n- * calling distanceTo from a geometry that is wholly contained within\n- * the target will result in a non-zero distance. If false, whenever\n- * geometries intersect, calling distanceTo will return 0. If false,\n- * details cannot be returned.\n+ * config - {Object} An object containing properties to be set on the \n+ * symbolizer. Any documented symbolizer property can be set at \n+ * construction.\n *\n * Returns:\n- * {Number | Object} The distance between this geometry and the target.\n- * If details is true, the return will be an object with distance,\n- * x0, y0, x1, and y1 properties. The x0 and y0 properties represent\n- * the coordinates of the closest point on this geometry. The x1 and y1\n- * properties represent the coordinates of the closest point on the\n- * target geometry.\n+ * A new polygon symbolizer.\n */\n- distanceTo: function(geometry, options) {\n- var edge = !(options && options.edge === false);\n- var details = edge && options && options.details;\n- var result, best, distance;\n- var min = Number.POSITIVE_INFINITY;\n- for (var i = 0, len = this.components.length; i < len; ++i) {\n- result = this.components[i].distanceTo(geometry, options);\n- distance = details ? result.distance : result;\n- if (distance < min) {\n- min = distance;\n- best = result;\n- if (min == 0) {\n- break;\n- }\n- }\n- }\n- return best;\n+ initialize: function(config) {\n+ OpenLayers.Symbolizer.prototype.initialize.apply(this, arguments);\n },\n \n+ CLASS_NAME: \"OpenLayers.Symbolizer.Polygon\"\n+\n+});\n+\n+/* ======================================================================\n+ OpenLayers/Symbolizer/Text.js\n+ ====================================================================== */\n+\n+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n+ * full list of contributors). Published under the 2-clause BSD license.\n+ * See license.txt in the OpenLayers distribution or repository for the\n+ * full text of the license. */\n+\n+/**\n+ * @requires OpenLayers/Symbolizer.js\n+ */\n+\n+/**\n+ * Class: OpenLayers.Symbolizer.Text\n+ * A symbolizer used to render text labels for features.\n+ */\n+OpenLayers.Symbolizer.Text = OpenLayers.Class(OpenLayers.Symbolizer, {\n+\n /** \n- * APIMethod: equals\n- * Determine whether another geometry is equivalent to this one. Geometries\n- * are considered equivalent if all components have the same coordinates.\n+ * APIProperty: label\n+ * {String} The text for the label.\n * \n- * Parameters:\n- * geometry - {} The geometry to test. \n- *\n- * Returns:\n- * {Boolean} The supplied geometry is equivalent to this geometry.\n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n */\n- equals: function(geometry) {\n- var equivalent = true;\n- if (!geometry || !geometry.CLASS_NAME ||\n- (this.CLASS_NAME != geometry.CLASS_NAME)) {\n- equivalent = false;\n- } else if (!(OpenLayers.Util.isArray(geometry.components)) ||\n- (geometry.components.length != this.components.length)) {\n- equivalent = false;\n- } else {\n- for (var i = 0, len = this.components.length; i < len; ++i) {\n- if (!this.components[i].equals(geometry.components[i])) {\n- equivalent = false;\n- break;\n- }\n- }\n- }\n- return equivalent;\n- },\n \n- /**\n- * APIMethod: transform\n- * Reproject the components geometry from source to dest.\n+ /** \n+ * APIProperty: fontFamily\n+ * {String} The font family for the label.\n * \n- * Parameters:\n- * source - {} \n- * dest - {}\n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n+ */\n+\n+ /** \n+ * APIProperty: fontSize\n+ * {String} The font size for the label.\n * \n- * Returns:\n- * {} \n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n+ */\n+\n+ /** \n+ * APIProperty: fontWeight\n+ * {String} The font weight for the label.\n+ * \n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n */\n- transform: function(source, dest) {\n- if (source && dest) {\n- for (var i = 0, len = this.components.length; i < len; i++) {\n- var component = this.components[i];\n- component.transform(source, dest);\n- }\n- this.bounds = null;\n- }\n- return this;\n- },\n \n /**\n- * APIMethod: intersects\n- * Determine if the input geometry intersects this one.\n- *\n- * Parameters:\n- * geometry - {} Any type of geometry.\n- *\n- * Returns:\n- * {Boolean} The input geometry intersects this one.\n+ * Property: fontStyle\n+ * {String} The font style for the label.\n+ * \n+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n */\n- intersects: function(geometry) {\n- var intersect = false;\n- for (var i = 0, len = this.components.length; i < len; ++i) {\n- intersect = geometry.intersects(this.components[i]);\n- if (intersect) {\n- break;\n- }\n- }\n- return intersect;\n- },\n \n /**\n- * APIMethod: getVertices\n- * Return a list of all points in this geometry.\n+ * Constructor: OpenLayers.Symbolizer.Text\n+ * Create a symbolizer for rendering text labels.\n *\n * Parameters:\n- * nodes - {Boolean} For lines, only return vertices that are\n- * endpoints. If false, for lines, only vertices that are not\n- * endpoints will be returned. If not provided, all vertices will\n- * be returned.\n+ * config - {Object} An object containing properties to be set on the \n+ * symbolizer. Any documented symbolizer property can be set at \n+ * construction.\n *\n * Returns:\n- * {Array} A list of all vertices in the geometry.\n+ * A new text symbolizer.\n */\n- getVertices: function(nodes) {\n- var vertices = [];\n- for (var i = 0, len = this.components.length; i < len; ++i) {\n- Array.prototype.push.apply(\n- vertices, this.components[i].getVertices(nodes)\n- );\n- }\n- return vertices;\n+ initialize: function(config) {\n+ OpenLayers.Symbolizer.prototype.initialize.apply(this, arguments);\n },\n \n+ CLASS_NAME: \"OpenLayers.Symbolizer.Text\"\n \n- CLASS_NAME: \"OpenLayers.Geometry.Collection\"\n });\n+\n /* ======================================================================\n- OpenLayers/Geometry/MultiPoint.js\n+ OpenLayers/Symbolizer/Raster.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n * See license.txt in the OpenLayers distribution or repository for the\n * full text of the license. */\n \n /**\n- * @requires OpenLayers/Geometry/Collection.js\n- * @requires OpenLayers/Geometry/Point.js\n+ * @requires OpenLayers/Symbolizer.js\n */\n \n /**\n- * Class: OpenLayers.Geometry.MultiPoint\n- * MultiPoint is a collection of Points. Create a new instance with the\n- * constructor.\n- *\n- * Inherits from:\n- * - \n- * - \n+ * Class: OpenLayers.Symbolizer.Raster\n+ * A symbolizer used to render raster images.\n */\n-OpenLayers.Geometry.MultiPoint = OpenLayers.Class(\n- OpenLayers.Geometry.Collection, {\n-\n- /**\n- * Property: componentTypes\n- * {Array(String)} An array of class names representing the types of\n- * components that the collection can include. A null value means the\n- * component types are not restricted.\n- */\n- componentTypes: [\"OpenLayers.Geometry.Point\"],\n-\n- /**\n- * Constructor: OpenLayers.Geometry.MultiPoint\n- * Create a new MultiPoint Geometry\n- *\n- * Parameters:\n- * components - {Array()} \n- *\n- * Returns:\n- * {}\n- */\n+OpenLayers.Symbolizer.Raster = OpenLayers.Class(OpenLayers.Symbolizer, {\n \n- /**\n- * APIMethod: addPoint\n- * Wrapper for \n- *\n- * Parameters:\n- * point - {} Point to be added\n- * index - {Integer} Optional index\n- */\n- addPoint: function(point, index) {\n- this.addComponent(point, index);\n- },\n+ /**\n+ * Constructor: OpenLayers.Symbolizer.Raster\n+ * Create a symbolizer for rendering rasters.\n+ *\n+ * Parameters:\n+ * config - {Object} An object containing properties to be set on the \n+ * symbolizer. Any documented symbolizer property can be set at \n+ * construction.\n+ *\n+ * Returns:\n+ * A new raster symbolizer.\n+ */\n+ initialize: function(config) {\n+ OpenLayers.Symbolizer.prototype.initialize.apply(this, arguments);\n+ },\n \n- /**\n- * APIMethod: removePoint\n- * Wrapper for \n- *\n- * Parameters:\n- * point - {} Point to be removed\n- */\n- removePoint: function(point) {\n- this.removeComponent(point);\n- },\n+ CLASS_NAME: \"OpenLayers.Symbolizer.Raster\"\n \n- CLASS_NAME: \"OpenLayers.Geometry.MultiPoint\"\n- });\n+});\n /* ======================================================================\n- OpenLayers/Geometry/Curve.js\n+ OpenLayers/Style2.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n * See license.txt in the OpenLayers distribution or repository for the\n * full text of the license. */\n \n /**\n- * @requires OpenLayers/Geometry/MultiPoint.js\n+ * @requires OpenLayers/BaseTypes/Class.js\n+ * @requires OpenLayers/Rule.js\n+ * @requires OpenLayers/Symbolizer/Point.js\n+ * @requires OpenLayers/Symbolizer/Line.js\n+ * @requires OpenLayers/Symbolizer/Polygon.js\n+ * @requires OpenLayers/Symbolizer/Text.js\n+ * @requires OpenLayers/Symbolizer/Raster.js\n */\n \n /**\n- * Class: OpenLayers.Geometry.Curve\n- * A Curve is a MultiPoint, whose points are assumed to be connected. To \n- * this end, we provide a \"getLength()\" function, which iterates through \n- * the points, summing the distances between them. \n- * \n- * Inherits: \n- * - \n+ * Class: OpenLayers.Style2\n+ * This class represents a collection of rules for rendering features.\n */\n-OpenLayers.Geometry.Curve = OpenLayers.Class(OpenLayers.Geometry.MultiPoint, {\n+OpenLayers.Style2 = OpenLayers.Class({\n \n /**\n- * Property: componentTypes\n- * {Array(String)} An array of class names representing the types of \n- * components that the collection can include. A null \n- * value means the component types are not restricted.\n+ * Property: id\n+ * {String} A unique id for this session.\n */\n- componentTypes: [\"OpenLayers.Geometry.Point\"],\n+ id: null,\n \n /**\n- * Constructor: OpenLayers.Geometry.Curve\n- * \n- * Parameters:\n- * point - {Array()}\n+ * APIProperty: name\n+ * {String} Style identifier.\n */\n+ name: null,\n \n /**\n- * APIMethod: getLength\n- * \n+ * APIProperty: title\n+ * {String} Title of this style.\n+ */\n+ title: null,\n+\n+ /**\n+ * APIProperty: description\n+ * {String} Description of this style.\n+ */\n+ description: null,\n+\n+ /**\n+ * APIProperty: layerName\n+ * {} Name of the layer that this style belongs to, usually\n+ * according to the NamedLayer attribute of an SLD document.\n+ */\n+ layerName: null,\n+\n+ /**\n+ * APIProperty: isDefault\n+ * {Boolean}\n+ */\n+ isDefault: false,\n+\n+ /** \n+ * APIProperty: rules \n+ * {Array()} Collection of rendering rules.\n+ */\n+ rules: null,\n+\n+ /** \n+ * Constructor: OpenLayers.Style2\n+ * Creates a style representing a collection of rendering rules.\n+ *\n+ * Parameters:\n+ * config - {Object} An object containing properties to be set on the \n+ * style. Any documented properties may be set at construction.\n+ *\n * Returns:\n- * {Float} The length of the curve\n+ * {} A new style object.\n */\n- getLength: function() {\n- var length = 0.0;\n- if (this.components && (this.components.length > 1)) {\n- for (var i = 1, len = this.components.length; i < len; i++) {\n- length += this.components[i - 1].distanceTo(this.components[i]);\n- }\n+ initialize: function(config) {\n+ OpenLayers.Util.extend(this, config);\n+ this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + \"_\");\n+ },\n+\n+ /** \n+ * APIMethod: destroy\n+ * nullify references to prevent circular references and memory leaks\n+ */\n+ destroy: function() {\n+ for (var i = 0, len = this.rules.length; i < len; i++) {\n+ this.rules[i].destroy();\n }\n- return length;\n+ delete this.rules;\n },\n \n /**\n- * APIMethod: getGeodesicLength\n- * Calculate the approximate length of the geometry were it projected onto\n- * the earth.\n- *\n- * projection - {} The spatial reference system\n- * for the geometry coordinates. If not provided, Geographic/WGS84 is\n- * assumed.\n+ * APIMethod: clone\n+ * Clones this style.\n * \n * Returns:\n- * {Float} The appoximate geodesic length of the geometry in meters.\n+ * {} Clone of this style.\n */\n- getGeodesicLength: function(projection) {\n- var geom = this; // so we can work with a clone if needed\n- if (projection) {\n- var gg = new OpenLayers.Projection(\"EPSG:4326\");\n- if (!gg.equals(projection)) {\n- geom = this.clone().transform(projection, gg);\n- }\n- }\n- var length = 0.0;\n- if (geom.components && (geom.components.length > 1)) {\n- var p1, p2;\n- for (var i = 1, len = geom.components.length; i < len; i++) {\n- p1 = geom.components[i - 1];\n- p2 = geom.components[i];\n- // this returns km and requires lon/lat properties\n- length += OpenLayers.Util.distVincenty({\n- lon: p1.x,\n- lat: p1.y\n- }, {\n- lon: p2.x,\n- lat: p2.y\n- });\n+ clone: function() {\n+ var config = OpenLayers.Util.extend({}, this);\n+ // clone rules\n+ if (this.rules) {\n+ config.rules = [];\n+ for (var i = 0, len = this.rules.length; i < len; ++i) {\n+ config.rules.push(this.rules[i].clone());\n }\n }\n- // convert to m\n- return length * 1000;\n+ return new OpenLayers.Style2(config);\n },\n \n- CLASS_NAME: \"OpenLayers.Geometry.Curve\"\n+ CLASS_NAME: \"OpenLayers.Style2\"\n });\n /* ======================================================================\n- OpenLayers/Geometry/LineString.js\n+ OpenLayers/Projection.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n * See license.txt in the OpenLayers distribution or repository for the\n * full text of the license. */\n \n /**\n- * @requires OpenLayers/Geometry/Curve.js\n+ * @requires OpenLayers/BaseTypes/Class.js\n+ * @requires OpenLayers/Util.js\n */\n \n /**\n- * Class: OpenLayers.Geometry.LineString\n- * A LineString is a Curve which, once two points have been added to it, can \n- * never be less than two points long.\n- * \n- * Inherits from:\n- * - \n+ * Namespace: OpenLayers.Projection\n+ * Methods for coordinate transforms between coordinate systems. By default,\n+ * OpenLayers ships with the ability to transform coordinates between\n+ * geographic (EPSG:4326) and web or spherical mercator (EPSG:900913 et al.)\n+ * coordinate reference systems. See the method for details\n+ * on usage.\n+ *\n+ * Additional transforms may be added by using the \n+ * library. If the proj4js library is included, the method \n+ * will work between any two coordinate reference systems with proj4js \n+ * definitions.\n+ *\n+ * If the proj4js library is not included, or if you wish to allow transforms\n+ * between arbitrary coordinate reference systems, use the \n+ * method to register a custom transform method.\n */\n-OpenLayers.Geometry.LineString = OpenLayers.Class(OpenLayers.Geometry.Curve, {\n+OpenLayers.Projection = OpenLayers.Class({\n \n /**\n- * Constructor: OpenLayers.Geometry.LineString\n- * Create a new LineString geometry\n- *\n- * Parameters:\n- * points - {Array()} An array of points used to\n- * generate the linestring\n- *\n+ * Property: proj\n+ * {Object} Proj4js.Proj instance.\n */\n+ proj: null,\n \n /**\n- * APIMethod: removeComponent\n- * Only allows removal of a point if there are three or more points in \n- * the linestring. (otherwise the result would be just a single point)\n- *\n- * Parameters: \n- * point - {} The point to be removed\n- *\n- * Returns: \n- * {Boolean} The component was removed.\n+ * Property: projCode\n+ * {String}\n */\n- removeComponent: function(point) {\n- var removed = this.components && (this.components.length > 2);\n- if (removed) {\n- OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,\n- arguments);\n- }\n- return removed;\n- },\n+ projCode: null,\n \n /**\n- * APIMethod: intersects\n- * Test for instersection between two geometries. This is a cheapo\n- * implementation of the Bently-Ottmann algorigithm. It doesn't\n- * really keep track of a sweep line data structure. It is closer\n- * to the brute force method, except that segments are sorted and\n- * potential intersections are only calculated when bounding boxes\n- * intersect.\n+ * Property: titleRegEx\n+ * {RegExp} regular expression to strip the title from a proj4js definition\n+ */\n+ titleRegEx: /\\+title=[^\\+]*/,\n+\n+ /**\n+ * Constructor: OpenLayers.Projection\n+ * This class offers several methods for interacting with a wrapped \n+ * pro4js projection object. \n *\n * Parameters:\n- * geometry - {}\n+ * projCode - {String} A string identifying the Well Known Identifier for\n+ * the projection.\n+ * options - {Object} An optional object to set additional properties\n+ * on the projection.\n *\n * Returns:\n- * {Boolean} The input geometry intersects this geometry.\n+ * {} A projection object.\n */\n- intersects: function(geometry) {\n- var intersect = false;\n- var type = geometry.CLASS_NAME;\n- if (type == \"OpenLayers.Geometry.LineString\" ||\n- type == \"OpenLayers.Geometry.LinearRing\" ||\n- type == \"OpenLayers.Geometry.Point\") {\n- var segs1 = this.getSortedSegments();\n- var segs2;\n- if (type == \"OpenLayers.Geometry.Point\") {\n- segs2 = [{\n- x1: geometry.x,\n- y1: geometry.y,\n- x2: geometry.x,\n- y2: geometry.y\n- }];\n- } else {\n- segs2 = geometry.getSortedSegments();\n- }\n- var seg1, seg1x1, seg1x2, seg1y1, seg1y2,\n- seg2, seg2y1, seg2y2;\n- // sweep right\n- outer: for (var i = 0, len = segs1.length; i < len; ++i) {\n- seg1 = segs1[i];\n- seg1x1 = seg1.x1;\n- seg1x2 = seg1.x2;\n- seg1y1 = seg1.y1;\n- seg1y2 = seg1.y2;\n- inner: for (var j = 0, jlen = segs2.length; j < jlen; ++j) {\n- seg2 = segs2[j];\n- if (seg2.x1 > seg1x2) {\n- // seg1 still left of seg2\n- break;\n- }\n- if (seg2.x2 < seg1x1) {\n- // seg2 still left of seg1\n- continue;\n- }\n- seg2y1 = seg2.y1;\n- seg2y2 = seg2.y2;\n- if (Math.min(seg2y1, seg2y2) > Math.max(seg1y1, seg1y2)) {\n- // seg2 above seg1\n- continue;\n- }\n- if (Math.max(seg2y1, seg2y2) < Math.min(seg1y1, seg1y2)) {\n- // seg2 below seg1\n- continue;\n- }\n- if (OpenLayers.Geometry.segmentsIntersect(seg1, seg2)) {\n- intersect = true;\n- break outer;\n- }\n- }\n- }\n- } else {\n- intersect = geometry.intersects(this);\n+ initialize: function(projCode, options) {\n+ OpenLayers.Util.extend(this, options);\n+ this.projCode = projCode;\n+ if (typeof Proj4js == \"object\") {\n+ this.proj = new Proj4js.Proj(projCode);\n }\n- return intersect;\n },\n \n /**\n- * Method: getSortedSegments\n+ * APIMethod: getCode\n+ * Get the string SRS code.\n *\n * Returns:\n- * {Array} An array of segment objects. Segment objects have properties\n- * x1, y1, x2, and y2. The start point is represented by x1 and y1.\n- * The end point is represented by x2 and y2. Start and end are\n- * ordered so that x1 < x2.\n+ * {String} The SRS code.\n */\n- getSortedSegments: function() {\n- var numSeg = this.components.length - 1;\n- var segments = new Array(numSeg),\n- point1, point2;\n- for (var i = 0; i < numSeg; ++i) {\n- point1 = this.components[i];\n- point2 = this.components[i + 1];\n- if (point1.x < point2.x) {\n- segments[i] = {\n- x1: point1.x,\n- y1: point1.y,\n- x2: point2.x,\n- y2: point2.y\n- };\n- } else {\n- segments[i] = {\n- x1: point2.x,\n- y1: point2.y,\n- x2: point1.x,\n- y2: point1.y\n- };\n- }\n- }\n- // more efficient to define this somewhere static\n- function byX1(seg1, seg2) {\n- return seg1.x1 - seg2.x1;\n- }\n- return segments.sort(byX1);\n+ getCode: function() {\n+ return this.proj ? this.proj.srsCode : this.projCode;\n },\n \n /**\n- * Method: splitWithSegment\n- * Split this geometry with the given segment.\n- *\n- * Parameters:\n- * seg - {Object} An object with x1, y1, x2, and y2 properties referencing\n- * segment endpoint coordinates.\n- * options - {Object} Properties of this object will be used to determine\n- * how the split is conducted.\n+ * APIMethod: getUnits\n+ * Get the units string for the projection -- returns null if \n+ * proj4js is not available.\n *\n- * Valid options:\n- * edge - {Boolean} Allow splitting when only edges intersect. Default is\n+ * Returns:\n+ * {String} The units abbreviation.\n+ */\n+ getUnits: function() {\n+ return this.proj ? this.proj.units : null;\n+ },\n+\n+ /**\n+ * Method: toString\n+ * Convert projection to string (getCode wrapper).\n+ *\n+ * Returns:\n+ * {String} The projection code.\n+ */\n+ toString: function() {\n+ return this.getCode();\n+ },\n+\n+ /**\n+ * Method: equals\n+ * Test equality of two projection instances. Determines equality based\n+ * soley on the projection code.\n+ *\n+ * Returns:\n+ * {Boolean} The two projections are equivalent.\n+ */\n+ equals: function(projection) {\n+ var p = projection,\n+ equals = false;\n+ if (p) {\n+ if (!(p instanceof OpenLayers.Projection)) {\n+ p = new OpenLayers.Projection(p);\n+ }\n+ if ((typeof Proj4js == \"object\") && this.proj.defData && p.proj.defData) {\n+ equals = this.proj.defData.replace(this.titleRegEx, \"\") ==\n+ p.proj.defData.replace(this.titleRegEx, \"\");\n+ } else if (p.getCode) {\n+ var source = this.getCode(),\n+ target = p.getCode();\n+ equals = source == target ||\n+ !!OpenLayers.Projection.transforms[source] &&\n+ OpenLayers.Projection.transforms[source][target] ===\n+ OpenLayers.Projection.nullTransform;\n+ }\n+ }\n+ return equals;\n+ },\n+\n+ /* Method: destroy\n+ * Destroy projection object.\n+ */\n+ destroy: function() {\n+ delete this.proj;\n+ delete this.projCode;\n+ },\n+\n+ CLASS_NAME: \"OpenLayers.Projection\"\n+});\n+\n+/**\n+ * Property: transforms\n+ * {Object} Transforms is an object, with from properties, each of which may\n+ * have a to property. This allows you to define projections without \n+ * requiring support for proj4js to be included.\n+ *\n+ * This object has keys which correspond to a 'source' projection object. The\n+ * keys should be strings, corresponding to the projection.getCode() value.\n+ * Each source projection object should have a set of destination projection\n+ * keys included in the object. \n+ * \n+ * Each value in the destination object should be a transformation function,\n+ * where the function is expected to be passed an object with a .x and a .y\n+ * property. The function should return the object, with the .x and .y\n+ * transformed according to the transformation function.\n+ *\n+ * Note - Properties on this object should not be set directly. To add a\n+ * transform method to this object, use the method. For an\n+ * example of usage, see the OpenLayers.Layer.SphericalMercator file.\n+ */\n+OpenLayers.Projection.transforms = {};\n+\n+/**\n+ * APIProperty: defaults\n+ * {Object} Defaults for the SRS codes known to OpenLayers (currently\n+ * EPSG:4326, CRS:84, urn:ogc:def:crs:EPSG:6.6:4326, EPSG:900913, EPSG:3857,\n+ * EPSG:102113 and EPSG:102100). Keys are the SRS code, values are units,\n+ * maxExtent (the validity extent for the SRS) and yx (true if this SRS is\n+ * known to have a reverse axis order).\n+ */\n+OpenLayers.Projection.defaults = {\n+ \"EPSG:4326\": {\n+ units: \"degrees\",\n+ maxExtent: [-180, -90, 180, 90],\n+ yx: true\n+ },\n+ \"CRS:84\": {\n+ units: \"degrees\",\n+ maxExtent: [-180, -90, 180, 90]\n+ },\n+ \"EPSG:900913\": {\n+ units: \"m\",\n+ maxExtent: [-20037508.34, -20037508.34, 20037508.34, 20037508.34]\n+ }\n+};\n+\n+/**\n+ * APIMethod: addTransform\n+ * Set a custom transform method between two projections. Use this method in\n+ * cases where the proj4js lib is not available or where custom projections\n+ * need to be handled.\n+ *\n+ * Parameters:\n+ * from - {String} The code for the source projection\n+ * to - {String} the code for the destination projection\n+ * method - {Function} A function that takes a point as an argument and\n+ * transforms that point from the source to the destination projection\n+ * in place. The original point should be modified.\n+ */\n+OpenLayers.Projection.addTransform = function(from, to, method) {\n+ if (method === OpenLayers.Projection.nullTransform) {\n+ var defaults = OpenLayers.Projection.defaults[from];\n+ if (defaults && !OpenLayers.Projection.defaults[to]) {\n+ OpenLayers.Projection.defaults[to] = defaults;\n+ }\n+ }\n+ if (!OpenLayers.Projection.transforms[from]) {\n+ OpenLayers.Projection.transforms[from] = {};\n+ }\n+ OpenLayers.Projection.transforms[from][to] = method;\n+};\n+\n+/**\n+ * APIMethod: transform\n+ * Transform a point coordinate from one projection to another. Note that\n+ * the input point is transformed in place.\n+ * \n+ * Parameters:\n+ * point - { | Object} An object with x and y\n+ * properties representing coordinates in those dimensions.\n+ * source - {OpenLayers.Projection} Source map coordinate system\n+ * dest - {OpenLayers.Projection} Destination map coordinate system\n+ *\n+ * Returns:\n+ * point - {object} A transformed coordinate. The original point is modified.\n+ */\n+OpenLayers.Projection.transform = function(point, source, dest) {\n+ if (source && dest) {\n+ if (!(source instanceof OpenLayers.Projection)) {\n+ source = new OpenLayers.Projection(source);\n+ }\n+ if (!(dest instanceof OpenLayers.Projection)) {\n+ dest = new OpenLayers.Projection(dest);\n+ }\n+ if (source.proj && dest.proj) {\n+ point = Proj4js.transform(source.proj, dest.proj, point);\n+ } else {\n+ var sourceCode = source.getCode();\n+ var destCode = dest.getCode();\n+ var transforms = OpenLayers.Projection.transforms;\n+ if (transforms[sourceCode] && transforms[sourceCode][destCode]) {\n+ transforms[sourceCode][destCode](point);\n+ }\n+ }\n+ }\n+ return point;\n+};\n+\n+/**\n+ * APIFunction: nullTransform\n+ * A null transformation - useful for defining projection aliases when\n+ * proj4js is not available:\n+ *\n+ * (code)\n+ * OpenLayers.Projection.addTransform(\"EPSG:3857\", \"EPSG:900913\",\n+ * OpenLayers.Projection.nullTransform);\n+ * OpenLayers.Projection.addTransform(\"EPSG:900913\", \"EPSG:3857\",\n+ * OpenLayers.Projection.nullTransform);\n+ * (end)\n+ */\n+OpenLayers.Projection.nullTransform = function(point) {\n+ return point;\n+};\n+\n+/**\n+ * Note: Transforms for web mercator <-> geographic\n+ * OpenLayers recognizes EPSG:3857, EPSG:900913, EPSG:102113 and EPSG:102100.\n+ * OpenLayers originally started referring to EPSG:900913 as web mercator.\n+ * The EPSG has declared EPSG:3857 to be web mercator.\n+ * ArcGIS 10 recognizes the EPSG:3857, EPSG:102113, and EPSG:102100 as\n+ * equivalent. See http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/11/20/ArcGIS-Online-moving-to-Google-_2F00_-Bing-tiling-scheme_3A00_-What-does-this-mean-for-you_3F00_.aspx#12084.\n+ * For geographic, OpenLayers recognizes EPSG:4326, CRS:84 and\n+ * urn:ogc:def:crs:EPSG:6.6:4326. OpenLayers also knows about the reverse axis\n+ * order for EPSG:4326. \n+ */\n+(function() {\n+\n+ var pole = 20037508.34;\n+\n+ function inverseMercator(xy) {\n+ xy.x = 180 * xy.x / pole;\n+ xy.y = 180 / Math.PI * (2 * Math.atan(Math.exp((xy.y / pole) * Math.PI)) - Math.PI / 2);\n+ return xy;\n+ }\n+\n+ function forwardMercator(xy) {\n+ xy.x = xy.x * pole / 180;\n+ var y = Math.log(Math.tan((90 + xy.y) * Math.PI / 360)) / Math.PI * pole;\n+ xy.y = Math.max(-20037508.34, Math.min(y, 20037508.34));\n+ return xy;\n+ }\n+\n+ function map(base, codes) {\n+ var add = OpenLayers.Projection.addTransform;\n+ var same = OpenLayers.Projection.nullTransform;\n+ var i, len, code, other, j;\n+ for (i = 0, len = codes.length; i < len; ++i) {\n+ code = codes[i];\n+ add(base, code, forwardMercator);\n+ add(code, base, inverseMercator);\n+ for (j = i + 1; j < len; ++j) {\n+ other = codes[j];\n+ add(code, other, same);\n+ add(other, code, same);\n+ }\n+ }\n+ }\n+\n+ // list of equivalent codes for web mercator\n+ var mercator = [\"EPSG:900913\", \"EPSG:3857\", \"EPSG:102113\", \"EPSG:102100\"],\n+ geographic = [\"CRS:84\", \"urn:ogc:def:crs:EPSG:6.6:4326\", \"EPSG:4326\"],\n+ i;\n+ for (i = mercator.length - 1; i >= 0; --i) {\n+ map(mercator[i], geographic);\n+ }\n+ for (i = geographic.length - 1; i >= 0; --i) {\n+ map(geographic[i], mercator);\n+ }\n+\n+})();\n+/* ======================================================================\n+ OpenLayers/Events.js\n+ ====================================================================== */\n+\n+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n+ * full list of contributors). Published under the 2-clause BSD license.\n+ * See license.txt in the OpenLayers distribution or repository for the\n+ * full text of the license. */\n+\n+\n+/**\n+ * @requires OpenLayers/Util.js\n+ */\n+\n+/**\n+ * Namespace: OpenLayers.Event\n+ * Utility functions for event handling.\n+ */\n+OpenLayers.Event = {\n+\n+ /** \n+ * Property: observers \n+ * {Object} A hashtable cache of the event observers. Keyed by\n+ * element._eventCacheID \n+ */\n+ observers: false,\n+\n+ /**\n+ * Constant: KEY_SPACE\n+ * {int}\n+ */\n+ KEY_SPACE: 32,\n+\n+ /** \n+ * Constant: KEY_BACKSPACE \n+ * {int} \n+ */\n+ KEY_BACKSPACE: 8,\n+\n+ /** \n+ * Constant: KEY_TAB \n+ * {int} \n+ */\n+ KEY_TAB: 9,\n+\n+ /** \n+ * Constant: KEY_RETURN \n+ * {int} \n+ */\n+ KEY_RETURN: 13,\n+\n+ /** \n+ * Constant: KEY_ESC \n+ * {int} \n+ */\n+ KEY_ESC: 27,\n+\n+ /** \n+ * Constant: KEY_LEFT \n+ * {int} \n+ */\n+ KEY_LEFT: 37,\n+\n+ /** \n+ * Constant: KEY_UP \n+ * {int} \n+ */\n+ KEY_UP: 38,\n+\n+ /** \n+ * Constant: KEY_RIGHT \n+ * {int} \n+ */\n+ KEY_RIGHT: 39,\n+\n+ /** \n+ * Constant: KEY_DOWN \n+ * {int} \n+ */\n+ KEY_DOWN: 40,\n+\n+ /** \n+ * Constant: KEY_DELETE \n+ * {int} \n+ */\n+ KEY_DELETE: 46,\n+\n+\n+ /**\n+ * Method: element\n+ * Cross browser event element detection.\n+ * \n+ * Parameters:\n+ * event - {Event} \n+ * \n+ * Returns:\n+ * {DOMElement} The element that caused the event \n+ */\n+ element: function(event) {\n+ return event.target || event.srcElement;\n+ },\n+\n+ /**\n+ * Method: isSingleTouch\n+ * Determine whether event was caused by a single touch\n+ *\n+ * Parameters:\n+ * event - {Event}\n+ *\n+ * Returns:\n+ * {Boolean}\n+ */\n+ isSingleTouch: function(event) {\n+ return event.touches && event.touches.length == 1;\n+ },\n+\n+ /**\n+ * Method: isMultiTouch\n+ * Determine whether event was caused by a multi touch\n+ *\n+ * Parameters:\n+ * event - {Event}\n+ *\n+ * Returns:\n+ * {Boolean}\n+ */\n+ isMultiTouch: function(event) {\n+ return event.touches && event.touches.length > 1;\n+ },\n+\n+ /**\n+ * Method: isLeftClick\n+ * Determine whether event was caused by a left click. \n+ *\n+ * Parameters:\n+ * event - {Event} \n+ * \n+ * Returns:\n+ * {Boolean}\n+ */\n+ isLeftClick: function(event) {\n+ return (((event.which) && (event.which == 1)) ||\n+ ((event.button) && (event.button == 1)));\n+ },\n+\n+ /**\n+ * Method: isRightClick\n+ * Determine whether event was caused by a right mouse click. \n+ *\n+ * Parameters:\n+ * event - {Event} \n+ * \n+ * Returns:\n+ * {Boolean}\n+ */\n+ isRightClick: function(event) {\n+ return (((event.which) && (event.which == 3)) ||\n+ ((event.button) && (event.button == 2)));\n+ },\n+\n+ /**\n+ * Method: stop\n+ * Stops an event from propagating. \n+ *\n+ * Parameters: \n+ * event - {Event} \n+ * allowDefault - {Boolean} If true, we stop the event chain but \n+ * still allow the default browser behaviour (text selection,\n+ * radio-button clicking, etc). Default is false.\n+ */\n+ stop: function(event, allowDefault) {\n+\n+ if (!allowDefault) {\n+ OpenLayers.Event.preventDefault(event);\n+ }\n+\n+ if (event.stopPropagation) {\n+ event.stopPropagation();\n+ } else {\n+ event.cancelBubble = true;\n+ }\n+ },\n+\n+ /**\n+ * Method: preventDefault\n+ * Cancels the event if it is cancelable, without stopping further\n+ * propagation of the event.\n+ *\n+ * Parameters:\n+ * event - {Event}\n+ */\n+ preventDefault: function(event) {\n+ if (event.preventDefault) {\n+ event.preventDefault();\n+ } else {\n+ event.returnValue = false;\n+ }\n+ },\n+\n+ /** \n+ * Method: findElement\n+ * \n+ * Parameters:\n+ * event - {Event} \n+ * tagName - {String} \n+ * \n+ * Returns:\n+ * {DOMElement} The first node with the given tagName, starting from the\n+ * node the event was triggered on and traversing the DOM upwards\n+ */\n+ findElement: function(event, tagName) {\n+ var element = OpenLayers.Event.element(event);\n+ while (element.parentNode && (!element.tagName ||\n+ (element.tagName.toUpperCase() != tagName.toUpperCase()))) {\n+ element = element.parentNode;\n+ }\n+ return element;\n+ },\n+\n+ /** \n+ * Method: observe\n+ * \n+ * Parameters:\n+ * elementParam - {DOMElement || String} \n+ * name - {String} \n+ * observer - {function} \n+ * useCapture - {Boolean} \n+ */\n+ observe: function(elementParam, name, observer, useCapture) {\n+ var element = OpenLayers.Util.getElement(elementParam);\n+ useCapture = useCapture || false;\n+\n+ if (name == 'keypress' &&\n+ (navigator.appVersion.match(/Konqueror|Safari|KHTML/) ||\n+ element.attachEvent)) {\n+ name = 'keydown';\n+ }\n+\n+ //if observers cache has not yet been created, create it\n+ if (!this.observers) {\n+ this.observers = {};\n+ }\n+\n+ //if not already assigned, make a new unique cache ID\n+ if (!element._eventCacheID) {\n+ var idPrefix = \"eventCacheID_\";\n+ if (element.id) {\n+ idPrefix = element.id + \"_\" + idPrefix;\n+ }\n+ element._eventCacheID = OpenLayers.Util.createUniqueID(idPrefix);\n+ }\n+\n+ var cacheID = element._eventCacheID;\n+\n+ //if there is not yet a hash entry for this element, add one\n+ if (!this.observers[cacheID]) {\n+ this.observers[cacheID] = [];\n+ }\n+\n+ //add a new observer to this element's list\n+ this.observers[cacheID].push({\n+ 'element': element,\n+ 'name': name,\n+ 'observer': observer,\n+ 'useCapture': useCapture\n+ });\n+\n+ //add the actual browser event listener\n+ if (element.addEventListener) {\n+ element.addEventListener(name, observer, useCapture);\n+ } else if (element.attachEvent) {\n+ element.attachEvent('on' + name, observer);\n+ }\n+ },\n+\n+ /** \n+ * Method: stopObservingElement\n+ * Given the id of an element to stop observing, cycle through the \n+ * element's cached observers, calling stopObserving on each one, \n+ * skipping those entries which can no longer be removed.\n+ * \n+ * parameters:\n+ * elementParam - {DOMElement || String} \n+ */\n+ stopObservingElement: function(elementParam) {\n+ var element = OpenLayers.Util.getElement(elementParam);\n+ var cacheID = element._eventCacheID;\n+\n+ this._removeElementObservers(OpenLayers.Event.observers[cacheID]);\n+ },\n+\n+ /**\n+ * Method: _removeElementObservers\n+ *\n+ * Parameters:\n+ * elementObservers - {Array(Object)} Array of (element, name, \n+ * observer, usecapture) objects, \n+ * taken directly from hashtable\n+ */\n+ _removeElementObservers: function(elementObservers) {\n+ if (elementObservers) {\n+ for (var i = elementObservers.length - 1; i >= 0; i--) {\n+ var entry = elementObservers[i];\n+ OpenLayers.Event.stopObserving.apply(this, [\n+ entry.element, entry.name, entry.observer, entry.useCapture\n+ ]);\n+ }\n+ }\n+ },\n+\n+ /**\n+ * Method: stopObserving\n+ * \n+ * Parameters:\n+ * elementParam - {DOMElement || String} \n+ * name - {String} \n+ * observer - {function} \n+ * useCapture - {Boolean} \n+ * \n+ * Returns:\n+ * {Boolean} Whether or not the event observer was removed\n+ */\n+ stopObserving: function(elementParam, name, observer, useCapture) {\n+ useCapture = useCapture || false;\n+\n+ var element = OpenLayers.Util.getElement(elementParam);\n+ var cacheID = element._eventCacheID;\n+\n+ if (name == 'keypress') {\n+ if (navigator.appVersion.match(/Konqueror|Safari|KHTML/) ||\n+ element.detachEvent) {\n+ name = 'keydown';\n+ }\n+ }\n+\n+ // find element's entry in this.observers cache and remove it\n+ var foundEntry = false;\n+ var elementObservers = OpenLayers.Event.observers[cacheID];\n+ if (elementObservers) {\n+\n+ // find the specific event type in the element's list\n+ var i = 0;\n+ while (!foundEntry && i < elementObservers.length) {\n+ var cacheEntry = elementObservers[i];\n+\n+ if ((cacheEntry.name == name) &&\n+ (cacheEntry.observer == observer) &&\n+ (cacheEntry.useCapture == useCapture)) {\n+\n+ elementObservers.splice(i, 1);\n+ if (elementObservers.length == 0) {\n+ delete OpenLayers.Event.observers[cacheID];\n+ }\n+ foundEntry = true;\n+ break;\n+ }\n+ i++;\n+ }\n+ }\n+\n+ //actually remove the event listener from browser\n+ if (foundEntry) {\n+ if (element.removeEventListener) {\n+ element.removeEventListener(name, observer, useCapture);\n+ } else if (element && element.detachEvent) {\n+ element.detachEvent('on' + name, observer);\n+ }\n+ }\n+ return foundEntry;\n+ },\n+\n+ /** \n+ * Method: unloadCache\n+ * Cycle through all the element entries in the events cache and call\n+ * stopObservingElement on each. \n+ */\n+ unloadCache: function() {\n+ // check for OpenLayers.Event before checking for observers, because\n+ // OpenLayers.Event may be undefined in IE if no map instance was\n+ // created\n+ if (OpenLayers.Event && OpenLayers.Event.observers) {\n+ for (var cacheID in OpenLayers.Event.observers) {\n+ var elementObservers = OpenLayers.Event.observers[cacheID];\n+ OpenLayers.Event._removeElementObservers.apply(this,\n+ [elementObservers]);\n+ }\n+ OpenLayers.Event.observers = false;\n+ }\n+ },\n+\n+ CLASS_NAME: \"OpenLayers.Event\"\n+};\n+\n+/* prevent memory leaks in IE */\n+OpenLayers.Event.observe(window, 'unload', OpenLayers.Event.unloadCache, false);\n+\n+/**\n+ * Class: OpenLayers.Events\n+ */\n+OpenLayers.Events = OpenLayers.Class({\n+\n+ /** \n+ * Constant: BROWSER_EVENTS\n+ * {Array(String)} supported events \n+ */\n+ BROWSER_EVENTS: [\n+ \"mouseover\", \"mouseout\",\n+ \"mousedown\", \"mouseup\", \"mousemove\",\n+ \"click\", \"dblclick\", \"rightclick\", \"dblrightclick\",\n+ \"resize\", \"focus\", \"blur\",\n+ \"touchstart\", \"touchmove\", \"touchend\",\n+ \"keydown\"\n+ ],\n+\n+ /** \n+ * Property: listeners \n+ * {Object} Hashtable of Array(Function): events listener functions \n+ */\n+ listeners: null,\n+\n+ /** \n+ * Property: object \n+ * {Object} the code object issuing application events \n+ */\n+ object: null,\n+\n+ /** \n+ * Property: element \n+ * {DOMElement} the DOM element receiving browser events \n+ */\n+ element: null,\n+\n+ /** \n+ * Property: eventHandler \n+ * {Function} bound event handler attached to elements \n+ */\n+ eventHandler: null,\n+\n+ /** \n+ * APIProperty: fallThrough \n+ * {Boolean} \n+ */\n+ fallThrough: null,\n+\n+ /** \n+ * APIProperty: includeXY\n+ * {Boolean} Should the .xy property automatically be created for browser\n+ * mouse events? In general, this should be false. If it is true, then\n+ * mouse events will automatically generate a '.xy' property on the \n+ * event object that is passed. (Prior to OpenLayers 2.7, this was true\n+ * by default.) Otherwise, you can call the getMousePosition on the\n+ * relevant events handler on the object available via the 'evt.object'\n+ * property of the evt object. So, for most events, you can call:\n+ * function named(evt) { \n+ * this.xy = this.object.events.getMousePosition(evt) \n+ * } \n+ *\n+ * This option typically defaults to false for performance reasons:\n+ * when creating an events object whose primary purpose is to manage\n+ * relatively positioned mouse events within a div, it may make\n+ * sense to set it to true.\n+ *\n+ * This option is also used to control whether the events object caches\n+ * offsets. If this is false, it will not: the reason for this is that\n+ * it is only expected to be called many times if the includeXY property\n+ * is set to true. If you set this to true, you are expected to clear \n+ * the offset cache manually (using this.clearMouseCache()) if:\n+ * the border of the element changes\n+ * the location of the element in the page changes\n+ */\n+ includeXY: false,\n+\n+ /**\n+ * APIProperty: extensions\n+ * {Object} Event extensions registered with this instance. Keys are\n+ * event types, values are {OpenLayers.Events.*} extension instances or\n+ * {Boolean} for events that an instantiated extension provides in\n+ * addition to the one it was created for.\n+ *\n+ * Extensions create an event in addition to browser events, which usually\n+ * fires when a sequence of browser events is completed. Extensions are\n+ * automatically instantiated when a listener is registered for an event\n+ * provided by an extension.\n+ *\n+ * Extensions are created in the namespace using\n+ * , and named after the event they provide.\n+ * The constructor receives the target instance as\n+ * argument. Extensions that need to capture browser events before they\n+ * propagate can register their listeners events using , with\n+ * {extension: true} as 4th argument.\n+ *\n+ * If an extension creates more than one event, an alias for each event\n+ * type should be created and reference the same class. The constructor\n+ * should set a reference in the target's extensions registry to itself.\n+ *\n+ * Below is a minimal extension that provides the \"foostart\" and \"fooend\"\n+ * event types, which replace the native \"click\" event type if clicked on\n+ * an element with the css class \"foo\":\n+ *\n+ * (code)\n+ * OpenLayers.Events.foostart = OpenLayers.Class({\n+ * initialize: function(target) {\n+ * this.target = target;\n+ * this.target.register(\"click\", this, this.doStuff, {extension: true});\n+ * // only required if extension provides more than one event type\n+ * this.target.extensions[\"foostart\"] = true;\n+ * this.target.extensions[\"fooend\"] = true;\n+ * },\n+ * destroy: function() {\n+ * var target = this.target;\n+ * target.unregister(\"click\", this, this.doStuff);\n+ * delete this.target;\n+ * // only required if extension provides more than one event type\n+ * delete target.extensions[\"foostart\"];\n+ * delete target.extensions[\"fooend\"];\n+ * },\n+ * doStuff: function(evt) {\n+ * var propagate = true;\n+ * if (OpenLayers.Event.element(evt).className === \"foo\") {\n+ * propagate = false;\n+ * var target = this.target;\n+ * target.triggerEvent(\"foostart\");\n+ * window.setTimeout(function() {\n+ * target.triggerEvent(\"fooend\");\n+ * }, 1000);\n+ * }\n+ * return propagate;\n+ * }\n+ * });\n+ * // only required if extension provides more than one event type\n+ * OpenLayers.Events.fooend = OpenLayers.Events.foostart;\n+ * (end)\n+ * \n+ */\n+ extensions: null,\n+\n+ /**\n+ * Property: extensionCount\n+ * {Object} Keys are event types (like in ), values are the\n+ * number of extension listeners for each event type.\n+ */\n+ extensionCount: null,\n+\n+ /**\n+ * Method: clearMouseListener\n+ * A version of that is bound to this instance so that\n+ * it can be used with and\n+ * .\n+ */\n+ clearMouseListener: null,\n+\n+ /**\n+ * Constructor: OpenLayers.Events\n+ * Construct an OpenLayers.Events object.\n+ *\n+ * Parameters:\n+ * object - {Object} The js object to which this Events object is being added\n+ * element - {DOMElement} A dom element to respond to browser events\n+ * eventTypes - {Array(String)} Deprecated. Array of custom application\n+ * events. A listener may be registered for any named event, regardless\n+ * of the values provided here.\n+ * fallThrough - {Boolean} Allow events to fall through after these have\n+ * been handled?\n+ * options - {Object} Options for the events object.\n+ */\n+ initialize: function(object, element, eventTypes, fallThrough, options) {\n+ OpenLayers.Util.extend(this, options);\n+ this.object = object;\n+ this.fallThrough = fallThrough;\n+ this.listeners = {};\n+ this.extensions = {};\n+ this.extensionCount = {};\n+ this._msTouches = [];\n+\n+ // if a dom element is specified, add a listeners list \n+ // for browser events on the element and register them\n+ if (element != null) {\n+ this.attachToElement(element);\n+ }\n+ },\n+\n+ /**\n+ * APIMethod: destroy\n+ */\n+ destroy: function() {\n+ for (var e in this.extensions) {\n+ if (typeof this.extensions[e] !== \"boolean\") {\n+ this.extensions[e].destroy();\n+ }\n+ }\n+ this.extensions = null;\n+ if (this.element) {\n+ OpenLayers.Event.stopObservingElement(this.element);\n+ if (this.element.hasScrollEvent) {\n+ OpenLayers.Event.stopObserving(\n+ window, \"scroll\", this.clearMouseListener\n+ );\n+ }\n+ }\n+ this.element = null;\n+\n+ this.listeners = null;\n+ this.object = null;\n+ this.fallThrough = null;\n+ this.eventHandler = null;\n+ },\n+\n+ /**\n+ * APIMethod: addEventType\n+ * Deprecated. Any event can be triggered without adding it first.\n+ * \n+ * Parameters:\n+ * eventName - {String}\n+ */\n+ addEventType: function(eventName) {},\n+\n+ /**\n+ * Method: attachToElement\n+ *\n+ * Parameters:\n+ * element - {HTMLDOMElement} a DOM element to attach browser events to\n+ */\n+ attachToElement: function(element) {\n+ if (this.element) {\n+ OpenLayers.Event.stopObservingElement(this.element);\n+ } else {\n+ // keep a bound copy of handleBrowserEvent() so that we can\n+ // pass the same function to both Event.observe() and .stopObserving()\n+ this.eventHandler = OpenLayers.Function.bindAsEventListener(\n+ this.handleBrowserEvent, this\n+ );\n+\n+ // to be used with observe and stopObserving\n+ this.clearMouseListener = OpenLayers.Function.bind(\n+ this.clearMouseCache, this\n+ );\n+ }\n+ this.element = element;\n+ var msTouch = !!window.navigator.msMaxTouchPoints;\n+ var type;\n+ for (var i = 0, len = this.BROWSER_EVENTS.length; i < len; i++) {\n+ type = this.BROWSER_EVENTS[i];\n+ // register the event cross-browser\n+ OpenLayers.Event.observe(element, type, this.eventHandler);\n+ if (msTouch && type.indexOf('touch') === 0) {\n+ this.addMsTouchListener(element, type, this.eventHandler);\n+ }\n+ }\n+ // disable dragstart in IE so that mousedown/move/up works normally\n+ OpenLayers.Event.observe(element, \"dragstart\", OpenLayers.Event.stop);\n+ },\n+\n+ /**\n+ * APIMethod: on\n+ * Convenience method for registering listeners with a common scope.\n+ * Internally, this method calls as shown in the examples\n+ * below.\n+ *\n+ * Example use:\n+ * (code)\n+ * // register a single listener for the \"loadstart\" event\n+ * events.on({\"loadstart\": loadStartListener});\n+ *\n+ * // this is equivalent to the following\n+ * events.register(\"loadstart\", undefined, loadStartListener);\n+ *\n+ * // register multiple listeners to be called with the same `this` object\n+ * events.on({\n+ * \"loadstart\": loadStartListener,\n+ * \"loadend\": loadEndListener,\n+ * scope: object\n+ * });\n+ *\n+ * // this is equivalent to the following\n+ * events.register(\"loadstart\", object, loadStartListener);\n+ * events.register(\"loadend\", object, loadEndListener);\n+ * (end)\n+ *\n+ * Parameters:\n+ * object - {Object} \n+ */\n+ on: function(object) {\n+ for (var type in object) {\n+ if (type != \"scope\" && object.hasOwnProperty(type)) {\n+ this.register(type, object.scope, object[type]);\n+ }\n+ }\n+ },\n+\n+ /**\n+ * APIMethod: register\n+ * Register an event on the events object.\n+ *\n+ * When the event is triggered, the 'func' function will be called, in the\n+ * context of 'obj'. Imagine we were to register an event, specifying an \n+ * OpenLayers.Bounds Object as 'obj'. When the event is triggered, the \n+ * context in the callback function will be our Bounds object. This means\n+ * that within our callback function, we can access the properties and \n+ * methods of the Bounds object through the \"this\" variable. So our \n+ * callback could execute something like: \n+ * : leftStr = \"Left: \" + this.left;\n+ * \n+ * or\n+ * \n+ * : centerStr = \"Center: \" + this.getCenterLonLat();\n+ *\n+ * Parameters:\n+ * type - {String} Name of the event to register\n+ * obj - {Object} The object to bind the context to for the callback#.\n+ * If no object is specified, default is the Events's 'object' property.\n+ * func - {Function} The callback function. If no callback is \n+ * specified, this function does nothing.\n+ * priority - {Boolean|Object} If true, adds the new listener to the\n+ * *front* of the events queue instead of to the end.\n+ *\n+ * Valid options for priority:\n+ * extension - {Boolean} If true, then the event will be registered as\n+ * extension event. Extension events are handled before all other\n+ * events.\n+ */\n+ register: function(type, obj, func, priority) {\n+ if (type in OpenLayers.Events && !this.extensions[type]) {\n+ this.extensions[type] = new OpenLayers.Events[type](this);\n+ }\n+ if (func != null) {\n+ if (obj == null) {\n+ obj = this.object;\n+ }\n+ var listeners = this.listeners[type];\n+ if (!listeners) {\n+ listeners = [];\n+ this.listeners[type] = listeners;\n+ this.extensionCount[type] = 0;\n+ }\n+ var listener = {\n+ obj: obj,\n+ func: func\n+ };\n+ if (priority) {\n+ listeners.splice(this.extensionCount[type], 0, listener);\n+ if (typeof priority === \"object\" && priority.extension) {\n+ this.extensionCount[type]++;\n+ }\n+ } else {\n+ listeners.push(listener);\n+ }\n+ }\n+ },\n+\n+ /**\n+ * APIMethod: registerPriority\n+ * Same as register() but adds the new listener to the *front* of the\n+ * events queue instead of to the end.\n+ * \n+ * TODO: get rid of this in 3.0 - Decide whether listeners should be \n+ * called in the order they were registered or in reverse order.\n+ *\n+ *\n+ * Parameters:\n+ * type - {String} Name of the event to register\n+ * obj - {Object} The object to bind the context to for the callback#.\n+ * If no object is specified, default is the Events's \n+ * 'object' property.\n+ * func - {Function} The callback function. If no callback is \n+ * specified, this function does nothing.\n+ */\n+ registerPriority: function(type, obj, func) {\n+ this.register(type, obj, func, true);\n+ },\n+\n+ /**\n+ * APIMethod: un\n+ * Convenience method for unregistering listeners with a common scope.\n+ * Internally, this method calls as shown in the examples\n+ * below.\n+ *\n+ * Example use:\n+ * (code)\n+ * // unregister a single listener for the \"loadstart\" event\n+ * events.un({\"loadstart\": loadStartListener});\n+ *\n+ * // this is equivalent to the following\n+ * events.unregister(\"loadstart\", undefined, loadStartListener);\n+ *\n+ * // unregister multiple listeners with the same `this` object\n+ * events.un({\n+ * \"loadstart\": loadStartListener,\n+ * \"loadend\": loadEndListener,\n+ * scope: object\n+ * });\n+ *\n+ * // this is equivalent to the following\n+ * events.unregister(\"loadstart\", object, loadStartListener);\n+ * events.unregister(\"loadend\", object, loadEndListener);\n+ * (end)\n+ */\n+ un: function(object) {\n+ for (var type in object) {\n+ if (type != \"scope\" && object.hasOwnProperty(type)) {\n+ this.unregister(type, object.scope, object[type]);\n+ }\n+ }\n+ },\n+\n+ /**\n+ * APIMethod: unregister\n+ *\n+ * Parameters:\n+ * type - {String} \n+ * obj - {Object} If none specified, defaults to this.object\n+ * func - {Function} \n+ */\n+ unregister: function(type, obj, func) {\n+ if (obj == null) {\n+ obj = this.object;\n+ }\n+ var listeners = this.listeners[type];\n+ if (listeners != null) {\n+ for (var i = 0, len = listeners.length; i < len; i++) {\n+ if (listeners[i].obj == obj && listeners[i].func == func) {\n+ listeners.splice(i, 1);\n+ break;\n+ }\n+ }\n+ }\n+ },\n+\n+ /** \n+ * Method: remove\n+ * Remove all listeners for a given event type. If type is not registered,\n+ * does nothing.\n+ *\n+ * Parameters:\n+ * type - {String} \n+ */\n+ remove: function(type) {\n+ if (this.listeners[type] != null) {\n+ this.listeners[type] = [];\n+ }\n+ },\n+\n+ /**\n+ * APIMethod: triggerEvent\n+ * Trigger a specified registered event. \n+ * \n+ * Parameters:\n+ * type - {String} \n+ * evt - {Event || Object} will be passed to the listeners.\n+ *\n+ * Returns:\n+ * {Boolean} The last listener return. If a listener returns false, the\n+ * chain of listeners will stop getting called.\n+ */\n+ triggerEvent: function(type, evt) {\n+ var listeners = this.listeners[type];\n+\n+ // fast path\n+ if (!listeners || listeners.length == 0) {\n+ return undefined;\n+ }\n+\n+ // prep evt object with object & div references\n+ if (evt == null) {\n+ evt = {};\n+ }\n+ evt.object = this.object;\n+ evt.element = this.element;\n+ if (!evt.type) {\n+ evt.type = type;\n+ }\n+\n+ // execute all callbacks registered for specified type\n+ // get a clone of the listeners array to\n+ // allow for splicing during callbacks\n+ listeners = listeners.slice();\n+ var continueChain;\n+ for (var i = 0, len = listeners.length; i < len; i++) {\n+ var callback = listeners[i];\n+ // bind the context to callback.obj\n+ continueChain = callback.func.apply(callback.obj, [evt]);\n+\n+ if ((continueChain != undefined) && (continueChain == false)) {\n+ // if callback returns false, execute no more callbacks.\n+ break;\n+ }\n+ }\n+ // don't fall through to other DOM elements\n+ if (!this.fallThrough) {\n+ OpenLayers.Event.stop(evt, true);\n+ }\n+ return continueChain;\n+ },\n+\n+ /**\n+ * Method: handleBrowserEvent\n+ * Basically just a wrapper to the triggerEvent() function, but takes \n+ * care to set a property 'xy' on the event with the current mouse \n+ * position.\n+ *\n+ * Parameters:\n+ * evt - {Event} \n+ */\n+ handleBrowserEvent: function(evt) {\n+ var type = evt.type,\n+ listeners = this.listeners[type];\n+ if (!listeners || listeners.length == 0) {\n+ // noone's listening, bail out\n+ return;\n+ }\n+ // add clientX & clientY to all events - corresponds to average x, y\n+ var touches = evt.touches;\n+ if (touches && touches[0]) {\n+ var x = 0;\n+ var y = 0;\n+ var num = touches.length;\n+ var touch;\n+ for (var i = 0; i < num; ++i) {\n+ touch = this.getTouchClientXY(touches[i]);\n+ x += touch.clientX;\n+ y += touch.clientY;\n+ }\n+ evt.clientX = x / num;\n+ evt.clientY = y / num;\n+ }\n+ if (this.includeXY) {\n+ evt.xy = this.getMousePosition(evt);\n+ }\n+ this.triggerEvent(type, evt);\n+ },\n+\n+ /**\n+ * Method: getTouchClientXY\n+ * WebKit has a few bugs for clientX/clientY. This method detects them\n+ * and calculate the correct values.\n+ *\n+ * Parameters:\n+ * evt - {Touch} a Touch object from a TouchEvent\n+ * \n+ * Returns:\n+ * {Object} An object with only clientX and clientY properties with the\n+ * calculated values.\n+ */\n+ getTouchClientXY: function(evt) {\n+ // olMochWin is to override window, used for testing\n+ var win = window.olMockWin || window,\n+ winPageX = win.pageXOffset,\n+ winPageY = win.pageYOffset,\n+ x = evt.clientX,\n+ y = evt.clientY;\n+\n+ if (evt.pageY === 0 && Math.floor(y) > Math.floor(evt.pageY) ||\n+ evt.pageX === 0 && Math.floor(x) > Math.floor(evt.pageX)) {\n+ // iOS4 include scroll offset in clientX/Y\n+ x = x - winPageX;\n+ y = y - winPageY;\n+ } else if (y < (evt.pageY - winPageY) || x < (evt.pageX - winPageX)) {\n+ // Some Android browsers have totally bogus values for clientX/Y\n+ // when scrolling/zooming a page\n+ x = evt.pageX - winPageX;\n+ y = evt.pageY - winPageY;\n+ }\n+\n+ evt.olClientX = x;\n+ evt.olClientY = y;\n+\n+ return {\n+ clientX: x,\n+ clientY: y\n+ };\n+ },\n+\n+ /**\n+ * APIMethod: clearMouseCache\n+ * Clear cached data about the mouse position. This should be called any \n+ * time the element that events are registered on changes position \n+ * within the page.\n+ */\n+ clearMouseCache: function() {\n+ this.element.scrolls = null;\n+ this.element.lefttop = null;\n+ this.element.offsets = null;\n+ },\n+\n+ /**\n+ * Method: getMousePosition\n+ * \n+ * Parameters:\n+ * evt - {Event} \n+ * \n+ * Returns:\n+ * {} The current xy coordinate of the mouse, adjusted\n+ * for offsets\n+ */\n+ getMousePosition: function(evt) {\n+ if (!this.includeXY) {\n+ this.clearMouseCache();\n+ } else if (!this.element.hasScrollEvent) {\n+ OpenLayers.Event.observe(window, \"scroll\", this.clearMouseListener);\n+ this.element.hasScrollEvent = true;\n+ }\n+\n+ if (!this.element.scrolls) {\n+ var viewportElement = OpenLayers.Util.getViewportElement();\n+ this.element.scrolls = [\n+ window.pageXOffset || viewportElement.scrollLeft,\n+ window.pageYOffset || viewportElement.scrollTop\n+ ];\n+ }\n+\n+ if (!this.element.lefttop) {\n+ this.element.lefttop = [\n+ (document.documentElement.clientLeft || 0),\n+ (document.documentElement.clientTop || 0)\n+ ];\n+ }\n+\n+ if (!this.element.offsets) {\n+ this.element.offsets = OpenLayers.Util.pagePosition(this.element);\n+ }\n+\n+ return new OpenLayers.Pixel(\n+ (evt.clientX + this.element.scrolls[0]) - this.element.offsets[0] -\n+ this.element.lefttop[0],\n+ (evt.clientY + this.element.scrolls[1]) - this.element.offsets[1] -\n+ this.element.lefttop[1]\n+ );\n+ },\n+\n+ /**\n+ * Method: addMsTouchListener\n+ *\n+ * Parameters:\n+ * element - {DOMElement} The DOM element to register the listener on\n+ * type - {String} The event type\n+ * handler - {Function} the handler\n+ */\n+ addMsTouchListener: function(element, type, handler) {\n+ var eventHandler = this.eventHandler;\n+ var touches = this._msTouches;\n+\n+ function msHandler(evt) {\n+ handler(OpenLayers.Util.applyDefaults({\n+ stopPropagation: function() {\n+ for (var i = touches.length - 1; i >= 0; --i) {\n+ touches[i].stopPropagation();\n+ }\n+ },\n+ preventDefault: function() {\n+ for (var i = touches.length - 1; i >= 0; --i) {\n+ touches[i].preventDefault();\n+ }\n+ },\n+ type: type\n+ }, evt));\n+ }\n+\n+ switch (type) {\n+ case 'touchstart':\n+ return this.addMsTouchListenerStart(element, type, msHandler);\n+ case 'touchend':\n+ return this.addMsTouchListenerEnd(element, type, msHandler);\n+ case 'touchmove':\n+ return this.addMsTouchListenerMove(element, type, msHandler);\n+ default:\n+ throw 'Unknown touch event type';\n+ }\n+ },\n+\n+ /**\n+ * Method: addMsTouchListenerStart\n+ *\n+ * Parameters:\n+ * element - {DOMElement} The DOM element to register the listener on\n+ * type - {String} The event type\n+ * handler - {Function} the handler\n+ */\n+ addMsTouchListenerStart: function(element, type, handler) {\n+ var touches = this._msTouches;\n+\n+ var cb = function(e) {\n+\n+ var alreadyInArray = false;\n+ for (var i = 0, ii = touches.length; i < ii; ++i) {\n+ if (touches[i].pointerId == e.pointerId) {\n+ alreadyInArray = true;\n+ break;\n+ }\n+ }\n+ if (!alreadyInArray) {\n+ touches.push(e);\n+ }\n+\n+ e.touches = touches.slice();\n+ handler(e);\n+ };\n+\n+ OpenLayers.Event.observe(element, 'MSPointerDown', cb);\n+\n+ // Need to also listen for end events to keep the _msTouches list\n+ // accurate\n+ var internalCb = function(e) {\n+ for (var i = 0, ii = touches.length; i < ii; ++i) {\n+ if (touches[i].pointerId == e.pointerId) {\n+ touches.splice(i, 1);\n+ break;\n+ }\n+ }\n+ };\n+ OpenLayers.Event.observe(element, 'MSPointerUp', internalCb);\n+ },\n+\n+ /**\n+ * Method: addMsTouchListenerMove\n+ *\n+ * Parameters:\n+ * element - {DOMElement} The DOM element to register the listener on\n+ * type - {String} The event type\n+ * handler - {Function} the handler\n+ */\n+ addMsTouchListenerMove: function(element, type, handler) {\n+ var touches = this._msTouches;\n+ var cb = function(e) {\n+\n+ //Don't fire touch moves when mouse isn't down\n+ if (e.pointerType == e.MSPOINTER_TYPE_MOUSE && e.buttons == 0) {\n+ return;\n+ }\n+\n+ if (touches.length == 1 && touches[0].pageX == e.pageX &&\n+ touches[0].pageY == e.pageY) {\n+ // don't trigger event when pointer has not moved\n+ return;\n+ }\n+ for (var i = 0, ii = touches.length; i < ii; ++i) {\n+ if (touches[i].pointerId == e.pointerId) {\n+ touches[i] = e;\n+ break;\n+ }\n+ }\n+\n+ e.touches = touches.slice();\n+ handler(e);\n+ };\n+\n+ OpenLayers.Event.observe(element, 'MSPointerMove', cb);\n+ },\n+\n+ /**\n+ * Method: addMsTouchListenerEnd\n+ *\n+ * Parameters:\n+ * element - {DOMElement} The DOM element to register the listener on\n+ * type - {String} The event type\n+ * handler - {Function} the handler\n+ */\n+ addMsTouchListenerEnd: function(element, type, handler) {\n+ var touches = this._msTouches;\n+\n+ var cb = function(e) {\n+\n+ for (var i = 0, ii = touches.length; i < ii; ++i) {\n+ if (touches[i].pointerId == e.pointerId) {\n+ touches.splice(i, 1);\n+ break;\n+ }\n+ }\n+\n+ e.touches = touches.slice();\n+ handler(e);\n+ };\n+\n+ OpenLayers.Event.observe(element, 'MSPointerUp', cb);\n+ },\n+\n+ CLASS_NAME: \"OpenLayers.Events\"\n+});\n+/* ======================================================================\n+ OpenLayers/Request/XMLHttpRequest.js\n+ ====================================================================== */\n+\n+// XMLHttpRequest.js Copyright (C) 2010 Sergey Ilinsky (http://www.ilinsky.com)\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+// http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+/**\n+ * @requires OpenLayers/Request.js\n+ */\n+\n+(function() {\n+\n+ // Save reference to earlier defined object implementation (if any)\n+ var oXMLHttpRequest = window.XMLHttpRequest;\n+\n+ // Define on browser type\n+ var bGecko = !!window.controllers,\n+ bIE = window.document.all && !window.opera,\n+ bIE7 = bIE && window.navigator.userAgent.match(/MSIE 7.0/);\n+\n+ // Enables \"XMLHttpRequest()\" call next to \"new XMLHttpReques()\"\n+ function fXMLHttpRequest() {\n+ this._object = oXMLHttpRequest && !bIE7 ? new oXMLHttpRequest : new window.ActiveXObject(\"Microsoft.XMLHTTP\");\n+ this._listeners = [];\n+ };\n+\n+ // Constructor\n+ function cXMLHttpRequest() {\n+ return new fXMLHttpRequest;\n+ };\n+ cXMLHttpRequest.prototype = fXMLHttpRequest.prototype;\n+\n+ // BUGFIX: Firefox with Firebug installed would break pages if not executed\n+ if (bGecko && oXMLHttpRequest.wrapped)\n+ cXMLHttpRequest.wrapped = oXMLHttpRequest.wrapped;\n+\n+ // Constants\n+ cXMLHttpRequest.UNSENT = 0;\n+ cXMLHttpRequest.OPENED = 1;\n+ cXMLHttpRequest.HEADERS_RECEIVED = 2;\n+ cXMLHttpRequest.LOADING = 3;\n+ cXMLHttpRequest.DONE = 4;\n+\n+ // Public Properties\n+ cXMLHttpRequest.prototype.readyState = cXMLHttpRequest.UNSENT;\n+ cXMLHttpRequest.prototype.responseText = '';\n+ cXMLHttpRequest.prototype.responseXML = null;\n+ cXMLHttpRequest.prototype.status = 0;\n+ cXMLHttpRequest.prototype.statusText = '';\n+\n+ // Priority proposal\n+ cXMLHttpRequest.prototype.priority = \"NORMAL\";\n+\n+ // Instance-level Events Handlers\n+ cXMLHttpRequest.prototype.onreadystatechange = null;\n+\n+ // Class-level Events Handlers\n+ cXMLHttpRequest.onreadystatechange = null;\n+ cXMLHttpRequest.onopen = null;\n+ cXMLHttpRequest.onsend = null;\n+ cXMLHttpRequest.onabort = null;\n+\n+ // Public Methods\n+ cXMLHttpRequest.prototype.open = function(sMethod, sUrl, bAsync, sUser, sPassword) {\n+ // Delete headers, required when object is reused\n+ delete this._headers;\n+\n+ // When bAsync parameter value is omitted, use true as default\n+ if (arguments.length < 3)\n+ bAsync = true;\n+\n+ // Save async parameter for fixing Gecko bug with missing readystatechange in synchronous requests\n+ this._async = bAsync;\n+\n+ // Set the onreadystatechange handler\n+ var oRequest = this,\n+ nState = this.readyState,\n+ fOnUnload;\n+\n+ // BUGFIX: IE - memory leak on page unload (inter-page leak)\n+ if (bIE && bAsync) {\n+ fOnUnload = function() {\n+ if (nState != cXMLHttpRequest.DONE) {\n+ fCleanTransport(oRequest);\n+ // Safe to abort here since onreadystatechange handler removed\n+ oRequest.abort();\n+ }\n+ };\n+ window.attachEvent(\"onunload\", fOnUnload);\n+ }\n+\n+ // Add method sniffer\n+ if (cXMLHttpRequest.onopen)\n+ cXMLHttpRequest.onopen.apply(this, arguments);\n+\n+ if (arguments.length > 4)\n+ this._object.open(sMethod, sUrl, bAsync, sUser, sPassword);\n+ else\n+ if (arguments.length > 3)\n+ this._object.open(sMethod, sUrl, bAsync, sUser);\n+ else\n+ this._object.open(sMethod, sUrl, bAsync);\n+\n+ this.readyState = cXMLHttpRequest.OPENED;\n+ fReadyStateChange(this);\n+\n+ this._object.onreadystatechange = function() {\n+ if (bGecko && !bAsync)\n+ return;\n+\n+ // Synchronize state\n+ oRequest.readyState = oRequest._object.readyState;\n+\n+ //\n+ fSynchronizeValues(oRequest);\n+\n+ // BUGFIX: Firefox fires unnecessary DONE when aborting\n+ if (oRequest._aborted) {\n+ // Reset readyState to UNSENT\n+ oRequest.readyState = cXMLHttpRequest.UNSENT;\n+\n+ // Return now\n+ return;\n+ }\n+\n+ if (oRequest.readyState == cXMLHttpRequest.DONE) {\n+ // Free up queue\n+ delete oRequest._data;\n+ /* if (bAsync)\n+ fQueue_remove(oRequest);*/\n+ //\n+ fCleanTransport(oRequest);\n+ // Uncomment this block if you need a fix for IE cache\n+ /*\n+ // BUGFIX: IE - cache issue\n+ if (!oRequest._object.getResponseHeader(\"Date\")) {\n+ // Save object to cache\n+ oRequest._cached = oRequest._object;\n+\n+ // Instantiate a new transport object\n+ cXMLHttpRequest.call(oRequest);\n+\n+ // Re-send request\n+ if (sUser) {\n+ if (sPassword)\n+ oRequest._object.open(sMethod, sUrl, bAsync, sUser, sPassword);\n+ else\n+ oRequest._object.open(sMethod, sUrl, bAsync, sUser);\n+ }\n+ else\n+ oRequest._object.open(sMethod, sUrl, bAsync);\n+ oRequest._object.setRequestHeader(\"If-Modified-Since\", oRequest._cached.getResponseHeader(\"Last-Modified\") || new window.Date(0));\n+ // Copy headers set\n+ if (oRequest._headers)\n+ for (var sHeader in oRequest._headers)\n+ if (typeof oRequest._headers[sHeader] == \"string\") // Some frameworks prototype objects with functions\n+ oRequest._object.setRequestHeader(sHeader, oRequest._headers[sHeader]);\n+\n+ oRequest._object.onreadystatechange = function() {\n+ // Synchronize state\n+ oRequest.readyState = oRequest._object.readyState;\n+\n+ if (oRequest._aborted) {\n+ //\n+ oRequest.readyState = cXMLHttpRequest.UNSENT;\n+\n+ // Return\n+ return;\n+ }\n+\n+ if (oRequest.readyState == cXMLHttpRequest.DONE) {\n+ // Clean Object\n+ fCleanTransport(oRequest);\n+\n+ // get cached request\n+ if (oRequest.status == 304)\n+ oRequest._object = oRequest._cached;\n+\n+ //\n+ delete oRequest._cached;\n+\n+ //\n+ fSynchronizeValues(oRequest);\n+\n+ //\n+ fReadyStateChange(oRequest);\n+\n+ // BUGFIX: IE - memory leak in interrupted\n+ if (bIE && bAsync)\n+ window.detachEvent(\"onunload\", fOnUnload);\n+ }\n+ };\n+ oRequest._object.send(null);\n+\n+ // Return now - wait until re-sent request is finished\n+ return;\n+ };\n+ */\n+ // BUGFIX: IE - memory leak in interrupted\n+ if (bIE && bAsync)\n+ window.detachEvent(\"onunload\", fOnUnload);\n+ }\n+\n+ // BUGFIX: Some browsers (Internet Explorer, Gecko) fire OPEN readystate twice\n+ if (nState != oRequest.readyState)\n+ fReadyStateChange(oRequest);\n+\n+ nState = oRequest.readyState;\n+ }\n+ };\n+\n+ function fXMLHttpRequest_send(oRequest) {\n+ oRequest._object.send(oRequest._data);\n+\n+ // BUGFIX: Gecko - missing readystatechange calls in synchronous requests\n+ if (bGecko && !oRequest._async) {\n+ oRequest.readyState = cXMLHttpRequest.OPENED;\n+\n+ // Synchronize state\n+ fSynchronizeValues(oRequest);\n+\n+ // Simulate missing states\n+ while (oRequest.readyState < cXMLHttpRequest.DONE) {\n+ oRequest.readyState++;\n+ fReadyStateChange(oRequest);\n+ // Check if we are aborted\n+ if (oRequest._aborted)\n+ return;\n+ }\n+ }\n+ };\n+ cXMLHttpRequest.prototype.send = function(vData) {\n+ // Add method sniffer\n+ if (cXMLHttpRequest.onsend)\n+ cXMLHttpRequest.onsend.apply(this, arguments);\n+\n+ if (!arguments.length)\n+ vData = null;\n+\n+ // BUGFIX: Safari - fails sending documents created/modified dynamically, so an explicit serialization required\n+ // BUGFIX: IE - rewrites any custom mime-type to \"text/xml\" in case an XMLNode is sent\n+ // BUGFIX: Gecko - fails sending Element (this is up to the implementation either to standard)\n+ if (vData && vData.nodeType) {\n+ vData = window.XMLSerializer ? new window.XMLSerializer().serializeToString(vData) : vData.xml;\n+ if (!this._headers[\"Content-Type\"])\n+ this._object.setRequestHeader(\"Content-Type\", \"application/xml\");\n+ }\n+\n+ this._data = vData;\n+ /*\n+ // Add to queue\n+ if (this._async)\n+ fQueue_add(this);\n+ else*/\n+ fXMLHttpRequest_send(this);\n+ };\n+ cXMLHttpRequest.prototype.abort = function() {\n+ // Add method sniffer\n+ if (cXMLHttpRequest.onabort)\n+ cXMLHttpRequest.onabort.apply(this, arguments);\n+\n+ // BUGFIX: Gecko - unnecessary DONE when aborting\n+ if (this.readyState > cXMLHttpRequest.UNSENT)\n+ this._aborted = true;\n+\n+ this._object.abort();\n+\n+ // BUGFIX: IE - memory leak\n+ fCleanTransport(this);\n+\n+ this.readyState = cXMLHttpRequest.UNSENT;\n+\n+ delete this._data;\n+ /* if (this._async)\n+ fQueue_remove(this);*/\n+ };\n+ cXMLHttpRequest.prototype.getAllResponseHeaders = function() {\n+ return this._object.getAllResponseHeaders();\n+ };\n+ cXMLHttpRequest.prototype.getResponseHeader = function(sName) {\n+ return this._object.getResponseHeader(sName);\n+ };\n+ cXMLHttpRequest.prototype.setRequestHeader = function(sName, sValue) {\n+ // BUGFIX: IE - cache issue\n+ if (!this._headers)\n+ this._headers = {};\n+ this._headers[sName] = sValue;\n+\n+ return this._object.setRequestHeader(sName, sValue);\n+ };\n+\n+ // EventTarget interface implementation\n+ cXMLHttpRequest.prototype.addEventListener = function(sName, fHandler, bUseCapture) {\n+ for (var nIndex = 0, oListener; oListener = this._listeners[nIndex]; nIndex++)\n+ if (oListener[0] == sName && oListener[1] == fHandler && oListener[2] == bUseCapture)\n+ return;\n+ // Add listener\n+ this._listeners.push([sName, fHandler, bUseCapture]);\n+ };\n+\n+ cXMLHttpRequest.prototype.removeEventListener = function(sName, fHandler, bUseCapture) {\n+ for (var nIndex = 0, oListener; oListener = this._listeners[nIndex]; nIndex++)\n+ if (oListener[0] == sName && oListener[1] == fHandler && oListener[2] == bUseCapture)\n+ break;\n+ // Remove listener\n+ if (oListener)\n+ this._listeners.splice(nIndex, 1);\n+ };\n+\n+ cXMLHttpRequest.prototype.dispatchEvent = function(oEvent) {\n+ var oEventPseudo = {\n+ 'type': oEvent.type,\n+ 'target': this,\n+ 'currentTarget': this,\n+ 'eventPhase': 2,\n+ 'bubbles': oEvent.bubbles,\n+ 'cancelable': oEvent.cancelable,\n+ 'timeStamp': oEvent.timeStamp,\n+ 'stopPropagation': function() {}, // There is no flow\n+ 'preventDefault': function() {}, // There is no default action\n+ 'initEvent': function() {} // Original event object should be initialized\n+ };\n+\n+ // Execute onreadystatechange\n+ if (oEventPseudo.type == \"readystatechange\" && this.onreadystatechange)\n+ (this.onreadystatechange.handleEvent || this.onreadystatechange).apply(this, [oEventPseudo]);\n+\n+ // Execute listeners\n+ for (var nIndex = 0, oListener; oListener = this._listeners[nIndex]; nIndex++)\n+ if (oListener[0] == oEventPseudo.type && !oListener[2])\n+ (oListener[1].handleEvent || oListener[1]).apply(this, [oEventPseudo]);\n+ };\n+\n+ //\n+ cXMLHttpRequest.prototype.toString = function() {\n+ return '[' + \"object\" + ' ' + \"XMLHttpRequest\" + ']';\n+ };\n+\n+ cXMLHttpRequest.toString = function() {\n+ return '[' + \"XMLHttpRequest\" + ']';\n+ };\n+\n+ // Helper function\n+ function fReadyStateChange(oRequest) {\n+ // Sniffing code\n+ if (cXMLHttpRequest.onreadystatechange)\n+ cXMLHttpRequest.onreadystatechange.apply(oRequest);\n+\n+ // Fake event\n+ oRequest.dispatchEvent({\n+ 'type': \"readystatechange\",\n+ 'bubbles': false,\n+ 'cancelable': false,\n+ 'timeStamp': new Date + 0\n+ });\n+ };\n+\n+ function fGetDocument(oRequest) {\n+ var oDocument = oRequest.responseXML,\n+ sResponse = oRequest.responseText;\n+ // Try parsing responseText\n+ if (bIE && sResponse && oDocument && !oDocument.documentElement && oRequest.getResponseHeader(\"Content-Type\").match(/[^\\/]+\\/[^\\+]+\\+xml/)) {\n+ oDocument = new window.ActiveXObject(\"Microsoft.XMLDOM\");\n+ oDocument.async = false;\n+ oDocument.validateOnParse = false;\n+ oDocument.loadXML(sResponse);\n+ }\n+ // Check if there is no error in document\n+ if (oDocument)\n+ if ((bIE && oDocument.parseError != 0) || !oDocument.documentElement || (oDocument.documentElement && oDocument.documentElement.tagName == \"parsererror\"))\n+ return null;\n+ return oDocument;\n+ };\n+\n+ function fSynchronizeValues(oRequest) {\n+ try {\n+ oRequest.responseText = oRequest._object.responseText;\n+ } catch (e) {}\n+ try {\n+ oRequest.responseXML = fGetDocument(oRequest._object);\n+ } catch (e) {}\n+ try {\n+ oRequest.status = oRequest._object.status;\n+ } catch (e) {}\n+ try {\n+ oRequest.statusText = oRequest._object.statusText;\n+ } catch (e) {}\n+ };\n+\n+ function fCleanTransport(oRequest) {\n+ // BUGFIX: IE - memory leak (on-page leak)\n+ oRequest._object.onreadystatechange = new window.Function;\n+ };\n+ /*\n+ // Queue manager\n+ var oQueuePending = {\"CRITICAL\":[],\"HIGH\":[],\"NORMAL\":[],\"LOW\":[],\"LOWEST\":[]},\n+ aQueueRunning = [];\n+ function fQueue_add(oRequest) {\n+ oQueuePending[oRequest.priority in oQueuePending ? oRequest.priority : \"NORMAL\"].push(oRequest);\n+ //\n+ setTimeout(fQueue_process);\n+ };\n+\n+ function fQueue_remove(oRequest) {\n+ for (var nIndex = 0, bFound = false; nIndex < aQueueRunning.length; nIndex++)\n+ if (bFound)\n+ aQueueRunning[nIndex - 1] = aQueueRunning[nIndex];\n+ else\n+ if (aQueueRunning[nIndex] == oRequest)\n+ bFound = true;\n+ if (bFound)\n+ aQueueRunning.length--;\n+ //\n+ setTimeout(fQueue_process);\n+ };\n+\n+ function fQueue_process() {\n+ if (aQueueRunning.length < 6) {\n+ for (var sPriority in oQueuePending) {\n+ if (oQueuePending[sPriority].length) {\n+ var oRequest = oQueuePending[sPriority][0];\n+ oQueuePending[sPriority] = oQueuePending[sPriority].slice(1);\n+ //\n+ aQueueRunning.push(oRequest);\n+ // Send request\n+ fXMLHttpRequest_send(oRequest);\n+ break;\n+ }\n+ }\n+ }\n+ };\n+ */\n+ // Internet Explorer 5.0 (missing apply)\n+ if (!window.Function.prototype.apply) {\n+ window.Function.prototype.apply = function(oRequest, oArguments) {\n+ if (!oArguments)\n+ oArguments = [];\n+ oRequest.__func = this;\n+ oRequest.__func(oArguments[0], oArguments[1], oArguments[2], oArguments[3], oArguments[4]);\n+ delete oRequest.__func;\n+ };\n+ };\n+\n+ // Register new object with window\n+ /**\n+ * Class: OpenLayers.Request.XMLHttpRequest\n+ * Standard-compliant (W3C) cross-browser implementation of the\n+ * XMLHttpRequest object. From\n+ * http://code.google.com/p/xmlhttprequest/.\n+ */\n+ if (!OpenLayers.Request) {\n+ /**\n+ * This allows for OpenLayers/Request.js to be included\n+ * before or after this script.\n+ */\n+ OpenLayers.Request = {};\n+ }\n+ OpenLayers.Request.XMLHttpRequest = cXMLHttpRequest;\n+})();\n+/* ======================================================================\n+ OpenLayers/Request.js\n+ ====================================================================== */\n+\n+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n+ * full list of contributors). Published under the 2-clause BSD license.\n+ * See license.txt in the OpenLayers distribution or repository for the\n+ * full text of the license. */\n+\n+/**\n+ * @requires OpenLayers/Events.js\n+ * @requires OpenLayers/Request/XMLHttpRequest.js\n+ */\n+\n+/**\n+ * TODO: deprecate me\n+ * Use OpenLayers.Request.proxy instead.\n+ */\n+OpenLayers.ProxyHost = \"\";\n+\n+/**\n+ * Namespace: OpenLayers.Request\n+ * The OpenLayers.Request namespace contains convenience methods for working\n+ * with XMLHttpRequests. These methods work with a cross-browser\n+ * W3C compliant class.\n+ */\n+if (!OpenLayers.Request) {\n+ /**\n+ * This allows for OpenLayers/Request/XMLHttpRequest.js to be included\n+ * before or after this script.\n+ */\n+ OpenLayers.Request = {};\n+}\n+OpenLayers.Util.extend(OpenLayers.Request, {\n+\n+ /**\n+ * Constant: DEFAULT_CONFIG\n+ * {Object} Default configuration for all requests.\n+ */\n+ DEFAULT_CONFIG: {\n+ method: \"GET\",\n+ url: window.location.href,\n+ async: true,\n+ user: undefined,\n+ password: undefined,\n+ params: null,\n+ proxy: OpenLayers.ProxyHost,\n+ headers: {},\n+ data: null,\n+ callback: function() {},\n+ success: null,\n+ failure: null,\n+ scope: null\n+ },\n+\n+ /**\n+ * Constant: URL_SPLIT_REGEX\n+ */\n+ URL_SPLIT_REGEX: /([^:]*:)\\/\\/([^:]*:?[^@]*@)?([^:\\/\\?]*):?([^\\/\\?]*)/,\n+\n+ /**\n+ * APIProperty: events\n+ * {} An events object that handles all \n+ * events on the {} object.\n+ *\n+ * All event listeners will receive an event object with three properties:\n+ * request - {} The request object.\n+ * config - {Object} The config object sent to the specific request method.\n+ * requestUrl - {String} The request url.\n+ * \n+ * Supported event types:\n+ * complete - Triggered when we have a response from the request, if a\n+ * listener returns false, no further response processing will take\n+ * place.\n+ * success - Triggered when the HTTP response has a success code (200-299).\n+ * failure - Triggered when the HTTP response does not have a success code.\n+ */\n+ events: new OpenLayers.Events(this),\n+\n+ /**\n+ * Method: makeSameOrigin\n+ * Using the specified proxy, returns a same origin url of the provided url.\n+ *\n+ * Parameters:\n+ * url - {String} An arbitrary url\n+ * proxy {String|Function} The proxy to use to make the provided url a\n+ * same origin url.\n+ *\n+ * Returns\n+ * {String} the same origin url. If no proxy is provided, the returned url\n+ * will be the same as the provided url.\n+ */\n+ makeSameOrigin: function(url, proxy) {\n+ var sameOrigin = url.indexOf(\"http\") !== 0;\n+ var urlParts = !sameOrigin && url.match(this.URL_SPLIT_REGEX);\n+ if (urlParts) {\n+ var location = window.location;\n+ sameOrigin =\n+ urlParts[1] == location.protocol &&\n+ urlParts[3] == location.hostname;\n+ var uPort = urlParts[4],\n+ lPort = location.port;\n+ if (uPort != 80 && uPort != \"\" || lPort != \"80\" && lPort != \"\") {\n+ sameOrigin = sameOrigin && uPort == lPort;\n+ }\n+ }\n+ if (!sameOrigin) {\n+ if (proxy) {\n+ if (typeof proxy == \"function\") {\n+ url = proxy(url);\n+ } else {\n+ url = proxy + encodeURIComponent(url);\n+ }\n+ }\n+ }\n+ return url;\n+ },\n+\n+ /**\n+ * APIMethod: issue\n+ * Create a new XMLHttpRequest object, open it, set any headers, bind\n+ * a callback to done state, and send any data. It is recommended that\n+ * you use one , , , , , or .\n+ * This method is only documented to provide detail on the configuration\n+ * options available to all request methods.\n+ *\n+ * Parameters:\n+ * config - {Object} Object containing properties for configuring the\n+ * request. Allowed configuration properties are described below.\n+ * This object is modified and should not be reused.\n+ *\n+ * Allowed config properties:\n+ * method - {String} One of GET, POST, PUT, DELETE, HEAD, or\n+ * OPTIONS. Default is GET.\n+ * url - {String} URL for the request.\n+ * async - {Boolean} Open an asynchronous request. Default is true.\n+ * user - {String} User for relevant authentication scheme. Set\n+ * to null to clear current user.\n+ * password - {String} Password for relevant authentication scheme.\n+ * Set to null to clear current password.\n+ * proxy - {String} Optional proxy. Defaults to\n+ * .\n+ * params - {Object} Any key:value pairs to be appended to the\n+ * url as a query string. Assumes url doesn't already include a query\n+ * string or hash. Typically, this is only appropriate for \n+ * requests where the query string will be appended to the url.\n+ * Parameter values that are arrays will be\n+ * concatenated with a comma (note that this goes against form-encoding)\n+ * as is done with .\n+ * headers - {Object} Object with header:value pairs to be set on\n+ * the request.\n+ * data - {String | Document} Optional data to send with the request.\n+ * Typically, this is only used with and requests.\n+ * Make sure to provide the appropriate \"Content-Type\" header for your\n+ * data. For and requests, the content type defaults to\n+ * \"application-xml\". If your data is a different content type, or\n+ * if you are using a different HTTP method, set the \"Content-Type\"\n+ * header to match your data type.\n+ * callback - {Function} Function to call when request is done.\n+ * To determine if the request failed, check request.status (200\n+ * indicates success).\n+ * success - {Function} Optional function to call if request status is in\n+ * the 200s. This will be called in addition to callback above and\n+ * would typically only be used as an alternative.\n+ * failure - {Function} Optional function to call if request status is not\n+ * in the 200s. This will be called in addition to callback above and\n+ * would typically only be used as an alternative.\n+ * scope - {Object} If callback is a public method on some object,\n+ * set the scope to that object.\n+ *\n+ * Returns:\n+ * {XMLHttpRequest} Request object. To abort the request before a response\n+ * is received, call abort() on the request object.\n+ */\n+ issue: function(config) {\n+ // apply default config - proxy host may have changed\n+ var defaultConfig = OpenLayers.Util.extend(\n+ this.DEFAULT_CONFIG, {\n+ proxy: OpenLayers.ProxyHost\n+ }\n+ );\n+ config = config || {};\n+ config.headers = config.headers || {};\n+ config = OpenLayers.Util.applyDefaults(config, defaultConfig);\n+ config.headers = OpenLayers.Util.applyDefaults(config.headers, defaultConfig.headers);\n+ // Always set the \"X-Requested-With\" header to signal that this request\n+ // was issued through the XHR-object. Since header keys are case \n+ // insensitive and we want to allow overriding of the \"X-Requested-With\"\n+ // header through the user we cannot use applyDefaults, but have to \n+ // check manually whether we were called with a \"X-Requested-With\"\n+ // header.\n+ var customRequestedWithHeader = false,\n+ headerKey;\n+ for (headerKey in config.headers) {\n+ if (config.headers.hasOwnProperty(headerKey)) {\n+ if (headerKey.toLowerCase() === 'x-requested-with') {\n+ customRequestedWithHeader = true;\n+ }\n+ }\n+ }\n+ if (customRequestedWithHeader === false) {\n+ // we did not have a custom \"X-Requested-With\" header\n+ config.headers['X-Requested-With'] = 'XMLHttpRequest';\n+ }\n+\n+ // create request, open, and set headers\n+ var request = new OpenLayers.Request.XMLHttpRequest();\n+ var url = OpenLayers.Util.urlAppend(config.url,\n+ OpenLayers.Util.getParameterString(config.params || {}));\n+ url = OpenLayers.Request.makeSameOrigin(url, config.proxy);\n+ request.open(\n+ config.method, url, config.async, config.user, config.password\n+ );\n+ for (var header in config.headers) {\n+ request.setRequestHeader(header, config.headers[header]);\n+ }\n+\n+ var events = this.events;\n+\n+ // we want to execute runCallbacks with \"this\" as the\n+ // execution scope\n+ var self = this;\n+\n+ request.onreadystatechange = function() {\n+ if (request.readyState == OpenLayers.Request.XMLHttpRequest.DONE) {\n+ var proceed = events.triggerEvent(\n+ \"complete\", {\n+ request: request,\n+ config: config,\n+ requestUrl: url\n+ }\n+ );\n+ if (proceed !== false) {\n+ self.runCallbacks({\n+ request: request,\n+ config: config,\n+ requestUrl: url\n+ });\n+ }\n+ }\n+ };\n+\n+ // send request (optionally with data) and return\n+ // call in a timeout for asynchronous requests so the return is\n+ // available before readyState == 4 for cached docs\n+ if (config.async === false) {\n+ request.send(config.data);\n+ } else {\n+ window.setTimeout(function() {\n+ if (request.readyState !== 0) { // W3C: 0-UNSENT\n+ request.send(config.data);\n+ }\n+ }, 0);\n+ }\n+ return request;\n+ },\n+\n+ /**\n+ * Method: runCallbacks\n+ * Calls the complete, success and failure callbacks. Application\n+ * can listen to the \"complete\" event, have the listener \n+ * display a confirm window and always return false, and\n+ * execute OpenLayers.Request.runCallbacks if the user\n+ * hits \"yes\" in the confirm window.\n+ *\n+ * Parameters:\n+ * options - {Object} Hash containing request, config and requestUrl keys\n+ */\n+ runCallbacks: function(options) {\n+ var request = options.request;\n+ var config = options.config;\n+\n+ // bind callbacks to readyState 4 (done)\n+ var complete = (config.scope) ?\n+ OpenLayers.Function.bind(config.callback, config.scope) :\n+ config.callback;\n+\n+ // optional success callback\n+ var success;\n+ if (config.success) {\n+ success = (config.scope) ?\n+ OpenLayers.Function.bind(config.success, config.scope) :\n+ config.success;\n+ }\n+\n+ // optional failure callback\n+ var failure;\n+ if (config.failure) {\n+ failure = (config.scope) ?\n+ OpenLayers.Function.bind(config.failure, config.scope) :\n+ config.failure;\n+ }\n+\n+ if (OpenLayers.Util.createUrlObject(config.url).protocol == \"file:\" &&\n+ request.responseText) {\n+ request.status = 200;\n+ }\n+ complete(request);\n+\n+ if (!request.status || (request.status >= 200 && request.status < 300)) {\n+ this.events.triggerEvent(\"success\", options);\n+ if (success) {\n+ success(request);\n+ }\n+ }\n+ if (request.status && (request.status < 200 || request.status >= 300)) {\n+ this.events.triggerEvent(\"failure\", options);\n+ if (failure) {\n+ failure(request);\n+ }\n+ }\n+ },\n+\n+ /**\n+ * APIMethod: GET\n+ * Send an HTTP GET request. Additional configuration properties are\n+ * documented in the method, with the method property set\n+ * to GET.\n+ *\n+ * Parameters:\n+ * config - {Object} Object with properties for configuring the request.\n+ * See the method for documentation of allowed properties.\n+ * This object is modified and should not be reused.\n+ * \n+ * Returns:\n+ * {XMLHttpRequest} Request object.\n+ */\n+ GET: function(config) {\n+ config = OpenLayers.Util.extend(config, {\n+ method: \"GET\"\n+ });\n+ return OpenLayers.Request.issue(config);\n+ },\n+\n+ /**\n+ * APIMethod: POST\n+ * Send a POST request. Additional configuration properties are\n+ * documented in the method, with the method property set\n+ * to POST and \"Content-Type\" header set to \"application/xml\".\n+ *\n+ * Parameters:\n+ * config - {Object} Object with properties for configuring the request.\n+ * See the method for documentation of allowed properties. The\n+ * default \"Content-Type\" header will be set to \"application-xml\" if\n+ * none is provided. This object is modified and should not be reused.\n+ * \n+ * Returns:\n+ * {XMLHttpRequest} Request object.\n+ */\n+ POST: function(config) {\n+ config = OpenLayers.Util.extend(config, {\n+ method: \"POST\"\n+ });\n+ // set content type to application/xml if it isn't already set\n+ config.headers = config.headers ? config.headers : {};\n+ if (!(\"CONTENT-TYPE\" in OpenLayers.Util.upperCaseObject(config.headers))) {\n+ config.headers[\"Content-Type\"] = \"application/xml\";\n+ }\n+ return OpenLayers.Request.issue(config);\n+ },\n+\n+ /**\n+ * APIMethod: PUT\n+ * Send an HTTP PUT request. Additional configuration properties are\n+ * documented in the method, with the method property set\n+ * to PUT and \"Content-Type\" header set to \"application/xml\".\n+ *\n+ * Parameters:\n+ * config - {Object} Object with properties for configuring the request.\n+ * See the method for documentation of allowed properties. The\n+ * default \"Content-Type\" header will be set to \"application-xml\" if\n+ * none is provided. This object is modified and should not be reused.\n+ * \n+ * Returns:\n+ * {XMLHttpRequest} Request object.\n+ */\n+ PUT: function(config) {\n+ config = OpenLayers.Util.extend(config, {\n+ method: \"PUT\"\n+ });\n+ // set content type to application/xml if it isn't already set\n+ config.headers = config.headers ? config.headers : {};\n+ if (!(\"CONTENT-TYPE\" in OpenLayers.Util.upperCaseObject(config.headers))) {\n+ config.headers[\"Content-Type\"] = \"application/xml\";\n+ }\n+ return OpenLayers.Request.issue(config);\n+ },\n+\n+ /**\n+ * APIMethod: DELETE\n+ * Send an HTTP DELETE request. Additional configuration properties are\n+ * documented in the method, with the method property set\n+ * to DELETE.\n+ *\n+ * Parameters:\n+ * config - {Object} Object with properties for configuring the request.\n+ * See the method for documentation of allowed properties.\n+ * This object is modified and should not be reused.\n+ * \n+ * Returns:\n+ * {XMLHttpRequest} Request object.\n+ */\n+ DELETE: function(config) {\n+ config = OpenLayers.Util.extend(config, {\n+ method: \"DELETE\"\n+ });\n+ return OpenLayers.Request.issue(config);\n+ },\n+\n+ /**\n+ * APIMethod: HEAD\n+ * Send an HTTP HEAD request. Additional configuration properties are\n+ * documented in the method, with the method property set\n+ * to HEAD.\n+ *\n+ * Parameters:\n+ * config - {Object} Object with properties for configuring the request.\n+ * See the method for documentation of allowed properties.\n+ * This object is modified and should not be reused.\n+ * \n+ * Returns:\n+ * {XMLHttpRequest} Request object.\n+ */\n+ HEAD: function(config) {\n+ config = OpenLayers.Util.extend(config, {\n+ method: \"HEAD\"\n+ });\n+ return OpenLayers.Request.issue(config);\n+ },\n+\n+ /**\n+ * APIMethod: OPTIONS\n+ * Send an HTTP OPTIONS request. Additional configuration properties are\n+ * documented in the method, with the method property set\n+ * to OPTIONS.\n+ *\n+ * Parameters:\n+ * config - {Object} Object with properties for configuring the request.\n+ * See the method for documentation of allowed properties.\n+ * This object is modified and should not be reused.\n+ * \n+ * Returns:\n+ * {XMLHttpRequest} Request object.\n+ */\n+ OPTIONS: function(config) {\n+ config = OpenLayers.Util.extend(config, {\n+ method: \"OPTIONS\"\n+ });\n+ return OpenLayers.Request.issue(config);\n+ }\n+\n+});\n+/* ======================================================================\n+ OpenLayers/Geometry.js\n+ ====================================================================== */\n+\n+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n+ * full list of contributors). Published under the 2-clause BSD license.\n+ * See license.txt in the OpenLayers distribution or repository for the\n+ * full text of the license. */\n+\n+/**\n+ * @requires OpenLayers/BaseTypes/Class.js\n+ */\n+\n+/**\n+ * Class: OpenLayers.Geometry\n+ * A Geometry is a description of a geographic object. Create an instance of\n+ * this class with the constructor. This is a base class,\n+ * typical geometry types are described by subclasses of this class.\n+ *\n+ * Note that if you use the method, you must\n+ * explicitly include the OpenLayers.Format.WKT in your build.\n+ */\n+OpenLayers.Geometry = OpenLayers.Class({\n+\n+ /**\n+ * Property: id\n+ * {String} A unique identifier for this geometry.\n+ */\n+ id: null,\n+\n+ /**\n+ * Property: parent\n+ * {}This is set when a Geometry is added as component\n+ * of another geometry\n+ */\n+ parent: null,\n+\n+ /**\n+ * Property: bounds \n+ * {} The bounds of this geometry\n+ */\n+ bounds: null,\n+\n+ /**\n+ * Constructor: OpenLayers.Geometry\n+ * Creates a geometry object. \n+ */\n+ initialize: function() {\n+ this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + \"_\");\n+ },\n+\n+ /**\n+ * Method: destroy\n+ * Destroy this geometry.\n+ */\n+ destroy: function() {\n+ this.id = null;\n+ this.bounds = null;\n+ },\n+\n+ /**\n+ * APIMethod: clone\n+ * Create a clone of this geometry. Does not set any non-standard\n+ * properties of the cloned geometry.\n+ * \n+ * Returns:\n+ * {} An exact clone of this geometry.\n+ */\n+ clone: function() {\n+ return new OpenLayers.Geometry();\n+ },\n+\n+ /**\n+ * Method: setBounds\n+ * Set the bounds for this Geometry.\n+ * \n+ * Parameters:\n+ * bounds - {} \n+ */\n+ setBounds: function(bounds) {\n+ if (bounds) {\n+ this.bounds = bounds.clone();\n+ }\n+ },\n+\n+ /**\n+ * Method: clearBounds\n+ * Nullify this components bounds and that of its parent as well.\n+ */\n+ clearBounds: function() {\n+ this.bounds = null;\n+ if (this.parent) {\n+ this.parent.clearBounds();\n+ }\n+ },\n+\n+ /**\n+ * Method: extendBounds\n+ * Extend the existing bounds to include the new bounds. \n+ * If geometry's bounds is not yet set, then set a new Bounds.\n+ * \n+ * Parameters:\n+ * newBounds - {} \n+ */\n+ extendBounds: function(newBounds) {\n+ var bounds = this.getBounds();\n+ if (!bounds) {\n+ this.setBounds(newBounds);\n+ } else {\n+ this.bounds.extend(newBounds);\n+ }\n+ },\n+\n+ /**\n+ * APIMethod: getBounds\n+ * Get the bounds for this Geometry. If bounds is not set, it \n+ * is calculated again, this makes queries faster.\n+ * \n+ * Returns:\n+ * {}\n+ */\n+ getBounds: function() {\n+ if (this.bounds == null) {\n+ this.calculateBounds();\n+ }\n+ return this.bounds;\n+ },\n+\n+ /** \n+ * APIMethod: calculateBounds\n+ * Recalculate the bounds for the geometry. \n+ */\n+ calculateBounds: function() {\n+ //\n+ // This should be overridden by subclasses.\n+ //\n+ },\n+\n+ /**\n+ * APIMethod: distanceTo\n+ * Calculate the closest distance between two geometries (on the x-y plane).\n+ *\n+ * Parameters:\n+ * geometry - {} The target geometry.\n+ * options - {Object} Optional properties for configuring the distance\n+ * calculation.\n+ *\n+ * Valid options depend on the specific geometry type.\n+ * \n+ * Returns:\n+ * {Number | Object} The distance between this geometry and the target.\n+ * If details is true, the return will be an object with distance,\n+ * x0, y0, x1, and x2 properties. The x0 and y0 properties represent\n+ * the coordinates of the closest point on this geometry. The x1 and y1\n+ * properties represent the coordinates of the closest point on the\n+ * target geometry.\n+ */\n+ distanceTo: function(geometry, options) {},\n+\n+ /**\n+ * APIMethod: getVertices\n+ * Return a list of all points in this geometry.\n+ *\n+ * Parameters:\n+ * nodes - {Boolean} For lines, only return vertices that are\n+ * endpoints. If false, for lines, only vertices that are not\n+ * endpoints will be returned. If not provided, all vertices will\n+ * be returned.\n+ *\n+ * Returns:\n+ * {Array} A list of all vertices in the geometry.\n+ */\n+ getVertices: function(nodes) {},\n+\n+ /**\n+ * Method: atPoint\n+ * Note - This is only an approximation based on the bounds of the \n+ * geometry.\n+ * \n+ * Parameters:\n+ * lonlat - {|Object} OpenLayers.LonLat or an\n+ * object with a 'lon' and 'lat' properties.\n+ * toleranceLon - {float} Optional tolerance in Geometric Coords\n+ * toleranceLat - {float} Optional tolerance in Geographic Coords\n+ * \n+ * Returns:\n+ * {Boolean} Whether or not the geometry is at the specified location\n+ */\n+ atPoint: function(lonlat, toleranceLon, toleranceLat) {\n+ var atPoint = false;\n+ var bounds = this.getBounds();\n+ if ((bounds != null) && (lonlat != null)) {\n+\n+ var dX = (toleranceLon != null) ? toleranceLon : 0;\n+ var dY = (toleranceLat != null) ? toleranceLat : 0;\n+\n+ var toleranceBounds =\n+ new OpenLayers.Bounds(this.bounds.left - dX,\n+ this.bounds.bottom - dY,\n+ this.bounds.right + dX,\n+ this.bounds.top + dY);\n+\n+ atPoint = toleranceBounds.containsLonLat(lonlat);\n+ }\n+ return atPoint;\n+ },\n+\n+ /**\n+ * Method: getLength\n+ * Calculate the length of this geometry. This method is defined in\n+ * subclasses.\n+ * \n+ * Returns:\n+ * {Float} The length of the collection by summing its parts\n+ */\n+ getLength: function() {\n+ //to be overridden by geometries that actually have a length\n+ //\n+ return 0.0;\n+ },\n+\n+ /**\n+ * Method: getArea\n+ * Calculate the area of this geometry. This method is defined in subclasses.\n+ * \n+ * Returns:\n+ * {Float} The area of the collection by summing its parts\n+ */\n+ getArea: function() {\n+ //to be overridden by geometries that actually have an area\n+ //\n+ return 0.0;\n+ },\n+\n+ /**\n+ * APIMethod: getCentroid\n+ * Calculate the centroid of this geometry. This method is defined in subclasses.\n+ *\n+ * Returns:\n+ * {} The centroid of the collection\n+ */\n+ getCentroid: function() {\n+ return null;\n+ },\n+\n+ /**\n+ * Method: toString\n+ * Returns a text representation of the geometry. If the WKT format is\n+ * included in a build, this will be the Well-Known Text \n+ * representation.\n+ *\n+ * Returns:\n+ * {String} String representation of this geometry.\n+ */\n+ toString: function() {\n+ var string;\n+ if (OpenLayers.Format && OpenLayers.Format.WKT) {\n+ string = OpenLayers.Format.WKT.prototype.write(\n+ new OpenLayers.Feature.Vector(this)\n+ );\n+ } else {\n+ string = Object.prototype.toString.call(this);\n+ }\n+ return string;\n+ },\n+\n+ CLASS_NAME: \"OpenLayers.Geometry\"\n+});\n+\n+/**\n+ * Function: OpenLayers.Geometry.fromWKT\n+ * Generate a geometry given a Well-Known Text string. For this method to\n+ * work, you must include the OpenLayers.Format.WKT in your build \n+ * explicitly.\n+ *\n+ * Parameters:\n+ * wkt - {String} A string representing the geometry in Well-Known Text.\n+ *\n+ * Returns:\n+ * {} A geometry of the appropriate class.\n+ */\n+OpenLayers.Geometry.fromWKT = function(wkt) {\n+ var geom;\n+ if (OpenLayers.Format && OpenLayers.Format.WKT) {\n+ var format = OpenLayers.Geometry.fromWKT.format;\n+ if (!format) {\n+ format = new OpenLayers.Format.WKT();\n+ OpenLayers.Geometry.fromWKT.format = format;\n+ }\n+ var result = format.read(wkt);\n+ if (result instanceof OpenLayers.Feature.Vector) {\n+ geom = result.geometry;\n+ } else if (OpenLayers.Util.isArray(result)) {\n+ var len = result.length;\n+ var components = new Array(len);\n+ for (var i = 0; i < len; ++i) {\n+ components[i] = result[i].geometry;\n+ }\n+ geom = new OpenLayers.Geometry.Collection(components);\n+ }\n+ }\n+ return geom;\n+};\n+\n+/**\n+ * Method: OpenLayers.Geometry.segmentsIntersect\n+ * Determine whether two line segments intersect. Optionally calculates\n+ * and returns the intersection point. This function is optimized for\n+ * cases where seg1.x2 >= seg2.x1 || seg2.x2 >= seg1.x1. In those\n+ * obvious cases where there is no intersection, the function should\n+ * not be called.\n+ *\n+ * Parameters:\n+ * seg1 - {Object} Object representing a segment with properties x1, y1, x2,\n+ * and y2. The start point is represented by x1 and y1. The end point\n+ * is represented by x2 and y2. Start and end are ordered so that x1 < x2.\n+ * seg2 - {Object} Object representing a segment with properties x1, y1, x2,\n+ * and y2. The start point is represented by x1 and y1. The end point\n+ * is represented by x2 and y2. Start and end are ordered so that x1 < x2.\n+ * options - {Object} Optional properties for calculating the intersection.\n+ *\n+ * Valid options:\n+ * point - {Boolean} Return the intersection point. If false, the actual\n+ * intersection point will not be calculated. If true and the segments\n+ * intersect, the intersection point will be returned. If true and\n+ * the segments do not intersect, false will be returned. If true and\n+ * the segments are coincident, true will be returned.\n+ * tolerance - {Number} If a non-null value is provided, if the segments are\n+ * within the tolerance distance, this will be considered an intersection.\n+ * In addition, if the point option is true and the calculated intersection\n+ * is within the tolerance distance of an end point, the endpoint will be\n+ * returned instead of the calculated intersection. Further, if the\n+ * intersection is within the tolerance of endpoints on both segments, or\n+ * if two segment endpoints are within the tolerance distance of eachother\n+ * (but no intersection is otherwise calculated), an endpoint on the\n+ * first segment provided will be returned.\n+ *\n+ * Returns:\n+ * {Boolean | } The two segments intersect.\n+ * If the point argument is true, the return will be the intersection\n+ * point or false if none exists. If point is true and the segments\n+ * are coincident, return will be true (and the instersection is equal\n+ * to the shorter segment).\n+ */\n+OpenLayers.Geometry.segmentsIntersect = function(seg1, seg2, options) {\n+ var point = options && options.point;\n+ var tolerance = options && options.tolerance;\n+ var intersection = false;\n+ var x11_21 = seg1.x1 - seg2.x1;\n+ var y11_21 = seg1.y1 - seg2.y1;\n+ var x12_11 = seg1.x2 - seg1.x1;\n+ var y12_11 = seg1.y2 - seg1.y1;\n+ var y22_21 = seg2.y2 - seg2.y1;\n+ var x22_21 = seg2.x2 - seg2.x1;\n+ var d = (y22_21 * x12_11) - (x22_21 * y12_11);\n+ var n1 = (x22_21 * y11_21) - (y22_21 * x11_21);\n+ var n2 = (x12_11 * y11_21) - (y12_11 * x11_21);\n+ if (d == 0) {\n+ // parallel\n+ if (n1 == 0 && n2 == 0) {\n+ // coincident\n+ intersection = true;\n+ }\n+ } else {\n+ var along1 = n1 / d;\n+ var along2 = n2 / d;\n+ if (along1 >= 0 && along1 <= 1 && along2 >= 0 && along2 <= 1) {\n+ // intersect\n+ if (!point) {\n+ intersection = true;\n+ } else {\n+ // calculate the intersection point\n+ var x = seg1.x1 + (along1 * x12_11);\n+ var y = seg1.y1 + (along1 * y12_11);\n+ intersection = new OpenLayers.Geometry.Point(x, y);\n+ }\n+ }\n+ }\n+ if (tolerance) {\n+ var dist;\n+ if (intersection) {\n+ if (point) {\n+ var segs = [seg1, seg2];\n+ var seg, x, y;\n+ // check segment endpoints for proximity to intersection\n+ // set intersection to first endpoint within the tolerance\n+ outer: for (var i = 0; i < 2; ++i) {\n+ seg = segs[i];\n+ for (var j = 1; j < 3; ++j) {\n+ x = seg[\"x\" + j];\n+ y = seg[\"y\" + j];\n+ dist = Math.sqrt(\n+ Math.pow(x - intersection.x, 2) +\n+ Math.pow(y - intersection.y, 2)\n+ );\n+ if (dist < tolerance) {\n+ intersection.x = x;\n+ intersection.y = y;\n+ break outer;\n+ }\n+ }\n+ }\n+\n+ }\n+ } else {\n+ // no calculated intersection, but segments could be within\n+ // the tolerance of one another\n+ var segs = [seg1, seg2];\n+ var source, target, x, y, p, result;\n+ // check segment endpoints for proximity to intersection\n+ // set intersection to first endpoint within the tolerance\n+ outer: for (var i = 0; i < 2; ++i) {\n+ source = segs[i];\n+ target = segs[(i + 1) % 2];\n+ for (var j = 1; j < 3; ++j) {\n+ p = {\n+ x: source[\"x\" + j],\n+ y: source[\"y\" + j]\n+ };\n+ result = OpenLayers.Geometry.distanceToSegment(p, target);\n+ if (result.distance < tolerance) {\n+ if (point) {\n+ intersection = new OpenLayers.Geometry.Point(p.x, p.y);\n+ } else {\n+ intersection = true;\n+ }\n+ break outer;\n+ }\n+ }\n+ }\n+ }\n+ }\n+ return intersection;\n+};\n+\n+/**\n+ * Function: OpenLayers.Geometry.distanceToSegment\n+ *\n+ * Parameters:\n+ * point - {Object} An object with x and y properties representing the\n+ * point coordinates.\n+ * segment - {Object} An object with x1, y1, x2, and y2 properties\n+ * representing endpoint coordinates.\n+ *\n+ * Returns:\n+ * {Object} An object with distance, along, x, and y properties. The distance\n+ * will be the shortest distance between the input point and segment.\n+ * The x and y properties represent the coordinates along the segment\n+ * where the shortest distance meets the segment. The along attribute\n+ * describes how far between the two segment points the given point is.\n+ */\n+OpenLayers.Geometry.distanceToSegment = function(point, segment) {\n+ var result = OpenLayers.Geometry.distanceSquaredToSegment(point, segment);\n+ result.distance = Math.sqrt(result.distance);\n+ return result;\n+};\n+\n+/**\n+ * Function: OpenLayers.Geometry.distanceSquaredToSegment\n+ *\n+ * Usually the distanceToSegment function should be used. This variant however\n+ * can be used for comparisons where the exact distance is not important.\n+ *\n+ * Parameters:\n+ * point - {Object} An object with x and y properties representing the\n+ * point coordinates.\n+ * segment - {Object} An object with x1, y1, x2, and y2 properties\n+ * representing endpoint coordinates.\n+ *\n+ * Returns:\n+ * {Object} An object with squared distance, along, x, and y properties.\n+ * The distance will be the shortest distance between the input point and\n+ * segment. The x and y properties represent the coordinates along the\n+ * segment where the shortest distance meets the segment. The along\n+ * attribute describes how far between the two segment points the given\n+ * point is.\n+ */\n+OpenLayers.Geometry.distanceSquaredToSegment = function(point, segment) {\n+ var x0 = point.x;\n+ var y0 = point.y;\n+ var x1 = segment.x1;\n+ var y1 = segment.y1;\n+ var x2 = segment.x2;\n+ var y2 = segment.y2;\n+ var dx = x2 - x1;\n+ var dy = y2 - y1;\n+ var along = ((dx * (x0 - x1)) + (dy * (y0 - y1))) /\n+ (Math.pow(dx, 2) + Math.pow(dy, 2));\n+ var x, y;\n+ if (along <= 0.0) {\n+ x = x1;\n+ y = y1;\n+ } else if (along >= 1.0) {\n+ x = x2;\n+ y = y2;\n+ } else {\n+ x = x1 + along * dx;\n+ y = y1 + along * dy;\n+ }\n+ return {\n+ distance: Math.pow(x - x0, 2) + Math.pow(y - y0, 2),\n+ x: x,\n+ y: y,\n+ along: along\n+ };\n+};\n+/* ======================================================================\n+ OpenLayers/Format.js\n+ ====================================================================== */\n+\n+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n+ * full list of contributors). Published under the 2-clause BSD license.\n+ * See license.txt in the OpenLayers distribution or repository for the\n+ * full text of the license. */\n+\n+/**\n+ * @requires OpenLayers/BaseTypes/Class.js\n+ * @requires OpenLayers/Util.js\n+ */\n+\n+/**\n+ * Class: OpenLayers.Format\n+ * Base class for format reading/writing a variety of formats. Subclasses\n+ * of OpenLayers.Format are expected to have read and write methods.\n+ */\n+OpenLayers.Format = OpenLayers.Class({\n+\n+ /**\n+ * Property: options\n+ * {Object} A reference to options passed to the constructor.\n+ */\n+ options: null,\n+\n+ /**\n+ * APIProperty: externalProjection\n+ * {} When passed a externalProjection and\n+ * internalProjection, the format will reproject the geometries it\n+ * reads or writes. The externalProjection is the projection used by\n+ * the content which is passed into read or which comes out of write.\n+ * In order to reproject, a projection transformation function for the\n+ * specified projections must be available. This support may be \n+ * provided via proj4js or via a custom transformation function. See\n+ * {} for more information on\n+ * custom transformations.\n+ */\n+ externalProjection: null,\n+\n+ /**\n+ * APIProperty: internalProjection\n+ * {} When passed a externalProjection and\n+ * internalProjection, the format will reproject the geometries it\n+ * reads or writes. The internalProjection is the projection used by\n+ * the geometries which are returned by read or which are passed into\n+ * write. In order to reproject, a projection transformation function\n+ * for the specified projections must be available. This support may be\n+ * provided via proj4js or via a custom transformation function. See\n+ * {} for more information on\n+ * custom transformations.\n+ */\n+ internalProjection: null,\n+\n+ /**\n+ * APIProperty: data\n+ * {Object} When is true, this is the parsed string sent to\n+ * .\n+ */\n+ data: null,\n+\n+ /**\n+ * APIProperty: keepData\n+ * {Object} Maintain a reference () to the most recently read data.\n+ * Default is false.\n+ */\n+ keepData: false,\n+\n+ /**\n+ * Constructor: OpenLayers.Format\n+ * Instances of this class are not useful. See one of the subclasses.\n+ *\n+ * Parameters:\n+ * options - {Object} An optional object with properties to set on the\n+ * format\n+ *\n+ * Valid options:\n+ * keepData - {Boolean} If true, upon , the data property will be\n+ * set to the parsed object (e.g. the json or xml object).\n+ *\n+ * Returns:\n+ * An instance of OpenLayers.Format\n+ */\n+ initialize: function(options) {\n+ OpenLayers.Util.extend(this, options);\n+ this.options = options;\n+ },\n+\n+ /**\n+ * APIMethod: destroy\n+ * Clean up.\n+ */\n+ destroy: function() {},\n+\n+ /**\n+ * Method: read\n+ * Read data from a string, and return an object whose type depends on the\n+ * subclass. \n+ * \n+ * Parameters:\n+ * data - {string} Data to read/parse.\n+ *\n+ * Returns:\n+ * Depends on the subclass\n+ */\n+ read: function(data) {\n+ throw new Error('Read not implemented.');\n+ },\n+\n+ /**\n+ * Method: write\n+ * Accept an object, and return a string. \n+ *\n+ * Parameters:\n+ * object - {Object} Object to be serialized\n+ *\n+ * Returns:\n+ * {String} A string representation of the object.\n+ */\n+ write: function(object) {\n+ throw new Error('Write not implemented.');\n+ },\n+\n+ CLASS_NAME: \"OpenLayers.Format\"\n+});\n+/* ======================================================================\n+ OpenLayers/Geometry/Point.js\n+ ====================================================================== */\n+\n+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n+ * full list of contributors). Published under the 2-clause BSD license.\n+ * See license.txt in the OpenLayers distribution or repository for the\n+ * full text of the license. */\n+\n+/**\n+ * @requires OpenLayers/Geometry.js\n+ */\n+\n+/**\n+ * Class: OpenLayers.Geometry.Point\n+ * Point geometry class. \n+ * \n+ * Inherits from:\n+ * - \n+ */\n+OpenLayers.Geometry.Point = OpenLayers.Class(OpenLayers.Geometry, {\n+\n+ /** \n+ * APIProperty: x \n+ * {float} \n+ */\n+ x: null,\n+\n+ /** \n+ * APIProperty: y \n+ * {float} \n+ */\n+ y: null,\n+\n+ /**\n+ * Constructor: OpenLayers.Geometry.Point\n+ * Construct a point geometry.\n+ *\n+ * Parameters:\n+ * x - {float} \n+ * y - {float}\n+ * \n+ */\n+ initialize: function(x, y) {\n+ OpenLayers.Geometry.prototype.initialize.apply(this, arguments);\n+\n+ this.x = parseFloat(x);\n+ this.y = parseFloat(y);\n+ },\n+\n+ /**\n+ * APIMethod: clone\n+ * \n+ * Returns:\n+ * {} An exact clone of this OpenLayers.Geometry.Point\n+ */\n+ clone: function(obj) {\n+ if (obj == null) {\n+ obj = new OpenLayers.Geometry.Point(this.x, this.y);\n+ }\n+\n+ // catch any randomly tagged-on properties\n+ OpenLayers.Util.applyDefaults(obj, this);\n+\n+ return obj;\n+ },\n+\n+ /** \n+ * Method: calculateBounds\n+ * Create a new Bounds based on the lon/lat\n+ */\n+ calculateBounds: function() {\n+ this.bounds = new OpenLayers.Bounds(this.x, this.y,\n+ this.x, this.y);\n+ },\n+\n+ /**\n+ * APIMethod: distanceTo\n+ * Calculate the closest distance between two geometries (on the x-y plane).\n+ *\n+ * Parameters:\n+ * geometry - {} The target geometry.\n+ * options - {Object} Optional properties for configuring the distance\n+ * calculation.\n+ *\n+ * Valid options:\n+ * details - {Boolean} Return details from the distance calculation.\n+ * Default is false.\n+ * edge - {Boolean} Calculate the distance from this geometry to the\n+ * nearest edge of the target geometry. Default is true. If true,\n+ * calling distanceTo from a geometry that is wholly contained within\n+ * the target will result in a non-zero distance. If false, whenever\n+ * geometries intersect, calling distanceTo will return 0. If false,\n+ * details cannot be returned.\n+ *\n+ * Returns:\n+ * {Number | Object} The distance between this geometry and the target.\n+ * If details is true, the return will be an object with distance,\n+ * x0, y0, x1, and x2 properties. The x0 and y0 properties represent\n+ * the coordinates of the closest point on this geometry. The x1 and y1\n+ * properties represent the coordinates of the closest point on the\n+ * target geometry.\n+ */\n+ distanceTo: function(geometry, options) {\n+ var edge = !(options && options.edge === false);\n+ var details = edge && options && options.details;\n+ var distance, x0, y0, x1, y1, result;\n+ if (geometry instanceof OpenLayers.Geometry.Point) {\n+ x0 = this.x;\n+ y0 = this.y;\n+ x1 = geometry.x;\n+ y1 = geometry.y;\n+ distance = Math.sqrt(Math.pow(x0 - x1, 2) + Math.pow(y0 - y1, 2));\n+ result = !details ?\n+ distance : {\n+ x0: x0,\n+ y0: y0,\n+ x1: x1,\n+ y1: y1,\n+ distance: distance\n+ };\n+ } else {\n+ result = geometry.distanceTo(this, options);\n+ if (details) {\n+ // switch coord order since this geom is target\n+ result = {\n+ x0: result.x1,\n+ y0: result.y1,\n+ x1: result.x0,\n+ y1: result.y0,\n+ distance: result.distance\n+ };\n+ }\n+ }\n+ return result;\n+ },\n+\n+ /** \n+ * APIMethod: equals\n+ * Determine whether another geometry is equivalent to this one. Geometries\n+ * are considered equivalent if all components have the same coordinates.\n+ * \n+ * Parameters:\n+ * geom - {} The geometry to test. \n+ *\n+ * Returns:\n+ * {Boolean} The supplied geometry is equivalent to this geometry.\n+ */\n+ equals: function(geom) {\n+ var equals = false;\n+ if (geom != null) {\n+ equals = ((this.x == geom.x && this.y == geom.y) ||\n+ (isNaN(this.x) && isNaN(this.y) && isNaN(geom.x) && isNaN(geom.y)));\n+ }\n+ return equals;\n+ },\n+\n+ /**\n+ * Method: toShortString\n+ *\n+ * Returns:\n+ * {String} Shortened String representation of Point object. \n+ * (ex. \"5, 42\")\n+ */\n+ toShortString: function() {\n+ return (this.x + \", \" + this.y);\n+ },\n+\n+ /**\n+ * APIMethod: move\n+ * Moves a geometry by the given displacement along positive x and y axes.\n+ * This modifies the position of the geometry and clears the cached\n+ * bounds.\n+ *\n+ * Parameters:\n+ * x - {Float} Distance to move geometry in positive x direction. \n+ * y - {Float} Distance to move geometry in positive y direction.\n+ */\n+ move: function(x, y) {\n+ this.x = this.x + x;\n+ this.y = this.y + y;\n+ this.clearBounds();\n+ },\n+\n+ /**\n+ * APIMethod: rotate\n+ * Rotate a point around another.\n+ *\n+ * Parameters:\n+ * angle - {Float} Rotation angle in degrees (measured counterclockwise\n+ * from the positive x-axis)\n+ * origin - {} Center point for the rotation\n+ */\n+ rotate: function(angle, origin) {\n+ angle *= Math.PI / 180;\n+ var radius = this.distanceTo(origin);\n+ var theta = angle + Math.atan2(this.y - origin.y, this.x - origin.x);\n+ this.x = origin.x + (radius * Math.cos(theta));\n+ this.y = origin.y + (radius * Math.sin(theta));\n+ this.clearBounds();\n+ },\n+\n+ /**\n+ * APIMethod: getCentroid\n+ *\n+ * Returns:\n+ * {} The centroid of the collection\n+ */\n+ getCentroid: function() {\n+ return new OpenLayers.Geometry.Point(this.x, this.y);\n+ },\n+\n+ /**\n+ * APIMethod: resize\n+ * Resize a point relative to some origin. For points, this has the effect\n+ * of scaling a vector (from the origin to the point). This method is\n+ * more useful on geometry collection subclasses.\n+ *\n+ * Parameters:\n+ * scale - {Float} Ratio of the new distance from the origin to the old\n+ * distance from the origin. A scale of 2 doubles the\n+ * distance between the point and origin.\n+ * origin - {} Point of origin for resizing\n+ * ratio - {Float} Optional x:y ratio for resizing. Default ratio is 1.\n+ * \n+ * Returns:\n+ * {} - The current geometry. \n+ */\n+ resize: function(scale, origin, ratio) {\n+ ratio = (ratio == undefined) ? 1 : ratio;\n+ this.x = origin.x + (scale * ratio * (this.x - origin.x));\n+ this.y = origin.y + (scale * (this.y - origin.y));\n+ this.clearBounds();\n+ return this;\n+ },\n+\n+ /**\n+ * APIMethod: intersects\n+ * Determine if the input geometry intersects this one.\n+ *\n+ * Parameters:\n+ * geometry - {} Any type of geometry.\n+ *\n+ * Returns:\n+ * {Boolean} The input geometry intersects this one.\n+ */\n+ intersects: function(geometry) {\n+ var intersect = false;\n+ if (geometry.CLASS_NAME == \"OpenLayers.Geometry.Point\") {\n+ intersect = this.equals(geometry);\n+ } else {\n+ intersect = geometry.intersects(this);\n+ }\n+ return intersect;\n+ },\n+\n+ /**\n+ * APIMethod: transform\n+ * Translate the x,y properties of the point from source to dest.\n+ * \n+ * Parameters:\n+ * source - {} \n+ * dest - {}\n+ * \n+ * Returns:\n+ * {} \n+ */\n+ transform: function(source, dest) {\n+ if ((source && dest)) {\n+ OpenLayers.Projection.transform(\n+ this, source, dest);\n+ this.bounds = null;\n+ }\n+ return this;\n+ },\n+\n+ /**\n+ * APIMethod: getVertices\n+ * Return a list of all points in this geometry.\n+ *\n+ * Parameters:\n+ * nodes - {Boolean} For lines, only return vertices that are\n+ * endpoints. If false, for lines, only vertices that are not\n+ * endpoints will be returned. If not provided, all vertices will\n+ * be returned.\n+ *\n+ * Returns:\n+ * {Array} A list of all vertices in the geometry.\n+ */\n+ getVertices: function(nodes) {\n+ return [this];\n+ },\n+\n+ CLASS_NAME: \"OpenLayers.Geometry.Point\"\n+});\n+/* ======================================================================\n+ OpenLayers/Geometry/Collection.js\n+ ====================================================================== */\n+\n+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n+ * full list of contributors). Published under the 2-clause BSD license.\n+ * See license.txt in the OpenLayers distribution or repository for the\n+ * full text of the license. */\n+\n+/**\n+ * @requires OpenLayers/Geometry.js\n+ */\n+\n+/**\n+ * Class: OpenLayers.Geometry.Collection\n+ * A Collection is exactly what it sounds like: A collection of different \n+ * Geometries. These are stored in the local parameter (which\n+ * can be passed as a parameter to the constructor). \n+ * \n+ * As new geometries are added to the collection, they are NOT cloned. \n+ * When removing geometries, they need to be specified by reference (ie you \n+ * have to pass in the *exact* geometry to be removed).\n+ * \n+ * The and functions here merely iterate through\n+ * the components, summing their respective areas and lengths.\n+ *\n+ * Create a new instance with the constructor.\n+ *\n+ * Inherits from:\n+ * - \n+ */\n+OpenLayers.Geometry.Collection = OpenLayers.Class(OpenLayers.Geometry, {\n+\n+ /**\n+ * APIProperty: components\n+ * {Array()} The component parts of this geometry\n+ */\n+ components: null,\n+\n+ /**\n+ * Property: componentTypes\n+ * {Array(String)} An array of class names representing the types of\n+ * components that the collection can include. A null value means the\n+ * component types are not restricted.\n+ */\n+ componentTypes: null,\n+\n+ /**\n+ * Constructor: OpenLayers.Geometry.Collection\n+ * Creates a Geometry Collection -- a list of geoms.\n+ *\n+ * Parameters: \n+ * components - {Array()} Optional array of geometries\n+ *\n+ */\n+ initialize: function(components) {\n+ OpenLayers.Geometry.prototype.initialize.apply(this, arguments);\n+ this.components = [];\n+ if (components != null) {\n+ this.addComponents(components);\n+ }\n+ },\n+\n+ /**\n+ * APIMethod: destroy\n+ * Destroy this geometry.\n+ */\n+ destroy: function() {\n+ this.components.length = 0;\n+ this.components = null;\n+ OpenLayers.Geometry.prototype.destroy.apply(this, arguments);\n+ },\n+\n+ /**\n+ * APIMethod: clone\n+ * Clone this geometry.\n+ *\n+ * Returns:\n+ * {} An exact clone of this collection\n+ */\n+ clone: function() {\n+ var geometry = eval(\"new \" + this.CLASS_NAME + \"()\");\n+ for (var i = 0, len = this.components.length; i < len; i++) {\n+ geometry.addComponent(this.components[i].clone());\n+ }\n+\n+ // catch any randomly tagged-on properties\n+ OpenLayers.Util.applyDefaults(geometry, this);\n+\n+ return geometry;\n+ },\n+\n+ /**\n+ * Method: getComponentsString\n+ * Get a string representing the components for this collection\n+ * \n+ * Returns:\n+ * {String} A string representation of the components of this geometry\n+ */\n+ getComponentsString: function() {\n+ var strings = [];\n+ for (var i = 0, len = this.components.length; i < len; i++) {\n+ strings.push(this.components[i].toShortString());\n+ }\n+ return strings.join(\",\");\n+ },\n+\n+ /**\n+ * APIMethod: calculateBounds\n+ * Recalculate the bounds by iterating through the components and \n+ * calling calling extendBounds() on each item.\n+ */\n+ calculateBounds: function() {\n+ this.bounds = null;\n+ var bounds = new OpenLayers.Bounds();\n+ var components = this.components;\n+ if (components) {\n+ for (var i = 0, len = components.length; i < len; i++) {\n+ bounds.extend(components[i].getBounds());\n+ }\n+ }\n+ // to preserve old behavior, we only set bounds if non-null\n+ // in the future, we could add bounds.isEmpty()\n+ if (bounds.left != null && bounds.bottom != null &&\n+ bounds.right != null && bounds.top != null) {\n+ this.setBounds(bounds);\n+ }\n+ },\n+\n+ /**\n+ * APIMethod: addComponents\n+ * Add components to this geometry.\n+ *\n+ * Parameters:\n+ * components - {Array()} An array of geometries to add\n+ */\n+ addComponents: function(components) {\n+ if (!(OpenLayers.Util.isArray(components))) {\n+ components = [components];\n+ }\n+ for (var i = 0, len = components.length; i < len; i++) {\n+ this.addComponent(components[i]);\n+ }\n+ },\n+\n+ /**\n+ * Method: addComponent\n+ * Add a new component (geometry) to the collection. If this.componentTypes\n+ * is set, then the component class name must be in the componentTypes array.\n+ *\n+ * The bounds cache is reset.\n+ * \n+ * Parameters:\n+ * component - {} A geometry to add\n+ * index - {int} Optional index into the array to insert the component\n+ *\n+ * Returns:\n+ * {Boolean} The component geometry was successfully added\n+ */\n+ addComponent: function(component, index) {\n+ var added = false;\n+ if (component) {\n+ if (this.componentTypes == null ||\n+ (OpenLayers.Util.indexOf(this.componentTypes,\n+ component.CLASS_NAME) > -1)) {\n+\n+ if (index != null && (index < this.components.length)) {\n+ var components1 = this.components.slice(0, index);\n+ var components2 = this.components.slice(index,\n+ this.components.length);\n+ components1.push(component);\n+ this.components = components1.concat(components2);\n+ } else {\n+ this.components.push(component);\n+ }\n+ component.parent = this;\n+ this.clearBounds();\n+ added = true;\n+ }\n+ }\n+ return added;\n+ },\n+\n+ /**\n+ * APIMethod: removeComponents\n+ * Remove components from this geometry.\n+ *\n+ * Parameters:\n+ * components - {Array()} The components to be removed\n+ *\n+ * Returns: \n+ * {Boolean} A component was removed.\n+ */\n+ removeComponents: function(components) {\n+ var removed = false;\n+\n+ if (!(OpenLayers.Util.isArray(components))) {\n+ components = [components];\n+ }\n+ for (var i = components.length - 1; i >= 0; --i) {\n+ removed = this.removeComponent(components[i]) || removed;\n+ }\n+ return removed;\n+ },\n+\n+ /**\n+ * Method: removeComponent\n+ * Remove a component from this geometry.\n+ *\n+ * Parameters:\n+ * component - {} \n+ *\n+ * Returns: \n+ * {Boolean} The component was removed.\n+ */\n+ removeComponent: function(component) {\n+\n+ OpenLayers.Util.removeItem(this.components, component);\n+\n+ // clearBounds() so that it gets recalculated on the next call\n+ // to this.getBounds();\n+ this.clearBounds();\n+ return true;\n+ },\n+\n+ /**\n+ * APIMethod: getLength\n+ * Calculate the length of this geometry\n+ *\n+ * Returns:\n+ * {Float} The length of the geometry\n+ */\n+ getLength: function() {\n+ var length = 0.0;\n+ for (var i = 0, len = this.components.length; i < len; i++) {\n+ length += this.components[i].getLength();\n+ }\n+ return length;\n+ },\n+\n+ /**\n+ * APIMethod: getArea\n+ * Calculate the area of this geometry. Note how this function is overridden\n+ * in .\n+ *\n+ * Returns:\n+ * {Float} The area of the collection by summing its parts\n+ */\n+ getArea: function() {\n+ var area = 0.0;\n+ for (var i = 0, len = this.components.length; i < len; i++) {\n+ area += this.components[i].getArea();\n+ }\n+ return area;\n+ },\n+\n+ /** \n+ * APIMethod: getGeodesicArea\n+ * Calculate the approximate area of the polygon were it projected onto\n+ * the earth.\n+ *\n+ * Parameters:\n+ * projection - {} The spatial reference system\n+ * for the geometry coordinates. If not provided, Geographic/WGS84 is\n+ * assumed.\n+ * \n+ * Reference:\n+ * Robert. G. Chamberlain and William H. Duquette, \"Some Algorithms for\n+ * Polygons on a Sphere\", JPL Publication 07-03, Jet Propulsion\n+ * Laboratory, Pasadena, CA, June 2007 http://trs-new.jpl.nasa.gov/dspace/handle/2014/40409\n+ *\n+ * Returns:\n+ * {float} The approximate geodesic area of the geometry in square meters.\n+ */\n+ getGeodesicArea: function(projection) {\n+ var area = 0.0;\n+ for (var i = 0, len = this.components.length; i < len; i++) {\n+ area += this.components[i].getGeodesicArea(projection);\n+ }\n+ return area;\n+ },\n+\n+ /**\n+ * APIMethod: getCentroid\n+ *\n+ * Compute the centroid for this geometry collection.\n+ *\n+ * Parameters:\n+ * weighted - {Boolean} Perform the getCentroid computation recursively,\n+ * returning an area weighted average of all geometries in this collection.\n+ *\n+ * Returns:\n+ * {} The centroid of the collection\n+ */\n+ getCentroid: function(weighted) {\n+ if (!weighted) {\n+ return this.components.length && this.components[0].getCentroid();\n+ }\n+ var len = this.components.length;\n+ if (!len) {\n+ return false;\n+ }\n+\n+ var areas = [];\n+ var centroids = [];\n+ var areaSum = 0;\n+ var minArea = Number.MAX_VALUE;\n+ var component;\n+ for (var i = 0; i < len; ++i) {\n+ component = this.components[i];\n+ var area = component.getArea();\n+ var centroid = component.getCentroid(true);\n+ if (isNaN(area) || isNaN(centroid.x) || isNaN(centroid.y)) {\n+ continue;\n+ }\n+ areas.push(area);\n+ areaSum += area;\n+ minArea = (area < minArea && area > 0) ? area : minArea;\n+ centroids.push(centroid);\n+ }\n+ len = areas.length;\n+ if (areaSum === 0) {\n+ // all the components in this collection have 0 area\n+ // probably a collection of points -- weight all the points the same\n+ for (var i = 0; i < len; ++i) {\n+ areas[i] = 1;\n+ }\n+ areaSum = areas.length;\n+ } else {\n+ // normalize all the areas where the smallest area will get\n+ // a value of 1\n+ for (var i = 0; i < len; ++i) {\n+ areas[i] /= minArea;\n+ }\n+ areaSum /= minArea;\n+ }\n+\n+ var xSum = 0,\n+ ySum = 0,\n+ centroid, area;\n+ for (var i = 0; i < len; ++i) {\n+ centroid = centroids[i];\n+ area = areas[i];\n+ xSum += centroid.x * area;\n+ ySum += centroid.y * area;\n+ }\n+\n+ return new OpenLayers.Geometry.Point(xSum / areaSum, ySum / areaSum);\n+ },\n+\n+ /**\n+ * APIMethod: getGeodesicLength\n+ * Calculate the approximate length of the geometry were it projected onto\n+ * the earth.\n+ *\n+ * projection - {} The spatial reference system\n+ * for the geometry coordinates. If not provided, Geographic/WGS84 is\n+ * assumed.\n+ * \n+ * Returns:\n+ * {Float} The appoximate geodesic length of the geometry in meters.\n+ */\n+ getGeodesicLength: function(projection) {\n+ var length = 0.0;\n+ for (var i = 0, len = this.components.length; i < len; i++) {\n+ length += this.components[i].getGeodesicLength(projection);\n+ }\n+ return length;\n+ },\n+\n+ /**\n+ * APIMethod: move\n+ * Moves a geometry by the given displacement along positive x and y axes.\n+ * This modifies the position of the geometry and clears the cached\n+ * bounds.\n+ *\n+ * Parameters:\n+ * x - {Float} Distance to move geometry in positive x direction. \n+ * y - {Float} Distance to move geometry in positive y direction.\n+ */\n+ move: function(x, y) {\n+ for (var i = 0, len = this.components.length; i < len; i++) {\n+ this.components[i].move(x, y);\n+ }\n+ },\n+\n+ /**\n+ * APIMethod: rotate\n+ * Rotate a geometry around some origin\n+ *\n+ * Parameters:\n+ * angle - {Float} Rotation angle in degrees (measured counterclockwise\n+ * from the positive x-axis)\n+ * origin - {} Center point for the rotation\n+ */\n+ rotate: function(angle, origin) {\n+ for (var i = 0, len = this.components.length; i < len; ++i) {\n+ this.components[i].rotate(angle, origin);\n+ }\n+ },\n+\n+ /**\n+ * APIMethod: resize\n+ * Resize a geometry relative to some origin. Use this method to apply\n+ * a uniform scaling to a geometry.\n+ *\n+ * Parameters:\n+ * scale - {Float} Factor by which to scale the geometry. A scale of 2\n+ * doubles the size of the geometry in each dimension\n+ * (lines, for example, will be twice as long, and polygons\n+ * will have four times the area).\n+ * origin - {} Point of origin for resizing\n+ * ratio - {Float} Optional x:y ratio for resizing. Default ratio is 1.\n+ * \n+ * Returns:\n+ * {} - The current geometry. \n+ */\n+ resize: function(scale, origin, ratio) {\n+ for (var i = 0; i < this.components.length; ++i) {\n+ this.components[i].resize(scale, origin, ratio);\n+ }\n+ return this;\n+ },\n+\n+ /**\n+ * APIMethod: distanceTo\n+ * Calculate the closest distance between two geometries (on the x-y plane).\n+ *\n+ * Parameters:\n+ * geometry - {} The target geometry.\n+ * options - {Object} Optional properties for configuring the distance\n+ * calculation.\n+ *\n+ * Valid options:\n+ * details - {Boolean} Return details from the distance calculation.\n+ * Default is false.\n+ * edge - {Boolean} Calculate the distance from this geometry to the\n+ * nearest edge of the target geometry. Default is true. If true,\n+ * calling distanceTo from a geometry that is wholly contained within\n+ * the target will result in a non-zero distance. If false, whenever\n+ * geometries intersect, calling distanceTo will return 0. If false,\n+ * details cannot be returned.\n+ *\n+ * Returns:\n+ * {Number | Object} The distance between this geometry and the target.\n+ * If details is true, the return will be an object with distance,\n+ * x0, y0, x1, and y1 properties. The x0 and y0 properties represent\n+ * the coordinates of the closest point on this geometry. The x1 and y1\n+ * properties represent the coordinates of the closest point on the\n+ * target geometry.\n+ */\n+ distanceTo: function(geometry, options) {\n+ var edge = !(options && options.edge === false);\n+ var details = edge && options && options.details;\n+ var result, best, distance;\n+ var min = Number.POSITIVE_INFINITY;\n+ for (var i = 0, len = this.components.length; i < len; ++i) {\n+ result = this.components[i].distanceTo(geometry, options);\n+ distance = details ? result.distance : result;\n+ if (distance < min) {\n+ min = distance;\n+ best = result;\n+ if (min == 0) {\n+ break;\n+ }\n+ }\n+ }\n+ return best;\n+ },\n+\n+ /** \n+ * APIMethod: equals\n+ * Determine whether another geometry is equivalent to this one. Geometries\n+ * are considered equivalent if all components have the same coordinates.\n+ * \n+ * Parameters:\n+ * geometry - {} The geometry to test. \n+ *\n+ * Returns:\n+ * {Boolean} The supplied geometry is equivalent to this geometry.\n+ */\n+ equals: function(geometry) {\n+ var equivalent = true;\n+ if (!geometry || !geometry.CLASS_NAME ||\n+ (this.CLASS_NAME != geometry.CLASS_NAME)) {\n+ equivalent = false;\n+ } else if (!(OpenLayers.Util.isArray(geometry.components)) ||\n+ (geometry.components.length != this.components.length)) {\n+ equivalent = false;\n+ } else {\n+ for (var i = 0, len = this.components.length; i < len; ++i) {\n+ if (!this.components[i].equals(geometry.components[i])) {\n+ equivalent = false;\n+ break;\n+ }\n+ }\n+ }\n+ return equivalent;\n+ },\n+\n+ /**\n+ * APIMethod: transform\n+ * Reproject the components geometry from source to dest.\n+ * \n+ * Parameters:\n+ * source - {} \n+ * dest - {}\n+ * \n+ * Returns:\n+ * {} \n+ */\n+ transform: function(source, dest) {\n+ if (source && dest) {\n+ for (var i = 0, len = this.components.length; i < len; i++) {\n+ var component = this.components[i];\n+ component.transform(source, dest);\n+ }\n+ this.bounds = null;\n+ }\n+ return this;\n+ },\n+\n+ /**\n+ * APIMethod: intersects\n+ * Determine if the input geometry intersects this one.\n+ *\n+ * Parameters:\n+ * geometry - {} Any type of geometry.\n+ *\n+ * Returns:\n+ * {Boolean} The input geometry intersects this one.\n+ */\n+ intersects: function(geometry) {\n+ var intersect = false;\n+ for (var i = 0, len = this.components.length; i < len; ++i) {\n+ intersect = geometry.intersects(this.components[i]);\n+ if (intersect) {\n+ break;\n+ }\n+ }\n+ return intersect;\n+ },\n+\n+ /**\n+ * APIMethod: getVertices\n+ * Return a list of all points in this geometry.\n+ *\n+ * Parameters:\n+ * nodes - {Boolean} For lines, only return vertices that are\n+ * endpoints. If false, for lines, only vertices that are not\n+ * endpoints will be returned. If not provided, all vertices will\n+ * be returned.\n+ *\n+ * Returns:\n+ * {Array} A list of all vertices in the geometry.\n+ */\n+ getVertices: function(nodes) {\n+ var vertices = [];\n+ for (var i = 0, len = this.components.length; i < len; ++i) {\n+ Array.prototype.push.apply(\n+ vertices, this.components[i].getVertices(nodes)\n+ );\n+ }\n+ return vertices;\n+ },\n+\n+\n+ CLASS_NAME: \"OpenLayers.Geometry.Collection\"\n+});\n+/* ======================================================================\n+ OpenLayers/Geometry/MultiPoint.js\n+ ====================================================================== */\n+\n+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n+ * full list of contributors). Published under the 2-clause BSD license.\n+ * See license.txt in the OpenLayers distribution or repository for the\n+ * full text of the license. */\n+\n+/**\n+ * @requires OpenLayers/Geometry/Collection.js\n+ * @requires OpenLayers/Geometry/Point.js\n+ */\n+\n+/**\n+ * Class: OpenLayers.Geometry.MultiPoint\n+ * MultiPoint is a collection of Points. Create a new instance with the\n+ * constructor.\n+ *\n+ * Inherits from:\n+ * - \n+ * - \n+ */\n+OpenLayers.Geometry.MultiPoint = OpenLayers.Class(\n+ OpenLayers.Geometry.Collection, {\n+\n+ /**\n+ * Property: componentTypes\n+ * {Array(String)} An array of class names representing the types of\n+ * components that the collection can include. A null value means the\n+ * component types are not restricted.\n+ */\n+ componentTypes: [\"OpenLayers.Geometry.Point\"],\n+\n+ /**\n+ * Constructor: OpenLayers.Geometry.MultiPoint\n+ * Create a new MultiPoint Geometry\n+ *\n+ * Parameters:\n+ * components - {Array()} \n+ *\n+ * Returns:\n+ * {}\n+ */\n+\n+ /**\n+ * APIMethod: addPoint\n+ * Wrapper for \n+ *\n+ * Parameters:\n+ * point - {} Point to be added\n+ * index - {Integer} Optional index\n+ */\n+ addPoint: function(point, index) {\n+ this.addComponent(point, index);\n+ },\n+\n+ /**\n+ * APIMethod: removePoint\n+ * Wrapper for \n+ *\n+ * Parameters:\n+ * point - {} Point to be removed\n+ */\n+ removePoint: function(point) {\n+ this.removeComponent(point);\n+ },\n+\n+ CLASS_NAME: \"OpenLayers.Geometry.MultiPoint\"\n+ });\n+/* ======================================================================\n+ OpenLayers/Geometry/Curve.js\n+ ====================================================================== */\n+\n+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n+ * full list of contributors). Published under the 2-clause BSD license.\n+ * See license.txt in the OpenLayers distribution or repository for the\n+ * full text of the license. */\n+\n+/**\n+ * @requires OpenLayers/Geometry/MultiPoint.js\n+ */\n+\n+/**\n+ * Class: OpenLayers.Geometry.Curve\n+ * A Curve is a MultiPoint, whose points are assumed to be connected. To \n+ * this end, we provide a \"getLength()\" function, which iterates through \n+ * the points, summing the distances between them. \n+ * \n+ * Inherits: \n+ * - \n+ */\n+OpenLayers.Geometry.Curve = OpenLayers.Class(OpenLayers.Geometry.MultiPoint, {\n+\n+ /**\n+ * Property: componentTypes\n+ * {Array(String)} An array of class names representing the types of \n+ * components that the collection can include. A null \n+ * value means the component types are not restricted.\n+ */\n+ componentTypes: [\"OpenLayers.Geometry.Point\"],\n+\n+ /**\n+ * Constructor: OpenLayers.Geometry.Curve\n+ * \n+ * Parameters:\n+ * point - {Array()}\n+ */\n+\n+ /**\n+ * APIMethod: getLength\n+ * \n+ * Returns:\n+ * {Float} The length of the curve\n+ */\n+ getLength: function() {\n+ var length = 0.0;\n+ if (this.components && (this.components.length > 1)) {\n+ for (var i = 1, len = this.components.length; i < len; i++) {\n+ length += this.components[i - 1].distanceTo(this.components[i]);\n+ }\n+ }\n+ return length;\n+ },\n+\n+ /**\n+ * APIMethod: getGeodesicLength\n+ * Calculate the approximate length of the geometry were it projected onto\n+ * the earth.\n+ *\n+ * projection - {} The spatial reference system\n+ * for the geometry coordinates. If not provided, Geographic/WGS84 is\n+ * assumed.\n+ * \n+ * Returns:\n+ * {Float} The appoximate geodesic length of the geometry in meters.\n+ */\n+ getGeodesicLength: function(projection) {\n+ var geom = this; // so we can work with a clone if needed\n+ if (projection) {\n+ var gg = new OpenLayers.Projection(\"EPSG:4326\");\n+ if (!gg.equals(projection)) {\n+ geom = this.clone().transform(projection, gg);\n+ }\n+ }\n+ var length = 0.0;\n+ if (geom.components && (geom.components.length > 1)) {\n+ var p1, p2;\n+ for (var i = 1, len = geom.components.length; i < len; i++) {\n+ p1 = geom.components[i - 1];\n+ p2 = geom.components[i];\n+ // this returns km and requires lon/lat properties\n+ length += OpenLayers.Util.distVincenty({\n+ lon: p1.x,\n+ lat: p1.y\n+ }, {\n+ lon: p2.x,\n+ lat: p2.y\n+ });\n+ }\n+ }\n+ // convert to m\n+ return length * 1000;\n+ },\n+\n+ CLASS_NAME: \"OpenLayers.Geometry.Curve\"\n+});\n+/* ======================================================================\n+ OpenLayers/Geometry/LineString.js\n+ ====================================================================== */\n+\n+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n+ * full list of contributors). Published under the 2-clause BSD license.\n+ * See license.txt in the OpenLayers distribution or repository for the\n+ * full text of the license. */\n+\n+/**\n+ * @requires OpenLayers/Geometry/Curve.js\n+ */\n+\n+/**\n+ * Class: OpenLayers.Geometry.LineString\n+ * A LineString is a Curve which, once two points have been added to it, can \n+ * never be less than two points long.\n+ * \n+ * Inherits from:\n+ * - \n+ */\n+OpenLayers.Geometry.LineString = OpenLayers.Class(OpenLayers.Geometry.Curve, {\n+\n+ /**\n+ * Constructor: OpenLayers.Geometry.LineString\n+ * Create a new LineString geometry\n+ *\n+ * Parameters:\n+ * points - {Array()} An array of points used to\n+ * generate the linestring\n+ *\n+ */\n+\n+ /**\n+ * APIMethod: removeComponent\n+ * Only allows removal of a point if there are three or more points in \n+ * the linestring. (otherwise the result would be just a single point)\n+ *\n+ * Parameters: \n+ * point - {} The point to be removed\n+ *\n+ * Returns: \n+ * {Boolean} The component was removed.\n+ */\n+ removeComponent: function(point) {\n+ var removed = this.components && (this.components.length > 2);\n+ if (removed) {\n+ OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,\n+ arguments);\n+ }\n+ return removed;\n+ },\n+\n+ /**\n+ * APIMethod: intersects\n+ * Test for instersection between two geometries. This is a cheapo\n+ * implementation of the Bently-Ottmann algorigithm. It doesn't\n+ * really keep track of a sweep line data structure. It is closer\n+ * to the brute force method, except that segments are sorted and\n+ * potential intersections are only calculated when bounding boxes\n+ * intersect.\n+ *\n+ * Parameters:\n+ * geometry - {}\n+ *\n+ * Returns:\n+ * {Boolean} The input geometry intersects this geometry.\n+ */\n+ intersects: function(geometry) {\n+ var intersect = false;\n+ var type = geometry.CLASS_NAME;\n+ if (type == \"OpenLayers.Geometry.LineString\" ||\n+ type == \"OpenLayers.Geometry.LinearRing\" ||\n+ type == \"OpenLayers.Geometry.Point\") {\n+ var segs1 = this.getSortedSegments();\n+ var segs2;\n+ if (type == \"OpenLayers.Geometry.Point\") {\n+ segs2 = [{\n+ x1: geometry.x,\n+ y1: geometry.y,\n+ x2: geometry.x,\n+ y2: geometry.y\n+ }];\n+ } else {\n+ segs2 = geometry.getSortedSegments();\n+ }\n+ var seg1, seg1x1, seg1x2, seg1y1, seg1y2,\n+ seg2, seg2y1, seg2y2;\n+ // sweep right\n+ outer: for (var i = 0, len = segs1.length; i < len; ++i) {\n+ seg1 = segs1[i];\n+ seg1x1 = seg1.x1;\n+ seg1x2 = seg1.x2;\n+ seg1y1 = seg1.y1;\n+ seg1y2 = seg1.y2;\n+ inner: for (var j = 0, jlen = segs2.length; j < jlen; ++j) {\n+ seg2 = segs2[j];\n+ if (seg2.x1 > seg1x2) {\n+ // seg1 still left of seg2\n+ break;\n+ }\n+ if (seg2.x2 < seg1x1) {\n+ // seg2 still left of seg1\n+ continue;\n+ }\n+ seg2y1 = seg2.y1;\n+ seg2y2 = seg2.y2;\n+ if (Math.min(seg2y1, seg2y2) > Math.max(seg1y1, seg1y2)) {\n+ // seg2 above seg1\n+ continue;\n+ }\n+ if (Math.max(seg2y1, seg2y2) < Math.min(seg1y1, seg1y2)) {\n+ // seg2 below seg1\n+ continue;\n+ }\n+ if (OpenLayers.Geometry.segmentsIntersect(seg1, seg2)) {\n+ intersect = true;\n+ break outer;\n+ }\n+ }\n+ }\n+ } else {\n+ intersect = geometry.intersects(this);\n+ }\n+ return intersect;\n+ },\n+\n+ /**\n+ * Method: getSortedSegments\n+ *\n+ * Returns:\n+ * {Array} An array of segment objects. Segment objects have properties\n+ * x1, y1, x2, and y2. The start point is represented by x1 and y1.\n+ * The end point is represented by x2 and y2. Start and end are\n+ * ordered so that x1 < x2.\n+ */\n+ getSortedSegments: function() {\n+ var numSeg = this.components.length - 1;\n+ var segments = new Array(numSeg),\n+ point1, point2;\n+ for (var i = 0; i < numSeg; ++i) {\n+ point1 = this.components[i];\n+ point2 = this.components[i + 1];\n+ if (point1.x < point2.x) {\n+ segments[i] = {\n+ x1: point1.x,\n+ y1: point1.y,\n+ x2: point2.x,\n+ y2: point2.y\n+ };\n+ } else {\n+ segments[i] = {\n+ x1: point2.x,\n+ y1: point2.y,\n+ x2: point1.x,\n+ y2: point1.y\n+ };\n+ }\n+ }\n+ // more efficient to define this somewhere static\n+ function byX1(seg1, seg2) {\n+ return seg1.x1 - seg2.x1;\n+ }\n+ return segments.sort(byX1);\n+ },\n+\n+ /**\n+ * Method: splitWithSegment\n+ * Split this geometry with the given segment.\n+ *\n+ * Parameters:\n+ * seg - {Object} An object with x1, y1, x2, and y2 properties referencing\n+ * segment endpoint coordinates.\n+ * options - {Object} Properties of this object will be used to determine\n+ * how the split is conducted.\n+ *\n+ * Valid options:\n+ * edge - {Boolean} Allow splitting when only edges intersect. Default is\n * true. If false, a vertex on the source segment must be within the\n * tolerance distance of the intersection to be considered a split.\n * tolerance - {Number} If a non-null value is provided, intersections\n * within the tolerance distance of one of the source segment's\n * endpoints will be assumed to occur at the endpoint.\n *\n * Returns:\n@@ -12700,467 +15781,14 @@\n * Constant: OpenLayers.Format.WFST.DEFAULTS\n * {Object} Default properties for the WFST format.\n */\n OpenLayers.Format.WFST.DEFAULTS = {\n \"version\": \"1.0.0\"\n };\n /* ======================================================================\n- OpenLayers/Style.js\n- ====================================================================== */\n-\n-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n- * full list of contributors). Published under the 2-clause BSD license.\n- * See license.txt in the OpenLayers distribution or repository for the\n- * full text of the license. */\n-\n-\n-/**\n- * @requires OpenLayers/BaseTypes/Class.js\n- * @requires OpenLayers/Util.js\n- * @requires OpenLayers/Feature/Vector.js\n- */\n-\n-/**\n- * Class: OpenLayers.Style\n- * This class represents a UserStyle obtained\n- * from a SLD, containing styling rules.\n- */\n-OpenLayers.Style = OpenLayers.Class({\n-\n- /**\n- * Property: id\n- * {String} A unique id for this session.\n- */\n- id: null,\n-\n- /**\n- * APIProperty: name\n- * {String}\n- */\n- name: null,\n-\n- /**\n- * Property: title\n- * {String} Title of this style (set if included in SLD)\n- */\n- title: null,\n-\n- /**\n- * Property: description\n- * {String} Description of this style (set if abstract is included in SLD)\n- */\n- description: null,\n-\n- /**\n- * APIProperty: layerName\n- * {} name of the layer that this style belongs to, usually\n- * according to the NamedLayer attribute of an SLD document.\n- */\n- layerName: null,\n-\n- /**\n- * APIProperty: isDefault\n- * {Boolean}\n- */\n- isDefault: false,\n-\n- /** \n- * Property: rules \n- * {Array()}\n- */\n- rules: null,\n-\n- /**\n- * APIProperty: context\n- * {Object} An optional object with properties that symbolizers' property\n- * values should be evaluated against. If no context is specified,\n- * feature.attributes will be used\n- */\n- context: null,\n-\n- /**\n- * Property: defaultStyle\n- * {Object} hash of style properties to use as default for merging\n- * rule-based style symbolizers onto. If no rules are defined,\n- * createSymbolizer will return this style. If is set to\n- * true, the defaultStyle will only be taken into account if there are\n- * rules defined.\n- */\n- defaultStyle: null,\n-\n- /**\n- * Property: defaultsPerSymbolizer\n- * {Boolean} If set to true, the will extend the symbolizer\n- * of every rule. Properties of the will also be used to set\n- * missing symbolizer properties if the symbolizer has stroke, fill or\n- * graphic set to true. Default is false.\n- */\n- defaultsPerSymbolizer: false,\n-\n- /**\n- * Property: propertyStyles\n- * {Hash of Boolean} cache of style properties that need to be parsed for\n- * propertyNames. Property names are keys, values won't be used.\n- */\n- propertyStyles: null,\n-\n-\n- /** \n- * Constructor: OpenLayers.Style\n- * Creates a UserStyle.\n- *\n- * Parameters:\n- * style - {Object} Optional hash of style properties that will be\n- * used as default style for this style object. This style\n- * applies if no rules are specified. Symbolizers defined in\n- * rules will extend this default style.\n- * options - {Object} An optional object with properties to set on the\n- * style.\n- *\n- * Valid options:\n- * rules - {Array()} List of rules to be added to the\n- * style.\n- * \n- * Returns:\n- * {}\n- */\n- initialize: function(style, options) {\n-\n- OpenLayers.Util.extend(this, options);\n- this.rules = [];\n- if (options && options.rules) {\n- this.addRules(options.rules);\n- }\n-\n- // use the default style from OpenLayers.Feature.Vector if no style\n- // was given in the constructor\n- this.setDefaultStyle(style ||\n- OpenLayers.Feature.Vector.style[\"default\"]);\n-\n- this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + \"_\");\n- },\n-\n- /** \n- * APIMethod: destroy\n- * nullify references to prevent circular references and memory leaks\n- */\n- destroy: function() {\n- for (var i = 0, len = this.rules.length; i < len; i++) {\n- this.rules[i].destroy();\n- this.rules[i] = null;\n- }\n- this.rules = null;\n- this.defaultStyle = null;\n- },\n-\n- /**\n- * Method: createSymbolizer\n- * creates a style by applying all feature-dependent rules to the base\n- * style.\n- * \n- * Parameters:\n- * feature - {} feature to evaluate rules for\n- * \n- * Returns:\n- * {Object} symbolizer hash\n- */\n- createSymbolizer: function(feature) {\n- var style = this.defaultsPerSymbolizer ? {} : this.createLiterals(\n- OpenLayers.Util.extend({}, this.defaultStyle), feature);\n-\n- var rules = this.rules;\n-\n- var rule, context;\n- var elseRules = [];\n- var appliedRules = false;\n- for (var i = 0, len = rules.length; i < len; i++) {\n- rule = rules[i];\n- // does the rule apply?\n- var applies = rule.evaluate(feature);\n-\n- if (applies) {\n- if (rule instanceof OpenLayers.Rule && rule.elseFilter) {\n- elseRules.push(rule);\n- } else {\n- appliedRules = true;\n- this.applySymbolizer(rule, style, feature);\n- }\n- }\n- }\n-\n- // if no other rules apply, apply the rules with else filters\n- if (appliedRules == false && elseRules.length > 0) {\n- appliedRules = true;\n- for (var i = 0, len = elseRules.length; i < len; i++) {\n- this.applySymbolizer(elseRules[i], style, feature);\n- }\n- }\n-\n- // don't display if there were rules but none applied\n- if (rules.length > 0 && appliedRules == false) {\n- style.display = \"none\";\n- }\n-\n- if (style.label != null && typeof style.label !== \"string\") {\n- style.label = String(style.label);\n- }\n-\n- return style;\n- },\n-\n- /**\n- * Method: applySymbolizer\n- *\n- * Parameters:\n- * rule - {}\n- * style - {Object}\n- * feature - {}\n- *\n- * Returns:\n- * {Object} A style with new symbolizer applied.\n- */\n- applySymbolizer: function(rule, style, feature) {\n- var symbolizerPrefix = feature.geometry ?\n- this.getSymbolizerPrefix(feature.geometry) :\n- OpenLayers.Style.SYMBOLIZER_PREFIXES[0];\n-\n- var symbolizer = rule.symbolizer[symbolizerPrefix] || rule.symbolizer;\n-\n- if (this.defaultsPerSymbolizer === true) {\n- var defaults = this.defaultStyle;\n- OpenLayers.Util.applyDefaults(symbolizer, {\n- pointRadius: defaults.pointRadius\n- });\n- if (symbolizer.stroke === true || symbolizer.graphic === true) {\n- OpenLayers.Util.applyDefaults(symbolizer, {\n- strokeWidth: defaults.strokeWidth,\n- strokeColor: defaults.strokeColor,\n- strokeOpacity: defaults.strokeOpacity,\n- strokeDashstyle: defaults.strokeDashstyle,\n- strokeLinecap: defaults.strokeLinecap\n- });\n- }\n- if (symbolizer.fill === true || symbolizer.graphic === true) {\n- OpenLayers.Util.applyDefaults(symbolizer, {\n- fillColor: defaults.fillColor,\n- fillOpacity: defaults.fillOpacity\n- });\n- }\n- if (symbolizer.graphic === true) {\n- OpenLayers.Util.applyDefaults(symbolizer, {\n- pointRadius: this.defaultStyle.pointRadius,\n- externalGraphic: this.defaultStyle.externalGraphic,\n- graphicName: this.defaultStyle.graphicName,\n- graphicOpacity: this.defaultStyle.graphicOpacity,\n- graphicWidth: this.defaultStyle.graphicWidth,\n- graphicHeight: this.defaultStyle.graphicHeight,\n- graphicXOffset: this.defaultStyle.graphicXOffset,\n- graphicYOffset: this.defaultStyle.graphicYOffset\n- });\n- }\n- }\n-\n- // merge the style with the current style\n- return this.createLiterals(\n- OpenLayers.Util.extend(style, symbolizer), feature);\n- },\n-\n- /**\n- * Method: createLiterals\n- * creates literals for all style properties that have an entry in\n- * .\n- * \n- * Parameters:\n- * style - {Object} style to create literals for. Will be modified\n- * inline.\n- * feature - {Object}\n- * \n- * Returns:\n- * {Object} the modified style\n- */\n- createLiterals: function(style, feature) {\n- var context = OpenLayers.Util.extend({}, feature.attributes || feature.data);\n- OpenLayers.Util.extend(context, this.context);\n-\n- for (var i in this.propertyStyles) {\n- style[i] = OpenLayers.Style.createLiteral(style[i], context, feature, i);\n- }\n- return style;\n- },\n-\n- /**\n- * Method: findPropertyStyles\n- * Looks into all rules for this style and the defaultStyle to collect\n- * all the style hash property names containing ${...} strings that have\n- * to be replaced using the createLiteral method before returning them.\n- * \n- * Returns:\n- * {Object} hash of property names that need createLiteral parsing. The\n- * name of the property is the key, and the value is true;\n- */\n- findPropertyStyles: function() {\n- var propertyStyles = {};\n-\n- // check the default style\n- var style = this.defaultStyle;\n- this.addPropertyStyles(propertyStyles, style);\n-\n- // walk through all rules to check for properties in their symbolizer\n- var rules = this.rules;\n- var symbolizer, value;\n- for (var i = 0, len = rules.length; i < len; i++) {\n- symbolizer = rules[i].symbolizer;\n- for (var key in symbolizer) {\n- value = symbolizer[key];\n- if (typeof value == \"object\") {\n- // symbolizer key is \"Point\", \"Line\" or \"Polygon\"\n- this.addPropertyStyles(propertyStyles, value);\n- } else {\n- // symbolizer is a hash of style properties\n- this.addPropertyStyles(propertyStyles, symbolizer);\n- break;\n- }\n- }\n- }\n- return propertyStyles;\n- },\n-\n- /**\n- * Method: addPropertyStyles\n- * \n- * Parameters:\n- * propertyStyles - {Object} hash to add new property styles to. Will be\n- * modified inline\n- * symbolizer - {Object} search this symbolizer for property styles\n- * \n- * Returns:\n- * {Object} propertyStyles hash\n- */\n- addPropertyStyles: function(propertyStyles, symbolizer) {\n- var property;\n- for (var key in symbolizer) {\n- property = symbolizer[key];\n- if (typeof property == \"string\" &&\n- property.match(/\\$\\{\\w+\\}/)) {\n- propertyStyles[key] = true;\n- }\n- }\n- return propertyStyles;\n- },\n-\n- /**\n- * APIMethod: addRules\n- * Adds rules to this style.\n- * \n- * Parameters:\n- * rules - {Array()}\n- */\n- addRules: function(rules) {\n- Array.prototype.push.apply(this.rules, rules);\n- this.propertyStyles = this.findPropertyStyles();\n- },\n-\n- /**\n- * APIMethod: setDefaultStyle\n- * Sets the default style for this style object.\n- * \n- * Parameters:\n- * style - {Object} Hash of style properties\n- */\n- setDefaultStyle: function(style) {\n- this.defaultStyle = style;\n- this.propertyStyles = this.findPropertyStyles();\n- },\n-\n- /**\n- * Method: getSymbolizerPrefix\n- * Returns the correct symbolizer prefix according to the\n- * geometry type of the passed geometry\n- * \n- * Parameters:\n- * geometry - {}\n- * \n- * Returns:\n- * {String} key of the according symbolizer\n- */\n- getSymbolizerPrefix: function(geometry) {\n- var prefixes = OpenLayers.Style.SYMBOLIZER_PREFIXES;\n- for (var i = 0, len = prefixes.length; i < len; i++) {\n- if (geometry.CLASS_NAME.indexOf(prefixes[i]) != -1) {\n- return prefixes[i];\n- }\n- }\n- },\n-\n- /**\n- * APIMethod: clone\n- * Clones this style.\n- * \n- * Returns:\n- * {} Clone of this style.\n- */\n- clone: function() {\n- var options = OpenLayers.Util.extend({}, this);\n- // clone rules\n- if (this.rules) {\n- options.rules = [];\n- for (var i = 0, len = this.rules.length; i < len; ++i) {\n- options.rules.push(this.rules[i].clone());\n- }\n- }\n- // clone context\n- options.context = this.context && OpenLayers.Util.extend({}, this.context);\n- //clone default style\n- var defaultStyle = OpenLayers.Util.extend({}, this.defaultStyle);\n- return new OpenLayers.Style(defaultStyle, options);\n- },\n-\n- CLASS_NAME: \"OpenLayers.Style\"\n-});\n-\n-\n-/**\n- * Function: createLiteral\n- * converts a style value holding a combination of PropertyName and Literal\n- * into a Literal, taking the property values from the passed features.\n- * \n- * Parameters:\n- * value - {String} value to parse. If this string contains a construct like\n- * \"foo ${bar}\", then \"foo \" will be taken as literal, and \"${bar}\"\n- * will be replaced by the value of the \"bar\" attribute of the passed\n- * feature.\n- * context - {Object} context to take attribute values from\n- * feature - {} optional feature to pass to\n- * for evaluating functions in the\n- * context.\n- * property - {String} optional, name of the property for which the literal is\n- * being created for evaluating functions in the context.\n- * \n- * Returns:\n- * {String} the parsed value. In the example of the value parameter above, the\n- * result would be \"foo valueOfBar\", assuming that the passed feature has an\n- * attribute named \"bar\" with the value \"valueOfBar\".\n- */\n-OpenLayers.Style.createLiteral = function(value, context, feature, property) {\n- if (typeof value == \"string\" && value.indexOf(\"${\") != -1) {\n- value = OpenLayers.String.format(value, context, [feature, property]);\n- value = (isNaN(value) || !value) ? value : parseFloat(value);\n- }\n- return value;\n-};\n-\n-/**\n- * Constant: OpenLayers.Style.SYMBOLIZER_PREFIXES\n- * {Array} prefixes of the sld symbolizers. These are the\n- * same as the main geometry types\n- */\n-OpenLayers.Style.SYMBOLIZER_PREFIXES = ['Point', 'Line', 'Polygon', 'Text',\n- 'Raster'\n-];\n-/* ======================================================================\n OpenLayers/Filter.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n * See license.txt in the OpenLayers distribution or repository for the\n * full text of the license. */\n@@ -18049,2113 +20677,14 @@\n \"ows\": OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers[\"ows\"]\n },\n \n CLASS_NAME: \"OpenLayers.Format.WPSExecute\"\n \n });\n /* ======================================================================\n- OpenLayers/Events.js\n- ====================================================================== */\n-\n-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n- * full list of contributors). Published under the 2-clause BSD license.\n- * See license.txt in the OpenLayers distribution or repository for the\n- * full text of the license. */\n-\n-\n-/**\n- * @requires OpenLayers/Util.js\n- */\n-\n-/**\n- * Namespace: OpenLayers.Event\n- * Utility functions for event handling.\n- */\n-OpenLayers.Event = {\n-\n- /** \n- * Property: observers \n- * {Object} A hashtable cache of the event observers. Keyed by\n- * element._eventCacheID \n- */\n- observers: false,\n-\n- /**\n- * Constant: KEY_SPACE\n- * {int}\n- */\n- KEY_SPACE: 32,\n-\n- /** \n- * Constant: KEY_BACKSPACE \n- * {int} \n- */\n- KEY_BACKSPACE: 8,\n-\n- /** \n- * Constant: KEY_TAB \n- * {int} \n- */\n- KEY_TAB: 9,\n-\n- /** \n- * Constant: KEY_RETURN \n- * {int} \n- */\n- KEY_RETURN: 13,\n-\n- /** \n- * Constant: KEY_ESC \n- * {int} \n- */\n- KEY_ESC: 27,\n-\n- /** \n- * Constant: KEY_LEFT \n- * {int} \n- */\n- KEY_LEFT: 37,\n-\n- /** \n- * Constant: KEY_UP \n- * {int} \n- */\n- KEY_UP: 38,\n-\n- /** \n- * Constant: KEY_RIGHT \n- * {int} \n- */\n- KEY_RIGHT: 39,\n-\n- /** \n- * Constant: KEY_DOWN \n- * {int} \n- */\n- KEY_DOWN: 40,\n-\n- /** \n- * Constant: KEY_DELETE \n- * {int} \n- */\n- KEY_DELETE: 46,\n-\n-\n- /**\n- * Method: element\n- * Cross browser event element detection.\n- * \n- * Parameters:\n- * event - {Event} \n- * \n- * Returns:\n- * {DOMElement} The element that caused the event \n- */\n- element: function(event) {\n- return event.target || event.srcElement;\n- },\n-\n- /**\n- * Method: isSingleTouch\n- * Determine whether event was caused by a single touch\n- *\n- * Parameters:\n- * event - {Event}\n- *\n- * Returns:\n- * {Boolean}\n- */\n- isSingleTouch: function(event) {\n- return event.touches && event.touches.length == 1;\n- },\n-\n- /**\n- * Method: isMultiTouch\n- * Determine whether event was caused by a multi touch\n- *\n- * Parameters:\n- * event - {Event}\n- *\n- * Returns:\n- * {Boolean}\n- */\n- isMultiTouch: function(event) {\n- return event.touches && event.touches.length > 1;\n- },\n-\n- /**\n- * Method: isLeftClick\n- * Determine whether event was caused by a left click. \n- *\n- * Parameters:\n- * event - {Event} \n- * \n- * Returns:\n- * {Boolean}\n- */\n- isLeftClick: function(event) {\n- return (((event.which) && (event.which == 1)) ||\n- ((event.button) && (event.button == 1)));\n- },\n-\n- /**\n- * Method: isRightClick\n- * Determine whether event was caused by a right mouse click. \n- *\n- * Parameters:\n- * event - {Event} \n- * \n- * Returns:\n- * {Boolean}\n- */\n- isRightClick: function(event) {\n- return (((event.which) && (event.which == 3)) ||\n- ((event.button) && (event.button == 2)));\n- },\n-\n- /**\n- * Method: stop\n- * Stops an event from propagating. \n- *\n- * Parameters: \n- * event - {Event} \n- * allowDefault - {Boolean} If true, we stop the event chain but \n- * still allow the default browser behaviour (text selection,\n- * radio-button clicking, etc). Default is false.\n- */\n- stop: function(event, allowDefault) {\n-\n- if (!allowDefault) {\n- OpenLayers.Event.preventDefault(event);\n- }\n-\n- if (event.stopPropagation) {\n- event.stopPropagation();\n- } else {\n- event.cancelBubble = true;\n- }\n- },\n-\n- /**\n- * Method: preventDefault\n- * Cancels the event if it is cancelable, without stopping further\n- * propagation of the event.\n- *\n- * Parameters:\n- * event - {Event}\n- */\n- preventDefault: function(event) {\n- if (event.preventDefault) {\n- event.preventDefault();\n- } else {\n- event.returnValue = false;\n- }\n- },\n-\n- /** \n- * Method: findElement\n- * \n- * Parameters:\n- * event - {Event} \n- * tagName - {String} \n- * \n- * Returns:\n- * {DOMElement} The first node with the given tagName, starting from the\n- * node the event was triggered on and traversing the DOM upwards\n- */\n- findElement: function(event, tagName) {\n- var element = OpenLayers.Event.element(event);\n- while (element.parentNode && (!element.tagName ||\n- (element.tagName.toUpperCase() != tagName.toUpperCase()))) {\n- element = element.parentNode;\n- }\n- return element;\n- },\n-\n- /** \n- * Method: observe\n- * \n- * Parameters:\n- * elementParam - {DOMElement || String} \n- * name - {String} \n- * observer - {function} \n- * useCapture - {Boolean} \n- */\n- observe: function(elementParam, name, observer, useCapture) {\n- var element = OpenLayers.Util.getElement(elementParam);\n- useCapture = useCapture || false;\n-\n- if (name == 'keypress' &&\n- (navigator.appVersion.match(/Konqueror|Safari|KHTML/) ||\n- element.attachEvent)) {\n- name = 'keydown';\n- }\n-\n- //if observers cache has not yet been created, create it\n- if (!this.observers) {\n- this.observers = {};\n- }\n-\n- //if not already assigned, make a new unique cache ID\n- if (!element._eventCacheID) {\n- var idPrefix = \"eventCacheID_\";\n- if (element.id) {\n- idPrefix = element.id + \"_\" + idPrefix;\n- }\n- element._eventCacheID = OpenLayers.Util.createUniqueID(idPrefix);\n- }\n-\n- var cacheID = element._eventCacheID;\n-\n- //if there is not yet a hash entry for this element, add one\n- if (!this.observers[cacheID]) {\n- this.observers[cacheID] = [];\n- }\n-\n- //add a new observer to this element's list\n- this.observers[cacheID].push({\n- 'element': element,\n- 'name': name,\n- 'observer': observer,\n- 'useCapture': useCapture\n- });\n-\n- //add the actual browser event listener\n- if (element.addEventListener) {\n- element.addEventListener(name, observer, useCapture);\n- } else if (element.attachEvent) {\n- element.attachEvent('on' + name, observer);\n- }\n- },\n-\n- /** \n- * Method: stopObservingElement\n- * Given the id of an element to stop observing, cycle through the \n- * element's cached observers, calling stopObserving on each one, \n- * skipping those entries which can no longer be removed.\n- * \n- * parameters:\n- * elementParam - {DOMElement || String} \n- */\n- stopObservingElement: function(elementParam) {\n- var element = OpenLayers.Util.getElement(elementParam);\n- var cacheID = element._eventCacheID;\n-\n- this._removeElementObservers(OpenLayers.Event.observers[cacheID]);\n- },\n-\n- /**\n- * Method: _removeElementObservers\n- *\n- * Parameters:\n- * elementObservers - {Array(Object)} Array of (element, name, \n- * observer, usecapture) objects, \n- * taken directly from hashtable\n- */\n- _removeElementObservers: function(elementObservers) {\n- if (elementObservers) {\n- for (var i = elementObservers.length - 1; i >= 0; i--) {\n- var entry = elementObservers[i];\n- OpenLayers.Event.stopObserving.apply(this, [\n- entry.element, entry.name, entry.observer, entry.useCapture\n- ]);\n- }\n- }\n- },\n-\n- /**\n- * Method: stopObserving\n- * \n- * Parameters:\n- * elementParam - {DOMElement || String} \n- * name - {String} \n- * observer - {function} \n- * useCapture - {Boolean} \n- * \n- * Returns:\n- * {Boolean} Whether or not the event observer was removed\n- */\n- stopObserving: function(elementParam, name, observer, useCapture) {\n- useCapture = useCapture || false;\n-\n- var element = OpenLayers.Util.getElement(elementParam);\n- var cacheID = element._eventCacheID;\n-\n- if (name == 'keypress') {\n- if (navigator.appVersion.match(/Konqueror|Safari|KHTML/) ||\n- element.detachEvent) {\n- name = 'keydown';\n- }\n- }\n-\n- // find element's entry in this.observers cache and remove it\n- var foundEntry = false;\n- var elementObservers = OpenLayers.Event.observers[cacheID];\n- if (elementObservers) {\n-\n- // find the specific event type in the element's list\n- var i = 0;\n- while (!foundEntry && i < elementObservers.length) {\n- var cacheEntry = elementObservers[i];\n-\n- if ((cacheEntry.name == name) &&\n- (cacheEntry.observer == observer) &&\n- (cacheEntry.useCapture == useCapture)) {\n-\n- elementObservers.splice(i, 1);\n- if (elementObservers.length == 0) {\n- delete OpenLayers.Event.observers[cacheID];\n- }\n- foundEntry = true;\n- break;\n- }\n- i++;\n- }\n- }\n-\n- //actually remove the event listener from browser\n- if (foundEntry) {\n- if (element.removeEventListener) {\n- element.removeEventListener(name, observer, useCapture);\n- } else if (element && element.detachEvent) {\n- element.detachEvent('on' + name, observer);\n- }\n- }\n- return foundEntry;\n- },\n-\n- /** \n- * Method: unloadCache\n- * Cycle through all the element entries in the events cache and call\n- * stopObservingElement on each. \n- */\n- unloadCache: function() {\n- // check for OpenLayers.Event before checking for observers, because\n- // OpenLayers.Event may be undefined in IE if no map instance was\n- // created\n- if (OpenLayers.Event && OpenLayers.Event.observers) {\n- for (var cacheID in OpenLayers.Event.observers) {\n- var elementObservers = OpenLayers.Event.observers[cacheID];\n- OpenLayers.Event._removeElementObservers.apply(this,\n- [elementObservers]);\n- }\n- OpenLayers.Event.observers = false;\n- }\n- },\n-\n- CLASS_NAME: \"OpenLayers.Event\"\n-};\n-\n-/* prevent memory leaks in IE */\n-OpenLayers.Event.observe(window, 'unload', OpenLayers.Event.unloadCache, false);\n-\n-/**\n- * Class: OpenLayers.Events\n- */\n-OpenLayers.Events = OpenLayers.Class({\n-\n- /** \n- * Constant: BROWSER_EVENTS\n- * {Array(String)} supported events \n- */\n- BROWSER_EVENTS: [\n- \"mouseover\", \"mouseout\",\n- \"mousedown\", \"mouseup\", \"mousemove\",\n- \"click\", \"dblclick\", \"rightclick\", \"dblrightclick\",\n- \"resize\", \"focus\", \"blur\",\n- \"touchstart\", \"touchmove\", \"touchend\",\n- \"keydown\"\n- ],\n-\n- /** \n- * Property: listeners \n- * {Object} Hashtable of Array(Function): events listener functions \n- */\n- listeners: null,\n-\n- /** \n- * Property: object \n- * {Object} the code object issuing application events \n- */\n- object: null,\n-\n- /** \n- * Property: element \n- * {DOMElement} the DOM element receiving browser events \n- */\n- element: null,\n-\n- /** \n- * Property: eventHandler \n- * {Function} bound event handler attached to elements \n- */\n- eventHandler: null,\n-\n- /** \n- * APIProperty: fallThrough \n- * {Boolean} \n- */\n- fallThrough: null,\n-\n- /** \n- * APIProperty: includeXY\n- * {Boolean} Should the .xy property automatically be created for browser\n- * mouse events? In general, this should be false. If it is true, then\n- * mouse events will automatically generate a '.xy' property on the \n- * event object that is passed. (Prior to OpenLayers 2.7, this was true\n- * by default.) Otherwise, you can call the getMousePosition on the\n- * relevant events handler on the object available via the 'evt.object'\n- * property of the evt object. So, for most events, you can call:\n- * function named(evt) { \n- * this.xy = this.object.events.getMousePosition(evt) \n- * } \n- *\n- * This option typically defaults to false for performance reasons:\n- * when creating an events object whose primary purpose is to manage\n- * relatively positioned mouse events within a div, it may make\n- * sense to set it to true.\n- *\n- * This option is also used to control whether the events object caches\n- * offsets. If this is false, it will not: the reason for this is that\n- * it is only expected to be called many times if the includeXY property\n- * is set to true. If you set this to true, you are expected to clear \n- * the offset cache manually (using this.clearMouseCache()) if:\n- * the border of the element changes\n- * the location of the element in the page changes\n- */\n- includeXY: false,\n-\n- /**\n- * APIProperty: extensions\n- * {Object} Event extensions registered with this instance. Keys are\n- * event types, values are {OpenLayers.Events.*} extension instances or\n- * {Boolean} for events that an instantiated extension provides in\n- * addition to the one it was created for.\n- *\n- * Extensions create an event in addition to browser events, which usually\n- * fires when a sequence of browser events is completed. Extensions are\n- * automatically instantiated when a listener is registered for an event\n- * provided by an extension.\n- *\n- * Extensions are created in the namespace using\n- * , and named after the event they provide.\n- * The constructor receives the target instance as\n- * argument. Extensions that need to capture browser events before they\n- * propagate can register their listeners events using , with\n- * {extension: true} as 4th argument.\n- *\n- * If an extension creates more than one event, an alias for each event\n- * type should be created and reference the same class. The constructor\n- * should set a reference in the target's extensions registry to itself.\n- *\n- * Below is a minimal extension that provides the \"foostart\" and \"fooend\"\n- * event types, which replace the native \"click\" event type if clicked on\n- * an element with the css class \"foo\":\n- *\n- * (code)\n- * OpenLayers.Events.foostart = OpenLayers.Class({\n- * initialize: function(target) {\n- * this.target = target;\n- * this.target.register(\"click\", this, this.doStuff, {extension: true});\n- * // only required if extension provides more than one event type\n- * this.target.extensions[\"foostart\"] = true;\n- * this.target.extensions[\"fooend\"] = true;\n- * },\n- * destroy: function() {\n- * var target = this.target;\n- * target.unregister(\"click\", this, this.doStuff);\n- * delete this.target;\n- * // only required if extension provides more than one event type\n- * delete target.extensions[\"foostart\"];\n- * delete target.extensions[\"fooend\"];\n- * },\n- * doStuff: function(evt) {\n- * var propagate = true;\n- * if (OpenLayers.Event.element(evt).className === \"foo\") {\n- * propagate = false;\n- * var target = this.target;\n- * target.triggerEvent(\"foostart\");\n- * window.setTimeout(function() {\n- * target.triggerEvent(\"fooend\");\n- * }, 1000);\n- * }\n- * return propagate;\n- * }\n- * });\n- * // only required if extension provides more than one event type\n- * OpenLayers.Events.fooend = OpenLayers.Events.foostart;\n- * (end)\n- * \n- */\n- extensions: null,\n-\n- /**\n- * Property: extensionCount\n- * {Object} Keys are event types (like in ), values are the\n- * number of extension listeners for each event type.\n- */\n- extensionCount: null,\n-\n- /**\n- * Method: clearMouseListener\n- * A version of that is bound to this instance so that\n- * it can be used with and\n- * .\n- */\n- clearMouseListener: null,\n-\n- /**\n- * Constructor: OpenLayers.Events\n- * Construct an OpenLayers.Events object.\n- *\n- * Parameters:\n- * object - {Object} The js object to which this Events object is being added\n- * element - {DOMElement} A dom element to respond to browser events\n- * eventTypes - {Array(String)} Deprecated. Array of custom application\n- * events. A listener may be registered for any named event, regardless\n- * of the values provided here.\n- * fallThrough - {Boolean} Allow events to fall through after these have\n- * been handled?\n- * options - {Object} Options for the events object.\n- */\n- initialize: function(object, element, eventTypes, fallThrough, options) {\n- OpenLayers.Util.extend(this, options);\n- this.object = object;\n- this.fallThrough = fallThrough;\n- this.listeners = {};\n- this.extensions = {};\n- this.extensionCount = {};\n- this._msTouches = [];\n-\n- // if a dom element is specified, add a listeners list \n- // for browser events on the element and register them\n- if (element != null) {\n- this.attachToElement(element);\n- }\n- },\n-\n- /**\n- * APIMethod: destroy\n- */\n- destroy: function() {\n- for (var e in this.extensions) {\n- if (typeof this.extensions[e] !== \"boolean\") {\n- this.extensions[e].destroy();\n- }\n- }\n- this.extensions = null;\n- if (this.element) {\n- OpenLayers.Event.stopObservingElement(this.element);\n- if (this.element.hasScrollEvent) {\n- OpenLayers.Event.stopObserving(\n- window, \"scroll\", this.clearMouseListener\n- );\n- }\n- }\n- this.element = null;\n-\n- this.listeners = null;\n- this.object = null;\n- this.fallThrough = null;\n- this.eventHandler = null;\n- },\n-\n- /**\n- * APIMethod: addEventType\n- * Deprecated. Any event can be triggered without adding it first.\n- * \n- * Parameters:\n- * eventName - {String}\n- */\n- addEventType: function(eventName) {},\n-\n- /**\n- * Method: attachToElement\n- *\n- * Parameters:\n- * element - {HTMLDOMElement} a DOM element to attach browser events to\n- */\n- attachToElement: function(element) {\n- if (this.element) {\n- OpenLayers.Event.stopObservingElement(this.element);\n- } else {\n- // keep a bound copy of handleBrowserEvent() so that we can\n- // pass the same function to both Event.observe() and .stopObserving()\n- this.eventHandler = OpenLayers.Function.bindAsEventListener(\n- this.handleBrowserEvent, this\n- );\n-\n- // to be used with observe and stopObserving\n- this.clearMouseListener = OpenLayers.Function.bind(\n- this.clearMouseCache, this\n- );\n- }\n- this.element = element;\n- var msTouch = !!window.navigator.msMaxTouchPoints;\n- var type;\n- for (var i = 0, len = this.BROWSER_EVENTS.length; i < len; i++) {\n- type = this.BROWSER_EVENTS[i];\n- // register the event cross-browser\n- OpenLayers.Event.observe(element, type, this.eventHandler);\n- if (msTouch && type.indexOf('touch') === 0) {\n- this.addMsTouchListener(element, type, this.eventHandler);\n- }\n- }\n- // disable dragstart in IE so that mousedown/move/up works normally\n- OpenLayers.Event.observe(element, \"dragstart\", OpenLayers.Event.stop);\n- },\n-\n- /**\n- * APIMethod: on\n- * Convenience method for registering listeners with a common scope.\n- * Internally, this method calls as shown in the examples\n- * below.\n- *\n- * Example use:\n- * (code)\n- * // register a single listener for the \"loadstart\" event\n- * events.on({\"loadstart\": loadStartListener});\n- *\n- * // this is equivalent to the following\n- * events.register(\"loadstart\", undefined, loadStartListener);\n- *\n- * // register multiple listeners to be called with the same `this` object\n- * events.on({\n- * \"loadstart\": loadStartListener,\n- * \"loadend\": loadEndListener,\n- * scope: object\n- * });\n- *\n- * // this is equivalent to the following\n- * events.register(\"loadstart\", object, loadStartListener);\n- * events.register(\"loadend\", object, loadEndListener);\n- * (end)\n- *\n- * Parameters:\n- * object - {Object} \n- */\n- on: function(object) {\n- for (var type in object) {\n- if (type != \"scope\" && object.hasOwnProperty(type)) {\n- this.register(type, object.scope, object[type]);\n- }\n- }\n- },\n-\n- /**\n- * APIMethod: register\n- * Register an event on the events object.\n- *\n- * When the event is triggered, the 'func' function will be called, in the\n- * context of 'obj'. Imagine we were to register an event, specifying an \n- * OpenLayers.Bounds Object as 'obj'. When the event is triggered, the \n- * context in the callback function will be our Bounds object. This means\n- * that within our callback function, we can access the properties and \n- * methods of the Bounds object through the \"this\" variable. So our \n- * callback could execute something like: \n- * : leftStr = \"Left: \" + this.left;\n- * \n- * or\n- * \n- * : centerStr = \"Center: \" + this.getCenterLonLat();\n- *\n- * Parameters:\n- * type - {String} Name of the event to register\n- * obj - {Object} The object to bind the context to for the callback#.\n- * If no object is specified, default is the Events's 'object' property.\n- * func - {Function} The callback function. If no callback is \n- * specified, this function does nothing.\n- * priority - {Boolean|Object} If true, adds the new listener to the\n- * *front* of the events queue instead of to the end.\n- *\n- * Valid options for priority:\n- * extension - {Boolean} If true, then the event will be registered as\n- * extension event. Extension events are handled before all other\n- * events.\n- */\n- register: function(type, obj, func, priority) {\n- if (type in OpenLayers.Events && !this.extensions[type]) {\n- this.extensions[type] = new OpenLayers.Events[type](this);\n- }\n- if (func != null) {\n- if (obj == null) {\n- obj = this.object;\n- }\n- var listeners = this.listeners[type];\n- if (!listeners) {\n- listeners = [];\n- this.listeners[type] = listeners;\n- this.extensionCount[type] = 0;\n- }\n- var listener = {\n- obj: obj,\n- func: func\n- };\n- if (priority) {\n- listeners.splice(this.extensionCount[type], 0, listener);\n- if (typeof priority === \"object\" && priority.extension) {\n- this.extensionCount[type]++;\n- }\n- } else {\n- listeners.push(listener);\n- }\n- }\n- },\n-\n- /**\n- * APIMethod: registerPriority\n- * Same as register() but adds the new listener to the *front* of the\n- * events queue instead of to the end.\n- * \n- * TODO: get rid of this in 3.0 - Decide whether listeners should be \n- * called in the order they were registered or in reverse order.\n- *\n- *\n- * Parameters:\n- * type - {String} Name of the event to register\n- * obj - {Object} The object to bind the context to for the callback#.\n- * If no object is specified, default is the Events's \n- * 'object' property.\n- * func - {Function} The callback function. If no callback is \n- * specified, this function does nothing.\n- */\n- registerPriority: function(type, obj, func) {\n- this.register(type, obj, func, true);\n- },\n-\n- /**\n- * APIMethod: un\n- * Convenience method for unregistering listeners with a common scope.\n- * Internally, this method calls as shown in the examples\n- * below.\n- *\n- * Example use:\n- * (code)\n- * // unregister a single listener for the \"loadstart\" event\n- * events.un({\"loadstart\": loadStartListener});\n- *\n- * // this is equivalent to the following\n- * events.unregister(\"loadstart\", undefined, loadStartListener);\n- *\n- * // unregister multiple listeners with the same `this` object\n- * events.un({\n- * \"loadstart\": loadStartListener,\n- * \"loadend\": loadEndListener,\n- * scope: object\n- * });\n- *\n- * // this is equivalent to the following\n- * events.unregister(\"loadstart\", object, loadStartListener);\n- * events.unregister(\"loadend\", object, loadEndListener);\n- * (end)\n- */\n- un: function(object) {\n- for (var type in object) {\n- if (type != \"scope\" && object.hasOwnProperty(type)) {\n- this.unregister(type, object.scope, object[type]);\n- }\n- }\n- },\n-\n- /**\n- * APIMethod: unregister\n- *\n- * Parameters:\n- * type - {String} \n- * obj - {Object} If none specified, defaults to this.object\n- * func - {Function} \n- */\n- unregister: function(type, obj, func) {\n- if (obj == null) {\n- obj = this.object;\n- }\n- var listeners = this.listeners[type];\n- if (listeners != null) {\n- for (var i = 0, len = listeners.length; i < len; i++) {\n- if (listeners[i].obj == obj && listeners[i].func == func) {\n- listeners.splice(i, 1);\n- break;\n- }\n- }\n- }\n- },\n-\n- /** \n- * Method: remove\n- * Remove all listeners for a given event type. If type is not registered,\n- * does nothing.\n- *\n- * Parameters:\n- * type - {String} \n- */\n- remove: function(type) {\n- if (this.listeners[type] != null) {\n- this.listeners[type] = [];\n- }\n- },\n-\n- /**\n- * APIMethod: triggerEvent\n- * Trigger a specified registered event. \n- * \n- * Parameters:\n- * type - {String} \n- * evt - {Event || Object} will be passed to the listeners.\n- *\n- * Returns:\n- * {Boolean} The last listener return. If a listener returns false, the\n- * chain of listeners will stop getting called.\n- */\n- triggerEvent: function(type, evt) {\n- var listeners = this.listeners[type];\n-\n- // fast path\n- if (!listeners || listeners.length == 0) {\n- return undefined;\n- }\n-\n- // prep evt object with object & div references\n- if (evt == null) {\n- evt = {};\n- }\n- evt.object = this.object;\n- evt.element = this.element;\n- if (!evt.type) {\n- evt.type = type;\n- }\n-\n- // execute all callbacks registered for specified type\n- // get a clone of the listeners array to\n- // allow for splicing during callbacks\n- listeners = listeners.slice();\n- var continueChain;\n- for (var i = 0, len = listeners.length; i < len; i++) {\n- var callback = listeners[i];\n- // bind the context to callback.obj\n- continueChain = callback.func.apply(callback.obj, [evt]);\n-\n- if ((continueChain != undefined) && (continueChain == false)) {\n- // if callback returns false, execute no more callbacks.\n- break;\n- }\n- }\n- // don't fall through to other DOM elements\n- if (!this.fallThrough) {\n- OpenLayers.Event.stop(evt, true);\n- }\n- return continueChain;\n- },\n-\n- /**\n- * Method: handleBrowserEvent\n- * Basically just a wrapper to the triggerEvent() function, but takes \n- * care to set a property 'xy' on the event with the current mouse \n- * position.\n- *\n- * Parameters:\n- * evt - {Event} \n- */\n- handleBrowserEvent: function(evt) {\n- var type = evt.type,\n- listeners = this.listeners[type];\n- if (!listeners || listeners.length == 0) {\n- // noone's listening, bail out\n- return;\n- }\n- // add clientX & clientY to all events - corresponds to average x, y\n- var touches = evt.touches;\n- if (touches && touches[0]) {\n- var x = 0;\n- var y = 0;\n- var num = touches.length;\n- var touch;\n- for (var i = 0; i < num; ++i) {\n- touch = this.getTouchClientXY(touches[i]);\n- x += touch.clientX;\n- y += touch.clientY;\n- }\n- evt.clientX = x / num;\n- evt.clientY = y / num;\n- }\n- if (this.includeXY) {\n- evt.xy = this.getMousePosition(evt);\n- }\n- this.triggerEvent(type, evt);\n- },\n-\n- /**\n- * Method: getTouchClientXY\n- * WebKit has a few bugs for clientX/clientY. This method detects them\n- * and calculate the correct values.\n- *\n- * Parameters:\n- * evt - {Touch} a Touch object from a TouchEvent\n- * \n- * Returns:\n- * {Object} An object with only clientX and clientY properties with the\n- * calculated values.\n- */\n- getTouchClientXY: function(evt) {\n- // olMochWin is to override window, used for testing\n- var win = window.olMockWin || window,\n- winPageX = win.pageXOffset,\n- winPageY = win.pageYOffset,\n- x = evt.clientX,\n- y = evt.clientY;\n-\n- if (evt.pageY === 0 && Math.floor(y) > Math.floor(evt.pageY) ||\n- evt.pageX === 0 && Math.floor(x) > Math.floor(evt.pageX)) {\n- // iOS4 include scroll offset in clientX/Y\n- x = x - winPageX;\n- y = y - winPageY;\n- } else if (y < (evt.pageY - winPageY) || x < (evt.pageX - winPageX)) {\n- // Some Android browsers have totally bogus values for clientX/Y\n- // when scrolling/zooming a page\n- x = evt.pageX - winPageX;\n- y = evt.pageY - winPageY;\n- }\n-\n- evt.olClientX = x;\n- evt.olClientY = y;\n-\n- return {\n- clientX: x,\n- clientY: y\n- };\n- },\n-\n- /**\n- * APIMethod: clearMouseCache\n- * Clear cached data about the mouse position. This should be called any \n- * time the element that events are registered on changes position \n- * within the page.\n- */\n- clearMouseCache: function() {\n- this.element.scrolls = null;\n- this.element.lefttop = null;\n- this.element.offsets = null;\n- },\n-\n- /**\n- * Method: getMousePosition\n- * \n- * Parameters:\n- * evt - {Event} \n- * \n- * Returns:\n- * {} The current xy coordinate of the mouse, adjusted\n- * for offsets\n- */\n- getMousePosition: function(evt) {\n- if (!this.includeXY) {\n- this.clearMouseCache();\n- } else if (!this.element.hasScrollEvent) {\n- OpenLayers.Event.observe(window, \"scroll\", this.clearMouseListener);\n- this.element.hasScrollEvent = true;\n- }\n-\n- if (!this.element.scrolls) {\n- var viewportElement = OpenLayers.Util.getViewportElement();\n- this.element.scrolls = [\n- window.pageXOffset || viewportElement.scrollLeft,\n- window.pageYOffset || viewportElement.scrollTop\n- ];\n- }\n-\n- if (!this.element.lefttop) {\n- this.element.lefttop = [\n- (document.documentElement.clientLeft || 0),\n- (document.documentElement.clientTop || 0)\n- ];\n- }\n-\n- if (!this.element.offsets) {\n- this.element.offsets = OpenLayers.Util.pagePosition(this.element);\n- }\n-\n- return new OpenLayers.Pixel(\n- (evt.clientX + this.element.scrolls[0]) - this.element.offsets[0] -\n- this.element.lefttop[0],\n- (evt.clientY + this.element.scrolls[1]) - this.element.offsets[1] -\n- this.element.lefttop[1]\n- );\n- },\n-\n- /**\n- * Method: addMsTouchListener\n- *\n- * Parameters:\n- * element - {DOMElement} The DOM element to register the listener on\n- * type - {String} The event type\n- * handler - {Function} the handler\n- */\n- addMsTouchListener: function(element, type, handler) {\n- var eventHandler = this.eventHandler;\n- var touches = this._msTouches;\n-\n- function msHandler(evt) {\n- handler(OpenLayers.Util.applyDefaults({\n- stopPropagation: function() {\n- for (var i = touches.length - 1; i >= 0; --i) {\n- touches[i].stopPropagation();\n- }\n- },\n- preventDefault: function() {\n- for (var i = touches.length - 1; i >= 0; --i) {\n- touches[i].preventDefault();\n- }\n- },\n- type: type\n- }, evt));\n- }\n-\n- switch (type) {\n- case 'touchstart':\n- return this.addMsTouchListenerStart(element, type, msHandler);\n- case 'touchend':\n- return this.addMsTouchListenerEnd(element, type, msHandler);\n- case 'touchmove':\n- return this.addMsTouchListenerMove(element, type, msHandler);\n- default:\n- throw 'Unknown touch event type';\n- }\n- },\n-\n- /**\n- * Method: addMsTouchListenerStart\n- *\n- * Parameters:\n- * element - {DOMElement} The DOM element to register the listener on\n- * type - {String} The event type\n- * handler - {Function} the handler\n- */\n- addMsTouchListenerStart: function(element, type, handler) {\n- var touches = this._msTouches;\n-\n- var cb = function(e) {\n-\n- var alreadyInArray = false;\n- for (var i = 0, ii = touches.length; i < ii; ++i) {\n- if (touches[i].pointerId == e.pointerId) {\n- alreadyInArray = true;\n- break;\n- }\n- }\n- if (!alreadyInArray) {\n- touches.push(e);\n- }\n-\n- e.touches = touches.slice();\n- handler(e);\n- };\n-\n- OpenLayers.Event.observe(element, 'MSPointerDown', cb);\n-\n- // Need to also listen for end events to keep the _msTouches list\n- // accurate\n- var internalCb = function(e) {\n- for (var i = 0, ii = touches.length; i < ii; ++i) {\n- if (touches[i].pointerId == e.pointerId) {\n- touches.splice(i, 1);\n- break;\n- }\n- }\n- };\n- OpenLayers.Event.observe(element, 'MSPointerUp', internalCb);\n- },\n-\n- /**\n- * Method: addMsTouchListenerMove\n- *\n- * Parameters:\n- * element - {DOMElement} The DOM element to register the listener on\n- * type - {String} The event type\n- * handler - {Function} the handler\n- */\n- addMsTouchListenerMove: function(element, type, handler) {\n- var touches = this._msTouches;\n- var cb = function(e) {\n-\n- //Don't fire touch moves when mouse isn't down\n- if (e.pointerType == e.MSPOINTER_TYPE_MOUSE && e.buttons == 0) {\n- return;\n- }\n-\n- if (touches.length == 1 && touches[0].pageX == e.pageX &&\n- touches[0].pageY == e.pageY) {\n- // don't trigger event when pointer has not moved\n- return;\n- }\n- for (var i = 0, ii = touches.length; i < ii; ++i) {\n- if (touches[i].pointerId == e.pointerId) {\n- touches[i] = e;\n- break;\n- }\n- }\n-\n- e.touches = touches.slice();\n- handler(e);\n- };\n-\n- OpenLayers.Event.observe(element, 'MSPointerMove', cb);\n- },\n-\n- /**\n- * Method: addMsTouchListenerEnd\n- *\n- * Parameters:\n- * element - {DOMElement} The DOM element to register the listener on\n- * type - {String} The event type\n- * handler - {Function} the handler\n- */\n- addMsTouchListenerEnd: function(element, type, handler) {\n- var touches = this._msTouches;\n-\n- var cb = function(e) {\n-\n- for (var i = 0, ii = touches.length; i < ii; ++i) {\n- if (touches[i].pointerId == e.pointerId) {\n- touches.splice(i, 1);\n- break;\n- }\n- }\n-\n- e.touches = touches.slice();\n- handler(e);\n- };\n-\n- OpenLayers.Event.observe(element, 'MSPointerUp', cb);\n- },\n-\n- CLASS_NAME: \"OpenLayers.Events\"\n-});\n-/* ======================================================================\n- OpenLayers/Request/XMLHttpRequest.js\n- ====================================================================== */\n-\n-// XMLHttpRequest.js Copyright (C) 2010 Sergey Ilinsky (http://www.ilinsky.com)\n-//\n-// Licensed under the Apache License, Version 2.0 (the \"License\");\n-// you may not use this file except in compliance with the License.\n-// You may obtain a copy of the License at\n-//\n-// http://www.apache.org/licenses/LICENSE-2.0\n-//\n-// Unless required by applicable law or agreed to in writing, software\n-// distributed under the License is distributed on an \"AS IS\" BASIS,\n-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n-// See the License for the specific language governing permissions and\n-// limitations under the License.\n-\n-/**\n- * @requires OpenLayers/Request.js\n- */\n-\n-(function() {\n-\n- // Save reference to earlier defined object implementation (if any)\n- var oXMLHttpRequest = window.XMLHttpRequest;\n-\n- // Define on browser type\n- var bGecko = !!window.controllers,\n- bIE = window.document.all && !window.opera,\n- bIE7 = bIE && window.navigator.userAgent.match(/MSIE 7.0/);\n-\n- // Enables \"XMLHttpRequest()\" call next to \"new XMLHttpReques()\"\n- function fXMLHttpRequest() {\n- this._object = oXMLHttpRequest && !bIE7 ? new oXMLHttpRequest : new window.ActiveXObject(\"Microsoft.XMLHTTP\");\n- this._listeners = [];\n- };\n-\n- // Constructor\n- function cXMLHttpRequest() {\n- return new fXMLHttpRequest;\n- };\n- cXMLHttpRequest.prototype = fXMLHttpRequest.prototype;\n-\n- // BUGFIX: Firefox with Firebug installed would break pages if not executed\n- if (bGecko && oXMLHttpRequest.wrapped)\n- cXMLHttpRequest.wrapped = oXMLHttpRequest.wrapped;\n-\n- // Constants\n- cXMLHttpRequest.UNSENT = 0;\n- cXMLHttpRequest.OPENED = 1;\n- cXMLHttpRequest.HEADERS_RECEIVED = 2;\n- cXMLHttpRequest.LOADING = 3;\n- cXMLHttpRequest.DONE = 4;\n-\n- // Public Properties\n- cXMLHttpRequest.prototype.readyState = cXMLHttpRequest.UNSENT;\n- cXMLHttpRequest.prototype.responseText = '';\n- cXMLHttpRequest.prototype.responseXML = null;\n- cXMLHttpRequest.prototype.status = 0;\n- cXMLHttpRequest.prototype.statusText = '';\n-\n- // Priority proposal\n- cXMLHttpRequest.prototype.priority = \"NORMAL\";\n-\n- // Instance-level Events Handlers\n- cXMLHttpRequest.prototype.onreadystatechange = null;\n-\n- // Class-level Events Handlers\n- cXMLHttpRequest.onreadystatechange = null;\n- cXMLHttpRequest.onopen = null;\n- cXMLHttpRequest.onsend = null;\n- cXMLHttpRequest.onabort = null;\n-\n- // Public Methods\n- cXMLHttpRequest.prototype.open = function(sMethod, sUrl, bAsync, sUser, sPassword) {\n- // Delete headers, required when object is reused\n- delete this._headers;\n-\n- // When bAsync parameter value is omitted, use true as default\n- if (arguments.length < 3)\n- bAsync = true;\n-\n- // Save async parameter for fixing Gecko bug with missing readystatechange in synchronous requests\n- this._async = bAsync;\n-\n- // Set the onreadystatechange handler\n- var oRequest = this,\n- nState = this.readyState,\n- fOnUnload;\n-\n- // BUGFIX: IE - memory leak on page unload (inter-page leak)\n- if (bIE && bAsync) {\n- fOnUnload = function() {\n- if (nState != cXMLHttpRequest.DONE) {\n- fCleanTransport(oRequest);\n- // Safe to abort here since onreadystatechange handler removed\n- oRequest.abort();\n- }\n- };\n- window.attachEvent(\"onunload\", fOnUnload);\n- }\n-\n- // Add method sniffer\n- if (cXMLHttpRequest.onopen)\n- cXMLHttpRequest.onopen.apply(this, arguments);\n-\n- if (arguments.length > 4)\n- this._object.open(sMethod, sUrl, bAsync, sUser, sPassword);\n- else\n- if (arguments.length > 3)\n- this._object.open(sMethod, sUrl, bAsync, sUser);\n- else\n- this._object.open(sMethod, sUrl, bAsync);\n-\n- this.readyState = cXMLHttpRequest.OPENED;\n- fReadyStateChange(this);\n-\n- this._object.onreadystatechange = function() {\n- if (bGecko && !bAsync)\n- return;\n-\n- // Synchronize state\n- oRequest.readyState = oRequest._object.readyState;\n-\n- //\n- fSynchronizeValues(oRequest);\n-\n- // BUGFIX: Firefox fires unnecessary DONE when aborting\n- if (oRequest._aborted) {\n- // Reset readyState to UNSENT\n- oRequest.readyState = cXMLHttpRequest.UNSENT;\n-\n- // Return now\n- return;\n- }\n-\n- if (oRequest.readyState == cXMLHttpRequest.DONE) {\n- // Free up queue\n- delete oRequest._data;\n- /* if (bAsync)\n- fQueue_remove(oRequest);*/\n- //\n- fCleanTransport(oRequest);\n- // Uncomment this block if you need a fix for IE cache\n- /*\n- // BUGFIX: IE - cache issue\n- if (!oRequest._object.getResponseHeader(\"Date\")) {\n- // Save object to cache\n- oRequest._cached = oRequest._object;\n-\n- // Instantiate a new transport object\n- cXMLHttpRequest.call(oRequest);\n-\n- // Re-send request\n- if (sUser) {\n- if (sPassword)\n- oRequest._object.open(sMethod, sUrl, bAsync, sUser, sPassword);\n- else\n- oRequest._object.open(sMethod, sUrl, bAsync, sUser);\n- }\n- else\n- oRequest._object.open(sMethod, sUrl, bAsync);\n- oRequest._object.setRequestHeader(\"If-Modified-Since\", oRequest._cached.getResponseHeader(\"Last-Modified\") || new window.Date(0));\n- // Copy headers set\n- if (oRequest._headers)\n- for (var sHeader in oRequest._headers)\n- if (typeof oRequest._headers[sHeader] == \"string\") // Some frameworks prototype objects with functions\n- oRequest._object.setRequestHeader(sHeader, oRequest._headers[sHeader]);\n-\n- oRequest._object.onreadystatechange = function() {\n- // Synchronize state\n- oRequest.readyState = oRequest._object.readyState;\n-\n- if (oRequest._aborted) {\n- //\n- oRequest.readyState = cXMLHttpRequest.UNSENT;\n-\n- // Return\n- return;\n- }\n-\n- if (oRequest.readyState == cXMLHttpRequest.DONE) {\n- // Clean Object\n- fCleanTransport(oRequest);\n-\n- // get cached request\n- if (oRequest.status == 304)\n- oRequest._object = oRequest._cached;\n-\n- //\n- delete oRequest._cached;\n-\n- //\n- fSynchronizeValues(oRequest);\n-\n- //\n- fReadyStateChange(oRequest);\n-\n- // BUGFIX: IE - memory leak in interrupted\n- if (bIE && bAsync)\n- window.detachEvent(\"onunload\", fOnUnload);\n- }\n- };\n- oRequest._object.send(null);\n-\n- // Return now - wait until re-sent request is finished\n- return;\n- };\n- */\n- // BUGFIX: IE - memory leak in interrupted\n- if (bIE && bAsync)\n- window.detachEvent(\"onunload\", fOnUnload);\n- }\n-\n- // BUGFIX: Some browsers (Internet Explorer, Gecko) fire OPEN readystate twice\n- if (nState != oRequest.readyState)\n- fReadyStateChange(oRequest);\n-\n- nState = oRequest.readyState;\n- }\n- };\n-\n- function fXMLHttpRequest_send(oRequest) {\n- oRequest._object.send(oRequest._data);\n-\n- // BUGFIX: Gecko - missing readystatechange calls in synchronous requests\n- if (bGecko && !oRequest._async) {\n- oRequest.readyState = cXMLHttpRequest.OPENED;\n-\n- // Synchronize state\n- fSynchronizeValues(oRequest);\n-\n- // Simulate missing states\n- while (oRequest.readyState < cXMLHttpRequest.DONE) {\n- oRequest.readyState++;\n- fReadyStateChange(oRequest);\n- // Check if we are aborted\n- if (oRequest._aborted)\n- return;\n- }\n- }\n- };\n- cXMLHttpRequest.prototype.send = function(vData) {\n- // Add method sniffer\n- if (cXMLHttpRequest.onsend)\n- cXMLHttpRequest.onsend.apply(this, arguments);\n-\n- if (!arguments.length)\n- vData = null;\n-\n- // BUGFIX: Safari - fails sending documents created/modified dynamically, so an explicit serialization required\n- // BUGFIX: IE - rewrites any custom mime-type to \"text/xml\" in case an XMLNode is sent\n- // BUGFIX: Gecko - fails sending Element (this is up to the implementation either to standard)\n- if (vData && vData.nodeType) {\n- vData = window.XMLSerializer ? new window.XMLSerializer().serializeToString(vData) : vData.xml;\n- if (!this._headers[\"Content-Type\"])\n- this._object.setRequestHeader(\"Content-Type\", \"application/xml\");\n- }\n-\n- this._data = vData;\n- /*\n- // Add to queue\n- if (this._async)\n- fQueue_add(this);\n- else*/\n- fXMLHttpRequest_send(this);\n- };\n- cXMLHttpRequest.prototype.abort = function() {\n- // Add method sniffer\n- if (cXMLHttpRequest.onabort)\n- cXMLHttpRequest.onabort.apply(this, arguments);\n-\n- // BUGFIX: Gecko - unnecessary DONE when aborting\n- if (this.readyState > cXMLHttpRequest.UNSENT)\n- this._aborted = true;\n-\n- this._object.abort();\n-\n- // BUGFIX: IE - memory leak\n- fCleanTransport(this);\n-\n- this.readyState = cXMLHttpRequest.UNSENT;\n-\n- delete this._data;\n- /* if (this._async)\n- fQueue_remove(this);*/\n- };\n- cXMLHttpRequest.prototype.getAllResponseHeaders = function() {\n- return this._object.getAllResponseHeaders();\n- };\n- cXMLHttpRequest.prototype.getResponseHeader = function(sName) {\n- return this._object.getResponseHeader(sName);\n- };\n- cXMLHttpRequest.prototype.setRequestHeader = function(sName, sValue) {\n- // BUGFIX: IE - cache issue\n- if (!this._headers)\n- this._headers = {};\n- this._headers[sName] = sValue;\n-\n- return this._object.setRequestHeader(sName, sValue);\n- };\n-\n- // EventTarget interface implementation\n- cXMLHttpRequest.prototype.addEventListener = function(sName, fHandler, bUseCapture) {\n- for (var nIndex = 0, oListener; oListener = this._listeners[nIndex]; nIndex++)\n- if (oListener[0] == sName && oListener[1] == fHandler && oListener[2] == bUseCapture)\n- return;\n- // Add listener\n- this._listeners.push([sName, fHandler, bUseCapture]);\n- };\n-\n- cXMLHttpRequest.prototype.removeEventListener = function(sName, fHandler, bUseCapture) {\n- for (var nIndex = 0, oListener; oListener = this._listeners[nIndex]; nIndex++)\n- if (oListener[0] == sName && oListener[1] == fHandler && oListener[2] == bUseCapture)\n- break;\n- // Remove listener\n- if (oListener)\n- this._listeners.splice(nIndex, 1);\n- };\n-\n- cXMLHttpRequest.prototype.dispatchEvent = function(oEvent) {\n- var oEventPseudo = {\n- 'type': oEvent.type,\n- 'target': this,\n- 'currentTarget': this,\n- 'eventPhase': 2,\n- 'bubbles': oEvent.bubbles,\n- 'cancelable': oEvent.cancelable,\n- 'timeStamp': oEvent.timeStamp,\n- 'stopPropagation': function() {}, // There is no flow\n- 'preventDefault': function() {}, // There is no default action\n- 'initEvent': function() {} // Original event object should be initialized\n- };\n-\n- // Execute onreadystatechange\n- if (oEventPseudo.type == \"readystatechange\" && this.onreadystatechange)\n- (this.onreadystatechange.handleEvent || this.onreadystatechange).apply(this, [oEventPseudo]);\n-\n- // Execute listeners\n- for (var nIndex = 0, oListener; oListener = this._listeners[nIndex]; nIndex++)\n- if (oListener[0] == oEventPseudo.type && !oListener[2])\n- (oListener[1].handleEvent || oListener[1]).apply(this, [oEventPseudo]);\n- };\n-\n- //\n- cXMLHttpRequest.prototype.toString = function() {\n- return '[' + \"object\" + ' ' + \"XMLHttpRequest\" + ']';\n- };\n-\n- cXMLHttpRequest.toString = function() {\n- return '[' + \"XMLHttpRequest\" + ']';\n- };\n-\n- // Helper function\n- function fReadyStateChange(oRequest) {\n- // Sniffing code\n- if (cXMLHttpRequest.onreadystatechange)\n- cXMLHttpRequest.onreadystatechange.apply(oRequest);\n-\n- // Fake event\n- oRequest.dispatchEvent({\n- 'type': \"readystatechange\",\n- 'bubbles': false,\n- 'cancelable': false,\n- 'timeStamp': new Date + 0\n- });\n- };\n-\n- function fGetDocument(oRequest) {\n- var oDocument = oRequest.responseXML,\n- sResponse = oRequest.responseText;\n- // Try parsing responseText\n- if (bIE && sResponse && oDocument && !oDocument.documentElement && oRequest.getResponseHeader(\"Content-Type\").match(/[^\\/]+\\/[^\\+]+\\+xml/)) {\n- oDocument = new window.ActiveXObject(\"Microsoft.XMLDOM\");\n- oDocument.async = false;\n- oDocument.validateOnParse = false;\n- oDocument.loadXML(sResponse);\n- }\n- // Check if there is no error in document\n- if (oDocument)\n- if ((bIE && oDocument.parseError != 0) || !oDocument.documentElement || (oDocument.documentElement && oDocument.documentElement.tagName == \"parsererror\"))\n- return null;\n- return oDocument;\n- };\n-\n- function fSynchronizeValues(oRequest) {\n- try {\n- oRequest.responseText = oRequest._object.responseText;\n- } catch (e) {}\n- try {\n- oRequest.responseXML = fGetDocument(oRequest._object);\n- } catch (e) {}\n- try {\n- oRequest.status = oRequest._object.status;\n- } catch (e) {}\n- try {\n- oRequest.statusText = oRequest._object.statusText;\n- } catch (e) {}\n- };\n-\n- function fCleanTransport(oRequest) {\n- // BUGFIX: IE - memory leak (on-page leak)\n- oRequest._object.onreadystatechange = new window.Function;\n- };\n- /*\n- // Queue manager\n- var oQueuePending = {\"CRITICAL\":[],\"HIGH\":[],\"NORMAL\":[],\"LOW\":[],\"LOWEST\":[]},\n- aQueueRunning = [];\n- function fQueue_add(oRequest) {\n- oQueuePending[oRequest.priority in oQueuePending ? oRequest.priority : \"NORMAL\"].push(oRequest);\n- //\n- setTimeout(fQueue_process);\n- };\n-\n- function fQueue_remove(oRequest) {\n- for (var nIndex = 0, bFound = false; nIndex < aQueueRunning.length; nIndex++)\n- if (bFound)\n- aQueueRunning[nIndex - 1] = aQueueRunning[nIndex];\n- else\n- if (aQueueRunning[nIndex] == oRequest)\n- bFound = true;\n- if (bFound)\n- aQueueRunning.length--;\n- //\n- setTimeout(fQueue_process);\n- };\n-\n- function fQueue_process() {\n- if (aQueueRunning.length < 6) {\n- for (var sPriority in oQueuePending) {\n- if (oQueuePending[sPriority].length) {\n- var oRequest = oQueuePending[sPriority][0];\n- oQueuePending[sPriority] = oQueuePending[sPriority].slice(1);\n- //\n- aQueueRunning.push(oRequest);\n- // Send request\n- fXMLHttpRequest_send(oRequest);\n- break;\n- }\n- }\n- }\n- };\n- */\n- // Internet Explorer 5.0 (missing apply)\n- if (!window.Function.prototype.apply) {\n- window.Function.prototype.apply = function(oRequest, oArguments) {\n- if (!oArguments)\n- oArguments = [];\n- oRequest.__func = this;\n- oRequest.__func(oArguments[0], oArguments[1], oArguments[2], oArguments[3], oArguments[4]);\n- delete oRequest.__func;\n- };\n- };\n-\n- // Register new object with window\n- /**\n- * Class: OpenLayers.Request.XMLHttpRequest\n- * Standard-compliant (W3C) cross-browser implementation of the\n- * XMLHttpRequest object. From\n- * http://code.google.com/p/xmlhttprequest/.\n- */\n- if (!OpenLayers.Request) {\n- /**\n- * This allows for OpenLayers/Request.js to be included\n- * before or after this script.\n- */\n- OpenLayers.Request = {};\n- }\n- OpenLayers.Request.XMLHttpRequest = cXMLHttpRequest;\n-})();\n-/* ======================================================================\n- OpenLayers/Request.js\n- ====================================================================== */\n-\n-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n- * full list of contributors). Published under the 2-clause BSD license.\n- * See license.txt in the OpenLayers distribution or repository for the\n- * full text of the license. */\n-\n-/**\n- * @requires OpenLayers/Events.js\n- * @requires OpenLayers/Request/XMLHttpRequest.js\n- */\n-\n-/**\n- * TODO: deprecate me\n- * Use OpenLayers.Request.proxy instead.\n- */\n-OpenLayers.ProxyHost = \"\";\n-\n-/**\n- * Namespace: OpenLayers.Request\n- * The OpenLayers.Request namespace contains convenience methods for working\n- * with XMLHttpRequests. These methods work with a cross-browser\n- * W3C compliant class.\n- */\n-if (!OpenLayers.Request) {\n- /**\n- * This allows for OpenLayers/Request/XMLHttpRequest.js to be included\n- * before or after this script.\n- */\n- OpenLayers.Request = {};\n-}\n-OpenLayers.Util.extend(OpenLayers.Request, {\n-\n- /**\n- * Constant: DEFAULT_CONFIG\n- * {Object} Default configuration for all requests.\n- */\n- DEFAULT_CONFIG: {\n- method: \"GET\",\n- url: window.location.href,\n- async: true,\n- user: undefined,\n- password: undefined,\n- params: null,\n- proxy: OpenLayers.ProxyHost,\n- headers: {},\n- data: null,\n- callback: function() {},\n- success: null,\n- failure: null,\n- scope: null\n- },\n-\n- /**\n- * Constant: URL_SPLIT_REGEX\n- */\n- URL_SPLIT_REGEX: /([^:]*:)\\/\\/([^:]*:?[^@]*@)?([^:\\/\\?]*):?([^\\/\\?]*)/,\n-\n- /**\n- * APIProperty: events\n- * {} An events object that handles all \n- * events on the {} object.\n- *\n- * All event listeners will receive an event object with three properties:\n- * request - {} The request object.\n- * config - {Object} The config object sent to the specific request method.\n- * requestUrl - {String} The request url.\n- * \n- * Supported event types:\n- * complete - Triggered when we have a response from the request, if a\n- * listener returns false, no further response processing will take\n- * place.\n- * success - Triggered when the HTTP response has a success code (200-299).\n- * failure - Triggered when the HTTP response does not have a success code.\n- */\n- events: new OpenLayers.Events(this),\n-\n- /**\n- * Method: makeSameOrigin\n- * Using the specified proxy, returns a same origin url of the provided url.\n- *\n- * Parameters:\n- * url - {String} An arbitrary url\n- * proxy {String|Function} The proxy to use to make the provided url a\n- * same origin url.\n- *\n- * Returns\n- * {String} the same origin url. If no proxy is provided, the returned url\n- * will be the same as the provided url.\n- */\n- makeSameOrigin: function(url, proxy) {\n- var sameOrigin = url.indexOf(\"http\") !== 0;\n- var urlParts = !sameOrigin && url.match(this.URL_SPLIT_REGEX);\n- if (urlParts) {\n- var location = window.location;\n- sameOrigin =\n- urlParts[1] == location.protocol &&\n- urlParts[3] == location.hostname;\n- var uPort = urlParts[4],\n- lPort = location.port;\n- if (uPort != 80 && uPort != \"\" || lPort != \"80\" && lPort != \"\") {\n- sameOrigin = sameOrigin && uPort == lPort;\n- }\n- }\n- if (!sameOrigin) {\n- if (proxy) {\n- if (typeof proxy == \"function\") {\n- url = proxy(url);\n- } else {\n- url = proxy + encodeURIComponent(url);\n- }\n- }\n- }\n- return url;\n- },\n-\n- /**\n- * APIMethod: issue\n- * Create a new XMLHttpRequest object, open it, set any headers, bind\n- * a callback to done state, and send any data. It is recommended that\n- * you use one , , , , , or .\n- * This method is only documented to provide detail on the configuration\n- * options available to all request methods.\n- *\n- * Parameters:\n- * config - {Object} Object containing properties for configuring the\n- * request. Allowed configuration properties are described below.\n- * This object is modified and should not be reused.\n- *\n- * Allowed config properties:\n- * method - {String} One of GET, POST, PUT, DELETE, HEAD, or\n- * OPTIONS. Default is GET.\n- * url - {String} URL for the request.\n- * async - {Boolean} Open an asynchronous request. Default is true.\n- * user - {String} User for relevant authentication scheme. Set\n- * to null to clear current user.\n- * password - {String} Password for relevant authentication scheme.\n- * Set to null to clear current password.\n- * proxy - {String} Optional proxy. Defaults to\n- * .\n- * params - {Object} Any key:value pairs to be appended to the\n- * url as a query string. Assumes url doesn't already include a query\n- * string or hash. Typically, this is only appropriate for \n- * requests where the query string will be appended to the url.\n- * Parameter values that are arrays will be\n- * concatenated with a comma (note that this goes against form-encoding)\n- * as is done with .\n- * headers - {Object} Object with header:value pairs to be set on\n- * the request.\n- * data - {String | Document} Optional data to send with the request.\n- * Typically, this is only used with and requests.\n- * Make sure to provide the appropriate \"Content-Type\" header for your\n- * data. For and requests, the content type defaults to\n- * \"application-xml\". If your data is a different content type, or\n- * if you are using a different HTTP method, set the \"Content-Type\"\n- * header to match your data type.\n- * callback - {Function} Function to call when request is done.\n- * To determine if the request failed, check request.status (200\n- * indicates success).\n- * success - {Function} Optional function to call if request status is in\n- * the 200s. This will be called in addition to callback above and\n- * would typically only be used as an alternative.\n- * failure - {Function} Optional function to call if request status is not\n- * in the 200s. This will be called in addition to callback above and\n- * would typically only be used as an alternative.\n- * scope - {Object} If callback is a public method on some object,\n- * set the scope to that object.\n- *\n- * Returns:\n- * {XMLHttpRequest} Request object. To abort the request before a response\n- * is received, call abort() on the request object.\n- */\n- issue: function(config) {\n- // apply default config - proxy host may have changed\n- var defaultConfig = OpenLayers.Util.extend(\n- this.DEFAULT_CONFIG, {\n- proxy: OpenLayers.ProxyHost\n- }\n- );\n- config = config || {};\n- config.headers = config.headers || {};\n- config = OpenLayers.Util.applyDefaults(config, defaultConfig);\n- config.headers = OpenLayers.Util.applyDefaults(config.headers, defaultConfig.headers);\n- // Always set the \"X-Requested-With\" header to signal that this request\n- // was issued through the XHR-object. Since header keys are case \n- // insensitive and we want to allow overriding of the \"X-Requested-With\"\n- // header through the user we cannot use applyDefaults, but have to \n- // check manually whether we were called with a \"X-Requested-With\"\n- // header.\n- var customRequestedWithHeader = false,\n- headerKey;\n- for (headerKey in config.headers) {\n- if (config.headers.hasOwnProperty(headerKey)) {\n- if (headerKey.toLowerCase() === 'x-requested-with') {\n- customRequestedWithHeader = true;\n- }\n- }\n- }\n- if (customRequestedWithHeader === false) {\n- // we did not have a custom \"X-Requested-With\" header\n- config.headers['X-Requested-With'] = 'XMLHttpRequest';\n- }\n-\n- // create request, open, and set headers\n- var request = new OpenLayers.Request.XMLHttpRequest();\n- var url = OpenLayers.Util.urlAppend(config.url,\n- OpenLayers.Util.getParameterString(config.params || {}));\n- url = OpenLayers.Request.makeSameOrigin(url, config.proxy);\n- request.open(\n- config.method, url, config.async, config.user, config.password\n- );\n- for (var header in config.headers) {\n- request.setRequestHeader(header, config.headers[header]);\n- }\n-\n- var events = this.events;\n-\n- // we want to execute runCallbacks with \"this\" as the\n- // execution scope\n- var self = this;\n-\n- request.onreadystatechange = function() {\n- if (request.readyState == OpenLayers.Request.XMLHttpRequest.DONE) {\n- var proceed = events.triggerEvent(\n- \"complete\", {\n- request: request,\n- config: config,\n- requestUrl: url\n- }\n- );\n- if (proceed !== false) {\n- self.runCallbacks({\n- request: request,\n- config: config,\n- requestUrl: url\n- });\n- }\n- }\n- };\n-\n- // send request (optionally with data) and return\n- // call in a timeout for asynchronous requests so the return is\n- // available before readyState == 4 for cached docs\n- if (config.async === false) {\n- request.send(config.data);\n- } else {\n- window.setTimeout(function() {\n- if (request.readyState !== 0) { // W3C: 0-UNSENT\n- request.send(config.data);\n- }\n- }, 0);\n- }\n- return request;\n- },\n-\n- /**\n- * Method: runCallbacks\n- * Calls the complete, success and failure callbacks. Application\n- * can listen to the \"complete\" event, have the listener \n- * display a confirm window and always return false, and\n- * execute OpenLayers.Request.runCallbacks if the user\n- * hits \"yes\" in the confirm window.\n- *\n- * Parameters:\n- * options - {Object} Hash containing request, config and requestUrl keys\n- */\n- runCallbacks: function(options) {\n- var request = options.request;\n- var config = options.config;\n-\n- // bind callbacks to readyState 4 (done)\n- var complete = (config.scope) ?\n- OpenLayers.Function.bind(config.callback, config.scope) :\n- config.callback;\n-\n- // optional success callback\n- var success;\n- if (config.success) {\n- success = (config.scope) ?\n- OpenLayers.Function.bind(config.success, config.scope) :\n- config.success;\n- }\n-\n- // optional failure callback\n- var failure;\n- if (config.failure) {\n- failure = (config.scope) ?\n- OpenLayers.Function.bind(config.failure, config.scope) :\n- config.failure;\n- }\n-\n- if (OpenLayers.Util.createUrlObject(config.url).protocol == \"file:\" &&\n- request.responseText) {\n- request.status = 200;\n- }\n- complete(request);\n-\n- if (!request.status || (request.status >= 200 && request.status < 300)) {\n- this.events.triggerEvent(\"success\", options);\n- if (success) {\n- success(request);\n- }\n- }\n- if (request.status && (request.status < 200 || request.status >= 300)) {\n- this.events.triggerEvent(\"failure\", options);\n- if (failure) {\n- failure(request);\n- }\n- }\n- },\n-\n- /**\n- * APIMethod: GET\n- * Send an HTTP GET request. Additional configuration properties are\n- * documented in the method, with the method property set\n- * to GET.\n- *\n- * Parameters:\n- * config - {Object} Object with properties for configuring the request.\n- * See the method for documentation of allowed properties.\n- * This object is modified and should not be reused.\n- * \n- * Returns:\n- * {XMLHttpRequest} Request object.\n- */\n- GET: function(config) {\n- config = OpenLayers.Util.extend(config, {\n- method: \"GET\"\n- });\n- return OpenLayers.Request.issue(config);\n- },\n-\n- /**\n- * APIMethod: POST\n- * Send a POST request. Additional configuration properties are\n- * documented in the method, with the method property set\n- * to POST and \"Content-Type\" header set to \"application/xml\".\n- *\n- * Parameters:\n- * config - {Object} Object with properties for configuring the request.\n- * See the method for documentation of allowed properties. The\n- * default \"Content-Type\" header will be set to \"application-xml\" if\n- * none is provided. This object is modified and should not be reused.\n- * \n- * Returns:\n- * {XMLHttpRequest} Request object.\n- */\n- POST: function(config) {\n- config = OpenLayers.Util.extend(config, {\n- method: \"POST\"\n- });\n- // set content type to application/xml if it isn't already set\n- config.headers = config.headers ? config.headers : {};\n- if (!(\"CONTENT-TYPE\" in OpenLayers.Util.upperCaseObject(config.headers))) {\n- config.headers[\"Content-Type\"] = \"application/xml\";\n- }\n- return OpenLayers.Request.issue(config);\n- },\n-\n- /**\n- * APIMethod: PUT\n- * Send an HTTP PUT request. Additional configuration properties are\n- * documented in the method, with the method property set\n- * to PUT and \"Content-Type\" header set to \"application/xml\".\n- *\n- * Parameters:\n- * config - {Object} Object with properties for configuring the request.\n- * See the method for documentation of allowed properties. The\n- * default \"Content-Type\" header will be set to \"application-xml\" if\n- * none is provided. This object is modified and should not be reused.\n- * \n- * Returns:\n- * {XMLHttpRequest} Request object.\n- */\n- PUT: function(config) {\n- config = OpenLayers.Util.extend(config, {\n- method: \"PUT\"\n- });\n- // set content type to application/xml if it isn't already set\n- config.headers = config.headers ? config.headers : {};\n- if (!(\"CONTENT-TYPE\" in OpenLayers.Util.upperCaseObject(config.headers))) {\n- config.headers[\"Content-Type\"] = \"application/xml\";\n- }\n- return OpenLayers.Request.issue(config);\n- },\n-\n- /**\n- * APIMethod: DELETE\n- * Send an HTTP DELETE request. Additional configuration properties are\n- * documented in the method, with the method property set\n- * to DELETE.\n- *\n- * Parameters:\n- * config - {Object} Object with properties for configuring the request.\n- * See the method for documentation of allowed properties.\n- * This object is modified and should not be reused.\n- * \n- * Returns:\n- * {XMLHttpRequest} Request object.\n- */\n- DELETE: function(config) {\n- config = OpenLayers.Util.extend(config, {\n- method: \"DELETE\"\n- });\n- return OpenLayers.Request.issue(config);\n- },\n-\n- /**\n- * APIMethod: HEAD\n- * Send an HTTP HEAD request. Additional configuration properties are\n- * documented in the method, with the method property set\n- * to HEAD.\n- *\n- * Parameters:\n- * config - {Object} Object with properties for configuring the request.\n- * See the method for documentation of allowed properties.\n- * This object is modified and should not be reused.\n- * \n- * Returns:\n- * {XMLHttpRequest} Request object.\n- */\n- HEAD: function(config) {\n- config = OpenLayers.Util.extend(config, {\n- method: \"HEAD\"\n- });\n- return OpenLayers.Request.issue(config);\n- },\n-\n- /**\n- * APIMethod: OPTIONS\n- * Send an HTTP OPTIONS request. Additional configuration properties are\n- * documented in the method, with the method property set\n- * to OPTIONS.\n- *\n- * Parameters:\n- * config - {Object} Object with properties for configuring the request.\n- * See the method for documentation of allowed properties.\n- * This object is modified and should not be reused.\n- * \n- * Returns:\n- * {XMLHttpRequest} Request object.\n- */\n- OPTIONS: function(config) {\n- config = OpenLayers.Util.extend(config, {\n- method: \"OPTIONS\"\n- });\n- return OpenLayers.Request.issue(config);\n- }\n-\n-});\n-/* ======================================================================\n OpenLayers/WPSProcess.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n * See license.txt in the OpenLayers distribution or repository for the\n * full text of the license. */\n@@ -20655,400 +21184,178 @@\n OpenLayers.Util.extend(this, options);\n },\n \n CLASS_NAME: \"OpenLayers.WPSProcess.ChainLink\"\n \n });\n /* ======================================================================\n- OpenLayers/Symbolizer.js\n- ====================================================================== */\n-\n-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n- * full list of contributors). Published under the 2-clause BSD license.\n- * See license.txt in the OpenLayers distribution or repository for the\n- * full text of the license. */\n-\n-/**\n- * @requires OpenLayers/BaseTypes/Class.js\n- */\n-\n-/**\n- * Class: OpenLayers.Symbolizer\n- * Base class representing a symbolizer used for feature rendering.\n- */\n-OpenLayers.Symbolizer = OpenLayers.Class({\n-\n-\n- /**\n- * APIProperty: zIndex\n- * {Number} The zIndex determines the rendering order for a symbolizer.\n- * Symbolizers with larger zIndex values are rendered over symbolizers\n- * with smaller zIndex values. Default is 0.\n- */\n- zIndex: 0,\n-\n- /**\n- * Constructor: OpenLayers.Symbolizer\n- * Instances of this class are not useful. See one of the subclasses.\n- *\n- * Parameters:\n- * config - {Object} An object containing properties to be set on the \n- * symbolizer. Any documented symbolizer property can be set at \n- * construction.\n- *\n- * Returns:\n- * A new symbolizer.\n- */\n- initialize: function(config) {\n- OpenLayers.Util.extend(this, config);\n- },\n-\n- /** \n- * APIMethod: clone\n- * Create a copy of this symbolizer.\n- *\n- * Returns a symbolizer of the same type with the same properties.\n- */\n- clone: function() {\n- var Type = eval(this.CLASS_NAME);\n- return new Type(OpenLayers.Util.extend({}, this));\n- },\n-\n- CLASS_NAME: \"OpenLayers.Symbolizer\"\n-\n-});\n-\n-/* ======================================================================\n- OpenLayers/Projection.js\n+ OpenLayers/StyleMap.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n * See license.txt in the OpenLayers distribution or repository for the\n * full text of the license. */\n \n /**\n * @requires OpenLayers/BaseTypes/Class.js\n- * @requires OpenLayers/Util.js\n+ * @requires OpenLayers/Style.js\n+ * @requires OpenLayers/Feature/Vector.js\n */\n \n /**\n- * Namespace: OpenLayers.Projection\n- * Methods for coordinate transforms between coordinate systems. By default,\n- * OpenLayers ships with the ability to transform coordinates between\n- * geographic (EPSG:4326) and web or spherical mercator (EPSG:900913 et al.)\n- * coordinate reference systems. See the method for details\n- * on usage.\n- *\n- * Additional transforms may be added by using the \n- * library. If the proj4js library is included, the method \n- * will work between any two coordinate reference systems with proj4js \n- * definitions.\n- *\n- * If the proj4js library is not included, or if you wish to allow transforms\n- * between arbitrary coordinate reference systems, use the \n- * method to register a custom transform method.\n+ * Class: OpenLayers.StyleMap\n */\n-OpenLayers.Projection = OpenLayers.Class({\n-\n- /**\n- * Property: proj\n- * {Object} Proj4js.Proj instance.\n- */\n- proj: null,\n+OpenLayers.StyleMap = OpenLayers.Class({\n \n /**\n- * Property: projCode\n- * {String}\n+ * Property: styles\n+ * {Object} Hash of {}, keyed by names of well known\n+ * rendering intents (e.g. \"default\", \"temporary\", \"select\", \"delete\").\n */\n- projCode: null,\n+ styles: null,\n \n /**\n- * Property: titleRegEx\n- * {RegExp} regular expression to strip the title from a proj4js definition\n+ * Property: extendDefault\n+ * {Boolean} if true, every render intent will extend the symbolizers\n+ * specified for the \"default\" intent at rendering time. Otherwise, every\n+ * rendering intent will be treated as a completely independent style.\n */\n- titleRegEx: /\\+title=[^\\+]*/,\n+ extendDefault: true,\n \n /**\n- * Constructor: OpenLayers.Projection\n- * This class offers several methods for interacting with a wrapped \n- * pro4js projection object. \n- *\n+ * Constructor: OpenLayers.StyleMap\n+ * \n * Parameters:\n- * projCode - {String} A string identifying the Well Known Identifier for\n- * the projection.\n- * options - {Object} An optional object to set additional properties\n- * on the projection.\n- *\n- * Returns:\n- * {} A projection object.\n- */\n- initialize: function(projCode, options) {\n- OpenLayers.Util.extend(this, options);\n- this.projCode = projCode;\n- if (typeof Proj4js == \"object\") {\n- this.proj = new Proj4js.Proj(projCode);\n- }\n- },\n-\n- /**\n- * APIMethod: getCode\n- * Get the string SRS code.\n- *\n- * Returns:\n- * {String} The SRS code.\n+ * style - {Object} Optional. Either a style hash, or a style object, or\n+ * a hash of style objects (style hashes) keyed by rendering\n+ * intent. If just one style hash or style object is passed,\n+ * this will be used for all known render intents (default,\n+ * select, temporary)\n+ * options - {Object} optional hash of additional options for this\n+ * instance\n */\n- getCode: function() {\n- return this.proj ? this.proj.srsCode : this.projCode;\n- },\n+ initialize: function(style, options) {\n+ this.styles = {\n+ \"default\": new OpenLayers.Style(\n+ OpenLayers.Feature.Vector.style[\"default\"]),\n+ \"select\": new OpenLayers.Style(\n+ OpenLayers.Feature.Vector.style[\"select\"]),\n+ \"temporary\": new OpenLayers.Style(\n+ OpenLayers.Feature.Vector.style[\"temporary\"]),\n+ \"delete\": new OpenLayers.Style(\n+ OpenLayers.Feature.Vector.style[\"delete\"])\n+ };\n \n- /**\n- * APIMethod: getUnits\n- * Get the units string for the projection -- returns null if \n- * proj4js is not available.\n- *\n- * Returns:\n- * {String} The units abbreviation.\n- */\n- getUnits: function() {\n- return this.proj ? this.proj.units : null;\n+ // take whatever the user passed as style parameter and convert it\n+ // into parts of stylemap.\n+ if (style instanceof OpenLayers.Style) {\n+ // user passed a style object\n+ this.styles[\"default\"] = style;\n+ this.styles[\"select\"] = style;\n+ this.styles[\"temporary\"] = style;\n+ this.styles[\"delete\"] = style;\n+ } else if (typeof style == \"object\") {\n+ for (var key in style) {\n+ if (style[key] instanceof OpenLayers.Style) {\n+ // user passed a hash of style objects\n+ this.styles[key] = style[key];\n+ } else if (typeof style[key] == \"object\") {\n+ // user passsed a hash of style hashes\n+ this.styles[key] = new OpenLayers.Style(style[key]);\n+ } else {\n+ // user passed a style hash (i.e. symbolizer)\n+ this.styles[\"default\"] = new OpenLayers.Style(style);\n+ this.styles[\"select\"] = new OpenLayers.Style(style);\n+ this.styles[\"temporary\"] = new OpenLayers.Style(style);\n+ this.styles[\"delete\"] = new OpenLayers.Style(style);\n+ break;\n+ }\n+ }\n+ }\n+ OpenLayers.Util.extend(this, options);\n },\n \n /**\n- * Method: toString\n- * Convert projection to string (getCode wrapper).\n- *\n- * Returns:\n- * {String} The projection code.\n+ * Method: destroy\n */\n- toString: function() {\n- return this.getCode();\n+ destroy: function() {\n+ for (var key in this.styles) {\n+ this.styles[key].destroy();\n+ }\n+ this.styles = null;\n },\n \n /**\n- * Method: equals\n- * Test equality of two projection instances. Determines equality based\n- * soley on the projection code.\n- *\n+ * Method: createSymbolizer\n+ * Creates the symbolizer for a feature for a render intent.\n+ * \n+ * Parameters:\n+ * feature - {} The feature to evaluate the rules\n+ * of the intended style against.\n+ * intent - {String} The intent determines the symbolizer that will be\n+ * used to draw the feature. Well known intents are \"default\"\n+ * (for just drawing the features), \"select\" (for selected\n+ * features) and \"temporary\" (for drawing features).\n+ * \n * Returns:\n- * {Boolean} The two projections are equivalent.\n- */\n- equals: function(projection) {\n- var p = projection,\n- equals = false;\n- if (p) {\n- if (!(p instanceof OpenLayers.Projection)) {\n- p = new OpenLayers.Projection(p);\n- }\n- if ((typeof Proj4js == \"object\") && this.proj.defData && p.proj.defData) {\n- equals = this.proj.defData.replace(this.titleRegEx, \"\") ==\n- p.proj.defData.replace(this.titleRegEx, \"\");\n- } else if (p.getCode) {\n- var source = this.getCode(),\n- target = p.getCode();\n- equals = source == target ||\n- !!OpenLayers.Projection.transforms[source] &&\n- OpenLayers.Projection.transforms[source][target] ===\n- OpenLayers.Projection.nullTransform;\n- }\n- }\n- return equals;\n- },\n-\n- /* Method: destroy\n- * Destroy projection object.\n+ * {Object} symbolizer hash\n */\n- destroy: function() {\n- delete this.proj;\n- delete this.projCode;\n- },\n-\n- CLASS_NAME: \"OpenLayers.Projection\"\n-});\n-\n-/**\n- * Property: transforms\n- * {Object} Transforms is an object, with from properties, each of which may\n- * have a to property. This allows you to define projections without \n- * requiring support for proj4js to be included.\n- *\n- * This object has keys which correspond to a 'source' projection object. The\n- * keys should be strings, corresponding to the projection.getCode() value.\n- * Each source projection object should have a set of destination projection\n- * keys included in the object. \n- * \n- * Each value in the destination object should be a transformation function,\n- * where the function is expected to be passed an object with a .x and a .y\n- * property. The function should return the object, with the .x and .y\n- * transformed according to the transformation function.\n- *\n- * Note - Properties on this object should not be set directly. To add a\n- * transform method to this object, use the method. For an\n- * example of usage, see the OpenLayers.Layer.SphericalMercator file.\n- */\n-OpenLayers.Projection.transforms = {};\n-\n-/**\n- * APIProperty: defaults\n- * {Object} Defaults for the SRS codes known to OpenLayers (currently\n- * EPSG:4326, CRS:84, urn:ogc:def:crs:EPSG:6.6:4326, EPSG:900913, EPSG:3857,\n- * EPSG:102113 and EPSG:102100). Keys are the SRS code, values are units,\n- * maxExtent (the validity extent for the SRS) and yx (true if this SRS is\n- * known to have a reverse axis order).\n- */\n-OpenLayers.Projection.defaults = {\n- \"EPSG:4326\": {\n- units: \"degrees\",\n- maxExtent: [-180, -90, 180, 90],\n- yx: true\n- },\n- \"CRS:84\": {\n- units: \"degrees\",\n- maxExtent: [-180, -90, 180, 90]\n- },\n- \"EPSG:900913\": {\n- units: \"m\",\n- maxExtent: [-20037508.34, -20037508.34, 20037508.34, 20037508.34]\n- }\n-};\n-\n-/**\n- * APIMethod: addTransform\n- * Set a custom transform method between two projections. Use this method in\n- * cases where the proj4js lib is not available or where custom projections\n- * need to be handled.\n- *\n- * Parameters:\n- * from - {String} The code for the source projection\n- * to - {String} the code for the destination projection\n- * method - {Function} A function that takes a point as an argument and\n- * transforms that point from the source to the destination projection\n- * in place. The original point should be modified.\n- */\n-OpenLayers.Projection.addTransform = function(from, to, method) {\n- if (method === OpenLayers.Projection.nullTransform) {\n- var defaults = OpenLayers.Projection.defaults[from];\n- if (defaults && !OpenLayers.Projection.defaults[to]) {\n- OpenLayers.Projection.defaults[to] = defaults;\n- }\n- }\n- if (!OpenLayers.Projection.transforms[from]) {\n- OpenLayers.Projection.transforms[from] = {};\n- }\n- OpenLayers.Projection.transforms[from][to] = method;\n-};\n-\n-/**\n- * APIMethod: transform\n- * Transform a point coordinate from one projection to another. Note that\n- * the input point is transformed in place.\n- * \n- * Parameters:\n- * point - { | Object} An object with x and y\n- * properties representing coordinates in those dimensions.\n- * source - {OpenLayers.Projection} Source map coordinate system\n- * dest - {OpenLayers.Projection} Destination map coordinate system\n- *\n- * Returns:\n- * point - {object} A transformed coordinate. The original point is modified.\n- */\n-OpenLayers.Projection.transform = function(point, source, dest) {\n- if (source && dest) {\n- if (!(source instanceof OpenLayers.Projection)) {\n- source = new OpenLayers.Projection(source);\n- }\n- if (!(dest instanceof OpenLayers.Projection)) {\n- dest = new OpenLayers.Projection(dest);\n- }\n- if (source.proj && dest.proj) {\n- point = Proj4js.transform(source.proj, dest.proj, point);\n- } else {\n- var sourceCode = source.getCode();\n- var destCode = dest.getCode();\n- var transforms = OpenLayers.Projection.transforms;\n- if (transforms[sourceCode] && transforms[sourceCode][destCode]) {\n- transforms[sourceCode][destCode](point);\n- }\n+ createSymbolizer: function(feature, intent) {\n+ if (!feature) {\n+ feature = new OpenLayers.Feature.Vector();\n }\n- }\n- return point;\n-};\n-\n-/**\n- * APIFunction: nullTransform\n- * A null transformation - useful for defining projection aliases when\n- * proj4js is not available:\n- *\n- * (code)\n- * OpenLayers.Projection.addTransform(\"EPSG:3857\", \"EPSG:900913\",\n- * OpenLayers.Projection.nullTransform);\n- * OpenLayers.Projection.addTransform(\"EPSG:900913\", \"EPSG:3857\",\n- * OpenLayers.Projection.nullTransform);\n- * (end)\n- */\n-OpenLayers.Projection.nullTransform = function(point) {\n- return point;\n-};\n-\n-/**\n- * Note: Transforms for web mercator <-> geographic\n- * OpenLayers recognizes EPSG:3857, EPSG:900913, EPSG:102113 and EPSG:102100.\n- * OpenLayers originally started referring to EPSG:900913 as web mercator.\n- * The EPSG has declared EPSG:3857 to be web mercator.\n- * ArcGIS 10 recognizes the EPSG:3857, EPSG:102113, and EPSG:102100 as\n- * equivalent. See http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/11/20/ArcGIS-Online-moving-to-Google-_2F00_-Bing-tiling-scheme_3A00_-What-does-this-mean-for-you_3F00_.aspx#12084.\n- * For geographic, OpenLayers recognizes EPSG:4326, CRS:84 and\n- * urn:ogc:def:crs:EPSG:6.6:4326. OpenLayers also knows about the reverse axis\n- * order for EPSG:4326. \n- */\n-(function() {\n-\n- var pole = 20037508.34;\n-\n- function inverseMercator(xy) {\n- xy.x = 180 * xy.x / pole;\n- xy.y = 180 / Math.PI * (2 * Math.atan(Math.exp((xy.y / pole) * Math.PI)) - Math.PI / 2);\n- return xy;\n- }\n-\n- function forwardMercator(xy) {\n- xy.x = xy.x * pole / 180;\n- var y = Math.log(Math.tan((90 + xy.y) * Math.PI / 360)) / Math.PI * pole;\n- xy.y = Math.max(-20037508.34, Math.min(y, 20037508.34));\n- return xy;\n- }\n-\n- function map(base, codes) {\n- var add = OpenLayers.Projection.addTransform;\n- var same = OpenLayers.Projection.nullTransform;\n- var i, len, code, other, j;\n- for (i = 0, len = codes.length; i < len; ++i) {\n- code = codes[i];\n- add(base, code, forwardMercator);\n- add(code, base, inverseMercator);\n- for (j = i + 1; j < len; ++j) {\n- other = codes[j];\n- add(code, other, same);\n- add(other, code, same);\n- }\n+ if (!this.styles[intent]) {\n+ intent = \"default\";\n }\n- }\n+ feature.renderIntent = intent;\n+ var defaultSymbolizer = {};\n+ if (this.extendDefault && intent != \"default\") {\n+ defaultSymbolizer = this.styles[\"default\"].createSymbolizer(feature);\n+ }\n+ return OpenLayers.Util.extend(defaultSymbolizer,\n+ this.styles[intent].createSymbolizer(feature));\n+ },\n \n- // list of equivalent codes for web mercator\n- var mercator = [\"EPSG:900913\", \"EPSG:3857\", \"EPSG:102113\", \"EPSG:102100\"],\n- geographic = [\"CRS:84\", \"urn:ogc:def:crs:EPSG:6.6:4326\", \"EPSG:4326\"],\n- i;\n- for (i = mercator.length - 1; i >= 0; --i) {\n- map(mercator[i], geographic);\n- }\n- for (i = geographic.length - 1; i >= 0; --i) {\n- map(geographic[i], mercator);\n- }\n+ /**\n+ * Method: addUniqueValueRules\n+ * Convenience method to create comparison rules for unique values of a\n+ * property. The rules will be added to the style object for a specified\n+ * rendering intent. This method is a shortcut for creating something like\n+ * the \"unique value legends\" familiar from well known desktop GIS systems\n+ * \n+ * Parameters:\n+ * renderIntent - {String} rendering intent to add the rules to\n+ * property - {String} values of feature attributes to create the\n+ * rules for\n+ * symbolizers - {Object} Hash of symbolizers, keyed by the desired\n+ * property values \n+ * context - {Object} An optional object with properties that\n+ * symbolizers' property values should be evaluated\n+ * against. If no context is specified, feature.attributes\n+ * will be used\n+ */\n+ addUniqueValueRules: function(renderIntent, property, symbolizers, context) {\n+ var rules = [];\n+ for (var value in symbolizers) {\n+ rules.push(new OpenLayers.Rule({\n+ symbolizer: symbolizers[value],\n+ context: context,\n+ filter: new OpenLayers.Filter.Comparison({\n+ type: OpenLayers.Filter.Comparison.EQUAL_TO,\n+ property: property,\n+ value: value\n+ })\n+ }));\n+ }\n+ this.styles[renderIntent].addRules(rules);\n+ },\n \n-})();\n+ CLASS_NAME: \"OpenLayers.StyleMap\"\n+});\n /* ======================================================================\n OpenLayers/Util/vendorPrefix.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n * See license.txt in the OpenLayers distribution or repository for the\n@@ -21289,14 +21596,202 @@\n requestFrame: requestFrame,\n start: start,\n stop: stop\n };\n \n })(window);\n /* ======================================================================\n+ OpenLayers/Kinetic.js\n+ ====================================================================== */\n+\n+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n+ * full list of contributors). Published under the 2-clause BSD license.\n+ * See license.txt in the OpenLayers distribution or repository for the\n+ * full text of the license. */\n+\n+/**\n+ * @requires OpenLayers/BaseTypes/Class.js\n+ * @requires OpenLayers/Animation.js\n+ */\n+\n+OpenLayers.Kinetic = OpenLayers.Class({\n+\n+ /**\n+ * Property: threshold\n+ * In most cases changing the threshold isn't needed.\n+ * In px/ms, default to 0.\n+ */\n+ threshold: 0,\n+\n+ /**\n+ * Property: deceleration\n+ * {Float} the deseleration in px/ms\u00b2, default to 0.0035.\n+ */\n+ deceleration: 0.0035,\n+\n+ /**\n+ * Property: nbPoints\n+ * {Integer} the number of points we use to calculate the kinetic\n+ * initial values.\n+ */\n+ nbPoints: 100,\n+\n+ /**\n+ * Property: delay\n+ * {Float} time to consider to calculate the kinetic initial values.\n+ * In ms, default to 200.\n+ */\n+ delay: 200,\n+\n+ /**\n+ * Property: points\n+ * List of points use to calculate the kinetic initial values.\n+ */\n+ points: undefined,\n+\n+ /**\n+ * Property: timerId\n+ * ID of the timer.\n+ */\n+ timerId: undefined,\n+\n+ /**\n+ * Constructor: OpenLayers.Kinetic\n+ *\n+ * Parameters:\n+ * options - {Object}\n+ */\n+ initialize: function(options) {\n+ OpenLayers.Util.extend(this, options);\n+ },\n+\n+ /**\n+ * Method: begin\n+ * Begins the dragging.\n+ */\n+ begin: function() {\n+ OpenLayers.Animation.stop(this.timerId);\n+ this.timerId = undefined;\n+ this.points = [];\n+ },\n+\n+ /**\n+ * Method: update\n+ * Updates during the dragging.\n+ *\n+ * Parameters:\n+ * xy - {} The new position.\n+ */\n+ update: function(xy) {\n+ this.points.unshift({\n+ xy: xy,\n+ tick: new Date().getTime()\n+ });\n+ if (this.points.length > this.nbPoints) {\n+ this.points.pop();\n+ }\n+ },\n+\n+ /**\n+ * Method: end\n+ * Ends the dragging, start the kinetic.\n+ *\n+ * Parameters:\n+ * xy - {} The last position.\n+ *\n+ * Returns:\n+ * {Object} An object with two properties: \"speed\", and \"theta\". The\n+ * \"speed\" and \"theta\" values are to be passed to the move \n+ * function when starting the animation.\n+ */\n+ end: function(xy) {\n+ var last, now = new Date().getTime();\n+ for (var i = 0, l = this.points.length, point; i < l; i++) {\n+ point = this.points[i];\n+ if (now - point.tick > this.delay) {\n+ break;\n+ }\n+ last = point;\n+ }\n+ if (!last) {\n+ return;\n+ }\n+ var time = new Date().getTime() - last.tick;\n+ var dist = Math.sqrt(Math.pow(xy.x - last.xy.x, 2) +\n+ Math.pow(xy.y - last.xy.y, 2));\n+ var speed = dist / time;\n+ if (speed == 0 || speed < this.threshold) {\n+ return;\n+ }\n+ var theta = Math.asin((xy.y - last.xy.y) / dist);\n+ if (last.xy.x <= xy.x) {\n+ theta = Math.PI - theta;\n+ }\n+ return {\n+ speed: speed,\n+ theta: theta\n+ };\n+ },\n+\n+ /**\n+ * Method: move\n+ * Launch the kinetic move pan.\n+ *\n+ * Parameters:\n+ * info - {Object} An object with two properties, \"speed\", and \"theta\".\n+ * These values are those returned from the \"end\" call.\n+ * callback - {Function} Function called on every step of the animation,\n+ * receives x, y (values to pan), end (is the last point).\n+ */\n+ move: function(info, callback) {\n+ var v0 = info.speed;\n+ var fx = Math.cos(info.theta);\n+ var fy = -Math.sin(info.theta);\n+\n+ var initialTime = new Date().getTime();\n+\n+ var lastX = 0;\n+ var lastY = 0;\n+\n+ var timerCallback = function() {\n+ if (this.timerId == null) {\n+ return;\n+ }\n+\n+ var t = new Date().getTime() - initialTime;\n+\n+ var p = (-this.deceleration * Math.pow(t, 2)) / 2.0 + v0 * t;\n+ var x = p * fx;\n+ var y = p * fy;\n+\n+ var args = {};\n+ args.end = false;\n+ var v = -this.deceleration * t + v0;\n+\n+ if (v <= 0) {\n+ OpenLayers.Animation.stop(this.timerId);\n+ this.timerId = null;\n+ args.end = true;\n+ }\n+\n+ args.x = x - lastX;\n+ args.y = y - lastY;\n+ lastX = x;\n+ lastY = y;\n+ callback(args.x, args.y, args.end);\n+ };\n+\n+ this.timerId = OpenLayers.Animation.start(\n+ OpenLayers.Function.bind(timerCallback, this)\n+ );\n+ },\n+\n+ CLASS_NAME: \"OpenLayers.Kinetic\"\n+});\n+/* ======================================================================\n OpenLayers/Tween.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n * See license.txt in the OpenLayers distribution or repository for the\n * full text of the license. */\n@@ -25952,1260 +26447,1421 @@\n }\n return bounds;\n },\n \n CLASS_NAME: \"OpenLayers.Layer\"\n });\n /* ======================================================================\n- OpenLayers/Icon.js\n+ OpenLayers/Protocol.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n * See license.txt in the OpenLayers distribution or repository for the\n * full text of the license. */\n \n /**\n * @requires OpenLayers/BaseTypes/Class.js\n */\n \n /**\n- * Class: OpenLayers.Icon\n- * \n- * The icon represents a graphical icon on the screen. Typically used in\n- * conjunction with a to represent markers on a screen.\n- *\n- * An icon has a url, size and position. It also contains an offset which \n- * allows the center point to be represented correctly. This can be\n- * provided either as a fixed offset or a function provided to calculate\n- * the desired offset. \n- * \n+ * Class: OpenLayers.Protocol\n+ * Abstract vector layer protocol class. Not to be instantiated directly. Use\n+ * one of the protocol subclasses instead.\n */\n-OpenLayers.Icon = OpenLayers.Class({\n-\n- /** \n- * Property: url \n- * {String} image url\n- */\n- url: null,\n+OpenLayers.Protocol = OpenLayers.Class({\n \n- /** \n- * Property: size \n- * {|Object} An OpenLayers.Size or\n- * an object with a 'w' and 'h' properties.\n+ /**\n+ * Property: format\n+ * {} The format used by this protocol.\n */\n- size: null,\n+ format: null,\n \n- /** \n- * Property: offset \n- * {|Object} distance in pixels to offset the\n- * image when being rendered. An OpenLayers.Pixel or an object\n- * with a 'x' and 'y' properties.\n+ /**\n+ * Property: options\n+ * {Object} Any options sent to the constructor.\n */\n- offset: null,\n+ options: null,\n \n- /** \n- * Property: calculateOffset \n- * {Function} Function to calculate the offset (based on the size)\n+ /**\n+ * Property: autoDestroy\n+ * {Boolean} The creator of the protocol can set autoDestroy to false\n+ * to fully control when the protocol is destroyed. Defaults to\n+ * true.\n */\n- calculateOffset: null,\n+ autoDestroy: true,\n \n- /** \n- * Property: imageDiv \n- * {DOMElement} \n+ /**\n+ * Property: defaultFilter\n+ * {} Optional default filter to read requests\n */\n- imageDiv: null,\n+ defaultFilter: null,\n \n- /** \n- * Property: px \n- * {|Object} An OpenLayers.Pixel or an object\n- * with a 'x' and 'y' properties.\n+ /**\n+ * Constructor: OpenLayers.Protocol\n+ * Abstract class for vector protocols. Create instances of a subclass.\n+ *\n+ * Parameters:\n+ * options - {Object} Optional object whose properties will be set on the\n+ * instance.\n */\n- px: null,\n+ initialize: function(options) {\n+ options = options || {};\n+ OpenLayers.Util.extend(this, options);\n+ this.options = options;\n+ },\n \n- /** \n- * Constructor: OpenLayers.Icon\n- * Creates an icon, which is an image tag in a div. \n+ /**\n+ * Method: mergeWithDefaultFilter\n+ * Merge filter passed to the read method with the default one\n *\n- * url - {String} \n- * size - {|Object} An OpenLayers.Size or an\n- * object with a 'w' and 'h'\n- * properties.\n- * offset - {|Object} An OpenLayers.Pixel or an\n- * object with a 'x' and 'y'\n- * properties.\n- * calculateOffset - {Function} \n+ * Parameters:\n+ * filter - {}\n */\n- initialize: function(url, size, offset, calculateOffset) {\n- this.url = url;\n- this.size = size || {\n- w: 20,\n- h: 20\n- };\n- this.offset = offset || {\n- x: -(this.size.w / 2),\n- y: -(this.size.h / 2)\n- };\n- this.calculateOffset = calculateOffset;\n-\n- var id = OpenLayers.Util.createUniqueID(\"OL_Icon_\");\n- this.imageDiv = OpenLayers.Util.createAlphaImageDiv(id);\n+ mergeWithDefaultFilter: function(filter) {\n+ var merged;\n+ if (filter && this.defaultFilter) {\n+ merged = new OpenLayers.Filter.Logical({\n+ type: OpenLayers.Filter.Logical.AND,\n+ filters: [this.defaultFilter, filter]\n+ });\n+ } else {\n+ merged = filter || this.defaultFilter || undefined;\n+ }\n+ return merged;\n },\n \n- /** \n- * Method: destroy\n- * Nullify references and remove event listeners to prevent circular \n- * references and memory leaks\n+ /**\n+ * APIMethod: destroy\n+ * Clean up the protocol.\n */\n destroy: function() {\n- // erase any drawn elements\n- this.erase();\n-\n- OpenLayers.Event.stopObservingElement(this.imageDiv.firstChild);\n- this.imageDiv.innerHTML = \"\";\n- this.imageDiv = null;\n+ this.options = null;\n+ this.format = null;\n },\n \n- /** \n- * Method: clone\n- * \n+ /**\n+ * APIMethod: read\n+ * Construct a request for reading new features.\n+ *\n+ * Parameters:\n+ * options - {Object} Optional object for configuring the request.\n+ *\n * Returns:\n- * {} A fresh copy of the icon.\n+ * {} An \n+ * object, the same object will be passed to the callback function passed\n+ * if one exists in the options object.\n */\n- clone: function() {\n- return new OpenLayers.Icon(this.url,\n- this.size,\n- this.offset,\n- this.calculateOffset);\n+ read: function(options) {\n+ options = options || {};\n+ options.filter = this.mergeWithDefaultFilter(options.filter);\n },\n \n+\n /**\n- * Method: setSize\n- * \n+ * APIMethod: create\n+ * Construct a request for writing newly created features.\n+ *\n * Parameters:\n- * size - {|Object} An OpenLayers.Size or\n- * an object with a 'w' and 'h' properties.\n+ * features - {Array({})} or\n+ * {}\n+ * options - {Object} Optional object for configuring the request.\n+ *\n+ * Returns:\n+ * {} An \n+ * object, the same object will be passed to the callback function passed\n+ * if one exists in the options object.\n */\n- setSize: function(size) {\n- if (size != null) {\n- this.size = size;\n- }\n- this.draw();\n- },\n+ create: function() {},\n \n /**\n- * Method: setUrl\n- * \n+ * APIMethod: update\n+ * Construct a request updating modified features.\n+ *\n * Parameters:\n- * url - {String} \n+ * features - {Array({})} or\n+ * {}\n+ * options - {Object} Optional object for configuring the request.\n+ *\n+ * Returns:\n+ * {} An \n+ * object, the same object will be passed to the callback function passed\n+ * if one exists in the options object.\n */\n- setUrl: function(url) {\n- if (url != null) {\n- this.url = url;\n- }\n- this.draw();\n- },\n+ update: function() {},\n \n- /** \n- * Method: draw\n- * Move the div to the given pixel.\n- * \n+ /**\n+ * APIMethod: delete\n+ * Construct a request deleting a removed feature.\n+ *\n * Parameters:\n- * px - {|Object} An OpenLayers.Pixel or an\n- * object with a 'x' and 'y' properties.\n- * \n+ * feature - {}\n+ * options - {Object} Optional object for configuring the request.\n+ *\n * Returns:\n- * {DOMElement} A new DOM Image of this icon set at the location passed-in\n+ * {} An \n+ * object, the same object will be passed to the callback function passed\n+ * if one exists in the options object.\n */\n- draw: function(px) {\n- OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,\n- null,\n- null,\n- this.size,\n- this.url,\n- \"absolute\");\n- this.moveTo(px);\n- return this.imageDiv;\n- },\n+ \"delete\": function() {},\n \n- /** \n- * Method: erase\n- * Erase the underlying image element.\n+ /**\n+ * APIMethod: commit\n+ * Go over the features and for each take action\n+ * based on the feature state. Possible actions are create,\n+ * update and delete.\n+ *\n+ * Parameters:\n+ * features - {Array({})}\n+ * options - {Object} Object whose possible keys are \"create\", \"update\",\n+ * \"delete\", \"callback\" and \"scope\", the values referenced by the\n+ * first three are objects as passed to the \"create\", \"update\", and\n+ * \"delete\" methods, the value referenced by the \"callback\" key is\n+ * a function which is called when the commit operation is complete\n+ * using the scope referenced by the \"scope\" key.\n+ *\n+ * Returns:\n+ * {Array({})} An array of\n+ * objects.\n */\n- erase: function() {\n- if (this.imageDiv != null && this.imageDiv.parentNode != null) {\n- OpenLayers.Element.remove(this.imageDiv);\n- }\n- },\n+ commit: function() {},\n \n- /** \n- * Method: setOpacity\n- * Change the icon's opacity\n+ /**\n+ * Method: abort\n+ * Abort an ongoing request.\n *\n * Parameters:\n- * opacity - {float} \n+ * response - {}\n */\n- setOpacity: function(opacity) {\n- OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv, null, null, null,\n- null, null, null, null, opacity);\n-\n- },\n+ abort: function(response) {},\n \n /**\n- * Method: moveTo\n- * move icon to passed in px.\n+ * Method: createCallback\n+ * Returns a function that applies the given public method with resp and\n+ * options arguments.\n *\n * Parameters:\n- * px - {|Object} the pixel position to move to.\n- * An OpenLayers.Pixel or an object with a 'x' and 'y' properties.\n+ * method - {Function} The method to be applied by the callback.\n+ * response - {} The protocol response object.\n+ * options - {Object} Options sent to the protocol method\n */\n- moveTo: function(px) {\n- //if no px passed in, use stored location\n- if (px != null) {\n- this.px = px;\n- }\n-\n- if (this.imageDiv != null) {\n- if (this.px == null) {\n- this.display(false);\n- } else {\n- if (this.calculateOffset) {\n- this.offset = this.calculateOffset(this.size);\n- }\n- OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv, null, {\n- x: this.px.x + this.offset.x,\n- y: this.px.y + this.offset.y\n- });\n- }\n- }\n+ createCallback: function(method, response, options) {\n+ return OpenLayers.Function.bind(function() {\n+ method.apply(this, [response, options]);\n+ }, this);\n },\n \n- /** \n- * Method: display\n- * Hide or show the icon\n+ CLASS_NAME: \"OpenLayers.Protocol\"\n+});\n+\n+/**\n+ * Class: OpenLayers.Protocol.Response\n+ * Protocols return Response objects to their users.\n+ */\n+OpenLayers.Protocol.Response = OpenLayers.Class({\n+ /**\n+ * Property: code\n+ * {Number} - OpenLayers.Protocol.Response.SUCCESS or\n+ * OpenLayers.Protocol.Response.FAILURE\n+ */\n+ code: null,\n+\n+ /**\n+ * Property: requestType\n+ * {String} The type of request this response corresponds to. Either\n+ * \"create\", \"read\", \"update\" or \"delete\".\n+ */\n+ requestType: null,\n+\n+ /**\n+ * Property: last\n+ * {Boolean} - true if this is the last response expected in a commit,\n+ * false otherwise, defaults to true.\n+ */\n+ last: true,\n+\n+ /**\n+ * Property: features\n+ * {Array({})} or {}\n+ * The features returned in the response by the server. Depending on the \n+ * protocol's read payload, either features or data will be populated.\n+ */\n+ features: null,\n+\n+ /**\n+ * Property: data\n+ * {Object}\n+ * The data returned in the response by the server. Depending on the \n+ * protocol's read payload, either features or data will be populated.\n+ */\n+ data: null,\n+\n+ /**\n+ * Property: reqFeatures\n+ * {Array({})} or {}\n+ * The features provided by the user and placed in the request by the\n+ * protocol.\n+ */\n+ reqFeatures: null,\n+\n+ /**\n+ * Property: priv\n+ */\n+ priv: null,\n+\n+ /**\n+ * Property: error\n+ * {Object} The error object in case a service exception was encountered.\n+ */\n+ error: null,\n+\n+ /**\n+ * Constructor: OpenLayers.Protocol.Response\n *\n * Parameters:\n- * display - {Boolean} \n+ * options - {Object} Optional object whose properties will be set on the\n+ * instance.\n */\n- display: function(display) {\n- this.imageDiv.style.display = (display) ? \"\" : \"none\";\n+ initialize: function(options) {\n+ OpenLayers.Util.extend(this, options);\n },\n \n-\n /**\n- * APIMethod: isDrawn\n- * \n+ * Method: success\n+ *\n * Returns:\n- * {Boolean} Whether or not the icon is drawn.\n+ * {Boolean} - true on success, false otherwise\n */\n- isDrawn: function() {\n- // nodeType 11 for ie, whose nodes *always* have a parentNode\n- // (of type document fragment)\n- var isDrawn = (this.imageDiv && this.imageDiv.parentNode &&\n- (this.imageDiv.parentNode.nodeType != 11));\n-\n- return isDrawn;\n+ success: function() {\n+ return this.code > 0;\n },\n \n- CLASS_NAME: \"OpenLayers.Icon\"\n+ CLASS_NAME: \"OpenLayers.Protocol.Response\"\n });\n+\n+OpenLayers.Protocol.Response.SUCCESS = 1;\n+OpenLayers.Protocol.Response.FAILURE = 0;\n /* ======================================================================\n- OpenLayers/Marker.js\n+ OpenLayers/Renderer.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n * See license.txt in the OpenLayers distribution or repository for the\n * full text of the license. */\n \n-\n /**\n * @requires OpenLayers/BaseTypes/Class.js\n- * @requires OpenLayers/Events.js\n- * @requires OpenLayers/Icon.js\n */\n \n /**\n- * Class: OpenLayers.Marker\n- * Instances of OpenLayers.Marker are a combination of a \n- * and an . \n- *\n- * Markers are generally added to a special layer called\n- * .\n- *\n- * Example:\n- * (code)\n- * var markers = new OpenLayers.Layer.Markers( \"Markers\" );\n- * map.addLayer(markers);\n- *\n- * var size = new OpenLayers.Size(21,25);\n- * var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);\n- * var icon = new OpenLayers.Icon('http://www.openlayers.org/dev/img/marker.png', size, offset);\n- * markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,0),icon));\n- * markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,0),icon.clone()));\n+ * Class: OpenLayers.Renderer \n+ * This is the base class for all renderers.\n *\n- * (end)\n+ * This is based on a merger code written by Paul Spencer and Bertil Chapuis.\n+ * It is largely composed of virtual functions that are to be implemented\n+ * in technology-specific subclasses, but there is some generic code too.\n+ * \n+ * The functions that *are* implemented here merely deal with the maintenance\n+ * of the size and extent variables, as well as the cached 'resolution' \n+ * value. \n+ * \n+ * A note to the user that all subclasses should use getResolution() instead\n+ * of directly accessing this.resolution in order to correctly use the \n+ * cacheing system.\n *\n- * Note that if you pass an icon into the Marker constructor, it will take\n- * that icon and use it. This means that you should not share icons between\n- * markers -- you use them once, but you should clone() for any additional\n- * markers using that same icon.\n */\n-OpenLayers.Marker = OpenLayers.Class({\n+OpenLayers.Renderer = OpenLayers.Class({\n \n /** \n- * Property: icon \n- * {} The icon used by this marker.\n+ * Property: container\n+ * {DOMElement} \n */\n- icon: null,\n+ container: null,\n \n- /** \n- * Property: lonlat \n- * {} location of object\n+ /**\n+ * Property: root\n+ * {DOMElement}\n */\n- lonlat: null,\n+ root: null,\n \n /** \n- * Property: events \n- * {} the event handler.\n+ * Property: extent\n+ * {}\n */\n- events: null,\n+ extent: null,\n+\n+ /**\n+ * Property: locked\n+ * {Boolean} If the renderer is currently in a state where many things\n+ * are changing, the 'locked' property is set to true. This means \n+ * that renderers can expect at least one more drawFeature event to be\n+ * called with the 'locked' property set to 'true': In some renderers,\n+ * this might make sense to use as a 'only update local information'\n+ * flag. \n+ */\n+ locked: false,\n \n /** \n- * Property: map \n- * {} the map this marker is attached to\n+ * Property: size\n+ * {} \n+ */\n+ size: null,\n+\n+ /**\n+ * Property: resolution\n+ * {Float} cache of current map resolution\n+ */\n+ resolution: null,\n+\n+ /**\n+ * Property: map \n+ * {} Reference to the map -- this is set in Vector's setMap()\n */\n map: null,\n \n- /** \n- * Constructor: OpenLayers.Marker\n+ /**\n+ * Property: featureDx\n+ * {Number} Feature offset in x direction. Will be calculated for and\n+ * applied to the current feature while rendering (see\n+ * ).\n+ */\n+ featureDx: 0,\n+\n+ /**\n+ * Constructor: OpenLayers.Renderer \n *\n * Parameters:\n- * lonlat - {} the position of this marker\n- * icon - {} the icon for this marker\n+ * containerID - {} \n+ * options - {Object} options for this renderer. See sublcasses for\n+ * supported options.\n */\n- initialize: function(lonlat, icon) {\n- this.lonlat = lonlat;\n-\n- var newIcon = (icon) ? icon : OpenLayers.Marker.defaultIcon();\n- if (this.icon == null) {\n- this.icon = newIcon;\n- } else {\n- this.icon.url = newIcon.url;\n- this.icon.size = newIcon.size;\n- this.icon.offset = newIcon.offset;\n- this.icon.calculateOffset = newIcon.calculateOffset;\n- }\n- this.events = new OpenLayers.Events(this, this.icon.imageDiv);\n+ initialize: function(containerID, options) {\n+ this.container = OpenLayers.Util.getElement(containerID);\n+ OpenLayers.Util.extend(this, options);\n },\n \n /**\n * APIMethod: destroy\n- * Destroy the marker. You must first remove the marker from any \n- * layer which it has been added to, or you will get buggy behavior.\n- * (This can not be done within the marker since the marker does not\n- * know which layer it is attached to.)\n */\n destroy: function() {\n- // erase any drawn features\n- this.erase();\n-\n+ this.container = null;\n+ this.extent = null;\n+ this.size = null;\n+ this.resolution = null;\n this.map = null;\n-\n- this.events.destroy();\n- this.events = null;\n-\n- if (this.icon != null) {\n- this.icon.destroy();\n- this.icon = null;\n- }\n },\n \n- /** \n- * Method: draw\n- * Calls draw on the icon, and returns that output.\n- * \n- * Parameters:\n- * px - {}\n+ /**\n+ * APIMethod: supported\n+ * This should be overridden by specific subclasses\n * \n * Returns:\n- * {DOMElement} A new DOM Image with this marker's icon set at the \n- * location passed-in\n+ * {Boolean} Whether or not the browser supports the renderer class\n */\n- draw: function(px) {\n- return this.icon.draw(px);\n+ supported: function() {\n+ return false;\n },\n \n- /** \n- * Method: erase\n- * Erases any drawn elements for this marker.\n+ /**\n+ * Method: setExtent\n+ * Set the visible part of the layer.\n+ *\n+ * Resolution has probably changed, so we nullify the resolution \n+ * cache (this.resolution) -- this way it will be re-computed when \n+ * next it is needed.\n+ * We nullify the resolution cache (this.resolution) if resolutionChanged\n+ * is set to true - this way it will be re-computed on the next\n+ * getResolution() request.\n+ *\n+ * Parameters:\n+ * extent - {}\n+ * resolutionChanged - {Boolean}\n+ *\n+ * Returns:\n+ * {Boolean} true to notify the layer that the new extent does not exceed\n+ * the coordinate range, and the features will not need to be redrawn.\n+ * False otherwise.\n */\n- erase: function() {\n- if (this.icon != null) {\n- this.icon.erase();\n+ setExtent: function(extent, resolutionChanged) {\n+ this.extent = extent.clone();\n+ if (this.map.baseLayer && this.map.baseLayer.wrapDateLine) {\n+ var ratio = extent.getWidth() / this.map.getExtent().getWidth(),\n+ extent = extent.scale(1 / ratio);\n+ this.extent = extent.wrapDateLine(this.map.getMaxExtent()).scale(ratio);\n+ }\n+ if (resolutionChanged) {\n+ this.resolution = null;\n }\n+ return true;\n },\n \n /**\n- * Method: moveTo\n- * Move the marker to the new location.\n+ * Method: setSize\n+ * Sets the size of the drawing surface.\n+ * \n+ * Resolution has probably changed, so we nullify the resolution \n+ * cache (this.resolution) -- this way it will be re-computed when \n+ * next it is needed.\n *\n * Parameters:\n- * px - {|Object} the pixel position to move to.\n- * An OpenLayers.Pixel or an object with a 'x' and 'y' properties.\n+ * size - {} \n */\n- moveTo: function(px) {\n- if ((px != null) && (this.icon != null)) {\n- this.icon.moveTo(px);\n- }\n- this.lonlat = this.map.getLonLatFromLayerPx(px);\n+ setSize: function(size) {\n+ this.size = size.clone();\n+ this.resolution = null;\n },\n \n- /**\n- * APIMethod: isDrawn\n+ /** \n+ * Method: getResolution\n+ * Uses cached copy of resolution if available to minimize computing\n * \n * Returns:\n- * {Boolean} Whether or not the marker is drawn.\n+ * {Float} The current map's resolution\n */\n- isDrawn: function() {\n- var isDrawn = (this.icon && this.icon.isDrawn());\n- return isDrawn;\n+ getResolution: function() {\n+ this.resolution = this.resolution || this.map.getResolution();\n+ return this.resolution;\n },\n \n /**\n- * Method: onScreen\n+ * Method: drawFeature\n+ * Draw the feature. The optional style argument can be used\n+ * to override the feature's own style. This method should only\n+ * be called from layer.drawFeature().\n *\n+ * Parameters:\n+ * feature - {} \n+ * style - {}\n+ * \n * Returns:\n- * {Boolean} Whether or not the marker is currently visible on screen.\n+ * {Boolean} true if the feature has been drawn completely, false if not,\n+ * undefined if the feature had no geometry\n */\n- onScreen: function() {\n+ drawFeature: function(feature, style) {\n+ if (style == null) {\n+ style = feature.style;\n+ }\n+ if (feature.geometry) {\n+ var bounds = feature.geometry.getBounds();\n+ if (bounds) {\n+ var worldBounds;\n+ if (this.map.baseLayer && this.map.baseLayer.wrapDateLine) {\n+ worldBounds = this.map.getMaxExtent();\n+ }\n+ if (!bounds.intersectsBounds(this.extent, {\n+ worldBounds: worldBounds\n+ })) {\n+ style = {\n+ display: \"none\"\n+ };\n+ } else {\n+ this.calculateFeatureDx(bounds, worldBounds);\n+ }\n+ var rendered = this.drawGeometry(feature.geometry, style, feature.id);\n+ if (style.display != \"none\" && style.label && rendered !== false) {\n \n- var onScreen = false;\n- if (this.map) {\n- var screenBounds = this.map.getExtent();\n- onScreen = screenBounds.containsLonLat(this.lonlat);\n+ var location = feature.geometry.getCentroid();\n+ if (style.labelXOffset || style.labelYOffset) {\n+ var xOffset = isNaN(style.labelXOffset) ? 0 : style.labelXOffset;\n+ var yOffset = isNaN(style.labelYOffset) ? 0 : style.labelYOffset;\n+ var res = this.getResolution();\n+ location.move(xOffset * res, yOffset * res);\n+ }\n+ this.drawText(feature.id, style, location);\n+ } else {\n+ this.removeText(feature.id);\n+ }\n+ return rendered;\n+ }\n }\n- return onScreen;\n },\n \n /**\n- * Method: inflate\n- * Englarges the markers icon by the specified ratio.\n+ * Method: calculateFeatureDx\n+ * {Number} Calculates the feature offset in x direction. Looking at the\n+ * center of the feature bounds and the renderer extent, we calculate how\n+ * many world widths the two are away from each other. This distance is\n+ * used to shift the feature as close as possible to the center of the\n+ * current enderer extent, which ensures that the feature is visible in the\n+ * current viewport.\n *\n * Parameters:\n- * inflate - {float} the ratio to enlarge the marker by (passing 2\n- * will double the size).\n+ * bounds - {} Bounds of the feature\n+ * worldBounds - {} Bounds of the world\n */\n- inflate: function(inflate) {\n- if (this.icon) {\n- this.icon.setSize({\n- w: this.icon.size.w * inflate,\n- h: this.icon.size.h * inflate\n- });\n+ calculateFeatureDx: function(bounds, worldBounds) {\n+ this.featureDx = 0;\n+ if (worldBounds) {\n+ var worldWidth = worldBounds.getWidth(),\n+ rendererCenterX = (this.extent.left + this.extent.right) / 2,\n+ featureCenterX = (bounds.left + bounds.right) / 2,\n+ worldsAway = Math.round((featureCenterX - rendererCenterX) / worldWidth);\n+ this.featureDx = worldsAway * worldWidth;\n }\n },\n \n /** \n- * Method: setOpacity\n- * Change the opacity of the marker by changin the opacity of \n- * its icon\n+ * Method: drawGeometry\n * \n+ * Draw a geometry. This should only be called from the renderer itself.\n+ * Use layer.drawFeature() from outside the renderer.\n+ * virtual function\n+ *\n * Parameters:\n- * opacity - {float} Specified as fraction (0.4, etc)\n+ * geometry - {} \n+ * style - {Object} \n+ * featureId - {} \n */\n- setOpacity: function(opacity) {\n- this.icon.setOpacity(opacity);\n+ drawGeometry: function(geometry, style, featureId) {},\n+\n+ /**\n+ * Method: drawText\n+ * Function for drawing text labels.\n+ * This method is only called by the renderer itself.\n+ * \n+ * Parameters: \n+ * featureId - {String}\n+ * style -\n+ * location - {}\n+ */\n+ drawText: function(featureId, style, location) {},\n+\n+ /**\n+ * Method: removeText\n+ * Function for removing text labels.\n+ * This method is only called by the renderer itself.\n+ * \n+ * Parameters: \n+ * featureId - {String}\n+ */\n+ removeText: function(featureId) {},\n+\n+ /**\n+ * Method: clear\n+ * Clear all vectors from the renderer.\n+ * virtual function.\n+ */\n+ clear: function() {},\n+\n+ /**\n+ * Method: getFeatureIdFromEvent\n+ * Returns a feature id from an event on the renderer. \n+ * How this happens is specific to the renderer. This should be\n+ * called from layer.getFeatureFromEvent().\n+ * Virtual function.\n+ * \n+ * Parameters:\n+ * evt - {} \n+ *\n+ * Returns:\n+ * {String} A feature id or undefined.\n+ */\n+ getFeatureIdFromEvent: function(evt) {},\n+\n+ /**\n+ * Method: eraseFeatures \n+ * This is called by the layer to erase features\n+ * \n+ * Parameters:\n+ * features - {Array()} \n+ */\n+ eraseFeatures: function(features) {\n+ if (!(OpenLayers.Util.isArray(features))) {\n+ features = [features];\n+ }\n+ for (var i = 0, len = features.length; i < len; ++i) {\n+ var feature = features[i];\n+ this.eraseGeometry(feature.geometry, feature.id);\n+ this.removeText(feature.id);\n+ }\n },\n \n /**\n- * Method: setUrl\n- * Change URL of the Icon Image.\n+ * Method: eraseGeometry\n+ * Remove a geometry from the renderer (by id).\n+ * virtual function.\n * \n- * url - {String} \n+ * Parameters:\n+ * geometry - {} \n+ * featureId - {String}\n */\n- setUrl: function(url) {\n- this.icon.setUrl(url);\n+ eraseGeometry: function(geometry, featureId) {},\n+\n+ /**\n+ * Method: moveRoot\n+ * moves this renderer's root to a (different) renderer.\n+ * To be implemented by subclasses that require a common renderer root for\n+ * feature selection.\n+ * \n+ * Parameters:\n+ * renderer - {} target renderer for the moved root\n+ */\n+ moveRoot: function(renderer) {},\n+\n+ /**\n+ * Method: getRenderLayerId\n+ * Gets the layer that this renderer's output appears on. If moveRoot was\n+ * used, this will be different from the id of the layer containing the\n+ * features rendered by this renderer.\n+ * \n+ * Returns:\n+ * {String} the id of the output layer.\n+ */\n+ getRenderLayerId: function() {\n+ return this.container.id;\n },\n \n- /** \n- * Method: display\n- * Hide or show the icon\n+ /**\n+ * Method: applyDefaultSymbolizer\n * \n- * display - {Boolean} \n+ * Parameters:\n+ * symbolizer - {Object}\n+ * \n+ * Returns:\n+ * {Object}\n */\n- display: function(display) {\n- this.icon.display(display);\n+ applyDefaultSymbolizer: function(symbolizer) {\n+ var result = OpenLayers.Util.extend({},\n+ OpenLayers.Renderer.defaultSymbolizer);\n+ if (symbolizer.stroke === false) {\n+ delete result.strokeWidth;\n+ delete result.strokeColor;\n+ }\n+ if (symbolizer.fill === false) {\n+ delete result.fillColor;\n+ }\n+ OpenLayers.Util.extend(result, symbolizer);\n+ return result;\n },\n \n- CLASS_NAME: \"OpenLayers.Marker\"\n+ CLASS_NAME: \"OpenLayers.Renderer\"\n });\n \n-\n /**\n- * Function: defaultIcon\n- * Creates a default .\n- * \n- * Returns:\n- * {} A default OpenLayers.Icon to use for a marker\n+ * Constant: OpenLayers.Renderer.defaultSymbolizer\n+ * {Object} Properties from this symbolizer will be applied to symbolizers\n+ * with missing properties. This can also be used to set a global\n+ * symbolizer default in OpenLayers. To be SLD 1.x compliant, add the\n+ * following code before rendering any vector features:\n+ * (code)\n+ * OpenLayers.Renderer.defaultSymbolizer = {\n+ * fillColor: \"#808080\",\n+ * fillOpacity: 1,\n+ * strokeColor: \"#000000\",\n+ * strokeOpacity: 1,\n+ * strokeWidth: 1,\n+ * pointRadius: 3,\n+ * graphicName: \"square\"\n+ * };\n+ * (end)\n */\n-OpenLayers.Marker.defaultIcon = function() {\n- return new OpenLayers.Icon(OpenLayers.Util.getImageLocation(\"marker.png\"), {\n- w: 21,\n- h: 25\n- }, {\n- x: -10.5,\n- y: -25\n- });\n+OpenLayers.Renderer.defaultSymbolizer = {\n+ fillColor: \"#000000\",\n+ strokeColor: \"#000000\",\n+ strokeWidth: 2,\n+ fillOpacity: 1,\n+ strokeOpacity: 1,\n+ pointRadius: 0,\n+ labelAlign: 'cm'\n };\n \n \n+\n+/**\n+ * Constant: OpenLayers.Renderer.symbol\n+ * Coordinate arrays for well known (named) symbols.\n+ */\n+OpenLayers.Renderer.symbol = {\n+ \"star\": [350, 75, 379, 161, 469, 161, 397, 215, 423, 301, 350, 250, 277, 301,\n+ 303, 215, 231, 161, 321, 161, 350, 75\n+ ],\n+ \"cross\": [4, 0, 6, 0, 6, 4, 10, 4, 10, 6, 6, 6, 6, 10, 4, 10, 4, 6, 0, 6, 0, 4, 4, 4,\n+ 4, 0\n+ ],\n+ \"x\": [0, 0, 25, 0, 50, 35, 75, 0, 100, 0, 65, 50, 100, 100, 75, 100, 50, 65, 25, 100, 0, 100, 35, 50, 0, 0],\n+ \"square\": [0, 0, 0, 1, 1, 1, 1, 0, 0, 0],\n+ \"triangle\": [0, 10, 10, 10, 5, 0, 0, 10]\n+};\n /* ======================================================================\n- OpenLayers/Handler.js\n+ OpenLayers/Tile.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n * See license.txt in the OpenLayers distribution or repository for the\n * full text of the license. */\n \n+\n /**\n * @requires OpenLayers/BaseTypes/Class.js\n- * @requires OpenLayers/Events.js\n+ * @requires OpenLayers/Util.js\n */\n \n /**\n- * Class: OpenLayers.Handler\n- * Base class to construct a higher-level handler for event sequences. All\n- * handlers have activate and deactivate methods. In addition, they have\n- * methods named like browser events. When a handler is activated, any\n- * additional methods named like a browser event is registered as a\n- * listener for the corresponding event. When a handler is deactivated,\n- * those same methods are unregistered as event listeners.\n- *\n- * Handlers also typically have a callbacks object with keys named like\n- * the abstracted events or event sequences that they are in charge of\n- * handling. The controls that wrap handlers define the methods that\n- * correspond to these abstract events - so instead of listening for\n- * individual browser events, they only listen for the abstract events\n- * defined by the handler.\n- * \n- * Handlers are created by controls, which ultimately have the responsibility\n- * of making changes to the the state of the application. Handlers\n- * themselves may make temporary changes, but in general are expected to\n- * return the application in the same state that they found it.\n+ * Class: OpenLayers.Tile \n+ * This is a class designed to designate a single tile, however\n+ * it is explicitly designed to do relatively little. Tiles store \n+ * information about themselves -- such as the URL that they are related\n+ * to, and their size - but do not add themselves to the layer div \n+ * automatically, for example. Create a new tile with the \n+ * constructor, or a subclass. \n+ * \n+ * TBD 3.0 - remove reference to url in above paragraph\n+ * \n */\n-OpenLayers.Handler = OpenLayers.Class({\n+OpenLayers.Tile = OpenLayers.Class({\n \n /**\n- * Property: id\n- * {String}\n+ * APIProperty: events\n+ * {} An events object that handles all \n+ * events on the tile.\n+ *\n+ * Register a listener for a particular event with the following syntax:\n+ * (code)\n+ * tile.events.register(type, obj, listener);\n+ * (end)\n+ *\n+ * Supported event types:\n+ * beforedraw - Triggered before the tile is drawn. Used to defer\n+ * drawing to an animation queue. To defer drawing, listeners need\n+ * to return false, which will abort drawing. The queue handler needs\n+ * to call (true) to actually draw the tile.\n+ * loadstart - Triggered when tile loading starts.\n+ * loadend - Triggered when tile loading ends.\n+ * loaderror - Triggered before the loadend event (i.e. when the tile is\n+ * still hidden) if the tile could not be loaded.\n+ * reload - Triggered when an already loading tile is reloaded.\n+ * unload - Triggered before a tile is unloaded.\n */\n- id: null,\n+ events: null,\n \n /**\n- * APIProperty: control\n- * {}. The control that initialized this handler. The\n- * control is assumed to have a valid map property - that map is used\n- * in the handler's own setMap method.\n+ * APIProperty: eventListeners\n+ * {Object} If set as an option at construction, the eventListeners\n+ * object will be registered with . Object\n+ * structure must be a listeners object as shown in the example for\n+ * the events.on method.\n+ *\n+ * This options can be set in the ``tileOptions`` option from\n+ * . For example, to be notified of the\n+ * ``loadend`` event of each tiles:\n+ * (code)\n+ * new OpenLayers.Layer.OSM('osm', 'http://tile.openstreetmap.org/${z}/${x}/${y}.png', {\n+ * tileOptions: {\n+ * eventListeners: {\n+ * 'loadend': function(evt) {\n+ * // do something on loadend\n+ * }\n+ * }\n+ * }\n+ * });\n+ * (end)\n */\n- control: null,\n+ eventListeners: null,\n \n /**\n- * Property: map\n- * {}\n+ * Property: id \n+ * {String} null\n */\n- map: null,\n+ id: null,\n+\n+ /** \n+ * Property: layer \n+ * {} layer the tile is attached to \n+ */\n+ layer: null,\n \n /**\n- * APIProperty: keyMask\n- * {Integer} Use bitwise operators and one or more of the OpenLayers.Handler\n- * constants to construct a keyMask. The keyMask is used by\n- * . If the keyMask matches the combination of keys\n- * down on an event, checkModifiers returns true.\n- *\n- * Example:\n- * (code)\n- * // handler only responds if the Shift key is down\n- * handler.keyMask = OpenLayers.Handler.MOD_SHIFT;\n+ * Property: url\n+ * {String} url of the request.\n *\n- * // handler only responds if Ctrl-Shift is down\n- * handler.keyMask = OpenLayers.Handler.MOD_SHIFT |\n- * OpenLayers.Handler.MOD_CTRL;\n- * (end)\n+ * TBD 3.0 \n+ * Deprecated. The base tile class does not need an url. This should be \n+ * handled in subclasses. Does not belong here.\n */\n- keyMask: null,\n+ url: null,\n \n- /**\n- * Property: active\n- * {Boolean}\n+ /** \n+ * APIProperty: bounds \n+ * {} null\n */\n- active: false,\n+ bounds: null,\n \n- /**\n- * Property: evt\n- * {Event} This property references the last event handled by the handler.\n- * Note that this property is not part of the stable API. Use of the\n- * evt property should be restricted to controls in the library\n- * or other applications that are willing to update with changes to\n- * the OpenLayers code.\n+ /** \n+ * Property: size \n+ * {} null\n */\n- evt: null,\n+ size: null,\n \n- /**\n- * Property: touch\n- * {Boolean} Indicates the support of touch events. When touch events are \n- * started touch will be true and all mouse related listeners will do \n- * nothing.\n+ /** \n+ * Property: position \n+ * {} Top Left pixel of the tile\n */\n- touch: false,\n+ position: null,\n \n /**\n- * Constructor: OpenLayers.Handler\n- * Construct a handler.\n- *\n+ * Property: isLoading\n+ * {Boolean} Is the tile loading?\n+ */\n+ isLoading: false,\n+\n+ /** TBD 3.0 -- remove 'url' from the list of parameters to the constructor.\n+ * there is no need for the base tile class to have a url.\n+ */\n+\n+ /** \n+ * Constructor: OpenLayers.Tile\n+ * Constructor for a new instance.\n+ * \n * Parameters:\n- * control - {} The control that initialized this\n- * handler. The control is assumed to have a valid map property; that\n- * map is used in the handler's own setMap method. If a map property\n- * is present in the options argument it will be used instead.\n- * callbacks - {Object} An object whose properties correspond to abstracted\n- * events or sequences of browser events. The values for these\n- * properties are functions defined by the control that get called by\n- * the handler.\n- * options - {Object} An optional object whose properties will be set on\n- * the handler.\n+ * layer - {} layer that the tile will go in.\n+ * position - {}\n+ * bounds - {}\n+ * url - {}\n+ * size - {}\n+ * options - {Object}\n */\n- initialize: function(control, callbacks, options) {\n+ initialize: function(layer, position, bounds, url, size, options) {\n+ this.layer = layer;\n+ this.position = position.clone();\n+ this.setBounds(bounds);\n+ this.url = url;\n+ if (size) {\n+ this.size = size.clone();\n+ }\n+\n+ //give the tile a unique id based on its BBOX.\n+ this.id = OpenLayers.Util.createUniqueID(\"Tile_\");\n+\n OpenLayers.Util.extend(this, options);\n- this.control = control;\n- this.callbacks = callbacks;\n \n- var map = this.map || control.map;\n- if (map) {\n- this.setMap(map);\n+ this.events = new OpenLayers.Events(this);\n+ if (this.eventListeners instanceof Object) {\n+ this.events.on(this.eventListeners);\n }\n-\n- this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + \"_\");\n },\n \n /**\n- * Method: setMap\n+ * Method: unload\n+ * Call immediately before destroying if you are listening to tile\n+ * events, so that counters are properly handled if tile is still\n+ * loading at destroy-time. Will only fire an event if the tile is\n+ * still loading.\n */\n- setMap: function(map) {\n- this.map = map;\n+ unload: function() {\n+ if (this.isLoading) {\n+ this.isLoading = false;\n+ this.events.triggerEvent(\"unload\");\n+ }\n },\n \n- /**\n- * Method: checkModifiers\n- * Check the keyMask on the handler. If no is set, this always\n- * returns true. If a is set and it matches the combination\n- * of keys down on an event, this returns true.\n- *\n- * Returns:\n- * {Boolean} The keyMask matches the keys down on an event.\n+ /** \n+ * APIMethod: destroy\n+ * Nullify references to prevent circular references and memory leaks.\n */\n- checkModifiers: function(evt) {\n- if (this.keyMask == null) {\n- return true;\n- }\n- /* calculate the keyboard modifier mask for this event */\n- var keyModifiers =\n- (evt.shiftKey ? OpenLayers.Handler.MOD_SHIFT : 0) |\n- (evt.ctrlKey ? OpenLayers.Handler.MOD_CTRL : 0) |\n- (evt.altKey ? OpenLayers.Handler.MOD_ALT : 0) |\n- (evt.metaKey ? OpenLayers.Handler.MOD_META : 0);\n+ destroy: function() {\n+ this.layer = null;\n+ this.bounds = null;\n+ this.size = null;\n+ this.position = null;\n \n- /* if it differs from the handler object's key mask,\n- bail out of the event handler */\n- return (keyModifiers == this.keyMask);\n+ if (this.eventListeners) {\n+ this.events.un(this.eventListeners);\n+ }\n+ this.events.destroy();\n+ this.eventListeners = null;\n+ this.events = null;\n },\n \n /**\n- * APIMethod: activate\n- * Turn on the handler. Returns false if the handler was already active.\n+ * Method: draw\n+ * Clear whatever is currently in the tile, then return whether or not \n+ * it should actually be re-drawn. This is an example implementation\n+ * that can be overridden by subclasses. The minimum thing to do here\n+ * is to call and return the result from .\n+ *\n+ * Parameters:\n+ * force - {Boolean} If true, the tile will not be cleared and no beforedraw\n+ * event will be fired. This is used for drawing tiles asynchronously\n+ * after drawing has been cancelled by returning false from a beforedraw\n+ * listener.\n * \n- * Returns: \n- * {Boolean} The handler was activated.\n+ * Returns:\n+ * {Boolean} Whether or not the tile should actually be drawn. Returns null\n+ * if a beforedraw listener returned false.\n */\n- activate: function() {\n- if (this.active) {\n- return false;\n+ draw: function(force) {\n+ if (!force) {\n+ //clear tile's contents and mark as not drawn\n+ this.clear();\n }\n- // register for event handlers defined on this class.\n- var events = OpenLayers.Events.prototype.BROWSER_EVENTS;\n- for (var i = 0, len = events.length; i < len; i++) {\n- if (this[events[i]]) {\n- this.register(events[i], this[events[i]]);\n- }\n+ var draw = this.shouldDraw();\n+ if (draw && !force && this.events.triggerEvent(\"beforedraw\") === false) {\n+ draw = null;\n }\n- this.active = true;\n- return true;\n+ return draw;\n },\n \n /**\n- * APIMethod: deactivate\n- * Turn off the handler. Returns false if the handler was already inactive.\n+ * Method: shouldDraw\n+ * Return whether or not the tile should actually be (re-)drawn. The only\n+ * case where we *wouldn't* want to draw the tile is if the tile is outside\n+ * its layer's maxExtent\n * \n * Returns:\n- * {Boolean} The handler was deactivated.\n+ * {Boolean} Whether or not the tile should actually be drawn.\n */\n- deactivate: function() {\n- if (!this.active) {\n- return false;\n- }\n- // unregister event handlers defined on this class.\n- var events = OpenLayers.Events.prototype.BROWSER_EVENTS;\n- for (var i = 0, len = events.length; i < len; i++) {\n- if (this[events[i]]) {\n- this.unregister(events[i], this[events[i]]);\n+ shouldDraw: function() {\n+ var withinMaxExtent = false,\n+ maxExtent = this.layer.maxExtent;\n+ if (maxExtent) {\n+ var map = this.layer.map;\n+ var worldBounds = map.baseLayer.wrapDateLine && map.getMaxExtent();\n+ if (this.bounds.intersectsBounds(maxExtent, {\n+ inclusive: false,\n+ worldBounds: worldBounds\n+ })) {\n+ withinMaxExtent = true;\n }\n }\n- this.touch = false;\n- this.active = false;\n- return true;\n- },\n \n- /**\n- * Method: startTouch\n- * Start touch events, this method must be called by subclasses in \n- * \"touchstart\" method. When touch events are started will be\n- * true and all mouse related listeners will do nothing.\n- */\n- startTouch: function() {\n- if (!this.touch) {\n- this.touch = true;\n- var events = [\n- \"mousedown\", \"mouseup\", \"mousemove\", \"click\", \"dblclick\",\n- \"mouseout\"\n- ];\n- for (var i = 0, len = events.length; i < len; i++) {\n- if (this[events[i]]) {\n- this.unregister(events[i], this[events[i]]);\n- }\n- }\n- }\n+ return withinMaxExtent || this.layer.displayOutsideMaxExtent;\n },\n \n /**\n- * Method: callback\n- * Trigger the control's named callback with the given arguments\n+ * Method: setBounds\n+ * Sets the bounds on this instance\n *\n * Parameters:\n- * name - {String} The key for the callback that is one of the properties\n- * of the handler's callbacks object.\n- * args - {Array(*)} An array of arguments (any type) with which to call \n- * the callback (defined by the control).\n+ * bounds {}\n */\n- callback: function(name, args) {\n- if (name && this.callbacks[name]) {\n- this.callbacks[name].apply(this.control, args);\n+ setBounds: function(bounds) {\n+ bounds = bounds.clone();\n+ if (this.layer.map.baseLayer.wrapDateLine) {\n+ var worldExtent = this.layer.map.getMaxExtent(),\n+ tolerance = this.layer.map.getResolution();\n+ bounds = bounds.wrapDateLine(worldExtent, {\n+ leftTolerance: tolerance,\n+ rightTolerance: tolerance\n+ });\n }\n+ this.bounds = bounds;\n },\n \n- /**\n- * Method: register\n- * register an event on the map\n- */\n- register: function(name, method) {\n- // TODO: deal with registerPriority in 3.0\n- this.map.events.registerPriority(name, this, method);\n- this.map.events.registerPriority(name, this, this.setEvent);\n- },\n-\n- /**\n- * Method: unregister\n- * unregister an event from the map\n- */\n- unregister: function(name, method) {\n- this.map.events.unregister(name, this, method);\n- this.map.events.unregister(name, this, this.setEvent);\n- },\n-\n- /**\n- * Method: setEvent\n- * With each registered browser event, the handler sets its own evt\n- * property. This property can be accessed by controls if needed\n- * to get more information about the event that the handler is\n- * processing.\n- *\n- * This allows modifier keys on the event to be checked (alt, shift, ctrl,\n- * and meta cannot be checked with the keyboard handler). For a\n- * control to determine which modifier keys are associated with the\n- * event that a handler is currently processing, it should access\n- * (code)handler.evt.altKey || handler.evt.shiftKey ||\n- * handler.evt.ctrlKey || handler.evt.metaKey(end).\n+ /** \n+ * Method: moveTo\n+ * Reposition the tile.\n *\n * Parameters:\n- * evt - {Event} The browser event.\n+ * bounds - {}\n+ * position - {}\n+ * redraw - {Boolean} Call draw method on tile after moving.\n+ * Default is true\n */\n- setEvent: function(evt) {\n- this.evt = evt;\n- return true;\n+ moveTo: function(bounds, position, redraw) {\n+ if (redraw == null) {\n+ redraw = true;\n+ }\n+\n+ this.setBounds(bounds);\n+ this.position = position.clone();\n+ if (redraw) {\n+ this.draw();\n+ }\n },\n \n- /**\n- * Method: destroy\n- * Deconstruct the handler.\n+ /** \n+ * Method: clear\n+ * Clear the tile of any bounds/position-related data so that it can \n+ * be reused in a new location.\n */\n- destroy: function() {\n- // unregister event listeners\n- this.deactivate();\n- // eliminate circular references\n- this.control = this.map = null;\n+ clear: function(draw) {\n+ // to be extended by subclasses\n },\n \n- CLASS_NAME: \"OpenLayers.Handler\"\n+ CLASS_NAME: \"OpenLayers.Tile\"\n });\n-\n-/**\n- * Constant: OpenLayers.Handler.MOD_NONE\n- * If set as the , returns false if any key is down.\n- */\n-OpenLayers.Handler.MOD_NONE = 0;\n-\n-/**\n- * Constant: OpenLayers.Handler.MOD_SHIFT\n- * If set as the , returns false if Shift is down.\n- */\n-OpenLayers.Handler.MOD_SHIFT = 1;\n-\n-/**\n- * Constant: OpenLayers.Handler.MOD_CTRL\n- * If set as the , returns false if Ctrl is down.\n- */\n-OpenLayers.Handler.MOD_CTRL = 2;\n-\n-/**\n- * Constant: OpenLayers.Handler.MOD_ALT\n- * If set as the , returns false if Alt is down.\n- */\n-OpenLayers.Handler.MOD_ALT = 4;\n-\n-/**\n- * Constant: OpenLayers.Handler.MOD_META\n- * If set as the , returns false if Cmd is down.\n- */\n-OpenLayers.Handler.MOD_META = 8;\n-\n-\n /* ======================================================================\n- OpenLayers/Format/WPSDescribeProcess.js\n+ OpenLayers/Icon.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n * See license.txt in the OpenLayers distribution or repository for the\n * full text of the license. */\n \n /**\n- * @requires OpenLayers/Format/XML.js\n- * @requires OpenLayers/Format/OWSCommon/v1_1_0.js\n+ * @requires OpenLayers/BaseTypes/Class.js\n */\n \n /**\n- * Class: OpenLayers.Format.WPSDescribeProcess\n- * Read WPS DescribeProcess responses. \n+ * Class: OpenLayers.Icon\n+ * \n+ * The icon represents a graphical icon on the screen. Typically used in\n+ * conjunction with a to represent markers on a screen.\n *\n- * Inherits from:\n- * - \n+ * An icon has a url, size and position. It also contains an offset which \n+ * allows the center point to be represented correctly. This can be\n+ * provided either as a fixed offset or a function provided to calculate\n+ * the desired offset. \n+ * \n */\n-OpenLayers.Format.WPSDescribeProcess = OpenLayers.Class(\n- OpenLayers.Format.XML, {\n+OpenLayers.Icon = OpenLayers.Class({\n \n- /**\n- * Constant: VERSION\n- * {String} 1.0.0\n- */\n- VERSION: \"1.0.0\",\n+ /** \n+ * Property: url \n+ * {String} image url\n+ */\n+ url: null,\n \n- /**\n- * Property: namespaces\n- * {Object} Mapping of namespace aliases to namespace URIs.\n- */\n- namespaces: {\n- wps: \"http://www.opengis.net/wps/1.0.0\",\n- ows: \"http://www.opengis.net/ows/1.1\",\n- xsi: \"http://www.w3.org/2001/XMLSchema-instance\"\n- },\n+ /** \n+ * Property: size \n+ * {|Object} An OpenLayers.Size or\n+ * an object with a 'w' and 'h' properties.\n+ */\n+ size: null,\n \n- /**\n- * Property: schemaLocation\n- * {String} Schema location\n- */\n- schemaLocation: \"http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd\",\n+ /** \n+ * Property: offset \n+ * {|Object} distance in pixels to offset the\n+ * image when being rendered. An OpenLayers.Pixel or an object\n+ * with a 'x' and 'y' properties.\n+ */\n+ offset: null,\n \n- /**\n- * Property: defaultPrefix\n- */\n- defaultPrefix: \"wps\",\n+ /** \n+ * Property: calculateOffset \n+ * {Function} Function to calculate the offset (based on the size)\n+ */\n+ calculateOffset: null,\n \n- /**\n- * Property: regExes\n- * Compiled regular expressions for manipulating strings.\n- */\n- regExes: {\n- trimSpace: (/^\\s*|\\s*$/g),\n- removeSpace: (/\\s*/g),\n- splitSpace: (/\\s+/),\n- trimComma: (/\\s*,\\s*/g)\n- },\n+ /** \n+ * Property: imageDiv \n+ * {DOMElement} \n+ */\n+ imageDiv: null,\n \n- /**\n- * Constructor: OpenLayers.Format.WPSDescribeProcess\n- *\n- * Parameters:\n- * options - {Object} An optional object whose properties will be set on\n- * this instance.\n- */\n+ /** \n+ * Property: px \n+ * {|Object} An OpenLayers.Pixel or an object\n+ * with a 'x' and 'y' properties.\n+ */\n+ px: null,\n \n- /**\n- * APIMethod: read\n- * Parse a WPS DescribeProcess and return an object with its information.\n- * \n- * Parameters: \n- * data - {String} or {DOMElement} data to read/parse.\n- *\n- * Returns:\n- * {Object}\n- */\n- read: function(data) {\n- if (typeof data == \"string\") {\n- data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);\n- }\n- if (data && data.nodeType == 9) {\n- data = data.documentElement;\n- }\n- var info = {};\n- this.readNode(data, info);\n- return info;\n- },\n+ /** \n+ * Constructor: OpenLayers.Icon\n+ * Creates an icon, which is an image tag in a div. \n+ *\n+ * url - {String} \n+ * size - {|Object} An OpenLayers.Size or an\n+ * object with a 'w' and 'h'\n+ * properties.\n+ * offset - {|Object} An OpenLayers.Pixel or an\n+ * object with a 'x' and 'y'\n+ * properties.\n+ * calculateOffset - {Function} \n+ */\n+ initialize: function(url, size, offset, calculateOffset) {\n+ this.url = url;\n+ this.size = size || {\n+ w: 20,\n+ h: 20\n+ };\n+ this.offset = offset || {\n+ x: -(this.size.w / 2),\n+ y: -(this.size.h / 2)\n+ };\n+ this.calculateOffset = calculateOffset;\n \n- /**\n- * Property: readers\n- * Contains public functions, grouped by namespace prefix, that will\n- * be applied when a namespaced node is found matching the function\n- * name. The function will be applied in the scope of this parser\n- * with two arguments: the node being read and a context object passed\n- * from the parent.\n- */\n- readers: {\n- \"wps\": {\n- \"ProcessDescriptions\": function(node, obj) {\n- obj.processDescriptions = {};\n- this.readChildNodes(node, obj.processDescriptions);\n- },\n- \"ProcessDescription\": function(node, processDescriptions) {\n- var processVersion = this.getAttributeNS(node, this.namespaces.wps, \"processVersion\");\n- var processDescription = {\n- processVersion: processVersion,\n- statusSupported: (node.getAttribute(\"statusSupported\") === \"true\"),\n- storeSupported: (node.getAttribute(\"storeSupported\") === \"true\")\n- };\n- this.readChildNodes(node, processDescription);\n- processDescriptions[processDescription.identifier] = processDescription;\n- },\n- \"DataInputs\": function(node, processDescription) {\n- processDescription.dataInputs = [];\n- this.readChildNodes(node, processDescription.dataInputs);\n- },\n- \"ProcessOutputs\": function(node, processDescription) {\n- processDescription.processOutputs = [];\n- this.readChildNodes(node, processDescription.processOutputs);\n- },\n- \"Output\": function(node, processOutputs) {\n- var output = {};\n- this.readChildNodes(node, output);\n- processOutputs.push(output);\n- },\n- \"ComplexOutput\": function(node, output) {\n- output.complexOutput = {};\n- this.readChildNodes(node, output.complexOutput);\n- },\n- \"LiteralOutput\": function(node, output) {\n- output.literalOutput = {};\n- this.readChildNodes(node, output.literalOutput);\n- },\n- \"Input\": function(node, dataInputs) {\n- var input = {\n- maxOccurs: parseInt(node.getAttribute(\"maxOccurs\")),\n- minOccurs: parseInt(node.getAttribute(\"minOccurs\"))\n- };\n- this.readChildNodes(node, input);\n- dataInputs.push(input);\n- },\n- \"BoundingBoxData\": function(node, input) {\n- input.boundingBoxData = {};\n- this.readChildNodes(node, input.boundingBoxData);\n- },\n- \"CRS\": function(node, obj) {\n- if (!obj.CRSs) {\n- obj.CRSs = {};\n- }\n- obj.CRSs[this.getChildValue(node)] = true;\n- },\n- \"LiteralData\": function(node, input) {\n- input.literalData = {};\n- this.readChildNodes(node, input.literalData);\n- },\n- \"ComplexData\": function(node, input) {\n- input.complexData = {};\n- this.readChildNodes(node, input.complexData);\n- },\n- \"Default\": function(node, complexData) {\n- complexData[\"default\"] = {};\n- this.readChildNodes(node, complexData[\"default\"]);\n- },\n- \"Supported\": function(node, complexData) {\n- complexData[\"supported\"] = {};\n- this.readChildNodes(node, complexData[\"supported\"]);\n- },\n- \"Format\": function(node, obj) {\n- var format = {};\n- this.readChildNodes(node, format);\n- if (!obj.formats) {\n- obj.formats = {};\n- }\n- obj.formats[format.mimeType] = true;\n- },\n- \"MimeType\": function(node, format) {\n- format.mimeType = this.getChildValue(node);\n+ var id = OpenLayers.Util.createUniqueID(\"OL_Icon_\");\n+ this.imageDiv = OpenLayers.Util.createAlphaImageDiv(id);\n+ },\n+\n+ /** \n+ * Method: destroy\n+ * Nullify references and remove event listeners to prevent circular \n+ * references and memory leaks\n+ */\n+ destroy: function() {\n+ // erase any drawn elements\n+ this.erase();\n+\n+ OpenLayers.Event.stopObservingElement(this.imageDiv.firstChild);\n+ this.imageDiv.innerHTML = \"\";\n+ this.imageDiv = null;\n+ },\n+\n+ /** \n+ * Method: clone\n+ * \n+ * Returns:\n+ * {} A fresh copy of the icon.\n+ */\n+ clone: function() {\n+ return new OpenLayers.Icon(this.url,\n+ this.size,\n+ this.offset,\n+ this.calculateOffset);\n+ },\n+\n+ /**\n+ * Method: setSize\n+ * \n+ * Parameters:\n+ * size - {|Object} An OpenLayers.Size or\n+ * an object with a 'w' and 'h' properties.\n+ */\n+ setSize: function(size) {\n+ if (size != null) {\n+ this.size = size;\n+ }\n+ this.draw();\n+ },\n+\n+ /**\n+ * Method: setUrl\n+ * \n+ * Parameters:\n+ * url - {String} \n+ */\n+ setUrl: function(url) {\n+ if (url != null) {\n+ this.url = url;\n+ }\n+ this.draw();\n+ },\n+\n+ /** \n+ * Method: draw\n+ * Move the div to the given pixel.\n+ * \n+ * Parameters:\n+ * px - {|Object} An OpenLayers.Pixel or an\n+ * object with a 'x' and 'y' properties.\n+ * \n+ * Returns:\n+ * {DOMElement} A new DOM Image of this icon set at the location passed-in\n+ */\n+ draw: function(px) {\n+ OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,\n+ null,\n+ null,\n+ this.size,\n+ this.url,\n+ \"absolute\");\n+ this.moveTo(px);\n+ return this.imageDiv;\n+ },\n+\n+ /** \n+ * Method: erase\n+ * Erase the underlying image element.\n+ */\n+ erase: function() {\n+ if (this.imageDiv != null && this.imageDiv.parentNode != null) {\n+ OpenLayers.Element.remove(this.imageDiv);\n+ }\n+ },\n+\n+ /** \n+ * Method: setOpacity\n+ * Change the icon's opacity\n+ *\n+ * Parameters:\n+ * opacity - {float} \n+ */\n+ setOpacity: function(opacity) {\n+ OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv, null, null, null,\n+ null, null, null, null, opacity);\n+\n+ },\n+\n+ /**\n+ * Method: moveTo\n+ * move icon to passed in px.\n+ *\n+ * Parameters:\n+ * px - {|Object} the pixel position to move to.\n+ * An OpenLayers.Pixel or an object with a 'x' and 'y' properties.\n+ */\n+ moveTo: function(px) {\n+ //if no px passed in, use stored location\n+ if (px != null) {\n+ this.px = px;\n+ }\n+\n+ if (this.imageDiv != null) {\n+ if (this.px == null) {\n+ this.display(false);\n+ } else {\n+ if (this.calculateOffset) {\n+ this.offset = this.calculateOffset(this.size);\n }\n- },\n- \"ows\": OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers[\"ows\"]\n- },\n+ OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv, null, {\n+ x: this.px.x + this.offset.x,\n+ y: this.px.y + this.offset.y\n+ });\n+ }\n+ }\n+ },\n \n- CLASS_NAME: \"OpenLayers.Format.WPSDescribeProcess\"\n+ /** \n+ * Method: display\n+ * Hide or show the icon\n+ *\n+ * Parameters:\n+ * display - {Boolean} \n+ */\n+ display: function(display) {\n+ this.imageDiv.style.display = (display) ? \"\" : \"none\";\n+ },\n \n- });\n+\n+ /**\n+ * APIMethod: isDrawn\n+ * \n+ * Returns:\n+ * {Boolean} Whether or not the icon is drawn.\n+ */\n+ isDrawn: function() {\n+ // nodeType 11 for ie, whose nodes *always* have a parentNode\n+ // (of type document fragment)\n+ var isDrawn = (this.imageDiv && this.imageDiv.parentNode &&\n+ (this.imageDiv.parentNode.nodeType != 11));\n+\n+ return isDrawn;\n+ },\n+\n+ CLASS_NAME: \"OpenLayers.Icon\"\n+});\n /* ======================================================================\n- OpenLayers/WPSClient.js\n+ OpenLayers/Strategy.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n * See license.txt in the OpenLayers distribution or repository for the\n * full text of the license. */\n \n /**\n- * @requires OpenLayers/SingleFile.js\n- */\n-\n-/**\n- * @requires OpenLayers/Events.js\n- * @requires OpenLayers/WPSProcess.js\n- * @requires OpenLayers/Format/WPSDescribeProcess.js\n- * @requires OpenLayers/Request.js\n+ * @requires OpenLayers/BaseTypes/Class.js\n */\n \n /**\n- * Class: OpenLayers.WPSClient\n- * High level API for interaction with Web Processing Services (WPS).\n- * An instance is used to create \n- * instances for servers known to the WPSClient. The WPSClient also caches\n- * DescribeProcess responses to reduce the number of requests sent to servers\n- * when processes are created.\n+ * Class: OpenLayers.Strategy\n+ * Abstract vector layer strategy class. Not to be instantiated directly. Use\n+ * one of the strategy subclasses instead.\n */\n-OpenLayers.WPSClient = OpenLayers.Class({\n+OpenLayers.Strategy = OpenLayers.Class({\n \n /**\n- * Property: servers\n- * {Object} Service metadata, keyed by a local identifier.\n- *\n- * Properties:\n- * url - {String} the url of the server\n- * version - {String} WPS version of the server\n- * processDescription - {Object} Cache of raw DescribeProcess\n- * responses, keyed by process identifier.\n+ * Property: layer\n+ * {} The layer this strategy belongs to.\n */\n- servers: null,\n+ layer: null,\n \n /**\n- * Property: version\n- * {String} The default WPS version to use if none is configured. Default\n- * is '1.0.0'.\n+ * Property: options\n+ * {Object} Any options sent to the constructor.\n */\n- version: '1.0.0',\n+ options: null,\n+\n+ /** \n+ * Property: active \n+ * {Boolean} The control is active.\n+ */\n+ active: null,\n \n /**\n- * Property: lazy\n- * {Boolean} Should the DescribeProcess be deferred until a process is\n- * fully configured? Default is false.\n+ * Property: autoActivate\n+ * {Boolean} The creator of the strategy can set autoActivate to false\n+ * to fully control when the protocol is activated and deactivated.\n+ * Defaults to true.\n */\n- lazy: false,\n+ autoActivate: true,\n \n /**\n- * Property: events\n- * {}\n- *\n- * Supported event types:\n- * describeprocess - Fires when the process description is available.\n- * Listeners receive an object with a 'raw' property holding the raw\n- * DescribeProcess response, and an 'identifier' property holding the\n- * process identifier of the described process.\n+ * Property: autoDestroy\n+ * {Boolean} The creator of the strategy can set autoDestroy to false\n+ * to fully control when the strategy is destroyed. Defaults to\n+ * true.\n */\n- events: null,\n+ autoDestroy: true,\n \n /**\n- * Constructor: OpenLayers.WPSClient\n+ * Constructor: OpenLayers.Strategy\n+ * Abstract class for vector strategies. Create instances of a subclass.\n *\n * Parameters:\n- * options - {Object} Object whose properties will be set on the instance.\n- *\n- * Avaliable options:\n- * servers - {Object} Mandatory. Service metadata, keyed by a local\n- * identifier. Can either be a string with the service url or an\n- * object literal with additional metadata:\n- *\n- * (code)\n- * servers: {\n- * local: '/geoserver/wps'\n- * }, {\n- * opengeo: {\n- * url: 'http://demo.opengeo.org/geoserver/wps',\n- * version: '1.0.0'\n- * }\n- * }\n- * (end)\n- *\n- * lazy - {Boolean} Optional. Set to true if DescribeProcess should not be\n- * requested until a process is fully configured. Default is false.\n+ * options - {Object} Optional object whose properties will be set on the\n+ * instance.\n */\n initialize: function(options) {\n OpenLayers.Util.extend(this, options);\n- this.events = new OpenLayers.Events(this);\n- this.servers = {};\n- for (var s in options.servers) {\n- this.servers[s] = typeof options.servers[s] == 'string' ? {\n- url: options.servers[s],\n- version: this.version,\n- processDescription: {}\n- } : options.servers[s];\n- }\n+ this.options = options;\n+ // set the active property here, so that user cannot override it\n+ this.active = false;\n },\n \n /**\n- * APIMethod: execute\n- * Shortcut to execute a process with a single function call. This is\n- * equivalent to using and then calling execute on the\n- * process.\n- *\n- * Parameters:\n- * options - {Object} Options for the execute operation.\n- *\n- * Available options:\n- * server - {String} Mandatory. One of the local identifiers of the\n- * configured servers.\n- * process - {String} Mandatory. A process identifier known to the\n- * server.\n- * inputs - {Object} The inputs for the process, keyed by input identifier.\n- * For spatial data inputs, the value of an input is usually an\n- * , an or an array of\n- * geometries or features.\n- * output - {String} The identifier of an output to parse. Optional. If not\n- * provided, the first output will be parsed.\n- * success - {Function} Callback to call when the process is complete.\n- * This function is called with an outputs object as argument, which\n- * will have a property with the identifier of the requested output\n- * (e.g. 'result'). For processes that generate spatial output, the\n- * value will either be a single or an\n- * array of features.\n- * scope - {Object} Optional scope for the success callback.\n+ * APIMethod: destroy\n+ * Clean up the strategy.\n */\n- execute: function(options) {\n- var process = this.getProcess(options.server, options.process);\n- process.execute({\n- inputs: options.inputs,\n- success: options.success,\n- scope: options.scope\n- });\n+ destroy: function() {\n+ this.deactivate();\n+ this.layer = null;\n+ this.options = null;\n },\n \n /**\n- * APIMethod: getProcess\n- * Creates an .\n+ * Method: setLayer\n+ * Called to set the property.\n *\n * Parameters:\n- * serverID - {String} Local identifier from the servers that this instance\n- * was constructed with.\n- * processID - {String} Process identifier known to the server.\n- *\n- * Returns:\n- * {}\n+ * layer - {}\n */\n- getProcess: function(serverID, processID) {\n- var process = new OpenLayers.WPSProcess({\n- client: this,\n- server: serverID,\n- identifier: processID\n- });\n- if (!this.lazy) {\n- process.describe();\n- }\n- return process;\n+ setLayer: function(layer) {\n+ this.layer = layer;\n },\n \n /**\n- * Method: describeProcess\n+ * Method: activate\n+ * Activate the strategy. Register any listeners, do appropriate setup.\n *\n- * Parameters:\n- * serverID - {String} Identifier of the server\n- * processID - {String} Identifier of the requested process\n- * callback - {Function} Callback to call when the description is available\n- * scope - {Object} Optional execution scope for the callback function\n+ * Returns:\n+ * {Boolean} True if the strategy was successfully activated or false if\n+ * the strategy was already active.\n */\n- describeProcess: function(serverID, processID, callback, scope) {\n- var server = this.servers[serverID];\n- if (!server.processDescription[processID]) {\n- if (!(processID in server.processDescription)) {\n- // set to null so we know a describeFeature request is pending\n- server.processDescription[processID] = null;\n- OpenLayers.Request.GET({\n- url: server.url,\n- params: {\n- SERVICE: 'WPS',\n- VERSION: server.version,\n- REQUEST: 'DescribeProcess',\n- IDENTIFIER: processID\n- },\n- success: function(response) {\n- server.processDescription[processID] = response.responseText;\n- this.events.triggerEvent('describeprocess', {\n- identifier: processID,\n- raw: response.responseText\n- });\n- },\n- scope: this\n- });\n- } else {\n- // pending request\n- this.events.register('describeprocess', this, function describe(evt) {\n- if (evt.identifier === processID) {\n- this.events.unregister('describeprocess', this, describe);\n- callback.call(scope, evt.raw);\n- }\n- });\n- }\n- } else {\n- window.setTimeout(function() {\n- callback.call(scope, server.processDescription[processID]);\n- }, 0);\n+ activate: function() {\n+ if (!this.active) {\n+ this.active = true;\n+ return true;\n }\n+ return false;\n },\n \n /**\n- * Method: destroy\n+ * Method: deactivate\n+ * Deactivate the strategy. Unregister any listeners, do appropriate\n+ * tear-down.\n+ *\n+ * Returns:\n+ * {Boolean} True if the strategy was successfully deactivated or false if\n+ * the strategy was already inactive.\n */\n- destroy: function() {\n- this.events.destroy();\n- this.events = null;\n- this.servers = null;\n+ deactivate: function() {\n+ if (this.active) {\n+ this.active = false;\n+ return true;\n+ }\n+ return false;\n },\n \n- CLASS_NAME: 'OpenLayers.WPSClient'\n-\n+ CLASS_NAME: \"OpenLayers.Strategy\"\n });\n /* ======================================================================\n OpenLayers/Layer/HTTPRequest.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n@@ -27436,313 +28092,14 @@\n \n return OpenLayers.Util.urlAppend(url, paramsString);\n },\n \n CLASS_NAME: \"OpenLayers.Layer.HTTPRequest\"\n });\n /* ======================================================================\n- OpenLayers/Tile.js\n- ====================================================================== */\n-\n-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n- * full list of contributors). Published under the 2-clause BSD license.\n- * See license.txt in the OpenLayers distribution or repository for the\n- * full text of the license. */\n-\n-\n-/**\n- * @requires OpenLayers/BaseTypes/Class.js\n- * @requires OpenLayers/Util.js\n- */\n-\n-/**\n- * Class: OpenLayers.Tile \n- * This is a class designed to designate a single tile, however\n- * it is explicitly designed to do relatively little. Tiles store \n- * information about themselves -- such as the URL that they are related\n- * to, and their size - but do not add themselves to the layer div \n- * automatically, for example. Create a new tile with the \n- * constructor, or a subclass. \n- * \n- * TBD 3.0 - remove reference to url in above paragraph\n- * \n- */\n-OpenLayers.Tile = OpenLayers.Class({\n-\n- /**\n- * APIProperty: events\n- * {} An events object that handles all \n- * events on the tile.\n- *\n- * Register a listener for a particular event with the following syntax:\n- * (code)\n- * tile.events.register(type, obj, listener);\n- * (end)\n- *\n- * Supported event types:\n- * beforedraw - Triggered before the tile is drawn. Used to defer\n- * drawing to an animation queue. To defer drawing, listeners need\n- * to return false, which will abort drawing. The queue handler needs\n- * to call (true) to actually draw the tile.\n- * loadstart - Triggered when tile loading starts.\n- * loadend - Triggered when tile loading ends.\n- * loaderror - Triggered before the loadend event (i.e. when the tile is\n- * still hidden) if the tile could not be loaded.\n- * reload - Triggered when an already loading tile is reloaded.\n- * unload - Triggered before a tile is unloaded.\n- */\n- events: null,\n-\n- /**\n- * APIProperty: eventListeners\n- * {Object} If set as an option at construction, the eventListeners\n- * object will be registered with . Object\n- * structure must be a listeners object as shown in the example for\n- * the events.on method.\n- *\n- * This options can be set in the ``tileOptions`` option from\n- * . For example, to be notified of the\n- * ``loadend`` event of each tiles:\n- * (code)\n- * new OpenLayers.Layer.OSM('osm', 'http://tile.openstreetmap.org/${z}/${x}/${y}.png', {\n- * tileOptions: {\n- * eventListeners: {\n- * 'loadend': function(evt) {\n- * // do something on loadend\n- * }\n- * }\n- * }\n- * });\n- * (end)\n- */\n- eventListeners: null,\n-\n- /**\n- * Property: id \n- * {String} null\n- */\n- id: null,\n-\n- /** \n- * Property: layer \n- * {} layer the tile is attached to \n- */\n- layer: null,\n-\n- /**\n- * Property: url\n- * {String} url of the request.\n- *\n- * TBD 3.0 \n- * Deprecated. The base tile class does not need an url. This should be \n- * handled in subclasses. Does not belong here.\n- */\n- url: null,\n-\n- /** \n- * APIProperty: bounds \n- * {} null\n- */\n- bounds: null,\n-\n- /** \n- * Property: size \n- * {} null\n- */\n- size: null,\n-\n- /** \n- * Property: position \n- * {} Top Left pixel of the tile\n- */\n- position: null,\n-\n- /**\n- * Property: isLoading\n- * {Boolean} Is the tile loading?\n- */\n- isLoading: false,\n-\n- /** TBD 3.0 -- remove 'url' from the list of parameters to the constructor.\n- * there is no need for the base tile class to have a url.\n- */\n-\n- /** \n- * Constructor: OpenLayers.Tile\n- * Constructor for a new instance.\n- * \n- * Parameters:\n- * layer - {} layer that the tile will go in.\n- * position - {}\n- * bounds - {}\n- * url - {}\n- * size - {}\n- * options - {Object}\n- */\n- initialize: function(layer, position, bounds, url, size, options) {\n- this.layer = layer;\n- this.position = position.clone();\n- this.setBounds(bounds);\n- this.url = url;\n- if (size) {\n- this.size = size.clone();\n- }\n-\n- //give the tile a unique id based on its BBOX.\n- this.id = OpenLayers.Util.createUniqueID(\"Tile_\");\n-\n- OpenLayers.Util.extend(this, options);\n-\n- this.events = new OpenLayers.Events(this);\n- if (this.eventListeners instanceof Object) {\n- this.events.on(this.eventListeners);\n- }\n- },\n-\n- /**\n- * Method: unload\n- * Call immediately before destroying if you are listening to tile\n- * events, so that counters are properly handled if tile is still\n- * loading at destroy-time. Will only fire an event if the tile is\n- * still loading.\n- */\n- unload: function() {\n- if (this.isLoading) {\n- this.isLoading = false;\n- this.events.triggerEvent(\"unload\");\n- }\n- },\n-\n- /** \n- * APIMethod: destroy\n- * Nullify references to prevent circular references and memory leaks.\n- */\n- destroy: function() {\n- this.layer = null;\n- this.bounds = null;\n- this.size = null;\n- this.position = null;\n-\n- if (this.eventListeners) {\n- this.events.un(this.eventListeners);\n- }\n- this.events.destroy();\n- this.eventListeners = null;\n- this.events = null;\n- },\n-\n- /**\n- * Method: draw\n- * Clear whatever is currently in the tile, then return whether or not \n- * it should actually be re-drawn. This is an example implementation\n- * that can be overridden by subclasses. The minimum thing to do here\n- * is to call and return the result from .\n- *\n- * Parameters:\n- * force - {Boolean} If true, the tile will not be cleared and no beforedraw\n- * event will be fired. This is used for drawing tiles asynchronously\n- * after drawing has been cancelled by returning false from a beforedraw\n- * listener.\n- * \n- * Returns:\n- * {Boolean} Whether or not the tile should actually be drawn. Returns null\n- * if a beforedraw listener returned false.\n- */\n- draw: function(force) {\n- if (!force) {\n- //clear tile's contents and mark as not drawn\n- this.clear();\n- }\n- var draw = this.shouldDraw();\n- if (draw && !force && this.events.triggerEvent(\"beforedraw\") === false) {\n- draw = null;\n- }\n- return draw;\n- },\n-\n- /**\n- * Method: shouldDraw\n- * Return whether or not the tile should actually be (re-)drawn. The only\n- * case where we *wouldn't* want to draw the tile is if the tile is outside\n- * its layer's maxExtent\n- * \n- * Returns:\n- * {Boolean} Whether or not the tile should actually be drawn.\n- */\n- shouldDraw: function() {\n- var withinMaxExtent = false,\n- maxExtent = this.layer.maxExtent;\n- if (maxExtent) {\n- var map = this.layer.map;\n- var worldBounds = map.baseLayer.wrapDateLine && map.getMaxExtent();\n- if (this.bounds.intersectsBounds(maxExtent, {\n- inclusive: false,\n- worldBounds: worldBounds\n- })) {\n- withinMaxExtent = true;\n- }\n- }\n-\n- return withinMaxExtent || this.layer.displayOutsideMaxExtent;\n- },\n-\n- /**\n- * Method: setBounds\n- * Sets the bounds on this instance\n- *\n- * Parameters:\n- * bounds {}\n- */\n- setBounds: function(bounds) {\n- bounds = bounds.clone();\n- if (this.layer.map.baseLayer.wrapDateLine) {\n- var worldExtent = this.layer.map.getMaxExtent(),\n- tolerance = this.layer.map.getResolution();\n- bounds = bounds.wrapDateLine(worldExtent, {\n- leftTolerance: tolerance,\n- rightTolerance: tolerance\n- });\n- }\n- this.bounds = bounds;\n- },\n-\n- /** \n- * Method: moveTo\n- * Reposition the tile.\n- *\n- * Parameters:\n- * bounds - {}\n- * position - {}\n- * redraw - {Boolean} Call draw method on tile after moving.\n- * Default is true\n- */\n- moveTo: function(bounds, position, redraw) {\n- if (redraw == null) {\n- redraw = true;\n- }\n-\n- this.setBounds(bounds);\n- this.position = position.clone();\n- if (redraw) {\n- this.draw();\n- }\n- },\n-\n- /** \n- * Method: clear\n- * Clear the tile of any bounds/position-related data so that it can \n- * be reused in a new location.\n- */\n- clear: function(draw) {\n- // to be extended by subclasses\n- },\n-\n- CLASS_NAME: \"OpenLayers.Tile\"\n-});\n-/* ======================================================================\n OpenLayers/Tile/Image.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n * See license.txt in the OpenLayers distribution or repository for the\n * full text of the license. */\n@@ -29553,547 +29910,1988 @@\n var row = this.grid.pop();\n for (i = 0, l = row.length; i < l; i++) {\n var tile = row[i];\n this.destroyTile(tile);\n }\n }\n \n- // remove extra columns\n- for (i = 0, l = this.grid.length; i < l; i++) {\n- while (this.grid[i].length > columns) {\n- var row = this.grid[i];\n- var tile = row.pop();\n- this.destroyTile(tile);\n- }\n- }\n+ // remove extra columns\n+ for (i = 0, l = this.grid.length; i < l; i++) {\n+ while (this.grid[i].length > columns) {\n+ var row = this.grid[i];\n+ var tile = row.pop();\n+ this.destroyTile(tile);\n+ }\n+ }\n+ },\n+\n+ /**\n+ * Method: onMapResize\n+ * For singleTile layers, this will set a new tile size according to the\n+ * dimensions of the map pane.\n+ */\n+ onMapResize: function() {\n+ if (this.singleTile) {\n+ this.clearGrid();\n+ this.setTileSize();\n+ }\n+ },\n+\n+ /**\n+ * APIMethod: getTileBounds\n+ * Returns The tile bounds for a layer given a pixel location.\n+ *\n+ * Parameters:\n+ * viewPortPx - {} The location in the viewport.\n+ *\n+ * Returns:\n+ * {} Bounds of the tile at the given pixel location.\n+ */\n+ getTileBounds: function(viewPortPx) {\n+ var maxExtent = this.maxExtent;\n+ var resolution = this.getResolution();\n+ var tileMapWidth = resolution * this.tileSize.w;\n+ var tileMapHeight = resolution * this.tileSize.h;\n+ var mapPoint = this.getLonLatFromViewPortPx(viewPortPx);\n+ var tileLeft = maxExtent.left + (tileMapWidth *\n+ Math.floor((mapPoint.lon -\n+ maxExtent.left) /\n+ tileMapWidth));\n+ var tileBottom = maxExtent.bottom + (tileMapHeight *\n+ Math.floor((mapPoint.lat -\n+ maxExtent.bottom) /\n+ tileMapHeight));\n+ return new OpenLayers.Bounds(tileLeft, tileBottom,\n+ tileLeft + tileMapWidth,\n+ tileBottom + tileMapHeight);\n+ },\n+\n+ CLASS_NAME: \"OpenLayers.Layer.Grid\"\n+});\n+/* ======================================================================\n+ OpenLayers/TileManager.js\n+ ====================================================================== */\n+\n+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n+ * full list of contributors). Published under the 2-clause BSD license.\n+ * See license.txt in the OpenLayers distribution or repository for the\n+ * full text of the license. */\n+\n+\n+/**\n+ * @requires OpenLayers/Util.js\n+ * @requires OpenLayers/BaseTypes.js\n+ * @requires OpenLayers/BaseTypes/Element.js\n+ * @requires OpenLayers/Layer/Grid.js\n+ * @requires OpenLayers/Tile/Image.js\n+ */\n+\n+/**\n+ * Class: OpenLayers.TileManager\n+ * Provides queueing of image requests and caching of image elements.\n+ *\n+ * Queueing avoids unnecessary image requests while changing zoom levels\n+ * quickly, and helps improve dragging performance on mobile devices that show\n+ * a lag in dragging when loading of new images starts. and\n+ * are the configuration options to control this behavior.\n+ *\n+ * Caching avoids setting the src on image elements for images that have already\n+ * been used. Several maps can share a TileManager instance, in which case each\n+ * map gets its own tile queue, but all maps share the same tile cache.\n+ */\n+OpenLayers.TileManager = OpenLayers.Class({\n+\n+ /**\n+ * APIProperty: cacheSize\n+ * {Number} Number of image elements to keep referenced in this instance's\n+ * cache for fast reuse. Default is 256.\n+ */\n+ cacheSize: 256,\n+\n+ /**\n+ * APIProperty: tilesPerFrame\n+ * {Number} Number of queued tiles to load per frame (see ).\n+ * Default is 2.\n+ */\n+ tilesPerFrame: 2,\n+\n+ /**\n+ * APIProperty: frameDelay\n+ * {Number} Delay between tile loading frames (see ) in\n+ * milliseconds. Default is 16.\n+ */\n+ frameDelay: 16,\n+\n+ /**\n+ * APIProperty: moveDelay\n+ * {Number} Delay in milliseconds after a map's move event before loading\n+ * tiles. Default is 100.\n+ */\n+ moveDelay: 100,\n+\n+ /**\n+ * APIProperty: zoomDelay\n+ * {Number} Delay in milliseconds after a map's zoomend event before loading\n+ * tiles. Default is 200.\n+ */\n+ zoomDelay: 200,\n+\n+ /**\n+ * Property: maps\n+ * {Array()} The maps to manage tiles on.\n+ */\n+ maps: null,\n+\n+ /**\n+ * Property: tileQueueId\n+ * {Object} The ids of the loop, keyed by map id.\n+ */\n+ tileQueueId: null,\n+\n+ /**\n+ * Property: tileQueue\n+ * {Object(Array())} Tiles queued for drawing, keyed by\n+ * map id.\n+ */\n+ tileQueue: null,\n+\n+ /**\n+ * Property: tileCache\n+ * {Object} Cached image elements, keyed by URL.\n+ */\n+ tileCache: null,\n+\n+ /**\n+ * Property: tileCacheIndex\n+ * {Array(String)} URLs of cached tiles. First entry is the least recently\n+ * used.\n+ */\n+ tileCacheIndex: null,\n+\n+ /** \n+ * Constructor: OpenLayers.TileManager\n+ * Constructor for a new instance.\n+ * \n+ * Parameters:\n+ * options - {Object} Configuration for this instance.\n+ */\n+ initialize: function(options) {\n+ OpenLayers.Util.extend(this, options);\n+ this.maps = [];\n+ this.tileQueueId = {};\n+ this.tileQueue = {};\n+ this.tileCache = {};\n+ this.tileCacheIndex = [];\n+ },\n+\n+ /**\n+ * Method: addMap\n+ * Binds this instance to a map\n+ *\n+ * Parameters:\n+ * map - {}\n+ */\n+ addMap: function(map) {\n+ if (this._destroyed || !OpenLayers.Layer.Grid) {\n+ return;\n+ }\n+ this.maps.push(map);\n+ this.tileQueue[map.id] = [];\n+ for (var i = 0, ii = map.layers.length; i < ii; ++i) {\n+ this.addLayer({\n+ layer: map.layers[i]\n+ });\n+ }\n+ map.events.on({\n+ move: this.move,\n+ zoomend: this.zoomEnd,\n+ changelayer: this.changeLayer,\n+ addlayer: this.addLayer,\n+ preremovelayer: this.removeLayer,\n+ scope: this\n+ });\n+ },\n+\n+ /**\n+ * Method: removeMap\n+ * Unbinds this instance from a map\n+ *\n+ * Parameters:\n+ * map - {}\n+ */\n+ removeMap: function(map) {\n+ if (this._destroyed || !OpenLayers.Layer.Grid) {\n+ return;\n+ }\n+ window.clearTimeout(this.tileQueueId[map.id]);\n+ if (map.layers) {\n+ for (var i = 0, ii = map.layers.length; i < ii; ++i) {\n+ this.removeLayer({\n+ layer: map.layers[i]\n+ });\n+ }\n+ }\n+ if (map.events) {\n+ map.events.un({\n+ move: this.move,\n+ zoomend: this.zoomEnd,\n+ changelayer: this.changeLayer,\n+ addlayer: this.addLayer,\n+ preremovelayer: this.removeLayer,\n+ scope: this\n+ });\n+ }\n+ delete this.tileQueue[map.id];\n+ delete this.tileQueueId[map.id];\n+ OpenLayers.Util.removeItem(this.maps, map);\n+ },\n+\n+ /**\n+ * Method: move\n+ * Handles the map's move event\n+ *\n+ * Parameters:\n+ * evt - {Object} Listener argument\n+ */\n+ move: function(evt) {\n+ this.updateTimeout(evt.object, this.moveDelay, true);\n+ },\n+\n+ /**\n+ * Method: zoomEnd\n+ * Handles the map's zoomEnd event\n+ *\n+ * Parameters:\n+ * evt - {Object} Listener argument\n+ */\n+ zoomEnd: function(evt) {\n+ this.updateTimeout(evt.object, this.zoomDelay);\n+ },\n+\n+ /**\n+ * Method: changeLayer\n+ * Handles the map's changeLayer event\n+ *\n+ * Parameters:\n+ * evt - {Object} Listener argument\n+ */\n+ changeLayer: function(evt) {\n+ if (evt.property === 'visibility' || evt.property === 'params') {\n+ this.updateTimeout(evt.object, 0);\n+ }\n+ },\n+\n+ /**\n+ * Method: addLayer\n+ * Handles the map's addlayer event\n+ *\n+ * Parameters:\n+ * evt - {Object} The listener argument\n+ */\n+ addLayer: function(evt) {\n+ var layer = evt.layer;\n+ if (layer instanceof OpenLayers.Layer.Grid) {\n+ layer.events.on({\n+ addtile: this.addTile,\n+ retile: this.clearTileQueue,\n+ scope: this\n+ });\n+ var i, j, tile;\n+ for (i = layer.grid.length - 1; i >= 0; --i) {\n+ for (j = layer.grid[i].length - 1; j >= 0; --j) {\n+ tile = layer.grid[i][j];\n+ this.addTile({\n+ tile: tile\n+ });\n+ if (tile.url && !tile.imgDiv) {\n+ this.manageTileCache({\n+ object: tile\n+ });\n+ }\n+ }\n+ }\n+ }\n+ },\n+\n+ /**\n+ * Method: removeLayer\n+ * Handles the map's preremovelayer event\n+ *\n+ * Parameters:\n+ * evt - {Object} The listener argument\n+ */\n+ removeLayer: function(evt) {\n+ var layer = evt.layer;\n+ if (layer instanceof OpenLayers.Layer.Grid) {\n+ this.clearTileQueue({\n+ object: layer\n+ });\n+ if (layer.events) {\n+ layer.events.un({\n+ addtile: this.addTile,\n+ retile: this.clearTileQueue,\n+ scope: this\n+ });\n+ }\n+ if (layer.grid) {\n+ var i, j, tile;\n+ for (i = layer.grid.length - 1; i >= 0; --i) {\n+ for (j = layer.grid[i].length - 1; j >= 0; --j) {\n+ tile = layer.grid[i][j];\n+ this.unloadTile({\n+ object: tile\n+ });\n+ }\n+ }\n+ }\n+ }\n+ },\n+\n+ /**\n+ * Method: updateTimeout\n+ * Applies the or to the loop,\n+ * and schedules more queue processing after if there are still\n+ * tiles in the queue.\n+ *\n+ * Parameters:\n+ * map - {} The map to update the timeout for\n+ * delay - {Number} The delay to apply\n+ * nice - {Boolean} If true, the timeout function will only be created if\n+ * the tilequeue is not empty. This is used by the move handler to\n+ * avoid impacts on dragging performance. For other events, the tile\n+ * queue may not be populated yet, so we need to set the timer\n+ * regardless of the queue size.\n+ */\n+ updateTimeout: function(map, delay, nice) {\n+ window.clearTimeout(this.tileQueueId[map.id]);\n+ var tileQueue = this.tileQueue[map.id];\n+ if (!nice || tileQueue.length) {\n+ this.tileQueueId[map.id] = window.setTimeout(\n+ OpenLayers.Function.bind(function() {\n+ this.drawTilesFromQueue(map);\n+ if (tileQueue.length) {\n+ this.updateTimeout(map, this.frameDelay);\n+ }\n+ }, this), delay\n+ );\n+ }\n+ },\n+\n+ /**\n+ * Method: addTile\n+ * Listener for the layer's addtile event\n+ *\n+ * Parameters:\n+ * evt - {Object} The listener argument\n+ */\n+ addTile: function(evt) {\n+ if (evt.tile instanceof OpenLayers.Tile.Image) {\n+ evt.tile.events.on({\n+ beforedraw: this.queueTileDraw,\n+ beforeload: this.manageTileCache,\n+ loadend: this.addToCache,\n+ unload: this.unloadTile,\n+ scope: this\n+ });\n+ } else {\n+ // Layer has the wrong tile type, so don't handle it any longer\n+ this.removeLayer({\n+ layer: evt.tile.layer\n+ });\n+ }\n+ },\n+\n+ /**\n+ * Method: unloadTile\n+ * Listener for the tile's unload event\n+ *\n+ * Parameters:\n+ * evt - {Object} The listener argument\n+ */\n+ unloadTile: function(evt) {\n+ var tile = evt.object;\n+ tile.events.un({\n+ beforedraw: this.queueTileDraw,\n+ beforeload: this.manageTileCache,\n+ loadend: this.addToCache,\n+ unload: this.unloadTile,\n+ scope: this\n+ });\n+ OpenLayers.Util.removeItem(this.tileQueue[tile.layer.map.id], tile);\n+ },\n+\n+ /**\n+ * Method: queueTileDraw\n+ * Adds a tile to the queue that will draw it.\n+ *\n+ * Parameters:\n+ * evt - {Object} Listener argument of the tile's beforedraw event\n+ */\n+ queueTileDraw: function(evt) {\n+ var tile = evt.object;\n+ var queued = false;\n+ var layer = tile.layer;\n+ var url = layer.getURL(tile.bounds);\n+ var img = this.tileCache[url];\n+ if (img && img.className !== 'olTileImage') {\n+ // cached image no longer valid, e.g. because we're olTileReplacing\n+ delete this.tileCache[url];\n+ OpenLayers.Util.removeItem(this.tileCacheIndex, url);\n+ img = null;\n+ }\n+ // queue only if image with same url not cached already\n+ if (layer.url && (layer.async || !img)) {\n+ // add to queue only if not in queue already\n+ var tileQueue = this.tileQueue[layer.map.id];\n+ if (!~OpenLayers.Util.indexOf(tileQueue, tile)) {\n+ tileQueue.push(tile);\n+ }\n+ queued = true;\n+ }\n+ return !queued;\n+ },\n+\n+ /**\n+ * Method: drawTilesFromQueue\n+ * Draws tiles from the tileQueue, and unqueues the tiles\n+ */\n+ drawTilesFromQueue: function(map) {\n+ var tileQueue = this.tileQueue[map.id];\n+ var limit = this.tilesPerFrame;\n+ var animating = map.zoomTween && map.zoomTween.playing;\n+ while (!animating && tileQueue.length && limit) {\n+ tileQueue.shift().draw(true);\n+ --limit;\n+ }\n+ },\n+\n+ /**\n+ * Method: manageTileCache\n+ * Adds, updates, removes and fetches cache entries.\n+ *\n+ * Parameters:\n+ * evt - {Object} Listener argument of the tile's beforeload event\n+ */\n+ manageTileCache: function(evt) {\n+ var tile = evt.object;\n+ var img = this.tileCache[tile.url];\n+ if (img) {\n+ // if image is on its layer's backbuffer, remove it from backbuffer\n+ if (img.parentNode &&\n+ OpenLayers.Element.hasClass(img.parentNode, 'olBackBuffer')) {\n+ img.parentNode.removeChild(img);\n+ img.id = null;\n+ }\n+ // only use image from cache if it is not on a layer already\n+ if (!img.parentNode) {\n+ img.style.visibility = 'hidden';\n+ img.style.opacity = 0;\n+ tile.setImage(img);\n+ // LRU - move tile to the end of the array to mark it as the most\n+ // recently used\n+ OpenLayers.Util.removeItem(this.tileCacheIndex, tile.url);\n+ this.tileCacheIndex.push(tile.url);\n+ }\n+ }\n+ },\n+\n+ /**\n+ * Method: addToCache\n+ *\n+ * Parameters:\n+ * evt - {Object} Listener argument for the tile's loadend event\n+ */\n+ addToCache: function(evt) {\n+ var tile = evt.object;\n+ if (!this.tileCache[tile.url]) {\n+ if (!OpenLayers.Element.hasClass(tile.imgDiv, 'olImageLoadError')) {\n+ if (this.tileCacheIndex.length >= this.cacheSize) {\n+ delete this.tileCache[this.tileCacheIndex[0]];\n+ this.tileCacheIndex.shift();\n+ }\n+ this.tileCache[tile.url] = tile.imgDiv;\n+ this.tileCacheIndex.push(tile.url);\n+ }\n+ }\n+ },\n+\n+ /**\n+ * Method: clearTileQueue\n+ * Clears the tile queue from tiles of a specific layer\n+ *\n+ * Parameters:\n+ * evt - {Object} Listener argument of the layer's retile event\n+ */\n+ clearTileQueue: function(evt) {\n+ var layer = evt.object;\n+ var tileQueue = this.tileQueue[layer.map.id];\n+ for (var i = tileQueue.length - 1; i >= 0; --i) {\n+ if (tileQueue[i].layer === layer) {\n+ tileQueue.splice(i, 1);\n+ }\n+ }\n+ },\n+\n+ /**\n+ * Method: destroy\n+ */\n+ destroy: function() {\n+ for (var i = this.maps.length - 1; i >= 0; --i) {\n+ this.removeMap(this.maps[i]);\n+ }\n+ this.maps = null;\n+ this.tileQueue = null;\n+ this.tileQueueId = null;\n+ this.tileCache = null;\n+ this.tileCacheIndex = null;\n+ this._destroyed = true;\n+ }\n+\n+});\n+/* ======================================================================\n+ OpenLayers/Format/WPSDescribeProcess.js\n+ ====================================================================== */\n+\n+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n+ * full list of contributors). Published under the 2-clause BSD license.\n+ * See license.txt in the OpenLayers distribution or repository for the\n+ * full text of the license. */\n+\n+/**\n+ * @requires OpenLayers/Format/XML.js\n+ * @requires OpenLayers/Format/OWSCommon/v1_1_0.js\n+ */\n+\n+/**\n+ * Class: OpenLayers.Format.WPSDescribeProcess\n+ * Read WPS DescribeProcess responses. \n+ *\n+ * Inherits from:\n+ * - \n+ */\n+OpenLayers.Format.WPSDescribeProcess = OpenLayers.Class(\n+ OpenLayers.Format.XML, {\n+\n+ /**\n+ * Constant: VERSION\n+ * {String} 1.0.0\n+ */\n+ VERSION: \"1.0.0\",\n+\n+ /**\n+ * Property: namespaces\n+ * {Object} Mapping of namespace aliases to namespace URIs.\n+ */\n+ namespaces: {\n+ wps: \"http://www.opengis.net/wps/1.0.0\",\n+ ows: \"http://www.opengis.net/ows/1.1\",\n+ xsi: \"http://www.w3.org/2001/XMLSchema-instance\"\n+ },\n+\n+ /**\n+ * Property: schemaLocation\n+ * {String} Schema location\n+ */\n+ schemaLocation: \"http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd\",\n+\n+ /**\n+ * Property: defaultPrefix\n+ */\n+ defaultPrefix: \"wps\",\n+\n+ /**\n+ * Property: regExes\n+ * Compiled regular expressions for manipulating strings.\n+ */\n+ regExes: {\n+ trimSpace: (/^\\s*|\\s*$/g),\n+ removeSpace: (/\\s*/g),\n+ splitSpace: (/\\s+/),\n+ trimComma: (/\\s*,\\s*/g)\n+ },\n+\n+ /**\n+ * Constructor: OpenLayers.Format.WPSDescribeProcess\n+ *\n+ * Parameters:\n+ * options - {Object} An optional object whose properties will be set on\n+ * this instance.\n+ */\n+\n+ /**\n+ * APIMethod: read\n+ * Parse a WPS DescribeProcess and return an object with its information.\n+ * \n+ * Parameters: \n+ * data - {String} or {DOMElement} data to read/parse.\n+ *\n+ * Returns:\n+ * {Object}\n+ */\n+ read: function(data) {\n+ if (typeof data == \"string\") {\n+ data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);\n+ }\n+ if (data && data.nodeType == 9) {\n+ data = data.documentElement;\n+ }\n+ var info = {};\n+ this.readNode(data, info);\n+ return info;\n+ },\n+\n+ /**\n+ * Property: readers\n+ * Contains public functions, grouped by namespace prefix, that will\n+ * be applied when a namespaced node is found matching the function\n+ * name. The function will be applied in the scope of this parser\n+ * with two arguments: the node being read and a context object passed\n+ * from the parent.\n+ */\n+ readers: {\n+ \"wps\": {\n+ \"ProcessDescriptions\": function(node, obj) {\n+ obj.processDescriptions = {};\n+ this.readChildNodes(node, obj.processDescriptions);\n+ },\n+ \"ProcessDescription\": function(node, processDescriptions) {\n+ var processVersion = this.getAttributeNS(node, this.namespaces.wps, \"processVersion\");\n+ var processDescription = {\n+ processVersion: processVersion,\n+ statusSupported: (node.getAttribute(\"statusSupported\") === \"true\"),\n+ storeSupported: (node.getAttribute(\"storeSupported\") === \"true\")\n+ };\n+ this.readChildNodes(node, processDescription);\n+ processDescriptions[processDescription.identifier] = processDescription;\n+ },\n+ \"DataInputs\": function(node, processDescription) {\n+ processDescription.dataInputs = [];\n+ this.readChildNodes(node, processDescription.dataInputs);\n+ },\n+ \"ProcessOutputs\": function(node, processDescription) {\n+ processDescription.processOutputs = [];\n+ this.readChildNodes(node, processDescription.processOutputs);\n+ },\n+ \"Output\": function(node, processOutputs) {\n+ var output = {};\n+ this.readChildNodes(node, output);\n+ processOutputs.push(output);\n+ },\n+ \"ComplexOutput\": function(node, output) {\n+ output.complexOutput = {};\n+ this.readChildNodes(node, output.complexOutput);\n+ },\n+ \"LiteralOutput\": function(node, output) {\n+ output.literalOutput = {};\n+ this.readChildNodes(node, output.literalOutput);\n+ },\n+ \"Input\": function(node, dataInputs) {\n+ var input = {\n+ maxOccurs: parseInt(node.getAttribute(\"maxOccurs\")),\n+ minOccurs: parseInt(node.getAttribute(\"minOccurs\"))\n+ };\n+ this.readChildNodes(node, input);\n+ dataInputs.push(input);\n+ },\n+ \"BoundingBoxData\": function(node, input) {\n+ input.boundingBoxData = {};\n+ this.readChildNodes(node, input.boundingBoxData);\n+ },\n+ \"CRS\": function(node, obj) {\n+ if (!obj.CRSs) {\n+ obj.CRSs = {};\n+ }\n+ obj.CRSs[this.getChildValue(node)] = true;\n+ },\n+ \"LiteralData\": function(node, input) {\n+ input.literalData = {};\n+ this.readChildNodes(node, input.literalData);\n+ },\n+ \"ComplexData\": function(node, input) {\n+ input.complexData = {};\n+ this.readChildNodes(node, input.complexData);\n+ },\n+ \"Default\": function(node, complexData) {\n+ complexData[\"default\"] = {};\n+ this.readChildNodes(node, complexData[\"default\"]);\n+ },\n+ \"Supported\": function(node, complexData) {\n+ complexData[\"supported\"] = {};\n+ this.readChildNodes(node, complexData[\"supported\"]);\n+ },\n+ \"Format\": function(node, obj) {\n+ var format = {};\n+ this.readChildNodes(node, format);\n+ if (!obj.formats) {\n+ obj.formats = {};\n+ }\n+ obj.formats[format.mimeType] = true;\n+ },\n+ \"MimeType\": function(node, format) {\n+ format.mimeType = this.getChildValue(node);\n+ }\n+ },\n+ \"ows\": OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers[\"ows\"]\n+ },\n+\n+ CLASS_NAME: \"OpenLayers.Format.WPSDescribeProcess\"\n+\n+ });\n+/* ======================================================================\n+ OpenLayers/WPSClient.js\n+ ====================================================================== */\n+\n+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n+ * full list of contributors). Published under the 2-clause BSD license.\n+ * See license.txt in the OpenLayers distribution or repository for the\n+ * full text of the license. */\n+\n+/**\n+ * @requires OpenLayers/SingleFile.js\n+ */\n+\n+/**\n+ * @requires OpenLayers/Events.js\n+ * @requires OpenLayers/WPSProcess.js\n+ * @requires OpenLayers/Format/WPSDescribeProcess.js\n+ * @requires OpenLayers/Request.js\n+ */\n+\n+/**\n+ * Class: OpenLayers.WPSClient\n+ * High level API for interaction with Web Processing Services (WPS).\n+ * An instance is used to create \n+ * instances for servers known to the WPSClient. The WPSClient also caches\n+ * DescribeProcess responses to reduce the number of requests sent to servers\n+ * when processes are created.\n+ */\n+OpenLayers.WPSClient = OpenLayers.Class({\n+\n+ /**\n+ * Property: servers\n+ * {Object} Service metadata, keyed by a local identifier.\n+ *\n+ * Properties:\n+ * url - {String} the url of the server\n+ * version - {String} WPS version of the server\n+ * processDescription - {Object} Cache of raw DescribeProcess\n+ * responses, keyed by process identifier.\n+ */\n+ servers: null,\n+\n+ /**\n+ * Property: version\n+ * {String} The default WPS version to use if none is configured. Default\n+ * is '1.0.0'.\n+ */\n+ version: '1.0.0',\n+\n+ /**\n+ * Property: lazy\n+ * {Boolean} Should the DescribeProcess be deferred until a process is\n+ * fully configured? Default is false.\n+ */\n+ lazy: false,\n+\n+ /**\n+ * Property: events\n+ * {}\n+ *\n+ * Supported event types:\n+ * describeprocess - Fires when the process description is available.\n+ * Listeners receive an object with a 'raw' property holding the raw\n+ * DescribeProcess response, and an 'identifier' property holding the\n+ * process identifier of the described process.\n+ */\n+ events: null,\n+\n+ /**\n+ * Constructor: OpenLayers.WPSClient\n+ *\n+ * Parameters:\n+ * options - {Object} Object whose properties will be set on the instance.\n+ *\n+ * Avaliable options:\n+ * servers - {Object} Mandatory. Service metadata, keyed by a local\n+ * identifier. Can either be a string with the service url or an\n+ * object literal with additional metadata:\n+ *\n+ * (code)\n+ * servers: {\n+ * local: '/geoserver/wps'\n+ * }, {\n+ * opengeo: {\n+ * url: 'http://demo.opengeo.org/geoserver/wps',\n+ * version: '1.0.0'\n+ * }\n+ * }\n+ * (end)\n+ *\n+ * lazy - {Boolean} Optional. Set to true if DescribeProcess should not be\n+ * requested until a process is fully configured. Default is false.\n+ */\n+ initialize: function(options) {\n+ OpenLayers.Util.extend(this, options);\n+ this.events = new OpenLayers.Events(this);\n+ this.servers = {};\n+ for (var s in options.servers) {\n+ this.servers[s] = typeof options.servers[s] == 'string' ? {\n+ url: options.servers[s],\n+ version: this.version,\n+ processDescription: {}\n+ } : options.servers[s];\n+ }\n+ },\n+\n+ /**\n+ * APIMethod: execute\n+ * Shortcut to execute a process with a single function call. This is\n+ * equivalent to using and then calling execute on the\n+ * process.\n+ *\n+ * Parameters:\n+ * options - {Object} Options for the execute operation.\n+ *\n+ * Available options:\n+ * server - {String} Mandatory. One of the local identifiers of the\n+ * configured servers.\n+ * process - {String} Mandatory. A process identifier known to the\n+ * server.\n+ * inputs - {Object} The inputs for the process, keyed by input identifier.\n+ * For spatial data inputs, the value of an input is usually an\n+ * , an or an array of\n+ * geometries or features.\n+ * output - {String} The identifier of an output to parse. Optional. If not\n+ * provided, the first output will be parsed.\n+ * success - {Function} Callback to call when the process is complete.\n+ * This function is called with an outputs object as argument, which\n+ * will have a property with the identifier of the requested output\n+ * (e.g. 'result'). For processes that generate spatial output, the\n+ * value will either be a single or an\n+ * array of features.\n+ * scope - {Object} Optional scope for the success callback.\n+ */\n+ execute: function(options) {\n+ var process = this.getProcess(options.server, options.process);\n+ process.execute({\n+ inputs: options.inputs,\n+ success: options.success,\n+ scope: options.scope\n+ });\n+ },\n+\n+ /**\n+ * APIMethod: getProcess\n+ * Creates an .\n+ *\n+ * Parameters:\n+ * serverID - {String} Local identifier from the servers that this instance\n+ * was constructed with.\n+ * processID - {String} Process identifier known to the server.\n+ *\n+ * Returns:\n+ * {}\n+ */\n+ getProcess: function(serverID, processID) {\n+ var process = new OpenLayers.WPSProcess({\n+ client: this,\n+ server: serverID,\n+ identifier: processID\n+ });\n+ if (!this.lazy) {\n+ process.describe();\n+ }\n+ return process;\n+ },\n+\n+ /**\n+ * Method: describeProcess\n+ *\n+ * Parameters:\n+ * serverID - {String} Identifier of the server\n+ * processID - {String} Identifier of the requested process\n+ * callback - {Function} Callback to call when the description is available\n+ * scope - {Object} Optional execution scope for the callback function\n+ */\n+ describeProcess: function(serverID, processID, callback, scope) {\n+ var server = this.servers[serverID];\n+ if (!server.processDescription[processID]) {\n+ if (!(processID in server.processDescription)) {\n+ // set to null so we know a describeFeature request is pending\n+ server.processDescription[processID] = null;\n+ OpenLayers.Request.GET({\n+ url: server.url,\n+ params: {\n+ SERVICE: 'WPS',\n+ VERSION: server.version,\n+ REQUEST: 'DescribeProcess',\n+ IDENTIFIER: processID\n+ },\n+ success: function(response) {\n+ server.processDescription[processID] = response.responseText;\n+ this.events.triggerEvent('describeprocess', {\n+ identifier: processID,\n+ raw: response.responseText\n+ });\n+ },\n+ scope: this\n+ });\n+ } else {\n+ // pending request\n+ this.events.register('describeprocess', this, function describe(evt) {\n+ if (evt.identifier === processID) {\n+ this.events.unregister('describeprocess', this, describe);\n+ callback.call(scope, evt.raw);\n+ }\n+ });\n+ }\n+ } else {\n+ window.setTimeout(function() {\n+ callback.call(scope, server.processDescription[processID]);\n+ }, 0);\n+ }\n+ },\n+\n+ /**\n+ * Method: destroy\n+ */\n+ destroy: function() {\n+ this.events.destroy();\n+ this.events = null;\n+ this.servers = null;\n+ },\n+\n+ CLASS_NAME: 'OpenLayers.WPSClient'\n+\n+});\n+/* ======================================================================\n+ OpenLayers/Control.js\n+ ====================================================================== */\n+\n+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n+ * full list of contributors). Published under the 2-clause BSD license.\n+ * See license.txt in the OpenLayers distribution or repository for the\n+ * full text of the license. */\n+\n+/**\n+ * @requires OpenLayers/BaseTypes/Class.js\n+ */\n+\n+/**\n+ * Class: OpenLayers.Control\n+ * Controls affect the display or behavior of the map. They allow everything\n+ * from panning and zooming to displaying a scale indicator. Controls by \n+ * default are added to the map they are contained within however it is\n+ * possible to add a control to an external div by passing the div in the\n+ * options parameter.\n+ * \n+ * Example:\n+ * The following example shows how to add many of the common controls\n+ * to a map.\n+ * \n+ * > var map = new OpenLayers.Map('map', { controls: [] });\n+ * >\n+ * > map.addControl(new OpenLayers.Control.PanZoomBar());\n+ * > map.addControl(new OpenLayers.Control.LayerSwitcher({'ascending':false}));\n+ * > map.addControl(new OpenLayers.Control.Permalink());\n+ * > map.addControl(new OpenLayers.Control.Permalink('permalink'));\n+ * > map.addControl(new OpenLayers.Control.MousePosition());\n+ * > map.addControl(new OpenLayers.Control.OverviewMap());\n+ * > map.addControl(new OpenLayers.Control.KeyboardDefaults());\n+ *\n+ * The next code fragment is a quick example of how to intercept \n+ * shift-mouse click to display the extent of the bounding box\n+ * dragged out by the user. Usually controls are not created\n+ * in exactly this manner. See the source for a more complete \n+ * example:\n+ *\n+ * > var control = new OpenLayers.Control();\n+ * > OpenLayers.Util.extend(control, {\n+ * > draw: function () {\n+ * > // this Handler.Box will intercept the shift-mousedown\n+ * > // before Control.MouseDefault gets to see it\n+ * > this.box = new OpenLayers.Handler.Box( control, \n+ * > {\"done\": this.notice},\n+ * > {keyMask: OpenLayers.Handler.MOD_SHIFT});\n+ * > this.box.activate();\n+ * > },\n+ * >\n+ * > notice: function (bounds) {\n+ * > OpenLayers.Console.userError(bounds);\n+ * > }\n+ * > }); \n+ * > map.addControl(control);\n+ * \n+ */\n+OpenLayers.Control = OpenLayers.Class({\n+\n+ /** \n+ * Property: id \n+ * {String} \n+ */\n+ id: null,\n+\n+ /** \n+ * Property: map \n+ * {} this gets set in the addControl() function in\n+ * OpenLayers.Map \n+ */\n+ map: null,\n+\n+ /** \n+ * APIProperty: div \n+ * {DOMElement} The element that contains the control, if not present the \n+ * control is placed inside the map.\n+ */\n+ div: null,\n+\n+ /** \n+ * APIProperty: type \n+ * {Number} Controls can have a 'type'. The type determines the type of\n+ * interactions which are possible with them when they are placed in an\n+ * . \n+ */\n+ type: null,\n+\n+ /** \n+ * Property: allowSelection\n+ * {Boolean} By default, controls do not allow selection, because\n+ * it may interfere with map dragging. If this is true, OpenLayers\n+ * will not prevent selection of the control.\n+ * Default is false.\n+ */\n+ allowSelection: false,\n+\n+ /** \n+ * Property: displayClass \n+ * {string} This property is used for CSS related to the drawing of the\n+ * Control. \n+ */\n+ displayClass: \"\",\n+\n+ /**\n+ * APIProperty: title \n+ * {string} This property is used for showing a tooltip over the \n+ * Control. \n+ */\n+ title: \"\",\n+\n+ /**\n+ * APIProperty: autoActivate\n+ * {Boolean} Activate the control when it is added to a map. Default is\n+ * false.\n+ */\n+ autoActivate: false,\n+\n+ /** \n+ * APIProperty: active \n+ * {Boolean} The control is active (read-only). Use and \n+ * to change control state.\n+ */\n+ active: null,\n+\n+ /**\n+ * Property: handlerOptions\n+ * {Object} Used to set non-default properties on the control's handler\n+ */\n+ handlerOptions: null,\n+\n+ /** \n+ * Property: handler \n+ * {} null\n+ */\n+ handler: null,\n+\n+ /**\n+ * APIProperty: eventListeners\n+ * {Object} If set as an option at construction, the eventListeners\n+ * object will be registered with . Object\n+ * structure must be a listeners object as shown in the example for\n+ * the events.on method.\n+ */\n+ eventListeners: null,\n+\n+ /** \n+ * APIProperty: events\n+ * {} Events instance for listeners and triggering\n+ * control specific events.\n+ *\n+ * Register a listener for a particular event with the following syntax:\n+ * (code)\n+ * control.events.register(type, obj, listener);\n+ * (end)\n+ *\n+ * Listeners will be called with a reference to an event object. The\n+ * properties of this event depends on exactly what happened.\n+ *\n+ * All event objects have at least the following properties:\n+ * object - {Object} A reference to control.events.object (a reference\n+ * to the control).\n+ * element - {DOMElement} A reference to control.events.element (which\n+ * will be null unless documented otherwise).\n+ *\n+ * Supported map event types:\n+ * activate - Triggered when activated.\n+ * deactivate - Triggered when deactivated.\n+ */\n+ events: null,\n+\n+ /**\n+ * Constructor: OpenLayers.Control\n+ * Create an OpenLayers Control. The options passed as a parameter\n+ * directly extend the control. For example passing the following:\n+ * \n+ * > var control = new OpenLayers.Control({div: myDiv});\n+ *\n+ * Overrides the default div attribute value of null.\n+ * \n+ * Parameters:\n+ * options - {Object} \n+ */\n+ initialize: function(options) {\n+ // We do this before the extend so that instances can override\n+ // className in options.\n+ this.displayClass =\n+ this.CLASS_NAME.replace(\"OpenLayers.\", \"ol\").replace(/\\./g, \"\");\n+\n+ OpenLayers.Util.extend(this, options);\n+\n+ this.events = new OpenLayers.Events(this);\n+ if (this.eventListeners instanceof Object) {\n+ this.events.on(this.eventListeners);\n+ }\n+ if (this.id == null) {\n+ this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + \"_\");\n+ }\n+ },\n+\n+ /**\n+ * Method: destroy\n+ * The destroy method is used to perform any clean up before the control\n+ * is dereferenced. Typically this is where event listeners are removed\n+ * to prevent memory leaks.\n+ */\n+ destroy: function() {\n+ if (this.events) {\n+ if (this.eventListeners) {\n+ this.events.un(this.eventListeners);\n+ }\n+ this.events.destroy();\n+ this.events = null;\n+ }\n+ this.eventListeners = null;\n+\n+ // eliminate circular references\n+ if (this.handler) {\n+ this.handler.destroy();\n+ this.handler = null;\n+ }\n+ if (this.handlers) {\n+ for (var key in this.handlers) {\n+ if (this.handlers.hasOwnProperty(key) &&\n+ typeof this.handlers[key].destroy == \"function\") {\n+ this.handlers[key].destroy();\n+ }\n+ }\n+ this.handlers = null;\n+ }\n+ if (this.map) {\n+ this.map.removeControl(this);\n+ this.map = null;\n+ }\n+ this.div = null;\n+ },\n+\n+ /** \n+ * Method: setMap\n+ * Set the map property for the control. This is done through an accessor\n+ * so that subclasses can override this and take special action once \n+ * they have their map variable set. \n+ *\n+ * Parameters:\n+ * map - {} \n+ */\n+ setMap: function(map) {\n+ this.map = map;\n+ if (this.handler) {\n+ this.handler.setMap(map);\n+ }\n+ },\n+\n+ /**\n+ * Method: draw\n+ * The draw method is called when the control is ready to be displayed\n+ * on the page. If a div has not been created one is created. Controls\n+ * with a visual component will almost always want to override this method \n+ * to customize the look of control. \n+ *\n+ * Parameters:\n+ * px - {} The top-left pixel position of the control\n+ * or null.\n+ *\n+ * Returns:\n+ * {DOMElement} A reference to the DIV DOMElement containing the control\n+ */\n+ draw: function(px) {\n+ if (this.div == null) {\n+ this.div = OpenLayers.Util.createDiv(this.id);\n+ this.div.className = this.displayClass;\n+ if (!this.allowSelection) {\n+ this.div.className += \" olControlNoSelect\";\n+ this.div.setAttribute(\"unselectable\", \"on\", 0);\n+ this.div.onselectstart = OpenLayers.Function.False;\n+ }\n+ if (this.title != \"\") {\n+ this.div.title = this.title;\n+ }\n+ }\n+ if (px != null) {\n+ this.position = px.clone();\n+ }\n+ this.moveTo(this.position);\n+ return this.div;\n+ },\n+\n+ /**\n+ * Method: moveTo\n+ * Sets the left and top style attributes to the passed in pixel \n+ * coordinates.\n+ *\n+ * Parameters:\n+ * px - {}\n+ */\n+ moveTo: function(px) {\n+ if ((px != null) && (this.div != null)) {\n+ this.div.style.left = px.x + \"px\";\n+ this.div.style.top = px.y + \"px\";\n+ }\n+ },\n+\n+ /**\n+ * APIMethod: activate\n+ * Explicitly activates a control and it's associated\n+ * handler if one has been set. Controls can be\n+ * deactivated by calling the deactivate() method.\n+ * \n+ * Returns:\n+ * {Boolean} True if the control was successfully activated or\n+ * false if the control was already active.\n+ */\n+ activate: function() {\n+ if (this.active) {\n+ return false;\n+ }\n+ if (this.handler) {\n+ this.handler.activate();\n+ }\n+ this.active = true;\n+ if (this.map) {\n+ OpenLayers.Element.addClass(\n+ this.map.viewPortDiv,\n+ this.displayClass.replace(/ /g, \"\") + \"Active\"\n+ );\n+ }\n+ this.events.triggerEvent(\"activate\");\n+ return true;\n+ },\n+\n+ /**\n+ * APIMethod: deactivate\n+ * Deactivates a control and it's associated handler if any. The exact\n+ * effect of this depends on the control itself.\n+ * \n+ * Returns:\n+ * {Boolean} True if the control was effectively deactivated or false\n+ * if the control was already inactive.\n+ */\n+ deactivate: function() {\n+ if (this.active) {\n+ if (this.handler) {\n+ this.handler.deactivate();\n+ }\n+ this.active = false;\n+ if (this.map) {\n+ OpenLayers.Element.removeClass(\n+ this.map.viewPortDiv,\n+ this.displayClass.replace(/ /g, \"\") + \"Active\"\n+ );\n+ }\n+ this.events.triggerEvent(\"deactivate\");\n+ return true;\n+ }\n+ return false;\n+ },\n+\n+ CLASS_NAME: \"OpenLayers.Control\"\n+});\n+\n+/**\n+ * Constant: OpenLayers.Control.TYPE_BUTTON\n+ */\n+OpenLayers.Control.TYPE_BUTTON = 1;\n+\n+/**\n+ * Constant: OpenLayers.Control.TYPE_TOGGLE\n+ */\n+OpenLayers.Control.TYPE_TOGGLE = 2;\n+\n+/**\n+ * Constant: OpenLayers.Control.TYPE_TOOL\n+ */\n+OpenLayers.Control.TYPE_TOOL = 3;\n+/* ======================================================================\n+ OpenLayers/Handler.js\n+ ====================================================================== */\n+\n+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n+ * full list of contributors). Published under the 2-clause BSD license.\n+ * See license.txt in the OpenLayers distribution or repository for the\n+ * full text of the license. */\n+\n+/**\n+ * @requires OpenLayers/BaseTypes/Class.js\n+ * @requires OpenLayers/Events.js\n+ */\n+\n+/**\n+ * Class: OpenLayers.Handler\n+ * Base class to construct a higher-level handler for event sequences. All\n+ * handlers have activate and deactivate methods. In addition, they have\n+ * methods named like browser events. When a handler is activated, any\n+ * additional methods named like a browser event is registered as a\n+ * listener for the corresponding event. When a handler is deactivated,\n+ * those same methods are unregistered as event listeners.\n+ *\n+ * Handlers also typically have a callbacks object with keys named like\n+ * the abstracted events or event sequences that they are in charge of\n+ * handling. The controls that wrap handlers define the methods that\n+ * correspond to these abstract events - so instead of listening for\n+ * individual browser events, they only listen for the abstract events\n+ * defined by the handler.\n+ * \n+ * Handlers are created by controls, which ultimately have the responsibility\n+ * of making changes to the the state of the application. Handlers\n+ * themselves may make temporary changes, but in general are expected to\n+ * return the application in the same state that they found it.\n+ */\n+OpenLayers.Handler = OpenLayers.Class({\n+\n+ /**\n+ * Property: id\n+ * {String}\n+ */\n+ id: null,\n+\n+ /**\n+ * APIProperty: control\n+ * {}. The control that initialized this handler. The\n+ * control is assumed to have a valid map property - that map is used\n+ * in the handler's own setMap method.\n+ */\n+ control: null,\n+\n+ /**\n+ * Property: map\n+ * {}\n+ */\n+ map: null,\n+\n+ /**\n+ * APIProperty: keyMask\n+ * {Integer} Use bitwise operators and one or more of the OpenLayers.Handler\n+ * constants to construct a keyMask. The keyMask is used by\n+ * . If the keyMask matches the combination of keys\n+ * down on an event, checkModifiers returns true.\n+ *\n+ * Example:\n+ * (code)\n+ * // handler only responds if the Shift key is down\n+ * handler.keyMask = OpenLayers.Handler.MOD_SHIFT;\n+ *\n+ * // handler only responds if Ctrl-Shift is down\n+ * handler.keyMask = OpenLayers.Handler.MOD_SHIFT |\n+ * OpenLayers.Handler.MOD_CTRL;\n+ * (end)\n+ */\n+ keyMask: null,\n+\n+ /**\n+ * Property: active\n+ * {Boolean}\n+ */\n+ active: false,\n+\n+ /**\n+ * Property: evt\n+ * {Event} This property references the last event handled by the handler.\n+ * Note that this property is not part of the stable API. Use of the\n+ * evt property should be restricted to controls in the library\n+ * or other applications that are willing to update with changes to\n+ * the OpenLayers code.\n+ */\n+ evt: null,\n+\n+ /**\n+ * Property: touch\n+ * {Boolean} Indicates the support of touch events. When touch events are \n+ * started touch will be true and all mouse related listeners will do \n+ * nothing.\n+ */\n+ touch: false,\n+\n+ /**\n+ * Constructor: OpenLayers.Handler\n+ * Construct a handler.\n+ *\n+ * Parameters:\n+ * control - {} The control that initialized this\n+ * handler. The control is assumed to have a valid map property; that\n+ * map is used in the handler's own setMap method. If a map property\n+ * is present in the options argument it will be used instead.\n+ * callbacks - {Object} An object whose properties correspond to abstracted\n+ * events or sequences of browser events. The values for these\n+ * properties are functions defined by the control that get called by\n+ * the handler.\n+ * options - {Object} An optional object whose properties will be set on\n+ * the handler.\n+ */\n+ initialize: function(control, callbacks, options) {\n+ OpenLayers.Util.extend(this, options);\n+ this.control = control;\n+ this.callbacks = callbacks;\n+\n+ var map = this.map || control.map;\n+ if (map) {\n+ this.setMap(map);\n+ }\n+\n+ this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + \"_\");\n+ },\n+\n+ /**\n+ * Method: setMap\n+ */\n+ setMap: function(map) {\n+ this.map = map;\n+ },\n+\n+ /**\n+ * Method: checkModifiers\n+ * Check the keyMask on the handler. If no is set, this always\n+ * returns true. If a is set and it matches the combination\n+ * of keys down on an event, this returns true.\n+ *\n+ * Returns:\n+ * {Boolean} The keyMask matches the keys down on an event.\n+ */\n+ checkModifiers: function(evt) {\n+ if (this.keyMask == null) {\n+ return true;\n+ }\n+ /* calculate the keyboard modifier mask for this event */\n+ var keyModifiers =\n+ (evt.shiftKey ? OpenLayers.Handler.MOD_SHIFT : 0) |\n+ (evt.ctrlKey ? OpenLayers.Handler.MOD_CTRL : 0) |\n+ (evt.altKey ? OpenLayers.Handler.MOD_ALT : 0) |\n+ (evt.metaKey ? OpenLayers.Handler.MOD_META : 0);\n+\n+ /* if it differs from the handler object's key mask,\n+ bail out of the event handler */\n+ return (keyModifiers == this.keyMask);\n+ },\n+\n+ /**\n+ * APIMethod: activate\n+ * Turn on the handler. Returns false if the handler was already active.\n+ * \n+ * Returns: \n+ * {Boolean} The handler was activated.\n+ */\n+ activate: function() {\n+ if (this.active) {\n+ return false;\n+ }\n+ // register for event handlers defined on this class.\n+ var events = OpenLayers.Events.prototype.BROWSER_EVENTS;\n+ for (var i = 0, len = events.length; i < len; i++) {\n+ if (this[events[i]]) {\n+ this.register(events[i], this[events[i]]);\n+ }\n+ }\n+ this.active = true;\n+ return true;\n+ },\n+\n+ /**\n+ * APIMethod: deactivate\n+ * Turn off the handler. Returns false if the handler was already inactive.\n+ * \n+ * Returns:\n+ * {Boolean} The handler was deactivated.\n+ */\n+ deactivate: function() {\n+ if (!this.active) {\n+ return false;\n+ }\n+ // unregister event handlers defined on this class.\n+ var events = OpenLayers.Events.prototype.BROWSER_EVENTS;\n+ for (var i = 0, len = events.length; i < len; i++) {\n+ if (this[events[i]]) {\n+ this.unregister(events[i], this[events[i]]);\n+ }\n+ }\n+ this.touch = false;\n+ this.active = false;\n+ return true;\n+ },\n+\n+ /**\n+ * Method: startTouch\n+ * Start touch events, this method must be called by subclasses in \n+ * \"touchstart\" method. When touch events are started will be\n+ * true and all mouse related listeners will do nothing.\n+ */\n+ startTouch: function() {\n+ if (!this.touch) {\n+ this.touch = true;\n+ var events = [\n+ \"mousedown\", \"mouseup\", \"mousemove\", \"click\", \"dblclick\",\n+ \"mouseout\"\n+ ];\n+ for (var i = 0, len = events.length; i < len; i++) {\n+ if (this[events[i]]) {\n+ this.unregister(events[i], this[events[i]]);\n+ }\n+ }\n+ }\n+ },\n+\n+ /**\n+ * Method: callback\n+ * Trigger the control's named callback with the given arguments\n+ *\n+ * Parameters:\n+ * name - {String} The key for the callback that is one of the properties\n+ * of the handler's callbacks object.\n+ * args - {Array(*)} An array of arguments (any type) with which to call \n+ * the callback (defined by the control).\n+ */\n+ callback: function(name, args) {\n+ if (name && this.callbacks[name]) {\n+ this.callbacks[name].apply(this.control, args);\n+ }\n+ },\n+\n+ /**\n+ * Method: register\n+ * register an event on the map\n+ */\n+ register: function(name, method) {\n+ // TODO: deal with registerPriority in 3.0\n+ this.map.events.registerPriority(name, this, method);\n+ this.map.events.registerPriority(name, this, this.setEvent);\n },\n \n /**\n- * Method: onMapResize\n- * For singleTile layers, this will set a new tile size according to the\n- * dimensions of the map pane.\n+ * Method: unregister\n+ * unregister an event from the map\n */\n- onMapResize: function() {\n- if (this.singleTile) {\n- this.clearGrid();\n- this.setTileSize();\n- }\n+ unregister: function(name, method) {\n+ this.map.events.unregister(name, this, method);\n+ this.map.events.unregister(name, this, this.setEvent);\n },\n \n /**\n- * APIMethod: getTileBounds\n- * Returns The tile bounds for a layer given a pixel location.\n+ * Method: setEvent\n+ * With each registered browser event, the handler sets its own evt\n+ * property. This property can be accessed by controls if needed\n+ * to get more information about the event that the handler is\n+ * processing.\n *\n- * Parameters:\n- * viewPortPx - {} The location in the viewport.\n+ * This allows modifier keys on the event to be checked (alt, shift, ctrl,\n+ * and meta cannot be checked with the keyboard handler). For a\n+ * control to determine which modifier keys are associated with the\n+ * event that a handler is currently processing, it should access\n+ * (code)handler.evt.altKey || handler.evt.shiftKey ||\n+ * handler.evt.ctrlKey || handler.evt.metaKey(end).\n *\n- * Returns:\n- * {} Bounds of the tile at the given pixel location.\n+ * Parameters:\n+ * evt - {Event} The browser event.\n */\n- getTileBounds: function(viewPortPx) {\n- var maxExtent = this.maxExtent;\n- var resolution = this.getResolution();\n- var tileMapWidth = resolution * this.tileSize.w;\n- var tileMapHeight = resolution * this.tileSize.h;\n- var mapPoint = this.getLonLatFromViewPortPx(viewPortPx);\n- var tileLeft = maxExtent.left + (tileMapWidth *\n- Math.floor((mapPoint.lon -\n- maxExtent.left) /\n- tileMapWidth));\n- var tileBottom = maxExtent.bottom + (tileMapHeight *\n- Math.floor((mapPoint.lat -\n- maxExtent.bottom) /\n- tileMapHeight));\n- return new OpenLayers.Bounds(tileLeft, tileBottom,\n- tileLeft + tileMapWidth,\n- tileBottom + tileMapHeight);\n+ setEvent: function(evt) {\n+ this.evt = evt;\n+ return true;\n },\n \n- CLASS_NAME: \"OpenLayers.Layer.Grid\"\n+ /**\n+ * Method: destroy\n+ * Deconstruct the handler.\n+ */\n+ destroy: function() {\n+ // unregister event listeners\n+ this.deactivate();\n+ // eliminate circular references\n+ this.control = this.map = null;\n+ },\n+\n+ CLASS_NAME: \"OpenLayers.Handler\"\n });\n+\n+/**\n+ * Constant: OpenLayers.Handler.MOD_NONE\n+ * If set as the , returns false if any key is down.\n+ */\n+OpenLayers.Handler.MOD_NONE = 0;\n+\n+/**\n+ * Constant: OpenLayers.Handler.MOD_SHIFT\n+ * If set as the , returns false if Shift is down.\n+ */\n+OpenLayers.Handler.MOD_SHIFT = 1;\n+\n+/**\n+ * Constant: OpenLayers.Handler.MOD_CTRL\n+ * If set as the , returns false if Ctrl is down.\n+ */\n+OpenLayers.Handler.MOD_CTRL = 2;\n+\n+/**\n+ * Constant: OpenLayers.Handler.MOD_ALT\n+ * If set as the , returns false if Alt is down.\n+ */\n+OpenLayers.Handler.MOD_ALT = 4;\n+\n+/**\n+ * Constant: OpenLayers.Handler.MOD_META\n+ * If set as the , returns false if Cmd is down.\n+ */\n+OpenLayers.Handler.MOD_META = 8;\n+\n+\n /* ======================================================================\n- OpenLayers/TileManager.js\n+ OpenLayers/Spherical.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n * See license.txt in the OpenLayers distribution or repository for the\n * full text of the license. */\n \n+/**\n+ * @requires OpenLayers/SingleFile.js\n+ */\n \n /**\n- * @requires OpenLayers/Util.js\n- * @requires OpenLayers/BaseTypes.js\n- * @requires OpenLayers/BaseTypes/Element.js\n- * @requires OpenLayers/Layer/Grid.js\n- * @requires OpenLayers/Tile/Image.js\n+ * Namespace: Spherical\n+ * The OpenLayers.Spherical namespace includes utility functions for\n+ * calculations on the basis of a spherical earth (ignoring ellipsoidal\n+ * effects), which is accurate enough for most purposes.\n+ *\n+ * Relevant links:\n+ * * http://www.movable-type.co.uk/scripts/latlong.html\n+ * * http://code.google.com/apis/maps/documentation/javascript/reference.html#spherical\n */\n \n+OpenLayers.Spherical = OpenLayers.Spherical || {};\n+\n+OpenLayers.Spherical.DEFAULT_RADIUS = 6378137;\n+\n /**\n- * Class: OpenLayers.TileManager\n- * Provides queueing of image requests and caching of image elements.\n+ * APIFunction: computeDistanceBetween\n+ * Computes the distance between two LonLats.\n *\n- * Queueing avoids unnecessary image requests while changing zoom levels\n- * quickly, and helps improve dragging performance on mobile devices that show\n- * a lag in dragging when loading of new images starts. and\n- * are the configuration options to control this behavior.\n+ * Parameters:\n+ * from - {} or {Object} Starting point. A LonLat or\n+ * a JavaScript literal with lon lat properties.\n+ * to - {} or {Object} Ending point. A LonLat or a\n+ * JavaScript literal with lon lat properties.\n+ * radius - {Float} The radius. Optional. Defaults to 6378137 meters.\n *\n- * Caching avoids setting the src on image elements for images that have already\n- * been used. Several maps can share a TileManager instance, in which case each\n- * map gets its own tile queue, but all maps share the same tile cache.\n+ * Returns:\n+ * {Float} The distance in meters.\n */\n-OpenLayers.TileManager = OpenLayers.Class({\n-\n- /**\n- * APIProperty: cacheSize\n- * {Number} Number of image elements to keep referenced in this instance's\n- * cache for fast reuse. Default is 256.\n- */\n- cacheSize: 256,\n+OpenLayers.Spherical.computeDistanceBetween = function(from, to, radius) {\n+ var R = radius || OpenLayers.Spherical.DEFAULT_RADIUS;\n+ var sinHalfDeltaLon = Math.sin(Math.PI * (to.lon - from.lon) / 360);\n+ var sinHalfDeltaLat = Math.sin(Math.PI * (to.lat - from.lat) / 360);\n+ var a = sinHalfDeltaLat * sinHalfDeltaLat +\n+ sinHalfDeltaLon * sinHalfDeltaLon * Math.cos(Math.PI * from.lat / 180) * Math.cos(Math.PI * to.lat / 180);\n+ return 2 * R * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n+};\n \n- /**\n- * APIProperty: tilesPerFrame\n- * {Number} Number of queued tiles to load per frame (see ).\n- * Default is 2.\n- */\n- tilesPerFrame: 2,\n \n- /**\n- * APIProperty: frameDelay\n- * {Number} Delay between tile loading frames (see ) in\n- * milliseconds. Default is 16.\n- */\n- frameDelay: 16,\n+/**\n+ * APIFunction: computeHeading\n+ * Computes the heading from one LonLat to another LonLat.\n+ *\n+ * Parameters:\n+ * from - {} or {Object} Starting point. A LonLat or\n+ * a JavaScript literal with lon lat properties.\n+ * to - {} or {Object} Ending point. A LonLat or a\n+ * JavaScript literal with lon lat properties.\n+ *\n+ * Returns:\n+ * {Float} The heading in degrees.\n+ */\n+OpenLayers.Spherical.computeHeading = function(from, to) {\n+ var y = Math.sin(Math.PI * (from.lon - to.lon) / 180) * Math.cos(Math.PI * to.lat / 180);\n+ var x = Math.cos(Math.PI * from.lat / 180) * Math.sin(Math.PI * to.lat / 180) -\n+ Math.sin(Math.PI * from.lat / 180) * Math.cos(Math.PI * to.lat / 180) * Math.cos(Math.PI * (from.lon - to.lon) / 180);\n+ return 180 * Math.atan2(y, x) / Math.PI;\n+};\n+/* ======================================================================\n+ OpenLayers/Marker.js\n+ ====================================================================== */\n \n- /**\n- * APIProperty: moveDelay\n- * {Number} Delay in milliseconds after a map's move event before loading\n- * tiles. Default is 100.\n- */\n- moveDelay: 100,\n+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n+ * full list of contributors). Published under the 2-clause BSD license.\n+ * See license.txt in the OpenLayers distribution or repository for the\n+ * full text of the license. */\n \n- /**\n- * APIProperty: zoomDelay\n- * {Number} Delay in milliseconds after a map's zoomend event before loading\n- * tiles. Default is 200.\n- */\n- zoomDelay: 200,\n \n- /**\n- * Property: maps\n- * {Array()} The maps to manage tiles on.\n- */\n- maps: null,\n+/**\n+ * @requires OpenLayers/BaseTypes/Class.js\n+ * @requires OpenLayers/Events.js\n+ * @requires OpenLayers/Icon.js\n+ */\n \n- /**\n- * Property: tileQueueId\n- * {Object} The ids of the loop, keyed by map id.\n- */\n- tileQueueId: null,\n+/**\n+ * Class: OpenLayers.Marker\n+ * Instances of OpenLayers.Marker are a combination of a \n+ * and an . \n+ *\n+ * Markers are generally added to a special layer called\n+ * .\n+ *\n+ * Example:\n+ * (code)\n+ * var markers = new OpenLayers.Layer.Markers( \"Markers\" );\n+ * map.addLayer(markers);\n+ *\n+ * var size = new OpenLayers.Size(21,25);\n+ * var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);\n+ * var icon = new OpenLayers.Icon('http://www.openlayers.org/dev/img/marker.png', size, offset);\n+ * markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,0),icon));\n+ * markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,0),icon.clone()));\n+ *\n+ * (end)\n+ *\n+ * Note that if you pass an icon into the Marker constructor, it will take\n+ * that icon and use it. This means that you should not share icons between\n+ * markers -- you use them once, but you should clone() for any additional\n+ * markers using that same icon.\n+ */\n+OpenLayers.Marker = OpenLayers.Class({\n \n- /**\n- * Property: tileQueue\n- * {Object(Array())} Tiles queued for drawing, keyed by\n- * map id.\n+ /** \n+ * Property: icon \n+ * {} The icon used by this marker.\n */\n- tileQueue: null,\n+ icon: null,\n \n- /**\n- * Property: tileCache\n- * {Object} Cached image elements, keyed by URL.\n+ /** \n+ * Property: lonlat \n+ * {} location of object\n */\n- tileCache: null,\n+ lonlat: null,\n \n- /**\n- * Property: tileCacheIndex\n- * {Array(String)} URLs of cached tiles. First entry is the least recently\n- * used.\n+ /** \n+ * Property: events \n+ * {} the event handler.\n */\n- tileCacheIndex: null,\n+ events: null,\n \n /** \n- * Constructor: OpenLayers.TileManager\n- * Constructor for a new instance.\n- * \n- * Parameters:\n- * options - {Object} Configuration for this instance.\n+ * Property: map \n+ * {} the map this marker is attached to\n */\n- initialize: function(options) {\n- OpenLayers.Util.extend(this, options);\n- this.maps = [];\n- this.tileQueueId = {};\n- this.tileQueue = {};\n- this.tileCache = {};\n- this.tileCacheIndex = [];\n- },\n+ map: null,\n \n- /**\n- * Method: addMap\n- * Binds this instance to a map\n+ /** \n+ * Constructor: OpenLayers.Marker\n *\n * Parameters:\n- * map - {}\n+ * lonlat - {} the position of this marker\n+ * icon - {} the icon for this marker\n */\n- addMap: function(map) {\n- if (this._destroyed || !OpenLayers.Layer.Grid) {\n- return;\n- }\n- this.maps.push(map);\n- this.tileQueue[map.id] = [];\n- for (var i = 0, ii = map.layers.length; i < ii; ++i) {\n- this.addLayer({\n- layer: map.layers[i]\n- });\n- }\n- map.events.on({\n- move: this.move,\n- zoomend: this.zoomEnd,\n- changelayer: this.changeLayer,\n- addlayer: this.addLayer,\n- preremovelayer: this.removeLayer,\n- scope: this\n- });\n- },\n+ initialize: function(lonlat, icon) {\n+ this.lonlat = lonlat;\n \n- /**\n- * Method: removeMap\n- * Unbinds this instance from a map\n- *\n- * Parameters:\n- * map - {}\n- */\n- removeMap: function(map) {\n- if (this._destroyed || !OpenLayers.Layer.Grid) {\n- return;\n- }\n- window.clearTimeout(this.tileQueueId[map.id]);\n- if (map.layers) {\n- for (var i = 0, ii = map.layers.length; i < ii; ++i) {\n- this.removeLayer({\n- layer: map.layers[i]\n- });\n- }\n- }\n- if (map.events) {\n- map.events.un({\n- move: this.move,\n- zoomend: this.zoomEnd,\n- changelayer: this.changeLayer,\n- addlayer: this.addLayer,\n- preremovelayer: this.removeLayer,\n- scope: this\n- });\n+ var newIcon = (icon) ? icon : OpenLayers.Marker.defaultIcon();\n+ if (this.icon == null) {\n+ this.icon = newIcon;\n+ } else {\n+ this.icon.url = newIcon.url;\n+ this.icon.size = newIcon.size;\n+ this.icon.offset = newIcon.offset;\n+ this.icon.calculateOffset = newIcon.calculateOffset;\n }\n- delete this.tileQueue[map.id];\n- delete this.tileQueueId[map.id];\n- OpenLayers.Util.removeItem(this.maps, map);\n+ this.events = new OpenLayers.Events(this, this.icon.imageDiv);\n },\n \n /**\n- * Method: move\n- * Handles the map's move event\n- *\n- * Parameters:\n- * evt - {Object} Listener argument\n+ * APIMethod: destroy\n+ * Destroy the marker. You must first remove the marker from any \n+ * layer which it has been added to, or you will get buggy behavior.\n+ * (This can not be done within the marker since the marker does not\n+ * know which layer it is attached to.)\n */\n- move: function(evt) {\n- this.updateTimeout(evt.object, this.moveDelay, true);\n- },\n+ destroy: function() {\n+ // erase any drawn features\n+ this.erase();\n \n- /**\n- * Method: zoomEnd\n- * Handles the map's zoomEnd event\n- *\n- * Parameters:\n- * evt - {Object} Listener argument\n- */\n- zoomEnd: function(evt) {\n- this.updateTimeout(evt.object, this.zoomDelay);\n- },\n+ this.map = null;\n \n- /**\n- * Method: changeLayer\n- * Handles the map's changeLayer event\n- *\n- * Parameters:\n- * evt - {Object} Listener argument\n- */\n- changeLayer: function(evt) {\n- if (evt.property === 'visibility' || evt.property === 'params') {\n- this.updateTimeout(evt.object, 0);\n- }\n- },\n+ this.events.destroy();\n+ this.events = null;\n \n- /**\n- * Method: addLayer\n- * Handles the map's addlayer event\n- *\n- * Parameters:\n- * evt - {Object} The listener argument\n- */\n- addLayer: function(evt) {\n- var layer = evt.layer;\n- if (layer instanceof OpenLayers.Layer.Grid) {\n- layer.events.on({\n- addtile: this.addTile,\n- retile: this.clearTileQueue,\n- scope: this\n- });\n- var i, j, tile;\n- for (i = layer.grid.length - 1; i >= 0; --i) {\n- for (j = layer.grid[i].length - 1; j >= 0; --j) {\n- tile = layer.grid[i][j];\n- this.addTile({\n- tile: tile\n- });\n- if (tile.url && !tile.imgDiv) {\n- this.manageTileCache({\n- object: tile\n- });\n- }\n- }\n- }\n+ if (this.icon != null) {\n+ this.icon.destroy();\n+ this.icon = null;\n }\n },\n \n- /**\n- * Method: removeLayer\n- * Handles the map's preremovelayer event\n- *\n+ /** \n+ * Method: draw\n+ * Calls draw on the icon, and returns that output.\n+ * \n * Parameters:\n- * evt - {Object} The listener argument\n+ * px - {}\n+ * \n+ * Returns:\n+ * {DOMElement} A new DOM Image with this marker's icon set at the \n+ * location passed-in\n */\n- removeLayer: function(evt) {\n- var layer = evt.layer;\n- if (layer instanceof OpenLayers.Layer.Grid) {\n- this.clearTileQueue({\n- object: layer\n- });\n- if (layer.events) {\n- layer.events.un({\n- addtile: this.addTile,\n- retile: this.clearTileQueue,\n- scope: this\n- });\n- }\n- if (layer.grid) {\n- var i, j, tile;\n- for (i = layer.grid.length - 1; i >= 0; --i) {\n- for (j = layer.grid[i].length - 1; j >= 0; --j) {\n- tile = layer.grid[i][j];\n- this.unloadTile({\n- object: tile\n- });\n- }\n- }\n- }\n- }\n+ draw: function(px) {\n+ return this.icon.draw(px);\n },\n \n- /**\n- * Method: updateTimeout\n- * Applies the or to the loop,\n- * and schedules more queue processing after if there are still\n- * tiles in the queue.\n- *\n- * Parameters:\n- * map - {} The map to update the timeout for\n- * delay - {Number} The delay to apply\n- * nice - {Boolean} If true, the timeout function will only be created if\n- * the tilequeue is not empty. This is used by the move handler to\n- * avoid impacts on dragging performance. For other events, the tile\n- * queue may not be populated yet, so we need to set the timer\n- * regardless of the queue size.\n+ /** \n+ * Method: erase\n+ * Erases any drawn elements for this marker.\n */\n- updateTimeout: function(map, delay, nice) {\n- window.clearTimeout(this.tileQueueId[map.id]);\n- var tileQueue = this.tileQueue[map.id];\n- if (!nice || tileQueue.length) {\n- this.tileQueueId[map.id] = window.setTimeout(\n- OpenLayers.Function.bind(function() {\n- this.drawTilesFromQueue(map);\n- if (tileQueue.length) {\n- this.updateTimeout(map, this.frameDelay);\n- }\n- }, this), delay\n- );\n+ erase: function() {\n+ if (this.icon != null) {\n+ this.icon.erase();\n }\n },\n \n /**\n- * Method: addTile\n- * Listener for the layer's addtile event\n+ * Method: moveTo\n+ * Move the marker to the new location.\n *\n * Parameters:\n- * evt - {Object} The listener argument\n+ * px - {|Object} the pixel position to move to.\n+ * An OpenLayers.Pixel or an object with a 'x' and 'y' properties.\n */\n- addTile: function(evt) {\n- if (evt.tile instanceof OpenLayers.Tile.Image) {\n- evt.tile.events.on({\n- beforedraw: this.queueTileDraw,\n- beforeload: this.manageTileCache,\n- loadend: this.addToCache,\n- unload: this.unloadTile,\n- scope: this\n- });\n- } else {\n- // Layer has the wrong tile type, so don't handle it any longer\n- this.removeLayer({\n- layer: evt.tile.layer\n- });\n+ moveTo: function(px) {\n+ if ((px != null) && (this.icon != null)) {\n+ this.icon.moveTo(px);\n }\n+ this.lonlat = this.map.getLonLatFromLayerPx(px);\n },\n \n /**\n- * Method: unloadTile\n- * Listener for the tile's unload event\n- *\n- * Parameters:\n- * evt - {Object} The listener argument\n+ * APIMethod: isDrawn\n+ * \n+ * Returns:\n+ * {Boolean} Whether or not the marker is drawn.\n */\n- unloadTile: function(evt) {\n- var tile = evt.object;\n- tile.events.un({\n- beforedraw: this.queueTileDraw,\n- beforeload: this.manageTileCache,\n- loadend: this.addToCache,\n- unload: this.unloadTile,\n- scope: this\n- });\n- OpenLayers.Util.removeItem(this.tileQueue[tile.layer.map.id], tile);\n+ isDrawn: function() {\n+ var isDrawn = (this.icon && this.icon.isDrawn());\n+ return isDrawn;\n },\n \n /**\n- * Method: queueTileDraw\n- * Adds a tile to the queue that will draw it.\n+ * Method: onScreen\n *\n- * Parameters:\n- * evt - {Object} Listener argument of the tile's beforedraw event\n+ * Returns:\n+ * {Boolean} Whether or not the marker is currently visible on screen.\n */\n- queueTileDraw: function(evt) {\n- var tile = evt.object;\n- var queued = false;\n- var layer = tile.layer;\n- var url = layer.getURL(tile.bounds);\n- var img = this.tileCache[url];\n- if (img && img.className !== 'olTileImage') {\n- // cached image no longer valid, e.g. because we're olTileReplacing\n- delete this.tileCache[url];\n- OpenLayers.Util.removeItem(this.tileCacheIndex, url);\n- img = null;\n- }\n- // queue only if image with same url not cached already\n- if (layer.url && (layer.async || !img)) {\n- // add to queue only if not in queue already\n- var tileQueue = this.tileQueue[layer.map.id];\n- if (!~OpenLayers.Util.indexOf(tileQueue, tile)) {\n- tileQueue.push(tile);\n- }\n- queued = true;\n- }\n- return !queued;\n- },\n+ onScreen: function() {\n \n- /**\n- * Method: drawTilesFromQueue\n- * Draws tiles from the tileQueue, and unqueues the tiles\n- */\n- drawTilesFromQueue: function(map) {\n- var tileQueue = this.tileQueue[map.id];\n- var limit = this.tilesPerFrame;\n- var animating = map.zoomTween && map.zoomTween.playing;\n- while (!animating && tileQueue.length && limit) {\n- tileQueue.shift().draw(true);\n- --limit;\n+ var onScreen = false;\n+ if (this.map) {\n+ var screenBounds = this.map.getExtent();\n+ onScreen = screenBounds.containsLonLat(this.lonlat);\n }\n+ return onScreen;\n },\n \n /**\n- * Method: manageTileCache\n- * Adds, updates, removes and fetches cache entries.\n+ * Method: inflate\n+ * Englarges the markers icon by the specified ratio.\n *\n * Parameters:\n- * evt - {Object} Listener argument of the tile's beforeload event\n+ * inflate - {float} the ratio to enlarge the marker by (passing 2\n+ * will double the size).\n */\n- manageTileCache: function(evt) {\n- var tile = evt.object;\n- var img = this.tileCache[tile.url];\n- if (img) {\n- // if image is on its layer's backbuffer, remove it from backbuffer\n- if (img.parentNode &&\n- OpenLayers.Element.hasClass(img.parentNode, 'olBackBuffer')) {\n- img.parentNode.removeChild(img);\n- img.id = null;\n- }\n- // only use image from cache if it is not on a layer already\n- if (!img.parentNode) {\n- img.style.visibility = 'hidden';\n- img.style.opacity = 0;\n- tile.setImage(img);\n- // LRU - move tile to the end of the array to mark it as the most\n- // recently used\n- OpenLayers.Util.removeItem(this.tileCacheIndex, tile.url);\n- this.tileCacheIndex.push(tile.url);\n- }\n+ inflate: function(inflate) {\n+ if (this.icon) {\n+ this.icon.setSize({\n+ w: this.icon.size.w * inflate,\n+ h: this.icon.size.h * inflate\n+ });\n }\n },\n \n- /**\n- * Method: addToCache\n- *\n+ /** \n+ * Method: setOpacity\n+ * Change the opacity of the marker by changin the opacity of \n+ * its icon\n+ * \n * Parameters:\n- * evt - {Object} Listener argument for the tile's loadend event\n+ * opacity - {float} Specified as fraction (0.4, etc)\n */\n- addToCache: function(evt) {\n- var tile = evt.object;\n- if (!this.tileCache[tile.url]) {\n- if (!OpenLayers.Element.hasClass(tile.imgDiv, 'olImageLoadError')) {\n- if (this.tileCacheIndex.length >= this.cacheSize) {\n- delete this.tileCache[this.tileCacheIndex[0]];\n- this.tileCacheIndex.shift();\n- }\n- this.tileCache[tile.url] = tile.imgDiv;\n- this.tileCacheIndex.push(tile.url);\n- }\n- }\n+ setOpacity: function(opacity) {\n+ this.icon.setOpacity(opacity);\n },\n \n /**\n- * Method: clearTileQueue\n- * Clears the tile queue from tiles of a specific layer\n- *\n- * Parameters:\n- * evt - {Object} Listener argument of the layer's retile event\n+ * Method: setUrl\n+ * Change URL of the Icon Image.\n+ * \n+ * url - {String} \n */\n- clearTileQueue: function(evt) {\n- var layer = evt.object;\n- var tileQueue = this.tileQueue[layer.map.id];\n- for (var i = tileQueue.length - 1; i >= 0; --i) {\n- if (tileQueue[i].layer === layer) {\n- tileQueue.splice(i, 1);\n- }\n- }\n+ setUrl: function(url) {\n+ this.icon.setUrl(url);\n },\n \n- /**\n- * Method: destroy\n+ /** \n+ * Method: display\n+ * Hide or show the icon\n+ * \n+ * display - {Boolean} \n */\n- destroy: function() {\n- for (var i = this.maps.length - 1; i >= 0; --i) {\n- this.removeMap(this.maps[i]);\n- }\n- this.maps = null;\n- this.tileQueue = null;\n- this.tileQueueId = null;\n- this.tileCache = null;\n- this.tileCacheIndex = null;\n- this._destroyed = true;\n- }\n+ display: function(display) {\n+ this.icon.display(display);\n+ },\n \n+ CLASS_NAME: \"OpenLayers.Marker\"\n });\n+\n+\n+/**\n+ * Function: defaultIcon\n+ * Creates a default .\n+ * \n+ * Returns:\n+ * {} A default OpenLayers.Icon to use for a marker\n+ */\n+OpenLayers.Marker.defaultIcon = function() {\n+ return new OpenLayers.Icon(OpenLayers.Util.getImageLocation(\"marker.png\"), {\n+ w: 21,\n+ h: 25\n+ }, {\n+ x: -10.5,\n+ y: -25\n+ });\n+};\n+\n+\n /* ======================================================================\n OpenLayers/Popup.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n * See license.txt in the OpenLayers distribution or repository for the\n@@ -31160,2468 +32958,137 @@\n \n OpenLayers.Popup.WIDTH = 200;\n OpenLayers.Popup.HEIGHT = 200;\n OpenLayers.Popup.COLOR = \"white\";\n OpenLayers.Popup.OPACITY = 1;\n OpenLayers.Popup.BORDER = \"0px\";\n /* ======================================================================\n- OpenLayers/Control.js\n+ OpenLayers/Marker/Box.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n * See license.txt in the OpenLayers distribution or repository for the\n * full text of the license. */\n \n+\n /**\n- * @requires OpenLayers/BaseTypes/Class.js\n+ * @requires OpenLayers/Marker.js\n */\n \n /**\n- * Class: OpenLayers.Control\n- * Controls affect the display or behavior of the map. They allow everything\n- * from panning and zooming to displaying a scale indicator. Controls by \n- * default are added to the map they are contained within however it is\n- * possible to add a control to an external div by passing the div in the\n- * options parameter.\n- * \n- * Example:\n- * The following example shows how to add many of the common controls\n- * to a map.\n- * \n- * > var map = new OpenLayers.Map('map', { controls: [] });\n- * >\n- * > map.addControl(new OpenLayers.Control.PanZoomBar());\n- * > map.addControl(new OpenLayers.Control.LayerSwitcher({'ascending':false}));\n- * > map.addControl(new OpenLayers.Control.Permalink());\n- * > map.addControl(new OpenLayers.Control.Permalink('permalink'));\n- * > map.addControl(new OpenLayers.Control.MousePosition());\n- * > map.addControl(new OpenLayers.Control.OverviewMap());\n- * > map.addControl(new OpenLayers.Control.KeyboardDefaults());\n- *\n- * The next code fragment is a quick example of how to intercept \n- * shift-mouse click to display the extent of the bounding box\n- * dragged out by the user. Usually controls are not created\n- * in exactly this manner. See the source for a more complete \n- * example:\n+ * Class: OpenLayers.Marker.Box\n *\n- * > var control = new OpenLayers.Control();\n- * > OpenLayers.Util.extend(control, {\n- * > draw: function () {\n- * > // this Handler.Box will intercept the shift-mousedown\n- * > // before Control.MouseDefault gets to see it\n- * > this.box = new OpenLayers.Handler.Box( control, \n- * > {\"done\": this.notice},\n- * > {keyMask: OpenLayers.Handler.MOD_SHIFT});\n- * > this.box.activate();\n- * > },\n- * >\n- * > notice: function (bounds) {\n- * > OpenLayers.Console.userError(bounds);\n- * > }\n- * > }); \n- * > map.addControl(control);\n- * \n+ * Inherits from:\n+ * - \n */\n-OpenLayers.Control = OpenLayers.Class({\n-\n- /** \n- * Property: id \n- * {String} \n- */\n- id: null,\n+OpenLayers.Marker.Box = OpenLayers.Class(OpenLayers.Marker, {\n \n /** \n- * Property: map \n- * {} this gets set in the addControl() function in\n- * OpenLayers.Map \n+ * Property: bounds \n+ * {} \n */\n- map: null,\n+ bounds: null,\n \n /** \n- * APIProperty: div \n- * {DOMElement} The element that contains the control, if not present the \n- * control is placed inside the map.\n+ * Property: div \n+ * {DOMElement} \n */\n div: null,\n \n /** \n- * APIProperty: type \n- * {Number} Controls can have a 'type'. The type determines the type of\n- * interactions which are possible with them when they are placed in an\n- * . \n- */\n- type: null,\n-\n- /** \n- * Property: allowSelection\n- * {Boolean} By default, controls do not allow selection, because\n- * it may interfere with map dragging. If this is true, OpenLayers\n- * will not prevent selection of the control.\n- * Default is false.\n- */\n- allowSelection: false,\n-\n- /** \n- * Property: displayClass \n- * {string} This property is used for CSS related to the drawing of the\n- * Control. \n- */\n- displayClass: \"\",\n-\n- /**\n- * APIProperty: title \n- * {string} This property is used for showing a tooltip over the \n- * Control. \n- */\n- title: \"\",\n-\n- /**\n- * APIProperty: autoActivate\n- * {Boolean} Activate the control when it is added to a map. Default is\n- * false.\n- */\n- autoActivate: false,\n-\n- /** \n- * APIProperty: active \n- * {Boolean} The control is active (read-only). Use and \n- * to change control state.\n- */\n- active: null,\n-\n- /**\n- * Property: handlerOptions\n- * {Object} Used to set non-default properties on the control's handler\n- */\n- handlerOptions: null,\n-\n- /** \n- * Property: handler \n- * {} null\n- */\n- handler: null,\n-\n- /**\n- * APIProperty: eventListeners\n- * {Object} If set as an option at construction, the eventListeners\n- * object will be registered with . Object\n- * structure must be a listeners object as shown in the example for\n- * the events.on method.\n- */\n- eventListeners: null,\n-\n- /** \n- * APIProperty: events\n- * {} Events instance for listeners and triggering\n- * control specific events.\n- *\n- * Register a listener for a particular event with the following syntax:\n- * (code)\n- * control.events.register(type, obj, listener);\n- * (end)\n- *\n- * Listeners will be called with a reference to an event object. The\n- * properties of this event depends on exactly what happened.\n- *\n- * All event objects have at least the following properties:\n- * object - {Object} A reference to control.events.object (a reference\n- * to the control).\n- * element - {DOMElement} A reference to control.events.element (which\n- * will be null unless documented otherwise).\n- *\n- * Supported map event types:\n- * activate - Triggered when activated.\n- * deactivate - Triggered when deactivated.\n- */\n- events: null,\n-\n- /**\n- * Constructor: OpenLayers.Control\n- * Create an OpenLayers Control. The options passed as a parameter\n- * directly extend the control. For example passing the following:\n- * \n- * > var control = new OpenLayers.Control({div: myDiv});\n+ * Constructor: OpenLayers.Marker.Box\n *\n- * Overrides the default div attribute value of null.\n- * \n * Parameters:\n- * options - {Object} \n+ * bounds - {} \n+ * borderColor - {String} \n+ * borderWidth - {int} \n */\n- initialize: function(options) {\n- // We do this before the extend so that instances can override\n- // className in options.\n- this.displayClass =\n- this.CLASS_NAME.replace(\"OpenLayers.\", \"ol\").replace(/\\./g, \"\");\n-\n- OpenLayers.Util.extend(this, options);\n-\n- this.events = new OpenLayers.Events(this);\n- if (this.eventListeners instanceof Object) {\n- this.events.on(this.eventListeners);\n- }\n- if (this.id == null) {\n- this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + \"_\");\n- }\n+ initialize: function(bounds, borderColor, borderWidth) {\n+ this.bounds = bounds;\n+ this.div = OpenLayers.Util.createDiv();\n+ this.div.style.overflow = 'hidden';\n+ this.events = new OpenLayers.Events(this, this.div);\n+ this.setBorder(borderColor, borderWidth);\n },\n \n /**\n- * Method: destroy\n- * The destroy method is used to perform any clean up before the control\n- * is dereferenced. Typically this is where event listeners are removed\n- * to prevent memory leaks.\n+ * Method: destroy \n */\n destroy: function() {\n- if (this.events) {\n- if (this.eventListeners) {\n- this.events.un(this.eventListeners);\n- }\n- this.events.destroy();\n- this.events = null;\n- }\n- this.eventListeners = null;\n \n- // eliminate circular references\n- if (this.handler) {\n- this.handler.destroy();\n- this.handler = null;\n- }\n- if (this.handlers) {\n- for (var key in this.handlers) {\n- if (this.handlers.hasOwnProperty(key) &&\n- typeof this.handlers[key].destroy == \"function\") {\n- this.handlers[key].destroy();\n- }\n- }\n- this.handlers = null;\n- }\n- if (this.map) {\n- this.map.removeControl(this);\n- this.map = null;\n- }\n+ this.bounds = null;\n this.div = null;\n- },\n-\n- /** \n- * Method: setMap\n- * Set the map property for the control. This is done through an accessor\n- * so that subclasses can override this and take special action once \n- * they have their map variable set. \n- *\n- * Parameters:\n- * map - {} \n- */\n- setMap: function(map) {\n- this.map = map;\n- if (this.handler) {\n- this.handler.setMap(map);\n- }\n- },\n-\n- /**\n- * Method: draw\n- * The draw method is called when the control is ready to be displayed\n- * on the page. If a div has not been created one is created. Controls\n- * with a visual component will almost always want to override this method \n- * to customize the look of control. \n- *\n- * Parameters:\n- * px - {} The top-left pixel position of the control\n- * or null.\n- *\n- * Returns:\n- * {DOMElement} A reference to the DIV DOMElement containing the control\n- */\n- draw: function(px) {\n- if (this.div == null) {\n- this.div = OpenLayers.Util.createDiv(this.id);\n- this.div.className = this.displayClass;\n- if (!this.allowSelection) {\n- this.div.className += \" olControlNoSelect\";\n- this.div.setAttribute(\"unselectable\", \"on\", 0);\n- this.div.onselectstart = OpenLayers.Function.False;\n- }\n- if (this.title != \"\") {\n- this.div.title = this.title;\n- }\n- }\n- if (px != null) {\n- this.position = px.clone();\n- }\n- this.moveTo(this.position);\n- return this.div;\n- },\n-\n- /**\n- * Method: moveTo\n- * Sets the left and top style attributes to the passed in pixel \n- * coordinates.\n- *\n- * Parameters:\n- * px - {}\n- */\n- moveTo: function(px) {\n- if ((px != null) && (this.div != null)) {\n- this.div.style.left = px.x + \"px\";\n- this.div.style.top = px.y + \"px\";\n- }\n- },\n-\n- /**\n- * APIMethod: activate\n- * Explicitly activates a control and it's associated\n- * handler if one has been set. Controls can be\n- * deactivated by calling the deactivate() method.\n- * \n- * Returns:\n- * {Boolean} True if the control was successfully activated or\n- * false if the control was already active.\n- */\n- activate: function() {\n- if (this.active) {\n- return false;\n- }\n- if (this.handler) {\n- this.handler.activate();\n- }\n- this.active = true;\n- if (this.map) {\n- OpenLayers.Element.addClass(\n- this.map.viewPortDiv,\n- this.displayClass.replace(/ /g, \"\") + \"Active\"\n- );\n- }\n- this.events.triggerEvent(\"activate\");\n- return true;\n- },\n-\n- /**\n- * APIMethod: deactivate\n- * Deactivates a control and it's associated handler if any. The exact\n- * effect of this depends on the control itself.\n- * \n- * Returns:\n- * {Boolean} True if the control was effectively deactivated or false\n- * if the control was already inactive.\n- */\n- deactivate: function() {\n- if (this.active) {\n- if (this.handler) {\n- this.handler.deactivate();\n- }\n- this.active = false;\n- if (this.map) {\n- OpenLayers.Element.removeClass(\n- this.map.viewPortDiv,\n- this.displayClass.replace(/ /g, \"\") + \"Active\"\n- );\n- }\n- this.events.triggerEvent(\"deactivate\");\n- return true;\n- }\n- return false;\n- },\n-\n- CLASS_NAME: \"OpenLayers.Control\"\n-});\n-\n-/**\n- * Constant: OpenLayers.Control.TYPE_BUTTON\n- */\n-OpenLayers.Control.TYPE_BUTTON = 1;\n-\n-/**\n- * Constant: OpenLayers.Control.TYPE_TOGGLE\n- */\n-OpenLayers.Control.TYPE_TOGGLE = 2;\n-\n-/**\n- * Constant: OpenLayers.Control.TYPE_TOOL\n- */\n-OpenLayers.Control.TYPE_TOOL = 3;\n-/* ======================================================================\n- OpenLayers/Rule.js\n- ====================================================================== */\n-\n-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n- * full list of contributors). Published under the 2-clause BSD license.\n- * See license.txt in the OpenLayers distribution or repository for the\n- * full text of the license. */\n-\n-\n-/**\n- * @requires OpenLayers/BaseTypes/Class.js\n- * @requires OpenLayers/Util.js\n- * @requires OpenLayers/Style.js\n- */\n-\n-/**\n- * Class: OpenLayers.Rule\n- * This class represents an SLD Rule, as being used for rule-based SLD styling.\n- */\n-OpenLayers.Rule = OpenLayers.Class({\n-\n- /**\n- * Property: id\n- * {String} A unique id for this session.\n- */\n- id: null,\n-\n- /**\n- * APIProperty: name\n- * {String} name of this rule\n- */\n- name: null,\n-\n- /**\n- * Property: title\n- * {String} Title of this rule (set if included in SLD)\n- */\n- title: null,\n-\n- /**\n- * Property: description\n- * {String} Description of this rule (set if abstract is included in SLD)\n- */\n- description: null,\n-\n- /**\n- * Property: context\n- * {Object} An optional object with properties that the rule should be\n- * evaluated against. If no context is specified, feature.attributes will\n- * be used.\n- */\n- context: null,\n-\n- /**\n- * Property: filter\n- * {} Optional filter for the rule.\n- */\n- filter: null,\n-\n- /**\n- * Property: elseFilter\n- * {Boolean} Determines whether this rule is only to be applied only if\n- * no other rules match (ElseFilter according to the SLD specification). \n- * Default is false. For instances of OpenLayers.Rule, if elseFilter is\n- * false, the rule will always apply. For subclasses, the else property is \n- * ignored.\n- */\n- elseFilter: false,\n-\n- /**\n- * Property: symbolizer\n- * {Object} Symbolizer or hash of symbolizers for this rule. If hash of\n- * symbolizers, keys are one or more of [\"Point\", \"Line\", \"Polygon\"]. The\n- * latter if useful if it is required to style e.g. vertices of a line\n- * with a point symbolizer. Note, however, that this is not implemented\n- * yet in OpenLayers, but it is the way how symbolizers are defined in\n- * SLD.\n- */\n- symbolizer: null,\n-\n- /**\n- * Property: symbolizers\n- * {Array} Collection of symbolizers associated with this rule. If \n- * provided at construction, the symbolizers array has precedence\n- * over the deprecated symbolizer property. Note that multiple \n- * symbolizers are not currently supported by the vector renderers.\n- * Rules with multiple symbolizers are currently only useful for\n- * maintaining elements in an SLD document.\n- */\n- symbolizers: null,\n-\n- /**\n- * APIProperty: minScaleDenominator\n- * {Number} or {String} minimum scale at which to draw the feature.\n- * In the case of a String, this can be a combination of text and\n- * propertyNames in the form \"literal ${propertyName}\"\n- */\n- minScaleDenominator: null,\n-\n- /**\n- * APIProperty: maxScaleDenominator\n- * {Number} or {String} maximum scale at which to draw the feature.\n- * In the case of a String, this can be a combination of text and\n- * propertyNames in the form \"literal ${propertyName}\"\n- */\n- maxScaleDenominator: null,\n-\n- /** \n- * Constructor: OpenLayers.Rule\n- * Creates a Rule.\n- *\n- * Parameters:\n- * options - {Object} An optional object with properties to set on the\n- * rule\n- * \n- * Returns:\n- * {}\n- */\n- initialize: function(options) {\n- this.symbolizer = {};\n- OpenLayers.Util.extend(this, options);\n- if (this.symbolizers) {\n- delete this.symbolizer;\n- }\n- this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + \"_\");\n- },\n-\n- /** \n- * APIMethod: destroy\n- * nullify references to prevent circular references and memory leaks\n- */\n- destroy: function() {\n- for (var i in this.symbolizer) {\n- this.symbolizer[i] = null;\n- }\n- this.symbolizer = null;\n- delete this.symbolizers;\n- },\n-\n- /**\n- * APIMethod: evaluate\n- * evaluates this rule for a specific feature\n- * \n- * Parameters:\n- * feature - {} feature to apply the rule to.\n- * \n- * Returns:\n- * {Boolean} true if the rule applies, false if it does not.\n- * This rule is the default rule and always returns true.\n- */\n- evaluate: function(feature) {\n- var context = this.getContext(feature);\n- var applies = true;\n-\n- if (this.minScaleDenominator || this.maxScaleDenominator) {\n- var scale = feature.layer.map.getScale();\n- }\n-\n- // check if within minScale/maxScale bounds\n- if (this.minScaleDenominator) {\n- applies = scale >= OpenLayers.Style.createLiteral(\n- this.minScaleDenominator, context);\n- }\n- if (applies && this.maxScaleDenominator) {\n- applies = scale < OpenLayers.Style.createLiteral(\n- this.maxScaleDenominator, context);\n- }\n-\n- // check if optional filter applies\n- if (applies && this.filter) {\n- // feature id filters get the feature, others get the context\n- if (this.filter.CLASS_NAME == \"OpenLayers.Filter.FeatureId\") {\n- applies = this.filter.evaluate(feature);\n- } else {\n- applies = this.filter.evaluate(context);\n- }\n- }\n-\n- return applies;\n- },\n-\n- /**\n- * Method: getContext\n- * Gets the context for evaluating this rule\n- * \n- * Paramters:\n- * feature - {} feature to take the context from if\n- * none is specified.\n- */\n- getContext: function(feature) {\n- var context = this.context;\n- if (!context) {\n- context = feature.attributes || feature.data;\n- }\n- if (typeof this.context == \"function\") {\n- context = this.context(feature);\n- }\n- return context;\n- },\n-\n- /**\n- * APIMethod: clone\n- * Clones this rule.\n- * \n- * Returns:\n- * {} Clone of this rule.\n- */\n- clone: function() {\n- var options = OpenLayers.Util.extend({}, this);\n- if (this.symbolizers) {\n- // clone symbolizers\n- var len = this.symbolizers.length;\n- options.symbolizers = new Array(len);\n- for (var i = 0; i < len; ++i) {\n- options.symbolizers[i] = this.symbolizers[i].clone();\n- }\n- } else {\n- // clone symbolizer\n- options.symbolizer = {};\n- var value, type;\n- for (var key in this.symbolizer) {\n- value = this.symbolizer[key];\n- type = typeof value;\n- if (type === \"object\") {\n- options.symbolizer[key] = OpenLayers.Util.extend({}, value);\n- } else if (type === \"string\") {\n- options.symbolizer[key] = value;\n- }\n- }\n- }\n- // clone filter\n- options.filter = this.filter && this.filter.clone();\n- // clone context\n- options.context = this.context && OpenLayers.Util.extend({}, this.context);\n- return new OpenLayers.Rule(options);\n- },\n-\n- CLASS_NAME: \"OpenLayers.Rule\"\n-});\n-/* ======================================================================\n- OpenLayers/Renderer.js\n- ====================================================================== */\n-\n-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n- * full list of contributors). Published under the 2-clause BSD license.\n- * See license.txt in the OpenLayers distribution or repository for the\n- * full text of the license. */\n-\n-/**\n- * @requires OpenLayers/BaseTypes/Class.js\n- */\n-\n-/**\n- * Class: OpenLayers.Renderer \n- * This is the base class for all renderers.\n- *\n- * This is based on a merger code written by Paul Spencer and Bertil Chapuis.\n- * It is largely composed of virtual functions that are to be implemented\n- * in technology-specific subclasses, but there is some generic code too.\n- * \n- * The functions that *are* implemented here merely deal with the maintenance\n- * of the size and extent variables, as well as the cached 'resolution' \n- * value. \n- * \n- * A note to the user that all subclasses should use getResolution() instead\n- * of directly accessing this.resolution in order to correctly use the \n- * cacheing system.\n- *\n- */\n-OpenLayers.Renderer = OpenLayers.Class({\n-\n- /** \n- * Property: container\n- * {DOMElement} \n- */\n- container: null,\n-\n- /**\n- * Property: root\n- * {DOMElement}\n- */\n- root: null,\n-\n- /** \n- * Property: extent\n- * {}\n- */\n- extent: null,\n-\n- /**\n- * Property: locked\n- * {Boolean} If the renderer is currently in a state where many things\n- * are changing, the 'locked' property is set to true. This means \n- * that renderers can expect at least one more drawFeature event to be\n- * called with the 'locked' property set to 'true': In some renderers,\n- * this might make sense to use as a 'only update local information'\n- * flag. \n- */\n- locked: false,\n-\n- /** \n- * Property: size\n- * {} \n- */\n- size: null,\n-\n- /**\n- * Property: resolution\n- * {Float} cache of current map resolution\n- */\n- resolution: null,\n-\n- /**\n- * Property: map \n- * {} Reference to the map -- this is set in Vector's setMap()\n- */\n- map: null,\n-\n- /**\n- * Property: featureDx\n- * {Number} Feature offset in x direction. Will be calculated for and\n- * applied to the current feature while rendering (see\n- * ).\n- */\n- featureDx: 0,\n-\n- /**\n- * Constructor: OpenLayers.Renderer \n- *\n- * Parameters:\n- * containerID - {} \n- * options - {Object} options for this renderer. See sublcasses for\n- * supported options.\n- */\n- initialize: function(containerID, options) {\n- this.container = OpenLayers.Util.getElement(containerID);\n- OpenLayers.Util.extend(this, options);\n- },\n-\n- /**\n- * APIMethod: destroy\n- */\n- destroy: function() {\n- this.container = null;\n- this.extent = null;\n- this.size = null;\n- this.resolution = null;\n- this.map = null;\n- },\n-\n- /**\n- * APIMethod: supported\n- * This should be overridden by specific subclasses\n- * \n- * Returns:\n- * {Boolean} Whether or not the browser supports the renderer class\n- */\n- supported: function() {\n- return false;\n- },\n-\n- /**\n- * Method: setExtent\n- * Set the visible part of the layer.\n- *\n- * Resolution has probably changed, so we nullify the resolution \n- * cache (this.resolution) -- this way it will be re-computed when \n- * next it is needed.\n- * We nullify the resolution cache (this.resolution) if resolutionChanged\n- * is set to true - this way it will be re-computed on the next\n- * getResolution() request.\n- *\n- * Parameters:\n- * extent - {}\n- * resolutionChanged - {Boolean}\n- *\n- * Returns:\n- * {Boolean} true to notify the layer that the new extent does not exceed\n- * the coordinate range, and the features will not need to be redrawn.\n- * False otherwise.\n- */\n- setExtent: function(extent, resolutionChanged) {\n- this.extent = extent.clone();\n- if (this.map.baseLayer && this.map.baseLayer.wrapDateLine) {\n- var ratio = extent.getWidth() / this.map.getExtent().getWidth(),\n- extent = extent.scale(1 / ratio);\n- this.extent = extent.wrapDateLine(this.map.getMaxExtent()).scale(ratio);\n- }\n- if (resolutionChanged) {\n- this.resolution = null;\n- }\n- return true;\n- },\n-\n- /**\n- * Method: setSize\n- * Sets the size of the drawing surface.\n- * \n- * Resolution has probably changed, so we nullify the resolution \n- * cache (this.resolution) -- this way it will be re-computed when \n- * next it is needed.\n- *\n- * Parameters:\n- * size - {} \n- */\n- setSize: function(size) {\n- this.size = size.clone();\n- this.resolution = null;\n- },\n-\n- /** \n- * Method: getResolution\n- * Uses cached copy of resolution if available to minimize computing\n- * \n- * Returns:\n- * {Float} The current map's resolution\n- */\n- getResolution: function() {\n- this.resolution = this.resolution || this.map.getResolution();\n- return this.resolution;\n- },\n-\n- /**\n- * Method: drawFeature\n- * Draw the feature. The optional style argument can be used\n- * to override the feature's own style. This method should only\n- * be called from layer.drawFeature().\n- *\n- * Parameters:\n- * feature - {} \n- * style - {}\n- * \n- * Returns:\n- * {Boolean} true if the feature has been drawn completely, false if not,\n- * undefined if the feature had no geometry\n- */\n- drawFeature: function(feature, style) {\n- if (style == null) {\n- style = feature.style;\n- }\n- if (feature.geometry) {\n- var bounds = feature.geometry.getBounds();\n- if (bounds) {\n- var worldBounds;\n- if (this.map.baseLayer && this.map.baseLayer.wrapDateLine) {\n- worldBounds = this.map.getMaxExtent();\n- }\n- if (!bounds.intersectsBounds(this.extent, {\n- worldBounds: worldBounds\n- })) {\n- style = {\n- display: \"none\"\n- };\n- } else {\n- this.calculateFeatureDx(bounds, worldBounds);\n- }\n- var rendered = this.drawGeometry(feature.geometry, style, feature.id);\n- if (style.display != \"none\" && style.label && rendered !== false) {\n-\n- var location = feature.geometry.getCentroid();\n- if (style.labelXOffset || style.labelYOffset) {\n- var xOffset = isNaN(style.labelXOffset) ? 0 : style.labelXOffset;\n- var yOffset = isNaN(style.labelYOffset) ? 0 : style.labelYOffset;\n- var res = this.getResolution();\n- location.move(xOffset * res, yOffset * res);\n- }\n- this.drawText(feature.id, style, location);\n- } else {\n- this.removeText(feature.id);\n- }\n- return rendered;\n- }\n- }\n- },\n \n- /**\n- * Method: calculateFeatureDx\n- * {Number} Calculates the feature offset in x direction. Looking at the\n- * center of the feature bounds and the renderer extent, we calculate how\n- * many world widths the two are away from each other. This distance is\n- * used to shift the feature as close as possible to the center of the\n- * current enderer extent, which ensures that the feature is visible in the\n- * current viewport.\n- *\n- * Parameters:\n- * bounds - {} Bounds of the feature\n- * worldBounds - {} Bounds of the world\n- */\n- calculateFeatureDx: function(bounds, worldBounds) {\n- this.featureDx = 0;\n- if (worldBounds) {\n- var worldWidth = worldBounds.getWidth(),\n- rendererCenterX = (this.extent.left + this.extent.right) / 2,\n- featureCenterX = (bounds.left + bounds.right) / 2,\n- worldsAway = Math.round((featureCenterX - rendererCenterX) / worldWidth);\n- this.featureDx = worldsAway * worldWidth;\n- }\n+ OpenLayers.Marker.prototype.destroy.apply(this, arguments);\n },\n \n /** \n- * Method: drawGeometry\n- * \n- * Draw a geometry. This should only be called from the renderer itself.\n- * Use layer.drawFeature() from outside the renderer.\n- * virtual function\n- *\n- * Parameters:\n- * geometry - {} \n- * style - {Object} \n- * featureId - {} \n- */\n- drawGeometry: function(geometry, style, featureId) {},\n-\n- /**\n- * Method: drawText\n- * Function for drawing text labels.\n- * This method is only called by the renderer itself.\n- * \n- * Parameters: \n- * featureId - {String}\n- * style -\n- * location - {}\n- */\n- drawText: function(featureId, style, location) {},\n-\n- /**\n- * Method: removeText\n- * Function for removing text labels.\n- * This method is only called by the renderer itself.\n- * \n- * Parameters: \n- * featureId - {String}\n- */\n- removeText: function(featureId) {},\n-\n- /**\n- * Method: clear\n- * Clear all vectors from the renderer.\n- * virtual function.\n- */\n- clear: function() {},\n-\n- /**\n- * Method: getFeatureIdFromEvent\n- * Returns a feature id from an event on the renderer. \n- * How this happens is specific to the renderer. This should be\n- * called from layer.getFeatureFromEvent().\n- * Virtual function.\n- * \n- * Parameters:\n- * evt - {} \n- *\n- * Returns:\n- * {String} A feature id or undefined.\n- */\n- getFeatureIdFromEvent: function(evt) {},\n-\n- /**\n- * Method: eraseFeatures \n- * This is called by the layer to erase features\n- * \n- * Parameters:\n- * features - {Array()} \n- */\n- eraseFeatures: function(features) {\n- if (!(OpenLayers.Util.isArray(features))) {\n- features = [features];\n- }\n- for (var i = 0, len = features.length; i < len; ++i) {\n- var feature = features[i];\n- this.eraseGeometry(feature.geometry, feature.id);\n- this.removeText(feature.id);\n- }\n- },\n-\n- /**\n- * Method: eraseGeometry\n- * Remove a geometry from the renderer (by id).\n- * virtual function.\n- * \n- * Parameters:\n- * geometry - {} \n- * featureId - {String}\n- */\n- eraseGeometry: function(geometry, featureId) {},\n-\n- /**\n- * Method: moveRoot\n- * moves this renderer's root to a (different) renderer.\n- * To be implemented by subclasses that require a common renderer root for\n- * feature selection.\n- * \n- * Parameters:\n- * renderer - {} target renderer for the moved root\n- */\n- moveRoot: function(renderer) {},\n-\n- /**\n- * Method: getRenderLayerId\n- * Gets the layer that this renderer's output appears on. If moveRoot was\n- * used, this will be different from the id of the layer containing the\n- * features rendered by this renderer.\n- * \n- * Returns:\n- * {String} the id of the output layer.\n- */\n- getRenderLayerId: function() {\n- return this.container.id;\n- },\n-\n- /**\n- * Method: applyDefaultSymbolizer\n+ * Method: setBorder\n+ * Allow the user to change the box's color and border width\n * \n * Parameters:\n- * symbolizer - {Object}\n- * \n- * Returns:\n- * {Object}\n+ * color - {String} Default is \"red\"\n+ * width - {int} Default is 2\n */\n- applyDefaultSymbolizer: function(symbolizer) {\n- var result = OpenLayers.Util.extend({},\n- OpenLayers.Renderer.defaultSymbolizer);\n- if (symbolizer.stroke === false) {\n- delete result.strokeWidth;\n- delete result.strokeColor;\n+ setBorder: function(color, width) {\n+ if (!color) {\n+ color = \"red\";\n }\n- if (symbolizer.fill === false) {\n- delete result.fillColor;\n+ if (!width) {\n+ width = 2;\n }\n- OpenLayers.Util.extend(result, symbolizer);\n- return result;\n- },\n-\n- CLASS_NAME: \"OpenLayers.Renderer\"\n-});\n-\n-/**\n- * Constant: OpenLayers.Renderer.defaultSymbolizer\n- * {Object} Properties from this symbolizer will be applied to symbolizers\n- * with missing properties. This can also be used to set a global\n- * symbolizer default in OpenLayers. To be SLD 1.x compliant, add the\n- * following code before rendering any vector features:\n- * (code)\n- * OpenLayers.Renderer.defaultSymbolizer = {\n- * fillColor: \"#808080\",\n- * fillOpacity: 1,\n- * strokeColor: \"#000000\",\n- * strokeOpacity: 1,\n- * strokeWidth: 1,\n- * pointRadius: 3,\n- * graphicName: \"square\"\n- * };\n- * (end)\n- */\n-OpenLayers.Renderer.defaultSymbolizer = {\n- fillColor: \"#000000\",\n- strokeColor: \"#000000\",\n- strokeWidth: 2,\n- fillOpacity: 1,\n- strokeOpacity: 1,\n- pointRadius: 0,\n- labelAlign: 'cm'\n-};\n-\n-\n-\n-/**\n- * Constant: OpenLayers.Renderer.symbol\n- * Coordinate arrays for well known (named) symbols.\n- */\n-OpenLayers.Renderer.symbol = {\n- \"star\": [350, 75, 379, 161, 469, 161, 397, 215, 423, 301, 350, 250, 277, 301,\n- 303, 215, 231, 161, 321, 161, 350, 75\n- ],\n- \"cross\": [4, 0, 6, 0, 6, 4, 10, 4, 10, 6, 6, 6, 6, 10, 4, 10, 4, 6, 0, 6, 0, 4, 4, 4,\n- 4, 0\n- ],\n- \"x\": [0, 0, 25, 0, 50, 35, 75, 0, 100, 0, 65, 50, 100, 100, 75, 100, 50, 65, 25, 100, 0, 100, 35, 50, 0, 0],\n- \"square\": [0, 0, 0, 1, 1, 1, 1, 0, 0, 0],\n- \"triangle\": [0, 10, 10, 10, 5, 0, 0, 10]\n-};\n-/* ======================================================================\n- OpenLayers/Symbolizer/Point.js\n- ====================================================================== */\n-\n-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n- * full list of contributors). Published under the 2-clause BSD license.\n- * See license.txt in the OpenLayers distribution or repository for the\n- * full text of the license. */\n-\n-/**\n- * @requires OpenLayers/Symbolizer.js\n- */\n-\n-/**\n- * Class: OpenLayers.Symbolizer.Point\n- * A symbolizer used to render point features.\n- */\n-OpenLayers.Symbolizer.Point = OpenLayers.Class(OpenLayers.Symbolizer, {\n-\n- /**\n- * APIProperty: strokeColor\n- * {String} Color for line stroke. This is a RGB hex value (e.g. \"#ff0000\"\n- * for red).\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * APIProperty: strokeOpacity\n- * {Number} Stroke opacity (0-1).\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * APIProperty: strokeWidth\n- * {Number} Pixel stroke width.\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * APIProperty: strokeLinecap\n- * {String} Stroke cap type (\"butt\", \"round\", or \"square\").\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * Property: strokeDashstyle\n- * {String} Stroke dash style according to the SLD spec. Note that the\n- * OpenLayers values for strokeDashstyle (\"dot\", \"dash\", \"dashdot\",\n- * \"longdash\", \"longdashdot\", or \"solid\") will not work in SLD, but\n- * most SLD patterns will render correctly in OpenLayers.\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * APIProperty: fillColor\n- * {String} RGB hex fill color (e.g. \"#ff0000\" for red).\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * APIProperty: fillOpacity\n- * {Number} Fill opacity (0-1).\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * APIProperty: pointRadius\n- * {Number} Pixel point radius.\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * APIProperty: externalGraphic\n- * {String} Url to an external graphic that will be used for rendering \n- * points.\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * APIProperty: graphicWidth\n- * {Number} Pixel width for sizing an external graphic.\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * APIProperty: graphicHeight\n- * {Number} Pixel height for sizing an external graphic.\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * APIProperty: graphicOpacity\n- * {Number} Opacity (0-1) for an external graphic.\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * APIProperty: graphicXOffset\n- * {Number} Pixel offset along the positive x axis for displacing an \n- * external graphic.\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * APIProperty: graphicYOffset\n- * {Number} Pixel offset along the positive y axis for displacing an \n- * external graphic.\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * APIProperty: rotation\n- * {Number} The rotation of a graphic in the clockwise direction about its \n- * center point (or any point off center as specified by \n- * and ).\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * APIProperty: graphicName\n- * {String} Named graphic to use when rendering points. Supported values \n- * include \"circle\", \"square\", \"star\", \"x\", \"cross\", and \"triangle\".\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * Constructor: OpenLayers.Symbolizer.Point\n- * Create a symbolizer for rendering points.\n- *\n- * Parameters:\n- * config - {Object} An object containing properties to be set on the \n- * symbolizer. Any documented symbolizer property can be set at \n- * construction.\n- *\n- * Returns:\n- * A new point symbolizer.\n- */\n- initialize: function(config) {\n- OpenLayers.Symbolizer.prototype.initialize.apply(this, arguments);\n- },\n-\n- CLASS_NAME: \"OpenLayers.Symbolizer.Point\"\n-\n-});\n-\n-/* ======================================================================\n- OpenLayers/Symbolizer/Line.js\n- ====================================================================== */\n-\n-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n- * full list of contributors). Published under the 2-clause BSD license.\n- * See license.txt in the OpenLayers distribution or repository for the\n- * full text of the license. */\n-\n-/**\n- * @requires OpenLayers/Symbolizer.js\n- */\n-\n-/**\n- * Class: OpenLayers.Symbolizer.Line\n- * A symbolizer used to render line features.\n- */\n-OpenLayers.Symbolizer.Line = OpenLayers.Class(OpenLayers.Symbolizer, {\n-\n- /**\n- * APIProperty: strokeColor\n- * {String} Color for line stroke. This is a RGB hex value (e.g. \"#ff0000\"\n- * for red). \n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * APIProperty: strokeOpacity\n- * {Number} Stroke opacity (0-1).\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * APIProperty: strokeWidth\n- * {Number} Pixel stroke width.\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * APIProperty: strokeLinecap\n- * {String} Stroke cap type (\"butt\", \"round\", or \"square\").\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * Property: strokeDashstyle\n- * {String} Stroke dash style according to the SLD spec. Note that the\n- * OpenLayers values for strokeDashstyle (\"dot\", \"dash\", \"dashdot\",\n- * \"longdash\", \"longdashdot\", or \"solid\") will not work in SLD, but\n- * most SLD patterns will render correctly in OpenLayers.\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * Constructor: OpenLayers.Symbolizer.Line\n- * Create a symbolizer for rendering lines.\n- *\n- * Parameters:\n- * config - {Object} An object containing properties to be set on the \n- * symbolizer. Any documented symbolizer property can be set at \n- * construction.\n- *\n- * Returns:\n- * A new line symbolizer.\n- */\n- initialize: function(config) {\n- OpenLayers.Symbolizer.prototype.initialize.apply(this, arguments);\n- },\n-\n- CLASS_NAME: \"OpenLayers.Symbolizer.Line\"\n-\n-});\n-\n-/* ======================================================================\n- OpenLayers/Symbolizer/Polygon.js\n- ====================================================================== */\n-\n-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n- * full list of contributors). Published under the 2-clause BSD license.\n- * See license.txt in the OpenLayers distribution or repository for the\n- * full text of the license. */\n-\n-/**\n- * @requires OpenLayers/Symbolizer.js\n- */\n-\n-/**\n- * Class: OpenLayers.Symbolizer.Polygon\n- * A symbolizer used to render line features.\n- */\n-OpenLayers.Symbolizer.Polygon = OpenLayers.Class(OpenLayers.Symbolizer, {\n-\n- /**\n- * APIProperty: strokeColor\n- * {String} Color for line stroke. This is a RGB hex value (e.g. \"#ff0000\"\n- * for red).\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * APIProperty: strokeOpacity\n- * {Number} Stroke opacity (0-1).\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * APIProperty: strokeWidth\n- * {Number} Pixel stroke width.\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * APIProperty: strokeLinecap\n- * {String} Stroke cap type (\"butt\", \"round\", or \"square\").\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * Property: strokeDashstyle\n- * {String} Stroke dash style according to the SLD spec. Note that the\n- * OpenLayers values for strokeDashstyle (\"dot\", \"dash\", \"dashdot\",\n- * \"longdash\", \"longdashdot\", or \"solid\") will not work in SLD, but\n- * most SLD patterns will render correctly in OpenLayers.\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * APIProperty: fillColor\n- * {String} RGB hex fill color (e.g. \"#ff0000\" for red).\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * APIProperty: fillOpacity\n- * {Number} Fill opacity (0-1).\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * Constructor: OpenLayers.Symbolizer.Polygon\n- * Create a symbolizer for rendering polygons.\n- *\n- * Parameters:\n- * config - {Object} An object containing properties to be set on the \n- * symbolizer. Any documented symbolizer property can be set at \n- * construction.\n- *\n- * Returns:\n- * A new polygon symbolizer.\n- */\n- initialize: function(config) {\n- OpenLayers.Symbolizer.prototype.initialize.apply(this, arguments);\n- },\n-\n- CLASS_NAME: \"OpenLayers.Symbolizer.Polygon\"\n-\n-});\n-\n-/* ======================================================================\n- OpenLayers/Symbolizer/Text.js\n- ====================================================================== */\n-\n-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n- * full list of contributors). Published under the 2-clause BSD license.\n- * See license.txt in the OpenLayers distribution or repository for the\n- * full text of the license. */\n-\n-/**\n- * @requires OpenLayers/Symbolizer.js\n- */\n-\n-/**\n- * Class: OpenLayers.Symbolizer.Text\n- * A symbolizer used to render text labels for features.\n- */\n-OpenLayers.Symbolizer.Text = OpenLayers.Class(OpenLayers.Symbolizer, {\n-\n- /** \n- * APIProperty: label\n- * {String} The text for the label.\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /** \n- * APIProperty: fontFamily\n- * {String} The font family for the label.\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /** \n- * APIProperty: fontSize\n- * {String} The font size for the label.\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /** \n- * APIProperty: fontWeight\n- * {String} The font weight for the label.\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * Property: fontStyle\n- * {String} The font style for the label.\n- * \n- * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.\n- */\n-\n- /**\n- * Constructor: OpenLayers.Symbolizer.Text\n- * Create a symbolizer for rendering text labels.\n- *\n- * Parameters:\n- * config - {Object} An object containing properties to be set on the \n- * symbolizer. Any documented symbolizer property can be set at \n- * construction.\n- *\n- * Returns:\n- * A new text symbolizer.\n- */\n- initialize: function(config) {\n- OpenLayers.Symbolizer.prototype.initialize.apply(this, arguments);\n- },\n-\n- CLASS_NAME: \"OpenLayers.Symbolizer.Text\"\n-\n-});\n-\n-/* ======================================================================\n- OpenLayers/Symbolizer/Raster.js\n- ====================================================================== */\n-\n-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n- * full list of contributors). Published under the 2-clause BSD license.\n- * See license.txt in the OpenLayers distribution or repository for the\n- * full text of the license. */\n-\n-/**\n- * @requires OpenLayers/Symbolizer.js\n- */\n-\n-/**\n- * Class: OpenLayers.Symbolizer.Raster\n- * A symbolizer used to render raster images.\n- */\n-OpenLayers.Symbolizer.Raster = OpenLayers.Class(OpenLayers.Symbolizer, {\n-\n- /**\n- * Constructor: OpenLayers.Symbolizer.Raster\n- * Create a symbolizer for rendering rasters.\n- *\n- * Parameters:\n- * config - {Object} An object containing properties to be set on the \n- * symbolizer. Any documented symbolizer property can be set at \n- * construction.\n- *\n- * Returns:\n- * A new raster symbolizer.\n- */\n- initialize: function(config) {\n- OpenLayers.Symbolizer.prototype.initialize.apply(this, arguments);\n- },\n-\n- CLASS_NAME: \"OpenLayers.Symbolizer.Raster\"\n-\n-});\n-/* ======================================================================\n- OpenLayers/Style2.js\n- ====================================================================== */\n-\n-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n- * full list of contributors). Published under the 2-clause BSD license.\n- * See license.txt in the OpenLayers distribution or repository for the\n- * full text of the license. */\n-\n-/**\n- * @requires OpenLayers/BaseTypes/Class.js\n- * @requires OpenLayers/Rule.js\n- * @requires OpenLayers/Symbolizer/Point.js\n- * @requires OpenLayers/Symbolizer/Line.js\n- * @requires OpenLayers/Symbolizer/Polygon.js\n- * @requires OpenLayers/Symbolizer/Text.js\n- * @requires OpenLayers/Symbolizer/Raster.js\n- */\n-\n-/**\n- * Class: OpenLayers.Style2\n- * This class represents a collection of rules for rendering features.\n- */\n-OpenLayers.Style2 = OpenLayers.Class({\n-\n- /**\n- * Property: id\n- * {String} A unique id for this session.\n- */\n- id: null,\n-\n- /**\n- * APIProperty: name\n- * {String} Style identifier.\n- */\n- name: null,\n-\n- /**\n- * APIProperty: title\n- * {String} Title of this style.\n- */\n- title: null,\n-\n- /**\n- * APIProperty: description\n- * {String} Description of this style.\n- */\n- description: null,\n-\n- /**\n- * APIProperty: layerName\n- * {} Name of the layer that this style belongs to, usually\n- * according to the NamedLayer attribute of an SLD document.\n- */\n- layerName: null,\n-\n- /**\n- * APIProperty: isDefault\n- * {Boolean}\n- */\n- isDefault: false,\n-\n- /** \n- * APIProperty: rules \n- * {Array()} Collection of rendering rules.\n- */\n- rules: null,\n-\n- /** \n- * Constructor: OpenLayers.Style2\n- * Creates a style representing a collection of rendering rules.\n- *\n- * Parameters:\n- * config - {Object} An object containing properties to be set on the \n- * style. Any documented properties may be set at construction.\n- *\n- * Returns:\n- * {} A new style object.\n- */\n- initialize: function(config) {\n- OpenLayers.Util.extend(this, config);\n- this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + \"_\");\n+ this.div.style.border = width + \"px solid \" + color;\n },\n \n /** \n- * APIMethod: destroy\n- * nullify references to prevent circular references and memory leaks\n- */\n- destroy: function() {\n- for (var i = 0, len = this.rules.length; i < len; i++) {\n- this.rules[i].destroy();\n- }\n- delete this.rules;\n- },\n-\n- /**\n- * APIMethod: clone\n- * Clones this style.\n+ * Method: draw\n * \n- * Returns:\n- * {} Clone of this style.\n- */\n- clone: function() {\n- var config = OpenLayers.Util.extend({}, this);\n- // clone rules\n- if (this.rules) {\n- config.rules = [];\n- for (var i = 0, len = this.rules.length; i < len; ++i) {\n- config.rules.push(this.rules[i].clone());\n- }\n- }\n- return new OpenLayers.Style2(config);\n- },\n-\n- CLASS_NAME: \"OpenLayers.Style2\"\n-});\n-/* ======================================================================\n- OpenLayers/Spherical.js\n- ====================================================================== */\n-\n-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n- * full list of contributors). Published under the 2-clause BSD license.\n- * See license.txt in the OpenLayers distribution or repository for the\n- * full text of the license. */\n-\n-/**\n- * @requires OpenLayers/SingleFile.js\n- */\n-\n-/**\n- * Namespace: Spherical\n- * The OpenLayers.Spherical namespace includes utility functions for\n- * calculations on the basis of a spherical earth (ignoring ellipsoidal\n- * effects), which is accurate enough for most purposes.\n- *\n- * Relevant links:\n- * * http://www.movable-type.co.uk/scripts/latlong.html\n- * * http://code.google.com/apis/maps/documentation/javascript/reference.html#spherical\n- */\n-\n-OpenLayers.Spherical = OpenLayers.Spherical || {};\n-\n-OpenLayers.Spherical.DEFAULT_RADIUS = 6378137;\n-\n-/**\n- * APIFunction: computeDistanceBetween\n- * Computes the distance between two LonLats.\n- *\n- * Parameters:\n- * from - {} or {Object} Starting point. A LonLat or\n- * a JavaScript literal with lon lat properties.\n- * to - {} or {Object} Ending point. A LonLat or a\n- * JavaScript literal with lon lat properties.\n- * radius - {Float} The radius. Optional. Defaults to 6378137 meters.\n- *\n- * Returns:\n- * {Float} The distance in meters.\n- */\n-OpenLayers.Spherical.computeDistanceBetween = function(from, to, radius) {\n- var R = radius || OpenLayers.Spherical.DEFAULT_RADIUS;\n- var sinHalfDeltaLon = Math.sin(Math.PI * (to.lon - from.lon) / 360);\n- var sinHalfDeltaLat = Math.sin(Math.PI * (to.lat - from.lat) / 360);\n- var a = sinHalfDeltaLat * sinHalfDeltaLat +\n- sinHalfDeltaLon * sinHalfDeltaLon * Math.cos(Math.PI * from.lat / 180) * Math.cos(Math.PI * to.lat / 180);\n- return 2 * R * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n-};\n-\n-\n-/**\n- * APIFunction: computeHeading\n- * Computes the heading from one LonLat to another LonLat.\n- *\n- * Parameters:\n- * from - {} or {Object} Starting point. A LonLat or\n- * a JavaScript literal with lon lat properties.\n- * to - {} or {Object} Ending point. A LonLat or a\n- * JavaScript literal with lon lat properties.\n- *\n- * Returns:\n- * {Float} The heading in degrees.\n- */\n-OpenLayers.Spherical.computeHeading = function(from, to) {\n- var y = Math.sin(Math.PI * (from.lon - to.lon) / 180) * Math.cos(Math.PI * to.lat / 180);\n- var x = Math.cos(Math.PI * from.lat / 180) * Math.sin(Math.PI * to.lat / 180) -\n- Math.sin(Math.PI * from.lat / 180) * Math.cos(Math.PI * to.lat / 180) * Math.cos(Math.PI * (from.lon - to.lon) / 180);\n- return 180 * Math.atan2(y, x) / Math.PI;\n-};\n-/* ======================================================================\n- OpenLayers/Protocol.js\n- ====================================================================== */\n-\n-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n- * full list of contributors). Published under the 2-clause BSD license.\n- * See license.txt in the OpenLayers distribution or repository for the\n- * full text of the license. */\n-\n-/**\n- * @requires OpenLayers/BaseTypes/Class.js\n- */\n-\n-/**\n- * Class: OpenLayers.Protocol\n- * Abstract vector layer protocol class. Not to be instantiated directly. Use\n- * one of the protocol subclasses instead.\n- */\n-OpenLayers.Protocol = OpenLayers.Class({\n-\n- /**\n- * Property: format\n- * {} The format used by this protocol.\n- */\n- format: null,\n-\n- /**\n- * Property: options\n- * {Object} Any options sent to the constructor.\n- */\n- options: null,\n-\n- /**\n- * Property: autoDestroy\n- * {Boolean} The creator of the protocol can set autoDestroy to false\n- * to fully control when the protocol is destroyed. Defaults to\n- * true.\n- */\n- autoDestroy: true,\n-\n- /**\n- * Property: defaultFilter\n- * {} Optional default filter to read requests\n- */\n- defaultFilter: null,\n-\n- /**\n- * Constructor: OpenLayers.Protocol\n- * Abstract class for vector protocols. Create instances of a subclass.\n- *\n- * Parameters:\n- * options - {Object} Optional object whose properties will be set on the\n- * instance.\n- */\n- initialize: function(options) {\n- options = options || {};\n- OpenLayers.Util.extend(this, options);\n- this.options = options;\n- },\n-\n- /**\n- * Method: mergeWithDefaultFilter\n- * Merge filter passed to the read method with the default one\n- *\n- * Parameters:\n- * filter - {}\n- */\n- mergeWithDefaultFilter: function(filter) {\n- var merged;\n- if (filter && this.defaultFilter) {\n- merged = new OpenLayers.Filter.Logical({\n- type: OpenLayers.Filter.Logical.AND,\n- filters: [this.defaultFilter, filter]\n- });\n- } else {\n- merged = filter || this.defaultFilter || undefined;\n- }\n- return merged;\n- },\n-\n- /**\n- * APIMethod: destroy\n- * Clean up the protocol.\n- */\n- destroy: function() {\n- this.options = null;\n- this.format = null;\n- },\n-\n- /**\n- * APIMethod: read\n- * Construct a request for reading new features.\n- *\n- * Parameters:\n- * options - {Object} Optional object for configuring the request.\n- *\n- * Returns:\n- * {} An \n- * object, the same object will be passed to the callback function passed\n- * if one exists in the options object.\n- */\n- read: function(options) {\n- options = options || {};\n- options.filter = this.mergeWithDefaultFilter(options.filter);\n- },\n-\n-\n- /**\n- * APIMethod: create\n- * Construct a request for writing newly created features.\n- *\n- * Parameters:\n- * features - {Array({})} or\n- * {}\n- * options - {Object} Optional object for configuring the request.\n- *\n- * Returns:\n- * {} An \n- * object, the same object will be passed to the callback function passed\n- * if one exists in the options object.\n- */\n- create: function() {},\n-\n- /**\n- * APIMethod: update\n- * Construct a request updating modified features.\n- *\n- * Parameters:\n- * features - {Array({})} or\n- * {}\n- * options - {Object} Optional object for configuring the request.\n- *\n- * Returns:\n- * {} An \n- * object, the same object will be passed to the callback function passed\n- * if one exists in the options object.\n- */\n- update: function() {},\n-\n- /**\n- * APIMethod: delete\n- * Construct a request deleting a removed feature.\n- *\n- * Parameters:\n- * feature - {}\n- * options - {Object} Optional object for configuring the request.\n- *\n- * Returns:\n- * {} An \n- * object, the same object will be passed to the callback function passed\n- * if one exists in the options object.\n- */\n- \"delete\": function() {},\n-\n- /**\n- * APIMethod: commit\n- * Go over the features and for each take action\n- * based on the feature state. Possible actions are create,\n- * update and delete.\n- *\n- * Parameters:\n- * features - {Array({})}\n- * options - {Object} Object whose possible keys are \"create\", \"update\",\n- * \"delete\", \"callback\" and \"scope\", the values referenced by the\n- * first three are objects as passed to the \"create\", \"update\", and\n- * \"delete\" methods, the value referenced by the \"callback\" key is\n- * a function which is called when the commit operation is complete\n- * using the scope referenced by the \"scope\" key.\n- *\n- * Returns:\n- * {Array({})} An array of\n- * objects.\n- */\n- commit: function() {},\n-\n- /**\n- * Method: abort\n- * Abort an ongoing request.\n- *\n- * Parameters:\n- * response - {}\n- */\n- abort: function(response) {},\n-\n- /**\n- * Method: createCallback\n- * Returns a function that applies the given public method with resp and\n- * options arguments.\n- *\n- * Parameters:\n- * method - {Function} The method to be applied by the callback.\n- * response - {} The protocol response object.\n- * options - {Object} Options sent to the protocol method\n- */\n- createCallback: function(method, response, options) {\n- return OpenLayers.Function.bind(function() {\n- method.apply(this, [response, options]);\n- }, this);\n- },\n-\n- CLASS_NAME: \"OpenLayers.Protocol\"\n-});\n-\n-/**\n- * Class: OpenLayers.Protocol.Response\n- * Protocols return Response objects to their users.\n- */\n-OpenLayers.Protocol.Response = OpenLayers.Class({\n- /**\n- * Property: code\n- * {Number} - OpenLayers.Protocol.Response.SUCCESS or\n- * OpenLayers.Protocol.Response.FAILURE\n- */\n- code: null,\n-\n- /**\n- * Property: requestType\n- * {String} The type of request this response corresponds to. Either\n- * \"create\", \"read\", \"update\" or \"delete\".\n- */\n- requestType: null,\n-\n- /**\n- * Property: last\n- * {Boolean} - true if this is the last response expected in a commit,\n- * false otherwise, defaults to true.\n- */\n- last: true,\n-\n- /**\n- * Property: features\n- * {Array({})} or {}\n- * The features returned in the response by the server. Depending on the \n- * protocol's read payload, either features or data will be populated.\n- */\n- features: null,\n-\n- /**\n- * Property: data\n- * {Object}\n- * The data returned in the response by the server. Depending on the \n- * protocol's read payload, either features or data will be populated.\n- */\n- data: null,\n-\n- /**\n- * Property: reqFeatures\n- * {Array({})} or {}\n- * The features provided by the user and placed in the request by the\n- * protocol.\n- */\n- reqFeatures: null,\n-\n- /**\n- * Property: priv\n- */\n- priv: null,\n-\n- /**\n- * Property: error\n- * {Object} The error object in case a service exception was encountered.\n- */\n- error: null,\n-\n- /**\n- * Constructor: OpenLayers.Protocol.Response\n- *\n- * Parameters:\n- * options - {Object} Optional object whose properties will be set on the\n- * instance.\n- */\n- initialize: function(options) {\n- OpenLayers.Util.extend(this, options);\n- },\n-\n- /**\n- * Method: success\n- *\n- * Returns:\n- * {Boolean} - true on success, false otherwise\n- */\n- success: function() {\n- return this.code > 0;\n- },\n-\n- CLASS_NAME: \"OpenLayers.Protocol.Response\"\n-});\n-\n-OpenLayers.Protocol.Response.SUCCESS = 1;\n-OpenLayers.Protocol.Response.FAILURE = 0;\n-/* ======================================================================\n- OpenLayers/Strategy.js\n- ====================================================================== */\n-\n-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n- * full list of contributors). Published under the 2-clause BSD license.\n- * See license.txt in the OpenLayers distribution or repository for the\n- * full text of the license. */\n-\n-/**\n- * @requires OpenLayers/BaseTypes/Class.js\n- */\n-\n-/**\n- * Class: OpenLayers.Strategy\n- * Abstract vector layer strategy class. Not to be instantiated directly. Use\n- * one of the strategy subclasses instead.\n- */\n-OpenLayers.Strategy = OpenLayers.Class({\n-\n- /**\n- * Property: layer\n- * {} The layer this strategy belongs to.\n- */\n- layer: null,\n-\n- /**\n- * Property: options\n- * {Object} Any options sent to the constructor.\n- */\n- options: null,\n-\n- /** \n- * Property: active \n- * {Boolean} The control is active.\n- */\n- active: null,\n-\n- /**\n- * Property: autoActivate\n- * {Boolean} The creator of the strategy can set autoActivate to false\n- * to fully control when the protocol is activated and deactivated.\n- * Defaults to true.\n- */\n- autoActivate: true,\n-\n- /**\n- * Property: autoDestroy\n- * {Boolean} The creator of the strategy can set autoDestroy to false\n- * to fully control when the strategy is destroyed. Defaults to\n- * true.\n- */\n- autoDestroy: true,\n-\n- /**\n- * Constructor: OpenLayers.Strategy\n- * Abstract class for vector strategies. Create instances of a subclass.\n- *\n- * Parameters:\n- * options - {Object} Optional object whose properties will be set on the\n- * instance.\n- */\n- initialize: function(options) {\n- OpenLayers.Util.extend(this, options);\n- this.options = options;\n- // set the active property here, so that user cannot override it\n- this.active = false;\n- },\n-\n- /**\n- * APIMethod: destroy\n- * Clean up the strategy.\n- */\n- destroy: function() {\n- this.deactivate();\n- this.layer = null;\n- this.options = null;\n- },\n-\n- /**\n- * Method: setLayer\n- * Called to set the property.\n- *\n * Parameters:\n- * layer - {}\n- */\n- setLayer: function(layer) {\n- this.layer = layer;\n- },\n-\n- /**\n- * Method: activate\n- * Activate the strategy. Register any listeners, do appropriate setup.\n- *\n- * Returns:\n- * {Boolean} True if the strategy was successfully activated or false if\n- * the strategy was already active.\n- */\n- activate: function() {\n- if (!this.active) {\n- this.active = true;\n- return true;\n- }\n- return false;\n- },\n-\n- /**\n- * Method: deactivate\n- * Deactivate the strategy. Unregister any listeners, do appropriate\n- * tear-down.\n- *\n- * Returns:\n- * {Boolean} True if the strategy was successfully deactivated or false if\n- * the strategy was already inactive.\n- */\n- deactivate: function() {\n- if (this.active) {\n- this.active = false;\n- return true;\n- }\n- return false;\n- },\n-\n- CLASS_NAME: \"OpenLayers.Strategy\"\n-});\n-/* ======================================================================\n- OpenLayers/StyleMap.js\n- ====================================================================== */\n-\n-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n- * full list of contributors). Published under the 2-clause BSD license.\n- * See license.txt in the OpenLayers distribution or repository for the\n- * full text of the license. */\n-\n-/**\n- * @requires OpenLayers/BaseTypes/Class.js\n- * @requires OpenLayers/Style.js\n- * @requires OpenLayers/Feature/Vector.js\n- */\n-\n-/**\n- * Class: OpenLayers.StyleMap\n- */\n-OpenLayers.StyleMap = OpenLayers.Class({\n-\n- /**\n- * Property: styles\n- * {Object} Hash of {}, keyed by names of well known\n- * rendering intents (e.g. \"default\", \"temporary\", \"select\", \"delete\").\n- */\n- styles: null,\n-\n- /**\n- * Property: extendDefault\n- * {Boolean} if true, every render intent will extend the symbolizers\n- * specified for the \"default\" intent at rendering time. Otherwise, every\n- * rendering intent will be treated as a completely independent style.\n- */\n- extendDefault: true,\n-\n- /**\n- * Constructor: OpenLayers.StyleMap\n+ * px - {} \n+ * sz - {} \n * \n- * Parameters:\n- * style - {Object} Optional. Either a style hash, or a style object, or\n- * a hash of style objects (style hashes) keyed by rendering\n- * intent. If just one style hash or style object is passed,\n- * this will be used for all known render intents (default,\n- * select, temporary)\n- * options - {Object} optional hash of additional options for this\n- * instance\n- */\n- initialize: function(style, options) {\n- this.styles = {\n- \"default\": new OpenLayers.Style(\n- OpenLayers.Feature.Vector.style[\"default\"]),\n- \"select\": new OpenLayers.Style(\n- OpenLayers.Feature.Vector.style[\"select\"]),\n- \"temporary\": new OpenLayers.Style(\n- OpenLayers.Feature.Vector.style[\"temporary\"]),\n- \"delete\": new OpenLayers.Style(\n- OpenLayers.Feature.Vector.style[\"delete\"])\n- };\n-\n- // take whatever the user passed as style parameter and convert it\n- // into parts of stylemap.\n- if (style instanceof OpenLayers.Style) {\n- // user passed a style object\n- this.styles[\"default\"] = style;\n- this.styles[\"select\"] = style;\n- this.styles[\"temporary\"] = style;\n- this.styles[\"delete\"] = style;\n- } else if (typeof style == \"object\") {\n- for (var key in style) {\n- if (style[key] instanceof OpenLayers.Style) {\n- // user passed a hash of style objects\n- this.styles[key] = style[key];\n- } else if (typeof style[key] == \"object\") {\n- // user passsed a hash of style hashes\n- this.styles[key] = new OpenLayers.Style(style[key]);\n- } else {\n- // user passed a style hash (i.e. symbolizer)\n- this.styles[\"default\"] = new OpenLayers.Style(style);\n- this.styles[\"select\"] = new OpenLayers.Style(style);\n- this.styles[\"temporary\"] = new OpenLayers.Style(style);\n- this.styles[\"delete\"] = new OpenLayers.Style(style);\n- break;\n- }\n- }\n- }\n- OpenLayers.Util.extend(this, options);\n- },\n-\n- /**\n- * Method: destroy\n+ * Returns: \n+ * {DOMElement} A new DOM Image with this marker's icon set at the \n+ * location passed-in\n */\n- destroy: function() {\n- for (var key in this.styles) {\n- this.styles[key].destroy();\n- }\n- this.styles = null;\n+ draw: function(px, sz) {\n+ OpenLayers.Util.modifyDOMElement(this.div, null, px, sz);\n+ return this.div;\n },\n \n /**\n- * Method: createSymbolizer\n- * Creates the symbolizer for a feature for a render intent.\n- * \n- * Parameters:\n- * feature - {} The feature to evaluate the rules\n- * of the intended style against.\n- * intent - {String} The intent determines the symbolizer that will be\n- * used to draw the feature. Well known intents are \"default\"\n- * (for just drawing the features), \"select\" (for selected\n- * features) and \"temporary\" (for drawing features).\n+ * Method: onScreen\n * \n- * Returns:\n- * {Object} symbolizer hash\n+ * Rreturn:\n+ * {Boolean} Whether or not the marker is currently visible on screen.\n */\n- createSymbolizer: function(feature, intent) {\n- if (!feature) {\n- feature = new OpenLayers.Feature.Vector();\n- }\n- if (!this.styles[intent]) {\n- intent = \"default\";\n- }\n- feature.renderIntent = intent;\n- var defaultSymbolizer = {};\n- if (this.extendDefault && intent != \"default\") {\n- defaultSymbolizer = this.styles[\"default\"].createSymbolizer(feature);\n+ onScreen: function() {\n+ var onScreen = false;\n+ if (this.map) {\n+ var screenBounds = this.map.getExtent();\n+ onScreen = screenBounds.containsBounds(this.bounds, true, true);\n }\n- return OpenLayers.Util.extend(defaultSymbolizer,\n- this.styles[intent].createSymbolizer(feature));\n+ return onScreen;\n },\n \n /**\n- * Method: addUniqueValueRules\n- * Convenience method to create comparison rules for unique values of a\n- * property. The rules will be added to the style object for a specified\n- * rendering intent. This method is a shortcut for creating something like\n- * the \"unique value legends\" familiar from well known desktop GIS systems\n+ * Method: display\n+ * Hide or show the icon\n * \n * Parameters:\n- * renderIntent - {String} rendering intent to add the rules to\n- * property - {String} values of feature attributes to create the\n- * rules for\n- * symbolizers - {Object} Hash of symbolizers, keyed by the desired\n- * property values \n- * context - {Object} An optional object with properties that\n- * symbolizers' property values should be evaluated\n- * against. If no context is specified, feature.attributes\n- * will be used\n+ * display - {Boolean} \n */\n- addUniqueValueRules: function(renderIntent, property, symbolizers, context) {\n- var rules = [];\n- for (var value in symbolizers) {\n- rules.push(new OpenLayers.Rule({\n- symbolizer: symbolizers[value],\n- context: context,\n- filter: new OpenLayers.Filter.Comparison({\n- type: OpenLayers.Filter.Comparison.EQUAL_TO,\n- property: property,\n- value: value\n- })\n- }));\n- }\n- this.styles[renderIntent].addRules(rules);\n+ display: function(display) {\n+ this.div.style.display = (display) ? \"\" : \"none\";\n },\n \n- CLASS_NAME: \"OpenLayers.StyleMap\"\n+ CLASS_NAME: \"OpenLayers.Marker.Box\"\n });\n-/* ======================================================================\n- OpenLayers/Kinetic.js\n- ====================================================================== */\n-\n-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n- * full list of contributors). Published under the 2-clause BSD license.\n- * See license.txt in the OpenLayers distribution or repository for the\n- * full text of the license. */\n-\n-/**\n- * @requires OpenLayers/BaseTypes/Class.js\n- * @requires OpenLayers/Animation.js\n- */\n-\n-OpenLayers.Kinetic = OpenLayers.Class({\n-\n- /**\n- * Property: threshold\n- * In most cases changing the threshold isn't needed.\n- * In px/ms, default to 0.\n- */\n- threshold: 0,\n-\n- /**\n- * Property: deceleration\n- * {Float} the deseleration in px/ms\u00b2, default to 0.0035.\n- */\n- deceleration: 0.0035,\n-\n- /**\n- * Property: nbPoints\n- * {Integer} the number of points we use to calculate the kinetic\n- * initial values.\n- */\n- nbPoints: 100,\n-\n- /**\n- * Property: delay\n- * {Float} time to consider to calculate the kinetic initial values.\n- * In ms, default to 200.\n- */\n- delay: 200,\n-\n- /**\n- * Property: points\n- * List of points use to calculate the kinetic initial values.\n- */\n- points: undefined,\n-\n- /**\n- * Property: timerId\n- * ID of the timer.\n- */\n- timerId: undefined,\n-\n- /**\n- * Constructor: OpenLayers.Kinetic\n- *\n- * Parameters:\n- * options - {Object}\n- */\n- initialize: function(options) {\n- OpenLayers.Util.extend(this, options);\n- },\n-\n- /**\n- * Method: begin\n- * Begins the dragging.\n- */\n- begin: function() {\n- OpenLayers.Animation.stop(this.timerId);\n- this.timerId = undefined;\n- this.points = [];\n- },\n-\n- /**\n- * Method: update\n- * Updates during the dragging.\n- *\n- * Parameters:\n- * xy - {} The new position.\n- */\n- update: function(xy) {\n- this.points.unshift({\n- xy: xy,\n- tick: new Date().getTime()\n- });\n- if (this.points.length > this.nbPoints) {\n- this.points.pop();\n- }\n- },\n-\n- /**\n- * Method: end\n- * Ends the dragging, start the kinetic.\n- *\n- * Parameters:\n- * xy - {} The last position.\n- *\n- * Returns:\n- * {Object} An object with two properties: \"speed\", and \"theta\". The\n- * \"speed\" and \"theta\" values are to be passed to the move \n- * function when starting the animation.\n- */\n- end: function(xy) {\n- var last, now = new Date().getTime();\n- for (var i = 0, l = this.points.length, point; i < l; i++) {\n- point = this.points[i];\n- if (now - point.tick > this.delay) {\n- break;\n- }\n- last = point;\n- }\n- if (!last) {\n- return;\n- }\n- var time = new Date().getTime() - last.tick;\n- var dist = Math.sqrt(Math.pow(xy.x - last.xy.x, 2) +\n- Math.pow(xy.y - last.xy.y, 2));\n- var speed = dist / time;\n- if (speed == 0 || speed < this.threshold) {\n- return;\n- }\n- var theta = Math.asin((xy.y - last.xy.y) / dist);\n- if (last.xy.x <= xy.x) {\n- theta = Math.PI - theta;\n- }\n- return {\n- speed: speed,\n- theta: theta\n- };\n- },\n-\n- /**\n- * Method: move\n- * Launch the kinetic move pan.\n- *\n- * Parameters:\n- * info - {Object} An object with two properties, \"speed\", and \"theta\".\n- * These values are those returned from the \"end\" call.\n- * callback - {Function} Function called on every step of the animation,\n- * receives x, y (values to pan), end (is the last point).\n- */\n- move: function(info, callback) {\n- var v0 = info.speed;\n- var fx = Math.cos(info.theta);\n- var fy = -Math.sin(info.theta);\n-\n- var initialTime = new Date().getTime();\n-\n- var lastX = 0;\n- var lastY = 0;\n-\n- var timerCallback = function() {\n- if (this.timerId == null) {\n- return;\n- }\n-\n- var t = new Date().getTime() - initialTime;\n-\n- var p = (-this.deceleration * Math.pow(t, 2)) / 2.0 + v0 * t;\n- var x = p * fx;\n- var y = p * fy;\n-\n- var args = {};\n- args.end = false;\n- var v = -this.deceleration * t + v0;\n-\n- if (v <= 0) {\n- OpenLayers.Animation.stop(this.timerId);\n- this.timerId = null;\n- args.end = true;\n- }\n-\n- args.x = x - lastX;\n- args.y = y - lastY;\n- lastX = x;\n- lastY = y;\n- callback(args.x, args.y, args.end);\n- };\n-\n- this.timerId = OpenLayers.Animation.start(\n- OpenLayers.Function.bind(timerCallback, this)\n- );\n- },\n \n- CLASS_NAME: \"OpenLayers.Kinetic\"\n-});\n /* ======================================================================\n OpenLayers/Events/featureclick.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n * See license.txt in the OpenLayers distribution or repository for the\n@@ -34175,11974 +33642,9525 @@\n }\n }\n return propagate;\n }\n \n });\n /* ======================================================================\n- OpenLayers/Format/WMSGetFeatureInfo.js\n+ OpenLayers/Handler/Drag.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n * See license.txt in the OpenLayers distribution or repository for the\n * full text of the license. */\n \n /**\n- * @requires OpenLayers/Format/XML.js\n+ * @requires OpenLayers/Handler.js\n */\n \n /**\n- * Class: OpenLayers.Format.WMSGetFeatureInfo\n- * Class to read GetFeatureInfo responses from Web Mapping Services\n+ * Class: OpenLayers.Handler.Drag\n+ * The drag handler is used to deal with sequences of browser events related\n+ * to dragging. The handler is used by controls that want to know when\n+ * a drag sequence begins, when a drag is happening, and when it has\n+ * finished.\n+ *\n+ * Controls that use the drag handler typically construct it with callbacks\n+ * for 'down', 'move', and 'done'. Callbacks for these keys are called\n+ * when the drag begins, with each move, and when the drag is done. In\n+ * addition, controls can have callbacks keyed to 'up' and 'out' if they\n+ * care to differentiate between the types of events that correspond with\n+ * the end of a drag sequence. If no drag actually occurs (no mouse move)\n+ * the 'down' and 'up' callbacks will be called, but not the 'done'\n+ * callback.\n+ *\n+ * Create a new drag handler with the constructor.\n *\n * Inherits from:\n- * - \n+ * - \n */\n-OpenLayers.Format.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Format.XML, {\n+OpenLayers.Handler.Drag = OpenLayers.Class(OpenLayers.Handler, {\n+\n+ /** \n+ * Property: started\n+ * {Boolean} When a mousedown or touchstart event is received, we want to\n+ * record it, but not set 'dragging' until the mouse moves after starting.\n+ */\n+ started: false,\n \n /**\n- * APIProperty: layerIdentifier\n- * {String} All xml nodes containing this search criteria will populate an\n- * internal array of layer nodes.\n+ * Property: stopDown\n+ * {Boolean} Stop propagation of mousedown events from getting to listeners\n+ * on the same element. Default is true.\n */\n- layerIdentifier: '_layer',\n+ stopDown: true,\n+\n+ /** \n+ * Property: dragging \n+ * {Boolean} \n+ */\n+ dragging: false,\n+\n+ /** \n+ * Property: last\n+ * {} The last pixel location of the drag.\n+ */\n+ last: null,\n+\n+ /** \n+ * Property: start\n+ * {} The first pixel location of the drag.\n+ */\n+ start: null,\n \n /**\n- * APIProperty: featureIdentifier\n- * {String} All xml nodes containing this search criteria will populate an \n- * internal array of feature nodes for each layer node found.\n+ * Property: lastMoveEvt\n+ * {Object} The last mousemove event that occurred. Used to\n+ * position the map correctly when our \"delay drag\"\n+ * timeout expired.\n */\n- featureIdentifier: '_feature',\n+ lastMoveEvt: null,\n \n /**\n- * Property: regExes\n- * Compiled regular expressions for manipulating strings.\n+ * Property: oldOnselectstart\n+ * {Function}\n */\n- regExes: {\n- trimSpace: (/^\\s*|\\s*$/g),\n- removeSpace: (/\\s*/g),\n- splitSpace: (/\\s+/),\n- trimComma: (/\\s*,\\s*/g)\n- },\n+ oldOnselectstart: null,\n \n /**\n- * Property: gmlFormat\n- * {} internal GML format for parsing geometries\n- * in msGMLOutput\n+ * Property: interval\n+ * {Integer} In order to increase performance, an interval (in \n+ * milliseconds) can be set to reduce the number of drag events \n+ * called. If set, a new drag event will not be set until the \n+ * interval has passed. \n+ * Defaults to 0, meaning no interval. \n */\n- gmlFormat: null,\n+ interval: 0,\n \n /**\n- * Constructor: OpenLayers.Format.WMSGetFeatureInfo\n- * Create a new parser for WMS GetFeatureInfo responses\n- *\n+ * Property: timeoutId\n+ * {String} The id of the timeout used for the mousedown interval.\n+ * This is \"private\", and should be left alone.\n+ */\n+ timeoutId: null,\n+\n+ /**\n+ * APIProperty: documentDrag\n+ * {Boolean} If set to true, the handler will also handle mouse moves when\n+ * the cursor has moved out of the map viewport. Default is false.\n+ */\n+ documentDrag: false,\n+\n+ /**\n+ * Property: documentEvents\n+ * {Boolean} Are we currently observing document events?\n+ */\n+ documentEvents: null,\n+\n+ /**\n+ * Constructor: OpenLayers.Handler.Drag\n+ * Returns OpenLayers.Handler.Drag\n+ * \n * Parameters:\n- * options - {Object} An optional object whose properties will be set on\n- * this instance.\n+ * control - {} The control that is making use of\n+ * this handler. If a handler is being used without a control, the\n+ * handlers setMap method must be overridden to deal properly with\n+ * the map.\n+ * callbacks - {Object} An object containing a single function to be\n+ * called when the drag operation is finished. The callback should\n+ * expect to recieve a single argument, the pixel location of the event.\n+ * Callbacks for 'move' and 'done' are supported. You can also speficy\n+ * callbacks for 'down', 'up', and 'out' to respond to those events.\n+ * options - {Object} \n */\n+ initialize: function(control, callbacks, options) {\n+ OpenLayers.Handler.prototype.initialize.apply(this, arguments);\n+\n+ if (this.documentDrag === true) {\n+ var me = this;\n+ this._docMove = function(evt) {\n+ me.mousemove({\n+ xy: {\n+ x: evt.clientX,\n+ y: evt.clientY\n+ },\n+ element: document\n+ });\n+ };\n+ this._docUp = function(evt) {\n+ me.mouseup({\n+ xy: {\n+ x: evt.clientX,\n+ y: evt.clientY\n+ }\n+ });\n+ };\n+ }\n+ },\n+\n \n /**\n- * APIMethod: read\n- * Read WMS GetFeatureInfo data from a string, and return an array of features\n+ * Method: dragstart\n+ * This private method is factorized from mousedown and touchstart methods\n *\n * Parameters:\n- * data - {String} or {DOMElement} data to read/parse.\n+ * evt - {Event} The event\n *\n * Returns:\n- * {Array()} An array of features.\n+ * {Boolean} Let the event propagate.\n */\n- read: function(data) {\n- var result;\n- if (typeof data == \"string\") {\n- data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);\n- }\n- var root = data.documentElement;\n- if (root) {\n- var scope = this;\n- var read = this[\"read_\" + root.nodeName];\n- if (read) {\n- result = read.call(this, root);\n- } else {\n- // fall-back to GML since this is a common output format for WMS\n- // GetFeatureInfo responses\n- result = new OpenLayers.Format.GML((this.options ? this.options : {})).read(data);\n+ dragstart: function(evt) {\n+ var propagate = true;\n+ this.dragging = false;\n+ if (this.checkModifiers(evt) &&\n+ (OpenLayers.Event.isLeftClick(evt) ||\n+ OpenLayers.Event.isSingleTouch(evt))) {\n+ this.started = true;\n+ this.start = evt.xy;\n+ this.last = evt.xy;\n+ OpenLayers.Element.addClass(\n+ this.map.viewPortDiv, \"olDragDown\"\n+ );\n+ this.down(evt);\n+ this.callback(\"down\", [evt.xy]);\n+\n+ // prevent document dragging\n+ OpenLayers.Event.preventDefault(evt);\n+\n+ if (!this.oldOnselectstart) {\n+ this.oldOnselectstart = document.onselectstart ?\n+ document.onselectstart : OpenLayers.Function.True;\n }\n+ document.onselectstart = OpenLayers.Function.False;\n+\n+ propagate = !this.stopDown;\n } else {\n- result = data;\n+ this.started = false;\n+ this.start = null;\n+ this.last = null;\n }\n- return result;\n+ return propagate;\n },\n \n-\n /**\n- * Method: read_msGMLOutput\n- * Parse msGMLOutput nodes.\n+ * Method: dragmove\n+ * This private method is factorized from mousemove and touchmove methods\n *\n * Parameters:\n- * data - {DOMElement}\n+ * evt - {Event} The event\n *\n * Returns:\n- * {Array}\n+ * {Boolean} Let the event propagate.\n */\n- read_msGMLOutput: function(data) {\n- var response = [];\n- var layerNodes = this.getSiblingNodesByTagCriteria(data,\n- this.layerIdentifier);\n- if (layerNodes) {\n- for (var i = 0, len = layerNodes.length; i < len; ++i) {\n- var node = layerNodes[i];\n- var layerName = node.nodeName;\n- if (node.prefix) {\n- layerName = layerName.split(':')[1];\n- }\n- var layerName = layerName.replace(this.layerIdentifier, '');\n- var featureNodes = this.getSiblingNodesByTagCriteria(node,\n- this.featureIdentifier);\n- if (featureNodes) {\n- for (var j = 0; j < featureNodes.length; j++) {\n- var featureNode = featureNodes[j];\n- var geomInfo = this.parseGeometry(featureNode);\n- var attributes = this.parseAttributes(featureNode);\n- var feature = new OpenLayers.Feature.Vector(geomInfo.geometry,\n- attributes, null);\n- feature.bounds = geomInfo.bounds;\n- feature.type = layerName;\n- response.push(feature);\n- }\n+ dragmove: function(evt) {\n+ this.lastMoveEvt = evt;\n+ if (this.started && !this.timeoutId && (evt.xy.x != this.last.x ||\n+ evt.xy.y != this.last.y)) {\n+ if (this.documentDrag === true && this.documentEvents) {\n+ if (evt.element === document) {\n+ this.adjustXY(evt);\n+ // do setEvent manually because the documentEvents are not\n+ // registered with the map\n+ this.setEvent(evt);\n+ } else {\n+ this.removeDocumentEvents();\n }\n }\n+ if (this.interval > 0) {\n+ this.timeoutId = setTimeout(\n+ OpenLayers.Function.bind(this.removeTimeout, this),\n+ this.interval);\n+ }\n+ this.dragging = true;\n+\n+ this.move(evt);\n+ this.callback(\"move\", [evt.xy]);\n+ if (!this.oldOnselectstart) {\n+ this.oldOnselectstart = document.onselectstart;\n+ document.onselectstart = OpenLayers.Function.False;\n+ }\n+ this.last = evt.xy;\n }\n- return response;\n+ return true;\n },\n \n /**\n- * Method: read_FeatureInfoResponse\n- * Parse FeatureInfoResponse nodes.\n+ * Method: dragend\n+ * This private method is factorized from mouseup and touchend methods\n *\n * Parameters:\n- * data - {DOMElement}\n+ * evt - {Event} The event\n *\n * Returns:\n- * {Array}\n+ * {Boolean} Let the event propagate.\n */\n- read_FeatureInfoResponse: function(data) {\n- var response = [];\n- var featureNodes = this.getElementsByTagNameNS(data, '*',\n- 'FIELDS');\n+ dragend: function(evt) {\n+ if (this.started) {\n+ if (this.documentDrag === true && this.documentEvents) {\n+ this.adjustXY(evt);\n+ this.removeDocumentEvents();\n+ }\n+ var dragged = (this.start != this.last);\n+ this.started = false;\n+ this.dragging = false;\n+ OpenLayers.Element.removeClass(\n+ this.map.viewPortDiv, \"olDragDown\"\n+ );\n+ this.up(evt);\n+ this.callback(\"up\", [evt.xy]);\n+ if (dragged) {\n+ this.callback(\"done\", [evt.xy]);\n+ }\n+ document.onselectstart = this.oldOnselectstart;\n+ }\n+ return true;\n+ },\n \n- for (var i = 0, len = featureNodes.length; i < len; i++) {\n- var featureNode = featureNodes[i];\n- var geom = null;\n+ /**\n+ * The four methods below (down, move, up, and out) are used by subclasses\n+ * to do their own processing related to these mouse events.\n+ */\n \n- // attributes can be actual attributes on the FIELDS tag, \n- // or FIELD children\n- var attributes = {};\n- var j;\n- var jlen = featureNode.attributes.length;\n- if (jlen > 0) {\n- for (j = 0; j < jlen; j++) {\n- var attribute = featureNode.attributes[j];\n- attributes[attribute.nodeName] = attribute.nodeValue;\n- }\n+ /**\n+ * Method: down\n+ * This method is called during the handling of the mouse down event.\n+ * Subclasses can do their own processing here.\n+ *\n+ * Parameters:\n+ * evt - {Event} The mouse down event\n+ */\n+ down: function(evt) {},\n+\n+ /**\n+ * Method: move\n+ * This method is called during the handling of the mouse move event.\n+ * Subclasses can do their own processing here.\n+ *\n+ * Parameters:\n+ * evt - {Event} The mouse move event\n+ *\n+ */\n+ move: function(evt) {},\n+\n+ /**\n+ * Method: up\n+ * This method is called during the handling of the mouse up event.\n+ * Subclasses can do their own processing here.\n+ *\n+ * Parameters:\n+ * evt - {Event} The mouse up event\n+ */\n+ up: function(evt) {},\n+\n+ /**\n+ * Method: out\n+ * This method is called during the handling of the mouse out event.\n+ * Subclasses can do their own processing here.\n+ *\n+ * Parameters:\n+ * evt - {Event} The mouse out event\n+ */\n+ out: function(evt) {},\n+\n+ /**\n+ * The methods below are part of the magic of event handling. Because\n+ * they are named like browser events, they are registered as listeners\n+ * for the events they represent.\n+ */\n+\n+ /**\n+ * Method: mousedown\n+ * Handle mousedown events\n+ *\n+ * Parameters:\n+ * evt - {Event}\n+ *\n+ * Returns:\n+ * {Boolean} Let the event propagate.\n+ */\n+ mousedown: function(evt) {\n+ return this.dragstart(evt);\n+ },\n+\n+ /**\n+ * Method: touchstart\n+ * Handle touchstart events\n+ *\n+ * Parameters:\n+ * evt - {Event}\n+ *\n+ * Returns:\n+ * {Boolean} Let the event propagate.\n+ */\n+ touchstart: function(evt) {\n+ this.startTouch();\n+ return this.dragstart(evt);\n+ },\n+\n+ /**\n+ * Method: mousemove\n+ * Handle mousemove events\n+ *\n+ * Parameters:\n+ * evt - {Event}\n+ *\n+ * Returns:\n+ * {Boolean} Let the event propagate.\n+ */\n+ mousemove: function(evt) {\n+ return this.dragmove(evt);\n+ },\n+\n+ /**\n+ * Method: touchmove\n+ * Handle touchmove events\n+ *\n+ * Parameters:\n+ * evt - {Event}\n+ *\n+ * Returns:\n+ * {Boolean} Let the event propagate.\n+ */\n+ touchmove: function(evt) {\n+ return this.dragmove(evt);\n+ },\n+\n+ /**\n+ * Method: removeTimeout\n+ * Private. Called by mousemove() to remove the drag timeout.\n+ */\n+ removeTimeout: function() {\n+ this.timeoutId = null;\n+ // if timeout expires while we're still dragging (mouseup\n+ // hasn't occurred) then call mousemove to move to the\n+ // correct position\n+ if (this.dragging) {\n+ this.mousemove(this.lastMoveEvt);\n+ }\n+ },\n+\n+ /**\n+ * Method: mouseup\n+ * Handle mouseup events\n+ *\n+ * Parameters:\n+ * evt - {Event}\n+ *\n+ * Returns:\n+ * {Boolean} Let the event propagate.\n+ */\n+ mouseup: function(evt) {\n+ return this.dragend(evt);\n+ },\n+\n+ /**\n+ * Method: touchend\n+ * Handle touchend events\n+ *\n+ * Parameters:\n+ * evt - {Event}\n+ *\n+ * Returns:\n+ * {Boolean} Let the event propagate.\n+ */\n+ touchend: function(evt) {\n+ // override evt.xy with last position since touchend does not have\n+ // any touch position\n+ evt.xy = this.last;\n+ return this.dragend(evt);\n+ },\n+\n+ /**\n+ * Method: mouseout\n+ * Handle mouseout events\n+ *\n+ * Parameters:\n+ * evt - {Event}\n+ *\n+ * Returns:\n+ * {Boolean} Let the event propagate.\n+ */\n+ mouseout: function(evt) {\n+ if (this.started && OpenLayers.Util.mouseLeft(evt, this.map.viewPortDiv)) {\n+ if (this.documentDrag === true) {\n+ this.addDocumentEvents();\n } else {\n- var nodes = featureNode.childNodes;\n- for (j = 0, jlen = nodes.length; j < jlen; ++j) {\n- var node = nodes[j];\n- if (node.nodeType != 3) {\n- attributes[node.getAttribute(\"name\")] =\n- node.getAttribute(\"value\");\n- }\n+ var dragged = (this.start != this.last);\n+ this.started = false;\n+ this.dragging = false;\n+ OpenLayers.Element.removeClass(\n+ this.map.viewPortDiv, \"olDragDown\"\n+ );\n+ this.out(evt);\n+ this.callback(\"out\", []);\n+ if (dragged) {\n+ this.callback(\"done\", [evt.xy]);\n+ }\n+ if (document.onselectstart) {\n+ document.onselectstart = this.oldOnselectstart;\n }\n }\n+ }\n+ return true;\n+ },\n \n- response.push(\n- new OpenLayers.Feature.Vector(geom, attributes, null)\n+ /**\n+ * Method: click\n+ * The drag handler captures the click event. If something else registers\n+ * for clicks on the same element, its listener will not be called \n+ * after a drag.\n+ * \n+ * Parameters: \n+ * evt - {Event} \n+ * \n+ * Returns:\n+ * {Boolean} Let the event propagate.\n+ */\n+ click: function(evt) {\n+ // let the click event propagate only if the mouse moved\n+ return (this.start == this.last);\n+ },\n+\n+ /**\n+ * Method: activate\n+ * Activate the handler.\n+ * \n+ * Returns:\n+ * {Boolean} The handler was successfully activated.\n+ */\n+ activate: function() {\n+ var activated = false;\n+ if (OpenLayers.Handler.prototype.activate.apply(this, arguments)) {\n+ this.dragging = false;\n+ activated = true;\n+ }\n+ return activated;\n+ },\n+\n+ /**\n+ * Method: deactivate \n+ * Deactivate the handler.\n+ * \n+ * Returns:\n+ * {Boolean} The handler was successfully deactivated.\n+ */\n+ deactivate: function() {\n+ var deactivated = false;\n+ if (OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {\n+ this.started = false;\n+ this.dragging = false;\n+ this.start = null;\n+ this.last = null;\n+ deactivated = true;\n+ OpenLayers.Element.removeClass(\n+ this.map.viewPortDiv, \"olDragDown\"\n );\n }\n- return response;\n+ return deactivated;\n },\n \n /**\n- * Method: getSiblingNodesByTagCriteria\n- * Recursively searches passed xml node and all it's descendant levels for \n- * nodes whose tagName contains the passed search string. This returns an \n- * array of all sibling nodes which match the criteria from the highest \n- * hierarchial level from which a match is found.\n+ * Method: adjustXY\n+ * Converts event coordinates that are relative to the document body to\n+ * ones that are relative to the map viewport. The latter is the default in\n+ * OpenLayers.\n * \n * Parameters:\n- * node - {DOMElement} An xml node\n- * criteria - {String} Search string which will match some part of a tagName \n- * \n- * Returns:\n- * Array({DOMElement}) An array of sibling xml nodes\n+ * evt - {Object}\n */\n- getSiblingNodesByTagCriteria: function(node, criteria) {\n- var nodes = [];\n- var children, tagName, n, matchNodes, child;\n- if (node && node.hasChildNodes()) {\n- children = node.childNodes;\n- n = children.length;\n+ adjustXY: function(evt) {\n+ var pos = OpenLayers.Util.pagePosition(this.map.viewPortDiv);\n+ evt.xy.x -= pos[0];\n+ evt.xy.y -= pos[1];\n+ },\n \n- for (var k = 0; k < n; k++) {\n- child = children[k];\n- while (child && child.nodeType != 1) {\n- child = child.nextSibling;\n- k++;\n+ /**\n+ * Method: addDocumentEvents\n+ * Start observing document events when documentDrag is true and the mouse\n+ * cursor leaves the map viewport while dragging.\n+ */\n+ addDocumentEvents: function() {\n+ OpenLayers.Element.addClass(document.body, \"olDragDown\");\n+ this.documentEvents = true;\n+ OpenLayers.Event.observe(document, \"mousemove\", this._docMove);\n+ OpenLayers.Event.observe(document, \"mouseup\", this._docUp);\n+ },\n+\n+ /**\n+ * Method: removeDocumentEvents\n+ * Stops observing document events when documentDrag is true and the mouse\n+ * cursor re-enters the map viewport while dragging.\n+ */\n+ removeDocumentEvents: function() {\n+ OpenLayers.Element.removeClass(document.body, \"olDragDown\");\n+ this.documentEvents = false;\n+ OpenLayers.Event.stopObserving(document, \"mousemove\", this._docMove);\n+ OpenLayers.Event.stopObserving(document, \"mouseup\", this._docUp);\n+ },\n+\n+ CLASS_NAME: \"OpenLayers.Handler.Drag\"\n+});\n+/* ======================================================================\n+ OpenLayers/Handler/Box.js\n+ ====================================================================== */\n+\n+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n+ * full list of contributors). Published under the 2-clause BSD license.\n+ * See license.txt in the OpenLayers distribution or repository for the\n+ * full text of the license. */\n+\n+/**\n+ * @requires OpenLayers/Handler.js\n+ * @requires OpenLayers/Handler/Drag.js\n+ */\n+\n+/**\n+ * Class: OpenLayers.Handler.Box\n+ * Handler for dragging a rectangle across the map. Box is displayed \n+ * on mouse down, moves on mouse move, and is finished on mouse up.\n+ *\n+ * Inherits from:\n+ * - \n+ */\n+OpenLayers.Handler.Box = OpenLayers.Class(OpenLayers.Handler, {\n+\n+ /** \n+ * Property: dragHandler \n+ * {} \n+ */\n+ dragHandler: null,\n+\n+ /**\n+ * APIProperty: boxDivClassName\n+ * {String} The CSS class to use for drawing the box. Default is\n+ * olHandlerBoxZoomBox\n+ */\n+ boxDivClassName: 'olHandlerBoxZoomBox',\n+\n+ /**\n+ * Property: boxOffsets\n+ * {Object} Caches box offsets from css. This is used by the getBoxOffsets\n+ * method.\n+ */\n+ boxOffsets: null,\n+\n+ /**\n+ * Constructor: OpenLayers.Handler.Box\n+ *\n+ * Parameters:\n+ * control - {} \n+ * callbacks - {Object} An object with a properties whose values are\n+ * functions. Various callbacks described below.\n+ * options - {Object} \n+ *\n+ * Named callbacks:\n+ * start - Called when the box drag operation starts.\n+ * done - Called when the box drag operation is finished.\n+ * The callback should expect to receive a single argument, the box \n+ * bounds or a pixel. If the box dragging didn't span more than a 5 \n+ * pixel distance, a pixel will be returned instead of a bounds object.\n+ */\n+ initialize: function(control, callbacks, options) {\n+ OpenLayers.Handler.prototype.initialize.apply(this, arguments);\n+ this.dragHandler = new OpenLayers.Handler.Drag(\n+ this, {\n+ down: this.startBox,\n+ move: this.moveBox,\n+ out: this.removeBox,\n+ up: this.endBox\n+ }, {\n+ keyMask: this.keyMask\n+ }\n+ );\n+ },\n+\n+ /**\n+ * Method: destroy\n+ */\n+ destroy: function() {\n+ OpenLayers.Handler.prototype.destroy.apply(this, arguments);\n+ if (this.dragHandler) {\n+ this.dragHandler.destroy();\n+ this.dragHandler = null;\n+ }\n+ },\n+\n+ /**\n+ * Method: setMap\n+ */\n+ setMap: function(map) {\n+ OpenLayers.Handler.prototype.setMap.apply(this, arguments);\n+ if (this.dragHandler) {\n+ this.dragHandler.setMap(map);\n+ }\n+ },\n+\n+ /**\n+ * Method: startBox\n+ *\n+ * Parameters:\n+ * xy - {}\n+ */\n+ startBox: function(xy) {\n+ this.callback(\"start\", []);\n+ this.zoomBox = OpenLayers.Util.createDiv('zoomBox', {\n+ x: -9999,\n+ y: -9999\n+ });\n+ this.zoomBox.className = this.boxDivClassName;\n+ this.zoomBox.style.zIndex = this.map.Z_INDEX_BASE[\"Popup\"] - 1;\n+\n+ this.map.viewPortDiv.appendChild(this.zoomBox);\n+\n+ OpenLayers.Element.addClass(\n+ this.map.viewPortDiv, \"olDrawBox\"\n+ );\n+ },\n+\n+ /**\n+ * Method: moveBox\n+ */\n+ moveBox: function(xy) {\n+ var startX = this.dragHandler.start.x;\n+ var startY = this.dragHandler.start.y;\n+ var deltaX = Math.abs(startX - xy.x);\n+ var deltaY = Math.abs(startY - xy.y);\n+\n+ var offset = this.getBoxOffsets();\n+ this.zoomBox.style.width = (deltaX + offset.width + 1) + \"px\";\n+ this.zoomBox.style.height = (deltaY + offset.height + 1) + \"px\";\n+ this.zoomBox.style.left = (xy.x < startX ?\n+ startX - deltaX - offset.left : startX - offset.left) + \"px\";\n+ this.zoomBox.style.top = (xy.y < startY ?\n+ startY - deltaY - offset.top : startY - offset.top) + \"px\";\n+ },\n+\n+ /**\n+ * Method: endBox\n+ */\n+ endBox: function(end) {\n+ var result;\n+ if (Math.abs(this.dragHandler.start.x - end.x) > 5 ||\n+ Math.abs(this.dragHandler.start.y - end.y) > 5) {\n+ var start = this.dragHandler.start;\n+ var top = Math.min(start.y, end.y);\n+ var bottom = Math.max(start.y, end.y);\n+ var left = Math.min(start.x, end.x);\n+ var right = Math.max(start.x, end.x);\n+ result = new OpenLayers.Bounds(left, bottom, right, top);\n+ } else {\n+ result = this.dragHandler.start.clone(); // i.e. OL.Pixel\n+ }\n+ this.removeBox();\n+\n+ this.callback(\"done\", [result]);\n+ },\n+\n+ /**\n+ * Method: removeBox\n+ * Remove the zoombox from the screen and nullify our reference to it.\n+ */\n+ removeBox: function() {\n+ this.map.viewPortDiv.removeChild(this.zoomBox);\n+ this.zoomBox = null;\n+ this.boxOffsets = null;\n+ OpenLayers.Element.removeClass(\n+ this.map.viewPortDiv, \"olDrawBox\"\n+ );\n+\n+ },\n+\n+ /**\n+ * Method: activate\n+ */\n+ activate: function() {\n+ if (OpenLayers.Handler.prototype.activate.apply(this, arguments)) {\n+ this.dragHandler.activate();\n+ return true;\n+ } else {\n+ return false;\n+ }\n+ },\n+\n+ /**\n+ * Method: deactivate\n+ */\n+ deactivate: function() {\n+ if (OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {\n+ if (this.dragHandler.deactivate()) {\n+ if (this.zoomBox) {\n+ this.removeBox();\n }\n- tagName = (child ? child.nodeName : '');\n- if (tagName.length > 0 && tagName.indexOf(criteria) > -1) {\n- nodes.push(child);\n- } else {\n- matchNodes = this.getSiblingNodesByTagCriteria(\n- child, criteria);\n+ }\n+ return true;\n+ } else {\n+ return false;\n+ }\n+ },\n+\n+ /**\n+ * Method: getBoxOffsets\n+ * Determines border offsets for a box, according to the box model.\n+ * \n+ * Returns:\n+ * {Object} an object with the following offsets:\n+ * - left\n+ * - right\n+ * - top\n+ * - bottom\n+ * - width\n+ * - height\n+ */\n+ getBoxOffsets: function() {\n+ if (!this.boxOffsets) {\n+ // Determine the box model. If the testDiv's clientWidth is 3, then\n+ // the borders are outside and we are dealing with the w3c box\n+ // model. Otherwise, the browser uses the traditional box model and\n+ // the borders are inside the box bounds, leaving us with a\n+ // clientWidth of 1.\n+ var testDiv = document.createElement(\"div\");\n+ //testDiv.style.visibility = \"hidden\";\n+ testDiv.style.position = \"absolute\";\n+ testDiv.style.border = \"1px solid black\";\n+ testDiv.style.width = \"3px\";\n+ document.body.appendChild(testDiv);\n+ var w3cBoxModel = testDiv.clientWidth == 3;\n+ document.body.removeChild(testDiv);\n+\n+ var left = parseInt(OpenLayers.Element.getStyle(this.zoomBox,\n+ \"border-left-width\"));\n+ var right = parseInt(OpenLayers.Element.getStyle(\n+ this.zoomBox, \"border-right-width\"));\n+ var top = parseInt(OpenLayers.Element.getStyle(this.zoomBox,\n+ \"border-top-width\"));\n+ var bottom = parseInt(OpenLayers.Element.getStyle(\n+ this.zoomBox, \"border-bottom-width\"));\n+ this.boxOffsets = {\n+ left: left,\n+ right: right,\n+ top: top,\n+ bottom: bottom,\n+ width: w3cBoxModel === false ? left + right : 0,\n+ height: w3cBoxModel === false ? top + bottom : 0\n+ };\n+ }\n+ return this.boxOffsets;\n+ },\n+\n+ CLASS_NAME: \"OpenLayers.Handler.Box\"\n+});\n+/* ======================================================================\n+ OpenLayers/Control/ZoomBox.js\n+ ====================================================================== */\n+\n+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n+ * full list of contributors). Published under the 2-clause BSD license.\n+ * See license.txt in the OpenLayers distribution or repository for the\n+ * full text of the license. */\n+\n+/**\n+ * @requires OpenLayers/Control.js\n+ * @requires OpenLayers/Handler/Box.js\n+ */\n+\n+/**\n+ * Class: OpenLayers.Control.ZoomBox\n+ * The ZoomBox control enables zooming directly to a given extent, by drawing \n+ * a box on the map. The box is drawn by holding down shift, whilst dragging \n+ * the mouse.\n+ *\n+ * Inherits from:\n+ * - \n+ */\n+OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, {\n+ /**\n+ * Property: type\n+ * {OpenLayers.Control.TYPE}\n+ */\n+ type: OpenLayers.Control.TYPE_TOOL,\n+\n+ /**\n+ * Property: out\n+ * {Boolean} Should the control be used for zooming out?\n+ */\n+ out: false,\n+\n+ /**\n+ * APIProperty: keyMask\n+ * {Integer} Zoom only occurs if the keyMask matches the combination of \n+ * keys down. Use bitwise operators and one or more of the\n+ * constants to construct a keyMask. Leave null if \n+ * not used mask. Default is null.\n+ */\n+ keyMask: null,\n \n- if (matchNodes.length > 0) {\n- (nodes.length == 0) ?\n- nodes = matchNodes: nodes.push(matchNodes);\n- }\n- }\n- }\n+ /**\n+ * APIProperty: alwaysZoom\n+ * {Boolean} Always zoom in/out when box drawn, even if the zoom level does\n+ * not change.\n+ */\n+ alwaysZoom: false,\n \n- }\n- return nodes;\n- },\n+ /**\n+ * APIProperty: zoomOnClick\n+ * {Boolean} Should we zoom when no box was dragged, i.e. the user only\n+ * clicked? Default is true.\n+ */\n+ zoomOnClick: true,\n \n /**\n- * Method: parseAttributes\n- *\n- * Parameters:\n- * node - {}\n- *\n- * Returns:\n- * {Object} An attributes object.\n- * \n- * Notes:\n- * Assumes that attributes are direct child xml nodes of the passed node\n- * and contain only a single text node. \n+ * Method: draw\n */\n- parseAttributes: function(node) {\n- var attributes = {};\n- if (node.nodeType == 1) {\n- var children = node.childNodes;\n- var n = children.length;\n- for (var i = 0; i < n; ++i) {\n- var child = children[i];\n- if (child.nodeType == 1) {\n- var grandchildren = child.childNodes;\n- var name = (child.prefix) ?\n- child.nodeName.split(\":\")[1] : child.nodeName;\n- if (grandchildren.length == 0) {\n- attributes[name] = null;\n- } else if (grandchildren.length == 1) {\n- var grandchild = grandchildren[0];\n- if (grandchild.nodeType == 3 ||\n- grandchild.nodeType == 4) {\n- var value = grandchild.nodeValue.replace(\n- this.regExes.trimSpace, \"\");\n- attributes[name] = value;\n- }\n- }\n- }\n- }\n- }\n- return attributes;\n+ draw: function() {\n+ this.handler = new OpenLayers.Handler.Box(this, {\n+ done: this.zoomBox\n+ }, {\n+ keyMask: this.keyMask\n+ });\n },\n \n /**\n- * Method: parseGeometry\n- * Parse the geometry and the feature bounds out of the node using \n- * Format.GML\n+ * Method: zoomBox\n *\n * Parameters:\n- * node - {}\n- *\n- * Returns:\n- * {Object} An object containing the geometry and the feature bounds\n+ * position - {} or {}\n */\n- parseGeometry: function(node) {\n- // we need to use the old Format.GML parser since we do not know the \n- // geometry name\n- if (!this.gmlFormat) {\n- this.gmlFormat = new OpenLayers.Format.GML();\n- }\n- var feature = this.gmlFormat.parseFeature(node);\n- var geometry, bounds = null;\n- if (feature) {\n- geometry = feature.geometry && feature.geometry.clone();\n- bounds = feature.bounds && feature.bounds.clone();\n- feature.destroy();\n+ zoomBox: function(position) {\n+ if (position instanceof OpenLayers.Bounds) {\n+ var bounds,\n+ targetCenterPx = position.getCenterPixel();\n+ if (!this.out) {\n+ var minXY = this.map.getLonLatFromPixel({\n+ x: position.left,\n+ y: position.bottom\n+ });\n+ var maxXY = this.map.getLonLatFromPixel({\n+ x: position.right,\n+ y: position.top\n+ });\n+ bounds = new OpenLayers.Bounds(minXY.lon, minXY.lat,\n+ maxXY.lon, maxXY.lat);\n+ } else {\n+ var pixWidth = position.right - position.left;\n+ var pixHeight = position.bottom - position.top;\n+ var zoomFactor = Math.min((this.map.size.h / pixHeight),\n+ (this.map.size.w / pixWidth));\n+ var extent = this.map.getExtent();\n+ var center = this.map.getLonLatFromPixel(targetCenterPx);\n+ var xmin = center.lon - (extent.getWidth() / 2) * zoomFactor;\n+ var xmax = center.lon + (extent.getWidth() / 2) * zoomFactor;\n+ var ymin = center.lat - (extent.getHeight() / 2) * zoomFactor;\n+ var ymax = center.lat + (extent.getHeight() / 2) * zoomFactor;\n+ bounds = new OpenLayers.Bounds(xmin, ymin, xmax, ymax);\n+ }\n+ // always zoom in/out \n+ var lastZoom = this.map.getZoom(),\n+ size = this.map.getSize(),\n+ centerPx = {\n+ x: size.w / 2,\n+ y: size.h / 2\n+ },\n+ zoom = this.map.getZoomForExtent(bounds),\n+ oldRes = this.map.getResolution(),\n+ newRes = this.map.getResolutionForZoom(zoom);\n+ if (oldRes == newRes) {\n+ this.map.setCenter(this.map.getLonLatFromPixel(targetCenterPx));\n+ } else {\n+ var zoomOriginPx = {\n+ x: (oldRes * targetCenterPx.x - newRes * centerPx.x) /\n+ (oldRes - newRes),\n+ y: (oldRes * targetCenterPx.y - newRes * centerPx.y) /\n+ (oldRes - newRes)\n+ };\n+ this.map.zoomTo(zoom, zoomOriginPx);\n+ }\n+ if (lastZoom == this.map.getZoom() && this.alwaysZoom == true) {\n+ this.map.zoomTo(lastZoom + (this.out ? -1 : 1));\n+ }\n+ } else if (this.zoomOnClick) { // it's a pixel\n+ if (!this.out) {\n+ this.map.zoomTo(this.map.getZoom() + 1, position);\n+ } else {\n+ this.map.zoomTo(this.map.getZoom() - 1, position);\n+ }\n }\n- return {\n- geometry: geometry,\n- bounds: bounds\n- };\n },\n \n- CLASS_NAME: \"OpenLayers.Format.WMSGetFeatureInfo\"\n-\n+ CLASS_NAME: \"OpenLayers.Control.ZoomBox\"\n });\n /* ======================================================================\n- OpenLayers/Format/WMSDescribeLayer.js\n+ OpenLayers/Control/DragPan.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n * See license.txt in the OpenLayers distribution or repository for the\n * full text of the license. */\n \n /**\n- * @requires OpenLayers/Format/XML/VersionedOGC.js\n+ * @requires OpenLayers/Control.js\n+ * @requires OpenLayers/Handler/Drag.js\n */\n \n /**\n- * Class: OpenLayers.Format.WMSDescribeLayer\n- * Read SLD WMS DescribeLayer response\n- * DescribeLayer is meant to couple WMS to WFS and WCS\n- * \n+ * Class: OpenLayers.Control.DragPan\n+ * The DragPan control pans the map with a drag of the mouse.\n+ *\n * Inherits from:\n- * - \n+ * - \n */\n-OpenLayers.Format.WMSDescribeLayer = OpenLayers.Class(OpenLayers.Format.XML.VersionedOGC, {\n+OpenLayers.Control.DragPan = OpenLayers.Class(OpenLayers.Control, {\n+\n+ /** \n+ * Property: type\n+ * {OpenLayers.Control.TYPES}\n+ */\n+ type: OpenLayers.Control.TYPE_TOOL,\n \n /**\n- * APIProperty: defaultVersion\n- * {String} Version number to assume if none found. Default is \"1.1.1\".\n+ * Property: panned\n+ * {Boolean} The map moved.\n */\n- defaultVersion: \"1.1.1\",\n+ panned: false,\n \n /**\n- * Constructor: OpenLayers.Format.WMSDescribeLayer\n- * Create a new parser for WMS DescribeLayer responses.\n+ * Property: interval\n+ * {Integer} The number of milliseconds that should ellapse before\n+ * panning the map again. Defaults to 0 milliseconds, which means that\n+ * no separate cycle is used for panning. In most cases you won't want\n+ * to change this value. For slow machines/devices larger values can be\n+ * tried out.\n+ */\n+ interval: 0,\n+\n+ /**\n+ * APIProperty: documentDrag\n+ * {Boolean} If set to true, mouse dragging will continue even if the\n+ * mouse cursor leaves the map viewport. Default is false.\n+ */\n+ documentDrag: false,\n+\n+ /**\n+ * Property: kinetic\n+ * {} The OpenLayers.Kinetic object.\n+ */\n+ kinetic: null,\n+\n+ /**\n+ * APIProperty: enableKinetic\n+ * {Boolean} Set this option to enable \"kinetic dragging\". Can be\n+ * set to true or to an object. If set to an object this\n+ * object will be passed to the {}\n+ * constructor. Defaults to true.\n+ * To get kinetic dragging, ensure that OpenLayers/Kinetic.js is\n+ * included in your build config.\n+ */\n+ enableKinetic: true,\n+\n+ /**\n+ * APIProperty: kineticInterval\n+ * {Integer} Interval in milliseconds between 2 steps in the \"kinetic\n+ * scrolling\". Applies only if enableKinetic is set. Defaults\n+ * to 10 milliseconds.\n+ */\n+ kineticInterval: 10,\n+\n+\n+ /**\n+ * Method: draw\n+ * Creates a Drag handler, using and\n+ * as callbacks.\n+ */\n+ draw: function() {\n+ if (this.enableKinetic && OpenLayers.Kinetic) {\n+ var config = {\n+ interval: this.kineticInterval\n+ };\n+ if (typeof this.enableKinetic === \"object\") {\n+ config = OpenLayers.Util.extend(config, this.enableKinetic);\n+ }\n+ this.kinetic = new OpenLayers.Kinetic(config);\n+ }\n+ this.handler = new OpenLayers.Handler.Drag(this, {\n+ \"move\": this.panMap,\n+ \"done\": this.panMapDone,\n+ \"down\": this.panMapStart\n+ }, {\n+ interval: this.interval,\n+ documentDrag: this.documentDrag\n+ });\n+ },\n+\n+ /**\n+ * Method: panMapStart\n+ */\n+ panMapStart: function() {\n+ if (this.kinetic) {\n+ this.kinetic.begin();\n+ }\n+ },\n+\n+ /**\n+ * Method: panMap\n *\n * Parameters:\n- * options - {Object} An optional object whose properties will be set on\n- * this instance.\n+ * xy - {} Pixel of the mouse position\n */\n+ panMap: function(xy) {\n+ if (this.kinetic) {\n+ this.kinetic.update(xy);\n+ }\n+ this.panned = true;\n+ this.map.pan(\n+ this.handler.last.x - xy.x,\n+ this.handler.last.y - xy.y, {\n+ dragging: true,\n+ animate: false\n+ }\n+ );\n+ },\n \n /**\n- * APIMethod: read\n- * Read DescribeLayer data from a string, and return the response. \n- * The OGC currently defines 2 formats which are allowed for output,\n- * so we need to parse these 2 types\n- * \n- * Parameters: \n- * data - {String} or {DOMElement} data to read/parse.\n+ * Method: panMapDone\n+ * Finish the panning operation. Only call setCenter (through )\n+ * if the map has actually been moved.\n *\n- * Returns:\n- * {Array} Array of {} objects which have:\n- * - {String} owsType: WFS/WCS\n- * - {String} owsURL: the online resource\n- * - {String} typeName: the name of the typename on the service\n+ * Parameters:\n+ * xy - {} Pixel of the mouse position\n */\n+ panMapDone: function(xy) {\n+ if (this.panned) {\n+ var res = null;\n+ if (this.kinetic) {\n+ res = this.kinetic.end(xy);\n+ }\n+ this.map.pan(\n+ this.handler.last.x - xy.x,\n+ this.handler.last.y - xy.y, {\n+ dragging: !!res,\n+ animate: false\n+ }\n+ );\n+ if (res) {\n+ var self = this;\n+ this.kinetic.move(res, function(x, y, end) {\n+ self.map.pan(x, y, {\n+ dragging: !end,\n+ animate: false\n+ });\n+ });\n+ }\n+ this.panned = false;\n+ }\n+ },\n \n- CLASS_NAME: \"OpenLayers.Format.WMSDescribeLayer\"\n-\n+ CLASS_NAME: \"OpenLayers.Control.DragPan\"\n });\n /* ======================================================================\n- OpenLayers/Format/Context.js\n+ OpenLayers/Handler/MouseWheel.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n * See license.txt in the OpenLayers distribution or repository for the\n * full text of the license. */\n \n /**\n- * @requires OpenLayers/Format/XML/VersionedOGC.js\n+ * @requires OpenLayers/Handler.js\n */\n \n /**\n- * Class: OpenLayers.Format.Context\n- * Base class for both Format.WMC and Format.OWSContext\n- *\n+ * Class: OpenLayers.Handler.MouseWheel\n+ * Handler for wheel up/down events.\n+ * \n * Inherits from:\n- * - \n+ * - \n */\n-OpenLayers.Format.Context = OpenLayers.Class(OpenLayers.Format.XML.VersionedOGC, {\n+OpenLayers.Handler.MouseWheel = OpenLayers.Class(OpenLayers.Handler, {\n+ /** \n+ * Property: wheelListener \n+ * {function} \n+ */\n+ wheelListener: null,\n \n /**\n- * Property: layerOptions\n- * {Object} Default options for layers created by the parser. These\n- * options are overridden by the options which are read from the\n- * capabilities document.\n+ * Property: interval\n+ * {Integer} In order to increase server performance, an interval (in \n+ * milliseconds) can be set to reduce the number of up/down events \n+ * called. If set, a new up/down event will not be set until the \n+ * interval has passed. \n+ * Defaults to 0, meaning no interval. \n */\n- layerOptions: null,\n+ interval: 0,\n \n /**\n- * Property: layerParams\n- * {Object} Default parameters for layers created by the parser. This\n- * can be used e.g. to override DEFAULT_PARAMS for \n- * OpenLayers.Layer.WMS.\n+ * Property: maxDelta\n+ * {Integer} Maximum delta to collect before breaking from the current\n+ * interval. In cumulative mode, this also limits the maximum delta\n+ * returned from the handler. Default is Number.POSITIVE_INFINITY.\n */\n- layerParams: null,\n+ maxDelta: Number.POSITIVE_INFINITY,\n \n /**\n- * Constructor: OpenLayers.Format.Context\n- * Create a new parser for Context documents.\n- *\n- * Parameters:\n- * options - {Object} An optional object whose properties will be set on\n- * this instance.\n+ * Property: delta\n+ * {Integer} When interval is set, delta collects the mousewheel z-deltas\n+ * of the events that occur within the interval.\n+ * See also the cumulative option\n */\n+ delta: 0,\n \n /**\n- * APIMethod: read\n- * Read Context data from a string, and return an object with map\n- * properties and a list of layers.\n+ * Property: cumulative\n+ * {Boolean} When interval is set: true to collect all the mousewheel \n+ * z-deltas, false to only record the delta direction (positive or\n+ * negative)\n+ */\n+ cumulative: true,\n+\n+ /**\n+ * Constructor: OpenLayers.Handler.MouseWheel\n *\n * Parameters:\n- * data - {String} or {DOMElement} data to read/parse.\n- * options - {Object} The options object must contain a map property. If\n- * the map property is a string, it must be the id of a dom element\n- * where the new map will be placed. If the map property is an\n- * , the layers from the context document will be added\n- * to the map.\n- *\n- * Returns:\n- * {} A map based on the context.\n+ * control - {} \n+ * callbacks - {Object} An object containing a single function to be\n+ * called when the drag operation is finished.\n+ * The callback should expect to recieve a single\n+ * argument, the point geometry.\n+ * options - {Object} \n */\n- read: function(data, options) {\n- var context = OpenLayers.Format.XML.VersionedOGC.prototype.read.apply(this,\n- arguments);\n- var map;\n- if (options && options.map) {\n- this.context = context;\n- if (options.map instanceof OpenLayers.Map) {\n- map = this.mergeContextToMap(context, options.map);\n- } else {\n- var mapOptions = options.map;\n- if (OpenLayers.Util.isElement(mapOptions) ||\n- typeof mapOptions == \"string\") {\n- // we assume mapOptions references a div\n- // element\n- mapOptions = {\n- div: mapOptions\n- };\n- }\n- map = this.contextToMap(context, mapOptions);\n- }\n- } else {\n- // not documented as part of the API, provided as a non-API option\n- map = context;\n- }\n- return map;\n+ initialize: function(control, callbacks, options) {\n+ OpenLayers.Handler.prototype.initialize.apply(this, arguments);\n+ this.wheelListener = OpenLayers.Function.bindAsEventListener(\n+ this.onWheelEvent, this\n+ );\n },\n \n /**\n- * Method: getLayerFromContext\n- * Create a WMS layer from a layerContext object.\n- *\n+ * Method: destroy\n+ */\n+ destroy: function() {\n+ OpenLayers.Handler.prototype.destroy.apply(this, arguments);\n+ this.wheelListener = null;\n+ },\n+\n+ /**\n+ * Mouse ScrollWheel code thanks to http://adomas.org/javascript-mouse-wheel/\n+ */\n+\n+ /** \n+ * Method: onWheelEvent\n+ * Catch the wheel event and handle it xbrowserly\n+ * \n * Parameters:\n- * layerContext - {Object} An object representing a WMS layer.\n- *\n- * Returns:\n- * {} A WMS layer.\n+ * e - {Event} \n */\n- getLayerFromContext: function(layerContext) {\n- var i, len;\n- // fill initial options object from layerContext\n- var options = {\n- queryable: layerContext.queryable, //keep queryable for api compatibility\n- visibility: layerContext.visibility,\n- maxExtent: layerContext.maxExtent,\n- metadata: OpenLayers.Util.applyDefaults(layerContext.metadata, {\n- styles: layerContext.styles,\n- formats: layerContext.formats,\n- \"abstract\": layerContext[\"abstract\"],\n- dataURL: layerContext.dataURL\n- }),\n- numZoomLevels: layerContext.numZoomLevels,\n- units: layerContext.units,\n- isBaseLayer: layerContext.isBaseLayer,\n- opacity: layerContext.opacity,\n- displayInLayerSwitcher: layerContext.displayInLayerSwitcher,\n- singleTile: layerContext.singleTile,\n- tileSize: (layerContext.tileSize) ?\n- new OpenLayers.Size(\n- layerContext.tileSize.width,\n- layerContext.tileSize.height\n- ) : undefined,\n- minScale: layerContext.minScale || layerContext.maxScaleDenominator,\n- maxScale: layerContext.maxScale || layerContext.minScaleDenominator,\n- srs: layerContext.srs,\n- dimensions: layerContext.dimensions,\n- metadataURL: layerContext.metadataURL\n- };\n- if (this.layerOptions) {\n- OpenLayers.Util.applyDefaults(options, this.layerOptions);\n+ onWheelEvent: function(e) {\n+\n+ // make sure we have a map and check keyboard modifiers\n+ if (!this.map || !this.checkModifiers(e)) {\n+ return;\n }\n \n- var params = {\n- layers: layerContext.name,\n- transparent: layerContext.transparent,\n- version: layerContext.version\n- };\n- if (layerContext.formats && layerContext.formats.length > 0) {\n- // set default value for params if current attribute is not positionned\n- params.format = layerContext.formats[0].value;\n- for (i = 0, len = layerContext.formats.length; i < len; i++) {\n- var format = layerContext.formats[i];\n- if (format.current == true) {\n- params.format = format.value;\n- break;\n+ // Ride up the element's DOM hierarchy to determine if it or any of \n+ // its ancestors was: \n+ // * specifically marked as scrollable (CSS overflow property)\n+ // * one of our layer divs or a div marked as scrollable\n+ // ('olScrollable' CSS class)\n+ // * the map div\n+ //\n+ var overScrollableDiv = false;\n+ var allowScroll = false;\n+ var overMapDiv = false;\n+\n+ var elem = OpenLayers.Event.element(e);\n+ while ((elem != null) && !overMapDiv && !overScrollableDiv) {\n+\n+ if (!overScrollableDiv) {\n+ try {\n+ var overflow;\n+ if (elem.currentStyle) {\n+ overflow = elem.currentStyle[\"overflow\"];\n+ } else {\n+ var style =\n+ document.defaultView.getComputedStyle(elem, null);\n+ overflow = style.getPropertyValue(\"overflow\");\n+ }\n+ overScrollableDiv = (overflow &&\n+ (overflow == \"auto\") || (overflow == \"scroll\"));\n+ } catch (err) {\n+ //sometimes when scrolling in a popup, this causes \n+ // obscure browser error\n }\n }\n- }\n- if (layerContext.styles && layerContext.styles.length > 0) {\n- for (i = 0, len = layerContext.styles.length; i < len; i++) {\n- var style = layerContext.styles[i];\n- if (style.current == true) {\n- // three style types to consider\n- // 1) linked SLD\n- // 2) inline SLD\n- // 3) named style\n- if (style.href) {\n- params.sld = style.href;\n- } else if (style.body) {\n- params.sld_body = style.body;\n- } else {\n- params.styles = style.name;\n+\n+ if (!allowScroll) {\n+ allowScroll = OpenLayers.Element.hasClass(elem, 'olScrollable');\n+ if (!allowScroll) {\n+ for (var i = 0, len = this.map.layers.length; i < len; i++) {\n+ // Are we in the layer div? Note that we have two cases\n+ // here: one is to catch EventPane layers, which have a\n+ // pane above the layer (layer.pane)\n+ var layer = this.map.layers[i];\n+ if (elem == layer.div || elem == layer.pane) {\n+ allowScroll = true;\n+ break;\n+ }\n }\n- break;\n }\n }\n- }\n- if (this.layerParams) {\n- OpenLayers.Util.applyDefaults(params, this.layerParams);\n- }\n+ overMapDiv = (elem == this.map.div);\n \n- var layer = null;\n- var service = layerContext.service;\n- if (service == OpenLayers.Format.Context.serviceTypes.WFS) {\n- options.strategies = [new OpenLayers.Strategy.BBOX()];\n- options.protocol = new OpenLayers.Protocol.WFS({\n- url: layerContext.url,\n- // since we do not know featureNS, let the protocol\n- // determine it automagically using featurePrefix\n- featurePrefix: layerContext.name.split(\":\")[0],\n- featureType: layerContext.name.split(\":\").pop()\n- });\n- layer = new OpenLayers.Layer.Vector(\n- layerContext.title || layerContext.name,\n- options\n- );\n- } else if (service == OpenLayers.Format.Context.serviceTypes.KML) {\n- // use a vector layer with an HTTP Protcol and a Fixed strategy\n- options.strategies = [new OpenLayers.Strategy.Fixed()];\n- options.protocol = new OpenLayers.Protocol.HTTP({\n- url: layerContext.url,\n- format: new OpenLayers.Format.KML()\n- });\n- layer = new OpenLayers.Layer.Vector(\n- layerContext.title || layerContext.name,\n- options\n- );\n- } else if (service == OpenLayers.Format.Context.serviceTypes.GML) {\n- // use a vector layer with a HTTP Protocol and a Fixed strategy\n- options.strategies = [new OpenLayers.Strategy.Fixed()];\n- options.protocol = new OpenLayers.Protocol.HTTP({\n- url: layerContext.url,\n- format: new OpenLayers.Format.GML()\n- });\n- layer = new OpenLayers.Layer.Vector(\n- layerContext.title || layerContext.name,\n- options\n- );\n- } else if (layerContext.features) {\n- // inline GML or KML features\n- layer = new OpenLayers.Layer.Vector(\n- layerContext.title || layerContext.name,\n- options\n- );\n- layer.addFeatures(layerContext.features);\n- } else if (layerContext.categoryLayer !== true) {\n- layer = new OpenLayers.Layer.WMS(\n- layerContext.title || layerContext.name,\n- layerContext.url,\n- params,\n- options\n- );\n+ elem = elem.parentNode;\n }\n- return layer;\n- },\n \n- /**\n- * Method: getLayersFromContext\n- * Create an array of layers from an array of layerContext objects.\n- *\n- * Parameters:\n- * layersContext - {Array(Object)} An array of objects representing layers.\n- *\n- * Returns:\n- * {Array()} An array of layers.\n- */\n- getLayersFromContext: function(layersContext) {\n- var layers = [];\n- for (var i = 0, len = layersContext.length; i < len; i++) {\n- var layer = this.getLayerFromContext(layersContext[i]);\n- if (layer !== null) {\n- layers.push(layer);\n+ // Logic below is the following:\n+ //\n+ // If we are over a scrollable div or not over the map div:\n+ // * do nothing (let the browser handle scrolling)\n+ //\n+ // otherwise \n+ // \n+ // If we are over the layer div or a 'olScrollable' div:\n+ // * zoom/in out\n+ // then\n+ // * kill event (so as not to also scroll the page after zooming)\n+ //\n+ // otherwise\n+ //\n+ // Kill the event (dont scroll the page if we wheel over the \n+ // layerswitcher or the pan/zoom control)\n+ //\n+ if (!overScrollableDiv && overMapDiv) {\n+ if (allowScroll) {\n+ var delta = 0;\n+\n+ if (e.wheelDelta) {\n+ delta = e.wheelDelta;\n+ if (delta % 160 === 0) {\n+ // opera have steps of 160 instead of 120\n+ delta = delta * 0.75;\n+ }\n+ delta = delta / 120;\n+ } else if (e.detail) {\n+ // detail in Firefox on OS X is 1/3 of Windows\n+ // so force delta 1 / -1\n+ delta = -(e.detail / Math.abs(e.detail));\n+ }\n+ this.delta += delta;\n+\n+ window.clearTimeout(this._timeoutId);\n+ if (this.interval && Math.abs(this.delta) < this.maxDelta) {\n+ // store e because window.event might change during delay\n+ var evt = OpenLayers.Util.extend({}, e);\n+ this._timeoutId = window.setTimeout(\n+ OpenLayers.Function.bind(function() {\n+ this.wheelZoom(evt);\n+ }, this),\n+ this.interval\n+ );\n+ } else {\n+ this.wheelZoom(e);\n+ }\n }\n+ OpenLayers.Event.stop(e);\n }\n- return layers;\n },\n \n /**\n- * Method: contextToMap\n- * Create a map given a context object.\n- *\n+ * Method: wheelZoom\n+ * Given the wheel event, we carry out the appropriate zooming in or out,\n+ * based on the 'wheelDelta' or 'detail' property of the event.\n+ * \n * Parameters:\n- * context - {Object} The context object.\n- * options - {Object} Default map options.\n- *\n- * Returns:\n- * {} A map based on the context object.\n+ * e - {Event}\n */\n- contextToMap: function(context, options) {\n- options = OpenLayers.Util.applyDefaults({\n- maxExtent: context.maxExtent,\n- projection: context.projection,\n- units: context.units\n- }, options);\n+ wheelZoom: function(e) {\n+ var delta = this.delta;\n+ this.delta = 0;\n \n- if (options.maxExtent) {\n- options.maxResolution =\n- options.maxExtent.getWidth() / OpenLayers.Map.TILE_WIDTH;\n+ if (delta) {\n+ e.xy = this.map.events.getMousePosition(e);\n+ if (delta < 0) {\n+ this.callback(\"down\",\n+ [e, this.cumulative ? Math.max(-this.maxDelta, delta) : -1]);\n+ } else {\n+ this.callback(\"up\",\n+ [e, this.cumulative ? Math.min(this.maxDelta, delta) : 1]);\n+ }\n }\n-\n- var metadata = {\n- contactInformation: context.contactInformation,\n- \"abstract\": context[\"abstract\"],\n- keywords: context.keywords,\n- logo: context.logo,\n- descriptionURL: context.descriptionURL\n- };\n-\n- options.metadata = metadata;\n-\n- var map = new OpenLayers.Map(options);\n- map.addLayers(this.getLayersFromContext(context.layersContext));\n- map.setCenter(\n- context.bounds.getCenterLonLat(),\n- map.getZoomForExtent(context.bounds, true)\n- );\n- return map;\n },\n \n /**\n- * Method: mergeContextToMap\n- * Add layers from a context object to a map.\n- *\n- * Parameters:\n- * context - {Object} The context object.\n- * map - {} The map.\n- *\n- * Returns:\n- * {} The same map with layers added.\n+ * Method: activate \n */\n- mergeContextToMap: function(context, map) {\n- map.addLayers(this.getLayersFromContext(context.layersContext));\n- return map;\n+ activate: function(evt) {\n+ if (OpenLayers.Handler.prototype.activate.apply(this, arguments)) {\n+ //register mousewheel events specifically on the window and document\n+ var wheelListener = this.wheelListener;\n+ OpenLayers.Event.observe(window, \"DOMMouseScroll\", wheelListener);\n+ OpenLayers.Event.observe(window, \"mousewheel\", wheelListener);\n+ OpenLayers.Event.observe(document, \"mousewheel\", wheelListener);\n+ return true;\n+ } else {\n+ return false;\n+ }\n },\n \n /**\n- * APIMethod: write\n- * Write a context document given a map.\n- *\n- * Parameters:\n- * obj - { | Object} A map or context object.\n- * options - {Object} Optional configuration object.\n- *\n- * Returns:\n- * {String} A context document string.\n+ * Method: deactivate \n */\n- write: function(obj, options) {\n- obj = this.toContext(obj);\n- return OpenLayers.Format.XML.VersionedOGC.prototype.write.apply(this,\n- arguments);\n+ deactivate: function(evt) {\n+ if (OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {\n+ // unregister mousewheel events specifically on the window and document\n+ var wheelListener = this.wheelListener;\n+ OpenLayers.Event.stopObserving(window, \"DOMMouseScroll\", wheelListener);\n+ OpenLayers.Event.stopObserving(window, \"mousewheel\", wheelListener);\n+ OpenLayers.Event.stopObserving(document, \"mousewheel\", wheelListener);\n+ return true;\n+ } else {\n+ return false;\n+ }\n },\n \n- CLASS_NAME: \"OpenLayers.Format.Context\"\n+ CLASS_NAME: \"OpenLayers.Handler.MouseWheel\"\n });\n-\n-/**\n- * Constant: OpenLayers.Format.Context.serviceTypes\n- * Enumeration for service types\n- */\n-OpenLayers.Format.Context.serviceTypes = {\n- \"WMS\": \"urn:ogc:serviceType:WMS\",\n- \"WFS\": \"urn:ogc:serviceType:WFS\",\n- \"WCS\": \"urn:ogc:serviceType:WCS\",\n- \"GML\": \"urn:ogc:serviceType:GML\",\n- \"SLD\": \"urn:ogc:serviceType:SLD\",\n- \"FES\": \"urn:ogc:serviceType:FES\",\n- \"KML\": \"urn:ogc:serviceType:KML\"\n-};\n /* ======================================================================\n- OpenLayers/Format/KML.js\n+ OpenLayers/Handler/Click.js\n ====================================================================== */\n \n /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for\n * full list of contributors). Published under the 2-clause BSD license.\n * See license.txt in the OpenLayers distribution or repository for the\n * full text of the license. */\n \n /**\n- * @requires OpenLayers/BaseTypes/Date.js\n- * @requires OpenLayers/Format/XML.js\n- * @requires OpenLayers/Feature/Vector.js\n- * @requires OpenLayers/Geometry/Point.js\n- * @requires OpenLayers/Geometry/LineString.js\n- * @requires OpenLayers/Geometry/Polygon.js\n- * @requires OpenLayers/Geometry/Collection.js\n- * @requires OpenLayers/Request/XMLHttpRequest.js\n- * @requires OpenLayers/Projection.js\n+ * @requires OpenLayers/Handler.js\n */\n \n /**\n- * Class: OpenLayers.Format.KML\n- * Read/Write KML. Create a new instance with the \n- * constructor. \n+ * Class: OpenLayers.Handler.Click\n+ * A handler for mouse clicks. The intention of this handler is to give\n+ * controls more flexibility with handling clicks. Browsers trigger\n+ * click events twice for a double-click. In addition, the mousedown,\n+ * mousemove, mouseup sequence fires a click event. With this handler,\n+ * controls can decide whether to ignore clicks associated with a double\n+ * click. By setting a , controls can also ignore clicks\n+ * that include a drag. Create a new instance with the\n+ * constructor.\n * \n * Inherits from:\n- * - \n+ * - \n */\n-OpenLayers.Format.KML = OpenLayers.Class(OpenLayers.Format.XML, {\n-\n+OpenLayers.Handler.Click = OpenLayers.Class(OpenLayers.Handler, {\n /**\n- * Property: namespaces\n- * {Object} Mapping of namespace aliases to namespace URIs.\n+ * APIProperty: delay\n+ * {Number} Number of milliseconds between clicks before the event is\n+ * considered a double-click.\n */\n- namespaces: {\n- kml: \"http://www.opengis.net/kml/2.2\",\n- gx: \"http://www.google.com/kml/ext/2.2\"\n- },\n+ delay: 300,\n \n /**\n- * APIProperty: kmlns\n- * {String} KML Namespace to use. Defaults to 2.0 namespace.\n- */\n- kmlns: \"http://earth.google.com/kml/2.0\",\n-\n- /** \n- * APIProperty: placemarksDesc\n- * {String} Name of the placemarks. Default is \"No description available\".\n- */\n- placemarksDesc: \"No description available\",\n-\n- /** \n- * APIProperty: foldersName\n- * {String} Name of the folders. Default is \"OpenLayers export\".\n- * If set to null, no name element will be created.\n- */\n- foldersName: \"OpenLayers export\",\n-\n- /** \n- * APIProperty: foldersDesc\n- * {String} Description of the folders. Default is \"Exported on [date].\"\n- * If set to null, no description element will be created.\n+ * APIProperty: single\n+ * {Boolean} Handle single clicks. Default is true. If false, clicks\n+ * will not be reported. If true, single-clicks will be reported.\n */\n- foldersDesc: \"Exported on \" + new Date(),\n+ single: true,\n \n /**\n- * APIProperty: extractAttributes\n- * {Boolean} Extract attributes from KML. Default is true.\n- * Extracting styleUrls requires this to be set to true\n- * Note that currently only Data and SimpleData \n- * elements are handled.\n+ * APIProperty: double\n+ * {Boolean} Handle double-clicks. Default is false.\n */\n- extractAttributes: true,\n+ 'double': false,\n \n /**\n- * APIProperty: kvpAttributes\n- * {Boolean} Only used if extractAttributes is true.\n- * If set to true, attributes will be simple\n- * key-value pairs, compatible with other formats,\n- * Any displayName elements will be ignored.\n- * If set to false, attributes will be objects,\n- * retaining any displayName elements, but not\n- * compatible with other formats. Any CDATA in\n- * displayName will be read in as a string value.\n- * Default is false.\n+ * APIProperty: pixelTolerance\n+ * {Number} Maximum number of pixels between mouseup and mousedown for an\n+ * event to be considered a click. Default is 0. If set to an\n+ * integer value, clicks with a drag greater than the value will be\n+ * ignored. This property can only be set when the handler is\n+ * constructed.\n */\n- kvpAttributes: false,\n+ pixelTolerance: 0,\n \n /**\n- * Property: extractStyles\n- * {Boolean} Extract styles from KML. Default is false.\n- * Extracting styleUrls also requires extractAttributes to be\n- * set to true\n+ * APIProperty: dblclickTolerance\n+ * {Number} Maximum distance in pixels between clicks for a sequence of \n+ * events to be considered a double click. Default is 13. If the\n+ * distance between two clicks is greater than this value, a double-\n+ * click will not be fired.\n */\n- extractStyles: false,\n+ dblclickTolerance: 13,\n \n /**\n- * APIProperty: extractTracks\n- * {Boolean} Extract gx:Track elements from Placemark elements. Default\n- * is false. If true, features will be generated for all points in\n- * all gx:Track elements. Features will have a when (Date) attribute\n- * based on when elements in the track. If tracks include angle\n- * elements, features will have heading, tilt, and roll attributes.\n- * If track point coordinates have three values, features will have\n- * an altitude attribute with the third coordinate value.\n+ * APIProperty: stopSingle\n+ * {Boolean} Stop other listeners from being notified of clicks. Default\n+ * is false. If true, any listeners registered before this one for \n+ * click or rightclick events will not be notified.\n */\n- extractTracks: false,\n+ stopSingle: false,\n \n /**\n- * APIProperty: trackAttributes\n- * {Array} If is true, points within gx:Track elements will \n- * be parsed as features with when, heading, tilt, and roll attributes.\n- * Any additional attribute names can be provided in .\n+ * APIProperty: stopDouble\n+ * {Boolean} Stop other listeners from being notified of double-clicks.\n+ * Default is false. If true, any click listeners registered before\n+ * this one will not be notified of *any* double-click events.\n+ * \n+ * The one caveat with stopDouble is that given a map with two click\n+ * handlers, one with stopDouble true and the other with stopSingle\n+ * true, the stopSingle handler should be activated last to get\n+ * uniform cross-browser performance. Since IE triggers one click\n+ * with a dblclick and FF triggers two, if a stopSingle handler is\n+ * activated first, all it gets in IE is a single click when the\n+ * second handler stops propagation on the dblclick.\n */\n- trackAttributes: null,\n+ stopDouble: false,\n \n /**\n- * Property: internalns\n- * {String} KML Namespace to use -- defaults to the namespace of the\n- * Placemark node being parsed, but falls back to kmlns. \n+ * Property: timerId\n+ * {Number} The id of the timeout waiting to clear the .\n */\n- internalns: null,\n+ timerId: null,\n \n /**\n- * Property: features\n- * {Array} Array of features\n- * \n+ * Property: down\n+ * {Object} Object that store relevant information about the last\n+ * mousedown or touchstart. Its 'xy' OpenLayers.Pixel property gives\n+ * the average location of the mouse/touch event. Its 'touches'\n+ * property records clientX/clientY of each touches.\n */\n- features: null,\n+ down: null,\n \n /**\n- * Property: styles\n- * {Object} Storage of style objects\n- * \n+ * Property: last\n+ * {Object} Object that store relevant information about the last\n+ * mousemove or touchmove. Its 'xy' OpenLayers.Pixel property gives\n+ * the average location of the mouse/touch event. Its 'touches'\n+ * property records clientX/clientY of each touches.\n */\n- styles: null,\n+ last: null,\n \n- /**\n- * Property: styleBaseUrl\n- * {String}\n+ /** \n+ * Property: first\n+ * {Object} When waiting for double clicks, this object will store \n+ * information about the first click in a two click sequence.\n */\n- styleBaseUrl: \"\",\n+ first: null,\n \n /**\n- * Property: fetched\n- * {Object} Storage of KML URLs that have been fetched before\n- * in order to prevent reloading them.\n+ * Property: rightclickTimerId\n+ * {Number} The id of the right mouse timeout waiting to clear the \n+ * .\n */\n- fetched: null,\n+ rightclickTimerId: null,\n \n /**\n- * APIProperty: maxDepth\n- * {Integer} Maximum depth for recursive loading external KML URLs \n- * Defaults to 0: do no external fetching\n+ * Constructor: OpenLayers.Handler.Click\n+ * Create a new click handler.\n+ * \n+ * Parameters:\n+ * control - {} The control that is making use of\n+ * this handler. If a handler is being used without a control, the\n+ * handler's setMap method must be overridden to deal properly with\n+ * the map.\n+ * callbacks - {Object} An object with keys corresponding to callbacks\n+ * that will be called by the handler. The callbacks should\n+ * expect to recieve a single argument, the click event.\n+ * Callbacks for 'click' and 'dblclick' are supported.\n+ * options - {Object} Optional object whose properties will be set on the\n+ * handler.\n */\n- maxDepth: 0,\n \n /**\n- * Constructor: OpenLayers.Format.KML\n- * Create a new parser for KML.\n+ * Method: touchstart\n+ * Handle touchstart.\n *\n- * Parameters:\n- * options - {Object} An optional object whose properties will be set on\n- * this instance.\n+ * Returns:\n+ * {Boolean} Continue propagating this event.\n */\n- initialize: function(options) {\n- // compile regular expressions once instead of every time they are used\n- this.regExes = {\n- trimSpace: (/^\\s*|\\s*$/g),\n- removeSpace: (/\\s*/g),\n- splitSpace: (/\\s+/),\n- trimComma: (/\\s*,\\s*/g),\n- kmlColor: (/(\\w{2})(\\w{2})(\\w{2})(\\w{2})/),\n- kmlIconPalette: (/root:\\/\\/icons\\/palette-(\\d+)(\\.\\w+)/),\n- straightBracket: (/\\$\\[(.*?)\\]/g)\n- };\n- // KML coordinates are always in longlat WGS84\n- this.externalProjection = new OpenLayers.Projection(\"EPSG:4326\");\n-\n- OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);\n+ touchstart: function(evt) {\n+ this.startTouch();\n+ this.down = this.getEventInfo(evt);\n+ this.last = this.getEventInfo(evt);\n+ return true;\n },\n \n /**\n- * APIMethod: read\n- * Read data from a string, and return a list of features. \n- * \n- * Parameters: \n- * data - {String} or {DOMElement} data to read/parse.\n+ * Method: touchmove\n+ * Store position of last move, because touchend event can have\n+ * an empty \"touches\" property.\n *\n * Returns:\n- * {Array()} List of features.\n+ * {Boolean} Continue propagating this event.\n */\n- read: function(data) {\n- this.features = [];\n- this.styles = {};\n- this.fetched = {};\n-\n- // Set default options \n- var options = {\n- depth: 0,\n- styleBaseUrl: this.styleBaseUrl\n- };\n-\n- return this.parseData(data, options);\n+ touchmove: function(evt) {\n+ this.last = this.getEventInfo(evt);\n+ return true;\n },\n \n /**\n- * Method: parseData\n- * Read data from a string, and return a list of features. \n- * \n- * Parameters: \n- * data - {String} or {DOMElement} data to read/parse.\n- * options - {Object} Hash of options\n+ * Method: touchend\n+ * Correctly set event xy property, and add lastTouches to have\n+ * touches property from last touchstart or touchmove\n *\n * Returns:\n- * {Array()} List of features.\n+ * {Boolean} Continue propagating this event.\n */\n- parseData: function(data, options) {\n- if (typeof data == \"string\") {\n- data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);\n- }\n-\n- // Loop throught the following node types in this order and\n- // process the nodes found \n- var types = [\"Link\", \"NetworkLink\", \"Style\", \"StyleMap\", \"Placemark\"];\n- for (var i = 0, len = types.length; i < len; ++i) {\n- var type = types[i];\n-\n- var nodes = this.getElementsByTagNameNS(data, \"*\", type);\n-\n- // skip to next type if no nodes are found\n- if (nodes.length == 0) {\n- continue;\n- }\n-\n- switch (type.toLowerCase()) {\n-\n- // Fetch external links \n- case \"link\":\n- case \"networklink\":\n- this.parseLinks(nodes, options);\n- break;\n-\n- // parse style information\n- case \"style\":\n- if (this.extractStyles) {\n- this.parseStyles(nodes, options);\n- }\n- break;\n- case \"stylemap\":\n- if (this.extractStyles) {\n- this.parseStyleMaps(nodes, options);\n- }\n- break;\n-\n- // parse features\n- case \"placemark\":\n- this.parseFeatures(nodes, options);\n- break;\n- }\n+ touchend: function(evt) {\n+ // touchstart may not have been allowed to propagate\n+ if (this.down) {\n+ evt.xy = this.last.xy;\n+ evt.lastTouches = this.last.touches;\n+ this.handleSingle(evt);\n+ this.down = null;\n }\n+ return true;\n+ },\n \n- return this.features;\n+ /**\n+ * Method: mousedown\n+ * Handle mousedown.\n+ *\n+ * Returns:\n+ * {Boolean} Continue propagating this event.\n+ */\n+ mousedown: function(evt) {\n+ this.down = this.getEventInfo(evt);\n+ this.last = this.getEventInfo(evt);\n+ return true;\n },\n \n /**\n- * Method: parseLinks\n- * Finds URLs of linked KML documents and fetches them\n- * \n- * Parameters: \n- * nodes - {Array} of {DOMElement} data to read/parse.\n- * options - {Object} Hash of options\n+ * Method: mouseup\n+ * Handle mouseup. Installed to support collection of right mouse events.\n * \n+ * Returns:\n+ * {Boolean} Continue propagating this event.\n */\n- parseLinks: function(nodes, options) {\n-\n- // Fetch external links and \n- // Don't do anything if we have reached our maximum depth for recursion\n- if (options.depth >= this.maxDepth) {\n- return false;\n- }\n-\n- // increase depth\n- var newOptions = OpenLayers.Util.extend({}, options);\n- newOptions.depth++;\n+ mouseup: function(evt) {\n+ var propagate = true;\n \n- for (var i = 0, len = nodes.length; i < len; i++) {\n- var href = this.parseProperty(nodes[i], \"*\", \"href\");\n- if (href && !this.fetched[href]) {\n- this.fetched[href] = true; // prevent reloading the same urls\n- var data = this.fetchLink(href);\n- if (data) {\n- this.parseData(data, newOptions);\n- }\n- }\n+ // Collect right mouse clicks from the mouseup\n+ // IE - ignores the second right click in mousedown so using\n+ // mouseup instead\n+ if (this.checkModifiers(evt) && this.control.handleRightClicks &&\n+ OpenLayers.Event.isRightClick(evt)) {\n+ propagate = this.rightclick(evt);\n }\n \n+ return propagate;\n },\n \n /**\n- * Method: fetchLink\n- * Fetches a URL and returns the result\n- * \n- * Parameters: \n- * href - {String} url to be fetched\n- * \n+ * Method: rightclick\n+ * Handle rightclick. For a dblrightclick, we get two clicks so we need \n+ * to always register for dblrightclick to properly handle single \n+ * clicks.\n+ * \n+ * Returns:\n+ * {Boolean} Continue propagating this event.\n */\n- fetchLink: function(href) {\n- var request = OpenLayers.Request.GET({\n- url: href,\n- async: false\n- });\n- if (request) {\n- return request.responseText;\n+ rightclick: function(evt) {\n+ if (this.passesTolerance(evt)) {\n+ if (this.rightclickTimerId != null) {\n+ //Second click received before timeout this must be \n+ // a double click\n+ this.clearTimer();\n+ this.callback('dblrightclick', [evt]);\n+ return !this.stopDouble;\n+ } else {\n+ //Set the rightclickTimerId, send evt only if double is \n+ // true else trigger single\n+ var clickEvent = this['double'] ?\n+ OpenLayers.Util.extend({}, evt) :\n+ this.callback('rightclick', [evt]);\n+\n+ var delayedRightCall = OpenLayers.Function.bind(\n+ this.delayedRightCall,\n+ this,\n+ clickEvent\n+ );\n+ this.rightclickTimerId = window.setTimeout(\n+ delayedRightCall, this.delay\n+ );\n+ }\n }\n+ return !this.stopSingle;\n },\n \n /**\n- * Method: parseStyles\n- * Parses