Enhancements to the WMC parser for better contact information, SRS, and style support. p=trondmm, r=me (closes #3236)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@11871 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2011-04-04 17:15:14 +00:00
parent a7d1cc9134
commit 7a5e837c9b
7 changed files with 824 additions and 62 deletions
+28
View File
@@ -45,6 +45,20 @@ OpenLayers.Format.WMC.v1_0_0 = OpenLayers.Class(
);
},
/**
* Method: read_wmc_SRS
*/
read_wmc_SRS: function(layerContext, node) {
var srs = this.getChildValue(node);
if (typeof layerContext.projections != "object") {
layerContext.projections = {};
}
var values = srs.split(/ +/);
for (var i=0, len=values.length; i<len; i++) {
layerContext.projections[values[i]] = true;
}
},
/**
* Method: write_wmc_Layer
* Create a Layer node given a layer context object. This method adds
@@ -61,12 +75,26 @@ OpenLayers.Format.WMC.v1_0_0 = OpenLayers.Class(
this, [context]
);
// optional SRS element(s)
if (context.srs) {
var projections = [];
for(var name in context.srs) {
projections.push(name);
}
node.appendChild(this.createElementDefaultNS("SRS", projections.join(" ")));
}
// optional FormatList element
node.appendChild(this.write_wmc_FormatList(context));
// optional StyleList element
node.appendChild(this.write_wmc_StyleList(context));
// optional DimensionList element
if (context.dimensions) {
node.appendChild(this.write_wmc_DimensionList(layer));
}
// OpenLayers specific properties go in an Extension element
node.appendChild(this.write_wmc_LayerExtension(context));
},