Rename _ol_source_Tile_ to TileSource

This commit is contained in:
Tim Schaub
2018-01-08 10:11:20 -07:00
parent d75623084e
commit d2c0ea103e
10 changed files with 57 additions and 57 deletions

View File

@@ -18,7 +18,7 @@ import CanvasTileLayerRenderer from '../renderer/canvas/TileLayer.js';
import ImageSource from '../source/Image.js';
import RasterOperationType from '../source/RasterOperationType.js';
import SourceState from '../source/State.js';
import _ol_source_Tile_ from '../source/Tile.js';
import TileSource from '../source/Tile.js';
import _ol_transform_ from '../transform.js';
@@ -398,7 +398,7 @@ function createRenderers(sources) {
*/
function createRenderer(source) {
var renderer = null;
if (source instanceof _ol_source_Tile_) {
if (source instanceof TileSource) {
renderer = createTileRenderer(source);
} else if (source instanceof ImageSource) {
renderer = createImageRenderer(source);

View File

@@ -23,7 +23,7 @@ import _ol_tilegrid_ from '../tilegrid.js';
* @param {ol.SourceTileOptions} options Tile source options.
* @api
*/
var _ol_source_Tile_ = function(options) {
var TileSource = function(options) {
Source.call(this, {
attributions: options.attributions,
@@ -78,13 +78,13 @@ var _ol_source_Tile_ = function(options) {
};
inherits(_ol_source_Tile_, Source);
inherits(TileSource, Source);
/**
* @return {boolean} Can expire cache.
*/
_ol_source_Tile_.prototype.canExpireCache = function() {
TileSource.prototype.canExpireCache = function() {
return this.tileCache.canExpireCache();
};
@@ -93,7 +93,7 @@ _ol_source_Tile_.prototype.canExpireCache = function() {
* @param {ol.proj.Projection} projection Projection.
* @param {Object.<string, ol.TileRange>} usedTiles Used tiles.
*/
_ol_source_Tile_.prototype.expireCache = function(projection, usedTiles) {
TileSource.prototype.expireCache = function(projection, usedTiles) {
var tileCache = this.getTileCacheForProjection(projection);
if (tileCache) {
tileCache.expireCache(usedTiles);
@@ -110,7 +110,7 @@ _ol_source_Tile_.prototype.expireCache = function(projection, usedTiles) {
* considered loaded.
* @return {boolean} The tile range is fully covered with loaded tiles.
*/
_ol_source_Tile_.prototype.forEachLoadedTile = function(projection, z, tileRange, callback) {
TileSource.prototype.forEachLoadedTile = function(projection, z, tileRange, callback) {
var tileCache = this.getTileCacheForProjection(projection);
if (!tileCache) {
return false;
@@ -142,7 +142,7 @@ _ol_source_Tile_.prototype.forEachLoadedTile = function(projection, z, tileRange
* @param {ol.proj.Projection} projection Projection.
* @return {number} Gutter.
*/
_ol_source_Tile_.prototype.getGutter = function(projection) {
TileSource.prototype.getGutter = function(projection) {
return 0;
};
@@ -152,7 +152,7 @@ _ol_source_Tile_.prototype.getGutter = function(projection) {
* @return {string} The key for all tiles.
* @protected
*/
_ol_source_Tile_.prototype.getKey = function() {
TileSource.prototype.getKey = function() {
return this.key_;
};
@@ -162,7 +162,7 @@ _ol_source_Tile_.prototype.getKey = function() {
* @param {string} key The key for tiles.
* @protected
*/
_ol_source_Tile_.prototype.setKey = function(key) {
TileSource.prototype.setKey = function(key) {
if (this.key_ !== key) {
this.key_ = key;
this.changed();
@@ -174,7 +174,7 @@ _ol_source_Tile_.prototype.setKey = function(key) {
* @param {ol.proj.Projection} projection Projection.
* @return {boolean} Opaque.
*/
_ol_source_Tile_.prototype.getOpaque = function(projection) {
TileSource.prototype.getOpaque = function(projection) {
return this.opaque_;
};
@@ -182,7 +182,7 @@ _ol_source_Tile_.prototype.getOpaque = function(projection) {
/**
* @inheritDoc
*/
_ol_source_Tile_.prototype.getResolutions = function() {
TileSource.prototype.getResolutions = function() {
return this.tileGrid.getResolutions();
};
@@ -196,7 +196,7 @@ _ol_source_Tile_.prototype.getResolutions = function() {
* @param {ol.proj.Projection} projection Projection.
* @return {!ol.Tile} Tile.
*/
_ol_source_Tile_.prototype.getTile = function(z, x, y, pixelRatio, projection) {};
TileSource.prototype.getTile = function(z, x, y, pixelRatio, projection) {};
/**
@@ -204,7 +204,7 @@ _ol_source_Tile_.prototype.getTile = function(z, x, y, pixelRatio, projection) {
* @return {ol.tilegrid.TileGrid} Tile grid.
* @api
*/
_ol_source_Tile_.prototype.getTileGrid = function() {
TileSource.prototype.getTileGrid = function() {
return this.tileGrid;
};
@@ -213,7 +213,7 @@ _ol_source_Tile_.prototype.getTileGrid = function() {
* @param {ol.proj.Projection} projection Projection.
* @return {!ol.tilegrid.TileGrid} Tile grid.
*/
_ol_source_Tile_.prototype.getTileGridForProjection = function(projection) {
TileSource.prototype.getTileGridForProjection = function(projection) {
if (!this.tileGrid) {
return _ol_tilegrid_.getForProjection(projection);
} else {
@@ -227,7 +227,7 @@ _ol_source_Tile_.prototype.getTileGridForProjection = function(projection) {
* @return {ol.TileCache} Tile cache.
* @protected
*/
_ol_source_Tile_.prototype.getTileCacheForProjection = function(projection) {
TileSource.prototype.getTileCacheForProjection = function(projection) {
var thisProj = this.getProjection();
if (thisProj && !equivalent(thisProj, projection)) {
return null;
@@ -244,7 +244,7 @@ _ol_source_Tile_.prototype.getTileCacheForProjection = function(projection) {
* @param {number} pixelRatio Pixel ratio.
* @return {number} Tile pixel ratio.
*/
_ol_source_Tile_.prototype.getTilePixelRatio = function(pixelRatio) {
TileSource.prototype.getTilePixelRatio = function(pixelRatio) {
return this.tilePixelRatio_;
};
@@ -255,7 +255,7 @@ _ol_source_Tile_.prototype.getTilePixelRatio = function(pixelRatio) {
* @param {ol.proj.Projection} projection Projection.
* @return {ol.Size} Tile size.
*/
_ol_source_Tile_.prototype.getTilePixelSize = function(z, pixelRatio, projection) {
TileSource.prototype.getTilePixelSize = function(z, pixelRatio, projection) {
var tileGrid = this.getTileGridForProjection(projection);
var tilePixelRatio = this.getTilePixelRatio(pixelRatio);
var tileSize = _ol_size_.toSize(tileGrid.getTileSize(z), this.tmpSize);
@@ -276,7 +276,7 @@ _ol_source_Tile_.prototype.getTilePixelSize = function(z, pixelRatio, projection
* @return {ol.TileCoord} Tile coordinate to be passed to the tileUrlFunction or
* null if no tile URL should be created for the passed `tileCoord`.
*/
_ol_source_Tile_.prototype.getTileCoordForTileUrlFunction = function(tileCoord, opt_projection) {
TileSource.prototype.getTileCoordForTileUrlFunction = function(tileCoord, opt_projection) {
var projection = opt_projection !== undefined ?
opt_projection : this.getProjection();
var tileGrid = this.getTileGridForProjection(projection);
@@ -290,7 +290,7 @@ _ol_source_Tile_.prototype.getTileCoordForTileUrlFunction = function(tileCoord,
/**
* @inheritDoc
*/
_ol_source_Tile_.prototype.refresh = function() {
TileSource.prototype.refresh = function() {
this.tileCache.clear();
this.changed();
};
@@ -303,7 +303,7 @@ _ol_source_Tile_.prototype.refresh = function() {
* @param {number} y Tile coordinate y.
* @param {ol.proj.Projection} projection Projection.
*/
_ol_source_Tile_.prototype.useTile = nullFunction;
TileSource.prototype.useTile = nullFunction;
/**
@@ -317,7 +317,7 @@ _ol_source_Tile_.prototype.useTile = nullFunction;
* @param {string} type Type.
* @param {ol.Tile} tile The tile.
*/
_ol_source_Tile_.Event = function(type, tile) {
TileSource.Event = function(type, tile) {
Event.call(this, type);
@@ -329,5 +329,5 @@ _ol_source_Tile_.Event = function(type, tile) {
this.tile = tile;
};
inherits(_ol_source_Tile_.Event, Event);
export default _ol_source_Tile_;
inherits(TileSource.Event, Event);
export default TileSource;

View File

@@ -6,7 +6,7 @@ import _ol_Tile_ from '../Tile.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';
import TileSource from '../source/Tile.js';
import _ol_tilecoord_ from '../tilecoord.js';
/**
@@ -24,7 +24,7 @@ import _ol_tilecoord_ from '../tilecoord.js';
*/
var _ol_source_TileDebug_ = function(options) {
_ol_source_Tile_.call(this, {
TileSource.call(this, {
opaque: false,
projection: options.projection,
tileGrid: options.tileGrid,
@@ -33,7 +33,7 @@ var _ol_source_TileDebug_ = function(options) {
};
inherits(_ol_source_TileDebug_, _ol_source_Tile_);
inherits(_ol_source_TileDebug_, TileSource);
/**

View File

@@ -12,7 +12,7 @@ import {applyTransform, intersects} from '../extent.js';
import _ol_net_ from '../net.js';
import {get as getProjection, getTransformFromProjections} from '../proj.js';
import SourceState from '../source/State.js';
import _ol_source_Tile_ from '../source/Tile.js';
import TileSource from '../source/Tile.js';
import _ol_tilecoord_ from '../tilecoord.js';
import _ol_tilegrid_ from '../tilegrid.js';
@@ -26,7 +26,7 @@ import _ol_tilegrid_ from '../tilegrid.js';
* @api
*/
var _ol_source_TileUTFGrid_ = function(options) {
_ol_source_Tile_.call(this, {
TileSource.call(this, {
projection: getProjection('EPSG:3857'),
state: SourceState.LOADING
});
@@ -74,7 +74,7 @@ var _ol_source_TileUTFGrid_ = function(options) {
}
};
inherits(_ol_source_TileUTFGrid_, _ol_source_Tile_);
inherits(_ol_source_TileUTFGrid_, TileSource);
/**

View File

@@ -4,7 +4,7 @@
import {getUid, inherits} from '../index.js';
import TileState from '../TileState.js';
import {expandUrl, createFromTemplates, nullTileUrlFunction} from '../tileurlfunction.js';
import _ol_source_Tile_ from '../source/Tile.js';
import TileSource from '../source/Tile.js';
import TileEventType from '../source/TileEventType.js';
import _ol_tilecoord_ from '../tilecoord.js';
@@ -20,7 +20,7 @@ import _ol_tilecoord_ from '../tilecoord.js';
*/
var _ol_source_UrlTile_ = function(options) {
_ol_source_Tile_.call(this, {
TileSource.call(this, {
attributions: options.attributions,
cacheSize: options.cacheSize,
extent: options.extent,
@@ -69,7 +69,7 @@ var _ol_source_UrlTile_ = function(options) {
};
inherits(_ol_source_UrlTile_, _ol_source_Tile_);
inherits(_ol_source_UrlTile_, TileSource);
/**
@@ -130,7 +130,7 @@ _ol_source_UrlTile_.prototype.handleTileChange = function(event) {
TileEventType.TILELOADEND : undefined;
}
if (type != undefined) {
this.dispatchEvent(new _ol_source_Tile_.Event(type, tile));
this.dispatchEvent(new TileSource.Event(type, tile));
}
};

View File

@@ -3,7 +3,7 @@ import _ol_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';
import _ol_source_Tile_ from '../../../../src/ol/source/Tile.js';
import TileSource from '../../../../src/ol/source/Tile.js';
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
describe('ol.control.Attribution', function() {
@@ -21,21 +21,21 @@ describe('ol.control.Attribution', function() {
})],
layers: [
new TileLayer({
source: new _ol_source_Tile_({
source: new TileSource({
projection: 'EPSG:3857',
tileGrid: _ol_tilegrid_.createXYZ(),
attributions: 'foo'
})
}),
new TileLayer({
source: new _ol_source_Tile_({
source: new TileSource({
projection: 'EPSG:3857',
tileGrid: _ol_tilegrid_.createXYZ(),
attributions: 'bar'
})
}),
new TileLayer({
source: new _ol_source_Tile_({
source: new TileSource({
projection: 'EPSG:3857',
tileGrid: _ol_tilegrid_.createXYZ(),
attributions: 'foo'

View File

@@ -6,7 +6,7 @@ import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js';
import _ol_source_ImageStatic_ from '../../../../src/ol/source/ImageStatic.js';
import RasterSource from '../../../../src/ol/source/Raster.js';
import Source from '../../../../src/ol/source/Source.js';
import _ol_source_Tile_ from '../../../../src/ol/source/Tile.js';
import TileSource from '../../../../src/ol/source/Tile.js';
import _ol_source_XYZ_ from '../../../../src/ol/source/XYZ.js';
var red = 'data:image/gif;base64,R0lGODlhAQABAPAAAP8AAP///yH5BAAAAAAALAAAAAA' +
@@ -92,7 +92,7 @@ where('Uint8ClampedArray').describe('ol.source.Raster', function() {
it('returns a tile source', function() {
var source = new RasterSource({
threads: 0,
sources: [new _ol_source_Tile_({})]
sources: [new TileSource({})]
});
expect(source).to.be.a(Source);
expect(source).to.be.a(RasterSource);

View File

@@ -4,7 +4,7 @@ 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';
import Source from '../../../../src/ol/source/Source.js';
import _ol_source_Tile_ from '../../../../src/ol/source/Tile.js';
import TileSource from '../../../../src/ol/source/Tile.js';
import _ol_tilecoord_ from '../../../../src/ol/tilecoord.js';
import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js';
@@ -25,7 +25,7 @@ var MockTile = function(tileStates) {
tileSize: 256
});
_ol_source_Tile_.call(this, {
TileSource.call(this, {
projection: getProjection('EPSG:4326'),
tileGrid: tileGrid
});
@@ -35,7 +35,7 @@ var MockTile = function(tileStates) {
}
};
inherits(MockTile, _ol_source_Tile_);
inherits(MockTile, TileSource);
/**
@@ -56,15 +56,15 @@ describe('ol.source.Tile', function() {
describe('constructor', function() {
it('returns a tile source', function() {
var source = new _ol_source_Tile_({
var source = new TileSource({
projection: getProjection('EPSG:4326')
});
expect(source).to.be.a(Source);
expect(source).to.be.a(_ol_source_Tile_);
expect(source).to.be.a(TileSource);
});
it('sets a custom cache size', function() {
var projection = getProjection('EPSG:4326');
var source = new _ol_source_Tile_({
var source = new TileSource({
projection: projection,
cacheSize: 42
});
@@ -74,7 +74,7 @@ describe('ol.source.Tile', function() {
describe('#setKey()', function() {
it('sets the source key', function() {
var source = new _ol_source_Tile_({});
var source = new TileSource({});
expect(source.getKey()).to.equal('');
var key = 'foo';
@@ -85,7 +85,7 @@ describe('ol.source.Tile', function() {
describe('#setKey()', function() {
it('dispatches a change event', function(done) {
var source = new _ol_source_Tile_({});
var source = new TileSource({});
var key = 'foo';
source.once('change', function() {
@@ -95,7 +95,7 @@ describe('ol.source.Tile', function() {
});
it('does not dispatch change if key does not change', function(done) {
var source = new _ol_source_Tile_({});
var source = new TileSource({});
var key = 'foo';
source.once('change', function() {
@@ -225,7 +225,7 @@ describe('ol.source.Tile', function() {
describe('#getTileCoordForTileUrlFunction()', function() {
it('returns the expected tile coordinate - {wrapX: true}', function() {
var tileSource = new _ol_source_Tile_({
var tileSource = new TileSource({
projection: 'EPSG:3857',
wrapX: true
});
@@ -241,7 +241,7 @@ describe('ol.source.Tile', function() {
});
it('returns the expected tile coordinate - {wrapX: false}', function() {
var tileSource = new _ol_source_Tile_({
var tileSource = new TileSource({
projection: 'EPSG:3857',
wrapX: false
});
@@ -257,7 +257,7 @@ describe('ol.source.Tile', function() {
});
it('works with wrapX and custom projection without extent', function() {
var tileSource = new _ol_source_Tile_({
var tileSource = new TileSource({
projection: new _ol_proj_Projection_({
code: 'foo',
global: true,
@@ -297,7 +297,7 @@ describe('MockTile', function() {
describe('constructor', function() {
it('creates a tile source', function() {
var source = new MockTile({});
expect(source).to.be.a(_ol_source_Tile_);
expect(source).to.be.a(TileSource);
expect(source).to.be.a(MockTile);
});
});

View File

@@ -1,5 +1,5 @@
import {get as getProjection, transformExtent, fromLonLat} from '../../../../src/ol/proj.js';
import _ol_source_Tile_ from '../../../../src/ol/source/Tile.js';
import TileSource from '../../../../src/ol/source/Tile.js';
import _ol_source_TileUTFGrid_ from '../../../../src/ol/source/TileUTFGrid.js';
import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js';
@@ -39,7 +39,7 @@ describe('ol.source.TileUTFGrid', function() {
var source = new _ol_source_TileUTFGrid_({url: url});
expect(source).to.be.an(_ol_source_TileUTFGrid_);
expect(source).to.be.an(_ol_source_Tile_);
expect(source).to.be.an(TileSource);
expect(function() {
// no options: will throw

View File

@@ -1,4 +1,4 @@
import _ol_source_Tile_ from '../../../../src/ol/source/Tile.js';
import TileSource from '../../../../src/ol/source/Tile.js';
import _ol_source_TileImage_ from '../../../../src/ol/source/TileImage.js';
import _ol_source_UrlTile_ from '../../../../src/ol/source/UrlTile.js';
import _ol_source_XYZ_ from '../../../../src/ol/source/XYZ.js';
@@ -14,7 +14,7 @@ describe('ol.source.XYZ', function() {
expect(source).to.be.an(_ol_source_XYZ_);
expect(source).to.be.an(_ol_source_TileImage_);
expect(source).to.be.an(_ol_source_UrlTile_);
expect(source).to.be.an(_ol_source_Tile_);
expect(source).to.be.an(TileSource);
});
it('can be constructed with a custom tile grid', function() {