Changeset 8578
- Timestamp:
- 01/04/09 12:39:32 (1 year ago)
- Files:
-
- sandbox/topp/wfsv/lib/OpenLayers/Format/GML/Base.js (modified) (2 diffs)
- sandbox/topp/wfsv/lib/OpenLayers/Format/WFST/v1.js (modified) (1 diff)
- sandbox/topp/wfsv/lib/OpenLayers/Layer/Markers.js (modified) (1 diff)
- sandbox/topp/wfsv/lib/OpenLayers/Protocol/WFS/v1.js (modified) (4 diffs)
- sandbox/topp/wfsv/lib/OpenLayers/Strategy/BBOX.js (modified) (7 diffs)
- sandbox/topp/wfsv/lib/OpenLayers/Strategy/Fixed.js (modified) (1 diff)
- sandbox/topp/wfsv/lib/OpenLayers/Strategy/Save.js (modified) (2 diffs)
- sandbox/topp/wfsv/news.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/topp/wfsv/lib/OpenLayers/Format/GML/Base.js
r8218 r8578 184 184 "featureMembers": function(node, obj) { 185 185 this.readChildNodes(node, obj); 186 }, 187 "name": function(node, obj) { 188 obj.name = this.getChildValue(node); 186 189 }, 187 190 "boundedBy": function(node, obj) { … … 338 341 var container = {components: [], attributes: {}}; 339 342 this.readChildNodes(node, container); 343 // look for common gml namespaced elements 344 if(container.name) { 345 container.attributes.name = container.name; 346 } 340 347 var feature = new OpenLayers.Feature.Vector( 341 348 container.components[0], container.attributes sandbox/topp/wfsv/lib/OpenLayers/Format/WFST/v1.js
r8212 r8578 112 112 if(!srsName) { 113 113 if(feature && feature.layer) { 114 if(feature.layer.map) { 115 srsName = feature.layer.map.getProjection(); 116 } else { 117 srsName = feature.layer.projection.getCode(); 118 } 114 srsName = feature.layer.projection.getCode(); 119 115 } else { 120 116 srsName = this.srsName; sandbox/topp/wfsv/lib/OpenLayers/Layer/Markers.js
r8147 r8578 159 159 var markerImg = marker.draw(px); 160 160 this.div.appendChild(markerImg); 161 } else if(marker.icon) { 162 marker.icon.moveTo(px); 161 163 } 162 164 } sandbox/topp/wfsv/lib/OpenLayers/Protocol/WFS/v1.js
r8157 r8578 76 76 * Valid options properties: 77 77 * featureType - {String} Local (without prefix) feature typeName (required). 78 * featureNS - {String} Feature namespace (optional). 78 * featureNS - {String} Feature namespace (optional - can be autodetected 79 * for reading if featurePrefix is provided and identical to the prefix 80 * in the server response). 79 81 * featurePrefix - {String} Feature namespace alias (optional - only used 80 * if featureNS is provided). Default is 'feature'.82 * for writing if featureNS is provided). Default is 'feature'. 81 83 * geometryName - {String} Name of geometry attribute. Default is 'the_geom'. 82 84 */ … … 94 96 }, this.formatOptions)); 95 97 } 98 var readNode = this.format.readNode; 99 this.format.readNode = function(node, obj) { 100 if(!this.featureNS && node.prefix == this.featurePrefix) { 101 this.featureNS = node.namespaceURI; 102 this.setNamespace("feature", this.featureNS); 103 } 104 return readNode.apply(this, arguments); 105 } 96 106 }, 97 107 … … 268 278 * filter - {OpenLayers.Filter} filter 269 279 */ 270 filterDelete: function(filter) { 271 var root = this.format.writeNode("wfs:Transaction"); 280 filterDelete: function(filter, options) { 281 options = OpenLayers.Util.extend({}, options); 282 OpenLayers.Util.applyDefaults(options, this.options); 283 284 var response = new OpenLayers.Protocol.Response({ 285 requestType: "commit" 286 }); 287 288 var root = this.format.createElementNSPlus("wfs:Transaction", { 289 attributes: { 290 service: "WFS", 291 version: this.version 292 } 293 }); 272 294 273 295 var deleteNode = this.format.createElementNSPlus("wfs:Delete", { … … 293 315 return OpenLayers.Request.POST({ 294 316 url: this.url, 317 callback : options.callback || function(){}, 295 318 data: data 296 319 }); sandbox/topp/wfsv/lib/OpenLayers/Strategy/BBOX.js
r8000 r8578 20 20 /** 21 21 * Property: bounds 22 * {<OpenLayers.Bounds>} The current data bounds. 22 * {<OpenLayers.Bounds>} The current data bounds (in the same projection 23 * as the layer - not always the same projection as the map). 23 24 */ 24 25 bounds: null, … … 104 105 */ 105 106 update: function(options) { 106 var mapBounds = this. layer.map.getExtent();107 var mapBounds = this.getMapBounds(); 107 108 if ((options && options.force) || this.invalidBounds(mapBounds)) { 108 109 this.calculateBounds(mapBounds); … … 110 111 } 111 112 }, 113 114 /** 115 * Method: getMapBounds 116 * Get the map bounds expressed in the same projection as this layer. 117 * 118 * Returns: 119 * {<OpenLayers.Bounds>} Map bounds in the projection of the layer. 120 */ 121 getMapBounds: function() { 122 var bounds = this.layer.map.getExtent(); 123 if(!this.layer.projection.equals(this.layer.map.getProjectionObject())) { 124 bounds = bounds.clone().transform( 125 this.layer.map.getProjectionObject(), this.layer.projection 126 ); 127 } 128 return bounds; 129 }, 112 130 113 131 /** … … 123 141 invalidBounds: function(mapBounds) { 124 142 if(!mapBounds) { 125 mapBounds = this. layer.map.getExtent();143 mapBounds = this.getMapBounds(); 126 144 } 127 145 return !this.bounds || !this.bounds.containsBounds(mapBounds); … … 137 155 calculateBounds: function(mapBounds) { 138 156 if(!mapBounds) { 139 mapBounds = this. layer.map.getExtent();157 mapBounds = this.getMapBounds(); 140 158 } 141 159 var center = mapBounds.getCenterLonLat(); … … 194 212 * Method: merge 195 213 * Given a list of features, determine which ones to add to the layer. 214 * If the layer projection differs from the map projection, features 215 * will be transformed from the layer projection to the map projection. 196 216 * 197 217 * Parameters: … … 203 223 var features = resp.features; 204 224 if(features && features.length > 0) { 225 var remote = this.layer.projection; 226 var local = this.layer.map.getProjectionObject(); 227 if(!local.equals(remote)) { 228 var geom; 229 for(var i=0, len=features.length; i<len; ++i) { 230 geom = features[i].geometry; 231 if(geom) { 232 geom.transform(remote, local); 233 } 234 } 235 } 205 236 this.layer.addFeatures(features); 206 237 } sandbox/topp/wfsv/lib/OpenLayers/Strategy/Fixed.js
r7708 r8578 63 63 var features = resp.features; 64 64 if (features && features.length > 0) { 65 var remote = this.layer.projection; 66 var local = this.layer.map.getProjectionObject(); 67 if(!local.equals(remote)) { 68 var geom; 69 for(var i=0, len=features.length; i<len; ++i) { 70 geom = features[i].geometry; 71 if(geom) { 72 geom.transform(remote, local); 73 } 74 } 75 } 65 76 this.layer.addFeatures(features); 66 77 } sandbox/topp/wfsv/lib/OpenLayers/Strategy/Save.js
r8065 r8578 31 31 /** 32 32 * Method: save 33 * Tell the layer protocol to commit unsaved features. If the layer 34 * projection differs from the map projection, features will be 35 * transformed into the layer projection before being committed. 33 36 * 34 37 * Parameters: 35 38 * features - {Array} Features to be saved. If null, then default is all 36 * features in the layer. 39 * features in the layer. Features are assumed to be in the map 40 * projection. 37 41 */ 38 42 save: function(features) { 39 if(!features) {43 if(!features) { 40 44 features = this.layer.features; 45 } 46 var remote = this.layer.projection; 47 var local = this.layer.map.getProjectionObject(); 48 if(!local.equals(remote)) { 49 var len = features.length; 50 var clones = new Array(len); 51 var orig, clone; 52 for(var i=0; i<len; ++i) { 53 orig = features[i]; 54 clone = orig.clone(); 55 clone.fid = orig.fid; 56 clone.state = orig.state; 57 clone._original = orig; 58 clone.geometry.transform(local, remote); 59 clones[i] = clone; 60 } 61 features = clones; 41 62 } 42 63 this.layer.protocol.commit(features, { … … 63 84 for(var i=0, len=features.length; i<len; ++i) { 64 85 feature = features[i]; 86 // if projection was different, we may be dealing with clones 87 feature = feature._original || feature; 65 88 state = feature.state; 66 89 if(state) { sandbox/topp/wfsv/news.txt
r5000 r8578 1 OpenLayers 2.7: 2 r8063 3 Released 09/29/08 4 http://trac.openlayers.org/wiki/Release/2.7/Notes 5 6 OpenLayers 2.6: 7 r6945 8 Released 04/15/08 9 http://trac.openlayers.org/wiki/Release/2.6/Notes 10 1 11 OpenLayers 2.5: 2 12 r4899
