Remove state enum from tile constructor

This commit is contained in:
Tim Schaub
2016-12-27 09:49:21 -07:00
parent 3852c0da83
commit 895a506025
22 changed files with 134 additions and 128 deletions
+8 -20
View File
@@ -1,6 +1,7 @@
goog.provide('ol.Tile');
goog.require('ol');
goog.require('ol.TileState');
goog.require('ol.events.EventTarget');
goog.require('ol.events.EventType');
@@ -12,7 +13,7 @@ goog.require('ol.events.EventType');
* @constructor
* @extends {ol.events.EventTarget}
* @param {ol.TileCoord} tileCoord Tile coordinate.
* @param {ol.Tile.State} state State.
* @param {ol.TileState} state State.
*/
ol.Tile = function(tileCoord, state) {
@@ -25,7 +26,7 @@ ol.Tile = function(tileCoord, state) {
/**
* @protected
* @type {ol.Tile.State}
* @type {ol.TileState}
*/
this.state = state;
@@ -90,7 +91,7 @@ ol.Tile.prototype.getInterimTile = function() {
// of the list (all those tiles correspond to older requests and will be
// cleaned up by refreshInterimChain)
do {
if (tile.getState() == ol.Tile.State.LOADED) {
if (tile.getState() == ol.TileState.LOADED) {
return tile;
}
tile = tile.interimTile;
@@ -113,17 +114,17 @@ ol.Tile.prototype.refreshInterimChain = function() {
var prev = this;
do {
if (tile.getState() == ol.Tile.State.LOADED) {
if (tile.getState() == ol.TileState.LOADED) {
//we have a loaded tile, we can discard the rest of the list
//we would could abort any LOADING tile request
//older than this tile (i.e. any LOADING tile following this entry in the chain)
tile.interimTile = null;
break;
} else if (tile.getState() == ol.Tile.State.LOADING) {
} else if (tile.getState() == ol.TileState.LOADING) {
//keep this LOADING tile any loaded tiles later in the chain are
//older than this tile, so we're still interested in the request
prev = tile;
} else if (tile.getState() == ol.Tile.State.IDLE) {
} else if (tile.getState() == ol.TileState.IDLE) {
//the head of the list is the most current tile, we don't need
//to start any other requests for this chain
prev.interimTile = tile.interimTile;
@@ -145,7 +146,7 @@ ol.Tile.prototype.getTileCoord = function() {
/**
* @return {ol.Tile.State} State.
* @return {ol.TileState} State.
*/
ol.Tile.prototype.getState = function() {
return this.state;
@@ -160,16 +161,3 @@ ol.Tile.prototype.getState = function() {
* @api
*/
ol.Tile.prototype.load = function() {};
/**
* @enum {number}
*/
ol.Tile.State = {
IDLE: 0,
LOADING: 1,
LOADED: 2,
ERROR: 3,
EMPTY: 4,
ABORT: 5
};