/** @packageDocumentation
 * @module Tiles
 */
import { Id64String } from "@itwin/core-bentley";
import { BackgroundMapSettings, BaseLayerSettings, ColorDef, GlobeMode, MapLayerSettings } from "@itwin/core-common";
import { Ellipsoid, EllipsoidPatch, Point3d, Range1d, Range3d, Ray3d, Transform, Vector3d } from "@itwin/core-geometry";
import { TerrainDisplayOverrides } from "../../DisplayStyleState";
import { HitDetail } from "../../HitDetail";
import { IModelConnection } from "../../IModelConnection";
import { FeatureSymbology } from "../../render/FeatureSymbology";
import { RenderPlanarClassifier } from "../../render/RenderPlanarClassifier";
import { SceneContext } from "../../ViewContext";
import { ScreenViewport } from "../../Viewport";
import { DisclosedTileTreeSet, GeometryTileTreeReference, ImageryMapLayerTreeReference, ImageryMapTileTree, ImageryTileTreeState, MapCartoRectangle, MapFeatureInfoOptions, MapLayerFeatureInfo, MapLayerImageryProvider, MapLayerIndex, MapLayerTileTreeReference, MapTile, MapTileLoader, MapTilingScheme, ModelMapLayerTileTreeReference, QuadId, RealityTile, RealityTileTree, RealityTileTreeParams, Tile, TileDrawArgs, TileParams, TileTree, TileTreeOwner, TileTreeReference } from "../internal";
/** Utility interface that ties an imagery tile tree to its corresponding map-layer settings object.
 * @internal
 */
interface MapLayerTreeSetting {
    tree: ImageryMapTileTree;
    settings: MapLayerSettings;
    baseImageryLayer: boolean;
}
/** Map tile tree scale range visibility values.
 * @beta */
export declare enum MapTileTreeScaleRangeVisibility {
    /** state is currently unknown (i.e. never been displayed)  */
    Unknown = 0,
    /** all currently selected tree tiles are visible (i.e within the scale range)  */
    Visible = 1,
    /** all currently selected tree tiles are hidden (i.e outside the scale range)  */
    Hidden = 2,
    /** currently selected tree tiles are partially visible (i.e some tiles are within the scale range, and some are outside.) */
    Partial = 3
}
/**
* Provides map layer information for a given tile tree.
* @internal
*/
export interface MapLayerInfoFromTileTree {
    /** Indicate if the map layer represents the base layer */
    isBaseLayer: boolean;
    /** Map layer index; undefined if base map */
    index?: MapLayerIndex;
    /** Settings for the map layer (or the base layer)*/
    settings: MapLayerSettings;
    /** Provider for the map layer (or the base layer) */
    provider?: MapLayerImageryProvider;
}
/** A [quad tree](https://en.wikipedia.org/wiki/Quadtree) consisting of [[MapTile]]s representing the map imagery draped onto the surface of the Earth.
 * A `MapTileTree` enables display of a globe or planar map with [map imagery](https://en.wikipedia.org/wiki/Tiled_web_map) obtained from any number of sources, such as
 * [Bing](https://learn.microsoft.com/en-us/bingmaps/), [OpenStreetMap](https://wiki.openstreetmap.org/wiki/API), and [GIS servers](https://wiki.openstreetmap.org/wiki/API).
 * The specific imagery displayed is determined by a [[Viewport]]'s [MapImagerySettings]($common) and [BackgroundMapSettings]($common).
 *
 * The map or globe may be smooth, or feature 3d geometry supplied by a [[TerrainProvider]].
 * The terrain displayed in a [[Viewport]] is determined by its [TerrainSettings]($common).
 * @public
 */
export declare class MapTileTree extends RealityTileTree {
    /** @internal */
    ecefToDb: Transform;
    /** @internal */
    bimElevationBias: number;
    /** @internal */
    geodeticOffset: number;
    /** @internal */
    sourceTilingScheme: MapTilingScheme;
    /** @internal */
    private _mercatorFractionToDb;
    /** @internal */
    earthEllipsoid: Ellipsoid;
    /** @internal */
    minEarthEllipsoid: Ellipsoid;
    /** @internal */
    maxEarthEllipsoid: Ellipsoid;
    /** Determines whether the map displays as a plane or an ellipsoid. */
    readonly globeMode: GlobeMode;
    /** @internal */
    globeOrigin: Point3d;
    /** @internal */
    private _mercatorTilingScheme;
    /** @internal */
    useDepthBuffer: boolean;
    /** @internal */
    isOverlay: boolean;
    /** @internal */
    terrainExaggeration: number;
    /** @internal */
    baseColor?: ColorDef;
    /** @internal */
    baseTransparent: boolean;
    /** @internal */
    mapTransparent: boolean;
    /** @internal */
    produceGeometry?: boolean;
    /** @internal */
    layerImageryTrees: MapLayerTreeSetting[];
    private _layerSettings;
    private _imageryTreeState;
    private _modelIdToIndex;
    /** @internal */
    layerClassifiers: Map<number, RenderPlanarClassifier>;
    /** @internal */
    constructor(params: RealityTileTreeParams, ecefToDb: Transform, bimElevationBias: number, geodeticOffset: number, sourceTilingScheme: MapTilingScheme, id: MapTreeId, applyTerrain: boolean);
    /** @internal */
    get parentsAndChildrenExclusive(): boolean;
    /** Return the imagery tile tree state of matching the provided imagery tree id.
     * @internal
     */
    getImageryTreeState(imageryTreeId: string): ImageryTileTreeState | undefined;
    /** Return a cloned dictionary of the imagery tile tree states
     * @internal
     */
    cloneImageryTreeState(): Map<string, ImageryTileTreeState>;
    /** @internal */
    tileFromQuadId(quadId: QuadId): MapTile | undefined;
    /** Add a new imagery tile tree / map-layer settings pair and initialize the imagery tile tree state.
     * @internal
     */
    addImageryLayer(tree: ImageryMapTileTree, settings: MapLayerSettings, index: number, baseImageryLayer: boolean): void;
    /** @internal */
    addModelLayer(layerTreeRef: ModelMapLayerTileTreeReference, context: SceneContext): void;
    /** @internal */
    protected collectClassifierGraphics(args: TileDrawArgs, selectedTiles: RealityTile[]): void;
    /** @internal */
    clearImageryTreesAndClassifiers(): void;
    /** @internal */
    get isTransparent(): boolean;
    /** @internal */
    get maxDepth(): number;
    /** @internal */
    createPlanarChild(params: TileParams, quadId: QuadId, corners: Point3d[], normal: Vector3d, rectangle: MapCartoRectangle, chordHeight: number, heightRange?: Range1d): MapTile | undefined;
    /** @internal */
    createGlobeChild(params: TileParams, quadId: QuadId, _rangeCorners: Point3d[], rectangle: MapCartoRectangle, ellipsoidPatch: EllipsoidPatch, heightRange?: Range1d): MapTile;
    /** @internal */
    getChildHeightRange(quadId: QuadId, rectangle: MapCartoRectangle, parent: MapTile): Range1d | undefined;
    /** @internal */
    clearLayers(): void;
    /** Reprojection does not work with very large tiles so just do linear transform.
     * @internal
     */
    static minReprojectionDepth: number;
    /** @internal */
    static maxGlobeDisplayDepth: number;
    /** @internal */
    static minDisplayableDepth: number;
    /** @internal */
    get mapLoader(): MapTileLoader;
    /** @internal */
    getBaseRealityDepth(sceneContext: SceneContext): number;
    /** @internal */
    doCreateGlobeChildren(tile: Tile): boolean;
    /** @internal */
    doReprojectChildren(tile: Tile): boolean;
    /** @internal */
    getCornerRays(rectangle: MapCartoRectangle): Ray3d[] | undefined;
    /** @internal */
    pointAboveEllipsoid(point: Point3d): boolean;
    private getMercatorFractionChildGridPoints;
    private getChildCornersFromGridPoints;
    /** @internal */
    getCachedReprojectedPoints(gridPoints: Point3d[]): (Point3d | undefined)[] | undefined;
    /** Minimize reprojection requests by requesting this corners tile and a grid that will include all points for 4 levels of descendants.
     * This greatly reduces the number of reprojection requests which currently require a roundtrip through the backend.
     * @internal
     */
    loadReprojectionCache(tile: MapTile): Promise<void>;
    private static _scratchCarto;
    /** Get the corners for planar children.
     * This generally will resolve immediately, but may require an asynchronous request for reprojecting the corners.
     * @internal
     */
    getPlanarChildCorners(tile: MapTile, columnCount: number, rowCount: number, resolve: (childCorners: Point3d[][]) => void): void;
    /** Scan the list of currently selected reality tiles, and fire the viewport's 'onMapLayerScaleRangeVisibilityChanged ' event
     * if any scale range visibility change is detected for one more map-layer definition.
     * @internal
     */
    reportTileVisibility(args: TileDrawArgs, selected: RealityTile[]): void;
    /** @internal */
    getFractionalTileCorners(quadId: QuadId): Point3d[];
    /** @internal */
    getTileRectangle(quadId: QuadId): MapCartoRectangle;
    /** @internal */
    getLayerIndex(imageryTreeId: Id64String): number;
    /** @internal */
    getLayerTransparency(imageryTreeId: Id64String): number;
}
interface MapTreeId {
    tileUserId: number;
    applyTerrain: boolean;
    terrainProviderName: string;
    terrainDataSource: string;
    terrainHeightOrigin: number;
    terrainHeightOriginMode: number;
    terrainExaggeration: number;
    mapGroundBias: number;
    wantSkirts: boolean;
    wantNormals: boolean;
    globeMode: GlobeMode;
    useDepthBuffer: boolean;
    isOverlay: boolean;
    baseColor?: ColorDef;
    baseTransparent: boolean;
    mapTransparent: boolean;
    maskModelIds?: string;
    produceGeometry?: boolean;
}
/** @internal */
type CheckTerrainDisplayOverride = () => TerrainDisplayOverrides | undefined;
/** Specialization of tile tree that represents background map.
 * @internal
 */
export declare class MapTileTreeReference extends TileTreeReference {
    private _baseLayerSettings;
    private _layerSettings;
    isOverlay: boolean;
    private _isDrape;
    private _overrideTerrainDisplay?;
    private _tileUserId;
    private _settings;
    private readonly _iModel;
    private _baseImageryLayerIncluded;
    private _baseColor?;
    private readonly _layerTrees;
    private _baseTransparent;
    private _symbologyOverrides;
    private _planarClipMask?;
    constructor(settings: BackgroundMapSettings, _baseLayerSettings: BaseLayerSettings | undefined, _layerSettings: MapLayerSettings[], iModel: IModelConnection, tileUserId: number, isOverlay: boolean, _isDrape: boolean, _overrideTerrainDisplay?: CheckTerrainDisplayOverride | undefined);
    forEachLayerTileTreeRef(func: (ref: TileTreeReference) => void): void;
    get isGlobal(): boolean;
    get baseColor(): ColorDef | undefined;
    get planarclipMaskPriority(): number;
    protected _createGeometryTreeReference(): GeometryTileTreeReference | undefined;
    /** Terrain  tiles do not contribute to the range used by "fit view". */
    unionFitRange(_range: Range3d): void;
    get settings(): BackgroundMapSettings;
    set settings(settings: BackgroundMapSettings);
    setBaseLayerSettings(baseLayerSettings: BaseLayerSettings): void;
    get layerSettings(): MapLayerSettings[];
    setLayerSettings(layerSettings: MapLayerSettings[]): void;
    clearLayers(): void;
    get castsShadows(): boolean;
    protected get _isLoadingComplete(): boolean;
    get useDepthBuffer(): boolean;
    get treeOwner(): TileTreeOwner;
    getLayerImageryTreeRef(index: number): MapLayerTileTreeReference | undefined;
    /** Return the map-layer scale range visibility for the provided map-layer index.
   * @internal
   */
    getMapLayerScaleRangeVisibility(index: number): MapTileTreeScaleRangeVisibility;
    initializeLayers(context: SceneContext): boolean;
    /** Adds this reference's graphics to the scene. By default this invokes [[TileTree.drawScene]] on the referenced TileTree, if it is loaded. */
    addToScene(context: SceneContext): void;
    createDrawArgs(context: SceneContext): TileDrawArgs | undefined;
    protected getViewFlagOverrides(_tree: TileTree): Partial<import("@itwin/core-bentley").Mutable<import("@itwin/core-bentley").NonFunctionPropertiesOf<import("@itwin/core-common").ViewFlags>>>;
    protected getSymbologyOverrides(_tree: TileTree): FeatureSymbology.Overrides | undefined;
    discloseTileTrees(trees: DisclosedTileTreeSet): void;
    imageryTreeFromTreeModelIds(mapTreeModelId: Id64String, layerTreeModelId: Id64String): ImageryMapLayerTreeReference[];
    layerFromTreeModelIds(mapTreeModelId: Id64String, layerTreeModelId: Id64String): MapLayerInfoFromTileTree[];
    private forEachImageryTileHit;
    canSupplyToolTip(hit: HitDetail): boolean;
    getToolTip(hit: HitDetail): Promise<HTMLElement | string | undefined>;
    getMapFeatureInfo(hit: HitDetail, options?: MapFeatureInfoOptions): Promise<MapLayerFeatureInfo[] | undefined>;
    /** Add logo cards to logo div. */
    addLogoCards(cards: HTMLTableElement, vp: ScreenViewport): void;
}
/** Returns whether a GCS converter is available.
 * @internal
 */
export declare function getGcsConverterAvailable(iModel: IModelConnection): Promise<boolean>;
export {};
//# sourceMappingURL=MapTileTree.d.ts.map