OpenLayers OpenLayers

Ticket #1328: GML.js.diff

File GML.js.diff, 2.0 kB (added by sbenthall, 4 months ago)
  • lib/OpenLayers/Format/GML.js

    old new  
    168168            attributes = this.parseAttributes(node); 
    169169        } 
    170170        var feature = new OpenLayers.Feature.Vector(geometry, attributes); 
     171         
     172        feature.gml = { 
     173            featureType: this.parseFeatureType(node), 
     174            featureNS: this.parseFeatureNS(node), 
     175            featureNSPrefix: this.parseFeatureNSPrefix(node) 
     176        }; 
     177                 
    171178        // assign fid - this can come from a "fid" or "id" attribute 
    172179        var childNode = node.firstChild; 
    173180        var fid; 
     
    182189            childNode = childNode.nextSibling; 
    183190        } 
    184191        feature.fid = fid; 
     192         
    185193        return feature; 
    186194    }, 
    187195     
     
    561569    }, 
    562570     
    563571    /** 
     572     * Method: parseFeatureType 
     573     * 
     574     * Parameters: 
     575     * node - {<DOMElement>} 
     576     * 
     577     * Returns: 
     578     * {String} The name of a featuretype 
     579     */   
     580    parseFeatureType: function(node){ 
     581        var childNode = node.firstChild; 
     582        return childNode.nodeName.split(":")[1]; 
     583    }, 
     584     
     585    /** 
     586     * Method: parseFeatureNS 
     587     * 
     588     * Parameters: 
     589     * node - {<DOMElement>} 
     590     * 
     591     * Returns: 
     592     * {String} The feature's namespace 
     593     */ 
     594    parseFeatureNS: function(node){ 
     595        var childNode = node.firstChild; 
     596        return childNode.namespaceURI; 
     597         
     598    }, 
     599     
     600        /** 
     601     * Method: parseFeatureNSName 
     602     * 
     603     * Parameters: 
     604     * node - {<DOMElement>} 
     605     * 
     606     * Returns: 
     607     * {String} The name of the feature's namespace 
     608     */ 
     609    parseFeatureNSPrefix: function(node){ 
     610        var childNode = node.firstChild; 
     611        return childNode.prefix; 
     612         
     613    }, 
     614     
     615     
     616    /** 
    564617     * APIMethod: write 
    565618     * Generate a GML document string given a list of features.  
    566619     *