Rename _ol_TileState_ to TileState

This commit is contained in:
Frederic Junod
2017-12-22 09:00:46 +01:00
parent 2130ce7481
commit fc00aecd2e
25 changed files with 159 additions and 159 deletions

View File

@@ -3,7 +3,7 @@
*/
import {inherits} from './index.js';
import _ol_Tile_ from './Tile.js';
import _ol_TileState_ from './TileState.js';
import TileState from './TileState.js';
import {createCanvasContext2D} from './dom.js';
import _ol_events_ from './events.js';
import EventType from './events/EventType.js';
@@ -66,14 +66,14 @@ inherits(_ol_ImageTile_, _ol_Tile_);
* @inheritDoc
*/
_ol_ImageTile_.prototype.disposeInternal = function() {
if (this.state == _ol_TileState_.LOADING) {
if (this.state == TileState.LOADING) {
this.unlistenImage_();
this.image_ = _ol_ImageTile_.getBlankImage();
}
if (this.interimTile) {
this.interimTile.dispose();
}
this.state = _ol_TileState_.ABORT;
this.state = TileState.ABORT;
this.changed();
_ol_Tile_.prototype.disposeInternal.call(this);
};
@@ -103,7 +103,7 @@ _ol_ImageTile_.prototype.getKey = function() {
* @private
*/
_ol_ImageTile_.prototype.handleImageError_ = function() {
this.state = _ol_TileState_.ERROR;
this.state = TileState.ERROR;
this.unlistenImage_();
this.image_ = _ol_ImageTile_.getBlankImage();
this.changed();
@@ -117,9 +117,9 @@ _ol_ImageTile_.prototype.handleImageError_ = function() {
*/
_ol_ImageTile_.prototype.handleImageLoad_ = function() {
if (this.image_.naturalWidth && this.image_.naturalHeight) {
this.state = _ol_TileState_.LOADED;
this.state = TileState.LOADED;
} else {
this.state = _ol_TileState_.EMPTY;
this.state = TileState.EMPTY;
}
this.unlistenImage_();
this.changed();
@@ -131,15 +131,15 @@ _ol_ImageTile_.prototype.handleImageLoad_ = function() {
* @api
*/
_ol_ImageTile_.prototype.load = function() {
if (this.state == _ol_TileState_.ERROR) {
this.state = _ol_TileState_.IDLE;
if (this.state == TileState.ERROR) {
this.state = TileState.IDLE;
this.image_ = new Image();
if (this.crossOrigin_ !== null) {
this.image_.crossOrigin = this.crossOrigin_;
}
}
if (this.state == _ol_TileState_.IDLE) {
this.state = _ol_TileState_.LOADING;
if (this.state == TileState.IDLE) {
this.state = TileState.LOADING;
this.changed();
this.imageListenerKeys_ = [
_ol_events_.listenOnce(this.image_, EventType.ERROR,

View File

@@ -2,7 +2,7 @@
* @module ol/Tile
*/
import {inherits} from './index.js';
import _ol_TileState_ from './TileState.js';
import TileState from './TileState.js';
import {easeIn} from './easing.js';
import EventTarget from './events/EventTarget.js';
import EventType from './events/EventType.js';
@@ -102,7 +102,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_TileState_.LOADED) {
if (tile.getState() == TileState.LOADED) {
return tile;
}
tile = tile.interimTile;
@@ -125,17 +125,17 @@ _ol_Tile_.prototype.refreshInterimChain = function() {
var prev = this;
do {
if (tile.getState() == _ol_TileState_.LOADED) {
if (tile.getState() == 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_TileState_.LOADING) {
} else if (tile.getState() == 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_TileState_.IDLE) {
} else if (tile.getState() == 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;

View File

@@ -2,7 +2,7 @@
* @module ol/TileQueue
*/
import {inherits} from './index.js';
import _ol_TileState_ from './TileState.js';
import TileState from './TileState.js';
import _ol_events_ from './events.js';
import EventType from './events/EventType.js';
import PriorityQueue from './structs/PriorityQueue.js';
@@ -87,8 +87,8 @@ TileQueue.prototype.getTilesLoading = function() {
TileQueue.prototype.handleTileChange = function(event) {
var tile = /** @type {ol.Tile} */ (event.target);
var state = tile.getState();
if (state === _ol_TileState_.LOADED || state === _ol_TileState_.ERROR ||
state === _ol_TileState_.EMPTY || state === _ol_TileState_.ABORT) {
if (state === TileState.LOADED || state === TileState.ERROR ||
state === TileState.EMPTY || state === TileState.ABORT) {
_ol_events_.unlisten(tile, EventType.CHANGE,
this.handleTileChange, this);
var tileKey = tile.getKey();
@@ -114,9 +114,9 @@ TileQueue.prototype.loadMoreTiles = function(maxTotalLoading, maxNewLoads) {
tile = /** @type {ol.Tile} */ (this.dequeue()[0]);
tileKey = tile.getKey();
state = tile.getState();
if (state === _ol_TileState_.ABORT) {
if (state === TileState.ABORT) {
abortedTiles = true;
} else if (state === _ol_TileState_.IDLE && !(tileKey in this.tilesLoadingKeys_)) {
} else if (state === TileState.IDLE && !(tileKey in this.tilesLoadingKeys_)) {
this.tilesLoadingKeys_[tileKey] = true;
++this.tilesLoading_;
++newLoads;

View File

@@ -3,7 +3,7 @@
*/
import {getUid, inherits} from './index.js';
import _ol_Tile_ from './Tile.js';
import _ol_TileState_ from './TileState.js';
import TileState from './TileState.js';
import {createCanvasContext2D} from './dom.js';
import _ol_events_ from './events.js';
import {getHeight, getIntersection, getWidth} from './extent.js';
@@ -107,7 +107,7 @@ var _ol_VectorImageTile_ = function(tileCoord, state, sourceRevision, format,
if (!sourceTile) {
var tileUrl = tileUrlFunction(sourceTileCoord, pixelRatio, projection);
sourceTile = sourceTiles[sourceTileKey] = new tileClass(sourceTileCoord,
tileUrl == undefined ? _ol_TileState_.EMPTY : _ol_TileState_.IDLE,
tileUrl == undefined ? TileState.EMPTY : TileState.IDLE,
tileUrl == undefined ? '' : tileUrl,
format, tileLoadFunction);
this.sourceTileListenerKeys_.push(
@@ -128,7 +128,7 @@ inherits(_ol_VectorImageTile_, _ol_Tile_);
* @inheritDoc
*/
_ol_VectorImageTile_.prototype.disposeInternal = function() {
this.state = _ol_TileState_.ABORT;
this.state = TileState.ABORT;
this.changed();
if (this.interimTile) {
this.interimTile.dispose();
@@ -223,23 +223,23 @@ _ol_VectorImageTile_.prototype.load = function() {
// an ERROR state after another load attempt.
var errorSourceTiles = {};
if (this.state == _ol_TileState_.IDLE) {
this.setState(_ol_TileState_.LOADING);
if (this.state == TileState.IDLE) {
this.setState(TileState.LOADING);
}
if (this.state == _ol_TileState_.LOADING) {
if (this.state == TileState.LOADING) {
this.tileKeys.forEach(function(sourceTileKey) {
var sourceTile = this.getTile(sourceTileKey);
if (sourceTile.state == _ol_TileState_.IDLE) {
if (sourceTile.state == TileState.IDLE) {
sourceTile.setLoader(this.loader_);
sourceTile.load();
}
if (sourceTile.state == _ol_TileState_.LOADING) {
if (sourceTile.state == TileState.LOADING) {
var key = _ol_events_.listen(sourceTile, EventType.CHANGE, function(e) {
var state = sourceTile.getState();
if (state == _ol_TileState_.LOADED ||
state == _ol_TileState_.ERROR) {
if (state == TileState.LOADED ||
state == TileState.ERROR) {
var uid = getUid(sourceTile);
if (state == _ol_TileState_.ERROR) {
if (state == TileState.ERROR) {
errorSourceTiles[uid] = true;
} else {
--leftToLoad;
@@ -269,19 +269,19 @@ _ol_VectorImageTile_.prototype.finishLoading_ = function() {
var empty = 0;
for (var i = loaded - 1; i >= 0; --i) {
var state = this.getTile(this.tileKeys[i]).getState();
if (state != _ol_TileState_.LOADED) {
if (state != TileState.LOADED) {
--loaded;
}
if (state == _ol_TileState_.EMPTY) {
if (state == TileState.EMPTY) {
++empty;
}
}
if (loaded == this.tileKeys.length) {
this.loadListenerKeys_.forEach(_ol_events_.unlistenByKey);
this.loadListenerKeys_.length = 0;
this.setState(_ol_TileState_.LOADED);
this.setState(TileState.LOADED);
} else {
this.setState(empty == this.tileKeys.length ? _ol_TileState_.EMPTY : _ol_TileState_.ERROR);
this.setState(empty == this.tileKeys.length ? TileState.EMPTY : TileState.ERROR);
}
};

View File

@@ -3,7 +3,7 @@
*/
import {getUid, inherits} from './index.js';
import _ol_Tile_ from './Tile.js';
import _ol_TileState_ from './TileState.js';
import TileState from './TileState.js';
/**
* @constructor
@@ -84,7 +84,7 @@ inherits(_ol_VectorTile_, _ol_Tile_);
_ol_VectorTile_.prototype.disposeInternal = function() {
this.features_ = null;
this.replayGroups_ = {};
this.state = _ol_TileState_.ABORT;
this.state = TileState.ABORT;
this.changed();
_ol_Tile_.prototype.disposeInternal.call(this);
};
@@ -154,8 +154,8 @@ _ol_VectorTile_.prototype.getReplayGroup = function(layer, key) {
* @inheritDoc
*/
_ol_VectorTile_.prototype.load = function() {
if (this.state == _ol_TileState_.IDLE) {
this.setState(_ol_TileState_.LOADING);
if (this.state == TileState.IDLE) {
this.setState(TileState.LOADING);
this.tileLoadFunction_(this, this.url_);
this.loader_(null, NaN, null);
}
@@ -179,7 +179,7 @@ _ol_VectorTile_.prototype.onLoad = function(features, dataProjection, extent) {
* Handler for tile load errors.
*/
_ol_VectorTile_.prototype.onError = function() {
this.setState(_ol_TileState_.ERROR);
this.setState(TileState.ERROR);
};
@@ -208,7 +208,7 @@ _ol_VectorTile_.prototype.setExtent = function(extent) {
*/
_ol_VectorTile_.prototype.setFeatures = function(features) {
this.features_ = features;
this.setState(_ol_TileState_.LOADED);
this.setState(TileState.LOADED);
};

View File

@@ -4,7 +4,7 @@
import {getUid, inherits, nullFunction} from '../index.js';
import ImageState from '../ImageState.js';
import _ol_Observable_ from '../Observable.js';
import _ol_TileState_ from '../TileState.js';
import TileState from '../TileState.js';
import _ol_events_ from '../events.js';
import EventType from '../events/EventType.js';
import {FALSE} from '../functions.js';
@@ -225,7 +225,7 @@ _ol_renderer_Layer_.prototype.manageTilePyramid = function(
for (y = tileRange.minY; y <= tileRange.maxY; ++y) {
if (currentZ - z <= preload) {
tile = tileSource.getTile(z, x, y, pixelRatio, projection);
if (tile.getState() == _ol_TileState_.IDLE) {
if (tile.getState() == TileState.IDLE) {
wantedTiles[tile.getKey()] = true;
if (!tileQueue.isKeyQueued(tile.getKey())) {
tileQueue.enqueue([tile, tileSourceKey,

View File

@@ -4,7 +4,7 @@
import {getUid, inherits} from '../../index.js';
import LayerType from '../../LayerType.js';
import TileRange from '../../TileRange.js';
import _ol_TileState_ from '../../TileState.js';
import TileState from '../../TileState.js';
import _ol_ViewHint_ from '../../ViewHint.js';
import {createCanvasContext2D} from '../../dom.js';
import {containsExtent, createEmpty, equals, getIntersection, isEmpty} from '../../extent.js';
@@ -111,9 +111,9 @@ _ol_renderer_canvas_TileLayer_['create'] = function(mapRenderer, layer) {
_ol_renderer_canvas_TileLayer_.prototype.isDrawableTile_ = function(tile) {
var tileState = tile.getState();
var useInterimTilesOnError = this.getLayer().getUseInterimTilesOnError();
return tileState == _ol_TileState_.LOADED ||
tileState == _ol_TileState_.EMPTY ||
tileState == _ol_TileState_.ERROR && !useInterimTilesOnError;
return tileState == TileState.LOADED ||
tileState == TileState.EMPTY ||
tileState == TileState.ERROR && !useInterimTilesOnError;
};
/**
@@ -166,10 +166,10 @@ _ol_renderer_canvas_TileLayer_.prototype.prepareFrame = function(frameState, lay
for (x = tileRange.minX; x <= tileRange.maxX; ++x) {
for (y = tileRange.minY; y <= tileRange.maxY; ++y) {
tile = tileSource.getTile(z, x, y, pixelRatio, projection);
if (tile.getState() == _ol_TileState_.ERROR) {
if (tile.getState() == TileState.ERROR) {
if (!tileLayer.getUseInterimTilesOnError()) {
// When useInterimTilesOnError is false, we consider the error tile as loaded.
tile.setState(_ol_TileState_.LOADED);
tile.setState(TileState.LOADED);
} else if (tileLayer.getPreload() > 0) {
// Preloaded tiles for lower resolutions might have finished loading.
newTiles = true;
@@ -180,7 +180,7 @@ _ol_renderer_canvas_TileLayer_.prototype.prepareFrame = function(frameState, lay
}
if (this.isDrawableTile_(tile)) {
var uid = getUid(this);
if (tile.getState() == _ol_TileState_.LOADED) {
if (tile.getState() == TileState.LOADED) {
tilesToDrawByZ[z][tile.tileCoord.toString()] = tile;
var inTransition = tile.inTransition(uid);
if (!newTiles && (inTransition || this.renderedTiles.indexOf(tile) === -1)) {

View File

@@ -3,7 +3,7 @@
*/
import {getUid, inherits} from '../../index.js';
import LayerType from '../../LayerType.js';
import _ol_TileState_ from '../../TileState.js';
import TileState from '../../TileState.js';
import {createCanvasContext2D} from '../../dom.js';
import _ol_events_ from '../../events.js';
import EventType from '../../events/EventType.js';
@@ -174,7 +174,7 @@ _ol_renderer_canvas_VectorTileLayer_.prototype.createReplayGroup_ = function(
var zIndexKeys = {};
for (var t = 0, tt = tile.tileKeys.length; t < tt; ++t) {
var sourceTile = tile.getTile(tile.tileKeys[t]);
if (sourceTile.getState() == _ol_TileState_.ERROR) {
if (sourceTile.getState() == TileState.ERROR) {
continue;
}
@@ -292,7 +292,7 @@ _ol_renderer_canvas_VectorTileLayer_.prototype.forEachFeatureAtCoordinate = func
}
for (var t = 0, tt = tile.tileKeys.length; t < tt; ++t) {
var sourceTile = tile.getTile(tile.tileKeys[t]);
if (sourceTile.getState() == _ol_TileState_.ERROR) {
if (sourceTile.getState() == TileState.ERROR) {
continue;
}
replayGroup = sourceTile.getReplayGroup(layer, tile.tileCoord.toString());
@@ -393,7 +393,7 @@ _ol_renderer_canvas_VectorTileLayer_.prototype.postCompose = function(context, f
var zs = [];
for (var i = tiles.length - 1; i >= 0; --i) {
var tile = /** @type {ol.VectorImageTile} */ (tiles[i]);
if (tile.getState() == _ol_TileState_.ABORT) {
if (tile.getState() == TileState.ABORT) {
continue;
}
var tileCoord = tile.tileCoord;
@@ -402,7 +402,7 @@ _ol_renderer_canvas_VectorTileLayer_.prototype.postCompose = function(context, f
var transform = undefined;
for (var t = 0, tt = tile.tileKeys.length; t < tt; ++t) {
var sourceTile = tile.getTile(tile.tileKeys[t]);
if (sourceTile.getState() == _ol_TileState_.ERROR) {
if (sourceTile.getState() == TileState.ERROR) {
continue;
}
var replayGroup = sourceTile.getReplayGroup(layer, tileCoord.toString());
@@ -507,7 +507,7 @@ _ol_renderer_canvas_VectorTileLayer_.prototype.renderTileImage_ = function(
var tileExtent = tileGrid.getTileCoordExtent(tileCoord);
for (var i = 0, ii = tile.tileKeys.length; i < ii; ++i) {
var sourceTile = tile.getTile(tile.tileKeys[i]);
if (sourceTile.getState() == _ol_TileState_.ERROR) {
if (sourceTile.getState() == TileState.ERROR) {
continue;
}
var pixelScale = pixelRatio / resolution;

View File

@@ -7,7 +7,7 @@
import {inherits} from '../../index.js';
import LayerType from '../../LayerType.js';
import TileRange from '../../TileRange.js';
import _ol_TileState_ from '../../TileState.js';
import TileState from '../../TileState.js';
import {numberSafeCompareFunction} from '../../array.js';
import {createEmpty, intersects} from '../../extent.js';
import {roundUpToPowerOfTwo} from '../../math.js';
@@ -262,20 +262,20 @@ _ol_renderer_webgl_TileLayer_.prototype.prepareFrame = function(frameState, laye
}
}
tileState = tile.getState();
drawable = tileState == _ol_TileState_.LOADED ||
tileState == _ol_TileState_.EMPTY ||
tileState == _ol_TileState_.ERROR && !useInterimTilesOnError;
drawable = tileState == TileState.LOADED ||
tileState == TileState.EMPTY ||
tileState == TileState.ERROR && !useInterimTilesOnError;
if (!drawable) {
tile = tile.getInterimTile();
}
tileState = tile.getState();
if (tileState == _ol_TileState_.LOADED) {
if (tileState == TileState.LOADED) {
if (mapRenderer.isTileTextureLoaded(tile)) {
tilesToDrawByZ[z][tile.tileCoord.toString()] = tile;
continue;
}
} else if (tileState == _ol_TileState_.EMPTY ||
(tileState == _ol_TileState_.ERROR &&
} else if (tileState == TileState.EMPTY ||
(tileState == TileState.ERROR &&
!useInterimTilesOnError)) {
continue;
}
@@ -342,7 +342,7 @@ _ol_renderer_webgl_TileLayer_.prototype.prepareFrame = function(frameState, laye
* @param {ol.Tile} tile Tile.
*/
function(tile) {
if (tile.getState() == _ol_TileState_.LOADED &&
if (tile.getState() == TileState.LOADED &&
!mapRenderer.isTileTextureLoaded(tile) &&
!tileTextureQueue.isKeyQueued(tile.getKey())) {
tileTextureQueue.enqueue([

View File

@@ -4,7 +4,7 @@
import {ERROR_THRESHOLD} from './common.js';
import {inherits} from '../index.js';
import _ol_Tile_ from '../Tile.js';
import _ol_TileState_ from '../TileState.js';
import TileState from '../TileState.js';
import _ol_events_ from '../events.js';
import EventType from '../events/EventType.js';
import {getArea, getCenter, getIntersection} from '../extent.js';
@@ -36,7 +36,7 @@ var _ol_reproj_Tile_ = function(sourceProj, sourceTileGrid,
targetProj, targetTileGrid, tileCoord, wrappedTileCoord,
pixelRatio, gutter, getTileFunction,
opt_errorThreshold, opt_renderEdges) {
_ol_Tile_.call(this, tileCoord, _ol_TileState_.IDLE);
_ol_Tile_.call(this, tileCoord, TileState.IDLE);
/**
* @private
@@ -108,7 +108,7 @@ var _ol_reproj_Tile_ = function(sourceProj, sourceTileGrid,
if (getArea(limitedTargetExtent) === 0) {
// Tile is completely outside range -> EMPTY
// TODO: is it actually correct that the source even creates the tile ?
this.state = _ol_TileState_.EMPTY;
this.state = TileState.EMPTY;
return;
}
@@ -131,7 +131,7 @@ var _ol_reproj_Tile_ = function(sourceProj, sourceTileGrid,
if (!isFinite(sourceResolution) || sourceResolution <= 0) {
// invalid sourceResolution -> EMPTY
// probably edges of the projections when no extent is defined
this.state = _ol_TileState_.EMPTY;
this.state = TileState.EMPTY;
return;
}
@@ -148,7 +148,7 @@ var _ol_reproj_Tile_ = function(sourceProj, sourceTileGrid,
if (this.triangulation_.getTriangles().length === 0) {
// no valid triangles -> EMPTY
this.state = _ol_TileState_.EMPTY;
this.state = TileState.EMPTY;
return;
}
@@ -167,7 +167,7 @@ var _ol_reproj_Tile_ = function(sourceProj, sourceTileGrid,
}
if (!getArea(sourceExtent)) {
this.state = _ol_TileState_.EMPTY;
this.state = TileState.EMPTY;
} else {
var sourceRange = sourceTileGrid.getTileRangeForExtentAndZ(
sourceExtent, this.sourceZ_);
@@ -182,7 +182,7 @@ var _ol_reproj_Tile_ = function(sourceProj, sourceTileGrid,
}
if (this.sourceTiles_.length === 0) {
this.state = _ol_TileState_.EMPTY;
this.state = TileState.EMPTY;
}
}
};
@@ -194,7 +194,7 @@ inherits(_ol_reproj_Tile_, _ol_Tile_);
* @inheritDoc
*/
_ol_reproj_Tile_.prototype.disposeInternal = function() {
if (this.state == _ol_TileState_.LOADING) {
if (this.state == TileState.LOADING) {
this.unlistenSources_();
}
_ol_Tile_.prototype.disposeInternal.call(this);
@@ -216,7 +216,7 @@ _ol_reproj_Tile_.prototype.getImage = function() {
_ol_reproj_Tile_.prototype.reproject_ = function() {
var sources = [];
this.sourceTiles_.forEach(function(tile, i, arr) {
if (tile && tile.getState() == _ol_TileState_.LOADED) {
if (tile && tile.getState() == TileState.LOADED) {
sources.push({
extent: this.sourceTileGrid_.getTileCoordExtent(tile.tileCoord),
image: tile.getImage()
@@ -226,7 +226,7 @@ _ol_reproj_Tile_.prototype.reproject_ = function() {
this.sourceTiles_.length = 0;
if (sources.length === 0) {
this.state = _ol_TileState_.ERROR;
this.state = TileState.ERROR;
} else {
var z = this.wrappedTileCoord_[0];
var size = this.targetTileGrid_.getTileSize(z);
@@ -242,7 +242,7 @@ _ol_reproj_Tile_.prototype.reproject_ = function() {
targetResolution, targetExtent, this.triangulation_, sources,
this.gutter_, this.renderEdges_);
this.state = _ol_TileState_.LOADED;
this.state = TileState.LOADED;
}
this.changed();
};
@@ -252,8 +252,8 @@ _ol_reproj_Tile_.prototype.reproject_ = function() {
* @inheritDoc
*/
_ol_reproj_Tile_.prototype.load = function() {
if (this.state == _ol_TileState_.IDLE) {
this.state = _ol_TileState_.LOADING;
if (this.state == TileState.IDLE) {
this.state = TileState.LOADING;
this.changed();
var leftToLoad = 0;
@@ -261,16 +261,16 @@ _ol_reproj_Tile_.prototype.load = function() {
this.sourcesListenerKeys_ = [];
this.sourceTiles_.forEach(function(tile, i, arr) {
var state = tile.getState();
if (state == _ol_TileState_.IDLE || state == _ol_TileState_.LOADING) {
if (state == TileState.IDLE || state == TileState.LOADING) {
leftToLoad++;
var sourceListenKey;
sourceListenKey = _ol_events_.listen(tile, EventType.CHANGE,
function(e) {
var state = tile.getState();
if (state == _ol_TileState_.LOADED ||
state == _ol_TileState_.ERROR ||
state == _ol_TileState_.EMPTY) {
if (state == TileState.LOADED ||
state == TileState.ERROR ||
state == TileState.EMPTY) {
_ol_events_.unlistenByKey(sourceListenKey);
leftToLoad--;
if (leftToLoad === 0) {
@@ -285,7 +285,7 @@ _ol_reproj_Tile_.prototype.load = function() {
this.sourceTiles_.forEach(function(tile, i, arr) {
var state = tile.getState();
if (state == _ol_TileState_.IDLE) {
if (state == TileState.IDLE) {
tile.load();
}
});

View File

@@ -3,7 +3,7 @@
*/
import {inherits, nullFunction} from '../index.js';
import TileCache from '../TileCache.js';
import _ol_TileState_ from '../TileState.js';
import TileState from '../TileState.js';
import Event from '../events/Event.js';
import {equivalent} from '../proj.js';
import _ol_size_ from '../size.js';
@@ -124,7 +124,7 @@ _ol_source_Tile_.prototype.forEachLoadedTile = function(projection, z, tileRange
loaded = false;
if (tileCache.containsKey(tileCoordKey)) {
tile = /** @type {!ol.Tile} */ (tileCache.get(tileCoordKey));
loaded = tile.getState() === _ol_TileState_.LOADED;
loaded = tile.getState() === TileState.LOADED;
if (loaded) {
loaded = (callback(tile) !== false);
}

View File

@@ -3,7 +3,7 @@
*/
import {inherits} from '../index.js';
import _ol_Tile_ from '../Tile.js';
import _ol_TileState_ from '../TileState.js';
import TileState from '../TileState.js';
import {createCanvasContext2D} from '../dom.js';
import _ol_size_ from '../size.js';
import _ol_source_Tile_ from '../source/Tile.js';
@@ -66,7 +66,7 @@ _ol_source_TileDebug_.prototype.getTile = function(z, x, y) {
*/
_ol_source_TileDebug_.Tile_ = function(tileCoord, tileSize, text) {
_ol_Tile_.call(this, tileCoord, _ol_TileState_.LOADED);
_ol_Tile_.call(this, tileCoord, TileState.LOADED);
/**
* @private

View File

@@ -5,7 +5,7 @@ import {ENABLE_RASTER_REPROJECTION} from '../reproj/common.js';
import {getUid, inherits} from '../index.js';
import _ol_ImageTile_ from '../ImageTile.js';
import TileCache from '../TileCache.js';
import _ol_TileState_ from '../TileState.js';
import TileState from '../TileState.js';
import _ol_events_ from '../events.js';
import EventType from '../events/EventType.js';
import {equivalent, get as getProjection} from '../proj.js';
@@ -218,7 +218,7 @@ _ol_source_TileImage_.prototype.createTile_ = function(z, x, y, pixelRatio, proj
this.tileUrlFunction(urlTileCoord, pixelRatio, projection) : undefined;
var tile = new this.tileClass(
tileCoord,
tileUrl !== undefined ? _ol_TileState_.IDLE : _ol_TileState_.EMPTY,
tileUrl !== undefined ? TileState.IDLE : TileState.EMPTY,
tileUrl !== undefined ? tileUrl : '',
this.crossOrigin,
this.tileLoadFunction,
@@ -304,7 +304,7 @@ _ol_source_TileImage_.prototype.getTileInternal = function(z, x, y, pixelRatio,
tile = this.createTile_(z, x, y, pixelRatio, projection, key);
//make the new tile the head of the list,
if (interimTile.getState() == _ol_TileState_.IDLE) {
if (interimTile.getState() == TileState.IDLE) {
//the old tile hasn't begun loading yet, and is now outdated, so we can simply discard it
tile.interimTile = interimTile.interimTile;
} else {

View File

@@ -3,7 +3,7 @@
*/
import {inherits} from '../index.js';
import _ol_Tile_ from '../Tile.js';
import _ol_TileState_ from '../TileState.js';
import TileState from '../TileState.js';
import {createFromTemplates, nullTileUrlFunction} from '../tileurlfunction.js';
import {assert} from '../asserts.js';
import _ol_events_ from '../events.js';
@@ -224,7 +224,7 @@ _ol_source_TileUTFGrid_.prototype.getTile = function(z, x, y, pixelRatio, projec
var tileUrl = this.tileUrlFunction_(urlTileCoord, pixelRatio, projection);
var tile = new _ol_source_TileUTFGrid_.Tile_(
tileCoord,
tileUrl !== undefined ? _ol_TileState_.IDLE : _ol_TileState_.EMPTY,
tileUrl !== undefined ? TileState.IDLE : TileState.EMPTY,
tileUrl !== undefined ? tileUrl : '',
this.tileGrid.getTileCoordExtent(tileCoord),
this.preemptive_,
@@ -370,7 +370,7 @@ _ol_source_TileUTFGrid_.Tile_.prototype.getData = function(coordinate) {
* @template T
*/
_ol_source_TileUTFGrid_.Tile_.prototype.forDataAtCoordinate = function(coordinate, callback, opt_this, opt_request) {
if (this.state == _ol_TileState_.IDLE && opt_request === true) {
if (this.state == TileState.IDLE && opt_request === true) {
_ol_events_.listenOnce(this, EventType.CHANGE, function(e) {
callback.call(opt_this, this.getData(coordinate));
}, this);
@@ -399,7 +399,7 @@ _ol_source_TileUTFGrid_.Tile_.prototype.getKey = function() {
* @private
*/
_ol_source_TileUTFGrid_.Tile_.prototype.handleError_ = function() {
this.state = _ol_TileState_.ERROR;
this.state = TileState.ERROR;
this.changed();
};
@@ -413,7 +413,7 @@ _ol_source_TileUTFGrid_.Tile_.prototype.handleLoad_ = function(json) {
this.keys_ = json.keys;
this.data_ = json.data;
this.state = _ol_TileState_.EMPTY;
this.state = TileState.EMPTY;
this.changed();
};
@@ -422,8 +422,8 @@ _ol_source_TileUTFGrid_.Tile_.prototype.handleLoad_ = function(json) {
* @private
*/
_ol_source_TileUTFGrid_.Tile_.prototype.loadInternal_ = function() {
if (this.state == _ol_TileState_.IDLE) {
this.state = _ol_TileState_.LOADING;
if (this.state == TileState.IDLE) {
this.state = TileState.LOADING;
if (this.jsonp_) {
_ol_net_.jsonp(this.src_, this.handleLoad_.bind(this),
this.handleError_.bind(this));

View File

@@ -2,7 +2,7 @@
* @module ol/source/UrlTile
*/
import {getUid, inherits} from '../index.js';
import _ol_TileState_ from '../TileState.js';
import TileState from '../TileState.js';
import {expandUrl, createFromTemplates, nullTileUrlFunction} from '../tileurlfunction.js';
import _ol_source_Tile_ from '../source/Tile.js';
import TileEventType from '../source/TileEventType.js';
@@ -120,13 +120,13 @@ _ol_source_UrlTile_.prototype.handleTileChange = function(event) {
var uid = getUid(tile);
var tileState = tile.getState();
var type;
if (tileState == _ol_TileState_.LOADING) {
if (tileState == TileState.LOADING) {
this.tileLoadingKeys_[uid] = true;
type = TileEventType.TILELOADSTART;
} else if (uid in this.tileLoadingKeys_) {
delete this.tileLoadingKeys_[uid];
type = tileState == _ol_TileState_.ERROR ? TileEventType.TILELOADERROR :
(tileState == _ol_TileState_.LOADED || tileState == _ol_TileState_.ABORT) ?
type = tileState == TileState.ERROR ? TileEventType.TILELOADERROR :
(tileState == TileState.LOADED || tileState == TileState.ABORT) ?
TileEventType.TILELOADEND : undefined;
}
if (type != undefined) {

View File

@@ -2,7 +2,7 @@
* @module ol/source/VectorTile
*/
import {inherits} from '../index.js';
import _ol_TileState_ from '../TileState.js';
import TileState from '../TileState.js';
import _ol_VectorImageTile_ from '../VectorImageTile.js';
import _ol_VectorTile_ from '../VectorTile.js';
import _ol_size_ from '../size.js';
@@ -120,7 +120,7 @@ _ol_source_VectorTile_.prototype.getTile = function(z, x, y, pixelRatio, project
tileCoord, projection);
var tile = new _ol_VectorImageTile_(
tileCoord,
urlTileCoord !== null ? _ol_TileState_.IDLE : _ol_TileState_.EMPTY,
urlTileCoord !== null ? TileState.IDLE : TileState.EMPTY,
this.getRevision(),
this.format_, this.tileLoadFunction, urlTileCoord, this.tileUrlFunction,
this.tileGrid, this.getTileGridForProjection(projection),

View File

@@ -4,7 +4,7 @@
import {DEFAULT_TILE_SIZE} from '../tilegrid/common.js';
import {inherits} from '../index.js';
import _ol_ImageTile_ from '../ImageTile.js';
import _ol_TileState_ from '../TileState.js';
import TileState from '../TileState.js';
import {expandUrl, createFromTileUrlFunctions} from '../tileurlfunction.js';
import {assert} from '../asserts.js';
import {createCanvasContext2D} from '../dom.js';
@@ -193,7 +193,7 @@ _ol_source_Zoomify_.Tile_.prototype.getImage = function() {
return this.zoomifyImage_;
}
var image = _ol_ImageTile_.prototype.getImage.call(this);
if (this.state == _ol_TileState_.LOADED) {
if (this.state == TileState.LOADED) {
var tileSize = this.tileSize_;
if (image.width == tileSize[0] && image.height == tileSize[1]) {
this.zoomifyImage_ = image;