added parsing of Attribution, KeywordList and MetadataURL to

WMSCapabilities. Thanks tschaub for the improvements to my original 
patch. r=tschaub (closes #2145)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@9499 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2009-06-23 20:34:27 +00:00
parent 253a8bbaf7
commit 9d74c087ce
2 changed files with 376 additions and 12 deletions

View File

@@ -98,8 +98,11 @@ OpenLayers.Format.WMSCapabilities.v1_1 = OpenLayers.Class(
* Method: read_cap_Format
*/
read_cap_Format: function(obj, node) {
var format = this.getChildValue(node);
if(obj.formats) {
obj.formats.push(this.getChildValue(node));
obj.formats.push(format);
} else {
obj.format = format;
}
},
@@ -131,6 +134,8 @@ OpenLayers.Format.WMSCapabilities.v1_1 = OpenLayers.Class(
var layer = {
formats: capability.request.getmap.formats || [],
styles: [],
metadataURLs: [],
keywords: [],
queryable: (node.getAttribute("queryable") === "1"
|| node.getAttribute("queryable") === "true")
};
@@ -216,6 +221,53 @@ OpenLayers.Format.WMSCapabilities.v1_1 = OpenLayers.Class(
}
},
/**
* Method: read_cap_Attribution
*/
read_cap_Attribution: function(obj, node) {
var attribution = {};
this.runChildNodes(attribution, node);
obj.attribution = attribution;
},
/**
* Method: read_cap_LogoURL
*/
read_cap_LogoURL: function(obj, node) {
obj.logo = {
width: node.getAttribute("width"),
height: node.getAttribute("height")
};
this.runChildNodes(obj.logo, node);
},
/**
* Method: read_cap_MetadataURL
*/
read_cap_MetadataURL: function(layer, node) {
var metadataURL = {};
this.runChildNodes(metadataURL, node);
metadataURL.type = node.getAttribute("type");
layer.metadataURLs.push(metadataURL);
},
/**
* Method: read_cap_KeywordList
*/
read_cap_KeywordList: function(layer, node) {
var obj = layer;
this.runChildNodes(obj, node);
},
/**
* Method: read_cap_Keyword
*/
read_cap_Keyword: function(obj, node) {
if(obj.keywords) {
obj.keywords.push(this.getChildValue(node));
}
},
/**
* Method: read_cap_LatLonBoundingBox
*/
@@ -227,7 +279,7 @@ OpenLayers.Format.WMSCapabilities.v1_1 = OpenLayers.Class(
parseFloat(node.getAttribute("maxy"))
];
},
/**
* Method: read_cap_Style
*/
@@ -241,15 +293,11 @@ OpenLayers.Format.WMSCapabilities.v1_1 = OpenLayers.Class(
* Method: read_cap_LegendURL
*/
read_cap_LegendURL: function(style, node) {
var legend = {
width: node.getAttribute('width'),
height: node.getAttribute('height')
style.legend = {
width: node.getAttribute("width"),
height: node.getAttribute("height")
};
var links = node.getElementsByTagName("OnlineResource");
if(links.length > 0) {
this.read_cap_OnlineResource(legend, links[0]);
}
style.legend = legend;
this.runChildNodes(style.legend, node);
},
/**