Move State to ol.Tile
This commit is contained in:
@@ -2,8 +2,8 @@ goog.provide('ol.source.Tile');
|
||||
goog.provide('ol.source.TileEvent');
|
||||
|
||||
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');
|
||||
@@ -118,7 +118,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() === ol.Tile.State.LOADED;
|
||||
if (loaded) {
|
||||
loaded = (callback(tile) !== false);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
goog.provide('ol.source.TileDebug');
|
||||
|
||||
goog.require('ol.Tile');
|
||||
goog.require('ol.TileState');
|
||||
goog.require('ol.dom');
|
||||
goog.require('ol.size');
|
||||
goog.require('ol.source.Tile');
|
||||
@@ -17,7 +16,7 @@ goog.require('ol.source.Tile');
|
||||
*/
|
||||
ol.DebugTile_ = function(tileCoord, tileSize, text) {
|
||||
|
||||
ol.Tile.call(this, tileCoord, ol.TileState.LOADED);
|
||||
ol.Tile.call(this, tileCoord, ol.Tile.State.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.TileState, string,
|
||||
* @type {function(new: ol.ImageTile, ol.TileCoord, ol.Tile.State, 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.TileState.IDLE : ol.TileState.EMPTY,
|
||||
tileUrl !== undefined ? ol.Tile.State.IDLE : ol.Tile.State.EMPTY,
|
||||
tileUrl !== undefined ? tileUrl : '',
|
||||
this.crossOrigin,
|
||||
this.tileLoadFunction);
|
||||
@@ -303,18 +303,18 @@ ol.source.TileImage.prototype.getTileInternal = function(z, x, y, pixelRatio, pr
|
||||
// cases we attempt to assign an interim tile to the new tile.
|
||||
var /** @type {ol.Tile} */ interimTile = tile;
|
||||
if (tile.interimTile && tile.interimTile.key == key) {
|
||||
goog.DEBUG && console.assert(tile.interimTile.getState() == ol.TileState.LOADED);
|
||||
goog.DEBUG && console.assert(tile.interimTile.getState() == ol.Tile.State.LOADED);
|
||||
goog.DEBUG && console.assert(tile.interimTile.interimTile === null);
|
||||
tile = tile.interimTile;
|
||||
if (interimTile.getState() == ol.TileState.LOADED) {
|
||||
if (interimTile.getState() == ol.Tile.State.LOADED) {
|
||||
tile.interimTile = interimTile;
|
||||
}
|
||||
} else {
|
||||
tile = this.createTile_(z, x, y, pixelRatio, projection, key);
|
||||
if (interimTile.getState() == ol.TileState.LOADED) {
|
||||
if (interimTile.getState() == ol.Tile.State.LOADED) {
|
||||
tile.interimTile = interimTile;
|
||||
} else if (interimTile.interimTile &&
|
||||
interimTile.interimTile.getState() == ol.TileState.LOADED) {
|
||||
interimTile.interimTile.getState() == ol.Tile.State.LOADED) {
|
||||
tile.interimTile = interimTile.interimTile;
|
||||
interimTile.interimTile = null;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ goog.provide('ol.source.TileUTFGrid');
|
||||
goog.require('goog.async.nextTick');
|
||||
goog.require('ol.Attribution');
|
||||
goog.require('ol.Tile');
|
||||
goog.require('ol.TileState');
|
||||
goog.require('ol.TileUrlFunction');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
@@ -236,7 +235,7 @@ ol.source.TileUTFGrid.prototype.getTile = function(z, x, y, pixelRatio, projecti
|
||||
var tileUrl = this.tileUrlFunction_(urlTileCoord, pixelRatio, projection);
|
||||
var tile = new ol.source.TileUTFGridTile_(
|
||||
tileCoord,
|
||||
tileUrl !== undefined ? ol.TileState.IDLE : ol.TileState.EMPTY,
|
||||
tileUrl !== undefined ? ol.Tile.State.IDLE : ol.Tile.State.EMPTY,
|
||||
tileUrl !== undefined ? tileUrl : '',
|
||||
this.tileGrid.getTileCoordExtent(tileCoord),
|
||||
this.preemptive_,
|
||||
@@ -262,7 +261,7 @@ ol.source.TileUTFGrid.prototype.useTile = function(z, x, y) {
|
||||
* @constructor
|
||||
* @extends {ol.Tile}
|
||||
* @param {ol.TileCoord} tileCoord Tile coordinate.
|
||||
* @param {ol.TileState} state State.
|
||||
* @param {ol.Tile.State} 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).
|
||||
@@ -384,7 +383,7 @@ ol.source.TileUTFGridTile_.prototype.getData = function(coordinate) {
|
||||
* @template T
|
||||
*/
|
||||
ol.source.TileUTFGridTile_.prototype.forDataAtCoordinate = function(coordinate, callback, opt_this, opt_request) {
|
||||
if (this.state == ol.TileState.IDLE && opt_request === true) {
|
||||
if (this.state == ol.Tile.State.IDLE && opt_request === true) {
|
||||
ol.events.listenOnce(this, ol.events.EventType.CHANGE, function(e) {
|
||||
callback.call(opt_this, this.getData(coordinate));
|
||||
}, this);
|
||||
@@ -413,7 +412,7 @@ ol.source.TileUTFGridTile_.prototype.getKey = function() {
|
||||
* @private
|
||||
*/
|
||||
ol.source.TileUTFGridTile_.prototype.handleError_ = function() {
|
||||
this.state = ol.TileState.ERROR;
|
||||
this.state = ol.Tile.State.ERROR;
|
||||
this.changed();
|
||||
};
|
||||
|
||||
@@ -427,7 +426,7 @@ ol.source.TileUTFGridTile_.prototype.handleLoad_ = function(json) {
|
||||
this.keys_ = json.keys;
|
||||
this.data_ = json.data;
|
||||
|
||||
this.state = ol.TileState.EMPTY;
|
||||
this.state = ol.Tile.State.EMPTY;
|
||||
this.changed();
|
||||
};
|
||||
|
||||
@@ -436,8 +435,8 @@ ol.source.TileUTFGridTile_.prototype.handleLoad_ = function(json) {
|
||||
* @private
|
||||
*/
|
||||
ol.source.TileUTFGridTile_.prototype.loadInternal_ = function() {
|
||||
if (this.state == ol.TileState.IDLE) {
|
||||
this.state = ol.TileState.LOADING;
|
||||
if (this.state == ol.Tile.State.IDLE) {
|
||||
this.state = ol.Tile.State.LOADING;
|
||||
if (this.jsonp_) {
|
||||
ol.net.jsonp(this.src_, this.handleLoad_.bind(this),
|
||||
this.handleError_.bind(this));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
goog.provide('ol.source.UrlTile');
|
||||
|
||||
goog.require('ol.TileState');
|
||||
goog.require('ol.Tile');
|
||||
goog.require('ol.TileUrlFunction');
|
||||
goog.require('ol.source.Tile');
|
||||
goog.require('ol.source.TileEvent');
|
||||
@@ -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.TileState.LOADING:
|
||||
case ol.Tile.State.LOADING:
|
||||
this.dispatchEvent(
|
||||
new ol.source.TileEvent(ol.source.TileEventType.TILELOADSTART, tile));
|
||||
break;
|
||||
case ol.TileState.LOADED:
|
||||
case ol.Tile.State.LOADED:
|
||||
this.dispatchEvent(
|
||||
new ol.source.TileEvent(ol.source.TileEventType.TILELOADEND, tile));
|
||||
break;
|
||||
case ol.TileState.ERROR:
|
||||
case ol.Tile.State.ERROR:
|
||||
this.dispatchEvent(
|
||||
new ol.source.TileEvent(ol.source.TileEventType.TILELOADERROR, tile));
|
||||
break;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
goog.provide('ol.source.VectorTile');
|
||||
|
||||
goog.require('ol.TileState');
|
||||
goog.require('ol.Tile');
|
||||
goog.require('ol.VectorTile');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
@@ -53,7 +53,7 @@ ol.source.VectorTile = function(options) {
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {function(new: ol.VectorTile, ol.TileCoord, ol.TileState, string,
|
||||
* @type {function(new: ol.VectorTile, ol.TileCoord, ol.Tile.State, string,
|
||||
* ol.format.Feature, ol.TileLoadFunctionType)}
|
||||
*/
|
||||
this.tileClass = options.tileClass ? options.tileClass : ol.VectorTile;
|
||||
@@ -77,7 +77,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.TileState.IDLE : ol.TileState.EMPTY,
|
||||
tileUrl !== undefined ? ol.Tile.State.IDLE : ol.Tile.State.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.TileState');
|
||||
goog.require('ol.Tile');
|
||||
goog.require('ol.dom');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.source.TileImage');
|
||||
@@ -135,7 +135,7 @@ ol.inherits(ol.source.Zoomify, ol.source.TileImage);
|
||||
* @constructor
|
||||
* @extends {ol.ImageTile}
|
||||
* @param {ol.TileCoord} tileCoord Tile coordinate.
|
||||
* @param {ol.TileState} state State.
|
||||
* @param {ol.Tile.State} state State.
|
||||
* @param {string} src Image source URI.
|
||||
* @param {?string} crossOrigin Cross origin.
|
||||
* @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function.
|
||||
@@ -168,7 +168,7 @@ ol.source.ZoomifyTile_.prototype.getImage = function(opt_context) {
|
||||
return this.zoomifyImageByContext_[key];
|
||||
} else {
|
||||
var image = ol.ImageTile.prototype.getImage.call(this, opt_context);
|
||||
if (this.state == ol.TileState.LOADED) {
|
||||
if (this.state == ol.Tile.State.LOADED) {
|
||||
if (image.width == tileSize && image.height == tileSize) {
|
||||
this.zoomifyImageByContext_[key] = image;
|
||||
return image;
|
||||
|
||||
Reference in New Issue
Block a user