diff --git a/src/ol/featureoverlay.exports b/src/ol/featureoverlay.exports index 120ff391d2..cf40b7937a 100644 --- a/src/ol/featureoverlay.exports +++ b/src/ol/featureoverlay.exports @@ -3,5 +3,5 @@ @exportProperty ol.FeatureOverlay.prototype.getFeatures @exportProperty ol.FeatureOverlay.prototype.setFeatures @exportProperty ol.FeatureOverlay.prototype.setMap -@exportProperty ol.FeatureOverlay.prototype.setStyleFunction +@exportProperty ol.FeatureOverlay.prototype.setStyle @exportProperty ol.FeatureOverlay.prototype.removeFeature diff --git a/src/ol/featureoverlay.js b/src/ol/featureoverlay.js index 50987b3a4b..6d9ac8863e 100644 --- a/src/ol/featureoverlay.js +++ b/src/ol/featureoverlay.js @@ -52,6 +52,12 @@ ol.FeatureOverlay = function(opt_options) { */ this.postComposeListenerKey_ = null; + /** + * @private + * @type {ol.style.Style|Array.|ol.feature.StyleFunction} + */ + this.style_ = null; + /** * @private * @type {ol.feature.StyleFunction|undefined} @@ -235,15 +241,26 @@ ol.FeatureOverlay.prototype.setMap = function(map) { /** - * @param {ol.feature.StyleFunction} styleFunction Style function. + * @param {ol.style.Style|Array.|ol.feature.StyleFunction} style + * Overlay style. * @todo stability experimental */ -ol.FeatureOverlay.prototype.setStyleFunction = function(styleFunction) { - this.styleFunction_ = styleFunction; +ol.FeatureOverlay.prototype.setStyle = function(style) { + this.style_ = style; + this.styleFunction_ = ol.feature.createStyleFunction(style); this.requestRenderFrame_(); }; +/** + * @return {ol.style.Style|Array.|ol.feature.StyleFunction} + * Overlay style. + */ +ol.FeatureOverlay.prototype.getStyle = function() { + return this.style_; +}; + + /** * @return {ol.feature.StyleFunction|undefined} Style function. */