propertyStyles of a Style's default symbolizer will not be parsed unless rules are specified. r=tschaub (closes #1432)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@6505 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2008-03-12 16:42:16 +00:00
parent 0768fa4d27
commit 7a25a14f93
2 changed files with 13 additions and 11 deletions

View File

@@ -115,7 +115,8 @@ OpenLayers.Style = OpenLayers.Class({
* {Object} symbolizer hash
*/
createSymbolizer: function(feature) {
var style = OpenLayers.Util.extend({}, this.defaultStyle);
var style = this.createLiterals(
OpenLayers.Util.extend({}, this.defaultStyle), feature);
var rules = this.rules;
@@ -173,11 +174,9 @@ OpenLayers.Style = OpenLayers.Class({
var symbolizer = rule.symbolizer[symbolizerPrefix] || rule.symbolizer;
var context = this.context || feature.attributes || feature.data;
// merge the style with the current style
return this.createLiterals(
OpenLayers.Util.extend(style, symbolizer), context);
OpenLayers.Util.extend(style, symbolizer), feature);
},
/**
@@ -188,14 +187,14 @@ OpenLayers.Style = OpenLayers.Class({
* Parameters:
* style - {Object} style to create literals for. Will be modified
* inline.
* context - {Object} context to take property values from. Defaults to
* feature.attributes (or feature.data, if attributes are not
* available)
* feature - {Object}
*
* Returns:
* {Object} the modified style
*/
createLiterals: function(style, context) {
createLiterals: function(style, feature) {
var context = this.context || feature.attributes || feature.data;
for (var i in this.propertyStyles) {
style[i] = OpenLayers.Style.createLiteral(style[i], context);
}