Changeset 7139
- Timestamp:
- 05/12/08 14:17:47 (6 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/vector-behavior/lib/OpenLayers/Protocol/WFS/v1_0_0.js
r7117 r7139 16 16 17 17 /** 18 * Array of parameters that should be set in a WFS request's outer envelope. 19 */ 20 21 ENVELOPE_PARAMS : ['service','version','maxFeatures', 'outputFormat'], 22 23 /** 24 * A mapping from Format classnames to the proper value for the outputFormat parameter of a WFS request. 25 */ 26 outputFormats : { 27 "OpenLayers.Format.GML" : "GML2" 28 }, 29 30 31 /** 18 32 * Property: namespaces 19 33 * {Object} Namespace dictionary keyed by namespace alias. … … 32 46 */ 33 47 DEFAULT_PARAMS: { service: "WFS", 34 version: "1.0.0" ,48 version: "1.0.0" 35 49 }, 36 50 … … 99 113 OpenLayers.Util.applyDefaults( 100 114 this.params, 101 OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS)115 this.DEFAULT_PARAMS 102 116 ); 103 117 … … 137 151 138 152 139 var root = this.createEnvelope("wfs:GetFeature" );153 var root = this.createEnvelope("wfs:GetFeature", params); 140 154 141 155 var query = this.format.createElementNSPlus("wfs:Query", { … … 196 210 197 211 // name e.g. 'wfs:Transaction' 198 createEnvelope: function(name ) {212 createEnvelope: function(name, params) { 199 213 var envelope = this.format.createElementNSPlus(name); 200 214 201 // should handle params here gracefully 202 // should check for e.g. maxFeatures 203 envelope.setAttribute('version', this.params.VERSION); 204 envelope.setAttribute('service', this.params.SERVICE); 215 216 if(!params){ 217 params = {}; 218 } 219 var param; 220 for(var i = 0; i < this.ENVELOPE_PARAMS.length; i++){ 221 param = this.ENVELOPE_PARAMS[i]; 222 if(params[param]){ 223 envelope.setAttribute(param, params[param]); 224 } 225 } 205 226 206 227 envelope.setAttribute("xmlns:" + this.format.featurePrefix, this.format.featureNS); 207 228 208 // This should depend on the layer's format. 209 envelope.setAttribute("outputFormat","GML2"); 229 if(this.outputFormats[this.format.CLASS_NAME] && !params.outputFormat){ 230 OpenLayers.Console.log("Setting outputFormat according to Format class name " + this.format.CLASS_NAME); 231 envelope.setAttribute("outputFormat", this.outputFormats[this.format.CLASS_NAME]); 232 } 210 233 211 234 envelope.setAttribute("xmlns:" + this.format.featurePrefix, this.format.featureNS);
