@itwin/core-frontend
Version:
iTwin.js frontend components
141 lines • 7.38 kB
TypeScript
/** @packageDocumentation
* @module Tiles
*/
import { BeDuration, BeTimePoint, Id64String } from "@itwin/core-bentley";
import { Matrix4d, Range3d, Transform } from "@itwin/core-geometry";
import { ElementAlignedBox3d, FrustumPlanes, RenderSchedule, ViewFlagOverrides } from "@itwin/core-common";
import { IModelConnection } from "../IModelConnection";
import { RenderClipVolume } from "../render/RenderClipVolume";
import { RenderMemory } from "../render/RenderMemory";
import { LayerTileTreeHandler, Tile, TileDrawArgs, TileGeometryCollector, TileLoadPriority, TileTreeParams } from "./internal";
/** Describes the current state of a [[TileTree]]. TileTrees are loaded asynchronously and may be unloaded after a period of disuse.
* @see [[TileTreeOwner]].
* @public
* @extensions
*/
export declare enum TileTreeLoadStatus {
/** No attempt to load the tile tree has yet been made. */
NotLoaded = 0,
/** The tile tree is in the process of being loaded. */
Loading = 1,
/** The tile tree has been successfully loaded. */
Loaded = 2,
/** An attempt to load the tile tree failed. */
NotFound = 3
}
/** A hierarchical level-of-detail tree of [3d Tiles](https://github.com/CesiumGS/3d-tiles) to be rendered in a [[Viewport]].
* Tile trees originate from a variety of sources:
* - Each [[GeometricModelState]] can supply its graphics as a tile tree;
* - A [[DisplayStyleState]]'s map settings or reality models;
* - [ViewAttachment]($backend)s in a [[SheetModelState]];
* - [[TiledGraphicsProvider]]s associated with a viewport.
*
* The same TileTree can be displayed in any number of viewports using multiple [[TileTreeReference]]s.
* A TileTree's lifetime is managed by a [[TileTreeOwner]].
*
* @note Some methods carry a warning that they should **not** be overridden by subclasses; typically a protected method exists that can be
* overridden instead to customize the behavior. For example, [[selectTiles]] should not be overridden; instead, override the[[_selectTiles]] method
* that it calls.
* @public
* @extensions
*/
export declare abstract class TileTree {
private _isDisposed;
/** @internal */
protected _lastSelected: BeTimePoint;
/** @internal */
protected _clipVolume?: RenderClipVolume;
readonly iModel: IModelConnection;
/** Transform from this tile tree's coordinate space to the iModel's coordinate space. */
readonly iModelTransform: Transform;
/** Uniquely identifies this tree among all other tile trees associated with the iModel. */
readonly id: string;
/** A 64-bit identifier for this tile tree, unique within the context of its [[IModelConnection]].
* For a tile tree associated with a [[GeometricModelState]], this is the Id of the model. Other types of tile trees
* typically use a transient Id obtained from [[IModelConnection.transientIds]].
*/
readonly modelId: Id64String;
/** The length of time after which tiles belonging to this tree are considered elegible for disposal if they are no longer in use. */
readonly expirationTime: BeDuration;
/** @internal */
get loadPriority(): TileLoadPriority;
private readonly _loadPriority;
/** Optional tight bounding box around the entire contents of all of this tree's tiles. */
readonly contentRange?: ElementAlignedBox3d;
/** The lowest-resolution tile in this tree. */
abstract get rootTile(): Tile;
/** True if this tile tree contains 3d graphics. */
abstract get is3d(): boolean;
/** Returns the maximum depth of this tree, if any. */
abstract get maxDepth(): number | undefined;
/** The overrides that should be applied to the view's [ViewFlags]($common) when this tile tree is drawn. Can be overridden by individual [[TileTreeReference]]s. */
abstract get viewFlagOverrides(): ViewFlagOverrides;
/** True if this tile tree has no bounds - e.g., a tile tree representing a globe is unbounded. */
get isContentUnbounded(): boolean;
/** Implement this method to select tiles of appropriate resolution. */
protected abstract _selectTiles(args: TileDrawArgs): Tile[];
/** Produce graphics of appropriate resolution to be drawn in a [[Viewport]]. */
abstract draw(args: TileDrawArgs): void;
/** Discard tiles and/or tile contents, presumably based on a least-recently-used and/or least-likely-to-be-needed criterion. */
abstract prune(): void;
/** True if this tile tree contains 2d graphics. */
get is2d(): boolean;
/** @internal */
get isPointCloud(): boolean;
/** @internal */
get clipVolume(): RenderClipVolume | undefined;
/** The volume of space occupied by this tile tree. */
get range(): ElementAlignedBox3d;
/** The most recent time at which tiles [[selectTiles]] was called. */
get lastSelectedTime(): BeTimePoint;
/** True if a tile and its child tiles should not be drawn simultaneously.
* Default: true.
*/
get parentsAndChildrenExclusive(): boolean;
/** @internal */
get layerHandler(): LayerTileTreeHandler | undefined;
/** Constructor */
protected constructor(params: TileTreeParams);
/** Selects tiles of appropriate resolution for some purpose like drawing to the screen, producing a shadow map, etc.
* @note Do **not** override this method. Implement [[_selectTiles]].
*/
selectTiles(args: TileDrawArgs): Tile[];
/** True if [[dispose]] has been called on this tile tree. */
get isDisposed(): boolean;
/** Dispose of this tree and any resources owned by it. This is typically invoked by a [[TileTreeOwner]]. */
[ ](): void;
/** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [Symbol.dispose] instead. */
dispose(): void;
/** @internal */
collectStatistics(stats: RenderMemory.Statistics): void;
/** Returns the number of [[Tile]]s currently in memory belonging to this tree, primarily for debugging. */
countTiles(): number;
/** @internal */
accumulateTransformedRange(range: Range3d, matrix: Matrix4d, location: Transform, frustumPlanes?: FrustumPlanes): void;
/**
* Return the transform from the tile tree's coordinate space to [ECEF](https://en.wikipedia.org/wiki/ECEF) (Earth Centered Earth Fixed) coordinates.
* If a geographic coordinate system is present then this transform will be calculated at the tile tree center.
* @beta
*/
getEcefTransform(): Promise<Transform | undefined>;
/** Populate [[TileGeometryCollector.polyfaces]] with geometry obtained from this tile tree's tiles satisfying the collector's criteria.
* The base implementation does nothing.
* @see [[TileTreeReference.createGeometryTreeReference]] to attempt to create a TileTree that can collect geometry.
* @beta
*/
collectTileGeometry(_collector: TileGeometryCollector): void;
/**
* Invoked when a schedule script is edited.
* Override to handle updates for affected elements or timelines.
*
* @internal
*/
onScheduleEditingChanged(_changes: RenderSchedule.EditingChanges[]): Promise<void>;
/**
* Invoked when a schedule script is committed during editing.
* Override in specific tile tree types to handle the change.
* @internal
*/
onScheduleEditingCommitted(): void;
}
//# sourceMappingURL=TileTree.d.ts.map