"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.TerrainProviderRegistry = void 0;
const internal_1 = require("../internal");
/** A registry of [[TerrainProvider]]s identified by their unique names. The registry can be accessed via [[IModelApp.terrainProviderRegistry]].
 * It always includes the built-in provider named "CesiumWorldTerrain", which obtains terrain meshes from [Cesium ION](https://cesium.com/platform/cesium-ion/content/cesium-world-terrain/). That provider requires a valid [[TileAdmin.Props.cesiumIonKey]] to be supplied to [[IModelApp.startup]].
 * Any number of additional providers can be [[register]]ed.
 *
 * When terrain is enabled for a [[Viewport]], the display system will attempt to look up the [[TerrainProvider]] corresponding to the [TerrainSettings.providerName]($common) specified by the [[Viewport]]'s [DisplayStyleSettings]($common). If a provider by that name is registered, it will be used to obtain terrain meshes; otherwise, the display system will produce flat terrain meshes.
 * @public
 */
class TerrainProviderRegistry {
    _providers = new Map();
    /** @internal */
    constructor() {
        this.register("CesiumWorldTerrain", {
            createTerrainMeshProvider: async (options) => (0, internal_1.getCesiumTerrainProvider)(options),
        });
    }
    /** Register a new [[TerrainProvider]].
     * @param name The name of the provider. It must be unique among all providers.
     * @param provider The provider to register.
     * @see [[find]] to later retrieve the provider by name.
     */
    register(name, provider) {
        this._providers.set(name, provider);
    }
    /** Look up a [[register]]ed [[TerrainProvider]] by its name. */
    find(name) {
        return this._providers.get(name);
    }
}
exports.TerrainProviderRegistry = TerrainProviderRegistry;
//# sourceMappingURL=TerrainProvider.js.map