@itwin/core-frontend 5.1.0-dev.10 → 5.1.0-dev.13

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.
@@ -1 +1 @@
1
- {"version":3,"file":"IModelTile.js","sourceRoot":"","sources":["../../../../src/internal/tile/IModelTile.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAqBH,4DASC;AA5BD,sDAAoF;AACpF,wDAA0D;AAC1D,oDAE4B;AAC5B,+CAA4C;AAG5C,oDAG+B;AAQ/B,SAAgB,wBAAwB,CAAC,KAAgB,EAAE,MAA8B;IACvF,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IACjE,MAAM,KAAK,GAAG,uBAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAE5C,IAAI,YAAY,CAAC;IACjB,IAAI,SAAS,KAAK,KAAK,CAAC,YAAY;QAClC,YAAY,GAAG,uBAAO,CAAC,QAAQ,CAAsB,KAAK,CAAC,YAAY,CAAC,CAAC;IAE3E,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC;AACzF,CAAC;AAED;;GAEG;AACH,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,2CAAE,CAAA;IACF,6CAAG,CAAA;AACL,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AASD;GACG;AACH,MAAa,UAAW,SAAQ,eAAI;IAC1B,eAAe,CAAU;IACzB,kBAAkB,CAAU;IACpC;;OAEG;IACI,cAAc,CAAsB;IAE3C,YAAmB,MAAwB,EAAE,IAAoB;QAC/D,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACpB,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,cAAc,CAAC;QAE7C,IAAI,CAAC,IAAI,CAAC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CAAC,CAAC,YAAY,CAAC,EAAE,CAAC;IACvE,CAAC;CACF;AAvRD,gCAuRC","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 { assert, BentleyError, BeTimePoint, ByteStream } from \"@itwin/core-bentley\";\nimport { Range3d, Transform } from \"@itwin/core-geometry\";\nimport {\n ColorDef, computeChildTileProps, computeChildTileRanges, computeTileChordTolerance, ElementAlignedBox3d, LinePixels, TileFormat, TileProps,\n} from \"@itwin/core-common\";\nimport { IModelApp } from \"../../IModelApp\";\nimport { GraphicBuilder } from \"../../render/GraphicBuilder\";\nimport { RenderSystem } from \"../../render/RenderSystem\";\nimport {\n addRangeGraphic, IModelTileTree, Tile, TileBoundingBoxes, TileContent, TileDrawArgs, TileLoadStatus, TileParams, TileRequest,\n TileRequestChannel, TileTreeLoadStatus, TileVisibility,\n} from \"./../../tile/internal\";\n\n/** Parameters used to construct an [[IModelTile]].\n */\nexport interface IModelTileParams extends TileParams {\n sizeMultiplier?: number;\n}\n\nexport function iModelTileParamsFromJSON(props: TileProps, parent: IModelTile | undefined): IModelTileParams {\n const { contentId, maximumSize, isLeaf, sizeMultiplier } = props;\n const range = Range3d.fromJSON(props.range);\n\n let contentRange;\n if (undefined !== props.contentRange)\n contentRange = Range3d.fromJSON<ElementAlignedBox3d>(props.contentRange);\n\n return { contentId, range, maximumSize, isLeaf, parent, contentRange, sizeMultiplier };\n}\n\n/**\n * Indicates whether a parent tile should be drawn in place of a child tile.\n */\nexport enum SelectParent {\n No,\n Yes,\n}\n\nexport interface IModelTileContent extends TileContent {\n /** If this tile was produced by refinement, the multiplier applied to its screen size. */\n sizeMultiplier?: number;\n /** A bitfield describing empty sub-volumes of this tile's volume. */\n emptySubRangeMask?: number;\n}\n\n/** A tile belonging to an [[IModelTileTree].\n */\nexport class IModelTile extends Tile {\n private _sizeMultiplier?: number;\n private _emptySubRangeMask?: number;\n /** If an initial attempt to obtain this tile's content (e.g., from cloud storage cache) failed,\n * the next channel to try.\n */\n public requestChannel?: TileRequestChannel;\n\n public constructor(params: IModelTileParams, tree: IModelTileTree) {\n super(params, tree);\n this._sizeMultiplier = params.sizeMultiplier;\n\n if (!this.isLeaf && this.tree.is3d && !this.isReady) { // ###TODO: Want to know specifically if tree is *spatial*.\n // Do not sub-divide such that chord tolerance would be below specified minimum, if minimum defined.\n const minTolerance = IModelApp.tileAdmin.minimumSpatialTolerance;\n if (minTolerance > 0 && computeTileChordTolerance(this, this.tree.is3d, this.iModelTree.tileScreenSize) <= minTolerance)\n this.setLeaf();\n }\n }\n\n public get iModelTree(): IModelTileTree { return this.tree as IModelTileTree; }\n public get iModelChildren(): IModelTile[] | undefined { return this.children as IModelTile[] | undefined; }\n public get emptySubRangeMask(): number { return this._emptySubRangeMask ?? 0; }\n\n public get sizeMultiplier(): number | undefined { return this._sizeMultiplier; }\n public get hasSizeMultiplier() { return undefined !== this.sizeMultiplier; }\n public override get maximumSize(): number {\n return super.maximumSize * (this.sizeMultiplier ?? 1.0);\n }\n\n public get channel(): TileRequestChannel {\n return IModelApp.tileAdmin.channels.getIModelTileChannel(this);\n }\n\n public async requestContent(): Promise<TileRequest.Response> {\n return IModelApp.tileAdmin.generateTileContent(this);\n }\n\n public async readContent(data: TileRequest.ResponseData, system: RenderSystem, isCanceled?: () => boolean): Promise<IModelTileContent> {\n if (undefined === isCanceled)\n isCanceled = () => !this.isLoading;\n\n assert(data instanceof Uint8Array);\n const streamBuffer = ByteStream.fromUint8Array(data);\n\n const position = streamBuffer.curPos;\n const format = streamBuffer.readUint32();\n streamBuffer.curPos = position;\n\n let content: IModelTileContent = { isLeaf: true };\n assert(TileFormat.IModel === format);\n if (format !== TileFormat.IModel)\n return content;\n\n const sizeMultiplier = this.hasSizeMultiplier ? this.sizeMultiplier : undefined;\n\n const ecefTransform = this.tree.iModel.isGeoLocated ? this.tree.iModel.getEcefTransform() : Transform.createIdentity();\n try {\n content = await this.iModelTree.decoder.decode({\n stream: streamBuffer,\n options: { tileId: this.contentId },\n system,\n isCanceled,\n sizeMultiplier,\n tileData: {\n ecefTransform,\n range: this.range,\n layerClassifiers: this.tree.layerHandler?.layerClassifiers,\n },\n });\n } catch {\n //\n }\n\n return content;\n }\n\n public override setContent(content: IModelTileContent): void {\n super.setContent(content);\n\n this._emptySubRangeMask = content.emptySubRangeMask;\n\n // NB: If this tile has no graphics, it may or may not have children - but we don't want to load the children until\n // this tile is too coarse for view based on its size in pixels.\n // That is different than an \"undisplayable\" tile (maximumSize=0) whose children should be loaded immediately.\n if (undefined !== content.graphic && 0 === this.maximumSize)\n this._maximumSize = this.iModelTree.tileScreenSize;\n\n const sizeMult = content.sizeMultiplier;\n if (undefined !== sizeMult && (undefined === this._sizeMultiplier || sizeMult > this._sizeMultiplier)) {\n this._sizeMultiplier = sizeMult;\n this._contentId = this.iModelTree.contentIdProvider.idFromParentAndMultiplier(this.contentId, sizeMult);\n if (undefined !== this.children && this.children.length > 1)\n this.disposeChildren();\n }\n }\n\n protected _loadChildren(resolve: (children: Tile[]) => void, reject: (error: Error) => void): void {\n try {\n const tree = this.iModelTree;\n const kids = computeChildTileProps(this, tree.contentIdProvider, tree);\n IModelApp.tileAdmin.onTilesElided(kids.numEmpty);\n\n const children: IModelTile[] = [];\n for (const props of kids.children) {\n const child = new IModelTile(iModelTileParamsFromJSON(props, this), tree);\n children.push(child);\n }\n\n resolve(children);\n } catch (err) {\n reject(err instanceof Error ? err : new Error(BentleyError.getErrorMessage(err)));\n }\n }\n\n protected override get rangeGraphicColor(): ColorDef {\n return this.hasSizeMultiplier ? ColorDef.red : super.rangeGraphicColor;\n }\n\n protected override addRangeGraphic(builder: GraphicBuilder, type: TileBoundingBoxes): void {\n if (TileBoundingBoxes.ChildVolumes !== type) {\n super.addRangeGraphic(builder, type);\n return;\n }\n\n const ranges = computeChildTileRanges(this, this.iModelTree);\n for (const range of ranges) {\n const color = range.isEmpty ? ColorDef.blue : ColorDef.green;\n const pixels = !range.isEmpty ? LinePixels.HiddenLine : LinePixels.Solid;\n const width = !range.isEmpty ? 2 : 1;\n builder.setSymbology(color, color, width, pixels);\n addRangeGraphic(builder, range.range, this.tree.is2d);\n }\n }\n\n public pruneChildren(olderThan: BeTimePoint): void {\n // A tile's usage marker indicates its the most recent time its *children* were used.\n if (this.usageMarker.isExpired(olderThan)) {\n this.disposeChildren();\n return;\n }\n\n // this node has been used recently. Keep it, but potentially unload its grandchildren.\n const children = this.iModelChildren;\n if (undefined !== children)\n for (const child of children)\n child.pruneChildren(olderThan);\n }\n\n public selectTiles(selected: Tile[], args: TileDrawArgs, numSkipped: number): SelectParent {\n let vis = this.computeVisibility(args);\n if (TileVisibility.OutsideFrustum === vis)\n return SelectParent.No;\n\n const maxDepth = this.iModelTree.debugMaxDepth;\n if (undefined !== maxDepth && this.depth >= maxDepth)\n vis = TileVisibility.Visible;\n\n if (TileVisibility.Visible === vis) {\n // This tile is of appropriate resolution to draw. If need loading or refinement, enqueue.\n if (!this.isReady)\n args.insertMissing(this);\n\n if (this.hasGraphics) {\n // It can be drawn - select it\n args.markReady(this);\n selected.push(this);\n } else if (!this.isReady) {\n // It can't be drawn. Try to draw children in its place; otherwise draw the parent.\n // Do not load/request the children for this purpose.\n const initialSize = selected.length;\n const kids = this.iModelChildren;\n if (undefined === kids)\n return SelectParent.Yes;\n\n // Find any descendant to draw, until we exceed max initial tiles to skip.\n if (this.depth < this.iModelTree.maxInitialTilesToSkip) {\n for (const kid of kids) {\n if (SelectParent.Yes === kid.selectTiles(selected, args, numSkipped)) {\n selected.length = initialSize;\n return SelectParent.Yes;\n }\n\n return SelectParent.No;\n }\n }\n\n // If all visible direct children can be drawn, draw them.\n for (const kid of kids) {\n if (TileVisibility.OutsideFrustum !== kid.computeVisibility(args)) {\n if (!kid.hasGraphics) {\n selected.length = initialSize;\n return SelectParent.Yes;\n } else {\n selected.push(kid);\n }\n }\n }\n\n args.markUsed(this);\n }\n\n // We're drawing either this tile, or its direct children.\n return SelectParent.No;\n }\n\n // This tile is too coarse to draw. Try to draw something more appropriate.\n // If it is not ready to draw, we may want to skip loading in favor of loading its descendants.\n // If we previously loaded and later unloaded content for this tile to free memory, don't force it to reload its content - proceed to children.\n let canSkipThisTile = (this._hadGraphics && !this.hasGraphics) || this.depth < this.iModelTree.maxInitialTilesToSkip;\n if (canSkipThisTile) {\n numSkipped = 1;\n } else {\n canSkipThisTile = this.isReady || this.isParentDisplayable || this.depth < this.iModelTree.maxInitialTilesToSkip;\n if (canSkipThisTile && this.isDisplayable) { // skipping an undisplayable tile doesn't count toward the maximum\n // Some tiles do not sub-divide - they only facet the same geometry to a higher resolution. We can skip directly to the correct resolution.\n const isNotReady = !this.isReady && !this.hasGraphics && !this.hasSizeMultiplier;\n if (isNotReady) {\n if (numSkipped >= this.iModelTree.maxTilesToSkip)\n canSkipThisTile = false;\n else\n numSkipped += 1;\n }\n }\n }\n\n const childrenLoadStatus = this.loadChildren(); // NB: asynchronous\n const children = canSkipThisTile ? this.iModelChildren : undefined;\n if (canSkipThisTile && TileTreeLoadStatus.Loading === childrenLoadStatus) {\n args.markChildrenLoading();\n args.markUsed(this);\n }\n\n if (undefined !== children) {\n // If we are the root tile and we are not displayable, then we want to draw *any* currently available children in our place, or else we would draw nothing.\n // Otherwise, if we want to draw children in our place, we should wait for *all* of them to load, or else we would show missing chunks where not-yet-loaded children belong.\n const isUndisplayableRootTile = this.isUndisplayableRootTile;\n args.markUsed(this);\n let drawChildren = true;\n const initialSize = selected.length;\n for (const child of children) {\n // NB: We must continue iterating children so that they can be requested if missing.\n if (SelectParent.Yes === child.selectTiles(selected, args, numSkipped)) {\n if (child.loadStatus === TileLoadStatus.NotFound) {\n // At least one child we want to draw failed to load. e.g., we reached max depth of map tile tree. Draw parent instead.\n drawChildren = canSkipThisTile = false;\n } else {\n // At least one child we want to draw is not yet loaded. Wait for it to load before drawing it and its siblings, unless we have nothing to draw in their place.\n drawChildren = isUndisplayableRootTile;\n }\n }\n }\n\n if (drawChildren)\n return SelectParent.No;\n\n // Some types of tiles (like maps) allow the ready children to be drawn on top of the parent while other children are not yet loaded.\n if (args.parentsAndChildrenExclusive)\n selected.length = initialSize;\n }\n\n if (this.isReady) {\n if (this.hasGraphics) {\n selected.push(this);\n if (!canSkipThisTile) {\n // This tile is too coarse, but we require loading it before we can start loading higher-res children.\n args.markReady(this);\n }\n }\n\n return SelectParent.No;\n }\n\n // This tile is not ready to be drawn. Request it *only* if we cannot skip it.\n if (!canSkipThisTile)\n args.insertMissing(this);\n\n return this.isParentDisplayable ? SelectParent.Yes : SelectParent.No;\n }\n}\n"]}
1
+ {"version":3,"file":"IModelTile.js","sourceRoot":"","sources":["../../../../src/internal/tile/IModelTile.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAqBH,4DASC;AA5BD,sDAAoF;AACpF,wDAA0D;AAC1D,oDAE4B;AAC5B,+CAA4C;AAG5C,oDAG+B;AAQ/B,SAAgB,wBAAwB,CAAC,KAAgB,EAAE,MAA8B;IACvF,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IACjE,MAAM,KAAK,GAAG,uBAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAE5C,IAAI,YAAY,CAAC;IACjB,IAAI,SAAS,KAAK,KAAK,CAAC,YAAY;QAClC,YAAY,GAAG,uBAAO,CAAC,QAAQ,CAAsB,KAAK,CAAC,YAAY,CAAC,CAAC;IAE3E,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC;AACzF,CAAC;AAED;;GAEG;AACH,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,2CAAE,CAAA;IACF,6CAAG,CAAA;AACL,CAA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AAe,EAAE,CAAC;oBACrB,sGAAsG;oBACtG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;gBACvB,CAAC;YACH,CAAC;YAED,OAAO,YAAY,CAAC,EAAE,CAAC;QACzB,CAAC;QAED,8EAA8E;QAC9E,IAAI,CAAC,eAAe;YAClB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAE3B,OAAO,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC;IACvE,CAAC;IAEe,WAAW;QACzB,KAAK,CAAC,WAAW,EAAE,CAAC;QACpB,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;CACF;AA5RD,gCA4RC","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 { assert, BentleyError, BeTimePoint, ByteStream } from \"@itwin/core-bentley\";\nimport { Range3d, Transform } from \"@itwin/core-geometry\";\nimport {\n ColorDef, computeChildTileProps, computeChildTileRanges, computeTileChordTolerance, ElementAlignedBox3d, LinePixels, TileFormat, TileProps,\n} from \"@itwin/core-common\";\nimport { IModelApp } from \"../../IModelApp\";\nimport { GraphicBuilder } from \"../../render/GraphicBuilder\";\nimport { RenderSystem } from \"../../render/RenderSystem\";\nimport {\n addRangeGraphic, IModelTileTree, Tile, TileBoundingBoxes, TileContent, TileDrawArgs, TileLoadStatus, TileParams, TileRequest,\n TileRequestChannel, TileTreeLoadStatus, TileVisibility,\n} from \"./../../tile/internal\";\n\n/** Parameters used to construct an [[IModelTile]].\n */\nexport interface IModelTileParams extends TileParams {\n sizeMultiplier?: number;\n}\n\nexport function iModelTileParamsFromJSON(props: TileProps, parent: IModelTile | undefined): IModelTileParams {\n const { contentId, maximumSize, isLeaf, sizeMultiplier } = props;\n const range = Range3d.fromJSON(props.range);\n\n let contentRange;\n if (undefined !== props.contentRange)\n contentRange = Range3d.fromJSON<ElementAlignedBox3d>(props.contentRange);\n\n return { contentId, range, maximumSize, isLeaf, parent, contentRange, sizeMultiplier };\n}\n\n/**\n * Indicates whether a parent tile should be drawn in place of a child tile.\n */\nexport enum SelectParent {\n No,\n Yes,\n}\n\nexport interface IModelTileContent extends TileContent {\n /** If this tile was produced by refinement, the multiplier applied to its screen size. */\n sizeMultiplier?: number;\n /** A bitfield describing empty sub-volumes of this tile's volume. */\n emptySubRangeMask?: number;\n}\n\n/** A tile belonging to an [[IModelTileTree].\n */\nexport class IModelTile extends Tile {\n private _sizeMultiplier?: number;\n private _emptySubRangeMask?: number;\n /** If an initial attempt to obtain this tile's content (e.g., from cloud storage cache) failed,\n * the next channel to try.\n */\n public requestChannel?: TileRequestChannel;\n\n public constructor(params: IModelTileParams, tree: IModelTileTree) {\n super(params, tree);\n this._sizeMultiplier = params.sizeMultiplier;\n\n if (!this.isLeaf && this.tree.is3d && !this.isReady) { // ###TODO: Want to know specifically if tree is *spatial*.\n // Do not sub-divide such that chord tolerance would be below specified minimum, if minimum defined.\n const minTolerance = IModelApp.tileAdmin.minimumSpatialTolerance;\n if (minTolerance > 0 && computeTileChordTolerance(this, this.tree.is3d, this.iModelTree.tileScreenSize) <= minTolerance)\n this.setLeaf();\n }\n }\n\n public get iModelTree(): IModelTileTree { return this.tree as IModelTileTree; }\n public get iModelChildren(): IModelTile[] | undefined { return this.children as IModelTile[] | undefined; }\n public get emptySubRangeMask(): number { return this._emptySubRangeMask ?? 0; }\n\n public get sizeMultiplier(): number | undefined { return this._sizeMultiplier; }\n public get hasSizeMultiplier() { return undefined !== this.sizeMultiplier; }\n public override get maximumSize(): number {\n return super.maximumSize * (this.sizeMultiplier ?? 1.0);\n }\n\n public get channel(): TileRequestChannel {\n return IModelApp.tileAdmin.channels.getIModelTileChannel(this);\n }\n\n public async requestContent(): Promise<TileRequest.Response> {\n return IModelApp.tileAdmin.generateTileContent(this);\n }\n\n public async readContent(data: TileRequest.ResponseData, system: RenderSystem, isCanceled?: () => boolean): Promise<IModelTileContent> {\n if (undefined === isCanceled)\n isCanceled = () => !this.isLoading;\n\n assert(data instanceof Uint8Array);\n const streamBuffer = ByteStream.fromUint8Array(data);\n\n const position = streamBuffer.curPos;\n const format = streamBuffer.readUint32();\n streamBuffer.curPos = position;\n\n let content: IModelTileContent = { isLeaf: true };\n assert(TileFormat.IModel === format);\n if (format !== TileFormat.IModel)\n return content;\n\n const sizeMultiplier = this.hasSizeMultiplier ? this.sizeMultiplier : undefined;\n\n const ecefTransform = this.tree.iModel.isGeoLocated ? this.tree.iModel.getEcefTransform() : Transform.createIdentity();\n try {\n content = await this.iModelTree.decoder.decode({\n stream: streamBuffer,\n options: { tileId: this.contentId },\n system,\n isCanceled,\n sizeMultiplier,\n tileData: {\n ecefTransform,\n range: this.range,\n layerClassifiers: this.tree.layerHandler?.layerClassifiers,\n },\n });\n } catch {\n //\n }\n\n return content;\n }\n\n public override setContent(content: IModelTileContent): void {\n super.setContent(content);\n\n this._emptySubRangeMask = content.emptySubRangeMask;\n\n // NB: If this tile has no graphics, it may or may not have children - but we don't want to load the children until\n // this tile is too coarse for view based on its size in pixels.\n // That is different than an \"undisplayable\" tile (maximumSize=0) whose children should be loaded immediately.\n if (undefined !== content.graphic && 0 === this.maximumSize)\n this._maximumSize = this.iModelTree.tileScreenSize;\n\n const sizeMult = content.sizeMultiplier;\n if (undefined !== sizeMult && (undefined === this._sizeMultiplier || sizeMult > this._sizeMultiplier)) {\n this._sizeMultiplier = sizeMult;\n this._contentId = this.iModelTree.contentIdProvider.idFromParentAndMultiplier(this.contentId, sizeMult);\n if (undefined !== this.children && this.children.length > 1)\n this.disposeChildren();\n }\n }\n\n protected _loadChildren(resolve: (children: Tile[]) => void, reject: (error: Error) => void): void {\n try {\n const tree = this.iModelTree;\n const kids = computeChildTileProps(this, tree.contentIdProvider, tree);\n IModelApp.tileAdmin.onTilesElided(kids.numEmpty);\n\n const children: IModelTile[] = [];\n for (const props of kids.children) {\n const child = new IModelTile(iModelTileParamsFromJSON(props, this), tree);\n children.push(child);\n }\n\n resolve(children);\n } catch (err) {\n reject(err instanceof Error ? err : new Error(BentleyError.getErrorMessage(err)));\n }\n }\n\n protected override get rangeGraphicColor(): ColorDef {\n return this.hasSizeMultiplier ? ColorDef.red : super.rangeGraphicColor;\n }\n\n protected override addRangeGraphic(builder: GraphicBuilder, type: TileBoundingBoxes): void {\n if (TileBoundingBoxes.ChildVolumes !== type) {\n super.addRangeGraphic(builder, type);\n return;\n }\n\n const ranges = computeChildTileRanges(this, this.iModelTree);\n for (const range of ranges) {\n const color = range.isEmpty ? ColorDef.blue : ColorDef.green;\n const pixels = !range.isEmpty ? LinePixels.HiddenLine : LinePixels.Solid;\n const width = !range.isEmpty ? 2 : 1;\n builder.setSymbology(color, color, width, pixels);\n addRangeGraphic(builder, range.range, this.tree.is2d);\n }\n }\n\n public pruneChildren(olderThan: BeTimePoint): void {\n // A tile's usage marker indicates its the most recent time its *children* were used.\n if (this.usageMarker.isExpired(olderThan)) {\n this.disposeChildren();\n return;\n }\n\n // this node has been used recently. Keep it, but potentially unload its grandchildren.\n const children = this.iModelChildren;\n if (undefined !== children)\n for (const child of children)\n child.pruneChildren(olderThan);\n }\n\n public selectTiles(selected: Tile[], args: TileDrawArgs, numSkipped: number): SelectParent {\n let vis = this.computeVisibility(args);\n if (TileVisibility.OutsideFrustum === vis)\n return SelectParent.No;\n\n const maxDepth = this.iModelTree.debugMaxDepth;\n if (undefined !== maxDepth && this.depth >= maxDepth)\n vis = TileVisibility.Visible;\n\n if (TileVisibility.Visible === vis) {\n // This tile is of appropriate resolution to draw. If need loading or refinement, enqueue.\n if (!this.isReady)\n args.insertMissing(this);\n\n if (this.hasGraphics) {\n // It can be drawn - select it\n args.markReady(this);\n selected.push(this);\n } else if (!this.isReady) {\n // It can't be drawn. Try to draw children in its place; otherwise draw the parent.\n // Do not load/request the children for this purpose.\n const initialSize = selected.length;\n const kids = this.iModelChildren;\n if (undefined === kids)\n return SelectParent.Yes;\n\n // Find any descendant to draw, until we exceed max initial tiles to skip.\n if (this.depth < this.iModelTree.maxInitialTilesToSkip) {\n for (const kid of kids) {\n if (SelectParent.Yes === kid.selectTiles(selected, args, numSkipped)) {\n selected.length = initialSize;\n return SelectParent.Yes;\n }\n\n return SelectParent.No;\n }\n }\n\n // If all visible direct children can be drawn, draw them.\n for (const kid of kids) {\n if (TileVisibility.OutsideFrustum !== kid.computeVisibility(args)) {\n if (!kid.hasGraphics) {\n selected.length = initialSize;\n return SelectParent.Yes;\n } else {\n selected.push(kid);\n }\n }\n }\n\n args.markUsed(this);\n }\n\n // We're drawing either this tile, or its direct children.\n return SelectParent.No;\n }\n\n // This tile is too coarse to draw. Try to draw something more appropriate.\n // If it is not ready to draw, we may want to skip loading in favor of loading its descendants.\n // If we previously loaded and later unloaded content for this tile to free memory, don't force it to reload its content - proceed to children.\n let canSkipThisTile = (this._hadGraphics && !this.hasGraphics) || this.depth < this.iModelTree.maxInitialTilesToSkip;\n if (canSkipThisTile) {\n numSkipped = 1;\n } else {\n canSkipThisTile = this.isReady || this.isParentDisplayable || this.depth < this.iModelTree.maxInitialTilesToSkip;\n if (canSkipThisTile && this.isDisplayable) { // skipping an undisplayable tile doesn't count toward the maximum\n // Some tiles do not sub-divide - they only facet the same geometry to a higher resolution. We can skip directly to the correct resolution.\n const isNotReady = !this.isReady && !this.hasGraphics && !this.hasSizeMultiplier;\n if (isNotReady) {\n if (numSkipped >= this.iModelTree.maxTilesToSkip)\n canSkipThisTile = false;\n else\n numSkipped += 1;\n }\n }\n }\n\n const childrenLoadStatus = this.loadChildren(); // NB: asynchronous\n const children = canSkipThisTile ? this.iModelChildren : undefined;\n if (canSkipThisTile && TileTreeLoadStatus.Loading === childrenLoadStatus) {\n args.markChildrenLoading();\n args.markUsed(this);\n }\n\n if (undefined !== children) {\n // If we are the root tile and we are not displayable, then we want to draw *any* currently available children in our place, or else we would draw nothing.\n // Otherwise, if we want to draw children in our place, we should wait for *all* of them to load, or else we would show missing chunks where not-yet-loaded children belong.\n const isUndisplayableRootTile = this.isUndisplayableRootTile;\n args.markUsed(this);\n let drawChildren = true;\n const initialSize = selected.length;\n for (const child of children) {\n // NB: We must continue iterating children so that they can be requested if missing.\n if (SelectParent.Yes === child.selectTiles(selected, args, numSkipped)) {\n if (child.loadStatus === TileLoadStatus.NotFound) {\n // At least one child we want to draw failed to load. e.g., we reached max depth of map tile tree. Draw parent instead.\n drawChildren = canSkipThisTile = false;\n } else {\n // At least one child we want to draw is not yet loaded. Wait for it to load before drawing it and its siblings, unless we have nothing to draw in their place.\n drawChildren = isUndisplayableRootTile;\n }\n }\n }\n\n if (drawChildren)\n return SelectParent.No;\n\n // Some types of tiles (like maps) allow the ready children to be drawn on top of the parent while other children are not yet loaded.\n if (args.parentsAndChildrenExclusive)\n selected.length = initialSize;\n }\n\n if (this.isReady) {\n if (this.hasGraphics) {\n selected.push(this);\n if (!canSkipThisTile) {\n // This tile is too coarse, but we require loading it before we can start loading higher-res children.\n args.markReady(this);\n }\n }\n\n return SelectParent.No;\n }\n\n // This tile is not ready to be drawn. Request it *only* if we cannot skip it.\n if (!canSkipThisTile)\n args.insertMissing(this);\n\n return this.isParentDisplayable ? SelectParent.Yes : SelectParent.No;\n }\n\n public override clearLayers(): void {\n super.clearLayers();\n this.disposeChildren();\n }\n}\n"]}
@@ -65,6 +65,8 @@ export declare class SheetViewState extends ViewState2d {
65
65
  /** See [[ViewState.detachFromViewport]]. */
66
66
  detachFromViewport(): void;
67
67
  get areAllTileTreesLoaded(): boolean;
68
+ /** @internal Strictly for testing */
69
+ areAllAttachmentsLoaded(): boolean;
68
70
  /** Create a sheet border decoration graphic. */
69
71
  private createBorder;
70
72
  /** @internal */
@@ -1 +1 @@
1
- {"version":3,"file":"SheetViewState.d.ts","sourceRoot":"","sources":["../../src/SheetViewState.ts"],"names":[],"m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AgB;cACS,QAAQ,CAAC,eAAe,EAAE,6BAA6B,GAAG,OAAO,CAAC,IAAI,CAAC;IAOhG,gBAAgB;IACA,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI;IAMxD,gBAAgB;IAChB,IAAoB,kBAAkB,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAgB3D;IAED,gBAAgB;YACF,kBAAkB;IASV,iBAAiB,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ3E,0CAA0C;IAC1B,gBAAgB,CAAC,IAAI,EAAE,oBAAoB,GAAG,IAAI;IAMlE,4CAA4C;IAC5B,kBAAkB,IAAI,IAAI;IAK1C,IAAoB,qBAAqB,IAAI,OAAO,CAQnD;IAED,qCAAqC;IAC9B,uBAAuB,IAAI,OAAO;IAOzC,gDAAgD;IAChD,OAAO,CAAC,YAAY;IAOpB,gBAAgB;IACA,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IAQxC,eAAe,IAAI,OAAO;IAO1C,gBAAgB;IACA,qBAAqB,CAAC,IAAI,EAAE,yBAAyB,GAAG,QAAQ,GAAG,SAAS;IAS5F,YAAY;IACI,uBAAuB,CAAC,IAAI,EAAE,2BAA2B,GAAG,SAAS,GAAG,SAAS;CAgBlG"}
@@ -249,8 +249,18 @@ class ViewAttachments {
249
249
  get isEmpty() {
250
250
  return 0 === this._attachments.length;
251
251
  }
252
- get areAllTileTreesLoaded() {
253
- return this._attachments.every((x) => x.areAllTileTreesLoaded);
252
+ areAllTileTreesLoaded(displayedExtents) {
253
+ return this._attachments.every((x) => {
254
+ const placement = Placement2d.fromJSON(x.viewAttachmentProps.placement);
255
+ const attachmentRange = placement.calculateRange();
256
+ if (!attachmentRange.intersectsRangeXY(displayedExtents))
257
+ return true;
258
+ return x.areAllTileTreesLoaded;
259
+ });
260
+ }
261
+ /** Strictly for testing purposes */
262
+ areAllAttachmentsLoaded() {
263
+ return this._attachments.every((attachment) => attachment.areAllTileTreesLoaded);
254
264
  }
255
265
  discloseTileTrees(trees) {
256
266
  for (const attachment of this._attachments)
@@ -429,7 +439,19 @@ export class SheetViewState extends ViewState2d {
429
439
  this._attachments = dispose(this._attachments);
430
440
  }
431
441
  get areAllTileTreesLoaded() {
432
- return super.areAllTileTreesLoaded && (!this._attachments || this._attachments.areAllTileTreesLoaded);
442
+ let displayedExtents = this._viewedExtents;
443
+ const frustum = this.calculateFrustum();
444
+ if (frustum) {
445
+ displayedExtents = frustum.toRange();
446
+ }
447
+ return super.areAllTileTreesLoaded && (!this._attachments || this._attachments.areAllTileTreesLoaded(displayedExtents));
448
+ }
449
+ /** @internal Strictly for testing */
450
+ areAllAttachmentsLoaded() {
451
+ if (this._attachments) {
452
+ return this._attachments.areAllAttachmentsLoaded();
453
+ }
454
+ return true;
433
455
  }
434
456
  /** Create a sheet border decoration graphic. */
435
457
  createBorder(width, height, context) {
@@ -1 +1 @@
1
- {"version":3,"file":"SheetViewState.js","sourceRoot":"","sources":["../../src/SheetViewState.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAyB,MAAM,qBAAqB,CAAC;AAChG,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACvK,OAAO,EACa,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAA2E,kBAAkB,EAAE,WAAW,EAC7L,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAI1D,OAAO,EAAE,aAAa,EA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AAO;gBACpB,UAAU,GAAG,SAAS,CAAC,YAAY,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;QACrE,CAAC;QAED,OAAO,SAAS,CAAC,YAAY,CAAC,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;IAC7F,CAAC;IAEM,iBAAiB,CAAC,KAA8B;QACrD,IAAI,IAAI,CAAC,SAAS;YAChB,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC5C,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 Views\n */\n\nimport { assert, CompressedId64Set, dispose, Id64Array, Id64String } from \"@itwin/core-bentley\";\nimport { Angle, ClipShape, ClipVector, Constant, Matrix3d, Point2d, Point3d, PolyfaceBuilder, Range2d, Range3d, StrokeOptions, Transform } from \"@itwin/core-geometry\";\nimport {\n AxisAlignedBox3d, ColorDef, Feature, FeatureTable, Frustum, Gradient, GraphicParams, HiddenLine, HydrateViewStateRequestProps, HydrateViewStateResponseProps, PackedFeatureTable, Placement2d, SheetProps,\n TextureTransparency, ViewAttachmentProps, ViewDefinition2dProps, ViewFlagOverrides, ViewStateProps,\n} from \"@itwin/core-common\";\nimport { CategorySelectorState } from \"./CategorySelectorState\";\nimport { DisplayStyle2dState } from \"./DisplayStyleState\";\nimport { IModelConnection } from \"./IModelConnection\";\nimport { GraphicBuilder } from \"./render/GraphicBuilder\";\nimport { RenderGraphic } from \"./render/RenderGraphic\";\nimport { GraphicBranch } from \"./render/GraphicBranch\";\nimport { Frustum2d } from \"./Frustum2d\";\nimport { Scene } from \"./render/Scene\";\nimport { Decorations } from \"./render/Decorations\";\nimport { MockRender } from \"./internal/render/MockRender\";\nimport { RenderClipVolume } from \"./render/RenderClipVolume\";\nimport { RenderMemory } from \"./render/RenderMemory\";\nimport { FeatureSymbology } from \"./render/FeatureSymbology\";\nimport { DecorateContext, SceneContext } from \"./ViewContext\";\nimport { IModelApp } from \"./IModelApp\";\nimport { CoordSystem } from \"./CoordSystem\";\nimport { OffScreenViewport, Viewport } from \"./Viewport\";\nimport { AttachToViewportArgs, ComputeDisplayTransformArgs, GetAttachmentViewportArgs, ViewState, ViewState2d } from \"./ViewState\";\nimport { DrawingViewState } from \"./DrawingViewState\";\nimport { createDefaultViewFlagOverrides, DisclosedTileTreeSet, TileGraphicType } from \"./tile/internal\";\nimport { imageBufferToPngDataUrl, openImageDataUrlInNewWindow } from \"./common/ImageUtil\";\nimport { ViewRect } from \"./common/ViewRect\";\nimport { GraphicType } from \"./common/render/GraphicType\";\n\n// cSpell:ignore ovrs\n\n/** Describes the geometry and styling of a sheet border decoration.\n * The sheet border decoration mimics a sheet of paper with a drop shadow.\n */\nclass SheetBorder {\n private _rect: Point2d[];\n private _shadow: Point2d[];\n private _gradient: Gradient.Symb;\n\n private constructor(rect: Point2d[], shadow: Point2d[], gradient: Gradient.Symb) {\n this._rect = rect;\n this._shadow = shadow;\n this._gradient = gradient;\n }\n\n /** Create a new sheet border. If a context is supplied, points are transformed to view coordinates. */\n public static create(width: number, height: number, context?: DecorateContext) {\n // Rect\n const rect: Point3d[] = [\n Point3d.create(0, height),\n Point3d.create(0, 0),\n Point3d.create(width, 0),\n Point3d.create(width, height),\n Point3d.create(0, height)];\n if (context) {\n context.viewport.worldToViewArray(rect);\n }\n\n // Shadow\n const shadowWidth = .01 * Math.sqrt(width * width + height * height);\n const shadow: Point3d[] = [\n Point3d.create(shadowWidth, 0),\n Point3d.create(shadowWidth, -shadowWidth),\n Point3d.create(width + shadowWidth, -shadowWidth),\n Point3d.create(width + shadowWidth, height - shadowWidth),\n Point3d.create(width, height - shadowWidth),\n Point3d.create(width, 0),\n Point3d.create(shadowWidth, 0),\n ];\n if (context) {\n context.viewport.worldToViewArray(shadow);\n }\n\n // Gradient\n const gradient = new Gradient.Symb();\n gradient.mode = Gradient.Mode.Linear;\n gradient.angle = Angle.createDegrees(-45);\n gradient.keys = [{ value: 0, color: ColorDef.from(25, 25, 25) }, { value: 0.5, color: ColorDef.from(150, 150, 150) }];\n\n // Copy over points\n const rect2d: Point2d[] = [];\n for (const point of rect)\n rect2d.push(Point2d.createFrom(point));\n const shadow2d: Point2d[] = [];\n for (const point of shadow)\n shadow2d.push(Point2d.createFrom(point));\n\n return new SheetBorder(rect2d, shadow2d, gradient);\n }\n\n public getRange(): Range2d {\n const range = Range2d.createArray(this._rect);\n const shadowRange = Range2d.createArray(this._shadow);\n range.extendRange(shadowRange);\n return range;\n }\n\n /** Add this border to the given GraphicBuilder. */\n public addToBuilder(builder: GraphicBuilder) {\n const lineColor = ColorDef.black;\n const fillColor = ColorDef.black;\n\n const params = new GraphicParams();\n params.fillColor = fillColor;\n params.gradient = this._gradient;\n\n builder.activateGraphicParams(params);\n builder.addShape2d(this._shadow, Frustum2d.minimumZDistance);\n\n builder.setSymbology(lineColor, fillColor, 2);\n builder.addLineString2d(this._rect, 0);\n }\n}\n\n/** The information required to instantiate an Attachment object. See ViewAttachmentsInfo */\ninterface ViewAttachmentInfo extends ViewAttachmentProps {\n attachedView: ViewState;\n}\n\n/** The information required to instantiate an ViewAttachments object to draw ViewAttachments into a sheet. The list of view attachment Ids is\n * supplied to SheetViewState via the constructor. The corresponding ViewAttachmentProps for each attachment are obtained asynchronously in\n * SheetViewState.load(). The Attachments object is created in SheetViewState.attachToViewport and disposed of in SheetViewState.detachFromViewport.\n */\nclass ViewAttachmentsInfo {\n private _attachments: Id64Array | ViewAttachmentInfo[];\n\n public get attachments() { return this._attachments; }\n\n private constructor(attachments: Id64Array | ViewAttachmentInfo[]) {\n this._attachments = attachments;\n }\n\n public get isLoaded(): boolean {\n return 0 === this._attachments.length || \"string\" !== typeof this._attachments[0];\n }\n\n public get viewAttachmentProps(): Array<Readonly<ViewAttachmentProps>> {\n return this.isLoaded ? this._props : [];\n }\n\n private get _props(): ViewAttachmentInfo[] {\n assert(this.isLoaded);\n return this._attachments as ViewAttachmentInfo[];\n }\n\n private get _ids(): Id64Array {\n assert(!this.isLoaded);\n return this._attachments as Id64Array;\n }\n\n public static fromJSON(ids: Id64Array = []): ViewAttachmentsInfo {\n return new ViewAttachmentsInfo(ids);\n }\n\n public toJSON(): Id64Array {\n return this.isLoaded ? this._props.map((x) => x.id!) : [...this._ids];\n }\n\n public clone(iModel: IModelConnection): ViewAttachmentsInfo {\n let attachments = this._attachments;\n if (this.isLoaded) {\n // Need to clone the attached ViewStates.\n attachments = attachments.map((attachment) => {\n assert(typeof attachment !== \"string\");\n return {\n ...attachment,\n attachedView: attachment.attachedView.clone(iModel),\n };\n });\n }\n\n return new ViewAttachmentsInfo(attachments);\n }\n\n public preload(options: HydrateViewStateRequestProps) {\n if (this.isLoaded)\n return;\n options.sheetViewAttachmentIds = CompressedId64Set.sortAndCompress(this._ids);\n options.viewStateLoadProps = {\n displayStyle: {\n omitScheduleScriptElementIds: !IModelApp.tileAdmin.enableFrontendScheduleScripts,\n compressExcludedElementIds: true,\n },\n };\n }\n\n public async postload(options: HydrateViewStateResponseProps, iModel: IModelConnection) {\n if (options.sheetViewViews === undefined)\n return;\n if (options.sheetViewAttachmentProps === undefined)\n return;\n\n const viewStateProps = options.sheetViewViews; // This is viewstateProps, need to turn this into ViewState\n const promises = [];\n for (const viewProps of viewStateProps) {\n const loadView = async () => {\n try {\n if (viewProps === undefined)\n return undefined;\n const view = await iModel.views.convertViewStatePropsToViewState(viewProps);\n return view;\n } catch {\n return undefined;\n }\n };\n promises.push(loadView());\n }\n const views = await Promise.all(promises);\n\n const attachmentProps = options.sheetViewAttachmentProps as ViewAttachmentInfo[];\n assert(views.length === attachmentProps.length);\n const attachments = [];\n for (let i = 0; i < views.length; i++) {\n const view = views[i];\n if (view && !(view instanceof SheetViewState)) {\n const props = attachmentProps[i];\n props.attachedView = view;\n attachments.push(props);\n }\n }\n\n this._attachments = attachments;\n }\n\n public async load(iModel: IModelConnection): Promise<void> {\n if (this.isLoaded)\n return;\n\n const attachmentProps = await iModel.elements.getProps(this._ids) as ViewAttachmentInfo[];\n const promises = [];\n for (const attachment of attachmentProps) {\n const loadView = async () => {\n try {\n const view = await iModel.views.load(attachment.view.id);\n return view;\n } catch {\n return undefined;\n }\n };\n\n promises.push(loadView());\n }\n\n const views = await Promise.all(promises);\n assert(views.length === attachmentProps.length);\n\n const attachments = [];\n for (let i = 0; i < views.length; i++) {\n const view = views[i];\n if (view && !(view instanceof SheetViewState)) {\n const props = attachmentProps[i];\n props.attachedView = view;\n attachments.push(props);\n }\n }\n\n this._attachments = attachments;\n }\n\n public createAttachments(sheetView: SheetViewState): ViewAttachments | undefined {\n return this.isLoaded ? new ViewAttachments(this._props, sheetView) : undefined;\n }\n}\n\n/** The set of view attachments to be displayed in a Viewport via a SheetViewState. Allocated when the view becomes attached to a Viewport;\n * disposed of when it becomes detached from the viewport.\n */\nclass ViewAttachments {\n private readonly _attachments: Attachment[] = [];\n public maxDepth = Frustum2d.minimumZDistance;\n\n public constructor(infos: ViewAttachmentInfo[], sheetView: SheetViewState) {\n for (const info of infos) {\n const drawAsRaster = info.jsonProperties?.displayOptions?.drawAsRaster || (info.attachedView.is3d() && info.attachedView.isCameraOn);\n const ctor = drawAsRaster ? RasterAttachment : OrthographicAttachment;\n const attachment = new ctor(info.attachedView, info, sheetView);\n this._attachments.push(attachment);\n this.maxDepth = Math.max(this.maxDepth, attachment.zDepth);\n }\n }\n\n public [Symbol.dispose](): void {\n for (const attachment of this._attachments)\n attachment[Symbol.dispose]();\n\n this._attachments.length = 0;\n }\n\n public [Symbol.iterator](): Iterator<Attachment> {\n return this._attachments[Symbol.iterator]();\n }\n\n /** For tests. */\n public get attachments(): object[] {\n return this._attachments;\n }\n\n public get isEmpty(): boolean {\n return 0 === this._attachments.length;\n }\n\n public get areAllTileTreesLoaded(): boolean {\n return this._attachments.every((x) => x.areAllTileTreesLoaded);\n }\n\n public discloseTileTrees(trees: DisclosedTileTreeSet): void {\n for (const attachment of this._attachments)\n trees.disclose(attachment);\n }\n\n public collectStatistics(stats: RenderMemory.Statistics): void {\n for (const attachment of this._attachments)\n attachment.collectStatistics(stats);\n }\n\n public addToScene(context: SceneContext): void {\n for (const attachment of this._attachments)\n attachment.addToScene(context);\n }\n\n public findById(attachmentId: Id64String): Attachment | undefined {\n return this._attachments.find((attachment: Attachment) => attachment.viewAttachmentProps.id === attachmentId);\n }\n}\n\n/** A view of a [SheetModel]($backend).\n * @public\n * @extensions\n */\nexport class SheetViewState extends ViewState2d {\n /** The width and height of the sheet in world coordinates. */\n public readonly sheetSize: Point2d;\n private _attachmentsInfo: ViewAttachmentsInfo;\n private _attachments?: ViewAttachments;\n private readonly _viewedExtents: AxisAlignedBox3d;\n\n public get attachmentIds(): Id64Array {\n return this._attachmentsInfo.toJSON();\n }\n\n public static override get className() { return \"SheetViewDefinition\"; }\n\n public static override createFromProps(viewStateData: ViewStateProps, iModel: IModelConnection): SheetViewState {\n const cat = new CategorySelectorState(viewStateData.categorySelectorProps, iModel);\n const displayStyleState = new DisplayStyle2dState(viewStateData.displayStyleProps, iModel);\n\n // use \"new this\" so subclasses are correct\n return new this(viewStateData.viewDefinitionProps as ViewDefinition2dProps, iModel, cat, displayStyleState, viewStateData.sheetProps!, viewStateData.sheetAttachments!);\n }\n\n public override toProps(): ViewStateProps {\n const props = super.toProps();\n\n props.sheetAttachments = this._attachmentsInfo.toJSON();\n\n // For sheetProps all that is actually used is the size, so just null out everything else.\n const codeProps = { spec: \"\", scope: \"\", value: \"\" };\n props.sheetProps = {\n model: \"\",\n code: codeProps,\n classFullName: \"\",\n width: this.sheetSize.x,\n height: this.sheetSize.y,\n scale: 1,\n };\n\n return props;\n }\n\n /** Strictly for testing. @internal */\n public get viewAttachmentProps(): Array<Readonly<ViewAttachmentProps>> {\n return this._attachmentsInfo.viewAttachmentProps.map((x) => {\n return {\n ...x,\n attachedView: undefined,\n };\n });\n }\n\n /** Strictly for testing. @internal */\n public get viewAttachmentInfos(): Id64Array | Array<{ attachedView: ViewState }> {\n return this._attachmentsInfo.attachments;\n }\n\n /** Strictly for testing. @internal */\n public get attachments(): object[] | undefined {\n return this._attachments?.attachments;\n }\n\n public override isDrawingView(): this is DrawingViewState { return false; }\n public override isSheetView(): this is SheetViewState { return true; }\n\n public constructor(props: ViewDefinition2dProps, iModel: IModelConnection, categories: CategorySelectorState, displayStyle: DisplayStyle2dState, sheetProps: SheetProps, attachments: Id64Array) {\n super(props, iModel, categories, displayStyle);\n if (categories instanceof SheetViewState) {\n // we are coming from clone...\n this.sheetSize = categories.sheetSize.clone();\n this._attachmentsInfo = categories._attachmentsInfo.clone(iModel);\n this._viewedExtents = categories._viewedExtents.clone();\n } else {\n this.sheetSize = Point2d.create(sheetProps.width, sheetProps.height);\n this._attachmentsInfo = ViewAttachmentsInfo.fromJSON(attachments);\n\n const extents = new Range3d(0, 0, 0, this.sheetSize.x, this.sheetSize.y, 0);\n const margin = 1.1;\n extents.scaleAboutCenterInPlace(margin);\n this._viewedExtents = extents;\n }\n }\n\n public override getOrigin() {\n const origin = super.getOrigin();\n if (this._attachments)\n origin.z = -this._attachments.maxDepth;\n\n return origin;\n }\n\n public override getExtents() {\n const extents = super.getExtents();\n if (this._attachments)\n extents.z = this._attachments.maxDepth + Frustum2d.minimumZDistance;\n\n return extents;\n }\n\n /** Overrides [[ViewState.discloseTileTrees]] to include tile trees associated with [ViewAttachment]($backend)s displayed on this sheet. */\n public override discloseTileTrees(trees: DisclosedTileTreeSet): void {\n super.discloseTileTrees(trees);\n if (this._attachments)\n trees.disclose(this._attachments);\n }\n\n /** @internal */\n public override collectNonTileTreeStatistics(stats: RenderMemory.Statistics): void {\n super.collectNonTileTreeStatistics(stats);\n if (this._attachments)\n this._attachments.collectStatistics(stats);\n }\n\n public override get defaultExtentLimits() {\n return { min: Constant.oneMillimeter, max: this.sheetSize.magnitude() * 10 };\n }\n\n public override getViewedExtents(): AxisAlignedBox3d {\n return this._viewedExtents;\n }\n\n /** @internal */\n protected override preload(hydrateRequest: HydrateViewStateRequestProps): void {\n super.preload(hydrateRequest);\n this._attachmentsInfo.preload(hydrateRequest);\n }\n\n /** @internal */\n protected override async postload(hydrateResponse: HydrateViewStateResponseProps): Promise<void> {\n const promises = [];\n promises.push(super.postload(hydrateResponse));\n promises.push(this._attachmentsInfo.postload(hydrateResponse, this.iModel));\n await Promise.all(promises);\n }\n\n /** @internal */\n public override createScene(context: SceneContext): void {\n super.createScene(context);\n if (this._attachments)\n this._attachments.addToScene(context);\n }\n\n /** @internal */\n public override get secondaryViewports(): Iterable<Viewport> {\n const attachments = this._attachments;\n if (!attachments)\n return super.secondaryViewports;\n\n function* iterator() {\n for (const attachment of attachments!) {\n const vp = attachment.viewport;\n if (vp)\n yield vp;\n }\n }\n\n return {\n [Symbol.iterator]: () => iterator(),\n };\n }\n\n /** @internal */\n private async queryAttachmentIds(): Promise<Id64Array> {\n const ecsql = `SELECT ECInstanceId as attachmentId FROM bis.ViewAttachment WHERE model.Id=${this.baseModelId}`;\n const ids: string[] = [];\n for await (const row of this.iModel.createQueryReader(ecsql))\n ids.push(row[0]);\n\n return ids;\n }\n\n public override async changeViewedModel(modelId: Id64String): Promise<void> {\n await super.changeViewedModel(modelId);\n const attachmentIds = await this.queryAttachmentIds();\n this._attachmentsInfo = ViewAttachmentsInfo.fromJSON(attachmentIds);\n\n assert(undefined === this._attachments);\n }\n\n /** See [[ViewState.attachToViewport]]. */\n public override attachToViewport(args: AttachToViewportArgs): void {\n super.attachToViewport(args);\n assert(undefined === this._attachments);\n this._attachments = this._attachmentsInfo.createAttachments(this);\n }\n\n /** See [[ViewState.detachFromViewport]]. */\n public override detachFromViewport(): void {\n super.detachFromViewport();\n this._attachments = dispose(this._attachments);\n }\n\n public override get areAllTileTreesLoaded(): boolean {\n return super.areAllTileTreesLoaded && (!this._attachments || this._attachments.areAllTileTreesLoaded);\n }\n\n /** Create a sheet border decoration graphic. */\n private createBorder(width: number, height: number, context: DecorateContext): RenderGraphic {\n const border = SheetBorder.create(width, height, context);\n const builder = context.createGraphicBuilder(GraphicType.ViewBackground);\n border.addToBuilder(builder);\n return builder.finish();\n }\n\n /** @internal */\n public override decorate(context: DecorateContext): void {\n super.decorate(context);\n if (this.sheetSize !== undefined) {\n const border = this.createBorder(this.sheetSize.x, this.sheetSize.y, context);\n context.setViewBackground(border);\n }\n }\n\n public override computeFitRange(): Range3d {\n const size = this.sheetSize;\n if (0 >= size.x || 0 >= size.y)\n return super.computeFitRange();\n return new Range3d(0, 0, -1, size.x, size.y, 1);\n }\n\n /** @internal */\n public override getAttachmentViewport(args: GetAttachmentViewportArgs): Viewport | undefined {\n const attachment = args.viewAttachmentId ? this._attachments?.findById(args.viewAttachmentId) : undefined;\n if (!attachment) {\n return undefined;\n }\n\n return args.inSectionDrawingAttachment ? attachment.viewport?.view.getAttachmentViewport({ inSectionDrawingAttachment: true }) : attachment.viewport;\n }\n\n /** @beta */\n public override computeDisplayTransform(args: ComputeDisplayTransformArgs): Transform | undefined {\n // ###TODO we're currently ignoring model and element Id in args, assuming irrelevant for sheets.\n // Should probably call super or have super call us.\n const attachment = undefined !== args.viewAttachmentId ? this._attachments?.findById(args.viewAttachmentId) : undefined;\n if (!attachment || !(attachment instanceof OrthographicAttachment)) {\n return undefined;\n }\n\n const sheetTransform = attachment.toSheet;\n const sectionTransform = args.inSectionDrawingAttachment ? attachment.view.computeDisplayTransform(args) : undefined;\n if (!sectionTransform) {\n return sheetTransform.clone(args.output);\n }\n\n return sheetTransform.multiplyTransformTransform(sectionTransform, args.output);\n }\n}\n\n/** A mostly no-op RenderTarget for an Attachment.\n * its Scene and symbology overrides.\n */\nclass AttachmentTarget extends MockRender.OffScreenTarget {\n private readonly _attachment: OrthographicAttachment;\n\n public constructor(attachment: OrthographicAttachment) {\n // The dimensions don't matter - we're not drawing anything.\n const rect = new ViewRect(1, 1);\n super(IModelApp.renderSystem, rect);\n this._attachment = attachment;\n }\n\n public override changeScene(scene: Scene): void {\n this._attachment.scene = scene;\n }\n\n public override overrideFeatureSymbology(ovrs: FeatureSymbology.Overrides): void {\n this._attachment.symbologyOverrides = ovrs;\n }\n}\n\n/** Draws the contents of a view attachment into a sheet view. */\ninterface Attachment extends Disposable {\n readonly areAllTileTreesLoaded: boolean;\n addToScene: (context: SceneContext) => void;\n discloseTileTrees: (trees: DisclosedTileTreeSet) => void;\n readonly zDepth: number;\n collectStatistics: (stats: RenderMemory.Statistics) => void;\n viewAttachmentProps: ViewAttachmentProps;\n readonly viewport?: Viewport;\n}\n\n/** Draws the contents a 2d or orthographic 3d view directly into a sheet view.\n * We select tiles for the view in the context of a light-weight offscreen viewport with a no-op RenderTarget, then\n * collect the resultant graphics and add them to the sheet view's scene.\n */\nclass OrthographicAttachment {\n private readonly _viewport: OffScreenViewport;\n private readonly _props: ViewAttachmentProps;\n private readonly _sheetModelId: Id64String;\n private readonly _viewFlagOverrides: ViewFlagOverrides;\n private readonly _toSheet: Transform;\n private readonly _fromSheet: Transform;\n private readonly _sizeInMeters: Point2d;\n private readonly _range: Range3d;\n private readonly _viewRect = new ViewRect(0, 0, 1, 1);\n private readonly _originalFrustum = new Frustum();\n private readonly _clipVolume?: RenderClipVolume;\n private readonly _hiddenLineSettings?: HiddenLine.Settings;\n private readonly _scale: { x: number, y: number };\n private _debugFeatureTable?: PackedFeatureTable;\n public scene?: Scene;\n public symbologyOverrides: FeatureSymbology.Overrides;\n public readonly zDepth: number;\n\n public get view(): ViewState {\n return this._viewport.view;\n }\n\n public get viewAttachmentProps() {\n return this._props;\n }\n\n public get viewport(): Viewport {\n return this._viewport;\n }\n\n public constructor(view: ViewState, props: ViewAttachmentProps, sheetView: SheetViewState) {\n this.symbologyOverrides = new FeatureSymbology.Overrides(view);\n const target = new AttachmentTarget(this);\n this._viewport = OffScreenViewport.createViewport(view, target, true);\n\n this._props = props;\n this._sheetModelId = sheetView.baseModelId;\n\n const applyClip = true; // set to false for debugging\n this._viewFlagOverrides = {\n ...view.viewFlags,\n clipVolume: applyClip,\n lighting: false,\n shadows: false,\n };\n\n const placement = Placement2d.fromJSON(props.placement);\n const range = placement.calculateRange();\n this._range = range;\n this._sizeInMeters = new Point2d(range.xLength(), range.yLength());\n\n // Compute transform from attached view's world coordinates to sheet's world coordinates.\n // NB: We obtain the extents and origin from the *viewport* not the *view* - they may have been adjusted by the viewport.\n const applySkew = true; // set to false for debugging\n const skew = applySkew ? view.getAspectRatioSkew() : 1;\n const extents = this._viewport.viewingSpace.viewDelta.clone();\n const zDepth = Math.abs(extents.z);\n const scaleX = this._sizeInMeters.x / Math.abs(extents.x);\n const scaleY = skew * this._sizeInMeters.y / Math.abs(extents.y);\n this._scale = { x: 1 / scaleX, y: 1 / scaleY };\n\n const zBias = Frustum2d.depthFromDisplayPriority(props.jsonProperties?.displayPriority ?? 0);\n this.zDepth = 1.01 * (zDepth - zBias); // give a little padding so that geometry right up against far plane doesn't get clipped.\n\n // View origin is at the *back* of the view. Align *front* of view based on display priority.\n const viewRot = view.getRotation();\n const viewOrg = viewRot.multiplyVector(this._viewport.viewingSpace.viewOrigin);\n viewOrg.z += zDepth;\n viewRot.multiplyTransposeVectorInPlace(viewOrg);\n\n const matrix = Matrix3d.createScale(scaleX, scaleY, 1);\n matrix.multiplyMatrixMatrix(viewRot, matrix);\n const origin = Matrix3d.xyzMinusMatrixTimesXYZ(viewOrg, matrix, viewOrg);\n const attachmentOrigin = Point3d.createFrom(placement.origin);\n attachmentOrigin.z = zBias;\n const viewOrgToAttachment = attachmentOrigin.minus(viewOrg);\n origin.addInPlace(viewOrgToAttachment);\n this._toSheet = Transform.createRefs(origin, matrix);\n this._fromSheet = this._toSheet.inverse()!;\n\n // If the attached view is a section drawing, it may itself have an attached spatial view with a clip.\n // The clip needs to be transformed into sheet space.\n if (view.isDrawingView())\n this._viewport.drawingToSheetTransform = this._toSheet;\n\n // ###TODO? If we also apply the attachment's clip to the attached view, we may get additional culling during tile selection.\n // However the attached view's frustum is already clipped by intersection with sheet view's frustum, and additional clipping planes\n // introduce additional computation, so possibly not worth it.\n\n // Transform the view's clip (if any) to sheet space\n let viewClip = view.viewFlags.clipVolume ? view.getViewClip()?.clone() : undefined;\n if (viewClip)\n viewClip.transformInPlace(this._toSheet);\n else\n viewClip = ClipVector.createEmpty();\n\n let sheetClip;\n if (undefined !== props.jsonProperties?.clip)\n sheetClip = ClipVector.fromJSON(props.jsonProperties?.clip);\n\n if (sheetClip && sheetClip.isValid) {\n // Clip to view attachment's clip. NB: clip is in sheet coordinate space.\n for (const clip of sheetClip.clips)\n viewClip.clips.push(clip);\n } else {\n // Clip to view attachment's bounding box\n viewClip.appendShape([\n Point3d.create(this._range.low.x, this._range.low.y),\n Point3d.create(this._range.high.x, this._range.low.y),\n Point3d.create(this._range.high.x, this._range.high.y),\n Point3d.create(this._range.low.x, this._range.high.y),\n ]);\n }\n\n this._clipVolume = IModelApp.renderSystem.createClipVolume(viewClip);\n\n // Save off the original frustum (potentially adjusted by viewport).\n this._viewport.setupFromView();\n this._viewport.viewingSpace.getFrustum(CoordSystem.World, true, this._originalFrustum);\n\n const applyHiddenLineSettings = true; // for debugging edge display, set to false...\n const style = view.displayStyle;\n if (style.is3d() && applyHiddenLineSettings)\n this._hiddenLineSettings = style.settings.hiddenLineSettings;\n }\n\n public [Symbol.dispose](): void {\n this._viewport[Symbol.dispose]();\n }\n\n public discloseTileTrees(trees: DisclosedTileTreeSet): void {\n trees.disclose(this._viewport);\n }\n\n public addToScene(context: SceneContext): void {\n if (context.viewport.freezeScene)\n return;\n\n if (!context.viewport.view.viewsCategory(this._props.category))\n return;\n\n const wantBounds = context.viewport.wantViewAttachmentBoundaries;\n const wantClipShapes = context.viewport.wantViewAttachmentClipShapes;\n if (wantBounds || wantClipShapes) {\n const builder = context.createSceneGraphicBuilder();\n if (wantBounds) {\n builder.setSymbology(ColorDef.red, ColorDef.red, 2);\n builder.addRangeBox(this._range);\n }\n\n if (wantClipShapes && this._clipVolume) {\n builder.setSymbology(ColorDef.blue, ColorDef.blue, 2);\n for (const prim of this._clipVolume.clipVector.clips) {\n if (!(prim instanceof ClipShape))\n continue; // ###TODO handle non-shape primitives, if any such ever encountered\n\n const pts = [];\n const tf = prim.transformFromClip;\n for (const pt of prim.polygon) {\n const tfPt = tf ? tf.multiplyPoint3d(pt) : pt;\n pts.push(new Point2d(tfPt.x, tfPt.y));\n }\n\n builder.addLineString2d(pts, 0);\n }\n }\n\n // Put into a Batch so that we can see tooltip with attachment Id on mouseover.\n const batch = context.target.renderSystem.createBatch(builder.finish(), this.getDebugFeatureTable(), this._range);\n context.outputGraphic(batch);\n }\n\n if (!context.viewport.wantViewAttachments)\n return;\n\n // Pixel size used to compute size of ViewRect so that tiles of appropriate LOD are selected.\n const pixelSize = context.viewport.getPixelSizeAtPoint();\n if (0 === pixelSize)\n return;\n\n // Adjust attached view frustum based on intersection with sheet view frustum.\n const attachFrustum = this._originalFrustum.transformBy(this._toSheet);\n const attachFrustumRange = attachFrustum.toRange();\n const sheetFrustum = context.viewport.getWorldFrustum();\n const sheetFrustumRange = sheetFrustum.toRange();\n const intersect = attachFrustumRange.intersect(sheetFrustumRange);\n if (intersect.isNull)\n return;\n\n attachFrustum.initFromRange(intersect);\n attachFrustum.transformBy(this._fromSheet, attachFrustum);\n this._viewport.setupViewFromFrustum(attachFrustum);\n\n // Adjust view rect based on size of attachment on screen so that tiles of appropriate LOD are selected.\n const width = this._sizeInMeters.x * intersect.xLength() / attachFrustumRange.xLength();\n const height = this._sizeInMeters.y * intersect.yLength() / attachFrustumRange.yLength();\n this._viewRect.width = Math.max(1, Math.round(width / pixelSize));\n this._viewRect.height = Math.max(1, Math.round(height / pixelSize));\n this._viewport.setRect(this._viewRect);\n\n // Propagate settings from on-screen viewport.\n this._viewport.debugBoundingBoxes = context.viewport.debugBoundingBoxes;\n this._viewport.setTileSizeModifier(context.viewport.tileSizeModifier);\n\n // Create the scene.\n this._viewport.renderFrame();\n\n const scene = this.scene;\n if (!scene)\n return;\n\n // Extract scene graphics and insert into on-screen scene context.\n const options = {\n viewAttachmentId: this._props.id,\n clipVolume: this._clipVolume,\n hline: this._hiddenLineSettings,\n frustum: {\n is3d: this.view.is3d(),\n scale: this._scale,\n },\n };\n\n const outputGraphics = (source: RenderGraphic[]) => {\n if (0 === source.length)\n return;\n\n const graphics = new GraphicBranch();\n graphics.setViewFlagOverrides(this._viewFlagOverrides);\n graphics.symbologyOverrides = this.symbologyOverrides;\n\n for (const graphic of source)\n graphics.entries.push(graphic);\n\n const branch = context.createGraphicBranch(graphics, this._toSheet, options);\n context.outputGraphic(branch);\n };\n\n outputGraphics(scene.foreground);\n context.withGraphicType(TileGraphicType.BackgroundMap, () => outputGraphics(scene.background));\n context.withGraphicType(TileGraphicType.Overlay, () => outputGraphics(scene.overlay));\n\n // Report tile statistics to sheet view's viewport.\n const tileAdmin = IModelApp.tileAdmin;\n const selectedAndReady = tileAdmin.getTilesForUser(this._viewport);\n const requested = tileAdmin.getRequestsForUser(this._viewport);\n tileAdmin.addExternalTilesForUser(context.viewport, {\n requested: requested?.size ?? 0,\n selected: selectedAndReady?.selected.size ?? 0,\n ready: selectedAndReady?.ready.size ?? 0,\n });\n }\n\n private getDebugFeatureTable(): PackedFeatureTable {\n if (this._debugFeatureTable)\n return this._debugFeatureTable;\n\n const featureTable = new FeatureTable(1, this._sheetModelId);\n featureTable.insert(new Feature(this._props.id));\n this._debugFeatureTable = PackedFeatureTable.pack(featureTable);\n return this._debugFeatureTable;\n }\n\n public get areAllTileTreesLoaded(): boolean {\n return this.view.areAllTileTreesLoaded;\n }\n\n public collectStatistics(_stats: RenderMemory.Statistics): void {\n // Handled by discloseTileTrees()\n }\n\n public get toSheet(): Transform {\n return this._toSheet;\n }\n}\n\nfunction createRasterAttachmentViewport(_view: ViewState, _rect: ViewRect, _attachment: RasterAttachment): OffScreenViewport {\n class RasterAttachmentViewport extends OffScreenViewport {\n private _sceneContext?: SceneContext;\n private _isSceneReady = false;\n private readonly _attachment: RasterAttachment;\n\n public constructor(view: ViewState, rect: ViewRect, attachment: RasterAttachment) {\n super(IModelApp.renderSystem.createOffscreenTarget(rect));\n this._attachment = attachment;\n this._isAspectRatioLocked = true;\n this.changeView(view);\n }\n\n public override createSceneContext(): SceneContext {\n assert(!this._isSceneReady);\n\n this._sceneContext = super.createSceneContext();\n return this._sceneContext;\n }\n\n public override renderFrame(): void {\n assert(!this._isSceneReady);\n\n this.clearSceneContext();\n super.renderFrame();\n\n if (undefined !== this._sceneContext) {\n this._isSceneReady = !this._sceneContext.hasMissingTiles && this.view.areAllTileTreesLoaded;\n if (this._isSceneReady)\n this._attachment.produceGraphics(this._sceneContext);\n\n this._sceneContext = undefined;\n }\n }\n\n private clearSceneContext(): void {\n this._sceneContext = undefined;\n }\n\n public override addDecorations(_decorations: Decorations): void {\n // ###TODO: skybox, ground plane, possibly grid. DecorateContext requires a ScreenViewport...\n }\n }\n\n return new RasterAttachmentViewport(_view, _rect, _attachment);\n}\n\n/** Draws a 3d view with camera enabled into a sheet view by producing an image of the view's contents offscreen. */\nclass RasterAttachment {\n private readonly _props: ViewAttachmentProps;\n private readonly _placement: Placement2d;\n private readonly _transform: Transform;\n public readonly zDepth: number;\n private _viewport?: OffScreenViewport;\n private _graphics?: RenderGraphic;\n\n public constructor(view: ViewState, props: ViewAttachmentProps, sheetView: SheetViewState) {\n // Render to a 2048x2048 view rect. Scale in Y to preserve aspect ratio.\n const maxSize = 2048;\n const rect = new ViewRect(0, 0, maxSize, maxSize);\n const height = maxSize * view.getAspectRatio() * view.getAspectRatioSkew();\n const skew = maxSize / height;\n view.setAspectRatioSkew(skew);\n\n if (true !== props.jsonProperties?.displayOptions?.preserveBackground) {\n // Make background color 100% transparent so that Viewport.readImageBuffer() will discard transparent pixels.\n const bgColor = sheetView.displayStyle.backgroundColor.withAlpha(0);\n view.displayStyle.backgroundColor = bgColor;\n }\n\n this._viewport = createRasterAttachmentViewport(view, rect, this);\n this._props = props;\n this._placement = Placement2d.fromJSON(props.placement);\n this._transform = this._placement.transform;\n this.zDepth = Frustum2d.depthFromDisplayPriority(props.jsonProperties?.displayPriority ?? 0);\n }\n\n public [Symbol.dispose](): void {\n this._viewport?.[Symbol.dispose]();\n }\n\n public get viewAttachmentProps() {\n return this._props;\n }\n\n public get viewport(): Viewport | undefined {\n return this._viewport;\n }\n\n public get areAllTileTreesLoaded() {\n return this._viewport?.areAllTileTreesLoaded ?? true;\n }\n\n public addToScene(context: SceneContext): void {\n // ###TODO: check viewport.wantViewAttachmentClipShapes\n if (!context.viewport.view.viewsCategory(this._props.category))\n return;\n\n if (context.viewport.wantViewAttachmentBoundaries) {\n const builder = context.createSceneGraphicBuilder(this._transform);\n builder.setSymbology(ColorDef.red, ColorDef.red, 2);\n builder.addRangeBox(Range3d.createRange2d(this._placement.bbox));\n context.outputGraphic(builder.finish());\n }\n\n if (!context.viewport.wantViewAttachments)\n return;\n\n if (this._graphics) {\n context.outputGraphic(this._graphics);\n return;\n }\n\n if (undefined === this._viewport)\n return;\n\n this._viewport.debugBoundingBoxes = context.viewport.debugBoundingBoxes;\n this._viewport.setTileSizeModifier(context.viewport.tileSizeModifier);\n\n this._viewport.renderFrame();\n if (this._graphics)\n context.outputGraphic(this._graphics);\n }\n\n public discloseTileTrees(trees: DisclosedTileTreeSet) {\n if (this._viewport)\n trees.disclose(this._viewport);\n }\n\n public produceGraphics(context: SceneContext): void {\n assert(context.viewport === this._viewport);\n this._graphics = this.createGraphics(this._viewport);\n this._viewport = dispose(this._viewport);\n\n if (undefined !== this._graphics)\n context.outputGraphic(this._graphics);\n }\n\n private createGraphics(vp: Viewport): RenderGraphic | undefined {\n // Create a texture from the contents of the view.\n const image = vp.readImageBuffer({ upsideDown: true });\n if (undefined === image)\n return undefined;\n\n const debugImage = false; // set to true to open a window displaying the captured image.\n if (debugImage) {\n const url = imageBufferToPngDataUrl(image, false);\n if (url)\n openImageDataUrlInNewWindow(url, \"Attachment\");\n }\n\n const texture = IModelApp.renderSystem.createTexture({\n image: { source: image, transparency: TextureTransparency.Opaque },\n });\n if (!texture)\n return undefined;\n\n // Create a material for the texture\n const graphicParams = new GraphicParams();\n graphicParams.material = IModelApp.renderSystem.createRenderMaterial({ textureMapping: { texture } });\n\n // Apply the texture to a rectangular polyface.\n const depth = this.zDepth;\n const east = this._placement.bbox.low.x;\n const west = this._placement.bbox.high.x;\n const north = this._placement.bbox.low.y;\n const south = this._placement.bbox.high.y;\n const corners = [\n Point3d.create(east, north, depth),\n Point3d.create(west, north, depth),\n Point3d.create(west, south, depth),\n Point3d.create(east, south, depth),\n ];\n const params = [\n Point2d.create(0, 0),\n Point2d.create(1, 0),\n Point2d.create(1, 1),\n Point2d.create(0, 1),\n ];\n\n const strokeOptions = new StrokeOptions();\n strokeOptions.needParams = strokeOptions.shouldTriangulate = true;\n const polyfaceBuilder = PolyfaceBuilder.create(strokeOptions);\n polyfaceBuilder.addQuadFacet(corners, params);\n const polyface = polyfaceBuilder.claimPolyface();\n\n const graphicBuilder = IModelApp.renderSystem.createGraphicBuilder(Transform.createIdentity(), GraphicType.Scene, vp, this._props.id);\n graphicBuilder.activateGraphicParams(graphicParams);\n graphicBuilder.addPolyface(polyface, false);\n const graphic = graphicBuilder.finish();\n\n // Wrap the polyface in a GraphicBranch.\n const branch = new GraphicBranch(true);\n const vfOvrs = createDefaultViewFlagOverrides({ clipVolume: true, shadows: false, lighting: false, thematic: false });\n\n // Disable transparency - background pixels are 100% transparent so they will be discarded anyway. Other pixels are 100% opaque.\n vfOvrs.transparency = false;\n branch.setViewFlagOverrides(vfOvrs);\n branch.symbologyOverrides = new FeatureSymbology.Overrides();\n branch.entries.push(graphic);\n\n // Apply the attachment's clip, if any.\n let clipVolume;\n if (this._props.jsonProperties?.clip) {\n const clipVector = ClipVector.fromJSON(this._props.jsonProperties?.clip);\n if (clipVector.isValid)\n clipVolume = IModelApp.renderSystem.createClipVolume(clipVector);\n }\n\n return IModelApp.renderSystem.createGraphicBranch(branch, this._transform, { clipVolume });\n }\n\n public collectStatistics(stats: RenderMemory.Statistics): void {\n if (this._graphics)\n this._graphics.collectStatistics(stats);\n }\n}\n"]}
1
+ {"version":3,"file":"SheetViewState.js","sourceRoot":"","sources":["../../src/SheetViewState.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAyB,MAAM,qBAAqB,CAAC;AAChG,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACvK,OAAO,EACa,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAA2E,kBAAkB,EAAE,WAAW,EAC7L,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAI1D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAG1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAY,MAAM,YAAY,CAAC;AACzD,OAAO,EAA2F,WAAW,EAAE,MAAM,aAAa,CAAC;AAEnI,OAAO,EAAE,8BAA8B,EAAwB,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACxG,OAAO,EAAE,uB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,kBAAkB,GAAG,IAAI,gBAAgB,CAAC,SAAS,EAAE,CAAC;QAC7D,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAE7B,uCAAuC;QACvC,IAAI,UAAU,CAAC;QACf,IAAI,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC;YACrC,MAAM,UAAU,GAAG,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;YACzE,IAAI,UAAU,CAAC,OAAO;gBACpB,UAAU,GAAG,SAAS,CAAC,YAAY,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;QACrE,CAAC;QAED,OAAO,SAAS,CAAC,YAAY,CAAC,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;IAC7F,CAAC;IAEM,iBAAiB,CAAC,KAA8B;QACrD,IAAI,IAAI,CAAC,SAAS;YAChB,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC5C,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 Views\n */\n\nimport { assert, CompressedId64Set, dispose, Id64Array, Id64String } from \"@itwin/core-bentley\";\nimport { Angle, ClipShape, ClipVector, Constant, Matrix3d, Point2d, Point3d, PolyfaceBuilder, Range2d, Range3d, StrokeOptions, Transform } from \"@itwin/core-geometry\";\nimport {\n AxisAlignedBox3d, ColorDef, Feature, FeatureTable, Frustum, Gradient, GraphicParams, HiddenLine, HydrateViewStateRequestProps, HydrateViewStateResponseProps, PackedFeatureTable, Placement2d, SheetProps,\n TextureTransparency, ViewAttachmentProps, ViewDefinition2dProps, ViewFlagOverrides, ViewStateProps,\n} from \"@itwin/core-common\";\nimport { CategorySelectorState } from \"./CategorySelectorState\";\nimport { DisplayStyle2dState } from \"./DisplayStyleState\";\nimport { IModelConnection } from \"./IModelConnection\";\nimport { GraphicBuilder } from \"./render/GraphicBuilder\";\nimport { RenderGraphic } from \"./render/RenderGraphic\";\nimport { GraphicBranch } from \"./render/GraphicBranch\";\nimport { Frustum2d } from \"./Frustum2d\";\nimport { Scene } from \"./render/Scene\";\nimport { Decorations } from \"./render/Decorations\";\nimport { MockRender } from \"./internal/render/MockRender\";\nimport { RenderClipVolume } from \"./render/RenderClipVolume\";\nimport { RenderMemory } from \"./render/RenderMemory\";\nimport { FeatureSymbology } from \"./render/FeatureSymbology\";\nimport { DecorateContext, SceneContext } from \"./ViewContext\";\nimport { IModelApp } from \"./IModelApp\";\nimport { CoordSystem } from \"./CoordSystem\";\nimport { OffScreenViewport, Viewport } from \"./Viewport\";\nimport { AttachToViewportArgs, ComputeDisplayTransformArgs, GetAttachmentViewportArgs, ViewState, ViewState2d } from \"./ViewState\";\nimport { DrawingViewState } from \"./DrawingViewState\";\nimport { createDefaultViewFlagOverrides, DisclosedTileTreeSet, TileGraphicType } from \"./tile/internal\";\nimport { imageBufferToPngDataUrl, openImageDataUrlInNewWindow } from \"./common/ImageUtil\";\nimport { ViewRect } from \"./common/ViewRect\";\nimport { GraphicType } from \"./common/render/GraphicType\";\n\n// cSpell:ignore ovrs\n\n/** Describes the geometry and styling of a sheet border decoration.\n * The sheet border decoration mimics a sheet of paper with a drop shadow.\n */\nclass SheetBorder {\n private _rect: Point2d[];\n private _shadow: Point2d[];\n private _gradient: Gradient.Symb;\n\n private constructor(rect: Point2d[], shadow: Point2d[], gradient: Gradient.Symb) {\n this._rect = rect;\n this._shadow = shadow;\n this._gradient = gradient;\n }\n\n /** Create a new sheet border. If a context is supplied, points are transformed to view coordinates. */\n public static create(width: number, height: number, context?: DecorateContext) {\n // Rect\n const rect: Point3d[] = [\n Point3d.create(0, height),\n Point3d.create(0, 0),\n Point3d.create(width, 0),\n Point3d.create(width, height),\n Point3d.create(0, height)];\n if (context) {\n context.viewport.worldToViewArray(rect);\n }\n\n // Shadow\n const shadowWidth = .01 * Math.sqrt(width * width + height * height);\n const shadow: Point3d[] = [\n Point3d.create(shadowWidth, 0),\n Point3d.create(shadowWidth, -shadowWidth),\n Point3d.create(width + shadowWidth, -shadowWidth),\n Point3d.create(width + shadowWidth, height - shadowWidth),\n Point3d.create(width, height - shadowWidth),\n Point3d.create(width, 0),\n Point3d.create(shadowWidth, 0),\n ];\n if (context) {\n context.viewport.worldToViewArray(shadow);\n }\n\n // Gradient\n const gradient = new Gradient.Symb();\n gradient.mode = Gradient.Mode.Linear;\n gradient.angle = Angle.createDegrees(-45);\n gradient.keys = [{ value: 0, color: ColorDef.from(25, 25, 25) }, { value: 0.5, color: ColorDef.from(150, 150, 150) }];\n\n // Copy over points\n const rect2d: Point2d[] = [];\n for (const point of rect)\n rect2d.push(Point2d.createFrom(point));\n const shadow2d: Point2d[] = [];\n for (const point of shadow)\n shadow2d.push(Point2d.createFrom(point));\n\n return new SheetBorder(rect2d, shadow2d, gradient);\n }\n\n public getRange(): Range2d {\n const range = Range2d.createArray(this._rect);\n const shadowRange = Range2d.createArray(this._shadow);\n range.extendRange(shadowRange);\n return range;\n }\n\n /** Add this border to the given GraphicBuilder. */\n public addToBuilder(builder: GraphicBuilder) {\n const lineColor = ColorDef.black;\n const fillColor = ColorDef.black;\n\n const params = new GraphicParams();\n params.fillColor = fillColor;\n params.gradient = this._gradient;\n\n builder.activateGraphicParams(params);\n builder.addShape2d(this._shadow, Frustum2d.minimumZDistance);\n\n builder.setSymbology(lineColor, fillColor, 2);\n builder.addLineString2d(this._rect, 0);\n }\n}\n\n/** The information required to instantiate an Attachment object. See ViewAttachmentsInfo */\ninterface ViewAttachmentInfo extends ViewAttachmentProps {\n attachedView: ViewState;\n}\n\n/** The information required to instantiate an ViewAttachments object to draw ViewAttachments into a sheet. The list of view attachment Ids is\n * supplied to SheetViewState via the constructor. The corresponding ViewAttachmentProps for each attachment are obtained asynchronously in\n * SheetViewState.load(). The Attachments object is created in SheetViewState.attachToViewport and disposed of in SheetViewState.detachFromViewport.\n */\nclass ViewAttachmentsInfo {\n private _attachments: Id64Array | ViewAttachmentInfo[];\n\n public get attachments() { return this._attachments; }\n\n private constructor(attachments: Id64Array | ViewAttachmentInfo[]) {\n this._attachments = attachments;\n }\n\n public get isLoaded(): boolean {\n return 0 === this._attachments.length || \"string\" !== typeof this._attachments[0];\n }\n\n public get viewAttachmentProps(): Array<Readonly<ViewAttachmentProps>> {\n return this.isLoaded ? this._props : [];\n }\n\n private get _props(): ViewAttachmentInfo[] {\n assert(this.isLoaded);\n return this._attachments as ViewAttachmentInfo[];\n }\n\n private get _ids(): Id64Array {\n assert(!this.isLoaded);\n return this._attachments as Id64Array;\n }\n\n public static fromJSON(ids: Id64Array = []): ViewAttachmentsInfo {\n return new ViewAttachmentsInfo(ids);\n }\n\n public toJSON(): Id64Array {\n return this.isLoaded ? this._props.map((x) => x.id!) : [...this._ids];\n }\n\n public clone(iModel: IModelConnection): ViewAttachmentsInfo {\n let attachments = this._attachments;\n if (this.isLoaded) {\n // Need to clone the attached ViewStates.\n attachments = attachments.map((attachment) => {\n assert(typeof attachment !== \"string\");\n return {\n ...attachment,\n attachedView: attachment.attachedView.clone(iModel),\n };\n });\n }\n\n return new ViewAttachmentsInfo(attachments);\n }\n\n public preload(options: HydrateViewStateRequestProps) {\n if (this.isLoaded)\n return;\n options.sheetViewAttachmentIds = CompressedId64Set.sortAndCompress(this._ids);\n options.viewStateLoadProps = {\n displayStyle: {\n omitScheduleScriptElementIds: !IModelApp.tileAdmin.enableFrontendScheduleScripts,\n compressExcludedElementIds: true,\n },\n };\n }\n\n public async postload(options: HydrateViewStateResponseProps, iModel: IModelConnection) {\n if (options.sheetViewViews === undefined)\n return;\n if (options.sheetViewAttachmentProps === undefined)\n return;\n\n const viewStateProps = options.sheetViewViews; // This is viewstateProps, need to turn this into ViewState\n const promises = [];\n for (const viewProps of viewStateProps) {\n const loadView = async () => {\n try {\n if (viewProps === undefined)\n return undefined;\n const view = await iModel.views.convertViewStatePropsToViewState(viewProps);\n return view;\n } catch {\n return undefined;\n }\n };\n promises.push(loadView());\n }\n const views = await Promise.all(promises);\n\n const attachmentProps = options.sheetViewAttachmentProps as ViewAttachmentInfo[];\n assert(views.length === attachmentProps.length);\n const attachments = [];\n for (let i = 0; i < views.length; i++) {\n const view = views[i];\n if (view && !(view instanceof SheetViewState)) {\n const props = attachmentProps[i];\n props.attachedView = view;\n attachments.push(props);\n }\n }\n\n this._attachments = attachments;\n }\n\n public async load(iModel: IModelConnection): Promise<void> {\n if (this.isLoaded)\n return;\n\n const attachmentProps = await iModel.elements.getProps(this._ids) as ViewAttachmentInfo[];\n const promises = [];\n for (const attachment of attachmentProps) {\n const loadView = async () => {\n try {\n const view = await iModel.views.load(attachment.view.id);\n return view;\n } catch {\n return undefined;\n }\n };\n\n promises.push(loadView());\n }\n\n const views = await Promise.all(promises);\n assert(views.length === attachmentProps.length);\n\n const attachments = [];\n for (let i = 0; i < views.length; i++) {\n const view = views[i];\n if (view && !(view instanceof SheetViewState)) {\n const props = attachmentProps[i];\n props.attachedView = view;\n attachments.push(props);\n }\n }\n\n this._attachments = attachments;\n }\n\n public createAttachments(sheetView: SheetViewState): ViewAttachments | undefined {\n return this.isLoaded ? new ViewAttachments(this._props, sheetView) : undefined;\n }\n}\n\n/** The set of view attachments to be displayed in a Viewport via a SheetViewState. Allocated when the view becomes attached to a Viewport;\n * disposed of when it becomes detached from the viewport.\n */\nclass ViewAttachments {\n private readonly _attachments: Attachment[] = [];\n public maxDepth = Frustum2d.minimumZDistance;\n\n public constructor(infos: ViewAttachmentInfo[], sheetView: SheetViewState) {\n for (const info of infos) {\n const drawAsRaster = info.jsonProperties?.displayOptions?.drawAsRaster || (info.attachedView.is3d() && info.attachedView.isCameraOn);\n const ctor = drawAsRaster ? RasterAttachment : OrthographicAttachment;\n const attachment = new ctor(info.attachedView, info, sheetView);\n this._attachments.push(attachment);\n this.maxDepth = Math.max(this.maxDepth, attachment.zDepth);\n }\n }\n\n public [Symbol.dispose](): void {\n for (const attachment of this._attachments)\n attachment[Symbol.dispose]();\n\n this._attachments.length = 0;\n }\n\n public [Symbol.iterator](): Iterator<Attachment> {\n return this._attachments[Symbol.iterator]();\n }\n\n /** For tests. */\n public get attachments(): object[] {\n return this._attachments;\n }\n\n public get isEmpty(): boolean {\n return 0 === this._attachments.length;\n }\n\n public areAllTileTreesLoaded(displayedExtents: Range3d): boolean {\n return this._attachments.every((x) => {\n const placement = Placement2d.fromJSON(x.viewAttachmentProps.placement);\n const attachmentRange = placement.calculateRange();\n if (!attachmentRange.intersectsRangeXY(displayedExtents))\n return true;\n\n return x.areAllTileTreesLoaded});\n }\n\n /** Strictly for testing purposes */\n public areAllAttachmentsLoaded(): boolean {\n return this._attachments.every((attachment) => attachment.areAllTileTreesLoaded);\n }\n\n public discloseTileTrees(trees: DisclosedTileTreeSet): void {\n for (const attachment of this._attachments)\n trees.disclose(attachment);\n }\n\n public collectStatistics(stats: RenderMemory.Statistics): void {\n for (const attachment of this._attachments)\n attachment.collectStatistics(stats);\n }\n\n public addToScene(context: SceneContext): void {\n for (const attachment of this._attachments)\n attachment.addToScene(context);\n }\n\n public findById(attachmentId: Id64String): Attachment | undefined {\n return this._attachments.find((attachment: Attachment) => attachment.viewAttachmentProps.id === attachmentId);\n }\n}\n\n/** A view of a [SheetModel]($backend).\n * @public\n * @extensions\n */\nexport class SheetViewState extends ViewState2d {\n /** The width and height of the sheet in world coordinates. */\n public readonly sheetSize: Point2d;\n private _attachmentsInfo: ViewAttachmentsInfo;\n private _attachments?: ViewAttachments;\n private readonly _viewedExtents: AxisAlignedBox3d;\n\n public get attachmentIds(): Id64Array {\n return this._attachmentsInfo.toJSON();\n }\n\n public static override get className() { return \"SheetViewDefinition\"; }\n\n public static override createFromProps(viewStateData: ViewStateProps, iModel: IModelConnection): SheetViewState {\n const cat = new CategorySelectorState(viewStateData.categorySelectorProps, iModel);\n const displayStyleState = new DisplayStyle2dState(viewStateData.displayStyleProps, iModel);\n\n // use \"new this\" so subclasses are correct\n return new this(viewStateData.viewDefinitionProps as ViewDefinition2dProps, iModel, cat, displayStyleState, viewStateData.sheetProps!, viewStateData.sheetAttachments!);\n }\n\n public override toProps(): ViewStateProps {\n const props = super.toProps();\n\n props.sheetAttachments = this._attachmentsInfo.toJSON();\n\n // For sheetProps all that is actually used is the size, so just null out everything else.\n const codeProps = { spec: \"\", scope: \"\", value: \"\" };\n props.sheetProps = {\n model: \"\",\n code: codeProps,\n classFullName: \"\",\n width: this.sheetSize.x,\n height: this.sheetSize.y,\n scale: 1,\n };\n\n return props;\n }\n\n /** Strictly for testing. @internal */\n public get viewAttachmentProps(): Array<Readonly<ViewAttachmentProps>> {\n return this._attachmentsInfo.viewAttachmentProps.map((x) => {\n return {\n ...x,\n attachedView: undefined,\n };\n });\n }\n\n /** Strictly for testing. @internal */\n public get viewAttachmentInfos(): Id64Array | Array<{ attachedView: ViewState }> {\n return this._attachmentsInfo.attachments;\n }\n\n /** Strictly for testing. @internal */\n public get attachments(): object[] | undefined {\n return this._attachments?.attachments;\n }\n\n public override isDrawingView(): this is DrawingViewState { return false; }\n public override isSheetView(): this is SheetViewState { return true; }\n\n public constructor(props: ViewDefinition2dProps, iModel: IModelConnection, categories: CategorySelectorState, displayStyle: DisplayStyle2dState, sheetProps: SheetProps, attachments: Id64Array) {\n super(props, iModel, categories, displayStyle);\n if (categories instanceof SheetViewState) {\n // we are coming from clone...\n this.sheetSize = categories.sheetSize.clone();\n this._attachmentsInfo = categories._attachmentsInfo.clone(iModel);\n this._viewedExtents = categories._viewedExtents.clone();\n } else {\n this.sheetSize = Point2d.create(sheetProps.width, sheetProps.height);\n this._attachmentsInfo = ViewAttachmentsInfo.fromJSON(attachments);\n\n const extents = new Range3d(0, 0, 0, this.sheetSize.x, this.sheetSize.y, 0);\n const margin = 1.1;\n extents.scaleAboutCenterInPlace(margin);\n this._viewedExtents = extents;\n }\n }\n\n public override getOrigin() {\n const origin = super.getOrigin();\n if (this._attachments)\n origin.z = -this._attachments.maxDepth;\n\n return origin;\n }\n\n public override getExtents() {\n const extents = super.getExtents();\n if (this._attachments)\n extents.z = this._attachments.maxDepth + Frustum2d.minimumZDistance;\n\n return extents;\n }\n\n /** Overrides [[ViewState.discloseTileTrees]] to include tile trees associated with [ViewAttachment]($backend)s displayed on this sheet. */\n public override discloseTileTrees(trees: DisclosedTileTreeSet): void {\n super.discloseTileTrees(trees);\n if (this._attachments)\n trees.disclose(this._attachments);\n }\n\n /** @internal */\n public override collectNonTileTreeStatistics(stats: RenderMemory.Statistics): void {\n super.collectNonTileTreeStatistics(stats);\n if (this._attachments)\n this._attachments.collectStatistics(stats);\n }\n\n public override get defaultExtentLimits() {\n return { min: Constant.oneMillimeter, max: this.sheetSize.magnitude() * 10 };\n }\n\n public override getViewedExtents(): AxisAlignedBox3d {\n return this._viewedExtents;\n }\n\n /** @internal */\n protected override preload(hydrateRequest: HydrateViewStateRequestProps): void {\n super.preload(hydrateRequest);\n this._attachmentsInfo.preload(hydrateRequest);\n }\n\n /** @internal */\n protected override async postload(hydrateResponse: HydrateViewStateResponseProps): Promise<void> {\n const promises = [];\n promises.push(super.postload(hydrateResponse));\n promises.push(this._attachmentsInfo.postload(hydrateResponse, this.iModel));\n await Promise.all(promises);\n }\n\n /** @internal */\n public override createScene(context: SceneContext): void {\n super.createScene(context);\n if (this._attachments)\n this._attachments.addToScene(context);\n }\n\n /** @internal */\n public override get secondaryViewports(): Iterable<Viewport> {\n const attachments = this._attachments;\n if (!attachments)\n return super.secondaryViewports;\n\n function* iterator() {\n for (const attachment of attachments!) {\n const vp = attachment.viewport;\n if (vp)\n yield vp;\n }\n }\n\n return {\n [Symbol.iterator]: () => iterator(),\n };\n }\n\n /** @internal */\n private async queryAttachmentIds(): Promise<Id64Array> {\n const ecsql = `SELECT ECInstanceId as attachmentId FROM bis.ViewAttachment WHERE model.Id=${this.baseModelId}`;\n const ids: string[] = [];\n for await (const row of this.iModel.createQueryReader(ecsql))\n ids.push(row[0]);\n\n return ids;\n }\n\n public override async changeViewedModel(modelId: Id64String): Promise<void> {\n await super.changeViewedModel(modelId);\n const attachmentIds = await this.queryAttachmentIds();\n this._attachmentsInfo = ViewAttachmentsInfo.fromJSON(attachmentIds);\n\n assert(undefined === this._attachments);\n }\n\n /** See [[ViewState.attachToViewport]]. */\n public override attachToViewport(args: AttachToViewportArgs): void {\n super.attachToViewport(args);\n assert(undefined === this._attachments);\n this._attachments = this._attachmentsInfo.createAttachments(this);\n }\n\n /** See [[ViewState.detachFromViewport]]. */\n public override detachFromViewport(): void {\n super.detachFromViewport();\n this._attachments = dispose(this._attachments);\n }\n\n public override get areAllTileTreesLoaded(): boolean {\n let displayedExtents = this._viewedExtents;\n const frustum = this.calculateFrustum();\n if (frustum) {\n displayedExtents = frustum.toRange();\n }\n\n return super.areAllTileTreesLoaded && (!this._attachments || this._attachments.areAllTileTreesLoaded(displayedExtents));\n }\n\n /** @internal Strictly for testing */\n public areAllAttachmentsLoaded(): boolean {\n if (this._attachments) {\n return this._attachments.areAllAttachmentsLoaded();\n }\n return true;\n }\n\n /** Create a sheet border decoration graphic. */\n private createBorder(width: number, height: number, context: DecorateContext): RenderGraphic {\n const border = SheetBorder.create(width, height, context);\n const builder = context.createGraphicBuilder(GraphicType.ViewBackground);\n border.addToBuilder(builder);\n return builder.finish();\n }\n\n /** @internal */\n public override decorate(context: DecorateContext): void {\n super.decorate(context);\n if (this.sheetSize !== undefined) {\n const border = this.createBorder(this.sheetSize.x, this.sheetSize.y, context);\n context.setViewBackground(border);\n }\n }\n\n public override computeFitRange(): Range3d {\n const size = this.sheetSize;\n if (0 >= size.x || 0 >= size.y)\n return super.computeFitRange();\n return new Range3d(0, 0, -1, size.x, size.y, 1);\n }\n\n /** @internal */\n public override getAttachmentViewport(args: GetAttachmentViewportArgs): Viewport | undefined {\n const attachment = args.viewAttachmentId ? this._attachments?.findById(args.viewAttachmentId) : undefined;\n if (!attachment) {\n return undefined;\n }\n\n return args.inSectionDrawingAttachment ? attachment.viewport?.view.getAttachmentViewport({ inSectionDrawingAttachment: true }) : attachment.viewport;\n }\n\n /** @beta */\n public override computeDisplayTransform(args: ComputeDisplayTransformArgs): Transform | undefined {\n // ###TODO we're currently ignoring model and element Id in args, assuming irrelevant for sheets.\n // Should probably call super or have super call us.\n const attachment = undefined !== args.viewAttachmentId ? this._attachments?.findById(args.viewAttachmentId) : undefined;\n if (!attachment || !(attachment instanceof OrthographicAttachment)) {\n return undefined;\n }\n\n const sheetTransform = attachment.toSheet;\n const sectionTransform = args.inSectionDrawingAttachment ? attachment.view.computeDisplayTransform(args) : undefined;\n if (!sectionTransform) {\n return sheetTransform.clone(args.output);\n }\n\n return sheetTransform.multiplyTransformTransform(sectionTransform, args.output);\n }\n}\n\n/** A mostly no-op RenderTarget for an Attachment.\n * its Scene and symbology overrides.\n */\nclass AttachmentTarget extends MockRender.OffScreenTarget {\n private readonly _attachment: OrthographicAttachment;\n\n public constructor(attachment: OrthographicAttachment) {\n // The dimensions don't matter - we're not drawing anything.\n const rect = new ViewRect(1, 1);\n super(IModelApp.renderSystem, rect);\n this._attachment = attachment;\n }\n\n public override changeScene(scene: Scene): void {\n this._attachment.scene = scene;\n }\n\n public override overrideFeatureSymbology(ovrs: FeatureSymbology.Overrides): void {\n this._attachment.symbologyOverrides = ovrs;\n }\n}\n\n/** Draws the contents of a view attachment into a sheet view. */\ninterface Attachment extends Disposable {\n readonly areAllTileTreesLoaded: boolean;\n addToScene: (context: SceneContext) => void;\n discloseTileTrees: (trees: DisclosedTileTreeSet) => void;\n readonly zDepth: number;\n collectStatistics: (stats: RenderMemory.Statistics) => void;\n viewAttachmentProps: ViewAttachmentProps;\n readonly viewport?: Viewport;\n}\n\n/** Draws the contents a 2d or orthographic 3d view directly into a sheet view.\n * We select tiles for the view in the context of a light-weight offscreen viewport with a no-op RenderTarget, then\n * collect the resultant graphics and add them to the sheet view's scene.\n */\nclass OrthographicAttachment {\n private readonly _viewport: OffScreenViewport;\n private readonly _props: ViewAttachmentProps;\n private readonly _sheetModelId: Id64String;\n private readonly _viewFlagOverrides: ViewFlagOverrides;\n private readonly _toSheet: Transform;\n private readonly _fromSheet: Transform;\n private readonly _sizeInMeters: Point2d;\n private readonly _range: Range3d;\n private readonly _viewRect = new ViewRect(0, 0, 1, 1);\n private readonly _originalFrustum = new Frustum();\n private readonly _clipVolume?: RenderClipVolume;\n private readonly _hiddenLineSettings?: HiddenLine.Settings;\n private readonly _scale: { x: number, y: number };\n private _debugFeatureTable?: PackedFeatureTable;\n public scene?: Scene;\n public symbologyOverrides: FeatureSymbology.Overrides;\n public readonly zDepth: number;\n\n public get view(): ViewState {\n return this._viewport.view;\n }\n\n public get viewAttachmentProps() {\n return this._props;\n }\n\n public get viewport(): Viewport {\n return this._viewport;\n }\n\n public constructor(view: ViewState, props: ViewAttachmentProps, sheetView: SheetViewState) {\n this.symbologyOverrides = new FeatureSymbology.Overrides(view);\n const target = new AttachmentTarget(this);\n this._viewport = OffScreenViewport.createViewport(view, target, true);\n\n this._props = props;\n this._sheetModelId = sheetView.baseModelId;\n\n const applyClip = true; // set to false for debugging\n this._viewFlagOverrides = {\n ...view.viewFlags,\n clipVolume: applyClip,\n lighting: false,\n shadows: false,\n };\n\n const placement = Placement2d.fromJSON(props.placement);\n const range = placement.calculateRange();\n this._range = range;\n this._sizeInMeters = new Point2d(range.xLength(), range.yLength());\n\n // Compute transform from attached view's world coordinates to sheet's world coordinates.\n // NB: We obtain the extents and origin from the *viewport* not the *view* - they may have been adjusted by the viewport.\n const applySkew = true; // set to false for debugging\n const skew = applySkew ? view.getAspectRatioSkew() : 1;\n const extents = this._viewport.viewingSpace.viewDelta.clone();\n const zDepth = Math.abs(extents.z);\n const scaleX = this._sizeInMeters.x / Math.abs(extents.x);\n const scaleY = skew * this._sizeInMeters.y / Math.abs(extents.y);\n this._scale = { x: 1 / scaleX, y: 1 / scaleY };\n\n const zBias = Frustum2d.depthFromDisplayPriority(props.jsonProperties?.displayPriority ?? 0);\n this.zDepth = 1.01 * (zDepth - zBias); // give a little padding so that geometry right up against far plane doesn't get clipped.\n\n // View origin is at the *back* of the view. Align *front* of view based on display priority.\n const viewRot = view.getRotation();\n const viewOrg = viewRot.multiplyVector(this._viewport.viewingSpace.viewOrigin);\n viewOrg.z += zDepth;\n viewRot.multiplyTransposeVectorInPlace(viewOrg);\n\n const matrix = Matrix3d.createScale(scaleX, scaleY, 1);\n matrix.multiplyMatrixMatrix(viewRot, matrix);\n const origin = Matrix3d.xyzMinusMatrixTimesXYZ(viewOrg, matrix, viewOrg);\n const attachmentOrigin = Point3d.createFrom(placement.origin);\n attachmentOrigin.z = zBias;\n const viewOrgToAttachment = attachmentOrigin.minus(viewOrg);\n origin.addInPlace(viewOrgToAttachment);\n this._toSheet = Transform.createRefs(origin, matrix);\n this._fromSheet = this._toSheet.inverse()!;\n\n // If the attached view is a section drawing, it may itself have an attached spatial view with a clip.\n // The clip needs to be transformed into sheet space.\n if (view.isDrawingView())\n this._viewport.drawingToSheetTransform = this._toSheet;\n\n // ###TODO? If we also apply the attachment's clip to the attached view, we may get additional culling during tile selection.\n // However the attached view's frustum is already clipped by intersection with sheet view's frustum, and additional clipping planes\n // introduce additional computation, so possibly not worth it.\n\n // Transform the view's clip (if any) to sheet space\n let viewClip = view.viewFlags.clipVolume ? view.getViewClip()?.clone() : undefined;\n if (viewClip)\n viewClip.transformInPlace(this._toSheet);\n else\n viewClip = ClipVector.createEmpty();\n\n let sheetClip;\n if (undefined !== props.jsonProperties?.clip)\n sheetClip = ClipVector.fromJSON(props.jsonProperties?.clip);\n\n if (sheetClip && sheetClip.isValid) {\n // Clip to view attachment's clip. NB: clip is in sheet coordinate space.\n for (const clip of sheetClip.clips)\n viewClip.clips.push(clip);\n } else {\n // Clip to view attachment's bounding box\n viewClip.appendShape([\n Point3d.create(this._range.low.x, this._range.low.y),\n Point3d.create(this._range.high.x, this._range.low.y),\n Point3d.create(this._range.high.x, this._range.high.y),\n Point3d.create(this._range.low.x, this._range.high.y),\n ]);\n }\n\n this._clipVolume = IModelApp.renderSystem.createClipVolume(viewClip);\n\n // Save off the original frustum (potentially adjusted by viewport).\n this._viewport.setupFromView();\n this._viewport.viewingSpace.getFrustum(CoordSystem.World, true, this._originalFrustum);\n\n const applyHiddenLineSettings = true; // for debugging edge display, set to false...\n const style = view.displayStyle;\n if (style.is3d() && applyHiddenLineSettings)\n this._hiddenLineSettings = style.settings.hiddenLineSettings;\n }\n\n public [Symbol.dispose](): void {\n this._viewport[Symbol.dispose]();\n }\n\n public discloseTileTrees(trees: DisclosedTileTreeSet): void {\n trees.disclose(this._viewport);\n }\n\n public addToScene(context: SceneContext): void {\n if (context.viewport.freezeScene)\n return;\n\n if (!context.viewport.view.viewsCategory(this._props.category))\n return;\n\n const wantBounds = context.viewport.wantViewAttachmentBoundaries;\n const wantClipShapes = context.viewport.wantViewAttachmentClipShapes;\n if (wantBounds || wantClipShapes) {\n const builder = context.createSceneGraphicBuilder();\n if (wantBounds) {\n builder.setSymbology(ColorDef.red, ColorDef.red, 2);\n builder.addRangeBox(this._range);\n }\n\n if (wantClipShapes && this._clipVolume) {\n builder.setSymbology(ColorDef.blue, ColorDef.blue, 2);\n for (const prim of this._clipVolume.clipVector.clips) {\n if (!(prim instanceof ClipShape))\n continue; // ###TODO handle non-shape primitives, if any such ever encountered\n\n const pts = [];\n const tf = prim.transformFromClip;\n for (const pt of prim.polygon) {\n const tfPt = tf ? tf.multiplyPoint3d(pt) : pt;\n pts.push(new Point2d(tfPt.x, tfPt.y));\n }\n\n builder.addLineString2d(pts, 0);\n }\n }\n\n // Put into a Batch so that we can see tooltip with attachment Id on mouseover.\n const batch = context.target.renderSystem.createBatch(builder.finish(), this.getDebugFeatureTable(), this._range);\n context.outputGraphic(batch);\n }\n\n if (!context.viewport.wantViewAttachments)\n return;\n\n // Pixel size used to compute size of ViewRect so that tiles of appropriate LOD are selected.\n const pixelSize = context.viewport.getPixelSizeAtPoint();\n if (0 === pixelSize)\n return;\n\n // Adjust attached view frustum based on intersection with sheet view frustum.\n const attachFrustum = this._originalFrustum.transformBy(this._toSheet);\n const attachFrustumRange = attachFrustum.toRange();\n const sheetFrustum = context.viewport.getWorldFrustum();\n const sheetFrustumRange = sheetFrustum.toRange();\n const intersect = attachFrustumRange.intersect(sheetFrustumRange);\n if (intersect.isNull)\n return;\n\n attachFrustum.initFromRange(intersect);\n attachFrustum.transformBy(this._fromSheet, attachFrustum);\n this._viewport.setupViewFromFrustum(attachFrustum);\n\n // Adjust view rect based on size of attachment on screen so that tiles of appropriate LOD are selected.\n const width = this._sizeInMeters.x * intersect.xLength() / attachFrustumRange.xLength();\n const height = this._sizeInMeters.y * intersect.yLength() / attachFrustumRange.yLength();\n this._viewRect.width = Math.max(1, Math.round(width / pixelSize));\n this._viewRect.height = Math.max(1, Math.round(height / pixelSize));\n this._viewport.setRect(this._viewRect);\n\n // Propagate settings from on-screen viewport.\n this._viewport.debugBoundingBoxes = context.viewport.debugBoundingBoxes;\n this._viewport.setTileSizeModifier(context.viewport.tileSizeModifier);\n\n // Create the scene.\n this._viewport.renderFrame();\n\n const scene = this.scene;\n if (!scene)\n return;\n\n // Extract scene graphics and insert into on-screen scene context.\n const options = {\n viewAttachmentId: this._props.id,\n clipVolume: this._clipVolume,\n hline: this._hiddenLineSettings,\n frustum: {\n is3d: this.view.is3d(),\n scale: this._scale,\n },\n };\n\n const outputGraphics = (source: RenderGraphic[]) => {\n if (0 === source.length)\n return;\n\n const graphics = new GraphicBranch();\n graphics.setViewFlagOverrides(this._viewFlagOverrides);\n graphics.symbologyOverrides = this.symbologyOverrides;\n\n for (const graphic of source)\n graphics.entries.push(graphic);\n\n const branch = context.createGraphicBranch(graphics, this._toSheet, options);\n context.outputGraphic(branch);\n };\n\n outputGraphics(scene.foreground);\n context.withGraphicType(TileGraphicType.BackgroundMap, () => outputGraphics(scene.background));\n context.withGraphicType(TileGraphicType.Overlay, () => outputGraphics(scene.overlay));\n\n // Report tile statistics to sheet view's viewport.\n const tileAdmin = IModelApp.tileAdmin;\n const selectedAndReady = tileAdmin.getTilesForUser(this._viewport);\n const requested = tileAdmin.getRequestsForUser(this._viewport);\n tileAdmin.addExternalTilesForUser(context.viewport, {\n requested: requested?.size ?? 0,\n selected: selectedAndReady?.selected.size ?? 0,\n ready: selectedAndReady?.ready.size ?? 0,\n });\n }\n\n private getDebugFeatureTable(): PackedFeatureTable {\n if (this._debugFeatureTable)\n return this._debugFeatureTable;\n\n const featureTable = new FeatureTable(1, this._sheetModelId);\n featureTable.insert(new Feature(this._props.id));\n this._debugFeatureTable = PackedFeatureTable.pack(featureTable);\n return this._debugFeatureTable;\n }\n\n public get areAllTileTreesLoaded(): boolean {\n return this.view.areAllTileTreesLoaded;\n }\n\n public collectStatistics(_stats: RenderMemory.Statistics): void {\n // Handled by discloseTileTrees()\n }\n\n public get toSheet(): Transform {\n return this._toSheet;\n }\n}\n\nfunction createRasterAttachmentViewport(_view: ViewState, _rect: ViewRect, _attachment: RasterAttachment): OffScreenViewport {\n class RasterAttachmentViewport extends OffScreenViewport {\n private _sceneContext?: SceneContext;\n private _isSceneReady = false;\n private readonly _attachment: RasterAttachment;\n\n public constructor(view: ViewState, rect: ViewRect, attachment: RasterAttachment) {\n super(IModelApp.renderSystem.createOffscreenTarget(rect));\n this._attachment = attachment;\n this._isAspectRatioLocked = true;\n this.changeView(view);\n }\n\n public override createSceneContext(): SceneContext {\n assert(!this._isSceneReady);\n\n this._sceneContext = super.createSceneContext();\n return this._sceneContext;\n }\n\n public override renderFrame(): void {\n assert(!this._isSceneReady);\n\n this.clearSceneContext();\n super.renderFrame();\n\n if (undefined !== this._sceneContext) {\n this._isSceneReady = !this._sceneContext.hasMissingTiles && this.view.areAllTileTreesLoaded;\n if (this._isSceneReady)\n this._attachment.produceGraphics(this._sceneContext);\n\n this._sceneContext = undefined;\n }\n }\n\n private clearSceneContext(): void {\n this._sceneContext = undefined;\n }\n\n public override addDecorations(_decorations: Decorations): void {\n // ###TODO: skybox, ground plane, possibly grid. DecorateContext requires a ScreenViewport...\n }\n }\n\n return new RasterAttachmentViewport(_view, _rect, _attachment);\n}\n\n/** Draws a 3d view with camera enabled into a sheet view by producing an image of the view's contents offscreen. */\nclass RasterAttachment {\n private readonly _props: ViewAttachmentProps;\n private readonly _placement: Placement2d;\n private readonly _transform: Transform;\n public readonly zDepth: number;\n private _viewport?: OffScreenViewport;\n private _graphics?: RenderGraphic;\n\n public constructor(view: ViewState, props: ViewAttachmentProps, sheetView: SheetViewState) {\n // Render to a 2048x2048 view rect. Scale in Y to preserve aspect ratio.\n const maxSize = 2048;\n const rect = new ViewRect(0, 0, maxSize, maxSize);\n const height = maxSize * view.getAspectRatio() * view.getAspectRatioSkew();\n const skew = maxSize / height;\n view.setAspectRatioSkew(skew);\n\n if (true !== props.jsonProperties?.displayOptions?.preserveBackground) {\n // Make background color 100% transparent so that Viewport.readImageBuffer() will discard transparent pixels.\n const bgColor = sheetView.displayStyle.backgroundColor.withAlpha(0);\n view.displayStyle.backgroundColor = bgColor;\n }\n\n this._viewport = createRasterAttachmentViewport(view, rect, this);\n this._props = props;\n this._placement = Placement2d.fromJSON(props.placement);\n this._transform = this._placement.transform;\n this.zDepth = Frustum2d.depthFromDisplayPriority(props.jsonProperties?.displayPriority ?? 0);\n }\n\n public [Symbol.dispose](): void {\n this._viewport?.[Symbol.dispose]();\n }\n\n public get viewAttachmentProps() {\n return this._props;\n }\n\n public get viewport(): Viewport | undefined {\n return this._viewport;\n }\n\n public get areAllTileTreesLoaded() {\n return this._viewport?.areAllTileTreesLoaded ?? true;\n }\n\n public addToScene(context: SceneContext): void {\n // ###TODO: check viewport.wantViewAttachmentClipShapes\n if (!context.viewport.view.viewsCategory(this._props.category))\n return;\n\n if (context.viewport.wantViewAttachmentBoundaries) {\n const builder = context.createSceneGraphicBuilder(this._transform);\n builder.setSymbology(ColorDef.red, ColorDef.red, 2);\n builder.addRangeBox(Range3d.createRange2d(this._placement.bbox));\n context.outputGraphic(builder.finish());\n }\n\n if (!context.viewport.wantViewAttachments)\n return;\n\n if (this._graphics) {\n context.outputGraphic(this._graphics);\n return;\n }\n\n if (undefined === this._viewport)\n return;\n\n this._viewport.debugBoundingBoxes = context.viewport.debugBoundingBoxes;\n this._viewport.setTileSizeModifier(context.viewport.tileSizeModifier);\n\n this._viewport.renderFrame();\n if (this._graphics)\n context.outputGraphic(this._graphics);\n }\n\n public discloseTileTrees(trees: DisclosedTileTreeSet) {\n if (this._viewport)\n trees.disclose(this._viewport);\n }\n\n public produceGraphics(context: SceneContext): void {\n assert(context.viewport === this._viewport);\n this._graphics = this.createGraphics(this._viewport);\n this._viewport = dispose(this._viewport);\n\n if (undefined !== this._graphics)\n context.outputGraphic(this._graphics);\n }\n\n private createGraphics(vp: Viewport): RenderGraphic | undefined {\n // Create a texture from the contents of the view.\n const image = vp.readImageBuffer({ upsideDown: true });\n if (undefined === image)\n return undefined;\n\n const debugImage = false; // set to true to open a window displaying the captured image.\n if (debugImage) {\n const url = imageBufferToPngDataUrl(image, false);\n if (url)\n openImageDataUrlInNewWindow(url, \"Attachment\");\n }\n\n const texture = IModelApp.renderSystem.createTexture({\n image: { source: image, transparency: TextureTransparency.Opaque },\n });\n if (!texture)\n return undefined;\n\n // Create a material for the texture\n const graphicParams = new GraphicParams();\n graphicParams.material = IModelApp.renderSystem.createRenderMaterial({ textureMapping: { texture } });\n\n // Apply the texture to a rectangular polyface.\n const depth = this.zDepth;\n const east = this._placement.bbox.low.x;\n const west = this._placement.bbox.high.x;\n const north = this._placement.bbox.low.y;\n const south = this._placement.bbox.high.y;\n const corners = [\n Point3d.create(east, north, depth),\n Point3d.create(west, north, depth),\n Point3d.create(west, south, depth),\n Point3d.create(east, south, depth),\n ];\n const params = [\n Point2d.create(0, 0),\n Point2d.create(1, 0),\n Point2d.create(1, 1),\n Point2d.create(0, 1),\n ];\n\n const strokeOptions = new StrokeOptions();\n strokeOptions.needParams = strokeOptions.shouldTriangulate = true;\n const polyfaceBuilder = PolyfaceBuilder.create(strokeOptions);\n polyfaceBuilder.addQuadFacet(corners, params);\n const polyface = polyfaceBuilder.claimPolyface();\n\n const graphicBuilder = IModelApp.renderSystem.createGraphicBuilder(Transform.createIdentity(), GraphicType.Scene, vp, this._props.id);\n graphicBuilder.activateGraphicParams(graphicParams);\n graphicBuilder.addPolyface(polyface, false);\n const graphic = graphicBuilder.finish();\n\n // Wrap the polyface in a GraphicBranch.\n const branch = new GraphicBranch(true);\n const vfOvrs = createDefaultViewFlagOverrides({ clipVolume: true, shadows: false, lighting: false, thematic: false });\n\n // Disable transparency - background pixels are 100% transparent so they will be discarded anyway. Other pixels are 100% opaque.\n vfOvrs.transparency = false;\n branch.setViewFlagOverrides(vfOvrs);\n branch.symbologyOverrides = new FeatureSymbology.Overrides();\n branch.entries.push(graphic);\n\n // Apply the attachment's clip, if any.\n let clipVolume;\n if (this._props.jsonProperties?.clip) {\n const clipVector = ClipVector.fromJSON(this._props.jsonProperties?.clip);\n if (clipVector.isValid)\n clipVolume = IModelApp.renderSystem.createClipVolume(clipVector);\n }\n\n return IModelApp.renderSystem.createGraphicBranch(branch, this._transform, { clipVolume });\n }\n\n public collectStatistics(stats: RenderMemory.Statistics): void {\n if (this._graphics)\n this._graphics.collectStatistics(stats);\n }\n}\n"]}
@@ -98,7 +98,7 @@ export * from "./render/ScreenSpaceEffectBuilder";
98
98
  export * from "./render/VisibleFeature";
99
99
  export * from "./internal/render/webgl/IModelFrameLifecycle";
100
100
  export type { TxnEntityChange, TxnEntityChangeIterable, TxnEntityChangeType, TxnEntityChanges, TxnEntityChangesFilterOptions, TxnEntityMetadata, TxnEntityMetadataCriterion, } from "./TxnEntityChanges";
101
- export { type TileTreeDiscloser, DisclosedTileTreeSet, type ReadGltfGraphicsArgs, type GltfGraphic, type GltfTemplate, readGltfGraphics, readGltfTemplate, readGltf, readElementGraphics, type BatchTableProperties, RealityTileTree, type RealityTileGeometry, RealityTile, type RenderGraphicTileTreeArgs, type GpuMemoryLimit, type GpuMemoryLimits, TileAdmin, type TileContent, type TiledGraphicsProvider, type TileDrawArgParams, TileDrawArgs, type CollectTileStatus, type TileGeometryCollectorOptions, TileGeometryCollector, type GeometryTileTreeReference, type TileParams, TileRequestChannels, type TileContentDecodingStatistics, TileRequestChannelStatistics, TileRequestChannel, TileRequest, type TileTreeOwner, type TileTreeParams, TileGraphicType, TileTreeReference, type TileTreeSupplier, TileTreeLoadStatus, TileTree, Tile, TileLoadStatus, TileVisibility, TileLoadPriority, TileBoundingBoxes, TileUsageMarker, TileUser, BingElevationProvider, QuadId, MapTilingScheme, GeographicTilingScheme, WebMercatorProjection, WebMercatorTilingScheme, type MapLayerIndex, MapTileProjection, MapTile, MapLayerTileTreeReference, MapLayerSourceStatus, type MapLayerSourceProps, MapLayerSource, MapLayerSources, MapLayerImageryProviderStatus, MapLayerImageryProvider, ImageryMapLayerFormat, MapLayerFormat, type ValidateSourceArgs, type MapLayerFormatType, type MapLayerSourceValidation, type MapLayerOptions, MapLayerFormatRegistry, type MapLayerTokenEndpoint, type MapLayerAuthenticationInfo, type MapLayerAccessToken, type MapLayerAccessTokenParams, type MapLayerAccessClient, type MapFeatureInfoOptions, MapFeatureInfoRecord, type MapFeatureInfo, type MapLayerFeatureInfo, type MapSubLayerFeatureInfo, type MapLayerFeature, type MapLayerFeatureGeometry, type MapLayerFeatureAttribute, MapLayerFeatureRecord, MapCartoRectangle, ImageryMapLayerTreeReference, EllipsoidTerrainProvider, getCesiumAssetUrl, MapTileTreeScaleRangeVisibility, MapTileTree, type TerrainMeshProviderOptions, type RequestMeshDataArgs, type ReadMeshArgs, TerrainMeshProvider, type TerrainProvider, TerrainProviderRegistry, } from "./tile/internal";
101
+ export { type TileTreeDiscloser, DisclosedTileTreeSet, type ReadGltfGraphicsArgs, type GltfGraphic, type GltfTemplate, readGltfGraphics, readGltfTemplate, readGltf, readElementGraphics, type BatchTableProperties, RealityTileTree, type RealityTileGeometry, RealityTile, type RenderGraphicTileTreeArgs, type GpuMemoryLimit, type GpuMemoryLimits, TileAdmin, type TileContent, type TiledGraphicsProvider, type TileDrawArgParams, TileDrawArgs, type CollectTileStatus, type TileGeometryCollectorOptions, TileGeometryCollector, type GeometryTileTreeReference, type TileParams, TileRequestChannels, type TileContentDecodingStatistics, TileRequestChannelStatistics, TileRequestChannel, TileRequest, type TileTreeOwner, type TileTreeParams, TileGraphicType, TileTreeReference, type TileTreeSupplier, TileTreeLoadStatus, TileTree, Tile, TileLoadStatus, TileVisibility, TileLoadPriority, TileBoundingBoxes, TileUsageMarker, TileUser, BingElevationProvider, QuadId, type QuadIdProps, MapTilingScheme, GeographicTilingScheme, WebMercatorProjection, WebMercatorTilingScheme, type MapLayerIndex, MapTileProjection, MapTile, MapLayerTileTreeReference, MapLayerSourceStatus, type MapLayerSourceProps, MapLayerSource, MapLayerSources, MapLayerImageryProviderStatus, MapLayerImageryProvider, ImageryMapLayerFormat, MapLayerFormat, type ValidateSourceArgs, type MapLayerFormatType, type MapLayerSourceValidation, type MapLayerOptions, MapLayerFormatRegistry, type MapLayerTokenEndpoint, type MapLayerAuthenticationInfo, type MapLayerAccessToken, type MapLayerAccessTokenParams, type MapLayerAccessClient, type MapFeatureInfoOptions, MapFeatureInfoRecord, type MapFeatureInfo, type MapLayerFeatureInfo, type MapSubLayerFeatureInfo, type MapLayerFeature, type MapLayerFeatureGeometry, type MapLayerFeatureAttribute, MapLayerFeatureRecord, MapCartoRectangle, ImageryMapLayerTreeReference, EllipsoidTerrainProvider, getCesiumAssetUrl, MapTileTreeScaleRangeVisibility, MapTileTree, type TerrainMeshProviderOptions, type RequestMeshDataArgs, type ReadMeshArgs, TerrainMeshProvider, type TerrainProvider, TerrainProviderRegistry, } from "./tile/internal";
102
102
  export * from "./tools/AccuDrawTool";
103
103
  export * from "./tools/AccuDrawViewportUI";
104
104
  export * from "./tools/ClipViewTool";
@@ -1 +1 @@
1
- {"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