diff options
author | Chris Schlaeger <chris@linux.com> | 2014-08-12 21:56:44 +0200 |
---|---|---|
committer | Chris Schlaeger <chris@linux.com> | 2014-08-12 21:56:44 +0200 |
commit | ea346a785dc1b3f7c156f6fc33da634e1f1a627b (patch) | |
tree | af67530553d20b6e82ad60fd79593e9c4abf5565 /misc/openlayers/lib/OpenLayers/Format/WFST | |
parent | 59741cd535c47f25971bf8c32b25da25ceadc6d5 (diff) | |
download | postrunner-ea346a785dc1b3f7c156f6fc33da634e1f1a627b.zip |
Adding jquery, flot and openlayers to be included with the GEM.v0.0.4
Diffstat (limited to 'misc/openlayers/lib/OpenLayers/Format/WFST')
-rw-r--r-- | misc/openlayers/lib/OpenLayers/Format/WFST/v1.js | 446 | ||||
-rw-r--r-- | misc/openlayers/lib/OpenLayers/Format/WFST/v1_0_0.js | 174 | ||||
-rw-r--r-- | misc/openlayers/lib/OpenLayers/Format/WFST/v1_1_0.js | 189 |
3 files changed, 809 insertions, 0 deletions
diff --git a/misc/openlayers/lib/OpenLayers/Format/WFST/v1.js b/misc/openlayers/lib/OpenLayers/Format/WFST/v1.js new file mode 100644 index 0000000..306ba6f --- /dev/null +++ b/misc/openlayers/lib/OpenLayers/Format/WFST/v1.js @@ -0,0 +1,446 @@ +/* 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/XML.js + * @requires OpenLayers/Format/WFST.js + * @requires OpenLayers/Filter/Spatial.js + * @requires OpenLayers/Filter/FeatureId.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", + ows: "http://www.opengis.net/ows" + }, + + /** + * 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, true); + } + 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. See + * below for a more detailed description of the influence of the + * feature's *modified* property. + * options - {Object} + * + * feature.modified rules: + * If a feature has a modified property set, the following checks will be + * made before a feature's geometry or attribute is included in an Update + * transaction: + * - *modified* is not set at all: The geometry and all attributes will be + * included. + * - *modified.geometry* is set (null or a geometry): The geometry will be + * included. If *modified.attributes* is not set, all attributes will + * be included. + * - *modified.attributes* is set: Only the attributes set (i.e. to null or + * a value) in *modified.attributes* will be included. + * If *modified.geometry* is not set, the geometry will not be included. + * + * Valid options include: + * - *multi* {Boolean} If set to true, geometries will be casted to + * Multi geometries before writing. + * + * Returns: + * {String} A serialized WFS transaction. + */ + write: function(features, options) { + var node = this.writeNode("wfs:Transaction", { + features:features, + options: options + }); + 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, + handle: options && options.handle, + 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(obj) { + obj = obj || {}; + var options = obj.options || {}; + var node = this.createElementNSPlus("wfs:Transaction", { + attributes: { + service: "WFS", + version: this.version, + handle: options.handle + } + }); + var i, len; + var features = obj.features; + if(features) { + // temporarily re-assigning geometry types + if (options.multi === true) { + OpenLayers.Util.extend(this.geometryTypes, { + "OpenLayers.Geometry.Point": "MultiPoint", + "OpenLayers.Geometry.LineString": (this.multiCurve === true) ? "MultiCurve": "MultiLineString", + "OpenLayers.Geometry.Polygon": (this.multiSurface === true) ? "MultiSurface" : "MultiPolygon" + }); + } + var name, feature; + for(i=0, len=features.length; i<len; ++i) { + feature = features[i]; + name = this.stateName[feature.state]; + if(name) { + this.writeNode(name, { + feature: feature, + options: options + }, node); + } + } + // switch back to original geometry types assignment + if (options.multi === true) { + this.setGeometryTypes(); + } + } + if (options.nativeElements) { + for (i=0, len=options.nativeElements.length; i<len; ++i) { + this.writeNode("wfs:Native", + options.nativeElements[i], node); + } + } + return node; + }, + "Native": function(nativeElement) { + var node = this.createElementNSPlus("wfs:Native", { + attributes: { + vendorId: nativeElement.vendorId, + safeToIgnore: nativeElement.safeToIgnore + }, + value: nativeElement.value + }); + return node; + }, + "Insert": function(obj) { + var feature = obj.feature; + var options = obj.options; + var node = this.createElementNSPlus("wfs:Insert", { + attributes: { + handle: options && options.handle + } + }); + this.srsName = this.getSrsName(feature); + this.writeNode("feature:_typeName", feature, node); + return node; + }, + "Update": function(obj) { + var feature = obj.feature; + var options = obj.options; + var node = this.createElementNSPlus("wfs:Update", { + attributes: { + handle: options && options.handle, + typeName: (this.featureNS ? this.featurePrefix + ":" : "") + + this.featureType + } + }); + if(this.featureNS) { + node.setAttribute("xmlns:" + this.featurePrefix, this.featureNS); + } + + // add in geometry + var modified = feature.modified; + if (this.geometryName !== null && (!modified || modified.geometry !== undefined)) { + this.srsName = this.getSrsName(feature); + this.writeNode( + "Property", {name: this.geometryName, value: feature.geometry}, node + ); + } + + // add in attributes + for(var key in feature.attributes) { + if(feature.attributes[key] !== undefined && + (!modified || !modified.attributes || + (modified.attributes && modified.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.Geometry) { + node = this.createElementNSPlus("wfs:Value"); + var geom = this.writeNode("feature:_geometry", obj).firstChild; + node.appendChild(geom); + } else { + node = this.createElementNSPlus("wfs:Value", {value: obj}); + } + return node; + }, + "Delete": function(obj) { + var feature = obj.feature; + var options = obj.options; + var node = this.createElementNSPlus("wfs:Delete", { + attributes: { + handle: options && options.handle, + 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) { + OpenLayers.Format.WFST.v1.prototype.setFilterProperty.call(this, filter.filters[i]); + } + } else { + if(filter instanceof OpenLayers.Filter.Spatial && !filter.property) { + // got a spatial filter without property, so set it + filter.property = this.geometryName; + } + } + }, + + CLASS_NAME: "OpenLayers.Format.WFST.v1" + +}); diff --git a/misc/openlayers/lib/OpenLayers/Format/WFST/v1_0_0.js b/misc/openlayers/lib/OpenLayers/Format/WFST/v1_0_0.js new file mode 100644 index 0000000..ed81a2d --- /dev/null +++ b/misc/openlayers/lib/OpenLayers/Format/WFST/v1_0_0.js @@ -0,0 +1,174 @@ +/* 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/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]); + }, + + /** + * Method: readNode + * Shorthand for applying one of the named readers given the node + * namespace and local name. Readers take two args (node, obj) and + * generally extend or modify the second. + * + * Parameters: + * node - {DOMElement} The node to be read (required). + * obj - {Object} The object to be modified (optional). + * first - {Boolean} Should be set to true for the first node read. This + * is usually the readNode call in the read method. Without this being + * set, auto-configured properties will stick on subsequent reads. + * + * Returns: + * {Object} The input object, modified (or a new one if none was provided). + */ + readNode: function(node, obj, first) { + // Not the superclass, only the mixin classes inherit from + // Format.GML.v2. We need this because we don't want to get readNode + // from the superclass's superclass, which is OpenLayers.Format.XML. + return OpenLayers.Format.GML.v2.prototype.readNode.apply(this, arguments); + }, + + /** + * 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 = container.insertIds.concat(obj.fids); + }, + "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 prefix = options.featurePrefix; + var node = this.createElementNSPlus("wfs:Query", { + attributes: { + typeName: (prefix ? prefix + ":" : "") + + options.featureType + } + }); + if(options.srsNameInQuery && options.srsName) { + node.setAttribute("srsName", options.srsName); + } + if(options.featureNS) { + node.setAttribute("xmlns:" + prefix, 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" +}); diff --git a/misc/openlayers/lib/OpenLayers/Format/WFST/v1_1_0.js b/misc/openlayers/lib/OpenLayers/Format/WFST/v1_1_0.js new file mode 100644 index 0000000..ff2a88d --- /dev/null +++ b/misc/openlayers/lib/OpenLayers/Format/WFST/v1_1_0.js @@ -0,0 +1,189 @@ +/* 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/WFST/v1.js + * @requires OpenLayers/Format/Filter/v1_1_0.js + * @requires OpenLayers/Format/OWSCommon/v1_0_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]); + }, + + /** + * Method: readNode + * Shorthand for applying one of the named readers given the node + * namespace and local name. Readers take two args (node, obj) and + * generally extend or modify the second. + * + * Parameters: + * node - {DOMElement} The node to be read (required). + * obj - {Object} The object to be modified (optional). + * first - {Boolean} Should be set to true for the first node read. This + * is usually the readNode call in the read method. Without this being + * set, auto-configured properties will stick on subsequent reads. + * + * Returns: + * {Object} The input object, modified (or a new one if none was provided). + */ + readNode: function(node, obj, first) { + // Not the superclass, only the mixin classes inherit from + // Format.GML.v3. We need this because we don't want to get readNode + // from the superclass's superclass, which is OpenLayers.Format.XML. + return OpenLayers.Format.GML.v3.prototype.readNode.apply(this, arguments); + }, + + /** + * 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"], + "ows": OpenLayers.Format.OWSCommon.v1_0_0.prototype.readers["ows"] + }, + + /** + * 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 && this.setAttributes(node, { + resultType: options.resultType, + startIndex: options.startIndex, + count: options.count + }); + return node; + }, + "Query": function(options) { + options = OpenLayers.Util.extend({ + featureNS: this.featureNS, + featurePrefix: this.featurePrefix, + featureType: this.featureType, + srsName: this.srsName + }, options); + var prefix = options.featurePrefix; + var node = this.createElementNSPlus("wfs:Query", { + attributes: { + typeName: (prefix ? prefix + ":" : "") + + options.featureType, + srsName: options.srsName + } + }); + if(options.featureNS) { + node.setAttribute("xmlns:" + prefix, 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) { + OpenLayers.Format.WFST.v1_1_0.prototype.setFilterProperty.call(this, 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" +}); |