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) git-svn-id: http://svn.openlayers.org/trunk/openlayers@7626 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -375,6 +375,19 @@ OpenLayers.Format.WMC.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: read_wmc_MetadataURL
|
||||
*/
|
||||
read_wmc_MetadataURL: function(layerInfo, node) {
|
||||
var metadataURL = {};
|
||||
var links = node.getElementsByTagName("OnlineResource");
|
||||
if(links.length > 0) {
|
||||
this.read_wmc_OnlineResource(metadataURL, links[0]);
|
||||
}
|
||||
layerInfo.options.metadataURL = metadataURL.href;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: read_wmc_Abstract
|
||||
*/
|
||||
@@ -620,6 +633,11 @@ OpenLayers.Format.WMC.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||
node.appendChild(this.createElementDefaultNS(
|
||||
"Title", layer.name
|
||||
));
|
||||
|
||||
// optional MetadataURL element
|
||||
if (layer.metadataURL) {
|
||||
node.appendChild(this.write_wmc_MetadataURL(layer));
|
||||
}
|
||||
|
||||
// optional FormatList element
|
||||
node.appendChild(this.write_wmc_FormatList(layer));
|
||||
@@ -726,6 +744,25 @@ OpenLayers.Format.WMC.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||
return node;
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: write_wmc_MetadataURL
|
||||
* Create a MetadataURL node given a layer object.
|
||||
*
|
||||
* Parameters:
|
||||
* layer - {<OpenLayers.Layer.WMS>} Layer object.
|
||||
*
|
||||
* Returns:
|
||||
* {Element} A WMC metadataURL element node.
|
||||
*/
|
||||
write_wmc_MetadataURL: function(layer) {
|
||||
var node = this.createElementDefaultNS("MetadataURL");
|
||||
|
||||
// required OnlineResource element
|
||||
node.appendChild(this.write_wmc_OnlineResource(layer.metadataURL));
|
||||
|
||||
return node;
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: write_wmc_FormatList
|
||||
* Create a FormatList node given a layer.
|
||||
|
||||
Reference in New Issue
Block a user