@itwin/core-common 4.5.0-dev.9 → 4.5.0

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 (41) hide show
  1. package/CHANGELOG.md +65 -1
  2. package/LICENSE.md +1 -1
  3. package/lib/cjs/ContextRealityModel.d.ts +8 -4
  4. package/lib/cjs/ContextRealityModel.d.ts.map +1 -1
  5. package/lib/cjs/ContextRealityModel.js +12 -3
  6. package/lib/cjs/ContextRealityModel.js.map +1 -1
  7. package/lib/cjs/ECSqlReader.d.ts.map +1 -1
  8. package/lib/cjs/ECSqlReader.js +10 -1
  9. package/lib/cjs/ECSqlReader.js.map +1 -1
  10. package/lib/cjs/ElementProps.d.ts +4 -4
  11. package/lib/cjs/ElementProps.d.ts.map +1 -1
  12. package/lib/cjs/ElementProps.js.map +1 -1
  13. package/lib/cjs/IModel.d.ts +12 -0
  14. package/lib/cjs/IModel.d.ts.map +1 -1
  15. package/lib/cjs/IModel.js.map +1 -1
  16. package/lib/cjs/ViewFlags.d.ts +1 -1
  17. package/lib/cjs/ViewFlags.d.ts.map +1 -1
  18. package/lib/cjs/ViewFlags.js +1 -1
  19. package/lib/cjs/ViewFlags.js.map +1 -1
  20. package/lib/cjs/rpc/core/RpcInvocation.js +1 -1
  21. package/lib/cjs/rpc/core/RpcInvocation.js.map +1 -1
  22. package/lib/esm/ContextRealityModel.d.ts +8 -4
  23. package/lib/esm/ContextRealityModel.d.ts.map +1 -1
  24. package/lib/esm/ContextRealityModel.js +12 -3
  25. package/lib/esm/ContextRealityModel.js.map +1 -1
  26. package/lib/esm/ECSqlReader.d.ts.map +1 -1
  27. package/lib/esm/ECSqlReader.js +10 -1
  28. package/lib/esm/ECSqlReader.js.map +1 -1
  29. package/lib/esm/ElementProps.d.ts +4 -4
  30. package/lib/esm/ElementProps.d.ts.map +1 -1
  31. package/lib/esm/ElementProps.js.map +1 -1
  32. package/lib/esm/IModel.d.ts +12 -0
  33. package/lib/esm/IModel.d.ts.map +1 -1
  34. package/lib/esm/IModel.js.map +1 -1
  35. package/lib/esm/ViewFlags.d.ts +1 -1
  36. package/lib/esm/ViewFlags.d.ts.map +1 -1
  37. package/lib/esm/ViewFlags.js +1 -1
  38. package/lib/esm/ViewFlags.js.map +1 -1
  39. package/lib/esm/rpc/core/RpcInvocation.js +1 -1
  40. package/lib/esm/rpc/core/RpcInvocation.js.map +1 -1
  41. package/package.json +7 -6
@@ -1 +1 @@
1
- {"version":3,"file":"ViewFlags.js","sourceRoot":"","sources":["../../src/ViewFlags.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,qBAAqB;AAErB,sDAAkF;AAElF;;;;GAIG;AACH,IAAY,UAyBX;AAzBD,WAAY,UAAU;IACpB;;;;OAIG;IACH,qDAAa,CAAA;IACb;;;;OAIG;IACH,yDAAe,CAAA;IACf;;;;;OAKG;IACH,qDAAa,CAAA;IACb;;;OAGG;IACH,uDAAc,CAAA;AAChB,CAAC,EAzBW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAyBrB;AA0ED,SAAS,aAAa,CAAC,UAAsB,EAAE,YAAqB;IAClE,OAAO,YAAY,IAAI,UAAU,CAAC,WAAW,KAAK,UAAU,CAAC;AAC/D,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAa,SAAS;IAsFpB;;OAEG;IACH,YAAmB,KAAoC;QACrD,IAAI,CAAC,UAAU,GAAG,KAAK,EAAE,UAAU,IAAI,UAAU,CAAC,SAAS,CAAC;QAC5D,IAAI,CAAC,UAAU,GAAG,KAAK,EAAE,UAAU,IAAI,IAAI,CAAC;QAC5C,IAAI,CAAC,QAAQ,GAAG,KAAK,EAAE,QAAQ,IAAI,IAAI,CAAC;QACxC,IAAI,CAAC,OAAO,GAAG,KAAK,EAAE,OAAO,IAAI,IAAI,CAAC;QACtC,IAAI,CAAC,MAAM,GAAG,KAAK,EAAE,MAAM,IAAI,IAAI,CAAC;QACpC,I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AAK,KAAK,CAAC,YAAY;eACxC,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI;eACxB,IAAI,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ;eAChC,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,SAAS;eAClC,IAAI,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ;eAChC,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI;eACxB,IAAI,CAAC,YAAY,KAAK,KAAK,CAAC,YAAY;eACxC,IAAI,CAAC,WAAW,KAAK,KAAK,CAAC,WAAW;eACtC,IAAI,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ;eAChC,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,OAAO;eAC9B,IAAI,CAAC,UAAU,KAAK,KAAK,CAAC,UAAU;eACpC,IAAI,CAAC,aAAa,KAAK,KAAK,CAAC,aAAa;eAC1C,IAAI,CAAC,UAAU,KAAK,KAAK,CAAC,UAAU;eACpC,IAAI,CAAC,aAAa,KAAK,KAAK,CAAC,aAAa;eAC1C,IAAI,CAAC,gBAAgB,KAAK,KAAK,CAAC,gBAAgB;eAChD,IAAI,CAAC,eAAe,KAAK,KAAK,CAAC,eAAe;eAC9C,IAAI,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ;eAChC,IAAI,CAAC,mBAAmB,KAAK,KAAK,CAAC,mBAAmB;eACtD,IAAI,CAAC,oBAAoB,KAAK,KAAK,CAAC,oBAAoB,CAAC;IAChE,CAAC;;AAzFD,kFAAkF;AAC3D,kBAAQ,GAAG,IAAI,SAAS,EAAE,CAAC;AAzTvC,8BAAS","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 DisplayStyles\r\n */\r\n\r\n// cspell:ignore ovrs\r\n\r\nimport { JsonUtils, Mutable, NonFunctionPropertiesOf } from \"@itwin/core-bentley\";\r\n\r\n/** Enumerates the available basic rendering modes, as part of a [DisplayStyle]($backend)'s [[ViewFlags]].\r\n * The rendering mode broadly affects various aspects of the display style - in particular, whether and how surfaces and their edges are drawn.\r\n * @public\r\n * @extensions\r\n */\r\nexport enum RenderMode {\r\n /** Renders only the edges of surfaces, with exceptions for planar regions based on their [[FillFlags]].\r\n * Lighting (and by extension, shadows) is not applied.\r\n * [[HiddenLine.Settings]] are not applied - edges use the elements' width, style, and color.\r\n * [[ViewFlags.hiddenEdges]] is ignored - hidden edges are never displayed in wireframe mode.\r\n */\r\n Wireframe = 0,\r\n /** By default, renders surfaces without their edges.\r\n * Lighting and shadows can be applied using [[ViewFlags.lighting]] and [[ViewFlags.shadows]].\r\n * Edges can be enabled using [[ViewFlags.visibleEdges]] and [[ViewFlags.hiddenEdges]], and their appearance customized using [[HiddenLine.Settings]].\r\n * Surfaces can be drawn with transparency, based on [[ViewFlags.transparency]].\r\n */\r\n SmoothShade = 6,\r\n /** Renders surfaces and their edges. By default, edges are drawn in white; this can be overridden using [[HiddenLine.Settings]].\r\n * All surfaces are rendered opaque. If a surface's transparency is below that specified by [[HiddenLine.Settings.transparencyThreshold]], it is not rendered.\r\n * Materials and textures are not applied - surfaces are drawn in their actual colors.\r\n * [[ViewFlags.visibleEdges]] is ignored - visible edges are always drawn. Hidden edges can be enabled using [[ViewFlags.hiddenEdges]].\r\n * Lighting (and by extension, shadows) is not applied.\r\n */\r\n SolidFill = 4,\r\n /** Identical to [[RenderMode.SolidFill]], except:\r\n * - Surfaces are drawn using the [DisplayStyle]($backend)'s background color.\r\n * - Edges are drawn using their surface's colors; this can be overridden using [[HiddenLine.Settings]].\r\n */\r\n HiddenLine = 3,\r\n}\r\n\r\n/** JSON representation of [[ViewFlags]].\r\n * This is a persistence format with some unfortunate quirks that have been retained for backwards compatibility.\r\n * In particular, it supplies three separate flags intended to control lighting - [[noCameraLights]], [[noSourceLights]], and [[noSolarLight]] -\r\n * but there exists only a single [[ViewFlags.lighting]] flag. [[ViewFlags.lighting]] is set to true unless all three of the \"no lighting\" flags are true.\r\n * It also uses awkward negative ([[noConstruct]], [[noTransp]]) and/or abbreviated ([[clipVol]], [[visEdges]]) property names that differ from\r\n * those of the corresponding [[ViewFlags]] properties, making usage of this type in code error-prone.\r\n * Prefer to use [[ViewFlagsProperties]] unless you need to work directly with the persistence format.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface ViewFlagProps {\r\n /** If true, don't display geometry of class [[GeometryClass.Construction]]. */\r\n noConstruct?: boolean;\r\n /** If true, don't display geometry of class [[GeometryClass.Dimension]]. */\r\n noDim?: boolean;\r\n /** If true, don't display geometry of class [[GeometryClass.Pattern]]. */\r\n noPattern?: boolean;\r\n /** If true, all lines are drawn with a width of 1 pixel. */\r\n noWeight?: boolean;\r\n /** If true, don't apply [[LinePixels]] styles. */\r\n noStyle?: boolean;\r\n /** If true, display transparency geometry as opaque. */\r\n noTransp?: boolean;\r\n /** If true, don't show filled planar regions, unless they use [[FillFlags.Always]]. */\r\n noFill?: boolean;\r\n /** If true, display a grid in the view. */\r\n grid?: boolean;\r\n /** If true, display graphics representing the [AuxCoordSystem]($backend). */\r\n acs?: boolean;\r\n /** If true, don't apply [[RenderTexture]]s to surfaces. */\r\n noTexture?: boolean;\r\n /** If true, don't apply [[RenderMaterial]]s to surfaces. */\r\n noMaterial?: boolean;\r\n /** See [[ViewFlagProps]] for how this affects [[ViewFlags.lighting]]. */\r\n noCameraLights?: boolean;\r\n /** See [[ViewFlagProps]] for how this affects [[ViewFlags.lighting]]. */\r\n noSourceLights?: boolean;\r\n /** See [[ViewFlagProps]] for how this affects [[ViewFlags.lighting]]. */\r\n noSolarLight?: boolean;\r\n /** If true, display the edges of surfaces. */\r\n visEdges?: boolean;\r\n /** If true, display the edges of surfaces, even if they are behind other geometry. */\r\n hidEdges?: boolean;\r\n /** If true, display shadows. */\r\n shadows?: boolean;\r\n /** If true, apply the view's clipping volume. Has no effect on other types of clips like [[ModelClipGroups]]. */\r\n clipVol?: boolean;\r\n /** If true, apply the view's [[DisplayStyleSettings.monochromeColor]] and [[DisplayStyleSettings.monochromeMode]] to produce a monochrome image. */\r\n monochrome?: boolean;\r\n /** The basic rendering mode, which affects the behavior of other flags. */\r\n renderMode?: RenderMode;\r\n /** Display a background map. */\r\n backgroundMap?: boolean;\r\n /** If true, apply [[AmbientOcclusion]]. */\r\n ambientOcclusion?: boolean;\r\n /** If true, apply [[ThematicDisplay]]. */\r\n thematicDisplay?: boolean;\r\n /** If true, overlay surfaces with wiremesh to reveal their triangulation. */\r\n wiremesh?: boolean;\r\n /** Controls whether surface discard is always applied regardless of other ViewFlags.\r\n * Surface shaders contain complicated logic to ensure that the edges of a surface always draw in front of the surface, and that planar surfaces sketched coincident with\r\n * non-planar surfaces always draw in front of those non-planar surfaces.\r\n * When this view flag is set to false (the default), then for 3d views if the render mode is wireframe (only edges are displayed) or smooth shader with visible edges turned off (only surfaces are displayed),\r\n * that logic does not execute, potentially improving performance for no degradation in visual quality. In some scenarios - such as wireframe views containing many planar regions with interior fill, or smooth views containing many coincident planar and non-planar surfaces - enabling this view flag improves display quality by forcing that logic to execute.\r\n */\r\n forceSurfaceDiscard?: boolean;\r\n /** Disables the \"white-on-white reversal\" employed by some CAD applications.\r\n * @see [[ViewFlags.whiteOnWhiteReversal]].\r\n */\r\n noWhiteOnWhiteReversal?: boolean;\r\n}\r\n\r\nfunction edgesRequired(renderMode: RenderMode, visibleEdges: boolean): boolean {\r\n return visibleEdges || RenderMode.SmoothShade !== renderMode;\r\n}\r\n\r\n/** Flags controlling how graphics appear within a view.\r\n * A [[ViewFlags]] object is immutable. There are several ways to produce a modified copy of a ViewFlags object:\r\n * ```ts\r\n * // Start with the default values for all properties.\r\n * let vf = ViewFlags.defaults;\r\n * // Change a single boolean property:\r\n * vf = vf.with(\"visibleEdges\", true);\r\n * // Change only the render mode:\r\n * vf = vf.withRenderMode(RenderMode.HiddenLine);\r\n * // Change multiple properties:\r\n * vf = vf.copy({ renderMode: RenderMode.SmoothShade, visibleEdges: true });\r\n * // Reset multiple properties to their default values:\r\n * vf = vf.copy({ renderMode: undefined, visibleEdges: undefined });\r\n *\r\n * ```\r\n * [[with]] and [[withRenderMode]] should be preferred if you only need to change a single property, as they will not create a new object unless\r\n * the new value differs from the current value.\r\n * [[copy]] and [[override]] should be preferred if you need to change multiple properties, as they will create no more than one new object, vs\r\n * each call to [[with]] or [[withRenderMode]] potentially creating a new object.\r\n * @see [[DisplayStyleSettings.viewFlags]] to define the view flags for a [DisplayStyle]($backend).\r\n * @public\r\n */\r\nexport class ViewFlags {\r\n /** The basic rendering mode applied to the view. This modulates the behavior of some of the other flags.\r\n * Default: [[RenderMode.Wireframe]].\r\n * @see [[RenderMode]] for details.\r\n */\r\n public readonly renderMode: RenderMode;\r\n /** Whether to display geometry of class [[GeometryClass.Dimension]]. Default: true. */\r\n public readonly dimensions: boolean;\r\n /** Whether to display geometry of class [[GeometryClass.Pattern]]. Default: true. */\r\n public readonly patterns: boolean;\r\n /** Whether to allow lines and edges to draw with width greater than one pixel. Default: true. */\r\n public readonly weights: boolean;\r\n /** Whether [[LinePixels]] are allowed to apply patterns to lines and edges. If false, they all draw as solid lines. Default: true. */\r\n public readonly styles: boolean;\r\n /** Whether element transparency is applied. If false, transparent geometry is drawn opaque. Default: true.\r\n * @see [[RenderMode]] for render mode-specific behavior.\r\n */\r\n public readonly transparency: boolean;\r\n /** In [[RenderMode.Wireframe]] only, whether to display the interiors of planar regions with [[FillFlags.ByView]]. Default: true. */\r\n public readonly fill: boolean;\r\n /** In [[RenderMode.SmoothShade]], whether to apply [[RenderTexture]]s to surfaces. Default: true. */\r\n public readonly textures: boolean;\r\n /** In [[RenderMode.SmoothShade]], whether to apply [[RenderMaterial]]s to surfaces. Default: true. */\r\n public readonly materials: boolean;\r\n /** Whether to display a graphical representation of the view's [AuxCoordSystem]($backend). Default: false. */\r\n public readonly acsTriad: boolean;\r\n /** Whether to display a grid. Default: false. */\r\n public readonly grid: boolean;\r\n /** In [[RenderMode.SmoothShade]], whether to display the edges of surfaces. Default: false.\r\n * @see [[HiddenLine.Settings]] to customize the appearance of the edges.\r\n */\r\n public readonly visibleEdges: boolean;\r\n /** In any mode except [[RenderMode.Wireframe]], whether to display the edges of surfaces occluded by other geometry.\r\n * This has no effect unless [[visibleEdges]] is also true.\r\n * Default: false.\r\n * @see [[HiddenLine.Settings]] to customize the appearance of the edges.\r\n */\r\n public readonly hiddenEdges: boolean;\r\n /** In [[RenderMode.SmoothShade]], whether to display solar shadows. This has no effect unless [[lighting]] is also true. Default: false.\r\n * @note Rendering shadows can reduce framerate, particularly on less capable graphics hardware or in complex scenes.\r\n */\r\n public readonly shadows: boolean;\r\n /** Whether to apply the view's clip volume to the geometry in the scene.\r\n * Default: true, except when using [[fromJSON]].\r\n * @see [[ViewDetails.clipVector]] to define the view's clip volume.\r\n */\r\n public readonly clipVolume: boolean;\r\n /** Whether to display geometry of class [[GeometryClass.Construction]].\r\n * Default: false, except when using [[fromJSON]].\r\n */\r\n public readonly constructions: boolean;\r\n /** Whether to produce a monochrome image. Default: false.\r\n * @see [DisplayStyleSettings.monochromeColor]($common) to define the monochrome color.\r\n * @see [DisplayStyleSettings.monochromeMode]($common) to define how the monochrome image is produced.\r\n */\r\n public readonly monochrome: boolean;\r\n /** Whether to display background map imagery. Default: false.\r\n * @see [[DisplayStyleSettings.backgroundMap]] to customize the map settings.\r\n */\r\n public readonly backgroundMap: boolean;\r\n /** In [[RenderMode.SmoothShade]], whether to apply [[AmbientOcclusion]]. Default: false. */\r\n public readonly ambientOcclusion: boolean;\r\n /** Whether to apply [[ThematicDisplay]]. Default: false. */\r\n public readonly thematicDisplay: boolean;\r\n /** If true, overlay surfaces with wiremesh to reveal their triangulation. */\r\n public readonly wiremesh: boolean;\r\n /** Controls whether surface discard is always applied regardless of other ViewFlags.\r\n * Surface shaders contain complicated logic to ensure that the edges of a surface always draw in front of the surface, and that planar surfaces sketched coincident with\r\n * non-planar surfaces always draw in front of those non-planar surfaces.\r\n * When this view flag is set to false (the default), then for 3d views if the render mode is wireframe (only edges are displayed) or smooth shader with visible edges turned off (only surfaces are displayed),\r\n * that logic does not execute, potentially improving performance for no degradation in visual quality. In some scenarios - such as wireframe views containing many planar regions with interior fill, or smooth views containing many coincident planar and non-planar surfaces - enabling this view flag improves display quality by forcing that logic to execute.\r\n */\r\n public readonly forceSurfaceDiscard: boolean;\r\n /** Whether to apply white-on-white reversal.\r\n * Some CAD applications use this to cause white geometry to be drawn as black if the view's background color is white.\r\n * When enabled, the [[DisplayStyleSettings]]' [[WhiteOnWhiteReversalSettings]] control how white-on-white reversal is applied.\r\n * Default: true.\r\n */\r\n public readonly whiteOnWhiteReversal: boolean;\r\n\r\n /** In [[RenderMode.SmoothShade]], whether to apply lighting to surfaces.\r\n * Default: false, except when using [[fromJSON]].\r\n * @see [[DisplayStyleSettings.lights]] to customize the light settings.\r\n */\r\n public readonly lighting: boolean;\r\n\r\n /** Create a new ViewFlags.\r\n * @param flags The properties to initialize. Any properties not specified are initialized to their default values.\r\n */\r\n public constructor(flags?: Partial<ViewFlagsProperties>) {\r\n this.renderMode = flags?.renderMode ?? RenderMode.Wireframe;\r\n this.dimensions = flags?.dimensions ?? true;\r\n this.patterns = flags?.patterns ?? true;\r\n this.weights = flags?.weights ?? true;\r\n this.styles = flags?.styles ?? true;\r\n this.transparency = flags?.transparency ?? true;\r\n this.fill = flags?.fill ?? true;\r\n this.textures = flags?.textures ?? true;\r\n this.materials = flags?.materials ?? true;\r\n this.acsTriad = flags?.acsTriad ?? false;\r\n this.grid = flags?.grid ?? false;\r\n this.visibleEdges = flags?.visibleEdges ?? false;\r\n this.hiddenEdges = flags?.hiddenEdges ?? false;\r\n this.shadows = flags?.shadows ?? false;\r\n this.clipVolume = flags?.clipVolume ?? true;\r\n this.constructions = flags?.constructions ?? false;\r\n this.monochrome = flags?.monochrome ?? false;\r\n this.backgroundMap = flags?.backgroundMap ?? false;\r\n this.ambientOcclusion = flags?.ambientOcclusion ?? false;\r\n this.thematicDisplay = flags?.thematicDisplay ?? false;\r\n this.wiremesh = flags?.wiremesh ?? false;\r\n this.forceSurfaceDiscard = flags?.forceSurfaceDiscard ?? false;\r\n this.whiteOnWhiteReversal = flags?.whiteOnWhiteReversal ?? true;\r\n this.lighting = flags?.lighting ?? false;\r\n }\r\n\r\n /** Produce a copy of these ViewFlags with some modified properties. Any properties not explicitly specified by `changedFlags` will retain their current values.\r\n * @param changedFlags Properties to modify.\r\n * @returns A copy of these ViewFlags modified according to the supplied properties.\r\n * @note Any explicitly `undefined` property of `changedFlags` will be set to its default value in the returned ViewFlags.\r\n * @see [[override]] to have `undefined` properties retain their current values.\r\n */\r\n public copy(changedFlags: Partial<ViewFlagsProperties>): ViewFlags {\r\n return JsonUtils.isNonEmptyObject(changedFlags) ? new ViewFlags({ ...this, ...changedFlags }) : this;\r\n }\r\n\r\n /** Produce a copy of these ViewFlags, overriding some of its properties. Any properties not explicitly specified by `overrides` will retain their current values,\r\n * as will any property explicitly set to `undefined`.\r\n * @param overrides The properties to override.\r\n * @see [[copy]] to have `undefined` properties reset to their default values.\r\n */\r\n public override(overrides: Partial<ViewFlagsProperties>): ViewFlags {\r\n // This method can get called very frequently when a RenderTimeline script is applied to the view. Often `overrides` will be an empty object.\r\n // To optimize:\r\n // - Bail as quickly as possible if nothing is actually overridden, without allocating a new ViewFlags.\r\n // - Only make a copy of the input if at least one property is explicitly `undefined`.\r\n let copied = false;\r\n let anyOverridden = false;\r\n\r\n for (const propName of Object.keys(overrides)) {\r\n const key = propName as keyof Partial<ViewFlagsProperties>;\r\n const overrideValue = overrides[key];\r\n if (undefined === overrideValue) {\r\n if (!copied) {\r\n // Don't modify input...\r\n overrides = { ...overrides };\r\n copied = true;\r\n }\r\n\r\n // `undefined` means \"retain existing value\".\r\n delete overrides[key];\r\n } else if (overrideValue !== this[key]) {\r\n anyOverridden = true;\r\n }\r\n }\r\n\r\n return anyOverridden ? this.copy(overrides) : this;\r\n }\r\n\r\n /** Produce a copy of these ViewFlags with a single boolean property changed.\r\n * @param flag The name of the property.\r\n * @param value The value to change the property to.\r\n * @returns A new ViewFlags with the property changed as specified, or `this` if the property already has the specified value.\r\n * @see [[withRenderMode]] to change the [[renderMode]] property.\r\n * @see [[copy]] and [[override]] to change multiple properties.\r\n */\r\n public with(flag: keyof Omit<ViewFlagsProperties, \"renderMode\">, value: boolean): ViewFlags {\r\n if (this[flag] === value)\r\n return this;\r\n\r\n const props: ViewFlagsProperties = { ...this };\r\n props[flag] = value;\r\n return new ViewFlags(props);\r\n }\r\n\r\n /** Produce a copy of these ViewFlags with a different [[renderMode]].\r\n * @param renderMode The new render mode.\r\n * @returns A new ViewFlags with the render mode changed as specified, or `this` if the render mode is already set to the requested value.\r\n * @see [[copy]] and [[override]] to change multiple properties.\r\n */\r\n public withRenderMode(renderMode: RenderMode): ViewFlags {\r\n return renderMode === this.renderMode ? this : this.copy({ renderMode });\r\n }\r\n\r\n /** Adjust view flags for renderer.\r\n * @internal\r\n */\r\n public normalize(): ViewFlags {\r\n switch (this.renderMode) {\r\n case RenderMode.Wireframe:\r\n if (this.visibleEdges || this.hiddenEdges)\r\n return this.copy({ visibleEdges: false, hiddenEdges: false });\r\n break;\r\n case RenderMode.SmoothShade:\r\n if (!this.visibleEdges)\r\n return this.copy({ hiddenEdges: false });\r\n break;\r\n case RenderMode.HiddenLine:\r\n case RenderMode.SolidFill:\r\n if (!this.visibleEdges || this.transparency)\r\n return this.copy({ visibleEdges: true, transparency: false });\r\n break;\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /** @internal */\r\n public hiddenEdgesVisible(): boolean {\r\n switch (this.renderMode) {\r\n case RenderMode.SolidFill:\r\n case RenderMode.HiddenLine:\r\n return this.hiddenEdges;\r\n case RenderMode.SmoothShade:\r\n return this.visibleEdges && this.hiddenEdges;\r\n }\r\n return true;\r\n }\r\n\r\n /** Returns true if the edges of surfaces should be displayed, based on [[RenderMode]] and the [[visibleEdges]] flag. */\r\n public edgesRequired(): boolean {\r\n return edgesRequired(this.renderMode, this.visibleEdges);\r\n }\r\n\r\n /** Convert to JSON representation.\r\n * Properties are omitted if they match the default values.\r\n */\r\n public toJSON(): ViewFlagProps {\r\n const out: ViewFlagProps = {};\r\n if (!this.constructions)\r\n out.noConstruct = true;\r\n if (!this.dimensions)\r\n out.noDim = true;\r\n if (!this.patterns)\r\n out.noPattern = true;\r\n if (!this.weights)\r\n out.noWeight = true;\r\n if (!this.styles)\r\n out.noStyle = true;\r\n if (!this.transparency)\r\n out.noTransp = true;\r\n if (!this.fill)\r\n out.noFill = true;\r\n if (this.grid)\r\n out.grid = true;\r\n if (this.acsTriad)\r\n out.acs = true;\r\n if (!this.textures)\r\n out.noTexture = true;\r\n if (!this.materials)\r\n out.noMaterial = true;\r\n if (!this.lighting)\r\n out.noCameraLights = out.noSourceLights = out.noSolarLight = true;\r\n if (this.visibleEdges)\r\n out.visEdges = true;\r\n if (this.hiddenEdges)\r\n out.hidEdges = true;\r\n if (this.shadows)\r\n out.shadows = true;\r\n if (this.clipVolume)\r\n out.clipVol = true;\r\n if (this.monochrome)\r\n out.monochrome = true;\r\n if (this.backgroundMap)\r\n out.backgroundMap = true;\r\n if (this.ambientOcclusion)\r\n out.ambientOcclusion = true;\r\n if (this.thematicDisplay)\r\n out.thematicDisplay = true;\r\n if (this.wiremesh)\r\n out.wiremesh = true;\r\n if (this.forceSurfaceDiscard)\r\n out.forceSurfaceDiscard = true;\r\n if (!this.whiteOnWhiteReversal)\r\n out.noWhiteOnWhiteReversal = true;\r\n\r\n out.renderMode = this.renderMode;\r\n return out;\r\n }\r\n\r\n /** Like [[toJSON]], but no properties are omitted. */\r\n public toFullyDefinedJSON(): Required<ViewFlagProps> {\r\n return {\r\n renderMode: this.renderMode,\r\n noConstruct: !this.constructions,\r\n noDim: !this.dimensions,\r\n noPattern: !this.patterns,\r\n noWeight: !this.weights,\r\n noStyle: !this.styles,\r\n noTransp: !this.transparency,\r\n noFill: !this.fill,\r\n grid: this.grid,\r\n acs: this.acsTriad,\r\n noTexture: !this.textures,\r\n noMaterial: !this.materials,\r\n noCameraLights: !this.lighting,\r\n noSourceLights: !this.lighting,\r\n noSolarLight: !this.lighting,\r\n visEdges: this.visibleEdges,\r\n hidEdges: this.hiddenEdges,\r\n shadows: this.shadows,\r\n clipVol: this.clipVolume,\r\n monochrome: this.monochrome,\r\n backgroundMap: this.backgroundMap,\r\n ambientOcclusion: this.ambientOcclusion,\r\n thematicDisplay: this.thematicDisplay,\r\n wiremesh: this.wiremesh,\r\n forceSurfaceDiscard: this.forceSurfaceDiscard,\r\n noWhiteOnWhiteReversal: !this.whiteOnWhiteReversal,\r\n };\r\n }\r\n\r\n /** A ViewFlags object with all properties initialized to their default values. */\r\n public static readonly defaults = new ViewFlags();\r\n\r\n /** Create a ViewFlags.\r\n * @param flags The properties to initialize. Any properties not specified are initialized to their default values.\r\n */\r\n public static create(flags?: Partial<ViewFlagsProperties>): ViewFlags {\r\n return flags && !JsonUtils.isEmptyObject(flags) ? new ViewFlags(flags) : this.defaults;\r\n }\r\n\r\n /** Create a ViewFlags from its JSON representation.\r\n * @note As described in [[ViewFlagProps]], the JSON representation is awkward and error-prone. Prefer to use [[create]] unless you\r\n * need to deal with the persistence format directly.\r\n * @note The default values differ slightly from those used by the constructor and [[create]]:\r\n * - [[clipVolume]] defaults to false.\r\n * - [[constructions]] defaults to true.\r\n * - [[lighting]] defaults to true unless all of [[ViewFlagProps.noSolarLight]], [[ViewFlagProps.noCameraLights]], and [[ViewFlagProps.noSourceLights]] are true.\r\n */\r\n public static fromJSON(json?: ViewFlagProps): ViewFlags {\r\n if (!json)\r\n return this.defaults;\r\n\r\n let renderMode: RenderMode;\r\n const renderModeValue = JsonUtils.asInt(json.renderMode);\r\n if (renderModeValue < RenderMode.HiddenLine)\r\n renderMode = RenderMode.Wireframe;\r\n else if (renderModeValue > RenderMode.SolidFill)\r\n renderMode = RenderMode.SmoothShade;\r\n else\r\n renderMode = renderModeValue;\r\n\r\n const lighting = !JsonUtils.asBool(json.noCameraLights) || !JsonUtils.asBool(json.noSourceLights) || !JsonUtils.asBool(json.noSolarLight);\r\n return new ViewFlags({\r\n renderMode,\r\n lighting,\r\n constructions: !JsonUtils.asBool(json.noConstruct),\r\n dimensions: !JsonUtils.asBool(json.noDim),\r\n patterns: !JsonUtils.asBool(json.noPattern),\r\n weights: !JsonUtils.asBool(json.noWeight),\r\n styles: !JsonUtils.asBool(json.noStyle),\r\n transparency: !JsonUtils.asBool(json.noTransp),\r\n fill: !JsonUtils.asBool(json.noFill),\r\n grid: JsonUtils.asBool(json.grid),\r\n acsTriad: JsonUtils.asBool(json.acs),\r\n textures: !JsonUtils.asBool(json.noTexture),\r\n materials: !JsonUtils.asBool(json.noMaterial),\r\n visibleEdges: JsonUtils.asBool(json.visEdges),\r\n hiddenEdges: JsonUtils.asBool(json.hidEdges),\r\n shadows: JsonUtils.asBool(json.shadows),\r\n clipVolume: JsonUtils.asBool(json.clipVol),\r\n monochrome: JsonUtils.asBool(json.monochrome),\r\n backgroundMap: JsonUtils.asBool(json.backgroundMap),\r\n ambientOcclusion: JsonUtils.asBool(json.ambientOcclusion),\r\n thematicDisplay: JsonUtils.asBool(json.thematicDisplay),\r\n wiremesh: JsonUtils.asBool(json.wiremesh),\r\n forceSurfaceDiscard: JsonUtils.asBool(json.forceSurfaceDiscard),\r\n whiteOnWhiteReversal: !JsonUtils.asBool(json.noWhiteOnWhiteReversal),\r\n });\r\n }\r\n\r\n /** Returns true if `this` and `other` are equivalent. */\r\n public equals(other: Readonly<ViewFlagsProperties>): boolean {\r\n if (this === other)\r\n return true;\r\n\r\n return this.renderMode === other.renderMode\r\n && this.dimensions === other.dimensions\r\n && this.patterns === other.patterns\r\n && this.weights === other.weights\r\n && this.styles === other.styles\r\n && this.transparency === other.transparency\r\n && this.fill === other.fill\r\n && this.textures === other.textures\r\n && this.materials === other.materials\r\n && this.acsTriad === other.acsTriad\r\n && this.grid === other.grid\r\n && this.visibleEdges === other.visibleEdges\r\n && this.hiddenEdges === other.hiddenEdges\r\n && this.lighting === other.lighting\r\n && this.shadows === other.shadows\r\n && this.clipVolume === other.clipVolume\r\n && this.constructions === other.constructions\r\n && this.monochrome === other.monochrome\r\n && this.backgroundMap === other.backgroundMap\r\n && this.ambientOcclusion === other.ambientOcclusion\r\n && this.thematicDisplay === other.thematicDisplay\r\n && this.wiremesh === other.wiremesh\r\n && this.forceSurfaceDiscard === other.forceSurfaceDiscard\r\n && this.whiteOnWhiteReversal === other.whiteOnWhiteReversal;\r\n }\r\n}\r\n\r\n/** A type containing all of the properties of [[ViewFlags]] with none of the methods and with the `readonly` modifiers removed.\r\n * @see [[ViewFlags.create]], [[ViewFlags.copy]], and [[ViewFlags.override]] for methods accepting an object of this type.\r\n * @public\r\n * @extensions\r\n */\r\nexport type ViewFlagsProperties = Mutable<NonFunctionPropertiesOf<ViewFlags>>;\r\n\r\n/** A type that describes how to override selected properties of a [[ViewFlags]].\r\n * @see [[ViewFlags.override]] to apply the overrides to a ViewFlags object.\r\n * @public\r\n * @extensions\r\n */\r\nexport type ViewFlagOverrides = Partial<ViewFlagsProperties>;\r\n"]}
1
+ {"version":3,"file":"ViewFlags.js","sourceRoot":"","sources":["../../src/ViewFlags.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,qBAAqB;AAErB,sDAAkF;AAElF;;;;GAIG;AACH,IAAY,UAyBX;AAzBD,WAAY,UAAU;IACpB;;;;OAIG;IACH,qDAAa,CAAA;IACb;;;;OAIG;IACH,yDAAe,CAAA;IACf;;;;;OAKG;IACH,qDAAa,CAAA;IACb;;;OAGG;IACH,uDAAc,CAAA;AAChB,CAAC,EAzBW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAyBrB;AA0ED,SAAS,aAAa,CAAC,UAAsB,EAAE,YAAqB;IAClE,OAAO,YAAY,IAAI,UAAU,CAAC,WAAW,KAAK,UAAU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,IAAI,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ;eAChC,IAAI,CAAC,mBAAmB,KAAK,KAAK,CAAC,mBAAmB;eACtD,IAAI,CAAC,oBAAoB,KAAK,KAAK,CAAC,oBAAoB,CAAC;IAChE,CAAC;;AAzFD,kFAAkF;AAC3D,kBAAQ,GAAG,IAAI,SAAS,EAAE,CAAC;AAzTvC,8BAAS","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 DisplayStyles\r\n */\r\n\r\n// cspell:ignore ovrs\r\n\r\nimport { JsonUtils, Mutable, NonFunctionPropertiesOf } from \"@itwin/core-bentley\";\r\n\r\n/** Enumerates the available basic rendering modes, as part of a [DisplayStyle]($backend)'s [[ViewFlags]].\r\n * The rendering mode broadly affects various aspects of the display style - in particular, whether and how surfaces and their edges are drawn.\r\n * @public\r\n * @extensions\r\n */\r\nexport enum RenderMode {\r\n /** Renders only the edges of surfaces, with exceptions for planar regions based on their [[FillFlags]].\r\n * Lighting (and by extension, shadows) is not applied.\r\n * [[HiddenLine.Settings]] are not applied - edges use the elements' width, style, and color.\r\n * [[ViewFlags.hiddenEdges]] is ignored - hidden edges are never displayed in wireframe mode.\r\n */\r\n Wireframe = 0,\r\n /** By default, renders surfaces without their edges.\r\n * Lighting and shadows can be applied using [[ViewFlags.lighting]] and [[ViewFlags.shadows]].\r\n * Edges can be enabled using [[ViewFlags.visibleEdges]] and [[ViewFlags.hiddenEdges]], and their appearance customized using [[HiddenLine.Settings]].\r\n * Surfaces can be drawn with transparency, based on [[ViewFlags.transparency]].\r\n */\r\n SmoothShade = 6,\r\n /** Renders surfaces and their edges. By default, edges are drawn in white; this can be overridden using [[HiddenLine.Settings]].\r\n * All surfaces are rendered opaque. If a surface's transparency is below that specified by [[HiddenLine.Settings.transparencyThreshold]], it is not rendered.\r\n * Materials and textures are not applied - surfaces are drawn in their actual colors.\r\n * [[ViewFlags.visibleEdges]] is ignored - visible edges are always drawn. Hidden edges can be enabled using [[ViewFlags.hiddenEdges]].\r\n * Lighting (and by extension, shadows) is not applied.\r\n */\r\n SolidFill = 4,\r\n /** Identical to [[RenderMode.SolidFill]], except:\r\n * - Surfaces are drawn using the [DisplayStyle]($backend)'s background color.\r\n * - Edges are drawn using their surface's colors; this can be overridden using [[HiddenLine.Settings]].\r\n */\r\n HiddenLine = 3,\r\n}\r\n\r\n/** JSON representation of [[ViewFlags]].\r\n * This is a persistence format with some unfortunate quirks that have been retained for backwards compatibility.\r\n * In particular, it supplies three separate flags intended to control lighting - [[noCameraLights]], [[noSourceLights]], and [[noSolarLight]] -\r\n * but there exists only a single [[ViewFlags.lighting]] flag. [[ViewFlags.lighting]] is set to true unless all three of the \"no lighting\" flags are true.\r\n * It also uses awkward negative ([[noConstruct]], [[noTransp]]) and/or abbreviated ([[clipVol]], [[visEdges]]) property names that differ from\r\n * those of the corresponding [[ViewFlags]] properties, making usage of this type in code error-prone.\r\n * Prefer to use [[ViewFlagsProperties]] unless you need to work directly with the persistence format.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface ViewFlagProps {\r\n /** If true, don't display geometry of class [[GeometryClass.Construction]]. */\r\n noConstruct?: boolean;\r\n /** If true, don't display geometry of class [[GeometryClass.Dimension]]. */\r\n noDim?: boolean;\r\n /** If true, don't display geometry of class [[GeometryClass.Pattern]]. */\r\n noPattern?: boolean;\r\n /** If true, all lines are drawn with a width of 1 pixel. */\r\n noWeight?: boolean;\r\n /** If true, don't apply [[LinePixels]] styles. */\r\n noStyle?: boolean;\r\n /** If true, display transparency geometry as opaque. */\r\n noTransp?: boolean;\r\n /** If true, don't show filled planar regions, unless they use [[FillFlags.Always]]. */\r\n noFill?: boolean;\r\n /** If true, display a grid in the view. */\r\n grid?: boolean;\r\n /** If true, display graphics representing the [AuxCoordSystem]($backend). */\r\n acs?: boolean;\r\n /** If true, don't apply [[RenderTexture]]s to surfaces. */\r\n noTexture?: boolean;\r\n /** If true, don't apply [[RenderMaterial]]s to surfaces. */\r\n noMaterial?: boolean;\r\n /** See [[ViewFlagProps]] for how this affects [[ViewFlags.lighting]]. */\r\n noCameraLights?: boolean;\r\n /** See [[ViewFlagProps]] for how this affects [[ViewFlags.lighting]]. */\r\n noSourceLights?: boolean;\r\n /** See [[ViewFlagProps]] for how this affects [[ViewFlags.lighting]]. */\r\n noSolarLight?: boolean;\r\n /** If true, display the edges of surfaces. */\r\n visEdges?: boolean;\r\n /** If true, display the edges of surfaces, even if they are behind other geometry. */\r\n hidEdges?: boolean;\r\n /** If true, display shadows. */\r\n shadows?: boolean;\r\n /** If true, apply the view's clipping volume. Has no effect on other types of clips like [[ModelClipGroups]]. */\r\n clipVol?: boolean;\r\n /** If true, apply the view's [[DisplayStyleSettings.monochromeColor]] and [[DisplayStyleSettings.monochromeMode]] to produce a monochrome image. */\r\n monochrome?: boolean;\r\n /** The basic rendering mode, which affects the behavior of other flags. */\r\n renderMode?: RenderMode;\r\n /** Display a background map. */\r\n backgroundMap?: boolean;\r\n /** If true, apply [[AmbientOcclusion]]. */\r\n ambientOcclusion?: boolean;\r\n /** If true, apply [[ThematicDisplay]]. */\r\n thematicDisplay?: boolean;\r\n /** If true, overlay surfaces with wiremesh to reveal their triangulation. */\r\n wiremesh?: boolean;\r\n /** Controls whether surface discard is always applied regardless of other ViewFlags.\r\n * Surface shaders contain complicated logic to ensure that the edges of a surface always draw in front of the surface, and that planar surfaces sketched coincident with\r\n * non-planar surfaces always draw in front of those non-planar surfaces.\r\n * When this view flag is set to false (the default), then for 3d views if the render mode is wireframe (only edges are displayed) or smooth shader with visible edges turned off (only surfaces are displayed),\r\n * that logic does not execute, potentially improving performance for no degradation in visual quality. In some scenarios - such as wireframe views containing many planar regions with interior fill, or smooth views containing many coincident planar and non-planar surfaces - enabling this view flag improves display quality by forcing that logic to execute.\r\n */\r\n forceSurfaceDiscard?: boolean;\r\n /** Disables the \"white-on-white reversal\" employed by some CAD applications.\r\n * @see [[ViewFlags.whiteOnWhiteReversal]].\r\n */\r\n noWhiteOnWhiteReversal?: boolean;\r\n}\r\n\r\nfunction edgesRequired(renderMode: RenderMode, visibleEdges: boolean): boolean {\r\n return visibleEdges || RenderMode.SmoothShade !== renderMode;\r\n}\r\n\r\n/** Flags controlling how graphics appear within a view.\r\n * A [[ViewFlags]] object is immutable. There are several ways to produce a modified copy of a ViewFlags object:\r\n * ```ts\r\n * // Start with the default values for all properties.\r\n * let vf = ViewFlags.defaults;\r\n * // Change a single boolean property:\r\n * vf = vf.with(\"visibleEdges\", true);\r\n * // Change only the render mode:\r\n * vf = vf.withRenderMode(RenderMode.HiddenLine);\r\n * // Change multiple properties:\r\n * vf = vf.copy({ renderMode: RenderMode.SmoothShade, visibleEdges: true });\r\n * // Reset multiple properties to their default values:\r\n * vf = vf.copy({ renderMode: undefined, visibleEdges: undefined });\r\n *\r\n * ```\r\n * [[with]] and [[withRenderMode]] should be preferred if you only need to change a single property, as they will not create a new object unless\r\n * the new value differs from the current value.\r\n * [[copy]] and [[override]] should be preferred if you need to change multiple properties, as they will create no more than one new object, vs\r\n * each call to [[with]] or [[withRenderMode]] potentially creating a new object.\r\n * @see [[DisplayStyleSettings.viewFlags]] to define the view flags for a [DisplayStyle]($backend).\r\n * @public\r\n */\r\nexport class ViewFlags {\r\n /** The basic rendering mode applied to the view. This modulates the behavior of some of the other flags.\r\n * Default: [[RenderMode.Wireframe]].\r\n * @see [[RenderMode]] for details.\r\n */\r\n public readonly renderMode: RenderMode;\r\n /** Whether to display geometry of class [[GeometryClass.Dimension]]. Default: true. */\r\n public readonly dimensions: boolean;\r\n /** Whether to display geometry of class [[GeometryClass.Pattern]]. Default: true. */\r\n public readonly patterns: boolean;\r\n /** Whether to allow lines and edges to draw with width greater than one pixel. Default: true. */\r\n public readonly weights: boolean;\r\n /** Whether [[LinePixels]] are allowed to apply patterns to lines and edges. If false, they all draw as solid lines. Default: true. */\r\n public readonly styles: boolean;\r\n /** Whether element transparency is applied. If false, transparent geometry is drawn opaque. Default: true.\r\n * @see [[RenderMode]] for render mode-specific behavior.\r\n */\r\n public readonly transparency: boolean;\r\n /** In [[RenderMode.Wireframe]] only, whether to display the interiors of planar regions with [[FillFlags.ByView]]. Default: true. */\r\n public readonly fill: boolean;\r\n /** In [[RenderMode.SmoothShade]], whether to apply [[RenderTexture]]s to surfaces. Default: true. */\r\n public readonly textures: boolean;\r\n /** In [[RenderMode.SmoothShade]], whether to apply [[RenderMaterial]]s to surfaces. Default: true. */\r\n public readonly materials: boolean;\r\n /** Whether to display a graphical representation of the view's [AuxCoordSystem]($backend). Default: false. */\r\n public readonly acsTriad: boolean;\r\n /** Whether to display a grid. Default: false. */\r\n public readonly grid: boolean;\r\n /** In [[RenderMode.SmoothShade]], whether to display the edges of surfaces. Default: false.\r\n * @see [[HiddenLine.Settings]] to customize the appearance of the edges.\r\n */\r\n public readonly visibleEdges: boolean;\r\n /** In any mode except [[RenderMode.Wireframe]], whether to display the edges of surfaces occluded by other geometry.\r\n * This has no effect unless [[visibleEdges]] is also true.\r\n * Default: false.\r\n * @see [[HiddenLine.Settings]] to customize the appearance of the edges.\r\n */\r\n public readonly hiddenEdges: boolean;\r\n /** In [[RenderMode.SmoothShade]], whether to display solar shadows. This has no effect unless [[lighting]] is also true. Default: false.\r\n * @note Rendering shadows can reduce framerate, particularly on less capable graphics hardware or in complex scenes.\r\n */\r\n public readonly shadows: boolean;\r\n /** Whether to apply the view's clip volume to the geometry in the scene.\r\n * Default: true, except when using [[fromJSON]].\r\n * @see [[ViewDetails.clipVector]] to define the view's clip volume.\r\n */\r\n public readonly clipVolume: boolean;\r\n /** Whether to display geometry of class [[GeometryClass.Construction]].\r\n * Default: false, except when using [[fromJSON]].\r\n */\r\n public readonly constructions: boolean;\r\n /** Whether to produce a monochrome image. Default: false.\r\n * @see [DisplayStyleSettings.monochromeColor]($common) to define the monochrome color.\r\n * @see [DisplayStyleSettings.monochromeMode]($common) to define how the monochrome image is produced.\r\n */\r\n public readonly monochrome: boolean;\r\n /** Whether to display background map imagery. Default: false.\r\n * @see [[DisplayStyleSettings.backgroundMap]] to customize the map settings.\r\n */\r\n public readonly backgroundMap: boolean;\r\n /** In [[RenderMode.SmoothShade]], whether to apply [[AmbientOcclusion]]. Default: false. */\r\n public readonly ambientOcclusion: boolean;\r\n /** Whether to apply [[ThematicDisplay]]. Default: false. */\r\n public readonly thematicDisplay: boolean;\r\n /** If true, overlay surfaces with wiremesh to reveal their triangulation. */\r\n public readonly wiremesh: boolean;\r\n /** Controls whether surface discard is always applied regardless of other ViewFlags.\r\n * Surface shaders contain complicated logic to ensure that the edges of a surface always draw in front of the surface, and that planar surfaces sketched coincident with\r\n * non-planar surfaces always draw in front of those non-planar surfaces.\r\n * When this view flag is set to false (the default), then for 3d views if the render mode is wireframe (only edges are displayed) or smooth shader with visible edges turned off (only surfaces are displayed),\r\n * that logic does not execute, potentially improving performance for no degradation in visual quality. In some scenarios - such as wireframe views containing many planar regions with interior fill, or smooth views containing many coincident planar and non-planar surfaces - enabling this view flag improves display quality by forcing that logic to execute.\r\n */\r\n public readonly forceSurfaceDiscard: boolean;\r\n /** Whether to apply white-on-white reversal.\r\n * Some CAD applications use this to cause white geometry to be drawn as black if the view's background color is white.\r\n * When enabled, the [[DisplayStyleSettings]]' [[WhiteOnWhiteReversalSettings]] control how white-on-white reversal is applied.\r\n * Default: true.\r\n */\r\n public readonly whiteOnWhiteReversal: boolean;\r\n\r\n /** In [[RenderMode.SmoothShade]], whether to apply lighting to surfaces.\r\n * Default: false, except when using [[fromJSON]].\r\n * @see [[DisplayStyleSettings.lights]] to customize the light settings.\r\n */\r\n public readonly lighting: boolean;\r\n\r\n /** Create a new ViewFlags.\r\n * @param flags The properties to initialize. Any properties not specified are initialized to their default values.\r\n */\r\n public constructor(flags?: Partial<ViewFlagsProperties>) {\r\n this.renderMode = flags?.renderMode ?? RenderMode.Wireframe;\r\n this.dimensions = flags?.dimensions ?? true;\r\n this.patterns = flags?.patterns ?? true;\r\n this.weights = flags?.weights ?? true;\r\n this.styles = flags?.styles ?? true;\r\n this.transparency = flags?.transparency ?? true;\r\n this.fill = flags?.fill ?? true;\r\n this.textures = flags?.textures ?? true;\r\n this.materials = flags?.materials ?? true;\r\n this.acsTriad = flags?.acsTriad ?? false;\r\n this.grid = flags?.grid ?? false;\r\n this.visibleEdges = flags?.visibleEdges ?? false;\r\n this.hiddenEdges = flags?.hiddenEdges ?? false;\r\n this.shadows = flags?.shadows ?? false;\r\n this.clipVolume = flags?.clipVolume ?? true;\r\n this.constructions = flags?.constructions ?? false;\r\n this.monochrome = flags?.monochrome ?? false;\r\n this.backgroundMap = flags?.backgroundMap ?? false;\r\n this.ambientOcclusion = flags?.ambientOcclusion ?? false;\r\n this.thematicDisplay = flags?.thematicDisplay ?? false;\r\n this.wiremesh = flags?.wiremesh ?? false;\r\n this.forceSurfaceDiscard = flags?.forceSurfaceDiscard ?? false;\r\n this.whiteOnWhiteReversal = flags?.whiteOnWhiteReversal ?? true;\r\n this.lighting = flags?.lighting ?? false;\r\n }\r\n\r\n /** Produce a copy of these ViewFlags with some modified properties. Any properties not explicitly specified by `changedFlags` will retain their current values.\r\n * @param changedFlags Properties to modify.\r\n * @returns A copy of these ViewFlags modified according to the supplied properties.\r\n * @note Any explicitly `undefined` property of `changedFlags` will be set to its default value in the returned ViewFlags.\r\n * @see [[override]] to have `undefined` properties retain their current values.\r\n */\r\n public copy(changedFlags: Partial<ViewFlagsProperties>): ViewFlags {\r\n return JsonUtils.isNonEmptyObject(changedFlags) ? new ViewFlags({ ...this, ...changedFlags }) : this;\r\n }\r\n\r\n /** Produce a copy of these ViewFlags, overriding some of its properties. Any properties not explicitly specified by `overrides` will retain their current values,\r\n * as will any property explicitly set to `undefined`.\r\n * @param overrides The properties to override.\r\n * @see [[copy]] to have `undefined` properties reset to their default values.\r\n */\r\n public override(overrides: Partial<ViewFlagsProperties>): ViewFlags {\r\n // This method can get called very frequently when a RenderTimeline script is applied to the view. Often `overrides` will be an empty object.\r\n // To optimize:\r\n // - Bail as quickly as possible if nothing is actually overridden, without allocating a new ViewFlags.\r\n // - Only make a copy of the input if at least one property is explicitly `undefined`.\r\n let copied = false;\r\n let anyOverridden = false;\r\n\r\n for (const propName of Object.keys(overrides)) {\r\n const key = propName as keyof Partial<ViewFlagsProperties>;\r\n const overrideValue = overrides[key];\r\n if (undefined === overrideValue) {\r\n if (!copied) {\r\n // Don't modify input...\r\n overrides = { ...overrides };\r\n copied = true;\r\n }\r\n\r\n // `undefined` means \"retain existing value\".\r\n delete overrides[key];\r\n } else if (overrideValue !== this[key]) {\r\n anyOverridden = true;\r\n }\r\n }\r\n\r\n return anyOverridden ? this.copy(overrides) : this;\r\n }\r\n\r\n /** Produce a copy of these ViewFlags with a single boolean property changed.\r\n * @param flag The name of the property.\r\n * @param value The value to change the property to.\r\n * @returns A new ViewFlags with the property changed as specified, or `this` if the property already has the specified value.\r\n * @see [[withRenderMode]] to change the [[renderMode]] property.\r\n * @see [[copy]] and [[override]] to change multiple properties.\r\n */\r\n public with(flag: keyof Omit<ViewFlagsProperties, \"renderMode\">, value: boolean): ViewFlags {\r\n if (this[flag] === value)\r\n return this;\r\n\r\n const props: ViewFlagsProperties = { ...this };\r\n props[flag] = value;\r\n return new ViewFlags(props);\r\n }\r\n\r\n /** Produce a copy of these ViewFlags with a different [[renderMode]].\r\n * @param renderMode The new render mode.\r\n * @returns A new ViewFlags with the render mode changed as specified, or `this` if the render mode is already set to the requested value.\r\n * @see [[copy]] and [[override]] to change multiple properties.\r\n */\r\n public withRenderMode(renderMode: RenderMode): ViewFlags {\r\n return renderMode === this.renderMode ? this : this.copy({ renderMode });\r\n }\r\n\r\n /** Adjust view flags for renderer.\r\n * @internal\r\n */\r\n public normalize(): ViewFlags {\r\n switch (this.renderMode) {\r\n case RenderMode.Wireframe:\r\n if (this.visibleEdges || this.hiddenEdges)\r\n return this.copy({ visibleEdges: false, hiddenEdges: false });\r\n break;\r\n case RenderMode.SmoothShade:\r\n if (!this.visibleEdges)\r\n return this.copy({ hiddenEdges: false });\r\n break;\r\n case RenderMode.HiddenLine:\r\n case RenderMode.SolidFill:\r\n if (!this.visibleEdges || this.transparency)\r\n return this.copy({ visibleEdges: true, transparency: false });\r\n break;\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /** Returns true if edges that could be occluded by other geometry are visible for the current [[RenderMode]]. */\r\n public hiddenEdgesVisible(): boolean {\r\n switch (this.renderMode) {\r\n case RenderMode.SolidFill:\r\n case RenderMode.HiddenLine:\r\n return this.hiddenEdges;\r\n case RenderMode.SmoothShade:\r\n return this.visibleEdges && this.hiddenEdges;\r\n }\r\n return true;\r\n }\r\n\r\n /** Returns true if the edges of surfaces should be displayed, based on [[RenderMode]] and the [[visibleEdges]] flag. */\r\n public edgesRequired(): boolean {\r\n return edgesRequired(this.renderMode, this.visibleEdges);\r\n }\r\n\r\n /** Convert to JSON representation.\r\n * Properties are omitted if they match the default values.\r\n */\r\n public toJSON(): ViewFlagProps {\r\n const out: ViewFlagProps = {};\r\n if (!this.constructions)\r\n out.noConstruct = true;\r\n if (!this.dimensions)\r\n out.noDim = true;\r\n if (!this.patterns)\r\n out.noPattern = true;\r\n if (!this.weights)\r\n out.noWeight = true;\r\n if (!this.styles)\r\n out.noStyle = true;\r\n if (!this.transparency)\r\n out.noTransp = true;\r\n if (!this.fill)\r\n out.noFill = true;\r\n if (this.grid)\r\n out.grid = true;\r\n if (this.acsTriad)\r\n out.acs = true;\r\n if (!this.textures)\r\n out.noTexture = true;\r\n if (!this.materials)\r\n out.noMaterial = true;\r\n if (!this.lighting)\r\n out.noCameraLights = out.noSourceLights = out.noSolarLight = true;\r\n if (this.visibleEdges)\r\n out.visEdges = true;\r\n if (this.hiddenEdges)\r\n out.hidEdges = true;\r\n if (this.shadows)\r\n out.shadows = true;\r\n if (this.clipVolume)\r\n out.clipVol = true;\r\n if (this.monochrome)\r\n out.monochrome = true;\r\n if (this.backgroundMap)\r\n out.backgroundMap = true;\r\n if (this.ambientOcclusion)\r\n out.ambientOcclusion = true;\r\n if (this.thematicDisplay)\r\n out.thematicDisplay = true;\r\n if (this.wiremesh)\r\n out.wiremesh = true;\r\n if (this.forceSurfaceDiscard)\r\n out.forceSurfaceDiscard = true;\r\n if (!this.whiteOnWhiteReversal)\r\n out.noWhiteOnWhiteReversal = true;\r\n\r\n out.renderMode = this.renderMode;\r\n return out;\r\n }\r\n\r\n /** Like [[toJSON]], but no properties are omitted. */\r\n public toFullyDefinedJSON(): Required<ViewFlagProps> {\r\n return {\r\n renderMode: this.renderMode,\r\n noConstruct: !this.constructions,\r\n noDim: !this.dimensions,\r\n noPattern: !this.patterns,\r\n noWeight: !this.weights,\r\n noStyle: !this.styles,\r\n noTransp: !this.transparency,\r\n noFill: !this.fill,\r\n grid: this.grid,\r\n acs: this.acsTriad,\r\n noTexture: !this.textures,\r\n noMaterial: !this.materials,\r\n noCameraLights: !this.lighting,\r\n noSourceLights: !this.lighting,\r\n noSolarLight: !this.lighting,\r\n visEdges: this.visibleEdges,\r\n hidEdges: this.hiddenEdges,\r\n shadows: this.shadows,\r\n clipVol: this.clipVolume,\r\n monochrome: this.monochrome,\r\n backgroundMap: this.backgroundMap,\r\n ambientOcclusion: this.ambientOcclusion,\r\n thematicDisplay: this.thematicDisplay,\r\n wiremesh: this.wiremesh,\r\n forceSurfaceDiscard: this.forceSurfaceDiscard,\r\n noWhiteOnWhiteReversal: !this.whiteOnWhiteReversal,\r\n };\r\n }\r\n\r\n /** A ViewFlags object with all properties initialized to their default values. */\r\n public static readonly defaults = new ViewFlags();\r\n\r\n /** Create a ViewFlags.\r\n * @param flags The properties to initialize. Any properties not specified are initialized to their default values.\r\n */\r\n public static create(flags?: Partial<ViewFlagsProperties>): ViewFlags {\r\n return flags && !JsonUtils.isEmptyObject(flags) ? new ViewFlags(flags) : this.defaults;\r\n }\r\n\r\n /** Create a ViewFlags from its JSON representation.\r\n * @note As described in [[ViewFlagProps]], the JSON representation is awkward and error-prone. Prefer to use [[create]] unless you\r\n * need to deal with the persistence format directly.\r\n * @note The default values differ slightly from those used by the constructor and [[create]]:\r\n * - [[clipVolume]] defaults to false.\r\n * - [[constructions]] defaults to true.\r\n * - [[lighting]] defaults to true unless all of [[ViewFlagProps.noSolarLight]], [[ViewFlagProps.noCameraLights]], and [[ViewFlagProps.noSourceLights]] are true.\r\n */\r\n public static fromJSON(json?: ViewFlagProps): ViewFlags {\r\n if (!json)\r\n return this.defaults;\r\n\r\n let renderMode: RenderMode;\r\n const renderModeValue = JsonUtils.asInt(json.renderMode);\r\n if (renderModeValue < RenderMode.HiddenLine)\r\n renderMode = RenderMode.Wireframe;\r\n else if (renderModeValue > RenderMode.SolidFill)\r\n renderMode = RenderMode.SmoothShade;\r\n else\r\n renderMode = renderModeValue;\r\n\r\n const lighting = !JsonUtils.asBool(json.noCameraLights) || !JsonUtils.asBool(json.noSourceLights) || !JsonUtils.asBool(json.noSolarLight);\r\n return new ViewFlags({\r\n renderMode,\r\n lighting,\r\n constructions: !JsonUtils.asBool(json.noConstruct),\r\n dimensions: !JsonUtils.asBool(json.noDim),\r\n patterns: !JsonUtils.asBool(json.noPattern),\r\n weights: !JsonUtils.asBool(json.noWeight),\r\n styles: !JsonUtils.asBool(json.noStyle),\r\n transparency: !JsonUtils.asBool(json.noTransp),\r\n fill: !JsonUtils.asBool(json.noFill),\r\n grid: JsonUtils.asBool(json.grid),\r\n acsTriad: JsonUtils.asBool(json.acs),\r\n textures: !JsonUtils.asBool(json.noTexture),\r\n materials: !JsonUtils.asBool(json.noMaterial),\r\n visibleEdges: JsonUtils.asBool(json.visEdges),\r\n hiddenEdges: JsonUtils.asBool(json.hidEdges),\r\n shadows: JsonUtils.asBool(json.shadows),\r\n clipVolume: JsonUtils.asBool(json.clipVol),\r\n monochrome: JsonUtils.asBool(json.monochrome),\r\n backgroundMap: JsonUtils.asBool(json.backgroundMap),\r\n ambientOcclusion: JsonUtils.asBool(json.ambientOcclusion),\r\n thematicDisplay: JsonUtils.asBool(json.thematicDisplay),\r\n wiremesh: JsonUtils.asBool(json.wiremesh),\r\n forceSurfaceDiscard: JsonUtils.asBool(json.forceSurfaceDiscard),\r\n whiteOnWhiteReversal: !JsonUtils.asBool(json.noWhiteOnWhiteReversal),\r\n });\r\n }\r\n\r\n /** Returns true if `this` and `other` are equivalent. */\r\n public equals(other: Readonly<ViewFlagsProperties>): boolean {\r\n if (this === other)\r\n return true;\r\n\r\n return this.renderMode === other.renderMode\r\n && this.dimensions === other.dimensions\r\n && this.patterns === other.patterns\r\n && this.weights === other.weights\r\n && this.styles === other.styles\r\n && this.transparency === other.transparency\r\n && this.fill === other.fill\r\n && this.textures === other.textures\r\n && this.materials === other.materials\r\n && this.acsTriad === other.acsTriad\r\n && this.grid === other.grid\r\n && this.visibleEdges === other.visibleEdges\r\n && this.hiddenEdges === other.hiddenEdges\r\n && this.lighting === other.lighting\r\n && this.shadows === other.shadows\r\n && this.clipVolume === other.clipVolume\r\n && this.constructions === other.constructions\r\n && this.monochrome === other.monochrome\r\n && this.backgroundMap === other.backgroundMap\r\n && this.ambientOcclusion === other.ambientOcclusion\r\n && this.thematicDisplay === other.thematicDisplay\r\n && this.wiremesh === other.wiremesh\r\n && this.forceSurfaceDiscard === other.forceSurfaceDiscard\r\n && this.whiteOnWhiteReversal === other.whiteOnWhiteReversal;\r\n }\r\n}\r\n\r\n/** A type containing all of the properties of [[ViewFlags]] with none of the methods and with the `readonly` modifiers removed.\r\n * @see [[ViewFlags.create]], [[ViewFlags.copy]], and [[ViewFlags.override]] for methods accepting an object of this type.\r\n * @public\r\n * @extensions\r\n */\r\nexport type ViewFlagsProperties = Mutable<NonFunctionPropertiesOf<ViewFlags>>;\r\n\r\n/** A type that describes how to override selected properties of a [[ViewFlags]].\r\n * @see [[ViewFlags.override]] to apply the overrides to a ViewFlags object.\r\n * @public\r\n * @extensions\r\n */\r\nexport type ViewFlagOverrides = Partial<ViewFlagsProperties>;\r\n"]}
@@ -247,7 +247,7 @@ class RpcInvocation {
247
247
  status.responseValue = rawResult; // for ipc case
248
248
  fulfillment.rawResult = status;
249
249
  }
250
- if (rawResult instanceof core_bentley_1.BentleyError) {
250
+ if (rawResult instanceof Error) {
251
251
  fulfillment.status = core_bentley_1.StatusCategory.for(rawResult).code;
252
252
  }
253
253
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RpcInvocation.js","sourceRoot":"","sources":["../../../../src/rpc/core/RpcInvocation.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;AAEH,sDAA8J;AAC9J,qEAAkE;AAElE,mDAAgD;AAChD,qDAAkD;AAElD,yDAAsD;AACtD,iDAAoE;AACpE,6CAA0F;AAC1F,mDAAoE;AACpE,iDAA8C;AAC9C,+CAA+H;AAC/H,+CAAgE;AAqChE;;GAEG;AACH,MAAa,aAAa;IAwBxB,mCAAmC;IACnC,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,+BAAgB,CAAC,QAAQ,CAAC,CAAC;YAC9C,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,+BAAgB,CAAC,OAAO,CAAC,CAAC;gBACxC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,+BAAgB,CAAC,QAAQ,CAAC,CAAC;oBAC1C,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,+BAAgB,CAAC,SAAS,CAAC,CAAC;wBAC5C,+BAAgB,CAAC,QAAQ,CAAC;IACpC,CAAC;IAED,4CAA4C;IAC5C,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC;IACtC,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,OAAO,CAAC,OAAqB;QACzC,OAAQ,OAAe,CAAC,gCAAkB,CAAC,CAAC;IAC9C,CAAC;IAED,gCAAgC;IAChC,YAAmB,QAAqB,EAAE,OAA6B;QA7C/D,WAA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Aa,CAAC,KAAK,EAAE,wBAAwB,cAAc,CAAC,WAAW,CAAC,IAAI,mCAAmC,IAAI,CAAC,SAAS,CAAC,aAAa,IAAI,CAAC,CAAC;QAEzK,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,uBAAuB,CAAC,WAAkC,EAAE,SAAc;QAChF,IAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAE;YAClC,OAAO;SACR;QAED,IAAI,aAA+D,CAAC;QACpE,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,aAAa,GAAG,SAAS,CAAC;SAC3B;aAAM,IAAI,IAAI,CAAC,SAAS,EAAE;YACzB,aAAa,GAAG,UAAU,CAAC;SAC5B;aAAM,IAAI,IAAI,CAAC,UAAU,EAAE;YAC1B,aAAa,GAAG,WAAW,CAAC;SAC7B;QAED,IAAI,aAAa,EAAE;YACjB,MAAM,aAAa,GAAG,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC;YACjD,MAAM,MAAM,GAAqB,EAAE,oBAAoB,EAAE,IAAI,EAAE,aAAa,EAAE,aAAa,EAAE,CAAC;YAC9F,WAAW,CAAC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YACpD,MAAM,CAAC,aAAa,GAAG,SAAS,CAAC,CAAC,eAAe;YACjD,WAAW,CAAC,SAAS,GAAG,MAAM,CAAC;SAChC;QAED,IAAI,SAAS,YAAY,2BAAY,EAAE;YACrC,WAAW,CAAC,MAAM,GAAG,6BAAc,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC;SACzD;IACH,CAAC;;;AA5Qa,yBAAW,GAAmB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,AAAhD,CAAiD;AAD/D,sCAAa","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 RpcInterface\r\n */\r\n\r\nimport { AccessToken, BentleyError, BentleyStatus, GuidString, IModelStatus, Logger, RpcInterfaceStatus, StatusCategory, Tracing } from \"@itwin/core-bentley\";\r\nimport { CommonLoggerCategory } from \"../../CommonLoggerCategory\";\r\nimport { IModelRpcProps } from \"../../IModel\";\r\nimport { IModelError } from \"../../IModelError\";\r\nimport { RpcInterface } from \"../../RpcInterface\";\r\nimport { SessionProps } from \"../../SessionProps\";\r\nimport { RpcConfiguration } from \"./RpcConfiguration\";\r\nimport { RpcProtocolEvent, RpcRequestStatus } from \"./RpcConstants\";\r\nimport { RpcControlChannel, RpcNotFoundResponse, RpcPendingResponse } from \"./RpcControl\";\r\nimport { RpcMarshaling, RpcSerializedValue } from \"./RpcMarshaling\";\r\nimport { RpcOperation } from \"./RpcOperation\";\r\nimport { RpcManagedStatus, RpcProtocol, RpcProtocolVersion, RpcRequestFulfillment, SerializedRpcRequest } from \"./RpcProtocol\";\r\nimport { CURRENT_INVOCATION, RpcRegistry } from \"./RpcRegistry\";\r\n\r\n/* eslint-disable deprecation/deprecation */\r\n\r\n/** The properties of an RpcActivity.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface RpcActivity extends SessionProps {\r\n /** Used for logging to correlate an Rpc activity between frontend and backend */\r\n readonly activityId: GuidString;\r\n\r\n /** access token for authorization */\r\n readonly accessToken: AccessToken;\r\n\r\n /** the name of the current rpc method */\r\n readonly rpcMethod?: string;\r\n\r\n readonly user?: string;\r\n}\r\n\r\n/** Serialized format for sending the request across the RPC layer\r\n * @public\r\n */\r\nexport interface SerializedRpcActivity {\r\n id: string;\r\n applicationId: string;\r\n applicationVersion: string;\r\n sessionId: string;\r\n authorization: string;\r\n user?: string;\r\n csrfToken?: { headerName: string, headerValue: string };\r\n}\r\n\r\n/** @internal */\r\nexport type RpcActivityRun = (activity: RpcActivity, fn: () => Promise<any>) => Promise<any>;\r\n\r\n/** An RPC operation invocation in response to a request.\r\n * @internal\r\n */\r\nexport class RpcInvocation {\r\n public static runActivity: RpcActivityRun = async (_activity, fn) => fn();\r\n private _threw: boolean = false;\r\n private _pending: boolean = false;\r\n private _notFound: boolean = false;\r\n private _noContent: boolean = false;\r\n private _timeIn: number = 0;\r\n private _timeOut: number = 0;\r\n\r\n /** The protocol for this invocation. */\r\n public readonly protocol: RpcProtocol;\r\n\r\n /** The received request. */\r\n public readonly request: SerializedRpcRequest;\r\n\r\n /** The operation of the request. */\r\n public readonly operation: RpcOperation = undefined as any;\r\n\r\n /** The implementation response. */\r\n public readonly result: Promise<any>;\r\n\r\n /** The fulfillment for this request. */\r\n public readonly fulfillment: Promise<RpcRequestFulfillment>;\r\n\r\n /** The status for this request. */\r\n public get status(): RpcRequestStatus {\r\n return this._threw ? RpcRequestStatus.Rejected :\r\n this._pending ? RpcRequestStatus.Pending :\r\n this._notFound ? RpcRequestStatus.NotFound :\r\n this._noContent ? RpcRequestStatus.NoContent :\r\n RpcRequestStatus.Resolved;\r\n }\r\n\r\n /** The elapsed time for this invocation. */\r\n public get elapsed(): number {\r\n return this._timeOut - this._timeIn;\r\n }\r\n\r\n /**\r\n * The invocation for the current RPC operation.\r\n * @note The return value of this function is only reliable in an RPC impl class member function where program control was received from the RpcInvocation constructor function.\r\n */\r\n public static current(rpcImpl: RpcInterface): RpcInvocation {\r\n return (rpcImpl as any)[CURRENT_INVOCATION];\r\n }\r\n\r\n /** Constructs an invocation. */\r\n public constructor(protocol: RpcProtocol, request: SerializedRpcRequest) {\r\n this._timeIn = new Date().getTime();\r\n this.protocol = protocol;\r\n this.request = request;\r\n\r\n try {\r\n try {\r\n this.operation = RpcOperation.lookup(this.request.operation.interfaceDefinition, this.request.operation.operationName);\r\n\r\n const backend = this.operation.interfaceVersion;\r\n const frontend = this.request.operation.interfaceVersion;\r\n if (!RpcInterface.isVersionCompatible(backend, frontend)) {\r\n throw new IModelError(RpcInterfaceStatus.IncompatibleVersion, `Backend version ${backend} does not match frontend version ${frontend} for RPC interface ${this.operation.operationName}.`);\r\n }\r\n } catch (error) {\r\n if (this.handleUnknownOperation(error)) {\r\n this.operation = RpcOperation.lookup(this.request.operation.interfaceDefinition, this.request.operation.operationName);\r\n } else {\r\n throw error;\r\n }\r\n }\r\n\r\n this.result = this.resolve();\r\n } catch (error) {\r\n this.result = this.reject(error);\r\n }\r\n\r\n this.fulfillment = this.result.then(async (value) => this._threw ? this.fulfillRejected(value) : this.fulfillResolved(value), async (reason) => this.fulfillRejected(reason));\r\n }\r\n\r\n private handleUnknownOperation(error: any): boolean {\r\n RpcControlChannel.ensureInitialized();\r\n return this.protocol.configuration.controlChannel.handleUnknownOperation(this, error);\r\n }\r\n\r\n public static sanitizeForLog(activity?: RpcActivity) {\r\n /* eslint-disable @typescript-eslint/naming-convention */\r\n return activity ? {\r\n ActivityId: activity.activityId, SessionId: activity.sessionId, ApplicationId: activity.applicationId, ApplicationVersion: activity.applicationVersion, rpcMethod: activity.rpcMethod,\r\n } : undefined;\r\n /* eslint-enable @typescript-eslint/naming-convention */\r\n }\r\n\r\n private async resolve(): Promise<any> {\r\n const request = this.request;\r\n const activity: RpcActivity = {\r\n activityId: request.id,\r\n applicationId: request.applicationId,\r\n applicationVersion: request.applicationVersion,\r\n sessionId: request.sessionId,\r\n user: request.user,\r\n accessToken: request.authorization,\r\n rpcMethod: request.operation.operationName,\r\n };\r\n\r\n try {\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.RequestReceived, this);\r\n\r\n const parameters = request.parametersOverride || RpcMarshaling.deserialize(this.protocol, request.parameters);\r\n this.applyPolicies(parameters);\r\n const impl = RpcRegistry.instance.getImplForInterface(this.operation.interfaceDefinition);\r\n (impl as any)[CURRENT_INVOCATION] = this;\r\n const op = this.lookupOperationFunction(impl);\r\n\r\n return await RpcInvocation.runActivity(activity, async () => op.call(impl, ...parameters)\r\n .catch(async (error) => {\r\n // this catch block is intentionally placed inside `runActivity` to attach the right logging metadata and use the correct openTelemetry span.\r\n if (!(error instanceof RpcPendingResponse)) {\r\n Logger.logError(CommonLoggerCategory.RpcInterfaceBackend, \"Error in RPC operation\", { error: BentleyError.getErrorProps(error) });\r\n Tracing.recordException(error);\r\n }\r\n throw error;\r\n }));\r\n } catch (error: unknown) {\r\n return this.reject(error);\r\n }\r\n }\r\n\r\n private applyPolicies(parameters: any) {\r\n if (!parameters || !Array.isArray(parameters))\r\n return;\r\n\r\n for (let i = 0; i !== parameters.length; ++i) {\r\n const parameter = parameters[i];\r\n const isToken = typeof (parameter) === \"object\" && parameter !== null && parameter.hasOwnProperty(\"iModelId\") && parameter.hasOwnProperty(\"iTwinId\");\r\n if (isToken && this.protocol.checkToken && !this.operation.policy.allowTokenMismatch) {\r\n const inflated = this.protocol.inflateToken(parameter, this.request);\r\n parameters[i] = inflated;\r\n\r\n if (!RpcInvocation.compareTokens(parameter, inflated)) {\r\n if (RpcConfiguration.throwOnTokenMismatch) {\r\n throw new IModelError(BentleyStatus.ERROR, \"IModelRpcProps mismatch detected for this request.\");\r\n } else {\r\n Logger.logWarning(CommonLoggerCategory.RpcInterfaceBackend, \"IModelRpcProps mismatch detected for this request.\");\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static compareTokens(a: IModelRpcProps, b: IModelRpcProps): boolean {\r\n return a.key === b.key &&\r\n a.iTwinId === b.iTwinId &&\r\n a.iModelId === b.iModelId &&\r\n (undefined === a.changeset || (a.changeset.id === b.changeset?.id));\r\n }\r\n\r\n private async reject(error: any): Promise<any> {\r\n this._threw = true;\r\n return error;\r\n }\r\n\r\n private async fulfillResolved(value: any): Promise<RpcRequestFulfillment> {\r\n this._timeOut = new Date().getTime();\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendResponseCreated, this);\r\n const result = RpcMarshaling.serialize(this.protocol, value);\r\n return this.fulfill(result, value);\r\n }\r\n\r\n private async fulfillRejected(reason: any): Promise<RpcRequestFulfillment> {\r\n this._timeOut = new Date().getTime();\r\n if (!RpcConfiguration.developmentMode)\r\n reason.stack = undefined;\r\n\r\n const result = RpcMarshaling.serialize(this.protocol, reason);\r\n\r\n if (reason instanceof RpcPendingResponse) {\r\n this._pending = true;\r\n this._threw = false;\r\n result.objects = reason.message;\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendReportedPending, this);\r\n } else if (this.supportsNoContent() && reason?.errorNumber === IModelStatus.NoContent) {\r\n this._noContent = true;\r\n this._threw = false;\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendReportedNoContent, this);\r\n } else if (reason instanceof RpcNotFoundResponse) {\r\n this._notFound = true;\r\n this._threw = false;\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendReportedNotFound, this);\r\n } else {\r\n this._threw = true;\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendErrorOccurred, this);\r\n }\r\n\r\n return this.fulfill(result, reason);\r\n }\r\n\r\n private supportsNoContent() {\r\n if (!this.request.protocolVersion) {\r\n return false;\r\n }\r\n\r\n return RpcProtocol.protocolVersion >= RpcProtocolVersion.IntroducedNoContent && this.request.protocolVersion >= RpcProtocolVersion.IntroducedNoContent;\r\n }\r\n\r\n private supportsStatusCategory() {\r\n if (!this.request.protocolVersion) {\r\n return false;\r\n }\r\n\r\n if (!this.protocol.supportsStatusCategory) {\r\n return false;\r\n }\r\n\r\n return RpcProtocol.protocolVersion >= RpcProtocolVersion.IntroducedStatusCategory && this.request.protocolVersion >= RpcProtocolVersion.IntroducedStatusCategory;\r\n }\r\n\r\n private fulfill(result: RpcSerializedValue, rawResult: any): RpcRequestFulfillment {\r\n const fulfillment: RpcRequestFulfillment = {\r\n result,\r\n rawResult,\r\n status: this.protocol.getCode(this.status),\r\n id: this.request.id,\r\n interfaceName: (typeof (this.operation) === \"undefined\") ? \"\" : this.operation.interfaceDefinition.interfaceName,\r\n allowCompression: this.operation?.policy.allowResponseCompression || false,\r\n };\r\n\r\n this.transformResponseStatus(fulfillment, rawResult);\r\n\r\n try {\r\n const impl = RpcRegistry.instance.getImplForInterface(this.operation.interfaceDefinition) as any;\r\n if (impl[CURRENT_INVOCATION] === this) {\r\n impl[CURRENT_INVOCATION] = undefined;\r\n }\r\n } catch (_err) { }\r\n\r\n return fulfillment;\r\n }\r\n\r\n private lookupOperationFunction(implementation: RpcInterface): (...args: any[]) => Promise<any> {\r\n const func = (implementation as any)[this.operation.operationName];\r\n if (!func || typeof (func) !== \"function\")\r\n throw new IModelError(BentleyStatus.ERROR, `RPC interface class \"${implementation.constructor.name}\" does not implement operation \"${this.operation.operationName}\".`);\r\n\r\n return func;\r\n }\r\n\r\n private transformResponseStatus(fulfillment: RpcRequestFulfillment, rawResult: any) {\r\n if (!this.supportsStatusCategory()) {\r\n return;\r\n }\r\n\r\n let managedStatus: \"notFound\" | \"pending\" | \"noContent\" | undefined;\r\n if (this._pending) {\r\n managedStatus = \"pending\";\r\n } else if (this._notFound) {\r\n managedStatus = \"notFound\";\r\n } else if (this._noContent) {\r\n managedStatus = \"noContent\";\r\n }\r\n\r\n if (managedStatus) {\r\n const responseValue = fulfillment.result.objects;\r\n const status: RpcManagedStatus = { iTwinRpcCoreResponse: true, managedStatus, responseValue };\r\n fulfillment.result.objects = JSON.stringify(status);\r\n status.responseValue = rawResult; // for ipc case\r\n fulfillment.rawResult = status;\r\n }\r\n\r\n if (rawResult instanceof BentleyError) {\r\n fulfillment.status = StatusCategory.for(rawResult).code;\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"RpcInvocation.js","sourceRoot":"","sources":["../../../../src/rpc/core/RpcInvocation.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;AAEH,sDAA8J;AAC9J,qEAAkE;AAElE,mDAAgD;AAChD,qDAAkD;AAElD,yDAAsD;AACtD,iDAAoE;AACpE,6CAA0F;AAC1F,mDAAoE;AACpE,iDAA8C;AAC9C,+CAA+H;AAC/H,+CAAgE;AAqChE;;GAEG;AACH,MAAa,aAAa;IAwBxB,mCAAmC;IACnC,IAAW,MAA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AAM,MAAM,GAAqB,EAAE,oBAAoB,EAAE,IAAI,EAAE,aAAa,EAAE,aAAa,EAAE,CAAC;YAC9F,WAAW,CAAC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YACpD,MAAM,CAAC,aAAa,GAAG,SAAS,CAAC,CAAC,eAAe;YACjD,WAAW,CAAC,SAAS,GAAG,MAAM,CAAC;SAChC;QAED,IAAI,SAAS,YAAY,KAAK,EAAE;YAC9B,WAAW,CAAC,MAAM,GAAG,6BAAc,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC;SACzD;IACH,CAAC;;;AA5Qa,yBAAW,GAAmB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,AAAhD,CAAiD;AAD/D,sCAAa","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 RpcInterface\r\n */\r\n\r\nimport { AccessToken, BentleyError, BentleyStatus, GuidString, IModelStatus, Logger, RpcInterfaceStatus, StatusCategory, Tracing } from \"@itwin/core-bentley\";\r\nimport { CommonLoggerCategory } from \"../../CommonLoggerCategory\";\r\nimport { IModelRpcProps } from \"../../IModel\";\r\nimport { IModelError } from \"../../IModelError\";\r\nimport { RpcInterface } from \"../../RpcInterface\";\r\nimport { SessionProps } from \"../../SessionProps\";\r\nimport { RpcConfiguration } from \"./RpcConfiguration\";\r\nimport { RpcProtocolEvent, RpcRequestStatus } from \"./RpcConstants\";\r\nimport { RpcControlChannel, RpcNotFoundResponse, RpcPendingResponse } from \"./RpcControl\";\r\nimport { RpcMarshaling, RpcSerializedValue } from \"./RpcMarshaling\";\r\nimport { RpcOperation } from \"./RpcOperation\";\r\nimport { RpcManagedStatus, RpcProtocol, RpcProtocolVersion, RpcRequestFulfillment, SerializedRpcRequest } from \"./RpcProtocol\";\r\nimport { CURRENT_INVOCATION, RpcRegistry } from \"./RpcRegistry\";\r\n\r\n/* eslint-disable deprecation/deprecation */\r\n\r\n/** The properties of an RpcActivity.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface RpcActivity extends SessionProps {\r\n /** Used for logging to correlate an Rpc activity between frontend and backend */\r\n readonly activityId: GuidString;\r\n\r\n /** access token for authorization */\r\n readonly accessToken: AccessToken;\r\n\r\n /** the name of the current rpc method */\r\n readonly rpcMethod?: string;\r\n\r\n readonly user?: string;\r\n}\r\n\r\n/** Serialized format for sending the request across the RPC layer\r\n * @public\r\n */\r\nexport interface SerializedRpcActivity {\r\n id: string;\r\n applicationId: string;\r\n applicationVersion: string;\r\n sessionId: string;\r\n authorization: string;\r\n user?: string;\r\n csrfToken?: { headerName: string, headerValue: string };\r\n}\r\n\r\n/** @internal */\r\nexport type RpcActivityRun = (activity: RpcActivity, fn: () => Promise<any>) => Promise<any>;\r\n\r\n/** An RPC operation invocation in response to a request.\r\n * @internal\r\n */\r\nexport class RpcInvocation {\r\n public static runActivity: RpcActivityRun = async (_activity, fn) => fn();\r\n private _threw: boolean = false;\r\n private _pending: boolean = false;\r\n private _notFound: boolean = false;\r\n private _noContent: boolean = false;\r\n private _timeIn: number = 0;\r\n private _timeOut: number = 0;\r\n\r\n /** The protocol for this invocation. */\r\n public readonly protocol: RpcProtocol;\r\n\r\n /** The received request. */\r\n public readonly request: SerializedRpcRequest;\r\n\r\n /** The operation of the request. */\r\n public readonly operation: RpcOperation = undefined as any;\r\n\r\n /** The implementation response. */\r\n public readonly result: Promise<any>;\r\n\r\n /** The fulfillment for this request. */\r\n public readonly fulfillment: Promise<RpcRequestFulfillment>;\r\n\r\n /** The status for this request. */\r\n public get status(): RpcRequestStatus {\r\n return this._threw ? RpcRequestStatus.Rejected :\r\n this._pending ? RpcRequestStatus.Pending :\r\n this._notFound ? RpcRequestStatus.NotFound :\r\n this._noContent ? RpcRequestStatus.NoContent :\r\n RpcRequestStatus.Resolved;\r\n }\r\n\r\n /** The elapsed time for this invocation. */\r\n public get elapsed(): number {\r\n return this._timeOut - this._timeIn;\r\n }\r\n\r\n /**\r\n * The invocation for the current RPC operation.\r\n * @note The return value of this function is only reliable in an RPC impl class member function where program control was received from the RpcInvocation constructor function.\r\n */\r\n public static current(rpcImpl: RpcInterface): RpcInvocation {\r\n return (rpcImpl as any)[CURRENT_INVOCATION];\r\n }\r\n\r\n /** Constructs an invocation. */\r\n public constructor(protocol: RpcProtocol, request: SerializedRpcRequest) {\r\n this._timeIn = new Date().getTime();\r\n this.protocol = protocol;\r\n this.request = request;\r\n\r\n try {\r\n try {\r\n this.operation = RpcOperation.lookup(this.request.operation.interfaceDefinition, this.request.operation.operationName);\r\n\r\n const backend = this.operation.interfaceVersion;\r\n const frontend = this.request.operation.interfaceVersion;\r\n if (!RpcInterface.isVersionCompatible(backend, frontend)) {\r\n throw new IModelError(RpcInterfaceStatus.IncompatibleVersion, `Backend version ${backend} does not match frontend version ${frontend} for RPC interface ${this.operation.operationName}.`);\r\n }\r\n } catch (error) {\r\n if (this.handleUnknownOperation(error)) {\r\n this.operation = RpcOperation.lookup(this.request.operation.interfaceDefinition, this.request.operation.operationName);\r\n } else {\r\n throw error;\r\n }\r\n }\r\n\r\n this.result = this.resolve();\r\n } catch (error) {\r\n this.result = this.reject(error);\r\n }\r\n\r\n this.fulfillment = this.result.then(async (value) => this._threw ? this.fulfillRejected(value) : this.fulfillResolved(value), async (reason) => this.fulfillRejected(reason));\r\n }\r\n\r\n private handleUnknownOperation(error: any): boolean {\r\n RpcControlChannel.ensureInitialized();\r\n return this.protocol.configuration.controlChannel.handleUnknownOperation(this, error);\r\n }\r\n\r\n public static sanitizeForLog(activity?: RpcActivity) {\r\n /* eslint-disable @typescript-eslint/naming-convention */\r\n return activity ? {\r\n ActivityId: activity.activityId, SessionId: activity.sessionId, ApplicationId: activity.applicationId, ApplicationVersion: activity.applicationVersion, rpcMethod: activity.rpcMethod,\r\n } : undefined;\r\n /* eslint-enable @typescript-eslint/naming-convention */\r\n }\r\n\r\n private async resolve(): Promise<any> {\r\n const request = this.request;\r\n const activity: RpcActivity = {\r\n activityId: request.id,\r\n applicationId: request.applicationId,\r\n applicationVersion: request.applicationVersion,\r\n sessionId: request.sessionId,\r\n user: request.user,\r\n accessToken: request.authorization,\r\n rpcMethod: request.operation.operationName,\r\n };\r\n\r\n try {\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.RequestReceived, this);\r\n\r\n const parameters = request.parametersOverride || RpcMarshaling.deserialize(this.protocol, request.parameters);\r\n this.applyPolicies(parameters);\r\n const impl = RpcRegistry.instance.getImplForInterface(this.operation.interfaceDefinition);\r\n (impl as any)[CURRENT_INVOCATION] = this;\r\n const op = this.lookupOperationFunction(impl);\r\n\r\n return await RpcInvocation.runActivity(activity, async () => op.call(impl, ...parameters)\r\n .catch(async (error) => {\r\n // this catch block is intentionally placed inside `runActivity` to attach the right logging metadata and use the correct openTelemetry span.\r\n if (!(error instanceof RpcPendingResponse)) {\r\n Logger.logError(CommonLoggerCategory.RpcInterfaceBackend, \"Error in RPC operation\", { error: BentleyError.getErrorProps(error) });\r\n Tracing.recordException(error);\r\n }\r\n throw error;\r\n }));\r\n } catch (error: unknown) {\r\n return this.reject(error);\r\n }\r\n }\r\n\r\n private applyPolicies(parameters: any) {\r\n if (!parameters || !Array.isArray(parameters))\r\n return;\r\n\r\n for (let i = 0; i !== parameters.length; ++i) {\r\n const parameter = parameters[i];\r\n const isToken = typeof (parameter) === \"object\" && parameter !== null && parameter.hasOwnProperty(\"iModelId\") && parameter.hasOwnProperty(\"iTwinId\");\r\n if (isToken && this.protocol.checkToken && !this.operation.policy.allowTokenMismatch) {\r\n const inflated = this.protocol.inflateToken(parameter, this.request);\r\n parameters[i] = inflated;\r\n\r\n if (!RpcInvocation.compareTokens(parameter, inflated)) {\r\n if (RpcConfiguration.throwOnTokenMismatch) {\r\n throw new IModelError(BentleyStatus.ERROR, \"IModelRpcProps mismatch detected for this request.\");\r\n } else {\r\n Logger.logWarning(CommonLoggerCategory.RpcInterfaceBackend, \"IModelRpcProps mismatch detected for this request.\");\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static compareTokens(a: IModelRpcProps, b: IModelRpcProps): boolean {\r\n return a.key === b.key &&\r\n a.iTwinId === b.iTwinId &&\r\n a.iModelId === b.iModelId &&\r\n (undefined === a.changeset || (a.changeset.id === b.changeset?.id));\r\n }\r\n\r\n private async reject(error: any): Promise<any> {\r\n this._threw = true;\r\n return error;\r\n }\r\n\r\n private async fulfillResolved(value: any): Promise<RpcRequestFulfillment> {\r\n this._timeOut = new Date().getTime();\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendResponseCreated, this);\r\n const result = RpcMarshaling.serialize(this.protocol, value);\r\n return this.fulfill(result, value);\r\n }\r\n\r\n private async fulfillRejected(reason: any): Promise<RpcRequestFulfillment> {\r\n this._timeOut = new Date().getTime();\r\n if (!RpcConfiguration.developmentMode)\r\n reason.stack = undefined;\r\n\r\n const result = RpcMarshaling.serialize(this.protocol, reason);\r\n\r\n if (reason instanceof RpcPendingResponse) {\r\n this._pending = true;\r\n this._threw = false;\r\n result.objects = reason.message;\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendReportedPending, this);\r\n } else if (this.supportsNoContent() && reason?.errorNumber === IModelStatus.NoContent) {\r\n this._noContent = true;\r\n this._threw = false;\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendReportedNoContent, this);\r\n } else if (reason instanceof RpcNotFoundResponse) {\r\n this._notFound = true;\r\n this._threw = false;\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendReportedNotFound, this);\r\n } else {\r\n this._threw = true;\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendErrorOccurred, this);\r\n }\r\n\r\n return this.fulfill(result, reason);\r\n }\r\n\r\n private supportsNoContent() {\r\n if (!this.request.protocolVersion) {\r\n return false;\r\n }\r\n\r\n return RpcProtocol.protocolVersion >= RpcProtocolVersion.IntroducedNoContent && this.request.protocolVersion >= RpcProtocolVersion.IntroducedNoContent;\r\n }\r\n\r\n private supportsStatusCategory() {\r\n if (!this.request.protocolVersion) {\r\n return false;\r\n }\r\n\r\n if (!this.protocol.supportsStatusCategory) {\r\n return false;\r\n }\r\n\r\n return RpcProtocol.protocolVersion >= RpcProtocolVersion.IntroducedStatusCategory && this.request.protocolVersion >= RpcProtocolVersion.IntroducedStatusCategory;\r\n }\r\n\r\n private fulfill(result: RpcSerializedValue, rawResult: any): RpcRequestFulfillment {\r\n const fulfillment: RpcRequestFulfillment = {\r\n result,\r\n rawResult,\r\n status: this.protocol.getCode(this.status),\r\n id: this.request.id,\r\n interfaceName: (typeof (this.operation) === \"undefined\") ? \"\" : this.operation.interfaceDefinition.interfaceName,\r\n allowCompression: this.operation?.policy.allowResponseCompression || false,\r\n };\r\n\r\n this.transformResponseStatus(fulfillment, rawResult);\r\n\r\n try {\r\n const impl = RpcRegistry.instance.getImplForInterface(this.operation.interfaceDefinition) as any;\r\n if (impl[CURRENT_INVOCATION] === this) {\r\n impl[CURRENT_INVOCATION] = undefined;\r\n }\r\n } catch (_err) { }\r\n\r\n return fulfillment;\r\n }\r\n\r\n private lookupOperationFunction(implementation: RpcInterface): (...args: any[]) => Promise<any> {\r\n const func = (implementation as any)[this.operation.operationName];\r\n if (!func || typeof (func) !== \"function\")\r\n throw new IModelError(BentleyStatus.ERROR, `RPC interface class \"${implementation.constructor.name}\" does not implement operation \"${this.operation.operationName}\".`);\r\n\r\n return func;\r\n }\r\n\r\n private transformResponseStatus(fulfillment: RpcRequestFulfillment, rawResult: any) {\r\n if (!this.supportsStatusCategory()) {\r\n return;\r\n }\r\n\r\n let managedStatus: \"notFound\" | \"pending\" | \"noContent\" | undefined;\r\n if (this._pending) {\r\n managedStatus = \"pending\";\r\n } else if (this._notFound) {\r\n managedStatus = \"notFound\";\r\n } else if (this._noContent) {\r\n managedStatus = \"noContent\";\r\n }\r\n\r\n if (managedStatus) {\r\n const responseValue = fulfillment.result.objects;\r\n const status: RpcManagedStatus = { iTwinRpcCoreResponse: true, managedStatus, responseValue };\r\n fulfillment.result.objects = JSON.stringify(status);\r\n status.responseValue = rawResult; // for ipc case\r\n fulfillment.rawResult = status;\r\n }\r\n\r\n if (rawResult instanceof Error) {\r\n fulfillment.status = StatusCategory.for(rawResult).code;\r\n }\r\n }\r\n}\r\n"]}
@@ -4,7 +4,7 @@
4
4
  import { BeEvent } from "@itwin/core-bentley";
5
5
  import { FeatureAppearance, FeatureAppearanceProps } from "./FeatureSymbology";
6
6
  import { PlanarClipMaskProps, PlanarClipMaskSettings } from "./PlanarClipMask";
7
- import { SpatialClassifierProps, SpatialClassifiers } from "./SpatialClassification";
7
+ import { SpatialClassifierProps, SpatialClassifiers, SpatialClassifiersContainer } from "./SpatialClassification";
8
8
  import { RealityModelDisplayProps, RealityModelDisplaySettings } from "./RealityModelDisplaySettings";
9
9
  /** JSON representation of the blob properties for an OrbitGt property cloud.
10
10
  * @alpha
@@ -166,8 +166,7 @@ export declare class ContextRealityModel {
166
166
  readonly description: string;
167
167
  /** An optional identifier that, if present, can be used to elide a request to the reality data service. */
168
168
  readonly realityDataId?: string;
169
- /** A set of [[SpatialClassifier]]s, of which one at any given time can be used to classify the reality model. */
170
- readonly classifiers?: SpatialClassifiers;
169
+ private readonly _classifiers;
171
170
  /** @alpha */
172
171
  readonly orbitGtBlob?: Readonly<OrbitGtBlobProps>;
173
172
  protected _appearanceOverrides?: FeatureAppearance;
@@ -184,8 +183,13 @@ export declare class ContextRealityModel {
184
183
  readonly onDisplaySettingsChanged: BeEvent<(newSettings: RealityModelDisplaySettings, model: ContextRealityModel) => void>;
185
184
  /** Construct a new context reality model.
186
185
  * @param props JSON representation of the reality model, which will be kept in sync with changes made via the ContextRealityModel's methods.
186
+ * @param options Options to customize how the reality model is created.
187
187
  */
188
- constructor(props: ContextRealityModelProps);
188
+ constructor(props: ContextRealityModelProps, options?: {
189
+ createClassifiers: (container: SpatialClassifiersContainer) => SpatialClassifiers;
190
+ });
191
+ /** A set of [[SpatialClassifier]]s, of which one at any given time can be used to classify the reality model. */
192
+ get classifiers(): SpatialClassifiers;
189
193
  /** Optionally describes how the geometry of the reality model can be masked by other models. */
190
194
  get planarClipMaskSettings(): PlanarClipMaskSettings | undefined;
191
195
  set planarClipMaskSettings(settings: PlanarClipMaskSettings | undefined);
@@ -1 +1 @@
1
- {"version":3,"file":"ContextRealityModel.d.ts","sourceRoot":"","sources":["../../src/ContextRealityModel.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAU,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAsB,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AACnG,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EAAE,wBAAwB,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAEtG;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,oBAAY,mBAAmB;IAC7B;;;;;OAKG;IACH,UAAU,eAAe;IACzB;;;;;OAKG;IACH,WAAW,gBAAgB;IAC3B;;;;OAIG;IACH,YAAY,iBAAiB;IAC7B;;OAEG;IACH,cAAc,mBAAmB;CAClC;AAED;;GAEG;AACH,oBAAY,iBAAiB;IAC3B;;SAEK;IACL,UAAU,eAAe;IACzB;;MAEE;IACF,GAAG,QAAQ;CACZ;AAED;;GAEG;AACH,yBAAiB,iBAAiB,CAAC;IACj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;;;OAGG;IACI,MAAM,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO;IAoBlD,+CAA+C;IACxC,KAAK,IAAI,IAAI;IAUpB;;;;;;OAMG;IACI,OAAO,CAAC,SAAS,EAAE,mBAAmB,EAAE,WAAW,EAAE,wBAAwB,GAAG,mBAAmB;IAoB1G;;;;;OAKG;IACI,MAAM,CAAC,QAAQ,EAAE,mBAAmB,EAAE,WAAW,EAAE,OAAO,CAAC,wBAAwB,CAAC,GAAG,mBAAmB;IAajH,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,kBAAkB;IAS1B,OAAO,CAAC,2BAA2B;IAInC,OAAO,CAAC,gCAAgC;IAIxC,OAAO,CAAC,4BAA4B;CAGrC"}
@@ -138,8 +138,9 @@ export var ContextRealityModelProps;
138
138
  export class ContextRealityModel {
139
139
  /** Construct a new context reality model.
140
140
  * @param props JSON representation of the reality model, which will be kept in sync with changes made via the ContextRealityModel's methods.
141
+ * @param options Options to customize how the reality model is created.
141
142
  */
142
- constructor(props) {
143
+ constructor(props, options) {
143
144
  /** Event dispatched just before assignment to [[planarClipMaskSettings]]. */
144
145
  this.onPlanarClipMaskChanged = new BeEvent();
145
146
  /** Event dispatched just before assignment to [[appearanceOverrides]]. */
@@ -159,8 +160,16 @@ export class ContextRealityModel {
159
160
  this._displaySettings = RealityModelDisplaySettings.fromJSON(props.displaySettings);
160
161
  if (props.planarClipMask && props.planarClipMask.mode !== PlanarClipMaskMode.None)
161
162
  this._planarClipMask = PlanarClipMaskSettings.fromJSON(props.planarClipMask);
162
- if (props.classifiers)
163
- this.classifiers = new SpatialClassifiers(props);
163
+ if (options?.createClassifiers) {
164
+ this._classifiers = options.createClassifiers(props);
165
+ }
166
+ else {
167
+ this._classifiers = new SpatialClassifiers(props);
168
+ }
169
+ }
170
+ /** A set of [[SpatialClassifier]]s, of which one at any given time can be used to classify the reality model. */
171
+ get classifiers() {
172
+ return this._classifiers;
164
173
  }
165
174
  /** Optionally describes how the geometry of the reality model can be masked by other models. */
166
175
  get planarClipMaskSettings() {
@@ -1 +1 @@
1
- {"version":3,"file":"ContextRealityModel.js","sourceRoot":"","sources":["../../src/ContextRealityModel.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAA0B,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAuB,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AACnG,OAAO,EAA0B,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EAA4B,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAatG;;GAEG;AACH,MAAM,CAAN,IAAY,mBAyBX;AAzBD,WAAY,mBAAmB;IAC7B;;;;;OAKG;IACH,gDAAyB,CAAA;IACzB;;;;;OAKG;IACH,kDAA2B,CAAA;IAC3B;;;;OAIG;IACH,oDAA6B,CAAA;IAC7B;;OAEG;IACH,wDAAiC,CAAA;AACnC,CAAC,EAzBW,mBAAmB,KAAnB,mBAAmB,QAyB9B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,iBASX;AATD,WAAY,iBAAiB;IAC3B;;SAEK;IACL,8CAAyB,CAAA;IACzB;;MAEE;IACF,gCAAW,CAAA;AACb,CAAC,EATW,iBAAiB,KAAjB,iBAAiB,QAS5B;AAED;;GAEG;AACH,WAAiB,iBAAiB;IAChC;;;;OAIG;IACH,SAAgB,OAAO,CAAC,UAAkB;QACxC,IAAI,MAAM,GAAG,iBAAiB,CAAC,UAAU,CAAC;QAC1C,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC;YAC7B,MAAM,GAAG,iBAAiB,CAAC,GAAG,CAAC;QACjC,OAAO,MAAM,CAAC;IAChB,CAAC;IALe,yBAAO,UAKtB,CAAA;AACH,CAAC,EAZgB,iBAAiB,KAAjB,iBAAiB,QAYjC;AAuB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AC,gCAAgC,EAAE,IAAI,CAAC,CAAC;QAC/F,6DAA6D;QAC7D,KAAK,CAAC,wBAAwB,CAAC,cAAc,CAAC,IAAI,CAAC,4BAA4B,EAAE,IAAI,CAAC,CAAC;IACzF,CAAC;IAEO,2BAA2B,CAAC,IAAwC,EAAE,KAA0B;QACtG,IAAI,CAAC,uBAAuB,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACvD,CAAC;IAEO,gCAAgC,CAAC,GAAkC,EAAE,KAA0B;QACrG,IAAI,CAAC,4BAA4B,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC3D,CAAC;IAEO,4BAA4B,CAAC,QAAqC,EAAE,KAA0B;QACpG,IAAI,CAAC,wBAAwB,CAAC,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC5D,CAAC;CACF","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 DisplayStyles\r\n */\r\n\r\nimport { assert, BeEvent } from \"@itwin/core-bentley\";\r\nimport { FeatureAppearance, FeatureAppearanceProps } from \"./FeatureSymbology\";\r\nimport { PlanarClipMaskMode, PlanarClipMaskProps, PlanarClipMaskSettings } from \"./PlanarClipMask\";\r\nimport { SpatialClassifierProps, SpatialClassifiers } from \"./SpatialClassification\";\r\nimport { RealityModelDisplayProps, RealityModelDisplaySettings } from \"./RealityModelDisplaySettings\";\r\n\r\n/** JSON representation of the blob properties for an OrbitGt property cloud.\r\n * @alpha\r\n */\r\nexport interface OrbitGtBlobProps {\r\n rdsUrl?: string;\r\n containerName: string;\r\n blobFileName: string;\r\n sasToken: string;\r\n accountName: string;\r\n}\r\n\r\n/** Identify the Reality Data service provider\r\n * @beta\r\n */\r\nexport enum RealityDataProvider {\r\n /**\r\n * This is the legacy mode where the access to the 3d tiles is harcoded in ContextRealityModelProps.tilesetUrl property.\r\n * It was use to support RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles\r\n * You should use other mode when possible\r\n * @see [[RealityDataSource.createKeyFromUrl]] that will try to detect provider from an URL\r\n */\r\n TilesetUrl = \"TilesetUrl\",\r\n /**\r\n * This is the legacy mode where the access to the 3d tiles is harcoded in ContextRealityModelProps.OrbitGtBlob property.\r\n * It was use to support OrbitPointCloud (OPC) from other server than ContextShare\r\n * You should use other mode when possible\r\n * @see [[RealityDataSource.createKeyFromOrbitGtBlobProps]] that will try to detect provider from an URL\r\n */\r\n OrbitGtBlob = \"OrbitGtBlob\",\r\n /**\r\n * Will provide access url from realityDataId and iTwinId on contextShare for 3dTile storage format or OPC storage format\r\n * This provider support all type of 3dTile storage fomat and OrbitPointCloud: RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles, OPC\r\n * @see [[RealityDataFormat]].\r\n */\r\n ContextShare = \"ContextShare\",\r\n /**\r\n * Will provide Open Street Map Building (OSM) from Cesium Ion (in 3dTile format)\r\n */\r\n CesiumIonAsset = \"CesiumIonAsset\",\r\n}\r\n\r\n/** Identify the Reality Data storage format\r\n * @beta\r\n */\r\nexport enum RealityDataFormat {\r\n /**\r\n * 3dTile supported formats; RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles\r\n * */\r\n ThreeDTile = \"ThreeDTile\",\r\n /**\r\n * Orbit Point Cloud (OPC) storage format (RealityDataType.OPC)\r\n */\r\n OPC = \"OPC\",\r\n}\r\n\r\n/** Utility function for RealityDataFormat\r\n * @beta\r\n */\r\nexport namespace RealityDataFormat {\r\n /**\r\n * Try to extract the RealityDataFormat from the url\r\n * @param tilesetUrl the reality data attachment url\r\n * @returns the extracted RealityDataFormat or ThreeDTile by default if not found\r\n */\r\n export function fromUrl(tilesetUrl: string): RealityDataFormat {\r\n let format = RealityDataFormat.ThreeDTile;\r\n if (tilesetUrl.includes(\".opc\"))\r\n format = RealityDataFormat.OPC;\r\n return format;\r\n }\r\n}\r\n\r\n/**\r\n * Key used by RealityDataSource to identify provider and reality data format\r\n * This key identify one and only one reality data source on the provider\r\n * @beta\r\n */\r\nexport interface RealityDataSourceKey {\r\n /**\r\n * The provider that supplies the access to reality data source for displaying the reality model\r\n * @see [[RealityDataProvider]] for default supported value;\r\n */\r\n provider: string;\r\n /**\r\n * The format used by the provider to store the reality data\r\n * @see [[RealityDataFormat]] for default supported value;\r\n */\r\n format: string;\r\n /** The reality data id that identify a reality data for the provider */\r\n id: string;\r\n /** The context id that was used when reality data was attached - if none provided, current session iTwinId will be used */\r\n iTwinId?: string;\r\n}\r\n/**\r\n * RealityDataSourceKey utility functions\r\n * @beta */\r\nexport namespace RealityDataSourceKey {\r\n /** Utility function to convert a RealityDataSourceKey into its string representation */\r\n export function convertToString(rdSourceKey: RealityDataSourceKey): string {\r\n return `${rdSourceKey.provider}:${rdSourceKey.format}:${rdSourceKey.id}:${rdSourceKey?.iTwinId}`;\r\n }\r\n /** Utility function to compare two RealityDataSourceKey, we consider it equal even if itwinId is different */\r\n export function isEqual(key1: RealityDataSourceKey, key2: RealityDataSourceKey): boolean {\r\n if ((key1.provider === RealityDataProvider.CesiumIonAsset) && key2.provider === RealityDataProvider.CesiumIonAsset)\r\n return true; // ignore other properties for CesiumIonAsset, id is hidden\r\n if ((key1.provider === key2.provider) && (key1.format === key2.format) && (key1.id === key2.id)) {\r\n // && (key1?.iTwinId === key2?.iTwinId)) -> ignore iTwinId, consider it is the same reality data\r\n return true;\r\n }\r\n return false;\r\n }\r\n}\r\n\r\n/** JSON representation of the reality data reference attachment properties.\r\n * @beta\r\n*/\r\nexport interface RealityDataSourceProps {\r\n /** The source key that identify a reality data for the provider. */\r\n sourceKey: RealityDataSourceKey;\r\n}\r\n\r\n/** JSON representation of a [[ContextRealityModel]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface ContextRealityModelProps {\r\n /** See [[ContextRealityModel.rdSourceKey]].\r\n * @beta\r\n */\r\n rdSourceKey?: RealityDataSourceKey;\r\n /** The URL that supplies the 3d tiles for displaying the reality model. */\r\n tilesetUrl: string;\r\n /** See [[ContextRealityModel.orbitGtBlob]].\r\n * @alpha\r\n */\r\n orbitGtBlob?: OrbitGtBlobProps;\r\n /** See [[ContextRealityModel.realityDataId]]. */\r\n realityDataId?: string;\r\n /** An optional, user-friendly name for the reality model suitable for display in a user interface. */\r\n name?: string;\r\n /** An optional, user-friendly description of the reality model suitable for display in a user interface. */\r\n description?: string;\r\n /** See [[ContextRealityModel.classifiers]]. */\r\n classifiers?: SpatialClassifierProps[];\r\n /** See [[ContextRealityModel.planarClipMask]]. */\r\n planarClipMask?: PlanarClipMaskProps;\r\n /** See [[ContextRealityModel.appearanceOverrides]]. */\r\n appearanceOverrides?: FeatureAppearanceProps;\r\n /** See [[ContextRealityModel.displaySettings]].\r\n * @beta\r\n */\r\n displaySettings?: RealityModelDisplayProps;\r\n}\r\n\r\n/** @public */\r\nexport namespace ContextRealityModelProps {\r\n /** Produce a deep copy of `input`. */\r\n export function clone(input: ContextRealityModelProps) {\r\n // Spread operator is shallow, and includes `undefined` properties and empty strings.\r\n // We want to make deep copies, omit undefined properties and empty strings, and require tilesetUrl to be defined.\r\n const output: ContextRealityModelProps = { tilesetUrl: input.tilesetUrl ?? \"\" };\r\n\r\n if (input.rdSourceKey)\r\n output.rdSourceKey = { ...input.rdSourceKey };\r\n\r\n if (input.name)\r\n output.name = input.name;\r\n\r\n if (input.realityDataId)\r\n output.realityDataId = input.realityDataId;\r\n\r\n if (input.description)\r\n output.description = input.description;\r\n\r\n if (input.orbitGtBlob)\r\n output.orbitGtBlob = { ...input.orbitGtBlob };\r\n\r\n if (input.appearanceOverrides) {\r\n output.appearanceOverrides = { ...input.appearanceOverrides };\r\n if (input.appearanceOverrides.rgb)\r\n output.appearanceOverrides.rgb = { ...input.appearanceOverrides.rgb };\r\n }\r\n\r\n if (input.displaySettings) {\r\n output.displaySettings = { ...input.displaySettings };\r\n if (input.displaySettings.pointCloud)\r\n output.displaySettings.pointCloud = { ...output.displaySettings.pointCloud };\r\n }\r\n\r\n if (input.planarClipMask)\r\n output.planarClipMask = { ...input.planarClipMask };\r\n\r\n if (input.classifiers)\r\n output.classifiers = input.classifiers.map((x) => { return { ...x, flags: { ...x.flags } }; });\r\n\r\n return output;\r\n }\r\n}\r\n\r\n/** A reality model not associated with a [GeometricModel]($backend) but instead defined in a [DisplayStyle]($backend) or [DisplayStyleState]($frontend).\r\n * Such reality models are displayed to provide context to the view and can be freely attached and detached at display time.\r\n * @see [this interactive example](https://www.itwinjs.org/sample-showcase/?group=Viewer&sample=reality-data-sample)\r\n * @see [[DisplayStyleSettings.contextRealityModels]] to define context reality models for a display style.\r\n * @public\r\n */\r\nexport class ContextRealityModel {\r\n /** @internal */\r\n protected readonly _props: ContextRealityModelProps;\r\n /**\r\n * The reality data source key identify the reality data provider and storage format.\r\n * It takes precedence over tilesetUrl and orbitGtBlob when present and can be use to actually replace these properties.\r\n * @beta\r\n */\r\n public readonly rdSourceKey?: RealityDataSourceKey;\r\n /** A name suitable for display in a user interface. By default, an empty string. */\r\n public readonly name: string;\r\n /** The URL that supplies the 3d tiles for displaying the reality model. */\r\n public readonly url: string;\r\n /** A description of the model suitable for display in a user interface. By default, an empty string. */\r\n public readonly description: string;\r\n /** An optional identifier that, if present, can be used to elide a request to the reality data service. */\r\n public readonly realityDataId?: string;\r\n /** A set of [[SpatialClassifier]]s, of which one at any given time can be used to classify the reality model. */\r\n public readonly classifiers?: SpatialClassifiers;\r\n /** @alpha */\r\n public readonly orbitGtBlob?: Readonly<OrbitGtBlobProps>;\r\n protected _appearanceOverrides?: FeatureAppearance;\r\n /** @beta */\r\n protected _displaySettings: RealityModelDisplaySettings;\r\n protected _planarClipMask?: PlanarClipMaskSettings;\r\n /** Event dispatched just before assignment to [[planarClipMaskSettings]]. */\r\n public readonly onPlanarClipMaskChanged = new BeEvent<(newSettings: PlanarClipMaskSettings | undefined, model: ContextRealityModel) => void>();\r\n /** Event dispatched just before assignment to [[appearanceOverrides]]. */\r\n public readonly onAppearanceOverridesChanged = new BeEvent<(newOverrides: FeatureAppearance | undefined, model: ContextRealityModel) => void>();\r\n /** Event dispatched just before assignment to [[displaySettings]].\r\n * @beta\r\n */\r\n public readonly onDisplaySettingsChanged = new BeEvent<(newSettings: RealityModelDisplaySettings, model: ContextRealityModel) => void>();\r\n\r\n /** Construct a new context reality model.\r\n * @param props JSON representation of the reality model, which will be kept in sync with changes made via the ContextRealityModel's methods.\r\n */\r\n public constructor(props: ContextRealityModelProps) {\r\n this._props = props;\r\n this.rdSourceKey = props.rdSourceKey;\r\n this.name = props.name ?? \"\";\r\n this.url = props.tilesetUrl ?? \"\";\r\n this.orbitGtBlob = props.orbitGtBlob;\r\n this.realityDataId = props.realityDataId;\r\n this.description = props.description ?? \"\";\r\n this._appearanceOverrides = props.appearanceOverrides ? FeatureAppearance.fromJSON(props.appearanceOverrides) : undefined;\r\n this._displaySettings = RealityModelDisplaySettings.fromJSON(props.displaySettings);\r\n\r\n if (props.planarClipMask && props.planarClipMask.mode !== PlanarClipMaskMode.None)\r\n this._planarClipMask = PlanarClipMaskSettings.fromJSON(props.planarClipMask);\r\n\r\n if (props.classifiers)\r\n this.classifiers = new SpatialClassifiers(props);\r\n }\r\n\r\n /** Optionally describes how the geometry of the reality model can be masked by other models. */\r\n public get planarClipMaskSettings(): PlanarClipMaskSettings | undefined {\r\n return this._planarClipMask;\r\n }\r\n public set planarClipMaskSettings(settings: PlanarClipMaskSettings | undefined) {\r\n this.onPlanarClipMaskChanged.raiseEvent(settings, this);\r\n if (!settings)\r\n delete this._props.planarClipMask;\r\n else\r\n this._props.planarClipMask = settings.toJSON();\r\n\r\n this._planarClipMask = settings;\r\n }\r\n\r\n /** Overrides applied to the appearance of the reality model. Only the rgb, transparency, nonLocatable, and emphasized properties are applicable - the rest are ignored. */\r\n public get appearanceOverrides(): FeatureAppearance | undefined {\r\n return this._appearanceOverrides;\r\n }\r\n public set appearanceOverrides(overrides: FeatureAppearance | undefined) {\r\n this.onAppearanceOverridesChanged.raiseEvent(overrides, this);\r\n if (!overrides)\r\n delete this._props.appearanceOverrides;\r\n else\r\n this._props.appearanceOverrides = overrides.toJSON();\r\n\r\n this._appearanceOverrides = overrides;\r\n }\r\n\r\n /** Settings controlling how this reality model is displayed in a [Viewport]($frontend).\r\n * @beta\r\n */\r\n public get displaySettings(): RealityModelDisplaySettings {\r\n return this._displaySettings;\r\n }\r\n public set displaySettings(settings: RealityModelDisplaySettings) {\r\n this.onDisplaySettingsChanged.raiseEvent(settings, this);\r\n this._props.displaySettings = settings.toJSON();\r\n this._displaySettings = settings;\r\n }\r\n\r\n /** Convert this model to its JSON representation. */\r\n public toJSON(): ContextRealityModelProps {\r\n return ContextRealityModelProps.clone(this._props);\r\n }\r\n\r\n /** Returns true if [[name]] and [[url]] match the specified name and url. */\r\n public matchesNameAndUrl(name: string, url: string): boolean {\r\n return this.name === name && this.url === url;\r\n }\r\n}\r\n\r\n/** An object that can store the JSON representation of a list of [[ContextRealityModel]]s.\r\n * @see [[ContextRealityModels]].\r\n * @see [[DisplayStyleSettingsProps.contextRealityModels]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface ContextRealityModelsContainer {\r\n /** The list of reality models. */\r\n contextRealityModels?: ContextRealityModelProps[];\r\n /** @internal used for type discrimination with ContextRealityModelsArgs. */\r\n container?: never;\r\n}\r\n\r\n/** Arguments supplied to the constructor of [[ContextRealityModels]].\r\n * @public\r\n */\r\nexport interface ContextRealityModelsArgs {\r\n /** The object that holds the JSON representation of the list of context reality models. */\r\n container: ContextRealityModelsContainer;\r\n /** Optional function used to instantiate each [[ContextRealityModel]] in the list. */\r\n createContextRealityModel?: (props: ContextRealityModelProps) => ContextRealityModel;\r\n /** If true, the list will not be populated by the constructor. Instead, the caller is responsible for calling [[ContextRealityModels.populate]] exactly once after construction.\r\n * This is chiefly intended for use internally by the [DisplayStyleState]($frontend) constructor.\r\n */\r\n deferPopulating?: boolean;\r\n}\r\n\r\n/** A list of [[ContextRealityModel]]s attached to a [[DisplayStyleSettings]]. The list may be presented to the user with the name and description of each model.\r\n * The list is automatically synchronized with the underlying JSON representation provided by the input [[ContextRealityModelsContainer]].\r\n * @see [this interactive example](https://www.itwinjs.org/sample-showcase/?group=Viewer&sample=reality-data-sample)\r\n * @see [[DisplayStyleSettings.contextRealityModels]].\r\n * @public\r\n */\r\nexport class ContextRealityModels {\r\n private readonly _container: ContextRealityModelsContainer;\r\n private readonly _createModel: (props: ContextRealityModelProps) => ContextRealityModel;\r\n private readonly _models: ContextRealityModel[] = [];\r\n /** Event dispatched just before [[ContextRealityModel.planarClipMaskSettings]] is modified for one of the reality models. */\r\n public readonly onPlanarClipMaskChanged = new BeEvent<(model: ContextRealityModel, newSettings: PlanarClipMaskSettings | undefined) => void>();\r\n /** Event dispatched just before [[ContextRealityModel.appearanceOverrides]] is modified for one of the reality models. */\r\n public readonly onAppearanceOverridesChanged = new BeEvent<(model: ContextRealityModel, newOverrides: FeatureAppearance | undefined) => void>();\r\n /** Event dispatched just before [[ContextRealityModel.displaySettings]] is modified for one of the reality models.\r\n * @beta\r\n */\r\n public readonly onDisplaySettingsChanged = new BeEvent<(model: ContextRealityModel, newSettings: RealityModelDisplaySettings) => void>();\r\n /** Event dispatched when a model is [[add]]ed, [[delete]]d, [[replace]]d, or [[update]]d. */\r\n public readonly onChanged = new BeEvent<(previousModel: ContextRealityModel | undefined, newModel: ContextRealityModel | undefined) => void>();\r\n\r\n /** Construct a new list of reality models from its JSON representation. The list will be initialized from `container.contextRealityModels` and that JSON representation\r\n * will be kept in sync with changes made to the list. The caller should not directly modify `container.contextRealityModels` or its contents as that will cause the list\r\n * to become out of sync with the JSON representation.\r\n * @param container The object that holds the JSON representation of the list.\r\n * @param createContextRealityModel Optional function used to instantiate each [[ContextRealityModel]] in the list.\r\n */\r\n public constructor(container: ContextRealityModelsContainer, createContextRealityModel?: (props: ContextRealityModelProps) => ContextRealityModel);\r\n\r\n /** Construct a new list of reality models from its JSON representation. The list will be initialized from `args.container.contextRealityModels` and that JSON representation\r\n * will be kept in sync with changes made to the list. The caller should not directly modify `container.contextRealityModels` or its contents as that will cause the list\r\n * to become out of sync with the JSON representation.\r\n * @param args Specifies the container and optionally customizes how the list of models is populated.\r\n */\r\n public constructor(args: ContextRealityModelsArgs);\r\n\r\n /** @internal */\r\n public constructor(arg0: ContextRealityModelsContainer | ContextRealityModelsArgs, createContextRealityModel?: (props: ContextRealityModelProps) => ContextRealityModel) {\r\n let container: ContextRealityModelsContainer;\r\n let defer = false;\r\n if (arg0.container) {\r\n container = arg0.container;\r\n createContextRealityModel = arg0.createContextRealityModel;\r\n defer = true === arg0.deferPopulating;\r\n } else {\r\n container = arg0;\r\n }\r\n\r\n this._container = container;\r\n this._createModel = createContextRealityModel ?? ((props) => new ContextRealityModel(props));\r\n\r\n if (!defer)\r\n this.populate();\r\n }\r\n\r\n /** @internal needs to be invoked after DisplayStyleSettings constructor by DisplayStyleState constructor.*/\r\n /** Populate the list of [[models]] from the container that was supplied to the constructor.\r\n * This should only be invoked once, and only if [[ContextRealityModelsArgs.deferPopulating]] was specified as `true` when calling the constructor.\r\n * @public\r\n */\r\n public populate(): void {\r\n assert(this._models.length === 0, \"do not call ContextRealityModels.populate more than once\");\r\n const models = this._container.contextRealityModels;\r\n if (models)\r\n for (const model of models)\r\n this._models.push(this.createModel(model));\r\n }\r\n\r\n /** The read-only list of reality models. */\r\n public get models(): ReadonlyArray<ContextRealityModel> {\r\n return this._models;\r\n }\r\n\r\n /** Append a new reality model to the list.\r\n * @param The JSON representation of the reality model.\r\n * @returns the newly-added reality model.\r\n */\r\n public add(props: ContextRealityModelProps): ContextRealityModel {\r\n if (!this._container.contextRealityModels)\r\n this._container.contextRealityModels = [];\r\n\r\n props = ContextRealityModelProps.clone(props);\r\n const model = this.createModel(props);\r\n\r\n this.onChanged.raiseEvent(undefined, model);\r\n\r\n this._models.push(model);\r\n this._container.contextRealityModels.push(props);\r\n\r\n return model;\r\n }\r\n\r\n /** Remove the specified reality model from the list.\r\n * @param model The reality model to remove.\r\n * @returns true if the model was removed, or false if the model was not present in the list.\r\n */\r\n public delete(model: ContextRealityModel): boolean {\r\n const index = this._models.indexOf(model);\r\n if (-1 === index)\r\n return false;\r\n\r\n assert(undefined !== this._container.contextRealityModels);\r\n assert(index < this._container.contextRealityModels.length);\r\n\r\n this.dropEventListeners(model);\r\n this.onChanged.raiseEvent(model, undefined);\r\n\r\n this._models.splice(index, 1);\r\n if (this.models.length === 0)\r\n this._container.contextRealityModels = undefined;\r\n else\r\n this._container.contextRealityModels.splice(index, 1);\r\n\r\n return true;\r\n }\r\n\r\n /** Remove all reality models from the list. */\r\n public clear(): void {\r\n for (const model of this.models) {\r\n this.dropEventListeners(model);\r\n this.onChanged.raiseEvent(model, undefined);\r\n }\r\n\r\n this._container.contextRealityModels = undefined;\r\n this._models.length = 0;\r\n }\r\n\r\n /** Replace a reality model in the list.\r\n * @param toReplace The reality model to be replaced.\r\n * @param replaceWith The JSON representation of the replacement reality model.\r\n * @returns the newly-created reality model that replaced `toReplace`.\r\n * @throws Error if `toReplace` is not present in the list\r\n * @note The replacement occupies the same index in the list as `toReplace` did.\r\n */\r\n public replace(toReplace: ContextRealityModel, replaceWith: ContextRealityModelProps): ContextRealityModel {\r\n const index = this._models.indexOf(toReplace);\r\n if (-1 === index)\r\n throw new Error(\"ContextRealityModel not present in list.\");\r\n\r\n assert(undefined !== this._container.contextRealityModels);\r\n assert(index < this._container.contextRealityModels.length);\r\n\r\n replaceWith = ContextRealityModelProps.clone(replaceWith);\r\n const model = this.createModel(replaceWith);\r\n\r\n this.onChanged.raiseEvent(toReplace, model);\r\n this.dropEventListeners(toReplace);\r\n\r\n this._models[index] = model;\r\n this._container.contextRealityModels[index] = replaceWith;\r\n\r\n return model;\r\n }\r\n\r\n /** Change selected properties of a reality model.\r\n * @param toUpdate The reality model whose properties are to be modified.\r\n * @param updateProps The properties to change.\r\n * @returns The updated reality model, identical to `toUpdate` except for properties explicitly supplied by `updateProps`.\r\n * @throws Error if `toUpdate` is not present in the list.\r\n */\r\n public update(toUpdate: ContextRealityModel, updateProps: Partial<ContextRealityModelProps>): ContextRealityModel {\r\n const props = {\r\n ...toUpdate.toJSON(),\r\n ...updateProps,\r\n };\r\n\r\n // Partial<> makes it possible to pass `undefined` for tilesetUrl...preserve previous URL in that case.\r\n if (undefined === props.tilesetUrl)\r\n props.tilesetUrl = toUpdate.url;\r\n\r\n return this.replace(toUpdate, props);\r\n }\r\n\r\n private createModel(props: ContextRealityModelProps): ContextRealityModel {\r\n const model = this._createModel(props);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onPlanarClipMaskChanged.addListener(this.handlePlanarClipMaskChanged, this);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onAppearanceOverridesChanged.addListener(this.handleAppearanceOverridesChanged, this);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onDisplaySettingsChanged.addListener(this.handleDisplaySettingsChanged, this);\r\n return model;\r\n }\r\n\r\n private dropEventListeners(model: ContextRealityModel): void {\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onPlanarClipMaskChanged.removeListener(this.handlePlanarClipMaskChanged, this);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onAppearanceOverridesChanged.removeListener(this.handleAppearanceOverridesChanged, this);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onDisplaySettingsChanged.removeListener(this.handleDisplaySettingsChanged, this);\r\n }\r\n\r\n private handlePlanarClipMaskChanged(mask: PlanarClipMaskSettings | undefined, model: ContextRealityModel): void {\r\n this.onPlanarClipMaskChanged.raiseEvent(model, mask);\r\n }\r\n\r\n private handleAppearanceOverridesChanged(app: FeatureAppearance | undefined, model: ContextRealityModel): void {\r\n this.onAppearanceOverridesChanged.raiseEvent(model, app);\r\n }\r\n\r\n private handleDisplaySettingsChanged(settings: RealityModelDisplaySettings, model: ContextRealityModel): void {\r\n this.onDisplaySettingsChanged.raiseEvent(model, settings);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ContextRealityModel.js","sourceRoot":"","sources":["../../src/ContextRealityModel.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAA0B,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAuB,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AACnG,OAAO,EAA0B,kBAAkB,EAA+B,MAAM,yBAAyB,CAAC;AAClH,OAAO,EAA4B,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAatG;;GAEG;AACH,MAAM,CAAN,IAAY,mBAyBX;AAzBD,WAAY,mBAAmB;IAC7B;;;;;OAKG;IACH,gDAAyB,CAAA;IACzB;;;;;OAKG;IACH,kDAA2B,CAAA;IAC3B;;;;OAIG;IACH,oDAA6B,CAAA;IAC7B;;OAEG;IACH,wDAAiC,CAAA;AACnC,CAAC,EAzBW,mBAAmB,KAAnB,mBAAmB,QAyB9B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,iBASX;AATD,WAAY,iBAAiB;IAC3B;;SAEK;IACL,8CAAyB,CAAA;IACzB;;MAEE;IACF,gCAAW,CAAA;AACb,CAAC,EATW,iBAAiB,KAAjB,iBAAiB,QAS5B;AAED;;GAEG;AACH,WAAiB,iBAAiB;IAChC;;;;OAIG;IACH,SAAgB,OAAO,CAAC,UAAkB;QACxC,IAAI,MAAM,GAAG,iBAAiB,CAAC,UAAU,CAAC;QAC1C,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC;YAC7B,MAAM,GAAG,iBAAiB,CAAC,GAAG,CAAC;QACjC,OAAO,MAAM,CAAC;IAChB,CAAC;IALe,yBAAO,UAKtB,CAAA;AACH,CAAC,EAZgB,iBAAiB,KAAjB,i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AC;IACf,CAAC;IAEO,kBAAkB,CAAC,KAA0B;QACnD,6DAA6D;QAC7D,KAAK,CAAC,uBAAuB,CAAC,cAAc,CAAC,IAAI,CAAC,2BAA2B,EAAE,IAAI,CAAC,CAAC;QACrF,6DAA6D;QAC7D,KAAK,CAAC,4BAA4B,CAAC,cAAc,CAAC,IAAI,CAAC,gCAAgC,EAAE,IAAI,CAAC,CAAC;QAC/F,6DAA6D;QAC7D,KAAK,CAAC,wBAAwB,CAAC,cAAc,CAAC,IAAI,CAAC,4BAA4B,EAAE,IAAI,CAAC,CAAC;IACzF,CAAC;IAEO,2BAA2B,CAAC,IAAwC,EAAE,KAA0B;QACtG,IAAI,CAAC,uBAAuB,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACvD,CAAC;IAEO,gCAAgC,CAAC,GAAkC,EAAE,KAA0B;QACrG,IAAI,CAAC,4BAA4B,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC3D,CAAC;IAEO,4BAA4B,CAAC,QAAqC,EAAE,KAA0B;QACpG,IAAI,CAAC,wBAAwB,CAAC,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC5D,CAAC;CACF","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 DisplayStyles\r\n */\r\n\r\nimport { assert, BeEvent } from \"@itwin/core-bentley\";\r\nimport { FeatureAppearance, FeatureAppearanceProps } from \"./FeatureSymbology\";\r\nimport { PlanarClipMaskMode, PlanarClipMaskProps, PlanarClipMaskSettings } from \"./PlanarClipMask\";\r\nimport { SpatialClassifierProps, SpatialClassifiers, SpatialClassifiersContainer } from \"./SpatialClassification\";\r\nimport { RealityModelDisplayProps, RealityModelDisplaySettings } from \"./RealityModelDisplaySettings\";\r\n\r\n/** JSON representation of the blob properties for an OrbitGt property cloud.\r\n * @alpha\r\n */\r\nexport interface OrbitGtBlobProps {\r\n rdsUrl?: string;\r\n containerName: string;\r\n blobFileName: string;\r\n sasToken: string;\r\n accountName: string;\r\n}\r\n\r\n/** Identify the Reality Data service provider\r\n * @beta\r\n */\r\nexport enum RealityDataProvider {\r\n /**\r\n * This is the legacy mode where the access to the 3d tiles is harcoded in ContextRealityModelProps.tilesetUrl property.\r\n * It was use to support RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles\r\n * You should use other mode when possible\r\n * @see [[RealityDataSource.createKeyFromUrl]] that will try to detect provider from an URL\r\n */\r\n TilesetUrl = \"TilesetUrl\",\r\n /**\r\n * This is the legacy mode where the access to the 3d tiles is harcoded in ContextRealityModelProps.OrbitGtBlob property.\r\n * It was use to support OrbitPointCloud (OPC) from other server than ContextShare\r\n * You should use other mode when possible\r\n * @see [[RealityDataSource.createKeyFromOrbitGtBlobProps]] that will try to detect provider from an URL\r\n */\r\n OrbitGtBlob = \"OrbitGtBlob\",\r\n /**\r\n * Will provide access url from realityDataId and iTwinId on contextShare for 3dTile storage format or OPC storage format\r\n * This provider support all type of 3dTile storage fomat and OrbitPointCloud: RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles, OPC\r\n * @see [[RealityDataFormat]].\r\n */\r\n ContextShare = \"ContextShare\",\r\n /**\r\n * Will provide Open Street Map Building (OSM) from Cesium Ion (in 3dTile format)\r\n */\r\n CesiumIonAsset = \"CesiumIonAsset\",\r\n}\r\n\r\n/** Identify the Reality Data storage format\r\n * @beta\r\n */\r\nexport enum RealityDataFormat {\r\n /**\r\n * 3dTile supported formats; RealityMesh3DTiles, Terrain3DTiles, Cesium3DTiles\r\n * */\r\n ThreeDTile = \"ThreeDTile\",\r\n /**\r\n * Orbit Point Cloud (OPC) storage format (RealityDataType.OPC)\r\n */\r\n OPC = \"OPC\",\r\n}\r\n\r\n/** Utility function for RealityDataFormat\r\n * @beta\r\n */\r\nexport namespace RealityDataFormat {\r\n /**\r\n * Try to extract the RealityDataFormat from the url\r\n * @param tilesetUrl the reality data attachment url\r\n * @returns the extracted RealityDataFormat or ThreeDTile by default if not found\r\n */\r\n export function fromUrl(tilesetUrl: string): RealityDataFormat {\r\n let format = RealityDataFormat.ThreeDTile;\r\n if (tilesetUrl.includes(\".opc\"))\r\n format = RealityDataFormat.OPC;\r\n return format;\r\n }\r\n}\r\n\r\n/**\r\n * Key used by RealityDataSource to identify provider and reality data format\r\n * This key identify one and only one reality data source on the provider\r\n * @beta\r\n */\r\nexport interface RealityDataSourceKey {\r\n /**\r\n * The provider that supplies the access to reality data source for displaying the reality model\r\n * @see [[RealityDataProvider]] for default supported value;\r\n */\r\n provider: string;\r\n /**\r\n * The format used by the provider to store the reality data\r\n * @see [[RealityDataFormat]] for default supported value;\r\n */\r\n format: string;\r\n /** The reality data id that identify a reality data for the provider */\r\n id: string;\r\n /** The context id that was used when reality data was attached - if none provided, current session iTwinId will be used */\r\n iTwinId?: string;\r\n}\r\n/**\r\n * RealityDataSourceKey utility functions\r\n * @beta */\r\nexport namespace RealityDataSourceKey {\r\n /** Utility function to convert a RealityDataSourceKey into its string representation */\r\n export function convertToString(rdSourceKey: RealityDataSourceKey): string {\r\n return `${rdSourceKey.provider}:${rdSourceKey.format}:${rdSourceKey.id}:${rdSourceKey?.iTwinId}`;\r\n }\r\n /** Utility function to compare two RealityDataSourceKey, we consider it equal even if itwinId is different */\r\n export function isEqual(key1: RealityDataSourceKey, key2: RealityDataSourceKey): boolean {\r\n if ((key1.provider === RealityDataProvider.CesiumIonAsset) && key2.provider === RealityDataProvider.CesiumIonAsset)\r\n return true; // ignore other properties for CesiumIonAsset, id is hidden\r\n if ((key1.provider === key2.provider) && (key1.format === key2.format) && (key1.id === key2.id)) {\r\n // && (key1?.iTwinId === key2?.iTwinId)) -> ignore iTwinId, consider it is the same reality data\r\n return true;\r\n }\r\n return false;\r\n }\r\n}\r\n\r\n/** JSON representation of the reality data reference attachment properties.\r\n * @beta\r\n*/\r\nexport interface RealityDataSourceProps {\r\n /** The source key that identify a reality data for the provider. */\r\n sourceKey: RealityDataSourceKey;\r\n}\r\n\r\n/** JSON representation of a [[ContextRealityModel]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface ContextRealityModelProps {\r\n /** See [[ContextRealityModel.rdSourceKey]].\r\n * @beta\r\n */\r\n rdSourceKey?: RealityDataSourceKey;\r\n /** The URL that supplies the 3d tiles for displaying the reality model. */\r\n tilesetUrl: string;\r\n /** See [[ContextRealityModel.orbitGtBlob]].\r\n * @alpha\r\n */\r\n orbitGtBlob?: OrbitGtBlobProps;\r\n /** See [[ContextRealityModel.realityDataId]]. */\r\n realityDataId?: string;\r\n /** An optional, user-friendly name for the reality model suitable for display in a user interface. */\r\n name?: string;\r\n /** An optional, user-friendly description of the reality model suitable for display in a user interface. */\r\n description?: string;\r\n /** See [[ContextRealityModel.classifiers]]. */\r\n classifiers?: SpatialClassifierProps[];\r\n /** See [[ContextRealityModel.planarClipMask]]. */\r\n planarClipMask?: PlanarClipMaskProps;\r\n /** See [[ContextRealityModel.appearanceOverrides]]. */\r\n appearanceOverrides?: FeatureAppearanceProps;\r\n /** See [[ContextRealityModel.displaySettings]].\r\n * @beta\r\n */\r\n displaySettings?: RealityModelDisplayProps;\r\n}\r\n\r\n/** @public */\r\nexport namespace ContextRealityModelProps {\r\n /** Produce a deep copy of `input`. */\r\n export function clone(input: ContextRealityModelProps): ContextRealityModelProps {\r\n // Spread operator is shallow, and includes `undefined` properties and empty strings.\r\n // We want to make deep copies, omit undefined properties and empty strings, and require tilesetUrl to be defined.\r\n const output: ContextRealityModelProps = { tilesetUrl: input.tilesetUrl ?? \"\" };\r\n\r\n if (input.rdSourceKey)\r\n output.rdSourceKey = { ...input.rdSourceKey };\r\n\r\n if (input.name)\r\n output.name = input.name;\r\n\r\n if (input.realityDataId)\r\n output.realityDataId = input.realityDataId;\r\n\r\n if (input.description)\r\n output.description = input.description;\r\n\r\n if (input.orbitGtBlob)\r\n output.orbitGtBlob = { ...input.orbitGtBlob };\r\n\r\n if (input.appearanceOverrides) {\r\n output.appearanceOverrides = { ...input.appearanceOverrides };\r\n if (input.appearanceOverrides.rgb)\r\n output.appearanceOverrides.rgb = { ...input.appearanceOverrides.rgb };\r\n }\r\n\r\n if (input.displaySettings) {\r\n output.displaySettings = { ...input.displaySettings };\r\n if (input.displaySettings.pointCloud)\r\n output.displaySettings.pointCloud = { ...output.displaySettings.pointCloud };\r\n }\r\n\r\n if (input.planarClipMask)\r\n output.planarClipMask = { ...input.planarClipMask };\r\n\r\n if (input.classifiers)\r\n output.classifiers = input.classifiers.map((x) => { return { ...x, flags: { ...x.flags } }; });\r\n\r\n return output;\r\n }\r\n}\r\n\r\n/** A reality model not associated with a [GeometricModel]($backend) but instead defined in a [DisplayStyle]($backend) or [DisplayStyleState]($frontend).\r\n * Such reality models are displayed to provide context to the view and can be freely attached and detached at display time.\r\n * @see [this interactive example](https://www.itwinjs.org/sample-showcase/?group=Viewer&sample=reality-data-sample)\r\n * @see [[DisplayStyleSettings.contextRealityModels]] to define context reality models for a display style.\r\n * @public\r\n */\r\nexport class ContextRealityModel {\r\n /** @internal */\r\n protected readonly _props: ContextRealityModelProps;\r\n /**\r\n * The reality data source key identify the reality data provider and storage format.\r\n * It takes precedence over tilesetUrl and orbitGtBlob when present and can be use to actually replace these properties.\r\n * @beta\r\n */\r\n public readonly rdSourceKey?: RealityDataSourceKey;\r\n /** A name suitable for display in a user interface. By default, an empty string. */\r\n public readonly name: string;\r\n /** The URL that supplies the 3d tiles for displaying the reality model. */\r\n public readonly url: string;\r\n /** A description of the model suitable for display in a user interface. By default, an empty string. */\r\n public readonly description: string;\r\n /** An optional identifier that, if present, can be used to elide a request to the reality data service. */\r\n public readonly realityDataId?: string;\r\n private readonly _classifiers: SpatialClassifiers;\r\n /** @alpha */\r\n public readonly orbitGtBlob?: Readonly<OrbitGtBlobProps>;\r\n protected _appearanceOverrides?: FeatureAppearance;\r\n /** @beta */\r\n protected _displaySettings: RealityModelDisplaySettings;\r\n protected _planarClipMask?: PlanarClipMaskSettings;\r\n /** Event dispatched just before assignment to [[planarClipMaskSettings]]. */\r\n public readonly onPlanarClipMaskChanged = new BeEvent<(newSettings: PlanarClipMaskSettings | undefined, model: ContextRealityModel) => void>();\r\n /** Event dispatched just before assignment to [[appearanceOverrides]]. */\r\n public readonly onAppearanceOverridesChanged = new BeEvent<(newOverrides: FeatureAppearance | undefined, model: ContextRealityModel) => void>();\r\n /** Event dispatched just before assignment to [[displaySettings]].\r\n * @beta\r\n */\r\n public readonly onDisplaySettingsChanged = new BeEvent<(newSettings: RealityModelDisplaySettings, model: ContextRealityModel) => void>();\r\n\r\n /** Construct a new context reality model.\r\n * @param props JSON representation of the reality model, which will be kept in sync with changes made via the ContextRealityModel's methods.\r\n * @param options Options to customize how the reality model is created.\r\n */\r\n public constructor(props: ContextRealityModelProps, options?: { createClassifiers: (container: SpatialClassifiersContainer) => SpatialClassifiers }) {\r\n this._props = props;\r\n this.rdSourceKey = props.rdSourceKey;\r\n this.name = props.name ?? \"\";\r\n this.url = props.tilesetUrl ?? \"\";\r\n this.orbitGtBlob = props.orbitGtBlob;\r\n this.realityDataId = props.realityDataId;\r\n this.description = props.description ?? \"\";\r\n this._appearanceOverrides = props.appearanceOverrides ? FeatureAppearance.fromJSON(props.appearanceOverrides) : undefined;\r\n this._displaySettings = RealityModelDisplaySettings.fromJSON(props.displaySettings);\r\n\r\n if (props.planarClipMask && props.planarClipMask.mode !== PlanarClipMaskMode.None)\r\n this._planarClipMask = PlanarClipMaskSettings.fromJSON(props.planarClipMask);\r\n\r\n if (options?.createClassifiers) {\r\n this._classifiers = options.createClassifiers(props);\r\n } else {\r\n this._classifiers = new SpatialClassifiers(props);\r\n }\r\n }\r\n\r\n /** A set of [[SpatialClassifier]]s, of which one at any given time can be used to classify the reality model. */\r\n public get classifiers(): SpatialClassifiers {\r\n return this._classifiers;\r\n }\r\n\r\n /** Optionally describes how the geometry of the reality model can be masked by other models. */\r\n public get planarClipMaskSettings(): PlanarClipMaskSettings | undefined {\r\n return this._planarClipMask;\r\n }\r\n public set planarClipMaskSettings(settings: PlanarClipMaskSettings | undefined) {\r\n this.onPlanarClipMaskChanged.raiseEvent(settings, this);\r\n if (!settings)\r\n delete this._props.planarClipMask;\r\n else\r\n this._props.planarClipMask = settings.toJSON();\r\n\r\n this._planarClipMask = settings;\r\n }\r\n\r\n /** Overrides applied to the appearance of the reality model. Only the rgb, transparency, nonLocatable, and emphasized properties are applicable - the rest are ignored. */\r\n public get appearanceOverrides(): FeatureAppearance | undefined {\r\n return this._appearanceOverrides;\r\n }\r\n public set appearanceOverrides(overrides: FeatureAppearance | undefined) {\r\n this.onAppearanceOverridesChanged.raiseEvent(overrides, this);\r\n if (!overrides)\r\n delete this._props.appearanceOverrides;\r\n else\r\n this._props.appearanceOverrides = overrides.toJSON();\r\n\r\n this._appearanceOverrides = overrides;\r\n }\r\n\r\n /** Settings controlling how this reality model is displayed in a [Viewport]($frontend).\r\n * @beta\r\n */\r\n public get displaySettings(): RealityModelDisplaySettings {\r\n return this._displaySettings;\r\n }\r\n public set displaySettings(settings: RealityModelDisplaySettings) {\r\n this.onDisplaySettingsChanged.raiseEvent(settings, this);\r\n this._props.displaySettings = settings.toJSON();\r\n this._displaySettings = settings;\r\n }\r\n\r\n /** Convert this model to its JSON representation. */\r\n public toJSON(): ContextRealityModelProps {\r\n return ContextRealityModelProps.clone(this._props);\r\n }\r\n\r\n /** Returns true if [[name]] and [[url]] match the specified name and url. */\r\n public matchesNameAndUrl(name: string, url: string): boolean {\r\n return this.name === name && this.url === url;\r\n }\r\n}\r\n\r\n/** An object that can store the JSON representation of a list of [[ContextRealityModel]]s.\r\n * @see [[ContextRealityModels]].\r\n * @see [[DisplayStyleSettingsProps.contextRealityModels]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface ContextRealityModelsContainer {\r\n /** The list of reality models. */\r\n contextRealityModels?: ContextRealityModelProps[];\r\n /** @internal used for type discrimination with ContextRealityModelsArgs. */\r\n container?: never;\r\n}\r\n\r\n/** Arguments supplied to the constructor of [[ContextRealityModels]].\r\n * @public\r\n */\r\nexport interface ContextRealityModelsArgs {\r\n /** The object that holds the JSON representation of the list of context reality models. */\r\n container: ContextRealityModelsContainer;\r\n /** Optional function used to instantiate each [[ContextRealityModel]] in the list. */\r\n createContextRealityModel?: (props: ContextRealityModelProps) => ContextRealityModel;\r\n /** If true, the list will not be populated by the constructor. Instead, the caller is responsible for calling [[ContextRealityModels.populate]] exactly once after construction.\r\n * This is chiefly intended for use internally by the [DisplayStyleState]($frontend) constructor.\r\n */\r\n deferPopulating?: boolean;\r\n}\r\n\r\n/** A list of [[ContextRealityModel]]s attached to a [[DisplayStyleSettings]]. The list may be presented to the user with the name and description of each model.\r\n * The list is automatically synchronized with the underlying JSON representation provided by the input [[ContextRealityModelsContainer]].\r\n * @see [this interactive example](https://www.itwinjs.org/sample-showcase/?group=Viewer&sample=reality-data-sample)\r\n * @see [[DisplayStyleSettings.contextRealityModels]].\r\n * @public\r\n */\r\nexport class ContextRealityModels {\r\n private readonly _container: ContextRealityModelsContainer;\r\n private readonly _createModel: (props: ContextRealityModelProps) => ContextRealityModel;\r\n private readonly _models: ContextRealityModel[] = [];\r\n /** Event dispatched just before [[ContextRealityModel.planarClipMaskSettings]] is modified for one of the reality models. */\r\n public readonly onPlanarClipMaskChanged = new BeEvent<(model: ContextRealityModel, newSettings: PlanarClipMaskSettings | undefined) => void>();\r\n /** Event dispatched just before [[ContextRealityModel.appearanceOverrides]] is modified for one of the reality models. */\r\n public readonly onAppearanceOverridesChanged = new BeEvent<(model: ContextRealityModel, newOverrides: FeatureAppearance | undefined) => void>();\r\n /** Event dispatched just before [[ContextRealityModel.displaySettings]] is modified for one of the reality models.\r\n * @beta\r\n */\r\n public readonly onDisplaySettingsChanged = new BeEvent<(model: ContextRealityModel, newSettings: RealityModelDisplaySettings) => void>();\r\n /** Event dispatched when a model is [[add]]ed, [[delete]]d, [[replace]]d, or [[update]]d. */\r\n public readonly onChanged = new BeEvent<(previousModel: ContextRealityModel | undefined, newModel: ContextRealityModel | undefined) => void>();\r\n\r\n /** Construct a new list of reality models from its JSON representation. The list will be initialized from `container.contextRealityModels` and that JSON representation\r\n * will be kept in sync with changes made to the list. The caller should not directly modify `container.contextRealityModels` or its contents as that will cause the list\r\n * to become out of sync with the JSON representation.\r\n * @param container The object that holds the JSON representation of the list.\r\n * @param createContextRealityModel Optional function used to instantiate each [[ContextRealityModel]] in the list.\r\n */\r\n public constructor(container: ContextRealityModelsContainer, createContextRealityModel?: (props: ContextRealityModelProps) => ContextRealityModel);\r\n\r\n /** Construct a new list of reality models from its JSON representation. The list will be initialized from `args.container.contextRealityModels` and that JSON representation\r\n * will be kept in sync with changes made to the list. The caller should not directly modify `container.contextRealityModels` or its contents as that will cause the list\r\n * to become out of sync with the JSON representation.\r\n * @param args Specifies the container and optionally customizes how the list of models is populated.\r\n */\r\n public constructor(args: ContextRealityModelsArgs);\r\n\r\n /** @internal */\r\n public constructor(arg0: ContextRealityModelsContainer | ContextRealityModelsArgs, createContextRealityModel?: (props: ContextRealityModelProps) => ContextRealityModel) {\r\n let container: ContextRealityModelsContainer;\r\n let defer = false;\r\n if (arg0.container) {\r\n container = arg0.container;\r\n createContextRealityModel = arg0.createContextRealityModel;\r\n defer = true === arg0.deferPopulating;\r\n } else {\r\n container = arg0;\r\n }\r\n\r\n this._container = container;\r\n this._createModel = createContextRealityModel ?? ((props) => new ContextRealityModel(props));\r\n\r\n if (!defer)\r\n this.populate();\r\n }\r\n\r\n /** @internal needs to be invoked after DisplayStyleSettings constructor by DisplayStyleState constructor.*/\r\n /** Populate the list of [[models]] from the container that was supplied to the constructor.\r\n * This should only be invoked once, and only if [[ContextRealityModelsArgs.deferPopulating]] was specified as `true` when calling the constructor.\r\n * @public\r\n */\r\n public populate(): void {\r\n assert(this._models.length === 0, \"do not call ContextRealityModels.populate more than once\");\r\n const models = this._container.contextRealityModels;\r\n if (models)\r\n for (const model of models)\r\n this._models.push(this.createModel(model));\r\n }\r\n\r\n /** The read-only list of reality models. */\r\n public get models(): ReadonlyArray<ContextRealityModel> {\r\n return this._models;\r\n }\r\n\r\n /** Append a new reality model to the list.\r\n * @param The JSON representation of the reality model.\r\n * @returns the newly-added reality model.\r\n */\r\n public add(props: ContextRealityModelProps): ContextRealityModel {\r\n if (!this._container.contextRealityModels)\r\n this._container.contextRealityModels = [];\r\n\r\n props = ContextRealityModelProps.clone(props);\r\n const model = this.createModel(props);\r\n\r\n this.onChanged.raiseEvent(undefined, model);\r\n\r\n this._models.push(model);\r\n this._container.contextRealityModels.push(props);\r\n\r\n return model;\r\n }\r\n\r\n /** Remove the specified reality model from the list.\r\n * @param model The reality model to remove.\r\n * @returns true if the model was removed, or false if the model was not present in the list.\r\n */\r\n public delete(model: ContextRealityModel): boolean {\r\n const index = this._models.indexOf(model);\r\n if (-1 === index)\r\n return false;\r\n\r\n assert(undefined !== this._container.contextRealityModels);\r\n assert(index < this._container.contextRealityModels.length);\r\n\r\n this.dropEventListeners(model);\r\n this.onChanged.raiseEvent(model, undefined);\r\n\r\n this._models.splice(index, 1);\r\n if (this.models.length === 0)\r\n this._container.contextRealityModels = undefined;\r\n else\r\n this._container.contextRealityModels.splice(index, 1);\r\n\r\n return true;\r\n }\r\n\r\n /** Remove all reality models from the list. */\r\n public clear(): void {\r\n for (const model of this.models) {\r\n this.dropEventListeners(model);\r\n this.onChanged.raiseEvent(model, undefined);\r\n }\r\n\r\n this._container.contextRealityModels = undefined;\r\n this._models.length = 0;\r\n }\r\n\r\n /** Replace a reality model in the list.\r\n * @param toReplace The reality model to be replaced.\r\n * @param replaceWith The JSON representation of the replacement reality model.\r\n * @returns the newly-created reality model that replaced `toReplace`.\r\n * @throws Error if `toReplace` is not present in the list\r\n * @note The replacement occupies the same index in the list as `toReplace` did.\r\n */\r\n public replace(toReplace: ContextRealityModel, replaceWith: ContextRealityModelProps): ContextRealityModel {\r\n const index = this._models.indexOf(toReplace);\r\n if (-1 === index)\r\n throw new Error(\"ContextRealityModel not present in list.\");\r\n\r\n assert(undefined !== this._container.contextRealityModels);\r\n assert(index < this._container.contextRealityModels.length);\r\n\r\n replaceWith = ContextRealityModelProps.clone(replaceWith);\r\n const model = this.createModel(replaceWith);\r\n\r\n this.onChanged.raiseEvent(toReplace, model);\r\n this.dropEventListeners(toReplace);\r\n\r\n this._models[index] = model;\r\n this._container.contextRealityModels[index] = replaceWith;\r\n\r\n return model;\r\n }\r\n\r\n /** Change selected properties of a reality model.\r\n * @param toUpdate The reality model whose properties are to be modified.\r\n * @param updateProps The properties to change.\r\n * @returns The updated reality model, identical to `toUpdate` except for properties explicitly supplied by `updateProps`.\r\n * @throws Error if `toUpdate` is not present in the list.\r\n */\r\n public update(toUpdate: ContextRealityModel, updateProps: Partial<ContextRealityModelProps>): ContextRealityModel {\r\n const props = {\r\n ...toUpdate.toJSON(),\r\n ...updateProps,\r\n };\r\n\r\n // Partial<> makes it possible to pass `undefined` for tilesetUrl...preserve previous URL in that case.\r\n if (undefined === props.tilesetUrl)\r\n props.tilesetUrl = toUpdate.url;\r\n\r\n return this.replace(toUpdate, props);\r\n }\r\n\r\n private createModel(props: ContextRealityModelProps): ContextRealityModel {\r\n const model = this._createModel(props);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onPlanarClipMaskChanged.addListener(this.handlePlanarClipMaskChanged, this);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onAppearanceOverridesChanged.addListener(this.handleAppearanceOverridesChanged, this);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onDisplaySettingsChanged.addListener(this.handleDisplaySettingsChanged, this);\r\n return model;\r\n }\r\n\r\n private dropEventListeners(model: ContextRealityModel): void {\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onPlanarClipMaskChanged.removeListener(this.handlePlanarClipMaskChanged, this);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onAppearanceOverridesChanged.removeListener(this.handleAppearanceOverridesChanged, this);\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n model.onDisplaySettingsChanged.removeListener(this.handleDisplaySettingsChanged, this);\r\n }\r\n\r\n private handlePlanarClipMaskChanged(mask: PlanarClipMaskSettings | undefined, model: ContextRealityModel): void {\r\n this.onPlanarClipMaskChanged.raiseEvent(model, mask);\r\n }\r\n\r\n private handleAppearanceOverridesChanged(app: FeatureAppearance | undefined, model: ContextRealityModel): void {\r\n this.onAppearanceOverridesChanged.raiseEvent(model, app);\r\n }\r\n\r\n private handleDisplaySettingsChanged(settings: RealityModelDisplaySettings, model: ContextRealityModel): void {\r\n this.onDisplaySettingsChanged.raiseEvent(model, settings);\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ECSqlReader.d.ts","sourceRoot":"","sources":["../../src/ECSqlReader.ts"],"names":[],"mappings":"AAQA,OAAO,EACS,cAAc,EAAE,eAAe,EAAE,iBAAiB,EAAkD,WAAW,EAAE,YAAY,EAC3I,qBAAqB,EACtB,MAAM,mBAAmB,CAAC;AAE3B,cAAc;AACd,qBAAa,mBAAoB,YAAW,QAAQ,CAAC,qBAAqB,CAAC;aAKtC,UAAU,EAAE,qBAAqB,EAAE;IAJtE,OAAO,CAAC,WAAW,CAA6B;IAChD,OAAO,CAAC,WAAW,CAA6B;IAChD,OAAO,CAAC,SAAS,CAA6B;gBAEX,UAAU,EAAE,qBAAqB,EAAE;IAStE,IAAW,MAAM,IAAI,MAAM,CAE1B;IAEM,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE,SAAS,CAAC;IAIpE,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS;IAQ3D,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS;IAQ/D,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,qBA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