Slightly smaller functions
This commit is contained in:
@@ -166,17 +166,14 @@ export function getVectorTileUrlTemplate(links, mediaType) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {SourceInfo} sourceInfo Source info.
|
||||
* @return {Promise<TileSetInfo>} Tile set info.
|
||||
*/
|
||||
export function getTileSetInfo(sourceInfo) {
|
||||
/**
|
||||
* @param {SourceInfo} sourceInfo The source info.
|
||||
* @param {TileMatrixSet} tileMatrixSet Tile matrix set.
|
||||
* @param {string} tileUrlTemplate Tile URL template.
|
||||
* @param {Array<TileMatrixSetLimit>} [tileMatrixSetLimits] Tile matrix set limits.
|
||||
* @return {TileSetInfo} Tile set info.
|
||||
*/
|
||||
function parseTileMatrixSet(
|
||||
sourceInfo,
|
||||
tileMatrixSet,
|
||||
tileUrlTemplate,
|
||||
tileMatrixSetLimits
|
||||
@@ -322,10 +319,11 @@ export function getTileSetInfo(sourceInfo) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {SourceInfo} sourceInfo The source info.
|
||||
* @param {TileSet} tileSet Tile set.
|
||||
* @return {TileSetInfo|Promise<TileSetInfo>} Tile set info.
|
||||
*/
|
||||
function parseTileSetMetadata(tileSet) {
|
||||
function parseTileSetMetadata(sourceInfo, tileSet) {
|
||||
const tileMatrixSetLimits = tileSet.tileMatrixSetLimits;
|
||||
let tileUrlTemplate;
|
||||
|
||||
@@ -345,6 +343,7 @@ export function getTileSetInfo(sourceInfo) {
|
||||
|
||||
if (tileSet.tileMatrixSet) {
|
||||
return parseTileMatrixSet(
|
||||
sourceInfo,
|
||||
tileSet.tileMatrixSet,
|
||||
tileUrlTemplate,
|
||||
tileMatrixSetLimits
|
||||
@@ -358,6 +357,7 @@ export function getTileSetInfo(sourceInfo) {
|
||||
const url = resolveUrl(sourceInfo.url, tileSet.tileMatrixSetDefinition);
|
||||
return getJSON(url).then(function (tileMatrixSet) {
|
||||
return parseTileMatrixSet(
|
||||
sourceInfo,
|
||||
tileMatrixSet,
|
||||
tileUrlTemplate,
|
||||
tileMatrixSetLimits
|
||||
@@ -365,5 +365,12 @@ export function getTileSetInfo(sourceInfo) {
|
||||
});
|
||||
}
|
||||
|
||||
return getJSON(sourceInfo.url).then(parseTileSetMetadata);
|
||||
/**
|
||||
* @param {SourceInfo} sourceInfo Source info.
|
||||
* @return {Promise<TileSetInfo>} Tile set info.
|
||||
*/
|
||||
export function getTileSetInfo(sourceInfo) {
|
||||
return getJSON(sourceInfo.url).then(function (tileSet) {
|
||||
return parseTileSetMetadata(sourceInfo, tileSet);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user