/*---------------------------------------------------------------------------------------------
* 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
 */
import { ApproximateTerrainHeights } from "../../ApproximateTerrainHeights";
/** Provides 3d meshes representing terrain for display in a [[Viewport]].
 * Each mesh represents the terrain within a rectangular region of the Earth associated with a [[MapTile]].
 * The display system drapes background map imagery onto these meshes.
 * `TerrainMeshProvider`s are obtained from [[TerrainProvider]]s.
 * @note A terrain mesh provider is expected to produce terrain for all areas of the globe. If it lacks terrain data for an area of the globe,
 * it might choose to fall back to producing smooth terrain using an [[EllipsoidTerrainProvider]].
 * @see [[EllipsoidTerrainProvider]] for an example implementation that provides smooth terrain meshes.
 * @see [BingTerrainMeshProvider](https://github.com/iTwin/itwinjs-core/blob/master/test-apps/display-test-app/src/frontend/BingTerrainProvider.ts) for an example
 * implementation that produces 3d terrain meshes from elevations provided by [[BingElevationProvider]].
 * @public
 */
export class TerrainMeshProvider {
    /** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [addAttributions] instead. */
    addLogoCards(_cards, _vp) { }
    /** Add attribution logo cards for the terrain data supplied by this provider to the [[Viewport]]'s logo div.
   * For example, a provider that produces meshes from [Bing Maps](https://docs.microsoft.com/en-us/bingmaps/rest-services/elevations/) would be required to
   * disclose any copyrighted data used in the production of those meshes.
   */
    async addAttributions(cards, vp) {
        // eslint-disable-next-line @typescript-eslint/no-deprecated
        return Promise.resolve(this.addLogoCards(cards, vp));
    }
    /** Return whether terrain data can be obtained for the [[MapTile]] specified by `quadId`. If it returns false, a terrain mesh will instead be produced for
     * that tile by up-sampling the terrain mesh provided by its parent tile.
     * The default implementation returns `true`.
     */
    isTileAvailable(_quadId) {
        return true;
    }
    /** Returns the minimum and maximum elevation of the terrain within the specified region of the Earth.
     * This range is used for culling terrain meshes that do not intersect the view frustum.
     * The default implementation uses a fast approximation.
     */
    getChildHeightRange(quadId, rectangle, parent) {
        return (quadId.level < ApproximateTerrainHeights.maxLevel) ? ApproximateTerrainHeights.instance.getMinimumMaximumHeights(rectangle) : parent.heightRange;
    }
    /** Returns true if the specified tile should always be loaded. Some tiles contain required metadata and hence should always be loaded.
     * For example, a parent tile might contain information about the availability or height ranges of its child tiles that can be used to
     * implement [[isTileAvailable]] or [[getChildHeightRange]], respectively.
     */
    forceTileLoad(_tile) { return false; }
}
//# sourceMappingURL=TerrainMeshProvider.js.map