Make tile keys stable to avoid TileQueue confusion
This commit is contained in:
@@ -93,11 +93,6 @@ class VectorImageTile extends Tile {
|
||||
*/
|
||||
this.extent = null;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
this.sourceRevision_ = sourceRevision;
|
||||
|
||||
/**
|
||||
* @type {import("./tilecoord.js").TileCoord}
|
||||
*/
|
||||
@@ -118,6 +113,8 @@ class VectorImageTile extends Tile {
|
||||
*/
|
||||
this.sourceTileListenerKeys_ = [];
|
||||
|
||||
this.key = sourceRevision.toString();
|
||||
|
||||
if (urlTileCoord && sourceTileGrid) {
|
||||
const extent = this.extent = tileGrid.getTileCoordExtent(urlTileCoord);
|
||||
const resolution = this.resolution_ = tileGrid.getResolution(urlTileCoord[0]);
|
||||
@@ -233,7 +230,7 @@ class VectorImageTile extends Tile {
|
||||
for (let i = 0, ii = tileKeys.length; i < ii; ++i) {
|
||||
this.sourceTiles_[tileKeys[i]].consumers++;
|
||||
}
|
||||
const tile = new VectorImageTile(this.tileCoord, TileState.IDLE, undefined, null, null,
|
||||
const tile = new VectorImageTile(this.tileCoord, TileState.IDLE, Number(this.key), null, null,
|
||||
this.wrappedTileCoord, null, null, null, this.sourceTiles_,
|
||||
undefined, null, null, null);
|
||||
tile.extent = this.extent;
|
||||
@@ -269,13 +266,6 @@ class VectorImageTile extends Tile {
|
||||
return this.replayState_[key];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
getKey() {
|
||||
return this.tileKeys.join('/') + '-' + this.sourceRevision_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} tileKey Key (tileCoord) of the source tile.
|
||||
* @return {import("./VectorTile.js").default} Source tile.
|
||||
|
||||
@@ -245,7 +245,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
|
||||
sourceTile.getImage = function() {
|
||||
return document.createElement('canvas');
|
||||
};
|
||||
const tile = new VectorImageTile([0, 0, 0], undefined, undefined, undefined,
|
||||
const tile = new VectorImageTile([0, 0, 0], undefined, 1, undefined,
|
||||
undefined, [0, 0, 0], undefined, createXYZ(), createXYZ(), {'0,0,0': sourceTile}, undefined,
|
||||
undefined, undefined, undefined);
|
||||
tile.transition_ = 0;
|
||||
@@ -338,7 +338,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
|
||||
}
|
||||
};
|
||||
frameState.layerStates[getUid(layer)] = {};
|
||||
renderer.renderedTiles = [new TileClass([0, 0, -1])];
|
||||
renderer.renderedTiles = [new TileClass([0, 0, -1], undefined, 1)];
|
||||
renderer.forEachFeatureAtCoordinate(
|
||||
coordinate, frameState, 0, spy, undefined);
|
||||
expect(spy.callCount).to.be(1);
|
||||
|
||||
Reference in New Issue
Block a user