Named export for ol/tileurlfunction
And change module name from ol/TileUrlFunction to ol/tileurlfunction
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* @module ol/source/BingMaps
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_TileUrlFunction_ from '../TileUrlFunction.js';
|
||||
import {createFromTileUrlFunctions} from '../tileurlfunction.js';
|
||||
import {applyTransform, intersects} from '../extent.js';
|
||||
import _ol_net_ from '../net.js';
|
||||
import {get as getProjection, getTransformFromProjections} from '../proj.js';
|
||||
@@ -142,7 +142,7 @@ _ol_source_BingMaps_.prototype.handleImageryMetadataResponse = function(response
|
||||
|
||||
var culture = this.culture_;
|
||||
var hidpi = this.hidpi_;
|
||||
this.tileUrlFunction = _ol_TileUrlFunction_.createFromTileUrlFunctions(
|
||||
this.tileUrlFunction = createFromTileUrlFunctions(
|
||||
resource.imageUrlSubdomains.map(function(subdomain) {
|
||||
var quadKeyTileCoord = [0, 0, 0];
|
||||
var imageUrl = resource.imageUrl
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_TileUrlFunction_ from '../TileUrlFunction.js';
|
||||
import {createFromTemplates} from '../tileurlfunction.js';
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import {applyTransform, intersects} from '../extent.js';
|
||||
import _ol_net_ from '../net.js';
|
||||
@@ -133,8 +133,7 @@ _ol_source_TileJSON_.prototype.handleTileJSONResponse = function(tileJSON) {
|
||||
});
|
||||
this.tileGrid = tileGrid;
|
||||
|
||||
this.tileUrlFunction =
|
||||
_ol_TileUrlFunction_.createFromTemplates(tileJSON.tiles, tileGrid);
|
||||
this.tileUrlFunction = createFromTemplates(tileJSON.tiles, tileGrid);
|
||||
|
||||
if (tileJSON.attribution !== undefined && !this.getAttributions()) {
|
||||
var attributionExtent = extent !== undefined ?
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_Tile_ from '../Tile.js';
|
||||
import _ol_TileState_ from '../TileState.js';
|
||||
import _ol_TileUrlFunction_ from '../TileUrlFunction.js';
|
||||
import {createFromTemplates, nullTileUrlFunction} from '../tileurlfunction.js';
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
@@ -42,7 +42,7 @@ var _ol_source_TileUTFGrid_ = function(options) {
|
||||
* @private
|
||||
* @type {!ol.TileUrlFunctionType}
|
||||
*/
|
||||
this.tileUrlFunction_ = _ol_TileUrlFunction_.nullTileUrlFunction;
|
||||
this.tileUrlFunction_ = nullTileUrlFunction;
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -193,8 +193,7 @@ _ol_source_TileUTFGrid_.prototype.handleTileJSONResponse = function(tileJSON) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.tileUrlFunction_ =
|
||||
_ol_TileUrlFunction_.createFromTemplates(grids, tileGrid);
|
||||
this.tileUrlFunction_ = createFromTemplates(grids, tileGrid);
|
||||
|
||||
if (tileJSON.attribution !== undefined) {
|
||||
var attributionExtent = extent !== undefined ?
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import {getUid, inherits} from '../index.js';
|
||||
import _ol_TileState_ from '../TileState.js';
|
||||
import _ol_TileUrlFunction_ from '../TileUrlFunction.js';
|
||||
import {expandUrl, createFromTemplates, nullTileUrlFunction} from '../tileurlfunction.js';
|
||||
import _ol_source_Tile_ from '../source/Tile.js';
|
||||
import _ol_source_TileEventType_ from '../source/TileEventType.js';
|
||||
import _ol_tilecoord_ from '../tilecoord.js';
|
||||
@@ -44,8 +44,7 @@ var _ol_source_UrlTile_ = function(options) {
|
||||
* @type {ol.TileUrlFunctionType}
|
||||
*/
|
||||
this.tileUrlFunction = this.fixedTileUrlFunction ?
|
||||
this.fixedTileUrlFunction.bind(this) :
|
||||
_ol_TileUrlFunction_.nullTileUrlFunction;
|
||||
this.fixedTileUrlFunction.bind(this) : nullTileUrlFunction;
|
||||
|
||||
/**
|
||||
* @protected
|
||||
@@ -171,10 +170,10 @@ _ol_source_UrlTile_.prototype.setTileUrlFunction = function(tileUrlFunction, opt
|
||||
* @api
|
||||
*/
|
||||
_ol_source_UrlTile_.prototype.setUrl = function(url) {
|
||||
var urls = this.urls = _ol_TileUrlFunction_.expandUrl(url);
|
||||
var urls = this.urls = expandUrl(url);
|
||||
this.setTileUrlFunction(this.fixedTileUrlFunction ?
|
||||
this.fixedTileUrlFunction.bind(this) :
|
||||
_ol_TileUrlFunction_.createFromTemplates(urls, this.tileGrid), url);
|
||||
createFromTemplates(urls, this.tileGrid), url);
|
||||
};
|
||||
|
||||
|
||||
@@ -188,7 +187,7 @@ _ol_source_UrlTile_.prototype.setUrls = function(urls) {
|
||||
var key = urls.join('\n');
|
||||
this.setTileUrlFunction(this.fixedTileUrlFunction ?
|
||||
this.fixedTileUrlFunction.bind(this) :
|
||||
_ol_TileUrlFunction_.createFromTemplates(urls, this.tileGrid), key);
|
||||
createFromTemplates(urls, this.tileGrid), key);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @module ol/source/WMTS
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_TileUrlFunction_ from '../TileUrlFunction.js';
|
||||
import {expandUrl, createFromTileUrlFunctions, nullTileUrlFunction} from '../tileurlfunction.js';
|
||||
import _ol_array_ from '../array.js';
|
||||
import {containsExtent} from '../extent.js';
|
||||
import _ol_obj_ from '../obj.js';
|
||||
@@ -63,7 +63,7 @@ var _ol_source_WMTS_ = function(options) {
|
||||
|
||||
var urls = options.urls;
|
||||
if (urls === undefined && options.url !== undefined) {
|
||||
urls = _ol_TileUrlFunction_.expandUrl(options.url);
|
||||
urls = expandUrl(options.url);
|
||||
}
|
||||
|
||||
// FIXME: should we guess this requestEncoding from options.url(s)
|
||||
@@ -151,9 +151,7 @@ var _ol_source_WMTS_ = function(options) {
|
||||
};
|
||||
|
||||
var tileUrlFunction = (urls && urls.length > 0) ?
|
||||
_ol_TileUrlFunction_.createFromTileUrlFunctions(
|
||||
urls.map(this.createFromWMTSTemplate_)) :
|
||||
_ol_TileUrlFunction_.nullTileUrlFunction;
|
||||
createFromTileUrlFunctions(urls.map(this.createFromWMTSTemplate_)) : nullTileUrlFunction;
|
||||
|
||||
_ol_source_TileImage_.call(this, {
|
||||
attributions: options.attributions,
|
||||
@@ -187,7 +185,7 @@ _ol_source_WMTS_.prototype.setUrls = function(urls) {
|
||||
var key = urls.join('\n');
|
||||
this.setTileUrlFunction(this.fixedTileUrlFunction ?
|
||||
this.fixedTileUrlFunction.bind(this) :
|
||||
_ol_TileUrlFunction_.createFromTileUrlFunctions(urls.map(this.createFromWMTSTemplate_.bind(this))), key);
|
||||
createFromTileUrlFunctions(urls.map(this.createFromWMTSTemplate_.bind(this))), key);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,7 @@ import {DEFAULT_TILE_SIZE} from '../tilegrid/common.js';
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_ImageTile_ from '../ImageTile.js';
|
||||
import _ol_TileState_ from '../TileState.js';
|
||||
import _ol_TileUrlFunction_ from '../TileUrlFunction.js';
|
||||
import {expandUrl, createFromTileUrlFunctions} from '../tileurlfunction.js';
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import {createCanvasContext2D} from '../dom.js';
|
||||
import {getTopLeft} from '../extent.js';
|
||||
@@ -92,7 +92,7 @@ var _ol_source_Zoomify_ = function(opt_options) {
|
||||
if (url && url.indexOf('{TileGroup}') == -1 && url.indexOf('{tileIndex}') == -1) {
|
||||
url += '{TileGroup}/{z}-{x}-{y}.jpg';
|
||||
}
|
||||
var urls = _ol_TileUrlFunction_.expandUrl(url);
|
||||
var urls = expandUrl(url);
|
||||
|
||||
/**
|
||||
* @param {string} template Template.
|
||||
@@ -133,7 +133,7 @@ var _ol_source_Zoomify_ = function(opt_options) {
|
||||
});
|
||||
}
|
||||
|
||||
var tileUrlFunction = _ol_TileUrlFunction_.createFromTileUrlFunctions(urls.map(createFromTemplate));
|
||||
var tileUrlFunction = createFromTileUrlFunctions(urls.map(createFromTemplate));
|
||||
|
||||
var ZoomifyTileClass = _ol_source_Zoomify_.Tile_.bind(null, tileGrid);
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* @module ol/TileUrlFunction
|
||||
* @module ol/tileurlfunction
|
||||
*/
|
||||
import _ol_asserts_ from './asserts.js';
|
||||
import _ol_math_ from './math.js';
|
||||
import _ol_tilecoord_ from './tilecoord.js';
|
||||
var _ol_TileUrlFunction_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -12,7 +11,7 @@ var _ol_TileUrlFunction_ = {};
|
||||
* @param {ol.tilegrid.TileGrid} tileGrid Tile grid.
|
||||
* @return {ol.TileUrlFunctionType} Tile URL function.
|
||||
*/
|
||||
_ol_TileUrlFunction_.createFromTemplate = function(template, tileGrid) {
|
||||
export function createFromTemplate(template, tileGrid) {
|
||||
var zRegEx = /\{z\}/g;
|
||||
var xRegEx = /\{x\}/g;
|
||||
var yRegEx = /\{y\}/g;
|
||||
@@ -44,7 +43,7 @@ _ol_TileUrlFunction_.createFromTemplate = function(template, tileGrid) {
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -52,22 +51,21 @@ _ol_TileUrlFunction_.createFromTemplate = function(template, tileGrid) {
|
||||
* @param {ol.tilegrid.TileGrid} tileGrid Tile grid.
|
||||
* @return {ol.TileUrlFunctionType} Tile URL function.
|
||||
*/
|
||||
_ol_TileUrlFunction_.createFromTemplates = function(templates, tileGrid) {
|
||||
export function createFromTemplates(templates, tileGrid) {
|
||||
var len = templates.length;
|
||||
var tileUrlFunctions = new Array(len);
|
||||
for (var i = 0; i < len; ++i) {
|
||||
tileUrlFunctions[i] = _ol_TileUrlFunction_.createFromTemplate(
|
||||
templates[i], tileGrid);
|
||||
tileUrlFunctions[i] = createFromTemplate(templates[i], tileGrid);
|
||||
}
|
||||
return _ol_TileUrlFunction_.createFromTileUrlFunctions(tileUrlFunctions);
|
||||
};
|
||||
return createFromTileUrlFunctions(tileUrlFunctions);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param {Array.<ol.TileUrlFunctionType>} tileUrlFunctions Tile URL Functions.
|
||||
* @return {ol.TileUrlFunctionType} Tile URL function.
|
||||
*/
|
||||
_ol_TileUrlFunction_.createFromTileUrlFunctions = function(tileUrlFunctions) {
|
||||
export function createFromTileUrlFunctions(tileUrlFunctions) {
|
||||
if (tileUrlFunctions.length === 1) {
|
||||
return tileUrlFunctions[0];
|
||||
}
|
||||
@@ -88,7 +86,7 @@ _ol_TileUrlFunction_.createFromTileUrlFunctions = function(tileUrlFunctions) {
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -97,16 +95,16 @@ _ol_TileUrlFunction_.createFromTileUrlFunctions = function(tileUrlFunctions) {
|
||||
* @param {ol.proj.Projection} projection Projection.
|
||||
* @return {string|undefined} Tile URL.
|
||||
*/
|
||||
_ol_TileUrlFunction_.nullTileUrlFunction = function(tileCoord, pixelRatio, projection) {
|
||||
export function nullTileUrlFunction(tileCoord, pixelRatio, projection) {
|
||||
return undefined;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} url URL.
|
||||
* @return {Array.<string>} Array of urls.
|
||||
*/
|
||||
_ol_TileUrlFunction_.expandUrl = function(url) {
|
||||
export function expandUrl(url) {
|
||||
var urls = [];
|
||||
var match = /\{([a-z])-([a-z])\}/.exec(url);
|
||||
if (match) {
|
||||
@@ -130,5 +128,4 @@ _ol_TileUrlFunction_.expandUrl = function(url) {
|
||||
}
|
||||
urls.push(url);
|
||||
return urls;
|
||||
};
|
||||
export default _ol_TileUrlFunction_;
|
||||
}
|
||||
Reference in New Issue
Block a user