[fusion-commits] r2257 - in trunk: . lib/OpenLayers
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Mon Oct 25 17:11:05 EDT 2010
Author: pagameba
Date: 2010-10-25 14:11:05 -0700 (Mon, 25 Oct 2010)
New Revision: 2257
Modified:
trunk/fusion.cfg
trunk/lib/OpenLayers/OpenLayers.js
Log:
adding WFS protocol to OpenLayers build.
Modified: trunk/fusion.cfg
===================================================================
--- trunk/fusion.cfg 2010-10-25 18:36:47 UTC (rev 2256)
+++ trunk/fusion.cfg 2010-10-25 21:11:05 UTC (rev 2257)
@@ -61,6 +61,10 @@
OpenLayers/Handler/RegularPolygon.js
OpenLayers/Projection.js
OpenLayers/Protocol/HTTP.js
+OpenLayers/Protocol/WFS.js
+OpenLayers/Protocol/WFS/v1.js
+OpenLayers/Protocol/WFS/v1_0_0.js
+OpenLayers/Protocol/WFS/v1_1_0.js
OpenLayers/Strategy/Fixed.js
OpenLayers/Feature.js
OpenLayers/Marker.js
Modified: trunk/lib/OpenLayers/OpenLayers.js
===================================================================
--- trunk/lib/OpenLayers/OpenLayers.js 2010-10-25 18:36:47 UTC (rev 2256)
+++ trunk/lib/OpenLayers/OpenLayers.js 2010-10-25 21:11:05 UTC (rev 2257)
@@ -1,95 +1,95 @@
-/*
-
- OpenLayers.js -- OpenLayers Map Viewer Library
-
- Copyright 2005-2010 OpenLayers Contributors, released under the Clear BSD
- license. Please see http://svn.openlayers.org/trunk/openlayers/license.txt
- for the full text of the license.
-
- Includes compressed code under the following licenses:
-
- (For uncompressed versions of the code used please see the
- OpenLayers SVN repository: <http://openlayers.org/>)
-
-*/
-
-/* Contains portions of Prototype.js:
- *
- * Prototype JavaScript framework, version 1.4.0
- * (c) 2005 Sam Stephenson <sam at conio.net>
- *
- * Prototype is freely distributable under the terms of an MIT-style license.
- * For details, see the Prototype web site: http://prototype.conio.net/
- *
- *--------------------------------------------------------------------------*/
-
-/**
-*
-* Contains portions of Rico <http://openrico.org/>
-*
-* Copyright 2005 Sabre Airline Solutions
-*
-* Licensed under the Apache License, Version 2.0 (the "License"); you
-* may not use this file except in compliance with the License. You
-* may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-* implied. See the License for the specific language governing
-* permissions and limitations under the License.
-*
-**/
-
-/**
- * Contains XMLHttpRequest.js <http://code.google.com/p/xmlhttprequest/>
- * Copyright 2007 Sergey Ilinsky (http://www.ilinsky.com)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- */
-
-/**
- * Contains portions of Gears <http://code.google.com/apis/gears/>
- *
- * 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.
- */
+/*
+
+ OpenLayers.js -- OpenLayers Map Viewer Library
+
+ Copyright 2005-2010 OpenLayers Contributors, released under the Clear BSD
+ license. Please see http://svn.openlayers.org/trunk/openlayers/license.txt
+ for the full text of the license.
+
+ Includes compressed code under the following licenses:
+
+ (For uncompressed versions of the code used please see the
+ OpenLayers SVN repository: <http://openlayers.org/>)
+
+*/
+
+/* Contains portions of Prototype.js:
+ *
+ * Prototype JavaScript framework, version 1.4.0
+ * (c) 2005 Sam Stephenson <sam at conio.net>
+ *
+ * Prototype is freely distributable under the terms of an MIT-style license.
+ * For details, see the Prototype web site: http://prototype.conio.net/
+ *
+ *--------------------------------------------------------------------------*/
+
+/**
+*
+* Contains portions of Rico <http://openrico.org/>
+*
+* Copyright 2005 Sabre Airline Solutions
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you
+* may not use this file except in compliance with the License. You
+* may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+* implied. See the License for the specific language governing
+* permissions and limitations under the License.
+*
+**/
+
+/**
+ * Contains XMLHttpRequest.js <http://code.google.com/p/xmlhttprequest/>
+ * Copyright 2007 Sergey Ilinsky (http://www.ilinsky.com)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ */
+
+/**
+ * Contains portions of Gears <http://code.google.com/apis/gears/>
+ *
+ * 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.
+ */
/* ======================================================================
OpenLayers/SingleFile.js
====================================================================== */
@@ -100,10 +100,33 @@
* full text of the license. */
var OpenLayers = {
- singleFile: true
-};
+ /**
+ * Constant: VERSION_NUMBER
+ */
+ VERSION_NUMBER: "$Revision$",
+ /**
+ * Constant: singleFile
+ * TODO: remove this in 3.0 when we stop supporting build profiles that
+ * include OpenLayers.js
+ */
+ singleFile: true,
+ /**
+ * Method: _getScriptLocation
+ * Return the path to this script. This is also implemented in
+ * OpenLayers.js
+ *
+ * Returns:
+ * {String} Path to this script
+ */
+ _getScriptLocation: (function() {
+ var s = document.getElementsByTagName('script');
+ var m = s[s.length-1].getAttribute("src").match(/(^|(.*?\/))(OpenLayers\.js)(\?|$)/);
+ var l = m ? m[1] : "";
+ return (function() { return l; });
+ })()
+};
/* ======================================================================
OpenLayers.js
====================================================================== */
@@ -117,62 +140,49 @@
* @requires OpenLayers/BaseTypes.js
* @requires OpenLayers/Lang/en.js
* @requires OpenLayers/Console.js
- */
+ */
+
+/*
+ * TODO: In 3.0, we will stop supporting build profiles that include
+ * OpenLayers.js. This means we will not need the singleFile and scriptFile
+ * variables, because we don't have to handle the singleFile case any more.
+ */
(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.
+ * case with old single file build profiles that included both
+ * OpenLayers.js and OpenLayers/SingleFile.js.
*/
var singleFile = (typeof OpenLayers == "object" && OpenLayers.singleFile);
/**
- * Cache for the script location returned from
- * OpenLayers._getScriptLocation
+ * Relative path of this script.
*/
- var scriptLocation;
+ var scriptName = (!singleFile) ? "lib/OpenLayers.js" : "OpenLayers.js";
/**
* 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.
+ * Method: _getScriptLocation
+ * Return the path to this script. This is also implemented in
+ * OpenLayers/SingleFile.js
*
* Returns:
* {String} Path to this script
*/
- _getScriptLocation: function () {
- if (scriptLocation != undefined) {
- return scriptLocation;
- }
- scriptLocation = "";
- var isOL = new RegExp("(^|(.*?\\/))(" + OpenLayers._scriptName + ")(\\?|$)");
-
- var scripts = document.getElementsByTagName('script');
- for (var i=0, len=scripts.length; i<len; i++) {
- var src = scripts[i].getAttribute('src');
- if (src) {
- var match = src.match(isOL);
- if(match) {
- scriptLocation = match[1];
- break;
- }
- }
- }
- return scriptLocation;
- }
+ _getScriptLocation: (function() {
+ var r = new RegExp("(^|(.*?\\/))(" + scriptName + ")(\\?|$)");
+ var s = document.getElementsByTagName('script');
+ var m = s[s.length-1].getAttribute("src").match(r);
+ var l = m ? m[1] : "";
+ return (function() { return l; });
+ })()
};
/**
* OpenLayers.singleFile is a flag indicating this file is being included
@@ -183,7 +193,7 @@
*
* When we *are* part of a SFL build we do not dynamically include the
* OpenLayers library code as it will be appended at the end of this file.
- */
+ */
if(!singleFile) {
var jsfiles = new Array(
"OpenLayers/Util.js",
@@ -455,7 +465,7 @@
/**
* Constant: VERSION_NUMBER
*/
-OpenLayers.VERSION_NUMBER="OpenLayers 2.10 -- $Revision$";
+OpenLayers.VERSION_NUMBER="$Revision$";
/* ======================================================================
OpenLayers/Util.js
====================================================================== */
@@ -512,7 +522,7 @@
* Maintain existing definition of $.
*/
if(typeof window.$ === "undefined") {
- //window.$ = OpenLayers.Util.getElement;
+ window.$ = OpenLayers.Util.getElement;
}
/**
@@ -1524,12 +1534,26 @@
for(var i=0, len=pairs.length; i<len; ++i) {
var keyValue = pairs[i].split('=');
if (keyValue[0]) {
- var key = decodeURIComponent(keyValue[0]);
- var value = keyValue[1] || ''; //empty string if no value
- //decode individual values (being liberal by replacing "+" with " ")
- value = decodeURIComponent(value.replace(/\+/g, " ")).split(",");
+ var key = keyValue[0];
+ try {
+ key = decodeURIComponent(key);
+ } catch (err) {
+ key = unescape(key);
+ }
+
+ // being liberal by replacing "+" with " "
+ var value = (keyValue[1] || '').replace(/\+/g, " ");
+ try {
+ value = decodeURIComponent(value);
+ } catch (err) {
+ value = unescape(value);
+ }
+
+ // follow OGC convention of comma delimited values
+ value = value.split(",")
+
//if there's only one value, do not return as array
if (value.length == 1) {
value = value[0];
@@ -3222,49 +3246,22 @@
*
*/
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, Type;
- for(var i=0, len=arguments.length; i<len; ++i) {
- Type = arguments[i];
- if(typeof Type == "function") {
- // make the class passed as the first argument the superclass
- if(i == 0 && len > 1) {
- initialize = Type.prototype.initialize;
- // replace the initialize method with an empty function,
- // because we do not want to create a real instance here
- Type.prototype.initialize = function() {};
- // the line below makes sure that the new class has a
- // superclass
- extended = new Type();
- // restore the original initialize method
- if(initialize === undefined) {
- delete Type.prototype.initialize;
- } else {
- Type.prototype.initialize = initialize;
- }
- }
- // get the prototype of the superclass
- parent = Type.prototype;
- } else {
- // in this case we're extending with the prototype
- parent = Type;
- }
- OpenLayers.Util.extend(extended, parent);
+ var len = arguments.length;
+ var P = arguments[0];
+ var F = arguments[len-1];
+
+ var C = typeof F.initialize == "function" ?
+ F.initialize :
+ function(){ P.apply(this, arguments); };
+
+ if (len > 1) {
+ var newArgs = [C, P].concat(
+ Array.prototype.slice.call(arguments).slice(1, len-1), F);
+ OpenLayers.inherit.apply(null, newArgs);
+ } else {
+ C.prototype = F;
}
- Class.prototype = extended;
- return Class;
+ return C;
};
/**
@@ -3289,7 +3286,6 @@
};
};
-
/**
* APIFunction: inherit
* *Deprecated*. Old method to inherit from one or more OpenLayers style
@@ -3301,18 +3297,38 @@
* 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<len; i++) {
- if (typeof arguments[i] == "function") {
- var mixin = arguments[i];
- arguments[i] = new mixin(OpenLayers.Class.isPrototype);
- }
- OpenLayers.Util.extend(proto, arguments[i]);
- }
- return proto;
+OpenLayers.Class.inherit = function (P) {
+ var C = function() {
+ P.call(this);
+ };
+ var newArgs = [C].concat(Array.prototype.slice.call(arguments));
+ OpenLayers.inherit.apply(null, newArgs);
+ return C.prototype;
};
+
+/**
+ * Function: OpenLayers.inherit
+ *
+ * Parameters:
+ * C - {Object} the class that inherits
+ * P - {Object} the superclass to inherit from
+ *
+ * In addition to the mandatory C and P parameters, an arbitrary number of
+ * objects can be passed, which will extend C.
+ */
+OpenLayers.inherit = function(C, P) {
+ var F = function() {};
+ F.prototype = P.prototype;
+ C.prototype = new F;
+ var i, l, o;
+ for(i=2, l=arguments.length; i<l; i++) {
+ o = arguments[i];
+ if(typeof o === "function") {
+ o = o.prototype;
+ }
+ OpenLayers.Util.extend(C.prototype, o);
+ }
+};
/* ======================================================================
OpenLayers/BaseTypes/Size.js
====================================================================== */
@@ -7482,6 +7498,81 @@
CLASS_NAME: "OpenLayers.Popup.Anchored"
});
/* ======================================================================
+ OpenLayers/Protocol/WFS.js
+ ====================================================================== */
+
+/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the Clear BSD license.
+ * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Protocol.js
+ */
+
+/**
+ * Function: OpenLayers.Protocol.WFS
+ * Used to create a versioned WFS protocol. Default version is 1.0.0.
+ *
+ * Returns:
+ * {<OpenLayers.Protocol>} A WFS protocol of the given version.
+ */
+OpenLayers.Protocol.WFS = function(options) {
+ options = OpenLayers.Util.applyDefaults(
+ options, OpenLayers.Protocol.WFS.DEFAULTS
+ );
+ var cls = OpenLayers.Protocol.WFS["v"+options.version.replace(/\./g, "_")];
+ if(!cls) {
+ throw "Unsupported WFS version: " + options.version;
+ }
+ return new cls(options);
+};
+
+/**
+ * Function: OpenLayers.Protocol.WFS.fromWMSLayer
+ * Convenience function to create a WFS protocol from a WMS layer. This makes
+ * the assumption that a WFS requests can be issued at the same URL as
+ * WMS requests and that a WFS featureType exists with the same name as the
+ * WMS layer.
+ *
+ * This function is designed to auto-configure <url>, <featureType>,
+ * <featurePrefix> and <srsName> for WFS <version> 1.1.0. Note that
+ * srsName matching with the WMS layer will not work with WFS 1.0.0..
+ *
+ * Parameters:
+ * layer - {<OpenLayers.Layer.WMS>} WMS layer that has a matching WFS
+ * FeatureType at the same server url with the same typename.
+ * options - {Object} Default properties to be set on the protocol.
+ *
+ */
+OpenLayers.Protocol.WFS.fromWMSLayer = function(layer, options) {
+ var typeName, featurePrefix;
+ var param = layer.params["LAYERS"];
+ var parts = (param instanceof Array ? param[0] : param).split(":");
+ if(parts.length > 1) {
+ featurePrefix = parts[0];
+ }
+ typeName = parts.pop();
+ var protocolOptions = {
+ url: layer.url,
+ featureType: typeName,
+ featurePrefix: featurePrefix,
+ srsName: layer.projection && layer.projection.getCode() ||
+ layer.map && layer.map.getProjectionObject().getCode(),
+ version: "1.1.0"
+ };
+ return new OpenLayers.Protocol.WFS(OpenLayers.Util.applyDefaults(
+ options, protocolOptions
+ ));
+};
+
+/**
+ * Constant: OpenLayers.Protocol.WFS.DEFAULTS
+ */
+OpenLayers.Protocol.WFS.DEFAULTS = {
+ "version": "1.0.0"
+};
+/* ======================================================================
OpenLayers/Renderer/Canvas.js
====================================================================== */
@@ -8494,10 +8585,13 @@
};
rendered = false;
+ var removeBackground = false;
if (style.display != "none") {
if (style.backgroundGraphic) {
this.redrawBackgroundNode(geometry.id, geometry, style,
featureId);
+ } else {
+ removeBackground = true;
}
rendered = this.redrawNode(geometry.id, geometry, style,
featureId);
@@ -8506,12 +8600,18 @@
var node = document.getElementById(geometry.id);
if (node) {
if (node._style.backgroundGraphic) {
- node.parentNode.removeChild(document.getElementById(
- geometry.id + this.BACKGROUND_ID_SUFFIX));
+ removeBackground = true;
}
node.parentNode.removeChild(node);
}
}
+ if (removeBackground) {
+ var node = document.getElementById(
+ geometry.id + this.BACKGROUND_ID_SUFFIX);
+ if (node) {
+ node.parentNode.removeChild(node);
+ }
+ }
return rendered;
},
@@ -9097,13 +9197,14 @@
* options - {Object} options to pass to protocol read.
*/
load: function(options) {
- this.layer.events.triggerEvent("loadstart");
- this.layer.protocol.read(OpenLayers.Util.applyDefaults({
- callback: this.merge,
- filter: this.layer.filter,
- scope: this
+ var layer = this.layer;
+ layer.events.triggerEvent("loadstart");
+ layer.protocol.read(OpenLayers.Util.applyDefaults({
+ callback: OpenLayers.Function.bind(this.merge, this,
+ layer.map.getProjectionObject()),
+ filter: layer.filter
}, options));
- this.layer.events.un({
+ layer.events.un({
"visibilitychanged": this.load,
scope: this
});
@@ -9112,25 +9213,28 @@
/**
* Method: merge
* Add all features to the layer.
+ *
+ * Parameters:
+ * mapProjection - {OpenLayers.Projection} the map projection
+ * resp - {Object} options to pass to protocol read.
*/
- merge: function(resp) {
- this.layer.destroyFeatures();
+ merge: function(mapProjection, resp) {
+ var layer = this.layer;
+ layer.destroyFeatures();
var features = resp.features;
if (features && features.length > 0) {
- var remote = this.layer.projection;
- var local = this.layer.map.getProjectionObject();
- if(!local.equals(remote)) {
+ if(!mapProjection.equals(layer.projection)) {
var geom;
for(var i=0, len=features.length; i<len; ++i) {
geom = features[i].geometry;
if(geom) {
- geom.transform(remote, local);
+ geom.transform(layer.projection, mapProjection);
}
}
}
- this.layer.addFeatures(features);
+ layer.addFeatures(features);
}
- this.layer.events.triggerEvent("loadend");
+ layer.events.triggerEvent("loadend");
},
CLASS_NAME: "OpenLayers.Strategy.Fixed"
@@ -9157,27 +9261,31 @@
/**
* APIProperty: strokeColor
* {String} Color for line stroke. This is a RGB hex value (e.g. "#ff0000"
- * for red).
+ * for red).
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- strokeColor: null,
/**
* APIProperty: strokeOpacity
* {Number} Stroke opacity (0-1).
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- strokeOpacity: null,
/**
* APIProperty: strokeWidth
* {Number} Pixel stroke width.
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- strokeWidth: null,
/**
* APIProperty: strokeLinecap
* {String} Stroke cap type ("butt", "round", or "square").
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- strokeLinecap: null,
/**
* Property: strokeDashstyle
@@ -9185,8 +9293,9 @@
* OpenLayers values for strokeDashstyle ("dot", "dash", "dashdot",
* "longdash", "longdashdot", or "solid") will not work in SLD, but
* most SLD patterns will render correctly in OpenLayers.
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- strokeDashstyle: null,
/**
* Constructor: OpenLayers.Symbolizer.Line
@@ -9231,26 +9340,30 @@
* APIProperty: strokeColor
* {String} Color for line stroke. This is a RGB hex value (e.g. "#ff0000"
* for red).
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- strokeColor: null,
/**
* APIProperty: strokeOpacity
* {Number} Stroke opacity (0-1).
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- strokeOpacity: null,
/**
* APIProperty: strokeWidth
* {Number} Pixel stroke width.
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- strokeWidth: null,
/**
* APIProperty: strokeLinecap
* {String} Stroke cap type ("butt", "round", or "square").
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- strokeLinecap: null,
/**
* Property: strokeDashstyle
@@ -9258,80 +9371,92 @@
* OpenLayers values for strokeDashstyle ("dot", "dash", "dashdot",
* "longdash", "longdashdot", or "solid") will not work in SLD, but
* most SLD patterns will render correctly in OpenLayers.
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- strokeDashstyle: null,
/**
* APIProperty: fillColor
* {String} RGB hex fill color (e.g. "#ff0000" for red).
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- fillColor: null,
/**
* APIProperty: fillOpacity
* {Number} Fill opacity (0-1).
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- fillOpacity: null,
/**
* APIProperty: pointRadius
* {Number} Pixel point radius.
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- pointRadius: null,
/**
* APIProperty: externalGraphic
* {String} Url to an external graphic that will be used for rendering
* points.
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- externalGraphic: null,
/**
* APIProperty: graphicWidth
* {Number} Pixel width for sizing an external graphic.
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- graphicWidth: null,
/**
* APIProperty: graphicHeight
* {Number} Pixel height for sizing an external graphic.
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- graphicHeight: null,
/**
* APIProperty: graphicOpacity
* {Number} Opacity (0-1) for an external graphic.
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- graphicOpacity: null,
/**
* APIProperty: graphicXOffset
* {Number} Pixel offset along the positive x axis for displacing an
* external graphic.
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- graphicXOffset: null,
/**
* APIProperty: graphicYOffset
* {Number} Pixel offset along the positive y axis for displacing an
* external graphic.
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- graphicYOffset: null,
/**
* APIProperty: rotation
* {Number} The rotation of a graphic in the clockwise direction about its
* center point (or any point off center as specified by
* <graphicXOffset> and <graphicYOffset>).
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- rotation: null,
/**
* APIProperty: graphicName
* {String} Named graphic to use when rendering points. Supported values
* include "circle", "square", "star", "x", "cross", and "triangle".
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- graphicName: null,
/**
* Constructor: OpenLayers.Symbolizer.Point
@@ -9376,26 +9501,30 @@
* APIProperty: strokeColor
* {String} Color for line stroke. This is a RGB hex value (e.g. "#ff0000"
* for red).
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- strokeColor: null,
/**
* APIProperty: strokeOpacity
* {Number} Stroke opacity (0-1).
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- strokeOpacity: null,
/**
* APIProperty: strokeWidth
* {Number} Pixel stroke width.
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- strokeWidth: null,
/**
* APIProperty: strokeLinecap
* {String} Stroke cap type ("butt", "round", or "square").
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- strokeLinecap: null,
/**
* Property: strokeDashstyle
@@ -9403,20 +9532,23 @@
* OpenLayers values for strokeDashstyle ("dot", "dash", "dashdot",
* "longdash", "longdashdot", or "solid") will not work in SLD, but
* most SLD patterns will render correctly in OpenLayers.
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- strokeDashstyle: null,
/**
* APIProperty: fillColor
* {String} RGB hex fill color (e.g. "#ff0000" for red).
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- fillColor: null,
/**
* APIProperty: fillOpacity
* {Number} Fill opacity (0-1).
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- fillOpacity: null,
/**
* Constructor: OpenLayers.Symbolizer.Polygon
@@ -9498,32 +9630,37 @@
/**
* APIProperty: label
* {String} The text for the label.
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- label: null,
/**
* APIProperty: fontFamily
* {String} The font family for the label.
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- fontFamily: null,
/**
* APIProperty: fontSize
* {String} The font size for the label.
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- fontSize: null,
/**
* APIProperty: fontWeight
* {String} The font weight for the label.
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- fontWeight: null,
/**
* Property: fontStyle
* {String} The font style for the label.
+ *
+ * No default set here. Use OpenLayers.Renderer.defaultRenderer for defaults.
*/
- fontStyle: null,
/**
* Constructor: OpenLayers.Symbolizer.Text
@@ -12009,6 +12146,366 @@
return point;
};
/* ======================================================================
+ OpenLayers/Protocol/WFS/v1.js
+ ====================================================================== */
+
+/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the Clear BSD license.
+ * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Protocol/WFS.js
+ */
+
+/**
+ * Class: OpenLayers.Protocol.WFS.v1
+ * Abstract class for for v1.0.0 and v1.1.0 protocol.
+ *
+ * Inherits from:
+ * - <OpenLayers.Protocol>
+ */
+OpenLayers.Protocol.WFS.v1 = OpenLayers.Class(OpenLayers.Protocol, {
+
+ /**
+ * Property: version
+ * {String} WFS version number.
+ */
+ version: null,
+
+ /**
+ * Property: srsName
+ * {String} Name of spatial reference system. Default is "EPSG:4326".
+ */
+ srsName: "EPSG:4326",
+
+ /**
+ * Property: featureType
+ * {String} Local feature typeName.
+ */
+ featureType: null,
+
+ /**
+ * Property: featureNS
+ * {String} Feature namespace.
+ */
+ featureNS: null,
+
+ /**
+ * Property: geometryName
+ * {String} Name of the geometry attribute for features. Default is
+ * "the_geom".
+ */
+ geometryName: "the_geom",
+
+ /**
+ * Property: schema
+ * {String} Optional schema location that will be included in the
+ * schemaLocation attribute value. Note that the feature type schema
+ * is required for a strict XML validator (on transactions with an
+ * insert for example), but is *not* required by the WFS specification
+ * (since the server is supposed to know about feature type schemas).
+ */
+ schema: null,
+
+ /**
+ * Property: featurePrefix
+ * {String} Namespace alias for feature type. Default is "feature".
+ */
+ featurePrefix: "feature",
+
+ /**
+ * Property: formatOptions
+ * {Object} Optional options for the format. If a format is not provided,
+ * this property can be used to extend the default format options.
+ */
+ formatOptions: null,
+
+ /**
+ * Property: readFormat
+ * {<OpenLayers.Format>} For WFS requests it is possible to get a
+ * different output format than GML. In that case, we cannot parse
+ * the response with the default format (WFST) and we need a different
+ * format for reading.
+ */
+ readFormat: null,
+
+ /**
+ * Property: readOptions
+ * {Object} Optional object to pass to format's read.
+ */
+ readOptions: null,
+
+ /**
+ * Constructor: OpenLayers.Protocol.WFS
+ * A class for giving layers WFS protocol.
+ *
+ * Parameters:
+ * options - {Object} Optional object whose properties will be set on the
+ * instance.
+ *
+ * Valid options properties:
+ * url - {String} URL to send requests to (required).
+ * featureType - {String} Local (without prefix) feature typeName (required).
+ * featureNS - {String} Feature namespace (required, but can be autodetected
+ * for reading if featurePrefix is provided and identical to the prefix
+ * in the server response).
+ * featurePrefix - {String} Feature namespace alias (optional - only used
+ * for writing if featureNS is provided). Default is 'feature'.
+ * geometryName - {String} Name of geometry attribute. Default is 'the_geom'.
+ */
+ initialize: function(options) {
+ OpenLayers.Protocol.prototype.initialize.apply(this, [options]);
+ if(!options.format) {
+ this.format = OpenLayers.Format.WFST(OpenLayers.Util.extend({
+ version: this.version,
+ featureType: this.featureType,
+ featureNS: this.featureNS,
+ featurePrefix: this.featurePrefix,
+ geometryName: this.geometryName,
+ srsName: this.srsName,
+ schema: this.schema
+ }, this.formatOptions));
+ }
+ if(!this.featureNS && this.featurePrefix) {
+ // featureNS autodetection
+ var readNode = this.format.readNode;
+ this.format.readNode = function(node, obj) {
+ if(!this.featureNS && node.prefix == this.featurePrefix) {
+ this.featureNS = node.namespaceURI;
+ this.setNamespace("feature", this.featureNS);
+ }
+ return readNode.apply(this, arguments);
+ };
+ }
+ },
+
+ /**
+ * APIMethod: destroy
+ * Clean up the protocol.
+ */
+ destroy: function() {
+ if(this.options && !this.options.format) {
+ this.format.destroy();
+ }
+ this.format = null;
+ OpenLayers.Protocol.prototype.destroy.apply(this);
+ },
+
+ /**
+ * Method: read
+ * Construct a request for reading new features. Since WFS splits the
+ * basic CRUD operations into GetFeature requests (for read) and
+ * Transactions (for all others), this method does not make use of the
+ * format's read method (that is only about reading transaction
+ * responses).
+ */
+ read: function(options) {
+ OpenLayers.Protocol.prototype.read.apply(this, arguments);
+ options = OpenLayers.Util.extend({}, options);
+ OpenLayers.Util.applyDefaults(options, this.options || {});
+ var response = new OpenLayers.Protocol.Response({requestType: "read"});
+
+ var data = OpenLayers.Format.XML.prototype.write.apply(
+ this.format, [this.format.writeNode("wfs:GetFeature", options)]
+ );
+
+ response.priv = OpenLayers.Request.POST({
+ url: options.url,
+ callback: this.createCallback(this.handleRead, response, options),
+ params: options.params,
+ headers: options.headers,
+ data: data
+ });
+
+ return response;
+ },
+
+ /**
+ * Method: handleRead
+ * Deal with response from the read request.
+ *
+ * Parameters:
+ * response - {<OpenLayers.Protocol.Response>} The response object to pass
+ * to the user callback.
+ * options - {Object} The user options passed to the read call.
+ */
+ handleRead: function(response, options) {
+ if(options.callback) {
+ var request = response.priv;
+ if(request.status >= 200 && request.status < 300) {
+ // success
+ if (this.readOptions && this.readOptions.output == "object") {
+ OpenLayers.Util.extend(response,
+ this.parseResponse(request, this.readOptions));
+ } else {
+ response.features = this.parseResponse(request);
+ }
+ response.code = OpenLayers.Protocol.Response.SUCCESS;
+ } else {
+ // failure
+ response.code = OpenLayers.Protocol.Response.FAILURE;
+ }
+ options.callback.call(options.scope, response);
+ }
+ },
+
+ /**
+ * Method: parseResponse
+ * Read HTTP response body and return features
+ *
+ * Parameters:
+ * request - {XMLHttpRequest} The request object
+ * options - {Object} Optional object to pass to format's read
+ *
+ * Returns:
+ * {Object} or {Array({<OpenLayers.Feature.Vector>})} or
+ * {<OpenLayers.Feature.Vector>}
+ * An object with a features property, an array of features or a single
+ * feature.
+ */
+ parseResponse: function(request, options) {
+ var doc = request.responseXML;
+ if(!doc || !doc.documentElement) {
+ doc = request.responseText;
+ }
+ if(!doc || doc.length <= 0) {
+ return null;
+ }
+ return (this.readFormat !== null) ? this.readFormat.read(doc) :
+ this.format.read(doc, options);
+ },
+
+ /**
+ * Method: commit
+ * Given a list of feature, assemble a batch request for update, create,
+ * and delete transactions. A commit call on the prototype amounts
+ * to writing a WFS transaction - so the write method on the format
+ * is used.
+ *
+ * Parameters:
+ * features - {Array(<OpenLayers.Feature.Vector>}
+ *
+ * Returns:
+ * {<OpenLayers.Protocol.Response>} A response object with a features
+ * property containing any insertIds and a priv property referencing
+ * the XMLHttpRequest object.
+ */
+ commit: function(features, options) {
+
+ options = OpenLayers.Util.extend({}, options);
+ OpenLayers.Util.applyDefaults(options, this.options);
+
+ var response = new OpenLayers.Protocol.Response({
+ requestType: "commit",
+ reqFeatures: features
+ });
+ response.priv = OpenLayers.Request.POST({
+ url: options.url,
+ data: this.format.write(features, options),
+ callback: this.createCallback(this.handleCommit, response, options)
+ });
+
+ return response;
+ },
+
+ /**
+ * Method: handleCommit
+ * Called when the commit request returns.
+ *
+ * Parameters:
+ * response - {<OpenLayers.Protocol.Response>} The response object to pass
+ * to the user callback.
+ * options - {Object} The user options passed to the commit call.
+ */
+ handleCommit: function(response, options) {
+ if(options.callback) {
+ var request = response.priv;
+
+ // ensure that we have an xml doc
+ var data = request.responseXML;
+ if(!data || !data.documentElement) {
+ data = request.responseText;
+ }
+
+ var obj = this.format.read(data) || {};
+
+ response.insertIds = obj.insertIds || [];
+ response.code = (obj.success) ?
+ OpenLayers.Protocol.Response.SUCCESS :
+ OpenLayers.Protocol.Response.FAILURE;
+ options.callback.call(options.scope, response);
+ }
+ },
+
+ /**
+ * Method: filterDelete
+ * Send a request that deletes all features by their filter.
+ *
+ * Parameters:
+ * filter - {OpenLayers.Filter} filter
+ */
+ filterDelete: function(filter, options) {
+ options = OpenLayers.Util.extend({}, options);
+ OpenLayers.Util.applyDefaults(options, this.options);
+
+ var response = new OpenLayers.Protocol.Response({
+ requestType: "commit"
+ });
+
+ var root = this.format.createElementNSPlus("wfs:Transaction", {
+ attributes: {
+ service: "WFS",
+ version: this.version
+ }
+ });
+
+ var deleteNode = this.format.createElementNSPlus("wfs:Delete", {
+ attributes: {
+ typeName: (options.featureNS ? this.featurePrefix + ":" : "") +
+ options.featureType
+ }
+ });
+
+ if(options.featureNS) {
+ deleteNode.setAttribute("xmlns:" + this.featurePrefix, options.featureNS);
+ }
+ var filterNode = this.format.writeNode("ogc:Filter", filter);
+
+ deleteNode.appendChild(filterNode);
+
+ root.appendChild(deleteNode);
+
+ var data = OpenLayers.Format.XML.prototype.write.apply(
+ this.format, [root]
+ );
+
+ return OpenLayers.Request.POST({
+ url: this.url,
+ callback : options.callback || function(){},
+ data: data
+ });
+
+ },
+
+ /**
+ * Method: abort
+ * Abort an ongoing request, the response object passed to
+ * this method must come from this protocol (as a result
+ * of a read, or commit operation).
+ *
+ * Parameters:
+ * response - {<OpenLayers.Protocol.Response>}
+ */
+ abort: function(response) {
+ if (response) {
+ response.priv.abort();
+ }
+ },
+
+ CLASS_NAME: "OpenLayers.Protocol.WFS.v1"
+});
+/* ======================================================================
OpenLayers/Renderer/SVG.js
====================================================================== */
@@ -13764,21 +14261,43 @@
var resolution = this.getResolution();
var path = [];
- var linearRing, i, j, len, ilen, comp, x, y;
- for (j = 0, len=geometry.components.length; j<len; j++) {
- linearRing = geometry.components[j];
-
+ var j, jj, points, area, first, second, i, ii, comp, pathComp, x, y;
+ for (j=0, jj=geometry.components.length; j<jj; j++) {
path.push("m");
- for (i=0, ilen=linearRing.components.length; i<ilen; i++) {
- comp = linearRing.components[i];
+ points = geometry.components[j].components;
+ // we only close paths of interior rings with area
+ area = (j === 0);
+ first = null;
+ second = null;
+ for (i=0, ii=points.length; i<ii; i++) {
+ comp = points[i];
x = (comp.x / resolution - this.offset.x) | 0;
y = (comp.y / resolution - this.offset.y) | 0;
- path.push(" " + x + "," + y);
+ pathComp = " " + x + "," + y;
+ path.push(pathComp)
if (i==0) {
path.push(" l");
}
+ if (!area) {
+ // IE improperly renders sub-paths that have no area.
+ // Instead of checking the area of every ring, we confirm
+ // the ring has at least three distinct points. This does
+ // not catch all non-zero area cases, but it greatly improves
+ // interior ring digitizing and is a minor performance hit
+ // when rendering rings with many points.
+ if (!first) {
+ first = pathComp;
+ } else if (first != pathComp) {
+ if (!second) {
+ second = pathComp;
+ } else if (second != pathComp) {
+ // stop looking
+ area = true;
+ }
+ }
+ }
}
- path.push(" x ");
+ path.push(area ? " x " : " ");
}
path.push("e");
node.path = path.join("");
@@ -14110,8 +14629,9 @@
* bounds - {<OpenLayers.Bounds>}
* url - {<String>}
* size - {<OpenLayers.Size>}
+ * options - {Object}
*/
- initialize: function(layer, position, bounds, url, size) {
+ initialize: function(layer, position, bounds, url, size, options) {
this.layer = layer;
this.position = position.clone();
this.bounds = bounds.clone();
@@ -14122,6 +14642,8 @@
this.id = OpenLayers.Util.createUniqueID("Tile_");
this.events = new OpenLayers.Events(this, null, this.EVENT_TYPES);
+
+ OpenLayers.Util.extend(this, options);
},
/**
@@ -14296,6 +14818,44 @@
CLASS_NAME: "OpenLayers.Tile"
});
/* ======================================================================
+ OpenLayers/Format/WFST.js
+ ====================================================================== */
+
+/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). 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.js
+ */
+
+/**
+ * Function: OpenLayers.Format.WFST
+ * Used to create a versioned WFS protocol. Default version is 1.0.0.
+ *
+ * Returns:
+ * {<OpenLayers.Format>} A WFST format of the given version.
+ */
+OpenLayers.Format.WFST = function(options) {
+ options = OpenLayers.Util.applyDefaults(
+ options, OpenLayers.Format.WFST.DEFAULTS
+ );
+ var cls = OpenLayers.Format.WFST["v"+options.version.replace(/\./g, "_")];
+ if(!cls) {
+ throw "Unsupported WFST version: " + options.version;
+ }
+ return new cls(options);
+};
+
+/**
+ * Constant: OpenLayers.Format.WFST.DEFAULTS
+ * {Object} Default properties for the WFST format.
+ */
+OpenLayers.Format.WFST.DEFAULTS = {
+ "version": "1.0.0"
+};
+/* ======================================================================
OpenLayers/Format/XML.js
====================================================================== */
@@ -18582,7 +19142,24 @@
* effects when the tile is moved or changes resolution.
*/
backBufferTile: null,
-
+
+ /**
+ * APIProperty: maxGetUrlLength
+ * {Number} If set, requests that would result in GET urls with more
+ * characters than the number provided will be made using form-encoded
+ * HTTP POST. It is good practice to avoid urls that are longer than 2048
+ * characters.
+ *
+ * Caution:
+ * Older versions of Gecko based browsers (e.g. Firefox < 3.5) and
+ * Opera < 10.0 do not fully support this option.
+ *
+ * Note:
+ * Do not use this option for layers that have a transitionEffect
+ * configured - IFrame tiles from POST requests can not be resized.
+ */
+ maxGetUrlLength: null,
+
/** TBD 3.0 - reorder the parameters to the init function to remove
* URL. the getUrl() function on the layer gets called on
* each draw(), so no need to specify it here.
@@ -18596,17 +19173,22 @@
* bounds - {<OpenLayers.Bounds>}
* url - {<String>} Deprecated. Remove me in 3.0.
* size - {<OpenLayers.Size>}
+ * options - {Object}
*/
- initialize: function(layer, position, bounds, url, size) {
+ initialize: function(layer, position, bounds, url, size, options) {
OpenLayers.Tile.prototype.initialize.apply(this, arguments);
+ if (this.maxGetUrlLength != null) {
+ OpenLayers.Util.extend(this, OpenLayers.Tile.Image.IFrame);
+ }
+
this.url = url; //deprecated remove me
this.frame = document.createElement('div');
this.frame.style.overflow = 'hidden';
this.frame.style.position = 'absolute';
- this.layerAlphaHack = this.layer.alpha && OpenLayers.Util.alphaHack();
+ this.layerAlphaHack = this.layer.alpha && OpenLayers.Util.alphaHack();
},
/**
@@ -18615,22 +19197,7 @@
*/
destroy: function() {
if (this.imgDiv != null) {
- if (this.layerAlphaHack) {
- // unregister the "load" handler
- OpenLayers.Event.stopObservingElement(this.imgDiv.childNodes[0]);
- }
-
- // unregister the "load" and "error" handlers. Only the "error" handler if
- // this.layerAlphaHack is true.
- OpenLayers.Event.stopObservingElement(this.imgDiv);
-
- if (this.imgDiv.parentNode == this.frame) {
- this.frame.removeChild(this.imgDiv);
- this.imgDiv.map = null;
- }
- this.imgDiv.urls = null;
- // abort any currently loading image
- this.imgDiv.src = OpenLayers.Util.getImagesLocation() + "blank.gif";
+ this.removeImgDiv();
}
this.imgDiv = null;
if ((this.frame != null) && (this.frame.parentNode == this.layer.div)) {
@@ -18648,7 +19215,7 @@
OpenLayers.Tile.prototype.destroy.apply(this, arguments);
},
-
+
/**
* Method: clone
*
@@ -18787,13 +19354,8 @@
* position it correctly, and set its url.
*/
renderTile: function() {
- if (this.imgDiv == null) {
+ if (this.layer.async) {
this.initImgDiv();
- }
-
- this.imgDiv.viewRequestID = this.layer.map.viewRequestID;
-
- if (this.layer.async) {
// Asyncronous image requests call the asynchronous getURL method
// on the layer to fetch an image that covers 'this.bounds', in the scope of
// 'this', setting the 'url' property of the layer itself, and running
@@ -18803,12 +19365,9 @@
// syncronous image requests get the url and position the frame immediately,
// and don't wait for an image request to come back.
- // needed for changing to a different server for onload error
- if (this.layer.url instanceof Array) {
- this.imgDiv.urls = this.layer.url.slice();
- }
-
this.url = this.layer.getURL(this.bounds);
+
+ this.initImgDiv();
// position the frame immediately
this.positionImage();
@@ -18862,94 +19421,129 @@
* Creates the imgDiv property on the tile.
*/
initImgDiv: function() {
-
- var offset = this.layer.imageOffset;
- var size = this.layer.getImageSize(this.bounds);
-
- if (this.layerAlphaHack) {
- this.imgDiv = OpenLayers.Util.createAlphaImageDiv(null,
- offset,
- size,
- null,
- "relative",
- null,
- null,
- null,
- true);
- } else {
- this.imgDiv = OpenLayers.Util.createImage(null,
- offset,
- size,
- null,
- "relative",
- null,
- null,
- true);
- }
-
- this.imgDiv.className = 'olTileImage';
+ if (this.imgDiv == null) {
+ var offset = this.layer.imageOffset;
+ var size = this.layer.getImageSize(this.bounds);
- /* checkImgURL used to be used to called as a work around, but it
- ended up hiding problems instead of solving them and broke things
- like relative URLs. See discussion on the dev list:
- http://openlayers.org/pipermail/dev/2007-January/000205.html
+ if (this.layerAlphaHack) {
+ this.imgDiv = OpenLayers.Util.createAlphaImageDiv(null,
+ offset,
+ size,
+ null,
+ "relative",
+ null,
+ null,
+ null,
+ true);
+ } else {
+ this.imgDiv = OpenLayers.Util.createImage(null,
+ offset,
+ size,
+ null,
+ "relative",
+ null,
+ null,
+ true);
+ }
- OpenLayers.Event.observe( this.imgDiv, "load",
- OpenLayers.Function.bind(this.checkImgURL, this) );
- */
- this.frame.style.zIndex = this.isBackBuffer ? 0 : 1;
- this.frame.appendChild(this.imgDiv);
- this.layer.div.appendChild(this.frame);
+ // needed for changing to a different server for onload error
+ if (this.layer.url instanceof Array) {
+ this.imgDiv.urls = this.layer.url.slice();
+ }
+
+ this.imgDiv.className = 'olTileImage';
- if(this.layer.opacity != null) {
-
- OpenLayers.Util.modifyDOMElement(this.imgDiv, null, null, null,
- null, null, null,
- this.layer.opacity);
- }
+ /* checkImgURL used to be used to called as a work around, but it
+ ended up hiding problems instead of solving them and broke things
+ like relative URLs. See discussion on the dev list:
+ http://openlayers.org/pipermail/dev/2007-January/000205.html
- // we need this reference to check back the viewRequestID
- this.imgDiv.map = this.layer.map;
+ OpenLayers.Event.observe( this.imgDiv, "load",
+ OpenLayers.Function.bind(this.checkImgURL, this) );
+ */
+ this.frame.style.zIndex = this.isBackBuffer ? 0 : 1;
+ this.frame.appendChild(this.imgDiv);
+ this.layer.div.appendChild(this.frame);
- //bind a listener to the onload of the image div so that we
- // can register when a tile has finished loading.
- var onload = function() {
-
- //normally isLoading should always be true here but there are some
- // right funky conditions where loading and then reloading a tile
- // with the same url *really*fast*. this check prevents sending
- // a 'loadend' if the msg has already been sent
- //
- if (this.isLoading) {
- this.isLoading = false;
- this.events.triggerEvent("loadend");
+ if(this.layer.opacity != null) {
+
+ OpenLayers.Util.modifyDOMElement(this.imgDiv, null, null, null,
+ null, null, null,
+ this.layer.opacity);
}
- };
+
+ // we need this reference to check back the viewRequestID
+ this.imgDiv.map = this.layer.map;
+
+ //bind a listener to the onload of the image div so that we
+ // can register when a tile has finished loading.
+ var onload = function() {
+
+ //normally isLoading should always be true here but there are some
+ // right funky conditions where loading and then reloading a tile
+ // with the same url *really*fast*. this check prevents sending
+ // a 'loadend' if the msg has already been sent
+ //
+ if (this.isLoading) {
+ this.isLoading = false;
+ this.events.triggerEvent("loadend");
+ }
+ };
+
+ if (this.layerAlphaHack) {
+ OpenLayers.Event.observe(this.imgDiv.childNodes[0], 'load',
+ OpenLayers.Function.bind(onload, this));
+ } else {
+ OpenLayers.Event.observe(this.imgDiv, 'load',
+ OpenLayers.Function.bind(onload, this));
+ }
+
+
+ // Bind a listener to the onerror of the image div so that we
+ // can registere when a tile has finished loading with errors.
+ var onerror = function() {
+
+ // If we have gone through all image reload attempts, it is time
+ // to realize that we are done with this image. Since
+ // OpenLayers.Util.onImageLoadError already has taken care about
+ // the error, we can continue as if the image was loaded
+ // successfully.
+ if (this.imgDiv._attempts > OpenLayers.IMAGE_RELOAD_ATTEMPTS) {
+ onload.call(this);
+ }
+ };
+ OpenLayers.Event.observe(this.imgDiv, "error",
+ OpenLayers.Function.bind(onerror, this));
+ }
- if (this.layerAlphaHack) {
- OpenLayers.Event.observe(this.imgDiv.childNodes[0], 'load',
- OpenLayers.Function.bind(onload, this));
- } else {
- OpenLayers.Event.observe(this.imgDiv, 'load',
- OpenLayers.Function.bind(onload, this));
- }
+ this.imgDiv.viewRequestID = this.layer.map.viewRequestID;
+ },
+
+ /**
+ * Method: removeImgDiv
+ * Removes the imgDiv from the DOM and stops listening to events on it.
+ */
+ removeImgDiv: function() {
+ // unregister the "load" and "error" handlers. Only the "error" handler if
+ // this.layerAlphaHack is true.
+ OpenLayers.Event.stopObservingElement(this.imgDiv);
+ if (this.imgDiv.parentNode == this.frame) {
+ this.frame.removeChild(this.imgDiv);
+ this.imgDiv.map = null;
+ }
+ this.imgDiv.urls = null;
- // Bind a listener to the onerror of the image div so that we
- // can registere when a tile has finished loading with errors.
- var onerror = function() {
-
- // If we have gone through all image reload attempts, it is time
- // to realize that we are done with this image. Since
- // OpenLayers.Util.onImageLoadError already has taken care about
- // the error, we can continue as if the image was loaded
- // successfully.
- if (this.imgDiv._attempts > OpenLayers.IMAGE_RELOAD_ATTEMPTS) {
- onload.call(this);
- }
- };
- OpenLayers.Event.observe(this.imgDiv, "error",
- OpenLayers.Function.bind(onerror, this));
+ var child = this.imgDiv.firstChild;
+ //check for children (alphaHack img or IFrame)
+ if (child) {
+ OpenLayers.Event.stopObservingElement(child);
+ this.imgDiv.removeChild(child);
+ delete child;
+ } else {
+ // abort any currently loading image
+ this.imgDiv.src = OpenLayers.Util.getImagesLocation() + "blank.gif";
+ }
},
/**
@@ -20324,6 +20918,378 @@
});
/* ======================================================================
+ OpenLayers/Format/WFST/v1.js
+ ====================================================================== */
+
+/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). 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/Format/WFST.js
+ */
+
+/**
+ * Class: OpenLayers.Format.WFST.v1
+ * Superclass for WFST parsers.
+ *
+ * Inherits from:
+ * - <OpenLayers.Format.XML>
+ */
+OpenLayers.Format.WFST.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
+
+ /**
+ * Property: namespaces
+ * {Object} Mapping of namespace aliases to namespace URIs.
+ */
+ namespaces: {
+ xlink: "http://www.w3.org/1999/xlink",
+ xsi: "http://www.w3.org/2001/XMLSchema-instance",
+ wfs: "http://www.opengis.net/wfs",
+ gml: "http://www.opengis.net/gml",
+ ogc: "http://www.opengis.net/ogc"
+ },
+
+ /**
+ * Property: defaultPrefix
+ */
+ defaultPrefix: "wfs",
+
+ /**
+ * Property: version
+ * {String} WFS version number.
+ */
+ version: null,
+
+ /**
+ * Property: schemaLocation
+ * {String} Schema location for a particular minor version.
+ */
+ schemaLocations: null,
+
+ /**
+ * APIProperty: srsName
+ * {String} URI for spatial reference system.
+ */
+ srsName: null,
+
+ /**
+ * APIProperty: extractAttributes
+ * {Boolean} Extract attributes from GML. Default is true.
+ */
+ 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,
+
+ /**
+ * Property: stateName
+ * {Object} Maps feature states to node names.
+ */
+ stateName: null,
+
+ /**
+ * Constructor: OpenLayers.Format.WFST.v1
+ * Instances of this class are not created directly. Use the
+ * <OpenLayers.Format.WFST.v1_0_0> or <OpenLayers.Format.WFST.v1_1_0>
+ * constructor instead.
+ *
+ * Parameters:
+ * options - {Object} An optional object whose properties will be set on
+ * this instance.
+ */
+ initialize: function(options) {
+ // set state name mapping
+ this.stateName = {};
+ this.stateName[OpenLayers.State.INSERT] = "wfs:Insert";
+ this.stateName[OpenLayers.State.UPDATE] = "wfs:Update";
+ this.stateName[OpenLayers.State.DELETE] = "wfs:Delete";
+ OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
+ },
+
+ /**
+ * Method: getSrsName
+ */
+ getSrsName: function(feature, options) {
+ var srsName = options && options.srsName;
+ if(!srsName) {
+ if(feature && feature.layer) {
+ srsName = feature.layer.projection.getCode();
+ } else {
+ srsName = this.srsName;
+ }
+ }
+ return srsName;
+ },
+
+ /**
+ * APIMethod: read
+ * Parse the response from a transaction. Because WFS is split into
+ * Transaction requests (create, update, and delete) and GetFeature
+ * requests (read), this method handles parsing of both types of
+ * responses.
+ *
+ * Parameters:
+ * data - {String | Document} The WFST document to read
+ * options - {Object} Options for the reader
+ *
+ * Valid options properties:
+ * output - {String} either "features" or "object". The default is
+ * "features", which means that the method will return an array of
+ * features. If set to "object", an object with a "features" property
+ * and other properties read by the parser will be returned.
+ *
+ * Returns:
+ * {Array | Object} Output depending on the output option.
+ */
+ read: function(data, options) {
+ options = options || {};
+ OpenLayers.Util.applyDefaults(options, {
+ output: "features"
+ });
+
+ if(typeof data == "string") {
+ data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
+ }
+ if(data && data.nodeType == 9) {
+ data = data.documentElement;
+ }
+ var obj = {};
+ if(data) {
+ this.readNode(data, obj);
+ }
+ if(obj.features && options.output === "features") {
+ obj = obj.features;
+ }
+ return obj;
+ },
+
+ /**
+ * 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: {
+ "wfs": {
+ "FeatureCollection": function(node, obj) {
+ obj.features = [];
+ this.readChildNodes(node, obj);
+ }
+ }
+ },
+
+ /**
+ * Method: write
+ * Given an array of features, write a WFS transaction. This assumes
+ * the features have a state property that determines the operation
+ * type - insert, update, or delete.
+ *
+ * Parameters:
+ * features - {Array(<OpenLayers.Feature.Vector>)} A list of features.
+ *
+ * Returns:
+ * {String} A serialized WFS transaction.
+ */
+ write: function(features) {
+ var node = this.writeNode("wfs:Transaction", features);
+ var value = this.schemaLocationAttr();
+ if(value) {
+ this.setAttributeNS(
+ node, this.namespaces["xsi"], "xsi:schemaLocation", value
+ )
+ }
+ return OpenLayers.Format.XML.prototype.write.apply(this, [node]);
+ },
+
+ /**
+ * 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: {
+ "wfs": {
+ "GetFeature": function(options) {
+ var node = this.createElementNSPlus("wfs:GetFeature", {
+ attributes: {
+ service: "WFS",
+ version: this.version,
+ outputFormat: options && options.outputFormat,
+ maxFeatures: options && options.maxFeatures,
+ "xsi:schemaLocation": this.schemaLocationAttr(options)
+ }
+ });
+ if (typeof this.featureType == "string") {
+ this.writeNode("Query", options, node);
+ } else {
+ for (var i=0,len = this.featureType.length; i<len; i++) {
+ options.featureType = this.featureType[i];
+ this.writeNode("Query", options, node);
+ }
+ }
+ return node;
+ },
+ "Transaction": function(features) {
+ var node = this.createElementNSPlus("wfs:Transaction", {
+ attributes: {
+ service: "WFS",
+ version: this.version
+ }
+ });
+ if(features) {
+ var name, feature;
+ for(var i=0, len=features.length; i<len; ++i) {
+ feature = features[i];
+ name = this.stateName[feature.state];
+ if(name) {
+ this.writeNode(name, feature, node);
+ }
+ }
+ }
+ return node;
+ },
+ "Insert": function(feature) {
+ var node = this.createElementNSPlus("wfs:Insert");
+ this.srsName = this.getSrsName(feature);
+ this.writeNode("feature:_typeName", feature, node);
+ return node;
+ },
+ "Update": function(feature) {
+ var node = this.createElementNSPlus("wfs:Update", {
+ attributes: {
+ typeName: (this.featureNS ? this.featurePrefix + ":" : "") +
+ this.featureType
+ }
+ });
+ if(this.featureNS) {
+ node.setAttribute("xmlns:" + this.featurePrefix, this.featureNS);
+ }
+
+ // add in geometry
+ if (this.geometryName !== null) {
+ this.writeNode(
+ "Property", {name: this.geometryName, value: feature}, node
+ );
+ }
+
+ // add in attributes
+ for(var key in feature.attributes) {
+ if(feature.attributes[key] !== undefined) {
+ this.writeNode(
+ "Property", {name: key, value: feature.attributes[key]}, node
+ );
+ }
+ }
+
+ // add feature id filter
+ this.writeNode("ogc:Filter", new OpenLayers.Filter.FeatureId({
+ fids: [feature.fid]
+ }), node);
+
+ return node;
+ },
+ "Property": function(obj) {
+ var node = this.createElementNSPlus("wfs:Property");
+ this.writeNode("Name", obj.name, node);
+ if(obj.value !== null) {
+ this.writeNode("Value", obj.value, node);
+ }
+ return node;
+ },
+ "Name": function(name) {
+ return this.createElementNSPlus("wfs:Name", {value: name});
+ },
+ "Value": function(obj) {
+ var node;
+ if(obj instanceof OpenLayers.Feature.Vector) {
+ node = this.createElementNSPlus("wfs:Value");
+ this.srsName = this.getSrsName(obj);
+ var geom = this.writeNode("feature:_geometry", obj.geometry).firstChild;
+ node.appendChild(geom);
+ } else {
+ node = this.createElementNSPlus("wfs:Value", {value: obj});
+ }
+ return node;
+ },
+ "Delete": function(feature) {
+ var node = this.createElementNSPlus("wfs:Delete", {
+ attributes: {
+ typeName: (this.featureNS ? this.featurePrefix + ":" : "") +
+ this.featureType
+ }
+ });
+ if(this.featureNS) {
+ node.setAttribute("xmlns:" + this.featurePrefix, this.featureNS);
+ }
+ this.writeNode("ogc:Filter", new OpenLayers.Filter.FeatureId({
+ fids: [feature.fid]
+ }), node);
+ return node;
+ }
+ }
+ },
+
+ /**
+ * Method: schemaLocationAttr
+ * Generate the xsi:schemaLocation attribute value.
+ *
+ * Returns:
+ * {String} The xsi:schemaLocation attribute or undefined if none.
+ */
+ schemaLocationAttr: function(options) {
+ options = OpenLayers.Util.extend({
+ featurePrefix: this.featurePrefix,
+ schema: this.schema
+ }, options);
+ var schemaLocations = OpenLayers.Util.extend({}, this.schemaLocations);
+ if(options.schema) {
+ schemaLocations[options.featurePrefix] = options.schema;
+ }
+ var parts = [];
+ var uri;
+ for(var key in schemaLocations) {
+ uri = this.namespaces[key];
+ if(uri) {
+ parts.push(uri + " " + schemaLocations[key]);
+ }
+ }
+ var value = parts.join(" ") || undefined;
+ return value;
+ },
+
+ /**
+ * Method: setFilterProperty
+ * Set the property of each spatial filter.
+ *
+ * Parameters:
+ * filter - {<OpenLayers.Filter>}
+ */
+ setFilterProperty: function(filter) {
+ if(filter.filters) {
+ for(var i=0, len=filter.filters.length; i<len; ++i) {
+ this.setFilterProperty(filter.filters[i]);
+ }
+ } else {
+ if(filter instanceof OpenLayers.Filter.Spatial) {
+ // got a spatial filter, set its property
+ filter.property = this.geometryName;
+ }
+ }
+ },
+
+ CLASS_NAME: "OpenLayers.Format.WFST.v1"
+
+});
+/* ======================================================================
OpenLayers/Handler/Click.js
====================================================================== */
@@ -22652,7 +23618,9 @@
/**
* APIMethod: display
- * Hide or show the Layer
+ * Hide or show the Layer. This is designed to be used internally, and
+ * is not generally the way to enable or disable the layer. For that,
+ * use the setVisibility function instead..
*
* Parameters:
* display - {Boolean}
@@ -23337,7 +24305,7 @@
* sz - {<OpenLayers.Size>}
*
* Returns:
- * {DOMElement} A new DOM Image with this marker´s icon set at the
+ * {DOMElement} A new DOM Image with this marker´s icon set at the
* location passed-in
*/
draw: function(px, sz) {
@@ -27375,7 +28343,7 @@
* {Number} Timeout id of trigger for measurepartial.
*/
delayedTrigger: null,
-
+
/**
* APIProperty: persist
* {Boolean} Keep the temporary measurement sketch drawn after the
@@ -27413,11 +28381,20 @@
},
/**
+ * APIMethod: deactivate
+ */
+ deactivate: function() {
+ this.cancelDelay();
+ return OpenLayers.Control.prototype.deactivate.apply(this, arguments);
+ },
+
+ /**
* APIMethod: cancel
* Stop the control from measuring. If <persist> is true, the temporary
* sketch will be erased.
*/
cancel: function() {
+ this.cancelDelay();
this.handler.cancel();
},
@@ -27447,9 +28424,7 @@
* geometry - {<OpenLayers.Geometry>}
*/
measureComplete: function(geometry) {
- if(this.delayedTrigger) {
- window.clearTimeout(this.delayedTrigger);
- }
+ this.cancelDelay();
this.measure(geometry, "measure");
},
@@ -27462,10 +28437,17 @@
* geometry - {<OpenLayers.Geometry>} The sketch geometry.
*/
measurePartial: function(point, geometry) {
- if (geometry.getLength() > 0) {
- geometry = geometry.clone();
+ this.cancelDelay();
+ geometry = geometry.clone();
+ // when we're wating for a dblclick, we have to trigger measurepartial
+ // after some delay to deal with reflow issues in IE
+ if (this.handler.freehandMode(this.handler.evt)) {
+ // no dblclick in freehand mode
+ this.measure(geometry, "measurepartial");
+ } else {
this.delayedTrigger = window.setTimeout(
OpenLayers.Function.bind(function() {
+ this.delayedTrigger = null;
this.measure(geometry, "measurepartial");
}, this),
this.partialDelay
@@ -27474,6 +28456,17 @@
},
/**
+ * Method: cancelDelay
+ * Cancels the delay measurement that measurePartial began.
+ */
+ cancelDelay: function() {
+ if (this.delayedTrigger !== null) {
+ window.clearTimeout(this.delayedTrigger);
+ this.delayedTrigger = null;
+ }
+ },
+
+ /**
* Method: measure
*
* Parameters:
@@ -29093,6 +30086,12 @@
*/
tileSize: null,
+ /** APIProperty: tileOptions
+ * {Object} optional configuration options for <OpenLayers.Tile> instances
+ * created by this Layer, if supported by the tile class.
+ */
+ tileOptions: null,
+
/**
* Property: grid
* {Array(Array(<OpenLayers.Tile>))} This is an array of rows, each row is
@@ -31404,7 +32403,7 @@
/**
* Constructor: OpenLayers.Filter
- * This is an abstract class. Create an instance of a filter subclass.
+ * This class represents a generic filter.
*
* Parameters:
* options - {Object} Optional object whose properties will be set on the
@@ -31426,8 +32425,8 @@
/**
* APIMethod: evaluate
- * Evaluates this filter in a specific context. Should be implemented by
- * subclasses.
+ * Evaluates this filter in a specific context. Instances or subclasses
+ * are supposed to override this method.
*
* Parameters:
* context - {Object} Context to use in evaluating the filter. If a vector
@@ -32830,7 +33829,7 @@
*/
addTile:function(bounds,position) {
return new OpenLayers.Tile.Image(this, position, bounds,
- null, this.tileSize);
+ null, this.tileSize, this.tileOptions);
},
/**
@@ -33752,6 +34751,91 @@
OpenLayers.Filter.Comparison.BETWEEN = "..";
OpenLayers.Filter.Comparison.LIKE = "~";
/* ======================================================================
+ OpenLayers/Filter/FeatureId.js
+ ====================================================================== */
+
+/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). 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>
+ */
+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:
+ * {<OpenLayers.Filter.FeatureId>}
+ */
+ initialize: function(options) {
+ this.fids = [];
+ OpenLayers.Filter.prototype.initialize.apply(this, [options]);
+ },
+
+ /**
+ * APIMethod: evaluate
+ * evaluates this rule for a specific feature
+ *
+ * Parameters:
+ * feature - {<OpenLayers.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<len; i++) {
+ var fid = feature.fid || feature.id;
+ if (fid == this.fids[i]) {
+ return true;
+ }
+ }
+ return false;
+ },
+
+ /**
+ * APIMethod: clone
+ * Clones this filter.
+ *
+ * Returns:
+ * {<OpenLayers.Filter.FeatureId>} 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"
+});
+/* ======================================================================
OpenLayers/Filter/Logical.js
====================================================================== */
@@ -34972,12 +36056,6 @@
isFixed: false,
/**
- * APIProperty: isVector
- * {Boolean} Whether the layer is a vector layer.
- */
- isVector: true,
-
- /**
* APIProperty: features
* {Array(<OpenLayers.Feature.Vector>)}
*/
@@ -35795,6 +36873,125 @@
CLASS_NAME: "OpenLayers.Layer.Vector"
});
/* ======================================================================
+ OpenLayers/Format/Filter.js
+ ====================================================================== */
+
+/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). 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/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 <OpenLayers.Format.Filter>
+ * constructor.
+ *
+ * Inherits from:
+ * - <OpenLayers.Format.XML>
+ */
+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 - {<OpenLayers.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:
+ * {<OpenLayers.Filter>} 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"
+});
+/* ======================================================================
OpenLayers/Geometry/MultiPoint.js
====================================================================== */
@@ -36905,6 +38102,436 @@
})();
/* ======================================================================
+ OpenLayers/Format/Filter/v1.js
+ ====================================================================== */
+
+/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). 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.XML>
+ */
+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
+ * <OpenLayers.Format.Filter> 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:
+ * {<OpenLayers.Filter>} 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);
+ },
+ "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 {<OpenLayers.Filter.Spatial>} 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:
+ * {<OpenLayers.Filter.Spatial>} 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 === undefined) {
+ value = this.getChildValue(node);
+ }
+ return value;
+ },
+
+ /**
+ * Method: write
+ *
+ * Parameters:
+ * filter - {<OpenLayers.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<filter.fids.length; ++i) {
+ this.writeNode("FeatureId", filter.fids[i], node);
+ }
+ } else {
+ this.writeNode(this.getFilterType(filter), filter, node);
+ }
+ return node;
+ },
+ "FeatureId": function(fid) {
+ return this.createElementNSPlus("ogc:FeatureId", {
+ attributes: {fid: fid}
+ });
+ },
+ "And": function(filter) {
+ var node = this.createElementNSPlus("ogc:And");
+ var childFilter;
+ for(var i=0; i<filter.filters.length; ++i) {
+ childFilter = filter.filters[i];
+ this.writeNode(
+ this.getFilterType(childFilter), childFilter, node
+ );
+ }
+ return node;
+ },
+ "Or": function(filter) {
+ var node = this.createElementNSPlus("ogc:Or");
+ var childFilter;
+ for(var i=0; i<filter.filters.length; ++i) {
+ childFilter = filter.filters[i];
+ this.writeNode(
+ this.getFilterType(childFilter), childFilter, node
+ );
+ }
+ return node;
+ },
+ "Not": function(filter) {
+ var node = this.createElementNSPlus("ogc:Not");
+ var childFilter = filter.filters[0];
+ this.writeNode(
+ this.getFilterType(childFilter), childFilter, node
+ );
+ return node;
+ },
+ "PropertyIsLessThan": function(filter) {
+ var node = this.createElementNSPlus("ogc:PropertyIsLessThan");
+ // no ogc:expression handling for now
+ this.writeNode("PropertyName", filter, node);
+ this.writeNode("Literal", filter.value, node);
+ return node;
+ },
+ "PropertyIsGreaterThan": function(filter) {
+ var node = this.createElementNSPlus("ogc:PropertyIsGreaterThan");
+ // no ogc:expression handling for now
+ this.writeNode("PropertyName", filter, node);
+ this.writeNode("Literal", filter.value, node);
+ return node;
+ },
+ "PropertyIsLessThanOrEqualTo": function(filter) {
+ var node = this.createElementNSPlus("ogc:PropertyIsLessThanOrEqualTo");
+ // no ogc:expression handling for now
+ this.writeNode("PropertyName", filter, node);
+ this.writeNode("Literal", filter.value, node);
+ return node;
+ },
+ "PropertyIsGreaterThanOrEqualTo": function(filter) {
+ var node = this.createElementNSPlus("ogc:PropertyIsGreaterThanOrEqualTo");
+ // no ogc:expression handling for now
+ this.writeNode("PropertyName", filter, node);
+ this.writeNode("Literal", filter.value, node);
+ return node;
+ },
+ "PropertyIsBetween": function(filter) {
+ var node = this.createElementNSPlus("ogc:PropertyIsBetween");
+ // no ogc:expression handling for now
+ this.writeNode("PropertyName", filter, node);
+ this.writeNode("LowerBoundary", filter, node);
+ this.writeNode("UpperBoundary", filter, node);
+ return node;
+ },
+ "PropertyName": function(filter) {
+ // no ogc:expression handling for now
+ return this.createElementNSPlus("ogc:PropertyName", {
+ value: filter.property
+ });
+ },
+ "Literal": function(value) {
+ // no ogc:expression handling for now
+ return this.createElementNSPlus("ogc:Literal", {
+ value: value
+ });
+ },
+ "LowerBoundary": function(filter) {
+ // no ogc:expression handling for now
+ var node = this.createElementNSPlus("ogc:LowerBoundary");
+ this.writeNode("Literal", filter.lowerBoundary, node);
+ return node;
+ },
+ "UpperBoundary": function(filter) {
+ // no ogc:expression handling for now
+ var node = this.createElementNSPlus("ogc:UpperBoundary");
+ this.writeNode("Literal", filter.upperBoundary, node);
+ return node;
+ },
+ "INTERSECTS": function(filter) {
+ return this.writeSpatial(filter, "Intersects");
+ },
+ "WITHIN": function(filter) {
+ return this.writeSpatial(filter, "Within");
+ },
+ "CONTAINS": function(filter) {
+ return this.writeSpatial(filter, "Contains");
+ },
+ "DWITHIN": function(filter) {
+ var node = this.writeSpatial(filter, "DWithin");
+ this.writeNode("Distance", filter, node);
+ return node;
+ },
+ "Distance": function(filter) {
+ return this.createElementNSPlus("ogc:Distance", {
+ attributes: {
+ units: filter.distanceUnits
+ },
+ value: filter.distance
+ });
+ }
+ }
+ },
+
+ /**
+ * Method: getFilterType
+ */
+ getFilterType: function(filter) {
+ var filterType = this.filterMap[filter.type];
+ if(!filterType) {
+ throw "Filter writing not supported for rule type: " + filter.type;
+ }
+ return filterType;
+ },
+
+ /**
+ * Property: filterMap
+ * {Object} Contains a member for each filter type. Values are node names
+ * for corresponding OGC Filter child elements.
+ */
+ filterMap: {
+ "&&": "And",
+ "||": "Or",
+ "!": "Not",
+ "==": "PropertyIsEqualTo",
+ "!=": "PropertyIsNotEqualTo",
+ "<": "PropertyIsLessThan",
+ ">": "PropertyIsGreaterThan",
+ "<=": "PropertyIsLessThanOrEqualTo",
+ ">=": "PropertyIsGreaterThanOrEqualTo",
+ "..": "PropertyIsBetween",
+ "~": "PropertyIsLike",
+ "BBOX": "BBOX",
+ "DWITHIN": "DWITHIN",
+ "WITHIN": "WITHIN",
+ "CONTAINS": "CONTAINS",
+ "INTERSECTS": "INTERSECTS"
+ },
+
+ CLASS_NAME: "OpenLayers.Format.Filter.v1"
+
+});
+/* ======================================================================
OpenLayers/Geometry/Curve.js
====================================================================== */
@@ -38526,11 +40153,21 @@
}
return true;
},
+
+ /**
+ * APIMethod: finishGeometry
+ * Finish the geometry and send it back to the control.
+ */
+ finishGeometry: function() {
+ var index = this.line.geometry.components.length - 1;
+ this.line.geometry.removeComponent(this.line.geometry.components[index]);
+ this.removePoint();
+ this.finalize();
+ },
/**
* Method: dblclick
- * Handle double-clicks. Finish the geometry and send it back
- * to the control.
+ * Handle double-clicks.
*
* Parameters:
* evt - {Event} The browser event
@@ -38540,10 +40177,7 @@
*/
dblclick: function(evt) {
if(!this.freehandMode(evt)) {
- var index = this.line.geometry.components.length - 1;
- this.line.geometry.removeComponent(this.line.geometry.components[index]);
- this.removePoint();
- this.finalize();
+ this.finishGeometry();
}
return false;
},
@@ -38889,7 +40523,21 @@
*/
OpenLayers.Handler.Polygon = OpenLayers.Class(OpenLayers.Handler.Path, {
+ /**
+ * APIProperty: holeModifier
+ * {String} Key modifier to trigger hole digitizing. Acceptable values are
+ * "altKey", "shiftKey", or "ctrlKey". If not set, no hole digitizing
+ * will take place. Default is null.
+ */
+ holeModifier: null,
+
/**
+ * Property: drawingHole
+ * {Boolean} Currently drawing an interior ring.
+ */
+ drawingHole: false,
+
+ /**
* Parameter: polygon
* {<OpenLayers.Feature.Vector>}
*/
@@ -38937,15 +40585,152 @@
this.line = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.LinearRing([this.point.geometry])
);
- this.polygon = new OpenLayers.Feature.Vector(
- new OpenLayers.Geometry.Polygon([this.line.geometry])
- );
+
+ // check for hole digitizing
+ var polygon;
+ if (this.holeModifier && (this.evt[this.holeModifier])) {
+ var geometry = this.point.geometry;
+ var features = this.control.layer.features;
+ var candidate;
+ // look for intersections, last drawn gets priority
+ for (var i=features.length-1; i>=0; --i) {
+ candidate = features[i].geometry;
+ if ((candidate instanceof OpenLayers.Geometry.Polygon ||
+ candidate instanceof OpenLayers.Geometry.MultiPolygon) &&
+ candidate.intersects(geometry)) {
+ polygon = features[i];
+ this.control.layer.removeFeatures([polygon], {silent: true});
+ this.control.layer.events.registerPriority(
+ "sketchcomplete", this, this.finalizeInteriorRing
+ );
+ this.control.layer.events.registerPriority(
+ "sketchmodified", this, this.enforceTopology
+ );
+ polygon.geometry.addComponent(this.line.geometry);
+ this.polygon = polygon;
+ this.drawingHole = true;
+ break;
+ }
+ }
+ }
+ if (!polygon) {
+ this.polygon = new OpenLayers.Feature.Vector(
+ new OpenLayers.Geometry.Polygon([this.line.geometry])
+ );
+ }
+
this.callback("create", [this.point.geometry, this.getSketch()]);
this.point.geometry.clearBounds();
this.layer.addFeatures([this.polygon, this.point], {silent: true});
},
+
+ /**
+ * Method: enforceTopology
+ * Simple topology enforcement for drawing interior rings. Ensures vertices
+ * of interior rings are contained by exterior ring. Other topology
+ * rules are enforced in <finalizeInteriorRing> to allow drawing of
+ * rings that intersect only during the sketch (e.g. a "C" shaped ring
+ * that nearly encloses another ring).
+ */
+ enforceTopology: function(event) {
+ var point = event.vertex;
+ var components = this.line.geometry.components;
+ // ensure that vertices of interior ring are contained by exterior ring
+ if (!this.polygon.geometry.intersects(point)) {
+ var last = components[components.length-3];
+ point.x = last.x;
+ point.y = last.y;
+ }
+ },
+
+ /**
+ * Method: finalizeInteriorRing
+ * Enforces that new ring has some area and doesn't contain vertices of any
+ * other rings.
+ */
+ finalizeInteriorRing: function() {
+ var ring = this.line.geometry;
+ // ensure that ring has some area
+ var modified = (ring.getArea() !== 0);
+ if (modified) {
+ // ensure that new ring doesn't intersect any other rings
+ var rings = this.polygon.geometry.components;
+ for (var i=rings.length-2; i>=0; --i) {
+ if (ring.intersects(rings[i])) {
+ modified = false;
+ break;
+ }
+ }
+ if (modified) {
+ // ensure that new ring doesn't contain any other rings
+ var target;
+ outer: for (var i=rings.length-2; i>0; --i) {
+ points = rings[i].components;
+ for (var j=0, jj=points.length; j<jj; ++j) {
+ if (ring.containsPoint(points[j])) {
+ modified = false;
+ break outer;
+ }
+ }
+ }
+ }
+ }
+ if (modified) {
+ if (this.polygon.state !== OpenLayers.State.INSERT) {
+ this.polygon.state = OpenLayers.State.UPDATE;
+ }
+ } else {
+ this.polygon.geometry.removeComponent(ring);
+ }
+ this.restoreFeature();
+ return false;
+ },
/**
+ * APIMethod: cancel
+ * Finish the geometry and call the "cancel" callback.
+ */
+ cancel: function() {
+ if (this.drawingHole) {
+ this.polygon.geometry.removeComponent(this.line.geometry);
+ this.restoreFeature(true);
+ }
+ return OpenLayers.Handler.Path.prototype.cancel.apply(this, arguments);
+ },
+
+ /**
+ * Method: restoreFeature
+ * Move the feature from the sketch layer to the target layer.
+ *
+ * Properties:
+ * cancel - {Boolean} Cancel drawing. If falsey, the "sketchcomplete" event
+ * will be fired.
+ */
+ restoreFeature: function(cancel) {
+ this.control.layer.events.unregister(
+ "sketchcomplete", this, this.finalizeInteriorRing
+ );
+ this.control.layer.events.unregister(
+ "sketchmodified", this, this.enforceTopology
+ );
+ this.layer.removeFeatures([this.polygon], {silent: true});
+ this.control.layer.addFeatures([this.polygon], {silent: true});
+ this.drawingHole = false;
+ if (!cancel) {
+ // Re-trigger "sketchcomplete" so other listeners can do their
+ // business. While this is somewhat sloppy (if a listener is
+ // registered with registerPriority - not common - between the start
+ // and end of a single ring drawing - very uncommon - it will be
+ // called twice).
+ // TODO: In 3.0, collapse sketch handlers into geometry specific
+ // drawing controls.
+ this.control.layer.events.triggerEvent(
+ "sketchcomplete", {feature : this.polygon}
+ );
+ }
+ },
+
+ /**
* Method: destroyFeature
* Destroy temporary geometries
*/
@@ -41184,3 +42969,781 @@
CLASS_NAME: "OpenLayers.Format.GML.v3"
});
+/* ======================================================================
+ OpenLayers/Format/Filter/v1_0_0.js
+ ====================================================================== */
+
+/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). 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.GML.v2>
+ * - <OpenLayers.Format.Filter.v1>
+ */
+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
+ * <OpenLayers.Format.Filter> 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);
+ },
+ "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);
+ }
+ }, 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;
+ },
+ "PropertyIsLike": function(filter) {
+ var node = this.createElementNSPlus("ogc:PropertyIsLike", {
+ attributes: {
+ wildCard: "*", singleChar: ".", escape: "!"
+ }
+ });
+ // no ogc:expression handling for now
+ this.writeNode("PropertyName", filter, node);
+ // convert regex string to ogc string
+ this.writeNode("Literal", filter.regex2value(), 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 {<OpenLayers.Filter.Spatial>} filter and converts it into XML.
+ *
+ * Parameters:
+ * filter - {<OpenLayers.Filter.Spatial>} 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"
+
+});
+/* ======================================================================
+ OpenLayers/Format/Filter/v1_1_0.js
+ ====================================================================== */
+
+/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). 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>
+ */
+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
+ * <OpenLayers.Format.Filter> 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);
+ },
+ "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("escapeChar");
+ filter.value2regex(wildCard, singleChar, esc);
+ 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;
+ },
+ "PropertyIsLike": function(filter) {
+ var node = this.createElementNSPlus("ogc:PropertyIsLike", {
+ attributes: {
+ wildCard: "*", singleChar: ".", escapeChar: "!"
+ }
+ });
+ // no ogc:expression handling for now
+ this.writeNode("PropertyName", filter, node);
+ // convert regex string to ogc string
+ this.writeNode("Literal", filter.regex2value(), 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 {<OpenLayers.Filter.Spatial>} filter and converts it into XML.
+ *
+ * Parameters:
+ * filter - {<OpenLayers.Filter.Spatial>} 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"
+
+});
+/* ======================================================================
+ OpenLayers/Format/WFST/v1_0_0.js
+ ====================================================================== */
+
+/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). 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/WFST/v1.js
+ * @requires OpenLayers/Format/Filter/v1_0_0.js
+ */
+
+/**
+ * Class: OpenLayers.Format.WFST.v1_0_0
+ * A format for creating WFS v1.0.0 transactions. Create a new instance with the
+ * <OpenLayers.Format.WFST.v1_0_0> constructor.
+ *
+ * Inherits from:
+ * - <OpenLayers.Format.Filter.v1_0_0>
+ * - <OpenLayers.Format.WFST.v1>
+ */
+OpenLayers.Format.WFST.v1_0_0 = OpenLayers.Class(
+ OpenLayers.Format.Filter.v1_0_0, OpenLayers.Format.WFST.v1, {
+
+ /**
+ * Property: version
+ * {String} WFS version number.
+ */
+ version: "1.0.0",
+
+ /**
+ * APIProperty: srsNameInQuery
+ * {Boolean} If true the reference system is passed in Query requests
+ * via the "srsName" attribute to the "wfs:Query" element, this
+ * property defaults to false as it isn't WFS 1.0.0 compliant.
+ */
+ srsNameInQuery: false,
+
+ /**
+ * Property: schemaLocations
+ * {Object} Properties are namespace aliases, values are schema locations.
+ */
+ schemaLocations: {
+ "wfs": "http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd"
+ },
+
+ /**
+ * Constructor: OpenLayers.Format.WFST.v1_0_0
+ * A class for parsing and generating WFS v1.0.0 transactions.
+ *
+ * Parameters:
+ * options - {Object} Optional object whose properties will be set on the
+ * instance.
+ *
+ * Valid options properties:
+ * featureType - {String} Local (without prefix) feature typeName (required).
+ * featureNS - {String} Feature namespace (optional).
+ * featurePrefix - {String} Feature namespace alias (optional - only used
+ * if featureNS is provided). Default is 'feature'.
+ * geometryName - {String} Name of geometry attribute. Default is 'the_geom'.
+ */
+ initialize: function(options) {
+ OpenLayers.Format.Filter.v1_0_0.prototype.initialize.apply(this, [options]);
+ OpenLayers.Format.WFST.v1.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: {
+ "wfs": OpenLayers.Util.applyDefaults({
+ "WFS_TransactionResponse": function(node, obj) {
+ obj.insertIds = [];
+ obj.success = false;
+ this.readChildNodes(node, obj);
+ },
+ "InsertResult": function(node, container) {
+ var obj = {fids: []};
+ this.readChildNodes(node, obj);
+ container.insertIds.push(obj.fids[0]);
+ },
+ "TransactionResult": function(node, obj) {
+ this.readChildNodes(node, obj);
+ },
+ "Status": function(node, obj) {
+ this.readChildNodes(node, obj);
+ },
+ "SUCCESS": function(node, obj) {
+ obj.success = true;
+ }
+ }, OpenLayers.Format.WFST.v1.prototype.readers["wfs"]),
+ "gml": OpenLayers.Format.GML.v2.prototype.readers["gml"],
+ "feature": OpenLayers.Format.GML.v2.prototype.readers["feature"],
+ "ogc": OpenLayers.Format.Filter.v1_0_0.prototype.readers["ogc"]
+ },
+
+ /**
+ * 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: {
+ "wfs": OpenLayers.Util.applyDefaults({
+ "Query": function(options) {
+ options = OpenLayers.Util.extend({
+ featureNS: this.featureNS,
+ featurePrefix: this.featurePrefix,
+ featureType: this.featureType,
+ srsName: this.srsName,
+ srsNameInQuery: this.srsNameInQuery
+ }, options);
+ var node = this.createElementNSPlus("wfs:Query", {
+ attributes: {
+ typeName: (options.featureNS ? options.featurePrefix + ":" : "") +
+ options.featureType
+ }
+ });
+ if(options.srsNameInQuery && options.srsName) {
+ node.setAttribute("srsName", options.srsName);
+ }
+ if(options.featureNS) {
+ node.setAttribute("xmlns:" + options.featurePrefix, options.featureNS);
+ }
+ if(options.propertyNames) {
+ for(var i=0,len = options.propertyNames.length; i<len; i++) {
+ this.writeNode(
+ "ogc:PropertyName",
+ {property: options.propertyNames[i]},
+ node
+ );
+ }
+ }
+ if(options.filter) {
+ this.setFilterProperty(options.filter);
+ this.writeNode("ogc:Filter", options.filter, node);
+ }
+ return node;
+ }
+ }, OpenLayers.Format.WFST.v1.prototype.writers["wfs"]),
+ "gml": OpenLayers.Format.GML.v2.prototype.writers["gml"],
+ "feature": OpenLayers.Format.GML.v2.prototype.writers["feature"],
+ "ogc": OpenLayers.Format.Filter.v1_0_0.prototype.writers["ogc"]
+ },
+
+ CLASS_NAME: "OpenLayers.Format.WFST.v1_0_0"
+});
+/* ======================================================================
+ OpenLayers/Format/WFST/v1_1_0.js
+ ====================================================================== */
+
+/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). 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/WFST/v1.js
+ * @requires OpenLayers/Format/Filter/v1_1_0.js
+ */
+
+/**
+ * Class: OpenLayers.Format.WFST.v1_1_0
+ * A format for creating WFS v1.1.0 transactions. Create a new instance with the
+ * <OpenLayers.Format.WFST.v1_1_0> constructor.
+ *
+ * Inherits from:
+ * - <OpenLayers.Format.Filter.v1_1_0>
+ * - <OpenLayers.Format.WFST.v1>
+ */
+OpenLayers.Format.WFST.v1_1_0 = OpenLayers.Class(
+ OpenLayers.Format.Filter.v1_1_0, OpenLayers.Format.WFST.v1, {
+
+ /**
+ * Property: version
+ * {String} WFS version number.
+ */
+ version: "1.1.0",
+
+ /**
+ * Property: schemaLocations
+ * {Object} Properties are namespace aliases, values are schema locations.
+ */
+ schemaLocations: {
+ "wfs": "http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"
+ },
+
+ /**
+ * Constructor: OpenLayers.Format.WFST.v1_1_0
+ * A class for parsing and generating WFS v1.1.0 transactions.
+ *
+ * To read additional information like hit count (numberOfFeatures) from
+ * the FeatureCollection, call the <OpenLayers.Format.WFST.v1.read> method
+ * with {output: "object"} as 2nd argument. Note that it is possible to
+ * just request the hit count from a WFS 1.1.0 server with the
+ * resultType="hits" request parameter.
+ *
+ * Parameters:
+ * options - {Object} Optional object whose properties will be set on the
+ * instance.
+ *
+ * Valid options properties:
+ * featureType - {String} Local (without prefix) feature typeName (required).
+ * featureNS - {String} Feature namespace (optional).
+ * featurePrefix - {String} Feature namespace alias (optional - only used
+ * if featureNS is provided). Default is 'feature'.
+ * geometryName - {String} Name of geometry attribute. Default is 'the_geom'.
+ */
+ initialize: function(options) {
+ OpenLayers.Format.Filter.v1_1_0.prototype.initialize.apply(this, [options]);
+ OpenLayers.Format.WFST.v1.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: {
+ "wfs": OpenLayers.Util.applyDefaults({
+ "FeatureCollection": function(node, obj) {
+ obj.numberOfFeatures = parseInt(node.getAttribute(
+ "numberOfFeatures"));
+ OpenLayers.Format.WFST.v1.prototype.readers["wfs"]["FeatureCollection"].apply(
+ this, arguments);
+ },
+ "TransactionResponse": function(node, obj) {
+ obj.insertIds = [];
+ obj.success = false;
+ this.readChildNodes(node, obj);
+ },
+ "TransactionSummary": function(node, obj) {
+ // this is a limited test of success
+ obj.success = true;
+ },
+ "InsertResults": function(node, obj) {
+ this.readChildNodes(node, obj);
+ },
+ "Feature": function(node, container) {
+ var obj = {fids: []};
+ this.readChildNodes(node, obj);
+ container.insertIds.push(obj.fids[0]);
+ }
+ }, OpenLayers.Format.WFST.v1.prototype.readers["wfs"]),
+ "gml": OpenLayers.Format.GML.v3.prototype.readers["gml"],
+ "feature": OpenLayers.Format.GML.v3.prototype.readers["feature"],
+ "ogc": OpenLayers.Format.Filter.v1_1_0.prototype.readers["ogc"]
+ },
+
+ /**
+ * 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: {
+ "wfs": OpenLayers.Util.applyDefaults({
+ "GetFeature": function(options) {
+ var node = OpenLayers.Format.WFST.v1.prototype.writers["wfs"]["GetFeature"].apply(this, arguments);
+ options && options.resultType && this.setAttributes(node, {
+ resultType: options.resultType
+ });
+ return node;
+ },
+ "Query": function(options) {
+ options = OpenLayers.Util.extend({
+ featureNS: this.featureNS,
+ featurePrefix: this.featurePrefix,
+ featureType: this.featureType,
+ srsName: this.srsName
+ }, options);
+ var node = this.createElementNSPlus("wfs:Query", {
+ attributes: {
+ typeName: (options.featureNS ? options.featurePrefix + ":" : "") +
+ options.featureType,
+ srsName: options.srsName
+ }
+ });
+ if(options.featureNS) {
+ node.setAttribute("xmlns:" + options.featurePrefix, options.featureNS);
+ }
+ if(options.propertyNames) {
+ for(var i=0,len = options.propertyNames.length; i<len; i++) {
+ this.writeNode(
+ "wfs:PropertyName",
+ {property: options.propertyNames[i]},
+ node
+ );
+ }
+ }
+ if(options.filter) {
+ this.setFilterProperty(options.filter);
+ this.writeNode("ogc:Filter", options.filter, node);
+ }
+ return node;
+ },
+ "PropertyName": function(obj) {
+ return this.createElementNSPlus("wfs:PropertyName", {
+ value: obj.property
+ });
+ }
+ }, OpenLayers.Format.WFST.v1.prototype.writers["wfs"]),
+ "gml": OpenLayers.Format.GML.v3.prototype.writers["gml"],
+ "feature": OpenLayers.Format.GML.v3.prototype.writers["feature"],
+ "ogc": OpenLayers.Format.Filter.v1_1_0.prototype.writers["ogc"]
+ },
+
+ CLASS_NAME: "OpenLayers.Format.WFST.v1_1_0"
+});
+/* ======================================================================
+ OpenLayers/Protocol/WFS/v1_0_0.js
+ ====================================================================== */
+
+/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the Clear BSD license.
+ * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Protocol/WFS/v1.js
+ * @requires OpenLayers/Format/WFST/v1_0_0.js
+ */
+
+/**
+ * Class: OpenLayers.Protocol.WFS.v1_0_0
+ * A WFS v1.0.0 protocol for vector layers. Create a new instance with the
+ * <OpenLayers.Protocol.WFS.v1_0_0> constructor.
+ *
+ * Inherits from:
+ * - <OpenLayers.Protocol.WFS.v1>
+ */
+OpenLayers.Protocol.WFS.v1_0_0 = OpenLayers.Class(OpenLayers.Protocol.WFS.v1, {
+
+ /**
+ * Property: version
+ * {String} WFS version number.
+ */
+ version: "1.0.0",
+
+ /**
+ * Constructor: OpenLayers.Protocol.WFS.v1_0_0
+ * A class for giving layers WFS v1.0.0 protocol.
+ *
+ * Parameters:
+ * options - {Object} Optional object whose properties will be set on the
+ * instance.
+ *
+ * Valid options properties:
+ * featureType - {String} Local (without prefix) feature typeName (required).
+ * featureNS - {String} Feature namespace (optional).
+ * featurePrefix - {String} Feature namespace alias (optional - only used
+ * if featureNS is provided). Default is 'feature'.
+ * geometryName - {String} Name of geometry attribute. Default is 'the_geom'.
+ */
+
+ CLASS_NAME: "OpenLayers.Protocol.WFS.v1_0_0"
+});
+/* ======================================================================
+ OpenLayers/Protocol/WFS/v1_1_0.js
+ ====================================================================== */
+
+/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the Clear BSD license.
+ * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Protocol/WFS/v1.js
+ * @requires OpenLayers/Format/WFST/v1_1_0.js
+ */
+
+/**
+ * Class: OpenLayers.Protocol.WFS.v1_1_0
+ * A WFS v1.1.0 protocol for vector layers. Create a new instance with the
+ * <OpenLayers.Protocol.WFS.v1_1_0> constructor.
+ *
+ * Differences from the v1.0.0 protocol:
+ * - uses Filter Encoding 1.1.0 instead of 1.0.0
+ * - uses GML 3 instead of 2 if no format is provided
+ *
+ * Inherits from:
+ * - <OpenLayers.Protocol.WFS.v1>
+ */
+OpenLayers.Protocol.WFS.v1_1_0 = OpenLayers.Class(OpenLayers.Protocol.WFS.v1, {
+
+ /**
+ * Property: version
+ * {String} WFS version number.
+ */
+ version: "1.1.0",
+
+ /**
+ * Constructor: OpenLayers.Protocol.WFS.v1_1_0
+ * A class for giving layers WFS v1.1.0 protocol.
+ *
+ * Parameters:
+ * options - {Object} Optional object whose properties will be set on the
+ * instance.
+ *
+ * Valid options properties:
+ * featureType - {String} Local (without prefix) feature typeName (required).
+ * featureNS - {String} Feature namespace (optional).
+ * featurePrefix - {String} Feature namespace alias (optional - only used
+ * if featureNS is provided). Default is 'feature'.
+ * geometryName - {String} Name of geometry attribute. Default is 'the_geom'.
+ */
+
+ CLASS_NAME: "OpenLayers.Protocol.WFS.v1_1_0"
+});
More information about the fusion-commits
mailing list