Allowing zero fill opacity to be written in SLD docs. The SLD format deserves a bit more of an overhaul (given changes to OL.Format.XML), and we've got decent changes sitting around in various sandboxes, but this is a simple fix for a small problem. r=ahocevar (closes #1884)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@8549 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -686,7 +686,7 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
|
|||||||
{symbolizer: symbolizer, key: "fillColor"}
|
{symbolizer: symbolizer, key: "fillColor"}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if(symbolizer.fillOpacity) {
|
if(symbolizer.fillOpacity != null) {
|
||||||
this.writeNode(
|
this.writeNode(
|
||||||
node, "CssParameter",
|
node, "CssParameter",
|
||||||
{symbolizer: symbolizer, key: "fillOpacity"}
|
{symbolizer: symbolizer, key: "fillOpacity"}
|
||||||
@@ -890,7 +890,7 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
|
|||||||
if(options.attributes) {
|
if(options.attributes) {
|
||||||
this.setAttributes(node, options.attributes);
|
this.setAttributes(node, options.attributes);
|
||||||
}
|
}
|
||||||
if(options.value) {
|
if(options.value != null) {
|
||||||
node.appendChild(this.createTextNode(options.value));
|
node.appendChild(this.createTextNode(options.value));
|
||||||
}
|
}
|
||||||
return node;
|
return node;
|
||||||
|
|||||||
@@ -138,7 +138,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function test_write(t) {
|
function test_write(t) {
|
||||||
t.plan(1);
|
t.plan(2);
|
||||||
|
|
||||||
// read first - testing that write produces the SLD aboce
|
// read first - testing that write produces the SLD aboce
|
||||||
var parser = new OpenLayers.Format.SLD.v1_0_0();
|
var parser = new OpenLayers.Format.SLD.v1_0_0();
|
||||||
@@ -148,6 +148,19 @@
|
|||||||
var node = parser.write(obj);
|
var node = parser.write(obj);
|
||||||
t.xml_eq(node, sld, "SLD correctly written");
|
t.xml_eq(node, sld, "SLD correctly written");
|
||||||
|
|
||||||
|
// test that 0 fill opacity gets written
|
||||||
|
var symbolizer = {
|
||||||
|
fillColor: "red",
|
||||||
|
fillOpacity: 0
|
||||||
|
};
|
||||||
|
var root = parser.createElementNSPlus("PolygonSymbolizer");
|
||||||
|
var got = parser.writeNode(root, "Fill", symbolizer);
|
||||||
|
var expect =
|
||||||
|
'<Fill xmlns="http://www.opengis.net/sld">' +
|
||||||
|
'<CssParameter name="fill">red</CssParameter>' +
|
||||||
|
'<CssParameter name="fill-opacity">0</CssParameter>' +
|
||||||
|
'</Fill>';
|
||||||
|
t.xml_eq(got, expect, "zero fill opacity written");
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_writeTextSymbolizer(t) {
|
function test_writeTextSymbolizer(t) {
|
||||||
|
|||||||
Reference in New Issue
Block a user