Merge pull request #9197 from fredj/cleanup
Remove unused opt_this param
This commit is contained in:
@@ -11,21 +11,19 @@
|
|||||||
* @param {number} offset Offset.
|
* @param {number} offset Offset.
|
||||||
* @param {number} end End.
|
* @param {number} end End.
|
||||||
* @param {number} stride Stride.
|
* @param {number} stride Stride.
|
||||||
* @param {function(this: S, import("../../coordinate.js").Coordinate, import("../../coordinate.js").Coordinate): T} callback Function
|
* @param {function(import("../../coordinate.js").Coordinate, import("../../coordinate.js").Coordinate): T} callback Function
|
||||||
* called for each segment.
|
* called for each segment.
|
||||||
* @param {S=} opt_this The object to be used as the value of 'this'
|
|
||||||
* within callback.
|
|
||||||
* @return {T|boolean} Value.
|
* @return {T|boolean} Value.
|
||||||
* @template T,S
|
* @template T
|
||||||
*/
|
*/
|
||||||
export function forEach(flatCoordinates, offset, end, stride, callback, opt_this) {
|
export function forEach(flatCoordinates, offset, end, stride, callback) {
|
||||||
const point1 = [flatCoordinates[offset], flatCoordinates[offset + 1]];
|
const point1 = [flatCoordinates[offset], flatCoordinates[offset + 1]];
|
||||||
const point2 = [];
|
const point2 = [];
|
||||||
let ret;
|
let ret;
|
||||||
for (; (offset + stride) < end; offset += stride) {
|
for (; (offset + stride) < end; offset += stride) {
|
||||||
point2[0] = flatCoordinates[offset + stride];
|
point2[0] = flatCoordinates[offset + stride];
|
||||||
point2[1] = flatCoordinates[offset + stride + 1];
|
point2[1] = flatCoordinates[offset + stride + 1];
|
||||||
ret = callback.call(opt_this, point1, point2);
|
ret = callback(point1, point2);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -221,10 +221,8 @@ class LayerRenderer extends Observable {
|
|||||||
* @param {import("../extent.js").Extent} extent Extent.
|
* @param {import("../extent.js").Extent} extent Extent.
|
||||||
* @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, import("../Tile.js").default)=} opt_tileCallback Tile callback.
|
* @param {function(import("../Tile.js").default)=} opt_tileCallback Tile callback.
|
||||||
* @param {T=} opt_this Object to use as `this` in `opt_tileCallback`.
|
|
||||||
* @protected
|
* @protected
|
||||||
* @template T
|
|
||||||
*/
|
*/
|
||||||
manageTilePyramid(
|
manageTilePyramid(
|
||||||
frameState,
|
frameState,
|
||||||
@@ -235,8 +233,7 @@ class LayerRenderer extends Observable {
|
|||||||
extent,
|
extent,
|
||||||
currentZ,
|
currentZ,
|
||||||
preload,
|
preload,
|
||||||
opt_tileCallback,
|
opt_tileCallback
|
||||||
opt_this
|
|
||||||
) {
|
) {
|
||||||
const tileSourceKey = getUid(tileSource);
|
const tileSourceKey = getUid(tileSource);
|
||||||
if (!(tileSourceKey in frameState.wantedTiles)) {
|
if (!(tileSourceKey in frameState.wantedTiles)) {
|
||||||
@@ -261,7 +258,7 @@ class LayerRenderer extends Observable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (opt_tileCallback !== undefined) {
|
if (opt_tileCallback !== undefined) {
|
||||||
opt_tileCallback.call(opt_this, tile);
|
opt_tileCallback(tile);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tileSource.useTile(z, x, y, projection);
|
tileSource.useTile(z, x, y, projection);
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer {
|
|||||||
covered = findLoadedTiles(z + 1, childTileRange);
|
covered = findLoadedTiles(z + 1, childTileRange);
|
||||||
}
|
}
|
||||||
if (!covered) {
|
if (!covered) {
|
||||||
tileGrid.forEachTileCoordParentTileRange(tile.tileCoord, findLoadedTiles, null, tmpTileRange, tmpExtent);
|
tileGrid.forEachTileCoordParentTileRange(tile.tileCoord, findLoadedTiles, tmpTileRange, tmpExtent);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,25 +138,23 @@ export class CustomTile extends Tile {
|
|||||||
* Calls the callback (synchronously by default) with the available data
|
* Calls the callback (synchronously by default) with the available data
|
||||||
* for given coordinate (or `null` if not yet loaded).
|
* for given coordinate (or `null` if not yet loaded).
|
||||||
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
|
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
|
||||||
* @param {function(this: T, *): void} callback Callback.
|
* @param {function(*): void} callback Callback.
|
||||||
* @param {T=} opt_this The object to use as `this` in the callback.
|
|
||||||
* @param {boolean=} opt_request If `true` the callback is always async.
|
* @param {boolean=} opt_request If `true` the callback is always async.
|
||||||
* The tile data is requested if not yet loaded.
|
* The tile data is requested if not yet loaded.
|
||||||
* @template T
|
|
||||||
*/
|
*/
|
||||||
forDataAtCoordinate(coordinate, callback, opt_this, opt_request) {
|
forDataAtCoordinate(coordinate, callback, opt_request) {
|
||||||
if (this.state == TileState.IDLE && opt_request === true) {
|
if (this.state == TileState.IDLE && opt_request === true) {
|
||||||
listenOnce(this, EventType.CHANGE, function(e) {
|
listenOnce(this, EventType.CHANGE, function(e) {
|
||||||
callback.call(opt_this, this.getData(coordinate));
|
callback(this.getData(coordinate));
|
||||||
}, this);
|
}, this);
|
||||||
this.loadInternal_();
|
this.loadInternal_();
|
||||||
} else {
|
} else {
|
||||||
if (opt_request === true) {
|
if (opt_request === true) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
callback.call(opt_this, this.getData(coordinate));
|
callback(this.getData(coordinate));
|
||||||
}.bind(this), 0);
|
}.bind(this), 0);
|
||||||
} else {
|
} else {
|
||||||
callback.call(opt_this, this.getData(coordinate));
|
callback(this.getData(coordinate));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -391,7 +389,7 @@ class UTFGrid extends TileSource {
|
|||||||
coordinate, resolution);
|
coordinate, resolution);
|
||||||
const tile = /** @type {!CustomTile} */(this.getTile(
|
const tile = /** @type {!CustomTile} */(this.getTile(
|
||||||
tileCoord[0], tileCoord[1], tileCoord[2], 1, this.getProjection()));
|
tileCoord[0], tileCoord[1], tileCoord[2], 1, this.getProjection()));
|
||||||
tile.forDataAtCoordinate(coordinate, callback, null, opt_request);
|
tile.forDataAtCoordinate(coordinate, callback, opt_request);
|
||||||
} else {
|
} else {
|
||||||
if (opt_request === true) {
|
if (opt_request === true) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
|
|||||||
@@ -203,14 +203,12 @@ class TileGrid {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
* @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
||||||
* @param {function(this: T, number, import("../TileRange.js").default): boolean} callback Callback.
|
* @param {function(number, import("../TileRange.js").default): boolean} callback Callback.
|
||||||
* @param {T=} opt_this The object to use as `this` in `callback`.
|
|
||||||
* @param {import("../TileRange.js").default=} opt_tileRange Temporary import("../TileRange.js").default object.
|
* @param {import("../TileRange.js").default=} opt_tileRange Temporary import("../TileRange.js").default object.
|
||||||
* @param {import("../extent.js").Extent=} opt_extent Temporary import("../extent.js").Extent object.
|
* @param {import("../extent.js").Extent=} opt_extent Temporary import("../extent.js").Extent object.
|
||||||
* @return {boolean} Callback succeeded.
|
* @return {boolean} Callback succeeded.
|
||||||
* @template T
|
|
||||||
*/
|
*/
|
||||||
forEachTileCoordParentTileRange(tileCoord, callback, opt_this, opt_tileRange, opt_extent) {
|
forEachTileCoordParentTileRange(tileCoord, callback, opt_tileRange, opt_extent) {
|
||||||
let tileRange, x, y;
|
let tileRange, x, y;
|
||||||
let tileCoordExtent = null;
|
let tileCoordExtent = null;
|
||||||
let z = tileCoord[0] - 1;
|
let z = tileCoord[0] - 1;
|
||||||
@@ -228,7 +226,7 @@ class TileGrid {
|
|||||||
} else {
|
} else {
|
||||||
tileRange = this.getTileRangeForExtentAndZ(tileCoordExtent, z, opt_tileRange);
|
tileRange = this.getTileRangeForExtentAndZ(tileCoordExtent, z, opt_tileRange);
|
||||||
}
|
}
|
||||||
if (callback.call(opt_this, z, tileRange)) {
|
if (callback(z, tileRange)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
--z;
|
--z;
|
||||||
|
|||||||
Reference in New Issue
Block a user