OpenLayers OpenLayers

Changeset 7626

Show
Ignore:
Timestamp:
07/30/08 20:00:27 (4 months ago)
Author:
crschmidt
Message:

Fix for WMC does not read/write metadataURLs.
This matches the style of other similar properties in the code, and has a
negligable (<5%) impact on parsing speed in Firefox/Safari. patch from
bartvde, (Closes #1452)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Format/WMC/v1.js

    r6748 r7626  
    377377 
    378378    /** 
     379     * Method: read_wmc_MetadataURL 
     380     */ 
     381    read_wmc_MetadataURL: function(layerInfo, node) { 
     382        var metadataURL = {}; 
     383        var links = node.getElementsByTagName("OnlineResource"); 
     384        if(links.length > 0) { 
     385            this.read_wmc_OnlineResource(metadataURL, links[0]); 
     386        } 
     387        layerInfo.options.metadataURL = metadataURL.href; 
     388 
     389    }, 
     390 
     391    /** 
    379392     * Method: read_wmc_Abstract 
    380393     */ 
     
    621634            "Title", layer.name 
    622635        )); 
     636 
     637        // optional MetadataURL element 
     638        if (layer.metadataURL) { 
     639            node.appendChild(this.write_wmc_MetadataURL(layer)); 
     640        } 
    623641         
    624642        // optional FormatList element 
     
    724742        node.appendChild(this.write_wmc_OnlineResource(layer.url)); 
    725743         
     744        return node; 
     745    }, 
     746 
     747    /** 
     748     * Method: write_wmc_MetadataURL 
     749     * Create a MetadataURL node given a layer object. 
     750     * 
     751     * Parameters: 
     752     * layer - {<OpenLayers.Layer.WMS>} Layer object. 
     753     * 
     754     * Returns: 
     755     * {Element} A WMC metadataURL element node. 
     756     */ 
     757    write_wmc_MetadataURL: function(layer) { 
     758        var node = this.createElementDefaultNS("MetadataURL"); 
     759 
     760        // required OnlineResource element 
     761        node.appendChild(this.write_wmc_OnlineResource(layer.metadataURL)); 
     762 
    726763        return node; 
    727764    },