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:
@@ -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,
|
* Returns an array of features that match a filter. This will not fetch data,
|
||||||
* it only considers features that are loaded already.
|
* it only considers features that are loaded already.
|
||||||
|
|||||||
Reference in New Issue
Block a user