add support for parsing WMS-C type capabilities, r=ahocevar (closes #3026)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@11056 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
bartvde
2011-01-24 12:20:36 +00:00
parent 3ba277f6b7
commit 54fe8a5590
3 changed files with 15 additions and 2 deletions

View File

@@ -28,6 +28,15 @@ OpenLayers.Format.WMSCapabilities = OpenLayers.Class(OpenLayers.Format.XML, {
*/
version: null,
/**
* APIProperty: profile
* {String} If provided, use a custom profile.
*
* Currently supported profiles:
* - WMSC - parses vendor specific capabilities for WMS-C.
*/
profile: null,
/**
* Property: parser
* {<OpenLayers.Format>} A cached versioned format used for reading.
@@ -63,12 +72,14 @@ OpenLayers.Format.WMSCapabilities = OpenLayers.Class(OpenLayers.Format.XML, {
}
var root = data.documentElement;
var version = this.version || root.getAttribute("version") || this.defaultVersion;
var profile = this.profile ? "_" + this.profile : "";
if(!this.parser || this.parser.version !== version) {
var constr = OpenLayers.Format.WMSCapabilities[
"v" + version.replace(/\./g, "_")
"v" + version.replace(/\./g, "_") + profile
];
if(!constr) {
throw "Can't find a WMS capabilities parser for version " + version;
throw "Can't find a WMS capabilities parser for version " +
version + profile;
}
this.parser = new constr(this.options);
}