From 75c187d5a398d7eb3d7f9fae9db31b3e8f284ae4 Mon Sep 17 00:00:00 2001 From: Bart van den Eijnden Date: Thu, 29 Mar 2012 22:13:24 +0200 Subject: [PATCH] setting graphic to false by default when reading a TextSymbolizer, just like is done on other symbolizers --- lib/OpenLayers/Format/SLD/v1.js | 4 +++- tests/Format/SLD/v1_0_0.html | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/OpenLayers/Format/SLD/v1.js b/lib/OpenLayers/Format/SLD/v1.js index 71855cbee0..9773e175ba 100644 --- a/lib/OpenLayers/Format/SLD/v1.js +++ b/lib/OpenLayers/Format/SLD/v1.js @@ -207,7 +207,9 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, { rule.maxScaleDenominator = parseFloat(this.getChildValue(node)); }, "TextSymbolizer": function(node, rule) { - var config = {}; + var config = { + graphic: false + }; this.readChildNodes(node, config); if (this.multipleSymbolizers) { config.zIndex = this.featureTypeCounter; diff --git a/tests/Format/SLD/v1_0_0.html b/tests/Format/SLD/v1_0_0.html index fbc18a6552..88367a4d26 100644 --- a/tests/Format/SLD/v1_0_0.html +++ b/tests/Format/SLD/v1_0_0.html @@ -622,6 +622,17 @@ } + function test_readTextSymbolizer(t) { + t.plan(1); + var format = new OpenLayers.Format.SLD.v1_0_0({ + multipleSymbolizers: true, + namedLayersAsArray: true + }); + doc = readXML("point_pointwithdefaultlabel.sld"); + var sld = format.read(doc); + t.eq(sld.namedLayers[0].userStyles[0].rules[0].symbolizers[1].graphic, false, "graphic set to false on TextSymbolizer"); + } + function test_roundtrip(t) { t.plan(5);