From f59eceef715f4c7c983d59346cd9724f0c192071 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Mon, 6 Apr 2009 23:08:08 +0000 Subject: [PATCH] create UserStyle in a way that propertyNames cache will be generated. Thanks sonicx for catching this. r=tschaub (closes #2000) r=tschaub git-svn-id: http://svn.openlayers.org/trunk/openlayers@9223 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Format/SLD/v1.js | 5 +++-- tests/Format/SLD/v1_0_0.html | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/OpenLayers/Format/SLD/v1.js b/lib/OpenLayers/Format/SLD/v1.js index 34da8bc90e..9bfe6dcb91 100644 --- a/lib/OpenLayers/Format/SLD/v1.js +++ b/lib/OpenLayers/Format/SLD/v1.js @@ -137,8 +137,9 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, { ); }, "UserStyle": function(node, layer) { - var style = new OpenLayers.Style(this.defaultSymbolizer); - this.readChildNodes(node, style); + var obj = {rules: []}; + this.readChildNodes(node, obj); + var style = new OpenLayers.Style(this.defaultSymbolizer, obj); layer.userStyles.push(style); }, "IsDefault": function(node, style) { diff --git a/tests/Format/SLD/v1_0_0.html b/tests/Format/SLD/v1_0_0.html index 50a5656818..4bd22773d9 100644 --- a/tests/Format/SLD/v1_0_0.html +++ b/tests/Format/SLD/v1_0_0.html @@ -125,7 +125,7 @@ ''; function test_read(t) { - t.plan(21); + t.plan(22); var xml = new OpenLayers.Format.XML(); var sldxml = xml.read(sld); @@ -169,6 +169,7 @@ t.eq(poly.strokeColor, "#000000", "(AAA161) first rule has proper stroke"); var text = symbolizer["Text"]; t.eq(text.label, "${FOO}", "(AAA161) first rule has proper text label"); + t.eq(layer.userStyles[0].propertyStyles["label"], true, "label added to propertyStyles"); t.eq(text.fontFamily, "Arial", "(AAA161) first rule has proper font family"); t.eq(text.fillColor, "#000000", "(AAA161) first rule has proper text fill"); t.eq(text.haloRadius, "3", "(AAA161) first rule has proper halo radius");