Transformed
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
goog.provide('ol.Tile');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.TileState');
|
||||
goog.require('ol.easing');
|
||||
goog.require('ol.events.EventTarget');
|
||||
goog.require('ol.events.EventType');
|
||||
|
||||
/**
|
||||
* @module ol/Tile
|
||||
*/
|
||||
import _ol_ from './index.js';
|
||||
import _ol_TileState_ from './TileState.js';
|
||||
import _ol_easing_ from './easing.js';
|
||||
import _ol_events_EventTarget_ from './events/EventTarget.js';
|
||||
import _ol_events_EventType_ from './events/EventType.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -18,8 +18,8 @@ goog.require('ol.events.EventType');
|
||||
* @param {ol.TileState} state State.
|
||||
* @param {olx.TileOptions=} opt_options Tile options.
|
||||
*/
|
||||
ol.Tile = function(tileCoord, state, opt_options) {
|
||||
ol.events.EventTarget.call(this);
|
||||
var _ol_Tile_ = function(tileCoord, state, opt_options) {
|
||||
_ol_events_EventTarget_.call(this);
|
||||
|
||||
var options = opt_options ? opt_options : {};
|
||||
|
||||
@@ -65,21 +65,22 @@ ol.Tile = function(tileCoord, state, opt_options) {
|
||||
this.transitionStarts_ = {};
|
||||
|
||||
};
|
||||
ol.inherits(ol.Tile, ol.events.EventTarget);
|
||||
|
||||
_ol_.inherits(_ol_Tile_, _ol_events_EventTarget_);
|
||||
|
||||
|
||||
/**
|
||||
* @protected
|
||||
*/
|
||||
ol.Tile.prototype.changed = function() {
|
||||
this.dispatchEvent(ol.events.EventType.CHANGE);
|
||||
_ol_Tile_.prototype.changed = function() {
|
||||
this.dispatchEvent(_ol_events_EventType_.CHANGE);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {string} Key.
|
||||
*/
|
||||
ol.Tile.prototype.getKey = function() {
|
||||
_ol_Tile_.prototype.getKey = function() {
|
||||
return this.key + '/' + this.tileCoord;
|
||||
};
|
||||
|
||||
@@ -89,7 +90,7 @@ ol.Tile.prototype.getKey = function() {
|
||||
* such tile exists, the original tile is returned.
|
||||
* @return {!ol.Tile} Best tile for rendering.
|
||||
*/
|
||||
ol.Tile.prototype.getInterimTile = function() {
|
||||
_ol_Tile_.prototype.getInterimTile = function() {
|
||||
if (!this.interimTile) {
|
||||
//empty chain
|
||||
return this;
|
||||
@@ -101,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() == _ol_TileState_.LOADED) {
|
||||
return tile;
|
||||
}
|
||||
tile = tile.interimTile;
|
||||
@@ -115,7 +116,7 @@ ol.Tile.prototype.getInterimTile = function() {
|
||||
* Goes through the chain of interim tiles and discards sections of the chain
|
||||
* that are no longer relevant.
|
||||
*/
|
||||
ol.Tile.prototype.refreshInterimChain = function() {
|
||||
_ol_Tile_.prototype.refreshInterimChain = function() {
|
||||
if (!this.interimTile) {
|
||||
return;
|
||||
}
|
||||
@@ -124,17 +125,17 @@ ol.Tile.prototype.refreshInterimChain = function() {
|
||||
var prev = this;
|
||||
|
||||
do {
|
||||
if (tile.getState() == ol.TileState.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.TileState.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.TileState.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;
|
||||
@@ -150,7 +151,7 @@ ol.Tile.prototype.refreshInterimChain = function() {
|
||||
* @return {ol.TileCoord} The tile coordinate.
|
||||
* @api
|
||||
*/
|
||||
ol.Tile.prototype.getTileCoord = function() {
|
||||
_ol_Tile_.prototype.getTileCoord = function() {
|
||||
return this.tileCoord;
|
||||
};
|
||||
|
||||
@@ -158,14 +159,14 @@ ol.Tile.prototype.getTileCoord = function() {
|
||||
/**
|
||||
* @return {ol.TileState} State.
|
||||
*/
|
||||
ol.Tile.prototype.getState = function() {
|
||||
_ol_Tile_.prototype.getState = function() {
|
||||
return this.state;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {ol.TileState} state State.
|
||||
*/
|
||||
ol.Tile.prototype.setState = function(state) {
|
||||
_ol_Tile_.prototype.setState = function(state) {
|
||||
this.state = state;
|
||||
this.changed();
|
||||
};
|
||||
@@ -177,7 +178,7 @@ ol.Tile.prototype.setState = function(state) {
|
||||
* @abstract
|
||||
* @api
|
||||
*/
|
||||
ol.Tile.prototype.load = function() {};
|
||||
_ol_Tile_.prototype.load = function() {};
|
||||
|
||||
/**
|
||||
* Get the alpha value for rendering.
|
||||
@@ -185,7 +186,7 @@ ol.Tile.prototype.load = function() {};
|
||||
* @param {number} time The render frame time.
|
||||
* @return {number} A number between 0 and 1.
|
||||
*/
|
||||
ol.Tile.prototype.getAlpha = function(id, time) {
|
||||
_ol_Tile_.prototype.getAlpha = function(id, time) {
|
||||
if (!this.transition_) {
|
||||
return 1;
|
||||
}
|
||||
@@ -202,7 +203,7 @@ ol.Tile.prototype.getAlpha = function(id, time) {
|
||||
if (delta >= this.transition_) {
|
||||
return 1;
|
||||
}
|
||||
return ol.easing.easeIn(delta / this.transition_);
|
||||
return _ol_easing_.easeIn(delta / this.transition_);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -212,7 +213,7 @@ ol.Tile.prototype.getAlpha = function(id, time) {
|
||||
* @param {number} id An id for the renderer.
|
||||
* @return {boolean} The tile is in transition.
|
||||
*/
|
||||
ol.Tile.prototype.inTransition = function(id) {
|
||||
_ol_Tile_.prototype.inTransition = function(id) {
|
||||
if (!this.transition_) {
|
||||
return false;
|
||||
}
|
||||
@@ -223,8 +224,9 @@ ol.Tile.prototype.inTransition = function(id) {
|
||||
* Mark a transition as complete.
|
||||
* @param {number} id An id for the renderer.
|
||||
*/
|
||||
ol.Tile.prototype.endTransition = function(id) {
|
||||
_ol_Tile_.prototype.endTransition = function(id) {
|
||||
if (this.transition_) {
|
||||
this.transitionStarts_[id] = -1;
|
||||
}
|
||||
};
|
||||
export default _ol_Tile_;
|
||||
|
||||
Reference in New Issue
Block a user