Slightly smaller functions
This commit is contained in:
@@ -166,21 +166,18 @@ 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(
|
||||
function parseTileMatrixSet(
|
||||
sourceInfo,
|
||||
tileMatrixSet,
|
||||
tileUrlTemplate,
|
||||
tileMatrixSetLimits
|
||||
) {
|
||||
) {
|
||||
let projection = sourceInfo.projection;
|
||||
if (!projection) {
|
||||
projection = getProjection(tileMatrixSet.crs);
|
||||
@@ -319,13 +316,14 @@ export function getTileSetInfo(sourceInfo) {
|
||||
urlTemplate: tileUrlTemplate,
|
||||
urlFunction: tileUrlFunction,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @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,12 +357,20 @@ export function getTileSetInfo(sourceInfo) {
|
||||
const url = resolveUrl(sourceInfo.url, tileSet.tileMatrixSetDefinition);
|
||||
return getJSON(url).then(function (tileMatrixSet) {
|
||||
return parseTileMatrixSet(
|
||||
sourceInfo,
|
||||
tileMatrixSet,
|
||||
tileUrlTemplate,
|
||||
tileMatrixSetLimits
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
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