Style constructor accepts a rules array. These rules will be added to the style. r=ahocevar (closes #1964)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@8975 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2009-03-09 22:26:05 +00:00
parent a10b319413
commit 1ed1584320
2 changed files with 41 additions and 10 deletions

View File

@@ -85,21 +85,29 @@ OpenLayers.Style = OpenLayers.Class({
* used as default style for this style object. This style
* applies if no rules are specified. Symbolizers defined in
* rules will extend this default style.
* options - {Object} An optional object with properties to set on the
* userStyle
* options - {Object} An optional object with properties to set on the
* style.
*
* Valid options:
* rules - {Array(<OpenLayers.Rule>)} List of rules to be added to the
* style.
*
* Return:
* {<OpenLayers.Style>}
*/
initialize: function(style, options) {
OpenLayers.Util.extend(this, options);
this.rules = [];
if(options && options.rules) {
this.addRules(options.rules);
}
// use the default style from OpenLayers.Feature.Vector if no style
// was given in the constructor
this.setDefaultStyle(style ||
OpenLayers.Feature.Vector.style["default"]);
OpenLayers.Util.extend(this, options);
this.setDefaultStyle(style ||
OpenLayers.Feature.Vector.style["default"]);
},
/**