Remove state enum from tile constructor
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
goog.provide('ol.source.Tile');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.Tile');
|
||||
goog.require('ol.TileCache');
|
||||
goog.require('ol.TileState');
|
||||
goog.require('ol.events.Event');
|
||||
goog.require('ol.proj');
|
||||
goog.require('ol.size');
|
||||
@@ -117,7 +117,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.Tile.State.LOADED;
|
||||
loaded = tile.getState() === ol.TileState.LOADED;
|
||||
if (loaded) {
|
||||
loaded = (callback(tile) !== false);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ goog.provide('ol.source.TileDebug');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.Tile');
|
||||
goog.require('ol.TileState');
|
||||
goog.require('ol.dom');
|
||||
goog.require('ol.size');
|
||||
goog.require('ol.source.Tile');
|
||||
@@ -63,7 +64,7 @@ ol.source.TileDebug.prototype.getTile = function(z, x, y) {
|
||||
*/
|
||||
ol.source.TileDebug.Tile_ = function(tileCoord, tileSize, text) {
|
||||
|
||||
ol.Tile.call(this, tileCoord, ol.Tile.State.LOADED);
|
||||
ol.Tile.call(this, tileCoord, ol.TileState.LOADED);
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -2,8 +2,8 @@ goog.provide('ol.source.TileImage');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.ImageTile');
|
||||
goog.require('ol.Tile');
|
||||
goog.require('ol.TileCache');
|
||||
goog.require('ol.TileState');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol.proj');
|
||||
@@ -51,7 +51,7 @@ ol.source.TileImage = function(options) {
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {function(new: ol.ImageTile, ol.TileCoord, ol.Tile.State, string,
|
||||
* @type {function(new: ol.ImageTile, ol.TileCoord, ol.TileState, string,
|
||||
* ?string, ol.TileLoadFunctionType)}
|
||||
*/
|
||||
this.tileClass = options.tileClass !== undefined ?
|
||||
@@ -219,7 +219,7 @@ ol.source.TileImage.prototype.createTile_ = function(z, x, y, pixelRatio, projec
|
||||
this.tileUrlFunction(urlTileCoord, pixelRatio, projection) : undefined;
|
||||
var tile = new this.tileClass(
|
||||
tileCoord,
|
||||
tileUrl !== undefined ? ol.Tile.State.IDLE : ol.Tile.State.EMPTY,
|
||||
tileUrl !== undefined ? ol.TileState.IDLE : ol.TileState.EMPTY,
|
||||
tileUrl !== undefined ? tileUrl : '',
|
||||
this.crossOrigin,
|
||||
this.tileLoadFunction);
|
||||
@@ -305,7 +305,7 @@ ol.source.TileImage.prototype.getTileInternal = function(z, x, y, pixelRatio, pr
|
||||
tile = this.createTile_(z, x, y, pixelRatio, projection, key);
|
||||
|
||||
//make the new tile the head of the list,
|
||||
if (interimTile.getState() == ol.Tile.State.IDLE) {
|
||||
if (interimTile.getState() == ol.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 {
|
||||
|
||||
@@ -3,6 +3,7 @@ goog.provide('ol.source.TileUTFGrid');
|
||||
goog.require('ol');
|
||||
goog.require('ol.Attribution');
|
||||
goog.require('ol.Tile');
|
||||
goog.require('ol.TileState');
|
||||
goog.require('ol.TileUrlFunction');
|
||||
goog.require('ol.asserts');
|
||||
goog.require('ol.events');
|
||||
@@ -236,7 +237,7 @@ ol.source.TileUTFGrid.prototype.getTile = function(z, x, y, pixelRatio, projecti
|
||||
var tileUrl = this.tileUrlFunction_(urlTileCoord, pixelRatio, projection);
|
||||
var tile = new ol.source.TileUTFGrid.Tile_(
|
||||
tileCoord,
|
||||
tileUrl !== undefined ? ol.Tile.State.IDLE : ol.Tile.State.EMPTY,
|
||||
tileUrl !== undefined ? ol.TileState.IDLE : ol.TileState.EMPTY,
|
||||
tileUrl !== undefined ? tileUrl : '',
|
||||
this.tileGrid.getTileCoordExtent(tileCoord),
|
||||
this.preemptive_,
|
||||
@@ -262,7 +263,7 @@ ol.source.TileUTFGrid.prototype.useTile = function(z, x, y) {
|
||||
* @constructor
|
||||
* @extends {ol.Tile}
|
||||
* @param {ol.TileCoord} tileCoord Tile coordinate.
|
||||
* @param {ol.Tile.State} state State.
|
||||
* @param {ol.TileState} state State.
|
||||
* @param {string} src Image source URI.
|
||||
* @param {ol.Extent} extent Extent of the tile.
|
||||
* @param {boolean} preemptive Load the tile when visible (before it's needed).
|
||||
@@ -382,7 +383,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.Tile.State.IDLE && opt_request === true) {
|
||||
if (this.state == ol.TileState.IDLE && opt_request === true) {
|
||||
ol.events.listenOnce(this, ol.events.EventType.CHANGE, function(e) {
|
||||
callback.call(opt_this, this.getData(coordinate));
|
||||
}, this);
|
||||
@@ -411,7 +412,7 @@ ol.source.TileUTFGrid.Tile_.prototype.getKey = function() {
|
||||
* @private
|
||||
*/
|
||||
ol.source.TileUTFGrid.Tile_.prototype.handleError_ = function() {
|
||||
this.state = ol.Tile.State.ERROR;
|
||||
this.state = ol.TileState.ERROR;
|
||||
this.changed();
|
||||
};
|
||||
|
||||
@@ -425,7 +426,7 @@ ol.source.TileUTFGrid.Tile_.prototype.handleLoad_ = function(json) {
|
||||
this.keys_ = json.keys;
|
||||
this.data_ = json.data;
|
||||
|
||||
this.state = ol.Tile.State.EMPTY;
|
||||
this.state = ol.TileState.EMPTY;
|
||||
this.changed();
|
||||
};
|
||||
|
||||
@@ -434,8 +435,8 @@ ol.source.TileUTFGrid.Tile_.prototype.handleLoad_ = function(json) {
|
||||
* @private
|
||||
*/
|
||||
ol.source.TileUTFGrid.Tile_.prototype.loadInternal_ = function() {
|
||||
if (this.state == ol.Tile.State.IDLE) {
|
||||
this.state = ol.Tile.State.LOADING;
|
||||
if (this.state == ol.TileState.IDLE) {
|
||||
this.state = ol.TileState.LOADING;
|
||||
if (this.jsonp_) {
|
||||
ol.net.jsonp(this.src_, this.handleLoad_.bind(this),
|
||||
this.handleError_.bind(this));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
goog.provide('ol.source.UrlTile');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.Tile');
|
||||
goog.require('ol.TileState');
|
||||
goog.require('ol.TileUrlFunction');
|
||||
goog.require('ol.source.Tile');
|
||||
|
||||
@@ -109,15 +109,15 @@ ol.source.UrlTile.prototype.getUrls = function() {
|
||||
ol.source.UrlTile.prototype.handleTileChange = function(event) {
|
||||
var tile = /** @type {ol.Tile} */ (event.target);
|
||||
switch (tile.getState()) {
|
||||
case ol.Tile.State.LOADING:
|
||||
case ol.TileState.LOADING:
|
||||
this.dispatchEvent(
|
||||
new ol.source.Tile.Event(ol.source.Tile.EventType.TILELOADSTART, tile));
|
||||
break;
|
||||
case ol.Tile.State.LOADED:
|
||||
case ol.TileState.LOADED:
|
||||
this.dispatchEvent(
|
||||
new ol.source.Tile.Event(ol.source.Tile.EventType.TILELOADEND, tile));
|
||||
break;
|
||||
case ol.Tile.State.ERROR:
|
||||
case ol.TileState.ERROR:
|
||||
this.dispatchEvent(
|
||||
new ol.source.Tile.Event(ol.source.Tile.EventType.TILELOADERROR, tile));
|
||||
break;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
goog.provide('ol.source.VectorTile');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.Tile');
|
||||
goog.require('ol.TileState');
|
||||
goog.require('ol.VectorTile');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
@@ -59,7 +59,7 @@ ol.source.VectorTile = function(options) {
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {function(new: ol.VectorTile, ol.TileCoord, ol.Tile.State, string,
|
||||
* @type {function(new: ol.VectorTile, ol.TileCoord, ol.TileState, string,
|
||||
* ol.format.Feature, ol.TileLoadFunctionType)}
|
||||
*/
|
||||
this.tileClass = options.tileClass ? options.tileClass : ol.VectorTile;
|
||||
@@ -91,7 +91,7 @@ ol.source.VectorTile.prototype.getTile = function(z, x, y, pixelRatio, projectio
|
||||
this.tileUrlFunction(urlTileCoord, pixelRatio, projection) : undefined;
|
||||
var tile = new this.tileClass(
|
||||
tileCoord,
|
||||
tileUrl !== undefined ? ol.Tile.State.IDLE : ol.Tile.State.EMPTY,
|
||||
tileUrl !== undefined ? ol.TileState.IDLE : ol.TileState.EMPTY,
|
||||
tileUrl !== undefined ? tileUrl : '',
|
||||
this.format_, this.tileLoadFunction);
|
||||
ol.events.listen(tile, ol.events.EventType.CHANGE,
|
||||
|
||||
@@ -2,7 +2,7 @@ goog.provide('ol.source.Zoomify');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.ImageTile');
|
||||
goog.require('ol.Tile');
|
||||
goog.require('ol.TileState');
|
||||
goog.require('ol.asserts');
|
||||
goog.require('ol.dom');
|
||||
goog.require('ol.extent');
|
||||
@@ -127,7 +127,7 @@ ol.inherits(ol.source.Zoomify, ol.source.TileImage);
|
||||
* @constructor
|
||||
* @extends {ol.ImageTile}
|
||||
* @param {ol.TileCoord} tileCoord Tile coordinate.
|
||||
* @param {ol.Tile.State} state State.
|
||||
* @param {ol.TileState} state State.
|
||||
* @param {string} src Image source URI.
|
||||
* @param {?string} crossOrigin Cross origin.
|
||||
* @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function.
|
||||
@@ -157,7 +157,7 @@ ol.source.Zoomify.Tile_.prototype.getImage = function() {
|
||||
}
|
||||
var tileSize = ol.DEFAULT_TILE_SIZE;
|
||||
var image = ol.ImageTile.prototype.getImage.call(this);
|
||||
if (this.state == ol.Tile.State.LOADED) {
|
||||
if (this.state == ol.TileState.LOADED) {
|
||||
if (image.width == tileSize && image.height == tileSize) {
|
||||
this.zoomifyImage_ = image;
|
||||
return image;
|
||||
|
||||
Reference in New Issue
Block a user