Maintain an extent array for reuse

This commit is contained in:
Tim Schaub
2021-02-10 18:04:27 -07:00
parent 98ac74e0bf
commit 79330e2aeb
+10 -1
View File
@@ -180,6 +180,12 @@ class TileGrid {
*/ */
this.tmpSize_ = [0, 0]; this.tmpSize_ = [0, 0];
/**
* @private
* @type {import("../extent.js").Extent}
*/
this.tmpExtent_ = [0, 0, 0, 0];
if (options.sizes !== undefined) { if (options.sizes !== undefined) {
this.fullTileRanges_ = options.sizes.map(function (size, z) { this.fullTileRanges_ = options.sizes.map(function (size, z) {
const tileRange = new TileRange( const tileRange = new TileRange(
@@ -340,7 +346,10 @@ class TileGrid {
opt_tileRange opt_tileRange
); );
} }
const tileCoordExtent = this.getTileCoordExtent(tileCoord, opt_extent); const tileCoordExtent = this.getTileCoordExtent(
tileCoord,
opt_extent || this.tmpExtent_
);
return this.getTileRangeForExtentAndZ( return this.getTileRangeForExtentAndZ(
tileCoordExtent, tileCoordExtent,
tileCoord[0] + 1, tileCoord[0] + 1,