@itwin/core-frontend 4.10.0-dev.27 → 4.10.0-dev.29

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.
Files changed (37) hide show
  1. package/lib/cjs/DrawingViewState.d.ts +7 -2
  2. package/lib/cjs/DrawingViewState.d.ts.map +1 -1
  3. package/lib/cjs/DrawingViewState.js +18 -6
  4. package/lib/cjs/DrawingViewState.js.map +1 -1
  5. package/lib/cjs/HitDetail.d.ts +6 -7
  6. package/lib/cjs/HitDetail.d.ts.map +1 -1
  7. package/lib/cjs/HitDetail.js +1 -2
  8. package/lib/cjs/HitDetail.js.map +1 -1
  9. package/lib/cjs/ViewState.d.ts +6 -2
  10. package/lib/cjs/ViewState.d.ts.map +1 -1
  11. package/lib/cjs/ViewState.js +3 -1
  12. package/lib/cjs/ViewState.js.map +1 -1
  13. package/lib/cjs/render/GraphicBranch.d.ts +1 -1
  14. package/lib/cjs/render/GraphicBranch.js.map +1 -1
  15. package/lib/cjs/render/Pixel.d.ts +3 -1
  16. package/lib/cjs/render/Pixel.d.ts.map +1 -1
  17. package/lib/cjs/render/Pixel.js.map +1 -1
  18. package/lib/esm/DrawingViewState.d.ts +7 -2
  19. package/lib/esm/DrawingViewState.d.ts.map +1 -1
  20. package/lib/esm/DrawingViewState.js +18 -6
  21. package/lib/esm/DrawingViewState.js.map +1 -1
  22. package/lib/esm/HitDetail.d.ts +6 -7
  23. package/lib/esm/HitDetail.d.ts.map +1 -1
  24. package/lib/esm/HitDetail.js +1 -2
  25. package/lib/esm/HitDetail.js.map +1 -1
  26. package/lib/esm/ViewState.d.ts +6 -2
  27. package/lib/esm/ViewState.d.ts.map +1 -1
  28. package/lib/esm/ViewState.js +3 -1
  29. package/lib/esm/ViewState.js.map +1 -1
  30. package/lib/esm/render/GraphicBranch.d.ts +1 -1
  31. package/lib/esm/render/GraphicBranch.js.map +1 -1
  32. package/lib/esm/render/Pixel.d.ts +3 -1
  33. package/lib/esm/render/Pixel.d.ts.map +1 -1
  34. package/lib/esm/render/Pixel.js.map +1 -1
  35. package/lib/public/scripts/parse-imdl-worker.js +1 -1
  36. package/lib/workers/webpack/parse-imdl-worker.js +1 -1
  37. package/package.json +18 -18
@@ -113,7 +113,7 @@ export interface GraphicBranchOptions {
113
113
  appearanceProvider?: FeatureAppearanceProvider;
114
114
  /** @internal Secondary planar classifiers (map layers) */
115
115
  secondaryClassifiers?: Map<number, RenderPlanarClassifier>;
116
- /** The Id of the [ViewAttachment]($backend) from which this branch's graphics originated.
116
+ /** See HitDetail.viewAttachmentId.
117
117
  * @internal
118
118
  */
119
119
  viewAttachmentId?: Id64String;
@@ -1 +1 @@
1
- {"version":3,"file":"GraphicBranch.js","sourceRoot":"","sources":["../../../src/render/GraphicBranch.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,YAAY,EAA2B,MAAM,qBAAqB,CAAC;AAK5E,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAqBzC;;;;;;;GAOG;AACH,MAAM,OAAO,aAAa;IAqCxB;;OAEG;IACH,YAAmB,cAAuB,KAAK;QAvC/C,qCAAqC;QACrB,YAAO,GAAoB,EAAE,CAAC;QAG9C;;WAEG;QACI,sBAAiB,GAAsB,EAAE,CAAC;QAiC/C,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED,oCAAoC;IAC7B,GAAG,CAAC,OAAsB;QAC/B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACI,YAAY,CAAC,KAAgB;QAClC,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAChD,CAAC;IAED,uFAAuF;IAChF,YAAY,CAAC,KAAgB;QAClC,IAAI,CAAC,iBAAiB,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC;IACxC,CAAC;IAED,oCAAoC;I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AAYD,gBAAgB;AAChB,MAAM,KAAW,qBAAqB,CAqBrC;AArBD,WAAiB,qBAAqB;IACpC,SAAgB,UAAU,CAAC,MAA6B,EAAE,IAAY;QACpE,IAAI,CAAC,MAAM,CAAC,qBAAqB,IAAI,CAAC,MAAM,CAAC,gBAAgB;YAC3D,OAAO,SAAS,CAAC;QAEnB,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAgC,CAAC;QACzD,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC;YAC1C,kBAAkB,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;YAC7D,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,gBAAgB,EAAE,CAAC;gBAC1C,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;oBAC/B,QAAQ,CAAC,GAAG,CAAC,uBAAuB,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;;oBAEnF,kBAAkB,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;YAC1E,CAAC;QACH,CAAC;QAED,OAAO;YACL,YAAY,EAAE,QAAQ;YACtB,gBAAgB,EAAE,MAAM,CAAC,iBAAiB;SAC3C,CAAC;IACJ,CAAC;IAnBe,gCAAU,aAmBzB,CAAA;AACH,CAAC,EArBgB,qBAAqB,KAArB,qBAAqB,QAqBrC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Rendering\r\n */\r\n\r\nimport { disposeArray, Id64String, IDisposable } from \"@itwin/core-bentley\";\r\nimport {\r\n FeatureAppearanceProvider, HiddenLine, RealityModelDisplaySettings, RenderSchedule, ViewFlagOverrides, ViewFlags,\r\n} from \"@itwin/core-common\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport { FeatureSymbology } from \"./FeatureSymbology\";\r\nimport { RenderClipVolume } from \"./RenderClipVolume\";\r\nimport { RenderGraphic } from \"./RenderGraphic\";\r\nimport { RenderMemory } from \"./RenderMemory\";\r\nimport { RenderPlanarClassifier } from \"./RenderPlanarClassifier\";\r\nimport { RenderTextureDrape } from \"./RenderSystem\";\r\nimport { Range3d, Transform } from \"@itwin/core-geometry\";\r\nimport { AnimationNodeId } from \"../common/internal/render/AnimationNodeId\";\r\n\r\n/** Carries information in a GraphicBranchOptions about a GraphicBranch produced by drawing one view into the context of another.\r\n * @internal\r\n */\r\nexport interface GraphicBranchFrustum {\r\n is3d: boolean;\r\n scale: {\r\n x: number;\r\n y: number;\r\n };\r\n}\r\n\r\n/**\r\n * A node in a scene graph. The branch itself is not renderable. Instead it contains a list of RenderGraphics,\r\n * and a transform, symbology overrides, and clip volume which are to be applied when rendering them.\r\n * Branches can be nested to build an arbitrarily-complex scene graph.\r\n * @see [[RenderSystem.createBranch]]\r\n * @public\r\n * @extensions\r\n */\r\nexport class GraphicBranch implements IDisposable /* , RenderMemory.Consumer */ {\r\n /** The child nodes of this branch */\r\n public readonly entries: RenderGraphic[] = [];\r\n /** If true, when the branch is disposed of, the RenderGraphics in its entries array will also be disposed */\r\n public readonly ownsEntries: boolean;\r\n /** Selectively overrides the view's [ViewFlags]($common) while drawing graphics within this branch. The default overrides nothing.\r\n * @see [[setViewFlagOverrides]].\r\n */\r\n public viewFlagOverrides: ViewFlagOverrides = {};\r\n /** Controls how reality models are displayed within this branch.\r\n * @beta\r\n */\r\n public realityModelDisplaySettings?: RealityModelDisplaySettings;\r\n /** @internal */\r\n public realityModelRange?: Range3d;\r\n /** Optional symbology overrides to be applied to all graphics in this branch */\r\n public symbologyOverrides?: FeatureSymbology.Overrides;\r\n /** Optional animation branch Id that incorporates the model Id and, for element timelines, the batch Id.\r\n * @internal\r\n */\r\n public animationId?: string;\r\n /** Identifies the node in the [RenderSchedule.Script]($backend) with which this branch is associated.\r\n * @internal\r\n */\r\n public animationNodeId?: AnimationNodeId | number;\r\n\r\n /** Identifies the \"group\" to which this branch belongs.\r\n * Groups represent cross-cutting subsets of a tile tree's contents.\r\n * For example, if a tile tree contains geometry from multiple models, each model (or smaller groups of multiple models) could be considered a group.\r\n * The top-level branches containing graphics from multiple tiles will each specify the group they represent, and the child branches within each\r\n * tile will likewise specify the group to which they belong.\r\n * When drawing, only the graphics within a tile that correlate with the current group will be drawn.\r\n * Groups cannot nest.\r\n * @internal\r\n */\r\n public groupNodeId?: number;\r\n\r\n /** Constructor\r\n * @param ownsEntries If true, when this branch is [[dispose]]d, all of the [[RenderGraphic]]s it contains will also be disposed.\r\n */\r\n public constructor(ownsEntries: boolean = false) {\r\n this.ownsEntries = ownsEntries;\r\n }\r\n\r\n /** Add a graphic to this branch. */\r\n public add(graphic: RenderGraphic): void {\r\n this.entries.push(graphic);\r\n }\r\n\r\n /** Compute the view flags that result from applying this branch's [[viewFlagOverrides]] to the input flags.\r\n * @param flags The input view flags, e.g., from the view's [[DisplayStyleState]].\r\n * @returns The result of applying [[viewFlagOverrides]] to `flags`.\r\n */\r\n public getViewFlags(flags: ViewFlags): ViewFlags {\r\n return flags.override(this.viewFlagOverrides);\r\n }\r\n\r\n /** Set [[viewFlagOverrides]] to override **all** ViewFlags as specified by `flags`. */\r\n public setViewFlags(flags: ViewFlags): void {\r\n this.viewFlagOverrides = { ...flags };\r\n }\r\n\r\n /** Change [[viewFlagOverrides]]. */\r\n public setViewFlagOverrides(ovr: ViewFlagOverrides): void {\r\n this.viewFlagOverrides = { ...ovr };\r\n }\r\n\r\n /** Disposes of all graphics in this branch, if and only if [[ownsEntries]] is true. */\r\n public dispose() {\r\n this.clear();\r\n }\r\n\r\n /** Returns true if this branch contains no graphics. */\r\n public get isEmpty(): boolean {\r\n return 0 === this.entries.length;\r\n }\r\n\r\n /** Empties the list of [[RenderGraphic]]s contained in this branch, and if the [[ownsEntries]] flag is set, also disposes of them. */\r\n public clear(): void {\r\n if (this.ownsEntries)\r\n disposeArray(this.entries);\r\n else\r\n this.entries.length = 0;\r\n }\r\n\r\n /** @internal */\r\n public collectStatistics(stats: RenderMemory.Statistics): void {\r\n for (const entry of this.entries)\r\n entry.collectStatistics(stats);\r\n }\r\n}\r\n\r\n/** Options passed to [[RenderSystem.createGraphicBranch]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface GraphicBranchOptions {\r\n /** Clip applied to the graphics in the branch. */\r\n clipVolume?: RenderClipVolume;\r\n /** @internal */\r\n classifierOrDrape?: RenderPlanarClassifier | RenderTextureDrape;\r\n /** Optionally replaces the view's hidden line settings when drawing the branch. */\r\n hline?: HiddenLine.Settings;\r\n /** The iModel from which the graphics originate, if different than that associated with the view. */\r\n iModel?: IModelConnection;\r\n /** An optional transform from the coordinate system of [[iModel]] to those of a different [[IModelConnection]].\r\n * This is used by [[AccuSnap]] when displaying one iModel in the context of another iModel (i.e., the iModel associated\r\n * with the [[Viewport]]).\r\n */\r\n transformFromIModel?: Transform;\r\n /** @internal */\r\n frustum?: GraphicBranchFrustum;\r\n /** Supplements the view's [[FeatureSymbology.Overrides]] for graphics in the branch. */\r\n appearanceProvider?: FeatureAppearanceProvider;\r\n /** @internal Secondary planar classifiers (map layers) */\r\n secondaryClassifiers?: Map<number, RenderPlanarClassifier>;\r\n /** The Id of the [ViewAttachment]($backend) from which this branch's graphics originated.\r\n * @internal\r\n */\r\n viewAttachmentId?: Id64String;\r\n /** If true, the view's [DisplayStyleSettings.clipStyle]($common) will be disabled for this branch.\r\n * No [ClipStyle.insideColor]($common), [ClipStyle.outsideColor]($common), or [ClipStyle.intersectionStyle]($common) will be applied.\r\n */\r\n disableClipStyle?: true;\r\n}\r\n\r\n/** Clip/Transform for a branch that are varied over time.\r\n * @internal\r\n */\r\nexport interface AnimationBranchState {\r\n readonly clip?: RenderClipVolume;\r\n readonly omit?: boolean;\r\n}\r\n\r\n/** @internal */\r\nexport function formatAnimationBranchId(modelId: Id64String, branchId: number): string {\r\n if (branchId < 0)\r\n return modelId;\r\n\r\n return `${modelId}_Node_${branchId.toString()}`;\r\n}\r\n\r\nfunction addAnimationBranch(modelId: Id64String, timeline: RenderSchedule.Timeline, branchId: number, branches: Map<string, AnimationBranchState>, time: number): void {\r\n const clipVector = timeline.getClipVector(time);\r\n const clip = clipVector ? IModelApp.renderSystem.createClipVolume(clipVector) : undefined;\r\n if (clip)\r\n branches.set(formatAnimationBranchId(modelId, branchId), { clip });\r\n}\r\n\r\n/** Mapping from node/branch IDs to animation branch state\r\n * @internal\r\n */\r\nexport interface AnimationBranchStates {\r\n /** Maps node Id to branch state. */\r\n readonly branchStates: Map<string, AnimationBranchState>;\r\n /** Ids of nodes that apply a transform. */\r\n readonly transformNodeIds: ReadonlySet<number>;\r\n}\r\n\r\n/** @internal */\r\nexport namespace AnimationBranchStates {\r\n export function fromScript(script: RenderSchedule.Script, time: number): AnimationBranchStates | undefined {\r\n if (!script.containsModelClipping && !script.requiresBatching)\r\n return undefined;\r\n\r\n const branches = new Map<string, AnimationBranchState>();\r\n for (const model of script.modelTimelines) {\r\n addAnimationBranch(model.modelId, model, -1, branches, time);\r\n for (const elem of model.elementTimelines) {\r\n if (elem.getVisibility(time) <= 0)\r\n branches.set(formatAnimationBranchId(model.modelId, elem.batchId), { omit: true });\r\n else\r\n addAnimationBranch(model.modelId, elem, elem.batchId, branches, time);\r\n }\r\n }\r\n\r\n return {\r\n branchStates: branches,\r\n transformNodeIds: script.transformBatchIds,\r\n };\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"GraphicBranch.js","sourceRoot":"","sources":["../../../src/render/GraphicBranch.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AA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AI,CAAC,IAAI,CAAC;oBAC/B,QAAQ,CAAC,GAAG,CAAC,uBAAuB,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;;oBAEnF,kBAAkB,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;YAC1E,CAAC;QACH,CAAC;QAED,OAAO;YACL,YAAY,EAAE,QAAQ;YACtB,gBAAgB,EAAE,MAAM,CAAC,iBAAiB;SAC3C,CAAC;IACJ,CAAC;IAnBe,gCAAU,aAmBzB,CAAA;AACH,CAAC,EArBgB,qBAAqB,KAArB,qBAAqB,QAqBrC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Rendering\r\n */\r\n\r\nimport { disposeArray, Id64String, IDisposable } from \"@itwin/core-bentley\";\r\nimport {\r\n FeatureAppearanceProvider, HiddenLine, RealityModelDisplaySettings, RenderSchedule, ViewFlagOverrides, ViewFlags,\r\n} from \"@itwin/core-common\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport { FeatureSymbology } from \"./FeatureSymbology\";\r\nimport { RenderClipVolume } from \"./RenderClipVolume\";\r\nimport { RenderGraphic } from \"./RenderGraphic\";\r\nimport { RenderMemory } from \"./RenderMemory\";\r\nimport { RenderPlanarClassifier } from \"./RenderPlanarClassifier\";\r\nimport { RenderTextureDrape } from \"./RenderSystem\";\r\nimport { Range3d, Transform } from \"@itwin/core-geometry\";\r\nimport { AnimationNodeId } from \"../common/internal/render/AnimationNodeId\";\r\n\r\n/** Carries information in a GraphicBranchOptions about a GraphicBranch produced by drawing one view into the context of another.\r\n * @internal\r\n */\r\nexport interface GraphicBranchFrustum {\r\n is3d: boolean;\r\n scale: {\r\n x: number;\r\n y: number;\r\n };\r\n}\r\n\r\n/**\r\n * A node in a scene graph. The branch itself is not renderable. Instead it contains a list of RenderGraphics,\r\n * and a transform, symbology overrides, and clip volume which are to be applied when rendering them.\r\n * Branches can be nested to build an arbitrarily-complex scene graph.\r\n * @see [[RenderSystem.createBranch]]\r\n * @public\r\n * @extensions\r\n */\r\nexport class GraphicBranch implements IDisposable /* , RenderMemory.Consumer */ {\r\n /** The child nodes of this branch */\r\n public readonly entries: RenderGraphic[] = [];\r\n /** If true, when the branch is disposed of, the RenderGraphics in its entries array will also be disposed */\r\n public readonly ownsEntries: boolean;\r\n /** Selectively overrides the view's [ViewFlags]($common) while drawing graphics within this branch. The default overrides nothing.\r\n * @see [[setViewFlagOverrides]].\r\n */\r\n public viewFlagOverrides: ViewFlagOverrides = {};\r\n /** Controls how reality models are displayed within this branch.\r\n * @beta\r\n */\r\n public realityModelDisplaySettings?: RealityModelDisplaySettings;\r\n /** @internal */\r\n public realityModelRange?: Range3d;\r\n /** Optional symbology overrides to be applied to all graphics in this branch */\r\n public symbologyOverrides?: FeatureSymbology.Overrides;\r\n /** Optional animation branch Id that incorporates the model Id and, for element timelines, the batch Id.\r\n * @internal\r\n */\r\n public animationId?: string;\r\n /** Identifies the node in the [RenderSchedule.Script]($backend) with which this branch is associated.\r\n * @internal\r\n */\r\n public animationNodeId?: AnimationNodeId | number;\r\n\r\n /** Identifies the \"group\" to which this branch belongs.\r\n * Groups represent cross-cutting subsets of a tile tree's contents.\r\n * For example, if a tile tree contains geometry from multiple models, each model (or smaller groups of multiple models) could be considered a group.\r\n * The top-level branches containing graphics from multiple tiles will each specify the group they represent, and the child branches within each\r\n * tile will likewise specify the group to which they belong.\r\n * When drawing, only the graphics within a tile that correlate with the current group will be drawn.\r\n * Groups cannot nest.\r\n * @internal\r\n */\r\n public groupNodeId?: number;\r\n\r\n /** Constructor\r\n * @param ownsEntries If true, when this branch is [[dispose]]d, all of the [[RenderGraphic]]s it contains will also be disposed.\r\n */\r\n public constructor(ownsEntries: boolean = false) {\r\n this.ownsEntries = ownsEntries;\r\n }\r\n\r\n /** Add a graphic to this branch. */\r\n public add(graphic: RenderGraphic): void {\r\n this.entries.push(graphic);\r\n }\r\n\r\n /** Compute the view flags that result from applying this branch's [[viewFlagOverrides]] to the input flags.\r\n * @param flags The input view flags, e.g., from the view's [[DisplayStyleState]].\r\n * @returns The result of applying [[viewFlagOverrides]] to `flags`.\r\n */\r\n public getViewFlags(flags: ViewFlags): ViewFlags {\r\n return flags.override(this.viewFlagOverrides);\r\n }\r\n\r\n /** Set [[viewFlagOverrides]] to override **all** ViewFlags as specified by `flags`. */\r\n public setViewFlags(flags: ViewFlags): void {\r\n this.viewFlagOverrides = { ...flags };\r\n }\r\n\r\n /** Change [[viewFlagOverrides]]. */\r\n public setViewFlagOverrides(ovr: ViewFlagOverrides): void {\r\n this.viewFlagOverrides = { ...ovr };\r\n }\r\n\r\n /** Disposes of all graphics in this branch, if and only if [[ownsEntries]] is true. */\r\n public dispose() {\r\n this.clear();\r\n }\r\n\r\n /** Returns true if this branch contains no graphics. */\r\n public get isEmpty(): boolean {\r\n return 0 === this.entries.length;\r\n }\r\n\r\n /** Empties the list of [[RenderGraphic]]s contained in this branch, and if the [[ownsEntries]] flag is set, also disposes of them. */\r\n public clear(): void {\r\n if (this.ownsEntries)\r\n disposeArray(this.entries);\r\n else\r\n this.entries.length = 0;\r\n }\r\n\r\n /** @internal */\r\n public collectStatistics(stats: RenderMemory.Statistics): void {\r\n for (const entry of this.entries)\r\n entry.collectStatistics(stats);\r\n }\r\n}\r\n\r\n/** Options passed to [[RenderSystem.createGraphicBranch]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface GraphicBranchOptions {\r\n /** Clip applied to the graphics in the branch. */\r\n clipVolume?: RenderClipVolume;\r\n /** @internal */\r\n classifierOrDrape?: RenderPlanarClassifier | RenderTextureDrape;\r\n /** Optionally replaces the view's hidden line settings when drawing the branch. */\r\n hline?: HiddenLine.Settings;\r\n /** The iModel from which the graphics originate, if different than that associated with the view. */\r\n iModel?: IModelConnection;\r\n /** An optional transform from the coordinate system of [[iModel]] to those of a different [[IModelConnection]].\r\n * This is used by [[AccuSnap]] when displaying one iModel in the context of another iModel (i.e., the iModel associated\r\n * with the [[Viewport]]).\r\n */\r\n transformFromIModel?: Transform;\r\n /** @internal */\r\n frustum?: GraphicBranchFrustum;\r\n /** Supplements the view's [[FeatureSymbology.Overrides]] for graphics in the branch. */\r\n appearanceProvider?: FeatureAppearanceProvider;\r\n /** @internal Secondary planar classifiers (map layers) */\r\n secondaryClassifiers?: Map<number, RenderPlanarClassifier>;\r\n /** See HitDetail.viewAttachmentId.\r\n * @internal\r\n */\r\n viewAttachmentId?: Id64String;\r\n /** If true, the view's [DisplayStyleSettings.clipStyle]($common) will be disabled for this branch.\r\n * No [ClipStyle.insideColor]($common), [ClipStyle.outsideColor]($common), or [ClipStyle.intersectionStyle]($common) will be applied.\r\n */\r\n disableClipStyle?: true;\r\n}\r\n\r\n/** Clip/Transform for a branch that are varied over time.\r\n * @internal\r\n */\r\nexport interface AnimationBranchState {\r\n readonly clip?: RenderClipVolume;\r\n readonly omit?: boolean;\r\n}\r\n\r\n/** @internal */\r\nexport function formatAnimationBranchId(modelId: Id64String, branchId: number): string {\r\n if (branchId < 0)\r\n return modelId;\r\n\r\n return `${modelId}_Node_${branchId.toString()}`;\r\n}\r\n\r\nfunction addAnimationBranch(modelId: Id64String, timeline: RenderSchedule.Timeline, branchId: number, branches: Map<string, AnimationBranchState>, time: number): void {\r\n const clipVector = timeline.getClipVector(time);\r\n const clip = clipVector ? IModelApp.renderSystem.createClipVolume(clipVector) : undefined;\r\n if (clip)\r\n branches.set(formatAnimationBranchId(modelId, branchId), { clip });\r\n}\r\n\r\n/** Mapping from node/branch IDs to animation branch state\r\n * @internal\r\n */\r\nexport interface AnimationBranchStates {\r\n /** Maps node Id to branch state. */\r\n readonly branchStates: Map<string, AnimationBranchState>;\r\n /** Ids of nodes that apply a transform. */\r\n readonly transformNodeIds: ReadonlySet<number>;\r\n}\r\n\r\n/** @internal */\r\nexport namespace AnimationBranchStates {\r\n export function fromScript(script: RenderSchedule.Script, time: number): AnimationBranchStates | undefined {\r\n if (!script.containsModelClipping && !script.requiresBatching)\r\n return undefined;\r\n\r\n const branches = new Map<string, AnimationBranchState>();\r\n for (const model of script.modelTimelines) {\r\n addAnimationBranch(model.modelId, model, -1, branches, time);\r\n for (const elem of model.elementTimelines) {\r\n if (elem.getVisibility(time) <= 0)\r\n branches.set(formatAnimationBranchId(model.modelId, elem.batchId), { omit: true });\r\n else\r\n addAnimationBranch(model.modelId, elem, elem.batchId, branches, time);\r\n }\r\n }\r\n\r\n return {\r\n branchStates: branches,\r\n transformNodeIds: script.transformBatchIds,\r\n };\r\n }\r\n}\r\n"]}
@@ -32,7 +32,9 @@ export declare namespace Pixel {
32
32
  readonly transformFromIModel?: Transform;
33
33
  /** @internal */
34
34
  readonly tileId?: string;
35
- /** The Id of the [ViewAttachment]($backend), if any, from which the pixel originated.
35
+ /** The Id of the "attached" view, if any, from which the pixel originated.
36
+ * An attached view is a 2d view drawn into the context of another view - for example, a [[ViewAttachment]]($backend)
37
+ * rendered into a [[SheetViewState]], or a [[SpatialViewState]] rendered by a [SectionDrawing]($backend) view.
36
38
  * @beta
37
39
  */
38
40
  readonly viewAttachmentId?: Id64String;
@@ -1 +1 @@
1
- {"version":3,"file":"Pixel.d.ts","sourceRoot":"","sources":["../../../src/render/Pixel.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAQ,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,gB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AQ;QAClB,uCAAQ,CAAA;QACR,wDAAwD;QACxD,6CAAgB,CAAA;QAChB,mJAAmJ;QACnJ,qEAA4B,CAAA;QAC5B,wCAAwC;QACxC,qCAAmC,CAAA;IACrC,CAAC,EARW,QAAQ,GAAR,cAAQ,KAAR,cAAQ,QAQnB;AAeH,CAAC,EAtNgB,KAAK,KAAL,KAAK,QAsNrB","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Rendering\r\n */\r\n\r\nimport { Id64, Id64String } from \"@itwin/core-bentley\";\r\nimport { BatchType, Feature, GeometryClass, ModelFeature } from \"@itwin/core-common\";\r\nimport { HitPriority, ViewAttachmentHitInfo } from \"../HitDetail\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport type { Viewport } from \"../Viewport\";\r\nimport { Transform } from \"@itwin/core-geometry\";\r\n\r\n/** Describes aspects of a pixel as read from a [[Viewport]].\r\n * @see [[Viewport.readPixels]].\r\n * @public\r\n * @extensions\r\n */\r\nexport namespace Pixel {\r\n /** Describes a single pixel within a [[Pixel.Buffer]]. */\r\n export class Data {\r\n /** The feature that produced the pixel. */\r\n public readonly feature?: Feature;\r\n public readonly modelId?: Id64String;\r\n /** The pixel's depth in [[CoordSystem.Npc]] coordinates (0 to 1), or -1 if depth was not written or not requested. */\r\n public readonly distanceFraction: number;\r\n /** The type of geometry that produced the pixel. */\r\n public readonly type: GeometryType;\r\n /** The planarity of the geometry that produced the pixel. */\r\n public readonly planarity: Planarity;\r\n /** @internal */\r\n public readonly batchType?: BatchType;\r\n /** The iModel from which the geometry producing the pixel originated. */\r\n public readonly iModel?: IModelConnection;\r\n /** @internal */\r\n public readonly transformFromIModel?: Transform;\r\n /** @internal */\r\n public readonly tileId?: string;\r\n /** The Id of the [ViewAttachment]($backend), if any, from which the pixel originated.\r\n * @beta\r\n */\r\n public readonly viewAttachmentId?: Id64String;\r\n /** @internal */\r\n public get isClassifier(): boolean {\r\n return undefined !== this.batchType && BatchType.Primary !== this.batchType;\r\n }\r\n\r\n /** @internal */\r\n public constructor(args?: {\r\n feature?: ModelFeature;\r\n distanceFraction?: number;\r\n type?: GeometryType;\r\n planarity?: Planarity;\r\n batchType?: BatchType;\r\n iModel?: IModelConnection;\r\n tileId?: string;\r\n viewAttachmentId?: string;\r\n transformFromIModel?: Transform;\r\n }) {\r\n if (args?.feature)\r\n this.feature = new Feature(args.feature.elementId, args.feature.subCategoryId, args.feature.geometryClass);\r\n\r\n this.modelId = args?.feature?.modelId;\r\n this.distanceFraction = args?.distanceFraction ?? -1;\r\n this.type = args?.type ?? GeometryType.Unknown;\r\n this.planarity = args?.planarity ?? Planarity.Unknown;\r\n this.iModel = args?.iModel;\r\n this.tileId = args?.tileId;\r\n this.viewAttachmentId = args?.viewAttachmentId;\r\n this.transformFromIModel = args?.transformFromIModel;\r\n }\r\n\r\n /** The Id of the element that produced the pixel. */\r\n public get elementId(): Id64String | undefined {\r\n return this.feature?.elementId;\r\n }\r\n\r\n /** The Id of the [SubCategory]($backend) that produced the pixel. */\r\n public get subCategoryId(): Id64String | undefined {\r\n return this.feature?.subCategoryId;\r\n }\r\n\r\n /** The class of geometry that produced the pixel. */\r\n public get geometryClass(): GeometryClass | undefined {\r\n return this.feature?.geometryClass;\r\n }\r\n\r\n /** Computes the [[HitPriority]] of this pixel based on its [[type]] and [[planarity]]. */\r\n public computeHitPriority(): HitPriority {\r\n switch (this.type) {\r\n case Pixel.GeometryType.Surface:\r\n return Pixel.Planarity.Planar === this.planarity ? HitPriority.PlanarSurface : HitPriority.NonPlanarSurface;\r\n case Pixel.GeometryType.Linear:\r\n return HitPriority.WireEdge;\r\n case Pixel.GeometryType.Edge:\r\n return Pixel.Planarity.Planar === this.planarity ? HitPriority.PlanarEdge : HitPriority.NonPlanarEdge;\r\n case Pixel.GeometryType.Silhouette:\r\n return HitPriority.SilhouetteEdge;\r\n default:\r\n return HitPriority.Unknown;\r\n }\r\n }\r\n\r\n /** Convert this pixel to a [[Pixel.HitProps]] suitable for constructing a [[HitDetail]].\r\n * @param viewport The viewport in which the hit originated.\r\n */\r\n public toHitProps(viewport: Viewport): Pixel.HitProps {\r\n let viewAttachment: ViewAttachmentHitInfo | undefined;\r\n if (this.viewAttachmentId) {\r\n const attachmentViewport = viewport.view.getAttachmentViewport(this.viewAttachmentId);\r\n if (attachmentViewport)\r\n viewAttachment = { viewport: attachmentViewport, id: this.viewAttachmentId };\r\n }\r\n\r\n return {\r\n sourceId: this.elementId ?? Id64.invalid,\r\n priority: this.computeHitPriority(),\r\n distFraction: this.distanceFraction,\r\n subCategoryId: this.subCategoryId,\r\n geometryClass: this.geometryClass,\r\n modelId: this.modelId,\r\n tileId: this.tileId,\r\n isClassifier: this.isClassifier,\r\n sourceIModel: this.iModel,\r\n transformFromSourceIModel: this.transformFromIModel,\r\n viewAttachment,\r\n };\r\n }\r\n }\r\n\r\n /** Describes a subset of [[HitDetailProps]] computed from a [[Pixel.Data]], suitable for constructing a [[HitDetail]].\r\n * For example, the following function creates a `HitDetail` from a `Pixel.Data` and other hit information:\r\n * ```ts\r\n * function makeHitDetail(pixel: Pixel.Data, viewport: ScreenViewport, testPoint: Point3d, hitSource: HitSource, hitPoint: Point3d, distXY: number): HitDetail {\r\n * return new HitDetail({\r\n * ...pixel.toHitProps(viewport),\r\n * viewport, testPoint, hitSource, hitPoint, distXY,\r\n * };\r\n * }\r\n * ```\r\n * @see [[Data.toHitProps]] to convert a [[Pixel.Data]] to a `HitProps`.\r\n * @public\r\n */\r\n export interface HitProps {\r\n /** The source of the geometry. This may be a persistent element Id, or a transient Id used for, e.g., pickable decorations. */\r\n sourceId: Id64String;\r\n /** The hit geometry priority/classification. */\r\n priority: HitPriority;\r\n /** The distance in view coordinates between the hit and the near plane. */\r\n distFraction: number;\r\n /** The [SubCategory]($backend) to which the hit geometry belongs. */\r\n subCategoryId?: Id64String;\r\n /** The class of the hit geometry. */\r\n geometryClass?: GeometryClass;\r\n /** The Id of the [[ModelState]] from which the hit originated. */\r\n modelId?: Id64String;\r\n /** The IModelConnection from which the hit originated.\r\n * This should almost always be left undefined, unless the hit is known to have originated from an iModel\r\n * other than the one associated with the viewport.\r\n * @internal\r\n */\r\n sourceIModel?: IModelConnection;\r\n /** @internal */\r\n transformFromSourceIModel?: Transform;\r\n /** @internal chiefly for debugging */\r\n tileId?: string;\r\n /** True if the hit originated from a reality model classifier.\r\n * @alpha\r\n */\r\n isClassifier?: boolean;\r\n /** Information about the [ViewAttachment]($backend) within which the hit geometry resides, if any.\r\n * @note Only [[SheetViewState]]s can have view attachments.\r\n * @beta\r\n */\r\n viewAttachment?: ViewAttachmentHitInfo;\r\n }\r\n\r\n /** Describes the type of geometry that produced the [[Pixel.Data]]. */\r\n export enum GeometryType {\r\n /** [[Pixel.Selector.GeometryAndDistance]] was not specified, or the type could not be determined. */\r\n Unknown, // Geometry was not selected, or type could not be determined\r\n /** No geometry was rendered to this pixel. */\r\n None,\r\n /** A surface produced this pixel. */\r\n Surface,\r\n /** A point primitive or polyline produced this pixel. */\r\n Linear,\r\n /** This pixel was produced by an edge of a surface. */\r\n Edge,\r\n /** This pixel was produced by a silhouette edge of a curved surface. */\r\n Silhouette,\r\n }\r\n\r\n /** Describes the planarity of the foremost geometry which produced the pixel. */\r\n export enum Planarity {\r\n /** [[Pixel.Selector.GeometryAndDistance]] was not specified, or the planarity could not be determined. */\r\n Unknown,\r\n /** No geometry was rendered to this pixel. */\r\n None,\r\n /** Planar geometry produced this pixel. */\r\n Planar,\r\n /** Non-planar geometry produced this pixel. */\r\n NonPlanar,\r\n }\r\n\r\n /**\r\n * Bit-mask by which callers of [[Viewport.readPixels]] specify which aspects are of interest.\r\n * Aspects not specified will be omitted from the returned data.\r\n */\r\n export enum Selector {\r\n None = 0,\r\n /** Select the [[Feature]] which produced each pixel. */\r\n Feature = 1 << 0, // eslint-disable-line @typescript-eslint/no-shadow\r\n /** Select the type and planarity of geometry which produced each pixel as well as the fraction of its distance between the near and far planes. */\r\n GeometryAndDistance = 1 << 2,\r\n /** Select all aspects of each pixel. */\r\n All = GeometryAndDistance | Feature,\r\n }\r\n\r\n /** A rectangular array of pixels as read from a [[Viewport]]'s frame buffer. Each pixel is represented as a [[Pixel.Data]] object.\r\n * The contents of the pixel buffer will be specified using device pixels, not CSS pixels. See [[Viewport.devicePixelRatio]] and [[Viewport.cssPixelsToDevicePixels]].\r\n * @see [[Viewport.readPixels]].\r\n */\r\n export interface Buffer {\r\n /** Retrieve the data associated with the pixel at (x,y) in view coordinates. */\r\n getPixel(x: number, y: number): Data;\r\n }\r\n\r\n /** A function which receives the results of a call to [[Viewport.readPixels]].\r\n * @note The contents of the buffer become invalid once the Receiver function returns. Do not store a reference to it.\r\n */\r\n export type Receiver = (pixels: Buffer | undefined) => void;\r\n}\r\n"]}
1
+ {"version":3,"file":"Pixel.js","sourceRoot":"","sources":["../../../src/render/Pixel.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAc,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,OAAO,EAA+B,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAAE,WAAW,EAAyB,MAAM,cAAc,CAAC;AAKlE;;;;GAIG;AACH,MAAM,KAAW,KAAK,CAwNrB;AAxND,WAAiB,KAAK;IACpB,0DAA0D;IAC1D,MAAa,IAAI;QAwBf,gBAAgB;QAChB,IAAW,YAAY;YACrB,OAAO,SAAS,KAAK,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,OAAO,KAAK,IAAI,CAAC,SAAS,CAAC;QAC9E,CAAC;QAED,gBAAgB;QAChB,YAAmB,IAUlB;YACC,IAAI,IAAI,EAAE,OAAO;gBACf,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,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bD,WAAY,YAAY;QACtB,qGAAqG;QACrG,qDAAO,CAAA;QACP,8CAA8C;QAC9C,+CAAI,CAAA;QACJ,qCAAqC;QACrC,qDAAO,CAAA;QACP,yDAAyD;QACzD,mDAAM,CAAA;QACN,uDAAuD;QACvD,+CAAI,CAAA;QACJ,wEAAwE;QACxE,2DAAU,CAAA;IACZ,CAAC,EAbW,YAAY,GAAZ,kBAAY,KAAZ,kBAAY,QAavB;IAED,iFAAiF;IACjF,IAAY,SASX;IATD,WAAY,SAAS;QACnB,0GAA0G;QAC1G,+CAAO,CAAA;QACP,8CAA8C;QAC9C,yCAAI,CAAA;QACJ,2CAA2C;QAC3C,6CAAM,CAAA;QACN,+CAA+C;QAC/C,mDAAS,CAAA;IACX,CAAC,EATW,SAAS,GAAT,eAAS,KAAT,eAAS,QASpB;IAED;;;OAGG;IACH,IAAY,QAQX;IARD,WAAY,QAAQ;QAClB,uCAAQ,CAAA;QACR,wDAAwD;QACxD,6CAAgB,CAAA;QAChB,mJAAmJ;QACnJ,qEAA4B,CAAA;QAC5B,wCAAwC;QACxC,qCAAmC,CAAA;IACrC,CAAC,EARW,QAAQ,GAAR,cAAQ,KAAR,cAAQ,QAQnB;AAeH,CAAC,EAxNgB,KAAK,KAAL,KAAK,QAwNrB","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Rendering\r\n */\r\n\r\nimport { Id64, Id64String } from \"@itwin/core-bentley\";\r\nimport { BatchType, Feature, GeometryClass, ModelFeature } from \"@itwin/core-common\";\r\nimport { HitPriority, ViewAttachmentHitInfo } from \"../HitDetail\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport type { Viewport } from \"../Viewport\";\r\nimport { Transform } from \"@itwin/core-geometry\";\r\n\r\n/** Describes aspects of a pixel as read from a [[Viewport]].\r\n * @see [[Viewport.readPixels]].\r\n * @public\r\n * @extensions\r\n */\r\nexport namespace Pixel {\r\n /** Describes a single pixel within a [[Pixel.Buffer]]. */\r\n export class Data {\r\n /** The feature that produced the pixel. */\r\n public readonly feature?: Feature;\r\n public readonly modelId?: Id64String;\r\n /** The pixel's depth in [[CoordSystem.Npc]] coordinates (0 to 1), or -1 if depth was not written or not requested. */\r\n public readonly distanceFraction: number;\r\n /** The type of geometry that produced the pixel. */\r\n public readonly type: GeometryType;\r\n /** The planarity of the geometry that produced the pixel. */\r\n public readonly planarity: Planarity;\r\n /** @internal */\r\n public readonly batchType?: BatchType;\r\n /** The iModel from which the geometry producing the pixel originated. */\r\n public readonly iModel?: IModelConnection;\r\n /** @internal */\r\n public readonly transformFromIModel?: Transform;\r\n /** @internal */\r\n public readonly tileId?: string;\r\n /** The Id of the \"attached\" view, if any, from which the pixel originated.\r\n * An attached view is a 2d view drawn into the context of another view - for example, a [[ViewAttachment]]($backend)\r\n * rendered into a [[SheetViewState]], or a [[SpatialViewState]] rendered by a [SectionDrawing]($backend) view.\r\n * @beta\r\n */\r\n public readonly viewAttachmentId?: Id64String;\r\n /** @internal */\r\n public get isClassifier(): boolean {\r\n return undefined !== this.batchType && BatchType.Primary !== this.batchType;\r\n }\r\n\r\n /** @internal */\r\n public constructor(args?: {\r\n feature?: ModelFeature;\r\n distanceFraction?: number;\r\n type?: GeometryType;\r\n planarity?: Planarity;\r\n batchType?: BatchType;\r\n iModel?: IModelConnection;\r\n tileId?: string;\r\n viewAttachmentId?: string;\r\n transformFromIModel?: Transform;\r\n }) {\r\n if (args?.feature)\r\n this.feature = new Feature(args.feature.elementId, args.feature.subCategoryId, args.feature.geometryClass);\r\n\r\n this.modelId = args?.feature?.modelId;\r\n this.distanceFraction = args?.distanceFraction ?? -1;\r\n this.type = args?.type ?? GeometryType.Unknown;\r\n this.planarity = args?.planarity ?? Planarity.Unknown;\r\n this.iModel = args?.iModel;\r\n this.tileId = args?.tileId;\r\n this.viewAttachmentId = args?.viewAttachmentId;\r\n this.transformFromIModel = args?.transformFromIModel;\r\n }\r\n\r\n /** The Id of the element that produced the pixel. */\r\n public get elementId(): Id64String | undefined {\r\n return this.feature?.elementId;\r\n }\r\n\r\n /** The Id of the [SubCategory]($backend) that produced the pixel. */\r\n public get subCategoryId(): Id64String | undefined {\r\n return this.feature?.subCategoryId;\r\n }\r\n\r\n /** The class of geometry that produced the pixel. */\r\n public get geometryClass(): GeometryClass | undefined {\r\n return this.feature?.geometryClass;\r\n }\r\n\r\n /** Computes the [[HitPriority]] of this pixel based on its [[type]] and [[planarity]]. */\r\n public computeHitPriority(): HitPriority {\r\n switch (this.type) {\r\n case Pixel.GeometryType.Surface:\r\n return Pixel.Planarity.Planar === this.planarity ? HitPriority.PlanarSurface : HitPriority.NonPlanarSurface;\r\n case Pixel.GeometryType.Linear:\r\n return HitPriority.WireEdge;\r\n case Pixel.GeometryType.Edge:\r\n return Pixel.Planarity.Planar === this.planarity ? HitPriority.PlanarEdge : HitPriority.NonPlanarEdge;\r\n case Pixel.GeometryType.Silhouette:\r\n return HitPriority.SilhouetteEdge;\r\n default:\r\n return HitPriority.Unknown;\r\n }\r\n }\r\n\r\n /** Convert this pixel to a [[Pixel.HitProps]] suitable for constructing a [[HitDetail]].\r\n * @param viewport The viewport in which the hit originated.\r\n */\r\n public toHitProps(viewport: Viewport): Pixel.HitProps {\r\n let viewAttachment: ViewAttachmentHitInfo | undefined;\r\n if (this.viewAttachmentId) {\r\n const attachmentViewport = viewport.view.getAttachmentViewport(this.viewAttachmentId);\r\n if (attachmentViewport)\r\n viewAttachment = { viewport: attachmentViewport, id: this.viewAttachmentId };\r\n }\r\n\r\n return {\r\n sourceId: this.elementId ?? Id64.invalid,\r\n priority: this.computeHitPriority(),\r\n distFraction: this.distanceFraction,\r\n subCategoryId: this.subCategoryId,\r\n geometryClass: this.geometryClass,\r\n modelId: this.modelId,\r\n tileId: this.tileId,\r\n isClassifier: this.isClassifier,\r\n sourceIModel: this.iModel,\r\n transformFromSourceIModel: this.transformFromIModel,\r\n viewAttachment,\r\n };\r\n }\r\n }\r\n\r\n /** Describes a subset of [[HitDetailProps]] computed from a [[Pixel.Data]], suitable for constructing a [[HitDetail]].\r\n * For example, the following function creates a `HitDetail` from a `Pixel.Data` and other hit information:\r\n * ```ts\r\n * function makeHitDetail(pixel: Pixel.Data, viewport: ScreenViewport, testPoint: Point3d, hitSource: HitSource, hitPoint: Point3d, distXY: number): HitDetail {\r\n * return new HitDetail({\r\n * ...pixel.toHitProps(viewport),\r\n * viewport, testPoint, hitSource, hitPoint, distXY,\r\n * };\r\n * }\r\n * ```\r\n * @see [[Data.toHitProps]] to convert a [[Pixel.Data]] to a `HitProps`.\r\n * @public\r\n */\r\n export interface HitProps {\r\n /** The source of the geometry. This may be a persistent element Id, or a transient Id used for, e.g., pickable decorations. */\r\n sourceId: Id64String;\r\n /** The hit geometry priority/classification. */\r\n priority: HitPriority;\r\n /** The distance in view coordinates between the hit and the near plane. */\r\n distFraction: number;\r\n /** The [SubCategory]($backend) to which the hit geometry belongs. */\r\n subCategoryId?: Id64String;\r\n /** The class of the hit geometry. */\r\n geometryClass?: GeometryClass;\r\n /** The Id of the [[ModelState]] from which the hit originated. */\r\n modelId?: Id64String;\r\n /** The IModelConnection from which the hit originated.\r\n * This should almost always be left undefined, unless the hit is known to have originated from an iModel\r\n * other than the one associated with the viewport.\r\n * @internal\r\n */\r\n sourceIModel?: IModelConnection;\r\n /** @internal */\r\n transformFromSourceIModel?: Transform;\r\n /** @internal chiefly for debugging */\r\n tileId?: string;\r\n /** True if the hit originated from a reality model classifier.\r\n * @alpha\r\n */\r\n isClassifier?: boolean;\r\n /** Information about the [ViewAttachment]($backend) within which the hit geometry resides, if any.\r\n * @note Only [[SheetViewState]]s can have view attachments.\r\n * @beta\r\n */\r\n viewAttachment?: ViewAttachmentHitInfo;\r\n }\r\n\r\n /** Describes the type of geometry that produced the [[Pixel.Data]]. */\r\n export enum GeometryType {\r\n /** [[Pixel.Selector.GeometryAndDistance]] was not specified, or the type could not be determined. */\r\n Unknown, // Geometry was not selected, or type could not be determined\r\n /** No geometry was rendered to this pixel. */\r\n None,\r\n /** A surface produced this pixel. */\r\n Surface,\r\n /** A point primitive or polyline produced this pixel. */\r\n Linear,\r\n /** This pixel was produced by an edge of a surface. */\r\n Edge,\r\n /** This pixel was produced by a silhouette edge of a curved surface. */\r\n Silhouette,\r\n }\r\n\r\n /** Describes the planarity of the foremost geometry which produced the pixel. */\r\n export enum Planarity {\r\n /** [[Pixel.Selector.GeometryAndDistance]] was not specified, or the planarity could not be determined. */\r\n Unknown,\r\n /** No geometry was rendered to this pixel. */\r\n None,\r\n /** Planar geometry produced this pixel. */\r\n Planar,\r\n /** Non-planar geometry produced this pixel. */\r\n NonPlanar,\r\n }\r\n\r\n /**\r\n * Bit-mask by which callers of [[Viewport.readPixels]] specify which aspects are of interest.\r\n * Aspects not specified will be omitted from the returned data.\r\n */\r\n export enum Selector {\r\n None = 0,\r\n /** Select the [[Feature]] which produced each pixel. */\r\n Feature = 1 << 0, // eslint-disable-line @typescript-eslint/no-shadow\r\n /** Select the type and planarity of geometry which produced each pixel as well as the fraction of its distance between the near and far planes. */\r\n GeometryAndDistance = 1 << 2,\r\n /** Select all aspects of each pixel. */\r\n All = GeometryAndDistance | Feature,\r\n }\r\n\r\n /** A rectangular array of pixels as read from a [[Viewport]]'s frame buffer. Each pixel is represented as a [[Pixel.Data]] object.\r\n * The contents of the pixel buffer will be specified using device pixels, not CSS pixels. See [[Viewport.devicePixelRatio]] and [[Viewport.cssPixelsToDevicePixels]].\r\n * @see [[Viewport.readPixels]].\r\n */\r\n export interface Buffer {\r\n /** Retrieve the data associated with the pixel at (x,y) in view coordinates. */\r\n getPixel(x: number, y: number): Data;\r\n }\r\n\r\n /** A function which receives the results of a call to [[Viewport.readPixels]].\r\n * @note The contents of the buffer become invalid once the Receiver function returns. Do not store a reference to it.\r\n */\r\n export type Receiver = (pixels: Buffer | undefined) => void;\r\n}\r\n"]}