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
This commit is contained in:
ahocevar
2009-04-06 23:08:08 +00:00
parent a685884a4f
commit f59eceef71
2 changed files with 5 additions and 3 deletions

View File

@@ -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) {

View File

@@ -125,7 +125,7 @@
'</StyledLayerDescriptor>';
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");