Rename _ol_Tile_ to Tile

This commit is contained in:
Tim Schaub
2018-01-11 10:29:56 -07:00
parent 2efdf7982c
commit 1552f27a43
12 changed files with 60 additions and 60 deletions

View File

@@ -2,7 +2,7 @@
* @module ol/ImageTile
*/
import {inherits} from './index.js';
import _ol_Tile_ from './Tile.js';
import Tile from './Tile.js';
import TileState from './TileState.js';
import {createCanvasContext2D} from './dom.js';
import _ol_events_ from './events.js';
@@ -20,7 +20,7 @@ import EventType from './events/EventType.js';
*/
var ImageTile = function(tileCoord, state, src, crossOrigin, tileLoadFunction, opt_options) {
_ol_Tile_.call(this, tileCoord, state, opt_options);
Tile.call(this, tileCoord, state, opt_options);
/**
* @private
@@ -59,7 +59,7 @@ var ImageTile = function(tileCoord, state, src, crossOrigin, tileLoadFunction, o
};
inherits(ImageTile, _ol_Tile_);
inherits(ImageTile, Tile);
/**
@@ -75,7 +75,7 @@ ImageTile.prototype.disposeInternal = function() {
}
this.state = TileState.ABORT;
this.changed();
_ol_Tile_.prototype.disposeInternal.call(this);
Tile.prototype.disposeInternal.call(this);
};

View File

@@ -18,7 +18,7 @@ import EventType from './events/EventType.js';
* @param {ol.TileState} state State.
* @param {olx.TileOptions=} opt_options Tile options.
*/
var _ol_Tile_ = function(tileCoord, state, opt_options) {
var Tile = function(tileCoord, state, opt_options) {
EventTarget.call(this);
var options = opt_options ? opt_options : {};
@@ -66,13 +66,13 @@ var _ol_Tile_ = function(tileCoord, state, opt_options) {
};
inherits(_ol_Tile_, EventTarget);
inherits(Tile, EventTarget);
/**
* @protected
*/
_ol_Tile_.prototype.changed = function() {
Tile.prototype.changed = function() {
this.dispatchEvent(EventType.CHANGE);
};
@@ -80,7 +80,7 @@ _ol_Tile_.prototype.changed = function() {
/**
* @return {string} Key.
*/
_ol_Tile_.prototype.getKey = function() {
Tile.prototype.getKey = function() {
return this.key + '/' + this.tileCoord;
};
@@ -90,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() {
Tile.prototype.getInterimTile = function() {
if (!this.interimTile) {
//empty chain
return this;
@@ -116,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() {
Tile.prototype.refreshInterimChain = function() {
if (!this.interimTile) {
return;
}
@@ -151,7 +151,7 @@ _ol_Tile_.prototype.refreshInterimChain = function() {
* @return {ol.TileCoord} The tile coordinate.
* @api
*/
_ol_Tile_.prototype.getTileCoord = function() {
Tile.prototype.getTileCoord = function() {
return this.tileCoord;
};
@@ -159,14 +159,14 @@ _ol_Tile_.prototype.getTileCoord = function() {
/**
* @return {ol.TileState} State.
*/
_ol_Tile_.prototype.getState = function() {
Tile.prototype.getState = function() {
return this.state;
};
/**
* @param {ol.TileState} state State.
*/
_ol_Tile_.prototype.setState = function(state) {
Tile.prototype.setState = function(state) {
this.state = state;
this.changed();
};
@@ -178,7 +178,7 @@ _ol_Tile_.prototype.setState = function(state) {
* @abstract
* @api
*/
_ol_Tile_.prototype.load = function() {};
Tile.prototype.load = function() {};
/**
* Get the alpha value for rendering.
@@ -186,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) {
Tile.prototype.getAlpha = function(id, time) {
if (!this.transition_) {
return 1;
}
@@ -213,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) {
Tile.prototype.inTransition = function(id) {
if (!this.transition_) {
return false;
}
@@ -224,9 +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) {
Tile.prototype.endTransition = function(id) {
if (this.transition_) {
this.transitionStarts_[id] = -1;
}
};
export default _ol_Tile_;
export default Tile;

View File

@@ -2,7 +2,7 @@
* @module ol/VectorImageTile
*/
import {getUid, inherits} from './index.js';
import _ol_Tile_ from './Tile.js';
import Tile from './Tile.js';
import TileState from './TileState.js';
import {createCanvasContext2D} from './dom.js';
import _ol_events_ from './events.js';
@@ -36,7 +36,7 @@ var VectorImageTile = function(tileCoord, state, sourceRevision, format,
tileLoadFunction, urlTileCoord, tileUrlFunction, sourceTileGrid, tileGrid,
sourceTiles, pixelRatio, projection, tileClass, handleTileChange, opt_options) {
_ol_Tile_.call(this, tileCoord, state, opt_options);
Tile.call(this, tileCoord, state, opt_options);
/**
* @private
@@ -121,7 +121,7 @@ var VectorImageTile = function(tileCoord, state, sourceRevision, format,
};
inherits(VectorImageTile, _ol_Tile_);
inherits(VectorImageTile, Tile);
/**
@@ -149,7 +149,7 @@ VectorImageTile.prototype.disposeInternal = function() {
this.loadListenerKeys_.length = 0;
this.sourceTileListenerKeys_.forEach(_ol_events_.unlistenByKey);
this.sourceTileListenerKeys_.length = 0;
_ol_Tile_.prototype.disposeInternal.call(this);
Tile.prototype.disposeInternal.call(this);
};

View File

@@ -2,7 +2,7 @@
* @module ol/VectorTile
*/
import {getUid, inherits} from './index.js';
import _ol_Tile_ from './Tile.js';
import Tile from './Tile.js';
import TileState from './TileState.js';
/**
@@ -17,7 +17,7 @@ import TileState from './TileState.js';
*/
var VectorTile = function(tileCoord, state, src, format, tileLoadFunction, opt_options) {
_ol_Tile_.call(this, tileCoord, state, opt_options);
Tile.call(this, tileCoord, state, opt_options);
/**
* @type {number}
@@ -75,7 +75,7 @@ var VectorTile = function(tileCoord, state, src, format, tileLoadFunction, opt_o
};
inherits(VectorTile, _ol_Tile_);
inherits(VectorTile, Tile);
/**
* @const
@@ -92,7 +92,7 @@ VectorTile.prototype.disposeInternal = function() {
this.replayGroups_ = {};
this.state = TileState.ABORT;
this.changed();
_ol_Tile_.prototype.disposeInternal.call(this);
Tile.prototype.disposeInternal.call(this);
};

View File

@@ -3,7 +3,7 @@
*/
import {ERROR_THRESHOLD} from './common.js';
import {inherits} from '../index.js';
import _ol_Tile_ from '../Tile.js';
import Tile from '../Tile.js';
import TileState from '../TileState.js';
import _ol_events_ from '../events.js';
import EventType from '../events/EventType.js';
@@ -36,7 +36,7 @@ var ReprojTile = function(sourceProj, sourceTileGrid,
targetProj, targetTileGrid, tileCoord, wrappedTileCoord,
pixelRatio, gutter, getTileFunction,
opt_errorThreshold, opt_renderEdges) {
_ol_Tile_.call(this, tileCoord, TileState.IDLE);
Tile.call(this, tileCoord, TileState.IDLE);
/**
* @private
@@ -187,7 +187,7 @@ var ReprojTile = function(sourceProj, sourceTileGrid,
}
};
inherits(ReprojTile, _ol_Tile_);
inherits(ReprojTile, Tile);
/**
@@ -197,7 +197,7 @@ ReprojTile.prototype.disposeInternal = function() {
if (this.state == TileState.LOADING) {
this.unlistenSources_();
}
_ol_Tile_.prototype.disposeInternal.call(this);
Tile.prototype.disposeInternal.call(this);
};

View File

@@ -2,7 +2,7 @@
* @module ol/source/TileDebug
*/
import {inherits} from '../index.js';
import _ol_Tile_ from '../Tile.js';
import Tile from '../Tile.js';
import TileState from '../TileState.js';
import {createCanvasContext2D} from '../dom.js';
import _ol_size_ from '../size.js';
@@ -66,7 +66,7 @@ TileDebug.prototype.getTile = function(z, x, y) {
*/
TileDebug.Tile_ = function(tileCoord, tileSize, text) {
_ol_Tile_.call(this, tileCoord, TileState.LOADED);
Tile.call(this, tileCoord, TileState.LOADED);
/**
* @private
@@ -87,7 +87,7 @@ TileDebug.Tile_ = function(tileCoord, tileSize, text) {
this.canvas_ = null;
};
inherits(TileDebug.Tile_, _ol_Tile_);
inherits(TileDebug.Tile_, Tile);
/**

View File

@@ -2,7 +2,7 @@
* @module ol/source/TileUTFGrid
*/
import {inherits} from '../index.js';
import _ol_Tile_ from '../Tile.js';
import Tile from '../Tile.js';
import TileState from '../TileState.js';
import {createFromTemplates, nullTileUrlFunction} from '../tileurlfunction.js';
import {assert} from '../asserts.js';
@@ -259,7 +259,7 @@ UTFGrid.prototype.useTile = function(z, x, y) {
*/
UTFGrid.Tile_ = function(tileCoord, state, src, extent, preemptive, jsonp) {
_ol_Tile_.call(this, tileCoord, state);
Tile.call(this, tileCoord, state);
/**
* @private
@@ -305,7 +305,7 @@ UTFGrid.Tile_ = function(tileCoord, state, src, extent, preemptive, jsonp) {
this.jsonp_ = jsonp;
};
inherits(UTFGrid.Tile_, _ol_Tile_);
inherits(UTFGrid.Tile_, Tile);
/**

View File

@@ -1,5 +1,5 @@
import Map from '../../../../src/ol/Map.js';
import _ol_Tile_ from '../../../../src/ol/Tile.js';
import Tile from '../../../../src/ol/Tile.js';
import View from '../../../../src/ol/View.js';
import Attribution from '../../../../src/ol/control/Attribution.js';
import TileLayer from '../../../../src/ol/layer/Tile.js';
@@ -50,7 +50,7 @@ describe('ol.control.Attribution', function() {
map.getLayers().forEach(function(layer) {
var source = layer.getSource();
source.getTile = function() {
var tile = new _ol_Tile_([0, 0, -1], 2 /* LOADED */);
var tile = new Tile([0, 0, -1], 2 /* LOADED */);
tile.getImage = function() {
var image = new Image();
image.width = 256;

View File

@@ -1,5 +1,5 @@
import {inherits} from '../../../../src/ol/index.js';
import _ol_Tile_ from '../../../../src/ol/Tile.js';
import Tile from '../../../../src/ol/Tile.js';
import TileRange from '../../../../src/ol/TileRange.js';
import {get as getProjection} from '../../../../src/ol/proj.js';
import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js';
@@ -31,7 +31,7 @@ var MockTile = function(tileStates) {
});
for (var key in tileStates) {
this.tileCache.set(key, new _ol_Tile_(key.split('/'), tileStates[key]));
this.tileCache.set(key, new Tile(key.split('/'), tileStates[key]));
}
};
@@ -46,7 +46,7 @@ MockTile.prototype.getTile = function(z, x, y) {
if (this.tileCache.containsKey(key)) {
return /** @type {!ol.Tile} */ (this.tileCache.get(key));
} else {
var tile = new _ol_Tile_(key, 0); // IDLE
var tile = new Tile(key, 0); // IDLE
this.tileCache.set(key, tile);
return tile;
}
@@ -279,7 +279,7 @@ describe('ol.source.Tile', function() {
});
// check the loaded tile is there
var tile = source.getTile(1, 0, 0);
expect(tile).to.be.a(_ol_Tile_);
expect(tile).to.be.a(Tile);
// check tile cache is filled
expect(source.tileCache.getCount()).to.eql(1);
// refresh the source
@@ -312,17 +312,17 @@ describe('MockTile', function() {
// check a loaded tile
tile = source.getTile(0, 0, 0);
expect(tile).to.be.a(_ol_Tile_);
expect(tile).to.be.a(Tile);
expect(tile.state).to.be(2); // LOADED
// check a tile that is not loaded
tile = source.getTile(1, 0, -1);
expect(tile).to.be.a(_ol_Tile_);
expect(tile).to.be.a(Tile);
expect(tile.state).to.be(0); // IDLE
// check another loaded tile
tile = source.getTile(1, 0, 0);
expect(tile).to.be.a(_ol_Tile_);
expect(tile).to.be.a(Tile);
expect(tile.state).to.be(2); // LOADED
});

View File

@@ -1,6 +1,6 @@
import {getUid} from '../../../src/ol/index.js';
import ImageTile from '../../../src/ol/ImageTile.js';
import _ol_Tile_ from '../../../src/ol/Tile.js';
import Tile from '../../../src/ol/Tile.js';
import TileState from '../../../src/ol/TileState.js';
@@ -8,14 +8,14 @@ describe('ol.Tile', function() {
describe('constructor', function() {
it('sets a default transition', function() {
var coord = [0, 0, 0];
var tile = new _ol_Tile_(coord, TileState.IDLE);
var tile = new Tile(coord, TileState.IDLE);
expect(tile.transition_).to.equal(250);
});
it('allows the transition to be set', function() {
var coord = [0, 0, 0];
var transition = 500;
var tile = new _ol_Tile_(coord, TileState.IDLE, {transition: transition});
var tile = new Tile(coord, TileState.IDLE, {transition: transition});
expect(tile.transition_).to.equal(transition);
});
});
@@ -23,7 +23,7 @@ describe('ol.Tile', function() {
describe('#getAlpha()', function() {
it('returns the alpha value for a tile in transition', function() {
var coord = [0, 0, 0];
var tile = new _ol_Tile_(coord, TileState.IDLE);
var tile = new Tile(coord, TileState.IDLE);
var id = 'test';
var time = Date.now();
@@ -45,7 +45,7 @@ describe('ol.Tile', function() {
describe('#inTransition()', function() {
it('determines if the tile is in transition', function() {
var coord = [0, 0, 0];
var tile = new _ol_Tile_(coord, TileState.IDLE);
var tile = new Tile(coord, TileState.IDLE);
var id = 'test';
expect(tile.inTransition(id)).to.be(true);

View File

@@ -1,4 +1,4 @@
import _ol_Tile_ from '../../../src/ol/Tile.js';
import Tile from '../../../src/ol/Tile.js';
import TileCache from '../../../src/ol/TileCache.js';
import _ol_tilecoord_ from '../../../src/ol/tilecoord.js';
@@ -8,13 +8,13 @@ describe('ol.TileCache', function() {
describe('#pruneExceptNewestZ()', function() {
it('gets rid of all entries that are not at the newest z', function() {
var tiles = [
new _ol_Tile_([0, 0, 0]),
new _ol_Tile_([1, 0, 0]),
new _ol_Tile_([1, 1, 0]),
new _ol_Tile_([2, 0, 0]),
new _ol_Tile_([2, 1, 0]),
new _ol_Tile_([2, 2, 0]),
new _ol_Tile_([2, 3, 0]) // newest tile at z: 2
new Tile([0, 0, 0]),
new Tile([1, 0, 0]),
new Tile([1, 1, 0]),
new Tile([2, 0, 0]),
new Tile([2, 1, 0]),
new Tile([2, 2, 0]),
new Tile([2, 3, 0]) // newest tile at z: 2
];
var cache = new TileCache();

View File

@@ -1,5 +1,5 @@
import ImageTile from '../../../src/ol/ImageTile.js';
import _ol_Tile_ from '../../../src/ol/Tile.js';
import Tile from '../../../src/ol/Tile.js';
import TileQueue from '../../../src/ol/TileQueue.js';
import TileState from '../../../src/ol/TileState.js';
import ImageSource from '../../../src/ol/source/Image.js';
@@ -11,7 +11,7 @@ describe('ol.TileQueue', function() {
function addRandomPriorityTiles(tq, num) {
var i, tile, priority;
for (i = 0; i < num; i++) {
tile = new _ol_Tile_();
tile = new Tile();
priority = Math.floor(Math.random() * 100);
tq.elements_.push([tile, '', [0, 0]]);
tq.priorities_.push(priority);