summaryrefslogtreecommitdiff
path: root/misc/openlayers/lib/OpenLayers/Format/WFSCapabilities
diff options
context:
space:
mode:
Diffstat (limited to 'misc/openlayers/lib/OpenLayers/Format/WFSCapabilities')
-rw-r--r--misc/openlayers/lib/OpenLayers/Format/WFSCapabilities/v1.js129
-rw-r--r--misc/openlayers/lib/OpenLayers/Format/WFSCapabilities/v1_0_0.js115
-rw-r--r--misc/openlayers/lib/OpenLayers/Format/WFSCapabilities/v1_1_0.js63
3 files changed, 307 insertions, 0 deletions
diff --git a/misc/openlayers/lib/OpenLayers/Format/WFSCapabilities/v1.js b/misc/openlayers/lib/OpenLayers/Format/WFSCapabilities/v1.js
new file mode 100644
index 0000000..c4ec517
--- /dev/null
+++ b/misc/openlayers/lib/OpenLayers/Format/WFSCapabilities/v1.js
@@ -0,0 +1,129 @@
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Format/WFSCapabilities.js
+ */
+
+/**
+ * Class: OpenLayers.Format.WFSCapabilities.v1
+ * Abstract class not to be instantiated directly.
+ *
+ * Inherits from:
+ * - <OpenLayers.Format.XML>
+ */
+OpenLayers.Format.WFSCapabilities.v1 = OpenLayers.Class(
+ OpenLayers.Format.XML, {
+
+ /**
+ * Property: namespaces
+ * {Object} Mapping of namespace aliases to namespace URIs.
+ */
+ namespaces: {
+ wfs: "http://www.opengis.net/wfs",
+ xlink: "http://www.w3.org/1999/xlink",
+ xsi: "http://www.w3.org/2001/XMLSchema-instance",
+ ows: "http://www.opengis.net/ows"
+ },
+
+
+ /**
+ * APIProperty: errorProperty
+ * {String} Which property of the returned object to check for in order to
+ * determine whether or not parsing has failed. In the case that the
+ * errorProperty is undefined on the returned object, the document will be
+ * run through an OGCExceptionReport parser.
+ */
+ errorProperty: "featureTypeList",
+
+ /**
+ * Property: defaultPrefix
+ */
+ defaultPrefix: "wfs",
+
+ /**
+ * Constructor: OpenLayers.Format.WFSCapabilities.v1_1
+ * Create an instance of one of the subclasses.
+ *
+ * Parameters:
+ * options - {Object} An optional object whose properties will be set on
+ * this instance.
+ */
+
+ /**
+ * APIMethod: read
+ * Read capabilities data from a string, and return a list of layers.
+ *
+ * Parameters:
+ * data - {String} or {DOMElement} data to read/parse.
+ *
+ * Returns:
+ * {Array} List of named layers.
+ */
+ read: function(data) {
+ if(typeof data == "string") {
+ data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
+ }
+ var raw = data;
+ if(data && data.nodeType == 9) {
+ data = data.documentElement;
+ }
+ var capabilities = {};
+ this.readNode(data, capabilities);
+ return capabilities;
+ },
+
+ /**
+ * 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": {
+ "WFS_Capabilities": function(node, obj) {
+ this.readChildNodes(node, obj);
+ },
+ "FeatureTypeList": function(node, request) {
+ request.featureTypeList = {
+ featureTypes: []
+ };
+ this.readChildNodes(node, request.featureTypeList);
+ },
+ "FeatureType": function(node, featureTypeList) {
+ var featureType = {};
+ this.readChildNodes(node, featureType);
+ featureTypeList.featureTypes.push(featureType);
+ },
+ "Name": function(node, obj) {
+ var name = this.getChildValue(node);
+ if(name) {
+ var parts = name.split(":");
+ obj.name = parts.pop();
+ if(parts.length > 0) {
+ obj.featureNS = this.lookupNamespaceURI(node, parts[0]);
+ }
+ }
+ },
+ "Title": function(node, obj) {
+ var title = this.getChildValue(node);
+ if(title) {
+ obj.title = title;
+ }
+ },
+ "Abstract": function(node, obj) {
+ var abst = this.getChildValue(node);
+ if(abst) {
+ obj["abstract"] = abst;
+ }
+ }
+ }
+ },
+
+ CLASS_NAME: "OpenLayers.Format.WFSCapabilities.v1"
+
+});
diff --git a/misc/openlayers/lib/OpenLayers/Format/WFSCapabilities/v1_0_0.js b/misc/openlayers/lib/OpenLayers/Format/WFSCapabilities/v1_0_0.js
new file mode 100644
index 0000000..6b202c7
--- /dev/null
+++ b/misc/openlayers/lib/OpenLayers/Format/WFSCapabilities/v1_0_0.js
@@ -0,0 +1,115 @@
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Format/WFSCapabilities/v1.js
+ */
+
+/**
+ * Class: OpenLayers.Format.WFSCapabilities/v1_0_0
+ * Read WFS Capabilities version 1.0.0.
+ *
+ * Inherits from:
+ * - <OpenLayers.Format.WFSCapabilities.v1>
+ */
+OpenLayers.Format.WFSCapabilities.v1_0_0 = OpenLayers.Class(
+ OpenLayers.Format.WFSCapabilities.v1, {
+
+ /**
+ * Constructor: OpenLayers.Format.WFSCapabilities.v1_0_0
+ * Create a new parser for WFS capabilities version 1.0.0.
+ *
+ * Parameters:
+ * options - {Object} An optional object whose properties will be set on
+ * this instance.
+ */
+
+ /**
+ * 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({
+ "Service": function(node, capabilities) {
+ capabilities.service = {};
+ this.readChildNodes(node, capabilities.service);
+ },
+ "Fees": function(node, service) {
+ var fees = this.getChildValue(node);
+ if (fees && fees.toLowerCase() != "none") {
+ service.fees = fees;
+ }
+ },
+ "AccessConstraints": function(node, service) {
+ var constraints = this.getChildValue(node);
+ if (constraints && constraints.toLowerCase() != "none") {
+ service.accessConstraints = constraints;
+ }
+ },
+ "OnlineResource": function(node, service) {
+ var onlineResource = this.getChildValue(node);
+ if (onlineResource && onlineResource.toLowerCase() != "none") {
+ service.onlineResource = onlineResource;
+ }
+ },
+ "Keywords": function(node, service) {
+ var keywords = this.getChildValue(node);
+ if (keywords && keywords.toLowerCase() != "none") {
+ service.keywords = keywords.split(', ');
+ }
+ },
+ "Capability": function(node, capabilities) {
+ capabilities.capability = {};
+ this.readChildNodes(node, capabilities.capability);
+ },
+ "Request": function(node, obj) {
+ obj.request = {};
+ this.readChildNodes(node, obj.request);
+ },
+ "GetFeature": function(node, request) {
+ request.getfeature = {
+ href: {}, // DCPType
+ formats: [] // ResultFormat
+ };
+ this.readChildNodes(node, request.getfeature);
+ },
+ "ResultFormat": function(node, obj) {
+ var children = node.childNodes;
+ var childNode;
+ for(var i=0; i<children.length; i++) {
+ childNode = children[i];
+ if(childNode.nodeType == 1) {
+ obj.formats.push(childNode.nodeName);
+ }
+ }
+ },
+ "DCPType": function(node, obj) {
+ this.readChildNodes(node, obj);
+ },
+ "HTTP": function(node, obj) {
+ this.readChildNodes(node, obj.href);
+ },
+ "Get": function(node, obj) {
+ obj.get = node.getAttribute("onlineResource");
+ },
+ "Post": function(node, obj) {
+ obj.post = node.getAttribute("onlineResource");
+ },
+ "SRS": function(node, obj) {
+ var srs = this.getChildValue(node);
+ if (srs) {
+ obj.srs = srs;
+ }
+ }
+ }, OpenLayers.Format.WFSCapabilities.v1.prototype.readers["wfs"])
+ },
+
+ CLASS_NAME: "OpenLayers.Format.WFSCapabilities.v1_0_0"
+
+});
diff --git a/misc/openlayers/lib/OpenLayers/Format/WFSCapabilities/v1_1_0.js b/misc/openlayers/lib/OpenLayers/Format/WFSCapabilities/v1_1_0.js
new file mode 100644
index 0000000..84f6b4b
--- /dev/null
+++ b/misc/openlayers/lib/OpenLayers/Format/WFSCapabilities/v1_1_0.js
@@ -0,0 +1,63 @@
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Format/WFSCapabilities/v1.js
+ * @requires OpenLayers/Format/OWSCommon/v1.js
+ */
+
+/**
+ * Class: OpenLayers.Format.WFSCapabilities/v1_1_0
+ * Read WFS Capabilities version 1.1.0.
+ *
+ * Inherits from:
+ * - <OpenLayers.Format.WFSCapabilities>
+ */
+OpenLayers.Format.WFSCapabilities.v1_1_0 = OpenLayers.Class(
+ OpenLayers.Format.WFSCapabilities.v1, {
+
+ /**
+ * Property: regExes
+ * Compiled regular expressions for manipulating strings.
+ */
+ regExes: {
+ trimSpace: (/^\s*|\s*$/g),
+ removeSpace: (/\s*/g),
+ splitSpace: (/\s+/),
+ trimComma: (/\s*,\s*/g)
+ },
+
+ /**
+ * Constructor: OpenLayers.Format.WFSCapabilities.v1_1_0
+ * Create a new parser for WFS capabilities version 1.1.0.
+ *
+ * Parameters:
+ * options - {Object} An optional object whose properties will be set on
+ * this instance.
+ */
+
+ /**
+ * 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({
+ "DefaultSRS": function(node, obj) {
+ var defaultSRS = this.getChildValue(node);
+ if (defaultSRS) {
+ obj.srs = defaultSRS;
+ }
+ }
+ }, OpenLayers.Format.WFSCapabilities.v1.prototype.readers["wfs"]),
+ "ows": OpenLayers.Format.OWSCommon.v1.prototype.readers.ows
+ },
+
+ CLASS_NAME: "OpenLayers.Format.WFSCapabilities.v1_1_0"
+
+});