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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user