Allow to set the layer style

By firing a simple CHANGE event, we can redraw the layer when
a style is assigned.
This commit is contained in:
ahocevar
2013-11-12 01:47:43 +01:00
parent 15053cbe56
commit 1d23229d98

View File

@@ -261,6 +261,17 @@ ol.layer.Vector.prototype.getStyle = function() {
};
/**
* Set a style for this layer.
* @param {ol.style.Style} style Style.
*/
ol.layer.Vector.prototype.setStyle = function(style) {
this.style_ = style;
this.dispatchEvent(
new ol.layer.VectorEvent(ol.layer.VectorEventType.CHANGE, [], []));
};
/**
* Returns an array of features that match a filter. This will not fetch data,
* it only considers features that are loaded already.