@itwin/core-frontend 5.1.0-dev.55 → 5.1.0-dev.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/DisplayStyleState.d.ts +37 -0
- package/lib/cjs/DisplayStyleState.d.ts.map +1 -1
- package/lib/cjs/DisplayStyleState.js +65 -0
- package/lib/cjs/DisplayStyleState.js.map +1 -1
- package/lib/cjs/Viewport.d.ts.map +1 -1
- package/lib/cjs/Viewport.js +16 -0
- package/lib/cjs/Viewport.js.map +1 -1
- package/lib/cjs/core-frontend.d.ts +1 -1
- package/lib/cjs/core-frontend.js +1 -1
- package/lib/cjs/core-frontend.js.map +1 -1
- package/lib/cjs/internal/ScriptUtils.d.ts +5 -0
- package/lib/cjs/internal/ScriptUtils.d.ts.map +1 -0
- package/lib/cjs/internal/ScriptUtils.js +120 -0
- package/lib/cjs/internal/ScriptUtils.js.map +1 -0
- package/lib/cjs/internal/tile/IModelTile.js.map +1 -1
- package/lib/cjs/internal/tile/IModelTileTree.d.ts +4 -2
- package/lib/cjs/internal/tile/IModelTileTree.d.ts.map +1 -1
- package/lib/cjs/internal/tile/IModelTileTree.js +58 -0
- package/lib/cjs/internal/tile/IModelTileTree.js.map +1 -1
- package/lib/cjs/internal/tile/PrimaryTileTree.js +1 -1
- package/lib/cjs/internal/tile/PrimaryTileTree.js.map +1 -1
- package/lib/cjs/tile/ImdlReader.js.map +1 -1
- package/lib/cjs/tile/TileTree.d.ts +14 -1
- package/lib/cjs/tile/TileTree.d.ts.map +1 -1
- package/lib/cjs/tile/TileTree.js +13 -0
- package/lib/cjs/tile/TileTree.js.map +1 -1
- package/lib/esm/DisplayStyleState.d.ts +37 -0
- package/lib/esm/DisplayStyleState.d.ts.map +1 -1
- package/lib/esm/DisplayStyleState.js +65 -0
- package/lib/esm/DisplayStyleState.js.map +1 -1
- package/lib/esm/Viewport.d.ts.map +1 -1
- package/lib/esm/Viewport.js +16 -0
- package/lib/esm/Viewport.js.map +1 -1
- package/lib/esm/core-frontend.d.ts +1 -1
- package/lib/esm/core-frontend.js +1 -1
- package/lib/esm/core-frontend.js.map +1 -1
- package/lib/esm/internal/ScriptUtils.d.ts +5 -0
- package/lib/esm/internal/ScriptUtils.d.ts.map +1 -0
- package/lib/esm/internal/ScriptUtils.js +117 -0
- package/lib/esm/internal/ScriptUtils.js.map +1 -0
- package/lib/esm/internal/tile/IModelTile.js.map +1 -1
- package/lib/esm/internal/tile/IModelTileTree.d.ts +4 -2
- package/lib/esm/internal/tile/IModelTileTree.d.ts.map +1 -1
- package/lib/esm/internal/tile/IModelTileTree.js +60 -2
- package/lib/esm/internal/tile/IModelTileTree.js.map +1 -1
- package/lib/esm/internal/tile/PrimaryTileTree.js +1 -1
- package/lib/esm/internal/tile/PrimaryTileTree.js.map +1 -1
- package/lib/esm/tile/ImdlReader.js.map +1 -1
- package/lib/esm/tile/TileTree.d.ts +14 -1
- package/lib/esm/tile/TileTree.d.ts.map +1 -1
- package/lib/esm/tile/TileTree.js +13 -0
- package/lib/esm/tile/TileTree.js.map +1 -1
- package/lib/public/scripts/parse-imdl-worker.js +1 -1
- package/lib/workers/webpack/parse-imdl-worker.js +1 -1
- package/package.json +20 -20
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TileTree.js","sourceRoot":"","sources":["../../../src/tile/TileTree.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAc,WAAW,EAAE,OAAO,EAAc,MAAM,qBAAqB,CAAC;AAGnF,OAAO,EAAE,oCAAoC,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAMzC;;;;GAIG;AACH,MAAM,CAAN,IAAY,kBASX;AATD,WAAY,kBAAkB;IAC5B,0DAA0D;IAC1D,qEAAS,CAAA;IACT,uDAAuD;IACvD,iEAAO,CAAA;IACP,kDAAkD;IAClD,+DAAM,CAAA;IACN,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,0BAA0B,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IACnE,CAAC;IAED;;;;OAIG;IACI,mBAAmB,CAAC,UAAiC;IAC5D,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tiles\n */\n\nimport { BeDuration, BeTimePoint, dispose, Id64String } from \"@itwin/core-bentley\";\nimport { Matrix4d, Range3d, Transform } from \"@itwin/core-geometry\";\nimport { ElementAlignedBox3d, FrustumPlanes, ViewFlagOverrides } from \"@itwin/core-common\";\nimport { calculateEcefToDbTransformAtLocation } from \"../BackgroundMapGeometry\";\nimport { IModelApp } from \"../IModelApp\";\nimport { IModelConnection } from \"../IModelConnection\";\nimport { RenderClipVolume } from \"../render/RenderClipVolume\";\nimport { RenderMemory } from \"../render/RenderMemory\";\nimport { LayerTileTreeHandler, Tile, TileDrawArgs, TileGeometryCollector, TileLoadPriority, TileTreeParams } from \"./internal\";\n\n/** Describes the current state of a [[TileTree]]. TileTrees are loaded asynchronously and may be unloaded after a period of disuse.\n * @see [[TileTreeOwner]].\n * @public\n * @extensions\n */\nexport enum TileTreeLoadStatus {\n /** No attempt to load the tile tree has yet been made. */\n NotLoaded,\n /** The tile tree is in the process of being loaded. */\n Loading,\n /** The tile tree has been successfully loaded. */\n Loaded,\n /** An attempt to load the tile tree failed. */\n NotFound,\n}\n\n/** A hierarchical level-of-detail tree of [3d Tiles](https://github.com/CesiumGS/3d-tiles) to be rendered in a [[Viewport]].\n * Tile trees originate from a variety of sources:\n * - Each [[GeometricModelState]] can supply its graphics as a tile tree;\n * - A [[DisplayStyleState]]'s map settings or reality models;\n * - [ViewAttachment]($backend)s in a [[SheetModelState]];\n * - [[TiledGraphicsProvider]]s associated with a viewport.\n *\n * The same TileTree can be displayed in any number of viewports using multiple [[TileTreeReference]]s.\n * A TileTree's lifetime is managed by a [[TileTreeOwner]].\n *\n * @note Some methods carry a warning that they should **not** be overridden by subclasses; typically a protected method exists that can be\n * overridden instead to customize the behavior. For example, [[selectTiles]] should not be overridden; instead, override the[[_selectTiles]] method\n * that it calls.\n * @public\n * @extensions\n */\nexport abstract class TileTree {\n private _isDisposed = false;\n /** @internal */\n protected _lastSelected = BeTimePoint.now();\n /** @internal */\n protected _clipVolume?: RenderClipVolume;\n public readonly iModel: IModelConnection;\n /** Transform from this tile tree's coordinate space to the iModel's coordinate space. */\n public readonly iModelTransform: Transform;\n /** Uniquely identifies this tree among all other tile trees associated with the iModel. */\n public readonly id: string;\n /** A 64-bit identifier for this tile tree, unique within the context of its [[IModelConnection]].\n * For a tile tree associated with a [[GeometricModelState]], this is the Id of the model. Other types of tile trees\n * typically use a transient Id obtained from [[IModelConnection.transientIds]].\n */\n public readonly modelId: Id64String;\n /** The length of time after which tiles belonging to this tree are considered elegible for disposal if they are no longer in use. */\n public readonly expirationTime: BeDuration;\n /** @internal */\n public get loadPriority(): TileLoadPriority { return this._loadPriority; }\n private readonly _loadPriority: TileLoadPriority;\n /** Optional tight bounding box around the entire contents of all of this tree's tiles. */\n public readonly contentRange?: ElementAlignedBox3d;\n\n /** The lowest-resolution tile in this tree. */\n public abstract get rootTile(): Tile;\n /** True if this tile tree contains 3d graphics. */\n public abstract get is3d(): boolean;\n /** Returns the maximum depth of this tree, if any. */\n public abstract get maxDepth(): number | undefined;\n\n /** 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. */\n public abstract get viewFlagOverrides(): ViewFlagOverrides;\n\n /** True if this tile tree has no bounds - e.g., a tile tree representing a globe is unbounded. */\n public get isContentUnbounded(): boolean {\n return false;\n }\n\n /** Implement this method to select tiles of appropriate resolution. */\n protected abstract _selectTiles(args: TileDrawArgs): Tile[];\n\n /** Produce graphics of appropriate resolution to be drawn in a [[Viewport]]. */\n public abstract draw(args: TileDrawArgs): void;\n\n /** Discard tiles and/or tile contents, presumably based on a least-recently-used and/or least-likely-to-be-needed criterion. */\n public abstract prune(): void;\n\n /** True if this tile tree contains 2d graphics. */\n public get is2d(): boolean { return !this.is3d; }\n /** @internal */\n public get isPointCloud(): boolean { return false; }\n /** @internal */\n public get clipVolume(): RenderClipVolume | undefined { return this._clipVolume; }\n\n /** The volume of space occupied by this tile tree. */\n public get range(): ElementAlignedBox3d { return this.rootTile.range; }\n /** The most recent time at which tiles [[selectTiles]] was called. */\n public get lastSelectedTime(): BeTimePoint { return this._lastSelected; }\n /** True if a tile and its child tiles should not be drawn simultaneously.\n * Default: true.\n */\n public get parentsAndChildrenExclusive(): boolean { return true; }\n\n /** @internal */\n public get layerHandler(): LayerTileTreeHandler | undefined { return undefined; }\n\n /** Constructor */\n protected constructor(params: TileTreeParams) {\n this._lastSelected = BeTimePoint.now();\n this.iModel = params.iModel;\n this.iModelTransform = params.location;\n this._clipVolume = params.clipVolume;\n this.modelId = params.modelId;\n this.id = params.id;\n this.contentRange = params.contentRange;\n\n const admin = IModelApp.tileAdmin;\n this._loadPriority = params.priority;\n this.expirationTime = params.expirationTime ?? admin.tileExpirationTime;\n }\n\n /** Selects tiles of appropriate resolution for some purpose like drawing to the screen, producing a shadow map, etc.\n * @note Do **not** override this method. Implement [[_selectTiles]].\n */\n public selectTiles(args: TileDrawArgs): Tile[] {\n this._lastSelected = BeTimePoint.now();\n const tiles = this._selectTiles(args);\n IModelApp.tileAdmin.addTilesForUser(args.context.viewport, tiles, args.readyTiles, args.touchedTiles);\n args.processSelectedTiles(tiles);\n return tiles;\n }\n\n /** True if [[dispose]] has been called on this tile tree. */\n public get isDisposed(): boolean { return this._isDisposed; }\n\n /** Dispose of this tree and any resources owned by it. This is typically invoked by a [[TileTreeOwner]]. */\n public [Symbol.dispose](): void {\n if (this.isDisposed)\n return;\n\n this._isDisposed = true;\n dispose(this.rootTile);\n }\n\n /** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [Symbol.dispose] instead. */\n public dispose() {\n this[Symbol.dispose]();\n }\n\n /** @internal */\n public collectStatistics(stats: RenderMemory.Statistics): void {\n this.rootTile.collectStatistics(stats);\n }\n\n /** Returns the number of [[Tile]]s currently in memory belonging to this tree, primarily for debugging. */\n public countTiles(): number {\n return 1 + this.rootTile.countDescendants();\n }\n\n /** @internal */\n public accumulateTransformedRange(range: Range3d, matrix: Matrix4d, location: Transform, frustumPlanes?: FrustumPlanes): void {\n this.rootTile.extendRangeForContent(range, matrix, location, frustumPlanes);\n }\n\n /**\n * Return the transform from the tile tree's coordinate space to [ECEF](https://en.wikipedia.org/wiki/ECEF) (Earth Centered Earth Fixed) coordinates.\n * If a geographic coordinate system is present then this transform will be calculated at the tile tree center.\n * @beta\n */\n public async getEcefTransform(): Promise<Transform | undefined> {\n if (!this.iModel.ecefLocation)\n return undefined;\n\n let dbToEcef: Transform | undefined;\n const range = this.contentRange ? this.contentRange : this.range;\n const center = range.localXYZToWorld(.5, .5, .5);\n if (center) {\n this.iModelTransform.multiplyPoint3d(center, center);\n const ecefToDb = await calculateEcefToDbTransformAtLocation(center, this.iModel);\n dbToEcef = ecefToDb?.inverse();\n }\n if (!dbToEcef)\n dbToEcef = this.iModel.ecefLocation.getTransform();\n\n return dbToEcef.multiplyTransformTransform(this.iModelTransform);\n }\n\n /** Populate [[TileGeometryCollector.polyfaces]] with geometry obtained from this tile tree's tiles satisfying the collector's criteria.\n * The base implementation does nothing.\n * @see [[TileTreeReference.createGeometryTreeReference]] to attempt to create a TileTree that can collect geometry.\n * @beta\n */\n public collectTileGeometry(_collector: TileGeometryCollector): void {\n }\n}\n\n"]}
|
|
1
|
+
{"version":3,"file":"TileTree.js","sourceRoot":"","sources":["../../../src/tile/TileTree.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAc,WAAW,EAAE,OAAO,EAAc,MAAM,qBAAqB,CAAC;AAGnF,OAAO,EAAE,oCAAoC,EAAE,MAAM,0BAA0B,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MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACjF,QAAQ,GAAG,QAAQ,EAAE,OAAO,EAAE,CAAC;QACjC,CAAC;QACD,IAAI,CAAC,QAAQ;YACX,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC;QAErD,OAAO,QAAQ,CAAC,0BAA0B,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IACnE,CAAC;IAED;;;;OAIG;IACI,mBAAmB,CAAC,UAAiC;IAC5D,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,wBAAwB,CAAC,QAAyC,IAAkB,CAAC;IAClG;;;;OAIG;IACI,0BAA0B,KAAU,CAAC;CAC7C","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tiles\n */\n\nimport { BeDuration, BeTimePoint, dispose, Id64String } from \"@itwin/core-bentley\";\nimport { Matrix4d, Range3d, Transform } from \"@itwin/core-geometry\";\nimport { ElementAlignedBox3d, FrustumPlanes, RenderSchedule, ViewFlagOverrides } from \"@itwin/core-common\";\nimport { calculateEcefToDbTransformAtLocation } from \"../BackgroundMapGeometry\";\nimport { IModelApp } from \"../IModelApp\";\nimport { IModelConnection } from \"../IModelConnection\";\nimport { RenderClipVolume } from \"../render/RenderClipVolume\";\nimport { RenderMemory } from \"../render/RenderMemory\";\nimport { LayerTileTreeHandler, Tile, TileDrawArgs, TileGeometryCollector, TileLoadPriority, TileTreeParams } from \"./internal\";\n\n/** Describes the current state of a [[TileTree]]. TileTrees are loaded asynchronously and may be unloaded after a period of disuse.\n * @see [[TileTreeOwner]].\n * @public\n * @extensions\n */\nexport enum TileTreeLoadStatus {\n /** No attempt to load the tile tree has yet been made. */\n NotLoaded,\n /** The tile tree is in the process of being loaded. */\n Loading,\n /** The tile tree has been successfully loaded. */\n Loaded,\n /** An attempt to load the tile tree failed. */\n NotFound,\n}\n\n/** A hierarchical level-of-detail tree of [3d Tiles](https://github.com/CesiumGS/3d-tiles) to be rendered in a [[Viewport]].\n * Tile trees originate from a variety of sources:\n * - Each [[GeometricModelState]] can supply its graphics as a tile tree;\n * - A [[DisplayStyleState]]'s map settings or reality models;\n * - [ViewAttachment]($backend)s in a [[SheetModelState]];\n * - [[TiledGraphicsProvider]]s associated with a viewport.\n *\n * The same TileTree can be displayed in any number of viewports using multiple [[TileTreeReference]]s.\n * A TileTree's lifetime is managed by a [[TileTreeOwner]].\n *\n * @note Some methods carry a warning that they should **not** be overridden by subclasses; typically a protected method exists that can be\n * overridden instead to customize the behavior. For example, [[selectTiles]] should not be overridden; instead, override the[[_selectTiles]] method\n * that it calls.\n * @public\n * @extensions\n */\nexport abstract class TileTree {\n private _isDisposed = false;\n /** @internal */\n protected _lastSelected = BeTimePoint.now();\n /** @internal */\n protected _clipVolume?: RenderClipVolume;\n public readonly iModel: IModelConnection;\n /** Transform from this tile tree's coordinate space to the iModel's coordinate space. */\n public readonly iModelTransform: Transform;\n /** Uniquely identifies this tree among all other tile trees associated with the iModel. */\n public readonly id: string;\n /** A 64-bit identifier for this tile tree, unique within the context of its [[IModelConnection]].\n * For a tile tree associated with a [[GeometricModelState]], this is the Id of the model. Other types of tile trees\n * typically use a transient Id obtained from [[IModelConnection.transientIds]].\n */\n public readonly modelId: Id64String;\n /** The length of time after which tiles belonging to this tree are considered elegible for disposal if they are no longer in use. */\n public readonly expirationTime: BeDuration;\n /** @internal */\n public get loadPriority(): TileLoadPriority { return this._loadPriority; }\n private readonly _loadPriority: TileLoadPriority;\n /** Optional tight bounding box around the entire contents of all of this tree's tiles. */\n public readonly contentRange?: ElementAlignedBox3d;\n\n /** The lowest-resolution tile in this tree. */\n public abstract get rootTile(): Tile;\n /** True if this tile tree contains 3d graphics. */\n public abstract get is3d(): boolean;\n /** Returns the maximum depth of this tree, if any. */\n public abstract get maxDepth(): number | undefined;\n\n /** 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. */\n public abstract get viewFlagOverrides(): ViewFlagOverrides;\n\n /** True if this tile tree has no bounds - e.g., a tile tree representing a globe is unbounded. */\n public get isContentUnbounded(): boolean {\n return false;\n }\n\n /** Implement this method to select tiles of appropriate resolution. */\n protected abstract _selectTiles(args: TileDrawArgs): Tile[];\n\n /** Produce graphics of appropriate resolution to be drawn in a [[Viewport]]. */\n public abstract draw(args: TileDrawArgs): void;\n\n /** Discard tiles and/or tile contents, presumably based on a least-recently-used and/or least-likely-to-be-needed criterion. */\n public abstract prune(): void;\n\n /** True if this tile tree contains 2d graphics. */\n public get is2d(): boolean { return !this.is3d; }\n /** @internal */\n public get isPointCloud(): boolean { return false; }\n /** @internal */\n public get clipVolume(): RenderClipVolume | undefined { return this._clipVolume; }\n\n /** The volume of space occupied by this tile tree. */\n public get range(): ElementAlignedBox3d { return this.rootTile.range; }\n /** The most recent time at which tiles [[selectTiles]] was called. */\n public get lastSelectedTime(): BeTimePoint { return this._lastSelected; }\n /** True if a tile and its child tiles should not be drawn simultaneously.\n * Default: true.\n */\n public get parentsAndChildrenExclusive(): boolean { return true; }\n\n /** @internal */\n public get layerHandler(): LayerTileTreeHandler | undefined { return undefined; }\n\n /** Constructor */\n protected constructor(params: TileTreeParams) {\n this._lastSelected = BeTimePoint.now();\n this.iModel = params.iModel;\n this.iModelTransform = params.location;\n this._clipVolume = params.clipVolume;\n this.modelId = params.modelId;\n this.id = params.id;\n this.contentRange = params.contentRange;\n\n const admin = IModelApp.tileAdmin;\n this._loadPriority = params.priority;\n this.expirationTime = params.expirationTime ?? admin.tileExpirationTime;\n }\n\n /** Selects tiles of appropriate resolution for some purpose like drawing to the screen, producing a shadow map, etc.\n * @note Do **not** override this method. Implement [[_selectTiles]].\n */\n public selectTiles(args: TileDrawArgs): Tile[] {\n this._lastSelected = BeTimePoint.now();\n const tiles = this._selectTiles(args);\n IModelApp.tileAdmin.addTilesForUser(args.context.viewport, tiles, args.readyTiles, args.touchedTiles);\n args.processSelectedTiles(tiles);\n return tiles;\n }\n\n /** True if [[dispose]] has been called on this tile tree. */\n public get isDisposed(): boolean { return this._isDisposed; }\n\n /** Dispose of this tree and any resources owned by it. This is typically invoked by a [[TileTreeOwner]]. */\n public [Symbol.dispose](): void {\n if (this.isDisposed)\n return;\n\n this._isDisposed = true;\n dispose(this.rootTile);\n }\n\n /** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [Symbol.dispose] instead. */\n public dispose() {\n this[Symbol.dispose]();\n }\n\n /** @internal */\n public collectStatistics(stats: RenderMemory.Statistics): void {\n this.rootTile.collectStatistics(stats);\n }\n\n /** Returns the number of [[Tile]]s currently in memory belonging to this tree, primarily for debugging. */\n public countTiles(): number {\n return 1 + this.rootTile.countDescendants();\n }\n\n /** @internal */\n public accumulateTransformedRange(range: Range3d, matrix: Matrix4d, location: Transform, frustumPlanes?: FrustumPlanes): void {\n this.rootTile.extendRangeForContent(range, matrix, location, frustumPlanes);\n }\n\n /**\n * Return the transform from the tile tree's coordinate space to [ECEF](https://en.wikipedia.org/wiki/ECEF) (Earth Centered Earth Fixed) coordinates.\n * If a geographic coordinate system is present then this transform will be calculated at the tile tree center.\n * @beta\n */\n public async getEcefTransform(): Promise<Transform | undefined> {\n if (!this.iModel.ecefLocation)\n return undefined;\n\n let dbToEcef: Transform | undefined;\n const range = this.contentRange ? this.contentRange : this.range;\n const center = range.localXYZToWorld(.5, .5, .5);\n if (center) {\n this.iModelTransform.multiplyPoint3d(center, center);\n const ecefToDb = await calculateEcefToDbTransformAtLocation(center, this.iModel);\n dbToEcef = ecefToDb?.inverse();\n }\n if (!dbToEcef)\n dbToEcef = this.iModel.ecefLocation.getTransform();\n\n return dbToEcef.multiplyTransformTransform(this.iModelTransform);\n }\n\n /** Populate [[TileGeometryCollector.polyfaces]] with geometry obtained from this tile tree's tiles satisfying the collector's criteria.\n * The base implementation does nothing.\n * @see [[TileTreeReference.createGeometryTreeReference]] to attempt to create a TileTree that can collect geometry.\n * @beta\n */\n public collectTileGeometry(_collector: TileGeometryCollector): void {\n }\n\n /**\n * Invoked when a schedule script is edited.\n * Override to handle updates for affected elements or timelines.\n *\n * @internal\n */\n public async onScheduleEditingChanged(_changes: RenderSchedule.EditingChanges[]): Promise<void> {}\n /**\n * Invoked when a schedule script is committed during editing.\n * Override in specific tile tree types to handle the change.\n * @internal\n */\n public onScheduleEditingCommitted(): void {}\n}\n\n"]}
|