UNPKG

@itwin/core-frontend

Version:
85 lines 5.17 kB
/** @packageDocumentation * @module Tiles */ import { IndexedPolyface, Range3d, Transform } from "@itwin/core-geometry"; import { Tile, TileTreeReference, TileUser } from "./internal"; /** Enumerates the statuses returned by [[TileGeometryCollector.collectTile]]. * - "accept": The tile's geometry should be collected. * - "reject": The tile's geometry (and that of all of its child tiles) should be omitted. * - "continue": The tile's geometry should be omitted, but that of its child tiles should be evaluated for collection. * @public */ export type CollectTileStatus = "accept" | "reject" | "continue"; /** Options for creating a [[TileGeometryCollector]]. * @public */ export interface TileGeometryCollectorOptions { /** The chord tolerance in meters describing the minimum level of detail desired of the tile geometry. */ chordTolerance: number; /** The volume in which to collect tiles. Geometry of tiles that do not intersect this volume will not be collected. */ range: Range3d; /** The [[TileUser]] that will make use of the tiles. */ user: TileUser; /** An optional transform to be applied to the tile ranges before testing intersection with [[range]]. Typically this is obtained from [[TileTree.iModelTransform]]. */ transform?: Transform; } /** Collects geoemtry from a [[GeometryTileTreeReference]] within a specified volume at a specified level of detail. * Subclasses can refine the collection criterion. * The tile geometry is obtained asynchronously, so successive collections over multiple frames may be required before all of the geometry * is collected. * @public */ export declare class TileGeometryCollector { /** The list of accumulated polyfaces, populated during [[GeometryTileTreeReference.collectTileGeometry]]. * The polyfaces belong to the [[Tile]]s - they should not be modified. * If [[isAllGeometryLoaded]] is `false`, then this list is incomplete - another geometry collection should be performed with a new collector on a subsequent frame. */ readonly polyfaces: IndexedPolyface[]; private readonly _missing; private _loading; /** The options used to construct this collector. */ protected readonly _options: TileGeometryCollectorOptions; /** Create a new collector. */ constructor(options: TileGeometryCollectorOptions); /** Allows an implementation of [[GeometryTileTreeReference.collectTileGeoemtry]] to indicate that further loading is required before * the collection can be completed. * This will cause [[isAllGeometryLoaded]] to return `false`. */ markLoading(): void; /** Enqueues requests to obtain the content of any tiles whose content is required to complete the geometry collection. * @see [[isAllGeometryLoaded]] to determine if geometry collection is complete. */ requestMissingTiles(): void; /** Allows an implementation of [[GeometryTileTreeReference.collectTileGeometry]] to indicate that the specified tile's content must be loaded * before geometry collection can be completed. * This will cause [[isAllGeometryLoaded]] to return `false`. */ addMissingTile(tile: Tile): void; /** Returns true if [[polyfaces]] has been fully populated with all the geometry satisfying this collector's criteria. * If it returns false, another collection using a new collector should be performed on a subsequent frame to load more geometry. */ get isAllGeometryLoaded(): boolean; /** Determine whether to collect the specified tile's geometry, reject it, or to evaluate the geometry of its child tiles for collection. * This base implementation makes that determination based on the collector's range and chord tolerance. Subclasses should typically call `super.collectTile` and, if * it returns "accept" or "continue", apply their own criteria to the tile. */ collectTile(tile: Tile): CollectTileStatus; } /** A [[TileTreeReference]] that can supply geometry in the form of [Polyface]($core-geometry)s from [[Tile]]s belonging to its [[TileTree]] and satisfying the criteria defined * by a [[TileGeometryCollector]]. * Use [[TileTreeReference.createGeometryTreeReference]] to obtain a GeometryTileTreeReference from an existing TileTreeReference. * @public */ export interface GeometryTileTreeReference extends TileTreeReference { /** Populate [[TileGeometryCollector.polyfaces]] with geometry satisfying `collector`'s criteria. * Because tile geometry is obtained asynchronously, successive collections over multiple frames may be required before the list of polyfaces is fully populated. * @see [[TileGeometryCollector.isAllGeometryLoaded]] to determine if the list of polyfaces is fully populated. */ collectTileGeometry: (collector: TileGeometryCollector) => void; /** If set to true, tile geometry will be reprojected using the tile's reprojection transform when geometry is collected from the referenced TileTree. * Currently only applies to point clouds, reality meshes, and terrain. * @internal */ reprojectGeometry?: boolean; } //# sourceMappingURL=TileGeometryCollector.d.ts.map