From 84fa9dd1aea72fec1e671a086e0b7918101d187c Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Fri, 27 Mar 2009 02:00:15 +0000 Subject: [PATCH] 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 --- lib/OpenLayers/Format/SLD/v1.js | 1 + tests/Format/SLD/v1_0_0.html | 34 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/lib/OpenLayers/Format/SLD/v1.js b/lib/OpenLayers/Format/SLD/v1.js index e761059063..cb52b3775d 100644 --- a/lib/OpenLayers/Format/SLD/v1.js +++ b/lib/OpenLayers/Format/SLD/v1.js @@ -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" }, diff --git a/tests/Format/SLD/v1_0_0.html b/tests/Format/SLD/v1_0_0.html index 9e42ad54ae..fd87a00b90 100644 --- a/tests/Format/SLD/v1_0_0.html +++ b/tests/Format/SLD/v1_0_0.html @@ -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 = + '' + + 'test' + + '' + + '' + + '' + + '' + + '0,0 10,10' + + '' + + '' + + '' + + ''; + + t.xml_eq(sld, expect, "rule with spatial filter correctly written"); + + }