@itwin/core-frontend 5.9.0-dev.9 → 5.9.1

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 (86) hide show
  1. package/CHANGELOG.md +37 -1
  2. package/lib/cjs/BriefcaseConnection.d.ts +2 -2
  3. package/lib/cjs/BriefcaseConnection.js +2 -2
  4. package/lib/cjs/BriefcaseConnection.js.map +1 -1
  5. package/lib/cjs/PerModelCategoryVisibility.d.ts.map +1 -1
  6. package/lib/cjs/PerModelCategoryVisibility.js +83 -81
  7. package/lib/cjs/PerModelCategoryVisibility.js.map +1 -1
  8. package/lib/cjs/SpatialViewState.d.ts.map +1 -1
  9. package/lib/cjs/SpatialViewState.js +3 -1
  10. package/lib/cjs/SpatialViewState.js.map +1 -1
  11. package/lib/cjs/ViewState.d.ts +32 -0
  12. package/lib/cjs/ViewState.d.ts.map +1 -1
  13. package/lib/cjs/ViewState.js +41 -4
  14. package/lib/cjs/ViewState.js.map +1 -1
  15. package/lib/cjs/internal/render/webgl/FrustumUniforms.d.ts.map +1 -1
  16. package/lib/cjs/internal/render/webgl/FrustumUniforms.js.map +1 -1
  17. package/lib/cjs/internal/render/webgl/RenderCommands.js.map +1 -1
  18. package/lib/cjs/quantity-formatting/AlternateUnitLabels.d.ts +8 -0
  19. package/lib/cjs/quantity-formatting/AlternateUnitLabels.d.ts.map +1 -0
  20. package/lib/cjs/quantity-formatting/AlternateUnitLabels.js +26 -0
  21. package/lib/cjs/quantity-formatting/AlternateUnitLabels.js.map +1 -0
  22. package/lib/cjs/quantity-formatting/QuantityFormatter.d.ts +119 -22
  23. package/lib/cjs/quantity-formatting/QuantityFormatter.d.ts.map +1 -1
  24. package/lib/cjs/quantity-formatting/QuantityFormatter.js +271 -65
  25. package/lib/cjs/quantity-formatting/QuantityFormatter.js.map +1 -1
  26. package/lib/cjs/tile/GltfReader.js.map +1 -1
  27. package/lib/cjs/tile/map/MapLayerFormatRegistry.js.map +1 -1
  28. package/lib/cjs/tools/PrimitiveTool.d.ts +1 -1
  29. package/lib/cjs/tools/PrimitiveTool.js +1 -1
  30. package/lib/cjs/tools/PrimitiveTool.js.map +1 -1
  31. package/lib/cjs/tools/ToolAdmin.d.ts +16 -1
  32. package/lib/cjs/tools/ToolAdmin.d.ts.map +1 -1
  33. package/lib/cjs/tools/ToolAdmin.js +52 -5
  34. package/lib/cjs/tools/ToolAdmin.js.map +1 -1
  35. package/lib/cjs/tools/ToolSettings.d.ts +4 -0
  36. package/lib/cjs/tools/ToolSettings.d.ts.map +1 -1
  37. package/lib/cjs/tools/ToolSettings.js +4 -0
  38. package/lib/cjs/tools/ToolSettings.js.map +1 -1
  39. package/lib/esm/BriefcaseConnection.d.ts +2 -2
  40. package/lib/esm/BriefcaseConnection.js +2 -2
  41. package/lib/esm/BriefcaseConnection.js.map +1 -1
  42. package/lib/esm/PerModelCategoryVisibility.d.ts.map +1 -1
  43. package/lib/esm/PerModelCategoryVisibility.js +84 -82
  44. package/lib/esm/PerModelCategoryVisibility.js.map +1 -1
  45. package/lib/esm/SpatialViewState.d.ts.map +1 -1
  46. package/lib/esm/SpatialViewState.js +3 -1
  47. package/lib/esm/SpatialViewState.js.map +1 -1
  48. package/lib/esm/ViewState.d.ts +32 -0
  49. package/lib/esm/ViewState.d.ts.map +1 -1
  50. package/lib/esm/ViewState.js +42 -5
  51. package/lib/esm/ViewState.js.map +1 -1
  52. package/lib/esm/internal/render/webgl/FrustumUniforms.d.ts.map +1 -1
  53. package/lib/esm/internal/render/webgl/FrustumUniforms.js.map +1 -1
  54. package/lib/esm/internal/render/webgl/RenderCommands.js.map +1 -1
  55. package/lib/esm/quantity-formatting/AlternateUnitLabels.d.ts +8 -0
  56. package/lib/esm/quantity-formatting/AlternateUnitLabels.d.ts.map +1 -0
  57. package/lib/esm/quantity-formatting/AlternateUnitLabels.js +23 -0
  58. package/lib/esm/quantity-formatting/AlternateUnitLabels.js.map +1 -0
  59. package/lib/esm/quantity-formatting/QuantityFormatter.d.ts +119 -22
  60. package/lib/esm/quantity-formatting/QuantityFormatter.d.ts.map +1 -1
  61. package/lib/esm/quantity-formatting/QuantityFormatter.js +269 -63
  62. package/lib/esm/quantity-formatting/QuantityFormatter.js.map +1 -1
  63. package/lib/esm/tile/GltfReader.js.map +1 -1
  64. package/lib/esm/tile/map/MapLayerFormatRegistry.js.map +1 -1
  65. package/lib/esm/tools/PrimitiveTool.d.ts +1 -1
  66. package/lib/esm/tools/PrimitiveTool.js +1 -1
  67. package/lib/esm/tools/PrimitiveTool.js.map +1 -1
  68. package/lib/esm/tools/ToolAdmin.d.ts +16 -1
  69. package/lib/esm/tools/ToolAdmin.d.ts.map +1 -1
  70. package/lib/esm/tools/ToolAdmin.js +52 -5
  71. package/lib/esm/tools/ToolAdmin.js.map +1 -1
  72. package/lib/esm/tools/ToolSettings.d.ts +4 -0
  73. package/lib/esm/tools/ToolSettings.d.ts.map +1 -1
  74. package/lib/esm/tools/ToolSettings.js +4 -0
  75. package/lib/esm/tools/ToolSettings.js.map +1 -1
  76. package/lib/public/scripts/parse-imdl-worker.js +1 -1
  77. package/lib/workers/webpack/parse-imdl-worker.js +1 -1
  78. package/package.json +20 -20
  79. package/lib/cjs/quantity-formatting/BasicUnitsProvider.d.ts +0 -38
  80. package/lib/cjs/quantity-formatting/BasicUnitsProvider.d.ts.map +0 -1
  81. package/lib/cjs/quantity-formatting/BasicUnitsProvider.js +0 -160
  82. package/lib/cjs/quantity-formatting/BasicUnitsProvider.js.map +0 -1
  83. package/lib/esm/quantity-formatting/BasicUnitsProvider.d.ts +0 -38
  84. package/lib/esm/quantity-formatting/BasicUnitsProvider.d.ts.map +0 -1
  85. package/lib/esm/quantity-formatting/BasicUnitsProvider.js +0 -155
  86. package/lib/esm/quantity-formatting/BasicUnitsProvider.js.map +0 -1
@@ -76,5 +76,9 @@ export declare class ToolSettings {
76
76
  * @beta
77
77
  */
78
78
  static enableVolumeSelection: boolean;
79
+ /** If true, pressing Escape key sets focus to Home to allow shortcuts to be used.
80
+ * @beta
81
+ */
82
+ static escapeMovesFocusToHome: boolean;
79
83
  }
80
84
  //# sourceMappingURL=ToolSettings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ToolSettings.d.ts","sourceRoot":"","sources":["../../../src/tools/ToolSettings.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAY,MAAM,sBAAsB,CAAC;AAEvD;;;GAGG;AACH,qBAAa,YAAY;IACvB,6DAA6D;IAC7D,OAAc,gBAAgB,aAAoC;IAClE,kEAAkE;IAClE,OAAc,kBAAkB,aAAoC;IACpE,sGAAsG;IACtG,OAAc,0BAA0B,SAAQ;IAChD,4HAA4H;IAC5H,OAAc,4BAA4B,UAAS;IACnD,qFAAqF;IACrF,OAAc,eAAe,UAAQ;IACrC,wEAAwE;IACxE,OAAc,cAAc,aAAmC;IAC/D,gEAAgE;IAChE,OAAc,cAAc,aAAoC;IAChE,wFAAwF;IACxF,OAAc,uBAAuB,SAAO;IAC5C,qFAAqF;IACrF,OAAc,uBAAuB,SAAQ;IAC7C,sGAAsG;IACtG,OAAc,8BAA8B,SAAQ;IACpD,qFAAqF;IACrF,OAAc,wBAAwB,SAAQ;IAC9C,2CAA2C;IAC3C,OAAc,eAAe,QAA6B;IAC1D,oEAAoE;IACpE,OAAc,cAAc,UAAS;IACrC,sDAAsD;IACtD,OAAc,YAAY,SAAO;IACjC,kHAAkH;IAClH,OAAc,kBAAkB,SAAK;IACrC,oFAAoF;IACpF,OAAc,sBAAsB,UAAQ;IAC5C,mFAAmF;IACnF,OAAc,cAAc,UAAS;IACrC,kHAAkH;IAClH,OAAc,eAAe,UAAS;IACtC,oGAAoG;IACpG,OAAc,cAAc,SAAO;IACnC,mFAAmF;IACnF,OAAc,aAAa,SAAO;IAClC,sEAAsE;IACtE,OAAc,eAAe,SAAM;IACnC,sEAAsE;IACtE,OAAc,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sBAAsB,UAAQ;IAC5C,mFAAmF;IACnF,OAAc,cAAc,UAAS;IACrC,kHAAkH;IAClH,OAAc,eAAe,UAAS;IACtC,oGAAoG;IACpG,OAAc,cAAc,SAAO;IACnC,mFAAmF;IACnF,OAAc,aAAa,SAAO;IAClC,sEAAsE;IACtE,OAAc,eAAe,SAAM;IACnC,sEAAsE;IACtE,OAAc,eAAe,SAAO;IACpC,6HAA6H;IAC7H,OAAc,qBAAqB,SAA0B;IAC7D,4EAA4E;IAC5E,OAAc,WAAW,SAAO;IAChC,kDAAkD;IAClD,OAAc,SAAS,SAAM;IAC7B,iDAAiD;IACjD,OAAc,cAAc,SAAO;IACnC,mHAAmH;IACnH,OAAc,cAAc;QAC1B,8BAA8B;;QAE9B,yHAAyH;;QAEzH,qFAAqF;;MAErF;IACF,2FAA2F;IAC3F,OAAc,4BAA4B,SAAM;IAChD;;;OAGG;IACH,OAAc,qBAAqB,UAAS;IAC5C;;MAEE;IACF,OAAc,sBAAsB,UAAQ;CAC7C"}
@@ -83,6 +83,10 @@ class ToolSettings {
83
83
  * @beta
84
84
  */
85
85
  static enableVolumeSelection = false;
86
+ /** If true, pressing Escape key sets focus to Home to allow shortcuts to be used.
87
+ * @beta
88
+ */
89
+ static escapeMovesFocusToHome = true;
86
90
  }
87
91
  exports.ToolSettings = ToolSettings;
88
92
  //# sourceMappingURL=ToolSettings.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ToolSettings.js","sourceRoot":"","sources":["../../../src/tools/ToolSettings.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAiD;AACjD,wDAAuD;AAEvD;;;GAGG;AACH,MAAa,YAAY;IACvB,6DAA6D;IACtD,MAAM,CAAC,gBAAgB,GAAG,yBAAU,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAClE,kEAAkE;IAC3D,MAAM,CAAC,kBAAkB,GAAG,yBAAU,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC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IAC/D,MAAM,CAAC,eAAe,GAAG,GAAG,CAAC;IACpC,6HAA6H;IACtH,MAAM,CAAC,qBAAqB,GAAG,wBAAQ,CAAC,aAAa,CAAC;IAC7D,4EAA4E;IACrE,MAAM,CAAC,WAAW,GAAG,GAAG,CAAC;IAChC,kDAAkD;IAC3C,MAAM,CAAC,SAAS,GAAG,EAAE,CAAC;IAC7B,iDAAiD;IAC1C,MAAM,CAAC,cAAc,GAAG,GAAG,CAAC;IACnC,mHAAmH;IAC5G,MAAM,CAAC,cAAc,GAAG;QAC7B,8BAA8B;QAC9B,OAAO,EAAE,IAAI;QACb,yHAAyH;QACzH,OAAO,EAAE,GAAG;QACZ,qFAAqF;QACrF,QAAQ,EAAE,yBAAU,CAAC,gBAAgB,CAAC,GAAG,CAAC;KAC3C,CAAC;IACF,2FAA2F;IACpF,MAAM,CAAC,4BAA4B,GAAG,EAAE,CAAC;IAChD;;;OAGG;IACI,MAAM,CAAC,qBAAqB,GAAG,KAAK,CAAC;;AApE9C,oCAqEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tools\n */\n\nimport { BeDuration } from \"@itwin/core-bentley\";\nimport { Angle, Constant } from \"@itwin/core-geometry\";\n\n/** Settings that control the behavior of built-in tools. Applications may modify these values.\n * @public\n * @extensions\n */\nexport class ToolSettings {\n /** Two tap must be within this period to be a double tap. */\n public static doubleTapTimeout = BeDuration.fromMilliseconds(250);\n /** Two clicks must be within this period to be a double click. */\n public static doubleClickTimeout = BeDuration.fromMilliseconds(500);\n /** Number of screen inches of movement allowed between clicks to still qualify as a double-click. */\n public static doubleClickToleranceInches = 0.05;\n /** @beta Use virtual cursor to help with locating elements using touch input. By default it's only enabled for snapping. */\n public static enableVirtualCursorForLocate = false;\n /** If true, view rotation tool keeps the up vector (worldZ) aligned with screenY. */\n public static preserveWorldUp = true;\n /** Delay with a touch on the surface before a move operation begins. */\n public static touchMoveDelay = BeDuration.fromMilliseconds(50);\n /** Delay with the mouse down before a drag operation begins. */\n public static startDragDelay = BeDuration.fromMilliseconds(110);\n /** Distance in screen inches a touch point must move before being considered motion. */\n public static touchMoveDistanceInches = 0.1;\n /** Distance in screen inches the cursor must move before a drag operation begins. */\n public static startDragDistanceInches = 0.15;\n /** Distance in screen inches touch points must move apart to be considered a change in zoom scale. */\n public static touchZoomChangeThresholdInches = 0.20;\n /** Radius in screen inches to search for elements that anchor viewing operations. */\n public static viewToolPickRadiusInches = 0.20;\n /** Camera angle enforced for walk tool. */\n public static walkCameraAngle = Angle.createDegrees(75.6);\n /** Whether the walk tool enforces worldZ be aligned with screenY */\n public static walkEnforceZUp = false;\n /** Speed, in meters per second, for the walk tool. */\n public static walkVelocity = 3.5;\n /** @beta Integer increment used to compute a walkVelocity multiplier for the look and move tool, capped at 10x */\n public static walkVelocityChange = 0;\n /** Whether the walk tool requests pointer lock to hide the cursor for mouse look */\n public static walkRequestPointerLock = true;\n /** @beta Whether the look and move tool detects collisions while moving forward */\n public static walkCollisions = false;\n /** @beta Whether the look and move tool adjusts the camera height for stairs/ramps when collisions are enabled */\n public static walkDetectFloor = false;\n /** @beta Maximum step height in meters above floor/ground to use when floor detection is enabled */\n public static walkStepHeight = 0.3;\n /** @beta Camera height in meters above floor/ground to use for set up walk tool */\n public static walkEyeHeight = 1.6;\n /** Scale factor applied for wheel events with \"per-line\" modifier. */\n public static wheelLineFactor = 40;\n /** Scale factor applied for wheel events with \"per-page\" modifier. */\n public static wheelPageFactor = 120;\n /** When the zoom-with-wheel tool (with camera enabled) gets closer than this distance to an obstacle, it \"bumps\" through. */\n public static wheelZoomBumpDistance = Constant.oneCentimeter;\n /** the speed to scroll for the \"scroll view\" tool (distance per second). */\n public static scrollSpeed = .75;\n /** the speed to zoom for the \"zoom view\" tool. */\n public static zoomSpeed = 10;\n /** Scale factor for zooming with mouse wheel. */\n public static wheelZoomRatio = 1.5;\n /** Parameters for viewing operations with *inertia* (i.e. they continue briefly if used with a throwing action) */\n public static viewingInertia = {\n /** Flag to enable inertia. */\n enabled: true,\n /** How quickly the inertia decays. The smaller the damping value the faster the inertia decays. Must be less than 1.0 */\n damping: .96,\n /** Maximum duration of the inertia operation. Important when frame rates are low. */\n duration: BeDuration.fromMilliseconds(500),\n };\n /** Maximum number of times in a second the accuSnap tool's onMotion function is called. */\n public static maxOnMotionSnapCallPerSecond = 15;\n /** If true, drag box selection will accept spatial elements that are inside or overlap a clip volume instead of only what is visible in the view.\n * @note Enabling is not recommended for web applications.\n * @beta\n */\n public static enableVolumeSelection = false;\n}\n"]}
1
+ {"version":3,"file":"ToolSettings.js","sourceRoot":"","sources":["../../../src/tools/ToolSettings.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAiD;AACjD,wDAAuD;AAEvD;;;GAGG;AACH,MAAa,YAAY;IACvB,6DAA6D;IACtD,MAAM,CAAC,gBAAgB,GAAG,yBAAU,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAClE,kEAAkE;IAC3D,MAAM,CAAC,kBAAkB,GAAG,yBAAU,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACpE,sGAAsG;IAC/F,MAAM,CAAC,0BAA0B,GAAG,IAAI,CAAC;IAChD,4HAA4H;IACrH,MAAM,CAAC,4BAA4B,GAAG,KAAK,CAAC;IACnD,qFAAqF;IAC9E,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC;IACrC,wEAAwE;IACjE,MAAM,CAAC,cAAc,GAAG,yBAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC;IAC/D,gEAAgE;IACzD,MAAM,CAAC,cAAc,GAAG,yBAAU,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAChE,wFAAwF;IACjF,MAAM,CAAC,uBAAuB,GAAG,GAAG,CAAC;IAC5C,qFAAqF;IAC9E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,EAAE,yBAAU,CAAC,gBAAgB,CAAC,GAAG,CAAC;KAC3C,CAAC;IACF,2FAA2F;IACpF,MAAM,CAAC,4BAA4B,GAAG,EAAE,CAAC;IAChD;;;OAGG;IACI,MAAM,CAAC,qBAAqB,GAAG,KAAK,CAAC;IAC5C;;MAEE;IACK,MAAM,CAAC,sBAAsB,GAAG,IAAI,CAAC;;AAxE9C,oCAyEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tools\n */\n\nimport { BeDuration } from \"@itwin/core-bentley\";\nimport { Angle, Constant } from \"@itwin/core-geometry\";\n\n/** Settings that control the behavior of built-in tools. Applications may modify these values.\n * @public\n * @extensions\n */\nexport class ToolSettings {\n /** Two tap must be within this period to be a double tap. */\n public static doubleTapTimeout = BeDuration.fromMilliseconds(250);\n /** Two clicks must be within this period to be a double click. */\n public static doubleClickTimeout = BeDuration.fromMilliseconds(500);\n /** Number of screen inches of movement allowed between clicks to still qualify as a double-click. */\n public static doubleClickToleranceInches = 0.05;\n /** @beta Use virtual cursor to help with locating elements using touch input. By default it's only enabled for snapping. */\n public static enableVirtualCursorForLocate = false;\n /** If true, view rotation tool keeps the up vector (worldZ) aligned with screenY. */\n public static preserveWorldUp = true;\n /** Delay with a touch on the surface before a move operation begins. */\n public static touchMoveDelay = BeDuration.fromMilliseconds(50);\n /** Delay with the mouse down before a drag operation begins. */\n public static startDragDelay = BeDuration.fromMilliseconds(110);\n /** Distance in screen inches a touch point must move before being considered motion. */\n public static touchMoveDistanceInches = 0.1;\n /** Distance in screen inches the cursor must move before a drag operation begins. */\n public static startDragDistanceInches = 0.15;\n /** Distance in screen inches touch points must move apart to be considered a change in zoom scale. */\n public static touchZoomChangeThresholdInches = 0.20;\n /** Radius in screen inches to search for elements that anchor viewing operations. */\n public static viewToolPickRadiusInches = 0.20;\n /** Camera angle enforced for walk tool. */\n public static walkCameraAngle = Angle.createDegrees(75.6);\n /** Whether the walk tool enforces worldZ be aligned with screenY */\n public static walkEnforceZUp = false;\n /** Speed, in meters per second, for the walk tool. */\n public static walkVelocity = 3.5;\n /** @beta Integer increment used to compute a walkVelocity multiplier for the look and move tool, capped at 10x */\n public static walkVelocityChange = 0;\n /** Whether the walk tool requests pointer lock to hide the cursor for mouse look */\n public static walkRequestPointerLock = true;\n /** @beta Whether the look and move tool detects collisions while moving forward */\n public static walkCollisions = false;\n /** @beta Whether the look and move tool adjusts the camera height for stairs/ramps when collisions are enabled */\n public static walkDetectFloor = false;\n /** @beta Maximum step height in meters above floor/ground to use when floor detection is enabled */\n public static walkStepHeight = 0.3;\n /** @beta Camera height in meters above floor/ground to use for set up walk tool */\n public static walkEyeHeight = 1.6;\n /** Scale factor applied for wheel events with \"per-line\" modifier. */\n public static wheelLineFactor = 40;\n /** Scale factor applied for wheel events with \"per-page\" modifier. */\n public static wheelPageFactor = 120;\n /** When the zoom-with-wheel tool (with camera enabled) gets closer than this distance to an obstacle, it \"bumps\" through. */\n public static wheelZoomBumpDistance = Constant.oneCentimeter;\n /** the speed to scroll for the \"scroll view\" tool (distance per second). */\n public static scrollSpeed = .75;\n /** the speed to zoom for the \"zoom view\" tool. */\n public static zoomSpeed = 10;\n /** Scale factor for zooming with mouse wheel. */\n public static wheelZoomRatio = 1.5;\n /** Parameters for viewing operations with *inertia* (i.e. they continue briefly if used with a throwing action) */\n public static viewingInertia = {\n /** Flag to enable inertia. */\n enabled: true,\n /** How quickly the inertia decays. The smaller the damping value the faster the inertia decays. Must be less than 1.0 */\n damping: .96,\n /** Maximum duration of the inertia operation. Important when frame rates are low. */\n duration: BeDuration.fromMilliseconds(500),\n };\n /** Maximum number of times in a second the accuSnap tool's onMotion function is called. */\n public static maxOnMotionSnapCallPerSecond = 15;\n /** If true, drag box selection will accept spatial elements that are inside or overlap a clip volume instead of only what is visible in the view.\n * @note Enabling is not recommended for web applications.\n * @beta\n */\n public static enableVolumeSelection = false;\n /** If true, pressing Escape key sets focus to Home to allow shortcuts to be used.\n * @beta\n */\n public static escapeMovesFocusToHome = true;\n}\n"]}
@@ -144,11 +144,11 @@ export declare class BriefcaseConnection extends IModelConnection {
144
144
  hasPendingTxns(): Promise<boolean>;
145
145
  /** Commit pending changes to this briefcase.
146
146
  * @param description Optional description of the changes.
147
- * @deprecated Use methods on EditCommand instead.
147
+ * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use methods on EditCommand instead.
148
148
  */
149
149
  saveChanges(description?: string): Promise<void>;
150
150
  /** Abandon pending changes to this briefcase.
151
- * @deprecated Use methods on EditCommand instead.
151
+ * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use methods on EditCommand instead.
152
152
  */
153
153
  abandonChanges(): Promise<void>;
154
154
  /** Pull (and potentially merge if there are local changes) up to a specified changeset from iModelHub into this briefcase
@@ -244,13 +244,13 @@ export class BriefcaseConnection extends IModelConnection {
244
244
  }
245
245
  /** Commit pending changes to this briefcase.
246
246
  * @param description Optional description of the changes.
247
- * @deprecated Use methods on EditCommand instead.
247
+ * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use methods on EditCommand instead.
248
248
  */
249
249
  async saveChanges(description) {
250
250
  await IpcApp.appFunctionIpc.saveChanges(this.key, description); // eslint-disable-line @typescript-eslint/no-deprecated
251
251
  }
252
252
  /** Abandon pending changes to this briefcase.
253
- * @deprecated Use methods on EditCommand instead.
253
+ * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use methods on EditCommand instead.
254
254
  */
255
255
  async abandonChanges() {
256
256
  await IpcApp.appFunctionIpc.abandonChanges(this.key); // eslint-disable-line @typescript-eslint/no-deprecated
@@ -1 +1 @@
1
- {"version":3,"file":"BriefcaseConnection.js","sourceRoot":"","sources":["../../src/BriefcaseConnection.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,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C;YACtD,eAAe,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;QACxF,CAAC;QAED,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,MAAM,aAAa,GAA6B;YAC9C,cAAc,EAAE,oBAAoB;YACpC,gBAAgB,EAAE,OAAO,EAAE,gBAAgB;YAC3C,kBAAkB,EAAE,CAAC,CAAC,OAAO,EAAE,WAAW;SAC3C,CAAC;QACF,IAAI,CAAC;YACH,IAAI,CAAC,SAAS,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;QAC7F,CAAC;gBAAS,CAAC;YACT,eAAe,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,WAAW,CAAC,WAAmB;QAC1C,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,OAAO,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;IAClE,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,wBAAwB;QACnC,OAAO,MAAM,CAAC,cAAc,CAAC,2BAA2B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrE,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,iBAAiB;QAC5B,OAAO,IAAI,CAAC,cAAc,CAAC,iBAAiB,EAAE,CAAC;IACjD,CAAC;IAED;;OAEG;IACa,sBAAsB,GAAG,IAAI,OAAO,EAA0C,CAAC;CAChG","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module IModelConnection\n */\n\nimport { assert, BeEvent, CompressedId64Set, Guid, GuidString, Id64Set, Id64String, IModelStatus, OpenMode } from \"@itwin/core-bentley\";\nimport {\n BriefcaseConnectionProps, ChangesetIndex, ChangesetIndexAndId, getPullChangesIpcChannel, IModelError,\n PullChangesOptions as IpcAppPullChangesOptions, LockState, OpenBriefcaseProps, StandaloneOpenOptions,\n} from \"@itwin/core-common\";\nimport { BriefcaseTxns } from \"./BriefcaseTxns\";\nimport { GraphicalEditingScope } from \"./GraphicalEditingScope\";\nimport { IModelApp } from \"./IModelApp\";\nimport { IModelConnection } from \"./IModelConnection\";\nimport { IpcApp } from \"./IpcApp\";\nimport { disposeTileTreesForGeometricModels } from \"./tile/internal\";\nimport { Viewport } from \"./Viewport\";\n\n/**\n * Download progress information.\n * @public\n */\nexport interface DownloadProgressInfo {\n /** Bytes downloaded. */\n loaded: number;\n /** Total size of the download in bytes. */\n total: number;\n}\n\n/**\n * Called to show progress during a download.\n * @public\n */\nexport type OnDownloadProgress = (progress: DownloadProgressInfo) => void;\n\n/**\n * Partial interface of AbortSignal.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal\n * @beta\n */\nexport interface GenericAbortSignal {\n /** Add Listener for abort signal. */\n addEventListener: (type: \"abort\", listener: (this: GenericAbortSignal, ev: any) => any) => void;\n /** Remove Listener for abort signal. */\n removeEventListener: (type: \"abort\", listener: (this: GenericAbortSignal, ev: any) => any) => void;\n}\n\n/**\n * Options for pulling iModel changes.\n * @public\n */\nexport interface PullChangesOptions {\n /** Function called regularly to report progress of changes download. */\n downloadProgressCallback?: OnDownloadProgress;\n /** Interval for calling progress callback (in milliseconds). */\n progressInterval?: number;\n /** Signal for cancelling the download.\n * @beta\n */\n abortSignal?: GenericAbortSignal;\n}\n\n/** Keeps track of changes to models, buffering them until synchronization points.\n * While a GraphicalEditingScope is open, the changes are buffered until the scope exits, at which point they are processed.\n * Otherwise, the buffered changes are processed after undo/redo, commit, or pull+merge changes.\n */\nclass ModelChangeMonitor {\n private _editingScope?: GraphicalEditingScope;\n private readonly _briefcase: BriefcaseConnection;\n private readonly _deletedModels = new Set<string>();\n private readonly _modelIdToGuid = new Map<string, string>();\n private readonly _removals: VoidFunction[] = [];\n\n public constructor(briefcase: BriefcaseConnection) {\n this._briefcase = briefcase;\n\n // Buffer updated geometry guids.\n this._removals.push(briefcase.txns.onModelGeometryChanged.addListener((changes) => {\n for (const change of changes) {\n this._deletedModels.delete(change.id);\n this._modelIdToGuid.set(change.id, change.guid);\n }\n }));\n\n // Buffer deletions of models.\n this._removals.push(briefcase.txns.onModelsChanged.addListener((changes) => {\n if (changes.deleted) {\n for (const id of CompressedId64Set.iterable(changes.deleted)) {\n this._modelIdToGuid.delete(id);\n this._deletedModels.add(id);\n }\n }\n }));\n\n // Outside of an editing scope, we want to update viewport contents after commit, undo/redo, or merging changes.\n const maybeProcess = async () => {\n if (this.editingScope)\n return;\n\n const modelIds = Array.from(this._modelIdToGuid.keys());\n if (modelIds.length > 0)\n await IModelApp.tileAdmin.purgeTileTrees(this._briefcase, modelIds);\n\n this.processBuffered();\n };\n\n this._removals.push(briefcase.txns.onCommitted.addListener(maybeProcess));\n this._removals.push(briefcase.txns.onReplayedExternalTxns.addListener(maybeProcess));\n this._removals.push(briefcase.txns.onAfterUndoRedo.addListener(maybeProcess));\n this._removals.push(briefcase.txns.onChangesPulled.addListener(maybeProcess));\n }\n\n public async close(): Promise<void> {\n for (const removal of this._removals)\n removal();\n\n this._removals.length = 0;\n\n if (this._editingScope) {\n await this._editingScope.exit();\n this._editingScope = undefined;\n }\n }\n\n public get editingScope(): GraphicalEditingScope | undefined {\n return this._editingScope;\n }\n\n public async enterEditingScope(): Promise<GraphicalEditingScope> {\n if (this._editingScope)\n throw new Error(\"Cannot create an editing scope for an iModel that already has one\");\n\n this._editingScope = await GraphicalEditingScope.enter(this._briefcase);\n\n const removeGeomListener = this._editingScope.onGeometryChanges.addListener((changes) => {\n const modelIds = [];\n for (const change of changes)\n modelIds.push(change.id);\n\n this.invalidateScenes(modelIds);\n });\n\n this._editingScope.onExited.addOnce((scope) => {\n assert(scope === this._editingScope);\n this._editingScope = undefined;\n removeGeomListener();\n this.processBuffered();\n });\n\n return this._editingScope;\n }\n\n private processBuffered(): void {\n const models = this._briefcase.models;\n for (const [id, guid] of this._modelIdToGuid) {\n const model = models.getLoaded(id)?.asGeometricModel;\n if (model)\n model.geometryGuid = guid;\n }\n\n const modelIds = new Set<string>(this._modelIdToGuid.keys());\n for (const deleted of this._deletedModels) {\n modelIds.add(deleted);\n models.unload(deleted);\n }\n\n this.invalidateScenes(modelIds);\n disposeTileTreesForGeometricModels(modelIds, this._briefcase);\n\n this._briefcase.onBufferedModelChanges.raiseEvent(modelIds);\n\n this._modelIdToGuid.clear();\n this._deletedModels.clear();\n }\n\n private invalidateScenes(changedModels: Iterable<Id64String>): void {\n for (const user of IModelApp.tileAdmin.tileUsers) {\n if (user instanceof Viewport && user.iModel === this._briefcase) {\n for (const modelId of changedModels) {\n if (user.view.viewsModel(modelId)) {\n user.invalidateScene();\n user.setFeatureOverrideProviderChanged();\n break;\n }\n }\n }\n }\n }\n}\n\n/**\n * Provides access to lock information in the iModel.\n * @see [[BriefcaseConnection.locks]]\n * @alpha\n */\nexport interface LockService {\n /** Get all elements with exclusive locks owned by other briefcases. */\n getExclusiveForeignLocks(): Promise<Id64Set>;\n /** Get all elements with shared locks owned by other briefcases. */\n getSharedForeignLocks(): Promise<Id64Set>;\n /** Check whether it's possible to acquire a lock for the element. */\n checkElementLockAvailability(elementId: Id64String, lock: LockState): Promise<boolean>;\n}\n\n/** Function for creating a [[LockService]] for a [[BriefcaseConnection]].\n * @alpha\n */\nexport type LockServiceFactory = (iModel: BriefcaseConnection) => Promise<LockService>;\n\n/** Settings that can be used to control the behavior of [[Tool]]s that modify a [[BriefcaseConnection]].\n * For example, tools that want to create new elements can consult the briefcase's editor tool settings to\n * determine into which model and category to insert the elements.\n * Specialized tools are free to ignore these settings.\n * @see [[BriefcaseConnection.editorToolSettings]] to query or modify the current settings for a briefcase.\n * @see [CreateElementTool]($editor-frontend) for an example of a tool that uses these settings.\n * @beta\n */\nexport class BriefcaseEditorToolSettings {\n private _category?: Id64String;\n private _model?: Id64String;\n\n /** An event raised just after the default [[category]] is changed. */\n public readonly onCategoryChanged = new BeEvent<(previousCategory: Id64String | undefined) => void>();\n\n /** An event raised just after the default [[model]] is changed. */\n public readonly onModelChanged = new BeEvent<(previousModel: Id64String | undefined) => void>();\n\n /** The [Category]($backend) into which new elements should be inserted by default.\n * Specialized tools are free to ignore this setting and instead use their own logic to select an appropriate category.\n * @see [[onCategoryChanged]] to be notified when this property is modified.\n * @see [CreateElementTool.targetCategory]($editor-frontend) for an example of a tool that uses this setting.\n */\n public get category(): Id64String | undefined {\n return this._category;\n }\n public set category(category: Id64String | undefined) {\n const previousCategory = this.category;\n if (category !== this.category) {\n this._category = category;\n this.onCategoryChanged.raiseEvent(previousCategory);\n }\n }\n\n /** The [Model]($backend) into which new elements should be inserted by default.\n * Specialized tools are free to ignore this setting and instead use their own logic to select an appropriate model.\n * @see [[onModelChanged]] to be notified when this property is modified.\n * @see [CreateElementTool.targetModelId]($editor-frontend) for an example of a tool that uses this setting.\n */\n public get model(): Id64String | undefined {\n return this._model;\n }\n public set model(model: Id64String | undefined) {\n const previousModel = this.model;\n if (model !== this.model) {\n this._model = model;\n this.onModelChanged.raiseEvent(previousModel);\n }\n }\n}\n\n/** A connection to an editable briefcase on the backend. This class uses [Ipc]($docs/learning/IpcInterface.md) to communicate\n * to the backend and may only be used by [[IpcApp]]s.\n * @public\n */\nexport class BriefcaseConnection extends IModelConnection {\n protected _isClosed?: boolean;\n private readonly _modelsMonitor: ModelChangeMonitor;\n private _locks?: LockService;\n\n /** The ID of the briefcase.\n * @beta\n */\n public readonly briefcaseId?: number;\n\n /** Default settings that can be used to control the behavior of [[Tool]]s that modify this briefcase.\n * @beta\n */\n public readonly editorToolSettings = new BriefcaseEditorToolSettings();\n\n /** Manages local changes to the briefcase via [Txns]($docs/learning/InteractiveEditing.md). */\n public readonly txns: BriefcaseTxns;\n\n /** Information about locks held on this iModel.\n * @note This is intended to be used by tools and other UI elements, to provide information about the current lock state. Implementations are expected to cache lock information and so may not reflect changes to locks immediately.\n * @alpha\n */\n public get locks(): LockService | undefined { return this._locks; }\n\n public override isBriefcaseConnection(): this is BriefcaseConnection { return true; }\n\n /** The Guid that identifies the iTwin that owns this iModel. */\n public override get iTwinId(): GuidString { return super.iTwinId ?? Guid.empty; } // GuidString | undefined for IModelConnection, but required for BriefcaseConnection\n\n /** The Guid that identifies this iModel. */\n public override get iModelId(): GuidString { return super.iModelId ?? Guid.empty; } // GuidString | undefined for IModelConnection, but required for BriefcaseConnection\n\n protected constructor(props: BriefcaseConnectionProps, openMode: OpenMode) {\n super(props);\n this._openMode = openMode;\n this.briefcaseId = props.briefcaseId;\n this.txns = new BriefcaseTxns(this);\n this._modelsMonitor = new ModelChangeMonitor(this);\n if (OpenMode.ReadWrite === this._openMode)\n this.txns.onAfterUndoRedo.addListener(async () => { await IModelApp.toolAdmin.restartPrimitiveTool(); });\n\n this.categories.cache.attachToBriefcase(this);\n }\n\n /** Open a BriefcaseConnection to a [BriefcaseDb]($backend). */\n public static async openFile(briefcaseProps: OpenBriefcaseProps): Promise<BriefcaseConnection>;\n\n /** Open a BriefcaseConnection to a [BriefcaseDb]($backend).\n * @alpha\n */\n public static async openFile(briefcaseProps: OpenBriefcaseProps, lockServiceFactory?: LockServiceFactory): Promise<BriefcaseConnection>\n\n public static async openFile(briefcaseProps: OpenBriefcaseProps, lockServiceFactory?: LockServiceFactory): Promise<BriefcaseConnection> {\n const iModelProps = await IpcApp.appFunctionIpc.openBriefcase(briefcaseProps);\n const connection = new this({ ...briefcaseProps, ...iModelProps }, briefcaseProps.readonly ? OpenMode.Readonly : OpenMode.ReadWrite);\n if (lockServiceFactory)\n connection._locks = await lockServiceFactory(connection);\n\n IModelConnection.onOpen.raiseEvent(connection);\n return connection;\n }\n\n /** Open a BriefcaseConnection to a [StandaloneDb]($backend)\n * @note StandaloneDbs, by definition, may not push or pull changes. Attempting to do so will throw exceptions.\n */\n public static async openStandalone(filePath: string, openMode: OpenMode = OpenMode.ReadWrite, opts?: StandaloneOpenOptions): Promise<BriefcaseConnection> {\n const openResponse = await IpcApp.appFunctionIpc.openStandalone(filePath, openMode, opts);\n const connection = new this(openResponse, openMode);\n IModelConnection.onOpen.raiseEvent(connection);\n return connection;\n }\n\n /** Returns `true` if [[close]] has already been called. */\n public get isClosed(): boolean { return this._isClosed === true; }\n\n /**\n * Close this BriefcaseConnection.\n * @note make sure to call [[saveChanges]] before calling this method. Unsaved local changes are abandoned.\n */\n public async close(): Promise<void> {\n if (this.isClosed)\n return;\n\n await this._modelsMonitor.close();\n\n this.beforeClose();\n this.txns[Symbol.dispose]();\n\n this._isClosed = true;\n await IpcApp.appFunctionIpc.closeIModel(this._fileKey);\n }\n\n protected requireTimeline() {\n if (this.iTwinId === Guid.empty)\n throw new IModelError(IModelStatus.WrongIModel, \"iModel has no timeline\");\n }\n\n /** Query if there are any pending Txns in this briefcase that are waiting to be pushed. */\n public async hasPendingTxns(): Promise<boolean> { // eslint-disable-line @itwin/prefer-get\n return this.txns.hasPendingTxns();\n }\n\n /** Commit pending changes to this briefcase.\n * @param description Optional description of the changes.\n * @deprecated Use methods on EditCommand instead.\n */\n public async saveChanges(description?: string): Promise<void> {\n await IpcApp.appFunctionIpc.saveChanges(this.key, description); // eslint-disable-line @typescript-eslint/no-deprecated\n }\n\n /** Abandon pending changes to this briefcase.\n * @deprecated Use methods on EditCommand instead.\n */\n public async abandonChanges(): Promise<void> {\n await IpcApp.appFunctionIpc.abandonChanges(this.key); // eslint-disable-line @typescript-eslint/no-deprecated\n }\n\n /** Pull (and potentially merge if there are local changes) up to a specified changeset from iModelHub into this briefcase\n * @param toIndex The changeset index to pull changes to. If `undefined`, pull all changes.\n * @param options Options for pulling changes.\n * @see [[BriefcaseTxns.onChangesPulled]] for the event dispatched after changes are pulled.\n */\n public async pullChanges(toIndex?: ChangesetIndex, options?: PullChangesOptions): Promise<void> {\n const removeListeners: VoidFunction[] = [];\n const shouldReportProgress = !!options?.downloadProgressCallback;\n\n if (shouldReportProgress) {\n const handleProgress = (_evt: Event, data: { loaded: number, total: number }) => {\n options?.downloadProgressCallback?.(data);\n };\n\n const removeProgressListener = IpcApp.addListener(\n getPullChangesIpcChannel(this.iModelId),\n handleProgress,\n );\n removeListeners.push(removeProgressListener);\n }\n\n if (options?.abortSignal) {\n const abort = () => void IpcApp.appFunctionIpc.cancelPullChangesRequest(this.key);\n options?.abortSignal.addEventListener(\"abort\", abort);\n removeListeners.push(() => options?.abortSignal?.removeEventListener(\"abort\", abort));\n }\n\n this.requireTimeline();\n const ipcAppOptions: IpcAppPullChangesOptions = {\n reportProgress: shouldReportProgress,\n progressInterval: options?.progressInterval,\n enableCancellation: !!options?.abortSignal,\n };\n try {\n this.changeset = await IpcApp.appFunctionIpc.pullChanges(this.key, toIndex, ipcAppOptions);\n } finally {\n removeListeners.forEach((remove) => remove());\n }\n }\n\n /** Create a changeset from local Txns and push to iModelHub. On success, clear Txn table.\n * @param description The description for the changeset\n * @returns the changesetId of the pushed changes\n * @see [[BriefcaseTxns.onChangesPushed]] for the event dispatched after changes are pushed.\n */\n public async pushChanges(description: string): Promise<ChangesetIndexAndId> {\n this.requireTimeline();\n return IpcApp.appFunctionIpc.pushChanges(this.key, description);\n }\n\n /** The current graphical editing scope, if one is in progress.\n * @see [[enterEditingScope]] to begin graphical editing.\n */\n public get editingScope(): GraphicalEditingScope | undefined {\n return this._modelsMonitor.editingScope;\n }\n\n /** Return whether graphical editing is supported for this briefcase. It is not supported if the briefcase is read-only, or the briefcase contains a version of\n * the BisCore ECSchema older than v0.1.11.\n * @see [[enterEditingScope]] to enable graphical editing.\n */\n public async supportsGraphicalEditing(): Promise<boolean> {\n return IpcApp.appFunctionIpc.isGraphicalEditingSupported(this.key);\n }\n\n /** Begin a new graphical editing scope.\n * @throws Error if an editing scope already exists or one could not be created.\n * @see [[GraphicalEditingScope.exit]] to exit the scope.\n * @see [[supportsGraphicalEditing]] to determine whether this method should be expected to succeed.\n * @see [[editingScope]] to obtain the current editing scope, if one is in progress.\n */\n public async enterEditingScope(): Promise<GraphicalEditingScope> {\n return this._modelsMonitor.enterEditingScope();\n }\n\n /** Strictly for tests - dispatched from ModelChangeMonitor.processBuffered.\n * @internal\n */\n public readonly onBufferedModelChanges = new BeEvent<(changedModelIds: Set<string>) => void>();\n}\n"]}
1
+ {"version":3,"file":"BriefcaseConnection.js","sourceRoot":"","sources":["../../src/BriefcaseConnection.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAmC,YAAY,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACxI,OAAO,EAC0D,wBAAwB,EAAE,WAAW,GAErG,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,kCAAkC,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AA8CtC;;;GAGG;AACH,MAAM,kBAAkB;IACd,aAAa,CAAyB;IAC7B,UAAU,CAAsB;IAChC,cAAc,GAAG,IAAI,GAAG,EAAU,CAAC;IACnC,cAAc,GAAG,IAAI,GAAG,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;QAC1C,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,OAAO,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;IAClE,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,wBAAwB;QACnC,OAAO,MAAM,CAAC,cAAc,CAAC,2BAA2B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrE,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,iBAAiB;QAC5B,OAAO,IAAI,CAAC,cAAc,CAAC,iBAAiB,EAAE,CAAC;IACjD,CAAC;IAED;;OAEG;IACa,sBAAsB,GAAG,IAAI,OAAO,EAA0C,CAAC;CAChG","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module IModelConnection\n */\n\nimport { assert, BeEvent, CompressedId64Set, Guid, GuidString, Id64Set, Id64String, IModelStatus, OpenMode } from \"@itwin/core-bentley\";\nimport {\n BriefcaseConnectionProps, ChangesetIndex, ChangesetIndexAndId, getPullChangesIpcChannel, IModelError,\n PullChangesOptions as IpcAppPullChangesOptions, LockState, OpenBriefcaseProps, StandaloneOpenOptions,\n} from \"@itwin/core-common\";\nimport { BriefcaseTxns } from \"./BriefcaseTxns\";\nimport { GraphicalEditingScope } from \"./GraphicalEditingScope\";\nimport { IModelApp } from \"./IModelApp\";\nimport { IModelConnection } from \"./IModelConnection\";\nimport { IpcApp } from \"./IpcApp\";\nimport { disposeTileTreesForGeometricModels } from \"./tile/internal\";\nimport { Viewport } from \"./Viewport\";\n\n/**\n * Download progress information.\n * @public\n */\nexport interface DownloadProgressInfo {\n /** Bytes downloaded. */\n loaded: number;\n /** Total size of the download in bytes. */\n total: number;\n}\n\n/**\n * Called to show progress during a download.\n * @public\n */\nexport type OnDownloadProgress = (progress: DownloadProgressInfo) => void;\n\n/**\n * Partial interface of AbortSignal.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal\n * @beta\n */\nexport interface GenericAbortSignal {\n /** Add Listener for abort signal. */\n addEventListener: (type: \"abort\", listener: (this: GenericAbortSignal, ev: any) => any) => void;\n /** Remove Listener for abort signal. */\n removeEventListener: (type: \"abort\", listener: (this: GenericAbortSignal, ev: any) => any) => void;\n}\n\n/**\n * Options for pulling iModel changes.\n * @public\n */\nexport interface PullChangesOptions {\n /** Function called regularly to report progress of changes download. */\n downloadProgressCallback?: OnDownloadProgress;\n /** Interval for calling progress callback (in milliseconds). */\n progressInterval?: number;\n /** Signal for cancelling the download.\n * @beta\n */\n abortSignal?: GenericAbortSignal;\n}\n\n/** Keeps track of changes to models, buffering them until synchronization points.\n * While a GraphicalEditingScope is open, the changes are buffered until the scope exits, at which point they are processed.\n * Otherwise, the buffered changes are processed after undo/redo, commit, or pull+merge changes.\n */\nclass ModelChangeMonitor {\n private _editingScope?: GraphicalEditingScope;\n private readonly _briefcase: BriefcaseConnection;\n private readonly _deletedModels = new Set<string>();\n private readonly _modelIdToGuid = new Map<string, string>();\n private readonly _removals: VoidFunction[] = [];\n\n public constructor(briefcase: BriefcaseConnection) {\n this._briefcase = briefcase;\n\n // Buffer updated geometry guids.\n this._removals.push(briefcase.txns.onModelGeometryChanged.addListener((changes) => {\n for (const change of changes) {\n this._deletedModels.delete(change.id);\n this._modelIdToGuid.set(change.id, change.guid);\n }\n }));\n\n // Buffer deletions of models.\n this._removals.push(briefcase.txns.onModelsChanged.addListener((changes) => {\n if (changes.deleted) {\n for (const id of CompressedId64Set.iterable(changes.deleted)) {\n this._modelIdToGuid.delete(id);\n this._deletedModels.add(id);\n }\n }\n }));\n\n // Outside of an editing scope, we want to update viewport contents after commit, undo/redo, or merging changes.\n const maybeProcess = async () => {\n if (this.editingScope)\n return;\n\n const modelIds = Array.from(this._modelIdToGuid.keys());\n if (modelIds.length > 0)\n await IModelApp.tileAdmin.purgeTileTrees(this._briefcase, modelIds);\n\n this.processBuffered();\n };\n\n this._removals.push(briefcase.txns.onCommitted.addListener(maybeProcess));\n this._removals.push(briefcase.txns.onReplayedExternalTxns.addListener(maybeProcess));\n this._removals.push(briefcase.txns.onAfterUndoRedo.addListener(maybeProcess));\n this._removals.push(briefcase.txns.onChangesPulled.addListener(maybeProcess));\n }\n\n public async close(): Promise<void> {\n for (const removal of this._removals)\n removal();\n\n this._removals.length = 0;\n\n if (this._editingScope) {\n await this._editingScope.exit();\n this._editingScope = undefined;\n }\n }\n\n public get editingScope(): GraphicalEditingScope | undefined {\n return this._editingScope;\n }\n\n public async enterEditingScope(): Promise<GraphicalEditingScope> {\n if (this._editingScope)\n throw new Error(\"Cannot create an editing scope for an iModel that already has one\");\n\n this._editingScope = await GraphicalEditingScope.enter(this._briefcase);\n\n const removeGeomListener = this._editingScope.onGeometryChanges.addListener((changes) => {\n const modelIds = [];\n for (const change of changes)\n modelIds.push(change.id);\n\n this.invalidateScenes(modelIds);\n });\n\n this._editingScope.onExited.addOnce((scope) => {\n assert(scope === this._editingScope);\n this._editingScope = undefined;\n removeGeomListener();\n this.processBuffered();\n });\n\n return this._editingScope;\n }\n\n private processBuffered(): void {\n const models = this._briefcase.models;\n for (const [id, guid] of this._modelIdToGuid) {\n const model = models.getLoaded(id)?.asGeometricModel;\n if (model)\n model.geometryGuid = guid;\n }\n\n const modelIds = new Set<string>(this._modelIdToGuid.keys());\n for (const deleted of this._deletedModels) {\n modelIds.add(deleted);\n models.unload(deleted);\n }\n\n this.invalidateScenes(modelIds);\n disposeTileTreesForGeometricModels(modelIds, this._briefcase);\n\n this._briefcase.onBufferedModelChanges.raiseEvent(modelIds);\n\n this._modelIdToGuid.clear();\n this._deletedModels.clear();\n }\n\n private invalidateScenes(changedModels: Iterable<Id64String>): void {\n for (const user of IModelApp.tileAdmin.tileUsers) {\n if (user instanceof Viewport && user.iModel === this._briefcase) {\n for (const modelId of changedModels) {\n if (user.view.viewsModel(modelId)) {\n user.invalidateScene();\n user.setFeatureOverrideProviderChanged();\n break;\n }\n }\n }\n }\n }\n}\n\n/**\n * Provides access to lock information in the iModel.\n * @see [[BriefcaseConnection.locks]]\n * @alpha\n */\nexport interface LockService {\n /** Get all elements with exclusive locks owned by other briefcases. */\n getExclusiveForeignLocks(): Promise<Id64Set>;\n /** Get all elements with shared locks owned by other briefcases. */\n getSharedForeignLocks(): Promise<Id64Set>;\n /** Check whether it's possible to acquire a lock for the element. */\n checkElementLockAvailability(elementId: Id64String, lock: LockState): Promise<boolean>;\n}\n\n/** Function for creating a [[LockService]] for a [[BriefcaseConnection]].\n * @alpha\n */\nexport type LockServiceFactory = (iModel: BriefcaseConnection) => Promise<LockService>;\n\n/** Settings that can be used to control the behavior of [[Tool]]s that modify a [[BriefcaseConnection]].\n * For example, tools that want to create new elements can consult the briefcase's editor tool settings to\n * determine into which model and category to insert the elements.\n * Specialized tools are free to ignore these settings.\n * @see [[BriefcaseConnection.editorToolSettings]] to query or modify the current settings for a briefcase.\n * @see [CreateElementTool]($editor-frontend) for an example of a tool that uses these settings.\n * @beta\n */\nexport class BriefcaseEditorToolSettings {\n private _category?: Id64String;\n private _model?: Id64String;\n\n /** An event raised just after the default [[category]] is changed. */\n public readonly onCategoryChanged = new BeEvent<(previousCategory: Id64String | undefined) => void>();\n\n /** An event raised just after the default [[model]] is changed. */\n public readonly onModelChanged = new BeEvent<(previousModel: Id64String | undefined) => void>();\n\n /** The [Category]($backend) into which new elements should be inserted by default.\n * Specialized tools are free to ignore this setting and instead use their own logic to select an appropriate category.\n * @see [[onCategoryChanged]] to be notified when this property is modified.\n * @see [CreateElementTool.targetCategory]($editor-frontend) for an example of a tool that uses this setting.\n */\n public get category(): Id64String | undefined {\n return this._category;\n }\n public set category(category: Id64String | undefined) {\n const previousCategory = this.category;\n if (category !== this.category) {\n this._category = category;\n this.onCategoryChanged.raiseEvent(previousCategory);\n }\n }\n\n /** The [Model]($backend) into which new elements should be inserted by default.\n * Specialized tools are free to ignore this setting and instead use their own logic to select an appropriate model.\n * @see [[onModelChanged]] to be notified when this property is modified.\n * @see [CreateElementTool.targetModelId]($editor-frontend) for an example of a tool that uses this setting.\n */\n public get model(): Id64String | undefined {\n return this._model;\n }\n public set model(model: Id64String | undefined) {\n const previousModel = this.model;\n if (model !== this.model) {\n this._model = model;\n this.onModelChanged.raiseEvent(previousModel);\n }\n }\n}\n\n/** A connection to an editable briefcase on the backend. This class uses [Ipc]($docs/learning/IpcInterface.md) to communicate\n * to the backend and may only be used by [[IpcApp]]s.\n * @public\n */\nexport class BriefcaseConnection extends IModelConnection {\n protected _isClosed?: boolean;\n private readonly _modelsMonitor: ModelChangeMonitor;\n private _locks?: LockService;\n\n /** The ID of the briefcase.\n * @beta\n */\n public readonly briefcaseId?: number;\n\n /** Default settings that can be used to control the behavior of [[Tool]]s that modify this briefcase.\n * @beta\n */\n public readonly editorToolSettings = new BriefcaseEditorToolSettings();\n\n /** Manages local changes to the briefcase via [Txns]($docs/learning/InteractiveEditing.md). */\n public readonly txns: BriefcaseTxns;\n\n /** Information about locks held on this iModel.\n * @note This is intended to be used by tools and other UI elements, to provide information about the current lock state. Implementations are expected to cache lock information and so may not reflect changes to locks immediately.\n * @alpha\n */\n public get locks(): LockService | undefined { return this._locks; }\n\n public override isBriefcaseConnection(): this is BriefcaseConnection { return true; }\n\n /** The Guid that identifies the iTwin that owns this iModel. */\n public override get iTwinId(): GuidString { return super.iTwinId ?? Guid.empty; } // GuidString | undefined for IModelConnection, but required for BriefcaseConnection\n\n /** The Guid that identifies this iModel. */\n public override get iModelId(): GuidString { return super.iModelId ?? Guid.empty; } // GuidString | undefined for IModelConnection, but required for BriefcaseConnection\n\n protected constructor(props: BriefcaseConnectionProps, openMode: OpenMode) {\n super(props);\n this._openMode = openMode;\n this.briefcaseId = props.briefcaseId;\n this.txns = new BriefcaseTxns(this);\n this._modelsMonitor = new ModelChangeMonitor(this);\n if (OpenMode.ReadWrite === this._openMode)\n this.txns.onAfterUndoRedo.addListener(async () => { await IModelApp.toolAdmin.restartPrimitiveTool(); });\n\n this.categories.cache.attachToBriefcase(this);\n }\n\n /** Open a BriefcaseConnection to a [BriefcaseDb]($backend). */\n public static async openFile(briefcaseProps: OpenBriefcaseProps): Promise<BriefcaseConnection>;\n\n /** Open a BriefcaseConnection to a [BriefcaseDb]($backend).\n * @alpha\n */\n public static async openFile(briefcaseProps: OpenBriefcaseProps, lockServiceFactory?: LockServiceFactory): Promise<BriefcaseConnection>\n\n public static async openFile(briefcaseProps: OpenBriefcaseProps, lockServiceFactory?: LockServiceFactory): Promise<BriefcaseConnection> {\n const iModelProps = await IpcApp.appFunctionIpc.openBriefcase(briefcaseProps);\n const connection = new this({ ...briefcaseProps, ...iModelProps }, briefcaseProps.readonly ? OpenMode.Readonly : OpenMode.ReadWrite);\n if (lockServiceFactory)\n connection._locks = await lockServiceFactory(connection);\n\n IModelConnection.onOpen.raiseEvent(connection);\n return connection;\n }\n\n /** Open a BriefcaseConnection to a [StandaloneDb]($backend)\n * @note StandaloneDbs, by definition, may not push or pull changes. Attempting to do so will throw exceptions.\n */\n public static async openStandalone(filePath: string, openMode: OpenMode = OpenMode.ReadWrite, opts?: StandaloneOpenOptions): Promise<BriefcaseConnection> {\n const openResponse = await IpcApp.appFunctionIpc.openStandalone(filePath, openMode, opts);\n const connection = new this(openResponse, openMode);\n IModelConnection.onOpen.raiseEvent(connection);\n return connection;\n }\n\n /** Returns `true` if [[close]] has already been called. */\n public get isClosed(): boolean { return this._isClosed === true; }\n\n /**\n * Close this BriefcaseConnection.\n * @note make sure to call [[saveChanges]] before calling this method. Unsaved local changes are abandoned.\n */\n public async close(): Promise<void> {\n if (this.isClosed)\n return;\n\n await this._modelsMonitor.close();\n\n this.beforeClose();\n this.txns[Symbol.dispose]();\n\n this._isClosed = true;\n await IpcApp.appFunctionIpc.closeIModel(this._fileKey);\n }\n\n protected requireTimeline() {\n if (this.iTwinId === Guid.empty)\n throw new IModelError(IModelStatus.WrongIModel, \"iModel has no timeline\");\n }\n\n /** Query if there are any pending Txns in this briefcase that are waiting to be pushed. */\n public async hasPendingTxns(): Promise<boolean> { // eslint-disable-line @itwin/prefer-get\n return this.txns.hasPendingTxns();\n }\n\n /** Commit pending changes to this briefcase.\n * @param description Optional description of the changes.\n * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use methods on EditCommand instead.\n */\n public async saveChanges(description?: string): Promise<void> {\n await IpcApp.appFunctionIpc.saveChanges(this.key, description); // eslint-disable-line @typescript-eslint/no-deprecated\n }\n\n /** Abandon pending changes to this briefcase.\n * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use methods on EditCommand instead.\n */\n public async abandonChanges(): Promise<void> {\n await IpcApp.appFunctionIpc.abandonChanges(this.key); // eslint-disable-line @typescript-eslint/no-deprecated\n }\n\n /** Pull (and potentially merge if there are local changes) up to a specified changeset from iModelHub into this briefcase\n * @param toIndex The changeset index to pull changes to. If `undefined`, pull all changes.\n * @param options Options for pulling changes.\n * @see [[BriefcaseTxns.onChangesPulled]] for the event dispatched after changes are pulled.\n */\n public async pullChanges(toIndex?: ChangesetIndex, options?: PullChangesOptions): Promise<void> {\n const removeListeners: VoidFunction[] = [];\n const shouldReportProgress = !!options?.downloadProgressCallback;\n\n if (shouldReportProgress) {\n const handleProgress = (_evt: Event, data: { loaded: number, total: number }) => {\n options?.downloadProgressCallback?.(data);\n };\n\n const removeProgressListener = IpcApp.addListener(\n getPullChangesIpcChannel(this.iModelId),\n handleProgress,\n );\n removeListeners.push(removeProgressListener);\n }\n\n if (options?.abortSignal) {\n const abort = () => void IpcApp.appFunctionIpc.cancelPullChangesRequest(this.key);\n options?.abortSignal.addEventListener(\"abort\", abort);\n removeListeners.push(() => options?.abortSignal?.removeEventListener(\"abort\", abort));\n }\n\n this.requireTimeline();\n const ipcAppOptions: IpcAppPullChangesOptions = {\n reportProgress: shouldReportProgress,\n progressInterval: options?.progressInterval,\n enableCancellation: !!options?.abortSignal,\n };\n try {\n this.changeset = await IpcApp.appFunctionIpc.pullChanges(this.key, toIndex, ipcAppOptions);\n } finally {\n removeListeners.forEach((remove) => remove());\n }\n }\n\n /** Create a changeset from local Txns and push to iModelHub. On success, clear Txn table.\n * @param description The description for the changeset\n * @returns the changesetId of the pushed changes\n * @see [[BriefcaseTxns.onChangesPushed]] for the event dispatched after changes are pushed.\n */\n public async pushChanges(description: string): Promise<ChangesetIndexAndId> {\n this.requireTimeline();\n return IpcApp.appFunctionIpc.pushChanges(this.key, description);\n }\n\n /** The current graphical editing scope, if one is in progress.\n * @see [[enterEditingScope]] to begin graphical editing.\n */\n public get editingScope(): GraphicalEditingScope | undefined {\n return this._modelsMonitor.editingScope;\n }\n\n /** Return whether graphical editing is supported for this briefcase. It is not supported if the briefcase is read-only, or the briefcase contains a version of\n * the BisCore ECSchema older than v0.1.11.\n * @see [[enterEditingScope]] to enable graphical editing.\n */\n public async supportsGraphicalEditing(): Promise<boolean> {\n return IpcApp.appFunctionIpc.isGraphicalEditingSupported(this.key);\n }\n\n /** Begin a new graphical editing scope.\n * @throws Error if an editing scope already exists or one could not be created.\n * @see [[GraphicalEditingScope.exit]] to exit the scope.\n * @see [[supportsGraphicalEditing]] to determine whether this method should be expected to succeed.\n * @see [[editingScope]] to obtain the current editing scope, if one is in progress.\n */\n public async enterEditingScope(): Promise<GraphicalEditingScope> {\n return this._modelsMonitor.enterEditingScope();\n }\n\n /** Strictly for tests - dispatched from ModelChangeMonitor.processBuffered.\n * @internal\n */\n public readonly onBufferedModelChanges = new BeEvent<(changedModelIds: Set<string>) => void>();\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"PerModelCategoryVisibility.d.ts","sourceRoot":"","sources":["../../src/PerModelCategoryVisibility.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAkB,IAAI,EAAE,OAAO,EAAE,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F,WAAW,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;QAC/E;;WAEG;QACH,YAAY,CAAC,0BAA0B,EAAE,KAAK,EAAE,EAAE,MAAM,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAC5F,oGAAoG;QACpG,cAAc,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;QACzC,wDAAwD;QACxD,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,QAAQ,CAAC,aAAa,CAAC,CAAC;QACjD,mFAAmF;QACnF,YAAY,CAAC,EAAE,EAAE,gBAAgB,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;KAC1F;IAED;;;MAGE;IACF,UAAiB,KAAK;QACpB,wDAAwD;QACxD,OAAO,EAAE,MAAM,CAAC;QAChB,uGAAuG;QACvG,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;QAClC,gEAAgE;QAChE,WAAW,EAAE,0BAA0B,CAAC,QAAQ,CAAC;KAClD;IAED,SAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,0BAA0B,CAAC,SAAS,CAExF;CACF"}
@@ -5,7 +5,7 @@
5
5
  /** @packageDocumentation
6
6
  * @module Views
7
7
  */
8
- import { compareStrings, Id64, SortedArray } from "@itwin/core-bentley";
8
+ import { Id64 } from "@itwin/core-bentley";
9
9
  /** Per-model category visibility permits the visibility of categories within a [[Viewport]] displaying a [[SpatialViewState]] to be overridden in
10
10
  * the context of individual [[GeometricModelState]]s.
11
11
  * If a category's visibility is overridden for a given model, then elements belonging to that category within that model will be displayed or hidden regardless of the category's inclusion in the Viewport's [[CategorySelectorState]].
@@ -32,41 +32,77 @@ export var PerModelCategoryVisibility;
32
32
  }
33
33
  PerModelCategoryVisibility.createOverrides = createOverrides;
34
34
  })(PerModelCategoryVisibility || (PerModelCategoryVisibility = {}));
35
- class PerModelCategoryVisibilityOverride {
36
- modelId;
37
- categoryId;
38
- visible;
39
- constructor(modelId, categoryId, visible) {
40
- this.modelId = modelId;
41
- this.categoryId = categoryId;
42
- this.visible = visible;
43
- }
44
- reset(modelId, categoryId, visible) {
45
- this.modelId = modelId;
46
- this.categoryId = categoryId;
47
- this.visible = visible;
48
- }
49
- }
50
- function compareCategoryOverrides(lhs, rhs) {
51
- const cmp = compareStrings(lhs.modelId, rhs.modelId);
52
- return 0 === cmp ? compareStrings(lhs.categoryId, rhs.categoryId) : cmp;
53
- }
54
35
  /** The Viewport-specific implementation of PerModelCategoryVisibility.Overrides. */
55
- class PerModelCategoryVisibilityOverrides extends SortedArray {
56
- _scratch = new PerModelCategoryVisibilityOverride("0", "0", false);
36
+ class PerModelCategoryVisibilityOverrides {
37
+ _map = new Map();
38
+ /** Flat set of all override entries, providing O(1) iteration via [Symbol.iterator]. Kept in sync with `_map`. */
39
+ _set = new Set();
57
40
  _vp;
58
41
  constructor(vp) {
59
- super(compareCategoryOverrides);
60
42
  this._vp = vp;
61
43
  }
44
+ [Symbol.iterator]() {
45
+ return this._set[Symbol.iterator]();
46
+ }
62
47
  getOverride(modelId, categoryId) {
63
- this._scratch.reset(modelId, categoryId, false);
64
- const ovr = this.findEqual(this._scratch);
48
+ const ovr = this._map.get(modelId)?.get(categoryId);
65
49
  if (undefined !== ovr)
66
50
  return ovr.visible ? PerModelCategoryVisibility.Override.Show : PerModelCategoryVisibility.Override.Hide;
67
51
  else
68
52
  return PerModelCategoryVisibility.Override.None;
69
53
  }
54
+ getModelEntry({ modelId, override }) {
55
+ let modelEntry = this._map.get(modelId);
56
+ if (modelEntry) {
57
+ return modelEntry;
58
+ }
59
+ if (override === PerModelCategoryVisibility.Override.None) {
60
+ return undefined;
61
+ }
62
+ modelEntry = new Map();
63
+ this._map.set(modelId, modelEntry);
64
+ return modelEntry;
65
+ }
66
+ addOrRemoveOverrideEntry({ modelEntry, categoryId, modelId, override }) {
67
+ const overrideEntry = modelEntry.get(categoryId);
68
+ if (override === PerModelCategoryVisibility.Override.None) {
69
+ if (overrideEntry === undefined) {
70
+ return false;
71
+ }
72
+ this._set.delete(overrideEntry);
73
+ modelEntry.delete(categoryId);
74
+ return true;
75
+ }
76
+ const visible = override === PerModelCategoryVisibility.Override.Show;
77
+ if (overrideEntry === undefined) {
78
+ const ovr = { modelId, categoryId, visible };
79
+ modelEntry.set(categoryId, ovr);
80
+ this._set.add(ovr);
81
+ return true;
82
+ }
83
+ if (overrideEntry.visible !== visible) {
84
+ overrideEntry.visible = visible;
85
+ return true;
86
+ }
87
+ return false;
88
+ }
89
+ applyOverride(modelId, categoryIds, override, catIdsToLoad) {
90
+ const modelEntry = this.getModelEntry({ modelId, override });
91
+ let changed = false;
92
+ if (!modelEntry)
93
+ return changed;
94
+ for (const categoryId of categoryIds) {
95
+ if (this.addOrRemoveOverrideEntry({ modelEntry, categoryId, modelId, override })) {
96
+ changed = true;
97
+ if (catIdsToLoad && override !== PerModelCategoryVisibility.Override.None)
98
+ catIdsToLoad.push(categoryId);
99
+ }
100
+ }
101
+ if (modelEntry.size === 0) {
102
+ this._map.delete(modelId);
103
+ }
104
+ return changed;
105
+ }
70
106
  /**
71
107
  * set the overrides for multiple perModelCategoryVisibility props, loading categoryIds from the iModel if necessary.
72
108
  * @see [[PerModelCategoryVisibility]]
@@ -81,19 +117,11 @@ class PerModelCategoryVisibilityOverrides extends SortedArray {
81
117
  const catIdsToLoad = [];
82
118
  const iModelToUse = iModel ? iModel : this._vp.iModel;
83
119
  for (const override of perModelCategoryVisibility) {
84
- const modelId = override.modelId;
85
120
  // The caller may pass a single categoryId as a string, if we don't convert this to an array we will iterate
86
121
  // over each individual character of that string, which is not the desired behavior.
87
122
  const categoryIds = typeof override.categoryIds === "string" ? [override.categoryIds] : override.categoryIds;
88
- const visOverride = override.visOverride;
89
- for (const categoryId of categoryIds) {
90
- if (this.findAndUpdateOverrideInArray(modelId, categoryId, visOverride)) {
91
- anyChanged = true;
92
- if (PerModelCategoryVisibility.Override.None !== visOverride) {
93
- catIdsToLoad.push(categoryId);
94
- }
95
- }
96
- }
123
+ if (this.applyOverride(override.modelId, categoryIds, override.visOverride, catIdsToLoad))
124
+ anyChanged = true;
97
125
  }
98
126
  if (anyChanged) {
99
127
  this._vp.setViewedCategoriesPerModelChanged();
@@ -101,44 +129,17 @@ class PerModelCategoryVisibilityOverrides extends SortedArray {
101
129
  this._vp.subcategories.push(iModelToUse.subcategories, catIdsToLoad, () => this._vp.setViewedCategoriesPerModelChanged());
102
130
  }
103
131
  }
104
- return;
105
- }
106
- /** Find and update the override in the array of overrides. If override not found, adds it to the array.
107
- * If the array was changed, returns true. */
108
- findAndUpdateOverrideInArray(modelId, categoryId, override) {
109
- const ovr = this._scratch;
110
- ovr.reset(modelId, categoryId, false);
111
- let changed = false;
112
- const index = this.indexOf(ovr);
113
- if (-1 === index) {
114
- if (PerModelCategoryVisibility.Override.None !== override) {
115
- this.insert(new PerModelCategoryVisibilityOverride(modelId, categoryId, PerModelCategoryVisibility.Override.Show === override));
116
- changed = true;
117
- }
118
- }
119
- else {
120
- if (PerModelCategoryVisibility.Override.None === override) {
121
- this._array.splice(index, 1);
122
- changed = true;
123
- }
124
- else if (this._array[index].visible !== (PerModelCategoryVisibility.Override.Show === override)) {
125
- this._array[index].visible = (PerModelCategoryVisibility.Override.Show === override);
126
- changed = true;
127
- }
128
- }
129
- return changed;
130
132
  }
131
133
  setOverride(modelIds, categoryIds, override) {
134
+ const categoryIdIterable = Id64.iterable(categoryIds);
132
135
  let changed = false;
133
136
  for (const modelId of Id64.iterable(modelIds)) {
134
- for (const categoryId of Id64.iterable(categoryIds)) {
135
- if (this.findAndUpdateOverrideInArray(modelId, categoryId, override))
136
- changed = true;
137
- }
137
+ if (this.applyOverride(modelId, categoryIdIterable, override))
138
+ changed = true;
138
139
  }
139
140
  if (changed) {
140
141
  this._vp.setViewedCategoriesPerModelChanged();
141
- if (PerModelCategoryVisibility.Override.None !== override) {
142
+ if (override !== PerModelCategoryVisibility.Override.None) {
142
143
  // Ensure subcategories loaded.
143
144
  this._vp.subcategories.push(this._vp.iModel.subcategories, categoryIds, () => this._vp.setViewedCategoriesPerModelChanged());
144
145
  }
@@ -146,30 +147,32 @@ class PerModelCategoryVisibilityOverrides extends SortedArray {
146
147
  }
147
148
  clearOverrides(modelIds) {
148
149
  if (undefined === modelIds) {
149
- if (0 < this.length) {
150
- this.clear();
150
+ if (this._map.size > 0) {
151
+ this._map.clear();
152
+ this._set.clear();
151
153
  this._vp.setViewedCategoriesPerModelChanged();
152
154
  }
153
155
  return;
154
156
  }
155
- for (let i = 0; i < this.length;) {
156
- const ovr = this._array[i];
157
- let removed = false;
158
- for (const modelId of Id64.iterable(modelIds)) {
159
- if (modelId === ovr.modelId) {
160
- this._array.splice(i, 1);
161
- this._vp.setViewedCategoriesPerModelChanged();
162
- removed = true;
163
- break;
164
- }
157
+ let changed = false;
158
+ for (const modelId of Id64.iterable(modelIds)) {
159
+ const modelEntry = this._map.get(modelId);
160
+ if (!modelEntry) {
161
+ continue;
162
+ }
163
+ changed = true;
164
+ for (const overrideEntry of modelEntry.values()) {
165
+ this._set.delete(overrideEntry);
165
166
  }
166
- if (!removed)
167
- ++i;
167
+ this._map.delete(modelId);
168
+ }
169
+ if (changed) {
170
+ this._vp.setViewedCategoriesPerModelChanged();
168
171
  }
169
172
  }
170
173
  addOverrides(fs, ovrs) {
171
174
  const cache = this._vp.iModel.subcategories;
172
- for (const ovr of this._array) {
175
+ for (const ovr of this._set) {
173
176
  const subcats = cache.getSubCategories(ovr.categoryId);
174
177
  if (undefined === subcats)
175
178
  continue;
@@ -179,7 +182,6 @@ class PerModelCategoryVisibilityOverrides extends SortedArray {
179
182
  /* if (!this._vp.view.viewsModel(ovr.modelId))
180
183
  continue; */
181
184
  // ###TODO: Avoid recomputing upper and lower portions of modelId if modelId repeated.
182
- // (Array is sorted first by modelId).
183
185
  // Also avoid computing if no effective overrides.
184
186
  const modelLo = Id64.getLowerUint32(ovr.modelId);
185
187
  const modelHi = Id64.getUpperUint32(ovr.modelId);
@@ -1 +1 @@
1
- {"version":3,"file":"PerModelCategoryVisibility.js","sourceRoot":"","sources":["../../src/PerModelCategoryVisibility.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,IAAI,EAAuB,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAK7F;;;;;;;;GAQG;AACH,MAAM,KAAW,0BAA0B,CAyD1C;AAzDD,WAAiB,0BAA0B;IACzC,uEAAuE;IACvE,IAAY,QAOX;IAPD,WAAY,QAAQ;QAClB,wIAAwI;QACxI,uCAAI,CAAA;QACJ,gDAAgD;QAChD,uCAAI,CAAA;QACJ,kDAAkD;QAClD,uCAAI,CAAA;IACN,CAAC,EAPW,QAAQ,GAAR,mCAAQ,KAAR,mCAAQ,QAOnB;IA6CD,SAAgB,eAAe,CAAC,QAAkB;QAChD,OAAO,IAAI,mCAAmC,CAAC,QAAQ,CAAC,CAAC;IAC3D,CAAC;IAFe,0CAAe,kBAE9B,CAAA;AACH,CAAC,EAzDgB,0BAA0B,KAA1B,0BAA0B,QAyD1C;AAED,MAAM,kCAAkC;IAC/B,OAAO,CAAa;IACpB,UAAU,CAAa;IACvB,OAAO,CAAU;IAExB,YAAmB,OAAmB,EAAE,UAAsB,EAAE,OAAgB;QAC9E,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAEM,KAAK,CAAC,OAAmB,EAAE,UAAsB,EAAE,OAAgB;QACxE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG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OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;oBACpC,CAAC;oBAED,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;gBAChC,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Views\n */\n\nimport { compareStrings, Id64, Id64Arg, Id64String, SortedArray } from \"@itwin/core-bentley\";\nimport { IModelConnection } from \"./IModelConnection\";\nimport { FeatureSymbology } from \"./render/FeatureSymbology\";\nimport { Viewport } from \"./Viewport\";\n\n/** Per-model category visibility permits the visibility of categories within a [[Viewport]] displaying a [[SpatialViewState]] to be overridden in\n * the context of individual [[GeometricModelState]]s.\n * If a category's visibility is overridden for a given model, then elements belonging to that category within that model will be displayed or hidden regardless of the category's inclusion in the Viewport's [[CategorySelectorState]].\n * The override affects geometry on all subcategories belonging to the overridden category. That is, if the category is overridden to be visible, then geometry on all subcategories of the category\n * will be visible, regardless of any [SubCategoryOverride]($common)s applied by the view's [[DisplayStyleState]].\n * @see [[Viewport.perModelCategoryVisibility]] to define the per-model category visibility for a viewport.\n * @public\n * @extensions\n */\nexport namespace PerModelCategoryVisibility {\n /** Describes whether and how a category's visibility is overridden. */\n export enum Override {\n /** The category's visibility is not overridden; its visibility is wholly controlled by the [[Viewport]]'s [[CategorySelectorState]]. */\n None,\n /** The category is overridden to be visible. */\n Show,\n /** The category is overridden to be invisible. */\n Hide,\n }\n\n /** Describes one visibility override in a [[PerModelCategoryVisibility.Overrides]]. */\n export interface OverrideEntry {\n /** The Id of the [[GeometricModelState]] in which the override applies. */\n readonly modelId: Id64String;\n /** The Id of the [SpatialCategory]($backend) whose visibility is overridden. */\n readonly categoryId: Id64String;\n /** Whether the category is visible in the context of the model. */\n readonly visible: boolean;\n }\n\n /** Describes a set of per-model category visibility overrides. Changes to these overrides invoke the [[Viewport.onViewedCategoriesPerModelChanged]] event.\n * @see [[Viewport.perModelCategoryVisibility]].\n */\n export interface Overrides {\n /** Returns the override state of the specified category within the specified model. */\n getOverride(modelId: Id64String, categoryId: Id64String): Override;\n /** Changes the override state of one or more categories for one or more models. */\n setOverride(modelIds: Id64Arg, categoryIds: Id64Arg, override: Override): void;\n /** Changes multiple overrides, given an array of overrides *\n * @beta\n */\n setOverrides(perModelCategoryVisibility: Props[], iModel?: IModelConnection): Promise<void>;\n /** Removes all overrides for the specified models, or for all models if `modelIds` is undefined. */\n clearOverrides(modelIds?: Id64Arg): void;\n /** An iterator over all of the visibility overrides. */\n [Symbol.iterator]: () => Iterator<OverrideEntry>;\n /** Populate the symbology overrides based on the per-model category visibility. */\n addOverrides(fs: FeatureSymbology.Overrides, ovrs: Id64.Uint32Map<Id64.Uint32Set>): void;\n }\n\n /** Describes a set of [[PerModelCategoryVisibility.Overrides]].\n * @see [[PerModelCategoryVisibility.Overrides.setOverrides]].\n * @beta\n */\n export interface Props {\n /** The id of the model to which the overrides apply. */\n modelId: string;\n /** The ids of the categories whose visibility are to be overridden within the context of the model. */\n categoryIds: Iterable<Id64String>;\n /** The visibility to be applied to the specified categories. */\n visOverride: PerModelCategoryVisibility.Override;\n }\n\n export function createOverrides(viewport: Viewport): PerModelCategoryVisibility.Overrides {\n return new PerModelCategoryVisibilityOverrides(viewport);\n }\n}\n\nclass PerModelCategoryVisibilityOverride {\n public modelId: Id64String;\n public categoryId: Id64String;\n public visible: boolean;\n\n public constructor(modelId: Id64String, categoryId: Id64String, visible: boolean) {\n this.modelId = modelId;\n this.categoryId = categoryId;\n this.visible = visible;\n }\n\n public reset(modelId: Id64String, categoryId: Id64String, visible: boolean): void {\n this.modelId = modelId;\n this.categoryId = categoryId;\n this.visible = visible;\n }\n}\n\nfunction compareCategoryOverrides(lhs: PerModelCategoryVisibilityOverride, rhs: PerModelCategoryVisibilityOverride): number {\n const cmp = compareStrings(lhs.modelId, rhs.modelId);\n return 0 === cmp ? compareStrings(lhs.categoryId, rhs.categoryId) : cmp;\n}\n\n/** The Viewport-specific implementation of PerModelCategoryVisibility.Overrides. */\nclass PerModelCategoryVisibilityOverrides extends SortedArray<PerModelCategoryVisibilityOverride> implements PerModelCategoryVisibility.Overrides {\n private readonly _scratch = new PerModelCategoryVisibilityOverride(\"0\", \"0\", false);\n private readonly _vp: Viewport;\n\n public constructor(vp: Viewport) {\n super(compareCategoryOverrides);\n this._vp = vp;\n }\n\n public getOverride(modelId: Id64String, categoryId: Id64String): PerModelCategoryVisibility.Override {\n this._scratch.reset(modelId, categoryId, false);\n const ovr = this.findEqual(this._scratch);\n if (undefined !== ovr)\n return ovr.visible ? PerModelCategoryVisibility.Override.Show : PerModelCategoryVisibility.Override.Hide;\n else\n return PerModelCategoryVisibility.Override.None;\n }\n\n /**\n * set the overrides for multiple perModelCategoryVisibility props, loading categoryIds from the iModel if necessary.\n * @see [[PerModelCategoryVisibility]]\n * @param perModelCategoryVisibility array of model category visibility overrides @see [[PerModelCategoryVisibility.Props]]\n * @param iModel Optional param iModel. If no iModel is provided, then the iModel associated with the viewport (used to construct this class) is used.\n * This optional iModel param is useful for apps which may show multiple iModels at once. Passing in an iModel ensures that the subcategories cache for the provided iModel\n * is populated as opposed to the iModel associated with the viewport which may or may not be an empty iModel.\n * @returns a promise that resolves once the overrides have been applied.\n */\n public async setOverrides(perModelCategoryVisibility: PerModelCategoryVisibility.Props[], iModel?: IModelConnection): Promise<void> {\n let anyChanged = false;\n const catIdsToLoad: string[] = [];\n const iModelToUse = iModel ? iModel : this._vp.iModel;\n for (const override of perModelCategoryVisibility) {\n const modelId = override.modelId;\n // The caller may pass a single categoryId as a string, if we don't convert this to an array we will iterate\n // over each individual character of that string, which is not the desired behavior.\n const categoryIds = typeof override.categoryIds === \"string\" ? [override.categoryIds] : override.categoryIds;\n const visOverride = override.visOverride;\n for (const categoryId of categoryIds) {\n if (this.findAndUpdateOverrideInArray(modelId, categoryId, visOverride)) {\n anyChanged = true;\n if (PerModelCategoryVisibility.Override.None !== visOverride) {\n catIdsToLoad.push(categoryId);\n }\n }\n }\n }\n if (anyChanged) {\n this._vp.setViewedCategoriesPerModelChanged();\n if (catIdsToLoad.length !== 0) {\n this._vp.subcategories.push(iModelToUse.subcategories, catIdsToLoad, () => this._vp.setViewedCategoriesPerModelChanged());\n }\n }\n return;\n }\n\n /** Find and update the override in the array of overrides. If override not found, adds it to the array.\n * If the array was changed, returns true. */\n private findAndUpdateOverrideInArray(modelId: Id64String, categoryId: Id64String, override: PerModelCategoryVisibility.Override): boolean {\n const ovr = this._scratch;\n ovr.reset(modelId, categoryId, false);\n let changed = false;\n const index = this.indexOf(ovr);\n if (-1 === index) {\n if (PerModelCategoryVisibility.Override.None !== override) {\n this.insert(new PerModelCategoryVisibilityOverride(modelId, categoryId, PerModelCategoryVisibility.Override.Show === override));\n changed = true;\n }\n } else {\n if (PerModelCategoryVisibility.Override.None === override) {\n this._array.splice(index, 1);\n changed = true;\n } else if (this._array[index].visible !== (PerModelCategoryVisibility.Override.Show === override)) {\n this._array[index].visible = (PerModelCategoryVisibility.Override.Show === override);\n changed = true;\n }\n }\n return changed;\n }\n\n public setOverride(modelIds: Id64Arg, categoryIds: Id64Arg, override: PerModelCategoryVisibility.Override): void {\n let changed = false;\n for (const modelId of Id64.iterable(modelIds)) {\n for (const categoryId of Id64.iterable(categoryIds)) {\n if (this.findAndUpdateOverrideInArray(modelId, categoryId, override))\n changed = true;\n }\n }\n\n if (changed) {\n this._vp.setViewedCategoriesPerModelChanged();\n\n if (PerModelCategoryVisibility.Override.None !== override) {\n // Ensure subcategories loaded.\n this._vp.subcategories.push(this._vp.iModel.subcategories, categoryIds, () => this._vp.setViewedCategoriesPerModelChanged());\n }\n }\n }\n\n public clearOverrides(modelIds?: Id64Arg): void {\n if (undefined === modelIds) {\n if (0 < this.length) {\n this.clear();\n this._vp.setViewedCategoriesPerModelChanged();\n }\n\n return;\n }\n\n for (let i = 0; i < this.length;) {\n const ovr = this._array[i];\n let removed = false;\n for (const modelId of Id64.iterable(modelIds)) {\n if (modelId === ovr.modelId) {\n this._array.splice(i, 1);\n this._vp.setViewedCategoriesPerModelChanged();\n removed = true;\n break;\n }\n }\n\n if (!removed)\n ++i;\n }\n }\n\n public addOverrides(fs: FeatureSymbology.Overrides, ovrs: Id64.Uint32Map<Id64.Uint32Set>): void {\n const cache = this._vp.iModel.subcategories;\n\n for (const ovr of this._array) {\n const subcats = cache.getSubCategories(ovr.categoryId);\n if (undefined === subcats)\n continue;\n\n // It's pointless to override for models which aren't displayed...except if we do this, and then someone enables that model,\n // we would need to regenerate our symbology overrides in response. Preferably people wouldn't bother overriding models that\n // they don't want us to draw...\n /* if (!this._vp.view.viewsModel(ovr.modelId))\n continue; */\n\n // ###TODO: Avoid recomputing upper and lower portions of modelId if modelId repeated.\n // (Array is sorted first by modelId).\n // Also avoid computing if no effective overrides.\n const modelLo = Id64.getLowerUint32(ovr.modelId);\n const modelHi = Id64.getUpperUint32(ovr.modelId);\n\n for (const subcat of subcats) {\n const subcatLo = Id64.getLowerUint32(subcat);\n const subcatHi = Id64.getUpperUint32(subcat);\n const vis = fs.isSubCategoryVisible(subcatLo, subcatHi);\n if (vis !== ovr.visible) {\n // Only care if visibility differs from that defined for entire view\n let entry = ovrs.get(modelLo, modelHi);\n if (undefined === entry) {\n entry = new Id64.Uint32Set();\n ovrs.set(modelLo, modelHi, entry);\n }\n\n entry.add(subcatLo, subcatHi);\n }\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"PerModelCategoryVisibility.js","sourceRoot":"","sources":["../../src/PerModelCategoryVisibility.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAuB,MAAM,qBAAqB,CAAC;AAKhE;;;;;;;;GAQG;AACH,MAAM,KAAW,0BAA0B,CAyD1C;AAzDD,WAAiB,0BAA0B;IACzC,uE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AI,SAAS,KAAK,OAAO;gBACvB,SAAS;YAEX,4HAA4H;YAC5H,4HAA4H;YAC5H,gCAAgC;YAChC;0BACc;YAEd,sFAAsF;YACtF,kDAAkD;YAClD,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACjD,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAEjD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;gBAC7B,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;gBAC7C,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;gBAC7C,MAAM,GAAG,GAAG,EAAE,CAAC,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;gBACxD,IAAI,GAAG,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC;oBACxB,oEAAoE;oBACpE,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;oBACvC,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;wBACxB,KAAK,GAAG,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;wBAC7B,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;oBACpC,CAAC;oBAED,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;gBAChC,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Views\n */\n\nimport { Id64, Id64Arg, Id64String } from \"@itwin/core-bentley\";\nimport { IModelConnection } from \"./IModelConnection\";\nimport { FeatureSymbology } from \"./render/FeatureSymbology\";\nimport { Viewport } from \"./Viewport\";\n\n/** Per-model category visibility permits the visibility of categories within a [[Viewport]] displaying a [[SpatialViewState]] to be overridden in\n * the context of individual [[GeometricModelState]]s.\n * If a category's visibility is overridden for a given model, then elements belonging to that category within that model will be displayed or hidden regardless of the category's inclusion in the Viewport's [[CategorySelectorState]].\n * The override affects geometry on all subcategories belonging to the overridden category. That is, if the category is overridden to be visible, then geometry on all subcategories of the category\n * will be visible, regardless of any [SubCategoryOverride]($common)s applied by the view's [[DisplayStyleState]].\n * @see [[Viewport.perModelCategoryVisibility]] to define the per-model category visibility for a viewport.\n * @public\n * @extensions\n */\nexport namespace PerModelCategoryVisibility {\n /** Describes whether and how a category's visibility is overridden. */\n export enum Override {\n /** The category's visibility is not overridden; its visibility is wholly controlled by the [[Viewport]]'s [[CategorySelectorState]]. */\n None,\n /** The category is overridden to be visible. */\n Show,\n /** The category is overridden to be invisible. */\n Hide,\n }\n\n /** Describes one visibility override in a [[PerModelCategoryVisibility.Overrides]]. */\n export interface OverrideEntry {\n /** The Id of the [[GeometricModelState]] in which the override applies. */\n readonly modelId: Id64String;\n /** The Id of the [SpatialCategory]($backend) whose visibility is overridden. */\n readonly categoryId: Id64String;\n /** Whether the category is visible in the context of the model. */\n readonly visible: boolean;\n }\n\n /** Describes a set of per-model category visibility overrides. Changes to these overrides invoke the [[Viewport.onViewedCategoriesPerModelChanged]] event.\n * @see [[Viewport.perModelCategoryVisibility]].\n */\n export interface Overrides {\n /** Returns the override state of the specified category within the specified model. */\n getOverride(modelId: Id64String, categoryId: Id64String): Override;\n /** Changes the override state of one or more categories for one or more models. */\n setOverride(modelIds: Id64Arg, categoryIds: Id64Arg, override: Override): void;\n /** Changes multiple overrides, given an array of overrides *\n * @beta\n */\n setOverrides(perModelCategoryVisibility: Props[], iModel?: IModelConnection): Promise<void>;\n /** Removes all overrides for the specified models, or for all models if `modelIds` is undefined. */\n clearOverrides(modelIds?: Id64Arg): void;\n /** An iterator over all of the visibility overrides. */\n [Symbol.iterator]: () => Iterator<OverrideEntry>;\n /** Populate the symbology overrides based on the per-model category visibility. */\n addOverrides(fs: FeatureSymbology.Overrides, ovrs: Id64.Uint32Map<Id64.Uint32Set>): void;\n }\n\n /** Describes a set of [[PerModelCategoryVisibility.Overrides]].\n * @see [[PerModelCategoryVisibility.Overrides.setOverrides]].\n * @beta\n */\n export interface Props {\n /** The id of the model to which the overrides apply. */\n modelId: string;\n /** The ids of the categories whose visibility are to be overridden within the context of the model. */\n categoryIds: Iterable<Id64String>;\n /** The visibility to be applied to the specified categories. */\n visOverride: PerModelCategoryVisibility.Override;\n }\n\n export function createOverrides(viewport: Viewport): PerModelCategoryVisibility.Overrides {\n return new PerModelCategoryVisibilityOverrides(viewport);\n }\n}\ntype Writeable<T extends object> = { -readonly [P in keyof T]: T[P] };\ntype WriteableOverrideEntry = Writeable<PerModelCategoryVisibility.OverrideEntry>;\n\ntype ModelEntry = Map<Id64String, WriteableOverrideEntry>;\n\n/** The Viewport-specific implementation of PerModelCategoryVisibility.Overrides. */\nclass PerModelCategoryVisibilityOverrides implements PerModelCategoryVisibility.Overrides {\n private readonly _map = new Map<Id64String, ModelEntry>();\n /** Flat set of all override entries, providing O(1) iteration via [Symbol.iterator]. Kept in sync with `_map`. */\n private readonly _set = new Set<WriteableOverrideEntry>();\n private readonly _vp: Viewport;\n\n public constructor(vp: Viewport) {\n this._vp = vp;\n }\n\n\n public [Symbol.iterator](): Iterator<PerModelCategoryVisibility.OverrideEntry> {\n return this._set[Symbol.iterator]();\n }\n\n public getOverride(modelId: Id64String, categoryId: Id64String): PerModelCategoryVisibility.Override {\n const ovr = this._map.get(modelId)?.get(categoryId);\n if (undefined !== ovr)\n return ovr.visible ? PerModelCategoryVisibility.Override.Show : PerModelCategoryVisibility.Override.Hide;\n else\n return PerModelCategoryVisibility.Override.None;\n }\n\n private getModelEntry({ modelId, override }: { modelId: Id64String; override: PerModelCategoryVisibility.Override }): ModelEntry | undefined {\n let modelEntry = this._map.get(modelId);\n if (modelEntry) {\n return modelEntry;\n }\n if (override === PerModelCategoryVisibility.Override.None) {\n return undefined;\n }\n modelEntry = new Map<Id64String, WriteableOverrideEntry>();\n this._map.set(modelId, modelEntry);\n return modelEntry;\n }\n\n private addOrRemoveOverrideEntry({ modelEntry, categoryId, modelId, override }: { modelEntry: ModelEntry; categoryId: Id64String; modelId: Id64String; override: PerModelCategoryVisibility.Override }): boolean {\n const overrideEntry = modelEntry.get(categoryId);\n if (override === PerModelCategoryVisibility.Override.None) {\n if (overrideEntry === undefined) {\n return false;\n }\n\n this._set.delete(overrideEntry);\n modelEntry.delete(categoryId);\n return true;\n }\n const visible = override === PerModelCategoryVisibility.Override.Show;\n if (overrideEntry === undefined) {\n const ovr: WriteableOverrideEntry = { modelId, categoryId, visible };\n modelEntry.set(categoryId, ovr);\n this._set.add(ovr);\n return true;\n }\n if (overrideEntry.visible !== visible) {\n overrideEntry.visible = visible;\n return true;\n }\n return false;\n }\n\n private applyOverride(modelId: Id64String, categoryIds: Iterable<Id64String>, override: PerModelCategoryVisibility.Override, catIdsToLoad?: string[]): boolean {\n const modelEntry = this.getModelEntry({ modelId, override });\n let changed = false;\n if (!modelEntry)\n return changed;\n\n for (const categoryId of categoryIds) {\n if (this.addOrRemoveOverrideEntry({ modelEntry, categoryId, modelId, override })) {\n changed = true;\n if (catIdsToLoad && override !== PerModelCategoryVisibility.Override.None)\n catIdsToLoad.push(categoryId);\n }\n }\n if (modelEntry.size === 0) {\n this._map.delete(modelId);\n }\n return changed;\n }\n\n /**\n * set the overrides for multiple perModelCategoryVisibility props, loading categoryIds from the iModel if necessary.\n * @see [[PerModelCategoryVisibility]]\n * @param perModelCategoryVisibility array of model category visibility overrides @see [[PerModelCategoryVisibility.Props]]\n * @param iModel Optional param iModel. If no iModel is provided, then the iModel associated with the viewport (used to construct this class) is used.\n * This optional iModel param is useful for apps which may show multiple iModels at once. Passing in an iModel ensures that the subcategories cache for the provided iModel\n * is populated as opposed to the iModel associated with the viewport which may or may not be an empty iModel.\n * @returns a promise that resolves once the overrides have been applied.\n */\n public async setOverrides(perModelCategoryVisibility: PerModelCategoryVisibility.Props[], iModel?: IModelConnection): Promise<void> {\n let anyChanged = false;\n const catIdsToLoad: string[] = [];\n const iModelToUse = iModel ? iModel : this._vp.iModel;\n for (const override of perModelCategoryVisibility) {\n // The caller may pass a single categoryId as a string, if we don't convert this to an array we will iterate\n // over each individual character of that string, which is not the desired behavior.\n const categoryIds = typeof override.categoryIds === \"string\" ? [override.categoryIds] : override.categoryIds;\n if (this.applyOverride(override.modelId, categoryIds, override.visOverride, catIdsToLoad))\n anyChanged = true;\n }\n if (anyChanged) {\n this._vp.setViewedCategoriesPerModelChanged();\n if (catIdsToLoad.length !== 0) {\n this._vp.subcategories.push(iModelToUse.subcategories, catIdsToLoad, () => this._vp.setViewedCategoriesPerModelChanged());\n }\n }\n }\n\n public setOverride(modelIds: Id64Arg, categoryIds: Id64Arg, override: PerModelCategoryVisibility.Override): void {\n const categoryIdIterable = Id64.iterable(categoryIds);\n let changed = false;\n for (const modelId of Id64.iterable(modelIds)) {\n if (this.applyOverride(modelId, categoryIdIterable, override))\n changed = true;\n }\n\n if (changed) {\n this._vp.setViewedCategoriesPerModelChanged();\n\n if (override !== PerModelCategoryVisibility.Override.None) {\n // Ensure subcategories loaded.\n this._vp.subcategories.push(this._vp.iModel.subcategories, categoryIds, () => this._vp.setViewedCategoriesPerModelChanged());\n }\n }\n }\n\n public clearOverrides(modelIds?: Id64Arg): void {\n if (undefined === modelIds) {\n if (this._map.size > 0) {\n this._map.clear();\n this._set.clear();\n this._vp.setViewedCategoriesPerModelChanged();\n }\n return;\n }\n\n let changed = false;\n for (const modelId of Id64.iterable(modelIds)) {\n const modelEntry = this._map.get(modelId);\n if (!modelEntry) {\n continue;\n }\n changed = true;\n for (const overrideEntry of modelEntry.values()) {\n this._set.delete(overrideEntry);\n }\n this._map.delete(modelId);\n }\n if (changed) {\n this._vp.setViewedCategoriesPerModelChanged();\n }\n }\n\n public addOverrides(fs: FeatureSymbology.Overrides, ovrs: Id64.Uint32Map<Id64.Uint32Set>): void {\n const cache = this._vp.iModel.subcategories;\n\n for (const ovr of this._set) {\n const subcats = cache.getSubCategories(ovr.categoryId);\n if (undefined === subcats)\n continue;\n\n // It's pointless to override for models which aren't displayed...except if we do this, and then someone enables that model,\n // we would need to regenerate our symbology overrides in response. Preferably people wouldn't bother overriding models that\n // they don't want us to draw...\n /* if (!this._vp.view.viewsModel(ovr.modelId))\n continue; */\n\n // ###TODO: Avoid recomputing upper and lower portions of modelId if modelId repeated.\n // Also avoid computing if no effective overrides.\n const modelLo = Id64.getLowerUint32(ovr.modelId);\n const modelHi = Id64.getUpperUint32(ovr.modelId);\n\n for (const subcat of subcats) {\n const subcatLo = Id64.getLowerUint32(subcat);\n const subcatHi = Id64.getUpperUint32(subcat);\n const vis = fs.isSubCategoryVisible(subcatLo, subcatHi);\n if (vis !== ovr.visible) {\n // Only care if visibility differs from that defined for entire view\n let entry = ovrs.get(modelLo, modelHi);\n if (undefined === entry) {\n entry = new Id64.Uint32Set();\n ovrs.set(modelLo, modelHi, entry);\n }\n\n entry.add(subcatLo, subcatHi);\n }\n }\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SpatialViewState.d.ts","sourceRoot":"","sources":["../../src/SpatialViewState.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAoC,UAAU,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACjH,OAAO,EAAY,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,4BAA4B,EAAE,6BAA6B,EAAE,0BAA0B,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC/J,OAAO,EAA8B,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,kBAAkB,EA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AIzC;AACD;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,gBAAgB;IACzD,WAA2B,SAAS,WAA2C;gBAEnE,KAAK,EAAE,0BAA0B,EAAE,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,qBAAqB,EAAE,YAAY,EAAE,mBAAmB,EAAE,aAAa,EAAE,kBAAkB;IAEhK,cAAc,IAAI,OAAO;CAC1C"}
@@ -128,7 +128,9 @@ export class SpatialViewState extends ViewState3d {
128
128
  }
129
129
  toJSON() {
130
130
  const val = super.toJSON();
131
- val.modelSelectorId = this.modelSelector.id;
131
+ val.modelSelector = { id: this.modelSelector.id };
132
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
133
+ val.modelSelectorId = this.modelSelector.id; // for backward compatibility
132
134
  return val;
133
135
  }
134
136
  /** @internal */