import { EpsgCode } from '../../epsg.js';
import { QuadKey } from '../../quad.key.js';
import { TileMatrixSet } from '../../tile.matrix.set.js';
import { TileMatrixSets } from '../../tms/index.js';
export function qkToName(qk) {
    return TileMatrixSet.tileToName(QuadKey.toTile(qk));
}
export function qkToNamedBounds(quadKeys) {
    const tms = TileMatrixSets.get(EpsgCode.Google);
    return quadKeys.map((qk) => ({ name: qkToName(qk), ...tms.tileToSourceBounds(QuadKey.toTile(qk)) }));
}
export function tileNamesToNamedBounds(tileNames, tms = TileMatrixSets.get(EpsgCode.Google)) {
    return tileNames.map((name) => ({ name, ...tms.tileToSourceBounds(TileMatrixSet.nameToTile(name)) }));
}
export function genTileNames(topLeftTile, xTotal, yTotal = 1, tms = TileMatrixSets.get(EpsgCode.Google)) {
    const bounds = [];
    yTotal += topLeftTile.y;
    xTotal += topLeftTile.x;
    const tile = { ...topLeftTile };
    for (let y = topLeftTile.y; y < yTotal; ++y) {
        tile.y = y;
        for (let x = topLeftTile.x; x < xTotal; ++x) {
            tile.x = x;
            bounds.push({ name: TileMatrixSet.tileToName(tile), ...tms.tileToSourceBounds(tile) });
        }
    }
    return bounds;
}
//# sourceMappingURL=test.util.js.map