Use opt_this instead of opt_obj in ol.renderer.Layer

This commit is contained in:
Tom Payne
2014-01-15 15:00:34 +01:00
parent 010f643f8f
commit 1df516e14d
5 changed files with 12 additions and 12 deletions

View File

@@ -45,7 +45,7 @@ goog.inherits(ol.renderer.canvas.ImageLayer, ol.renderer.canvas.Layer);
* @inheritDoc * @inheritDoc
*/ */
ol.renderer.canvas.ImageLayer.prototype.forEachFeatureAtPixel = ol.renderer.canvas.ImageLayer.prototype.forEachFeatureAtPixel =
function(coordinate, frameState, callback, opt_obj) { function(coordinate, frameState, callback, opt_this) {
var layer = this.getLayer(); var layer = this.getLayer();
var source = layer.getSource(); var source = layer.getSource();
goog.asserts.assertInstanceof(source, ol.source.Image); goog.asserts.assertInstanceof(source, ol.source.Image);
@@ -58,7 +58,7 @@ ol.renderer.canvas.ImageLayer.prototype.forEachFeatureAtPixel =
* @return {?} Callback result. * @return {?} Callback result.
*/ */
function(feature) { function(feature) {
return callback.call(opt_obj, feature, this); return callback.call(opt_this, feature, this);
}); });
}; };

View File

@@ -89,7 +89,7 @@ ol.renderer.canvas.VectorLayer.prototype.composeFrame =
* @inheritDoc * @inheritDoc
*/ */
ol.renderer.canvas.VectorLayer.prototype.forEachFeatureAtPixel = ol.renderer.canvas.VectorLayer.prototype.forEachFeatureAtPixel =
function(coordinate, frameState, callback, opt_obj) { function(coordinate, frameState, callback, opt_this) {
if (goog.isNull(this.replayGroup_)) { if (goog.isNull(this.replayGroup_)) {
return undefined; return undefined;
} else { } else {
@@ -109,7 +109,7 @@ ol.renderer.canvas.VectorLayer.prototype.forEachFeatureAtPixel =
function(geometry, data) { function(geometry, data) {
var feature = /** @type {ol.Feature} */ (data); var feature = /** @type {ol.Feature} */ (data);
goog.asserts.assert(goog.isDef(feature)); goog.asserts.assert(goog.isDef(feature));
return callback.call(opt_obj, feature, layer); return callback.call(opt_this, feature, layer);
}); });
} }
}; };

View File

@@ -50,7 +50,7 @@ goog.inherits(ol.renderer.dom.ImageLayer, ol.renderer.dom.Layer);
* @inheritDoc * @inheritDoc
*/ */
ol.renderer.dom.ImageLayer.prototype.forEachFeatureAtPixel = ol.renderer.dom.ImageLayer.prototype.forEachFeatureAtPixel =
function(coordinate, frameState, callback, opt_obj) { function(coordinate, frameState, callback, opt_this) {
var layer = this.getLayer(); var layer = this.getLayer();
var source = layer.getSource(); var source = layer.getSource();
goog.asserts.assertInstanceof(source, ol.source.Image); goog.asserts.assertInstanceof(source, ol.source.Image);
@@ -63,7 +63,7 @@ ol.renderer.dom.ImageLayer.prototype.forEachFeatureAtPixel =
* @return {?} Callback result. * @return {?} Callback result.
*/ */
function(feature) { function(feature) {
return callback.call(opt_obj, feature, this); return callback.call(opt_this, feature, this);
}); });
}; };

View File

@@ -49,7 +49,7 @@ goog.inherits(ol.renderer.Layer, goog.Disposable);
* @param {ol.FrameState} frameState Frame state. * @param {ol.FrameState} frameState Frame state.
* @param {function(this: S, ol.Feature, ol.layer.Layer): T} callback Feature * @param {function(this: S, ol.Feature, ol.layer.Layer): T} callback Feature
* callback. * callback.
* @param {S=} opt_obj Scope. * @param {S=} opt_this Object to use as `this` in `callback`.
* @return {T|undefined} Callback result. * @return {T|undefined} Callback result.
* @template S,T * @template S,T
*/ */
@@ -249,13 +249,13 @@ ol.renderer.Layer.prototype.snapCenterToPixel =
* @param {number} currentZ Current Z. * @param {number} currentZ Current Z.
* @param {number} preload Load low resolution tiles up to 'preload' levels. * @param {number} preload Load low resolution tiles up to 'preload' levels.
* @param {function(this: T, ol.Tile)=} opt_tileCallback Tile callback. * @param {function(this: T, ol.Tile)=} opt_tileCallback Tile callback.
* @param {T=} opt_obj Object. * @param {T=} opt_this Object to use as `this` in `opt_tileCallback`.
* @protected * @protected
* @template T * @template T
*/ */
ol.renderer.Layer.prototype.manageTilePyramid = function( ol.renderer.Layer.prototype.manageTilePyramid = function(
frameState, tileSource, tileGrid, projection, extent, currentZ, preload, frameState, tileSource, tileGrid, projection, extent, currentZ, preload,
opt_tileCallback, opt_obj) { opt_tileCallback, opt_this) {
var tileSourceKey = goog.getUid(tileSource).toString(); var tileSourceKey = goog.getUid(tileSource).toString();
if (!(tileSourceKey in frameState.wantedTiles)) { if (!(tileSourceKey in frameState.wantedTiles)) {
frameState.wantedTiles[tileSourceKey] = {}; frameState.wantedTiles[tileSourceKey] = {};
@@ -279,7 +279,7 @@ ol.renderer.Layer.prototype.manageTilePyramid = function(
} }
} }
if (goog.isDef(opt_tileCallback)) { if (goog.isDef(opt_tileCallback)) {
opt_tileCallback.call(opt_obj, tile); opt_tileCallback.call(opt_this, tile);
} }
} else { } else {
tileSource.useTile(z, x, y); tileSource.useTile(z, x, y);

View File

@@ -76,7 +76,7 @@ ol.renderer.webgl.ImageLayer.prototype.createTexture_ = function(image) {
* @inheritDoc * @inheritDoc
*/ */
ol.renderer.webgl.ImageLayer.prototype.forEachFeatureAtPixel = ol.renderer.webgl.ImageLayer.prototype.forEachFeatureAtPixel =
function(coordinate, frameState, callback, opt_obj) { function(coordinate, frameState, callback, opt_this) {
var layer = this.getLayer(); var layer = this.getLayer();
var source = layer.getSource(); var source = layer.getSource();
goog.asserts.assertInstanceof(source, ol.source.Image); goog.asserts.assertInstanceof(source, ol.source.Image);
@@ -89,7 +89,7 @@ ol.renderer.webgl.ImageLayer.prototype.forEachFeatureAtPixel =
* @return {?} Callback result. * @return {?} Callback result.
*/ */
function(feature) { function(feature) {
return callback.call(opt_obj, feature, this); return callback.call(opt_this, feature, this);
}); });
}; };