UNPKG

@itwin/core-frontend

Version:
56 lines 2.62 kB
"use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ /** @packageDocumentation * @module Tiles */ Object.defineProperty(exports, "__esModule", { value: true }); exports.MapBoxLayerImageryProvider = void 0; const IModelApp_1 = require("../../../../IModelApp"); const internal_1 = require("../../../../tile/internal"); /** Base class imagery map layer formats. Subclasses should override formatId and [[MapLayerFormat.createImageryProvider]]. */ class MapBoxLayerImageryProvider extends internal_1.MapLayerImageryProvider { _zoomMin; _zoomMax; _baseUrl; constructor(settings) { super(settings, true); this._baseUrl = settings.url; this._zoomMin = 1; this._zoomMax = 20; } get tileWidth() { return 256; } get tileHeight() { return 256; } get minimumZoomLevel() { return this._zoomMin; } get maximumZoomLevel() { return this._zoomMax; } // construct the Url from the desired Tile async constructUrl(row, column, zoomLevel) { if (!this._settings.accessKey) { return ""; } // from the template url, construct the tile url. // format: {baseUrl}/{tileSize}/{level}/{column}/{row}?access_token={token} let url = this._baseUrl.concat(this.tileWidth.toString()); url = url.concat(`/${zoomLevel.toString()}/${column.toString()}/${row.toString()}`); url = url.concat(`?${this._settings.accessKey.key}=${this._settings.accessKey.value}`); return url; } /** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [addAttributions] instead. */ addLogoCards(cards) { if (!cards.dataset.mapboxLogoCard) { cards.dataset.mapboxLogoCard = "true"; cards.appendChild(IModelApp_1.IModelApp.makeLogoCard({ heading: "Mapbox", notice: IModelApp_1.IModelApp.localization.getLocalizedString("iModelJs:BackgroundMap.MapBoxCopyright") })); } } async addAttributions(cards, _vp) { // eslint-disable-next-line @typescript-eslint/no-deprecated return Promise.resolve(this.addLogoCards(cards)); } // no initialization needed for MapBoxImageryProvider. async initialize() { } } exports.MapBoxLayerImageryProvider = MapBoxLayerImageryProvider; //# sourceMappingURL=MapBoxLayerImageryProvider.js.map