Adding gml namespace to SLD format for writing spatial filters. r=ahocevar (closes #2006)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@9138 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2009-03-27 02:00:15 +00:00
parent cd899ab11e
commit 84fa9dd1ae
2 changed files with 35 additions and 0 deletions

View File

@@ -24,6 +24,7 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, {
namespaces: {
sld: "http://www.opengis.net/sld",
ogc: "http://www.opengis.net/ogc",
gml: "http://www.opengis.net/gml",
xlink: "http://www.w3.org/1999/xlink",
xsi: "http://www.w3.org/2001/XMLSchema-instance"
},

View File

@@ -261,6 +261,40 @@
t.xml_eq(node, expected, "TextSymbolizer correctly written");
}
function test_writeSpatialFilter(t) {
t.plan(1);
var format = new OpenLayers.Format.SLD.v1_0_0();
var rule = new OpenLayers.Rule({
name: "test",
filter: new OpenLayers.Filter.Spatial({
type: OpenLayers.Filter.Spatial.BBOX,
value: new OpenLayers.Bounds(0, 0, 10, 10)
})
});
var sld = format.writeNode("sld:Rule", rule);
var expect =
'<Rule xmlns="http://www.opengis.net/sld">' +
'<Name>test</Name>' +
'<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">' +
'<ogc:BBOX>' +
'<ogc:PropertyName/>' +
'<gml:Box xmlns:gml="http://www.opengis.net/gml">' +
'<gml:coordinates decimal="." cs="," ts=" ">0,0 10,10</gml:coordinates>' +
'</gml:Box>' +
'</ogc:BBOX>' +
'</ogc:Filter>' +
'</Rule>';
t.xml_eq(sld, expect, "rule with spatial filter correctly written");
}
</script>