diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 9dfafe7b0d..6e34dd6dbc 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2010-03-02 Miguel de Dios + + * include/javascript/OpenLayers/lib/*, + include/javascript/OpenLayers/news.txt, + include/javascript/OpenLayers/readme.txt, + include/javascript/OpenLayers/repository-license.txt, + include/javascript/OpenLayers/release-license.txt: delete unused files of + OpenLayers lib. + 2010-03-02 Miguel de Dios * operation/gis_maps/render_view.php: clean source code. diff --git a/pandora_console/include/javascript/OpenLayers/lib/Firebug/errorIcon.png b/pandora_console/include/javascript/OpenLayers/lib/Firebug/errorIcon.png deleted file mode 100755 index 2d75261bb6..0000000000 Binary files a/pandora_console/include/javascript/OpenLayers/lib/Firebug/errorIcon.png and /dev/null differ diff --git a/pandora_console/include/javascript/OpenLayers/lib/Firebug/firebug.css b/pandora_console/include/javascript/OpenLayers/lib/Firebug/firebug.css deleted file mode 100755 index 1f041c4da9..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/Firebug/firebug.css +++ /dev/null @@ -1,209 +0,0 @@ - -html, body { - margin: 0; - background: #FFFFFF; - font-family: Lucida Grande, Tahoma, sans-serif; - font-size: 11px; - overflow: hidden; -} - -a { - text-decoration: none; -} - -a:hover { - text-decoration: underline; -} - -.toolbar { - height: 14px; - border-top: 1px solid ThreeDHighlight; - border-bottom: 1px solid ThreeDShadow; - padding: 2px 6px; - background: ThreeDFace; -} - -.toolbarRight { - position: absolute; - top: 4px; - right: 6px; -} - -#log { - overflow: auto; - position: absolute; - left: 0; - width: 100%; -} - -#commandLine { - position: absolute; - bottom: 0; - left: 0; - width: 100%; - height: 18px; - border: none; - border-top: 1px solid ThreeDShadow; -} - -/************************************************************************************************/ - -.logRow { - position: relative; - border-bottom: 1px solid #D7D7D7; - padding: 2px 4px 1px 6px; - background-color: #FFFFFF; -} - -.logRow-command { - font-family: Monaco, monospace; - color: blue; -} - -.objectBox-null { - padding: 0 2px; - border: 1px solid #666666; - background-color: #888888; - color: #FFFFFF; -} - -.objectBox-string { - font-family: Monaco, monospace; - color: red; - white-space: pre; -} - -.objectBox-number { - color: #000088; -} - -.objectBox-function { - font-family: Monaco, monospace; - color: DarkGreen; -} - -.objectBox-object { - color: DarkGreen; - font-weight: bold; -} - -/************************************************************************************************/ - -.logRow-info, -.logRow-error, -.logRow-warning { - background: #FFFFFF no-repeat 2px 2px; - padding-left: 20px; - padding-bottom: 3px; -} - -.logRow-info { - background-image: url(infoIcon.png); -} - -.logRow-warning { - background-color: cyan; - background-image: url(warningIcon.png); -} - -.logRow-error { - background-color: LightYellow; - background-image: url(errorIcon.png); -} - -.errorMessage { - vertical-align: top; - color: #FF0000; -} - -.objectBox-sourceLink { - position: absolute; - right: 4px; - top: 2px; - padding-left: 8px; - font-family: Lucida Grande, sans-serif; - font-weight: bold; - color: #0000FF; -} - -/************************************************************************************************/ - -.logRow-group { - background: #EEEEEE; - border-bottom: none; -} - -.logGroup { - background: #EEEEEE; -} - -.logGroupBox { - margin-left: 24px; - border-top: 1px solid #D7D7D7; - border-left: 1px solid #D7D7D7; -} - -/************************************************************************************************/ - -.selectorTag, -.selectorId, -.selectorClass { - font-family: Monaco, monospace; - font-weight: normal; -} - -.selectorTag { - color: #0000FF; -} - -.selectorId { - color: DarkBlue; -} - -.selectorClass { - color: red; -} - -/************************************************************************************************/ - -.objectBox-element { - font-family: Monaco, monospace; - color: #000088; -} - -.nodeChildren { - margin-left: 16px; -} - -.nodeTag { - color: blue; -} - -.nodeValue { - color: #FF0000; - font-weight: normal; -} - -.nodeText, -.nodeComment { - margin: 0 2px; - vertical-align: top; -} - -.nodeText { - color: #333333; -} - -.nodeComment { - color: DarkGreen; -} - -/************************************************************************************************/ - -.propertyNameCell { - vertical-align: top; -} - -.propertyName { - font-weight: bold; -} diff --git a/pandora_console/include/javascript/OpenLayers/lib/Firebug/firebug.html b/pandora_console/include/javascript/OpenLayers/lib/Firebug/firebug.html deleted file mode 100755 index 861e639326..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/Firebug/firebug.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - Firebug - - - - -
- Clear - - Close - -
-
- - - - - diff --git a/pandora_console/include/javascript/OpenLayers/lib/Firebug/firebug.js b/pandora_console/include/javascript/OpenLayers/lib/Firebug/firebug.js deleted file mode 100755 index a6242c3bc5..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/Firebug/firebug.js +++ /dev/null @@ -1,674 +0,0 @@ - -if (!window.console || !console.firebug) { (function() -{ - window.console = - { - log: function() - { - logFormatted(arguments, ""); - }, - - debug: function() - { - logFormatted(arguments, "debug"); - }, - - info: function() - { - logFormatted(arguments, "info"); - }, - - warn: function() - { - logFormatted(arguments, "warning"); - }, - - error: function() - { - logFormatted(arguments, "error"); - }, - - assert: function(truth, message) - { - if (!truth) - { - var args = []; - for (var i = 1; i < arguments.length; ++i) - args.push(arguments[i]); - - logFormatted(args.length ? args : ["Assertion Failure"], "error"); - throw message ? message : "Assertion Failure"; - } - }, - - dir: function(object) - { - var html = []; - - var pairs = []; - for (var name in object) - { - try - { - pairs.push([name, object[name]]); - } - catch (exc) - { - } - } - - pairs.sort(function(a, b) { return a[0] < b[0] ? -1 : 1; }); - - html.push(''); - for (var i = 0; i < pairs.length; ++i) - { - var name = pairs[i][0], value = pairs[i][1]; - - html.push('', - '', ''); - } - html.push('
', - escapeHTML(name), ''); - appendObject(value, html); - html.push('
'); - - logRow(html, "dir"); - }, - - dirxml: function(node) - { - var html = []; - - appendNode(node, html); - logRow(html, "dirxml"); - }, - - group: function() - { - logRow(arguments, "group", pushGroup); - }, - - groupEnd: function() - { - logRow(arguments, "", popGroup); - }, - - time: function(name) - { - timeMap[name] = (new Date()).getTime(); - }, - - timeEnd: function(name) - { - if (name in timeMap) - { - var delta = (new Date()).getTime() - timeMap[name]; - logFormatted([name+ ":", delta+"ms"]); - delete timeMap[name]; - } - }, - - count: function() - { - this.warn(["count() not supported."]); - }, - - trace: function() - { - this.warn(["trace() not supported."]); - }, - - profile: function() - { - this.warn(["profile() not supported."]); - }, - - profileEnd: function() - { - }, - - clear: function() - { - consoleBody.innerHTML = ""; - }, - - open: function() - { - toggleConsole(true); - }, - - close: function() - { - if (frameVisible) - toggleConsole(); - } - }; - - // ******************************************************************************************** - - var consoleFrame = null; - var consoleBody = null; - var commandLine = null; - - var frameVisible = false; - var messageQueue = []; - var groupStack = []; - var timeMap = {}; - - var clPrefix = ">>> "; - - var isFirefox = navigator.userAgent.indexOf("Firefox") != -1; - var isIE = navigator.userAgent.indexOf("MSIE") != -1; - var isOpera = navigator.userAgent.indexOf("Opera") != -1; - var isSafari = navigator.userAgent.indexOf("AppleWebKit") != -1; - - // ******************************************************************************************** - - function toggleConsole(forceOpen) - { - frameVisible = forceOpen || !frameVisible; - if (consoleFrame) - consoleFrame.style.visibility = frameVisible ? "visible" : "hidden"; - else - waitForBody(); - } - - function focusCommandLine() - { - toggleConsole(true); - if (commandLine) - commandLine.focus(); - } - - function waitForBody() - { - if (document.body) - createFrame(); - else - setTimeout(waitForBody, 200); - } - - function createFrame() - { - if (consoleFrame) - return; - - window.onFirebugReady = function(doc) - { - window.onFirebugReady = null; - - var toolbar = doc.getElementById("toolbar"); - toolbar.onmousedown = onSplitterMouseDown; - - commandLine = doc.getElementById("commandLine"); - addEvent(commandLine, "keydown", onCommandLineKeyDown); - - addEvent(doc, isIE || isSafari ? "keydown" : "keypress", onKeyDown); - - consoleBody = doc.getElementById("log"); - layout(); - flush(); - } - - var baseURL = getFirebugURL(); - - consoleFrame = document.createElement("iframe"); - consoleFrame.setAttribute("src", baseURL+"/firebug.html"); - consoleFrame.setAttribute("frameBorder", "0"); - consoleFrame.style.visibility = (frameVisible ? "visible" : "hidden"); - consoleFrame.style.zIndex = "2147483583"; - consoleFrame.style.position = document.all ? "absolute" : "fixed"; - consoleFrame.style.width = "100%"; - consoleFrame.style.left = "0"; - consoleFrame.style.bottom = "0"; - consoleFrame.style.height = "200px"; - document.body.appendChild(consoleFrame); - } - - function getFirebugURL() - { - var scripts = document.getElementsByTagName("script"); - for (var i = 0; i < scripts.length; ++i) - { - if (scripts[i].src.indexOf("firebug.js") != -1) - { - var lastSlash = scripts[i].src.lastIndexOf("/"); - return scripts[i].src.substr(0, lastSlash); - } - } - } - - function evalCommandLine() - { - var text = commandLine.value; - commandLine.value = ""; - - logRow([clPrefix, text], "command"); - - var value; - try - { - value = eval(text); - } - catch (exc) - { - } - - console.log(value); - } - - function layout() - { - var toolbar = consoleBody.ownerDocument.getElementById("toolbar"); - var height = consoleFrame.offsetHeight - (toolbar.offsetHeight + commandLine.offsetHeight); - height = Math.max(height, 0); - consoleBody.style.top = toolbar.offsetHeight + "px"; - consoleBody.style.height = height + "px"; - - commandLine.style.top = (consoleFrame.offsetHeight - commandLine.offsetHeight) + "px"; - } - - function logRow(message, className, handler) - { - if (consoleBody) - writeMessage(message, className, handler); - else - { - messageQueue.push([message, className, handler]); - waitForBody(); - } - } - - function flush() - { - var queue = messageQueue; - messageQueue = []; - - for (var i = 0; i < queue.length; ++i) - writeMessage(queue[i][0], queue[i][1], queue[i][2]); - } - - function writeMessage(message, className, handler) - { - var isScrolledToBottom = - consoleBody.scrollTop + consoleBody.offsetHeight >= consoleBody.scrollHeight; - - if (!handler) - handler = writeRow; - - handler(message, className); - - if (isScrolledToBottom) - consoleBody.scrollTop = consoleBody.scrollHeight - consoleBody.offsetHeight; - } - - function appendRow(row) - { - var container = groupStack.length ? groupStack[groupStack.length-1] : consoleBody; - container.appendChild(row); - } - - function writeRow(message, className) - { - var row = consoleBody.ownerDocument.createElement("div"); - row.className = "logRow" + (className ? " logRow-"+className : ""); - row.innerHTML = message.join(""); - appendRow(row); - } - - function pushGroup(message, className) - { - logFormatted(message, className); - - var groupRow = consoleBody.ownerDocument.createElement("div"); - groupRow.className = "logGroup"; - var groupRowBox = consoleBody.ownerDocument.createElement("div"); - groupRowBox.className = "logGroupBox"; - groupRow.appendChild(groupRowBox); - appendRow(groupRowBox); - groupStack.push(groupRowBox); - } - - function popGroup() - { - groupStack.pop(); - } - - // ******************************************************************************************** - - function logFormatted(objects, className) - { - var html = []; - - var format = objects[0]; - var objIndex = 0; - - if (typeof(format) != "string") - { - format = ""; - objIndex = -1; - } - - var parts = parseFormat(format); - for (var i = 0; i < parts.length; ++i) - { - var part = parts[i]; - if (part && typeof(part) == "object") - { - var object = objects[++objIndex]; - part.appender(object, html); - } - else - appendText(part, html); - } - - for (var i = objIndex+1; i < objects.length; ++i) - { - appendText(" ", html); - - var object = objects[i]; - if (typeof(object) == "string") - appendText(object, html); - else - appendObject(object, html); - } - - logRow(html, className); - } - - function parseFormat(format) - { - var parts = []; - - var reg = /((^%|[^\\]%)(\d+)?(\.)([a-zA-Z]))|((^%|[^\\]%)([a-zA-Z]))/; - var appenderMap = {s: appendText, d: appendInteger, i: appendInteger, f: appendFloat}; - - for (var m = reg.exec(format); m; m = reg.exec(format)) - { - var type = m[8] ? m[8] : m[5]; - var appender = type in appenderMap ? appenderMap[type] : appendObject; - var precision = m[3] ? parseInt(m[3]) : (m[4] == "." ? -1 : 0); - - parts.push(format.substr(0, m[0][0] == "%" ? m.index : m.index+1)); - parts.push({appender: appender, precision: precision}); - - format = format.substr(m.index+m[0].length); - } - - parts.push(format); - - return parts; - } - - function escapeHTML(value) - { - function replaceChars(ch) - { - switch (ch) - { - case "<": - return "<"; - case ">": - return ">"; - case "&": - return "&"; - case "'": - return "'"; - case '"': - return """; - } - return "?"; - }; - return String(value).replace(/[<>&"']/g, replaceChars); - } - - function objectToString(object) - { - try - { - return object+""; - } - catch (exc) - { - return null; - } - } - - // ******************************************************************************************** - - function appendText(object, html) - { - html.push(escapeHTML(objectToString(object))); - } - - function appendNull(object, html) - { - html.push('', escapeHTML(objectToString(object)), ''); - } - - function appendString(object, html) - { - html.push('"', escapeHTML(objectToString(object)), - '"'); - } - - function appendInteger(object, html) - { - html.push('', escapeHTML(objectToString(object)), ''); - } - - function appendFloat(object, html) - { - html.push('', escapeHTML(objectToString(object)), ''); - } - - function appendFunction(object, html) - { - var reName = /function ?(.*?)\(/; - var m = reName.exec(objectToString(object)); - var name = m ? m[1] : "function"; - html.push('', escapeHTML(name), '()'); - } - - function appendObject(object, html) - { - try - { - if (object == undefined) - appendNull("undefined", html); - else if (object == null) - appendNull("null", html); - else if (typeof object == "string") - appendString(object, html); - else if (typeof object == "number") - appendInteger(object, html); - else if (typeof object == "function") - appendFunction(object, html); - else if (object.nodeType == 1) - appendSelector(object, html); - else if (typeof object == "object") - appendObjectFormatted(object, html); - else - appendText(object, html); - } - catch (exc) - { - } - } - - function appendObjectFormatted(object, html) - { - var text = objectToString(object); - var reObject = /\[object (.*?)\]/; - - var m = reObject.exec(text); - html.push('', m ? m[1] : text, '') - } - - function appendSelector(object, html) - { - html.push(''); - - html.push('', escapeHTML(object.nodeName.toLowerCase()), ''); - if (object.id) - html.push('#', escapeHTML(object.id), ''); - if (object.className) - html.push('.', escapeHTML(object.className), ''); - - html.push(''); - } - - function appendNode(node, html) - { - if (node.nodeType == 1) - { - html.push( - '
', - '<', node.nodeName.toLowerCase(), ''); - - for (var i = 0; i < node.attributes.length; ++i) - { - var attr = node.attributes[i]; - if (!attr.specified) - continue; - - html.push(' ', attr.nodeName.toLowerCase(), - '="', escapeHTML(attr.nodeValue), - '"') - } - - if (node.firstChild) - { - html.push('>
'); - - for (var child = node.firstChild; child; child = child.nextSibling) - appendNode(child, html); - - html.push('
</', - node.nodeName.toLowerCase(), '>
'); - } - else - html.push('/>'); - } - else if (node.nodeType == 3) - { - html.push('
', escapeHTML(node.nodeValue), - '
'); - } - } - - // ******************************************************************************************** - - function addEvent(object, name, handler) - { - if (document.all) - object.attachEvent("on"+name, handler); - else - object.addEventListener(name, handler, false); - } - - function removeEvent(object, name, handler) - { - if (document.all) - object.detachEvent("on"+name, handler); - else - object.removeEventListener(name, handler, false); - } - - function cancelEvent(event) - { - if (document.all) - event.cancelBubble = true; - else - event.stopPropagation(); - } - - function onError(msg, href, lineNo) - { - var html = []; - - var lastSlash = href.lastIndexOf("/"); - var fileName = lastSlash == -1 ? href : href.substr(lastSlash+1); - - html.push( - '', msg, '', - '' - ); - - logRow(html, "error"); - }; - - function onKeyDown(event) - { - if (event.keyCode == 123) - toggleConsole(); - else if ((event.keyCode == 108 || event.keyCode == 76) && event.shiftKey - && (event.metaKey || event.ctrlKey)) - focusCommandLine(); - else - return; - - cancelEvent(event); - } - - function onSplitterMouseDown(event) - { - if (isSafari || isOpera) - return; - - addEvent(document, "mousemove", onSplitterMouseMove); - addEvent(document, "mouseup", onSplitterMouseUp); - - for (var i = 0; i < frames.length; ++i) - { - addEvent(frames[i].document, "mousemove", onSplitterMouseMove); - addEvent(frames[i].document, "mouseup", onSplitterMouseUp); - } - } - - function onSplitterMouseMove(event) - { - var win = document.all - ? event.srcElement.ownerDocument.parentWindow - : event.target.ownerDocument.defaultView; - - var clientY = event.clientY; - if (win != win.parent) - clientY += win.frameElement ? win.frameElement.offsetTop : 0; - - var height = consoleFrame.offsetTop + consoleFrame.clientHeight; - var toolbar = consoleBody.ownerDocument.getElementById("toolbar"); - var y = Math.max(height - clientY, - toolbar.offsetHeight + commandLine.offsetHeight); - - consoleFrame.style.height = y + "px"; - layout(); - } - - function onSplitterMouseUp(event) - { - removeEvent(document, "mousemove", onSplitterMouseMove); - removeEvent(document, "mouseup", onSplitterMouseUp); - - for (var i = 0; i < frames.length; ++i) - { - removeEvent(frames[i].document, "mousemove", onSplitterMouseMove); - removeEvent(frames[i].document, "mouseup", onSplitterMouseUp); - } - } - - function onCommandLineKeyDown(event) - { - if (event.keyCode == 13) - evalCommandLine(); - else if (event.keyCode == 27) - commandLine.value = ""; - } - - window.onerror = onError; - addEvent(document, isIE || isSafari ? "keydown" : "keypress", onKeyDown); - - if (document.documentElement.getAttribute("debug") == "true") - toggleConsole(true); -})(); -} diff --git a/pandora_console/include/javascript/OpenLayers/lib/Firebug/firebugx.js b/pandora_console/include/javascript/OpenLayers/lib/Firebug/firebugx.js deleted file mode 100755 index 4c8b30f762..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/Firebug/firebugx.js +++ /dev/null @@ -1,9 +0,0 @@ - -if (!window.console || !console.firebug) { - var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", - "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; - - window.console = {}; - for (var i = 0; i < names.length; ++i) - window.console[names[i]] = function() {} -} diff --git a/pandora_console/include/javascript/OpenLayers/lib/Firebug/infoIcon.png b/pandora_console/include/javascript/OpenLayers/lib/Firebug/infoIcon.png deleted file mode 100755 index da1e5334c1..0000000000 Binary files a/pandora_console/include/javascript/OpenLayers/lib/Firebug/infoIcon.png and /dev/null differ diff --git a/pandora_console/include/javascript/OpenLayers/lib/Firebug/license.txt b/pandora_console/include/javascript/OpenLayers/lib/Firebug/license.txt deleted file mode 100755 index ba43b7514b..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/Firebug/license.txt +++ /dev/null @@ -1,30 +0,0 @@ -Software License Agreement (BSD License) - -Copyright (c) 2007, Parakey Inc. -All rights reserved. - -Redistribution and use of this software in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above - copyright notice, this list of conditions and the - following disclaimer. - -* Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the - following disclaimer in the documentation and/or other - materials provided with the distribution. - -* Neither the name of Parakey Inc. nor the names of its - contributors may be used to endorse or promote products - derived from this software without specific prior - written permission of Parakey Inc. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER -IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/pandora_console/include/javascript/OpenLayers/lib/Firebug/readme.txt b/pandora_console/include/javascript/OpenLayers/lib/Firebug/readme.txt deleted file mode 100755 index 1edebf5654..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/Firebug/readme.txt +++ /dev/null @@ -1,13 +0,0 @@ -This directory contains the source for Firebug Lite -(http://www.getfirebug.com/lite.html). This code is distributed with a -BSD License, Copyright (c) 2007, Parakey Inc. See the included license.txt -for the full text of the license. - -This is a patched version of the trunk from -http://fbug.googlecode.com/svn/trunk. - -Revision 36 was patched to resolve the issue described here -http://code.google.com/p/fbug/issues/detail?id=85 - -When this issue is resolved, Firebug Lite can be used directly - no further -modifications are needed for OpenLayers. \ No newline at end of file diff --git a/pandora_console/include/javascript/OpenLayers/lib/Firebug/warningIcon.png b/pandora_console/include/javascript/OpenLayers/lib/Firebug/warningIcon.png deleted file mode 100755 index de51084e84..0000000000 Binary files a/pandora_console/include/javascript/OpenLayers/lib/Firebug/warningIcon.png and /dev/null differ diff --git a/pandora_console/include/javascript/OpenLayers/lib/Gears/gears_init.js b/pandora_console/include/javascript/OpenLayers/lib/Gears/gears_init.js deleted file mode 100755 index d531a3f5bb..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/Gears/gears_init.js +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2007, Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of Google Inc. nor the names of its contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Sets up google.gears.*, which is *the only* supported way to access Gears. - * - * Circumvent this file at your own risk! - * - * In the future, Gears may automatically define google.gears.* without this - * file. Gears may use these objects to transparently fix bugs and compatibility - * issues. Applications that use the code below will continue to work seamlessly - * when that happens. - */ - -(function() { - // We are already defined. Hooray! - if (window.google && google.gears) { - return; - } - - var factory = null; - - // Firefox - if (typeof GearsFactory != 'undefined') { - factory = new GearsFactory(); - } else { - // IE - try { - factory = new ActiveXObject('Gears.Factory'); - // privateSetGlobalObject is only required and supported on WinCE. - if (factory.getBuildInfo().indexOf('ie_mobile') != -1) { - factory.privateSetGlobalObject(this); - } - } catch (e) { - // Safari - if ((typeof navigator.mimeTypes != 'undefined') - && navigator.mimeTypes["application/x-googlegears"]) { - factory = document.createElement("object"); - factory.style.display = "none"; - factory.width = 0; - factory.height = 0; - factory.type = "application/x-googlegears"; - document.documentElement.appendChild(factory); - } - } - } - - // *Do not* define any objects if Gears is not installed. This mimics the - // behavior of Gears defining the objects in the future. - if (!factory) { - return; - } - - // Now set up the objects, being careful not to overwrite anything. - // - // Note: In Internet Explorer for Windows Mobile, you can't add properties to - // the window object. However, global objects are automatically added as - // properties of the window object in all browsers. - if (!window.google) { - google = {}; - } - - if (!google.gears) { - google.gears = {factory: factory}; - } -})(); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers.js deleted file mode 100755 index 255481165d..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers.js +++ /dev/null @@ -1,299 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/* - * @requires OpenLayers/BaseTypes.js - * @requires OpenLayers/Lang/en.js - * @requires OpenLayers/Console.js - */ - -(function() { - /** - * Before creating the OpenLayers namespace, check to see if - * OpenLayers.singleFile is true. This occurs if the - * OpenLayers/SingleFile.js script is included before this one - as is the - * case with single file builds. - */ - var singleFile = (typeof OpenLayers == "object" && OpenLayers.singleFile); - - /** - * Namespace: OpenLayers - * The OpenLayers object provides a namespace for all things OpenLayers - */ - window.OpenLayers = { - - /** - * Property: _scriptName - * {String} Relative path of this script. - */ - _scriptName: (!singleFile) ? "lib/OpenLayers.js" : "OpenLayers.js", - - /** - * Function: _getScriptLocation - * Return the path to this script. - * - * Returns: - * {String} Path to this script - */ - _getScriptLocation: function () { - var scriptLocation = ""; - var isOL = new RegExp("(^|(.*?\\/))(" + OpenLayers._scriptName + ")(\\?|$)"); - - var scripts = document.getElementsByTagName('script'); - for (var i=0, len=scripts.length; i"; - } else { - var s = document.createElement("script"); - s.src = host + jsfiles[i]; - var h = document.getElementsByTagName("head").length ? - document.getElementsByTagName("head")[0] : - document.body; - h.appendChild(s); - } - } - if (docWrite) { - document.write(allScriptTags.join("")); - } - } -})(); - -/** - * Constant: VERSION_NUMBER - */ -OpenLayers.VERSION_NUMBER="OpenLayers 2.8 -- $Revision: 9492 $"; diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Ajax.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Ajax.js deleted file mode 100755 index 407a6d0cfa..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Ajax.js +++ /dev/null @@ -1,677 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Request/XMLHttpRequest.js - * @requires OpenLayers/Console.js - */ - -OpenLayers.ProxyHost = ""; -//OpenLayers.ProxyHost = "examples/proxy.cgi?url="; - -/** - * Ajax reader for OpenLayers - * - * @uri url to do remote XML http get - * @param {String} 'get' format params (x=y&a=b...) - * @who object to handle callbacks for this request - * @complete the function to be called on success - * @failure the function to be called on failure - * - * example usage from a caller: - * - * caps: function(request) { - * -blah- - * }, - * - * OpenLayers.loadURL(url,params,this,caps); - * - * Notice the above example does not provide an error handler; a default empty - * handler is provided which merely logs the error if a failure handler is not - * supplied - * - */ - - -/** - * Function: OpenLayers.nullHandler - * @param {} request - */ -OpenLayers.nullHandler = function(request) { - OpenLayers.Console.userError(OpenLayers.i18n("unhandledRequest", {'statusText':request.statusText})); -}; - -/** - * APIFunction: loadURL - * Background load a document. For more flexibility in using XMLHttpRequest, - * see the methods. - * - * Parameters: - * uri - {String} URI of source doc - * params - {String} or {Object} GET params. Either a string in the form - * "?hello=world&foo=bar" (do not forget the leading question mark) - * or an object in the form {'hello': 'world', 'foo': 'bar} - * caller - {Object} object which gets callbacks - * onComplete - {Function} Optional callback for success. The callback - * will be called with this set to caller and will receive the request - * object as an argument. Note that if you do not specify an onComplete - * function, will be called (which pops up a - * user friendly error message dialog). - * onFailure - {Function} Optional callback for failure. In the event of - * a failure, the callback will be called with this set to caller and will - * receive the request object as an argument. Note that if you do not - * specify an onComplete function, will be called - * (which pops up a user friendly error message dialog). - * - * Returns: - * {} The request object. To abort loading, - * call request.abort(). - */ -OpenLayers.loadURL = function(uri, params, caller, - onComplete, onFailure) { - - if(typeof params == 'string') { - params = OpenLayers.Util.getParameters(params); - } - var success = (onComplete) ? onComplete : OpenLayers.nullHandler; - var failure = (onFailure) ? onFailure : OpenLayers.nullHandler; - - return OpenLayers.Request.GET({ - url: uri, params: params, - success: success, failure: failure, scope: caller - }); -}; - -/** - * Function: parseXMLString - * Parse XML into a doc structure - * - * Parameters: - * text - {String} - * - * Returns: - * {?} Parsed AJAX Responsev - */ -OpenLayers.parseXMLString = function(text) { - - //MS sucks, if the server is bad it dies - var index = text.indexOf('<'); - if (index > 0) { - text = text.substring(index); - } - - var ajaxResponse = OpenLayers.Util.Try( - function() { - var xmldom = new ActiveXObject('Microsoft.XMLDOM'); - xmldom.loadXML(text); - return xmldom; - }, - function() { - return new DOMParser().parseFromString(text, 'text/xml'); - }, - function() { - var req = new XMLHttpRequest(); - req.open("GET", "data:" + "text/xml" + - ";charset=utf-8," + encodeURIComponent(text), false); - if (req.overrideMimeType) { - req.overrideMimeType("text/xml"); - } - req.send(null); - return req.responseXML; - } - ); - - return ajaxResponse; -}; - - -/** - * Namespace: OpenLayers.Ajax - */ -OpenLayers.Ajax = { - - /** - * Method: emptyFunction - */ - emptyFunction: function () {}, - - /** - * Method: getTransport - * - * Returns: - * {Object} Transport mechanism for whichever browser we're in, or false if - * none available. - */ - getTransport: function() { - return OpenLayers.Util.Try( - function() {return new XMLHttpRequest();}, - function() {return new ActiveXObject('Msxml2.XMLHTTP');}, - function() {return new ActiveXObject('Microsoft.XMLHTTP');} - ) || false; - }, - - /** - * Property: activeRequestCount - * {Integer} - */ - activeRequestCount: 0 -}; - -/** - * Namespace: OpenLayers.Ajax.Responders - * {Object} - */ -OpenLayers.Ajax.Responders = { - - /** - * Property: responders - * {Array} - */ - responders: [], - - /** - * Method: register - * - * Parameters: - * responderToAdd - {?} - */ - register: function(responderToAdd) { - for (var i = 0; i < this.responders.length; i++){ - if (responderToAdd == this.responders[i]){ - return; - } - } - this.responders.push(responderToAdd); - }, - - /** - * Method: unregister - * - * Parameters: - * responderToRemove - {?} - */ - unregister: function(responderToRemove) { - OpenLayers.Util.removeItem(this.reponders, responderToRemove); - }, - - /** - * Method: dispatch - * - * Parameters: - * callback - {?} - * request - {?} - * transport - {?} - */ - dispatch: function(callback, request, transport) { - var responder; - for (var i = 0; i < this.responders.length; i++) { - responder = this.responders[i]; - - if (responder[callback] && - typeof responder[callback] == 'function') { - try { - responder[callback].apply(responder, - [request, transport]); - } catch (e) {} - } - } - } -}; - -OpenLayers.Ajax.Responders.register({ - /** - * Function: onCreate - */ - onCreate: function() { - OpenLayers.Ajax.activeRequestCount++; - }, - - /** - * Function: onComplete - */ - onComplete: function() { - OpenLayers.Ajax.activeRequestCount--; - } -}); - -/** - * Class: OpenLayers.Ajax.Base - */ -OpenLayers.Ajax.Base = OpenLayers.Class({ - - /** - * Constructor: OpenLayers.Ajax.Base - * - * Parameters: - * options - {Object} - */ - initialize: function(options) { - this.options = { - method: 'post', - asynchronous: true, - contentType: 'application/xml', - parameters: '' - }; - OpenLayers.Util.extend(this.options, options || {}); - - this.options.method = this.options.method.toLowerCase(); - - if (typeof this.options.parameters == 'string') { - this.options.parameters = - OpenLayers.Util.getParameters(this.options.parameters); - } - } -}); - -/** - * Class: OpenLayers.Ajax.Request - * *Deprecated*. Use method instead. - * - * Inherit: - * - - */ -OpenLayers.Ajax.Request = OpenLayers.Class(OpenLayers.Ajax.Base, { - - /** - * Property: _complete - * - * {Boolean} - */ - _complete: false, - - /** - * Constructor: OpenLayers.Ajax.Request - * - * Parameters: - * url - {String} - * options - {Object} - */ - initialize: function(url, options) { - OpenLayers.Ajax.Base.prototype.initialize.apply(this, [options]); - - if (OpenLayers.ProxyHost && OpenLayers.String.startsWith(url, "http")) { - url = OpenLayers.ProxyHost + encodeURIComponent(url); - } - - this.transport = OpenLayers.Ajax.getTransport(); - this.request(url); - }, - - /** - * Method: request - * - * Parameters: - * url - {String} - */ - request: function(url) { - this.url = url; - this.method = this.options.method; - var params = OpenLayers.Util.extend({}, this.options.parameters); - - if (this.method != 'get' && this.method != 'post') { - // simulate other verbs over post - params['_method'] = this.method; - this.method = 'post'; - } - - this.parameters = params; - - if (params = OpenLayers.Util.getParameterString(params)) { - // when GET, append parameters to URL - if (this.method == 'get') { - this.url += ((this.url.indexOf('?') > -1) ? '&' : '?') + params; - } else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) { - params += '&_='; - } - } - try { - var response = new OpenLayers.Ajax.Response(this); - if (this.options.onCreate) { - this.options.onCreate(response); - } - - OpenLayers.Ajax.Responders.dispatch('onCreate', - this, - response); - - this.transport.open(this.method.toUpperCase(), - this.url, - this.options.asynchronous); - - if (this.options.asynchronous) { - window.setTimeout( - OpenLayers.Function.bind(this.respondToReadyState, this, 1), - 10); - } - - this.transport.onreadystatechange = - OpenLayers.Function.bind(this.onStateChange, this); - this.setRequestHeaders(); - - this.body = this.method == 'post' ? - (this.options.postBody || params) : null; - this.transport.send(this.body); - - // Force Firefox to handle ready state 4 for synchronous requests - if (!this.options.asynchronous && - this.transport.overrideMimeType) { - this.onStateChange(); - } - } catch (e) { - this.dispatchException(e); - } - }, - - /** - * Method: onStateChange - */ - onStateChange: function() { - var readyState = this.transport.readyState; - if (readyState > 1 && !((readyState == 4) && this._complete)) { - this.respondToReadyState(this.transport.readyState); - } - }, - - /** - * Method: setRequestHeaders - */ - setRequestHeaders: function() { - var headers = { - 'X-Requested-With': 'XMLHttpRequest', - 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*', - 'OpenLayers': true - }; - - if (this.method == 'post') { - headers['Content-type'] = this.options.contentType + - (this.options.encoding ? '; charset=' + this.options.encoding : ''); - - /* Force "Connection: close" for older Mozilla browsers to work - * around a bug where XMLHttpRequest sends an incorrect - * Content-length header. See Mozilla Bugzilla #246651. - */ - if (this.transport.overrideMimeType && - (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005) { - headers['Connection'] = 'close'; - } - } - // user-defined headers - if (typeof this.options.requestHeaders == 'object') { - var extras = this.options.requestHeaders; - - if (typeof extras.push == 'function') { - for (var i = 0, length = extras.length; i < length; i += 2) { - headers[extras[i]] = extras[i+1]; - } - } else { - for (var i in extras) { - headers[i] = extras[i]; - } - } - } - - for (var name in headers) { - this.transport.setRequestHeader(name, headers[name]); - } - }, - - /** - * Method: success - * - * Returns: - * {Boolean} - - */ - success: function() { - var status = this.getStatus(); - return !status || (status >=200 && status < 300); - }, - - /** - * Method: getStatus - * - * Returns: - * {Integer} - Status - */ - getStatus: function() { - try { - return this.transport.status || 0; - } catch (e) { - return 0; - } - }, - - /** - * Method: respondToReadyState - * - * Parameters: - * readyState - {?} - */ - respondToReadyState: function(readyState) { - var state = OpenLayers.Ajax.Request.Events[readyState]; - var response = new OpenLayers.Ajax.Response(this); - - if (state == 'Complete') { - try { - this._complete = true; - (this.options['on' + response.status] || - this.options['on' + (this.success() ? 'Success' : 'Failure')] || - OpenLayers.Ajax.emptyFunction)(response); - } catch (e) { - this.dispatchException(e); - } - - var contentType = response.getHeader('Content-type'); - } - - try { - (this.options['on' + state] || - OpenLayers.Ajax.emptyFunction)(response); - OpenLayers.Ajax.Responders.dispatch('on' + state, - this, - response); - } catch (e) { - this.dispatchException(e); - } - - if (state == 'Complete') { - // avoid memory leak in MSIE: clean up - this.transport.onreadystatechange = OpenLayers.Ajax.emptyFunction; - } - }, - - /** - * Method: getHeader - * - * Parameters: - * name - {String} Header name - * - * Returns: - * {?} - response header for the given name - */ - getHeader: function(name) { - try { - return this.transport.getResponseHeader(name); - } catch (e) { - return null; - } - }, - - /** - * Method: dispatchException - * If the optional onException function is set, execute it - * and then dispatch the call to any other listener registered - * for onException. - * - * If no optional onException function is set, we suspect that - * the user may have also not used - * OpenLayers.Ajax.Responders.register to register a listener - * for the onException call. To make sure that something - * gets done with this exception, only dispatch the call if there - * are listeners. - * - * If you explicitly want to swallow exceptions, set - * request.options.onException to an empty function (function(){}) - * or register an empty function with - * for onException. - * - * Parameters: - * exception - {?} - */ - dispatchException: function(exception) { - var handler = this.options.onException; - if(handler) { - // call options.onException and alert any other listeners - handler(this, exception); - OpenLayers.Ajax.Responders.dispatch('onException', this, exception); - } else { - // check if there are any other listeners - var listener = false; - var responders = OpenLayers.Ajax.Responders.responders; - for (var i = 0; i < responders.length; i++) { - if(responders[i].onException) { - listener = true; - break; - } - } - if(listener) { - // call all listeners - OpenLayers.Ajax.Responders.dispatch('onException', this, exception); - } else { - // let the exception through - throw exception; - } - } - } -}); - -/** - * Property: Events - * {Array(String)} - */ -OpenLayers.Ajax.Request.Events = - ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete']; - -/** - * Class: OpenLayers.Ajax.Response - */ -OpenLayers.Ajax.Response = OpenLayers.Class({ - - /** - * Property: status - * - * {Integer} - */ - status: 0, - - - /** - * Property: statusText - * - * {String} - */ - statusText: '', - - /** - * Constructor: OpenLayers.Ajax.Response - * - * Parameters: - * request - {Object} - */ - initialize: function(request) { - this.request = request; - var transport = this.transport = request.transport, - readyState = this.readyState = transport.readyState; - - if ((readyState > 2 && - !(!!(window.attachEvent && !window.opera))) || - readyState == 4) { - this.status = this.getStatus(); - this.statusText = this.getStatusText(); - this.responseText = transport.responseText == null ? - '' : String(transport.responseText); - } - - if(readyState == 4) { - var xml = transport.responseXML; - this.responseXML = xml === undefined ? null : xml; - } - }, - - /** - * Method: getStatus - */ - getStatus: OpenLayers.Ajax.Request.prototype.getStatus, - - /** - * Method: getStatustext - * - * Returns: - * {String} - statusText - */ - getStatusText: function() { - try { - return this.transport.statusText || ''; - } catch (e) { - return ''; - } - }, - - /** - * Method: getHeader - */ - getHeader: OpenLayers.Ajax.Request.prototype.getHeader, - - /** - * Method: getResponseHeader - * - * Returns: - * {?} - response header for given name - */ - getResponseHeader: function(name) { - return this.transport.getResponseHeader(name); - } -}); - - -/** - * Function: getElementsByTagNameNS - * - * Parameters: - * parentnode - {?} - * nsuri - {?} - * nsprefix - {?} - * tagname - {?} - * - * Returns: - * {?} - */ -OpenLayers.Ajax.getElementsByTagNameNS = function(parentnode, nsuri, - nsprefix, tagname) { - var elem = null; - if (parentnode.getElementsByTagNameNS) { - elem = parentnode.getElementsByTagNameNS(nsuri, tagname); - } else { - elem = parentnode.getElementsByTagName(nsprefix + ':' + tagname); - } - return elem; -}; - - -/** - * Function: serializeXMLToString - * Wrapper function around XMLSerializer, which doesn't exist/work in - * IE/Safari. We need to come up with a way to serialize in those browser: - * for now, these browsers will just fail. #535, #536 - * - * Parameters: - * xmldom {XMLNode} xml dom to serialize - * - * Returns: - * {?} - */ -OpenLayers.Ajax.serializeXMLToString = function(xmldom) { - var serializer = new XMLSerializer(); - var data = serializer.serializeToString(xmldom); - return data; -}; diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/BaseTypes.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/BaseTypes.js deleted file mode 100755 index 615ef1de3e..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/BaseTypes.js +++ /dev/null @@ -1,529 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/BaseTypes/Class.js - * @requires OpenLayers/BaseTypes/LonLat.js - * @requires OpenLayers/BaseTypes/Size.js - * @requires OpenLayers/BaseTypes/Pixel.js - * @requires OpenLayers/BaseTypes/Bounds.js - * @requires OpenLayers/BaseTypes/Element.js - * @requires OpenLayers/Lang/en.js - * @requires OpenLayers/Console.js - */ - -/** - * Header: OpenLayers Base Types - * OpenLayers custom string, number and function functions are described here. - */ - -/** - * Namespace: OpenLayers.String - * Contains convenience functions for string manipulation. - */ -OpenLayers.String = { - - /** - * APIFunction: startsWith - * Test whether a string starts with another string. - * - * Parameters: - * str - {String} The string to test. - * sub - {Sring} The substring to look for. - * - * Returns: - * {Boolean} The first string starts with the second. - */ - startsWith: function(str, sub) { - return (str.indexOf(sub) == 0); - }, - - /** - * APIFunction: contains - * Test whether a string contains another string. - * - * Parameters: - * str - {String} The string to test. - * sub - {String} The substring to look for. - * - * Returns: - * {Boolean} The first string contains the second. - */ - contains: function(str, sub) { - return (str.indexOf(sub) != -1); - }, - - /** - * APIFunction: trim - * Removes leading and trailing whitespace characters from a string. - * - * Parameters: - * str - {String} The (potentially) space padded string. This string is not - * modified. - * - * Returns: - * {String} A trimmed version of the string with all leading and - * trailing spaces removed. - */ - trim: function(str) { - return str.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); - }, - - /** - * APIFunction: camelize - * Camel-case a hyphenated string. - * Ex. "chicken-head" becomes "chickenHead", and - * "-chicken-head" becomes "ChickenHead". - * - * Parameters: - * str - {String} The string to be camelized. The original is not modified. - * - * Returns: - * {String} The string, camelized - */ - camelize: function(str) { - var oStringList = str.split('-'); - var camelizedString = oStringList[0]; - for (var i=1, len=oStringList.length; i replacement = context[a]; - // 1 -> replacement = context[a][b]; - // 2 -> replacement = context[a][b][c]; - var subs = match.split(/\.+/); - for (var i=0; i< subs.length; i++) { - if (i == 0) { - replacement = context; - } - - replacement = replacement[subs[i]]; - } - - if(typeof replacement == "function") { - replacement = args ? - replacement.apply(null, args) : - replacement(); - } - - // If replacement is undefined, return the string 'undefined'. - // This is a workaround for a bugs in browsers not properly - // dealing with non-participating groups in regular expressions: - // http://blog.stevenlevithan.com/archives/npcg-javascript - if (typeof replacement == 'undefined') { - return 'undefined'; - } else { - return replacement; - } - }; - - return template.replace(OpenLayers.String.tokenRegEx, replacer); - }, - - /** - * Property: OpenLayers.String.tokenRegEx - * Used to find tokens in a string. - * Examples: ${a}, ${a.b.c}, ${a-b}, ${5} - */ - tokenRegEx: /\$\{([\w.]+?)\}/g, - - /** - * Property: OpenLayers.String.numberRegEx - * Used to test strings as numbers. - */ - numberRegEx: /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/, - - /** - * APIFunction: OpenLayers.String.isNumeric - * Determine whether a string contains only a numeric value. - * - * Examples: - * (code) - * OpenLayers.String.isNumeric("6.02e23") // true - * OpenLayers.String.isNumeric("12 dozen") // false - * OpenLayers.String.isNumeric("4") // true - * OpenLayers.String.isNumeric(" 4 ") // false - * (end) - * - * Returns: - * {Boolean} String contains only a number. - */ - isNumeric: function(value) { - return OpenLayers.String.numberRegEx.test(value); - }, - - /** - * APIFunction: numericIf - * Converts a string that appears to be a numeric value into a number. - * - * Returns - * {Number|String} a Number if the passed value is a number, a String - * otherwise. - */ - numericIf: function(value) { - return OpenLayers.String.isNumeric(value) ? parseFloat(value) : value; - } - -}; - -if (!String.prototype.startsWith) { - /** - * APIMethod: String.startsWith - * *Deprecated*. Whether or not a string starts with another string. - * - * Parameters: - * sStart - {Sring} The string we're testing for. - * - * Returns: - * {Boolean} Whether or not this string starts with the string passed in. - */ - String.prototype.startsWith = function(sStart) { - OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated", - {'newMethod':'OpenLayers.String.startsWith'})); - return OpenLayers.String.startsWith(this, sStart); - }; -} - -if (!String.prototype.contains) { - /** - * APIMethod: String.contains - * *Deprecated*. Whether or not a string contains another string. - * - * Parameters: - * str - {String} The string that we're testing for. - * - * Returns: - * {Boolean} Whether or not this string contains with the string passed in. - */ - String.prototype.contains = function(str) { - OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated", - {'newMethod':'OpenLayers.String.contains'})); - return OpenLayers.String.contains(this, str); - }; -} - -if (!String.prototype.trim) { - /** - * APIMethod: String.trim - * *Deprecated*. Removes leading and trailing whitespace characters from a string. - * - * Returns: - * {String} A trimmed version of the string - all leading and - * trailing spaces removed - */ - String.prototype.trim = function() { - OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated", - {'newMethod':'OpenLayers.String.trim'})); - return OpenLayers.String.trim(this); - }; -} - -if (!String.prototype.camelize) { - /** - * APIMethod: String.camelize - * *Deprecated*. Camel-case a hyphenated string. - * Ex. "chicken-head" becomes "chickenHead", and - * "-chicken-head" becomes "ChickenHead". - * - * Returns: - * {String} The string, camelized - */ - String.prototype.camelize = function() { - OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated", - {'newMethod':'OpenLayers.String.camelize'})); - return OpenLayers.String.camelize(this); - }; -} - -/** - * Namespace: OpenLayers.Number - * Contains convenience functions for manipulating numbers. - */ -OpenLayers.Number = { - - /** - * Property: decimalSeparator - * Decimal separator to use when formatting numbers. - */ - decimalSeparator: ".", - - /** - * Property: thousandsSeparator - * Thousands separator to use when formatting numbers. - */ - thousandsSeparator: ",", - - /** - * APIFunction: limitSigDigs - * Limit the number of significant digits on a float. - * - * Parameters: - * num - {Float} - * sig - {Integer} - * - * Returns: - * {Float} The number, rounded to the specified number of significant - * digits. - */ - limitSigDigs: function(num, sig) { - var fig = 0; - if (sig > 0) { - fig = parseFloat(num.toPrecision(sig)); - } - return fig; - }, - - /** - * APIFunction: format - * Formats a number for output. - * - * Parameters: - * num - {Float} - * dec - {Integer} Number of decimal places to round to. - * Defaults to 0. Set to null to leave decimal places unchanged. - * tsep - {String} Thousands separator. - * Default is ",". - * dsep - {String} Decimal separator. - * Default is ".". - * - * Returns: - * {String} A string representing the formatted number. - */ - format: function(num, dec, tsep, dsep) { - dec = (typeof dec != "undefined") ? dec : 0; - tsep = (typeof tsep != "undefined") ? tsep : - OpenLayers.Number.thousandsSeparator; - dsep = (typeof dsep != "undefined") ? dsep : - OpenLayers.Number.decimalSeparator; - - if (dec != null) { - num = parseFloat(num.toFixed(dec)); - } - - var parts = num.toString().split("."); - if (parts.length == 1 && dec == null) { - // integer where we do not want to touch the decimals - dec = 0; - } - - var integer = parts[0]; - if (tsep) { - var thousands = /(-?[0-9]+)([0-9]{3})/; - while(thousands.test(integer)) { - integer = integer.replace(thousands, "$1" + tsep + "$2"); - } - } - - var str; - if (dec == 0) { - str = integer; - } else { - var rem = parts.length > 1 ? parts[1] : "0"; - if (dec != null) { - rem = rem + new Array(dec - rem.length + 1).join("0"); - } - str = integer + dsep + rem; - } - return str; - } -}; - -if (!Number.prototype.limitSigDigs) { - /** - * APIMethod: Number.limitSigDigs - * *Deprecated*. Limit the number of significant digits on an integer. Does *not* - * work with floats! - * - * Parameters: - * sig - {Integer} - * - * Returns: - * {Integer} The number, rounded to the specified number of significant digits. - * If null, 0, or negative value passed in, returns 0 - */ - Number.prototype.limitSigDigs = function(sig) { - OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated", - {'newMethod':'OpenLayers.Number.limitSigDigs'})); - return OpenLayers.Number.limitSigDigs(this, sig); - }; -} - -/** - * Namespace: OpenLayers.Function - * Contains convenience functions for function manipulation. - */ -OpenLayers.Function = { - /** - * APIFunction: bind - * Bind a function to an object. Method to easily create closures with - * 'this' altered. - * - * Parameters: - * func - {Function} Input function. - * object - {Object} The object to bind to the input function (as this). - * - * Returns: - * {Function} A closure with 'this' set to the passed in object. - */ - bind: function(func, object) { - // create a reference to all arguments past the second one - var args = Array.prototype.slice.apply(arguments, [2]); - return function() { - // Push on any additional arguments from the actual function call. - // These will come after those sent to the bind call. - var newArgs = args.concat( - Array.prototype.slice.apply(arguments, [0]) - ); - return func.apply(object, newArgs); - }; - }, - - /** - * APIFunction: bindAsEventListener - * Bind a function to an object, and configure it to receive the event - * object as first parameter when called. - * - * Parameters: - * func - {Function} Input function to serve as an event listener. - * object - {Object} A reference to this. - * - * Returns: - * {Function} - */ - bindAsEventListener: function(func, object) { - return function(event) { - return func.call(object, event || window.event); - }; - } -}; - -if (!Function.prototype.bind) { - /** - * APIMethod: Function.bind - * *Deprecated*. Bind a function to an object. - * Method to easily create closures with 'this' altered. - * - * Parameters: - * object - {Object} the this parameter - * - * Returns: - * {Function} A closure with 'this' altered to the first - * argument. - */ - Function.prototype.bind = function() { - OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated", - {'newMethod':'OpenLayers.Function.bind'})); - // new function takes the same arguments with this function up front - Array.prototype.unshift.apply(arguments, [this]); - return OpenLayers.Function.bind.apply(null, arguments); - }; -} - -if (!Function.prototype.bindAsEventListener) { - /** - * APIMethod: Function.bindAsEventListener - * *Deprecated*. Bind a function to an object, and configure it to receive the - * event object as first parameter when called. - * - * Parameters: - * object - {Object} A reference to this. - * - * Returns: - * {Function} - */ - Function.prototype.bindAsEventListener = function(object) { - OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated", - {'newMethod':'OpenLayers.Function.bindAsEventListener'})); - return OpenLayers.Function.bindAsEventListener(this, object); - }; -} - -/** - * Namespace: OpenLayers.Array - * Contains convenience functions for array manipulation. - */ -OpenLayers.Array = { - - /** - * APIMethod: filter - * Filter an array. Provides the functionality of the - * Array.prototype.filter extension to the ECMA-262 standard. Where - * available, Array.prototype.filter will be used. - * - * Based on well known example from http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Array:filter - * - * Parameters: - * array - {Array} The array to be filtered. This array is not mutated. - * Elements added to this array by the callback will not be visited. - * callback - {Function} A function that is called for each element in - * the array. If this function returns true, the element will be - * included in the return. The function will be called with three - * arguments: the element in the array, the index of that element, and - * the array itself. If the optional caller parameter is specified - * the callback will be called with this set to caller. - * caller - {Object} Optional object to be set as this when the callback - * is called. - * - * Returns: - * {Array} An array of elements from the passed in array for which the - * callback returns true. - */ - filter: function(array, callback, caller) { - var selected = []; - if (Array.prototype.filter) { - selected = array.filter(callback, caller); - } else { - var len = array.length; - if (typeof callback != "function") { - throw new TypeError(); - } - for(var i=0; i bounds = new OpenLayers.Bounds(); - * > bounds.extend(new OpenLayers.LonLat(4,5)); - * > bounds.extend(new OpenLayers.LonLat(5,6)); - * > bounds.toBBOX(); // returns 4,5,5,6 - */ -OpenLayers.Bounds = OpenLayers.Class({ - - /** - * Property: left - * {Number} Minimum horizontal coordinate. - */ - left: null, - - /** - * Property: bottom - * {Number} Minimum vertical coordinate. - */ - bottom: null, - - /** - * Property: right - * {Number} Maximum horizontal coordinate. - */ - right: null, - - /** - * Property: top - * {Number} Maximum vertical coordinate. - */ - top: null, - - /** - * Property: centerLonLat - * {} A cached center location. This should not be - * accessed directly. Use instead. - */ - centerLonLat: null, - - /** - * Constructor: OpenLayers.Bounds - * Construct a new bounds object. - * - * Parameters: - * left - {Number} The left bounds of the box. Note that for width - * calculations, this is assumed to be less than the right value. - * bottom - {Number} The bottom bounds of the box. Note that for height - * calculations, this is assumed to be more than the top value. - * right - {Number} The right bounds. - * top - {Number} The top bounds. - */ - initialize: function(left, bottom, right, top) { - if (left != null) { - this.left = OpenLayers.Util.toFloat(left); - } - if (bottom != null) { - this.bottom = OpenLayers.Util.toFloat(bottom); - } - if (right != null) { - this.right = OpenLayers.Util.toFloat(right); - } - if (top != null) { - this.top = OpenLayers.Util.toFloat(top); - } - }, - - /** - * Method: clone - * Create a cloned instance of this bounds. - * - * Returns: - * {} A fresh copy of the bounds - */ - clone:function() { - return new OpenLayers.Bounds(this.left, this.bottom, - this.right, this.top); - }, - - /** - * Method: equals - * Test a two bounds for equivalence. - * - * Parameters: - * bounds - {} - * - * Returns: - * {Boolean} The passed-in bounds object has the same left, - * right, top, bottom components as this. Note that if bounds - * passed in is null, returns false. - */ - equals:function(bounds) { - var equals = false; - if (bounds != null) { - equals = ((this.left == bounds.left) && - (this.right == bounds.right) && - (this.top == bounds.top) && - (this.bottom == bounds.bottom)); - } - return equals; - }, - - /** - * APIMethod: toString - * - * Returns: - * {String} String representation of bounds object. - * (ex."left-bottom=(5,42) right-top=(10,45)") - */ - toString:function() { - return ( "left-bottom=(" + this.left + "," + this.bottom + ")" - + " right-top=(" + this.right + "," + this.top + ")" ); - }, - - /** - * APIMethod: toArray - * - * Returns: - * {Array} array of left, bottom, right, top - */ - toArray: function() { - return [this.left, this.bottom, this.right, this.top]; - }, - - /** - * APIMethod: toBBOX - * - * Parameters: - * decimal - {Integer} How many significant digits in the bbox coords? - * Default is 6 - * - * Returns: - * {String} Simple String representation of bounds object. - * (ex. "5,42,10,45") - */ - toBBOX:function(decimal) { - if (decimal== null) { - decimal = 6; - } - var mult = Math.pow(10, decimal); - var bbox = Math.round(this.left * mult) / mult + "," + - Math.round(this.bottom * mult) / mult + "," + - Math.round(this.right * mult) / mult + "," + - Math.round(this.top * mult) / mult; - - return bbox; - }, - - /** - * APIMethod: toGeometry - * Create a new polygon geometry based on this bounds. - * - * Returns: - * {} A new polygon with the coordinates - * of this bounds. - */ - toGeometry: function() { - return new OpenLayers.Geometry.Polygon([ - new OpenLayers.Geometry.LinearRing([ - new OpenLayers.Geometry.Point(this.left, this.bottom), - new OpenLayers.Geometry.Point(this.right, this.bottom), - new OpenLayers.Geometry.Point(this.right, this.top), - new OpenLayers.Geometry.Point(this.left, this.top) - ]) - ]); - }, - - /** - * APIMethod: getWidth - * - * Returns: - * {Float} The width of the bounds - */ - getWidth:function() { - return (this.right - this.left); - }, - - /** - * APIMethod: getHeight - * - * Returns: - * {Float} The height of the bounds (top minus bottom). - */ - getHeight:function() { - return (this.top - this.bottom); - }, - - /** - * APIMethod: getSize - * - * Returns: - * {} The size of the box. - */ - getSize:function() { - return new OpenLayers.Size(this.getWidth(), this.getHeight()); - }, - - /** - * APIMethod: getCenterPixel - * - * Returns: - * {} The center of the bounds in pixel space. - */ - getCenterPixel:function() { - return new OpenLayers.Pixel( (this.left + this.right) / 2, - (this.bottom + this.top) / 2); - }, - - /** - * APIMethod: getCenterLonLat - * - * Returns: - * {} The center of the bounds in map space. - */ - getCenterLonLat:function() { - if(!this.centerLonLat) { - this.centerLonLat = new OpenLayers.LonLat( - (this.left + this.right) / 2, (this.bottom + this.top) / 2 - ); - } - return this.centerLonLat; - }, - - /** - * Method: scale - * Scales the bounds around a pixel or lonlat. Note that the new - * bounds may return non-integer properties, even if a pixel - * is passed. - * - * Parameters: - * ratio - {Float} - * origin - { or } - * Default is center. - * - * Returns: - * {} A new bounds that is scaled by ratio - * from origin. - */ - - scale: function(ratio, origin){ - if(origin == null){ - origin = this.getCenterLonLat(); - } - - var bounds = []; - - var origx,origy; - - // get origin coordinates - if(origin.CLASS_NAME == "OpenLayers.LonLat"){ - origx = origin.lon; - origy = origin.lat; - } else { - origx = origin.x; - origy = origin.y; - } - - var left = (this.left - origx) * ratio + origx; - var bottom = (this.bottom - origy) * ratio + origy; - var right = (this.right - origx) * ratio + origx; - var top = (this.top - origy) * ratio + origy; - - return new OpenLayers.Bounds(left, bottom, right, top); - }, - - /** - * APIMethod: add - * - * Parameters: - * x - {Float} - * y - {Float} - * - * Returns: - * {} A new bounds whose coordinates are the same as - * this, but shifted by the passed-in x and y values. - */ - add:function(x, y) { - if ( (x == null) || (y == null) ) { - var msg = OpenLayers.i18n("boundsAddError"); - OpenLayers.Console.error(msg); - return null; - } - return new OpenLayers.Bounds(this.left + x, this.bottom + y, - this.right + x, this.top + y); - }, - - /** - * APIMethod: extend - * Extend the bounds to include the point, lonlat, or bounds specified. - * Note, this function assumes that left < right and bottom < top. - * - * Parameters: - * object - {Object} Can be LonLat, Point, or Bounds - */ - extend:function(object) { - var bounds = null; - if (object) { - // clear cached center location - switch(object.CLASS_NAME) { - case "OpenLayers.LonLat": - bounds = new OpenLayers.Bounds(object.lon, object.lat, - object.lon, object.lat); - break; - case "OpenLayers.Geometry.Point": - bounds = new OpenLayers.Bounds(object.x, object.y, - object.x, object.y); - break; - - case "OpenLayers.Bounds": - bounds = object; - break; - } - - if (bounds) { - this.centerLonLat = null; - if ( (this.left == null) || (bounds.left < this.left)) { - this.left = bounds.left; - } - if ( (this.bottom == null) || (bounds.bottom < this.bottom) ) { - this.bottom = bounds.bottom; - } - if ( (this.right == null) || (bounds.right > this.right) ) { - this.right = bounds.right; - } - if ( (this.top == null) || (bounds.top > this.top) ) { - this.top = bounds.top; - } - } - } - }, - - /** - * APIMethod: containsLonLat - * - * Parameters: - * ll - {} - * inclusive - {Boolean} Whether or not to include the border. - * Default is true. - * - * Returns: - * {Boolean} The passed-in lonlat is within this bounds. - */ - containsLonLat:function(ll, inclusive) { - return this.contains(ll.lon, ll.lat, inclusive); - }, - - /** - * APIMethod: containsPixel - * - * Parameters: - * px - {} - * inclusive - {Boolean} Whether or not to include the border. Default is - * true. - * - * Returns: - * {Boolean} The passed-in pixel is within this bounds. - */ - containsPixel:function(px, inclusive) { - return this.contains(px.x, px.y, inclusive); - }, - - /** - * APIMethod: contains - * - * Parameters: - * x - {Float} - * y - {Float} - * inclusive - {Boolean} Whether or not to include the border. Default is - * true. - * - * Returns: - * {Boolean} Whether or not the passed-in coordinates are within this - * bounds. - */ - contains:function(x, y, inclusive) { - //set default - if (inclusive == null) { - inclusive = true; - } - - if (x == null || y == null) { - return false; - } - - x = OpenLayers.Util.toFloat(x); - y = OpenLayers.Util.toFloat(y); - - var contains = false; - if (inclusive) { - contains = ((x >= this.left) && (x <= this.right) && - (y >= this.bottom) && (y <= this.top)); - } else { - contains = ((x > this.left) && (x < this.right) && - (y > this.bottom) && (y < this.top)); - } - return contains; - }, - - /** - * APIMethod: intersectsBounds - * Determine whether the target bounds intersects this bounds. Bounds are - * considered intersecting if any of their edges intersect or if one - * bounds contains the other. - * - * Parameters: - * bounds - {} The target bounds. - * inclusive - {Boolean} Treat coincident borders as intersecting. Default - * is true. If false, bounds that do not overlap but only touch at the - * border will not be considered as intersecting. - * - * Returns: - * {Boolean} The passed-in bounds object intersects this bounds. - */ - intersectsBounds:function(bounds, inclusive) { - if (inclusive == null) { - inclusive = true; - } - var intersects = false; - var mightTouch = ( - this.left == bounds.right || - this.right == bounds.left || - this.top == bounds.bottom || - this.bottom == bounds.top - ); - - // if the two bounds only touch at an edge, and inclusive is false, - // then the bounds don't *really* intersect. - if (inclusive || !mightTouch) { - // otherwise, if one of the boundaries even partially contains another, - // inclusive of the edges, then they do intersect. - var inBottom = ( - ((bounds.bottom >= this.bottom) && (bounds.bottom <= this.top)) || - ((this.bottom >= bounds.bottom) && (this.bottom <= bounds.top)) - ); - var inTop = ( - ((bounds.top >= this.bottom) && (bounds.top <= this.top)) || - ((this.top > bounds.bottom) && (this.top < bounds.top)) - ); - var inLeft = ( - ((bounds.left >= this.left) && (bounds.left <= this.right)) || - ((this.left >= bounds.left) && (this.left <= bounds.right)) - ); - var inRight = ( - ((bounds.right >= this.left) && (bounds.right <= this.right)) || - ((this.right >= bounds.left) && (this.right <= bounds.right)) - ); - intersects = ((inBottom || inTop) && (inLeft || inRight)); - } - return intersects; - }, - - /** - * APIMethod: containsBounds - * Determine whether the target bounds is contained within this bounds. - * - * bounds - {} The target bounds. - * partial - {Boolean} If any of the target corners is within this bounds - * consider the bounds contained. Default is false. If true, the - * entire target bounds must be contained within this bounds. - * inclusive - {Boolean} Treat shared edges as contained. Default is - * true. - * - * Returns: - * {Boolean} The passed-in bounds object is contained within this bounds. - */ - containsBounds:function(bounds, partial, inclusive) { - if (partial == null) { - partial = false; - } - if (inclusive == null) { - inclusive = true; - } - var bottomLeft = this.contains(bounds.left, bounds.bottom, inclusive); - var bottomRight = this.contains(bounds.right, bounds.bottom, inclusive); - var topLeft = this.contains(bounds.left, bounds.top, inclusive); - var topRight = this.contains(bounds.right, bounds.top, inclusive); - - return (partial) ? (bottomLeft || bottomRight || topLeft || topRight) - : (bottomLeft && bottomRight && topLeft && topRight); - }, - - /** - * APIMethod: determineQuadrant - * - * Parameters: - * lonlat - {} - * - * Returns: - * {String} The quadrant ("br" "tr" "tl" "bl") of the bounds in which the - * coordinate lies. - */ - determineQuadrant: function(lonlat) { - - var quadrant = ""; - var center = this.getCenterLonLat(); - - quadrant += (lonlat.lat < center.lat) ? "b" : "t"; - quadrant += (lonlat.lon < center.lon) ? "l" : "r"; - - return quadrant; - }, - - /** - * APIMethod: transform - * Transform the Bounds object from source to dest. - * - * Parameters: - * source - {} Source projection. - * dest - {} Destination projection. - * - * Returns: - * {} Itself, for use in chaining operations. - */ - transform: function(source, dest) { - // clear cached center location - this.centerLonLat = null; - var ll = OpenLayers.Projection.transform( - {'x': this.left, 'y': this.bottom}, source, dest); - var lr = OpenLayers.Projection.transform( - {'x': this.right, 'y': this.bottom}, source, dest); - var ul = OpenLayers.Projection.transform( - {'x': this.left, 'y': this.top}, source, dest); - var ur = OpenLayers.Projection.transform( - {'x': this.right, 'y': this.top}, source, dest); - this.left = Math.min(ll.x, ul.x); - this.bottom = Math.min(ll.y, lr.y); - this.right = Math.max(lr.x, ur.x); - this.top = Math.max(ul.y, ur.y); - return this; - }, - - /** - * APIMethod: wrapDateLine - * - * Parameters: - * maxExtent - {} - * options - {Object} Some possible options are: - * leftTolerance - {float} Allow for a margin of error - * with the 'left' value of this - * bound. - * Default is 0. - * rightTolerance - {float} Allow for a margin of error - * with the 'right' value of - * this bound. - * Default is 0. - * - * Returns: - * {} A copy of this bounds, but wrapped around the - * "dateline" (as specified by the borders of - * maxExtent). Note that this function only returns - * a different bounds value if this bounds is - * *entirely* outside of the maxExtent. If this - * bounds straddles the dateline (is part in/part - * out of maxExtent), the returned bounds will be - * merely a copy of this one. - */ - wrapDateLine: function(maxExtent, options) { - options = options || {}; - - var leftTolerance = options.leftTolerance || 0; - var rightTolerance = options.rightTolerance || 0; - - var newBounds = this.clone(); - - if (maxExtent) { - - //shift right? - while ( newBounds.left < maxExtent.left && - (newBounds.right - rightTolerance) <= maxExtent.left ) { - newBounds = newBounds.add(maxExtent.getWidth(), 0); - } - - //shift left? - while ( (newBounds.left + leftTolerance) >= maxExtent.right && - newBounds.right > maxExtent.right ) { - newBounds = newBounds.add(-maxExtent.getWidth(), 0); - } - } - - return newBounds; - }, - - CLASS_NAME: "OpenLayers.Bounds" -}); - -/** - * APIFunction: fromString - * Alternative constructor that builds a new OpenLayers.Bounds from a - * parameter string - * - * Parameters: - * str - {String}Comma-separated bounds string. (ex. "5,42,10,45") - * - * Returns: - * {} New bounds object built from the - * passed-in String. - */ -OpenLayers.Bounds.fromString = function(str) { - var bounds = str.split(","); - return OpenLayers.Bounds.fromArray(bounds); -}; - -/** - * APIFunction: fromArray - * Alternative constructor that builds a new OpenLayers.Bounds - * from an array - * - * Parameters: - * bbox - {Array(Float)} Array of bounds values (ex. [5,42,10,45]) - * - * Returns: - * {} New bounds object built from the passed-in Array. - */ -OpenLayers.Bounds.fromArray = function(bbox) { - return new OpenLayers.Bounds(parseFloat(bbox[0]), - parseFloat(bbox[1]), - parseFloat(bbox[2]), - parseFloat(bbox[3])); -}; - -/** - * APIFunction: fromSize - * Alternative constructor that builds a new OpenLayers.Bounds - * from a size - * - * Parameters: - * size - {} - * - * Returns: - * {} New bounds object built from the passed-in size. - */ -OpenLayers.Bounds.fromSize = function(size) { - return new OpenLayers.Bounds(0, - size.h, - size.w, - 0); -}; - -/** - * Function: oppositeQuadrant - * Get the opposite quadrant for a given quadrant string. - * - * Parameters: - * quadrant - {String} two character quadrant shortstring - * - * Returns: - * {String} The opposing quadrant ("br" "tr" "tl" "bl"). For Example, if - * you pass in "bl" it returns "tr", if you pass in "br" it - * returns "tl", etc. - */ -OpenLayers.Bounds.oppositeQuadrant = function(quadrant) { - var opp = ""; - - opp += (quadrant.charAt(0) == 't') ? 'b' : 't'; - opp += (quadrant.charAt(1) == 'l') ? 'r' : 'l'; - - return opp; -}; diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/BaseTypes/Class.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/BaseTypes/Class.js deleted file mode 100755 index 0f21c37a72..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/BaseTypes/Class.js +++ /dev/null @@ -1,114 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * Constructor: OpenLayers.Class - * Base class used to construct all other classes. Includes support for - * multiple inheritance. - * - * This constructor is new in OpenLayers 2.5. At OpenLayers 3.0, the old - * syntax for creating classes and dealing with inheritance - * will be removed. - * - * To create a new OpenLayers-style class, use the following syntax: - * > var MyClass = OpenLayers.Class(prototype); - * - * To create a new OpenLayers-style class with multiple inheritance, use the - * following syntax: - * > var MyClass = OpenLayers.Class(Class1, Class2, prototype); - * Note that instanceof reflection will only reveil Class1 as superclass. - * Class2 ff are mixins. - * - */ -OpenLayers.Class = function() { - var Class = function() { - /** - * This following condition can be removed at 3.0 - this is only for - * backwards compatibility while the Class.inherit method is still - * in use. So at 3.0, the following three lines would be replaced with - * simply: - * this.initialize.apply(this, arguments); - */ - if (arguments && arguments[0] != OpenLayers.Class.isPrototype) { - this.initialize.apply(this, arguments); - } - }; - var extended = {}; - var parent, initialize; - for(var i=0, len=arguments.length; i 1) { - initialize = arguments[i].prototype.initialize; - // replace the initialize method with an empty function, - // because we do not want to create a real instance here - arguments[i].prototype.initialize = function() {}; - // the line below makes sure that the new class has a - // superclass - extended = new arguments[i]; - // restore the original initialize method - if(initialize === undefined) { - delete arguments[i].prototype.initialize; - } else { - arguments[i].prototype.initialize = initialize; - } - } - // get the prototype of the superclass - parent = arguments[i].prototype; - } else { - // in this case we're extending with the prototype - parent = arguments[i]; - } - OpenLayers.Util.extend(extended, parent); - } - Class.prototype = extended; - return Class; -}; - -/** - * Property: isPrototype - * *Deprecated*. This is no longer needed and will be removed at 3.0. - */ -OpenLayers.Class.isPrototype = function () {}; - -/** - * APIFunction: OpenLayers.create - * *Deprecated*. Old method to create an OpenLayers style class. Use the - * constructor instead. - * - * Returns: - * An OpenLayers class - */ -OpenLayers.Class.create = function() { - return function() { - if (arguments && arguments[0] != OpenLayers.Class.isPrototype) { - this.initialize.apply(this, arguments); - } - }; -}; - - -/** - * APIFunction: inherit - * *Deprecated*. Old method to inherit from one or more OpenLayers style - * classes. Use the constructor instead. - * - * Parameters: - * class - One or more classes can be provided as arguments - * - * Returns: - * An object prototype - */ -OpenLayers.Class.inherit = function () { - var superClass = arguments[0]; - var proto = new superClass(OpenLayers.Class.isPrototype); - for (var i=1, len=arguments.length; i"lon=5,lat=42") - */ - toString:function() { - return ("lon=" + this.lon + ",lat=" + this.lat); - }, - - /** - * APIMethod: toShortString - * - * Returns: - * {String} Shortened String representation of OpenLayers.LonLat object. - * (ex. "5, 42") - */ - toShortString:function() { - return (this.lon + ", " + this.lat); - }, - - /** - * APIMethod: clone - * - * Returns: - * {} New OpenLayers.LonLat object with the same lon - * and lat values - */ - clone:function() { - return new OpenLayers.LonLat(this.lon, this.lat); - }, - - /** - * APIMethod: add - * - * Parameters: - * lon - {Float} - * lat - {Float} - * - * Returns: - * {} A new OpenLayers.LonLat object with the lon and - * lat passed-in added to this's. - */ - add:function(lon, lat) { - if ( (lon == null) || (lat == null) ) { - var msg = OpenLayers.i18n("lonlatAddError"); - OpenLayers.Console.error(msg); - return null; - } - return new OpenLayers.LonLat(this.lon + lon, this.lat + lat); - }, - - /** - * APIMethod: equals - * - * Parameters: - * ll - {} - * - * Returns: - * {Boolean} Boolean value indicating whether the passed-in - * object has the same lon and lat - * components as this. - * Note: if ll passed in is null, returns false - */ - equals:function(ll) { - var equals = false; - if (ll != null) { - equals = ((this.lon == ll.lon && this.lat == ll.lat) || - (isNaN(this.lon) && isNaN(this.lat) && isNaN(ll.lon) && isNaN(ll.lat))); - } - return equals; - }, - - /** - * APIMethod: transform - * Transform the LonLat object from source to dest. This transformation is - * *in place*: if you want a *new* lonlat, use .clone() first. - * - * Parameters: - * source - {} Source projection. - * dest - {} Destination projection. - * - * Returns: - * {} Itself, for use in chaining operations. - */ - transform: function(source, dest) { - var point = OpenLayers.Projection.transform( - {'x': this.lon, 'y': this.lat}, source, dest); - this.lon = point.x; - this.lat = point.y; - return this; - }, - - /** - * APIMethod: wrapDateLine - * - * Parameters: - * maxExtent - {} - * - * Returns: - * {} A copy of this lonlat, but wrapped around the - * "dateline" (as specified by the borders of - * maxExtent) - */ - wrapDateLine: function(maxExtent) { - - var newLonLat = this.clone(); - - if (maxExtent) { - //shift right? - while (newLonLat.lon < maxExtent.left) { - newLonLat.lon += maxExtent.getWidth(); - } - - //shift left? - while (newLonLat.lon > maxExtent.right) { - newLonLat.lon -= maxExtent.getWidth(); - } - } - - return newLonLat; - }, - - CLASS_NAME: "OpenLayers.LonLat" -}); - -/** - * Function: fromString - * Alternative constructor that builds a new from a - * parameter string - * - * Parameters: - * str - {String} Comma-separated Lon,Lat coordinate string. - * (ex. "5,40") - * - * Returns: - * {} New object built from the - * passed-in String. - */ -OpenLayers.LonLat.fromString = function(str) { - var pair = str.split(","); - return new OpenLayers.LonLat(parseFloat(pair[0]), - parseFloat(pair[1])); -}; diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/BaseTypes/Pixel.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/BaseTypes/Pixel.js deleted file mode 100755 index 755ab0cdcd..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/BaseTypes/Pixel.js +++ /dev/null @@ -1,124 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Console.js - */ - -/** - * Class: OpenLayers.Pixel - * This class represents a screen coordinate, in x and y coordinates - */ -OpenLayers.Pixel = OpenLayers.Class({ - - /** - * APIProperty: x - * {Number} The x coordinate - */ - x: 0.0, - - /** - * APIProperty: y - * {Number} The y coordinate - */ - y: 0.0, - - /** - * Constructor: OpenLayers.Pixel - * Create a new OpenLayers.Pixel instance - * - * Parameters: - * x - {Number} The x coordinate - * y - {Number} The y coordinate - * - * Returns: - * An instance of OpenLayers.Pixel - */ - initialize: function(x, y) { - this.x = parseFloat(x); - this.y = parseFloat(y); - }, - - /** - * Method: toString - * Cast this object into a string - * - * Returns: - * {String} The string representation of Pixel. ex: "x=200.4,y=242.2" - */ - toString:function() { - return ("x=" + this.x + ",y=" + this.y); - }, - - /** - * APIMethod: clone - * Return a clone of this pixel object - * - * Returns: - * {} A clone pixel - */ - clone:function() { - return new OpenLayers.Pixel(this.x, this.y); - }, - - /** - * APIMethod: equals - * Determine whether one pixel is equivalent to another - * - * Parameters: - * px - {} - * - * Returns: - * {Boolean} The point passed in as parameter is equal to this. Note that - * if px passed in is null, returns false. - */ - equals:function(px) { - var equals = false; - if (px != null) { - equals = ((this.x == px.x && this.y == px.y) || - (isNaN(this.x) && isNaN(this.y) && isNaN(px.x) && isNaN(px.y))); - } - return equals; - }, - - /** - * APIMethod: add - * - * Parameters: - * x - {Integer} - * y - {Integer} - * - * Returns: - * {} A new Pixel with this pixel's x&y augmented by the - * values passed in. - */ - add:function(x, y) { - if ( (x == null) || (y == null) ) { - var msg = OpenLayers.i18n("pixelAddError"); - OpenLayers.Console.error(msg); - return null; - } - return new OpenLayers.Pixel(this.x + x, this.y + y); - }, - - /** - * APIMethod: offset - * - * Parameters - * px - {} - * - * Returns: - * {} A new Pixel with this pixel's x&y augmented by the - * x&y values of the pixel passed in. - */ - offset:function(px) { - var newPx = this.clone(); - if (px) { - newPx = this.add(px.x, px.y); - } - return newPx; - }, - - CLASS_NAME: "OpenLayers.Pixel" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/BaseTypes/Size.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/BaseTypes/Size.js deleted file mode 100755 index 0b56284068..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/BaseTypes/Size.js +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * Class: OpenLayers.Size - * Instances of this class represent a width/height pair - */ -OpenLayers.Size = OpenLayers.Class({ - - /** - * APIProperty: w - * {Number} width - */ - w: 0.0, - - /** - * APIProperty: h - * {Number} height - */ - h: 0.0, - - - /** - * Constructor: OpenLayers.Size - * Create an instance of OpenLayers.Size - * - * Parameters: - * w - {Number} width - * h - {Number} height - */ - initialize: function(w, h) { - this.w = parseFloat(w); - this.h = parseFloat(h); - }, - - /** - * Method: toString - * Return the string representation of a size object - * - * Returns: - * {String} The string representation of OpenLayers.Size object. - * (ex. "w=55,h=66") - */ - toString:function() { - return ("w=" + this.w + ",h=" + this.h); - }, - - /** - * APIMethod: clone - * Create a clone of this size object - * - * Returns: - * {} A new OpenLayers.Size object with the same w and h - * values - */ - clone:function() { - return new OpenLayers.Size(this.w, this.h); - }, - - /** - * - * APIMethod: equals - * Determine where this size is equal to another - * - * Parameters: - * sz - {} - * - * Returns: - * {Boolean} The passed in size has the same h and w properties as this one. - * Note that if sz passed in is null, returns false. - * - */ - equals:function(sz) { - var equals = false; - if (sz != null) { - equals = ((this.w == sz.w && this.h == sz.h) || - (isNaN(this.w) && isNaN(this.h) && isNaN(sz.w) && isNaN(sz.h))); - } - return equals; - }, - - CLASS_NAME: "OpenLayers.Size" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Console.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Console.js deleted file mode 100755 index ec42af93d4..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Console.js +++ /dev/null @@ -1,245 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * Namespace: OpenLayers.Console - * The OpenLayers.Console namespace is used for debugging and error logging. - * If the Firebug Lite (../Firebug/firebug.js) is included before this script, - * calls to OpenLayers.Console methods will get redirected to window.console. - * This makes use of the Firebug extension where available and allows for - * cross-browser debugging Firebug style. - * - * Note: - * Note that behavior will differ with the Firebug extention and Firebug Lite. - * Most notably, the Firebug Lite console does not currently allow for - * hyperlinks to code or for clicking on object to explore their properties. - * - */ -OpenLayers.Console = { - /** - * Create empty functions for all console methods. The real value of these - * properties will be set if Firebug Lite (../Firebug/firebug.js script) is - * included. We explicitly require the Firebug Lite script to trigger - * functionality of the OpenLayers.Console methods. - */ - - /** - * APIFunction: log - * Log an object in the console. The Firebug Lite console logs string - * representation of objects. Given multiple arguments, they will - * be cast to strings and logged with a space delimiter. If the first - * argument is a string with printf-like formatting, subsequent arguments - * will be used in string substitution. Any additional arguments (beyond - * the number substituted in a format string) will be appended in a space- - * delimited line. - * - * Parameters: - * object - {Object} - */ - log: function() {}, - - /** - * APIFunction: debug - * Writes a message to the console, including a hyperlink to the line - * where it was called. - * - * May be called with multiple arguments as with OpenLayers.Console.log(). - * - * Parameters: - * object - {Object} - */ - debug: function() {}, - - /** - * APIFunction: info - * Writes a message to the console with the visual "info" icon and color - * coding and a hyperlink to the line where it was called. - * - * May be called with multiple arguments as with OpenLayers.Console.log(). - * - * Parameters: - * object - {Object} - */ - info: function() {}, - - /** - * APIFunction: warn - * Writes a message to the console with the visual "warning" icon and - * color coding and a hyperlink to the line where it was called. - * - * May be called with multiple arguments as with OpenLayers.Console.log(). - * - * Parameters: - * object - {Object} - */ - warn: function() {}, - - /** - * APIFunction: error - * Writes a message to the console with the visual "error" icon and color - * coding and a hyperlink to the line where it was called. - * - * May be called with multiple arguments as with OpenLayers.Console.log(). - * - * Parameters: - * object - {Object} - */ - error: function() {}, - - /** - * APIFunction: userError - * A single interface for showing error messages to the user. The default - * behavior is a Javascript alert, though this can be overridden by - * reassigning OpenLayers.Console.userError to a different function. - * - * Expects a single error message - * - * Parameters: - * object - {Object} - */ - userError: function(error) { - alert(error); - }, - - /** - * APIFunction: assert - * Tests that an expression is true. If not, it will write a message to - * the console and throw an exception. - * - * May be called with multiple arguments as with OpenLayers.Console.log(). - * - * Parameters: - * object - {Object} - */ - assert: function() {}, - - /** - * APIFunction: dir - * Prints an interactive listing of all properties of the object. This - * looks identical to the view that you would see in the DOM tab. - * - * Parameters: - * object - {Object} - */ - dir: function() {}, - - /** - * APIFunction: dirxml - * Prints the XML source tree of an HTML or XML element. This looks - * identical to the view that you would see in the HTML tab. You can click - * on any node to inspect it in the HTML tab. - * - * Parameters: - * object - {Object} - */ - dirxml: function() {}, - - /** - * APIFunction: trace - * Prints an interactive stack trace of JavaScript execution at the point - * where it is called. The stack trace details the functions on the stack, - * as well as the values that were passed as arguments to each function. - * You can click each function to take you to its source in the Script tab, - * and click each argument value to inspect it in the DOM or HTML tabs. - * - */ - trace: function() {}, - - /** - * APIFunction: group - * Writes a message to the console and opens a nested block to indent all - * future messages sent to the console. Call OpenLayers.Console.groupEnd() - * to close the block. - * - * May be called with multiple arguments as with OpenLayers.Console.log(). - * - * Parameters: - * object - {Object} - */ - group: function() {}, - - /** - * APIFunction: groupEnd - * Closes the most recently opened block created by a call to - * OpenLayers.Console.group - */ - groupEnd: function() {}, - - /** - * APIFunction: time - * Creates a new timer under the given name. Call - * OpenLayers.Console.timeEnd(name) - * with the same name to stop the timer and print the time elapsed. - * - * Parameters: - * name - {String} - */ - time: function() {}, - - /** - * APIFunction: timeEnd - * Stops a timer created by a call to OpenLayers.Console.time(name) and - * writes the time elapsed. - * - * Parameters: - * name - {String} - */ - timeEnd: function() {}, - - /** - * APIFunction: profile - * Turns on the JavaScript profiler. The optional argument title would - * contain the text to be printed in the header of the profile report. - * - * This function is not currently implemented in Firebug Lite. - * - * Parameters: - * title - {String} Optional title for the profiler - */ - profile: function() {}, - - /** - * APIFunction: profileEnd - * Turns off the JavaScript profiler and prints its report. - * - * This function is not currently implemented in Firebug Lite. - */ - profileEnd: function() {}, - - /** - * APIFunction: count - * Writes the number of times that the line of code where count was called - * was executed. The optional argument title will print a message in - * addition to the number of the count. - * - * This function is not currently implemented in Firebug Lite. - * - * Parameters: - * title - {String} Optional title to be printed with count - */ - count: function() {}, - - CLASS_NAME: "OpenLayers.Console" -}; - -/** - * Execute an anonymous function to extend the OpenLayers.Console namespace - * if the firebug.js script is included. This closure is used so that the - * "scripts" and "i" variables don't pollute the global namespace. - */ -(function() { - /** - * If Firebug Lite is included (before this script), re-route all - * OpenLayers.Console calls to the console object. - */ - var scripts = document.getElementsByTagName("script"); - for(var i=0, len=scripts.length; i var map = new OpenLayers.Map('map', { controls: [] }); - * > - * > map.addControl(new OpenLayers.Control.PanZoomBar()); - * > map.addControl(new OpenLayers.Control.MouseToolbar()); - * > map.addControl(new OpenLayers.Control.LayerSwitcher({'ascending':false})); - * > map.addControl(new OpenLayers.Control.Permalink()); - * > map.addControl(new OpenLayers.Control.Permalink('permalink')); - * > map.addControl(new OpenLayers.Control.MousePosition()); - * > map.addControl(new OpenLayers.Control.OverviewMap()); - * > map.addControl(new OpenLayers.Control.KeyboardDefaults()); - * - * The next code fragment is a quick example of how to intercept - * shift-mouse click to display the extent of the bounding box - * dragged out by the user. Usually controls are not created - * in exactly this manner. See the source for a more complete - * example: - * - * > var control = new OpenLayers.Control(); - * > OpenLayers.Util.extend(control, { - * > draw: function () { - * > // this Handler.Box will intercept the shift-mousedown - * > // before Control.MouseDefault gets to see it - * > this.box = new OpenLayers.Handler.Box( control, - * > {"done": this.notice}, - * > {keyMask: OpenLayers.Handler.MOD_SHIFT}); - * > this.box.activate(); - * > }, - * > - * > notice: function (bounds) { - * > OpenLayers.Console.userError(bounds); - * > } - * > }); - * > map.addControl(control); - * - */ -OpenLayers.Control = OpenLayers.Class({ - - /** - * Property: id - * {String} - */ - id: null, - - /** - * Property: map - * {} this gets set in the addControl() function in - * OpenLayers.Map - */ - map: null, - - /** - * Property: div - * {DOMElement} - */ - div: null, - - /** - * Property: type - * {OpenLayers.Control.TYPES} Controls can have a 'type'. The type - * determines the type of interactions which are possible with them when - * they are placed into a toolbar. - */ - type: null, - - /** - * Property: allowSelection - * {Boolean} By deafault, controls do not allow selection, because - * it may interfere with map dragging. If this is true, OpenLayers - * will not prevent selection of the control. - * Default is false. - */ - allowSelection: false, - - /** - * Property: displayClass - * {string} This property is used for CSS related to the drawing of the - * Control. - */ - displayClass: "", - - /** - * Property: title - * {string} This property is used for showing a tooltip over the - * Control. - */ - title: "", - - /** - * Property: active - * {Boolean} The control is active. - */ - active: null, - - /** - * Property: handler - * {} null - */ - handler: null, - - /** - * APIProperty: eventListeners - * {Object} If set as an option at construction, the eventListeners - * object will be registered with . Object - * structure must be a listeners object as shown in the example for - * the events.on method. - */ - eventListeners: null, - - /** - * Property: events - * {} Events instance for triggering control specific - * events. - */ - events: null, - - /** - * Constant: EVENT_TYPES - * {Array(String)} Supported application event types. Register a listener - * for a particular event with the following syntax: - * (code) - * control.events.register(type, obj, listener); - * (end) - * - * Listeners will be called with a reference to an event object. The - * properties of this event depends on exactly what happened. - * - * All event objects have at least the following properties: - * object - {Object} A reference to control.events.object (a reference - * to the control). - * element - {DOMElement} A reference to control.events.element (which - * will be null unless documented otherwise). - * - * Supported map event types: - * activate - Triggered when activated. - * deactivate - Triggered when deactivated. - */ - EVENT_TYPES: ["activate", "deactivate"], - - /** - * Constructor: OpenLayers.Control - * Create an OpenLayers Control. The options passed as a parameter - * directly extend the control. For example passing the following: - * - * > var control = new OpenLayers.Control({div: myDiv}); - * - * Overrides the default div attribute value of null. - * - * Parameters: - * options - {Object} - */ - initialize: function (options) { - // We do this before the extend so that instances can override - // className in options. - this.displayClass = - this.CLASS_NAME.replace("OpenLayers.", "ol").replace(/\./g, ""); - - OpenLayers.Util.extend(this, options); - - this.events = new OpenLayers.Events(this, null, this.EVENT_TYPES); - if(this.eventListeners instanceof Object) { - this.events.on(this.eventListeners); - } - if (this.id == null) { - this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_"); - } - }, - - /** - * Method: destroy - * The destroy method is used to perform any clean up before the control - * is dereferenced. Typically this is where event listeners are removed - * to prevent memory leaks. - */ - destroy: function () { - if(this.events) { - if(this.eventListeners) { - this.events.un(this.eventListeners); - } - this.events.destroy(); - this.events = null; - } - this.eventListeners = null; - - // eliminate circular references - if (this.handler) { - this.handler.destroy(); - this.handler = null; - } - if(this.handlers) { - for(var key in this.handlers) { - if(this.handlers.hasOwnProperty(key) && - typeof this.handlers[key].destroy == "function") { - this.handlers[key].destroy(); - } - } - this.handlers = null; - } - if (this.map) { - this.map.removeControl(this); - this.map = null; - } - }, - - /** - * Method: setMap - * Set the map property for the control. This is done through an accessor - * so that subclasses can override this and take special action once - * they have their map variable set. - * - * Parameters: - * map - {} - */ - setMap: function(map) { - this.map = map; - if (this.handler) { - this.handler.setMap(map); - } - }, - - /** - * Method: draw - * The draw method is called when the control is ready to be displayed - * on the page. If a div has not been created one is created. Controls - * with a visual component will almost always want to override this method - * to customize the look of control. - * - * Parameters: - * px - {} The top-left pixel position of the control - * or null. - * - * Returns: - * {DOMElement} A reference to the DIV DOMElement containing the control - */ - draw: function (px) { - if (this.div == null) { - this.div = OpenLayers.Util.createDiv(this.id); - this.div.className = this.displayClass; - if (!this.allowSelection) { - this.div.className += " olControlNoSelect"; - this.div.setAttribute("unselectable", "on", 0); - this.div.onselectstart = function() { return(false); }; - } - if (this.title != "") { - this.div.title = this.title; - } - } - if (px != null) { - this.position = px.clone(); - } - this.moveTo(this.position); - return this.div; - }, - - /** - * Method: moveTo - * Sets the left and top style attributes to the passed in pixel - * coordinates. - * - * Parameters: - * px - {} - */ - moveTo: function (px) { - if ((px != null) && (this.div != null)) { - this.div.style.left = px.x + "px"; - this.div.style.top = px.y + "px"; - } - }, - - /** - * Method: activate - * Explicitly activates a control and it's associated - * handler if one has been set. Controls can be - * deactivated by calling the deactivate() method. - * - * Returns: - * {Boolean} True if the control was successfully activated or - * false if the control was already active. - */ - activate: function () { - if (this.active) { - return false; - } - if (this.handler) { - this.handler.activate(); - } - this.active = true; - if(this.map) { - OpenLayers.Element.addClass( - this.map.viewPortDiv, - this.displayClass.replace(/ /g, "") + "Active" - ); - } - this.events.triggerEvent("activate"); - return true; - }, - - /** - * Method: deactivate - * Deactivates a control and it's associated handler if any. The exact - * effect of this depends on the control itself. - * - * Returns: - * {Boolean} True if the control was effectively deactivated or false - * if the control was already inactive. - */ - deactivate: function () { - if (this.active) { - if (this.handler) { - this.handler.deactivate(); - } - this.active = false; - if(this.map) { - OpenLayers.Element.removeClass( - this.map.viewPortDiv, - this.displayClass.replace(/ /g, "") + "Active" - ); - } - this.events.triggerEvent("deactivate"); - return true; - } - return false; - }, - - CLASS_NAME: "OpenLayers.Control" -}); - -OpenLayers.Control.TYPE_BUTTON = 1; -OpenLayers.Control.TYPE_TOGGLE = 2; -OpenLayers.Control.TYPE_TOOL = 3; diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/ArgParser.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/ArgParser.js deleted file mode 100755 index bafd822bf1..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/ArgParser.js +++ /dev/null @@ -1,165 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - - -/** - * @requires OpenLayers/Control.js - */ - -/** - * Class: OpenLayers.Control.ArgParser - * The ArgParser control adds location bar querystring parsing functionality - * to an OpenLayers Map. - * When added to a Map control, on a page load/refresh, the Map will - * automatically take the href string and parse it for lon, lat, zoom, and - * layers information. - * - * Inherits from: - * - - */ -OpenLayers.Control.ArgParser = OpenLayers.Class(OpenLayers.Control, { - - /** - * Parameter: center - * {} - */ - center: null, - - /** - * Parameter: zoom - * {int} - */ - zoom: null, - - /** - * Parameter: layers - * {Array()} - */ - layers: null, - - /** - * APIProperty: displayProjection - * {} Requires proj4js support. - * Projection used when reading the coordinates from the URL. This will - * - * reproject the map coordinates from the URL into the map's - * projection. - * - * If you are using this functionality, be aware that any permalink - * which is added to the map will determine the coordinate type which - * is read from the URL, which means you should not add permalinks with - * different displayProjections to the same map. - */ - displayProjection: null, - - /** - * Constructor: OpenLayers.Control.ArgParser - * - * Parameters: - * options - {Object} - */ - initialize: function(options) { - OpenLayers.Control.prototype.initialize.apply(this, arguments); - }, - - /** - * Method: setMap - * Set the map property for the control. - * - * Parameters: - * map - {} - */ - setMap: function(map) { - OpenLayers.Control.prototype.setMap.apply(this, arguments); - - //make sure we dont already have an arg parser attached - for(var i=0, len=this.map.controls.length; i - */ -OpenLayers.Control.Attribution = - OpenLayers.Class(OpenLayers.Control, { - - /** - * APIProperty: seperator - * {String} String used to seperate layers. - */ - separator: ", ", - - /** - * Constructor: OpenLayers.Control.Attribution - * - * Parameters: - * options - {Object} Options for control. - */ - initialize: function(options) { - OpenLayers.Control.prototype.initialize.apply(this, arguments); - }, - - /** - * Method: destroy - * Destroy control. - */ - destroy: function() { - this.map.events.un({ - "removelayer": this.updateAttribution, - "addlayer": this.updateAttribution, - "changelayer": this.updateAttribution, - "changebaselayer": this.updateAttribution, - scope: this - }); - - OpenLayers.Control.prototype.destroy.apply(this, arguments); - }, - - /** - * Method: draw - * Initialize control. - * - * Returns: - * {DOMElement} A reference to the DIV DOMElement containing the control - */ - draw: function() { - OpenLayers.Control.prototype.draw.apply(this, arguments); - - this.map.events.on({ - 'changebaselayer': this.updateAttribution, - 'changelayer': this.updateAttribution, - 'addlayer': this.updateAttribution, - 'removelayer': this.updateAttribution, - scope: this - }); - this.updateAttribution(); - - return this.div; - }, - - /** - * Method: updateAttribution - * Update attribution string. - */ - updateAttribution: function() { - var attributions = []; - if (this.map && this.map.layers) { - for(var i=0, len=this.map.layers.length; i. - * When clicked, the function trigger() is executed. - * - * Inherits from: - * - - * - * Use: - * (code) - * var button = new OpenLayers.Control.Button({ - * displayClass: "MyButton", trigger: myFunction - * }); - * panel.addControls([button]); - * (end) - * - * Will create a button with CSS class MyButtonItemInactive, that - * will call the function MyFunction() when clicked. - */ -OpenLayers.Control.Button = OpenLayers.Class(OpenLayers.Control, { - /** - * Property: type - * {Integer} OpenLayers.Control.TYPE_BUTTON. - */ - type: OpenLayers.Control.TYPE_BUTTON, - - /** - * Method: trigger - * Called by a control panel when the button is clicked. - */ - trigger: function() {}, - - CLASS_NAME: "OpenLayers.Control.Button" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/DragFeature.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/DragFeature.js deleted file mode 100755 index ad390f490e..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/DragFeature.js +++ /dev/null @@ -1,293 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - - -/** - * @requires OpenLayers/Control.js - * @requires OpenLayers/Handler/Drag.js - * @requires OpenLayers/Handler/Feature.js - */ - -/** - * Class: OpenLayers.Control.DragFeature - * The DragFeature control moves a feature with a drag of the mouse. Create a - * new control with the constructor. - * - * Inherits From: - * - - */ -OpenLayers.Control.DragFeature = OpenLayers.Class(OpenLayers.Control, { - - /** - * APIProperty: geometryTypes - * {Array(String)} To restrict dragging to a limited set of geometry types, - * send a list of strings corresponding to the geometry class names. - */ - geometryTypes: null, - - /** - * APIProperty: onStart - * {Function} Define this function if you want to know when a drag starts. - * The function should expect to receive two arguments: the feature - * that is about to be dragged and the pixel location of the mouse. - * - * Parameters: - * feature - {} The feature that is about to be - * dragged. - * pixel - {} The pixel location of the mouse. - */ - onStart: function(feature, pixel) {}, - - /** - * APIProperty: onDrag - * {Function} Define this function if you want to know about each move of a - * feature. The function should expect to receive two arguments: the - * feature that is being dragged and the pixel location of the mouse. - * - * Parameters: - * feature - {} The feature that was dragged. - * pixel - {} The pixel location of the mouse. - */ - onDrag: function(feature, pixel) {}, - - /** - * APIProperty: onComplete - * {Function} Define this function if you want to know when a feature is - * done dragging. The function should expect to receive two arguments: - * the feature that is being dragged and the pixel location of the - * mouse. - * - * Parameters: - * feature - {} The feature that was dragged. - * pixel - {} The pixel location of the mouse. - */ - onComplete: function(feature, pixel) {}, - - /** - * Property: layer - * {} - */ - layer: null, - - /** - * Property: feature - * {} - */ - feature: null, - - /** - * Property: dragCallbacks - * {Object} The functions that are sent to the drag handler for callback. - */ - dragCallbacks: {}, - - /** - * Property: featureCallbacks - * {Object} The functions that are sent to the feature handler for callback. - */ - featureCallbacks: {}, - - /** - * Property: lastPixel - * {} - */ - lastPixel: null, - - /** - * Constructor: OpenLayers.Control.DragFeature - * Create a new control to drag features. - * - * Parameters: - * layer - {} The layer containing features to be - * dragged. - * options - {Object} Optional object whose properties will be set on the - * control. - */ - initialize: function(layer, options) { - OpenLayers.Control.prototype.initialize.apply(this, [options]); - this.layer = layer; - this.handlers = { - drag: new OpenLayers.Handler.Drag( - this, OpenLayers.Util.extend({ - down: this.downFeature, - move: this.moveFeature, - up: this.upFeature, - out: this.cancel, - done: this.doneDragging - }, this.dragCallbacks) - ), - feature: new OpenLayers.Handler.Feature( - this, this.layer, OpenLayers.Util.extend({ - over: this.overFeature, - out: this.outFeature - }, this.featureCallbacks), - {geometryTypes: this.geometryTypes} - ) - }; - }, - - /** - * APIMethod: destroy - * Take care of things that are not handled in superclass - */ - destroy: function() { - this.layer = null; - OpenLayers.Control.prototype.destroy.apply(this, []); - }, - - /** - * APIMethod: activate - * Activate the control and the feature handler. - * - * Returns: - * {Boolean} Successfully activated the control and feature handler. - */ - activate: function() { - return (this.handlers.feature.activate() && - OpenLayers.Control.prototype.activate.apply(this, arguments)); - }, - - /** - * APIMethod: deactivate - * Deactivate the control and all handlers. - * - * Returns: - * {Boolean} Successfully deactivated the control. - */ - deactivate: function() { - // the return from the handlers is unimportant in this case - this.handlers.drag.deactivate(); - this.handlers.feature.deactivate(); - this.feature = null; - this.dragging = false; - this.lastPixel = null; - OpenLayers.Element.removeClass( - this.map.viewPortDiv, this.displayClass + "Over" - ); - return OpenLayers.Control.prototype.deactivate.apply(this, arguments); - }, - - /** - * Method: overFeature - * Called when the feature handler detects a mouse-over on a feature. - * This activates the drag handler. - * - * Parameters: - * feature - {} The selected feature. - */ - overFeature: function(feature) { - if(!this.handlers.drag.dragging) { - this.feature = feature; - this.handlers.drag.activate(); - this.over = true; - OpenLayers.Element.addClass(this.map.viewPortDiv, this.displayClass + "Over"); - } else { - if(this.feature.id == feature.id) { - this.over = true; - } else { - this.over = false; - } - } - }, - - /** - * Method: downFeature - * Called when the drag handler detects a mouse-down. - * - * Parameters: - * pixel - {} Location of the mouse event. - */ - downFeature: function(pixel) { - this.lastPixel = pixel; - this.onStart(this.feature, pixel); - }, - - /** - * Method: moveFeature - * Called when the drag handler detects a mouse-move. Also calls the - * optional onDrag method. - * - * Parameters: - * pixel - {} Location of the mouse event. - */ - moveFeature: function(pixel) { - var res = this.map.getResolution(); - this.feature.geometry.move(res * (pixel.x - this.lastPixel.x), - res * (this.lastPixel.y - pixel.y)); - this.layer.drawFeature(this.feature); - this.lastPixel = pixel; - this.onDrag(this.feature, pixel); - }, - - /** - * Method: upFeature - * Called when the drag handler detects a mouse-up. - * - * Parameters: - * pixel - {} Location of the mouse event. - */ - upFeature: function(pixel) { - if(!this.over) { - this.handlers.drag.deactivate(); - } - }, - - /** - * Method: doneDragging - * Called when the drag handler is done dragging. - * - * Parameters: - * pixel - {} The last event pixel location. If this event - * came from a mouseout, this may not be in the map viewport. - */ - doneDragging: function(pixel) { - this.onComplete(this.feature, pixel); - }, - - /** - * Method: outFeature - * Called when the feature handler detects a mouse-out on a feature. - * - * Parameters: - * feature - {} The feature that the mouse left. - */ - outFeature: function(feature) { - if(!this.handlers.drag.dragging) { - this.over = false; - this.handlers.drag.deactivate(); - OpenLayers.Element.removeClass( - this.map.viewPortDiv, this.displayClass + "Over" - ); - this.feature = null; - } else { - if(this.feature.id == feature.id) { - this.over = false; - } - } - }, - - /** - * Method: cancel - * Called when the drag handler detects a mouse-out (from the map viewport). - */ - cancel: function() { - this.handlers.drag.deactivate(); - this.over = false; - }, - - /** - * Method: setMap - * Set the map property for the control and all handlers. - * - * Parameters: - * map - {} The control's map. - */ - setMap: function(map) { - this.handlers.drag.setMap(map); - this.handlers.feature.setMap(map); - OpenLayers.Control.prototype.setMap.apply(this, arguments); - }, - - CLASS_NAME: "OpenLayers.Control.DragFeature" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/DragPan.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/DragPan.js deleted file mode 100755 index 8caf6b823a..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/DragPan.js +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Control.js - * @requires OpenLayers/Handler/Drag.js - */ - -/** - * Class: OpenLayers.Control.DragPan - * The DragPan control pans the map with a drag of the mouse. - * - * Inherits from: - * - - */ -OpenLayers.Control.DragPan = OpenLayers.Class(OpenLayers.Control, { - - /** - * Property: type - * {OpenLayers.Control.TYPES} - */ - type: OpenLayers.Control.TYPE_TOOL, - - /** - * Property: panned - * {Boolean} The map moved. - */ - panned: false, - - /** - * Property: interval - * {Integer} The number of milliseconds that should ellapse before - * panning the map again. Set this to increase dragging performance. - * Defaults to 25 milliseconds. - */ - interval: 25, - - /** - * Method: draw - * Creates a Drag handler, using and - * as callbacks. - */ - draw: function() { - this.handler = new OpenLayers.Handler.Drag(this, { - "move": this.panMap, - "done": this.panMapDone - }, { - interval: this.interval - } - ); - }, - - /** - * Method: panMap - * - * Parameters: - * xy - {} Pixel of the mouse position - */ - panMap: function(xy) { - this.panned = true; - this.map.pan( - this.handler.last.x - xy.x, - this.handler.last.y - xy.y, - {dragging: this.handler.dragging, animate: false} - ); - }, - - /** - * Method: panMapDone - * Finish the panning operation. Only call setCenter (through ) - * if the map has actually been moved. - * - * Parameters: - * xy - {} Pixel of the mouse position - */ - panMapDone: function(xy) { - if(this.panned) { - this.panMap(xy); - this.panned = false; - } - }, - - CLASS_NAME: "OpenLayers.Control.DragPan" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/DrawFeature.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/DrawFeature.js deleted file mode 100755 index 6056fda869..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/DrawFeature.js +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - - -/** - * @requires OpenLayers/Control.js - * @requires OpenLayers/Feature/Vector.js - */ - -/** - * Class: OpenLayers.Control.DrawFeature - * The DrawFeature control draws point, line or polygon features on a vector - * layer when active. - * - * Inherits from: - * - - */ -OpenLayers.Control.DrawFeature = OpenLayers.Class(OpenLayers.Control, { - - /** - * Property: layer - * {} - */ - layer: null, - - /** - * Property: callbacks - * {Object} The functions that are sent to the handler for callback - */ - callbacks: null, - - /** - * Constant: EVENT_TYPES - * - * Supported event types: - * featureadded - Triggered when a feature is added - */ - EVENT_TYPES: ["featureadded"], - - /** - * APIProperty: featureAdded - * {Function} Called after each feature is added - */ - featureAdded: function() {}, - - /** - * APIProperty: handlerOptions - * {Object} Used to set non-default properties on the control's handler - */ - handlerOptions: null, - - /** - * Constructor: OpenLayers.Control.DrawFeature - * - * Parameters: - * layer - {} - * handler - {} - * options - {Object} - */ - initialize: function(layer, handler, options) { - - // concatenate events specific to vector with those from the base - this.EVENT_TYPES = - OpenLayers.Control.DrawFeature.prototype.EVENT_TYPES.concat( - OpenLayers.Control.prototype.EVENT_TYPES - ); - - OpenLayers.Control.prototype.initialize.apply(this, [options]); - this.callbacks = OpenLayers.Util.extend( - { - done: this.drawFeature, - modify: function(vertex, feature) { - this.layer.events.triggerEvent( - "sketchmodified", {vertex: vertex, feature: feature} - ); - }, - create: function(vertex, feature) { - this.layer.events.triggerEvent( - "sketchstarted", {vertex: vertex, feature: feature} - ); - } - }, - this.callbacks - ); - this.layer = layer; - var sketchStyle = this.layer.styleMap && this.layer.styleMap.styles.temporary; - if(sketchStyle) { - this.handlerOptions = this.handlerOptions || {}; - this.handlerOptions.layerOptions = OpenLayers.Util.applyDefaults( - this.handlerOptions.layerOptions, - {styleMap: new OpenLayers.StyleMap({"default": sketchStyle})} - ); - } - this.handler = new handler(this, this.callbacks, this.handlerOptions); - }, - - /** - * Method: drawFeature - */ - drawFeature: function(geometry) { - var feature = new OpenLayers.Feature.Vector(geometry); - var proceed = this.layer.events.triggerEvent( - "sketchcomplete", {feature: feature} - ); - if(proceed !== false) { - feature.state = OpenLayers.State.INSERT; - this.layer.addFeatures([feature]); - this.featureAdded(feature); - this.events.triggerEvent("featureadded",{feature : feature}); - } - }, - - CLASS_NAME: "OpenLayers.Control.DrawFeature" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/EditingToolbar.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/EditingToolbar.js deleted file mode 100755 index 6a8173fd71..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/EditingToolbar.js +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Control/Panel.js - * @requires OpenLayers/Control/Navigation.js - * @requires OpenLayers/Control/DrawFeature.js - * @requires OpenLayers/Handler/Point.js - * @requires OpenLayers/Handler/Path.js - * @requires OpenLayers/Handler/Polygon.js - */ - -/** - * Class: OpenLayers.Control.EditingToolbar - * The EditingToolbar is a panel of 4 controls to draw polygons, lines, - * points, or to navigate the map by panning. By default it appears in the - * upper right corner of the map. - * - * Inherits from: - * - - */ -OpenLayers.Control.EditingToolbar = OpenLayers.Class( - OpenLayers.Control.Panel, { - - /** - * Constructor: OpenLayers.Control.EditingToolbar - * Create an editing toolbar for a given layer. - * - * Parameters: - * layer - {} - * options - {Object} - */ - initialize: function(layer, options) { - OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]); - - this.addControls( - [ new OpenLayers.Control.Navigation() ] - ); - var controls = [ - new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Point, {'displayClass': 'olControlDrawFeaturePoint'}), - new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Path, {'displayClass': 'olControlDrawFeaturePath'}), - new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Polygon, {'displayClass': 'olControlDrawFeaturePolygon'}) - ]; - this.addControls(controls); - }, - - /** - * Method: draw - * calls the default draw, and then activates mouse defaults. - * - * Returns: - * {DOMElement} - */ - draw: function() { - var div = OpenLayers.Control.Panel.prototype.draw.apply(this, arguments); - this.activateControl(this.controls[0]); - return div; - }, - - CLASS_NAME: "OpenLayers.Control.EditingToolbar" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/GetFeature.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/GetFeature.js deleted file mode 100755 index e8314e69f0..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/GetFeature.js +++ /dev/null @@ -1,558 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Control.js - * @requires OpenLayers/Handler/Click.js - * @requires OpenLayers/Handler/Box.js - * @requires OpenLayers/Handler/Hover.js - * @requires OpenLayers/Filter/Spatial.js - */ - -/** - * Class: OpenLayers.Control.GetFeature - * Gets vector features for locations underneath the mouse cursor. Can be - * configured to act on click, hover or dragged boxes. Uses an - * that supports spatial filters (BBOX) to retrieve - * features from a server and fires events that notify applications of the - * selected features. - * - * Inherits from: - * - - */ -OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, { - - /** - * APIProperty: protocol - * {} Required. The protocol used for fetching - * features. - */ - protocol: null, - - /** - * APIProperty: multipleKey - * {String} An event modifier ('altKey' or 'shiftKey') that temporarily sets - * the property to true. Default is null. - */ - multipleKey: null, - - /** - * APIProperty: toggleKey - * {String} An event modifier ('altKey' or 'shiftKey') that temporarily sets - * the property to true. Default is null. - */ - toggleKey: null, - - /** - * Property: modifiers - * {Object} The event modifiers to use, according to the current event - * being handled by this control's handlers - */ - modifiers: null, - - /** - * APIProperty: multiple - * {Boolean} Allow selection of multiple geometries. Default is false. - */ - multiple: false, - - /** - * APIProperty: click - * {Boolean} Use a click handler for selecting/unselecting features. - * Default is true. - */ - click: true, - - /** - * APIProperty: clickout - * {Boolean} Unselect features when clicking outside any feature. - * Applies only if is true. Default is true. - */ - clickout: true, - - /** - * APIProperty: toggle - * {Boolean} Unselect a selected feature on click. Applies only if - * is true. Default is false. - */ - toggle: false, - - /** - * APIProperty: clickTolerance - * {Integer} Tolerance for the BBOX query in pixels. This has the - * same effect as the tolerance parameter on WMS GetFeatureInfo - * requests. Will be ignored for box selections. Applies only if - * is true. Default is 5. - */ - clickTolerance: 5, - - /** - * APIProperty: hover - * {Boolean} Send feature requests on mouse moves. Default is false. - */ - hover: false, - - /** - * APIProperty: box - * {Boolean} Allow feature selection by drawing a box. - */ - box: false, - - /** - * APIProperty: maxFeatures - * {Integer} Maximum number of features to return from a query, if - * supported by the . Default is 10. - */ - maxFeatures: 10, - - /** - * Property: features - * {Object} Hash of {}, keyed by fid, holding - * the currently selected features - */ - features: null, - - /** - * Proeprty: hoverFeature - * {} The feature currently selected by the - * hover handler - */ - hoverFeature: null, - - /** - * APIProperty: handlerOptions - * {Object} Additional options for the handlers used by this control. This - * is a hash with the keys "click", "box" and "hover". - */ - handlerOptions: null, - - /** - * Property: handlers - * {Object} Object with references to multiple - * instances. - */ - handlers: null, - - /** - * Property: hoverResponse - * {} The response object associated with - * the currently running hover request (if any). - */ - hoverResponse: null, - - /** - * Constant: EVENT_TYPES - * - * Supported event types: - * beforefeatureselected - Triggered when is true before a - * feature is selected. The event object has a feature property with - * the feature about to select - * featureselected - Triggered when is true and a feature is - * selected. The event object has a feature property with the - * selected feature - * featureunselected - Triggered when is true and a feature is - * unselected. The event object has a feature property with the - * unselected feature - * clickout - Triggered when when is true and no feature was - * selected. - * hoverfeature - Triggered when is true and the mouse has - * stopped over a feature - * outfeature - Triggered when is true and the mouse moves - * moved away from a hover-selected feature - */ - EVENT_TYPES: ["featureselected", "featureunselected", "clickout", - "beforefeatureselected", "hoverfeature", "outfeature"], - - /** - * Constructor: OpenLayers.Control.GetFeature - * Create a new control for fetching remote features. - * - * Parameters: - * options - {Object} A configuration object which at least has to contain - * a property - */ - initialize: function(options) { - // concatenate events specific to vector with those from the base - this.EVENT_TYPES = - OpenLayers.Control.GetFeature.prototype.EVENT_TYPES.concat( - OpenLayers.Control.prototype.EVENT_TYPES - ); - - options.handlerOptions = options.handlerOptions || {}; - - OpenLayers.Control.prototype.initialize.apply(this, [options]); - - this.features = {}; - - this.handlers = {}; - - if(this.click) { - this.handlers.click = new OpenLayers.Handler.Click(this, - {click: this.selectSingle}, this.handlerOptions.click || {}) - }; - - if(this.box) { - this.handlers.box = new OpenLayers.Handler.Box( - this, {done: this.selectBox}, - OpenLayers.Util.extend(this.handlerOptions.box, { - boxDivClassName: "olHandlerBoxSelectFeature" - }) - ); - } - - if(this.hover) { - this.handlers.hover = new OpenLayers.Handler.Hover( - this, {'move': this.cancelHover, 'pause': this.selectHover}, - OpenLayers.Util.extend(this.handlerOptions.hover, { - 'delay': 250 - }) - ); - } - }, - - /** - * Method: activate - * Activates the control. - * - * Returns: - * {Boolean} The control was effectively activated. - */ - activate: function () { - if (!this.active) { - for(var i in this.handlers) { - this.handlers[i].activate(); - } - } - return OpenLayers.Control.prototype.activate.apply( - this, arguments - ); - }, - - /** - * Method: deactivate - * Deactivates the control. - * - * Returns: - * {Boolean} The control was effectively deactivated. - */ - deactivate: function () { - if (this.active) { - for(var i in this.handlers) { - this.handlers[i].deactivate(); - } - } - return OpenLayers.Control.prototype.deactivate.apply( - this, arguments - ); - }, - - /** - * Method: unselectAll - * Unselect all selected features. To unselect all except for a single - * feature, set the options.except property to the feature. - * - * Parameters: - * options - {Object} Optional configuration object. - */ - unselectAll: function(options) { - // we'll want an option to supress notification here - var feature; - for(var i=this.features.length-1; i>=0; --i) { - feature = this.features[i]; - if(!options || options.except != feature) { - this.unselect(feature); - } - } - }, - - /** - * Method: selectSingle - * Called on click - * - * Parameters: - * evt - {} - */ - selectSingle: function(evt) { - // Set the cursor to "wait" to tell the user we're working on their click. - OpenLayers.Element.addClass(this.map.viewPortDiv, "olCursorWait"); - - var bounds = this.pixelToBounds(evt.xy); - - this.setModifiers(evt); - this.request(bounds, {single: true}); - }, - - /** - * Method: selectBox - * Callback from the handlers.box set up when selection is on - * - * Parameters: - * position - {} - */ - selectBox: function(position) { - if (position instanceof OpenLayers.Bounds) { - var minXY = this.map.getLonLatFromPixel( - new OpenLayers.Pixel(position.left, position.bottom) - ); - var maxXY = this.map.getLonLatFromPixel( - new OpenLayers.Pixel(position.right, position.top) - ); - var bounds = new OpenLayers.Bounds( - minXY.lon, minXY.lat, maxXY.lon, maxXY.lat - ); - - this.setModifiers(this.handlers.box.dragHandler.evt); - this.request(bounds); - } - }, - - /** - * Method selectHover - * Callback from the handlers.hover set up when selection is on - * - * Parameters: - * evt {Object} - event object with an xy property - */ - selectHover: function(evt) { - var bounds = this.pixelToBounds(evt.xy); - this.request(bounds, {single: true, hover: true}); - }, - - /** - * Method: cancelHover - * Callback from the handlers.hover set up when selection is on - */ - cancelHover: function() { - if (this.hoverResponse) { - this.protocol.abort(this.hoverResponse); - this.hoverResponse = null; - } - }, - - /** - * Method: request - * Sends a GetFeature request to the WFS - * - * Parameters: - * bounds - {} bounds for the request's BBOX filter - * options - {Object} additional options for this method. - * - * Supported options include: - * single - {Boolean} A single feature should be returned. - * Note that this will be ignored if the protocol does not - * return the geometries of the features. - * hover - {Boolean} Do the request for the hover handler. - */ - request: function(bounds, options) { - options = options || {}; - var filter = new OpenLayers.Filter.Spatial({ - type: OpenLayers.Filter.Spatial.BBOX, - value: bounds - }); - - var response = this.protocol.read({ - maxFeatures: options.single == true ? this.maxFeatures : undefined, - filter: filter, - callback: function(result) { - if(result.code == 1) { - if(result.features.length) { - if(options.single == true) { - this.selectBestFeature(result.features, - bounds.getCenterLonLat(), options); - } else { - this.select(result.features); - } - } else if(options.hover) { - this.hoverSelect(); - } else { - this.events.triggerEvent("clickout"); - if(this.clickout) { - this.unselectAll(); - } - } - } - // Reset the cursor. - OpenLayers.Element.removeClass(this.map.viewPortDiv, "olCursorWait"); - }, - scope: this - }); - if(options.hover == true) { - this.hoverResponse = response; - } - }, - - /** - * Method: selectBestFeature - * Selects the feature from an array of features that is the best match - * for the click position. - * - * Parameters: - * features - {Array()} - * clickPosition - {} - * options - {Object} additional options for this method - * - * Supported options include: - * hover - {Boolean} Do the selection for the hover handler. - */ - selectBestFeature: function(features, clickPosition, options) { - options = options || {}; - if(features.length) { - var point = new OpenLayers.Geometry.Point(clickPosition.lon, - clickPosition.lat); - var feature, resultFeature, dist; - var minDist = Number.MAX_VALUE; - for(var i=0; i} - */ - setModifiers: function(evt) { - this.modifiers = { - multiple: this.multiple || (this.multipleKey && evt[this.multipleKey]), - toggle: this.toggle || (this.toggleKey && evt[this.toggleKey]) - } - }, - - /** - * Method: select - * Add feature to the hash of selected features and trigger the - * featureselected event. - * - * Parameters: - * features - {} or an array of features - */ - select: function(features) { - if(!this.modifiers.multiple && !this.modifiers.toggle) { - this.unselectAll(); - } - if(!(features instanceof Array)) { - features = [features]; - } - - var feature; - for(var i=0, len=features.length; i - * - * Parameters: - * feature - {} the feature to hover-select. - * If none is provided, the current will be nulled and - * the outfeature event will be triggered. - */ - hoverSelect: function(feature) { - var fid = feature ? feature.fid || feature.id : null; - var hfid = this.hoverFeature ? - this.hoverFeature.fid || this.hoverFeature.id : null; - - if(hfid && hfid != fid) { - this.events.triggerEvent("outfeature", - {feature: this.hoverFeature}); - this.hoverFeature = null; - } - if(fid && fid != hfid) { - this.events.triggerEvent("hoverfeature", {feature: feature}); - this.hoverFeature = feature; - } - }, - - /** - * Method: unselect - * Remove feature from the hash of selected features and trigger the - * featureunselected event. - * - * Parameters: - * feature - {} - */ - unselect: function(feature) { - delete this.features[feature.fid || feature.id]; - this.events.triggerEvent("featureunselected", {feature: feature}); - }, - - /** - * Method: unselectAll - * Unselect all selected features. - */ - unselectAll: function() { - // we'll want an option to supress notification here - for(var fid in this.features) { - this.unselect(this.features[fid]); - } - }, - - /** - * Method: setMap - * Set the map property for the control. - * - * Parameters: - * map - {} - */ - setMap: function(map) { - for(var i in this.handlers) { - this.handlers[i].setMap(map); - } - OpenLayers.Control.prototype.setMap.apply(this, arguments); - }, - - /** - * Method: pixelToBounds - * Takes a pixel as argument and creates bounds after adding the - * . - * - * Parameters: - * pixel - {} - */ - pixelToBounds: function(pixel) { - var llPx = pixel.add(-this.clickTolerance/2, this.clickTolerance/2); - var urPx = pixel.add(this.clickTolerance/2, -this.clickTolerance/2); - var ll = this.map.getLonLatFromPixel(llPx); - var ur = this.map.getLonLatFromPixel(urPx); - return new OpenLayers.Bounds(ll.lon, ll.lat, ur.lon, ur.lat); - }, - - CLASS_NAME: "OpenLayers.Control.GetFeature" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/KeyboardDefaults.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/KeyboardDefaults.js deleted file mode 100755 index 2ab4a604e5..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/KeyboardDefaults.js +++ /dev/null @@ -1,121 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - - -/** - * @requires OpenLayers/Control.js - * @requires OpenLayers/Handler/Keyboard.js - */ - -/** - * Class: OpenLayers.Control.KeyboardDefaults - * The KeyboardDefaults control adds panning and zooming functions, controlled - * with the keyboard. By default arrow keys pan, +/- keys zoom & Page Up/Page - * Down/Home/End scroll by three quarters of a page. - * - * This control has no visible appearance. - * - * Inherits from: - * - - */ -OpenLayers.Control.KeyboardDefaults = OpenLayers.Class(OpenLayers.Control, { - - /** - * APIProperty: slideFactor - * Pixels to slide by. - */ - slideFactor: 75, - - /** - * Constructor: OpenLayers.Control.KeyboardDefaults - */ - initialize: function() { - OpenLayers.Control.prototype.initialize.apply(this, arguments); - }, - - /** - * APIMethod: destroy - */ - destroy: function() { - if (this.handler) { - this.handler.destroy(); - } - this.handler = null; - - OpenLayers.Control.prototype.destroy.apply(this, arguments); - }, - - /** - * Method: draw - * Create handler. - */ - draw: function() { - this.handler = new OpenLayers.Handler.Keyboard( this, { - "keydown": this.defaultKeyPress }); - this.activate(); - }, - - /** - * Method: defaultKeyPress - * When handling the key event, we only use evt.keyCode. This holds - * some drawbacks, though we get around them below. When interpretting - * the keycodes below (including the comments associated with them), - * consult the URL below. For instance, the Safari browser returns - * "IE keycodes", and so is supported by any keycode labeled "IE". - * - * Very informative URL: - * http://unixpapa.com/js/key.html - * - * Parameters: - * code - {Integer} - */ - defaultKeyPress: function (evt) { - switch(evt.keyCode) { - case OpenLayers.Event.KEY_LEFT: - this.map.pan(-this.slideFactor, 0); - break; - case OpenLayers.Event.KEY_RIGHT: - this.map.pan(this.slideFactor, 0); - break; - case OpenLayers.Event.KEY_UP: - this.map.pan(0, -this.slideFactor); - break; - case OpenLayers.Event.KEY_DOWN: - this.map.pan(0, this.slideFactor); - break; - - case 33: // Page Up. Same in all browsers. - var size = this.map.getSize(); - this.map.pan(0, -0.75*size.h); - break; - case 34: // Page Down. Same in all browsers. - var size = this.map.getSize(); - this.map.pan(0, 0.75*size.h); - break; - case 35: // End. Same in all browsers. - var size = this.map.getSize(); - this.map.pan(0.75*size.w, 0); - break; - case 36: // Home. Same in all browsers. - var size = this.map.getSize(); - this.map.pan(-0.75*size.w, 0); - break; - - case 43: // +/= (ASCII), keypad + (ASCII, Opera) - case 61: // +/= (Mozilla, Opera, some ASCII) - case 187: // +/= (IE) - case 107: // keypad + (IE, Mozilla) - this.map.zoomIn(); - break; - case 45: // -/_ (ASCII, Opera), keypad - (ASCII, Opera) - case 109: // -/_ (Mozilla), keypad - (Mozilla, IE) - case 189: // -/_ (IE) - case 95: // -/_ (some ASCII) - this.map.zoomOut(); - break; - } - }, - - CLASS_NAME: "OpenLayers.Control.KeyboardDefaults" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/LayerSwitcher.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/LayerSwitcher.js deleted file mode 100755 index e6913fd31f..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/LayerSwitcher.js +++ /dev/null @@ -1,638 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Control.js - */ - -/** - * Class: OpenLayers.Control.LayerSwitcher - * The LayerSwitcher control displays a table of contents for the map. This - * allows the user interface to switch between BaseLasyers and to show or hide - * Overlays. By default the switcher is shown minimized on the right edge of - * the map, the user may expand it by clicking on the handle. - * - * To create the LayerSwitcher outside of the map, pass the Id of a html div - * as the first argument to the constructor. - * - * Inherits from: - * - - */ -OpenLayers.Control.LayerSwitcher = - OpenLayers.Class(OpenLayers.Control, { - - /** - * Property: activeColor - * {String} - */ - activeColor: "darkblue", - - /** - * Property: layerStates - * {Array(Object)} Basically a copy of the "state" of the map's layers - * the last time the control was drawn. We have this in order to avoid - * unnecessarily redrawing the control. - */ - layerStates: null, - - - // DOM Elements - - /** - * Property: layersDiv - * {DOMElement} - */ - layersDiv: null, - - /** - * Property: baseLayersDiv - * {DOMElement} - */ - baseLayersDiv: null, - - /** - * Property: baseLayers - * {Array()} - */ - baseLayers: null, - - - /** - * Property: dataLbl - * {DOMElement} - */ - dataLbl: null, - - /** - * Property: dataLayersDiv - * {DOMElement} - */ - dataLayersDiv: null, - - /** - * Property: dataLayers - * {Array()} - */ - dataLayers: null, - - - /** - * Property: minimizeDiv - * {DOMElement} - */ - minimizeDiv: null, - - /** - * Property: maximizeDiv - * {DOMElement} - */ - maximizeDiv: null, - - /** - * APIProperty: ascending - * {Boolean} - */ - ascending: true, - - /** - * Constructor: OpenLayers.Control.LayerSwitcher - * - * Parameters: - * options - {Object} - */ - initialize: function(options) { - OpenLayers.Control.prototype.initialize.apply(this, arguments); - this.layerStates = []; - }, - - /** - * APIMethod: destroy - */ - destroy: function() { - - OpenLayers.Event.stopObservingElement(this.div); - - OpenLayers.Event.stopObservingElement(this.minimizeDiv); - OpenLayers.Event.stopObservingElement(this.maximizeDiv); - - //clear out layers info and unregister their events - this.clearLayersArray("base"); - this.clearLayersArray("data"); - - this.map.events.un({ - "addlayer": this.redraw, - "changelayer": this.redraw, - "removelayer": this.redraw, - "changebaselayer": this.redraw, - scope: this - }); - - OpenLayers.Control.prototype.destroy.apply(this, arguments); - }, - - /** - * Method: setMap - * - * Properties: - * map - {} - */ - setMap: function(map) { - OpenLayers.Control.prototype.setMap.apply(this, arguments); - - this.map.events.on({ - "addlayer": this.redraw, - "changelayer": this.redraw, - "removelayer": this.redraw, - "changebaselayer": this.redraw, - scope: this - }); - }, - - /** - * Method: draw - * - * Returns: - * {DOMElement} A reference to the DIV DOMElement containing the - * switcher tabs. - */ - draw: function() { - OpenLayers.Control.prototype.draw.apply(this); - - // create layout divs - this.loadContents(); - - // set mode to minimize - if(!this.outsideViewport) { - this.minimizeControl(); - } - - // populate div with current info - this.redraw(); - - return this.div; - }, - - /** - * Method: clearLayersArray - * User specifies either "base" or "data". we then clear all the - * corresponding listeners, the div, and reinitialize a new array. - * - * Parameters: - * layersType - {String} - */ - clearLayersArray: function(layersType) { - var layers = this[layersType + "Layers"]; - if (layers) { - for(var i=0, len=layers.length; i} layerSwitcher - * - {} layer - */ - - onInputClick: function(e) { - - if (!this.inputElem.disabled) { - if (this.inputElem.type == "radio") { - this.inputElem.checked = true; - this.layer.map.setBaseLayer(this.layer); - } else { - this.inputElem.checked = !this.inputElem.checked; - this.layerSwitcher.updateMap(); - } - } - OpenLayers.Event.stop(e); - }, - - /** - * Method: onLayerClick - * Need to update the map accordingly whenever user clicks in either of - * the layers. - * - * Parameters: - * e - {Event} - */ - onLayerClick: function(e) { - this.updateMap(); - }, - - - /** - * Method: updateMap - * Cycles through the loaded data and base layer input arrays and makes - * the necessary calls to the Map object such that that the map's - * visual state corresponds to what the user has selected in - * the control. - */ - updateMap: function() { - - // set the newly selected base layer - for(var i=0, len=this.baseLayers.length; i - */ -OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, { - - /** - * Constant: EVENT_TYPES - * {Array(String)} Supported application event types. Register a listener - * for a particular event with the following syntax: - * (code) - * control.events.register(type, obj, listener); - * (end) - * - * Listeners will be called with a reference to an event object. The - * properties of this event depends on exactly what happened. - * - * Supported control event types (in addition to those from ): - * measure - Triggered when a measurement sketch is complete. Listeners - * will receive an event with measure, units, order, and geometry - * properties. - * measurepartial - Triggered when a new point is added to the - * measurement sketch. Listeners receive an event with measure, - * units, order, and geometry. - */ - EVENT_TYPES: ['measure', 'measurepartial'], - - /** - * APIProperty: handlerOptions - * {Object} Used to set non-default properties on the control's handler - */ - handlerOptions: null, - - /** - * Property: callbacks - * {Object} The functions that are sent to the handler for callback - */ - callbacks: null, - - /** - * Property: displaySystem - * {String} Display system for output measurements. Supported values - * are 'english', 'metric', and 'geographic'. Default is 'metric'. - */ - displaySystem: 'metric', - - /** - * Property: geodesic - * {Boolean} Calculate geodesic metrics instead of planar metrics. This - * requires that geometries can be transformed into Geographic/WGS84 - * (if that is not already the map projection). Default is false. - */ - geodesic: false, - - /** - * Property: displaySystemUnits - * {Object} Units for various measurement systems. Values are arrays - * of unit abbreviations (from OpenLayers.INCHES_PER_UNIT) in decreasing - * order of length. - */ - displaySystemUnits: { - geographic: ['dd'], - english: ['mi', 'ft', 'in'], - metric: ['km', 'm'] - }, - - /** - * Property: delay - * {Number} Number of milliseconds between clicks before the event is - * considered a double-click. The "measurepartial" event will not - * be triggered if the sketch is completed within this time. This - * is required for IE where creating a browser reflow (if a listener - * is modifying the DOM by displaying the measurement values) messes - * with the dblclick listener in the sketch handler. - */ - partialDelay: 300, - - /** - * Property: delayedTrigger - * {Number} Timeout id of trigger for measurepartial. - */ - delayedTrigger: null, - - /** - * APIProperty: persist - * {Boolean} Keep the temporary measurement sketch drawn after the - * measurement is complete. The geometry will persist until a new - * measurement is started, the control is deactivated, or is - * called. - */ - persist: false, - - /** - * Constructor: OpenLayers.Control.Measure - * - * Parameters: - * handler - {} - * options - {Object} - */ - initialize: function(handler, options) { - // concatenate events specific to measure with those from the base - this.EVENT_TYPES = - OpenLayers.Control.Measure.prototype.EVENT_TYPES.concat( - OpenLayers.Control.prototype.EVENT_TYPES - ); - OpenLayers.Control.prototype.initialize.apply(this, [options]); - this.callbacks = OpenLayers.Util.extend( - {done: this.measureComplete, point: this.measurePartial}, - this.callbacks - ); - - // let the handler options override, so old code that passes 'persist' - // directly to the handler does not need an update - this.handlerOptions = OpenLayers.Util.extend( - {persist: this.persist}, this.handlerOptions - ); - this.handler = new handler(this, this.callbacks, this.handlerOptions); - }, - - /** - * APIMethod: cancel - * Stop the control from measuring. If is true, the temporary - * sketch will be erased. - */ - cancel: function() { - this.handler.cancel(); - }, - - /** - * Method: updateHandler - * - * Parameters: - * handler - {Function} One of the sketch handler constructors. - * options - {Object} Options for the handler. - */ - updateHandler: function(handler, options) { - var active = this.active; - if(active) { - this.deactivate(); - } - this.handler = new handler(this, this.callbacks, options); - if(active) { - this.activate(); - } - }, - - /** - * Method: measureComplete - * Called when the measurement sketch is done. - * - * Parameters: - * geometry - {} - */ - measureComplete: function(geometry) { - if(this.delayedTrigger) { - window.clearTimeout(this.delayedTrigger); - } - this.measure(geometry, "measure"); - }, - - /** - * Method: measurePartial - * Called each time a new point is added to the measurement sketch. - * - * Parameters: - * point - {} The last point added. - * geometry - {} The sketch geometry. - */ - measurePartial: function(point, geometry) { - this.delayedTrigger = window.setTimeout( - OpenLayers.Function.bind(function() { - this.measure(geometry, "measurepartial"); - }, this), - this.partialDelay - ); - }, - - /** - * Method: measure - * - * Parameters: - * geometry - {} - * eventType - {String} - */ - measure: function(geometry, eventType) { - var stat, order; - if(geometry.CLASS_NAME.indexOf('LineString') > -1) { - stat = this.getBestLength(geometry); - order = 1; - } else { - stat = this.getBestArea(geometry); - order = 2; - } - this.events.triggerEvent(eventType, { - measure: stat[0], - units: stat[1], - order: order, - geometry: geometry - }); - }, - - /** - * Method: getBestArea - * Based on the returns the area of a geometry. - * - * Parameters: - * geometry - {} - * - * Returns: - * {Array([Float, String])} Returns a two item array containing the - * area and the units abbreviation. - */ - getBestArea: function(geometry) { - var units = this.displaySystemUnits[this.displaySystem]; - var unit, area; - for(var i=0, len=units.length; i 1) { - break; - } - } - return [area, unit]; - }, - - /** - * Method: getArea - * - * Parameters: - * geometry - {} - * units - {String} Unit abbreviation - * - * Returns: - * {Float} The geometry area in the given units. - */ - getArea: function(geometry, units) { - var area, geomUnits; - if(this.geodesic) { - area = geometry.getGeodesicArea(this.map.getProjectionObject()); - geomUnits = "m"; - } else { - area = geometry.getArea(); - geomUnits = this.map.getUnits(); - } - var inPerDisplayUnit = OpenLayers.INCHES_PER_UNIT[units]; - if(inPerDisplayUnit) { - var inPerMapUnit = OpenLayers.INCHES_PER_UNIT[geomUnits]; - area *= Math.pow((inPerMapUnit / inPerDisplayUnit), 2); - } - return area; - }, - - /** - * Method: getBestLength - * Based on the returns the length of a geometry. - * - * Parameters: - * geometry - {} - * - * Returns: - * {Array([Float, String])} Returns a two item array containing the - * length and the units abbreviation. - */ - getBestLength: function(geometry) { - var units = this.displaySystemUnits[this.displaySystem]; - var unit, length; - for(var i=0, len=units.length; i 1) { - break; - } - } - return [length, unit]; - }, - - /** - * Method: getLength - * - * Parameters: - * geometry - {} - * units - {String} Unit abbreviation - * - * Returns: - * {Float} The geometry length in the given units. - */ - getLength: function(geometry, units) { - var length, geomUnits; - if(this.geodesic) { - length = geometry.getGeodesicLength(this.map.getProjectionObject()); - geomUnits = "m"; - } else { - length = geometry.getLength(); - geomUnits = this.map.getUnits(); - } - var inPerDisplayUnit = OpenLayers.INCHES_PER_UNIT[units]; - if(inPerDisplayUnit) { - var inPerMapUnit = OpenLayers.INCHES_PER_UNIT[geomUnits]; - length *= (inPerMapUnit / inPerDisplayUnit); - } - return length; - }, - - CLASS_NAME: "OpenLayers.Control.Measure" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/ModifyFeature.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/ModifyFeature.js deleted file mode 100755 index cccccf0bb0..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/ModifyFeature.js +++ /dev/null @@ -1,738 +0,0 @@ -/* Copyright (c) 2006 MetaCarta, Inc., published under the Clear BSD license. - * See http://svn.openlayers.org/trunk/openlayers/license.txt - * for the full text of the license. */ - - -/** - * @requires OpenLayers/Control/DragFeature.js - * @requires OpenLayers/Control/SelectFeature.js - * @requires OpenLayers/Handler/Keyboard.js - */ - -/** - * Class: OpenLayers.Control.ModifyFeature - * Control to modify features. When activated, a click renders the vertices - * of a feature - these vertices can then be dragged. By default, the - * delete key will delete the vertex under the mouse. New features are - * added by dragging "virtual vertices" between vertices. Create a new - * control with the constructor. - * - * Inherits From: - * - - */ -OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, { - - /** - * APIProperty: geometryTypes - * {Array(String)} To restrict modification to a limited set of geometry - * types, send a list of strings corresponding to the geometry class - * names. - */ - geometryTypes: null, - - /** - * APIProperty: clickout - * {Boolean} Unselect features when clicking outside any feature. - * Default is true. - */ - clickout: true, - - /** - * APIProperty: toggle - * {Boolean} Unselect a selected feature on click. - * Default is true. - */ - toggle: true, - - /** - * Property: layer - * {} - */ - layer: null, - - /** - * Property: feature - * {} Feature currently available for modification. - */ - feature: null, - - /** - * Property: vertices - * {Array()} Verticies currently available - * for dragging. - */ - vertices: null, - - /** - * Property: virtualVertices - * {Array()} Virtual vertices in the middle - * of each edge. - */ - virtualVertices: null, - - /** - * Property: selectControl - * {} - */ - selectControl: null, - - /** - * Property: dragControl - * {} - */ - dragControl: null, - - /** - * Property: handlers - * {Object} - */ - handlers: null, - - /** - * APIProperty: deleteCodes - * {Array(Integer)} Keycodes for deleting verticies. Set to null to disable - * vertex deltion by keypress. If non-null, keypresses with codes - * in this array will delete vertices under the mouse. Default - * is 46 and 68, the 'delete' and lowercase 'd' keys. - */ - deleteCodes: null, - - /** - * APIProperty: virtualStyle - * {Object} A symbolizer to be used for virtual vertices. - */ - virtualStyle: null, - - /** - * APIProperty: mode - * {Integer} Bitfields specifying the modification mode. Defaults to - * OpenLayers.Control.ModifyFeature.RESHAPE. To set the mode to a - * combination of options, use the | operator. or example, to allow - * the control to both resize and rotate features, use the following - * syntax - * (code) - * control.mode = OpenLayers.Control.ModifyFeature.RESIZE | - * OpenLayers.Control.ModifyFeature.ROTATE; - * (end) - */ - mode: null, - - /** - * Property: modified - * {Boolean} The currently selected feature has been modified. - */ - modified: false, - - /** - * Property: radiusHandle - * {} A handle for rotating/resizing a feature. - */ - radiusHandle: null, - - /** - * Property: dragHandle - * {} A handle for dragging a feature. - */ - dragHandle: null, - - /** - * APIProperty: onModificationStart - * {Function} *Deprecated*. Register for "beforefeaturemodified" instead. - * The "beforefeaturemodified" event is triggered on the layer before - * any modification begins. - * - * Optional function to be called when a feature is selected - * to be modified. The function should expect to be called with a - * feature. This could be used for example to allow to lock the - * feature on server-side. - */ - onModificationStart: function() {}, - - /** - * APIProperty: onModification - * {Function} *Deprecated*. Register for "featuremodified" instead. - * The "featuremodified" event is triggered on the layer with each - * feature modification. - * - * Optional function to be called when a feature has been - * modified. The function should expect to be called with a feature. - */ - onModification: function() {}, - - /** - * APIProperty: onModificationEnd - * {Function} *Deprecated*. Register for "afterfeaturemodified" instead. - * The "afterfeaturemodified" event is triggered on the layer after - * a feature has been modified. - * - * Optional function to be called when a feature is finished - * being modified. The function should expect to be called with a - * feature. - */ - onModificationEnd: function() {}, - - /** - * Constructor: OpenLayers.Control.ModifyFeature - * Create a new modify feature control. - * - * Parameters: - * layer - {} Layer that contains features that - * will be modified. - * options - {Object} Optional object whose properties will be set on the - * control. - */ - initialize: function(layer, options) { - this.layer = layer; - this.vertices = []; - this.virtualVertices = []; - this.virtualStyle = OpenLayers.Util.extend({}, - this.layer.style || this.layer.styleMap.createSymbolizer()); - this.virtualStyle.fillOpacity = 0.3; - this.virtualStyle.strokeOpacity = 0.3; - this.deleteCodes = [46, 68]; - this.mode = OpenLayers.Control.ModifyFeature.RESHAPE; - OpenLayers.Control.prototype.initialize.apply(this, [options]); - if(!(this.deleteCodes instanceof Array)) { - this.deleteCodes = [this.deleteCodes]; - } - var control = this; - - // configure the select control - var selectOptions = { - geometryTypes: this.geometryTypes, - clickout: this.clickout, - toggle: this.toggle, - onBeforeSelect: this.beforeSelectFeature, - onSelect: this.selectFeature, - onUnselect: this.unselectFeature, - scope: this - }; - this.selectControl = new OpenLayers.Control.SelectFeature( - layer, selectOptions - ); - - // configure the drag control - var dragOptions = { - geometryTypes: ["OpenLayers.Geometry.Point"], - snappingOptions: this.snappingOptions, - onStart: function(feature, pixel) { - control.dragStart.apply(control, [feature, pixel]); - }, - onDrag: function(feature, pixel) { - control.dragVertex.apply(control, [feature, pixel]); - }, - onComplete: function(feature) { - control.dragComplete.apply(control, [feature]); - } - }; - this.dragControl = new OpenLayers.Control.DragFeature( - layer, dragOptions - ); - - // configure the keyboard handler - var keyboardOptions = { - keydown: this.handleKeypress - }; - this.handlers = { - keyboard: new OpenLayers.Handler.Keyboard(this, keyboardOptions) - }; - }, - - /** - * APIMethod: destroy - * Take care of things that are not handled in superclass. - */ - destroy: function() { - this.layer = null; - this.selectControl.destroy(); - this.dragControl.destroy(); - OpenLayers.Control.prototype.destroy.apply(this, []); - }, - - /** - * APIMethod: activate - * Activate the control. - * - * Returns: - * {Boolean} Successfully activated the control. - */ - activate: function() { - return (this.selectControl.activate() && - this.handlers.keyboard.activate() && - OpenLayers.Control.prototype.activate.apply(this, arguments)); - }, - - /** - * APIMethod: deactivate - * Deactivate the control. - * - * Returns: - * {Boolean} Successfully deactivated the control. - */ - deactivate: function() { - var deactivated = false; - // the return from the controls is unimportant in this case - if(OpenLayers.Control.prototype.deactivate.apply(this, arguments)) { - this.layer.removeFeatures(this.vertices, {silent: true}); - this.layer.removeFeatures(this.virtualVertices, {silent: true}); - this.vertices = []; - this.dragControl.deactivate(); - if(this.feature && this.feature.geometry && this.feature.layer) { - this.selectControl.unselect.apply(this.selectControl, - [this.feature]); - } - this.selectControl.deactivate(); - this.handlers.keyboard.deactivate(); - deactivated = true; - } - return deactivated; - }, - - /** - * Method: beforeSelectFeature - * Called before a feature is selected. - * - * Parameters: - * feature - {} The feature about to be selected. - */ - beforeSelectFeature: function(feature) { - return this.layer.events.triggerEvent( - "beforefeaturemodified", {feature: feature} - ); - }, - - /** - * Method: selectFeature - * Called when the select feature control selects a feature. - * - * Parameters: - * feature - {} the selected feature. - */ - selectFeature: function(feature) { - this.feature = feature; - this.modified = false; - this.resetVertices(); - this.dragControl.activate(); - this.onModificationStart(this.feature); - }, - - /** - * Method: unselectFeature - * Called when the select feature control unselects a feature. - * - * Parameters: - * feature - {} The unselected feature. - */ - unselectFeature: function(feature) { - this.layer.removeFeatures(this.vertices, {silent: true}); - this.vertices = []; - this.layer.destroyFeatures(this.virtualVertices, {silent: true}); - this.virtualVertices = []; - if(this.dragHandle) { - this.layer.destroyFeatures([this.dragHandle], {silent: true}); - delete this.dragHandle; - } - if(this.radiusHandle) { - this.layer.destroyFeatures([this.radiusHandle], {silent: true}); - delete this.radiusHandle; - } - this.feature = null; - this.dragControl.deactivate(); - this.onModificationEnd(feature); - this.layer.events.triggerEvent("afterfeaturemodified", { - feature: feature, - modified: this.modified - }); - this.modified = false; - }, - - /** - * Method: dragStart - * Called by the drag feature control with before a feature is dragged. - * This method is used to differentiate between points and vertices - * of higher order geometries. This respects the - * property and forces a select of points when the drag control is - * already active (and stops events from propagating to the select - * control). - * - * Parameters: - * feature - {} The point or vertex about to be - * dragged. - * pixel - {} Pixel location of the mouse event. - */ - dragStart: function(feature, pixel) { - // only change behavior if the feature is not in the vertices array - if(feature != this.feature && !feature.geometry.parent && - feature != this.dragHandle && feature != this.radiusHandle) { - if(this.feature) { - // unselect the currently selected feature - this.selectControl.clickFeature.apply(this.selectControl, - [this.feature]); - } - // check any constraints on the geometry type - if(this.geometryTypes == null || - OpenLayers.Util.indexOf(this.geometryTypes, - feature.geometry.CLASS_NAME) != -1) { - // select the point - this.selectControl.clickFeature.apply(this.selectControl, - [feature]); - /** - * TBD: These lines improve workflow by letting the user - * immediately start dragging after the mouse down. - * However, it is very ugly to be messing with controls - * and their handlers in this way. I'd like a better - * solution if the workflow change is necessary. - */ - // prepare the point for dragging - this.dragControl.overFeature.apply(this.dragControl, - [feature]); - this.dragControl.lastPixel = pixel; - this.dragControl.handlers.drag.started = true; - this.dragControl.handlers.drag.start = pixel; - this.dragControl.handlers.drag.last = pixel; - } - } - }, - - /** - * Method: dragVertex - * Called by the drag feature control with each drag move of a vertex. - * - * Parameters: - * vertex - {} The vertex being dragged. - * pixel - {} Pixel location of the mouse event. - */ - dragVertex: function(vertex, pixel) { - this.modified = true; - /** - * Five cases: - * 1) dragging a simple point - * 2) dragging a virtual vertex - * 3) dragging a drag handle - * 4) dragging a real vertex - * 5) dragging a radius handle - */ - if(this.feature.geometry.CLASS_NAME == "OpenLayers.Geometry.Point") { - // dragging a simple point - if(this.feature != vertex) { - this.feature = vertex; - } - this.layer.events.triggerEvent("vertexmodified", { - vertex: vertex.geometry, - feature: this.feature, - pixel: pixel - }); - } else { - if(vertex._index) { - // dragging a virtual vertex - vertex.geometry.parent.addComponent(vertex.geometry, - vertex._index); - // move from virtual to real vertex - delete vertex._index; - OpenLayers.Util.removeItem(this.virtualVertices, vertex); - this.vertices.push(vertex); - } else if(vertex == this.dragHandle) { - // dragging a drag handle - this.layer.removeFeatures(this.vertices, {silent: true}); - this.vertices = []; - if(this.radiusHandle) { - this.layer.destroyFeatures([this.radiusHandle], {silent: true}); - this.radiusHandle = null; - } - } else if(vertex !== this.radiusHandle) { - // dragging a real vertex - this.layer.events.triggerEvent("vertexmodified", { - vertex: vertex.geometry, - feature: this.feature, - pixel: pixel - }); - } - // dragging a radius handle - no special treatment - if(this.virtualVertices.length > 0) { - this.layer.destroyFeatures(this.virtualVertices, {silent: true}); - this.virtualVertices = []; - } - this.layer.drawFeature(this.feature, this.selectControl.renderIntent); - } - // keep the vertex on top so it gets the mouseout after dragging - // this should be removed in favor of an option to draw under or - // maintain node z-index - this.layer.drawFeature(vertex); - }, - - /** - * Method: dragComplete - * Called by the drag feature control when the feature dragging is complete. - * - * Parameters: - * vertex - {} The vertex being dragged. - */ - dragComplete: function(vertex) { - this.resetVertices(); - this.setFeatureState(); - this.onModification(this.feature); - this.layer.events.triggerEvent("featuremodified", - {feature: this.feature}); - }, - - /** - * Method: setFeatureState - * Called when the feature is modified. If the current state is not - * INSERT or DELETE, the state is set to UPDATE. - */ - setFeatureState: function() { - if(this.feature.state != OpenLayers.State.INSERT && - this.feature.state != OpenLayers.State.DELETE) { - this.feature.state = OpenLayers.State.UPDATE; - } - }, - - /** - * Method: resetVertices - */ - resetVertices: function() { - // if coming from a drag complete we're about to destroy the vertex - // that was just dragged. For that reason, the drag feature control - // will never detect a mouse-out on that vertex, meaning that the drag - // handler won't be deactivated. This can cause errors because the drag - // feature control still has a feature to drag but that feature is - // destroyed. To prevent this, we call outFeature on the drag feature - // control if the control actually has a feature to drag. - if(this.dragControl.feature) { - this.dragControl.outFeature(this.dragControl.feature); - } - if(this.vertices.length > 0) { - this.layer.removeFeatures(this.vertices, {silent: true}); - this.vertices = []; - } - if(this.virtualVertices.length > 0) { - this.layer.removeFeatures(this.virtualVertices, {silent: true}); - this.virtualVertices = []; - } - if(this.dragHandle) { - this.layer.destroyFeatures([this.dragHandle], {silent: true}); - this.dragHandle = null; - } - if(this.radiusHandle) { - this.layer.destroyFeatures([this.radiusHandle], {silent: true}); - this.radiusHandle = null; - } - if(this.feature && - this.feature.geometry.CLASS_NAME != "OpenLayers.Geometry.Point") { - if((this.mode & OpenLayers.Control.ModifyFeature.DRAG)) { - this.collectDragHandle(); - } - if((this.mode & (OpenLayers.Control.ModifyFeature.ROTATE | - OpenLayers.Control.ModifyFeature.RESIZE))) { - this.collectRadiusHandle(); - } - if(this.mode & OpenLayers.Control.ModifyFeature.RESHAPE){ - // Don't collect vertices when we're resizing - if (!(this.mode & OpenLayers.Control.ModifyFeature.RESIZE)){ - this.collectVertices(); - } - } - } - }, - - /** - * Method: handleKeypress - * Called by the feature handler on keypress. This is used to delete - * vertices. If the property is set, vertices will - * be deleted when a feature is selected for modification and - * the mouse is over a vertex. - * - * Parameters: - * {Integer} Key code corresponding to the keypress event. - */ - handleKeypress: function(evt) { - var code = evt.keyCode; - - // check for delete key - if(this.feature && - OpenLayers.Util.indexOf(this.deleteCodes, code) != -1) { - var vertex = this.dragControl.feature; - if(vertex && - OpenLayers.Util.indexOf(this.vertices, vertex) != -1 && - !this.dragControl.handlers.drag.dragging && - vertex.geometry.parent) { - // remove the vertex - vertex.geometry.parent.removeComponent(vertex.geometry); - this.layer.drawFeature(this.feature, - this.selectControl.renderIntent); - this.resetVertices(); - this.setFeatureState(); - this.onModification(this.feature); - this.layer.events.triggerEvent("featuremodified", - {feature: this.feature}); - } - } - }, - - /** - * Method: collectVertices - * Collect the vertices from the modifiable feature's geometry and push - * them on to the control's vertices array. - */ - collectVertices: function() { - this.vertices = []; - this.virtualVertices = []; - var control = this; - function collectComponentVertices(geometry) { - var i, vertex, component, len; - if(geometry.CLASS_NAME == "OpenLayers.Geometry.Point") { - vertex = new OpenLayers.Feature.Vector(geometry); - vertex._sketch = true; - control.vertices.push(vertex); - } else { - var numVert = geometry.components.length; - if(geometry.CLASS_NAME == "OpenLayers.Geometry.LinearRing") { - numVert -= 1; - } - for(i=0; i} The control's map. - */ - setMap: function(map) { - this.selectControl.setMap(map); - this.dragControl.setMap(map); - OpenLayers.Control.prototype.setMap.apply(this, arguments); - }, - - CLASS_NAME: "OpenLayers.Control.ModifyFeature" -}); - -/** - * Constant: RESHAPE - * {Integer} Constant used to make the control work in reshape mode - */ -OpenLayers.Control.ModifyFeature.RESHAPE = 1; -/** - * Constant: RESIZE - * {Integer} Constant used to make the control work in resize mode - */ -OpenLayers.Control.ModifyFeature.RESIZE = 2; -/** - * Constant: ROTATE - * {Integer} Constant used to make the control work in rotate mode - */ -OpenLayers.Control.ModifyFeature.ROTATE = 4; -/** - * Constant: DRAG - * {Integer} Constant used to make the control work in drag mode - */ -OpenLayers.Control.ModifyFeature.DRAG = 8; diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/MouseDefaults.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/MouseDefaults.js deleted file mode 100755 index d1296975eb..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/MouseDefaults.js +++ /dev/null @@ -1,367 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Control.js - */ - -/** - * Class: OpenLayers.Control.MouseDefaults - * This class is DEPRECATED in 2.4 and will be removed by 3.0. - * If you need this functionality, use - * instead!!! - * - * This class is DEPRECATED in 2.4 and will be removed by 3.0. - * If you need this functionality, use Control.Navigation instead!!! - * - * Inherits from: - * - - */ -OpenLayers.Control.MouseDefaults = OpenLayers.Class(OpenLayers.Control, { - - /** WARNING WARNING WARNING!!! - This class is DEPRECATED in 2.4 and will be removed by 3.0. - If you need this functionality, use Control.Navigation instead!!! */ - - /** - * Property: performedDrag - * {Boolean} - */ - performedDrag: false, - - /** - * Property: wheelObserver - * {Function} - */ - wheelObserver: null, - - /** - * Constructor: OpenLayers.Control.MouseDefaults - */ - initialize: function() { - OpenLayers.Control.prototype.initialize.apply(this, arguments); - }, - - /** - * APIMethod: destroy - */ - destroy: function() { - - if (this.handler) { - this.handler.destroy(); - } - this.handler = null; - - this.map.events.un({ - "click": this.defaultClick, - "dblclick": this.defaultDblClick, - "mousedown": this.defaultMouseDown, - "mouseup": this.defaultMouseUp, - "mousemove": this.defaultMouseMove, - "mouseout": this.defaultMouseOut, - scope: this - }); - - //unregister mousewheel events specifically on the window and document - OpenLayers.Event.stopObserving(window, "DOMMouseScroll", - this.wheelObserver); - OpenLayers.Event.stopObserving(window, "mousewheel", - this.wheelObserver); - OpenLayers.Event.stopObserving(document, "mousewheel", - this.wheelObserver); - this.wheelObserver = null; - - OpenLayers.Control.prototype.destroy.apply(this, arguments); - }, - - /** - * Method: draw - */ - draw: function() { - this.map.events.on({ - "click": this.defaultClick, - "dblclick": this.defaultDblClick, - "mousedown": this.defaultMouseDown, - "mouseup": this.defaultMouseUp, - "mousemove": this.defaultMouseMove, - "mouseout": this.defaultMouseOut, - scope: this - }); - - this.registerWheelEvents(); - - }, - - /** - * Method: registerWheelEvents - */ - registerWheelEvents: function() { - - this.wheelObserver = OpenLayers.Function.bindAsEventListener( - this.onWheelEvent, this - ); - - //register mousewheel events specifically on the window and document - OpenLayers.Event.observe(window, "DOMMouseScroll", this.wheelObserver); - OpenLayers.Event.observe(window, "mousewheel", this.wheelObserver); - OpenLayers.Event.observe(document, "mousewheel", this.wheelObserver); - }, - - /** - * Method: defaultClick - * - * Parameters: - * evt - {Event} - * - * Returns: - * {Boolean} - */ - defaultClick: function (evt) { - if (!OpenLayers.Event.isLeftClick(evt)) { - return; - } - var notAfterDrag = !this.performedDrag; - this.performedDrag = false; - return notAfterDrag; - }, - - /** - * Method: defaultDblClick - * - * Parameters: - * evt - {Event} - */ - defaultDblClick: function (evt) { - var newCenter = this.map.getLonLatFromViewPortPx( evt.xy ); - this.map.setCenter(newCenter, this.map.zoom + 1); - OpenLayers.Event.stop(evt); - return false; - }, - - /** - * Method: defaultMouseDown - * - * Parameters: - * evt - {Event} - */ - defaultMouseDown: function (evt) { - if (!OpenLayers.Event.isLeftClick(evt)) { - return; - } - this.mouseDragStart = evt.xy.clone(); - this.performedDrag = false; - if (evt.shiftKey) { - this.map.div.style.cursor = "crosshair"; - this.zoomBox = OpenLayers.Util.createDiv('zoomBox', - this.mouseDragStart, - null, - null, - "absolute", - "2px solid red"); - this.zoomBox.style.backgroundColor = "white"; - this.zoomBox.style.filter = "alpha(opacity=50)"; // IE - this.zoomBox.style.opacity = "0.50"; - this.zoomBox.style.fontSize = "1px"; - this.zoomBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1; - this.map.viewPortDiv.appendChild(this.zoomBox); - } - document.onselectstart=function() { return false; }; - OpenLayers.Event.stop(evt); - }, - - /** - * Method: defaultMouseMove - * - * Parameters: - * evt - {Event} - */ - defaultMouseMove: function (evt) { - // record the mouse position, used in onWheelEvent - this.mousePosition = evt.xy.clone(); - - if (this.mouseDragStart != null) { - if (this.zoomBox) { - var deltaX = Math.abs(this.mouseDragStart.x - evt.xy.x); - var deltaY = Math.abs(this.mouseDragStart.y - evt.xy.y); - this.zoomBox.style.width = Math.max(1, deltaX) + "px"; - this.zoomBox.style.height = Math.max(1, deltaY) + "px"; - if (evt.xy.x < this.mouseDragStart.x) { - this.zoomBox.style.left = evt.xy.x+"px"; - } - if (evt.xy.y < this.mouseDragStart.y) { - this.zoomBox.style.top = evt.xy.y+"px"; - } - } else { - var deltaX = this.mouseDragStart.x - evt.xy.x; - var deltaY = this.mouseDragStart.y - evt.xy.y; - var size = this.map.getSize(); - var newXY = new OpenLayers.Pixel(size.w / 2 + deltaX, - size.h / 2 + deltaY); - var newCenter = this.map.getLonLatFromViewPortPx( newXY ); - this.map.setCenter(newCenter, null, true); - this.mouseDragStart = evt.xy.clone(); - this.map.div.style.cursor = "move"; - } - this.performedDrag = true; - } - }, - - /** - * Method: defaultMouseUp - * - * Parameters: - * evt - {} - */ - defaultMouseUp: function (evt) { - if (!OpenLayers.Event.isLeftClick(evt)) { - return; - } - if (this.zoomBox) { - this.zoomBoxEnd(evt); - } else { - if (this.performedDrag) { - this.map.setCenter(this.map.center); - } - } - document.onselectstart=null; - this.mouseDragStart = null; - this.map.div.style.cursor = ""; - }, - - /** - * Method: defaultMouseOut - * - * Parameters: - * evt - {Event} - */ - defaultMouseOut: function (evt) { - if (this.mouseDragStart != null && - OpenLayers.Util.mouseLeft(evt, this.map.div)) { - if (this.zoomBox) { - this.removeZoomBox(); - } - this.mouseDragStart = null; - } - }, - - - /** - * Method: defaultWheelUp - * User spun scroll wheel up - * - */ - defaultWheelUp: function(evt) { - if (this.map.getZoom() <= this.map.getNumZoomLevels()) { - this.map.setCenter(this.map.getLonLatFromPixel(evt.xy), - this.map.getZoom() + 1); - } - }, - - /** - * Method: defaultWheelDown - * User spun scroll wheel down - */ - defaultWheelDown: function(evt) { - if (this.map.getZoom() > 0) { - this.map.setCenter(this.map.getLonLatFromPixel(evt.xy), - this.map.getZoom() - 1); - } - }, - - /** - * Method: zoomBoxEnd - * Zoombox function. - */ - zoomBoxEnd: function(evt) { - if (this.mouseDragStart != null) { - if (Math.abs(this.mouseDragStart.x - evt.xy.x) > 5 || - Math.abs(this.mouseDragStart.y - evt.xy.y) > 5) { - var start = this.map.getLonLatFromViewPortPx( this.mouseDragStart ); - var end = this.map.getLonLatFromViewPortPx( evt.xy ); - var top = Math.max(start.lat, end.lat); - var bottom = Math.min(start.lat, end.lat); - var left = Math.min(start.lon, end.lon); - var right = Math.max(start.lon, end.lon); - var bounds = new OpenLayers.Bounds(left, bottom, right, top); - this.map.zoomToExtent(bounds); - } else { - var end = this.map.getLonLatFromViewPortPx( evt.xy ); - this.map.setCenter(new OpenLayers.LonLat( - (end.lon), - (end.lat) - ), this.map.getZoom() + 1); - } - this.removeZoomBox(); - } - }, - - /** - * Method: removeZoomBox - * Remove the zoombox from the screen and nullify our reference to it. - */ - removeZoomBox: function() { - this.map.viewPortDiv.removeChild(this.zoomBox); - this.zoomBox = null; - }, - - -/** - * Mouse ScrollWheel code thanks to http://adomas.org/javascript-mouse-wheel/ - */ - - - /** - * Method: onWheelEvent - * Catch the wheel event and handle it xbrowserly - * - * Parameters: - * e - {Event} - */ - onWheelEvent: function(e){ - - // first determine whether or not the wheeling was inside the map - var inMap = false; - var elem = OpenLayers.Event.element(e); - while(elem != null) { - if (this.map && elem == this.map.div) { - inMap = true; - break; - } - elem = elem.parentNode; - } - - if (inMap) { - - var delta = 0; - if (!e) { - e = window.event; - } - if (e.wheelDelta) { - delta = e.wheelDelta/120; - if (window.opera && window.opera.version() < 9.2) { - delta = -delta; - } - } else if (e.detail) { - delta = -e.detail / 3; - } - if (delta) { - // add the mouse position to the event because mozilla has a bug - // with clientX and clientY (see https://bugzilla.mozilla.org/show_bug.cgi?id=352179) - // getLonLatFromViewPortPx(e) returns wrong values - e.xy = this.mousePosition; - - if (delta < 0) { - this.defaultWheelDown(e); - } else { - this.defaultWheelUp(e); - } - } - - //only wheel the map, not the window - OpenLayers.Event.stop(e); - } - }, - - CLASS_NAME: "OpenLayers.Control.MouseDefaults" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/MousePosition.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/MousePosition.js deleted file mode 100755 index 320ea51745..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/MousePosition.js +++ /dev/null @@ -1,171 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - - -/** - * @requires OpenLayers/Control.js - */ - -/** - * Class: OpenLayers.Control.MousePosition - * The MousePosition control displays geographic coordinates of the mouse - * pointer, as it is moved about the map. - * - * Inherits from: - * - - */ -OpenLayers.Control.MousePosition = OpenLayers.Class(OpenLayers.Control, { - - /** - * Property: element - * {DOMElement} - */ - element: null, - - /** - * APIProperty: prefix - * {String} - */ - prefix: '', - - /** - * APIProperty: separator - * {String} - */ - separator: ', ', - - /** - * APIProperty: suffix - * {String} - */ - suffix: '', - - /** - * APIProperty: numDigits - * {Integer} - */ - numDigits: 5, - - /** - * APIProperty: granularity - * {Integer} - */ - granularity: 10, - - /** - * Property: lastXy - * {} - */ - lastXy: null, - - /** - * APIProperty: displayProjection - * {} The projection in which the - * mouse position is displayed - */ - displayProjection: null, - - /** - * Constructor: OpenLayers.Control.MousePosition - * - * Parameters: - * options - {Object} Options for control. - */ - initialize: function(options) { - OpenLayers.Control.prototype.initialize.apply(this, arguments); - }, - - /** - * Method: destroy - */ - destroy: function() { - if (this.map) { - this.map.events.unregister('mousemove', this, this.redraw); - } - OpenLayers.Control.prototype.destroy.apply(this, arguments); - }, - - /** - * Method: draw - * {DOMElement} - */ - draw: function() { - OpenLayers.Control.prototype.draw.apply(this, arguments); - - if (!this.element) { - this.div.left = ""; - this.div.top = ""; - this.element = this.div; - } - - this.redraw(); - return this.div; - }, - - /** - * Method: redraw - */ - redraw: function(evt) { - - var lonLat; - - if (evt == null) { - lonLat = new OpenLayers.LonLat(0, 0); - } else { - if (this.lastXy == null || - Math.abs(evt.xy.x - this.lastXy.x) > this.granularity || - Math.abs(evt.xy.y - this.lastXy.y) > this.granularity) - { - this.lastXy = evt.xy; - return; - } - - lonLat = this.map.getLonLatFromPixel(evt.xy); - if (!lonLat) { - // map has not yet been properly initialized - return; - } - if (this.displayProjection) { - lonLat.transform(this.map.getProjectionObject(), - this.displayProjection ); - } - this.lastXy = evt.xy; - - } - - var newHtml = this.formatOutput(lonLat); - - if (newHtml != this.element.innerHTML) { - this.element.innerHTML = newHtml; - } - }, - - /** - * Method: formatOutput - * Override to provide custom display output - * - * Parameters: - * lonLat - {} Location to display - */ - formatOutput: function(lonLat) { - var digits = parseInt(this.numDigits); - var newHtml = - this.prefix + - lonLat.lon.toFixed(digits) + - this.separator + - lonLat.lat.toFixed(digits) + - this.suffix; - return newHtml; - }, - - /** - * Method: setMap - */ - setMap: function() { - OpenLayers.Control.prototype.setMap.apply(this, arguments); - this.map.events.register( 'mousemove', this, this.redraw); - }, - - CLASS_NAME: "OpenLayers.Control.MousePosition" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/MouseToolbar.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/MouseToolbar.js deleted file mode 100755 index 957b6da235..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/MouseToolbar.js +++ /dev/null @@ -1,405 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - - -/** - * @requires OpenLayers/Control.js - * @requires OpenLayers/Control/MouseDefaults.js - */ - -/** - * Class: OpenLayers.Control.MouseToolbar - * This class is DEPRECATED in 2.4 and will be removed by 3.0. - * If you need this functionality, use - * instead!!! - */ -OpenLayers.Control.MouseToolbar = OpenLayers.Class( - OpenLayers.Control.MouseDefaults, { - - /** - * Property: mode - */ - mode: null, - /** - * Property: buttons - */ - buttons: null, - - /** - * APIProperty: direction - * {String} 'vertical' or 'horizontal' - */ - direction: "vertical", - - /** - * Property: buttonClicked - * {String} - */ - buttonClicked: null, - - /** - * Constructor: OpenLayers.Control.MouseToolbar - * - * Parameters: - * position - {} - * direction - {String} - */ - initialize: function(position, direction) { - OpenLayers.Control.prototype.initialize.apply(this, arguments); - this.position = new OpenLayers.Pixel(OpenLayers.Control.MouseToolbar.X, - OpenLayers.Control.MouseToolbar.Y); - if (position) { - this.position = position; - } - if (direction) { - this.direction = direction; - } - this.measureDivs = []; - }, - - /** - * APIMethod: destroy - */ - destroy: function() { - for( var btnId in this.buttons) { - var btn = this.buttons[btnId]; - btn.map = null; - btn.events.destroy(); - } - OpenLayers.Control.MouseDefaults.prototype.destroy.apply(this, - arguments); - }, - - /** - * Method: draw - */ - draw: function() { - OpenLayers.Control.prototype.draw.apply(this, arguments); - OpenLayers.Control.MouseDefaults.prototype.draw.apply(this, arguments); - this.buttons = {}; - var sz = new OpenLayers.Size(28,28); - var centered = new OpenLayers.Pixel(OpenLayers.Control.MouseToolbar.X,0); - this._addButton("zoombox", "drag-rectangle-off.png", "drag-rectangle-on.png", centered, sz, "Shift->Drag to zoom to area"); - centered = centered.add((this.direction == "vertical" ? 0 : sz.w), (this.direction == "vertical" ? sz.h : 0)); - this._addButton("pan", "panning-hand-off.png", "panning-hand-on.png", centered, sz, "Drag the map to pan."); - centered = centered.add((this.direction == "vertical" ? 0 : sz.w), (this.direction == "vertical" ? sz.h : 0)); - this.switchModeTo("pan"); - - return this.div; - }, - - /** - * Method: _addButton - */ - _addButton:function(id, img, activeImg, xy, sz, title) { - var imgLocation = OpenLayers.Util.getImagesLocation() + img; - var activeImgLocation = OpenLayers.Util.getImagesLocation() + activeImg; - // var btn = new ol.AlphaImage("_"+id, imgLocation, xy, sz); - var btn = OpenLayers.Util.createAlphaImageDiv( - "OpenLayers_Control_MouseToolbar_" + id, - xy, sz, imgLocation, "absolute"); - - //we want to add the outer div - this.div.appendChild(btn); - btn.imgLocation = imgLocation; - btn.activeImgLocation = activeImgLocation; - - btn.events = new OpenLayers.Events(this, btn, null, true); - btn.events.on({ - "mousedown": this.buttonDown, - "mouseup": this.buttonUp, - "dblclick": OpenLayers.Event.stop, - scope: this - }); - btn.action = id; - btn.title = title; - btn.alt = title; - btn.map = this.map; - - //we want to remember/reference the outer div - this.buttons[id] = btn; - return btn; - }, - - /** - * Method: buttonDown - * - * Parameters: - * evt - {Event} - */ - buttonDown: function(evt) { - if (!OpenLayers.Event.isLeftClick(evt)) { - return; - } - this.buttonClicked = evt.element.action; - OpenLayers.Event.stop(evt); - }, - - /** - * Method: buttonUp - * - * Parameters: - * evt - {Event} - */ - buttonUp: function(evt) { - if (!OpenLayers.Event.isLeftClick(evt)) { - return; - } - if (this.buttonClicked != null) { - if (this.buttonClicked == evt.element.action) { - this.switchModeTo(evt.element.action); - } - OpenLayers.Event.stop(evt); - this.buttonClicked = null; - } - }, - - /** - * Method: defaultDblClick - * - * Parameters: - * evt - {Event} - */ - defaultDblClick: function (evt) { - this.switchModeTo("pan"); - this.performedDrag = false; - var newCenter = this.map.getLonLatFromViewPortPx( evt.xy ); - this.map.setCenter(newCenter, this.map.zoom + 1); - OpenLayers.Event.stop(evt); - return false; - }, - - /** - * Method: defaultMouseDown - * - * Parameters: - * evt - {Event} - */ - defaultMouseDown: function (evt) { - if (!OpenLayers.Event.isLeftClick(evt)) { - return; - } - this.mouseDragStart = evt.xy.clone(); - this.performedDrag = false; - this.startViaKeyboard = false; - if (evt.shiftKey && this.mode !="zoombox") { - this.switchModeTo("zoombox"); - this.startViaKeyboard = true; - } else if (evt.altKey && this.mode !="measure") { - this.switchModeTo("measure"); - } else if (!this.mode) { - this.switchModeTo("pan"); - } - - switch (this.mode) { - case "zoombox": - this.map.div.style.cursor = "crosshair"; - this.zoomBox = OpenLayers.Util.createDiv('zoomBox', - this.mouseDragStart, - null, - null, - "absolute", - "2px solid red"); - this.zoomBox.style.backgroundColor = "white"; - this.zoomBox.style.filter = "alpha(opacity=50)"; // IE - this.zoomBox.style.opacity = "0.50"; - this.zoomBox.style.fontSize = "1px"; - this.zoomBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1; - this.map.viewPortDiv.appendChild(this.zoomBox); - this.performedDrag = true; - break; - case "measure": - var distance = ""; - if (this.measureStart) { - var measureEnd = this.map.getLonLatFromViewPortPx(this.mouseDragStart); - distance = OpenLayers.Util.distVincenty(this.measureStart, measureEnd); - distance = Math.round(distance * 100) / 100; - distance = distance + "km"; - this.measureStartBox = this.measureBox; - } - this.measureStart = this.map.getLonLatFromViewPortPx(this.mouseDragStart);; - this.measureBox = OpenLayers.Util.createDiv(null, - this.mouseDragStart.add( - -2-parseInt(this.map.layerContainerDiv.style.left), - -2-parseInt(this.map.layerContainerDiv.style.top)), - null, - null, - "absolute"); - this.measureBox.style.width="4px"; - this.measureBox.style.height="4px"; - this.measureBox.style.fontSize = "1px"; - this.measureBox.style.backgroundColor="red"; - this.measureBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1; - this.map.layerContainerDiv.appendChild(this.measureBox); - if (distance) { - this.measureBoxDistance = OpenLayers.Util.createDiv(null, - this.mouseDragStart.add( - -2-parseInt(this.map.layerContainerDiv.style.left), - 2-parseInt(this.map.layerContainerDiv.style.top)), - null, - null, - "absolute"); - - this.measureBoxDistance.innerHTML = distance; - this.measureBoxDistance.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1; - this.map.layerContainerDiv.appendChild(this.measureBoxDistance); - this.measureDivs.push(this.measureBoxDistance); - } - this.measureBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1; - this.map.layerContainerDiv.appendChild(this.measureBox); - this.measureDivs.push(this.measureBox); - break; - default: - this.map.div.style.cursor = "move"; - break; - } - document.onselectstart = function() { return false; }; - OpenLayers.Event.stop(evt); - }, - - /** - * Method: switchModeTo - * - * Parameters: - * mode - {String} - */ - switchModeTo: function(mode) { - if (mode != this.mode) { - - - if (this.mode && this.buttons[this.mode]) { - OpenLayers.Util.modifyAlphaImageDiv(this.buttons[this.mode], null, null, null, this.buttons[this.mode].imgLocation); - } - if (this.mode == "measure" && mode != "measure") { - for(var i=0, len=this.measureDivs.length; i - */ -OpenLayers.Control.NavToolbar = OpenLayers.Class(OpenLayers.Control.Panel, { - - /** - * Constructor: OpenLayers.Control.NavToolbar - * Add our two mousedefaults controls. - * - * Parameters: - * options - {Object} An optional object whose properties will be used - * to extend the control. - */ - initialize: function(options) { - OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]); - this.addControls([ - new OpenLayers.Control.Navigation(), - new OpenLayers.Control.ZoomBox() - ]); - }, - - /** - * Method: draw - * calls the default draw, and then activates mouse defaults. - */ - draw: function() { - var div = OpenLayers.Control.Panel.prototype.draw.apply(this, arguments); - this.activateControl(this.controls[0]); - return div; - }, - - CLASS_NAME: "OpenLayers.Control.NavToolbar" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/Navigation.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/Navigation.js deleted file mode 100755 index 4ace37b429..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/Navigation.js +++ /dev/null @@ -1,247 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Control/ZoomBox.js - * @requires OpenLayers/Control/DragPan.js - * @requires OpenLayers/Handler/MouseWheel.js - * @requires OpenLayers/Handler/Click.js - */ - -/** - * Class: OpenLayers.Control.Navigation - * The navigation control handles map browsing with mouse events (dragging, - * double-clicking, and scrolling the wheel). Create a new navigation - * control with the control. - * - * Note that this control is added to the map by default (if no controls - * array is sent in the options object to the - * constructor). - * - * Inherits: - * - - */ -OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, { - - /** - * Property: dragPan - * {} - */ - dragPan: null, - - /** - * APIProprety: dragPanOptions - * {Object} Options passed to the DragPan control. - */ - dragPanOptions: null, - - /** - * Property: zoomBox - * {} - */ - zoomBox: null, - - /** - * APIProperty: zoomWheelEnabled - * {Boolean} Whether the mousewheel should zoom the map - */ - zoomWheelEnabled: true, - - /** - * APIProperty: handleRightClicks - * {Boolean} Whether or not to handle right clicks. Default is false. - */ - handleRightClicks: false, - - /** - * APIProperty: zoomBoxKeyMask - * {Integer} key code of the key, which has to be - * pressed, while drawing the zoom box with the mouse on the screen. - * You should probably set handleRightClicks to true if you use this - * with MOD_CTRL, to disable the context menu for machines which use - * CTRL-Click as a right click. - * Default: and . Call the trigger method - * on the and controls to restore previous and next - * history states. The previous and next controls will become active - * when there are available states to restore and will become deactive - * when there are no states to restore. - * - * Inherits from: - * - - */ -OpenLayers.Control.NavigationHistory = OpenLayers.Class(OpenLayers.Control, { - - /** - * Property: type - * {String} Note that this control is not intended to be added directly - * to a control panel. Instead, add the sub-controls previous and - * next. These sub-controls are button type controls that activate - * and deactivate themselves. If this parent control is added to - * a panel, it will act as a toggle. - */ - type: OpenLayers.Control.TYPE_TOGGLE, - - /** - * APIProperty: previous - * {} A button type control whose trigger method restores - * the previous state managed by this control. - */ - previous: null, - - /** - * APIProperty: previousOptions - * {Object} Set this property on the options argument of the constructor - * to set optional properties on the control. - */ - previousOptions: null, - - /** - * APIProperty: next - * {} A button type control whose trigger method restores - * the next state managed by this control. - */ - next: null, - - /** - * APIProperty: nextOptions - * {Object} Set this property on the options argument of the constructor - * to set optional properties on the control. - */ - nextOptions: null, - - /** - * APIProperty: limit - * {Integer} Optional limit on the number of history items to retain. If - * null, there is no limit. Default is 50. - */ - limit: 50, - - /** - * Property: activateOnDraw - * {Boolean} Activate the control when it is first added to the map. - * Default is true. - */ - activateOnDraw: true, - - /** - * Property: clearOnDeactivate - * {Boolean} Clear the history when the control is deactivated. Default - * is false. - */ - clearOnDeactivate: false, - - /** - * Property: registry - * {Object} An object with keys corresponding to event types. Values - * are functions that return an object representing the current state. - */ - registry: null, - - /** - * Property: nextStack - * {Array} Array of items in the history. - */ - nextStack: null, - - /** - * Property: previousStack - * {Array} List of items in the history. First item represents the current - * state. - */ - previousStack: null, - - /** - * Property: listeners - * {Object} An object containing properties corresponding to event types. - * This object is used to configure the control and is modified on - * construction. - */ - listeners: null, - - /** - * Property: restoring - * {Boolean} Currently restoring a history state. This is set to true - * before calling restore and set to false after restore returns. - */ - restoring: false, - - /** - * Constructor: OpenLayers.Control.NavigationHistory - * - * Parameters: - * options - {Object} An optional object whose properties will be used - * to extend the control. - */ - initialize: function(options) { - OpenLayers.Control.prototype.initialize.apply(this, [options]); - - this.registry = OpenLayers.Util.extend({ - "moveend": function() { - return { - center: this.map.getCenter(), - resolution: this.map.getResolution() - }; - } - }, this.registry); - - this.clear(); - - var previousOptions = { - trigger: OpenLayers.Function.bind(this.previousTrigger, this), - displayClass: this.displayClass + " " + this.displayClass + "Previous" - }; - OpenLayers.Util.extend(previousOptions, this.previousOptions); - this.previous = new OpenLayers.Control.Button(previousOptions); - - var nextOptions = { - trigger: OpenLayers.Function.bind(this.nextTrigger, this), - displayClass: this.displayClass + " " + this.displayClass + "Next" - }; - OpenLayers.Util.extend(nextOptions, this.nextOptions); - this.next = new OpenLayers.Control.Button(nextOptions); - - }, - - /** - * Method: onPreviousChange - * Called when the previous history stack changes. - * - * Parameters: - * state - {Object} An object representing the state to be restored - * if previous is triggered again or null if no previous states remain. - * length - {Integer} The number of remaining previous states that can - * be restored. - */ - onPreviousChange: function(state, length) { - if(state && !this.previous.active) { - this.previous.activate(); - } else if(!state && this.previous.active) { - this.previous.deactivate(); - } - }, - - /** - * Method: onNextChange - * Called when the next history stack changes. - * - * Parameters: - * state - {Object} An object representing the state to be restored - * if next is triggered again or null if no next states remain. - * length - {Integer} The number of remaining next states that can - * be restored. - */ - onNextChange: function(state, length) { - if(state && !this.next.active) { - this.next.activate(); - } else if(!state && this.next.active) { - this.next.deactivate(); - } - }, - - /** - * APIMethod: destroy - * Destroy the control. - */ - destroy: function() { - OpenLayers.Control.prototype.destroy.apply(this); - this.previous.destroy(); - this.next.destroy(); - this.deactivate(); - for(var prop in this) { - this[prop] = null; - } - }, - - /** - * Method: setMap - * Set the map property for the control and and child - * controls. - * - * Parameters: - * map - {} - */ - setMap: function(map) { - this.map = map; - this.next.setMap(map); - this.previous.setMap(map); - }, - - /** - * Method: draw - * Called when the control is added to the map. - */ - draw: function() { - OpenLayers.Control.prototype.draw.apply(this, arguments); - this.next.draw(); - this.previous.draw(); - if(this.activateOnDraw) { - this.activate(); - } - }, - - /** - * Method: previousTrigger - * Restore the previous state. If no items are in the previous history - * stack, this has no effect. - * - * Returns: - * {Object} Item representing state that was restored. Undefined if no - * items are in the previous history stack. - */ - previousTrigger: function() { - var current = this.previousStack.shift(); - var state = this.previousStack.shift(); - if(state != undefined) { - this.nextStack.unshift(current); - this.previousStack.unshift(state); - this.restoring = true; - this.restore(state); - this.restoring = false; - this.onNextChange(this.nextStack[0], this.nextStack.length); - this.onPreviousChange( - this.previousStack[1], this.previousStack.length - 1 - ); - } else { - this.previousStack.unshift(current); - } - return state; - }, - - /** - * APIMethod: nextTrigger - * Restore the next state. If no items are in the next history - * stack, this has no effect. The next history stack is populated - * as states are restored from the previous history stack. - * - * Returns: - * {Object} Item representing state that was restored. Undefined if no - * items are in the next history stack. - */ - nextTrigger: function() { - var state = this.nextStack.shift(); - if(state != undefined) { - this.previousStack.unshift(state); - this.restoring = true; - this.restore(state); - this.restoring = false; - this.onNextChange(this.nextStack[0], this.nextStack.length); - this.onPreviousChange( - this.previousStack[1], this.previousStack.length - 1 - ); - } - return state; - }, - - /** - * APIMethod: clear - * Clear history. - */ - clear: function() { - this.previousStack = []; - this.nextStack = []; - }, - - /** - * Method: restore - * Update the state with the given object. - * - * Parameters: - * state - {Object} An object representing the state to restore. - */ - restore: function(state) { - var zoom = this.map.getZoomForResolution(state.resolution); - this.map.setCenter(state.center, zoom); - }, - - /** - * Method: setListeners - * Sets functions to be registered in the listeners object. - */ - setListeners: function() { - this.listeners = {}; - for(var type in this.registry) { - this.listeners[type] = OpenLayers.Function.bind(function() { - if(!this.restoring) { - var state = this.registry[type].apply(this, arguments); - this.previousStack.unshift(state); - if(this.previousStack.length > 1) { - this.onPreviousChange( - this.previousStack[1], this.previousStack.length - 1 - ); - } - if(this.previousStack.length > (this.limit + 1)) { - this.previousStack.pop(); - } - if(this.nextStack.length > 0) { - this.nextStack = []; - this.onNextChange(null, 0); - } - } - return true; - }, this); - } - }, - - /** - * APIMethod: activate - * Activate the control. This registers any listeners. - * - * Returns: - * {Boolean} Control successfully activated. - */ - activate: function() { - var activated = false; - if(this.map) { - if(OpenLayers.Control.prototype.activate.apply(this)) { - if(this.listeners == null) { - this.setListeners(); - } - for(var type in this.listeners) { - this.map.events.register(type, this, this.listeners[type]); - } - activated = true; - if(this.previousStack.length == 0) { - this.initStack(); - } - } - } - return activated; - }, - - /** - * Method: initStack - * Called after the control is activated if the previous history stack is - * empty. - */ - initStack: function() { - if(this.map.getCenter()) { - this.listeners.moveend(); - } - }, - - /** - * APIMethod: deactivate - * Deactivate the control. This unregisters any listeners. - * - * Returns: - * {Boolean} Control successfully deactivated. - */ - deactivate: function() { - var deactivated = false; - if(this.map) { - if(OpenLayers.Control.prototype.deactivate.apply(this)) { - for(var type in this.listeners) { - this.map.events.unregister( - type, this, this.listeners[type] - ); - } - if(this.clearOnDeactivate) { - this.clear(); - } - deactivated = true; - } - } - return deactivated; - }, - - CLASS_NAME: "OpenLayers.Control.NavigationHistory" -}); - diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/OverviewMap.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/OverviewMap.js deleted file mode 100755 index 03c92b836a..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/OverviewMap.js +++ /dev/null @@ -1,700 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Control.js - * @requires OpenLayers/BaseTypes.js - * @requires OpenLayers/Events.js - */ - -/** - * Class: OpenLayers.Control.OverviewMap - * The OverMap control creates a small overview map, useful to display the - * extent of a zoomed map and your main map and provide additional - * navigation options to the User. By default the overview map is drawn in - * the lower right corner of the main map. Create a new overview map with the - * constructor. - * - * Inerits from: - * - - */ -OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, { - - /** - * Property: element - * {DOMElement} The DOM element that contains the overview map - */ - element: null, - - /** - * APIProperty: ovmap - * {} A reference to the overview map itself. - */ - ovmap: null, - - /** - * APIProperty: size - * {} The overvew map size in pixels. Note that this is - * the size of the map itself - the element that contains the map (default - * class name olControlOverviewMapElement) may have padding or other style - * attributes added via CSS. - */ - size: new OpenLayers.Size(180, 90), - - /** - * APIProperty: layers - * {Array()} Ordered list of layers in the overview map. - * If none are sent at construction, the base layer for the main map is used. - */ - layers: null, - - /** - * APIProperty: minRectSize - * {Integer} The minimum width or height (in pixels) of the extent - * rectangle on the overview map. When the extent rectangle reaches - * this size, it will be replaced depending on the value of the - * property. Default is 15 pixels. - */ - minRectSize: 15, - - /** - * APIProperty: minRectDisplayClass - * {String} Replacement style class name for the extent rectangle when - * is reached. This string will be suffixed on to the - * displayClass. Default is "RectReplacement". - * - * Example CSS declaration: - * (code) - * .olControlOverviewMapRectReplacement { - * overflow: hidden; - * cursor: move; - * background-image: url("img/overview_replacement.gif"); - * background-repeat: no-repeat; - * background-position: center; - * } - * (end) - */ - minRectDisplayClass: "RectReplacement", - - /** - * APIProperty: minRatio - * {Float} The ratio of the overview map resolution to the main map - * resolution at which to zoom farther out on the overview map. - */ - minRatio: 8, - - /** - * APIProperty: maxRatio - * {Float} The ratio of the overview map resolution to the main map - * resolution at which to zoom farther in on the overview map. - */ - maxRatio: 32, - - /** - * APIProperty: mapOptions - * {Object} An object containing any non-default properties to be sent to - * the overview map's map constructor. These should include any - * non-default options that the main map was constructed with. - */ - mapOptions: null, - - /** - * APIProperty: autoPan - * {Boolean} Always pan the overview map, so the extent marker remains in - * the center. Default is false. If true, when you drag the extent - * marker, the overview map will update itself so the marker returns - * to the center. - */ - autoPan: false, - - /** - * Property: handlers - * {Object} - */ - handlers: null, - - /** - * Property: resolutionFactor - * {Object} - */ - resolutionFactor: 1, - - /** - * Constructor: OpenLayers.Control.OverviewMap - * Create a new overview map - * - * Parameters: - * object - {Object} Properties of this object will be set on the overview - * map object. Note, to set options on the map object contained in this - * control, set as one of the options properties. - */ - initialize: function(options) { - this.layers = []; - this.handlers = {}; - OpenLayers.Control.prototype.initialize.apply(this, [options]); - }, - - /** - * APIMethod: destroy - * Deconstruct the control - */ - destroy: function() { - if (!this.mapDiv) { // we've already been destroyed - return; - } - this.handlers.click.destroy(); - - this.mapDiv.removeChild(this.extentRectangle); - this.extentRectangle = null; - this.rectEvents.destroy(); - this.rectEvents = null; - - this.ovmap.destroy(); - this.ovmap = null; - - this.element.removeChild(this.mapDiv); - this.mapDiv = null; - - this.div.removeChild(this.element); - this.element = null; - - if (this.maximizeDiv) { - OpenLayers.Event.stopObservingElement(this.maximizeDiv); - this.div.removeChild(this.maximizeDiv); - this.maximizeDiv = null; - } - - if (this.minimizeDiv) { - OpenLayers.Event.stopObservingElement(this.minimizeDiv); - this.div.removeChild(this.minimizeDiv); - this.minimizeDiv = null; - } - - this.map.events.un({ - "moveend": this.update, - "changebaselayer": this.baseLayerDraw, - scope: this - }); - - OpenLayers.Control.prototype.destroy.apply(this, arguments); - }, - - /** - * Method: draw - * Render the control in the browser. - */ - draw: function() { - OpenLayers.Control.prototype.draw.apply(this, arguments); - if(!(this.layers.length > 0)) { - if (this.map.baseLayer) { - var layer = this.map.baseLayer.clone(); - this.layers = [layer]; - } else { - this.map.events.register("changebaselayer", this, this.baseLayerDraw); - return this.div; - } - } - - // create overview map DOM elements - this.element = document.createElement('div'); - this.element.className = this.displayClass + 'Element'; - this.element.style.display = 'none'; - - this.mapDiv = document.createElement('div'); - this.mapDiv.style.width = this.size.w + 'px'; - this.mapDiv.style.height = this.size.h + 'px'; - this.mapDiv.style.position = 'relative'; - this.mapDiv.style.overflow = 'hidden'; - this.mapDiv.id = OpenLayers.Util.createUniqueID('overviewMap'); - - this.extentRectangle = document.createElement('div'); - this.extentRectangle.style.position = 'absolute'; - this.extentRectangle.style.zIndex = 1000; //HACK - this.extentRectangle.className = this.displayClass+'ExtentRectangle'; - this.mapDiv.appendChild(this.extentRectangle); - - this.element.appendChild(this.mapDiv); - - this.div.appendChild(this.element); - - // Optionally add min/max buttons if the control will go in the - // map viewport. - if(!this.outsideViewport) { - this.div.className += " " + this.displayClass + 'Container'; - var imgLocation = OpenLayers.Util.getImagesLocation(); - // maximize button div - var img = imgLocation + 'layer-switcher-maximize.png'; - this.maximizeDiv = OpenLayers.Util.createAlphaImageDiv( - this.displayClass + 'MaximizeButton', - null, - new OpenLayers.Size(18,18), - img, - 'absolute'); - this.maximizeDiv.style.display = 'none'; - this.maximizeDiv.className = this.displayClass + 'MaximizeButton'; - OpenLayers.Event.observe(this.maximizeDiv, 'click', - OpenLayers.Function.bindAsEventListener(this.maximizeControl, - this) - ); - this.div.appendChild(this.maximizeDiv); - - // minimize button div - var img = imgLocation + 'layer-switcher-minimize.png'; - this.minimizeDiv = OpenLayers.Util.createAlphaImageDiv( - 'OpenLayers_Control_minimizeDiv', - null, - new OpenLayers.Size(18,18), - img, - 'absolute'); - this.minimizeDiv.style.display = 'none'; - this.minimizeDiv.className = this.displayClass + 'MinimizeButton'; - OpenLayers.Event.observe(this.minimizeDiv, 'click', - OpenLayers.Function.bindAsEventListener(this.minimizeControl, - this) - ); - this.div.appendChild(this.minimizeDiv); - - var eventsToStop = ['dblclick','mousedown']; - - for (var i=0, len=eventsToStop.length; i} The pixel location of the drag. - */ - rectDrag: function(px) { - var deltaX = this.handlers.drag.last.x - px.x; - var deltaY = this.handlers.drag.last.y - px.y; - if(deltaX != 0 || deltaY != 0) { - var rectTop = this.rectPxBounds.top; - var rectLeft = this.rectPxBounds.left; - var rectHeight = Math.abs(this.rectPxBounds.getHeight()); - var rectWidth = this.rectPxBounds.getWidth(); - // don't allow dragging off of parent element - var newTop = Math.max(0, (rectTop - deltaY)); - newTop = Math.min(newTop, - this.ovmap.size.h - this.hComp - rectHeight); - var newLeft = Math.max(0, (rectLeft - deltaX)); - newLeft = Math.min(newLeft, - this.ovmap.size.w - this.wComp - rectWidth); - this.setRectPxBounds(new OpenLayers.Bounds(newLeft, - newTop + rectHeight, - newLeft + rectWidth, - newTop)); - } - }, - - /** - * Method: mapDivClick - * Handle browser events - * - * Parameters: - * evt - {} evt - */ - mapDivClick: function(evt) { - var pxCenter = this.rectPxBounds.getCenterPixel(); - var deltaX = evt.xy.x - pxCenter.x; - var deltaY = evt.xy.y - pxCenter.y; - var top = this.rectPxBounds.top; - var left = this.rectPxBounds.left; - var height = Math.abs(this.rectPxBounds.getHeight()); - var width = this.rectPxBounds.getWidth(); - var newTop = Math.max(0, (top + deltaY)); - newTop = Math.min(newTop, this.ovmap.size.h - height); - var newLeft = Math.max(0, (left + deltaX)); - newLeft = Math.min(newLeft, this.ovmap.size.w - width); - this.setRectPxBounds(new OpenLayers.Bounds(newLeft, - newTop + height, - newLeft + width, - newTop)); - this.updateMapToRect(); - }, - - /** - * Method: maximizeControl - * Unhide the control. Called when the control is in the map viewport. - * - * Parameters: - * e - {} - */ - maximizeControl: function(e) { - this.element.style.display = ''; - this.showToggle(false); - if (e != null) { - OpenLayers.Event.stop(e); - } - }, - - /** - * Method: minimizeControl - * Hide all the contents of the control, shrink the size, - * add the maximize icon - * - * Parameters: - * e - {} - */ - minimizeControl: function(e) { - this.element.style.display = 'none'; - this.showToggle(true); - if (e != null) { - OpenLayers.Event.stop(e); - } - }, - - /** - * Method: showToggle - * Hide/Show the toggle depending on whether the control is minimized - * - * Parameters: - * minimize - {Boolean} - */ - showToggle: function(minimize) { - this.maximizeDiv.style.display = minimize ? '' : 'none'; - this.minimizeDiv.style.display = minimize ? 'none' : ''; - }, - - /** - * Method: update - * Update the overview map after layers move. - */ - update: function() { - if(this.ovmap == null) { - this.createMap(); - } - - if(this.autoPan || !this.isSuitableOverview()) { - this.updateOverview(); - } - - // update extent rectangle - this.updateRectToMap(); - }, - - /** - * Method: isSuitableOverview - * Determines if the overview map is suitable given the extent and - * resolution of the main map. - */ - isSuitableOverview: function() { - var mapExtent = this.map.getExtent(); - var maxExtent = this.map.maxExtent; - var testExtent = new OpenLayers.Bounds( - Math.max(mapExtent.left, maxExtent.left), - Math.max(mapExtent.bottom, maxExtent.bottom), - Math.min(mapExtent.right, maxExtent.right), - Math.min(mapExtent.top, maxExtent.top)); - - if (this.ovmap.getProjection() != this.map.getProjection()) { - testExtent = testExtent.transform( - this.map.getProjectionObject(), - this.ovmap.getProjectionObject() ); - } - - var resRatio = this.ovmap.getResolution() / this.map.getResolution(); - return ((resRatio > this.minRatio) && - (resRatio <= this.maxRatio) && - (this.ovmap.getExtent().containsBounds(testExtent))); - }, - - /** - * Method updateOverview - * Called by if returns true - */ - updateOverview: function() { - var mapRes = this.map.getResolution(); - var targetRes = this.ovmap.getResolution(); - var resRatio = targetRes / mapRes; - if(resRatio > this.maxRatio) { - // zoom in overview map - targetRes = this.minRatio * mapRes; - } else if(resRatio <= this.minRatio) { - // zoom out overview map - targetRes = this.maxRatio * mapRes; - } - var center; - if (this.ovmap.getProjection() != this.map.getProjection()) { - center = this.map.center.clone(); - center.transform(this.map.getProjectionObject(), - this.ovmap.getProjectionObject() ); - } else { - center = this.map.center; - } - this.ovmap.setCenter(center, this.ovmap.getZoomForResolution( - targetRes * this.resolutionFactor)); - this.updateRectToMap(); - }, - - /** - * Method: createMap - * Construct the map that this control contains - */ - createMap: function() { - // create the overview map - var options = OpenLayers.Util.extend( - {controls: [], maxResolution: 'auto', - fallThrough: false}, this.mapOptions); - this.ovmap = new OpenLayers.Map(this.mapDiv, options); - - // prevent ovmap from being destroyed when the page unloads, because - // the OverviewMap control has to do this (and does it). - OpenLayers.Event.stopObserving(window, 'unload', this.ovmap.unloadDestroy); - - this.ovmap.addLayers(this.layers); - this.ovmap.zoomToMaxExtent(); - // check extent rectangle border width - this.wComp = parseInt(OpenLayers.Element.getStyle(this.extentRectangle, - 'border-left-width')) + - parseInt(OpenLayers.Element.getStyle(this.extentRectangle, - 'border-right-width')); - this.wComp = (this.wComp) ? this.wComp : 2; - this.hComp = parseInt(OpenLayers.Element.getStyle(this.extentRectangle, - 'border-top-width')) + - parseInt(OpenLayers.Element.getStyle(this.extentRectangle, - 'border-bottom-width')); - this.hComp = (this.hComp) ? this.hComp : 2; - - this.handlers.drag = new OpenLayers.Handler.Drag( - this, {move: this.rectDrag, done: this.updateMapToRect}, - {map: this.ovmap} - ); - this.handlers.click = new OpenLayers.Handler.Click( - this, { - "click": this.mapDivClick - },{ - "single": true, "double": false, - "stopSingle": true, "stopDouble": true, - "pixelTolerance": 1, - map: this.ovmap - } - ); - this.handlers.click.activate(); - - this.rectEvents = new OpenLayers.Events(this, this.extentRectangle, - null, true); - this.rectEvents.register("mouseover", this, function(e) { - if(!this.handlers.drag.active && !this.map.dragging) { - this.handlers.drag.activate(); - } - }); - this.rectEvents.register("mouseout", this, function(e) { - if(!this.handlers.drag.dragging) { - this.handlers.drag.deactivate(); - } - }); - - if (this.ovmap.getProjection() != this.map.getProjection()) { - var sourceUnits = this.map.getProjectionObject().getUnits() || - this.map.units || this.map.baseLayer.units; - var targetUnits = this.ovmap.getProjectionObject().getUnits() || - this.ovmap.units || this.ovmap.baseLayer.units; - this.resolutionFactor = sourceUnits && targetUnits ? - OpenLayers.INCHES_PER_UNIT[sourceUnits] / - OpenLayers.INCHES_PER_UNIT[targetUnits] : 1; - } - }, - - /** - * Method: updateRectToMap - * Updates the extent rectangle position and size to match the map extent - */ - updateRectToMap: function() { - // If the projections differ we need to reproject - var bounds; - if (this.ovmap.getProjection() != this.map.getProjection()) { - bounds = this.map.getExtent().transform( - this.map.getProjectionObject(), - this.ovmap.getProjectionObject() ); - } else { - bounds = this.map.getExtent(); - } - var pxBounds = this.getRectBoundsFromMapBounds(bounds); - if (pxBounds) { - this.setRectPxBounds(pxBounds); - } - }, - - /** - * Method: updateMapToRect - * Updates the map extent to match the extent rectangle position and size - */ - updateMapToRect: function() { - var lonLatBounds = this.getMapBoundsFromRectBounds(this.rectPxBounds); - if (this.ovmap.getProjection() != this.map.getProjection()) { - lonLatBounds = lonLatBounds.transform( - this.ovmap.getProjectionObject(), - this.map.getProjectionObject() ); - } - this.map.panTo(lonLatBounds.getCenterLonLat()); - }, - - /** - * Method: setRectPxBounds - * Set extent rectangle pixel bounds. - * - * Parameters: - * pxBounds - {} - */ - setRectPxBounds: function(pxBounds) { - var top = Math.max(pxBounds.top, 0); - var left = Math.max(pxBounds.left, 0); - var bottom = Math.min(pxBounds.top + Math.abs(pxBounds.getHeight()), - this.ovmap.size.h - this.hComp); - var right = Math.min(pxBounds.left + pxBounds.getWidth(), - this.ovmap.size.w - this.wComp); - var width = Math.max(right - left, 0); - var height = Math.max(bottom - top, 0); - if(width < this.minRectSize || height < this.minRectSize) { - this.extentRectangle.className = this.displayClass + - this.minRectDisplayClass; - var rLeft = left + (width / 2) - (this.minRectSize / 2); - var rTop = top + (height / 2) - (this.minRectSize / 2); - this.extentRectangle.style.top = Math.round(rTop) + 'px'; - this.extentRectangle.style.left = Math.round(rLeft) + 'px'; - this.extentRectangle.style.height = this.minRectSize + 'px'; - this.extentRectangle.style.width = this.minRectSize + 'px'; - } else { - this.extentRectangle.className = this.displayClass + - 'ExtentRectangle'; - this.extentRectangle.style.top = Math.round(top) + 'px'; - this.extentRectangle.style.left = Math.round(left) + 'px'; - this.extentRectangle.style.height = Math.round(height) + 'px'; - this.extentRectangle.style.width = Math.round(width) + 'px'; - } - this.rectPxBounds = new OpenLayers.Bounds( - Math.round(left), Math.round(bottom), - Math.round(right), Math.round(top) - ); - }, - - /** - * Method: getRectBoundsFromMapBounds - * Get the rect bounds from the map bounds. - * - * Parameters: - * lonLatBounds - {} - * - * Returns: - * {}A bounds which is the passed-in map lon/lat extent - * translated into pixel bounds for the overview map - */ - getRectBoundsFromMapBounds: function(lonLatBounds) { - var leftBottomLonLat = new OpenLayers.LonLat(lonLatBounds.left, - lonLatBounds.bottom); - var rightTopLonLat = new OpenLayers.LonLat(lonLatBounds.right, - lonLatBounds.top); - var leftBottomPx = this.getOverviewPxFromLonLat(leftBottomLonLat); - var rightTopPx = this.getOverviewPxFromLonLat(rightTopLonLat); - var bounds = null; - if (leftBottomPx && rightTopPx) { - bounds = new OpenLayers.Bounds(leftBottomPx.x, leftBottomPx.y, - rightTopPx.x, rightTopPx.y); - } - return bounds; - }, - - /** - * Method: getMapBoundsFromRectBounds - * Get the map bounds from the rect bounds. - * - * Parameters: - * pxBounds - {} - * - * Returns: - * {} Bounds which is the passed-in overview rect bounds - * translated into lon/lat bounds for the overview map - */ - getMapBoundsFromRectBounds: function(pxBounds) { - var leftBottomPx = new OpenLayers.Pixel(pxBounds.left, - pxBounds.bottom); - var rightTopPx = new OpenLayers.Pixel(pxBounds.right, - pxBounds.top); - var leftBottomLonLat = this.getLonLatFromOverviewPx(leftBottomPx); - var rightTopLonLat = this.getLonLatFromOverviewPx(rightTopPx); - return new OpenLayers.Bounds(leftBottomLonLat.lon, leftBottomLonLat.lat, - rightTopLonLat.lon, rightTopLonLat.lat); - }, - - /** - * Method: getLonLatFromOverviewPx - * Get a map location from a pixel location - * - * Parameters: - * overviewMapPx - {} - * - * Returns: - * {} Location which is the passed-in overview map - * OpenLayers.Pixel, translated into lon/lat by the overview map - */ - getLonLatFromOverviewPx: function(overviewMapPx) { - var size = this.ovmap.size; - var res = this.ovmap.getResolution(); - var center = this.ovmap.getExtent().getCenterLonLat(); - - var delta_x = overviewMapPx.x - (size.w / 2); - var delta_y = overviewMapPx.y - (size.h / 2); - - return new OpenLayers.LonLat(center.lon + delta_x * res , - center.lat - delta_y * res); - }, - - /** - * Method: getOverviewPxFromLonLat - * Get a pixel location from a map location - * - * Parameters: - * lonlat - {} - * - * Returns: - * {} Location which is the passed-in OpenLayers.LonLat, - * translated into overview map pixels - */ - getOverviewPxFromLonLat: function(lonlat) { - var res = this.ovmap.getResolution(); - var extent = this.ovmap.getExtent(); - var px = null; - if (extent) { - px = new OpenLayers.Pixel( - Math.round(1/res * (lonlat.lon - extent.left)), - Math.round(1/res * (extent.top - lonlat.lat))); - } - return px; - }, - - CLASS_NAME: 'OpenLayers.Control.OverviewMap' -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/Pan.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/Pan.js deleted file mode 100755 index 9e6c4128aa..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/Pan.js +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Control.js - */ - -/** - * Class: OpenLayers.Control.Pan - * The Pan control is a single button to pan the map in one direction. For - * a more complete control see . - * - * Inherits from: - * - - */ -OpenLayers.Control.Pan = OpenLayers.Class(OpenLayers.Control, { - - /** - * APIProperty: slideFactor - * {Integer} Number of pixels by which we'll pan the map in any direction - * on clicking the arrow buttons. - */ - slideFactor: 50, - - /** - * Property: direction - * {String} in {'North', 'South', 'East', 'West'} - */ - direction: null, - - /** - * Property: type - * {String} The type of -- When added to a - * , 'type' is used by the panel to determine how to - * handle our events. - */ - type: OpenLayers.Control.TYPE_BUTTON, - - /** - * Constructor: OpenLayers.Control.Pan - * Control which handles the panning (in any of the cardinal directions) - * of the map by a set px distance. - * - * Parameters: - * direction - {String} The direction this button should pan. - * options - {Object} An optional object whose properties will be used - * to extend the control. - */ - initialize: function(direction, options) { - - this.direction = direction; - this.CLASS_NAME += this.direction; - - OpenLayers.Control.prototype.initialize.apply(this, [options]); - }, - - /** - * Method: trigger - */ - trigger: function(){ - - switch (this.direction) { - case OpenLayers.Control.Pan.NORTH: - this.map.pan(0, -this.slideFactor); - break; - case OpenLayers.Control.Pan.SOUTH: - this.map.pan(0, this.slideFactor); - break; - case OpenLayers.Control.Pan.WEST: - this.map.pan(-this.slideFactor, 0); - break; - case OpenLayers.Control.Pan.EAST: - this.map.pan(this.slideFactor, 0); - break; - } - }, - - CLASS_NAME: "OpenLayers.Control.Pan" -}); - -OpenLayers.Control.Pan.NORTH = "North"; -OpenLayers.Control.Pan.SOUTH = "South"; -OpenLayers.Control.Pan.EAST = "East"; -OpenLayers.Control.Pan.WEST = "West"; diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/PanPanel.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/PanPanel.js deleted file mode 100755 index b8d10947bd..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/PanPanel.js +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @requires OpenLayers/Control/Panel.js - * @requires OpenLayers/Control/Pan.js - */ - -/** - * Class: OpenLayers.Control.PanPanel - * The PanPanel is visible control for panning the map North, South, East or - * West in small steps. By default it is drawn in the top left corner of the - * map. - * - * Note: - * If you wish to use this class with the default images and you want - * it to look nice in ie6, you should add the following, conditionally - * added css stylesheet to your HTML file: - * - * (code) - * - * (end) - * - * Inherits from: - * - - */ -OpenLayers.Control.PanPanel = OpenLayers.Class(OpenLayers.Control.Panel, { - - /** - * Constructor: OpenLayers.Control.PanPanel - * Add the four directional pan buttons. - * - * Parameters: - * options - {Object} An optional object whose properties will be used - * to extend the control. - */ - initialize: function(options) { - OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]); - this.addControls([ - new OpenLayers.Control.Pan(OpenLayers.Control.Pan.NORTH), - new OpenLayers.Control.Pan(OpenLayers.Control.Pan.SOUTH), - new OpenLayers.Control.Pan(OpenLayers.Control.Pan.EAST), - new OpenLayers.Control.Pan(OpenLayers.Control.Pan.WEST) - ]); - }, - - CLASS_NAME: "OpenLayers.Control.PanPanel" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/PanZoom.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/PanZoom.js deleted file mode 100755 index e92036059b..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/PanZoom.js +++ /dev/null @@ -1,244 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - - -/** - * @requires OpenLayers/Control.js - */ - -/** - * Class: OpenLayers.Control.PanZoom - * The PanZoom is a visible control, composed of a - * and a . By - * default it is drawn in the upper left corner of the map. - * - * Inherits from: - * - - */ -OpenLayers.Control.PanZoom = OpenLayers.Class(OpenLayers.Control, { - - /** - * APIProperty: slideFactor - * {Integer} Number of pixels by which we'll pan the map in any direction - * on clicking the arrow buttons. If you want to pan by some ratio - * of the map dimensions, use instead. - */ - slideFactor: 50, - - /** - * APIProperty: slideRatio - * {Number} The fraction of map width/height by which we'll pan the map - * on clicking the arrow buttons. Default is null. If set, will - * override . E.g. if slideRatio is .5, then the Pan Up - * button will pan up half the map height. - */ - slideRatio: null, - - /** - * Property: buttons - * {Array(DOMElement)} Array of Button Divs - */ - buttons: null, - - /** - * Property: position - * {} - */ - position: null, - - /** - * Constructor: OpenLayers.Control.PanZoom - * - * Parameters: - * options - {Object} - */ - initialize: function(options) { - this.position = new OpenLayers.Pixel(OpenLayers.Control.PanZoom.X, - OpenLayers.Control.PanZoom.Y); - OpenLayers.Control.prototype.initialize.apply(this, arguments); - }, - - /** - * APIMethod: destroy - */ - destroy: function() { - OpenLayers.Control.prototype.destroy.apply(this, arguments); - this.removeButtons(); - this.buttons = null; - this.position = null; - }, - - /** - * Method: draw - * - * Parameters: - * px - {} - * - * Returns: - * {DOMElement} A reference to the container div for the PanZoom control. - */ - draw: function(px) { - // initialize our internal div - OpenLayers.Control.prototype.draw.apply(this, arguments); - px = this.position; - - // place the controls - this.buttons = []; - - var sz = new OpenLayers.Size(18,18); - var centered = new OpenLayers.Pixel(px.x+sz.w/2, px.y); - - this._addButton("panup", "north-mini.png", centered, sz); - px.y = centered.y+sz.h; - this._addButton("panleft", "west-mini.png", px, sz); - this._addButton("panright", "east-mini.png", px.add(sz.w, 0), sz); - this._addButton("pandown", "south-mini.png", - centered.add(0, sz.h*2), sz); - this._addButton("zoomin", "zoom-plus-mini.png", - centered.add(0, sz.h*3+5), sz); - this._addButton("zoomworld", "zoom-world-mini.png", - centered.add(0, sz.h*4+5), sz); - this._addButton("zoomout", "zoom-minus-mini.png", - centered.add(0, sz.h*5+5), sz); - return this.div; - }, - - /** - * Method: _addButton - * - * Parameters: - * id - {String} - * img - {String} - * xy - {} - * sz - {} - * - * Returns: - * {DOMElement} A Div (an alphaImageDiv, to be precise) that contains the - * image of the button, and has all the proper event handlers set. - */ - _addButton:function(id, img, xy, sz) { - var imgLocation = OpenLayers.Util.getImagesLocation() + img; - var btn = OpenLayers.Util.createAlphaImageDiv( - this.id + "_" + id, - xy, sz, imgLocation, "absolute"); - - //we want to add the outer div - this.div.appendChild(btn); - - OpenLayers.Event.observe(btn, "mousedown", - OpenLayers.Function.bindAsEventListener(this.buttonDown, btn)); - OpenLayers.Event.observe(btn, "dblclick", - OpenLayers.Function.bindAsEventListener(this.doubleClick, btn)); - OpenLayers.Event.observe(btn, "click", - OpenLayers.Function.bindAsEventListener(this.doubleClick, btn)); - btn.action = id; - btn.map = this.map; - - if(!this.slideRatio){ - var slideFactorPixels = this.slideFactor; - var getSlideFactor = function() { - return slideFactorPixels; - }; - } else { - var slideRatio = this.slideRatio; - var getSlideFactor = function(dim) { - return this.map.getSize()[dim] * slideRatio; - }; - } - - btn.getSlideFactor = getSlideFactor; - - //we want to remember/reference the outer div - this.buttons.push(btn); - return btn; - }, - - /** - * Method: _removeButton - * - * Parameters: - * btn - {Object} - */ - _removeButton: function(btn) { - OpenLayers.Event.stopObservingElement(btn); - btn.map = null; - this.div.removeChild(btn); - OpenLayers.Util.removeItem(this.buttons, btn); - }, - - /** - * Method: removeButtons - */ - removeButtons: function() { - for(var i=this.buttons.length-1; i>=0; --i) { - this._removeButton(this.buttons[i]); - } - }, - - /** - * Method: doubleClick - * - * Parameters: - * evt - {Event} - * - * Returns: - * {Boolean} - */ - doubleClick: function (evt) { - OpenLayers.Event.stop(evt); - return false; - }, - - /** - * Method: buttonDown - * - * Parameters: - * evt - {Event} - */ - buttonDown: function (evt) { - if (!OpenLayers.Event.isLeftClick(evt)) { - return; - } - - switch (this.action) { - case "panup": - this.map.pan(0, -this.getSlideFactor("h")); - break; - case "pandown": - this.map.pan(0, this.getSlideFactor("h")); - break; - case "panleft": - this.map.pan(-this.getSlideFactor("w"), 0); - break; - case "panright": - this.map.pan(this.getSlideFactor("w"), 0); - break; - case "zoomin": - this.map.zoomIn(); - break; - case "zoomout": - this.map.zoomOut(); - break; - case "zoomworld": - this.map.zoomToMaxExtent(); - break; - } - - OpenLayers.Event.stop(evt); - }, - - CLASS_NAME: "OpenLayers.Control.PanZoom" -}); - -/** - * Constant: X - * {Integer} - */ -OpenLayers.Control.PanZoom.X = 4; - -/** - * Constant: Y - * {Integer} - */ -OpenLayers.Control.PanZoom.Y = 4; diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/PanZoomBar.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/PanZoomBar.js deleted file mode 100755 index 290cb6ea6b..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/PanZoomBar.js +++ /dev/null @@ -1,373 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - - -/** - * @requires OpenLayers/Control/PanZoom.js - */ - -/** - * Class: OpenLayers.Control.PanZoomBar - * The PanZoomBar is a visible control composed of a - * and a . - * By default it is displayed in the upper left corner of the map as 4 - * directional arrows above a vertical slider. - * - * Inherits from: - * - - */ -OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, { - - /** - * APIProperty: zoomStopWidth - */ - zoomStopWidth: 18, - - /** - * APIProperty: zoomStopHeight - */ - zoomStopHeight: 11, - - /** - * Property: slider - */ - slider: null, - - /** - * Property: sliderEvents - * {} - */ - sliderEvents: null, - - /** - * Property: zoomBarDiv - * {DOMElement} - */ - zoomBarDiv: null, - - /** - * Property: divEvents - * {} - */ - divEvents: null, - - /** - * APIProperty: zoomWorldIcon - * {Boolean} - */ - zoomWorldIcon: false, - - /** - * Constructor: OpenLayers.Control.PanZoomBar - */ - initialize: function() { - OpenLayers.Control.PanZoom.prototype.initialize.apply(this, arguments); - }, - - /** - * APIMethod: destroy - */ - destroy: function() { - - this._removeZoomBar(); - - this.map.events.un({ - "changebaselayer": this.redraw, - scope: this - }); - - OpenLayers.Control.PanZoom.prototype.destroy.apply(this, arguments); - }, - - /** - * Method: setMap - * - * Parameters: - * map - {} - */ - setMap: function(map) { - OpenLayers.Control.PanZoom.prototype.setMap.apply(this, arguments); - this.map.events.register("changebaselayer", this, this.redraw); - }, - - /** - * Method: redraw - * clear the div and start over. - */ - redraw: function() { - if (this.div != null) { - this.removeButtons(); - this._removeZoomBar(); - } - this.draw(); - }, - - /** - * Method: draw - * - * Parameters: - * px - {} - */ - draw: function(px) { - // initialize our internal div - OpenLayers.Control.prototype.draw.apply(this, arguments); - px = this.position.clone(); - - // place the controls - this.buttons = []; - - var sz = new OpenLayers.Size(18,18); - var centered = new OpenLayers.Pixel(px.x+sz.w/2, px.y); - var wposition = sz.w; - - if (this.zoomWorldIcon) { - centered = new OpenLayers.Pixel(px.x+sz.w, px.y); - } - - this._addButton("panup", "north-mini.png", centered, sz); - px.y = centered.y+sz.h; - this._addButton("panleft", "west-mini.png", px, sz); - if (this.zoomWorldIcon) { - this._addButton("zoomworld", "zoom-world-mini.png", px.add(sz.w, 0), sz); - - wposition *= 2; - } - this._addButton("panright", "east-mini.png", px.add(wposition, 0), sz); - this._addButton("pandown", "south-mini.png", centered.add(0, sz.h*2), sz); - this._addButton("zoomin", "zoom-plus-mini.png", centered.add(0, sz.h*3+5), sz); - centered = this._addZoomBar(centered.add(0, sz.h*4 + 5)); - this._addButton("zoomout", "zoom-minus-mini.png", centered, sz); - return this.div; - }, - - /** - * Method: _addZoomBar - * - * Parameters: - * location - {} where zoombar drawing is to start. - */ - _addZoomBar:function(centered) { - var imgLocation = OpenLayers.Util.getImagesLocation(); - - var id = this.id + "_" + this.map.id; - var zoomsToEnd = this.map.getNumZoomLevels() - 1 - this.map.getZoom(); - var slider = OpenLayers.Util.createAlphaImageDiv(id, - centered.add(-1, zoomsToEnd * this.zoomStopHeight), - new OpenLayers.Size(20,9), - imgLocation+"slider.png", - "absolute"); - this.slider = slider; - - this.sliderEvents = new OpenLayers.Events(this, slider, null, true, - {includeXY: true}); - this.sliderEvents.on({ - "mousedown": this.zoomBarDown, - "mousemove": this.zoomBarDrag, - "mouseup": this.zoomBarUp, - "dblclick": this.doubleClick, - "click": this.doubleClick - }); - - var sz = new OpenLayers.Size(); - sz.h = this.zoomStopHeight * this.map.getNumZoomLevels(); - sz.w = this.zoomStopWidth; - var div = null; - - if (OpenLayers.Util.alphaHack()) { - var id = this.id + "_" + this.map.id; - div = OpenLayers.Util.createAlphaImageDiv(id, centered, - new OpenLayers.Size(sz.w, - this.zoomStopHeight), - imgLocation + "zoombar.png", - "absolute", null, "crop"); - div.style.height = sz.h + "px"; - } else { - div = OpenLayers.Util.createDiv( - 'OpenLayers_Control_PanZoomBar_Zoombar' + this.map.id, - centered, - sz, - imgLocation+"zoombar.png"); - } - - this.zoombarDiv = div; - - this.divEvents = new OpenLayers.Events(this, div, null, true, - {includeXY: true}); - this.divEvents.on({ - "mousedown": this.divClick, - "mousemove": this.passEventToSlider, - "dblclick": this.doubleClick, - "click": this.doubleClick - }); - - this.div.appendChild(div); - - this.startTop = parseInt(div.style.top); - this.div.appendChild(slider); - - this.map.events.register("zoomend", this, this.moveZoomBar); - - centered = centered.add(0, - this.zoomStopHeight * this.map.getNumZoomLevels()); - return centered; - }, - - /** - * Method: _removeZoomBar - */ - _removeZoomBar: function() { - this.sliderEvents.un({ - "mousedown": this.zoomBarDown, - "mousemove": this.zoomBarDrag, - "mouseup": this.zoomBarUp, - "dblclick": this.doubleClick, - "click": this.doubleClick - }); - this.sliderEvents.destroy(); - - this.divEvents.un({ - "mousedown": this.divClick, - "mousemove": this.passEventToSlider, - "dblclick": this.doubleClick, - "click": this.doubleClick - }); - this.divEvents.destroy(); - - this.div.removeChild(this.zoombarDiv); - this.zoombarDiv = null; - this.div.removeChild(this.slider); - this.slider = null; - - this.map.events.unregister("zoomend", this, this.moveZoomBar); - }, - - /** - * Method: passEventToSlider - * This function is used to pass events that happen on the div, or the map, - * through to the slider, which then does its moving thing. - * - * Parameters: - * evt - {} - */ - passEventToSlider:function(evt) { - this.sliderEvents.handleBrowserEvent(evt); - }, - - /** - * Method: divClick - * Picks up on clicks directly on the zoombar div - * and sets the zoom level appropriately. - */ - divClick: function (evt) { - if (!OpenLayers.Event.isLeftClick(evt)) { - return; - } - var y = evt.xy.y; - var top = OpenLayers.Util.pagePosition(evt.object)[1]; - var levels = (y - top)/this.zoomStopHeight; - if(!this.map.fractionalZoom) { - levels = Math.floor(levels); - } - var zoom = (this.map.getNumZoomLevels() - 1) - levels; - zoom = Math.min(Math.max(zoom, 0), this.map.getNumZoomLevels() - 1); - this.map.zoomTo(zoom); - OpenLayers.Event.stop(evt); - }, - - /* - * Method: zoomBarDown - * event listener for clicks on the slider - * - * Parameters: - * evt - {} - */ - zoomBarDown:function(evt) { - if (!OpenLayers.Event.isLeftClick(evt)) { - return; - } - this.map.events.on({ - "mousemove": this.passEventToSlider, - "mouseup": this.passEventToSlider, - scope: this - }); - this.mouseDragStart = evt.xy.clone(); - this.zoomStart = evt.xy.clone(); - this.div.style.cursor = "move"; - // reset the div offsets just in case the div moved - this.zoombarDiv.offsets = null; - OpenLayers.Event.stop(evt); - }, - - /* - * Method: zoomBarDrag - * This is what happens when a click has occurred, and the client is - * dragging. Here we must ensure that the slider doesn't go beyond the - * bottom/top of the zoombar div, as well as moving the slider to its new - * visual location - * - * Parameters: - * evt - {} - */ - zoomBarDrag:function(evt) { - if (this.mouseDragStart != null) { - var deltaY = this.mouseDragStart.y - evt.xy.y; - var offsets = OpenLayers.Util.pagePosition(this.zoombarDiv); - if ((evt.clientY - offsets[1]) > 0 && - (evt.clientY - offsets[1]) < parseInt(this.zoombarDiv.style.height) - 2) { - var newTop = parseInt(this.slider.style.top) - deltaY; - this.slider.style.top = newTop+"px"; - this.mouseDragStart = evt.xy.clone(); - } - OpenLayers.Event.stop(evt); - } - }, - - /* - * Method: zoomBarUp - * Perform cleanup when a mouseup event is received -- discover new zoom - * level and switch to it. - * - * Parameters: - * evt - {} - */ - zoomBarUp:function(evt) { - if (!OpenLayers.Event.isLeftClick(evt)) { - return; - } - if (this.zoomStart) { - this.div.style.cursor=""; - this.map.events.un({ - "mouseup": this.passEventToSlider, - "mousemove": this.passEventToSlider, - scope: this - }); - var deltaY = this.zoomStart.y - evt.xy.y; - var zoomLevel = this.map.zoom; - if (this.map.fractionalZoom) { - zoomLevel += deltaY/this.zoomStopHeight; - zoomLevel = Math.min(Math.max(zoomLevel, 0), - this.map.getNumZoomLevels() - 1); - } else { - zoomLevel += Math.round(deltaY/this.zoomStopHeight); - } - this.map.zoomTo(zoomLevel); - this.moveZoomBar(); - this.mouseDragStart = null; - OpenLayers.Event.stop(evt); - } - }, - - /* - * Method: moveZoomBar - * Change the location of the slider to match the current zoom level. - */ - moveZoomBar:function() { - var newTop = - ((this.map.getNumZoomLevels()-1) - this.map.getZoom()) * - this.zoomStopHeight + this.startTop + 1; - this.slider.style.top = newTop + "px"; - }, - - CLASS_NAME: "OpenLayers.Control.PanZoomBar" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/Panel.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/Panel.js deleted file mode 100755 index a6045a3139..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/Panel.js +++ /dev/null @@ -1,286 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Control.js - */ - -/** - * Class: OpenLayers.Control.Panel - * The Panel control is a container for other controls. With it toolbars - * may be composed. - * - * Inherits from: - * - - */ -OpenLayers.Control.Panel = OpenLayers.Class(OpenLayers.Control, { - /** - * Property: controls - * {Array()} - */ - controls: null, - - /** - * APIProperty: defaultControl - * {} The control which is activated when the control is - * activated (turned on), which also happens at instantiation. - */ - defaultControl: null, - - /** - * Constructor: OpenLayers.Control.Panel - * Create a new control panel. - * - * Parameters: - * options - {Object} An optional object whose properties will be used - * to extend the control. - */ - initialize: function(options) { - OpenLayers.Control.prototype.initialize.apply(this, [options]); - this.controls = []; - }, - - /** - * APIMethod: destroy - */ - destroy: function() { - OpenLayers.Control.prototype.destroy.apply(this, arguments); - for(var i = this.controls.length - 1 ; i >= 0; i--) { - if(this.controls[i].events) { - this.controls[i].events.un({ - "activate": this.redraw, - "deactivate": this.redraw, - scope: this - }); - } - OpenLayers.Event.stopObservingElement(this.controls[i].panel_div); - this.controls[i].panel_div = null; - } - }, - - /** - * APIMethod: activate - */ - activate: function() { - if (OpenLayers.Control.prototype.activate.apply(this, arguments)) { - for(var i=0, len=this.controls.length; i} - */ - activateControl: function (control) { - if (!this.active) { return false; } - if (control.type == OpenLayers.Control.TYPE_BUTTON) { - control.trigger(); - this.redraw(); - return; - } - if (control.type == OpenLayers.Control.TYPE_TOGGLE) { - if (control.active) { - control.deactivate(); - } else { - control.activate(); - } - this.redraw(); - return; - } - for (var i=0, len=this.controls.length; i} - */ - addControls: function(controls) { - if (!(controls instanceof Array)) { - controls = [controls]; - } - this.controls = this.controls.concat(controls); - - // Give each control a panel_div which will be used later. - // Access to this div is via the panel_div attribute of the - // control added to the panel. - // Also, stop mousedowns and clicks, but don't stop mouseup, - // since they need to pass through. - for (var i=0, len=controls.length; i)} A list of controls matching the given criteria. - * An empty array is returned if no matches are found. - */ - getControlsBy: function(property, match) { - var test = (typeof match.test == "function"); - var found = OpenLayers.Array.filter(this.controls, function(item) { - return item[property] == match || (test && match.test(item[property])); - }); - return found; - }, - - /** - * APIMethod: getControlsByName - * Get a list of contorls with names matching the given name. - * - * Parameter: - * match - {String | Object} A control name. The name can also be a regular - * expression literal or object. In addition, it can be any object - * with a method named test. For reqular expressions or other, if - * name.test(control.name) evaluates to true, the control will be included - * in the list of controls returned. If no controls are found, an empty - * array is returned. - * - * Returns: - * {Array()} A list of controls matching the given name. - * An empty array is returned if no matches are found. - */ - getControlsByName: function(match) { - return this.getControlsBy("name", match); - }, - - /** - * APIMethod: getControlsByClass - * Get a list of controls of a given type (CLASS_NAME). - * - * Parameter: - * match - {String | Object} A control class name. The type can also be a - * regular expression literal or object. In addition, it can be any - * object with a method named test. For reqular expressions or other, - * if type.test(control.CLASS_NAME) evaluates to true, the control will - * be included in the list of controls returned. If no controls are - * found, an empty array is returned. - * - * Returns: - * {Array()} A list of controls matching the given type. - * An empty array is returned if no matches are found. - */ - getControlsByClass: function(match) { - return this.getControlsBy("CLASS_NAME", match); - }, - - CLASS_NAME: "OpenLayers.Control.Panel" -}); - diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/Permalink.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/Permalink.js deleted file mode 100755 index b5c77e49bb..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/Permalink.js +++ /dev/null @@ -1,219 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - - -/** - * @requires OpenLayers/Control.js - * @requires OpenLayers/Control/ArgParser.js - */ - -/** - * Class: OpenLayers.Control.Permalink - * The Permalink control is hyperlink that will return the user to the - * current map view. By default it is drawn in the lower right corner of the - * map. The href is updated as the map is zoomed, panned and whilst layers - * are switched. - * ` - * Inherits from: - * - - */ -OpenLayers.Control.Permalink = OpenLayers.Class(OpenLayers.Control, { - - /** - * APIProperty: argParserClass - * {Class} The ArgParser control class (not instance) to use with this - * control. - */ - argParserClass: OpenLayers.Control.ArgParser, - - /** - * Property: element - * {DOMElement} - */ - element: null, - - /** - * APIProperty: base - * {String} - */ - base: '', - - /** - * APIProperty: displayProjection - * {} Requires proj4js support. Projection used - * when creating the coordinates in the link. This will reproject the - * map coordinates into display coordinates. If you are using this - * functionality, the permalink which is last added to the map will - * determine the coordinate type which is read from the URL, which - * means you should not add permalinks with different - * displayProjections to the same map. - */ - displayProjection: null, - - /** - * Constructor: OpenLayers.Control.Permalink - * - * Parameters: - * element - {DOMElement} - * base - {String} - * options - {Object} options to the control. - */ - initialize: function(element, base, options) { - OpenLayers.Control.prototype.initialize.apply(this, [options]); - this.element = OpenLayers.Util.getElement(element); - this.base = base || document.location.href; - }, - - /** - * APIMethod: destroy - */ - destroy: function() { - if (this.element.parentNode == this.div) { - this.div.removeChild(this.element); - } - this.element = null; - - this.map.events.unregister('moveend', this, this.updateLink); - - OpenLayers.Control.prototype.destroy.apply(this, arguments); - }, - - /** - * Method: setMap - * Set the map property for the control. - * - * Parameters: - * map - {} - */ - setMap: function(map) { - OpenLayers.Control.prototype.setMap.apply(this, arguments); - - //make sure we have an arg parser attached - for(var i=0, len=this.map.controls.length; i} center to encode in the permalink. - * Defaults to the current map center. - * zoom - {Integer} zoom level to encode in the permalink. Defaults to the - * current map zoom level. - * layers - {Array()} layers to encode in the permalink. - * Defaults to the current map layers. - * - * Returns: - * {Object} Hash of parameters that will be url-encoded into the - * permalink. - */ - createParams: function(center, zoom, layers) { - center = center || this.map.getCenter(); - - var params = OpenLayers.Util.getParameters(this.base); - - // If there's still no center, map is not initialized yet. - // Break out of this function, and simply return the params from the - // base link. - if (center) { - - //zoom - params.zoom = zoom || this.map.getZoom(); - - //lon,lat - var lat = center.lat; - var lon = center.lon; - - if (this.displayProjection) { - var mapPosition = OpenLayers.Projection.transform( - { x: lon, y: lat }, - this.map.getProjectionObject(), - this.displayProjection ); - lon = mapPosition.x; - lat = mapPosition.y; - } - params.lat = Math.round(lat*100000)/100000; - params.lon = Math.round(lon*100000)/100000; - - //layers - layers = layers || this.map.layers; - params.layers = ''; - for (var i=0, len=layers.length; i - */ -OpenLayers.Control.Scale = OpenLayers.Class(OpenLayers.Control, { - - /** - * Parameter: element - * {DOMElement} - */ - element: null, - - /** - * Constructor: OpenLayers.Control.Scale - * - * Parameters: - * element - {DOMElement} - * options - {Object} - */ - initialize: function(element, options) { - OpenLayers.Control.prototype.initialize.apply(this, [options]); - this.element = OpenLayers.Util.getElement(element); - }, - - /** - * Method: draw - * - * Returns: - * {DOMElement} - */ - draw: function() { - OpenLayers.Control.prototype.draw.apply(this, arguments); - if (!this.element) { - this.element = document.createElement("div"); - this.div.appendChild(this.element); - } - this.map.events.register( 'moveend', this, this.updateScale); - this.updateScale(); - return this.div; - }, - - /** - * Method: updateScale - */ - updateScale: function() { - var scale = this.map.getScale(); - if (!scale) { - return; - } - - if (scale >= 9500 && scale <= 950000) { - scale = Math.round(scale / 1000) + "K"; - } else if (scale >= 950000) { - scale = Math.round(scale / 1000000) + "M"; - } else { - scale = Math.round(scale); - } - - this.element.innerHTML = OpenLayers.i18n("scale", {'scaleDenom':scale}); - }, - - CLASS_NAME: "OpenLayers.Control.Scale" -}); - diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/ScaleLine.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/ScaleLine.js deleted file mode 100755 index 432dd66b41..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/ScaleLine.js +++ /dev/null @@ -1,208 +0,0 @@ -/* Copyright (c) 2006-2007 MetaCarta, Inc., published under a modified BSD license. - * See http://svn.openlayers.org/trunk/openlayers/repository-license.txt - * for the full text of the license. */ - -/** - * @requires OpenLayers/Control.js - */ - -/** - * Class: OpenLayers.Control.ScaleLine - * The ScaleLine displays a small line indicator representing the current - * map scale on the map. By default it is drawn in the lower left corner of - * the map. - * - * Inherits from: - * - - * - * Is a very close copy of: - * - - */ -OpenLayers.Control.ScaleLine = OpenLayers.Class(OpenLayers.Control, { - - /** - * Property: maxWidth - * {Integer} Maximum width of the scale line in pixels. Default is 100. - */ - maxWidth: 100, - - /** - * Property: topOutUnits - * {String} Units for zoomed out on top bar. Default is km. - */ - topOutUnits: "km", - - /** - * Property: topInUnits - * {String} Units for zoomed in on top bar. Default is m. - */ - topInUnits: "m", - - /** - * Property: bottomOutUnits - * {String} Units for zoomed out on bottom bar. Default is mi. - */ - bottomOutUnits: "mi", - - /** - * Property: bottomInUnits - * {String} Units for zoomed in on bottom bar. Default is ft. - */ - bottomInUnits: "ft", - - /** - * Property: eTop - * {DOMElement} - */ - eTop: null, - - /** - * Property: eBottom - * {DOMElement} - */ - eBottom:null, - - /** - * Constructor: OpenLayers.Control.ScaleLine - * Create a new scale line control. - * - * Parameters: - * options - {Object} An optional object whose properties will be used - * to extend the control. - */ - initialize: function(options) { - OpenLayers.Control.prototype.initialize.apply(this, [options]); - }, - - /** - * Method: draw - * - * Returns: - * {DOMElement} - */ - draw: function() { - OpenLayers.Control.prototype.draw.apply(this, arguments); - if (!this.eTop) { - this.div.style.display = "block"; - this.div.style.position = "absolute"; - - // stick in the top bar - this.eTop = document.createElement("div"); - this.eTop.className = this.displayClass + "Top"; - var theLen = this.topInUnits.length; - this.div.appendChild(this.eTop); - if((this.topOutUnits == "") || (this.topInUnits == "")) { - this.eTop.style.visibility = "hidden"; - } else { - this.eTop.style.visibility = "visible"; - } - - // and the bottom bar - this.eBottom = document.createElement("div"); - this.eBottom.className = this.displayClass + "Bottom"; - this.div.appendChild(this.eBottom); - if((this.bottomOutUnits == "") || (this.bottomInUnits == "")) { - this.eBottom.style.visibility = "hidden"; - } else { - this.eBottom.style.visibility = "visible"; - } - } - this.map.events.register('moveend', this, this.update); - this.update(); - return this.div; - }, - - /** - * Method: getBarLen - * Given a number, round it down to the nearest 1,2,5 times a power of 10. - * That seems a fairly useful set of number groups to use. - * - * Parameters: - * maxLen - {float} the number we're rounding down from - * - * Returns: - * {Float} the rounded number (less than or equal to maxLen) - */ - getBarLen: function(maxLen) { - // nearest power of 10 lower than maxLen - var digits = parseInt(Math.log(maxLen) / Math.log(10)); - var pow10 = Math.pow(10, digits); - - // ok, find first character - var firstChar = parseInt(maxLen / pow10); - - // right, put it into the correct bracket - var barLen; - if(firstChar > 5) { - barLen = 5; - } else if(firstChar > 2) { - barLen = 2; - } else { - barLen = 1; - } - - // scale it up the correct power of 10 - return barLen * pow10; - }, - - /** - * Method: update - * Update the size of the bars, and the labels they contain. - */ - update: function() { - var res = this.map.getResolution(); - if (!res) { - return; - } - - var curMapUnits = this.map.getUnits(); - var inches = OpenLayers.INCHES_PER_UNIT; - - // convert maxWidth to map units - var maxSizeData = this.maxWidth * res * inches[curMapUnits]; - - // decide whether to use large or small scale units - var topUnits; - var bottomUnits; - if(maxSizeData > 100000) { - topUnits = this.topOutUnits; - bottomUnits = this.bottomOutUnits; - } else { - topUnits = this.topInUnits; - bottomUnits = this.bottomInUnits; - } - - // and to map units units - var topMax = maxSizeData / inches[topUnits]; - var bottomMax = maxSizeData / inches[bottomUnits]; - - // now trim this down to useful block length - var topRounded = this.getBarLen(topMax); - var bottomRounded = this.getBarLen(bottomMax); - - // and back to display units - topMax = topRounded / inches[curMapUnits] * inches[topUnits]; - bottomMax = bottomRounded / inches[curMapUnits] * inches[bottomUnits]; - - // and to pixel units - var topPx = topMax / res; - var bottomPx = bottomMax / res; - - // now set the pixel widths - // and the values inside them - - if (this.eBottom.style.visibility == "visible"){ - this.eBottom.style.width = Math.round(bottomPx) + "px"; - this.eBottom.innerHTML = bottomRounded + " " + bottomUnits ; - } - - if (this.eTop.style.visibility == "visible"){ - this.eTop.style.width = Math.round(topPx) + "px"; - this.eTop.innerHTML = topRounded + " " + topUnits; - } - - }, - - CLASS_NAME: "OpenLayers.Control.ScaleLine" -}); - diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/SelectFeature.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/SelectFeature.js deleted file mode 100755 index d0772df9f8..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/SelectFeature.js +++ /dev/null @@ -1,562 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - - -/** - * @requires OpenLayers/Control.js - * @requires OpenLayers/Feature/Vector.js - * @requires OpenLayers/Handler/Feature.js - * @requires OpenLayers/Layer/Vector/RootContainer.js - */ - -/** - * Class: OpenLayers.Control.SelectFeature - * The SelectFeature control selects vector features from a given layer on - * click or hover. - * - * Inherits from: - * - - */ -OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, { - - /** - * Constant: EVENT_TYPES - * - * Supported event types: - * - *beforefeaturehighlighted* Triggered before a feature is highlighted - * - *featurehighlighted* Triggered when a feature is highlighted - * - *featureunhighlighted* Triggered when a feature is unhighlighted - */ - EVENT_TYPES: ["beforefeaturehighlighted", "featurehighlighted", "featureunhighlighted"], - - /** - * Property: multipleKey - * {String} An event modifier ('altKey' or 'shiftKey') that temporarily sets - * the property to true. Default is null. - */ - multipleKey: null, - - /** - * Property: toggleKey - * {String} An event modifier ('altKey' or 'shiftKey') that temporarily sets - * the property to true. Default is null. - */ - toggleKey: null, - - /** - * APIProperty: multiple - * {Boolean} Allow selection of multiple geometries. Default is false. - */ - multiple: false, - - /** - * APIProperty: clickout - * {Boolean} Unselect features when clicking outside any feature. - * Default is true. - */ - clickout: true, - - /** - * APIProperty: toggle - * {Boolean} Unselect a selected feature on click. Default is false. Only - * has meaning if hover is false. - */ - toggle: false, - - /** - * APIProperty: hover - * {Boolean} Select on mouse over and deselect on mouse out. If true, this - * ignores clicks and only listens to mouse moves. - */ - hover: false, - - /** - * APIProperty: highlightOnly - * {Boolean} If true do not actually select features (i.e. place them in the - * layer's selected features array), just highlight them. This property has - * no effect if hover is false. Defaults to false. - */ - highlightOnly: false, - - /** - * APIProperty: box - * {Boolean} Allow feature selection by drawing a box. - */ - box: false, - - /** - * Property: onBeforeSelect - * {Function} Optional function to be called before a feature is selected. - * The function should expect to be called with a feature. - */ - onBeforeSelect: function() {}, - - /** - * APIProperty: onSelect - * {Function} Optional function to be called when a feature is selected. - * The function should expect to be called with a feature. - */ - onSelect: function() {}, - - /** - * APIProperty: onUnselect - * {Function} Optional function to be called when a feature is unselected. - * The function should expect to be called with a feature. - */ - onUnselect: function() {}, - - /** - * Property: scope - * {Object} The scope to use with the onBeforeSelect, onSelect, onUnselect - * callbacks. If null the scope will be this control. - */ - scope: null, - - /** - * APIProperty: geometryTypes - * {Array(String)} To restrict selecting to a limited set of geometry types, - * send a list of strings corresponding to the geometry class names. - */ - geometryTypes: null, - - /** - * Property: layer - * {} The vector layer with a common renderer - * root for all layers this control is configured with (if an array of - * layers was passed to the constructor), or the vector layer the control - * was configured with (if a single layer was passed to the constructor). - */ - layer: null, - - /** - * Property: layers - * {Array(} The layers this control will work on, - * or null if the control was configured with a single layer - */ - layers: null, - - /** - * APIProperty: callbacks - * {Object} The functions that are sent to the handlers.feature for callback - */ - callbacks: null, - - /** - * APIProperty: selectStyle - * {Object} Hash of styles - */ - selectStyle: null, - - /** - * Property: renderIntent - * {String} key used to retrieve the select style from the layer's - * style map. - */ - renderIntent: "select", - - /** - * Property: handlers - * {Object} Object with references to multiple - * instances. - */ - handlers: null, - - /** - * Constructor: OpenLayers.Control.SelectFeature - * Create a new control for selecting features. - * - * Parameters: - * layers - {}, or an array of vector layers. The - * layer(s) this control will select features from. - * options - {Object} - */ - initialize: function(layers, options) { - // concatenate events specific to this control with those from the base - this.EVENT_TYPES = - OpenLayers.Control.SelectFeature.prototype.EVENT_TYPES.concat( - OpenLayers.Control.prototype.EVENT_TYPES - ); - OpenLayers.Control.prototype.initialize.apply(this, [options]); - - if(this.scope === null) { - this.scope = this; - } - if(layers instanceof Array) { - this.layers = layers; - this.layer = new OpenLayers.Layer.Vector.RootContainer( - this.id + "_container", { - layers: layers - } - ); - } else { - this.layer = layers; - } - var callbacks = { - click: this.clickFeature, - clickout: this.clickoutFeature - }; - if (this.hover) { - callbacks.over = this.overFeature; - callbacks.out = this.outFeature; - } - - this.callbacks = OpenLayers.Util.extend(callbacks, this.callbacks); - this.handlers = { - feature: new OpenLayers.Handler.Feature( - this, this.layer, this.callbacks, - {geometryTypes: this.geometryTypes} - ) - }; - - if (this.box) { - this.handlers.box = new OpenLayers.Handler.Box( - this, {done: this.selectBox}, - {boxDivClassName: "olHandlerBoxSelectFeature"} - ); - } - }, - - /** - * Method: destroy - */ - destroy: function() { - OpenLayers.Control.prototype.destroy.apply(this, arguments); - if(this.layers) { - this.layer.destroy(); - } - }, - - /** - * Method: activate - * Activates the control. - * - * Returns: - * {Boolean} The control was effectively activated. - */ - activate: function () { - if (!this.active) { - if(this.layers) { - this.map.addLayer(this.layer); - } - this.handlers.feature.activate(); - if(this.box && this.handlers.box) { - this.handlers.box.activate(); - } - } - return OpenLayers.Control.prototype.activate.apply( - this, arguments - ); - }, - - /** - * Method: deactivate - * Deactivates the control. - * - * Returns: - * {Boolean} The control was effectively deactivated. - */ - deactivate: function () { - if (this.active) { - this.handlers.feature.deactivate(); - if(this.handlers.box) { - this.handlers.box.deactivate(); - } - if(this.layers) { - this.map.removeLayer(this.layer); - } - } - return OpenLayers.Control.prototype.deactivate.apply( - this, arguments - ); - }, - - /** - * Method: unselectAll - * Unselect all selected features. To unselect all except for a single - * feature, set the options.except property to the feature. - * - * Parameters: - * options - {Object} Optional configuration object. - */ - unselectAll: function(options) { - // we'll want an option to supress notification here - var layers = this.layers || [this.layer]; - var layer, feature; - for(var l=0; l=0; --i) { - feature = layer.selectedFeatures[i]; - if(!options || options.except != feature) { - this.unselect(feature); - } - } - } - }, - - /** - * Method: clickFeature - * Called on click in a feature - * Only responds if this.hover is false. - * - * Parameters: - * feature - {} - */ - clickFeature: function(feature) { - if(!this.hover) { - var selected = (OpenLayers.Util.indexOf( - feature.layer.selectedFeatures, feature) > -1); - if(selected) { - if(this.toggleSelect()) { - this.unselect(feature); - } else if(!this.multipleSelect()) { - this.unselectAll({except: feature}); - } - } else { - if(!this.multipleSelect()) { - this.unselectAll({except: feature}); - } - this.select(feature); - } - } - }, - - /** - * Method: multipleSelect - * Allow for multiple selected features based on property and - * event modifier. - * - * Returns: - * {Boolean} Allow for multiple selected features. - */ - multipleSelect: function() { - return this.multiple || (this.handlers.feature.evt && - this.handlers.feature.evt[this.multipleKey]); - }, - - /** - * Method: toggleSelect - * Event should toggle the selected state of a feature based on - * property and event modifier. - * - * Returns: - * {Boolean} Toggle the selected state of a feature. - */ - toggleSelect: function() { - return this.toggle || (this.handlers.feature.evt && - this.handlers.feature.evt[this.toggleKey]); - }, - - /** - * Method: clickoutFeature - * Called on click outside a previously clicked (selected) feature. - * Only responds if this.hover is false. - * - * Parameters: - * feature - {} - */ - clickoutFeature: function(feature) { - if(!this.hover && this.clickout) { - this.unselectAll(); - } - }, - - /** - * Method: overFeature - * Called on over a feature. - * Only responds if this.hover is true. - * - * Parameters: - * feature - {} - */ - overFeature: function(feature) { - var layer = feature.layer; - if(this.hover) { - if(this.highlightOnly) { - this.highlight(feature); - } else if(OpenLayers.Util.indexOf( - layer.selectedFeatures, feature) == -1) { - this.select(feature); - } - } - }, - - /** - * Method: outFeature - * Called on out of a selected feature. - * Only responds if this.hover is true. - * - * Parameters: - * feature - {} - */ - outFeature: function(feature) { - if(this.hover) { - if(this.highlightOnly) { - // we do nothing if we're not the last highlighter of the - // feature - if(feature._lastHighlighter == this.id) { - // if another select control had highlighted the feature before - // we did it ourself then we use that control to highlight the - // feature as it was before we highlighted it, else we just - // unhighlight it - if(feature._prevHighlighter && - feature._prevHighlighter != this.id) { - delete feature._lastHighlighter; - var control = this.map.getControl( - feature._prevHighlighter); - if(control) { - control.highlight(feature); - } - } else { - this.unhighlight(feature); - } - } - } else { - this.unselect(feature); - } - } - }, - - /** - * Method: highlight - * Redraw feature with the select style. - * - * Parameters: - * feature - {} - */ - highlight: function(feature) { - var layer = feature.layer; - var cont = this.events.triggerEvent("beforefeaturehighlighted", { - feature : feature - }); - if(cont !== false) { - feature._prevHighlighter = feature._lastHighlighter; - feature._lastHighlighter = this.id; - var style = this.selectStyle || this.renderIntent; - layer.drawFeature(feature, style); - this.events.triggerEvent("featurehighlighted", {feature : feature}); - } - }, - - /** - * Method: unhighlight - * Redraw feature with the "default" style - * - * Parameters: - * feature - {} - */ - unhighlight: function(feature) { - var layer = feature.layer; - feature._lastHighlighter = feature._prevHighlighter; - delete feature._prevHighlighter; - layer.drawFeature(feature, feature.style || feature.layer.style || - "default"); - this.events.triggerEvent("featureunhighlighted", {feature : feature}); - }, - - /** - * Method: select - * Add feature to the layer's selectedFeature array, render the feature as - * selected, and call the onSelect function. - * - * Parameters: - * feature - {} - */ - select: function(feature) { - var cont = this.onBeforeSelect.call(this.scope, feature); - var layer = feature.layer; - if(cont !== false) { - cont = layer.events.triggerEvent("beforefeatureselected", { - feature: feature - }); - if(cont !== false) { - layer.selectedFeatures.push(feature); - this.highlight(feature); - layer.events.triggerEvent("featureselected", {feature: feature}); - this.onSelect.call(this.scope, feature); - } - } - }, - - /** - * Method: unselect - * Remove feature from the layer's selectedFeature array, render the feature as - * normal, and call the onUnselect function. - * - * Parameters: - * feature - {} - */ - unselect: function(feature) { - var layer = feature.layer; - // Store feature style for restoration later - this.unhighlight(feature); - OpenLayers.Util.removeItem(layer.selectedFeatures, feature); - layer.events.triggerEvent("featureunselected", {feature: feature}); - this.onUnselect.call(this.scope, feature); - }, - - /** - * Method: selectBox - * Callback from the handlers.box set up when selection is true - * on. - * - * Parameters: - * position - { || } - */ - selectBox: function(position) { - if (position instanceof OpenLayers.Bounds) { - var minXY = this.map.getLonLatFromPixel( - new OpenLayers.Pixel(position.left, position.bottom) - ); - var maxXY = this.map.getLonLatFromPixel( - new OpenLayers.Pixel(position.right, position.top) - ); - var bounds = new OpenLayers.Bounds( - minXY.lon, minXY.lat, maxXY.lon, maxXY.lat - ); - - // if multiple is false, first deselect currently selected features - if (!this.multipleSelect()) { - this.unselectAll(); - } - - // because we're using a box, we consider we want multiple selection - var prevMultiple = this.multiple; - this.multiple = true; - var layers = this.layers || [this.layer]; - var layer; - for(var l=0; l -1) { - if (bounds.toGeometry().intersects(feature.geometry)) { - if (OpenLayers.Util.indexOf(layer.selectedFeatures, feature) == -1) { - this.select(feature); - } - } - } - } - } - this.multiple = prevMultiple; - } - }, - - /** - * Method: setMap - * Set the map property for the control. - * - * Parameters: - * map - {} - */ - setMap: function(map) { - this.handlers.feature.setMap(map); - if (this.box) { - this.handlers.box.setMap(map); - } - OpenLayers.Control.prototype.setMap.apply(this, arguments); - }, - - CLASS_NAME: "OpenLayers.Control.SelectFeature" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/Snapping.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/Snapping.js deleted file mode 100755 index 98307d902d..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/Snapping.js +++ /dev/null @@ -1,546 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Control.js - * @requires OpenLayers/Layer/Vector.js - */ - -/** - * Class: OpenLayers.Control.Snapping - * Acts as a snapping agent while editing vector features. - * - * Inherits from: - * - - */ -OpenLayers.Control.Snapping = OpenLayers.Class(OpenLayers.Control, { - - /** - * Constant: EVENT_TYPES - * {Array(String)} Supported application event types. Register a listener - * for a particular event with the following syntax: - * (code) - * control.events.register(type, obj, listener); - * (end) - * - * Listeners will be called with a reference to an event object. The - * properties of this event depends on exactly what happened. - * - * Supported control event types (in addition to those from ): - * beforesnap - Triggered before a snap occurs. Listeners receive an - * event object with *point*, *x*, *y*, *distance*, *layer*, and - * *snapType* properties. The point property will be original point - * geometry considered for snapping. The x and y properties represent - * coordinates the point will receive. The distance is the distance - * of the snap. The layer is the target layer. The snapType property - * will be one of "node", "vertex", or "edge". Return false to stop - * snapping from occurring. - * snap - Triggered when a snap occurs. Listeners receive an event with - * *point*, *snapType*, *layer*, and *distance* properties. The point - * will be the location snapped to. The snapType will be one of "node", - * "vertex", or "edge". The layer will be the target layer. The - * distance will be the distance of the snap in map units. - * unsnap - Triggered when a vertex is unsnapped. Listeners receive an - * event with a *point* property. - */ - EVENT_TYPES: ["beforesnap", "snap", "unsnap"], - - /** - * CONSTANT: DEFAULTS - * Default target properties. - */ - DEFAULTS: { - tolerance: 10, - node: true, - edge: true, - vertex: true - }, - - /** - * Property: greedy - * {Boolean} Snap to closest feature in first layer with an eligible - * feature. Default is true. - */ - greedy: true, - - /** - * Property: precedence - * {Array} List representing precedence of different snapping types. - * Default is "node", "vertex", "edge". - */ - precedence: ["node", "vertex", "edge"], - - /** - * Property: resolution - * {Float} The map resolution for the previously considered snap. - */ - resolution: null, - - /** - * Property: geoToleranceCache - * {Object} A cache of geo-tolerances. Tolerance values (in map units) are - * calculated when the map resolution changes. - */ - geoToleranceCache: null, - - /** - * Property: layer - * {} The current editable layer. Set at - * construction or after construction with . - */ - layer: null, - - /** - * Property: feature - * {} The current editable feature. - */ - feature: null, - - /** - * Property: point - * {} The currently snapped vertex. - */ - point: null, - - /** - * Constructor: OpenLayers.Control.Snapping - * Creates a new snapping control. A control is constructed with an editable - * layer and a set of configuration objects for target layers. While the - * control is active, dragging vertices while drawing new features or - * modifying existing features on the editable layer will engage - * snapping to features on the target layers. Whether a vertex snaps to - * a feature on a target layer depends on the target layer configuration. - * - * Parameters: - * options - {Object} An object containing all configuration properties for - * the control. - * - * Valid options: - * layer - {OpenLayers.Layer.Vector} The editable layer. Features from this - * layer that are digitized or modified may have vertices snapped to - * features from any of the target layers. - * targets - {Array(Object | OpenLayers.Layer.Vector)} A list of objects for - * configuring target layers. See valid properties of the target - * objects below. If the items in the targets list are vector layers - * (instead of configuration objects), the defaults from the - * property will apply. The editable layer itself may be a target - * layer - allowing newly created or edited features to be snapped to - * existing features from the same layer. If no targets are provided - * the layer given in the constructor (as ) will become the - * initial target. - * defaults - {Object} An object with default properties to be applied - * to all target objects. - * greedy - {Boolean} Snap to closest feature in first target layer that - * applies. Default is true. If false, all features in all target - * layers will be checked and the closest feature in all target layers - * will be chosen. The greedy property determines if the order of the - * target layers is significant. By default, the order of the target - * layers is significant where layers earlier in the target layer list - * have precedence over layers later in the list. Within a single - * layer, the closest feature is always chosen for snapping. This - * property only determines whether the search for a closer feature - * continues after an eligible feature is found in a target layer. - * - * Valid target properties: - * layer - {OpenLayers.Layer.Vector} A target layer. Features from this - * layer will be eligible to act as snapping target for the editable - * layer. - * tolerance - {Float} The distance (in pixels) at which snapping may occur. - * Default is 10. - * node - {Boolean} Snap to nodes (first or last point in a geometry) in - * target layer. Default is true. - * nodeTolerance - {Float} Optional distance at which snapping may occur - * for nodes specifically. If none is provided, will be - * used. - * vertex - {Boolean} Snap to vertices in target layer. Default is true. - * vertexTolerance - {Float} Optional distance at which snapping may occur - * for vertices specifically. If none is provided, will be - * used. - * edge - {Boolean} Snap to edges in target layer. Default is true. - * edgeTolerance - {Float} Optional distance at which snapping may occur - * for edges specifically. If none is provided, will be - * used. - * filter - {OpenLayers.Filter} Optional filter to evaluate to determine if - * feature is eligible for snapping. If filter evaluates to true for a - * target feature a vertex may be snapped to the feature. - */ - initialize: function(options) { - // concatenate events specific to measure with those from the base - Array.prototype.push.apply( - this.EVENT_TYPES, OpenLayers.Control.prototype.EVENT_TYPES - ); - OpenLayers.Control.prototype.initialize.apply(this, [options]); - this.options = options || {}; // TODO: this could be done by the super - - // set the editable layer if provided - if(this.options.layer) { - this.setLayer(this.options.layer); - } - // configure target layers - var defaults = OpenLayers.Util.extend({}, this.options.defaults); - this.defaults = OpenLayers.Util.applyDefaults(defaults, this.DEFAULTS); - this.setTargets(this.options.targets); - if(this.targets.length === 0 && this.layer) { - this.addTargetLayer(this.layer); - } - - this.geoToleranceCache = {}; - }, - - /** - * APIMethod: setLayer - * Set the editable layer. Call the setLayer method if the editable layer - * changes and the same control should be used on a new editable layer. - * If the control is already active, it will be active after the new - * layer is set. - * - * Parameters: - * layer - {OpenLayers.Layer.Vector} The new editable layer. - */ - setLayer: function(layer) { - if(this.active) { - this.deactivate(); - this.layer = layer; - this.activate(); - } else { - this.layer = layer; - } - }, - - /** - * Method: setTargets - * Set the targets for the snapping agent. - * - * Parameters: - * targets - {Array} An array of target configs or target layers. - */ - setTargets: function(targets) { - this.targets = []; - if(targets && targets.length) { - var target; - for(var i=0, len=targets.length; i} A target layer. - */ - addTargetLayer: function(layer) { - this.addTarget({layer: layer}); - }, - - /** - * Method: addTarget - * Add a configured target layer. - * - * Parameters: - * target - {Object} A target config. - */ - addTarget: function(target) { - target = OpenLayers.Util.applyDefaults(target, this.defaults); - target.nodeTolerance = target.nodeTolerance || target.tolerance; - target.vertexTolerance = target.vertexTolerance || target.tolerance; - target.edgeTolerance = target.edgeTolerance || target.tolerance; - this.targets.push(target); - }, - - /** - * Method: removeTargetLayer - * Remove a target layer. - * - * Parameters: - * layer - {} The target layer to remove. - */ - removeTargetLayer: function(layer) { - var target; - for(var i=this.targets.length-1; i>=0; --i) { - target = this.targets[i]; - if(target.layer === layer) { - this.removeTarget(target); - } - } - }, - - /** - * Method: removeTarget - * Remove a target. - * - * Parameters: - * target - {Object} A target config. - * - * Returns: - * {Array} The targets array. - */ - removeTarget: function(target) { - return OpenLayers.Util.removeItem(this.targets, target); - }, - - /** - * APIMethod: activate - * Activate the control. Activating the control registers listeners for - * editing related events so that during feature creation and - * modification, moving vertices will trigger snapping. - */ - activate: function() { - var activated = OpenLayers.Control.prototype.activate.call(this); - if(activated) { - if(this.layer && this.layer.events) { - this.layer.events.on({ - sketchstarted: this.onSketchModified, - sketchmodified: this.onSketchModified, - vertexmodified: this.onVertexModified, - scope: this - }); - } - } - return activated; - }, - - /** - * APIMethod: deactivate - * Deactivate the control. Deactivating the control unregisters listeners - * so feature editing may proceed without engaging the snapping agent. - */ - deactivate: function() { - var deactivated = OpenLayers.Control.prototype.deactivate.call(this); - if(deactivated) { - if(this.layer && this.layer.events) { - this.layer.events.un({ - sketchstarted: this.onSketchModified, - sketchmodified: this.onSketchModified, - vertexmodified: this.onVertexModified, - scope: this - }); - } - } - this.feature = null; - this.point = null; - return deactivated; - }, - - /** - * Method: onSketchModified - * Registered as a listener for the sketchmodified event on the editable - * layer. - * - * Parameters: - * event - {Object} The sketch modified event. - */ - onSketchModified: function(event) { - this.feature = event.feature; - this.considerSnapping(event.vertex, event.vertex); - }, - - /** - * Method: onVertexModified - * Registered as a listener for the vertexmodified event on the editable - * layer. - * - * Parameters: - * event - {Object} The vertex modified event. - */ - onVertexModified: function(event) { - this.feature = event.feature; - var loc = this.layer.map.getLonLatFromViewPortPx(event.pixel); - this.considerSnapping( - event.vertex, new OpenLayers.Geometry.Point(loc.lon, loc.lat) - ); - }, - - /** - * Method: considerSnapping - * - * Parameters: - * point - {} The location of the mouse in map - * coords. - */ - considerSnapping: function(point, loc) { - var best = { - rank: Number.POSITIVE_INFINITY, - dist: Number.POSITIVE_INFINITY, - x: null, y: null - }; - var snapped = false; - var result, target; - for(var i=0, len=this.targets.length; i} The location of the mouse in map - * coords. - * - * Returns: - * {Object} A result object with rank, dist, x, and y properties. - * Returns null if candidate is not eligible for snapping. - */ - testTarget: function(target, loc) { - var tolerance = { - node: this.getGeoTolerance(target.nodeTolerance), - vertex: this.getGeoTolerance(target.vertexTolerance), - edge: this.getGeoTolerance(target.edgeTolerance) - }; - // this could be cached if we don't support setting tolerance values directly - var maxTolerance = Math.max( - tolerance.node, tolerance.vertex, tolerance.edge - ); - var result = { - rank: Number.POSITIVE_INFINITY, dist: Number.POSITIVE_INFINITY - }; - var eligible = false; - var features = target.layer.features; - var feature, type, vertices, vertex, closest, dist, found; - var numTypes = this.precedence.length; - var ll = new OpenLayers.LonLat(loc.x, loc.y); - for(var i=0, len=features.length; i when the map resolution - * has not changed. - * - * Parameters: - * tolerance - {Number} A tolerance value in pixels. - * - * Returns: - * {Number} A tolerance value in map units. - */ - getGeoTolerance: function(tolerance) { - var resolution = this.layer.map.getResolution(); - if(resolution !== this.resolution) { - this.resolution = resolution; - this.geoToleranceCache = {}; - } - var geoTolerance = this.geoToleranceCache[tolerance]; - if(geoTolerance === undefined) { - geoTolerance = tolerance * resolution; - this.geoToleranceCache[tolerance] = geoTolerance; - } - return geoTolerance; - }, - - /** - * Method: destroy - * Clean up the control. - */ - destroy: function() { - if(this.active) { - this.deactivate(); // TODO: this should be handled by the super - } - delete this.layer; - delete this.targets; - OpenLayers.Control.prototype.destroy.call(this); - }, - - CLASS_NAME: "OpenLayers.Control.Snapping" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/Split.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/Split.js deleted file mode 100755 index 2ccd9c4ae2..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/Split.js +++ /dev/null @@ -1,497 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Control.js - * @requires OpenLayers/Handler/Path.js - * @requires OpenLayers/Layer/Vector.js - */ - -/** - * Class: OpenLayers.Control.Split - * Acts as a split feature agent while editing vector features. - * - * Inherits from: - * - - */ -OpenLayers.Control.Split = OpenLayers.Class(OpenLayers.Control, { - - /** - * Constant: EVENT_TYPES - * {Array(String)} Supported application event types. Register a listener - * for a particular event with the following syntax: - * (code) - * control.events.register(type, obj, listener); - * (end) - * - * Listeners will be called with a reference to an event object. The - * properties of this event depends on exactly what happened. - * - * Supported control event types (in addition to those from ): - * beforesplit - Triggered before a split occurs. Listeners receive an - * event object with *source* and *target* properties. - * split - Triggered when a split occurs. Listeners receive an event with - * an *original* property and a *features* property. The original - * is a reference to the target feature that the sketch or modified - * feature intersects. The features property is a list of all features - * that result from this single split. This event is triggered before - * the resulting features are added to the layer (while the layer still - * has a reference to the original). - * aftersplit - Triggered after all splits resulting from a single sketch - * or feature modification have occurred. The original features - * have been destroyed and features that result from the split - * have already been added to the layer. Listeners receive an event - * with a *source* and *features* property. The source references the - * sketch or modified feature used as a splitter. The features - * property is a list of all resulting features. - */ - EVENT_TYPES: ["beforesplit", "split", "aftersplit"], - - /** - * APIProperty: layer - * {} The target layer with features to be split. - * Set at construction or after construction with . - */ - layer: null, - - /** - * Property: source - * {} Optional source layer. Any newly created - * or modified features from this layer will be used to split features - * on the target layer. If not provided, a temporary sketch layer will - * be created. - */ - source: null, - - /** - * Property: sourceOptions - * {Options} If a temporary sketch layer is created, these layer options - * will be applied. - */ - sourceOptions: null, - - /** - * APIProperty: tolerance - * {Number} Distance between the calculated intersection and a vertex on - * the source geometry below which the existing vertex will be used - * for the split. Default is null. - */ - tolerance: null, - - /** - * APIProperty: edge - * {Boolean} Allow splits given intersection of edges only. Default is - * true. If false, a vertex on the source must be within the - * distance of the calculated intersection for a split - * to occur. - */ - edge: true, - - /** - * APIProperty: deferDelete - * {Boolean} Instead of removing features from the layer, set feature - * states of split features to DELETE. This assumes a save strategy - * or other component is in charge of removing features from the - * layer. Default is false. If false, split features will be - * immediately deleted from the layer. - */ - deferDelete: false, - - /** - * APIProperty: mutual - * {Boolean} If source and target layers are the same, split source - * features and target features where they intersect. Default is - * true. If false, only target features will be split. - */ - mutual: true, - - /** - * APIProperty: targetFilter - * {OpenLayers.Filter} Optional filter that will be evaluated - * to determine if a feature from the target layer is eligible for - * splitting. - */ - targetFilter: null, - - /** - * APIProperty: sourceFilter - * {OpenLayers.Filter} Optional filter that will be evaluated - * to determine if a feature from the target layer is eligible for - * splitting. - */ - sourceFilter: null, - - /** - * Property: handler - * {} The temporary sketch handler created if - * no source layer is provided. - */ - handler: null, - - /** - * Constructor: OpenLayers.Control.Split - * Creates a new split control. A control is constructed with a target - * layer and an optional source layer. While the control is active, - * creating new features or modifying existing features on the source - * layer will result in splitting any eligible features on the target - * layer. If no source layer is provided, a temporary sketch layer will - * be created to create lines for splitting features on the target. - * - * Parameters: - * options - {Object} An object containing all configuration properties for - * the control. - * - * Valid options: - * layer - {OpenLayers.Layer.Vector} The target layer. Features from this - * layer will be split by new or modified features on the source layer - * or temporary sketch layer. - * source - {OpenLayers.Layer.Vector} Optional source layer. If provided - * newly created features or modified features will be used to split - * features on the target layer. If not provided, a temporary sketch - * layer will be created for drawing lines. - * tolerance - {Number} Optional value for the distance between a source - * vertex and the calculated intersection below which the split will - * occur at the vertex. - * edge - {Boolean} Allow splits given intersection of edges only. Default - * is true. If false, a vertex on the source must be within the - * distance of the calculated intersection for a split - * to occur. - * mutual - {Boolean} If source and target are the same, split source - * features and target features where they intersect. Default is - * true. If false, only target features will be split. - * targetFilter - {OpenLayers.Filter} Optional filter that will be evaluated - * to determine if a feature from the target layer is eligible for - * splitting. - * sourceFilter - {OpenLayers.Filter} Optional filter that will be evaluated - * to determine if a feature from the target layer is eligible for - * splitting. - */ - initialize: function(options) { - // concatenate events specific to measure with those from the base - Array.prototype.push.apply( - this.EVENT_TYPES, OpenLayers.Control.prototype.EVENT_TYPES - ); - OpenLayers.Control.prototype.initialize.apply(this, [options]); - this.options = options || {}; // TODO: this could be done by the super - - // set the source layer if provided - if(this.options.source) { - this.setSource(this.options.source); - } - }, - - /** - * APIMethod: setSource - * Set the source layer for edits layer. - * - * Parameters: - * layer - {OpenLayers.Layer.Vector} The new source layer layer. If - * null, a temporary sketch layer will be created. - */ - setSource: function(layer) { - if(this.active) { - this.deactivate(); - if(this.handler) { - this.handler.destroy(); - delete this.handler; - } - this.source = layer; - this.activate(); - } else { - this.source = layer; - } - }, - - /** - * APIMethod: activate - * Activate the control. Activating the control registers listeners for - * editing related events so that during feature creation and - * modification, features in the target will be considered for - * splitting. - */ - activate: function() { - var activated = OpenLayers.Control.prototype.activate.call(this); - if(activated) { - if(!this.source) { - if(!this.handler) { - this.handler = new OpenLayers.Handler.Path(this, - {done: function(geometry) { - this.onSketchComplete({ - feature: new OpenLayers.Feature.Vector(geometry) - }); - }}, - {layerOptions: this.sourceOptions} - ); - } - this.handler.activate(); - } else if(this.source.events) { - this.source.events.on({ - sketchcomplete: this.onSketchComplete, - afterfeaturemodified: this.afterFeatureModified, - scope: this - }); - } - } - return activated; - }, - - /** - * APIMethod: deactivate - * Deactivate the control. Deactivating the control unregisters listeners - * so feature editing may proceed without engaging the split agent. - */ - deactivate: function() { - var deactivated = OpenLayers.Control.prototype.deactivate.call(this); - if(deactivated) { - if(this.source && this.source.events) { - this.layer.events.un({ - sketchcomplete: this.onSketchComplete, - afterfeaturemodified: this.afterFeatureModified, - scope: this - }); - } - } - return deactivated; - }, - - /** - * Method: onSketchComplete - * Registered as a listener for the sketchcomplete event on the editable - * layer. - * - * Parameters: - * event - {Object} The sketch complete event. - * - * Returns: - * {Boolean} Stop the sketch from being added to the layer (it has been - * split). - */ - onSketchComplete: function(event) { - this.feature = null; - return !this.considerSplit(event.feature); - }, - - /** - * Method: afterFeatureModified - * Registered as a listener for the afterfeaturemodified event on the - * editable layer. - * - * Parameters: - * event - {Object} The after feature modified event. - */ - afterFeatureModified: function(event) { - if(event.modified) { - var feature = event.feature; - if(feature.geometry instanceof OpenLayers.Geometry.LineString || - feature.geometry instanceof OpenLayers.Geometry.MultiLineString) { - this.feature = event.feature; - this.considerSplit(event.feature); - } - } - }, - - /** - * Method: removeByGeometry - * Remove a feature from a list based on the given geometry. - * - * Parameters: - * features - {Array(} A list of features. - * geometry - {} A geometry. - */ - removeByGeometry: function(features, geometry) { - for(var i=0, len=features.length; i} The target feature. - * - * Returns: - * {Boolean} The target is eligible for splitting. - */ - isEligible: function(target) { - return ( - target.state !== OpenLayers.State.DELETE - ) && ( - target.geometry instanceof OpenLayers.Geometry.LineString || - target.geometry instanceof OpenLayers.Geometry.MultiLineString - ) && ( - this.feature !== target - ) && ( - !this.targetFilter || - this.targetFilter.evaluate(target.attributes) - ); - }, - - /** - * Method: considerSplit - * Decide whether or not to split target features with the supplied - * feature. If is true, both the source and target features - * will be split if eligible. - * - * Parameters: - * feature - { 1) { - // splice in new source parts - parts.unshift(j, 1); // add args for splice below - Array.prototype.splice.apply(sourceParts, parts); - j += parts.length - 3; - } - results = results[1]; - } - // handle parts that result from target splitting - if(results.length > 1) { - // splice in new target parts - results.unshift(k, 1); // add args for splice below - Array.prototype.splice.apply(targetParts, results); - k += results.length - 3; - } - } - } - } - } - } - if(targetParts && targetParts.length > 1) { - this.geomsToFeatures(targetFeature, targetParts); - this.events.triggerEvent("split", { - original: targetFeature, - features: targetParts - }); - Array.prototype.push.apply(additions, targetParts); - removals.push(targetFeature); - targetSplit = true; - } - } - } - if(sourceParts && sourceParts.length > 1) { - this.geomsToFeatures(feature, sourceParts); - this.events.triggerEvent("split", { - original: feature, - features: sourceParts - }); - Array.prototype.push.apply(additions, sourceParts); - removals.push(feature); - sourceSplit = true; - } - if(sourceSplit || targetSplit) { - // remove and add feature events are suppressed - // listen for split event on this control instead - if(this.deferDelete) { - // Set state instead of removing. Take care to avoid - // setting delete for features that have not yet been - // inserted - those should be destroyed immediately. - var feat, destroys = []; - for(var i=0, len=removals.length; i} The feature to be cloned. - * geoms - {Array()} List of goemetries. This will - * become a list of new features. - */ - geomsToFeatures: function(feature, geoms) { - var clone = feature.clone(); - delete clone.geometry; - var newFeature; - for(var i=0, len=geoms.length; i - */ -OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, { - - /** - * APIProperty: hover - * {Boolean} Send GetFeatureInfo requests when mouse stops moving. - * Default is false. - */ - hover: false, - - /** - * APIProperty: maxFeatures - * {Integer} Maximum number of features to return from a WMS query. This - * sets the feature_count parameter on WMS GetFeatureInfo - * requests. - */ - maxFeatures: 10, - - /** - * Property: layers - * {Array()} The layers to query for feature info. - * If omitted, all map WMS layers with a url that matches this or - * will be considered. - */ - layers: null, - - /** - * Property: queryVisible - * {Boolean} If true, filter out hidden layers when searching the map for - * layers to query. Default is false. - */ - queryVisible: false, - - /** - * Property: url - * {String} The URL of the WMS service to use. If not provided, the url - * of the first eligible layer will be used. - */ - url: null, - - /** - * Property: layerUrls - * {Array(String)} Optional list of urls for layers that should be queried. - * This can be used when the layer url differs from the url used for - * making GetFeatureInfo requests (in the case of a layer using cached - * tiles). - */ - layerUrls: null, - - /** - * Property: infoFormat - * {String} The mimetype to request from the server - */ - infoFormat: 'text/html', - - /** - * Property: vendorParams - * {Object} Additional parameters that will be added to the request, for - * WMS implementations that support them. This could e.g. look like - * (start code) - * { - * radius: 5 - * } - * (end) - */ - vendorParams: {}, - - /** - * Property: format - * {} A format for parsing GetFeatureInfo responses. - * Default is . - */ - format: null, - - /** - * Property: formatOptions - * {Object} Optional properties to set on the format (if one is not provided - * in the property. - */ - formatOptions: null, - - /** - * APIProperty: handlerOptions - * {Object} Additional options for the handlers used by this control, e.g. - * (start code) - * { - * "click": {delay: 100}, - * "hover": {delay: 300} - * } - * (end) - */ - handlerOptions: null, - - /** - * Property: handler - * {Object} Reference to the for this control - */ - handler: null, - - /** - * Property: hoverRequest - * {} contains the currently running hover request - * (if any). - */ - hoverRequest: null, - - /** - * Constant: EVENT_TYPES - * - * Supported event types (in addition to those from ): - * getfeatureinfo - Triggered when a GetFeatureInfo response is received. - * The event object has a *text* property with the body of the - * response (String), a *features* property with an array of the - * parsed features, an *xy* property with the position of the mouse - * click or hover event that triggered the request, and a *request* - * property with the request itself. - */ - EVENT_TYPES: ["getfeatureinfo"], - - /** - * Constructor: - * - * Parameters: - * options - {Object} - */ - initialize: function(options) { - // concatenate events specific to vector with those from the base - this.EVENT_TYPES = - OpenLayers.Control.WMSGetFeatureInfo.prototype.EVENT_TYPES.concat( - OpenLayers.Control.prototype.EVENT_TYPES - ); - - options = options || {}; - options.handlerOptions = options.handlerOptions || {}; - - OpenLayers.Control.prototype.initialize.apply(this, [options]); - - if(!this.format) { - this.format = new OpenLayers.Format.WMSGetFeatureInfo( - options.formatOptions - ); - } - - if (this.hover) { - this.handler = new OpenLayers.Handler.Hover( - this, { - 'move': this.cancelHover, - 'pause': this.getInfoForHover - }, - OpenLayers.Util.extend(this.handlerOptions.hover || {}, { - 'delay': 250 - })); - } else { - this.handler = new OpenLayers.Handler.Click(this, - {click: this.getInfoForClick}, this.handlerOptions.click || {}); - } - }, - - /** - * Method: activate - * Activates the control. - * - * Returns: - * {Boolean} The control was effectively activated. - */ - activate: function () { - if (!this.active) { - this.handler.activate(); - } - return OpenLayers.Control.prototype.activate.apply( - this, arguments - ); - }, - - /** - * Method: deactivate - * Deactivates the control. - * - * Returns: - * {Boolean} The control was effectively deactivated. - */ - deactivate: function () { - return OpenLayers.Control.prototype.deactivate.apply( - this, arguments - ); - }, - - /** - * Method: getInfoForClick - * Called on click - * - * Parameters: - * evt - {} - */ - getInfoForClick: function(evt) { - // Set the cursor to "wait" to tell the user we're working on their - // click. - OpenLayers.Element.addClass(this.map.viewPortDiv, "olCursorWait"); - this.request(evt.xy, {}); - }, - - /** - * Method: getInfoForHover - * Pause callback for the hover handler - * - * Parameters: - * evt - {Object} - */ - getInfoForHover: function(evt) { - this.request(evt.xy, {hover: true}); - }, - - /** - * Method: cancelHover - * Cancel callback for the hover handler - */ - cancelHover: function() { - if (this.hoverRequest) { - this.hoverRequest.abort(); - this.hoverRequest = null; - } - }, - - /** - * Method: findLayers - * Internal method to get the layers, independent of whether we are - * inspecting the map or using a client-provided array - */ - findLayers: function() { - - var layers = []; - - var candidates = this.layers || this.map.layers; - var layer, url; - for(var i=0, len=candidates.length; i or one - * of the . - * - * Parameters: - * url - {String} The url to test. - * - * Returns: - * {Boolean} The provided url matches the control or one of the - * . - */ - urlMatches: function(url) { - var matches = OpenLayers.Util.isEquivalentUrl(this.url, url); - if(!matches && this.layerUrls) { - for(var i=0, len=this.layerUrls.length; i} The position on the map where the - * mouse event occurred. - * options - {Object} additional options for this method. - * - * Valid options: - * - *hover* {Boolean} true if we do the request for the hover handler - */ - request: function(clickPosition, options) { - options = options || {}; - var layerNames = []; - var styleNames = []; - - var layers = this.findLayers(); - if(layers.length > 0) { - - for (var i = 0, len = layers.length; i < len; i++) { - layerNames = layerNames.concat(layers[i].params.LAYERS); - // in the event of a WMS layer bundling multiple layers but not - // specifying styles,we need the same number of commas to specify - // the default style for each of the layers. We can't just leave it - // blank as we may be including other layers that do specify styles. - if (layers[i].params.STYLES) { - styleNames = styleNames.concat(layers[i].params.STYLES); - } else { - if (layers[i].params.LAYERS instanceof Array) { - styleNames = styleNames.concat(new Array(layers[i].params.LAYERS.length)); - } else { // Assume it's a String - styleNames = styleNames.concat(layers[i].params.LAYERS.replace(/[^,]/g, "")); - } - } - } - - var wmsOptions = { - url: this.url, - params: OpenLayers.Util.applyDefaults({ - service: "WMS", - version: "1.1.0", - request: "GetFeatureInfo", - layers: layerNames, - query_layers: layerNames, - styles: styleNames, - bbox: this.map.getExtent().toBBOX(), - srs: this.map.getProjection(), - feature_count: this.maxFeatures, - x: clickPosition.x, - y: clickPosition.y, - height: this.map.getSize().h, - width: this.map.getSize().w, - info_format: this.infoFormat - }, this.vendorParams), - callback: function(request) { - this.handleResponse(clickPosition, request); - }, - scope: this - }; - - var response = OpenLayers.Request.GET(wmsOptions); - - if (options.hover === true) { - this.hoverRequest = response.priv; - } - } else { - // Reset the cursor. - OpenLayers.Element.removeClass(this.map.viewPortDiv, "olCursorWait"); - } - }, - - /** - * Method: handleResponse - * Handler for the GetFeatureInfo response. - * - * Parameters: - * xy - {} The position on the map where the - * mouse event occurred. - * request - {XMLHttpRequest} The request object. - */ - handleResponse: function(xy, request) { - - var doc = request.responseXML; - if(!doc || !doc.documentElement) { - doc = request.responseText; - } - var features = this.format.read(doc); - - this.events.triggerEvent("getfeatureinfo", { - text: request.responseText, - features: features, - request: request, - xy: xy - }); - - // Reset the cursor. - OpenLayers.Element.removeClass(this.map.viewPortDiv, "olCursorWait"); - }, - - /** - * Method: setMap - * Set the map property for the control. - * - * Parameters: - * map - {} - */ - setMap: function(map) { - this.handler.setMap(map); - OpenLayers.Control.prototype.setMap.apply(this, arguments); - }, - - CLASS_NAME: "OpenLayers.Control.WMSGetFeatureInfo" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/ZoomBox.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/ZoomBox.js deleted file mode 100755 index 461ece4086..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/ZoomBox.js +++ /dev/null @@ -1,93 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Control.js - * @requires OpenLayers/Handler/Box.js - */ - -/** - * Class: OpenLayers.Control.ZoomBox - * The ZoomBox control enables zooming directly to a given extent, by drawing - * a box on the map. The box is drawn by holding down shift, whilst dragging - * the mouse. - * - * Inherits from: - * - - */ -OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, { - /** - * Property: type - * {OpenLayers.Control.TYPE} - */ - type: OpenLayers.Control.TYPE_TOOL, - - /** - * Property: out - * {Boolean} Should the control be used for zooming out? - */ - out: false, - - /** - * Property: alwaysZoom - * {Boolean} Always zoom in/out, when box drawed - */ - alwaysZoom: false, - - /** - * Method: draw - */ - draw: function() { - this.handler = new OpenLayers.Handler.Box( this, - {done: this.zoomBox}, {keyMask: this.keyMask} ); - }, - - /** - * Method: zoomBox - * - * Parameters: - * position - {} or {} - */ - zoomBox: function (position) { - if (position instanceof OpenLayers.Bounds) { - if (!this.out) { - var minXY = this.map.getLonLatFromPixel( - new OpenLayers.Pixel(position.left, position.bottom)); - var maxXY = this.map.getLonLatFromPixel( - new OpenLayers.Pixel(position.right, position.top)); - var bounds = new OpenLayers.Bounds(minXY.lon, minXY.lat, - maxXY.lon, maxXY.lat); - } else { - var pixWidth = Math.abs(position.right-position.left); - var pixHeight = Math.abs(position.top-position.bottom); - var zoomFactor = Math.min((this.map.size.h / pixHeight), - (this.map.size.w / pixWidth)); - var extent = this.map.getExtent(); - var center = this.map.getLonLatFromPixel( - position.getCenterPixel()); - var xmin = center.lon - (extent.getWidth()/2)*zoomFactor; - var xmax = center.lon + (extent.getWidth()/2)*zoomFactor; - var ymin = center.lat - (extent.getHeight()/2)*zoomFactor; - var ymax = center.lat + (extent.getHeight()/2)*zoomFactor; - var bounds = new OpenLayers.Bounds(xmin, ymin, xmax, ymax); - } - // always zoom in/out - var lastZoom = this.map.getZoom(); - this.map.zoomToExtent(bounds); - if (lastZoom == this.map.getZoom() && this.alwaysZoom == true){ - this.map.zoomTo(lastZoom + (this.out ? -1 : 1)); - } - } else { // it's a pixel - if (!this.out) { - this.map.setCenter(this.map.getLonLatFromPixel(position), - this.map.getZoom() + 1); - } else { - this.map.setCenter(this.map.getLonLatFromPixel(position), - this.map.getZoom() - 1); - } - } - }, - - CLASS_NAME: "OpenLayers.Control.ZoomBox" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/ZoomIn.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/ZoomIn.js deleted file mode 100755 index 8173df3fe0..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/ZoomIn.js +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Control.js - */ - -/** - * Class: OpenLayers.Control.ZoomIn - * The ZoomIn control is a button to increase the zoom level of a map. - * - * Inherits from: - * - - */ -OpenLayers.Control.ZoomIn = OpenLayers.Class(OpenLayers.Control, { - - /** - * Property: type - * {String} The type of -- When added to a - * , 'type' is used by the panel to determine how to - * handle our events. - */ - type: OpenLayers.Control.TYPE_BUTTON, - - /** - * Method: trigger - */ - trigger: function(){ - this.map.zoomIn(); - }, - - CLASS_NAME: "OpenLayers.Control.ZoomIn" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/ZoomOut.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/ZoomOut.js deleted file mode 100755 index 48b8ac5b22..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/ZoomOut.js +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Control.js - */ - -/** - * Class: OpenLayers.Control.ZoomOut - * The ZoomOut control is a button to decrease the zoom level of a map. - * - * Inherits from: - * - - */ -OpenLayers.Control.ZoomOut = OpenLayers.Class(OpenLayers.Control, { - - /** - * Property: type - * {String} The type of -- When added to a - * , 'type' is used by the panel to determine how to - * handle our events. - */ - type: OpenLayers.Control.TYPE_BUTTON, - - /** - * Method: trigger - */ - trigger: function(){ - this.map.zoomOut(); - }, - - CLASS_NAME: "OpenLayers.Control.ZoomOut" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/ZoomPanel.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/ZoomPanel.js deleted file mode 100755 index c2cab2eb7b..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/ZoomPanel.js +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Control/Panel.js - * @requires OpenLayers/Control/ZoomIn.js - * @requires OpenLayers/Control/ZoomOut.js - * @requires OpenLayers/Control/ZoomToMaxExtent.js - */ - -/** - * Class: OpenLayers.Control.ZoomPanel - * The ZoomPanel control is a compact collecton of 3 zoom controls: a - * , a , and a - * . By default it is drawn in the upper left - * corner of the map. - * - * Note: - * If you wish to use this class with the default images and you want - * it to look nice in ie6, you should add the following, conditionally - * added css stylesheet to your HTML file: - * - * (code) - * - * (end) - * - * Inherits from: - * - - */ -OpenLayers.Control.ZoomPanel = OpenLayers.Class(OpenLayers.Control.Panel, { - - /** - * Constructor: OpenLayers.Control.ZoomPanel - * Add the three zooming controls. - * - * Parameters: - * options - {Object} An optional object whose properties will be used - * to extend the control. - */ - initialize: function(options) { - OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]); - this.addControls([ - new OpenLayers.Control.ZoomIn(), - new OpenLayers.Control.ZoomToMaxExtent(), - new OpenLayers.Control.ZoomOut() - ]); - }, - - CLASS_NAME: "OpenLayers.Control.ZoomPanel" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/ZoomToMaxExtent.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/ZoomToMaxExtent.js deleted file mode 100755 index 74511732a8..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Control/ZoomToMaxExtent.js +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Control.js - */ - -/** - * Class: OpenLayers.Control.ZoomToMaxExtent - * The ZoomToMaxExtent control is a button that zooms out to the maximum - * extent of the map. It is designed to be used with a - * . - * - * Inherits from: - * - - */ -OpenLayers.Control.ZoomToMaxExtent = OpenLayers.Class(OpenLayers.Control, { - - /** - * Property: type - * {String} The type of -- When added to a - * , 'type' is used by the panel to determine how to - * handle our events. - */ - type: OpenLayers.Control.TYPE_BUTTON, - - /* - * Method: trigger - * Do the zoom. - */ - trigger: function() { - if (this.map) { - this.map.zoomToMaxExtent(); - } - }, - - CLASS_NAME: "OpenLayers.Control.ZoomToMaxExtent" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Events.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Events.js deleted file mode 100755 index bb0d954bf2..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Events.js +++ /dev/null @@ -1,828 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - - -/** - * @requires OpenLayers/Util.js - */ - -/** - * Namespace: OpenLayers.Event - * Utility functions for event handling. - */ -OpenLayers.Event = { - - /** - * Property: observers - * {Object} A hashtable cache of the event observers. Keyed by - * element._eventCacheID - */ - observers: false, - - /** - * Constant: KEY_BACKSPACE - * {int} - */ - KEY_BACKSPACE: 8, - - /** - * Constant: KEY_TAB - * {int} - */ - KEY_TAB: 9, - - /** - * Constant: KEY_RETURN - * {int} - */ - KEY_RETURN: 13, - - /** - * Constant: KEY_ESC - * {int} - */ - KEY_ESC: 27, - - /** - * Constant: KEY_LEFT - * {int} - */ - KEY_LEFT: 37, - - /** - * Constant: KEY_UP - * {int} - */ - KEY_UP: 38, - - /** - * Constant: KEY_RIGHT - * {int} - */ - KEY_RIGHT: 39, - - /** - * Constant: KEY_DOWN - * {int} - */ - KEY_DOWN: 40, - - /** - * Constant: KEY_DELETE - * {int} - */ - KEY_DELETE: 46, - - - /** - * Method: element - * Cross browser event element detection. - * - * Parameters: - * event - {Event} - * - * Returns: - * {DOMElement} The element that caused the event - */ - element: function(event) { - return event.target || event.srcElement; - }, - - /** - * Method: isLeftClick - * Determine whether event was caused by a left click. - * - * Parameters: - * event - {Event} - * - * Returns: - * {Boolean} - */ - isLeftClick: function(event) { - return (((event.which) && (event.which == 1)) || - ((event.button) && (event.button == 1))); - }, - - /** - * Method: isRightClick - * Determine whether event was caused by a right mouse click. - * - * Parameters: - * event - {Event} - * - * Returns: - * {Boolean} - */ - isRightClick: function(event) { - return (((event.which) && (event.which == 3)) || - ((event.button) && (event.button == 2))); - }, - - /** - * Method: stop - * Stops an event from propagating. - * - * Parameters: - * event - {Event} - * allowDefault - {Boolean} If true, we stop the event chain but - * still allow the default browser - * behaviour (text selection, radio-button - * clicking, etc) - * Default false - */ - stop: function(event, allowDefault) { - - if (!allowDefault) { - if (event.preventDefault) { - event.preventDefault(); - } else { - event.returnValue = false; - } - } - - if (event.stopPropagation) { - event.stopPropagation(); - } else { - event.cancelBubble = true; - } - }, - - /** - * Method: findElement - * - * Parameters: - * event - {Event} - * tagName - {String} - * - * Returns: - * {DOMElement} The first node with the given tagName, starting from the - * node the event was triggered on and traversing the DOM upwards - */ - findElement: function(event, tagName) { - var element = OpenLayers.Event.element(event); - while (element.parentNode && (!element.tagName || - (element.tagName.toUpperCase() != tagName.toUpperCase()))){ - element = element.parentNode; - } - return element; - }, - - /** - * Method: observe - * - * Parameters: - * elementParam - {DOMElement || String} - * name - {String} - * observer - {function} - * useCapture - {Boolean} - */ - observe: function(elementParam, name, observer, useCapture) { - var element = OpenLayers.Util.getElement(elementParam); - useCapture = useCapture || false; - - if (name == 'keypress' && - (navigator.appVersion.match(/Konqueror|Safari|KHTML/) - || element.attachEvent)) { - name = 'keydown'; - } - - //if observers cache has not yet been created, create it - if (!this.observers) { - this.observers = {}; - } - - //if not already assigned, make a new unique cache ID - if (!element._eventCacheID) { - var idPrefix = "eventCacheID_"; - if (element.id) { - idPrefix = element.id + "_" + idPrefix; - } - element._eventCacheID = OpenLayers.Util.createUniqueID(idPrefix); - } - - var cacheID = element._eventCacheID; - - //if there is not yet a hash entry for this element, add one - if (!this.observers[cacheID]) { - this.observers[cacheID] = []; - } - - //add a new observer to this element's list - this.observers[cacheID].push({ - 'element': element, - 'name': name, - 'observer': observer, - 'useCapture': useCapture - }); - - //add the actual browser event listener - if (element.addEventListener) { - element.addEventListener(name, observer, useCapture); - } else if (element.attachEvent) { - element.attachEvent('on' + name, observer); - } - }, - - /** - * Method: stopObservingElement - * Given the id of an element to stop observing, cycle through the - * element's cached observers, calling stopObserving on each one, - * skipping those entries which can no longer be removed. - * - * parameters: - * elementParam - {DOMElement || String} - */ - stopObservingElement: function(elementParam) { - var element = OpenLayers.Util.getElement(elementParam); - var cacheID = element._eventCacheID; - - this._removeElementObservers(OpenLayers.Event.observers[cacheID]); - }, - - /** - * Method: _removeElementObservers - * - * Parameters: - * elementObservers - {Array(Object)} Array of (element, name, - * observer, usecapture) objects, - * taken directly from hashtable - */ - _removeElementObservers: function(elementObservers) { - if (elementObservers) { - for(var i = elementObservers.length-1; i >= 0; i--) { - var entry = elementObservers[i]; - var args = new Array(entry.element, - entry.name, - entry.observer, - entry.useCapture); - var removed = OpenLayers.Event.stopObserving.apply(this, args); - } - } - }, - - /** - * Method: stopObserving - * - * Parameters: - * elementParam - {DOMElement || String} - * name - {String} - * observer - {function} - * useCapture - {Boolean} - * - * Returns: - * {Boolean} Whether or not the event observer was removed - */ - stopObserving: function(elementParam, name, observer, useCapture) { - useCapture = useCapture || false; - - var element = OpenLayers.Util.getElement(elementParam); - var cacheID = element._eventCacheID; - - if (name == 'keypress') { - if ( navigator.appVersion.match(/Konqueror|Safari|KHTML/) || - element.detachEvent) { - name = 'keydown'; - } - } - - // find element's entry in this.observers cache and remove it - var foundEntry = false; - var elementObservers = OpenLayers.Event.observers[cacheID]; - if (elementObservers) { - - // find the specific event type in the element's list - var i=0; - while(!foundEntry && i < elementObservers.length) { - var cacheEntry = elementObservers[i]; - - if ((cacheEntry.name == name) && - (cacheEntry.observer == observer) && - (cacheEntry.useCapture == useCapture)) { - - elementObservers.splice(i, 1); - if (elementObservers.length == 0) { - delete OpenLayers.Event.observers[cacheID]; - } - foundEntry = true; - break; - } - i++; - } - } - - //actually remove the event listener from browser - if (foundEntry) { - if (element.removeEventListener) { - element.removeEventListener(name, observer, useCapture); - } else if (element && element.detachEvent) { - element.detachEvent('on' + name, observer); - } - } - return foundEntry; - }, - - /** - * Method: unloadCache - * Cycle through all the element entries in the events cache and call - * stopObservingElement on each. - */ - unloadCache: function() { - // check for OpenLayers.Event before checking for observers, because - // OpenLayers.Event may be undefined in IE if no map instance was - // created - if (OpenLayers.Event && OpenLayers.Event.observers) { - for (var cacheID in OpenLayers.Event.observers) { - var elementObservers = OpenLayers.Event.observers[cacheID]; - OpenLayers.Event._removeElementObservers.apply(this, - [elementObservers]); - } - OpenLayers.Event.observers = false; - } - }, - - CLASS_NAME: "OpenLayers.Event" -}; - -/* prevent memory leaks in IE */ -OpenLayers.Event.observe(window, 'unload', OpenLayers.Event.unloadCache, false); - -// FIXME: Remove this in 3.0. In 3.0, Event.stop will no longer be provided -// by OpenLayers. -if (window.Event) { - OpenLayers.Util.applyDefaults(window.Event, OpenLayers.Event); -} else { - var Event = OpenLayers.Event; -} - -/** - * Class: OpenLayers.Events - */ -OpenLayers.Events = OpenLayers.Class({ - - /** - * Constant: BROWSER_EVENTS - * {Array(String)} supported events - */ - BROWSER_EVENTS: [ - "mouseover", "mouseout", - "mousedown", "mouseup", "mousemove", - "click", "dblclick", "rightclick", "dblrightclick", - "resize", "focus", "blur" - ], - - /** - * Property: listeners - * {Object} Hashtable of Array(Function): events listener functions - */ - listeners: null, - - /** - * Property: object - * {Object} the code object issuing application events - */ - object: null, - - /** - * Property: element - * {DOMElement} the DOM element receiving browser events - */ - element: null, - - /** - * Property: eventTypes - * {Array(String)} list of support application events - */ - eventTypes: null, - - /** - * Property: eventHandler - * {Function} bound event handler attached to elements - */ - eventHandler: null, - - /** - * APIProperty: fallThrough - * {Boolean} - */ - fallThrough: null, - - /** - * APIProperty: includeXY - * {Boolean} Should the .xy property automatically be created for browser - * mouse events? In general, this should be false. If it is true, then - * mouse events will automatically generate a '.xy' property on the - * event object that is passed. (Prior to OpenLayers 2.7, this was true - * by default.) Otherwise, you can call the getMousePosition on the - * relevant events handler on the object available via the 'evt.object' - * property of the evt object. So, for most events, you can call: - * function named(evt) { - * this.xy = this.object.events.getMousePosition(evt) - * } - * - * This option typically defaults to false for performance reasons: - * when creating an events object whose primary purpose is to manage - * relatively positioned mouse events within a div, it may make - * sense to set it to true. - * - * This option is also used to control whether the events object caches - * offsets. If this is false, it will not: the reason for this is that - * it is only expected to be called many times if the includeXY property - * is set to true. If you set this to true, you are expected to clear - * the offset cache manually (using this.clearMouseCache()) if: - * the border of the element changes - * the location of the element in the page changes - */ - includeXY: false, - - /** - * Method: clearMouseListener - * A version of that is bound to this instance so that - * it can be used with and - * . - */ - clearMouseListener: null, - - /** - * Constructor: OpenLayers.Events - * Construct an OpenLayers.Events object. - * - * Parameters: - * object - {Object} The js object to which this Events object is being - * added element - {DOMElement} A dom element to respond to browser events - * eventTypes - {Array(String)} Array of custom application events - * fallThrough - {Boolean} Allow events to fall through after these have - * been handled? - * options - {Object} Options for the events object. - */ - initialize: function (object, element, eventTypes, fallThrough, options) { - OpenLayers.Util.extend(this, options); - this.object = object; - this.fallThrough = fallThrough; - this.listeners = {}; - - // keep a bound copy of handleBrowserEvent() so that we can - // pass the same function to both Event.observe() and .stopObserving() - this.eventHandler = OpenLayers.Function.bindAsEventListener( - this.handleBrowserEvent, this - ); - - // to be used with observe and stopObserving - this.clearMouseListener = OpenLayers.Function.bind( - this.clearMouseCache, this - ); - - // if eventTypes is specified, create a listeners list for each - // custom application event. - this.eventTypes = []; - if (eventTypes != null) { - for (var i=0, len=eventTypes.length; i} The current xy coordinate of the mouse, adjusted - * for offsets - */ - getMousePosition: function (evt) { - if (!this.includeXY) { - this.clearMouseCache(); - } else if (!this.element.hasScrollEvent) { - OpenLayers.Event.observe(window, "scroll", this.clearMouseListener); - this.element.hasScrollEvent = true; - } - - if (!this.element.scrolls) { - this.element.scrolls = [ - (document.documentElement.scrollLeft - || document.body.scrollLeft), - (document.documentElement.scrollTop - || document.body.scrollTop) - ]; - } - - if (!this.element.lefttop) { - this.element.lefttop = [ - (document.documentElement.clientLeft || 0), - (document.documentElement.clientTop || 0) - ]; - } - - if (!this.element.offsets) { - this.element.offsets = OpenLayers.Util.pagePosition(this.element); - this.element.offsets[0] += this.element.scrolls[0]; - this.element.offsets[1] += this.element.scrolls[1]; - } - return new OpenLayers.Pixel( - (evt.clientX + this.element.scrolls[0]) - this.element.offsets[0] - - this.element.lefttop[0], - (evt.clientY + this.element.scrolls[1]) - this.element.offsets[1] - - this.element.lefttop[1] - ); - }, - - CLASS_NAME: "OpenLayers.Events" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Feature.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Feature.js deleted file mode 100755 index 2eaafbdba5..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Feature.js +++ /dev/null @@ -1,222 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - - -/** - * @requires OpenLayers/Util.js - * @requires OpenLayers/Marker.js - * @requires OpenLayers/Popup/AnchoredBubble.js - */ - -/** - * Class: OpenLayers.Feature - * Features are combinations of geography and attributes. The OpenLayers.Feature - * class specifically combines a marker and a lonlat. - */ -OpenLayers.Feature = OpenLayers.Class({ - - /** - * Property: layer - * {} - */ - layer: null, - - /** - * Property: id - * {String} - */ - id: null, - - /** - * Property: lonlat - * {} - */ - lonlat: null, - - /** - * Property: data - * {Object} - */ - data: null, - - /** - * Property: marker - * {} - */ - marker: null, - - /** - * APIProperty: popupClass - * {} The class which will be used to instantiate - * a new Popup. Default is . - */ - popupClass: OpenLayers.Popup.AnchoredBubble, - - /** - * Property: popup - * {} - */ - popup: null, - - /** - * Constructor: OpenLayers.Feature - * Constructor for features. - * - * Parameters: - * layer - {} - * lonlat - {} - * data - {Object} - * - * Returns: - * {} - */ - initialize: function(layer, lonlat, data) { - this.layer = layer; - this.lonlat = lonlat; - this.data = (data != null) ? data : {}; - this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_"); - }, - - /** - * Method: destroy - * nullify references to prevent circular references and memory leaks - */ - destroy: function() { - - //remove the popup from the map - if ((this.layer != null) && (this.layer.map != null)) { - if (this.popup != null) { - this.layer.map.removePopup(this.popup); - } - } - - this.layer = null; - this.id = null; - this.lonlat = null; - this.data = null; - if (this.marker != null) { - this.destroyMarker(this.marker); - this.marker = null; - } - if (this.popup != null) { - this.destroyPopup(this.popup); - this.popup = null; - } - }, - - /** - * Method: onScreen - * - * Returns: - * {Boolean} Whether or not the feature is currently visible on screen - * (based on its 'lonlat' property) - */ - onScreen:function() { - - var onScreen = false; - if ((this.layer != null) && (this.layer.map != null)) { - var screenBounds = this.layer.map.getExtent(); - onScreen = screenBounds.containsLonLat(this.lonlat); - } - return onScreen; - }, - - - /** - * Method: createMarker - * Based on the data associated with the Feature, create and return a marker object. - * - * Returns: - * {} A Marker Object created from the 'lonlat' and 'icon' properties - * set in this.data. If no 'lonlat' is set, returns null. If no - * 'icon' is set, OpenLayers.Marker() will load the default image. - * - * Note - this.marker is set to return value - * - */ - createMarker: function() { - - if (this.lonlat != null) { - this.marker = new OpenLayers.Marker(this.lonlat, this.data.icon); - } - return this.marker; - }, - - /** - * Method: destroyMarker - * Destroys marker. - * If user overrides the createMarker() function, s/he should be able - * to also specify an alternative function for destroying it - */ - destroyMarker: function() { - this.marker.destroy(); - }, - - /** - * Method: createPopup - * Creates a popup object created from the 'lonlat', 'popupSize', - * and 'popupContentHTML' properties set in this.data. It uses - * this.marker.icon as default anchor. - * - * If no 'lonlat' is set, returns null. - * If no this.marker has been created, no anchor is sent. - * - * Note - the returned popup object is 'owned' by the feature, so you - * cannot use the popup's destroy method to discard the popup. - * Instead, you must use the feature's destroyPopup - * - * Note - this.popup is set to return value - * - * Parameters: - * closeBox - {Boolean} create popup with closebox or not - * - * Returns: - * {} Returns the created popup, which is also set - * as 'popup' property of this feature. Will be of whatever type - * specified by this feature's 'popupClass' property, but must be - * of type . - * - */ - createPopup: function(closeBox) { - - if (this.lonlat != null) { - - var id = this.id + "_popup"; - var anchor = (this.marker) ? this.marker.icon : null; - - if (!this.popup) { - this.popup = new this.popupClass(id, - this.lonlat, - this.data.popupSize, - this.data.popupContentHTML, - anchor, - closeBox); - } - if (this.data.overflow != null) { - this.popup.contentDiv.style.overflow = this.data.overflow; - } - - this.popup.feature = this; - } - return this.popup; - }, - - - /** - * Method: destroyPopup - * Destroys the popup created via createPopup. - * - * As with the marker, if user overrides the createPopup() function, s/he - * should also be able to override the destruction - */ - destroyPopup: function() { - if (this.popup) { - this.popup.feature = null; - this.popup.destroy(); - this.popup = null; - } - }, - - CLASS_NAME: "OpenLayers.Feature" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Feature/Vector.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Feature/Vector.js deleted file mode 100755 index ecb7ccb087..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Feature/Vector.js +++ /dev/null @@ -1,419 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -// TRASH THIS -OpenLayers.State = { - /** states */ - UNKNOWN: 'Unknown', - INSERT: 'Insert', - UPDATE: 'Update', - DELETE: 'Delete' -}; - -/** - * @requires OpenLayers/Feature.js - * @requires OpenLayers/Util.js - */ - -/** - * Class: OpenLayers.Feature.Vector - * Vector features use the OpenLayers.Geometry classes as geometry description. - * They have an 'attributes' property, which is the data object, and a 'style' - * property, the default values of which are defined in the - * objects. - * - * Inherits from: - * - - */ -OpenLayers.Feature.Vector = OpenLayers.Class(OpenLayers.Feature, { - - /** - * Property: fid - * {String} - */ - fid: null, - - /** - * APIProperty: geometry - * {} - */ - geometry: null, - - /** - * APIProperty: attributes - * {Object} This object holds arbitrary properties that describe the - * feature. - */ - attributes: null, - - /** - * Property: bounds - * {} The box bounding that feature's geometry, that - * property can be set by an object when - * deserializing the feature, so in most cases it represents an - * information set by the server. - */ - bounds: null, - - /** - * Property: state - * {String} - */ - state: null, - - /** - * APIProperty: style - * {Object} - */ - style: null, - - /** - * Property: renderIntent - * {String} rendering intent currently being used - */ - renderIntent: "default", - - /** - * Constructor: OpenLayers.Feature.Vector - * Create a vector feature. - * - * Parameters: - * geometry - {} The geometry that this feature - * represents. - * attributes - {Object} An optional object that will be mapped to the - * property. - * style - {Object} An optional style object. - */ - initialize: function(geometry, attributes, style) { - OpenLayers.Feature.prototype.initialize.apply(this, - [null, null, attributes]); - this.lonlat = null; - this.geometry = geometry ? geometry : null; - this.state = null; - this.attributes = {}; - if (attributes) { - this.attributes = OpenLayers.Util.extend(this.attributes, - attributes); - } - this.style = style ? style : null; - }, - - /** - * Method: destroy - * nullify references to prevent circular references and memory leaks - */ - destroy: function() { - if (this.layer) { - this.layer.removeFeatures(this); - this.layer = null; - } - - this.geometry = null; - OpenLayers.Feature.prototype.destroy.apply(this, arguments); - }, - - /** - * Method: clone - * Create a clone of this vector feature. Does not set any non-standard - * properties. - * - * Returns: - * {} An exact clone of this vector feature. - */ - clone: function () { - return new OpenLayers.Feature.Vector( - this.geometry ? this.geometry.clone() : null, - this.attributes, - this.style); - }, - - /** - * Method: onScreen - * Determine whether the feature is within the map viewport. This method - * tests for an intersection between the geometry and the viewport - * bounds. If a more effecient but less precise geometry bounds - * intersection is desired, call the method with the boundsOnly - * parameter true. - * - * Parameters: - * boundsOnly - {Boolean} Only test whether a feature's bounds intersects - * the viewport bounds. Default is false. If false, the feature's - * geometry must intersect the viewport for onScreen to return true. - * - * Returns: - * {Boolean} The feature is currently visible on screen (optionally - * based on its bounds if boundsOnly is true). - */ - onScreen:function(boundsOnly) { - var onScreen = false; - if(this.layer && this.layer.map) { - var screenBounds = this.layer.map.getExtent(); - if(boundsOnly) { - var featureBounds = this.geometry.getBounds(); - onScreen = screenBounds.intersectsBounds(featureBounds); - } else { - var screenPoly = screenBounds.toGeometry(); - onScreen = screenPoly.intersects(this.geometry); - } - } - return onScreen; - }, - - /** - * Method: createMarker - * HACK - we need to decide if all vector features should be able to - * create markers - * - * Returns: - * {} For now just returns null - */ - createMarker: function() { - return null; - }, - - /** - * Method: destroyMarker - * HACK - we need to decide if all vector features should be able to - * delete markers - * - * If user overrides the createMarker() function, s/he should be able - * to also specify an alternative function for destroying it - */ - destroyMarker: function() { - // pass - }, - - /** - * Method: createPopup - * HACK - we need to decide if all vector features should be able to - * create popups - * - * Returns: - * {} For now just returns null - */ - createPopup: function() { - return null; - }, - - /** - * Method: atPoint - * Determins whether the feature intersects with the specified location. - * - * Parameters: - * lonlat - {} - * toleranceLon - {float} Optional tolerance in Geometric Coords - * toleranceLat - {float} Optional tolerance in Geographic Coords - * - * Returns: - * {Boolean} Whether or not the feature is at the specified location - */ - atPoint: function(lonlat, toleranceLon, toleranceLat) { - var atPoint = false; - if(this.geometry) { - atPoint = this.geometry.atPoint(lonlat, toleranceLon, - toleranceLat); - } - return atPoint; - }, - - /** - * Method: destroyPopup - * HACK - we need to decide if all vector features should be able to - * delete popups - */ - destroyPopup: function() { - // pass - }, - - /** - * Method: move - * Moves the feature and redraws it at its new location - * - * Parameters: - * state - {OpenLayers.LonLat or OpenLayers.Pixel} the - * location to which to move the feature. - */ - move: function(location) { - - if(!this.layer || !this.geometry.move){ - //do nothing if no layer or immoveable geometry - return; - } - - var pixel; - if (location.CLASS_NAME == "OpenLayers.LonLat") { - pixel = this.layer.getViewPortPxFromLonLat(location); - } else { - pixel = location; - } - - var lastPixel = this.layer.getViewPortPxFromLonLat(this.geometry.getBounds().getCenterLonLat()); - var res = this.layer.map.getResolution(); - this.geometry.move(res * (pixel.x - lastPixel.x), - res * (lastPixel.y - pixel.y)); - this.layer.drawFeature(this); - return lastPixel; - }, - - /** - * Method: toState - * Sets the new state - * - * Parameters: - * state - {String} - */ - toState: function(state) { - if (state == OpenLayers.State.UPDATE) { - switch (this.state) { - case OpenLayers.State.UNKNOWN: - case OpenLayers.State.DELETE: - this.state = state; - break; - case OpenLayers.State.UPDATE: - case OpenLayers.State.INSERT: - break; - } - } else if (state == OpenLayers.State.INSERT) { - switch (this.state) { - case OpenLayers.State.UNKNOWN: - break; - default: - this.state = state; - break; - } - } else if (state == OpenLayers.State.DELETE) { - switch (this.state) { - case OpenLayers.State.INSERT: - // the feature should be destroyed - break; - case OpenLayers.State.DELETE: - break; - case OpenLayers.State.UNKNOWN: - case OpenLayers.State.UPDATE: - this.state = state; - break; - } - } else if (state == OpenLayers.State.UNKNOWN) { - this.state = state; - } - }, - - CLASS_NAME: "OpenLayers.Feature.Vector" -}); - - -/** - * Constant: OpenLayers.Feature.Vector.style - * OpenLayers features can have a number of style attributes. The 'default' - * style will typically be used if no other style is specified. These - * styles correspond for the most part, to the styling properties defined - * by the SVG standard. - * Information on fill properties: http://www.w3.org/TR/SVG/painting.html#FillProperties - * Information on stroke properties: http://www.w3.org/TR/SVG/painting.html#StrokeProperties - * - * Symbolizer properties: - * fill - {Boolean} Set to false if no fill is desired. - * fillColor - {String} Hex fill color. Default is "#ee9900". - * fillOpacity - {Number} Fill opacity (0-1). Default is 0.4 - * stroke - {Boolean} Set to false if no stroke is desired. - * strokeColor - {String} Hex stroke color. Default is "#ee9900". - * strokeOpacity - {Number} Stroke opacity (0-1). Default is 1. - * strokeWidth - {Number} Pixel stroke width. Default is 1. - * strokeLinecap - {String} Stroke cap type. Default is "round". [butt | round | square] - * strokeDashstyle - {String} Stroke dash style. Default is "solid". [dot | dash | dashdot | longdash | longdashdot | solid] - * graphic - {Boolean} Set to false if no graphic is desired. - * pointRadius - {Number} Pixel point radius. Default is 6. - * pointerEvents - {String} Default is "visiblePainted". - * cursor - {String} Default is "". - * externalGraphic - {String} Url to an external graphic that will be used for rendering points. - * graphicWidth - {Number} Pixel width for sizing an external graphic. - * graphicHeight - {Number} Pixel height for sizing an external graphic. - * graphicOpacity - {Number} Opacity (0-1) for an external graphic. - * graphicXOffset - {Number} Pixel offset along the positive x axis for displacing an external graphic. - * graphicYOffset - {Number} Pixel offset along the positive y axis for displacing an external graphic. - * graphicZIndex - {Number} The integer z-index value to use in rendering. - * graphicName - {String} Named graphic to use when rendering points. Supported values include "circle" (default), - * "square", "star", "x", "cross", "triangle". - * graphicTitle - {String} Tooltip for an external graphic. Only supported in Firefox and Internet Explorer. - * backgroundGraphic - {String} Url to a graphic to be used as the background under an externalGraphic. - * backgroundGraphicZIndex - {Number} The integer z-index value to use in rendering the background graphic. - * backgroundXOffset - {Number} The x offset (in pixels) for the background graphic. - * backgroundYOffset - {Number} The y offset (in pixels) for the background graphic. - * backgroundHeight - {Number} The height of the background graphic. If not provided, the graphicHeight will be used. - * backgroundWidth - {Number} The width of the background width. If not provided, the graphicWidth will be used. - * label - {String} The text for an optional label. For browsers that use the canvas renderer, this requires either - * fillText or mozDrawText to be available. - * labelAlign - {String} Label alignment. This specifies the insertion point relative to the text. It is a string - * composed of two characters. The first character is for the horizontal alignment, the second for the vertical - * alignment. Valid values for horizontal alignment: "l"=left, "c"=center, "r"=right. Valid values for vertical - * alignment: "t"=top, "m"=middle, "b"=bottom. Example values: "lt", "cm", "rb". The canvas renderer does not - * support vertical alignment, it will always use "b". - * fontColor - {String} The font color for the label, to be provided like CSS. - * fontFamily - {String} The font family for the label, to be provided like in CSS. - * fontSize - {String} The font size for the label, to be provided like in CSS. - * fontWeight - {String} The font weight for the label, to be provided like in CSS. - * display - {String} Symbolizers will have no effect if display is set to "none". All other values have no effect. - */ -OpenLayers.Feature.Vector.style = { - 'default': { - fillColor: "#ee9900", - fillOpacity: 0.4, - hoverFillColor: "white", - hoverFillOpacity: 0.8, - strokeColor: "#ee9900", - strokeOpacity: 1, - strokeWidth: 1, - strokeLinecap: "round", - strokeDashstyle: "solid", - hoverStrokeColor: "red", - hoverStrokeOpacity: 1, - hoverStrokeWidth: 0.2, - pointRadius: 6, - hoverPointRadius: 1, - hoverPointUnit: "%", - pointerEvents: "visiblePainted", - cursor: "inherit" - }, - 'select': { - fillColor: "blue", - fillOpacity: 0.4, - hoverFillColor: "white", - hoverFillOpacity: 0.8, - strokeColor: "blue", - strokeOpacity: 1, - strokeWidth: 2, - strokeLinecap: "round", - strokeDashstyle: "solid", - hoverStrokeColor: "red", - hoverStrokeOpacity: 1, - hoverStrokeWidth: 0.2, - pointRadius: 6, - hoverPointRadius: 1, - hoverPointUnit: "%", - pointerEvents: "visiblePainted", - cursor: "pointer" - }, - 'temporary': { - fillColor: "#66cccc", - fillOpacity: 0.2, - hoverFillColor: "white", - hoverFillOpacity: 0.8, - strokeColor: "#66cccc", - strokeOpacity: 1, - strokeLinecap: "round", - strokeWidth: 2, - strokeDashstyle: "solid", - hoverStrokeColor: "red", - hoverStrokeOpacity: 1, - hoverStrokeWidth: 0.2, - pointRadius: 6, - hoverPointRadius: 1, - hoverPointUnit: "%", - pointerEvents: "visiblePainted", - cursor: "inherit" - }, - 'delete': { - display: "none" - } -}; diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Feature/WFS.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Feature/WFS.js deleted file mode 100755 index 722c983e0e..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Feature/WFS.js +++ /dev/null @@ -1,79 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Feature.js - */ - -/** - * Class: OpenLayers.Feature.WFS - * WFS handling class, for use as a featureClass on the WFS layer for handling - * 'point' WFS types. Good for subclassing when creating a custom WFS like - * XML application. - * - * Inherits from: - * - - */ -OpenLayers.Feature.WFS = OpenLayers.Class(OpenLayers.Feature, { - - /** - * Constructor: OpenLayers.Feature.WFS - * Create a WFS feature. - * - * Parameters: - * layer - {} - * xmlNode - {XMLNode} - */ - initialize: function(layer, xmlNode) { - var newArguments = arguments; - var data = this.processXMLNode(xmlNode); - newArguments = new Array(layer, data.lonlat, data); - OpenLayers.Feature.prototype.initialize.apply(this, newArguments); - this.createMarker(); - this.layer.addMarker(this.marker); - }, - - /** - * Method: destroy - * nullify references to prevent circular references and memory leaks - */ - destroy: function() { - if (this.marker != null) { - this.layer.removeMarker(this.marker); - } - OpenLayers.Feature.prototype.destroy.apply(this, arguments); - }, - - /** - * Method: processXMLNode - * When passed an xmlNode, parses it for a GML point, and passes - * back an object describing that point. - * - * For subclasses of Feature.WFS, this is the feature to change. - * - * Parameters: - * xmlNode - {XMLNode} - * - * Returns: - * {Object} Data Object with 'id', 'lonlat', and private properties set - */ - processXMLNode: function(xmlNode) { - //this should be overridden by subclasses - // must return an Object with 'id' and 'lonlat' values set - var point = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode, "http://www.opengis.net/gml", "gml", "Point"); - var text = OpenLayers.Util.getXmlNodeValue(OpenLayers.Ajax.getElementsByTagNameNS(point[0], "http://www.opengis.net/gml","gml", "coordinates")[0]); - var floats = text.split(","); - return {lonlat: new OpenLayers.LonLat(parseFloat(floats[0]), - parseFloat(floats[1])), - id: null}; - - }, - - CLASS_NAME: "OpenLayers.Feature.WFS" -}); - - - - - diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Filter.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Filter.js deleted file mode 100755 index 31cbcd36ba..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Filter.js +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license. - * See http://svn.openlayers.org/trunk/openlayers/repository-license.txt - * for the full text of the license. */ - - -/** - * @requires OpenLayers/Util.js - * @requires OpenLayers/Style.js - */ - -/** - * Class: OpenLayers.Filter - * This class represents an OGC Filter. - */ -OpenLayers.Filter = OpenLayers.Class({ - - /** - * Constructor: OpenLayers.Filter - * This is an abstract class. Create an instance of a filter subclass. - * - * Parameters: - * options - {Object} Optional object whose properties will be set on the - * instance. - * - * Returns: - * {} - */ - initialize: function(options) { - OpenLayers.Util.extend(this, options); - }, - - /** - * APIMethod: destroy - * Remove reference to anything added. - */ - destroy: function() { - }, - - /** - * APIMethod: evaluate - * Evaluates this filter in a specific context. Should be implemented by - * subclasses. - * - * Parameters: - * context - {Object} Context to use in evaluating the filter. - * - * Returns: - * {Boolean} The filter applies. - */ - evaluate: function(context) { - return true; - }, - - /** - * APIMethod: clone - * Clones this filter. Should be implementted by subclasses. - * - * Returns: - * {} Clone of this filter. - */ - clone: function() { - return null; - }, - - CLASS_NAME: "OpenLayers.Filter" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Filter/Comparison.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Filter/Comparison.js deleted file mode 100755 index b8d4e92a42..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Filter/Comparison.js +++ /dev/null @@ -1,255 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Filter.js - * @requires OpenLayers/Console.js - */ - -/** - * Class: OpenLayers.Filter.Comparison - * This class represents a comparison filter. - * - * Inherits from - * - - */ -OpenLayers.Filter.Comparison = OpenLayers.Class(OpenLayers.Filter, { - - /** - * APIProperty: type - * {String} type: type of the comparison. This is one of - * - OpenLayers.Filter.Comparison.EQUAL_TO = "=="; - * - OpenLayers.Filter.Comparison.NOT_EQUAL_TO = "!="; - * - OpenLayers.Filter.Comparison.LESS_THAN = "<"; - * - OpenLayers.Filter.Comparison.GREATER_THAN = ">"; - * - OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO = "<="; - * - OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO = ">="; - * - OpenLayers.Filter.Comparison.BETWEEN = ".."; - * - OpenLayers.Filter.Comparison.LIKE = "~"; - */ - type: null, - - /** - * APIProperty: property - * {String} - * name of the context property to compare - */ - property: null, - - /** - * APIProperty: value - * {Number} or {String} - * comparison value for binary comparisons. In the case of a String, this - * can be a combination of text and propertyNames in the form - * "literal ${propertyName}" - */ - value: null, - - /** - * Property: matchCase - * {Boolean} Force case sensitive searches for EQUAL_TO and NOT_EQUAL_TO - * comparisons. The Filter Encoding 1.1 specification added a matchCase - * attribute to ogc:PropertyIsEqualTo and ogc:PropertyIsNotEqualTo - * elements. This property will be serialized with those elements only - * if using the v1.1.0 filter format. However, when evaluating filters - * here, the matchCase property will always be respected (for EQUAL_TO - * and NOT_EQUAL_TO). Default is true. - */ - matchCase: true, - - /** - * APIProperty: lowerBoundary - * {Number} or {String} - * lower boundary for between comparisons. In the case of a String, this - * can be a combination of text and propertyNames in the form - * "literal ${propertyName}" - */ - lowerBoundary: null, - - /** - * APIProperty: upperBoundary - * {Number} or {String} - * upper boundary for between comparisons. In the case of a String, this - * can be a combination of text and propertyNames in the form - * "literal ${propertyName}" - */ - upperBoundary: null, - - /** - * Constructor: OpenLayers.Filter.Comparison - * Creates a comparison rule. - * - * Parameters: - * options - {Object} An optional object with properties to set on the - * rule - * - * Returns: - * {} - */ - initialize: function(options) { - OpenLayers.Filter.prototype.initialize.apply(this, [options]); - }, - - /** - * APIMethod: evaluate - * Evaluates this filter in a specific context. Should be implemented by - * subclasses. - * - * Parameters: - * context - {Object} Context to use in evaluating the filter. - * - * Returns: - * {Boolean} The filter applies. - */ - evaluate: function(context) { - var result = false; - switch(this.type) { - case OpenLayers.Filter.Comparison.EQUAL_TO: - var got = context[this.property]; - var exp = this.value; - if(!this.matchCase && - typeof got == "string" && typeof exp == "string") { - result = (got.toUpperCase() == exp.toUpperCase()); - } else { - result = (got == exp); - } - break; - case OpenLayers.Filter.Comparison.NOT_EQUAL_TO: - var got = context[this.property]; - var exp = this.value; - if(!this.matchCase && - typeof got == "string" && typeof exp == "string") { - result = (got.toUpperCase() != exp.toUpperCase()); - } else { - result = (got != exp); - } - break; - case OpenLayers.Filter.Comparison.LESS_THAN: - result = context[this.property] < this.value; - break; - case OpenLayers.Filter.Comparison.GREATER_THAN: - result = context[this.property] > this.value; - break; - case OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO: - result = context[this.property] <= this.value; - break; - case OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO: - result = context[this.property] >= this.value; - break; - case OpenLayers.Filter.Comparison.BETWEEN: - result = (context[this.property] >= this.lowerBoundary) && - (context[this.property] <= this.upperBoundary); - break; - case OpenLayers.Filter.Comparison.LIKE: - var regexp = new RegExp(this.value, "gi"); - result = regexp.test(context[this.property]); - break; - } - return result; - }, - - /** - * APIMethod: value2regex - * Converts the value of this rule into a regular expression string, - * according to the wildcard characters specified. This method has to - * be called after instantiation of this class, if the value is not a - * regular expression already. - * - * Parameters: - * wildCard - {} wildcard character in the above value, default - * is "*" - * singleChar - {) single-character wildcard in the above value - * default is "." - * escape - {) escape character in the above value, default is - * "!" - * - * Returns: - * {String} regular expression string - */ - value2regex: function(wildCard, singleChar, escapeChar) { - if (wildCard == ".") { - var msg = "'.' is an unsupported wildCard character for "+ - "OpenLayers.Filter.Comparison"; - OpenLayers.Console.error(msg); - return null; - } - - - // set UMN MapServer defaults for unspecified parameters - wildCard = wildCard ? wildCard : "*"; - singleChar = singleChar ? singleChar : "."; - escapeChar = escapeChar ? escapeChar : "!"; - - this.value = this.value.replace( - new RegExp("\\"+escapeChar+"(.|$)", "g"), "\\$1"); - this.value = this.value.replace( - new RegExp("\\"+singleChar, "g"), "."); - this.value = this.value.replace( - new RegExp("\\"+wildCard, "g"), ".*"); - this.value = this.value.replace( - new RegExp("\\\\.\\*", "g"), "\\"+wildCard); - this.value = this.value.replace( - new RegExp("\\\\\\.", "g"), "\\"+singleChar); - - return this.value; - }, - - /** - * Method: regex2value - * Convert the value of this rule from a regular expression string into an - * ogc literal string using a wildCard of *, a singleChar of ., and an - * escape of !. Leaves the property unmodified. - * - * Returns: - * {String} A string value. - */ - regex2value: function() { - - var value = this.value; - - // replace ! with !! - value = value.replace(/!/g, "!!"); - - // replace \. with !. (watching out for \\.) - value = value.replace(/(\\)?\\\./g, function($0, $1) { - return $1 ? $0 : "!."; - }); - - // replace \* with #* (watching out for \\*) - value = value.replace(/(\\)?\\\*/g, function($0, $1) { - return $1 ? $0 : "!*"; - }); - - // replace \\ with \ - value = value.replace(/\\\\/g, "\\"); - - // convert .* to * (the sequence #.* is not allowed) - value = value.replace(/\.\*/g, "*"); - - return value; - }, - - /** - * APIMethod: clone - * Clones this filter. - * - * Returns: - * {} Clone of this filter. - */ - clone: function() { - return OpenLayers.Util.extend(new OpenLayers.Filter.Comparison(), this); - }, - - CLASS_NAME: "OpenLayers.Filter.Comparison" -}); - - -OpenLayers.Filter.Comparison.EQUAL_TO = "=="; -OpenLayers.Filter.Comparison.NOT_EQUAL_TO = "!="; -OpenLayers.Filter.Comparison.LESS_THAN = "<"; -OpenLayers.Filter.Comparison.GREATER_THAN = ">"; -OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO = "<="; -OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO = ">="; -OpenLayers.Filter.Comparison.BETWEEN = ".."; -OpenLayers.Filter.Comparison.LIKE = "~"; diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Filter/FeatureId.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Filter/FeatureId.js deleted file mode 100755 index 9574dd5f76..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Filter/FeatureId.js +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - - -/** - * @requires OpenLayers/Filter.js - */ - -/** - * Class: OpenLayers.Filter.FeatureId - * This class represents a ogc:FeatureId Filter, as being used for rule-based SLD - * styling - * - * Inherits from - * - - */ -OpenLayers.Filter.FeatureId = OpenLayers.Class(OpenLayers.Filter, { - - /** - * APIProperty: fids - * {Array(String)} Feature Ids to evaluate this rule against. To be passed - * To be passed inside the params object. - */ - fids: null, - - /** - * Constructor: OpenLayers.Filter.FeatureId - * Creates an ogc:FeatureId rule. - * - * Parameters: - * options - {Object} An optional object with properties to set on the - * rule - * - * Returns: - * {} - */ - initialize: function(options) { - this.fids = []; - OpenLayers.Filter.prototype.initialize.apply(this, [options]); - }, - - /** - * APIMethod: evaluate - * evaluates this rule for a specific feature - * - * Parameters: - * feature - {} feature to apply the rule to. - * For vector features, the check is run against the fid, - * for plain features against the id. - * - * Returns: - * {Boolean} true if the rule applies, false if it does not - */ - evaluate: function(feature) { - for (var i=0, len=this.fids.length; i} Clone of this filter. - */ - clone: function() { - var filter = new OpenLayers.Filter.FeatureId(); - OpenLayers.Util.extend(filter, this); - filter.fids = this.fids.slice(); - return filter; - }, - - CLASS_NAME: "OpenLayers.Filter.FeatureId" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Filter/Logical.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Filter/Logical.js deleted file mode 100755 index a438af45a5..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Filter/Logical.js +++ /dev/null @@ -1,117 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - - -/** - * @requires OpenLayers/Filter.js - */ - -/** - * Class: OpenLayers.Filter.Logical - * This class represents ogc:And, ogc:Or and ogc:Not rules. - * - * Inherits from - * - - */ -OpenLayers.Filter.Logical = OpenLayers.Class(OpenLayers.Filter, { - - /** - * APIProperty: filters - * {Array()} Child filters for this filter. - */ - filters: null, - - /** - * APIProperty: type - * {String} type of logical operator. Available types are: - * - OpenLayers.Filter.Logical.AND = "&&"; - * - OpenLayers.Filter.Logical.OR = "||"; - * - OpenLayers.Filter.Logical.NOT = "!"; - */ - type: null, - - /** - * Constructor: OpenLayers.Filter.Logical - * Creates a logical filter (And, Or, Not). - * - * Parameters: - * options - {Object} An optional object with properties to set on the - * filter. - * - * Returns: - * {} - */ - initialize: function(options) { - this.filters = []; - OpenLayers.Filter.prototype.initialize.apply(this, [options]); - }, - - /** - * APIMethod: destroy - * Remove reference to child filters. - */ - destroy: function() { - this.filters = null; - OpenLayers.Filter.prototype.destroy.apply(this); - }, - - /** - * APIMethod: evaluate - * Evaluates this filter in a specific context. Should be implemented by - * subclasses. - * - * Parameters: - * context - {Object} Context to use in evaluating the filter. - * - * Returns: - * {Boolean} The filter applies. - */ - evaluate: function(context) { - switch(this.type) { - case OpenLayers.Filter.Logical.AND: - for (var i=0, len=this.filters.length; i} Clone of this filter. - */ - clone: function() { - var filters = []; - for(var i=0, len=this.filters.length; i - */ -OpenLayers.Filter.Spatial = OpenLayers.Class(OpenLayers.Filter, { - - /** - * APIProperty: type - * {String} Type of spatial filter. - * - * The type should be one of: - * - OpenLayers.Filter.Spatial.BBOX - * - OpenLayers.Filter.Spatial.INTERSECTS - * - OpenLayers.Filter.Spatial.DWITHIN - * - OpenLayers.Filter.Spatial.WITHIN - * - OpenLayers.Filter.Spatial.CONTAINS - */ - type: null, - - /** - * APIProperty: property - * {String} Name of the context property to compare. - */ - property: null, - - /** - * APIProperty: value - * { || } The bounds or geometry - * to be used by the filter. Use bounds for BBOX filters and geometry - * for INTERSECTS or DWITHIN filters. - */ - value: null, - - /** - * APIProperty: distance - * {Number} The distance to use in a DWithin spatial filter. - */ - distance: null, - - /** - * APIProperty: distanceUnits - * {String} The units to use for the distance, e.g. 'm'. - */ - distanceUnits: null, - - /** - * Constructor: OpenLayers.Filter.Spatial - * Creates a spatial filter. - * - * Parameters: - * options - {Object} An optional object with properties to set on the - * filter. - * - * Returns: - * {} - */ - initialize: function(options) { - OpenLayers.Filter.prototype.initialize.apply(this, [options]); - }, - - /** - * Method: evaluate - * Evaluates this filter for a specific feature. - * - * Parameters: - * feature - {} feature to apply the filter to. - * - * Returns: - * {Boolean} The feature meets filter criteria. - */ - evaluate: function(feature) { - var intersect = false; - switch(this.type) { - case OpenLayers.Filter.Spatial.BBOX: - case OpenLayers.Filter.Spatial.INTERSECTS: - if(feature.geometry) { - var geom = this.value; - if(this.value.CLASS_NAME == "OpenLayers.Bounds") { - geom = this.value.toGeometry(); - } - if(feature.geometry.intersects(geom)) { - intersect = true; - } - } - break; - default: - OpenLayers.Console.error( - OpenLayers.i18n("filterEvaluateNotImplemented")); - break; - } - return intersect; - }, - - /** - * APIMethod: clone - * Clones this filter. - * - * Returns: - * {} Clone of this filter. - */ - clone: function() { - var options = OpenLayers.Util.applyDefaults({ - value: this.value && this.value.clone && this.value.clone() - }, this); - return new OpenLayers.Filter.Spatial(options); - }, - CLASS_NAME: "OpenLayers.Filter.Spatial" -}); - -OpenLayers.Filter.Spatial.BBOX = "BBOX"; -OpenLayers.Filter.Spatial.INTERSECTS = "INTERSECTS"; -OpenLayers.Filter.Spatial.DWITHIN = "DWITHIN"; -OpenLayers.Filter.Spatial.WITHIN = "WITHIN"; -OpenLayers.Filter.Spatial.CONTAINS = "CONTAINS"; diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format.js deleted file mode 100755 index 0a11e39e3f..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format.js +++ /dev/null @@ -1,122 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Util.js - * @requires OpenLayers/Console.js - */ - -/** - * Class: OpenLayers.Format - * Base class for format reading/writing a variety of formats. Subclasses - * of OpenLayers.Format are expected to have read and write methods. - */ -OpenLayers.Format = OpenLayers.Class({ - - /** - * Property: options - * {Object} A reference to options passed to the constructor. - */ - options: null, - - /** - * APIProperty: externalProjection - * {} When passed a externalProjection and - * internalProjection, the format will reproject the geometries it - * reads or writes. The externalProjection is the projection used by - * the content which is passed into read or which comes out of write. - * In order to reproject, a projection transformation function for the - * specified projections must be available. This support may be - * provided via proj4js or via a custom transformation function. See - * {} for more information on - * custom transformations. - */ - externalProjection: null, - - /** - * APIProperty: internalProjection - * {} When passed a externalProjection and - * internalProjection, the format will reproject the geometries it - * reads or writes. The internalProjection is the projection used by - * the geometries which are returned by read or which are passed into - * write. In order to reproject, a projection transformation function - * for the specified projections must be available. This support may be - * provided via proj4js or via a custom transformation function. See - * {} for more information on - * custom transformations. - */ - internalProjection: null, - - /** - * APIProperty: data - * {Object} When is true, this is the parsed string sent to - * . - */ - data: null, - - /** - * APIProperty: keepData - * {Object} Maintain a reference () to the most recently read data. - * Default is false. - */ - keepData: false, - - /** - * Constructor: OpenLayers.Format - * Instances of this class are not useful. See one of the subclasses. - * - * Parameters: - * options - {Object} An optional object with properties to set on the - * format - * - * Valid options: - * keepData - {Boolean} If true, upon , the data property will be - * set to the parsed object (e.g. the json or xml object). - * - * Returns: - * An instance of OpenLayers.Format - */ - initialize: function(options) { - OpenLayers.Util.extend(this, options); - this.options = options; - }, - - /** - * APIMethod: destroy - * Clean up. - */ - destroy: function() { - }, - - /** - * Method: read - * Read data from a string, and return an object whose type depends on the - * subclass. - * - * Parameters: - * data - {string} Data to read/parse. - * - * Returns: - * Depends on the subclass - */ - read: function(data) { - OpenLayers.Console.userError(OpenLayers.i18n("readNotImplemented")); - }, - - /** - * Method: write - * Accept an object, and return a string. - * - * Parameters: - * object - {Object} Object to be serialized - * - * Returns: - * {String} A string representation of the object. - */ - write: function(object) { - OpenLayers.Console.userError(OpenLayers.i18n("writeNotImplemented")); - }, - - CLASS_NAME: "OpenLayers.Format" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/ArcXML.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/ArcXML.js deleted file mode 100755 index ac195f8f55..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/ArcXML.js +++ /dev/null @@ -1,1025 +0,0 @@ -/* Copyright (c) 2009 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Format/XML.js - * @requires OpenLayers/Geometry/Polygon.js - * @requires OpenLayers/Geometry/Point.js - * @requires OpenLayers/Geometry/MultiPolygon.js - * @requires OpenLayers/Geometry/LinearRing.js - */ - -/** - * Class: OpenLayers.Format.ArcXML - * Read/Wite ArcXML. Create a new instance with the - * constructor. - * - * Inherits from: - * - - */ -OpenLayers.Format.ArcXML = OpenLayers.Class(OpenLayers.Format.XML, { - - /** - * Property: fontStyleKeys - * {Array} List of keys used in font styling. - */ - fontStyleKeys: [ - 'antialiasing', 'blockout', 'font', 'fontcolor','fontsize', 'fontstyle', - 'glowing', 'interval', 'outline', 'printmode', 'shadow', 'transparency' - ], - - /** - * Property: request - * A get_image request destined for an ArcIMS server. - */ - request: null, - - /** - * Property: response - * A parsed response from an ArcIMS server. - */ - response: null, - - /** - * Constructor: OpenLayers.Format.ArcXML - * Create a new parser/writer for ArcXML. Create an instance of this class - * to begin authoring a request to an ArcIMS service. This is used - * primarily by the ArcIMS layer, but could be used to do other wild - * stuff, like geocoding. - * - * Parameters: - * options - {Object} An optional object whose properties will be set on - * this instance. - */ - initialize: function(options) { - this.request = new OpenLayers.Format.ArcXML.Request(); - this.response = new OpenLayers.Format.ArcXML.Response(); - - if (options) { - if (options.requesttype == "feature") { - this.request.get_image = null; - - var qry = this.request.get_feature.query; - this.addCoordSys(qry.featurecoordsys, options.featureCoordSys); - this.addCoordSys(qry.filtercoordsys, options.filterCoordSys); - - if (options.polygon) { - qry.isspatial = true; - qry.spatialfilter.polygon = options.polygon; - } else if (options.envelope) { - qry.isspatial = true; - qry.spatialfilter.envelope = {minx:0, miny:0, maxx:0, maxy:0}; - this.parseEnvelope(qry.spatialfilter.envelope, options.envelope); - } - } else if (options.requesttype == "image") { - this.request.get_feature = null; - - var props = this.request.get_image.properties; - this.parseEnvelope(props.envelope, options.envelope); - - this.addLayers(props.layerlist, options.layers); - this.addImageSize(props.imagesize, options.tileSize); - this.addCoordSys(props.featurecoordsys, options.featureCoordSys); - this.addCoordSys(props.filtercoordsys, options.filterCoordSys); - } else { - // if an arcxml object is being created with no request type, it is - // probably going to consume a response, so do not throw an error if - // the requesttype is not defined - this.request = null; - } - } - - OpenLayers.Format.XML.prototype.initialize.apply(this, [options]); - }, - - /** - * Method: parseEnvelope - * Parse an array of coordinates into an ArcXML envelope structure. - * - * Parameters: - * env - {Object} An envelope object that will contain the parsed coordinates. - * arr - {Array(double)} An array of coordinates in the order: [ minx, miny, maxx, maxy ] - */ - parseEnvelope: function(env, arr) { - if (arr && arr.length == 4) { - env.minx = arr[0]; - env.miny = arr[1]; - env.maxx = arr[2]; - env.maxy = arr[3]; - } - }, - - /** - * Method: addLayers - * Add a collection of layers to another collection of layers. Each layer in the list is tuple of - * { id, visible }. These layer collections represent the - * /ARCXML/REQUEST/get_image/PROPERTIES/LAYERLIST/LAYERDEF items in ArcXML - * - * TODO: Add support for dynamic layer rendering. - * - * Parameters: - * ll - {Array({id,visible})} A list of layer definitions. - * lyrs - {Array({id,visible})} A list of layer definitions. - */ - addLayers: function(ll, lyrs) { - for(var lind = 0, len=lyrs.length; lind < len; lind++) { - ll.push(lyrs[lind]); - } - }, - - /** - * Method: addImageSize - * Set the size of the requested image. - * - * Parameters: - * imsize - {Object} An ArcXML imagesize object. - * olsize - {OpenLayers.Size} The image size to set. - */ - addImageSize: function(imsize, olsize) { - if (olsize !== null) { - imsize.width = olsize.w; - imsize.height = olsize.h; - imsize.printwidth = olsize.w; - imsize.printheight = olsize.h; - } - }, - - /** - * Method: addCoordSys - * Add the coordinate system information to an object. The object may be - * - * Parameters: - * featOrFilt - {Object} A featurecoordsys or filtercoordsys ArcXML structure. - * fsys - {String} or {OpenLayers.Projection} or {filtercoordsys} or - * {featurecoordsys} A projection representation. If it's a {String}, - * the value is assumed to be the SRID. If it's a {OpenLayers.Projection} - * AND Proj4js is available, the projection number and name are extracted - * from there. If it's a filter or feature ArcXML structure, it is copied. - */ - addCoordSys: function(featOrFilt, fsys) { - if (typeof fsys == "string") { - featOrFilt.id = parseInt(fsys); - featOrFilt.string = fsys; - } - // is this a proj4js instance? - else if (typeof fsys == "object" && fsys.proj !== null){ - featOrFilt.id = fsys.proj.srsProjNumber; - featOrFilt.string = fsys.proj.srsCode; - } else { - featOrFilt = fsys; - } - }, - - /** - * APIMethod: iserror - * Check to see if the response from the server was an error. - * - * Parameters: - * data - {String} or {DOMElement} data to read/parse. If nothing is supplied, - * the current response is examined. - * - * Returns: - * {Boolean} true if the response was an error. - */ - iserror: function(data) { - var ret = null; - - if (!data) { - ret = (this.response.error !== ''); - } else { - data = OpenLayers.Format.XML.prototype.read.apply(this, [data]); - var errorNodes = data.documentElement.getElementsByTagName("ERROR"); - ret = (errorNodes !== null && errorNodes.length > 0); - } - - return ret; - }, - - /** - * APIMethod: read - * Read data from a string, and return an response. - * - * Parameters: - * data - {String} or {DOMElement} data to read/parse. - * - * Returns: - * {OpenLayers.Format.ArcXML.Response} An ArcXML response. Note that this response - * data may change in the future. - */ - read: function(data) { - if(typeof data == "string") { - data = OpenLayers.Format.XML.prototype.read.apply(this, [data]); - } - - var arcNode = null; - if (data && data.documentElement) { - if(data.documentElement.nodeName == "ARCXML") { - arcNode = data.documentElement; - } else { - arcNode = data.documentElement.getElementsByTagName("ARCXML")[0]; - } - } - - if (!arcNode) { - var error, source; - try { - error = data.firstChild.nodeValue; - source = data.firstChild.childNodes[1].firstChild.nodeValue; - } catch (err) { - // pass - } - throw { - message: "Error parsing the ArcXML request", - error: error, - source: source - }; - } - - var response = this.parseResponse(arcNode); - return response; - }, - - /** - * APIMethod: write - * Generate an ArcXml document string for sending to an ArcIMS server. - * - * Returns: - * {String} A string representing the ArcXML document request. - */ - write: function(request) { - if (!request) { - request = this.request; - } - var root = this.createElementNS("", "ARCXML"); - root.setAttribute("version","1.1"); - - var reqElem = this.createElementNS("", "REQUEST"); - - if (request.get_image != null) { - var getElem = this.createElementNS("", "GET_IMAGE"); - reqElem.appendChild(getElem); - - var propElem = this.createElementNS("", "PROPERTIES"); - getElem.appendChild(propElem); - - var props = request.get_image.properties; - if (props.featurecoordsys != null) { - var feat = this.createElementNS("", "FEATURECOORDSYS"); - propElem.appendChild(feat); - - if (props.featurecoordsys.id === 0) { - feat.setAttribute("string", props.featurecoordsys['string']); - } - else { - feat.setAttribute("id", props.featurecoordsys.id); - } - } - - if (props.filtercoordsys != null) { - var filt = this.createElementNS("", "FILTERCOORDSYS"); - propElem.appendChild(filt); - - if (props.filtercoordsys.id === 0) { - filt.setAttribute("string", props.filtercoordsys.string); - } - else { - filt.setAttribute("id", props.filtercoordsys.id); - } - } - - if (props.envelope != null) { - var env = this.createElementNS("", "ENVELOPE"); - propElem.appendChild(env); - - env.setAttribute("minx", props.envelope.minx); - env.setAttribute("miny", props.envelope.miny); - env.setAttribute("maxx", props.envelope.maxx); - env.setAttribute("maxy", props.envelope.maxy); - } - - var imagesz = this.createElementNS("", "IMAGESIZE"); - propElem.appendChild(imagesz); - - imagesz.setAttribute("height", props.imagesize.height); - imagesz.setAttribute("width", props.imagesize.width); - - if (props.imagesize.height != props.imagesize.printheight || - props.imagesize.width != props.imagesize.printwidth) { - imagesz.setAttribute("printheight", props.imagesize.printheight); - imagesz.setArrtibute("printwidth", props.imagesize.printwidth); - } - - if (props.background != null) { - var backgrnd = this.createElementNS("", "BACKGROUND"); - propElem.appendChild(backgrnd); - - backgrnd.setAttribute("color", - props.background.color.r + "," + - props.background.color.g + "," + - props.background.color.b); - - if (props.background.transcolor !== null) { - backgrnd.setAttribute("transcolor", - props.background.transcolor.r + "," + - props.background.transcolor.g + "," + - props.background.transcolor.b); - } - } - - if (props.layerlist != null && props.layerlist.length > 0) { - var layerlst = this.createElementNS("", "LAYERLIST"); - propElem.appendChild(layerlst); - - for (var ld = 0; ld < props.layerlist.length; ld++) { - var ldef = this.createElementNS("", "LAYERDEF"); - layerlst.appendChild(ldef); - - ldef.setAttribute("id", props.layerlist[ld].id); - ldef.setAttribute("visible", props.layerlist[ld].visible); - - if (typeof props.layerlist[ld].query == "object") { - var query = props.layerlist[ld].query; - - if (query.where.length < 0) { - continue; - } - - var queryElem = null; - if (typeof query.spatialfilter == "boolean" && query.spatialfilter) { - // handle spatial filter madness - queryElem = this.createElementNS("", "SPATIALQUERY"); - } - else { - queryElem = this.createElementNS("", "QUERY"); - } - - queryElem.setAttribute("where", query.where); - - if (typeof query.accuracy == "number" && query.accuracy > 0) { - queryElem.setAttribute("accuracy", query.accuracy); - } - if (typeof query.featurelimit == "number" && query.featurelimit < 2000) { - queryElem.setAttribute("featurelimit", query.featurelimit); - } - if (typeof query.subfields == "string" && query.subfields != "#ALL#") { - queryElem.setAttribute("subfields", query.subfields); - } - if (typeof query.joinexpression == "string" && query.joinexpression.length > 0) { - queryElem.setAttribute("joinexpression", query.joinexpression); - } - if (typeof query.jointables == "string" && query.jointables.length > 0) { - queryElem.setAttribute("jointables", query.jointables); - } - - ldef.appendChild(queryElem); - } - - if (typeof props.layerlist[ld].renderer == "object") { - this.addRenderer(ldef, props.layerlist[ld].renderer); - } - } - } - } else if (request.get_feature != null) { - var getElem = this.createElementNS("", "GET_FEATURES"); - getElem.setAttribute("outputmode", "newxml"); - getElem.setAttribute("checkesc", "true"); - - if (request.get_feature.geometry) { - getElem.setAttribute("geometry", request.get_feature.geometry); - } - else { - getElem.setAttribute("geometry", "false"); - } - - if (request.get_feature.compact) { - getElem.setAttribute("compact", request.get_feature.compact); - } - - if (request.get_feature.featurelimit == "number") { - getElem.setAttribute("featurelimit", request.get_feature.featurelimit); - } - - getElem.setAttribute("globalenvelope", "true"); - reqElem.appendChild(getElem); - - if (request.get_feature.layer != null && request.get_feature.layer.length > 0) { - var lyrElem = this.createElementNS("", "LAYER"); - lyrElem.setAttribute("id", request.get_feature.layer); - getElem.appendChild(lyrElem); - } - - var fquery = request.get_feature.query; - if (fquery != null) { - var qElem = null; - if (fquery.isspatial) { - qElem = this.createElementNS("", "SPATIALQUERY"); - } else { - qElem = this.createElementNS("", "QUERY"); - } - getElem.appendChild(qElem); - - if (typeof fquery.accuracy == "number") { - qElem.setAttribute("accuracy", fquery.accuracy); - } - //qElem.setAttribute("featurelimit", "5"); - - if (fquery.featurecoordsys != null) { - var fcsElem1 = this.createElementNS("", "FEATURECOORDSYS"); - - if (fquery.featurecoordsys.id == 0) { - fcsElem1.setAttribute("string", fquery.featurecoordsys.string); - } else { - fcsElem1.setAttribute("id", fquery.featurecoordsys.id); - } - qElem.appendChild(fcsElem1); - } - - if (fquery.filtercoordsys != null) { - var fcsElem2 = this.createElementNS("", "FILTERCOORDSYS"); - - if (fquery.filtercoordsys.id === 0) { - fcsElem2.setAttribute("string", fquery.filtercoordsys.string); - } else { - fcsElem2.setAttribute("id", fquery.filtercoordsys.id); - } - qElem.appendChild(fcsElem2); - } - - if (fquery.buffer > 0) { - var bufElem = this.createElementNS("", "BUFFER"); - bufElem.setAttribute("distance", fquery.buffer); - qElem.appendChild(bufElem); - } - - if (fquery.isspatial) { - var spfElem = this.createElementNS("", "SPATIALFILTER"); - spfElem.setAttribute("relation", fquery.spatialfilter.relation); - qElem.appendChild(spfElem); - - if (fquery.spatialfilter.envelope) { - var envElem = this.createElementNS("", "ENVELOPE"); - envElem.setAttribute("minx", fquery.spatialfilter.envelope.minx); - envElem.setAttribute("miny", fquery.spatialfilter.envelope.miny); - envElem.setAttribute("maxx", fquery.spatialfilter.envelope.maxx); - envElem.setAttribute("maxy", fquery.spatialfilter.envelope.maxy); - spfElem.appendChild(envElem); - } else if(typeof fquery.spatialfilter.polygon == "object") { - spfElem.appendChild(this.writePolygonGeometry(fquery.spatialfilter.polygon)); - } - } - - if (fquery.where != null && fquery.where.length > 0) { - qElem.setAttribute("where", fquery.where); - } - } - } - - root.appendChild(reqElem); - - return OpenLayers.Format.XML.prototype.write.apply(this, [root]); - }, - - - addGroupRenderer: function(ldef, toprenderer) { - var topRelem = this.createElementNS("", "GROUPRENDERER"); - ldef.appendChild(topRelem); - - for (var rind = 0; rind < toprenderer.length; rind++) { - var renderer = toprenderer[rind]; - this.addRenderer(topRelem, renderer); - } - }, - - - addRenderer: function(topRelem, renderer) { - if (renderer instanceof Array) { - this.addGroupRenderer(topRelem, renderer); - } else { - var renderElem = this.createElementNS("", renderer.type.toUpperCase() + "RENDERER"); - topRelem.appendChild(renderElem); - - if (renderElem.tagName == "VALUEMAPRENDERER") { - this.addValueMapRenderer(renderElem, renderer); - } else if (renderElem.tagName == "VALUEMAPLABELRENDERER") { - this.addValueMapLabelRenderer(renderElem, renderer); - } else if (renderElem.tagName == "SIMPLELABELRENDERER") { - this.addSimpleLabelRenderer(renderElem, renderer); - } else if (renderElem.tagName == "SCALEDEPENDENTRENDERER") { - this.addScaleDependentRenderer(renderElem, renderer); - } - } - }, - - - addScaleDependentRenderer: function(renderElem, renderer) { - if (typeof renderer.lower == "string" || typeof renderer.lower == "number") { - renderElem.setAttribute("lower", renderer.lower); - } - if (typeof renderer.upper == "string" || typeof renderer.upper == "number") { - renderElem.setAttribute("upper", renderer.upper); - } - - this.addRenderer(renderElem, renderer.renderer); - }, - - - addValueMapLabelRenderer: function(renderElem, renderer) { - renderElem.setAttribute("lookupfield", renderer.lookupfield); - renderElem.setAttribute("labelfield", renderer.labelfield); - - if (typeof renderer.exacts == "object") { - for (var ext=0, extlen=renderer.exacts.length; ext 0) { - response.error = this.getChildValue(errorNode, "Unknown error."); - } else { - var responseNode = data.getElementsByTagName("RESPONSE"); - - if (responseNode == null || responseNode.length == 0) { - response.error = "No RESPONSE tag found in ArcXML response."; - return response; - } - - var rtype = responseNode[0].firstChild.nodeName; - if (rtype == "#text") { - rtype = responseNode[0].firstChild.nextSibling.nodeName; - } - - if (rtype == "IMAGE") { - var envelopeNode = data.getElementsByTagName("ENVELOPE"); - var outputNode = data.getElementsByTagName("OUTPUT"); - - if (envelopeNode == null || envelopeNode.length == 0) { - response.error = "No ENVELOPE tag found in ArcXML response."; - } else if (outputNode == null || outputNode.length == 0) { - response.error = "No OUTPUT tag found in ArcXML response."; - } else { - var envAttr = this.parseAttributes(envelopeNode[0]); - var outputAttr = this.parseAttributes(outputNode[0]); - - if (typeof outputAttr.type == "string") { - response.image = { - envelope: envAttr, - output: { - type: outputAttr.type, - data: this.getChildValue(outputNode[0]) - } - }; - } else { - response.image = { envelope: envAttr, output: outputAttr }; - } - } - } else if (rtype == "FEATURES") { - var features = responseNode[0].getElementsByTagName("FEATURES"); - - // get the feature count - var featureCount = features[0].getElementsByTagName("FEATURECOUNT"); - response.features.featurecount = featureCount[0].getAttribute("count"); - - if (response.features.featurecount > 0) { - // get the feature envelope - var envelope = features[0].getElementsByTagName("ENVELOPE"); - response.features.envelope = this.parseAttributes(envelope[0], typeof(0)); - - // get the field values per feature - var featureList = features[0].getElementsByTagName("FEATURE"); - for (var fn = 0; fn < featureList.length; fn++) { - var feature = new OpenLayers.Feature.Vector(); - var fields = featureList[fn].getElementsByTagName("FIELD"); - - for (var fdn = 0; fdn < fields.length; fdn++) { - var fieldName = fields[fdn].getAttribute("name"); - var fieldValue = fields[fdn].getAttribute("value"); - feature.attributes[ fieldName ] = fieldValue; - } - - var geom = featureList[fn].getElementsByTagName("POLYGON"); - - if (geom.length > 0) { - // if there is a polygon, create an openlayers polygon, and assign - // it to the .geometry property of the feature - var ring = geom[0].getElementsByTagName("RING"); - - var polys = []; - for (var rn = 0; rn < ring.length; rn++) { - var linearRings = []; - linearRings.push(this.parsePointGeometry(ring[rn])); - - var holes = ring[rn].getElementsByTagName("HOLE"); - for (var hn = 0; hn < holes.length; hn++) { - linearRings.push(this.parsePointGeometry(holes[hn])); - } - holes = null; - polys.push(new OpenLayers.Geometry.Polygon(linearRings)); - linearRings = null; - } - ring = null; - - if (polys.length == 1) { - feature.geometry = polys[0]; - } else - { - feature.geometry = new OpenLayers.Geometry.MultiPolygon(polys); - } - } - - response.features.feature.push(feature); - } - } - } else { - response.error = "Unidentified response type."; - } - } - return response; - }, - - - /** - * Method: parseAttributes - * - * Parameters: - * node - {} An element to parse attributes from. - * - * Returns: - * {Object} An attributes object, with properties set to attribute values. - */ - parseAttributes: function(node,type) { - var attributes = {}; - for(var attr = 0; attr < node.attributes.length; attr++) { - if (type == "number") { - attributes[node.attributes[attr].nodeName] = parseFloat(node.attributes[attr].nodeValue); - } else { - attributes[node.attributes[attr].nodeName] = node.attributes[attr].nodeValue; - } - } - return attributes; - }, - - - /** - * Method: parsePointGeometry - * - * Parameters: - * node - {} An element to parse or arcxml data from. - * - * Returns: - * {OpenLayers.Geometry.LinearRing} A linear ring represented by the node's points. - */ - parsePointGeometry: function(node) { - var ringPoints = []; - var coords = node.getElementsByTagName("COORDS"); - - if (coords.length > 0) { - // if coords is present, it's the only coords item - var coordArr = this.getChildValue(coords[0]); - coordArr = coordArr.split(/;/); - for (var cn = 0; cn < coordArr.length; cn++) { - var coordItems = coordArr[cn].split(/ /); - ringPoints.push(new OpenLayers.Geometry.Point(parseFloat(coordItems[0]), parseFloat(coordItems[1]))); - } - coords = null; - } else { - var point = node.getElementsByTagName("POINT"); - if (point.length > 0) { - for (var pn = 0; pn < point.length; pn++) { - ringPoints.push( - new OpenLayers.Geometry.Point( - parseFloat(point[pn].getAttribute("x")), - parseFloat(point[pn].getAttribute("y")) - ) - ); - } - } - point = null; - } - - return new OpenLayers.Geometry.LinearRing(ringPoints); - }, - - CLASS_NAME: "OpenLayers.Format.ArcXML" -}); - -OpenLayers.Format.ArcXML.Request = OpenLayers.Class({ - initialize: function(params) { - var defaults = { - get_image: { - properties: { - background: null, - /*{ - color: { r:255, g:255, b:255 }, - transcolor: null - },*/ - draw: true, - envelope: { - minx: 0, - miny: 0, - maxx: 0, - maxy: 0 - }, - featurecoordsys: { - id:0, - string:"", - datumtransformid:0, - datumtransformstring:"" - }, - filtercoordsys:{ - id:0, - string:"", - datumtransformid:0, - datumtransformstring:"" - }, - imagesize:{ - height:0, - width:0, - dpi:96, - printheight:0, - printwidth:0, - scalesymbols:false - }, - layerlist:[], - /* no support for legends */ - output:{ - baseurl:"", - legendbaseurl:"", - legendname:"", - legendpath:"", - legendurl:"", - name:"", - path:"", - type:"jpg", - url:"" - } - } - }, - - get_feature: { - layer: "", - query: { - isspatial: false, - featurecoordsys: { - id:0, - string:"", - datumtransformid:0, - datumtransformstring:"" - }, - filtercoordsys: { - id:0, - string:"", - datumtransformid:0, - datumtransformstring:"" - }, - buffer:0, - where:"", - spatialfilter: { - relation: "envelope_intersection", - envelope: null - } - } - }, - - environment: { - separators: { - cs:" ", - ts:";" - } - }, - - layer: [], - workspaces: [] - }; - - return OpenLayers.Util.extend(this, defaults); - }, - - CLASS_NAME: "OpenLayers.Format.ArcXML.Request" -}); - -OpenLayers.Format.ArcXML.Response = OpenLayers.Class({ - initialize: function(params) { - var defaults = { - image: { - envelope:null, - output:'' - }, - - features: { - featurecount: 0, - envelope: null, - feature: [] - }, - - error:'' - }; - - return OpenLayers.Util.extend(this, defaults); - }, - - CLASS_NAME: "OpenLayers.Format.ArcXML.Response" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/ArcXML/Features.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/ArcXML/Features.js deleted file mode 100755 index 7e71feb201..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/ArcXML/Features.js +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (c) 2009 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Format/ArcXML.js - */ - -/** - * Class: OpenLayers.Format.ArcXML.Features - * Read/Wite ArcXML features. Create a new instance with the - * constructor. - * - * Inherits from: - * - - */ -OpenLayers.Format.ArcXML.Features = OpenLayers.Class(OpenLayers.Format.XML, { - - /** - * Constructor: OpenLayers.Format.ArcXML.Features - * Create a new parser/writer for ArcXML Features. Create an instance of this class - * to get a set of features from an ArcXML response. - * - * Parameters: - * options - {Object} An optional object whose properties will be set on - * this instance. - */ - initialize: function(options) { - OpenLayers.Format.XML.prototype.initialize.apply(this, [options]); - }, - - /** - * APIMethod: read - * Read data from a string of ArcXML, and return a set of OpenLayers features. - * - * Parameters: - * data - {String} or {DOMElement} data to read/parse. - * - * Returns: - * {Array()} A collection of features. - */ - read: function(data) { - var axl = new OpenLayers.Format.ArcXML(); - var parsed = axl.read(data); - - return parsed.features.feature; - } -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/Filter.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/Filter.js deleted file mode 100755 index 142ffb71e4..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/Filter.js +++ /dev/null @@ -1,114 +0,0 @@ -/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license. - * See http://svn.openlayers.org/trunk/openlayers/repository-license.txt - * for the full text of the license. */ - -/** - * @requires OpenLayers/Format/XML.js - * @requires OpenLayers/Filter/FeatureId.js - * @requires OpenLayers/Filter/Logical.js - * @requires OpenLayers/Filter/Comparison.js - */ - -/** - * Class: OpenLayers.Format.Filter - * Read/Wite ogc:Filter. Create a new instance with the - * constructor. - * - * Inherits from: - * - - */ -OpenLayers.Format.Filter = OpenLayers.Class(OpenLayers.Format.XML, { - - /** - * APIProperty: defaultVersion - * {String} Version number to assume if none found. Default is "1.0.0". - */ - defaultVersion: "1.0.0", - - /** - * APIProperty: version - * {String} Specify a version string if one is known. - */ - version: null, - - /** - * Property: parser - * {Object} Instance of the versioned parser. Cached for multiple read and - * write calls of the same version. - */ - parser: null, - - /** - * Constructor: OpenLayers.Format.Filter - * Create a new parser for Filter. - * - * Parameters: - * options - {Object} An optional object whose properties will be set on - * this instance. - */ - initialize: function(options) { - OpenLayers.Format.XML.prototype.initialize.apply(this, [options]); - }, - - /** - * APIMethod: write - * Write an ogc:Filter given a filter object. - * - * Parameters: - * filter - {} An filter. - * options - {Object} Optional configuration object. - * - * Returns: - * {Elment} An ogc:Filter element node. - */ - write: function(filter, options) { - var version = (options && options.version) || - this.version || this.defaultVersion; - if(!this.parser || this.parser.VERSION != version) { - var format = OpenLayers.Format.Filter[ - "v" + version.replace(/\./g, "_") - ]; - if(!format) { - throw "Can't find a Filter parser for version " + - version; - } - this.parser = new format(this.options); - } - return this.parser.write(filter); - //return OpenLayers.Format.XML.prototype.write.apply(this, [root]); - }, - - /** - * APIMethod: read - * Read and Filter doc and return an object representing the Filter. - * - * Parameters: - * data - {String | DOMElement} Data to read. - * - * Returns: - * {} A filter object. - */ - read: function(data) { - if(typeof data == "string") { - data = OpenLayers.Format.XML.prototype.read.apply(this, [data]); - } - var version = this.version; - if(!version) { - version = this.defaultVersion; - } - if(!this.parser || this.parser.VERSION != version) { - var format = OpenLayers.Format.Filter[ - "v" + version.replace(/\./g, "_") - ]; - if(!format) { - throw "Can't find a Filter parser for version " + - version; - } - this.parser = new format(this.options); - } - var filter = this.parser.read(data); - return filter; - }, - - CLASS_NAME: "OpenLayers.Format.Filter" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/Filter/v1.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/Filter/v1.js deleted file mode 100755 index 244e61d798..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/Filter/v1.js +++ /dev/null @@ -1,449 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Format/Filter.js - * @requires OpenLayers/Format/XML.js - */ - -/** - * Class: OpenLayers.Format.Filter.v1 - * Superclass for Filter version 1 parsers. - * - * Inherits from: - * - - */ -OpenLayers.Format.Filter.v1 = OpenLayers.Class(OpenLayers.Format.XML, { - - /** - * Property: namespaces - * {Object} Mapping of namespace aliases to namespace URIs. - */ - namespaces: { - ogc: "http://www.opengis.net/ogc", - gml: "http://www.opengis.net/gml", - xlink: "http://www.w3.org/1999/xlink", - xsi: "http://www.w3.org/2001/XMLSchema-instance" - }, - - /** - * Property: defaultPrefix - */ - defaultPrefix: "ogc", - - /** - * Property: schemaLocation - * {String} Schema location for a particular minor version. - */ - schemaLocation: null, - - /** - * Constructor: OpenLayers.Format.Filter.v1 - * Instances of this class are not created directly. Use the - * constructor instead. - * - * Parameters: - * options - {Object} An optional object whose properties will be set on - * this instance. - */ - initialize: function(options) { - OpenLayers.Format.XML.prototype.initialize.apply(this, [options]); - }, - - /** - * Method: read - * - * Parameters: - * data - {DOMElement} A Filter document element. - * - * Returns: - * {} A filter object. - */ - read: function(data) { - var obj = {}; - this.readers.ogc["Filter"].apply(this, [data, obj]); - return obj.filter; - }, - - /** - * Property: readers - * Contains public functions, grouped by namespace prefix, that will - * be applied when a namespaced node is found matching the function - * name. The function will be applied in the scope of this parser - * with two arguments: the node being read and a context object passed - * from the parent. - */ - readers: { - "ogc": { - "Filter": function(node, parent) { - // Filters correspond to subclasses of OpenLayers.Filter. - // Since they contain information we don't persist, we - // create a temporary object and then pass on the filter - // (ogc:Filter) to the parent obj. - var obj = { - fids: [], - filters: [] - }; - this.readChildNodes(node, obj); - if(obj.fids.length > 0) { - parent.filter = new OpenLayers.Filter.FeatureId({ - fids: obj.fids - }); - } else if(obj.filters.length > 0) { - parent.filter = obj.filters[0]; - } - }, - "FeatureId": function(node, obj) { - var fid = node.getAttribute("fid"); - if(fid) { - obj.fids.push(fid); - } - }, - "And": function(node, obj) { - var filter = new OpenLayers.Filter.Logical({ - type: OpenLayers.Filter.Logical.AND - }); - this.readChildNodes(node, filter); - obj.filters.push(filter); - }, - "Or": function(node, obj) { - var filter = new OpenLayers.Filter.Logical({ - type: OpenLayers.Filter.Logical.OR - }); - this.readChildNodes(node, filter); - obj.filters.push(filter); - }, - "Not": function(node, obj) { - var filter = new OpenLayers.Filter.Logical({ - type: OpenLayers.Filter.Logical.NOT - }); - this.readChildNodes(node, filter); - obj.filters.push(filter); - }, - "PropertyIsLessThan": function(node, obj) { - var filter = new OpenLayers.Filter.Comparison({ - type: OpenLayers.Filter.Comparison.LESS_THAN - }); - this.readChildNodes(node, filter); - obj.filters.push(filter); - }, - "PropertyIsGreaterThan": function(node, obj) { - var filter = new OpenLayers.Filter.Comparison({ - type: OpenLayers.Filter.Comparison.GREATER_THAN - }); - this.readChildNodes(node, filter); - obj.filters.push(filter); - }, - "PropertyIsLessThanOrEqualTo": function(node, obj) { - var filter = new OpenLayers.Filter.Comparison({ - type: OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO - }); - this.readChildNodes(node, filter); - obj.filters.push(filter); - }, - "PropertyIsGreaterThanOrEqualTo": function(node, obj) { - var filter = new OpenLayers.Filter.Comparison({ - type: OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO - }); - this.readChildNodes(node, filter); - obj.filters.push(filter); - }, - "PropertyIsBetween": function(node, obj) { - var filter = new OpenLayers.Filter.Comparison({ - type: OpenLayers.Filter.Comparison.BETWEEN - }); - this.readChildNodes(node, filter); - obj.filters.push(filter); - }, - "PropertyIsLike": function(node, obj) { - var filter = new OpenLayers.Filter.Comparison({ - type: OpenLayers.Filter.Comparison.LIKE - }); - this.readChildNodes(node, filter); - var wildCard = node.getAttribute("wildCard"); - var singleChar = node.getAttribute("singleChar"); - var esc = node.getAttribute("escape"); - filter.value2regex(wildCard, singleChar, esc); - obj.filters.push(filter); - }, - "Literal": function(node, obj) { - obj.value = OpenLayers.String.numericIf( - this.getChildValue(node)); - }, - "PropertyName": function(node, filter) { - filter.property = this.getChildValue(node); - }, - "LowerBoundary": function(node, filter) { - filter.lowerBoundary = OpenLayers.String.numericIf( - this.readOgcExpression(node)); - }, - "UpperBoundary": function(node, filter) { - filter.upperBoundary = OpenLayers.String.numericIf( - this.readOgcExpression(node)); - }, - "Intersects": function(node, obj) { - this.readSpatial(node, obj, OpenLayers.Filter.Spatial.INTERSECTS); - }, - "Within": function(node, obj) { - this.readSpatial(node, obj, OpenLayers.Filter.Spatial.WITHIN); - }, - "Contains": function(node, obj) { - this.readSpatial(node, obj, OpenLayers.Filter.Spatial.CONTAINS); - }, - "DWithin": function(node, obj) { - this.readSpatial(node, obj, OpenLayers.Filter.Spatial.DWITHIN); - }, - "Distance": function(node, obj) { - obj.distance = parseInt(this.getChildValue(node)); - obj.distanceUnits = node.getAttribute("units"); - } - } - }, - - /** - * Method: readSpatial - * - * Read a {} filter. - * - * Parameters: - * node - {DOMElement} A DOM element that contains an ogc:expression. - * obj - {Object} The target object. - * type - {String} One of the OpenLayers.Filter.Spatial.* constants. - * - * Returns: - * {} The created filter. - */ - readSpatial: function(node, obj, type) { - var filter = new OpenLayers.Filter.Spatial({ - type: type - }); - this.readChildNodes(node, filter); - filter.value = filter.components[0]; - delete filter.components; - obj.filters.push(filter); - }, - - /** - * Method: readOgcExpression - * Limited support for OGC expressions. - * - * Parameters: - * node - {DOMElement} A DOM element that contains an ogc:expression. - * - * Returns: - * {String} A value to be used in a symbolizer. - */ - readOgcExpression: function(node) { - var obj = {}; - this.readChildNodes(node, obj); - var value = obj.value; - if(!value) { - value = this.getChildValue(node); - } - return value; - }, - - /** - * Method: write - * - * Parameters: - * filter - {} A filter object. - * - * Returns: - * {DOMElement} An ogc:Filter element. - */ - write: function(filter) { - return this.writers.ogc["Filter"].apply(this, [filter]); - }, - - /** - * Property: writers - * As a compliment to the readers property, this structure contains public - * writing functions grouped by namespace alias and named like the - * node names they produce. - */ - writers: { - "ogc": { - "Filter": function(filter) { - var node = this.createElementNSPlus("ogc:Filter"); - var sub = filter.CLASS_NAME.split(".").pop(); - if(sub == "FeatureId") { - for(var i=0; i": "PropertyIsGreaterThan", - "<=": "PropertyIsLessThanOrEqualTo", - ">=": "PropertyIsGreaterThanOrEqualTo", - "..": "PropertyIsBetween", - "~": "PropertyIsLike", - "BBOX": "BBOX", - "DWITHIN": "DWITHIN", - "WITHIN": "WITHIN", - "CONTAINS": "CONTAINS", - "INTERSECTS": "INTERSECTS" - }, - - CLASS_NAME: "OpenLayers.Format.Filter.v1" - -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/Filter/v1_0_0.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/Filter/v1_0_0.js deleted file mode 100755 index 6024836fe7..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/Filter/v1_0_0.js +++ /dev/null @@ -1,145 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Format/GML/v2.js - * @requires OpenLayers/Format/Filter/v1.js - */ - -/** - * Class: OpenLayers.Format.Filter.v1_0_0 - * Write ogc:Filter version 1.0.0. - * - * Inherits from: - * - - * - - */ -OpenLayers.Format.Filter.v1_0_0 = OpenLayers.Class( - OpenLayers.Format.GML.v2, OpenLayers.Format.Filter.v1, { - - /** - * Constant: VERSION - * {String} 1.0.0 - */ - VERSION: "1.0.0", - - /** - * Property: schemaLocation - * {String} http://www.opengis.net/ogc/filter/1.0.0/filter.xsd - */ - schemaLocation: "http://www.opengis.net/ogc/filter/1.0.0/filter.xsd", - - /** - * Constructor: OpenLayers.Format.Filter.v1_0_0 - * Instances of this class are not created directly. Use the - * constructor instead. - * - * Parameters: - * options - {Object} An optional object whose properties will be set on - * this instance. - */ - initialize: function(options) { - OpenLayers.Format.GML.v2.prototype.initialize.apply( - this, [options] - ); - }, - - /** - * Property: readers - * Contains public functions, grouped by namespace prefix, that will - * be applied when a namespaced node is found matching the function - * name. The function will be applied in the scope of this parser - * with two arguments: the node being read and a context object passed - * from the parent. - */ - readers: { - "ogc": OpenLayers.Util.applyDefaults({ - "PropertyIsEqualTo": function(node, obj) { - var filter = new OpenLayers.Filter.Comparison({ - type: OpenLayers.Filter.Comparison.EQUAL_TO - }); - this.readChildNodes(node, filter); - obj.filters.push(filter); - }, - "PropertyIsNotEqualTo": function(node, obj) { - var filter = new OpenLayers.Filter.Comparison({ - type: OpenLayers.Filter.Comparison.NOT_EQUAL_TO - }); - this.readChildNodes(node, filter); - obj.filters.push(filter); - } - }, OpenLayers.Format.Filter.v1.prototype.readers["ogc"]), - "gml": OpenLayers.Format.GML.v2.prototype.readers["gml"], - "feature": OpenLayers.Format.GML.v2.prototype.readers["feature"] - }, - - /** - * Property: writers - * As a compliment to the readers property, this structure contains public - * writing functions grouped by namespace alias and named like the - * node names they produce. - */ - writers: { - "ogc": OpenLayers.Util.applyDefaults({ - "PropertyIsEqualTo": function(filter) { - var node = this.createElementNSPlus("ogc:PropertyIsEqualTo"); - // no ogc:expression handling for now - this.writeNode("PropertyName", filter, node); - this.writeNode("Literal", filter.value, node); - return node; - }, - "PropertyIsNotEqualTo": function(filter) { - var node = this.createElementNSPlus("ogc:PropertyIsNotEqualTo"); - // no ogc:expression handling for now - this.writeNode("PropertyName", filter, node); - this.writeNode("Literal", filter.value, node); - return node; - }, - "BBOX": function(filter) { - var node = this.createElementNSPlus("ogc:BBOX"); - this.writeNode("PropertyName", filter, node); - var box = this.writeNode("gml:Box", filter.value, node); - if(filter.projection) { - box.setAttribute("srsName", filter.projection); - } - return node; - }}, OpenLayers.Format.Filter.v1.prototype.writers["ogc"]), - - "gml": OpenLayers.Format.GML.v2.prototype.writers["gml"], - "feature": OpenLayers.Format.GML.v2.prototype.writers["feature"] - - }, - - /** - * Method: writeSpatial - * - * Read a {} filter and converts it into XML. - * - * Parameters: - * filter - {} The filter. - * name - {String} Name of the generated XML element. - * - * Returns: - * {DOMElement} The created XML element. - */ - writeSpatial: function(filter, name) { - var node = this.createElementNSPlus("ogc:"+name); - this.writeNode("PropertyName", filter, node); - var child; - if(filter.value instanceof OpenLayers.Geometry) { - child = this.writeNode("feature:_geometry", filter.value).firstChild; - } else { - child = this.writeNode("gml:Box", filter.value); - } - if(filter.projection) { - child.setAttribute("srsName", filter.projection); - } - node.appendChild(child); - return node; - }, - - - CLASS_NAME: "OpenLayers.Format.Filter.v1_0_0" - -}); \ No newline at end of file diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/Filter/v1_1_0.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/Filter/v1_1_0.js deleted file mode 100755 index 1d0bfca30a..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/Filter/v1_1_0.js +++ /dev/null @@ -1,158 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Format/Filter/v1.js - * @requires OpenLayers/Format/GML/v3.js - */ - -/** - * Class: OpenLayers.Format.Filter.v1_1_0 - * Write ogc:Filter version 1.1.0. - * - * Differences from the v1.0.0 parser: - * - uses GML v3 instead of GML v2 - * - reads matchCase attribute on ogc:PropertyIsEqual and - * ogc:PropertyIsNotEqualelements. - * - writes matchCase attribute from comparison filters of type EQUAL_TO and - * type NOT_EQUAL_TO. - * - * Inherits from: - * - - */ -OpenLayers.Format.Filter.v1_1_0 = OpenLayers.Class( - OpenLayers.Format.GML.v3, OpenLayers.Format.Filter.v1, { - - /** - * Constant: VERSION - * {String} 1.1.0 - */ - VERSION: "1.1.0", - - /** - * Property: schemaLocation - * {String} http://www.opengis.net/ogc/filter/1.1.0/filter.xsd - */ - schemaLocation: "http://www.opengis.net/ogc/filter/1.1.0/filter.xsd", - - /** - * Constructor: OpenLayers.Format.Filter.v1_1_0 - * Instances of this class are not created directly. Use the - * constructor instead. - * - * Parameters: - * options - {Object} An optional object whose properties will be set on - * this instance. - */ - initialize: function(options) { - OpenLayers.Format.GML.v3.prototype.initialize.apply( - this, [options] - ); - }, - - /** - * Property: readers - * Contains public functions, grouped by namespace prefix, that will - * be applied when a namespaced node is found matching the function - * name. The function will be applied in the scope of this parser - * with two arguments: the node being read and a context object passed - * from the parent. - */ - readers: { - "ogc": OpenLayers.Util.applyDefaults({ - "PropertyIsEqualTo": function(node, obj) { - var matchCase = node.getAttribute("matchCase"); - var filter = new OpenLayers.Filter.Comparison({ - type: OpenLayers.Filter.Comparison.EQUAL_TO, - matchCase: !(matchCase === "false" || matchCase === "0") - }); - this.readChildNodes(node, filter); - obj.filters.push(filter); - }, - "PropertyIsNotEqualTo": function(node, obj) { - var matchCase = node.getAttribute("matchCase"); - var filter = new OpenLayers.Filter.Comparison({ - type: OpenLayers.Filter.Comparison.NOT_EQUAL_TO, - matchCase: !(matchCase === "false" || matchCase === "0") - }); - this.readChildNodes(node, filter); - obj.filters.push(filter); - } - }, OpenLayers.Format.Filter.v1.prototype.readers["ogc"]), - "gml": OpenLayers.Format.GML.v3.prototype.readers["gml"], - "feature": OpenLayers.Format.GML.v3.prototype.readers["feature"] - }, - - /** - * Property: writers - * As a compliment to the readers property, this structure contains public - * writing functions grouped by namespace alias and named like the - * node names they produce. - */ - writers: { - "ogc": OpenLayers.Util.applyDefaults({ - "PropertyIsEqualTo": function(filter) { - var node = this.createElementNSPlus("ogc:PropertyIsEqualTo", { - attributes: {matchCase: filter.matchCase} - }); - // no ogc:expression handling for now - this.writeNode("PropertyName", filter, node); - this.writeNode("Literal", filter.value, node); - return node; - }, - "PropertyIsNotEqualTo": function(filter) { - var node = this.createElementNSPlus("ogc:PropertyIsNotEqualTo", { - attributes: {matchCase: filter.matchCase} - }); - // no ogc:expression handling for now - this.writeNode("PropertyName", filter, node); - this.writeNode("Literal", filter.value, node); - return node; - }, - "BBOX": function(filter) { - var node = this.createElementNSPlus("ogc:BBOX"); - this.writeNode("PropertyName", filter, node); - var box = this.writeNode("gml:Envelope", filter.value); - if(filter.projection) { - box.setAttribute("srsName", filter.projection); - } - node.appendChild(box); - return node; - }}, OpenLayers.Format.Filter.v1.prototype.writers["ogc"]), - - "gml": OpenLayers.Format.GML.v3.prototype.writers["gml"], - "feature": OpenLayers.Format.GML.v3.prototype.writers["feature"] - }, - - /** - * Method: writeSpatial - * - * Read a {} filter and converts it into XML. - * - * Parameters: - * filter - {} The filter. - * name - {String} Name of the generated XML element. - * - * Returns: - * {DOMElement} The created XML element. - */ - writeSpatial: function(filter, name) { - var node = this.createElementNSPlus("ogc:"+name); - this.writeNode("PropertyName", filter, node); - var child; - if(filter.value instanceof OpenLayers.Geometry) { - child = this.writeNode("feature:_geometry", filter.value).firstChild; - } else { - child = this.writeNode("gml:Envelope", filter.value); - } - if(filter.projection) { - child.setAttribute("srsName", filter.projection); - } - node.appendChild(child); - return node; - }, - - CLASS_NAME: "OpenLayers.Format.Filter.v1_1_0" - -}); \ No newline at end of file diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/GML.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/GML.js deleted file mode 100755 index e6913767f9..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/GML.js +++ /dev/null @@ -1,872 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Format/XML.js - * @requires OpenLayers/Feature/Vector.js - * @requires OpenLayers/Geometry/Point.js - * @requires OpenLayers/Geometry/MultiPoint.js - * @requires OpenLayers/Geometry/LineString.js - * @requires OpenLayers/Geometry/MultiLineString.js - * @requires OpenLayers/Geometry/Polygon.js - * @requires OpenLayers/Geometry/MultiPolygon.js - * @requires OpenLayers/Console.js - */ - -/** - * Class: OpenLayers.Format.GML - * Read/Wite GML. Create a new instance with the - * constructor. Supports the GML simple features profile. - * - * Inherits from: - * - - */ -OpenLayers.Format.GML = OpenLayers.Class(OpenLayers.Format.XML, { - - /* - * APIProperty: featureNS - * {String} Namespace used for feature attributes. Default is - * "http://mapserver.gis.umn.edu/mapserver". - */ - featureNS: "http://mapserver.gis.umn.edu/mapserver", - - /** - * APIProperty: featurePrefix - * {String} Namespace alias (or prefix) for feature nodes. Default is - * "feature". - */ - featurePrefix: "feature", - - /* - * APIProperty: featureName - * {String} Element name for features. Default is "featureMember". - */ - featureName: "featureMember", - - /* - * APIProperty: layerName - * {String} Name of data layer. Default is "features". - */ - layerName: "features", - - /** - * APIProperty: geometryName - * {String} Name of geometry element. Defaults to "geometry". - */ - geometryName: "geometry", - - /** - * APIProperty: collectionName - * {String} Name of featureCollection element. - */ - collectionName: "FeatureCollection", - - /** - * APIProperty: gmlns - * {String} GML Namespace. - */ - gmlns: "http://www.opengis.net/gml", - - /** - * APIProperty: extractAttributes - * {Boolean} Extract attributes from GML. - */ - extractAttributes: true, - - /** - * APIProperty: xy - * {Boolean} Order of the GML coordinate true:(x,y) or false:(y,x) - * Changing is not recommended, a new Format should be instantiated. - */ - xy: true, - - /** - * Constructor: OpenLayers.Format.GML - * Create a new parser for GML. - * - * Parameters: - * options - {Object} An optional object whose properties will be set on - * this instance. - */ - initialize: function(options) { - // compile regular expressions once instead of every time they are used - this.regExes = { - trimSpace: (/^\s*|\s*$/g), - removeSpace: (/\s*/g), - splitSpace: (/\s+/), - trimComma: (/\s*,\s*/g) - }; - OpenLayers.Format.XML.prototype.initialize.apply(this, [options]); - }, - - /** - * APIMethod: read - * Read data from a string, and return a list of features. - * - * Parameters: - * data - {String} or {DOMElement} data to read/parse. - * - * Returns: - * {Array()} An array of features. - */ - read: function(data) { - if(typeof data == "string") { - data = OpenLayers.Format.XML.prototype.read.apply(this, [data]); - } - var featureNodes = this.getElementsByTagNameNS(data.documentElement, - this.gmlns, - this.featureName); - var features = []; - for(var i=0; i 0) { - // only deal with first geometry of this type - var parser = this.parseGeometry[type.toLowerCase()]; - if(parser) { - geometry = parser.apply(this, [nodeList[0]]); - if (this.internalProjection && this.externalProjection) { - geometry.transform(this.externalProjection, - this.internalProjection); - } - } else { - OpenLayers.Console.error(OpenLayers.i18n( - "unsupportedGeometryType", {'geomType':type})); - } - // stop looking for different geometry types - break; - } - } - - // construct feature (optionally with attributes) - var attributes; - if(this.extractAttributes) { - attributes = this.parseAttributes(node); - } - var feature = new OpenLayers.Feature.Vector(geometry, attributes); - - feature.gml = { - featureType: node.firstChild.nodeName.split(":")[1], - featureNS: node.firstChild.namespaceURI, - featureNSPrefix: node.firstChild.prefix - }; - - // assign fid - this can come from a "fid" or "id" attribute - var childNode = node.firstChild; - var fid; - while(childNode) { - if(childNode.nodeType == 1) { - fid = childNode.getAttribute("fid") || - childNode.getAttribute("id"); - if(fid) { - break; - } - } - childNode = childNode.nextSibling; - } - feature.fid = fid; - return feature; - }, - - /** - * Property: parseGeometry - * Properties of this object are the functions that parse geometries based - * on their type. - */ - parseGeometry: { - - /** - * Method: parseGeometry.point - * Given a GML node representing a point geometry, create an OpenLayers - * point geometry. - * - * Parameters: - * node - {DOMElement} A GML node. - * - * Returns: - * {} A point geometry. - */ - point: function(node) { - /** - * Three coordinate variations to consider: - * 1) x y z - * 2) x, y, z - * 3) xy - */ - var nodeList, coordString; - var coords = []; - - // look for - var nodeList = this.getElementsByTagNameNS(node, this.gmlns, "pos"); - if(nodeList.length > 0) { - coordString = nodeList[0].firstChild.nodeValue; - coordString = coordString.replace(this.regExes.trimSpace, ""); - coords = coordString.split(this.regExes.splitSpace); - } - - // look for - if(coords.length == 0) { - nodeList = this.getElementsByTagNameNS(node, this.gmlns, - "coordinates"); - if(nodeList.length > 0) { - coordString = nodeList[0].firstChild.nodeValue; - coordString = coordString.replace(this.regExes.removeSpace, - ""); - coords = coordString.split(","); - } - } - - // look for - if(coords.length == 0) { - nodeList = this.getElementsByTagNameNS(node, this.gmlns, - "coord"); - if(nodeList.length > 0) { - var xList = this.getElementsByTagNameNS(nodeList[0], - this.gmlns, "X"); - var yList = this.getElementsByTagNameNS(nodeList[0], - this.gmlns, "Y"); - if(xList.length > 0 && yList.length > 0) { - coords = [xList[0].firstChild.nodeValue, - yList[0].firstChild.nodeValue]; - } - } - } - - // preserve third dimension - if(coords.length == 2) { - coords[2] = null; - } - - if (this.xy) { - return new OpenLayers.Geometry.Point(coords[0], coords[1], - coords[2]); - } - else{ - return new OpenLayers.Geometry.Point(coords[1], coords[0], - coords[2]); - } - }, - - /** - * Method: parseGeometry.multipoint - * Given a GML node representing a multipoint geometry, create an - * OpenLayers multipoint geometry. - * - * Parameters: - * node - {DOMElement} A GML node. - * - * Returns: - * {} A multipoint geometry. - */ - multipoint: function(node) { - var nodeList = this.getElementsByTagNameNS(node, this.gmlns, - "Point"); - var components = []; - if(nodeList.length > 0) { - var point; - for(var i=0; i} A linestring geometry. - */ - linestring: function(node, ring) { - /** - * Two coordinate variations to consider: - * 1) x0 y0 z0 x1 y1 z1 - * 2) x0, y0, z0 x1, y1, z1 - */ - var nodeList, coordString; - var coords = []; - var points = []; - - // look for - nodeList = this.getElementsByTagNameNS(node, this.gmlns, "posList"); - if(nodeList.length > 0) { - coordString = this.getChildValue(nodeList[0]); - coordString = coordString.replace(this.regExes.trimSpace, ""); - coords = coordString.split(this.regExes.splitSpace); - var dim = parseInt(nodeList[0].getAttribute("dimension")); - var j, x, y, z; - for(var i=0; i - if(coords.length == 0) { - nodeList = this.getElementsByTagNameNS(node, this.gmlns, - "coordinates"); - if(nodeList.length > 0) { - coordString = this.getChildValue(nodeList[0]); - coordString = coordString.replace(this.regExes.trimSpace, - ""); - coordString = coordString.replace(this.regExes.trimComma, - ","); - var pointList = coordString.split(this.regExes.splitSpace); - for(var i=0; i} A multilinestring geometry. - */ - multilinestring: function(node) { - var nodeList = this.getElementsByTagNameNS(node, this.gmlns, - "LineString"); - var components = []; - if(nodeList.length > 0) { - var line; - for(var i=0; i} A polygon geometry. - */ - polygon: function(node) { - var nodeList = this.getElementsByTagNameNS(node, this.gmlns, - "LinearRing"); - var components = []; - if(nodeList.length > 0) { - // this assumes exterior ring first, inner rings after - var ring; - for(var i=0; i} A multipolygon geometry. - */ - multipolygon: function(node) { - var nodeList = this.getElementsByTagNameNS(node, this.gmlns, - "Polygon"); - var components = []; - if(nodeList.length > 0) { - var polygon; - for(var i=0; i 0) { - var coords = []; - - if(lpoint.length > 0) { - coordString = lpoint[0].firstChild.nodeValue; - coordString = coordString.replace(this.regExes.trimSpace, ""); - coords = coordString.split(this.regExes.splitSpace); - } - - if(coords.length == 2) { - coords[2] = null; - } - if (this.xy) { - var lowerPoint = new OpenLayers.Geometry.Point(coords[0], coords[1],coords[2]); - } else { - var lowerPoint = new OpenLayers.Geometry.Point(coords[1], coords[0],coords[2]); - } - } - - var upoint = this.getElementsByTagNameNS(node, this.gmlns, "upperCorner"); - if (upoint.length > 0) { - var coords = []; - - if(upoint.length > 0) { - coordString = upoint[0].firstChild.nodeValue; - coordString = coordString.replace(this.regExes.trimSpace, ""); - coords = coordString.split(this.regExes.splitSpace); - } - - if(coords.length == 2) { - coords[2] = null; - } - if (this.xy) { - var upperPoint = new OpenLayers.Geometry.Point(coords[0], coords[1],coords[2]); - } else { - var upperPoint = new OpenLayers.Geometry.Point(coords[1], coords[0],coords[2]); - } - } - - if (lowerPoint && upperPoint) { - components.push(new OpenLayers.Geometry.Point(lowerPoint.x, lowerPoint.y)); - components.push(new OpenLayers.Geometry.Point(upperPoint.x, lowerPoint.y)); - components.push(new OpenLayers.Geometry.Point(upperPoint.x, upperPoint.y)); - components.push(new OpenLayers.Geometry.Point(lowerPoint.x, upperPoint.y)); - components.push(new OpenLayers.Geometry.Point(lowerPoint.x, lowerPoint.y)); - - var ring = new OpenLayers.Geometry.LinearRing(components); - envelope = new OpenLayers.Geometry.Polygon([ring]); - } - return envelope; - } - }, - - /** - * Method: parseAttributes - * - * Parameters: - * node - {} - * - * Returns: - * {Object} An attributes object. - */ - parseAttributes: function(node) { - var attributes = {}; - // assume attributes are children of the first type 1 child - var childNode = node.firstChild; - var children, i, child, grandchildren, grandchild, name, value; - while(childNode) { - if(childNode.nodeType == 1) { - // attributes are type 1 children with one type 3 child - children = childNode.childNodes; - for(i=0; i becomes - // {fieldname: null} - attributes[child.nodeName.split(":").pop()] = null; - } - } - } - break; - } - childNode = childNode.nextSibling; - } - return attributes; - }, - - /** - * APIMethod: write - * Generate a GML document string given a list of features. - * - * Parameters: - * features - {Array()} List of features to - * serialize into a string. - * - * Returns: - * {String} A string representing the GML document. - */ - write: function(features) { - if(!(features instanceof Array)) { - features = [features]; - } - var gml = this.createElementNS("http://www.opengis.net/wfs", - "wfs:" + this.collectionName); - for(var i=0; i} The feature to be built as GML. - * - * Returns: - * {DOMElement} A node reprensting the feature in GML. - */ - createFeatureXML: function(feature) { - var geometry = feature.geometry; - var geometryNode = this.buildGeometryNode(geometry); - var geomContainer = this.createElementNS(this.featureNS, - this.featurePrefix + ":" + - this.geometryName); - geomContainer.appendChild(geometryNode); - var featureNode = this.createElementNS(this.gmlns, - "gml:" + this.featureName); - var featureContainer = this.createElementNS(this.featureNS, - this.featurePrefix + ":" + - this.layerName); - var fid = feature.fid || feature.id; - featureContainer.setAttribute("fid", fid); - featureContainer.appendChild(geomContainer); - for(var attr in feature.attributes) { - var attrText = this.createTextNode(feature.attributes[attr]); - var nodename = attr.substring(attr.lastIndexOf(":") + 1); - var attrContainer = this.createElementNS(this.featureNS, - this.featurePrefix + ":" + - nodename); - attrContainer.appendChild(attrText); - featureContainer.appendChild(attrContainer); - } - featureNode.appendChild(featureContainer); - return featureNode; - }, - - /** - * APIMethod: buildGeometryNode - */ - buildGeometryNode: function(geometry) { - if (this.externalProjection && this.internalProjection) { - geometry = geometry.clone(); - geometry.transform(this.internalProjection, - this.externalProjection); - } - var className = geometry.CLASS_NAME; - var type = className.substring(className.lastIndexOf(".") + 1); - var builder = this.buildGeometry[type.toLowerCase()]; - return builder.apply(this, [geometry]); - }, - - /** - * Property: buildGeometry - * Object containing methods to do the actual geometry node building - * based on geometry type. - */ - buildGeometry: { - // TBD retrieve the srs from layer - // srsName is non-standard, so not including it until it's right. - // gml.setAttribute("srsName", - // "http://www.opengis.net/gml/srs/epsg.xml#4326"); - - /** - * Method: buildGeometry.point - * Given an OpenLayers point geometry, create a GML point. - * - * Parameters: - * geometry - {} A point geometry. - * - * Returns: - * {DOMElement} A GML point node. - */ - point: function(geometry) { - var gml = this.createElementNS(this.gmlns, "gml:Point"); - gml.appendChild(this.buildCoordinatesNode(geometry)); - return gml; - }, - - /** - * Method: buildGeometry.multipoint - * Given an OpenLayers multipoint geometry, create a GML multipoint. - * - * Parameters: - * geometry - {} A multipoint geometry. - * - * Returns: - * {DOMElement} A GML multipoint node. - */ - multipoint: function(geometry) { - var gml = this.createElementNS(this.gmlns, "gml:MultiPoint"); - var points = geometry.components; - var pointMember, pointGeom; - for(var i=0; i} A linestring geometry. - * - * Returns: - * {DOMElement} A GML linestring node. - */ - linestring: function(geometry) { - var gml = this.createElementNS(this.gmlns, "gml:LineString"); - gml.appendChild(this.buildCoordinatesNode(geometry)); - return gml; - }, - - /** - * Method: buildGeometry.multilinestring - * Given an OpenLayers multilinestring geometry, create a GML - * multilinestring. - * - * Parameters: - * geometry - {} A multilinestring - * geometry. - * - * Returns: - * {DOMElement} A GML multilinestring node. - */ - multilinestring: function(geometry) { - var gml = this.createElementNS(this.gmlns, "gml:MultiLineString"); - var lines = geometry.components; - var lineMember, lineGeom; - for(var i=0; i} A linearring geometry. - * - * Returns: - * {DOMElement} A GML linearring node. - */ - linearring: function(geometry) { - var gml = this.createElementNS(this.gmlns, "gml:LinearRing"); - gml.appendChild(this.buildCoordinatesNode(geometry)); - return gml; - }, - - /** - * Method: buildGeometry.polygon - * Given an OpenLayers polygon geometry, create a GML polygon. - * - * Parameters: - * geometry - {} A polygon geometry. - * - * Returns: - * {DOMElement} A GML polygon node. - */ - polygon: function(geometry) { - var gml = this.createElementNS(this.gmlns, "gml:Polygon"); - var rings = geometry.components; - var ringMember, ringGeom, type; - for(var i=0; i} A multipolygon - * geometry. - * - * Returns: - * {DOMElement} A GML multipolygon node. - */ - multipolygon: function(geometry) { - var gml = this.createElementNS(this.gmlns, "gml:MultiPolygon"); - var polys = geometry.components; - var polyMember, polyGeom; - for(var i=0; i} A bounds object. - * - * Returns: - * {DOMElement} A GML box node. - */ - bounds: function(bounds) { - var gml = this.createElementNS(this.gmlns, "gml:Box"); - gml.appendChild(this.buildCoordinatesNode(bounds)); - return gml; - } - }, - - /** - * Method: buildCoordinates - * builds the coordinates XmlNode - * (code) - * ... - * (end) - * Parameters: - * geometry - {} - * - * Returns: - * {XmlNode} created xmlNode - */ - buildCoordinatesNode: function(geometry) { - var coordinatesNode = this.createElementNS(this.gmlns, - "gml:coordinates"); - coordinatesNode.setAttribute("decimal", "."); - coordinatesNode.setAttribute("cs", ","); - coordinatesNode.setAttribute("ts", " "); - - var parts = []; - - if(geometry instanceof OpenLayers.Bounds){ - parts.push(geometry.left + "," + geometry.bottom); - parts.push(geometry.right + "," + geometry.top); - } else { - var points = (geometry.components) ? geometry.components : [geometry]; - for(var i=0; i - */ -OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, { - - /** - * Property: namespaces - * {Object} Mapping of namespace aliases to namespace URIs. - */ - namespaces: { - gml: "http://www.opengis.net/gml", - xlink: "http://www.w3.org/1999/xlink", - xsi: "http://www.w3.org/2001/XMLSchema-instance", - wfs: "http://www.opengis.net/wfs" // this is a convenience for reading wfs:FeatureCollection - }, - - /** - * Property: defaultPrefix - */ - defaultPrefix: "gml", - - /** - * Property: schemaLocation - * {String} Schema location for a particular minor version. - */ - schemaLocation: null, - - /** - * APIProperty: featureType - * {Array(String) or String} The local (without prefix) feature typeName(s). - */ - featureType: null, - - /** - * APIProperty: featureNS - * {String} The feature namespace. Must be set in the options at - * construction. - */ - featureNS: null, - - /** - * APIProperty: geometry - * {String} Name of geometry element. Defaults to "geometry". - */ - geometryName: "geometry", - - /** - * APIProperty: extractAttributes - * {Boolean} Extract attributes from GML. Default is true. - */ - extractAttributes: true, - - /** - * APIProperty: srsName - * {String} URI for spatial reference system. This is optional for - * single part geometries and mandatory for collections and multis. - * If set, the srsName attribute will be written for all geometries. - * Default is null. - */ - srsName: null, - - /** - * APIProperty: xy - * {Boolean} Order of the GML coordinate true:(x,y) or false:(y,x) - * Changing is not recommended, a new Format should be instantiated. - */ - xy: true, - - /** - * Property: geometryTypes - * {Object} Maps OpenLayers geometry class names to GML element names. - * Use before accessing this property. - */ - geometryTypes: null, - - /** - * Property: singleFeatureType - * {Boolean} True if there is only 1 featureType, and not an array - * of featuretypes. - */ - singleFeatureType: null, - - /** - * Property: regExes - * Compiled regular expressions for manipulating strings. - */ - regExes: { - trimSpace: (/^\s*|\s*$/g), - removeSpace: (/\s*/g), - splitSpace: (/\s+/), - trimComma: (/\s*,\s*/g) - }, - - /** - * Constructor: OpenLayers.Format.GML.Base - * Instances of this class are not created directly. Use the - * or constructor - * instead. - * - * Parameters: - * options - {Object} An optional object whose properties will be set on - * this instance. - * - * Valid options properties: - * featureType - {Array(String) or String} Local (without prefix) feature - * typeName(s) (required). - * featureNS - {String} Feature namespace (required). - * geometryName - {String} Geometry element name. - */ - initialize: function(options) { - OpenLayers.Format.XML.prototype.initialize.apply(this, [options]); - this.setGeometryTypes(); - if(options && options.featureNS) { - this.setNamespace("feature", options.featureNS); - } - this.singleFeatureType = !options || (typeof options.featureType === "string"); - }, - - /** - * Method: read - * - * Parameters: - * data - {DOMElement} A gml:featureMember element, a gml:featureMembers - * element, or an element containing either of the above at any level. - * - * Returns: - * {Array()} An array of features. - */ - read: function(data) { - if(typeof data == "string") { - data = OpenLayers.Format.XML.prototype.read.apply(this, [data]); - } - if(data && data.nodeType == 9) { - data = data.documentElement; - } - var features = []; - this.readNode(data, {features: features}); - if(features.length == 0) { - // look for gml:featureMember elements - var elements = this.getElementsByTagNameNS( - data, this.namespaces.gml, "featureMember" - ); - if(elements.length) { - for(var i=0, len=elements.length; i 0) { - obj.bounds = container.components[0]; - } - }, - "Point": function(node, container) { - var obj = {points: []}; - this.readChildNodes(node, obj); - if(!container.components) { - container.components = []; - } - container.components.push(obj.points[0]); - }, - "coordinates": function(node, obj) { - var str = this.getChildValue(node).replace( - this.regExes.trimSpace, "" - ); - str = str.replace(this.regExes.trimComma, ","); - var pointList = str.split(this.regExes.splitSpace); - var coords; - var numPoints = pointList.length; - var points = new Array(numPoints); - for(var i=0; i) | OpenLayers.Feature.Vector} - * An array of features or a single feature. - * - * Returns: - * {String} Given an array of features, a doc with a gml:featureMembers - * element will be returned. Given a single feature, a doc with a - * gml:featureMember element will be returned. - */ - write: function(features) { - var name; - if(features instanceof Array) { - name = "featureMembers"; - } else { - name = "featureMember"; - } - var root = this.writeNode("gml:" + name, features); - this.setAttributeNS( - root, this.namespaces["xsi"], - "xsi:schemaLocation", this.schemaLocation - ); - - return OpenLayers.Format.XML.prototype.write.apply(this, [root]); - }, - - /** - * Property: writers - * As a compliment to the readers property, this structure contains public - * writing functions grouped by namespace alias and named like the - * node names they produce. - */ - writers: { - "gml": { - "featureMember": function(feature) { - var node = this.createElementNSPlus("gml:featureMember"); - this.writeNode("feature:_typeName", feature, node); - return node; - }, - "MultiPoint": function(geometry) { - var node = this.createElementNSPlus("gml:MultiPoint"); - for(var i=0; i mapping. - */ - setGeometryTypes: function() { - this.geometryTypes = { - "OpenLayers.Geometry.Point": "Point", - "OpenLayers.Geometry.MultiPoint": "MultiPoint", - "OpenLayers.Geometry.LineString": "LineString", - "OpenLayers.Geometry.MultiLineString": "MultiLineString", - "OpenLayers.Geometry.Polygon": "Polygon", - "OpenLayers.Geometry.MultiPolygon": "MultiPolygon", - "OpenLayers.Geometry.Collection": "GeometryCollection" - }; - }, - - CLASS_NAME: "OpenLayers.Format.GML.Base" - -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/GML/v2.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/GML/v2.js deleted file mode 100755 index 7bbf65f709..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/GML/v2.js +++ /dev/null @@ -1,192 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Format/GML/Base.js - */ - -/** - * Class: OpenLayers.Format.GML.v2 - * Parses GML version 2. - * - * Inherits from: - * - - */ -OpenLayers.Format.GML.v2 = OpenLayers.Class(OpenLayers.Format.GML.Base, { - - /** - * Property: schemaLocation - * {String} Schema location for a particular minor version. - */ - schemaLocation: "http://www.opengis.net/gml http://schemas.opengis.net/gml/2.1.2/feature.xsd", - - /** - * Constructor: OpenLayers.Format.GML.v2 - * Create a parser for GML v2. - * - * Parameters: - * options - {Object} An optional object whose properties will be set on - * this instance. - * - * Valid options properties: - * featureType - {String} Local (without prefix) feature typeName (required). - * featureNS - {String} Feature namespace (required). - * geometryName - {String} Geometry element name. - */ - initialize: function(options) { - OpenLayers.Format.GML.Base.prototype.initialize.apply(this, [options]); - }, - - /** - * Property: readers - * Contains public functions, grouped by namespace prefix, that will - * be applied when a namespaced node is found matching the function - * name. The function will be applied in the scope of this parser - * with two arguments: the node being read and a context object passed - * from the parent. - */ - readers: { - "gml": OpenLayers.Util.applyDefaults({ - "outerBoundaryIs": function(node, container) { - var obj = {}; - this.readChildNodes(node, obj); - container.outer = obj.components[0]; - }, - "innerBoundaryIs": function(node, container) { - var obj = {}; - this.readChildNodes(node, obj); - container.inner.push(obj.components[0]); - }, - "Box": function(node, container) { - var obj = {}; - this.readChildNodes(node, obj); - if(!container.components) { - container.components = []; - } - var min = obj.points[0]; - var max = obj.points[1]; - container.components.push( - new OpenLayers.Bounds(min.x, min.y, max.x, max.y) - ); - } - }, OpenLayers.Format.GML.Base.prototype.readers["gml"]), - "feature": OpenLayers.Format.GML.Base.prototype.readers["feature"], - "wfs": OpenLayers.Format.GML.Base.prototype.readers["wfs"] - }, - - /** - * Method: write - * - * Parameters: - * features - {Array() | OpenLayers.Feature.Vector} - * An array of features or a single feature. - * - * Returns: - * {String} Given an array of features, a doc with a gml:featureMembers - * element will be returned. Given a single feature, a doc with a - * gml:featureMember element will be returned. - */ - write: function(features) { - var name; - if(features instanceof Array) { - // GML2 only has abstract feature collections - // wfs provides a feature collection from a well-known schema - name = "wfs:FeatureCollection"; - } else { - name = "gml:featureMember"; - } - var root = this.writeNode(name, features); - this.setAttributeNS( - root, this.namespaces["xsi"], - "xsi:schemaLocation", this.schemaLocation - ); - - return OpenLayers.Format.XML.prototype.write.apply(this, [root]); - }, - - /** - * Property: writers - * As a compliment to the readers property, this structure contains public - * writing functions grouped by namespace alias and named like the - * node names they produce. - */ - writers: { - "gml": OpenLayers.Util.applyDefaults({ - "Point": function(geometry) { - var node = this.createElementNSPlus("gml:Point"); - this.writeNode("coordinates", [geometry], node); - return node; - }, - "coordinates": function(points) { - var numPoints = points.length; - var parts = new Array(numPoints); - var point; - for(var i=0; i - */ -OpenLayers.Format.GML.v3 = OpenLayers.Class(OpenLayers.Format.GML.Base, { - - /** - * Property: schemaLocation - * {String} Schema location for a particular minor version. The writers - * conform with the Simple Features Profile for GML. - */ - schemaLocation: "http://www.opengis.net/gml http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/1.0.0/gmlsf.xsd", - - /** - * Property: curve - * {Boolean} Write gml:Curve instead of gml:LineString elements. This also - * affects the elements in multi-part geometries. Default is false. - * To write gml:Curve elements instead of gml:LineString, set curve - * to true in the options to the contstructor (cannot be changed after - * instantiation). - */ - curve: false, - - /** - * Property: multiCurve - * {Boolean} Write gml:MultiCurve instead of gml:MultiLineString. Since - * the latter is deprecated in GML 3, the default is true. To write - * gml:MultiLineString instead of gml:MultiCurve, set multiCurve to - * false in the options to the constructor (cannot be changed after - * instantiation). - */ - multiCurve: true, - - /** - * Property: surface - * {Boolean} Write gml:Surface instead of gml:Polygon elements. This also - * affects the elements in multi-part geometries. Default is false. - * To write gml:Surface elements instead of gml:Polygon, set surface - * to true in the options to the contstructor (cannot be changed after - * instantiation). - */ - surface: false, - - /** - * Property: multiSurface - * {Boolean} Write gml:multiSurface instead of gml:MultiPolygon. Since - * the latter is deprecated in GML 3, the default is true. To write - * gml:MultiPolygon instead of gml:multiSurface, set multiSurface to - * false in the options to the constructor (cannot be changed after - * instantiation). - */ - multiSurface: true, - - /** - * Constructor: OpenLayers.Format.GML.v3 - * Create a parser for GML v3. - * - * Parameters: - * options - {Object} An optional object whose properties will be set on - * this instance. - * - * Valid options properties: - * featureType - {String} Local (without prefix) feature typeName (required). - * featureNS - {String} Feature namespace (required). - * geometryName - {String} Geometry element name. - */ - initialize: function(options) { - OpenLayers.Format.GML.Base.prototype.initialize.apply(this, [options]); - }, - - /** - * Property: readers - * Contains public functions, grouped by namespace prefix, that will - * be applied when a namespaced node is found matching the function - * name. The function will be applied in the scope of this parser - * with two arguments: the node being read and a context object passed - * from the parent. - */ - readers: { - "gml": OpenLayers.Util.applyDefaults({ - "featureMembers": function(node, obj) { - this.readChildNodes(node, obj); - }, - "Curve": function(node, container) { - var obj = {points: []}; - this.readChildNodes(node, obj); - if(!container.components) { - container.components = []; - } - container.components.push( - new OpenLayers.Geometry.LineString(obj.points) - ); - }, - "segments": function(node, obj) { - this.readChildNodes(node, obj); - }, - "LineStringSegment": function(node, container) { - var obj = {}; - this.readChildNodes(node, obj); - if(obj.points) { - Array.prototype.push.apply(container.points, obj.points); - } - }, - "pos": function(node, obj) { - var str = this.getChildValue(node).replace( - this.regExes.trimSpace, "" - ); - var coords = str.split(this.regExes.splitSpace); - var point; - if(this.xy) { - point = new OpenLayers.Geometry.Point( - coords[0], coords[1], coords[2] - ); - } else { - point = new OpenLayers.Geometry.Point( - coords[1], coords[0], coords[2] - ); - } - obj.points = [point]; - }, - "posList": function(node, obj) { - var str = this.getChildValue(node).replace( - this.regExes.trimSpace, "" - ); - var coords = str.split(this.regExes.splitSpace); - var dim = parseInt(node.getAttribute("dimension")) || 2; - var j, x, y, z; - var numPoints = coords.length / dim; - var points = new Array(numPoints); - for(var i=0, len=coords.length; i 0) { - container.components = [ - new OpenLayers.Geometry.MultiLineString(obj.components) - ]; - } - }, - "curveMember": function(node, obj) { - this.readChildNodes(node, obj); - }, - "MultiSurface": function(node, container) { - var obj = {components: []}; - this.readChildNodes(node, obj); - if(obj.components.length > 0) { - container.components = [ - new OpenLayers.Geometry.MultiPolygon(obj.components) - ]; - } - }, - "surfaceMember": function(node, obj) { - this.readChildNodes(node, obj); - }, - "surfaceMembers": function(node, obj) { - this.readChildNodes(node, obj); - }, - "pointMembers": function(node, obj) { - this.readChildNodes(node, obj); - }, - "lineStringMembers": function(node, obj) { - this.readChildNodes(node, obj); - }, - "polygonMembers": function(node, obj) { - this.readChildNodes(node, obj); - }, - "geometryMembers": function(node, obj) { - this.readChildNodes(node, obj); - }, - "Envelope": function(node, container) { - var obj = {points: new Array(2)}; - this.readChildNodes(node, obj); - if(!container.components) { - container.components = []; - } - var min = obj.points[0]; - var max = obj.points[1]; - container.components.push( - new OpenLayers.Bounds(min.x, min.y, max.x, max.y) - ); - }, - "lowerCorner": function(node, container) { - var obj = {}; - this.readers.gml.pos.apply(this, [node, obj]); - container.points[0] = obj.points[0]; - }, - "upperCorner": function(node, container) { - var obj = {}; - this.readers.gml.pos.apply(this, [node, obj]); - container.points[1] = obj.points[0]; - } - }, OpenLayers.Format.GML.Base.prototype.readers["gml"]), - "feature": OpenLayers.Format.GML.Base.prototype.readers["feature"], - "wfs": OpenLayers.Format.GML.Base.prototype.readers["wfs"] - }, - - /** - * Method: write - * - * Parameters: - * features - {Array() | OpenLayers.Feature.Vector} - * An array of features or a single feature. - * - * Returns: - * {String} Given an array of features, a doc with a gml:featureMembers - * element will be returned. Given a single feature, a doc with a - * gml:featureMember element will be returned. - */ - write: function(features) { - var name; - if(features instanceof Array) { - name = "featureMembers"; - } else { - name = "featureMember"; - } - var root = this.writeNode("gml:" + name, features); - this.setAttributeNS( - root, this.namespaces["xsi"], - "xsi:schemaLocation", this.schemaLocation - ); - - return OpenLayers.Format.XML.prototype.write.apply(this, [root]); - }, - - /** - * Property: writers - * As a compliment to the readers property, this structure contains public - * writing functions grouped by namespace alias and named like the - * node names they produce. - */ - writers: { - "gml": OpenLayers.Util.applyDefaults({ - "featureMembers": function(features) { - var node = this.createElementNSPlus("gml:featureMembers"); - for(var i=0, len=features.length; i mapping. - */ - setGeometryTypes: function() { - this.geometryTypes = { - "OpenLayers.Geometry.Point": "Point", - "OpenLayers.Geometry.MultiPoint": "MultiPoint", - "OpenLayers.Geometry.LineString": (this.curve === true) ? "Curve": "LineString", - "OpenLayers.Geometry.MultiLineString": (this.multiCurve === false) ? "MultiLineString" : "MultiCurve", - "OpenLayers.Geometry.Polygon": (this.surface === true) ? "Surface" : "Polygon", - "OpenLayers.Geometry.MultiPolygon": (this.multiSurface === false) ? "MultiPolygon" : "MultiSurface", - "OpenLayers.Geometry.Collection": "GeometryCollection" - }; - }, - - CLASS_NAME: "OpenLayers.Format.GML.v3" - -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/GPX.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/GPX.js deleted file mode 100755 index 3866f827fc..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/GPX.js +++ /dev/null @@ -1,179 +0,0 @@ -/* Copyright (c) 2006-2007 MetaCarta, Inc., published under a modified BSD license. - * See http://svn.openlayers.org/trunk/openlayers/repository-license.txt - * for the full text of the license. */ - -/** - * @requires OpenLayers/Format/XML.js - * @requires OpenLayers/Feature/Vector.js - * @requires OpenLayers/Geometry/Point.js - * @requires OpenLayers/Geometry/LineString.js - */ - -/** - * Class: OpenLayers.Format.GPX - * Read/write GPX parser. Create a new instance with the - * constructor. - * - * Inherits from: - * - - */ -OpenLayers.Format.GPX = OpenLayers.Class(OpenLayers.Format.XML, { - /** - * APIProperty: extractWaypoints - * {Boolean} Extract waypoints from GPX. (default: true) - */ - extractWaypoints: true, - - /** - * APIProperty: extractTracks - * {Boolean} Extract tracks from GPX. (default: true) - */ - extractTracks: true, - - /** - * APIProperty: extractRoutes - * {Boolean} Extract routes from GPX. (default: true) - */ - extractRoutes: true, - - /** - * APIProperty: extractAttributes - * {Boolean} Extract feature attributes from GPX. (default: true) - * NOTE: Attributes as part of extensions to the GPX standard may not - * be extracted. - */ - extractAttributes: true, - - /** - * Constructor: OpenLayers.Format.GPX - * Create a new parser for GPX. - * - * Parameters: - * options - {Object} An optional object whose properties will be set on - * this instance. - */ - initialize: function(options) { - OpenLayers.Format.XML.prototype.initialize.apply(this, [options]); - }, - - /** - * APIMethod: read - * Return a list of features from a GPX doc - * - * Parameters: - * doc - {Element} - * - * Returns: - * An Array of s - */ - read: function(doc) { - if (typeof doc == "string") { - doc = OpenLayers.Format.XML.prototype.read.apply(this, [doc]); - } - var features = []; - - if(this.extractTracks) { - var tracks = doc.getElementsByTagName("trk"); - for (var i=0, len=tracks.length; i} a trkseg or rte node to parse - * segmentType - {String} nodeName of waypoints that form the line - * - * Returns: - * {} A linestring geometry - */ - extractSegment: function(segment, segmentType) { - var points = this.getElementsByTagNameNS(segment, segment.namespaceURI, segmentType); - var point_features = []; - for (var i = 0, len = points.length; i < len; i++) { - point_features.push(new OpenLayers.Geometry.Point(points[i].getAttribute("lon"), points[i].getAttribute("lat"))); - } - return new OpenLayers.Geometry.LineString(point_features); - }, - - /** - * Method: parseAttributes - * - * Parameters: - * node - {} - * - * Returns: - * {Object} An attributes object. - */ - parseAttributes: function(node) { - // node is either a wpt, trk or rte - // attributes are children of the form value - var attributes = {}; - var attrNode = node.firstChild; - while(attrNode) { - if(attrNode.nodeType == 1) { - var value = attrNode.firstChild; - if(value.nodeType == 3 || value.nodeType == 4) { - name = (attrNode.prefix) ? - attrNode.nodeName.split(":")[1] : - attrNode.nodeName; - if(name != "trkseg" && name != "rtept") { - attributes[name] = value.nodeValue; - } - } - } - attrNode = attrNode.nextSibling; - } - return attributes; - }, - - CLASS_NAME: "OpenLayers.Format.GPX" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/GeoJSON.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/GeoJSON.js deleted file mode 100755 index 5a0bd39575..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/GeoJSON.js +++ /dev/null @@ -1,707 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Format/JSON.js - * @requires OpenLayers/Feature/Vector.js - * @requires OpenLayers/Geometry/Point.js - * @requires OpenLayers/Geometry/MultiPoint.js - * @requires OpenLayers/Geometry/LineString.js - * @requires OpenLayers/Geometry/MultiLineString.js - * @requires OpenLayers/Geometry/Polygon.js - * @requires OpenLayers/Geometry/MultiPolygon.js - * @requires OpenLayers/Console.js - */ - -/** - * Class: OpenLayers.Format.GeoJSON - * Read and write GeoJSON. Create a new parser with the - * constructor. - * - * Inherits from: - * - - */ -OpenLayers.Format.GeoJSON = OpenLayers.Class(OpenLayers.Format.JSON, { - - /** - * Constructor: OpenLayers.Format.GeoJSON - * Create a new parser for GeoJSON. - * - * Parameters: - * options - {Object} An optional object whose properties will be set on - * this instance. - */ - initialize: function(options) { - OpenLayers.Format.JSON.prototype.initialize.apply(this, [options]); - }, - - /** - * APIMethod: read - * Deserialize a GeoJSON string. - * - * Parameters: - * json - {String} A GeoJSON string - * type - {String} Optional string that determines the structure of - * the output. Supported values are "Geometry", "Feature", and - * "FeatureCollection". If absent or null, a default of - * "FeatureCollection" is assumed. - * filter - {Function} A function which will be called for every key and - * value at every level of the final result. Each value will be - * replaced by the result of the filter function. This can be used to - * reform generic objects into instances of classes, or to transform - * date strings into Date objects. - * - * Returns: - * {Object} The return depends on the value of the type argument. If type - * is "FeatureCollection" (the default), the return will be an array - * of . If type is "Geometry", the input json - * must represent a single geometry, and the return will be an - * . If type is "Feature", the input json must - * represent a single feature, and the return will be an - * . - */ - read: function(json, type, filter) { - type = (type) ? type : "FeatureCollection"; - var results = null; - var obj = null; - if (typeof json == "string") { - obj = OpenLayers.Format.JSON.prototype.read.apply(this, - [json, filter]); - } else { - obj = json; - } - if(!obj) { - OpenLayers.Console.error("Bad JSON: " + json); - } else if(typeof(obj.type) != "string") { - OpenLayers.Console.error("Bad GeoJSON - no type: " + json); - } else if(this.isValidType(obj, type)) { - switch(type) { - case "Geometry": - try { - results = this.parseGeometry(obj); - } catch(err) { - OpenLayers.Console.error(err); - } - break; - case "Feature": - try { - results = this.parseFeature(obj); - results.type = "Feature"; - } catch(err) { - OpenLayers.Console.error(err); - } - break; - case "FeatureCollection": - // for type FeatureCollection, we allow input to be any type - results = []; - switch(obj.type) { - case "Feature": - try { - results.push(this.parseFeature(obj)); - } catch(err) { - results = null; - OpenLayers.Console.error(err); - } - break; - case "FeatureCollection": - for(var i=0, len=obj.features.length; i. - * - * Parameters: - * obj - {Object} An object created from a GeoJSON object - * - * Returns: - * {} A feature. - */ - parseFeature: function(obj) { - var feature, geometry, attributes, bbox; - attributes = (obj.properties) ? obj.properties : {}; - bbox = (obj.geometry && obj.geometry.bbox) || obj.bbox; - try { - geometry = this.parseGeometry(obj.geometry); - } catch(err) { - // deal with bad geometries - throw err; - } - feature = new OpenLayers.Feature.Vector(geometry, attributes); - if(bbox) { - feature.bounds = OpenLayers.Bounds.fromArray(bbox); - } - if(obj.id) { - feature.fid = obj.id; - } - return feature; - }, - - /** - * Method: parseGeometry - * Convert a geometry object from GeoJSON into an . - * - * Parameters: - * obj - {Object} An object created from a GeoJSON object - * - * Returns: - * {} A geometry. - */ - parseGeometry: function(obj) { - if (obj == null) { - return null; - } - var geometry, collection = false; - if(obj.type == "GeometryCollection") { - if(!(obj.geometries instanceof Array)) { - throw "GeometryCollection must have geometries array: " + obj; - } - var numGeom = obj.geometries.length; - var components = new Array(numGeom); - for(var i=0; i. - * - * Parameters: - * array - {Object} The coordinates array from the GeoJSON fragment. - * - * Returns: - * {} A geometry. - */ - "point": function(array) { - if(array.length != 2) { - throw "Only 2D points are supported: " + array; - } - return new OpenLayers.Geometry.Point(array[0], array[1]); - }, - - /** - * Method: parseCoords.multipoint - * Convert a coordinate array from GeoJSON into an - * . - * - * Parameters: - * array {Object} The coordinates array from the GeoJSON fragment. - * - * Returns: - * {} A geometry. - */ - "multipoint": function(array) { - var points = []; - var p = null; - for(var i=0, len=array.length; i. - * - * Parameters: - * array - {Object} The coordinates array from the GeoJSON fragment. - * - * Returns: - * {} A geometry. - */ - "linestring": function(array) { - var points = []; - var p = null; - for(var i=0, len=array.length; i. - * - * Parameters: - * array - {Object} The coordinates array from the GeoJSON fragment. - * - * Returns: - * {} A geometry. - */ - "multilinestring": function(array) { - var lines = []; - var l = null; - for(var i=0, len=array.length; i. - * - * Returns: - * {} A geometry. - */ - "polygon": function(array) { - var rings = []; - var r, l; - for(var i=0, len=array.length; i. - * - * Parameters: - * array - {Object} The coordinates array from the GeoJSON fragment. - * - * Returns: - * {} A geometry. - */ - "multipolygon": function(array) { - var polys = []; - var p = null; - for(var i=0, len=array.length; i. - * - * Parameters: - * array - {Object} The coordinates array from the GeoJSON fragment. - * - * Returns: - * {} A geometry. - */ - "box": function(array) { - if(array.length != 2) { - throw "GeoJSON box coordinates must have 2 elements"; - } - return new OpenLayers.Geometry.Polygon([ - new OpenLayers.Geometry.LinearRing([ - new OpenLayers.Geometry.Point(array[0][0], array[0][1]), - new OpenLayers.Geometry.Point(array[1][0], array[0][1]), - new OpenLayers.Geometry.Point(array[1][0], array[1][1]), - new OpenLayers.Geometry.Point(array[0][0], array[1][1]), - new OpenLayers.Geometry.Point(array[0][0], array[0][1]) - ]) - ]); - } - - }, - - /** - * APIMethod: write - * Serialize a feature, geometry, array of features into a GeoJSON string. - * - * Parameters: - * obj - {Object} An , , - * or an array of features. - * pretty - {Boolean} Structure the output with newlines and indentation. - * Default is false. - * - * Returns: - * {String} The GeoJSON string representation of the input geometry, - * features, or array of features. - */ - write: function(obj, pretty) { - var geojson = { - "type": null - }; - if(obj instanceof Array) { - geojson.type = "FeatureCollection"; - var numFeatures = obj.length; - geojson.features = new Array(numFeatures); - for(var i=0; i} - * - * Returns: - * {Object} An object which can be assigned to the crs property - * of a GeoJSON object. - */ - createCRSObject: function(object) { - var proj = object.layer.projection.toString(); - var crs = {}; - if (proj.match(/epsg:/i)) { - var code = parseInt(proj.substring(proj.indexOf(":") + 1)); - if (code == 4326) { - crs = { - "type": "OGC", - "properties": { - "urn": "urn:ogc:def:crs:OGC:1.3:CRS84" - } - }; - } else { - crs = { - "type": "EPSG", - "properties": { - "code": code - } - }; - } - } - return crs; - }, - - /** - * Property: extract - * Object with properties corresponding to the GeoJSON types. - * Property values are functions that do the actual value extraction. - */ - extract: { - /** - * Method: extract.feature - * Return a partial GeoJSON object representing a single feature. - * - * Parameters: - * feature - {} - * - * Returns: - * {Object} An object representing the point. - */ - 'feature': function(feature) { - var geom = this.extract.geometry.apply(this, [feature.geometry]); - return { - "type": "Feature", - "id": feature.fid == null ? feature.id : feature.fid, - "properties": feature.attributes, - "geometry": geom - }; - }, - - /** - * Method: extract.geometry - * Return a GeoJSON object representing a single geometry. - * - * Parameters: - * geometry - {} - * - * Returns: - * {Object} An object representing the geometry. - */ - 'geometry': function(geometry) { - if (geometry == null) { - return null; - } - if (this.internalProjection && this.externalProjection) { - geometry = geometry.clone(); - geometry.transform(this.internalProjection, - this.externalProjection); - } - var geometryType = geometry.CLASS_NAME.split('.')[2]; - var data = this.extract[geometryType.toLowerCase()].apply(this, [geometry]); - var json; - if(geometryType == "Collection") { - json = { - "type": "GeometryCollection", - "geometries": data - }; - } else { - json = { - "type": geometryType, - "coordinates": data - }; - } - - return json; - }, - - /** - * Method: extract.point - * Return an array of coordinates from a point. - * - * Parameters: - * point - {} - * - * Returns: - * {Array} An array of coordinates representing the point. - */ - 'point': function(point) { - return [point.x, point.y]; - }, - - /** - * Method: extract.multipoint - * Return an array of point coordinates from a multipoint. - * - * Parameters: - * multipoint - {} - * - * Returns: - * {Array} An array of point coordinate arrays representing - * the multipoint. - */ - 'multipoint': function(multipoint) { - var array = []; - for(var i=0, len=multipoint.components.length; i} - * - * Returns: - * {Array} An array of coordinate arrays representing - * the linestring. - */ - 'linestring': function(linestring) { - var array = []; - for(var i=0, len=linestring.components.length; i} - * - * Returns: - * {Array} An array of linestring arrays representing - * the multilinestring. - */ - 'multilinestring': function(multilinestring) { - var array = []; - for(var i=0, len=multilinestring.components.length; i} - * - * Returns: - * {Array} An array of linear ring arrays representing the polygon. - */ - 'polygon': function(polygon) { - var array = []; - for(var i=0, len=polygon.components.length; i} - * - * Returns: - * {Array} An array of polygon arrays representing - * the multipolygon - */ - 'multipolygon': function(multipolygon) { - var array = []; - for(var i=0, len=multipolygon.components.length; i} - * - * Returns: - * {Array} An array of geometry objects representing the geometry - * collection. - */ - 'collection': function(collection) { - var len = collection.components.length; - var array = new Array(len); - for(var i=0; i constructor. - * - * Inherits from: - * - - */ -OpenLayers.Format.GeoRSS = OpenLayers.Class(OpenLayers.Format.XML, { - - /** - * APIProperty: rssns - * {String} RSS namespace to use. Defaults to - * "http://backend.userland.com/rss2" - */ - rssns: "http://backend.userland.com/rss2", - - /** - * APIProperty: featurens - * {String} Feature Attributes namespace. Defaults to - * "http://mapserver.gis.umn.edu/mapserver" - */ - featureNS: "http://mapserver.gis.umn.edu/mapserver", - - /** - * APIProperty: georssns - * {String} GeoRSS namespace to use. Defaults to - * "http://www.georss.org/georss" - */ - georssns: "http://www.georss.org/georss", - - /** - * APIProperty: geons - * {String} W3C Geo namespace to use. Defaults to - * "http://www.w3.org/2003/01/geo/wgs84_pos#" - */ - geons: "http://www.w3.org/2003/01/geo/wgs84_pos#", - - /** - * APIProperty: featureTitle - * {String} Default title for features. Defaults to "Untitled" - */ - featureTitle: "Untitled", - - /** - * APIProperty: featureDescription - * {String} Default description for features. Defaults to "No Description" - */ - featureDescription: "No Description", - - /** - * Property: gmlParse - * {Object} GML Format object for parsing features - * Non-API and only created if necessary - */ - gmlParser: null, - - /** - * APIProperty: xy - * {Boolean} Order of the GML coordinate: true:(x,y) or false:(y,x) - * For GeoRSS the default is (y,x), therefore: false - */ - xy: false, - - /** - * Constructor: OpenLayers.Format.GeoRSS - * Create a new parser for GeoRSS. - * - * Parameters: - * options - {Object} An optional object whose properties will be set on - * this instance. - */ - initialize: function(options) { - OpenLayers.Format.XML.prototype.initialize.apply(this, [options]); - }, - - /** - * Method: createGeometryFromItem - * Return a geometry from a GeoRSS Item. - * - * Parameters: - * item - {DOMElement} A GeoRSS item node. - * - * Returns: - * {} A geometry representing the node. - */ - createGeometryFromItem: function(item) { - var point = this.getElementsByTagNameNS(item, this.georssns, "point"); - var lat = this.getElementsByTagNameNS(item, this.geons, 'lat'); - var lon = this.getElementsByTagNameNS(item, this.geons, 'long'); - - var line = this.getElementsByTagNameNS(item, - this.georssns, - "line"); - var polygon = this.getElementsByTagNameNS(item, - this.georssns, - "polygon"); - var where = this.getElementsByTagNameNS(item, - this.georssns, - "where"); - var box = this.getElementsByTagNameNS(item, - this.georssns, - "box"); - - if (point.length > 0 || (lat.length > 0 && lon.length > 0)) { - var location; - if (point.length > 0) { - location = OpenLayers.String.trim( - point[0].firstChild.nodeValue).split(/\s+/); - if (location.length !=2) { - location = OpenLayers.String.trim( - point[0].firstChild.nodeValue).split(/\s*,\s*/); - } - } else { - location = [parseFloat(lat[0].firstChild.nodeValue), - parseFloat(lon[0].firstChild.nodeValue)]; - } - - var geometry = new OpenLayers.Geometry.Point(parseFloat(location[1]), - parseFloat(location[0])); - - } else if (line.length > 0) { - var coords = OpenLayers.String.trim(this.concatChildValues(line[0])).split(/\s+/); - var components = []; - var point; - for (var i=0, len=coords.length; i 0) { - var coords = OpenLayers.String.trim(this.concatChildValues(polygon[0])).split(/\s+/); - var components = []; - var point; - for (var i=0, len=coords.length; i 0) { - if (!this.gmlParser) { - this.gmlParser = new OpenLayers.Format.GML({'xy': this.xy}); - } - var feature = this.gmlParser.parseFeature(where[0]); - geometry = feature.geometry; - } else if (box.length > 0) { - var coords = OpenLayers.String.trim(box[0].firstChild.nodeValue).split(/\s+/); - var components = []; - var point; - if (coords.length > 3) { - point = new OpenLayers.Geometry.Point(parseFloat(coords[1]), - parseFloat(coords[0])); - components.push(point); - point = new OpenLayers.Geometry.Point(parseFloat(coords[1]), - parseFloat(coords[2])); - components.push(point); - point = new OpenLayers.Geometry.Point(parseFloat(coords[3]), - parseFloat(coords[2])); - components.push(point); - point = new OpenLayers.Geometry.Point(parseFloat(coords[3]), - parseFloat(coords[0])); - components.push(point); - point = new OpenLayers.Geometry.Point(parseFloat(coords[1]), - parseFloat(coords[0])); - components.push(point); - } - geometry = new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing(components)]); - } - - if (geometry && this.internalProjection && this.externalProjection) { - geometry.transform(this.externalProjection, - this.internalProjection); - } - - return geometry; - }, - - /** - * Method: createFeatureFromItem - * Return a feature from a GeoRSS Item. - * - * Parameters: - * item - {DOMElement} A GeoRSS item node. - * - * Returns: - * {} A feature representing the item. - */ - createFeatureFromItem: function(item) { - var geometry = this.createGeometryFromItem(item); - - /* Provide defaults for title and description */ - var title = this.getChildValue(item, "*", "title", this.featureTitle); - - /* First try RSS descriptions, then Atom summaries */ - var description = this.getChildValue( - item, "*", "description", - this.getChildValue(item, "*", "content", - this.getChildValue(item, "*", "summary", this.featureDescription))); - - /* If no link URL is found in the first child node, try the - href attribute */ - var link = this.getChildValue(item, "*", "link"); - if(!link) { - try { - link = this.getElementsByTagNameNS(item, "*", "link")[0].getAttribute("href"); - } catch(e) { - link = null; - } - } - - var id = this.getChildValue(item, "*", "id", null); - - var data = { - "title": title, - "description": description, - "link": link - }; - var feature = new OpenLayers.Feature.Vector(geometry, data); - feature.fid = id; - return feature; - }, - - /** - * Method: getChildValue - * - * Parameters: - * node - {DOMElement} - * nsuri - {String} Child node namespace uri ("*" for any). - * name - {String} Child node name. - * def - {String} Optional string default to return if no child found. - * - * Returns: - * {String} The value of the first child with the given tag name. Returns - * default value or empty string if none found. - */ - getChildValue: function(node, nsuri, name, def) { - var value; - var eles = this.getElementsByTagNameNS(node, nsuri, name); - if(eles && eles[0] && eles[0].firstChild - && eles[0].firstChild.nodeValue) { - value = eles[0].firstChild.nodeValue; - } else { - value = (def == undefined) ? "" : def; - } - return value; - }, - - /** - * APIMethod: read - * Return a list of features from a GeoRSS doc - - * Parameters: - * data - {Element} - * - * Returns: - * An Array of s - */ - read: function(doc) { - if (typeof doc == "string") { - doc = OpenLayers.Format.XML.prototype.read.apply(this, [doc]); - } - - /* Try RSS items first, then Atom entries */ - var itemlist = null; - itemlist = this.getElementsByTagNameNS(doc, '*', 'item'); - if (itemlist.length == 0) { - itemlist = this.getElementsByTagNameNS(doc, '*', 'entry'); - } - - var numItems = itemlist.length; - var features = new Array(numItems); - for(var i=0; i)} List of features to serialize into a string. - */ - write: function(features) { - var georss; - if(features instanceof Array) { - georss = this.createElementNS(this.rssns, "rss"); - for(var i=0, len=features.length; i, and build a geometry for it. - * - * Parameters: - * feature - {} - * - * Returns: - * {DOMElement} - */ - createFeatureXML: function(feature) { - var geometryNode = this.buildGeometryNode(feature.geometry); - var featureNode = this.createElementNS(this.rssns, "item"); - var titleNode = this.createElementNS(this.rssns, "title"); - titleNode.appendChild(this.createTextNode(feature.attributes.title ? feature.attributes.title : "")); - var descNode = this.createElementNS(this.rssns, "description"); - descNode.appendChild(this.createTextNode(feature.attributes.description ? feature.attributes.description : "")); - featureNode.appendChild(titleNode); - featureNode.appendChild(descNode); - if (feature.attributes.link) { - var linkNode = this.createElementNS(this.rssns, "link"); - linkNode.appendChild(this.createTextNode(feature.attributes.link)); - featureNode.appendChild(linkNode); - } - for(var attr in feature.attributes) { - if (attr == "link" || attr == "title" || attr == "description") { continue; } - var attrText = this.createTextNode(feature.attributes[attr]); - var nodename = attr; - if (attr.search(":") != -1) { - nodename = attr.split(":")[1]; - } - var attrContainer = this.createElementNS(this.featureNS, "feature:"+nodename); - attrContainer.appendChild(attrText); - featureNode.appendChild(attrContainer); - } - featureNode.appendChild(geometryNode); - return featureNode; - }, - - /** - * Method: buildGeometryNode - * builds a GeoRSS node with a given geometry - * - * Parameters: - * geometry - {} - * - * Returns: - * {DOMElement} A gml node. - */ - buildGeometryNode: function(geometry) { - if (this.internalProjection && this.externalProjection) { - geometry = geometry.clone(); - geometry.transform(this.internalProjection, - this.externalProjection); - } - var node; - // match Polygon - if (geometry.CLASS_NAME == "OpenLayers.Geometry.Polygon") { - node = this.createElementNS(this.georssns, 'georss:polygon'); - - node.appendChild(this.buildCoordinatesNode(geometry.components[0])); - } - // match LineString - else if (geometry.CLASS_NAME == "OpenLayers.Geometry.LineString") { - node = this.createElementNS(this.georssns, 'georss:line'); - - node.appendChild(this.buildCoordinatesNode(geometry)); - } - // match Point - else if (geometry.CLASS_NAME == "OpenLayers.Geometry.Point") { - node = this.createElementNS(this.georssns, 'georss:point'); - node.appendChild(this.buildCoordinatesNode(geometry)); - } else { - throw "Couldn't parse " + geometry.CLASS_NAME; - } - return node; - }, - - /** - * Method: buildCoordinatesNode - * - * Parameters: - * geometry - {} - */ - buildCoordinatesNode: function(geometry) { - var points = null; - - if (geometry.components) { - points = geometry.components; - } - - var path; - if (points) { - var numPoints = points.length; - var parts = new Array(numPoints); - for (var i = 0; i < numPoints; i++) { - parts[i] = points[i].y + " " + points[i].x; - } - path = parts.join(" "); - } else { - path = geometry.y + " " + geometry.x; - } - return this.createTextNode(path); - }, - - CLASS_NAME: "OpenLayers.Format.GeoRSS" -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/JSON.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/JSON.js deleted file mode 100755 index 6b3a4613d8..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/JSON.js +++ /dev/null @@ -1,388 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * Note: - * This work draws heavily from the public domain JSON serializer/deserializer - * at http://www.json.org/json.js. Rewritten so that it doesn't modify - * basic data prototypes. - */ - -/** - * @requires OpenLayers/Format.js - */ - -/** - * Class: OpenLayers.Format.JSON - * A parser to read/write JSON safely. Create a new instance with the - * constructor. - * - * Inherits from: - * - - */ -OpenLayers.Format.JSON = OpenLayers.Class(OpenLayers.Format, { - - /** - * APIProperty: indent - * {String} For "pretty" printing, the indent string will be used once for - * each indentation level. - */ - indent: " ", - - /** - * APIProperty: space - * {String} For "pretty" printing, the space string will be used after - * the ":" separating a name/value pair. - */ - space: " ", - - /** - * APIProperty: newline - * {String} For "pretty" printing, the newline string will be used at the - * end of each name/value pair or array item. - */ - newline: "\n", - - /** - * Property: level - * {Integer} For "pretty" printing, this is incremented/decremented during - * serialization. - */ - level: 0, - - /** - * Property: pretty - * {Boolean} Serialize with extra whitespace for structure. This is set - * by the method. - */ - pretty: false, - - /** - * Constructor: OpenLayers.Format.JSON - * Create a new parser for JSON. - * - * Parameters: - * options - {Object} An optional object whose properties will be set on - * this instance. - */ - initialize: function(options) { - OpenLayers.Format.prototype.initialize.apply(this, [options]); - }, - - /** - * APIMethod: read - * Deserialize a json string. - * - * Parameters: - * json - {String} A JSON string - * filter - {Function} A function which will be called for every key and - * value at every level of the final result. Each value will be - * replaced by the result of the filter function. This can be used to - * reform generic objects into instances of classes, or to transform - * date strings into Date objects. - * - * Returns: - * {Object} An object, array, string, or number . - */ - read: function(json, filter) { - /** - * Parsing happens in three stages. In the first stage, we run the text - * against a regular expression which looks for non-JSON - * characters. We are especially concerned with '()' and 'new' - * because they can cause invocation, and '=' because it can cause - * mutation. But just to be safe, we will reject all unexpected - * characters. - */ - try { - if (/^[\],:{}\s]*$/.test(json.replace(/\\["\\\/bfnrtu]/g, '@'). - replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']'). - replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { - - /** - * In the second stage we use the eval function to compile the - * text into a JavaScript structure. The '{' operator is - * subject to a syntactic ambiguity in JavaScript - it can - * begin a block or an object literal. We wrap the text in - * parens to eliminate the ambiguity. - */ - var object = eval('(' + json + ')'); - - /** - * In the optional third stage, we recursively walk the new - * structure, passing each name/value pair to a filter - * function for possible transformation. - */ - if(typeof filter === 'function') { - function walk(k, v) { - if(v && typeof v === 'object') { - for(var i in v) { - if(v.hasOwnProperty(i)) { - v[i] = walk(i, v[i]); - } - } - } - return filter(k, v); - } - object = walk('', object); - } - - if(this.keepData) { - this.data = object; - } - - return object; - } - } catch(e) { - // Fall through if the regexp test fails. - } - return null; - }, - - /** - * APIMethod: write - * Serialize an object into a JSON string. - * - * Parameters: - * value - {String} The object, array, string, number, boolean or date - * to be serialized. - * pretty - {Boolean} Structure the output with newlines and indentation. - * Default is false. - * - * Returns: - * {String} The JSON string representation of the input value. - */ - write: function(value, pretty) { - this.pretty = !!pretty; - var json = null; - var type = typeof value; - if(this.serialize[type]) { - try { - json = this.serialize[type].apply(this, [value]); - } catch(err) { - OpenLayers.Console.error("Trouble serializing: " + err); - } - } - return json; - }, - - /** - * Method: writeIndent - * Output an indentation string depending on the indentation level. - * - * Returns: - * {String} An appropriate indentation string. - */ - writeIndent: function() { - var pieces = []; - if(this.pretty) { - for(var i=0; i 0) { - pieces.push(','); - } - pieces.push(this.writeNewline(), this.writeIndent(), json); - } - } - - this.level -= 1; - pieces.push(this.writeNewline(), this.writeIndent(), ']'); - return pieces.join(''); - }, - - /** - * Method: serialize.string - * Transform a string into a JSON string. - * - * Parameters: - * string - {String} The string to be serialized - * - * Returns: - * {String} A JSON string representing the string. - */ - 'string': function(string) { - // If the string contains no control characters, no quote characters, and no - // backslash characters, then we can simply slap some quotes around it. - // Otherwise we must also replace the offending characters with safe - // sequences. - var m = { - '\b': '\\b', - '\t': '\\t', - '\n': '\\n', - '\f': '\\f', - '\r': '\\r', - '"' : '\\"', - '\\': '\\\\' - }; - if(/["\\\x00-\x1f]/.test(string)) { - return '"' + string.replace(/([\x00-\x1f\\"])/g, function(a, b) { - var c = m[b]; - if(c) { - return c; - } - c = b.charCodeAt(); - return '\\u00' + - Math.floor(c / 16).toString(16) + - (c % 16).toString(16); - }) + '"'; - } - return '"' + string + '"'; - }, - - /** - * Method: serialize.number - * Transform a number into a JSON string. - * - * Parameters: - * number - {Number} The number to be serialized. - * - * Returns: - * {String} A JSON string representing the number. - */ - 'number': function(number) { - return isFinite(number) ? String(number) : "null"; - }, - - /** - * Method: serialize.boolean - * Transform a boolean into a JSON string. - * - * Parameters: - * bool - {Boolean} The boolean to be serialized. - * - * Returns: - * {String} A JSON string representing the boolean. - */ - 'boolean': function(bool) { - return String(bool); - }, - - /** - * Method: serialize.object - * Transform a date into a JSON string. - * - * Parameters: - * date - {Date} The date to be serialized. - * - * Returns: - * {String} A JSON string representing the date. - */ - 'date': function(date) { - function format(number) { - // Format integers to have at least two digits. - return (number < 10) ? '0' + number : number; - } - return '"' + date.getFullYear() + '-' + - format(date.getMonth() + 1) + '-' + - format(date.getDate()) + 'T' + - format(date.getHours()) + ':' + - format(date.getMinutes()) + ':' + - format(date.getSeconds()) + '"'; - } - }, - - CLASS_NAME: "OpenLayers.Format.JSON" - -}); diff --git a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/KML.js b/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/KML.js deleted file mode 100755 index b42644e2c3..0000000000 --- a/pandora_console/include/javascript/OpenLayers/lib/OpenLayers/Format/KML.js +++ /dev/null @@ -1,1238 +0,0 @@ -/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD - * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Format/XML.js - * @requires OpenLayers/Feature/Vector.js - * @requires OpenLayers/Geometry/Point.js - * @requires OpenLayers/Geometry/LineString.js - * @requires OpenLayers/Geometry/Polygon.js - * @requires OpenLayers/Geometry/Collection.js - * @requires OpenLayers/Request/XMLHttpRequest.js - * @requires OpenLayers/Console.js - */ - -/** - * Class: OpenLayers.Format.KML - * Read/Wite KML. Create a new instance with the - * constructor. - * - * Inherits from: - * - - */ -OpenLayers.Format.KML = OpenLayers.Class(OpenLayers.Format.XML, { - - /** - * APIProperty: kmlns - * {String} KML Namespace to use. Defaults to 2.0 namespace. - */ - kmlns: "http://earth.google.com/kml/2.0", - - /** - * APIProperty: placemarksDesc - * {String} Name of the placemarks. Default is "No description available." - */ - placemarksDesc: "No description available", - - /** - * APIProperty: foldersName - * {String} Name of the folders. Default is "OpenLayers export." - */ - foldersName: "OpenLayers export", - - /** - * APIProperty: foldersDesc - * {String} Description of the folders. Default is "Exported on [date]." - */ - foldersDesc: "Exported on " + new Date(), - - /** - * APIProperty: extractAttributes - * {Boolean} Extract attributes from KML. Default is true. - * Extracting styleUrls requires this to be set to true - */ - extractAttributes: true, - - /** - * Property: extractStyles - * {Boolean} Extract styles from KML. Default is false. - * Extracting styleUrls also requires extractAttributes to be - * set to true - */ - extractStyles: false, - - /** - * Property: internalns - * {String} KML Namespace to use -- defaults to the namespace of the - * Placemark node being parsed, but falls back to kmlns. - */ - internalns: null, - - /** - * Property: features - * {Array} Array of features - * - */ - features: null, - - /** - * Property: styles - * {Object} Storage of style objects - * - */ - styles: null, - - /** - * Property: styleBaseUrl - * {String} - */ - styleBaseUrl: "", - - /** - * Property: fetched - * {Object} Storage of KML URLs that have been fetched before - * in order to prevent reloading them. - */ - fetched: null, - - /** - * APIProperty: maxDepth - * {Integer} Maximum depth for recursive loading external KML URLs - * Defaults to 0: do no external fetching - */ - maxDepth: 0, - - /** - * Constructor: OpenLayers.Format.KML - * Create a new parser for KML. - * - * Parameters: - * options - {Object} An optional object whose properties will be set on - * this instance. - */ - initialize: function(options) { - // compile regular expressions once instead of every time they are used - this.regExes = { - trimSpace: (/^\s*|\s*$/g), - removeSpace: (/\s*/g), - splitSpace: (/\s+/), - trimComma: (/\s*,\s*/g), - kmlColor: (/(\w{2})(\w{2})(\w{2})(\w{2})/), - kmlIconPalette: (/root:\/\/icons\/palette-(\d+)(\.\w+)/), - straightBracket: (/\$\[(.*?)\]/g) - }; - OpenLayers.Format.XML.prototype.initialize.apply(this, [options]); - }, - - /** - * APIMethod: read - * Read data from a string, and return a list of features. - * - * Parameters: - * data - {String} or {DOMElement} data to read/parse. - * - * Returns: - * {Array()} List of features. - */ - read: function(data) { - this.features = []; - this.styles = {}; - this.fetched = {}; - - // Set default options - var options = { - depth: 0, - styleBaseUrl: this.styleBaseUrl - }; - - return this.parseData(data, options); - }, - - /** - * Method: parseData - * Read data from a string, and return a list of features. - * - * Parameters: - * data - {String} or {DOMElement} data to read/parse. - * options - {Object} Hash of options - * - * Returns: - * {Array()} List of features. - */ - parseData: function(data, options) { - if(typeof data == "string") { - data = OpenLayers.Format.XML.prototype.read.apply(this, [data]); - } - - // Loop throught the following node types in this order and - // process the nodes found - var types = ["Link", "NetworkLink", "Style", "StyleMap", "Placemark"]; - for(var i=0, len=types.length; i and - // Don't do anything if we have reached our maximum depth for recursion - if (options.depth >= this.maxDepth) { - return false; - } - - // increase depth - var newOptions = OpenLayers.Util.extend({}, options); - newOptions.depth++; - - for(var i=0, len=nodes.length; i nodes in the data and parses them - * Also parses nodes, but only uses the 'normal' key - * - * Parameters: - * nodes - {Array} of {DOMElement} data to read/parse. - * options - {Object} Hash of options - * - */ - parseStyles: function(nodes, options) { - for(var i=0, len=nodes.length; i node and builds the style hash - * accordingly - * - * Parameters: - * node - {DOMElement}