Added parseFloat for quantity and opacity on read, as suggested in bartvde's review. With additional tests to show that everything works as suggested now. See #2642.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@10349 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -226,11 +226,13 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, {
|
||||
this.readChildNodes(node, symbolizer.colorMap);
|
||||
},
|
||||
"ColorMapEntry": function(node, colorMap) {
|
||||
var q = node.getAttribute("quantity");
|
||||
var o = node.getAttribute("opacity");
|
||||
colorMap.push({
|
||||
color: node.getAttribute("color"),
|
||||
quantity: node.getAttribute("quantity") || undefined,
|
||||
quantity: q !== null ? parseFloat(q) : undefined,
|
||||
label: node.getAttribute("label") || undefined,
|
||||
opacity: node.getAttribute("opacity") || undefined
|
||||
opacity: o !== null ? parseFloat(o) : undefined
|
||||
});
|
||||
},
|
||||
"LineSymbolizer": function(node, rule) {
|
||||
@@ -838,11 +840,11 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, {
|
||||
var node = this.createElementNSPlus("sld:ColorMapEntry");
|
||||
var a = colorMapEntry;
|
||||
node.setAttribute("color", a.color);
|
||||
a.opacity && node.setAttribute("opacity",
|
||||
a.opacity !== undefined && node.setAttribute("opacity",
|
||||
parseFloat(a.opacity));
|
||||
a.quantity && node.setAttribute("quantity",
|
||||
a.quantity !== undefined && node.setAttribute("quantity",
|
||||
parseFloat(a.quantity));
|
||||
a.label && node.setAttribute("label", a.label);
|
||||
a.label !== undefined && node.setAttribute("label", a.label);
|
||||
return node;
|
||||
},
|
||||
"PolygonSymbolizer": function(symbolizer) {
|
||||
|
||||
Reference in New Issue
Block a user