From a3b43f21e4f39320c15e5130469f55aa14c4aec7 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Wed, 27 Nov 2013 12:09:50 +0100 Subject: [PATCH] Add ol.source.Vector#forEachFeature function --- src/ol/source/vectorsource.exports | 1 + src/ol/source/vectorsource.js | 11 +++++++++++ 2 files changed, 12 insertions(+) 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.