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