Use opt_this instead of opt_obj in ol.source.Vector

This commit is contained in:
Tom Payne
2014-01-15 15:01:58 +01:00
parent 1df516e14d
commit 651bdcbd73
+9 -9
View File
@@ -140,30 +140,30 @@ ol.source.Vector.prototype.clear = function() {
/** /**
* @param {function(this: T, ol.Feature): S} f Callback. * @param {function(this: T, ol.Feature): S} f Callback.
* @param {T=} opt_obj The object to be used as the value of 'this' within f. * @param {T=} opt_this The object to use as `this` in `f`.
* @return {S|undefined} * @return {S|undefined}
* @template T,S * @template T,S
*/ */
ol.source.Vector.prototype.forEachFeature = function(f, opt_obj) { ol.source.Vector.prototype.forEachFeature = function(f, opt_this) {
return this.rBush_.forEach(f, opt_obj); return this.rBush_.forEach(f, opt_this);
}; };
/** /**
* @param {ol.Coordinate} coordinate Coordinate. * @param {ol.Coordinate} coordinate Coordinate.
* @param {function(this: T, ol.Feature): S} f Callback. * @param {function(this: T, ol.Feature): S} f Callback.
* @param {T=} opt_obj The object to be used as the value of 'this' within f. * @param {T=} opt_this The object to use as `this` in `f`.
* @return {S|undefined} * @return {S|undefined}
* @template T,S * @template T,S
*/ */
ol.source.Vector.prototype.forEachFeatureAtCoordinate = ol.source.Vector.prototype.forEachFeatureAtCoordinate =
function(coordinate, f, opt_obj) { function(coordinate, f, opt_this) {
var extent = [coordinate[0], coordinate[1], coordinate[0], coordinate[1]]; var extent = [coordinate[0], coordinate[1], coordinate[0], coordinate[1]];
return this.forEachFeatureInExtent(extent, function(feature) { return this.forEachFeatureInExtent(extent, function(feature) {
var geometry = feature.getGeometry(); var geometry = feature.getGeometry();
goog.asserts.assert(!goog.isNull(geometry)); goog.asserts.assert(!goog.isNull(geometry));
if (geometry.containsCoordinate(coordinate)) { if (geometry.containsCoordinate(coordinate)) {
return f.call(opt_obj, feature); return f.call(opt_this, feature);
} else { } else {
return undefined; return undefined;
} }
@@ -174,13 +174,13 @@ ol.source.Vector.prototype.forEachFeatureAtCoordinate =
/** /**
* @param {ol.Extent} extent Extent. * @param {ol.Extent} extent Extent.
* @param {function(this: T, ol.Feature): S} f Callback. * @param {function(this: T, ol.Feature): S} f Callback.
* @param {T=} opt_obj The object to be used as the value of 'this' within f. * @param {T=} opt_this The object to use as `this` in `f`.
* @return {S|undefined} * @return {S|undefined}
* @template T,S * @template T,S
*/ */
ol.source.Vector.prototype.forEachFeatureInExtent = ol.source.Vector.prototype.forEachFeatureInExtent =
function(extent, f, opt_obj) { function(extent, f, opt_this) {
return this.rBush_.forEachInExtent(extent, f, opt_obj); return this.rBush_.forEachInExtent(extent, f, opt_this);
}; };