Rename _ol_source_UrlTile_ to UrlTile

This commit is contained in:
Tim Schaub
2018-01-08 16:03:55 -07:00
parent 32ee149909
commit 231c8837ca
5 changed files with 36 additions and 36 deletions

View File

@@ -10,7 +10,7 @@ import _ol_events_ from '../events.js';
import EventType from '../events/EventType.js'; import EventType from '../events/EventType.js';
import {equivalent, get as getProjection} from '../proj.js'; import {equivalent, get as getProjection} from '../proj.js';
import _ol_reproj_Tile_ from '../reproj/Tile.js'; import _ol_reproj_Tile_ from '../reproj/Tile.js';
import _ol_source_UrlTile_ from '../source/UrlTile.js'; import UrlTile from '../source/UrlTile.js';
import _ol_tilecoord_ from '../tilecoord.js'; import _ol_tilecoord_ from '../tilecoord.js';
import _ol_tilegrid_ from '../tilegrid.js'; import _ol_tilegrid_ from '../tilegrid.js';
@@ -26,7 +26,7 @@ import _ol_tilegrid_ from '../tilegrid.js';
*/ */
var TileImage = function(options) { var TileImage = function(options) {
_ol_source_UrlTile_.call(this, { UrlTile.call(this, {
attributions: options.attributions, attributions: options.attributions,
cacheSize: options.cacheSize, cacheSize: options.cacheSize,
extent: options.extent, extent: options.extent,
@@ -84,7 +84,7 @@ var TileImage = function(options) {
this.renderReprojectionEdges_ = false; this.renderReprojectionEdges_ = false;
}; };
inherits(TileImage, _ol_source_UrlTile_); inherits(TileImage, UrlTile);
/** /**
@@ -92,7 +92,7 @@ inherits(TileImage, _ol_source_UrlTile_);
*/ */
TileImage.prototype.canExpireCache = function() { TileImage.prototype.canExpireCache = function() {
if (!ENABLE_RASTER_REPROJECTION) { if (!ENABLE_RASTER_REPROJECTION) {
return _ol_source_UrlTile_.prototype.canExpireCache.call(this); return UrlTile.prototype.canExpireCache.call(this);
} }
if (this.tileCache.canExpireCache()) { if (this.tileCache.canExpireCache()) {
return true; return true;
@@ -112,7 +112,7 @@ TileImage.prototype.canExpireCache = function() {
*/ */
TileImage.prototype.expireCache = function(projection, usedTiles) { TileImage.prototype.expireCache = function(projection, usedTiles) {
if (!ENABLE_RASTER_REPROJECTION) { if (!ENABLE_RASTER_REPROJECTION) {
_ol_source_UrlTile_.prototype.expireCache.call(this, projection, usedTiles); UrlTile.prototype.expireCache.call(this, projection, usedTiles);
return; return;
} }
var usedTileCache = this.getTileCacheForProjection(projection); var usedTileCache = this.getTileCacheForProjection(projection);
@@ -155,7 +155,7 @@ TileImage.prototype.getOpaque = function(projection) {
this.getProjection() && projection && !equivalent(this.getProjection(), projection)) { this.getProjection() && projection && !equivalent(this.getProjection(), projection)) {
return false; return false;
} else { } else {
return _ol_source_UrlTile_.prototype.getOpaque.call(this, projection); return UrlTile.prototype.getOpaque.call(this, projection);
} }
}; };
@@ -165,7 +165,7 @@ TileImage.prototype.getOpaque = function(projection) {
*/ */
TileImage.prototype.getTileGridForProjection = function(projection) { TileImage.prototype.getTileGridForProjection = function(projection) {
if (!ENABLE_RASTER_REPROJECTION) { if (!ENABLE_RASTER_REPROJECTION) {
return _ol_source_UrlTile_.prototype.getTileGridForProjection.call(this, projection); return UrlTile.prototype.getTileGridForProjection.call(this, projection);
} }
var thisProj = this.getProjection(); var thisProj = this.getProjection();
if (this.tileGrid && (!thisProj || equivalent(thisProj, projection))) { if (this.tileGrid && (!thisProj || equivalent(thisProj, projection))) {
@@ -186,7 +186,7 @@ TileImage.prototype.getTileGridForProjection = function(projection) {
*/ */
TileImage.prototype.getTileCacheForProjection = function(projection) { TileImage.prototype.getTileCacheForProjection = function(projection) {
if (!ENABLE_RASTER_REPROJECTION) { if (!ENABLE_RASTER_REPROJECTION) {
return _ol_source_UrlTile_.prototype.getTileCacheForProjection.call(this, projection); return UrlTile.prototype.getTileCacheForProjection.call(this, projection);
} }
var thisProj = this.getProjection(); if (!thisProj || equivalent(thisProj, projection)) { var thisProj = this.getProjection(); if (!thisProj || equivalent(thisProj, projection)) {
return this.tileCache; return this.tileCache;

View File

@@ -18,7 +18,7 @@ import _ol_tilecoord_ from '../tilecoord.js';
* @extends {ol.source.Tile} * @extends {ol.source.Tile}
* @param {ol.SourceUrlTileOptions} options Image tile options. * @param {ol.SourceUrlTileOptions} options Image tile options.
*/ */
var _ol_source_UrlTile_ = function(options) { var UrlTile = function(options) {
TileSource.call(this, { TileSource.call(this, {
attributions: options.attributions, attributions: options.attributions,
@@ -69,21 +69,21 @@ var _ol_source_UrlTile_ = function(options) {
}; };
inherits(_ol_source_UrlTile_, TileSource); inherits(UrlTile, TileSource);
/** /**
* @type {ol.TileUrlFunctionType|undefined} * @type {ol.TileUrlFunctionType|undefined}
* @protected * @protected
*/ */
_ol_source_UrlTile_.prototype.fixedTileUrlFunction; UrlTile.prototype.fixedTileUrlFunction;
/** /**
* Return the tile load function of the source. * Return the tile load function of the source.
* @return {ol.TileLoadFunctionType} TileLoadFunction * @return {ol.TileLoadFunctionType} TileLoadFunction
* @api * @api
*/ */
_ol_source_UrlTile_.prototype.getTileLoadFunction = function() { UrlTile.prototype.getTileLoadFunction = function() {
return this.tileLoadFunction; return this.tileLoadFunction;
}; };
@@ -93,7 +93,7 @@ _ol_source_UrlTile_.prototype.getTileLoadFunction = function() {
* @return {ol.TileUrlFunctionType} TileUrlFunction * @return {ol.TileUrlFunctionType} TileUrlFunction
* @api * @api
*/ */
_ol_source_UrlTile_.prototype.getTileUrlFunction = function() { UrlTile.prototype.getTileUrlFunction = function() {
return this.tileUrlFunction; return this.tileUrlFunction;
}; };
@@ -105,7 +105,7 @@ _ol_source_UrlTile_.prototype.getTileUrlFunction = function() {
* @return {!Array.<string>|null} URLs. * @return {!Array.<string>|null} URLs.
* @api * @api
*/ */
_ol_source_UrlTile_.prototype.getUrls = function() { UrlTile.prototype.getUrls = function() {
return this.urls; return this.urls;
}; };
@@ -115,7 +115,7 @@ _ol_source_UrlTile_.prototype.getUrls = function() {
* @param {ol.events.Event} event Event. * @param {ol.events.Event} event Event.
* @protected * @protected
*/ */
_ol_source_UrlTile_.prototype.handleTileChange = function(event) { UrlTile.prototype.handleTileChange = function(event) {
var tile = /** @type {ol.Tile} */ (event.target); var tile = /** @type {ol.Tile} */ (event.target);
var uid = getUid(tile); var uid = getUid(tile);
var tileState = tile.getState(); var tileState = tile.getState();
@@ -140,7 +140,7 @@ _ol_source_UrlTile_.prototype.handleTileChange = function(event) {
* @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function. * @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function.
* @api * @api
*/ */
_ol_source_UrlTile_.prototype.setTileLoadFunction = function(tileLoadFunction) { UrlTile.prototype.setTileLoadFunction = function(tileLoadFunction) {
this.tileCache.clear(); this.tileCache.clear();
this.tileLoadFunction = tileLoadFunction; this.tileLoadFunction = tileLoadFunction;
this.changed(); this.changed();
@@ -153,7 +153,7 @@ _ol_source_UrlTile_.prototype.setTileLoadFunction = function(tileLoadFunction) {
* @param {string=} opt_key Optional new tile key for the source. * @param {string=} opt_key Optional new tile key for the source.
* @api * @api
*/ */
_ol_source_UrlTile_.prototype.setTileUrlFunction = function(tileUrlFunction, opt_key) { UrlTile.prototype.setTileUrlFunction = function(tileUrlFunction, opt_key) {
this.tileUrlFunction = tileUrlFunction; this.tileUrlFunction = tileUrlFunction;
this.tileCache.pruneExceptNewestZ(); this.tileCache.pruneExceptNewestZ();
if (typeof opt_key !== 'undefined') { if (typeof opt_key !== 'undefined') {
@@ -169,7 +169,7 @@ _ol_source_UrlTile_.prototype.setTileUrlFunction = function(tileUrlFunction, opt
* @param {string} url URL. * @param {string} url URL.
* @api * @api
*/ */
_ol_source_UrlTile_.prototype.setUrl = function(url) { UrlTile.prototype.setUrl = function(url) {
var urls = this.urls = expandUrl(url); var urls = this.urls = expandUrl(url);
this.setTileUrlFunction(this.fixedTileUrlFunction ? this.setTileUrlFunction(this.fixedTileUrlFunction ?
this.fixedTileUrlFunction.bind(this) : this.fixedTileUrlFunction.bind(this) :
@@ -182,7 +182,7 @@ _ol_source_UrlTile_.prototype.setUrl = function(url) {
* @param {Array.<string>} urls URLs. * @param {Array.<string>} urls URLs.
* @api * @api
*/ */
_ol_source_UrlTile_.prototype.setUrls = function(urls) { UrlTile.prototype.setUrls = function(urls) {
this.urls = urls; this.urls = urls;
var key = urls.join('\n'); var key = urls.join('\n');
this.setTileUrlFunction(this.fixedTileUrlFunction ? this.setTileUrlFunction(this.fixedTileUrlFunction ?
@@ -194,10 +194,10 @@ _ol_source_UrlTile_.prototype.setUrls = function(urls) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_source_UrlTile_.prototype.useTile = function(z, x, y) { UrlTile.prototype.useTile = function(z, x, y) {
var tileCoordKey = _ol_tilecoord_.getKeyZXY(z, x, y); var tileCoordKey = _ol_tilecoord_.getKeyZXY(z, x, y);
if (this.tileCache.containsKey(tileCoordKey)) { if (this.tileCache.containsKey(tileCoordKey)) {
this.tileCache.get(tileCoordKey); this.tileCache.get(tileCoordKey);
} }
}; };
export default _ol_source_UrlTile_; export default UrlTile;

View File

@@ -6,7 +6,7 @@ import TileState from '../TileState.js';
import VectorImageTile, {defaultLoadFunction} from '../VectorImageTile.js'; import VectorImageTile, {defaultLoadFunction} from '../VectorImageTile.js';
import VectorTile from '../VectorTile.js'; import VectorTile from '../VectorTile.js';
import _ol_size_ from '../size.js'; import _ol_size_ from '../size.js';
import _ol_source_UrlTile_ from '../source/UrlTile.js'; import UrlTile from '../source/UrlTile.js';
import _ol_tilecoord_ from '../tilecoord.js'; import _ol_tilecoord_ from '../tilecoord.js';
import _ol_tilegrid_ from '../tilegrid.js'; import _ol_tilegrid_ from '../tilegrid.js';
@@ -38,7 +38,7 @@ var _ol_source_VectorTile_ = function(options) {
tileSize: options.tileSize || 512 tileSize: options.tileSize || 512
}); });
_ol_source_UrlTile_.call(this, { UrlTile.call(this, {
attributions: options.attributions, attributions: options.attributions,
cacheSize: options.cacheSize !== undefined ? options.cacheSize : 128, cacheSize: options.cacheSize !== undefined ? options.cacheSize : 128,
extent: extent, extent: extent,
@@ -87,7 +87,7 @@ var _ol_source_VectorTile_ = function(options) {
}; };
inherits(_ol_source_VectorTile_, _ol_source_UrlTile_); inherits(_ol_source_VectorTile_, UrlTile);
/** /**

View File

@@ -1,5 +1,5 @@
import {get as getProjection} from '../../../../src/ol/proj.js'; import {get as getProjection} from '../../../../src/ol/proj.js';
import _ol_source_UrlTile_ from '../../../../src/ol/source/UrlTile.js'; import UrlTile from '../../../../src/ol/source/UrlTile.js';
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
@@ -7,7 +7,7 @@ describe('ol.source.UrlTile', function() {
describe('#setUrl()', function() { describe('#setUrl()', function() {
it('sets the URL for the source', function() { it('sets the URL for the source', function() {
var source = new _ol_source_UrlTile_({}); var source = new UrlTile({});
var url = 'https://example.com/'; var url = 'https://example.com/';
source.setUrl(url); source.setUrl(url);
@@ -16,7 +16,7 @@ describe('ol.source.UrlTile', function() {
}); });
it('updates the key for the source', function() { it('updates the key for the source', function() {
var source = new _ol_source_UrlTile_({}); var source = new UrlTile({});
var url = 'https://example.com/'; var url = 'https://example.com/';
source.setUrl(url); source.setUrl(url);
@@ -27,7 +27,7 @@ describe('ol.source.UrlTile', function() {
describe('#setUrls()', function() { describe('#setUrls()', function() {
it('sets the URL for the source', function() { it('sets the URL for the source', function() {
var source = new _ol_source_UrlTile_({}); var source = new UrlTile({});
var urls = [ var urls = [
'https://a.example.com/', 'https://a.example.com/',
@@ -40,7 +40,7 @@ describe('ol.source.UrlTile', function() {
}); });
it('updates the key for the source', function() { it('updates the key for the source', function() {
var source = new _ol_source_UrlTile_({}); var source = new UrlTile({});
var urls = [ var urls = [
'https://a.example.com/', 'https://a.example.com/',
@@ -55,7 +55,7 @@ describe('ol.source.UrlTile', function() {
describe('url option', function() { describe('url option', function() {
it('expands url template', function() { it('expands url template', function() {
var tileSource = new _ol_source_UrlTile_({ var tileSource = new UrlTile({
url: '{1-3}' url: '{1-3}'
}); });
@@ -69,7 +69,7 @@ describe('ol.source.UrlTile', function() {
var tileSource, tileGrid; var tileSource, tileGrid;
beforeEach(function() { beforeEach(function() {
tileSource = new _ol_source_UrlTile_({ tileSource = new UrlTile({
projection: 'EPSG:3857', projection: 'EPSG:3857',
tileGrid: _ol_tilegrid_.createXYZ({maxZoom: 6}), tileGrid: _ol_tilegrid_.createXYZ({maxZoom: 6}),
url: '{z}/{x}/{y}', url: '{z}/{x}/{y}',
@@ -176,7 +176,7 @@ describe('ol.source.UrlTile', function() {
describe('using a "url" option', function() { describe('using a "url" option', function() {
beforeEach(function() { beforeEach(function() {
sourceOptions.url = url; sourceOptions.url = url;
source = new _ol_source_UrlTile_(sourceOptions); source = new UrlTile(sourceOptions);
}); });
it('returns the XYZ URL', function() { it('returns the XYZ URL', function() {
@@ -189,7 +189,7 @@ describe('ol.source.UrlTile', function() {
describe('using a "urls" option', function() { describe('using a "urls" option', function() {
beforeEach(function() { beforeEach(function() {
sourceOptions.urls = ['some_xyz_url1', 'some_xyz_url2']; sourceOptions.urls = ['some_xyz_url1', 'some_xyz_url2'];
source = new _ol_source_UrlTile_(sourceOptions); source = new UrlTile(sourceOptions);
}); });
it('returns the XYZ URLs', function() { it('returns the XYZ URLs', function() {
@@ -204,7 +204,7 @@ describe('ol.source.UrlTile', function() {
sourceOptions.tileUrlFunction = function() { sourceOptions.tileUrlFunction = function() {
return 'some_xyz_url'; return 'some_xyz_url';
}; };
source = new _ol_source_UrlTile_(sourceOptions); source = new UrlTile(sourceOptions);
}); });
it('returns null', function() { it('returns null', function() {

View File

@@ -1,6 +1,6 @@
import TileSource from '../../../../src/ol/source/Tile.js'; import TileSource from '../../../../src/ol/source/Tile.js';
import TileImage from '../../../../src/ol/source/TileImage.js'; import TileImage from '../../../../src/ol/source/TileImage.js';
import _ol_source_UrlTile_ from '../../../../src/ol/source/UrlTile.js'; import UrlTile from '../../../../src/ol/source/UrlTile.js';
import XYZ from '../../../../src/ol/source/XYZ.js'; import XYZ from '../../../../src/ol/source/XYZ.js';
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
@@ -13,7 +13,7 @@ describe('ol.source.XYZ', function() {
var source = new XYZ(); var source = new XYZ();
expect(source).to.be.an(XYZ); expect(source).to.be.an(XYZ);
expect(source).to.be.an(TileImage); expect(source).to.be.an(TileImage);
expect(source).to.be.an(_ol_source_UrlTile_); expect(source).to.be.an(UrlTile);
expect(source).to.be.an(TileSource); expect(source).to.be.an(TileSource);
}); });