SLD format rewrite. Adds a versioned parser with read and write support. This does not come with full support for ogc:expression parsing, but makes for easy future enhancements. r=ahocevar (closes #1458)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@6645 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2008-03-27 17:18:05 +00:00
parent 6b1903b5a3
commit 3b267f5334
11 changed files with 1620 additions and 719 deletions
+8 -9
View File
@@ -17,17 +17,16 @@
}
function test_Format_SLD_read(t) {
t.plan(5);
var styles = new OpenLayers.Format.SLD().read(this.test_content,
{withNamedLayer: true});
t.plan(4);
var sld = new OpenLayers.Format.SLD().read(this.test_content);
var testLayer = styles[1].TestLayer;
var testLayer = sld.namedLayers["TestLayer"];
var userStyles = testLayer.userStyles;
t.ok(testLayer.foo != undefined, "SLD correctly reads a UserStyle named \"foo\"");
t.eq(testLayer.foo.rules.length, 1, "The number of rules for the UserStyle is correct");
t.eq(testLayer.foo.rules[0].name, "bar", "The first rule's name is \"bar\"");
t.eq(testLayer.foo.rules[0].symbolizer.Polygon.fillColor, "blue", "The fillColor for the Polygon symbolizer is correct");
t.eq(testLayer.foo.name, styles[0][0].name, "The content hash of the Format contains the correct rules.");
t.eq(userStyles[0].name, "foo", "SLD correctly reads a UserStyle named 'foo'");
t.eq(userStyles[0].rules.length, 1, "The number of rules for the UserStyle is correct");
t.eq(userStyles[0].rules[0].name, "bar", "The first rule's name is 'bar'");
t.eq(userStyles[0].rules[0].symbolizer.Polygon.fillColor, "blue", "The fillColor for the Polygon symbolizer is correct");
}
</script>