diff --git a/src/ol/source/vectorsource.exports b/src/ol/source/vectorsource.exports index 7312bcf87a..04850fda13 100644 --- a/src/ol/source/vectorsource.exports +++ b/src/ol/source/vectorsource.exports @@ -1,3 +1,4 @@ @exportClass ol.source.Vector ol.source.VectorOptions @exportProperty ol.source.Vector.prototype.addFeature +@exportProperty ol.source.Vector.prototype.forEachFeature @exportProperty ol.source.Vector.prototype.getAllFeaturesAtCoordinate diff --git a/src/ol/source/vectorsource.js b/src/ol/source/vectorsource.js index b9039d16aa..037c420b66 100644 --- a/src/ol/source/vectorsource.js +++ b/src/ol/source/vectorsource.js @@ -68,6 +68,17 @@ ol.source.Vector.prototype.addFeature = function(feature) { }; +/** + * @param {function(this: T, ol.Feature): S} f Callback. + * @param {T=} opt_obj The object to be used a the value of 'this' within f. + * @return {S|undefined} + * @template T,S + */ +ol.source.Vector.prototype.forEachFeature = function(f, opt_obj) { + return this.rBush_.forEach(f, opt_obj); +}; + + /** * @param {ol.Coordinate} coordinate Coordinate. * @param {function(this: T, ol.Feature): S} f Callback.