@itwin/core-frontend 5.3.0 → 5.4.0-dev.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -1
- package/lib/cjs/BriefcaseConnection.d.ts.map +1 -1
- package/lib/cjs/BriefcaseConnection.js +1 -0
- package/lib/cjs/BriefcaseConnection.js.map +1 -1
- package/lib/cjs/SheetViewState.d.ts +7 -5
- package/lib/cjs/SheetViewState.d.ts.map +1 -1
- package/lib/cjs/SheetViewState.js +52 -683
- package/lib/cjs/SheetViewState.js.map +1 -1
- package/lib/cjs/SubCategoriesCache.d.ts +1 -0
- package/lib/cjs/SubCategoriesCache.d.ts.map +1 -1
- package/lib/cjs/SubCategoriesCache.js +40 -1
- package/lib/cjs/SubCategoriesCache.js.map +1 -1
- package/lib/cjs/internal/SheetViewAttachments.d.ts +57 -0
- package/lib/cjs/internal/SheetViewAttachments.d.ts.map +1 -0
- package/lib/cjs/internal/SheetViewAttachments.js +336 -0
- package/lib/cjs/internal/SheetViewAttachments.js.map +1 -0
- package/lib/cjs/internal/ViewAttachmentRenderer.d.ts +32 -0
- package/lib/cjs/internal/ViewAttachmentRenderer.d.ts.map +1 -0
- package/lib/cjs/internal/ViewAttachmentRenderer.js +462 -0
- package/lib/cjs/internal/ViewAttachmentRenderer.js.map +1 -0
- package/lib/cjs/internal/render/webgl/ShaderBuilder.d.ts.map +1 -1
- package/lib/cjs/internal/render/webgl/ShaderBuilder.js +8 -1
- package/lib/cjs/internal/render/webgl/ShaderBuilder.js.map +1 -1
- package/lib/esm/BriefcaseConnection.d.ts.map +1 -1
- package/lib/esm/BriefcaseConnection.js +1 -0
- package/lib/esm/BriefcaseConnection.js.map +1 -1
- package/lib/esm/SheetViewState.d.ts +7 -5
- package/lib/esm/SheetViewState.d.ts.map +1 -1
- package/lib/esm/SheetViewState.js +55 -686
- package/lib/esm/SheetViewState.js.map +1 -1
- package/lib/esm/SubCategoriesCache.d.ts +1 -0
- package/lib/esm/SubCategoriesCache.d.ts.map +1 -1
- package/lib/esm/SubCategoriesCache.js +40 -1
- package/lib/esm/SubCategoriesCache.js.map +1 -1
- package/lib/esm/internal/SheetViewAttachments.d.ts +57 -0
- package/lib/esm/internal/SheetViewAttachments.d.ts.map +1 -0
- package/lib/esm/internal/SheetViewAttachments.js +332 -0
- package/lib/esm/internal/SheetViewAttachments.js.map +1 -0
- package/lib/esm/internal/ViewAttachmentRenderer.d.ts +32 -0
- package/lib/esm/internal/ViewAttachmentRenderer.d.ts.map +1 -0
- package/lib/esm/internal/ViewAttachmentRenderer.js +459 -0
- package/lib/esm/internal/ViewAttachmentRenderer.js.map +1 -0
- package/lib/esm/internal/render/webgl/ShaderBuilder.d.ts.map +1 -1
- package/lib/esm/internal/render/webgl/ShaderBuilder.js +8 -1
- package/lib/esm/internal/render/webgl/ShaderBuilder.js.map +1 -1
- package/lib/public/scripts/parse-imdl-worker.js +1 -1
- package/lib/workers/webpack/parse-imdl-worker.js +1 -1
- package/package.json +20 -20
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SheetViewState.js","sourceRoot":"","sources":["../../src/SheetViewState.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,aAAa,EAAyB,MAAM,qBAAqB,CAAC;AAC/G,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,qBAAq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C;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, expectDefined, 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) => expectDefined(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, expectDefined(viewStateData.sheetProps), expectDefined(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 if (this._attachments === undefined)\n return super.secondaryViewports;\n\n const attachments = this._attachments;\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 = expectDefined(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,OAAO,EAAE,OAAO,EAAE,aAAa,EAAyB,MAAM,qBAAqB,CAAC;AAC7F,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAa,MAAM,sBAAsB,CAAC;AACtG,OAAO,EACa,QAAQ,EAAE,QAAQ,EAAE,aAAa,GAEpD,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAI1D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,OAAO,EAA2F,WAAW,EAAE,MAAM,aAAa,CAAC;AAGnI,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE,qBAAqB;AAErB;;GAEG;AACH,MAAM,WAAW;IACP,KAAK,CAAY;IACjB,OAAO,CAAY;IACnB,SAAS,CAAgB;IAEjC,YAAoB,IAAe,EAAE,MAAiB,EAAE,QAAuB;QAC7E,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,OAA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AgB,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAC3D,CAAC;IAED,YAAY;IACI,uBAAuB,CAAC,IAAiC;QACvE,iGAAiG;QACjG,oDAAoD;QACpD,OAAO,IAAI,CAAC,gBAAgB,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAC7D,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 { BeEvent, dispose, expectDefined, Id64Array, Id64String } from \"@itwin/core-bentley\";\nimport { Angle, Constant, Point2d, Point3d, Range2d, Range3d, Transform } from \"@itwin/core-geometry\";\nimport {\n AxisAlignedBox3d, ColorDef, Gradient, GraphicParams, HydrateViewStateRequestProps, HydrateViewStateResponseProps, SheetProps,\n ViewAttachmentProps, ViewDefinition2dProps, 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 { Frustum2d } from \"./Frustum2d\";\nimport { RenderMemory } from \"./render/RenderMemory\";\nimport { DecorateContext, SceneContext } from \"./ViewContext\";\nimport { Viewport } from \"./Viewport\";\nimport { AttachToViewportArgs, ComputeDisplayTransformArgs, GetAttachmentViewportArgs, ViewState, ViewState2d } from \"./ViewState\";\nimport { DrawingViewState } from \"./DrawingViewState\";\nimport { DisclosedTileTreeSet } from \"./tile/internal\";\nimport { GraphicType } from \"./common/render/GraphicType\";\nimport { SheetViewAttachments } from \"./internal/SheetViewAttachments\";\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/** 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 _viewAttachments: SheetViewAttachments;\n private readonly _viewedExtents: AxisAlignedBox3d;\n private _onViewAttachmentsReloaded: () => void = () => undefined;\n\n /** Strictly for tests. */\n public readonly onViewAttachmentsReloaded = new BeEvent<() => void>();\n\n public get attachmentIds(): readonly string[] {\n return this._viewAttachments.attachmentIds;\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, expectDefined(viewStateData.sheetProps), expectDefined(viewStateData.sheetAttachments));\n }\n\n public override toProps(): ViewStateProps {\n const props = super.toProps();\n\n props.sheetAttachments = [...this.attachmentIds];\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._viewAttachments.attachmentProps;\n }\n\n /** Strictly for testing. @internal */\n public get viewAttachmentInfos(): readonly Id64String[] | Array<{ attachedView: ViewState }> {\n return this._viewAttachments.attachmentInfos;\n }\n\n /** Strictly for testing. @internal */\n public get attachments(): object[] | undefined {\n return this._viewAttachments.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._viewAttachments = categories._viewAttachments.clone(iModel);\n this._viewedExtents = categories._viewedExtents.clone();\n } else {\n this.sheetSize = Point2d.create(sheetProps.width, sheetProps.height);\n this._viewAttachments = SheetViewAttachments.create(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 if (iModel.isBriefcaseConnection()) {\n iModel.txns.onElementsChanged.addListener(async (changes) => {\n let reload = false;\n for (const change of changes.filter({ includeMetadata: (meta) => meta.is(\"BisCore:ViewAttachment\")})) {\n if (change.type === \"inserted\" || this._viewAttachments.attachmentIds.includes(change.id)) {\n reload = true;\n break;\n }\n }\n\n if (reload) {\n await this._viewAttachments.reload(this.baseModelId, iModel);\n this._onViewAttachmentsReloaded();\n this.onViewAttachmentsReloaded.raiseEvent();\n }\n });\n }\n }\n\n public override getOrigin() {\n const origin = super.getOrigin();\n origin.z = -this._viewAttachments.maxDepth;\n return origin;\n }\n\n public override getExtents() {\n const extents = super.getExtents();\n extents.z = this._viewAttachments.maxDepth + Frustum2d.minimumZDistance;\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 trees.disclose(this._viewAttachments);\n }\n\n /** @internal */\n public override collectNonTileTreeStatistics(stats: RenderMemory.Statistics): void {\n super.collectNonTileTreeStatistics(stats);\n this._viewAttachments.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._viewAttachments.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._viewAttachments.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 this._viewAttachments.addToScene(context);\n }\n\n /** @internal */\n public override get secondaryViewports(): Iterable<Viewport> {\n return this._viewAttachments.getSecondaryViewports();\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\n const attachmentIds = await this.queryAttachmentIds();\n\n dispose(this._viewAttachments);\n this._viewAttachments = SheetViewAttachments.create(attachmentIds);\n }\n\n /** See [[ViewState.attachToViewport]]. */\n public override attachToViewport(args: AttachToViewportArgs): void {\n super.attachToViewport(args);\n this._viewAttachments.attachToViewport({\n backgroundColor: this.displayStyle.backgroundColor,\n sheetModelId: this.baseModelId,\n });\n\n this._onViewAttachmentsReloaded = () => args.invalidateController();\n }\n\n /** See [[ViewState.detachFromViewport]]. */\n public override detachFromViewport(): void {\n super.detachFromViewport();\n this._viewAttachments.detachFromViewport();\n this._onViewAttachmentsReloaded = () => undefined;\n }\n\n public override get areAllTileTreesLoaded(): boolean {\n if (!super.areAllTileTreesLoaded) {\n return false;\n }\n\n let displayedExtents = this._viewedExtents;\n const frustum = this.calculateFrustum();\n if (frustum) {\n displayedExtents = frustum.toRange();\n }\n\n return this._viewAttachments.areAllTileTreesLoaded(displayedExtents);\n }\n\n /** @internal Strictly for testing */\n public areAllAttachmentsLoaded(): boolean {\n return this._viewAttachments.areAllAttachmentsLoaded();\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 return this._viewAttachments.getAttachmentViewport(args);\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 return this._viewAttachments.computeDisplayTransform(args);\n }\n}\n"]}
|
|
@@ -24,6 +24,7 @@ export declare class SubCategoriesCache {
|
|
|
24
24
|
private readonly _imodel;
|
|
25
25
|
private _missingAtTimeOfPreload;
|
|
26
26
|
constructor(imodel: IModelConnection);
|
|
27
|
+
attachToBriefcase(imodel: IModelConnection): void;
|
|
27
28
|
/** Get the Ids of all subcategories belonging to the category with the specified Id, or undefined if no such information is present. */
|
|
28
29
|
getSubCategories(categoryId: string): Id64Set | undefined;
|
|
29
30
|
/** Get the base appearance of the subcategory with the specified Id, or undefined if no such information is present. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubCategoriesCache.d.ts","sourceRoot":"","sources":["../../src/SubCategoriesCache.ts"],"names":[],"mappings":"AAKA,OAAO,EAAmC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAuB,MAAM,qBAAqB,CAAC;AACzH,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,8EAA8E;IAC9E,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;IACrC;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACnC,2BAA2B;IAC3B,MAAM,IAAI,IAAI,CAAC;CAChB;AAID;;GAEG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA8B;IAC5D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA4C;IACzE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAC3C,OAAO,CAAC,uBAAuB,CAAsB;gBAElC,MAAM,EAAE,gBAAgB;
|
|
1
|
+
{"version":3,"file":"SubCategoriesCache.d.ts","sourceRoot":"","sources":["../../src/SubCategoriesCache.ts"],"names":[],"mappings":"AAKA,OAAO,EAAmC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAuB,MAAM,qBAAqB,CAAC;AACzH,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,8EAA8E;IAC9E,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;IACrC;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACnC,2BAA2B;IAC3B,MAAM,IAA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oCtB,OAAO,CAAC,QAAQ;KAgBjB;CACF"}
|
|
@@ -13,7 +13,46 @@ export class SubCategoriesCache {
|
|
|
13
13
|
_appearances = new Map();
|
|
14
14
|
_imodel;
|
|
15
15
|
_missingAtTimeOfPreload;
|
|
16
|
-
constructor(imodel) {
|
|
16
|
+
constructor(imodel) {
|
|
17
|
+
this._imodel = imodel;
|
|
18
|
+
}
|
|
19
|
+
attachToBriefcase(imodel) {
|
|
20
|
+
// We want to do this in the constructor but can't, because IModelConnection.subcategories is initialized before
|
|
21
|
+
// BriefcaseConnection.txns.
|
|
22
|
+
assert(imodel === this._imodel);
|
|
23
|
+
assert(imodel.isBriefcaseConnection());
|
|
24
|
+
imodel.txns.onElementsChanged.addListener((changes) => {
|
|
25
|
+
const affectedSubCategories = new Set();
|
|
26
|
+
for (const change of changes) {
|
|
27
|
+
if (change.metadata.is("BisCore:Category")) {
|
|
28
|
+
if (change.type === "deleted") {
|
|
29
|
+
this._byCategoryId.delete(change.id);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else if (change.metadata.is("BisCore:SubCategory")) {
|
|
33
|
+
if (change.type === "inserted") {
|
|
34
|
+
// We don't know to which category the subcategory belongs. Blow away the entire cache.
|
|
35
|
+
this._byCategoryId.clear();
|
|
36
|
+
this._appearances.clear();
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
this._appearances.delete(change.id);
|
|
40
|
+
affectedSubCategories.add(change.id);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (affectedSubCategories.size > 0) {
|
|
44
|
+
for (const [catId, subCatIds] of this._byCategoryId) {
|
|
45
|
+
for (const subCatId of affectedSubCategories) {
|
|
46
|
+
if (subCatIds.has(subCatId)) {
|
|
47
|
+
this._byCategoryId.delete(catId);
|
|
48
|
+
affectedSubCategories.delete(subCatId);
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
17
56
|
/** Get the Ids of all subcategories belonging to the category with the specified Id, or undefined if no such information is present. */
|
|
18
57
|
getSubCategories(categoryId) { return this._byCategoryId.get(categoryId); }
|
|
19
58
|
/** Get the base appearance of the subcategory with the specified Id, or undefined if no such information is present. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubCategoriesCache.js","sourceRoot":"","sources":["../../src/SubCategoriesCache.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,IAAI,EAAgC,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACzH,OAAO,EAAE,qBAAqB,EAAwB,MAAM,oBAAoB,CAAC;AAkBjF,MAAM,sBAAsB,GAAG,IAAI,GAAG,EAAU,CAAC;AAEjD;;GAEG;AACH,MAAM,OAAO,kBAAkB;IACZ,aAAa,GAAG,IAAI,GAAG,EAAmB,CAAC;IAC3C,YAAY,GAAG,IAAI,GAAG,EAAiC,CAAC;IACxD,OAAO,CAAmB;IACnC,uBAAuB,CAAsB;IAErD,YAAmB,MAAwB,IAAI,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC;IAEvE,wIAAwI;IACjI,gBAAgB,CAAC,UAAkB,IAAyB,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAE/G,wHAAwH;IACjH,wBAAwB,CAAC,aAAyB,IAAuC,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;IAEzJ;;;;OAIG;IACI,IAAI,CAAC,WAAoB;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAC7C,IAAI,SAAS,KAAK,OAAO;YACvB,OAAO,SAAS,CAAC;QAEnB,MAAM,OAAO,GAAG,IAAI,kBAAkB,CAAC,OAAO,CAAC,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------------------------------------------------------------------------------\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\nimport { assert, CompressedId64Set, Id64, Id64Arg, Id64Set, Id64String, OrderedId64Iterable } from \"@itwin/core-bentley\";\nimport { SubCategoryAppearance, SubCategoryResultRow } from \"@itwin/core-common\";\nimport { IModelConnection } from \"./IModelConnection\";\n\n/** A cancelable paginated request for subcategory information.\n * @see SubCategoriesCache\n * @internal\n */\nexport interface SubCategoriesRequest {\n /** The Ids of any categories which were requested but were not yet loaded. */\n readonly missingCategoryIds: Id64Set;\n /** A promise which resolves to true when all of the requested categories have been loaded, or to false if not all categories were loaded.\n * Categories may fail to load if the request is explicitly canceled or if the IModelConnection is closed before all categories are loaded.\n */\n readonly promise: Promise<boolean>;\n /** Cancels the request. */\n cancel(): void;\n}\n\nconst invalidCategoryIdEntry = new Set<string>();\n\n/** A cache of information about the subcategories contained within an [[IModelConnection]]. It is populated on demand.\n * @internal\n */\nexport class SubCategoriesCache {\n private readonly _byCategoryId = new Map<string, Id64Set>();\n private readonly _appearances = new Map<string, SubCategoryAppearance>();\n private readonly _imodel: IModelConnection;\n private _missingAtTimeOfPreload: Id64Set | undefined;\n\n public constructor(imodel: IModelConnection) { this._imodel = imodel; }\n\n /** Get the Ids of all subcategories belonging to the category with the specified Id, or undefined if no such information is present. */\n public getSubCategories(categoryId: string): Id64Set | undefined { return this._byCategoryId.get(categoryId); }\n\n /** Get the base appearance of the subcategory with the specified Id, or undefined if no such information is present. */\n public getSubCategoryAppearance(subCategoryId: Id64String): SubCategoryAppearance | undefined { return this._appearances.get(subCategoryId.toString()); }\n\n /** Request that the subcategory information for all of the specified categories is loaded.\n * If all such information has already been loaded, returns undefined.\n * Otherwise, dispatches an asynchronous request to load those categories which are not already loaded and returns a cancellable request object\n * containing the corresponding promise and the set of categories still to be loaded.\n */\n public load(categoryIds: Id64Arg): SubCategoriesRequest | undefined {\n const missing = this.getMissing(categoryIds);\n if (undefined === missing)\n return undefined;\n\n const request = new SubCategoriesCache.Request(missing, this._imodel);\n const promise = request.dispatch().then((result?: SubCategoriesCache.Result) => {\n if (undefined !== result)\n this.processResults(result, missing);\n\n return !request.wasCanceled;\n });\n return {\n missingCategoryIds: missing,\n promise,\n cancel: () => request.cancel(),\n };\n }\n\n /** Load all subcategories that come from used spatial categories of the iModel into the cache. */\n public async loadAllUsedSpatialSubCategories(): Promise<void> {\n try {\n const results = await this._imodel.queryAllUsedSpatialSubCategories();\n if (undefined !== results) {\n this.processResults(results, new Set<string>(), false);\n }\n } catch {\n // In case of a truncated response, gracefully handle the error and exit.\n }\n\n }\n /** Given categoryIds, return which of these are not cached. */\n private getMissing(categoryIds: Id64Arg): Id64Set | undefined {\n let missing: Id64Set | undefined;\n for (const catId of Id64.iterable(categoryIds)) {\n if (undefined === this._byCategoryId.get(catId)) {\n if (undefined === missing)\n missing = new Set<string>();\n\n missing.add(catId);\n }\n }\n\n return missing;\n }\n\n public clear(): void {\n this._byCategoryId.clear();\n this._appearances.clear();\n }\n\n public onIModelConnectionClose(): void {\n this.clear();\n }\n\n private static createSubCategoryAppearance(json?: any) {\n let props: SubCategoryAppearance.Props | undefined;\n if (\"string\" === typeof json && 0 < json.length)\n props = JSON.parse(json);\n\n return new SubCategoryAppearance(props);\n }\n\n private processResults(result: SubCategoriesCache.Result, missing: Id64Set, override: boolean = true): void {\n for (const row of result) {\n this.add(row.parentId, row.id, SubCategoriesCache.createSubCategoryAppearance(row.appearance), override);\n }\n\n // Ensure that any category Ids which returned no results (e.g., non-existent category, invalid Id, etc) are still recorded so they are not repeatedly re-requested\n for (const id of missing)\n if (undefined === this._byCategoryId.get(id))\n this._byCategoryId.set(id, invalidCategoryIdEntry);\n }\n\n /** Exposed strictly for tests.\n * @internal\n */\n public add(categoryId: string, subCategoryId: string, appearance: SubCategoryAppearance, override: boolean) {\n let set = this._byCategoryId.get(categoryId);\n if (undefined === set)\n this._byCategoryId.set(categoryId, set = new Set<string>());\n\n set.add(subCategoryId);\n if (override || !this._appearances.has(subCategoryId))\n this._appearances.set(subCategoryId, appearance);\n }\n\n public async getCategoryInfo(inputCategoryIds: Id64String | Iterable<Id64String>): Promise<Map<Id64String, IModelConnection.Categories.CategoryInfo>> {\n // Eliminate duplicates...\n const categoryIds = new Set<string>(typeof inputCategoryIds === \"string\" ? [inputCategoryIds] : inputCategoryIds);\n const req = this.load(categoryIds);\n if (req)\n await req.promise;\n\n const map = new Map<Id64String, IModelConnection.Categories.CategoryInfo>();\n for (const categoryId of categoryIds) {\n const subCategoryIds = this._byCategoryId.get(categoryId);\n if (!subCategoryIds)\n continue;\n\n const subCategories = this.mapSubCategoryInfos(categoryId, subCategoryIds);\n map.set(categoryId, { id: categoryId, subCategories });\n }\n\n return map;\n }\n\n public async getSubCategoryInfo(categoryId: Id64String, inputSubCategoryIds: Id64String | Iterable<Id64String>): Promise<Map<Id64String, IModelConnection.Categories.SubCategoryInfo>> {\n // Eliminate duplicates...\n const subCategoryIds = new Set<string>(typeof inputSubCategoryIds === \"string\" ? [inputSubCategoryIds] : inputSubCategoryIds);\n const req = this.load(categoryId);\n if (req)\n await req.promise;\n\n return this.mapSubCategoryInfos(categoryId, subCategoryIds);\n }\n\n private mapSubCategoryInfos(categoryId: Id64String, subCategoryIds: Set<Id64String>): Map<Id64String, IModelConnection.Categories.SubCategoryInfo> {\n const map = new Map<Id64String, IModelConnection.Categories.SubCategoryInfo>();\n for (const id of subCategoryIds) {\n const appearance = this._appearances.get(id);\n if (appearance)\n map.set(id, { id, categoryId, appearance });\n }\n\n return map;\n }\n}\n\n/** This namespace and the types within it are exported strictly for use in tests.\n * @internal\n */\nexport namespace SubCategoriesCache {\n export type Result = SubCategoryResultRow[];\n\n export class Request {\n private readonly _imodel: IModelConnection;\n private readonly _categoryIds: CompressedId64Set[] = [];\n private readonly _result: Result = [];\n private _canceled = false;\n private _curCategoryIdsIndex = 0;\n\n public get wasCanceled() { return this._canceled || this._imodel.isClosed; }\n\n public constructor(categoryIds: Set<string>, imodel: IModelConnection, maxCategoriesPerQuery = 2500) {\n this._imodel = imodel;\n\n const catIds = [...categoryIds];\n OrderedId64Iterable.sortArray(catIds); // sort categories, so that given the same set of categoryIds we will always create the same batches.\n while (catIds.length !== 0) {\n const end = (catIds.length > maxCategoriesPerQuery) ? maxCategoriesPerQuery : catIds.length;\n const compressedIds = CompressedId64Set.compressArray(catIds.splice(0, end));\n this._categoryIds.push(compressedIds);\n }\n }\n\n public cancel() { this._canceled = true; }\n\n public async dispatch(): Promise<Result | undefined> {\n if (this.wasCanceled || this._curCategoryIdsIndex >= this._categoryIds.length) // handle case of empty category Id set...\n return undefined;\n\n try {\n const catIds = this._categoryIds[this._curCategoryIdsIndex];\n const result = await this._imodel.querySubCategories(catIds);\n this._result.push(...result);\n if (this.wasCanceled)\n return undefined;\n } catch {\n // ###TODO: detect cases in which retry is warranted\n // Note that currently, if we succeed in obtaining some pages of results and fail to retrieve another page, we will end up processing the\n // incomplete results. Since we're not retrying, that's the best we can do.\n }\n\n // Finished with current batch of categoryIds. Dispatch the next batch if one exists.\n if (++this._curCategoryIdsIndex < this._categoryIds.length) {\n if (this.wasCanceled)\n return undefined;\n else\n return this.dispatch();\n }\n\n // Even if we were canceled, we've retrieved all the rows. Might as well process them to prevent another request for some of the same rows from being enqueued.\n return this._result;\n }\n }\n\n export type QueueFunc = (anySubCategoriesLoaded: boolean) => void;\n\n export class QueueEntry {\n public readonly categoryIds: Id64Set;\n public readonly funcs: QueueFunc[];\n\n public constructor(categoryIds: Id64Set, func: QueueFunc) {\n this.categoryIds = categoryIds;\n this.funcs = [func];\n }\n }\n\n /** A \"queue\" of SubCategoriesRequests, which consists of between 0 and 2 entries. Each entry specifies the set of category IDs to be loaded and a list of functions to be executed\n * when loading is completed. This is used to enforce ordering of operations upon subcategories despite the need to asynchronously load them. It incidentally also provides an\n * opportunity to reduce the number of backend requests by batching consecutive requests.\n * Chiefly used by [[Viewport]].\n * @internal\n */\n export class Queue {\n /* NB: Members marked protected for use in tests only. */\n protected _current?: QueueEntry;\n protected _next?: QueueEntry;\n protected _request?: SubCategoriesRequest;\n protected _disposed = false;\n\n /** Push a request onto the queue. The requested categories will be loaded if necessary, and then\n * the supplied function will be invoked. Any previously-pushed requests are guaranteed to be processed before this one.\n */\n public push(cache: SubCategoriesCache, categoryIds: Id64Arg, func: QueueFunc): void {\n if (this._disposed)\n return;\n else if (undefined === this._current)\n this.pushCurrent(cache, categoryIds, func);\n else\n this.pushNext(categoryIds, func);\n }\n\n /** Cancel all requests and empty the queue. */\n public [Symbol.dispose](): void {\n if (undefined !== this._request) {\n assert(undefined !== this._current);\n this._request.cancel();\n this._request = undefined;\n }\n\n this._current = this._next = undefined;\n this._disposed = true;\n }\n\n public get isEmpty(): boolean {\n return undefined === this._current && undefined === this._next;\n }\n\n private pushCurrent(cache: SubCategoriesCache, categoryIds: Id64Arg, func: QueueFunc): void {\n assert(undefined === this._next);\n assert(undefined === this._current);\n assert(undefined === this._request);\n\n this._request = cache.load(categoryIds);\n if (undefined === this._request) {\n // All requested categories are already loaded.\n func(false);\n return;\n } else {\n // We need to load the requested categories before invoking the function.\n this.processCurrent(cache, new QueueEntry(Id64.toIdSet(categoryIds, true), func));\n }\n }\n\n private processCurrent(cache: SubCategoriesCache, entry: QueueEntry): void {\n assert(undefined !== this._request);\n assert(undefined === this._current);\n assert(undefined === this._next);\n\n this._current = entry;\n this._request.promise.then((completed: boolean) => { // eslint-disable-line @typescript-eslint/no-floating-promises\n if (this._disposed)\n return;\n\n // Invoke all the functions which were awaiting this set of IModelConnection.Categories.\n assert(undefined !== this._current);\n if (completed)\n for (const func of this._current.funcs)\n func(true);\n\n this._request = undefined;\n this._current = undefined;\n\n // If we have more requests, process them.\n const next = this._next;\n this._next = undefined;\n if (undefined !== next) {\n this._request = cache.load(next.categoryIds);\n if (undefined === this._request) {\n // All categories loaded.\n for (const func of next.funcs)\n func(true);\n } else {\n // We need to load the requested categories before invoking the pending functions.\n this.processCurrent(cache, next);\n }\n }\n });\n }\n\n private pushNext(categoryIds: Id64Arg, func: QueueFunc): void {\n assert(undefined !== this._current);\n assert(undefined !== this._request);\n\n if (undefined === this._next) {\n // We have a request currently in process and none pending.\n // We could potentially determine that this request doesn't require any categories that are not already loaded or being loaded by the current request.\n // But we will find that out (synchronously) when current request completes, unless more requests come in. Probably not worth it.\n this._next = new QueueEntry(Id64.toIdSet(categoryIds, true), func);\n } else {\n // We have a request currently in process, and one or more pending. Append this one to the pending.\n this._next.funcs.push(func);\n for (const categoryId of Id64.iterable(categoryIds))\n this._next.categoryIds.add(categoryId);\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SubCategoriesCache.js","sourceRoot":"","sources":["../../src/SubCategoriesCache.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,IAAI,EAAgC,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACzH,OAAO,EAAE,qBAAqB,EAAwB,MAAM,oBAAoB,CAAC;AAkBjF,MAAM,sBAAsB,GAAG,IAAI,GAAG,EAAU,CAAC;AAEjD;;GAEG;AACH,MAAM,OAAO,kBAAkB;IACZ,aAAa,GAAG,IAAI,GAAG,EAAmB,CAAC;IAC3C,YAAY,GAAG,IAAI,GAAG,EAAiC,CAAC;IACxD,OAAO,CAAmB;IACnC,uBAAuB,CAAsB;IAErD,YAAmB,MAAwB;QACzC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAEM,iBAAiB,CAAC,MAAwB;QAC/C,gHAAgH;QAChH,4BAA4B;QAC5B,MAAM,CAAC,MAAM,KAAK,IAAI,CAAC,OAAO,CAAC,CAAC;QAChC,MAAM,CAAC,MAAM,CAAC,qBAAqB,EAAE,CAAC,CAAC;QACvC,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE,EAAE;YACpD,MAA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,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;YACrE,CAAC;iBAAM,CAAC;gBACN,mGAAmG;gBACnG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC5B,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;oBACjD,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC;KACF;IAvGY,wBAAK,QAuGjB,CAAA;AACH,CAAC,EAjLgB,kBAAkB,KAAlB,kBAAkB,QAiLlC","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\nimport { assert, CompressedId64Set, Id64, Id64Arg, Id64Set, Id64String, OrderedId64Iterable } from \"@itwin/core-bentley\";\nimport { SubCategoryAppearance, SubCategoryResultRow } from \"@itwin/core-common\";\nimport { IModelConnection } from \"./IModelConnection\";\n\n/** A cancelable paginated request for subcategory information.\n * @see SubCategoriesCache\n * @internal\n */\nexport interface SubCategoriesRequest {\n /** The Ids of any categories which were requested but were not yet loaded. */\n readonly missingCategoryIds: Id64Set;\n /** A promise which resolves to true when all of the requested categories have been loaded, or to false if not all categories were loaded.\n * Categories may fail to load if the request is explicitly canceled or if the IModelConnection is closed before all categories are loaded.\n */\n readonly promise: Promise<boolean>;\n /** Cancels the request. */\n cancel(): void;\n}\n\nconst invalidCategoryIdEntry = new Set<string>();\n\n/** A cache of information about the subcategories contained within an [[IModelConnection]]. It is populated on demand.\n * @internal\n */\nexport class SubCategoriesCache {\n private readonly _byCategoryId = new Map<string, Id64Set>();\n private readonly _appearances = new Map<string, SubCategoryAppearance>();\n private readonly _imodel: IModelConnection;\n private _missingAtTimeOfPreload: Id64Set | undefined;\n\n public constructor(imodel: IModelConnection) {\n this._imodel = imodel;\n }\n\n public attachToBriefcase(imodel: IModelConnection): void {\n // We want to do this in the constructor but can't, because IModelConnection.subcategories is initialized before\n // BriefcaseConnection.txns.\n assert(imodel === this._imodel);\n assert(imodel.isBriefcaseConnection());\n imodel.txns.onElementsChanged.addListener((changes) => {\n const affectedSubCategories = new Set<string>();\n for (const change of changes) {\n if (change.metadata.is(\"BisCore:Category\")) {\n if (change.type === \"deleted\") {\n this._byCategoryId.delete(change.id);\n }\n } else if (change.metadata.is(\"BisCore:SubCategory\")) {\n if (change.type === \"inserted\") {\n // We don't know to which category the subcategory belongs. Blow away the entire cache.\n this._byCategoryId.clear();\n this._appearances.clear();\n return;\n }\n\n this._appearances.delete(change.id);\n affectedSubCategories.add(change.id);\n }\n }\n\n if (affectedSubCategories.size > 0) {\n for (const [catId, subCatIds] of this._byCategoryId) {\n for (const subCatId of affectedSubCategories) {\n if (subCatIds.has(subCatId)) {\n this._byCategoryId.delete(catId);\n affectedSubCategories.delete(subCatId);\n break;\n }\n }\n }\n }\n });\n }\n /** Get the Ids of all subcategories belonging to the category with the specified Id, or undefined if no such information is present. */\n public getSubCategories(categoryId: string): Id64Set | undefined { return this._byCategoryId.get(categoryId); }\n\n /** Get the base appearance of the subcategory with the specified Id, or undefined if no such information is present. */\n public getSubCategoryAppearance(subCategoryId: Id64String): SubCategoryAppearance | undefined { return this._appearances.get(subCategoryId.toString()); }\n\n /** Request that the subcategory information for all of the specified categories is loaded.\n * If all such information has already been loaded, returns undefined.\n * Otherwise, dispatches an asynchronous request to load those categories which are not already loaded and returns a cancellable request object\n * containing the corresponding promise and the set of categories still to be loaded.\n */\n public load(categoryIds: Id64Arg): SubCategoriesRequest | undefined {\n const missing = this.getMissing(categoryIds);\n if (undefined === missing)\n return undefined;\n\n const request = new SubCategoriesCache.Request(missing, this._imodel);\n const promise = request.dispatch().then((result?: SubCategoriesCache.Result) => {\n if (undefined !== result)\n this.processResults(result, missing);\n\n return !request.wasCanceled;\n });\n return {\n missingCategoryIds: missing,\n promise,\n cancel: () => request.cancel(),\n };\n }\n\n /** Load all subcategories that come from used spatial categories of the iModel into the cache. */\n public async loadAllUsedSpatialSubCategories(): Promise<void> {\n try {\n const results = await this._imodel.queryAllUsedSpatialSubCategories();\n if (undefined !== results) {\n this.processResults(results, new Set<string>(), false);\n }\n } catch {\n // In case of a truncated response, gracefully handle the error and exit.\n }\n\n }\n /** Given categoryIds, return which of these are not cached. */\n private getMissing(categoryIds: Id64Arg): Id64Set | undefined {\n let missing: Id64Set | undefined;\n for (const catId of Id64.iterable(categoryIds)) {\n if (undefined === this._byCategoryId.get(catId)) {\n if (undefined === missing)\n missing = new Set<string>();\n\n missing.add(catId);\n }\n }\n\n return missing;\n }\n\n public clear(): void {\n this._byCategoryId.clear();\n this._appearances.clear();\n }\n\n public onIModelConnectionClose(): void {\n this.clear();\n }\n\n private static createSubCategoryAppearance(json?: any) {\n let props: SubCategoryAppearance.Props | undefined;\n if (\"string\" === typeof json && 0 < json.length)\n props = JSON.parse(json);\n\n return new SubCategoryAppearance(props);\n }\n\n private processResults(result: SubCategoriesCache.Result, missing: Id64Set, override: boolean = true): void {\n for (const row of result) {\n this.add(row.parentId, row.id, SubCategoriesCache.createSubCategoryAppearance(row.appearance), override);\n }\n\n // Ensure that any category Ids which returned no results (e.g., non-existent category, invalid Id, etc) are still recorded so they are not repeatedly re-requested\n for (const id of missing)\n if (undefined === this._byCategoryId.get(id))\n this._byCategoryId.set(id, invalidCategoryIdEntry);\n }\n\n /** Exposed strictly for tests.\n * @internal\n */\n public add(categoryId: string, subCategoryId: string, appearance: SubCategoryAppearance, override: boolean) {\n let set = this._byCategoryId.get(categoryId);\n if (undefined === set)\n this._byCategoryId.set(categoryId, set = new Set<string>());\n\n set.add(subCategoryId);\n if (override || !this._appearances.has(subCategoryId))\n this._appearances.set(subCategoryId, appearance);\n }\n\n public async getCategoryInfo(inputCategoryIds: Id64String | Iterable<Id64String>): Promise<Map<Id64String, IModelConnection.Categories.CategoryInfo>> {\n // Eliminate duplicates...\n const categoryIds = new Set<string>(typeof inputCategoryIds === \"string\" ? [inputCategoryIds] : inputCategoryIds);\n const req = this.load(categoryIds);\n if (req)\n await req.promise;\n\n const map = new Map<Id64String, IModelConnection.Categories.CategoryInfo>();\n for (const categoryId of categoryIds) {\n const subCategoryIds = this._byCategoryId.get(categoryId);\n if (!subCategoryIds)\n continue;\n\n const subCategories = this.mapSubCategoryInfos(categoryId, subCategoryIds);\n map.set(categoryId, { id: categoryId, subCategories });\n }\n\n return map;\n }\n\n public async getSubCategoryInfo(categoryId: Id64String, inputSubCategoryIds: Id64String | Iterable<Id64String>): Promise<Map<Id64String, IModelConnection.Categories.SubCategoryInfo>> {\n // Eliminate duplicates...\n const subCategoryIds = new Set<string>(typeof inputSubCategoryIds === \"string\" ? [inputSubCategoryIds] : inputSubCategoryIds);\n const req = this.load(categoryId);\n if (req)\n await req.promise;\n\n return this.mapSubCategoryInfos(categoryId, subCategoryIds);\n }\n\n private mapSubCategoryInfos(categoryId: Id64String, subCategoryIds: Set<Id64String>): Map<Id64String, IModelConnection.Categories.SubCategoryInfo> {\n const map = new Map<Id64String, IModelConnection.Categories.SubCategoryInfo>();\n for (const id of subCategoryIds) {\n const appearance = this._appearances.get(id);\n if (appearance)\n map.set(id, { id, categoryId, appearance });\n }\n\n return map;\n }\n}\n\n/** This namespace and the types within it are exported strictly for use in tests.\n * @internal\n */\nexport namespace SubCategoriesCache {\n export type Result = SubCategoryResultRow[];\n\n export class Request {\n private readonly _imodel: IModelConnection;\n private readonly _categoryIds: CompressedId64Set[] = [];\n private readonly _result: Result = [];\n private _canceled = false;\n private _curCategoryIdsIndex = 0;\n\n public get wasCanceled() { return this._canceled || this._imodel.isClosed; }\n\n public constructor(categoryIds: Set<string>, imodel: IModelConnection, maxCategoriesPerQuery = 2500) {\n this._imodel = imodel;\n\n const catIds = [...categoryIds];\n OrderedId64Iterable.sortArray(catIds); // sort categories, so that given the same set of categoryIds we will always create the same batches.\n while (catIds.length !== 0) {\n const end = (catIds.length > maxCategoriesPerQuery) ? maxCategoriesPerQuery : catIds.length;\n const compressedIds = CompressedId64Set.compressArray(catIds.splice(0, end));\n this._categoryIds.push(compressedIds);\n }\n }\n\n public cancel() { this._canceled = true; }\n\n public async dispatch(): Promise<Result | undefined> {\n if (this.wasCanceled || this._curCategoryIdsIndex >= this._categoryIds.length) // handle case of empty category Id set...\n return undefined;\n\n try {\n const catIds = this._categoryIds[this._curCategoryIdsIndex];\n const result = await this._imodel.querySubCategories(catIds);\n this._result.push(...result);\n if (this.wasCanceled)\n return undefined;\n } catch {\n // ###TODO: detect cases in which retry is warranted\n // Note that currently, if we succeed in obtaining some pages of results and fail to retrieve another page, we will end up processing the\n // incomplete results. Since we're not retrying, that's the best we can do.\n }\n\n // Finished with current batch of categoryIds. Dispatch the next batch if one exists.\n if (++this._curCategoryIdsIndex < this._categoryIds.length) {\n if (this.wasCanceled)\n return undefined;\n else\n return this.dispatch();\n }\n\n // Even if we were canceled, we've retrieved all the rows. Might as well process them to prevent another request for some of the same rows from being enqueued.\n return this._result;\n }\n }\n\n export type QueueFunc = (anySubCategoriesLoaded: boolean) => void;\n\n export class QueueEntry {\n public readonly categoryIds: Id64Set;\n public readonly funcs: QueueFunc[];\n\n public constructor(categoryIds: Id64Set, func: QueueFunc) {\n this.categoryIds = categoryIds;\n this.funcs = [func];\n }\n }\n\n /** A \"queue\" of SubCategoriesRequests, which consists of between 0 and 2 entries. Each entry specifies the set of category IDs to be loaded and a list of functions to be executed\n * when loading is completed. This is used to enforce ordering of operations upon subcategories despite the need to asynchronously load them. It incidentally also provides an\n * opportunity to reduce the number of backend requests by batching consecutive requests.\n * Chiefly used by [[Viewport]].\n * @internal\n */\n export class Queue {\n /* NB: Members marked protected for use in tests only. */\n protected _current?: QueueEntry;\n protected _next?: QueueEntry;\n protected _request?: SubCategoriesRequest;\n protected _disposed = false;\n\n /** Push a request onto the queue. The requested categories will be loaded if necessary, and then\n * the supplied function will be invoked. Any previously-pushed requests are guaranteed to be processed before this one.\n */\n public push(cache: SubCategoriesCache, categoryIds: Id64Arg, func: QueueFunc): void {\n if (this._disposed)\n return;\n else if (undefined === this._current)\n this.pushCurrent(cache, categoryIds, func);\n else\n this.pushNext(categoryIds, func);\n }\n\n /** Cancel all requests and empty the queue. */\n public [Symbol.dispose](): void {\n if (undefined !== this._request) {\n assert(undefined !== this._current);\n this._request.cancel();\n this._request = undefined;\n }\n\n this._current = this._next = undefined;\n this._disposed = true;\n }\n\n public get isEmpty(): boolean {\n return undefined === this._current && undefined === this._next;\n }\n\n private pushCurrent(cache: SubCategoriesCache, categoryIds: Id64Arg, func: QueueFunc): void {\n assert(undefined === this._next);\n assert(undefined === this._current);\n assert(undefined === this._request);\n\n this._request = cache.load(categoryIds);\n if (undefined === this._request) {\n // All requested categories are already loaded.\n func(false);\n return;\n } else {\n // We need to load the requested categories before invoking the function.\n this.processCurrent(cache, new QueueEntry(Id64.toIdSet(categoryIds, true), func));\n }\n }\n\n private processCurrent(cache: SubCategoriesCache, entry: QueueEntry): void {\n assert(undefined !== this._request);\n assert(undefined === this._current);\n assert(undefined === this._next);\n\n this._current = entry;\n this._request.promise.then((completed: boolean) => { // eslint-disable-line @typescript-eslint/no-floating-promises\n if (this._disposed)\n return;\n\n // Invoke all the functions which were awaiting this set of IModelConnection.Categories.\n assert(undefined !== this._current);\n if (completed)\n for (const func of this._current.funcs)\n func(true);\n\n this._request = undefined;\n this._current = undefined;\n\n // If we have more requests, process them.\n const next = this._next;\n this._next = undefined;\n if (undefined !== next) {\n this._request = cache.load(next.categoryIds);\n if (undefined === this._request) {\n // All categories loaded.\n for (const func of next.funcs)\n func(true);\n } else {\n // We need to load the requested categories before invoking the pending functions.\n this.processCurrent(cache, next);\n }\n }\n });\n }\n\n private pushNext(categoryIds: Id64Arg, func: QueueFunc): void {\n assert(undefined !== this._current);\n assert(undefined !== this._request);\n\n if (undefined === this._next) {\n // We have a request currently in process and none pending.\n // We could potentially determine that this request doesn't require any categories that are not already loaded or being loaded by the current request.\n // But we will find that out (synchronously) when current request completes, unless more requests come in. Probably not worth it.\n this._next = new QueueEntry(Id64.toIdSet(categoryIds, true), func);\n } else {\n // We have a request currently in process, and one or more pending. Append this one to the pending.\n this._next.funcs.push(func);\n for (const categoryId of Id64.iterable(categoryIds))\n this._next.categoryIds.add(categoryId);\n }\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Views
|
|
3
|
+
*/
|
|
4
|
+
import { ColorDef, HydrateViewStateRequestProps, HydrateViewStateResponseProps, ViewAttachmentProps } from "@itwin/core-common";
|
|
5
|
+
import { ComputeDisplayTransformArgs, GetAttachmentViewportArgs, ViewState } from "../ViewState";
|
|
6
|
+
import { Id64String } from "@itwin/core-bentley";
|
|
7
|
+
import { IModelConnection } from "../IModelConnection";
|
|
8
|
+
import { Range3d, Transform } from "@itwin/core-geometry";
|
|
9
|
+
import { SceneContext } from "../ViewContext";
|
|
10
|
+
import { Viewport } from "../Viewport";
|
|
11
|
+
import { RenderMemory } from "../render/RenderMemory";
|
|
12
|
+
import { DisclosedTileTreeSet } from "../tile/internal";
|
|
13
|
+
/** Manages the set of ViewAttachment elements to be rendered by a SheetViewState.
|
|
14
|
+
* Takes care of reloading them after ViewAttachment elements are modified, deleted, or inserted.
|
|
15
|
+
*/
|
|
16
|
+
export declare class SheetViewAttachments implements Disposable {
|
|
17
|
+
private _impl;
|
|
18
|
+
private _reload?;
|
|
19
|
+
private _maxDepth;
|
|
20
|
+
private _rendererArgs?;
|
|
21
|
+
private _renderers?;
|
|
22
|
+
get maxDepth(): number;
|
|
23
|
+
getSecondaryViewports(): Iterable<Viewport>;
|
|
24
|
+
private constructor();
|
|
25
|
+
[Symbol.dispose](): void;
|
|
26
|
+
static create(attachmentIds: Id64String[]): SheetViewAttachments;
|
|
27
|
+
get attachmentIds(): readonly string[];
|
|
28
|
+
clone(iModel: IModelConnection): SheetViewAttachments;
|
|
29
|
+
preload(request: HydrateViewStateRequestProps): void;
|
|
30
|
+
postload(response: HydrateViewStateResponseProps, iModel: IModelConnection): Promise<void>;
|
|
31
|
+
reload(sheetModelId: Id64String, iModel: IModelConnection): Promise<void>;
|
|
32
|
+
attachToViewport(args: {
|
|
33
|
+
backgroundColor: ColorDef;
|
|
34
|
+
sheetModelId: Id64String;
|
|
35
|
+
}): void;
|
|
36
|
+
detachFromViewport(): void;
|
|
37
|
+
areAllTileTreesLoaded(displayedExtents: Range3d): boolean;
|
|
38
|
+
discloseTileTrees(trees: DisclosedTileTreeSet): void;
|
|
39
|
+
collectStatistics(stats: RenderMemory.Statistics): void;
|
|
40
|
+
addToScene(context: SceneContext): void;
|
|
41
|
+
getAttachmentViewport(args: GetAttachmentViewportArgs): Viewport | undefined;
|
|
42
|
+
computeDisplayTransform(args: ComputeDisplayTransformArgs): Transform | undefined;
|
|
43
|
+
/** Strictly for tests. */
|
|
44
|
+
areAllAttachmentsLoaded(): boolean;
|
|
45
|
+
/** Strictly for tests. */
|
|
46
|
+
get attachments(): object[] | undefined;
|
|
47
|
+
/** Strictly for tests. */
|
|
48
|
+
get attachmentProps(): Array<Readonly<ViewAttachmentProps>>;
|
|
49
|
+
/** Strictly for tests. */
|
|
50
|
+
get attachmentInfos(): readonly Id64String[] | Array<{
|
|
51
|
+
attachedView: ViewState;
|
|
52
|
+
}>;
|
|
53
|
+
private loadRenderers;
|
|
54
|
+
private renderers;
|
|
55
|
+
private findRendererById;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=SheetViewAttachments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SheetViewAttachments.d.ts","sourceRoot":"","sources":["../../../src/internal/SheetViewAttachments.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,4BAA4B,EAAE,6BAA6B,EAAe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