Rename getTileZXY to getTile

This commit is contained in:
Tom Payne
2013-03-25 10:10:03 +01:00
parent dfb631a08f
commit 65e6ed3485
8 changed files with 20 additions and 20 deletions

View File

@@ -159,7 +159,7 @@ ol.renderer.canvas.TileLayer.prototype.renderFrame =
for (x = tileRange.minX; x <= tileRange.maxX; ++x) { for (x = tileRange.minX; x <= tileRange.maxX; ++x) {
for (y = tileRange.minY; y <= tileRange.maxY; ++y) { for (y = tileRange.minY; y <= tileRange.maxY; ++y) {
tile = tileSource.getTileZXY(z, x, y, tileGrid, projection); tile = tileSource.getTile(z, x, y, tileGrid, projection);
tileState = tile.getState(); tileState = tile.getState();
if (tileState == ol.TileState.LOADED || tileState == ol.TileState.EMPTY) { if (tileState == ol.TileState.LOADED || tileState == ol.TileState.EMPTY) {
tilesToDrawByZ[z][tile.tileCoord.toString()] = tile; tilesToDrawByZ[z][tile.tileCoord.toString()] = tile;

View File

@@ -116,7 +116,7 @@ ol.renderer.dom.TileLayer.prototype.renderFrame =
for (x = tileRange.minX; x <= tileRange.maxX; ++x) { for (x = tileRange.minX; x <= tileRange.maxX; ++x) {
for (y = tileRange.minY; y <= tileRange.maxY; ++y) { for (y = tileRange.minY; y <= tileRange.maxY; ++y) {
tile = tileSource.getTileZXY(z, x, y, tileGrid, projection); tile = tileSource.getTile(z, x, y, tileGrid, projection);
tileState = tile.getState(); tileState = tile.getState();
if (tileState == ol.TileState.LOADED) { if (tileState == ol.TileState.LOADED) {
tilesToDrawByZ[z][tile.tileCoord.toString()] = tile; tilesToDrawByZ[z][tile.tileCoord.toString()] = tile;

View File

@@ -263,7 +263,7 @@ ol.renderer.Layer.prototype.updateUsedTiles =
ol.renderer.Layer.prototype.createGetTileIfLoadedFunction = ol.renderer.Layer.prototype.createGetTileIfLoadedFunction =
function(isLoadedFunction, tileSource, tileGrid, projection) { function(isLoadedFunction, tileSource, tileGrid, projection) {
return function(z, x, y) { return function(z, x, y) {
var tile = tileSource.getTileZXY(z, x, y, tileGrid, projection); var tile = tileSource.getTile(z, x, y, tileGrid, projection);
return isLoadedFunction(tile) ? tile : null; return isLoadedFunction(tile) ? tile : null;
}; };
}; };
@@ -315,7 +315,7 @@ ol.renderer.Layer.prototype.manageTilePyramid =
for (x = tileRange.minX; x <= tileRange.maxX; ++x) { for (x = tileRange.minX; x <= tileRange.maxX; ++x) {
for (y = tileRange.minY; y <= tileRange.maxY; ++y) { for (y = tileRange.minY; y <= tileRange.maxY; ++y) {
if (ol.PREEMPTIVELY_LOAD_LOW_RESOLUTION_TILES || z == currentZ) { if (ol.PREEMPTIVELY_LOAD_LOW_RESOLUTION_TILES || z == currentZ) {
tile = tileSource.getTileZXY(z, x, y, tileGrid, projection); tile = tileSource.getTile(z, x, y, tileGrid, projection);
if (tile.getState() == ol.TileState.IDLE) { if (tile.getState() == ol.TileState.IDLE) {
tileCenter = tileGrid.getTileCoordCenter(tile.tileCoord); tileCenter = tileGrid.getTileCoordCenter(tile.tileCoord);
wantedTiles[tile.tileCoord.toString()] = true; wantedTiles[tile.tileCoord.toString()] = true;

View File

@@ -267,7 +267,7 @@ ol.renderer.webgl.TileLayer.prototype.renderFrame =
for (x = tileRange.minX; x <= tileRange.maxX; ++x) { for (x = tileRange.minX; x <= tileRange.maxX; ++x) {
for (y = tileRange.minY; y <= tileRange.maxY; ++y) { for (y = tileRange.minY; y <= tileRange.maxY; ++y) {
tile = tileSource.getTileZXY(z, x, y, tileGrid, projection); tile = tileSource.getTile(z, x, y, tileGrid, projection);
tileState = tile.getState(); tileState = tile.getState();
if (tileState == ol.TileState.LOADED) { if (tileState == ol.TileState.LOADED) {
if (mapRenderer.isTileTextureLoaded(tile)) { if (mapRenderer.isTileTextureLoaded(tile)) {

View File

@@ -122,7 +122,7 @@ ol.source.DebugTileSource.prototype.expireCache = function(usedTiles) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
ol.source.DebugTileSource.prototype.getTileZXY = function(z, x, y) { ol.source.DebugTileSource.prototype.getTile = function(z, x, y) {
var tileCoordKey = ol.TileCoord.getKeyZXY(z, x, y); var tileCoordKey = ol.TileCoord.getKeyZXY(z, x, y);
if (this.tileCache_.containsKey(tileCoordKey)) { if (this.tileCache_.containsKey(tileCoordKey)) {
return /** @type {!ol.DebugTile_} */ (this.tileCache_.get(tileCoordKey)); return /** @type {!ol.DebugTile_} */ (this.tileCache_.get(tileCoordKey));

View File

@@ -87,7 +87,7 @@ ol.source.ImageTileSource.prototype.expireCache = function(usedTiles) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
ol.source.ImageTileSource.prototype.getTileZXY = ol.source.ImageTileSource.prototype.getTile =
function(z, x, y, tileGrid, projection) { function(z, x, y, tileGrid, projection) {
var tileCoordKey = ol.TileCoord.getKeyZXY(z, x, y); var tileCoordKey = ol.TileCoord.getKeyZXY(z, x, y);
if (this.tileCache_.containsKey(tileCoordKey)) { if (this.tileCache_.containsKey(tileCoordKey)) {

View File

@@ -128,7 +128,7 @@ ol.source.TileSource.prototype.getResolutions = function() {
* @param {ol.Projection=} opt_projection Projection. * @param {ol.Projection=} opt_projection Projection.
* @return {!ol.Tile} Tile. * @return {!ol.Tile} Tile.
*/ */
ol.source.TileSource.prototype.getTileZXY = goog.abstractMethod; ol.source.TileSource.prototype.getTile = goog.abstractMethod;
/** /**

View File

@@ -23,7 +23,7 @@ describe('ol.source.TileSource', function() {
var range = grid.getTileRangeForExtentAndZ(source.getExtent(), 3); var range = grid.getTileRangeForExtentAndZ(source.getExtent(), 3);
function getTileIfLoaded(z, x, y) { function getTileIfLoaded(z, x, y) {
var tile = source.getTileZXY(z, x, y, null, null); var tile = source.getTile(z, x, y, null, null);
return (!goog.isNull(tile) && tile.getState() === ol.TileState.LOADED) ? return (!goog.isNull(tile) && tile.getState() === ol.TileState.LOADED) ?
tile : null; tile : null;
} }
@@ -45,7 +45,7 @@ describe('ol.source.TileSource', function() {
var range = grid.getTileRangeForExtentAndZ(source.getExtent(), 0); var range = grid.getTileRangeForExtentAndZ(source.getExtent(), 0);
function getTileIfLoaded(z, x, y) { function getTileIfLoaded(z, x, y) {
var tile = source.getTileZXY(z, x, y, null, null); var tile = source.getTile(z, x, y, null, null);
return (!goog.isNull(tile) && tile.getState() === ol.TileState.LOADED) ? return (!goog.isNull(tile) && tile.getState() === ol.TileState.LOADED) ?
tile : null; tile : null;
} }
@@ -69,7 +69,7 @@ describe('ol.source.TileSource', function() {
var range = grid.getTileRangeForExtentAndZ(source.getExtent(), 1); var range = grid.getTileRangeForExtentAndZ(source.getExtent(), 1);
function getTileIfLoaded(z, x, y) { function getTileIfLoaded(z, x, y) {
var tile = source.getTileZXY(z, x, y, null, null); var tile = source.getTile(z, x, y, null, null);
return (!goog.isNull(tile) && tile.getState() === ol.TileState.LOADED) ? return (!goog.isNull(tile) && tile.getState() === ol.TileState.LOADED) ?
tile : null; tile : null;
} }
@@ -94,7 +94,7 @@ describe('ol.source.TileSource', function() {
var grid = source.getTileGrid(); var grid = source.getTileGrid();
var range = grid.getTileRangeForExtentAndZ(source.getExtent(), 1); var range = grid.getTileRangeForExtentAndZ(source.getExtent(), 1);
function getTileIfLoaded(z, x, y) { function getTileIfLoaded(z, x, y) {
var tile = source.getTileZXY(z, x, y, null, null); var tile = source.getTile(z, x, y, null, null);
return (!goog.isNull(tile) && tile.getState() === ol.TileState.LOADED) ? return (!goog.isNull(tile) && tile.getState() === ol.TileState.LOADED) ?
tile : null; tile : null;
} }
@@ -120,7 +120,7 @@ describe('ol.source.TileSource', function() {
var range = grid.getTileRangeForExtentAndZ(source.getExtent(), 1); var range = grid.getTileRangeForExtentAndZ(source.getExtent(), 1);
function getTileIfLoaded(z, x, y) { function getTileIfLoaded(z, x, y) {
var tile = source.getTileZXY(z, x, y, null, null); var tile = source.getTile(z, x, y, null, null);
return (!goog.isNull(tile) && tile.getState() === ol.TileState.LOADED) ? return (!goog.isNull(tile) && tile.getState() === ol.TileState.LOADED) ?
tile : null; tile : null;
} }
@@ -143,7 +143,7 @@ describe('ol.source.TileSource', function() {
var range = grid.getTileRangeForExtentAndZ(source.getExtent(), 1); var range = grid.getTileRangeForExtentAndZ(source.getExtent(), 1);
function getTileIfLoaded(z, x, y) { function getTileIfLoaded(z, x, y) {
var tile = source.getTileZXY(z, x, y, null, null); var tile = source.getTile(z, x, y, null, null);
return (!goog.isNull(tile) && tile.getState() === ol.TileState.LOADED) ? return (!goog.isNull(tile) && tile.getState() === ol.TileState.LOADED) ?
tile : null; tile : null;
} }
@@ -168,7 +168,7 @@ describe('ol.source.TileSource', function() {
var range = grid.getTileRangeForExtentAndZ(source.getExtent(), 1); var range = grid.getTileRangeForExtentAndZ(source.getExtent(), 1);
function getTileIfLoaded(z, x, y) { function getTileIfLoaded(z, x, y) {
var tile = source.getTileZXY(z, x, y, null, null); var tile = source.getTile(z, x, y, null, null);
return (!goog.isNull(tile) && tile.getState() === ol.TileState.LOADED) ? return (!goog.isNull(tile) && tile.getState() === ol.TileState.LOADED) ?
tile : null; tile : null;
} }
@@ -219,7 +219,7 @@ goog.inherits(ol.test.source.MockTileSource, ol.source.TileSource);
/** /**
* @inheritDoc * @inheritDoc
*/ */
ol.test.source.MockTileSource.prototype.getTileZXY = function(z, x, y) { ol.test.source.MockTileSource.prototype.getTile = function(z, x, y) {
var key = ol.TileCoord.getKeyZXY(z, x, y); var key = ol.TileCoord.getKeyZXY(z, x, y);
var tileState = this.loaded_[key] ? ol.TileState.LOADED : ol.TileState.IDLE; var tileState = this.loaded_[key] ? ol.TileState.LOADED : ol.TileState.IDLE;
return new ol.Tile(new ol.TileCoord(z, x, y), tileState); return new ol.Tile(new ol.TileCoord(z, x, y), tileState);
@@ -236,7 +236,7 @@ describe('ol.test.source.MockTileSource', function() {
}); });
}); });
describe('#getTileZXY()', function() { describe('#getTile()', function() {
it('returns a tile with state based on constructor arg', function() { it('returns a tile with state based on constructor arg', function() {
var source = new ol.test.source.MockTileSource({ var source = new ol.test.source.MockTileSource({
'0/0/0': true, '0/0/0': true,
@@ -245,17 +245,17 @@ describe('ol.test.source.MockTileSource', function() {
var tile; var tile;
// check a loaded tile // check a loaded tile
tile = source.getTileZXY(0, 0, 0); tile = source.getTile(0, 0, 0);
expect(tile).to.be.a(ol.Tile); expect(tile).to.be.a(ol.Tile);
expect(tile.state).to.be(ol.TileState.LOADED); expect(tile.state).to.be(ol.TileState.LOADED);
// check a tile that is not loaded // check a tile that is not loaded
tile = source.getTileZXY(1, 0, -1); tile = source.getTile(1, 0, -1);
expect(tile).to.be.a(ol.Tile); expect(tile).to.be.a(ol.Tile);
expect(tile.state).to.be(ol.TileState.IDLE); expect(tile.state).to.be(ol.TileState.IDLE);
// check another loaded tile // check another loaded tile
tile = source.getTileZXY(1, 0, 0); tile = source.getTile(1, 0, 0);
expect(tile).to.be.a(ol.Tile); expect(tile).to.be.a(ol.Tile);
expect(tile.state).to.be(ol.TileState.LOADED); expect(tile.state).to.be(ol.TileState.LOADED);