OpenLayers OpenLayers

Changeset 8578

Show
Ignore:
Timestamp:
01/04/09 12:39:32 (1 year ago)
Author:
sbenthall
Message:

merge from -r8218:HEAD topp/wfs sandbox

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/topp/wfsv/lib/OpenLayers/Format/GML/Base.js

    r8218 r8578  
    184184            "featureMembers": function(node, obj) { 
    185185                this.readChildNodes(node, obj);                 
     186            }, 
     187            "name": function(node, obj) { 
     188                obj.name = this.getChildValue(node); 
    186189            }, 
    187190            "boundedBy": function(node, obj) { 
     
    338341                var container = {components: [], attributes: {}}; 
    339342                this.readChildNodes(node, container); 
     343                // look for common gml namespaced elements 
     344                if(container.name) { 
     345                    container.attributes.name = container.name; 
     346                } 
    340347                var feature = new OpenLayers.Feature.Vector( 
    341348                    container.components[0], container.attributes 
  • sandbox/topp/wfsv/lib/OpenLayers/Format/WFST/v1.js

    r8212 r8578  
    112112        if(!srsName) { 
    113113            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(); 
    119115            } else { 
    120116                srsName = this.srsName; 
  • sandbox/topp/wfsv/lib/OpenLayers/Layer/Markers.js

    r8147 r8578  
    159159                var markerImg = marker.draw(px); 
    160160                this.div.appendChild(markerImg); 
     161            } else if(marker.icon) { 
     162                marker.icon.moveTo(px); 
    161163            } 
    162164        } 
  • sandbox/topp/wfsv/lib/OpenLayers/Protocol/WFS/v1.js

    r8157 r8578  
    7676     * Valid options properties: 
    7777     * 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). 
    7981     * 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'. 
    8183     * geometryName - {String} Name of geometry attribute.  Default is 'the_geom'. 
    8284     */ 
     
    9496            }, this.formatOptions)); 
    9597        } 
     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        } 
    96106    }, 
    97107     
     
    268278     * filter - {OpenLayers.Filter} filter 
    269279     */ 
    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        }); 
    272294         
    273295        var deleteNode = this.format.createElementNSPlus("wfs:Delete", { 
     
    293315        return OpenLayers.Request.POST({ 
    294316            url: this.url, 
     317            callback : options.callback || function(){}, 
    295318            data: data 
    296319        });    
  • sandbox/topp/wfsv/lib/OpenLayers/Strategy/BBOX.js

    r8000 r8578  
    2020    /** 
    2121     * 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). 
    2324     */ 
    2425    bounds: null, 
     
    104105     */ 
    105106    update: function(options) { 
    106         var mapBounds = this.layer.map.getExtent(); 
     107        var mapBounds = this.getMapBounds(); 
    107108        if ((options && options.force) || this.invalidBounds(mapBounds)) { 
    108109            this.calculateBounds(mapBounds); 
     
    110111        } 
    111112    }, 
     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    }, 
    112130 
    113131    /** 
     
    123141    invalidBounds: function(mapBounds) { 
    124142        if(!mapBounds) { 
    125             mapBounds = this.layer.map.getExtent(); 
     143            mapBounds = this.getMapBounds(); 
    126144        } 
    127145        return !this.bounds || !this.bounds.containsBounds(mapBounds); 
     
    137155    calculateBounds: function(mapBounds) { 
    138156        if(!mapBounds) { 
    139             mapBounds = this.layer.map.getExtent(); 
     157            mapBounds = this.getMapBounds(); 
    140158        } 
    141159        var center = mapBounds.getCenterLonLat(); 
     
    194212     * Method: merge 
    195213     * 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. 
    196216     * 
    197217     * Parameters: 
     
    203223        var features = resp.features; 
    204224        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            } 
    205236            this.layer.addFeatures(features); 
    206237        } 
  • sandbox/topp/wfsv/lib/OpenLayers/Strategy/Fixed.js

    r7708 r8578  
    6363        var features = resp.features; 
    6464        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            } 
    6576            this.layer.addFeatures(features); 
    6677        } 
  • sandbox/topp/wfsv/lib/OpenLayers/Strategy/Save.js

    r8065 r8578  
    3131    /** 
    3232     * 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. 
    3336     * 
    3437     * Parameters: 
    3538     * 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. 
    3741     */ 
    3842    save: function(features) { 
    39         if(!features)
     43        if(!features)
    4044            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; 
    4162        } 
    4263        this.layer.protocol.commit(features, { 
     
    6384            for(var i=0, len=features.length; i<len; ++i) { 
    6485                feature = features[i]; 
     86                // if projection was different, we may be dealing with clones 
     87                feature = feature._original || feature; 
    6588                state = feature.state; 
    6689                if(state) { 
  • sandbox/topp/wfsv/news.txt

    r5000 r8578  
     1OpenLayers 2.7: 
     2 r8063 
     3 Released 09/29/08 
     4 http://trac.openlayers.org/wiki/Release/2.7/Notes 
     5 
     6OpenLayers 2.6: 
     7 r6945 
     8 Released 04/15/08 
     9 http://trac.openlayers.org/wiki/Release/2.6/Notes 
     10 
    111OpenLayers 2.5: 
    212 r4899