@itwin/core-frontend 5.7.0-dev.9 → 5.8.0-dev.2

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 (84) hide show
  1. package/CHANGELOG.md +13 -1
  2. package/lib/cjs/CategorySelectorState.d.ts +8 -0
  3. package/lib/cjs/CategorySelectorState.d.ts.map +1 -1
  4. package/lib/cjs/CategorySelectorState.js +12 -0
  5. package/lib/cjs/CategorySelectorState.js.map +1 -1
  6. package/lib/cjs/GeoServices.js +1 -1
  7. package/lib/cjs/GeoServices.js.map +1 -1
  8. package/lib/cjs/IModelConnection.d.ts +0 -2
  9. package/lib/cjs/IModelConnection.d.ts.map +1 -1
  10. package/lib/cjs/IModelConnection.js +110 -105
  11. package/lib/cjs/IModelConnection.js.map +1 -1
  12. package/lib/cjs/ViewState.d.ts.map +1 -1
  13. package/lib/cjs/ViewState.js +2 -0
  14. package/lib/cjs/ViewState.js.map +1 -1
  15. package/lib/cjs/Viewport.d.ts +2 -1
  16. package/lib/cjs/Viewport.d.ts.map +1 -1
  17. package/lib/cjs/Viewport.js +10 -3
  18. package/lib/cjs/Viewport.js.map +1 -1
  19. package/lib/cjs/common/gltf/GltfParser.js +1 -1
  20. package/lib/cjs/common/gltf/GltfParser.js.map +1 -1
  21. package/lib/cjs/internal/tile/MeshoptCompression.js +1 -1
  22. package/lib/cjs/internal/tile/MeshoptCompression.js.map +1 -1
  23. package/lib/cjs/internal/tile/PntsReader.js +1 -1
  24. package/lib/cjs/internal/tile/PntsReader.js.map +1 -1
  25. package/lib/cjs/internal/tile/RealityTileLoader.d.ts.map +1 -1
  26. package/lib/cjs/internal/tile/RealityTileLoader.js +26 -5
  27. package/lib/cjs/internal/tile/RealityTileLoader.js.map +1 -1
  28. package/lib/cjs/tile/GltfReader.d.ts +4 -2
  29. package/lib/cjs/tile/GltfReader.d.ts.map +1 -1
  30. package/lib/cjs/tile/GltfReader.js +55 -5
  31. package/lib/cjs/tile/GltfReader.js.map +1 -1
  32. package/lib/cjs/tools/MeasureTool.d.ts.map +1 -1
  33. package/lib/cjs/tools/MeasureTool.js +18 -1
  34. package/lib/cjs/tools/MeasureTool.js.map +1 -1
  35. package/lib/cjs/tools/PrimitiveTool.d.ts.map +1 -1
  36. package/lib/cjs/tools/PrimitiveTool.js +7 -1
  37. package/lib/cjs/tools/PrimitiveTool.js.map +1 -1
  38. package/lib/cjs/tools/ToolAdmin.d.ts +1 -0
  39. package/lib/cjs/tools/ToolAdmin.d.ts.map +1 -1
  40. package/lib/cjs/tools/ToolAdmin.js +32 -18
  41. package/lib/cjs/tools/ToolAdmin.js.map +1 -1
  42. package/lib/esm/CategorySelectorState.d.ts +8 -0
  43. package/lib/esm/CategorySelectorState.d.ts.map +1 -1
  44. package/lib/esm/CategorySelectorState.js +12 -0
  45. package/lib/esm/CategorySelectorState.js.map +1 -1
  46. package/lib/esm/GeoServices.js +1 -1
  47. package/lib/esm/GeoServices.js.map +1 -1
  48. package/lib/esm/IModelConnection.d.ts +0 -2
  49. package/lib/esm/IModelConnection.d.ts.map +1 -1
  50. package/lib/esm/IModelConnection.js +110 -105
  51. package/lib/esm/IModelConnection.js.map +1 -1
  52. package/lib/esm/ViewState.d.ts.map +1 -1
  53. package/lib/esm/ViewState.js +2 -0
  54. package/lib/esm/ViewState.js.map +1 -1
  55. package/lib/esm/Viewport.d.ts +2 -1
  56. package/lib/esm/Viewport.d.ts.map +1 -1
  57. package/lib/esm/Viewport.js +10 -3
  58. package/lib/esm/Viewport.js.map +1 -1
  59. package/lib/esm/common/gltf/GltfParser.js +1 -1
  60. package/lib/esm/common/gltf/GltfParser.js.map +1 -1
  61. package/lib/esm/internal/tile/MeshoptCompression.js +1 -1
  62. package/lib/esm/internal/tile/MeshoptCompression.js.map +1 -1
  63. package/lib/esm/internal/tile/PntsReader.js +1 -1
  64. package/lib/esm/internal/tile/PntsReader.js.map +1 -1
  65. package/lib/esm/internal/tile/RealityTileLoader.d.ts.map +1 -1
  66. package/lib/esm/internal/tile/RealityTileLoader.js +26 -5
  67. package/lib/esm/internal/tile/RealityTileLoader.js.map +1 -1
  68. package/lib/esm/tile/GltfReader.d.ts +4 -2
  69. package/lib/esm/tile/GltfReader.d.ts.map +1 -1
  70. package/lib/esm/tile/GltfReader.js +55 -5
  71. package/lib/esm/tile/GltfReader.js.map +1 -1
  72. package/lib/esm/tools/MeasureTool.d.ts.map +1 -1
  73. package/lib/esm/tools/MeasureTool.js +18 -1
  74. package/lib/esm/tools/MeasureTool.js.map +1 -1
  75. package/lib/esm/tools/PrimitiveTool.d.ts.map +1 -1
  76. package/lib/esm/tools/PrimitiveTool.js +7 -1
  77. package/lib/esm/tools/PrimitiveTool.js.map +1 -1
  78. package/lib/esm/tools/ToolAdmin.d.ts +1 -0
  79. package/lib/esm/tools/ToolAdmin.d.ts.map +1 -1
  80. package/lib/esm/tools/ToolAdmin.js +32 -18
  81. package/lib/esm/tools/ToolAdmin.js.map +1 -1
  82. package/lib/public/scripts/parse-imdl-worker.js +1 -1
  83. package/lib/workers/webpack/parse-imdl-worker.js +1 -1
  84. package/package.json +20 -20
package/CHANGELOG.md CHANGED
@@ -1,6 +1,18 @@
1
1
  # Change Log - @itwin/core-frontend
2
2
 
3
- This log was last generated on Thu, 05 Feb 2026 16:14:10 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 26 Feb 2026 22:18:10 GMT and should not be manually modified.
4
+
5
+ ## 5.6.2
6
+ Thu, 26 Feb 2026 22:14:46 GMT
7
+
8
+ ### Updates
9
+
10
+ - Support geometry collection for reality meshes with glTF tiles
11
+
12
+ ## 5.6.1
13
+ Fri, 13 Feb 2026 17:11:47 GMT
14
+
15
+ _Version update only_
4
16
 
5
17
  ## 5.6.0
6
18
  Thu, 05 Feb 2026 16:12:37 GMT
@@ -38,6 +38,14 @@ export declare class CategorySelectorState extends ElementState {
38
38
  addCategories(arg: Id64Arg): void;
39
39
  /** Remove one or more categories from this CategorySelector */
40
40
  dropCategories(arg: Id64Arg): void;
41
+ /** Add one or more categories to this CategorySelector, raising a single batch event instead of one event per category.
42
+ * This is more efficient than [[addCategories]] when adding many categories at once.
43
+ */
44
+ addCategoriesBatched(arg: Id64Arg): void;
45
+ /** Remove one or more categories from this CategorySelector, raising a single batch event instead of one event per category.
46
+ * This is more efficient than [[dropCategories]] when dropping many categories at once.
47
+ */
48
+ dropCategoriesBatched(arg: Id64Arg): void;
41
49
  /** Add or remove categories from this CategorySelector.
42
50
  * @param arg The categories to add or remove
43
51
  * @param add If true, categories will be added; otherwise they will be removed.
@@ -1 +1 @@
1
- {"version":3,"file":"CategorySelectorState.d.ts","sourceRoot":"","sources":["../../src/CategorySelectorState.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAQ,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;;;;;;;GASG;AACH,qBAAa,qBAAsB,SAAQ,YAAY;IACrD,WAA2B,SAAS,WAAiC;IAErE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA+B;gBAE/C,KAAK,EAAE,qBAAqB,EAAE,MAAM,EAAE,gBAAgB;IAMlE,IAAW,UAAU,IAAI,GAAG,CAAC,MAAM,CAAC,CAEnC;IAED,IAAW,UAAU,CAAC,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,EAI5C;IAED,gBAAgB;IAChB,IAAW,oBAAoB,IAAI,aAAa,CAAC,MAAM,CAAC,CAEvD;IAEe,MAAM,IAAI,qBAAqB;IAO/C;;OAEG;IACI,UAAU,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO;IAWxD,wCAAwC;IACxC,IAAW,IAAI,IAAI,MAAM,CAA4B;IAErD,uFAAuF;IAChF,GAAG,CAA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A8E;IACvE,gBAAgB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO;IAExD,0DAA0D;IACnD,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI;IAKxC,+DAA+D;IACxD,cAAc,CAAC,GAAG,EAAE,OAAO;IAKlC;;OAEG;IACI,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI;IAI/C;;OAEG;IACI,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI;IAIhD;;;OAGG;IACI,qBAAqB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,GAAG,IAAI;CAM/D"}
@@ -73,6 +73,18 @@ class CategorySelectorState extends EntityState_1.ElementState {
73
73
  for (const id of core_bentley_1.Id64.iterable(arg))
74
74
  this.categories.delete(id);
75
75
  }
76
+ /** Add one or more categories to this CategorySelector, raising a single batch event instead of one event per category.
77
+ * This is more efficient than [[addCategories]] when adding many categories at once.
78
+ */
79
+ addCategoriesBatched(arg) {
80
+ this._categories.addAll(core_bentley_1.Id64.iterable(arg));
81
+ }
82
+ /** Remove one or more categories from this CategorySelector, raising a single batch event instead of one event per category.
83
+ * This is more efficient than [[dropCategories]] when dropping many categories at once.
84
+ */
85
+ dropCategoriesBatched(arg) {
86
+ this._categories.deleteAll(core_bentley_1.Id64.iterable(arg));
87
+ }
76
88
  /** Add or remove categories from this CategorySelector.
77
89
  * @param arg The categories to add or remove
78
90
  * @param add If true, categories will be added; otherwise they will be removed.
@@ -1 +1 @@
1
- {"version":3,"file":"CategorySelectorState.js","sourceRoot":"","sources":["../../src/CategorySelectorState.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAA+E;AAE/E,+CAA6C;AAG7C;;;;;;;;;GASG;AACH,MAAa,qBAAsB,SAAQ,0BAAY;IAC9C,MAAM,KAAc,SAAS,KAAK,OAAO,kBAAkB,CAAC,CAAC,CAAC;IAEpD,WAAW,GAAG,IAAI,4BAAa,EAAU,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;gBAC5B,OAAO,KAAK,CAAC;QAEjB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,wCAAwC;IACxC,IAAW,IAAI,KAAa,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAErD,uFAAuF;IAChF,GAAG,CAAC,EAAc,IAAa,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAEvE,8EAA8E;IACvE,gBAAgB,CAAC,UAAsB,IAAa,OAAO,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAEzF,0DAA0D;IACnD,aAAa,CAAC,GAAY;QAC/B,KAAK,MAAM,EAAE,IAAI,mBAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;YACjC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;IAED,+DAA+D;IACxD,cAAc,CAAC,GAAY;QAChC,KAAK,MAAM,EAAE,IAAI,mBAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;YACjC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACI,qBAAqB,CAAC,GAAY,EAAE,GAAY;QACrD,IAAI,GAAG;YACL,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;;YAExB,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;CACF;AA9ED,sDA8EC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Views\r\n */\r\nimport { Id64, Id64Arg, Id64String, ObservableSet } from \"@itwin/core-bentley\";\r\nimport { CategorySelectorProps } from \"@itwin/core-common\";\r\nimport { ElementState } from \"./EntityState\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\n\r\n/** A set of Categories to be displayed in a [[ViewState]].\r\n * Elements belonging to categories not specified in the category selector will not be drawn in the view.\r\n * By default, geometry belonging to any [[SubCategory]] of a visible Category is also visible in the view,\r\n * unless the [[SubCategoryAppearance]] or [[SubCategoryOverride]] specifies that it should be invisible.\r\n * @note To change the set of categories visible in a [[ViewState]] currently associated with a [[Viewport]],\r\n * use [[ViewState.changeCategoryDisplay]] to ensure the view updates appropriately on screen.\r\n * @see [[Category]]\r\n * @public\r\n * @extensions\r\n */\r\nexport class CategorySelectorState extends ElementState {\r\n public static override get className() { return \"CategorySelector\"; }\r\n\r\n private readonly _categories = new ObservableSet<string>();\r\n\r\n constructor(props: CategorySelectorProps, iModel: IModelConnection) {\r\n super(props, iModel);\r\n if (props.categories)\r\n props.categories.forEach((cat) => this.categories.add(cat));\r\n }\r\n\r\n public get categories(): Set<string> {\r\n return this._categories;\r\n }\r\n\r\n public set categories(categories: Set<string>) {\r\n this._categories.clear();\r\n for (const category of categories)\r\n this._categories.add(category);\r\n }\r\n\r\n /** @internal */\r\n public get observableCategories(): ObservableSet<string> {\r\n return this._categories;\r\n }\r\n\r\n public override toJSON(): CategorySelectorProps {\r\n const val = super.toJSON() as CategorySelectorProps;\r\n val.categories = [];\r\n this.categories.forEach((cat) => val.categories.push(cat));\r\n return val;\r\n }\r\n\r\n /** Returns true if this category selector is logically equivalent to the specified category selector.\r\n * Two category selectors are logically equivalent if they have the same name and Id and contain the same set of category Ids.\r\n */\r\n public equalState(other: CategorySelectorState): boolean {\r\n if (this.categories.size !== other.categories.size || this.name !== other.name || this.id !== other.id)\r\n return false;\r\n\r\n for (const cat of this.categories)\r\n if (!other.categories.has(cat))\r\n return false;\r\n\r\n return true;\r\n }\r\n\r\n /** The name of this CategorySelector */\r\n public get name(): string { return this.code.value; }\r\n\r\n /** Determine whether this CategorySelector includes the specified categoryId string */\r\n public has(id: Id64String): boolean { return this.categories.has(id); }\r\n\r\n /** Determine whether this CategorySelector includes the specified category */\r\n public isCategoryViewed(categoryId: Id64String): boolean { return this.has(categoryId); }\r\n\r\n /** Add one or more categories to this CategorySelector */\r\n public addCategories(arg: Id64Arg): void {\r\n for (const id of Id64.iterable(arg))\r\n this.categories.add(id);\r\n }\r\n\r\n /** Remove one or more categories from this CategorySelector */\r\n public dropCategories(arg: Id64Arg) {\r\n for (const id of Id64.iterable(arg))\r\n this.categories.delete(id);\r\n }\r\n\r\n /** Add or remove categories from this CategorySelector.\r\n * @param arg The categories to add or remove\r\n * @param add If true, categories will be added; otherwise they will be removed.\r\n */\r\n public changeCategoryDisplay(arg: Id64Arg, add: boolean): void {\r\n if (add)\r\n this.addCategories(arg);\r\n else\r\n this.dropCategories(arg);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"CategorySelectorState.js","sourceRoot":"","sources":["../../src/CategorySelectorState.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAA+E;AAE/E,+CAA6C;AAG7C;;;;;;;;;GASG;AACH,MAAa,qBAAsB,SAAQ,0BAAY;IAC9C,MAAM,KAAc,SAAS,KAAK,OAAO,kBAAkB,CAAC,CAAC,CAAC;IAEpD,WAAW,GAAG,IAAI,4BAAa,EAAU,CAAC;IAE3D,YAAY,KAA4B,EAAE,MAAwB;QAChE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrB,IAAI,KAAK,CAAC,UAAU;YAClB,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IAChE,CAAC;IAED,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,IAAW,UAAU,CAAC,UAAuB;QAC3C,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;QACzB,KAAK,MAAM,QAAQ,IAAI,UAAU;YAC/B,I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BAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;YACjC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;IAED,+DAA+D;IACxD,cAAc,CAAC,GAAY;QAChC,KAAK,MAAM,EAAE,IAAI,mBAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;YACjC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC/B,CAAC;IAED;;OAEG;IACI,oBAAoB,CAAC,GAAY;QACtC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,mBAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED;;OAEG;IACI,qBAAqB,CAAC,GAAY;QACvC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,mBAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IACjD,CAAC;IAED;;;OAGG;IACI,qBAAqB,CAAC,GAAY,EAAE,GAAY;QACrD,IAAI,GAAG;YACL,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;;YAExB,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;CACF;AA5FD,sDA4FC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Views\r\n */\r\nimport { Id64, Id64Arg, Id64String, ObservableSet } from \"@itwin/core-bentley\";\r\nimport { CategorySelectorProps } from \"@itwin/core-common\";\r\nimport { ElementState } from \"./EntityState\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\n\r\n/** A set of Categories to be displayed in a [[ViewState]].\r\n * Elements belonging to categories not specified in the category selector will not be drawn in the view.\r\n * By default, geometry belonging to any [[SubCategory]] of a visible Category is also visible in the view,\r\n * unless the [[SubCategoryAppearance]] or [[SubCategoryOverride]] specifies that it should be invisible.\r\n * @note To change the set of categories visible in a [[ViewState]] currently associated with a [[Viewport]],\r\n * use [[ViewState.changeCategoryDisplay]] to ensure the view updates appropriately on screen.\r\n * @see [[Category]]\r\n * @public\r\n * @extensions\r\n */\r\nexport class CategorySelectorState extends ElementState {\r\n public static override get className() { return \"CategorySelector\"; }\r\n\r\n private readonly _categories = new ObservableSet<string>();\r\n\r\n constructor(props: CategorySelectorProps, iModel: IModelConnection) {\r\n super(props, iModel);\r\n if (props.categories)\r\n props.categories.forEach((cat) => this.categories.add(cat));\r\n }\r\n\r\n public get categories(): Set<string> {\r\n return this._categories;\r\n }\r\n\r\n public set categories(categories: Set<string>) {\r\n this._categories.clear();\r\n for (const category of categories)\r\n this._categories.add(category);\r\n }\r\n\r\n /** @internal */\r\n public get observableCategories(): ObservableSet<string> {\r\n return this._categories;\r\n }\r\n\r\n public override toJSON(): CategorySelectorProps {\r\n const val = super.toJSON() as CategorySelectorProps;\r\n val.categories = [];\r\n this.categories.forEach((cat) => val.categories.push(cat));\r\n return val;\r\n }\r\n\r\n /** Returns true if this category selector is logically equivalent to the specified category selector.\r\n * Two category selectors are logically equivalent if they have the same name and Id and contain the same set of category Ids.\r\n */\r\n public equalState(other: CategorySelectorState): boolean {\r\n if (this.categories.size !== other.categories.size || this.name !== other.name || this.id !== other.id)\r\n return false;\r\n\r\n for (const cat of this.categories)\r\n if (!other.categories.has(cat))\r\n return false;\r\n\r\n return true;\r\n }\r\n\r\n /** The name of this CategorySelector */\r\n public get name(): string { return this.code.value; }\r\n\r\n /** Determine whether this CategorySelector includes the specified categoryId string */\r\n public has(id: Id64String): boolean { return this.categories.has(id); }\r\n\r\n /** Determine whether this CategorySelector includes the specified category */\r\n public isCategoryViewed(categoryId: Id64String): boolean { return this.has(categoryId); }\r\n\r\n /** Add one or more categories to this CategorySelector */\r\n public addCategories(arg: Id64Arg): void {\r\n for (const id of Id64.iterable(arg))\r\n this.categories.add(id);\r\n }\r\n\r\n /** Remove one or more categories from this CategorySelector */\r\n public dropCategories(arg: Id64Arg) {\r\n for (const id of Id64.iterable(arg))\r\n this.categories.delete(id);\r\n }\r\n\r\n /** Add one or more categories to this CategorySelector, raising a single batch event instead of one event per category.\r\n * This is more efficient than [[addCategories]] when adding many categories at once.\r\n */\r\n public addCategoriesBatched(arg: Id64Arg): void {\r\n this._categories.addAll(Id64.iterable(arg));\r\n }\r\n\r\n /** Remove one or more categories from this CategorySelector, raising a single batch event instead of one event per category.\r\n * This is more efficient than [[dropCategories]] when dropping many categories at once.\r\n */\r\n public dropCategoriesBatched(arg: Id64Arg): void {\r\n this._categories.deleteAll(Id64.iterable(arg));\r\n }\r\n\r\n /** Add or remove categories from this CategorySelector.\r\n * @param arg The categories to add or remove\r\n * @param add If true, categories will be added; otherwise they will be removed.\r\n */\r\n public changeCategoryDisplay(arg: Id64Arg, add: boolean): void {\r\n if (add)\r\n this.addCategories(arg);\r\n else\r\n this.dropCategories(arg);\r\n }\r\n}\r\n"]}
@@ -103,7 +103,7 @@ class CoordinateConverter {
103
103
  this._cache.set(requests[j], results[j]);
104
104
  }
105
105
  }).catch((err) => {
106
- core_bentley_1.Logger.logException(`${FrontendLoggerCategory_1.FrontendLoggerCategory.Package}.geoservices`, err);
106
+ core_bentley_1.Logger.logError(`${FrontendLoggerCategory_1.FrontendLoggerCategory.Package}.geoservices`, err);
107
107
  });
108
108
  promises.push(promise);
109
109
  }
@@ -1 +1 @@
1
- {"version":3,"file":"GeoServices.js","sourceRoot":"","sources":["../../src/GeoServices.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,qBAAqB;AACrB,sDAE6B;AAE7B,oDAG4B;AAE5B,4EAAyE;AAazE,SAAS,aAAa,CAAC,GAAW,EAAE,GAAW;IAC7C,OAAO,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,GAAG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AAW,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QAElG,IAAI,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACvC,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,SAAS,GAAG,IAAI,YAAY,CAAC,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;YAC1D,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;YAElC,SAAS,CAAC,sBAAsB,CAAC,OAAO,CAAC,GAAG,EAAE;gBAC5C,IAAI,SAAS,KAAK,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC;oBACtC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC,CAAC,CAAC;QACL,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AA5DD,kCA4DC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module IModelConnection\r\n */\r\n\r\n// cspell:ignore GCRS\r\nimport {\r\n assert, BeEvent, Dictionary, Logger, SortedArray,\r\n} from \"@itwin/core-bentley\";\r\nimport { WritableXYAndZ, XYAndZ, XYZProps } from \"@itwin/core-geometry\";\r\nimport {\r\n GeoCoordinatesRequestProps, GeoCoordinatesResponseProps, GeoCoordStatus, GeographicCRSProps, IModelCoordinatesRequestProps, IModelCoordinatesResponseProps,\r\n IModelReadRpcInterface, PointWithStatus,\r\n} from \"@itwin/core-common\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\nimport { FrontendLoggerCategory } from \"./common/FrontendLoggerCategory\";\r\n\r\n/** Options used to create a [[CoordinateConverter]].\r\n * @internal exported strictly for tests.\r\n */\r\nexport interface CoordinateConverterOptions {\r\n isIModelClosed: () => boolean;\r\n /** Asynchronously convert each point. The resultant array should have the same number and order of points as the input. */\r\n requestPoints: (points: XYAndZ[]) => Promise<PointWithStatus[]>;\r\n /** Maximum number of points to include in each request. Default: 300. */\r\n maxPointsPerRequest?: number;\r\n}\r\n\r\nfunction compareXYAndZ(lhs: XYAndZ, rhs: XYAndZ): number {\r\n return lhs.x - rhs.x || lhs.y - rhs.y || lhs.z - rhs.z;\r\n}\r\n\r\nfunction cloneXYAndZ(xyz: XYAndZ): XYAndZ {\r\n return { x: xyz.x, y: xyz.y, z: xyz.z };\r\n}\r\n\r\ntype CoordinateConverterState =\r\n // No pending requests.\r\n \"idle\" |\r\n // We have scheduled a requestAnimationFrame to dispatch all pending requests.\r\n \"scheduled\" |\r\n // We have dispatched all requests that were pending at the most recent requestAnimationFrame callback.\r\n \"in-flight\";\r\n\r\n/** Performs conversion of coordinates from one coordinate system to another.\r\n * A [[GeoConverter]] has a pair of these for converting between iModel coordinates and geographic coordinates.\r\n * Uses a cache to avoid repeatedly requesting the same points, and a batching strategy to avoid making frequent small requests.\r\n * The cache stores every point that was ever converted by [[convert]]. It is currently permitted to grow to unbounded size.\r\n * The batching works as follows:\r\n * When a conversion is requested via [[convert]], if all the requested points are in the cache, they are returned immediately.\r\n * Otherwise, any points not in the cache and not in the current in-flight request (if any) are placed onto the queue of pending requests.\r\n * A pending request is scheduled if one hasn't already been scheduled, via requestAnimationFrame.\r\n * In the animation frame callback, the pending requests are split into batches of no more than options.maxPointsPerRequest and dispatched to the backend.\r\n * Once the response is received, the results are loaded into and returned from the cache.\r\n * If more calls to convert occurred while the request was in flight, another request is dispatched.\r\n * @internal exported strictly for tests.\r\n */\r\nexport class CoordinateConverter {\r\n protected readonly _cache: Dictionary<XYAndZ, PointWithStatus>;\r\n protected _state: CoordinateConverterState = \"idle\";\r\n // The accumulated set of points to be converted by the next request.\r\n protected _pending: SortedArray<XYAndZ>;\r\n // The set of points that were included in the current in-flight request, if any.\r\n protected _inflight: SortedArray<XYAndZ>;\r\n // An event fired when the next request completes.\r\n protected _onCompleted = new BeEvent<() => void>();\r\n // Used for creating cache keys (XYAndZ) from XYZProps without having to allocate temporary objects.\r\n protected readonly _scratchXYZ = { x: 0, y: 0, z: 0 };\r\n protected readonly _maxPointsPerRequest: number;\r\n protected readonly _isIModelClosed: () => boolean;\r\n protected readonly _requestPoints: (points: XYAndZ[]) => Promise<PointWithStatus[]>;\r\n // If true, [[dispatch]] will schedule another dispatch after it receives a response.\r\n // This is needed when all the points requested after the most recent dispatch were included in the currently-in-flight request -\r\n // _pending will be empty but new callers will be awaiting the results of the in-flight request.\r\n protected _redispatchOnCompletion = false;\r\n\r\n public get isIdle(): boolean {\r\n return \"idle\" === this._state;\r\n }\r\n\r\n protected toXYAndZ(input: XYZProps, output: WritableXYAndZ): XYAndZ {\r\n if (Array.isArray(input)) {\r\n output.x = input[0] ?? 0;\r\n output.y = input[1] ?? 0;\r\n output.z = input[2] ?? 0;\r\n } else {\r\n output.x = input.x ?? 0;\r\n output.y = input.y ?? 0;\r\n output.z = input.z ?? 0;\r\n }\r\n\r\n return output;\r\n }\r\n\r\n public constructor(opts: CoordinateConverterOptions) {\r\n this._maxPointsPerRequest = Math.max(1, opts.maxPointsPerRequest ?? 300);\r\n this._isIModelClosed = opts.isIModelClosed;\r\n this._requestPoints = opts.requestPoints;\r\n\r\n this._cache = new Dictionary<XYAndZ, PointWithStatus>(compareXYAndZ, cloneXYAndZ);\r\n this._pending = new SortedArray<XYAndZ>(compareXYAndZ, false, cloneXYAndZ);\r\n this._inflight = new SortedArray<XYAndZ>(compareXYAndZ, false, cloneXYAndZ);\r\n }\r\n\r\n protected async dispatch(): Promise<void> {\r\n assert(this._state === \"scheduled\");\r\n if (this._isIModelClosed() || this._pending.isEmpty) {\r\n this._state = \"idle\";\r\n this._onCompleted.raiseEvent();\r\n return;\r\n }\r\n\r\n this._state = \"in-flight\";\r\n\r\n // Ensure subsequently-enqueued requests listen for the *next* response to be received.\r\n const onCompleted = this._onCompleted;\r\n this._onCompleted = new BeEvent<() => void>();\r\n\r\n // Pending requests are now in flight. Start a new list of pending requests. It's cheaper to swap than to allocate new objects.\r\n const inflight = this._pending;\r\n this._pending = this._inflight;\r\n assert(this._pending.isEmpty);\r\n this._inflight = inflight;\r\n\r\n // Split requests if necessary to avoid requesting more than the maximum allowed number of points.\r\n const promises: Array<Promise<void>> = [];\r\n for (let i = 0; i < inflight.length; i += this._maxPointsPerRequest) {\r\n const requests = inflight.slice(i, i + this._maxPointsPerRequest).extractArray();\r\n const promise = this._requestPoints(requests).then((results) => {\r\n if (this._isIModelClosed())\r\n return;\r\n\r\n if (results.length !== requests.length)\r\n Logger.logError(`${FrontendLoggerCategory.Package}.geoservices`, `requested conversion of ${requests.length} points, but received ${results.length} points`);\r\n\r\n for (let j = 0; j < results.length; j++) {\r\n if (j < requests.length)\r\n this._cache.set(requests[j], results[j]);\r\n }\r\n }).catch((err) => {\r\n Logger.logException(`${FrontendLoggerCategory.Package}.geoservices`, err);\r\n });\r\n\r\n promises.push(promise);\r\n }\r\n\r\n await Promise.all(promises);\r\n\r\n assert(this._state === \"in-flight\");\r\n this._state = \"idle\";\r\n this._inflight.clear();\r\n\r\n // If any more pending conversions arrived while awaiting this request, schedule another request.\r\n if (!this._pending.isEmpty || this._redispatchOnCompletion) {\r\n this._redispatchOnCompletion = false;\r\n this.scheduleDispatch(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n }\r\n\r\n // Resolve promises of all callers who were awaiting this request.\r\n onCompleted.raiseEvent();\r\n }\r\n\r\n // Add any points not present in cache to pending request list.\r\n // Return the number of points present in cache.\r\n protected enqueue(points: XYZProps[]): number {\r\n let numInCache = 0;\r\n for (const point of points) {\r\n const xyz = this.toXYAndZ(point, this._scratchXYZ);\r\n if (this._cache.get(xyz))\r\n ++numInCache;\r\n else if (this._inflight.contains(xyz))\r\n this._redispatchOnCompletion = true;\r\n else\r\n this._pending.insert(xyz);\r\n }\r\n\r\n return numInCache;\r\n }\r\n\r\n // Obtain converted points from the cache. The assumption is that every point in `inputs` is already present in the cache.\r\n // Any point not present will be returned unconverted with an error status.\r\n protected getFromCache(inputs: XYZProps[]): PointWithStatus[] {\r\n const outputs: PointWithStatus[] = [];\r\n for (const input of inputs) {\r\n const xyz = this.toXYAndZ(input, this._scratchXYZ);\r\n let output = this._cache.get(xyz);\r\n if (!output)\r\n output = { p: { ...xyz }, s: GeoCoordStatus.CSMapError };\r\n\r\n outputs.push(output);\r\n }\r\n\r\n return outputs;\r\n }\r\n\r\n protected async scheduleDispatch(): Promise<void> {\r\n if (\"idle\" === this._state) {\r\n this._state = \"scheduled\";\r\n requestAnimationFrame(() => {\r\n this.dispatch(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n });\r\n }\r\n\r\n return new Promise((resolve) => {\r\n this._onCompleted.addOnce(() => resolve());\r\n });\r\n }\r\n\r\n public async convert(inputs: XYZProps[]): Promise<{ points: PointWithStatus[], fromCache: number }> {\r\n const fromCache = this.enqueue(inputs);\r\n assert(fromCache >= 0);\r\n assert(fromCache <= inputs.length);\r\n\r\n if (fromCache === inputs.length)\r\n return { points: this.getFromCache(inputs), fromCache };\r\n\r\n await this.scheduleDispatch();\r\n\r\n return { points: this.getFromCache(inputs), fromCache };\r\n }\r\n\r\n public findCached(inputs: XYZProps[]): CachedIModelCoordinatesResponseProps {\r\n const result: Array<PointWithStatus | undefined> = [];\r\n let missing: XYZProps[] | undefined;\r\n for (const input of inputs) {\r\n const key = this.toXYAndZ(input, this._scratchXYZ);\r\n const output = this._cache.get(key);\r\n result.push(output);\r\n if (!output) {\r\n if (!missing)\r\n missing = [];\r\n\r\n missing.push(input);\r\n }\r\n }\r\n\r\n return { result, missing };\r\n }\r\n}\r\n\r\n/** Response to a request to obtain imodel coordinates from cache.\r\n * @internal\r\n */\r\nexport interface CachedIModelCoordinatesResponseProps {\r\n /** An array of the same length as the input array, with undefined entries at indices corresponding to points not found in cache. */\r\n result: Array<PointWithStatus | undefined>;\r\n /** An array of points in the input array which were not found in the cache, or undefined if all points were found in the cache. */\r\n missing?: XYZProps[];\r\n}\r\n\r\n/** Options used to create a [[GeoConverter]].\r\n * @internal exported strictly for tests.\r\n */\r\nexport interface GeoConverterOptions {\r\n readonly datum: string;\r\n isIModelClosed: () => boolean;\r\n toIModelCoords: (request: IModelCoordinatesRequestProps) => Promise<PointWithStatus[]>;\r\n fromIModelCoords: (request: GeoCoordinatesRequestProps) => Promise<PointWithStatus[]>;\r\n}\r\n\r\n/** An object capable of communicating with the backend to convert between coordinates in a geographic coordinate system and coordinates in an [[IModelConnection]]'s own coordinate system.\r\n * @see [[GeoServices.getConverter]] to obtain a converter.\r\n * @see [GeographicCRS]($common) for more information about geographic coordinate reference systems.\r\n * @public\r\n */\r\nexport class GeoConverter {\r\n private readonly _geoToIModel: CoordinateConverter;\r\n private readonly _iModelToGeo: CoordinateConverter;\r\n /** Used for removing this converter from GeoServices' cache after all requests are completed.\r\n * @internal\r\n */\r\n public readonly onAllRequestsCompleted = new BeEvent<() => void>();\r\n\r\n /** @internal */\r\n constructor(opts: GeoConverterOptions) {\r\n const isIModelClosed = opts.isIModelClosed;\r\n this._geoToIModel = new CoordinateConverter({\r\n isIModelClosed,\r\n requestPoints: async (geoCoords: XYAndZ[]) => opts.toIModelCoords({ source: opts.datum, geoCoords }),\r\n });\r\n\r\n this._iModelToGeo = new CoordinateConverter({\r\n isIModelClosed,\r\n requestPoints: async (iModelCoords: XYAndZ[]) => opts.fromIModelCoords({ target: opts.datum, iModelCoords }),\r\n });\r\n }\r\n\r\n /** Convert the specified geographic coordinates into iModel coordinates. */\r\n public async convertToIModelCoords(geoPoints: XYZProps[]): Promise<PointWithStatus[]> {\r\n const result = await this.getIModelCoordinatesFromGeoCoordinates(geoPoints);\r\n return result.iModelCoords;\r\n }\r\n\r\n /** Convert the specified iModel coordinates into geographic coordinates. */\r\n public async convertFromIModelCoords(iModelCoords: XYZProps[]): Promise<PointWithStatus[]> {\r\n const result = await this.getGeoCoordinatesFromIModelCoordinates(iModelCoords);\r\n return result.geoCoords;\r\n }\r\n\r\n /** @internal */\r\n public async getIModelCoordinatesFromGeoCoordinates(geoPoints: XYZProps[]): Promise<IModelCoordinatesResponseProps> {\r\n const result = await this._geoToIModel.convert(geoPoints);\r\n this.checkCompletion();\r\n return {\r\n iModelCoords: result.points,\r\n fromCache: result.fromCache,\r\n };\r\n }\r\n\r\n /** @internal */\r\n public async getGeoCoordinatesFromIModelCoordinates(iModelPoints: XYZProps[]): Promise<GeoCoordinatesResponseProps> {\r\n const result = await this._iModelToGeo.convert(iModelPoints);\r\n this.checkCompletion();\r\n return {\r\n geoCoords: result.points,\r\n fromCache: result.fromCache,\r\n };\r\n }\r\n\r\n private checkCompletion(): void {\r\n if (this._geoToIModel.isIdle && this._iModelToGeo.isIdle)\r\n this.onAllRequestsCompleted.raiseEvent();\r\n }\r\n\r\n /** @internal */\r\n public getCachedIModelCoordinatesFromGeoCoordinates(geoPoints: XYZProps[]): CachedIModelCoordinatesResponseProps {\r\n return this._geoToIModel.findCached(geoPoints);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport type GeoServicesOptions = Omit<GeoConverterOptions, \"datum\">;\r\n\r\n/** The Geographic Services available for an [[IModelConnection]].\r\n * @see [[IModelConnection.geoServices]] to obtain the GeoServices for a specific iModel.\r\n * @public\r\n */\r\nexport class GeoServices {\r\n private readonly _options: GeoServicesOptions;\r\n /** Each GeoConverter has its own independent request queue and cache of previously-converted points.\r\n * Some callers like RealityTileTree obtain a single GeoConverter and reuse it throughout their own lifetime. Therefore they benefit from both batching and caching, and\r\n * the cache gets deleted once the RealityTileTree becomes disused.\r\n *\r\n * Other callers like IModelConnection.spatialToCartographic obtain a new GeoConverter every time they need one, use it to convert a single point(!), and then discard the converter.\r\n * This entirely prevents batching - e.g., calling spatialToCartographic 20 times in one frame results in 20 http requests.\r\n * To address that, we cache each GeoConverter returned by getConverter until it has converted at least one point and has no further outstanding conversion requests.\r\n * In this way, the converter lives for as long as (and no longer than) any caller is awaiting conversion to/from its datum - it and its cache are deleted once it becomes disused.\r\n * This makes the coordinate caching generally less useful, but at least bounded - and maximizes batching of requests.\r\n */\r\n private readonly _cache = new Map<string, GeoConverter>();\r\n\r\n /** @internal */\r\n public constructor(options: GeoServicesOptions) {\r\n this._options = options;\r\n }\r\n\r\n /** @internal */\r\n public static createForIModel(iModel: IModelConnection): GeoServices {\r\n return new GeoServices({\r\n isIModelClosed: () => iModel.isClosed,\r\n toIModelCoords: async (request) => {\r\n const rpc = IModelReadRpcInterface.getClientForRouting(iModel.routingContext.token);\r\n const response = await rpc.getIModelCoordinatesFromGeoCoordinates(iModel.getRpcProps(), request);\r\n return response.iModelCoords;\r\n },\r\n fromIModelCoords: async (request) => {\r\n const rpc = IModelReadRpcInterface.getClientForRouting(iModel.routingContext.token);\r\n const response = await rpc.getGeoCoordinatesFromIModelCoordinates(iModel.getRpcProps(), request);\r\n return response.geoCoords;\r\n },\r\n });\r\n }\r\n\r\n /** Obtain a converter that can convert between a geographic coordinate system and the iModel's own coordinate system.\r\n * @param datumOrGCRS The name or JSON representation of the geographic coordinate system datum - for example, \"WGS84\".\r\n * @returns a converter, or `undefined` if the iModel is not open.\r\n * @note A [[BlankConnection]] has no connection to a backend, so it is never \"open\"; therefore it always returns `undefined`.\r\n */\r\n public getConverter(datumOrGCRS?: string | GeographicCRSProps): GeoConverter | undefined {\r\n if (this._options.isIModelClosed())\r\n return undefined;\r\n\r\n const datum = (typeof datumOrGCRS === \"object\" ? JSON.stringify(datumOrGCRS) : datumOrGCRS) ?? \"\";\r\n\r\n let converter = this._cache.get(datum);\r\n if (!converter) {\r\n converter = new GeoConverter({ ...this._options, datum });\r\n this._cache.set(datum, converter);\r\n\r\n converter.onAllRequestsCompleted.addOnce(() => {\r\n if (converter === this._cache.get(datum))\r\n this._cache.delete(datum);\r\n });\r\n }\r\n\r\n return converter;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"GeoServices.js","sourceRoot":"","sources":["../../src/GeoServices.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,qBAAqB;AACrB,sDAE6B;AAE7B,oDAG4B;AAE5B,4EAAyE;AAazE,SAAS,aAAa,CAAC,GAAW,EAAE,GAAW;IAC7C,OAAO,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;AACzD,CAAC;AAED,SAAS,WAAW,CAAC,GAAW;IAC9B,OAAO,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;AAC1C,CAAC;AAUD;;;;;;;;;;;;GAYG;AACH,MAAa,mBAAmB;IACX,MAAM,CAAsC;IACrD,MAAM,GAA6B,MAAM,CAAC;IACpD,qEAAqE;IAC3D,QAAQ,CAAsB;IACxC,iFAAiF;IACvE,SAAS,CAAsB;IACzC,kDAAkD;IACxC,YAAY,GAAG,IAAI,sBAAO,EAAc,CAAC;IACnD,oGAAoG;IACjF,WAAW,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IACnC,oBAAoB,CAAS;IAC7B,eAAe,CAAgB;IAC/B,cAAc,CAAmD;IACpF,qFAAqF;IACrF,iIAAiI;IACjI,gGAAgG;IACtF,uBAAuB,GAAG,KAAK,CAAC;IAE1C,IAAW,MAAM;QACf,OAAO,MAAM,KAAK,IAAI,CAAC,MAAM,CAAC;IAChC,CAAC;IAES,QAAQ,CAAC,KAAe,EAAE,MAAsB;QACxD,IAAI,KAAK,CAAC,OAAO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,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;gBACpF,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,sCAAsC,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,OAAO,CAAC,CAAC;gBACjG,OAAO,QAAQ,CAAC,SAAS,CAAC;YAC5B,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACI,YAAY,CAAC,WAAyC;QAC3D,IAAI,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE;YAChC,OAAO,SAAS,CAAC;QAEnB,MAAM,KAAK,GAAG,CAAC,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QAElG,IAAI,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACvC,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,SAAS,GAAG,IAAI,YAAY,CAAC,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;YAC1D,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;YAElC,SAAS,CAAC,sBAAsB,CAAC,OAAO,CAAC,GAAG,EAAE;gBAC5C,IAAI,SAAS,KAAK,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC;oBACtC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC,CAAC,CAAC;QACL,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AA5DD,kCA4DC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module IModelConnection\r\n */\r\n\r\n// cspell:ignore GCRS\r\nimport {\r\n assert, BeEvent, Dictionary, Logger, SortedArray,\r\n} from \"@itwin/core-bentley\";\r\nimport { WritableXYAndZ, XYAndZ, XYZProps } from \"@itwin/core-geometry\";\r\nimport {\r\n GeoCoordinatesRequestProps, GeoCoordinatesResponseProps, GeoCoordStatus, GeographicCRSProps, IModelCoordinatesRequestProps, IModelCoordinatesResponseProps,\r\n IModelReadRpcInterface, PointWithStatus,\r\n} from \"@itwin/core-common\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\nimport { FrontendLoggerCategory } from \"./common/FrontendLoggerCategory\";\r\n\r\n/** Options used to create a [[CoordinateConverter]].\r\n * @internal exported strictly for tests.\r\n */\r\nexport interface CoordinateConverterOptions {\r\n isIModelClosed: () => boolean;\r\n /** Asynchronously convert each point. The resultant array should have the same number and order of points as the input. */\r\n requestPoints: (points: XYAndZ[]) => Promise<PointWithStatus[]>;\r\n /** Maximum number of points to include in each request. Default: 300. */\r\n maxPointsPerRequest?: number;\r\n}\r\n\r\nfunction compareXYAndZ(lhs: XYAndZ, rhs: XYAndZ): number {\r\n return lhs.x - rhs.x || lhs.y - rhs.y || lhs.z - rhs.z;\r\n}\r\n\r\nfunction cloneXYAndZ(xyz: XYAndZ): XYAndZ {\r\n return { x: xyz.x, y: xyz.y, z: xyz.z };\r\n}\r\n\r\ntype CoordinateConverterState =\r\n // No pending requests.\r\n \"idle\" |\r\n // We have scheduled a requestAnimationFrame to dispatch all pending requests.\r\n \"scheduled\" |\r\n // We have dispatched all requests that were pending at the most recent requestAnimationFrame callback.\r\n \"in-flight\";\r\n\r\n/** Performs conversion of coordinates from one coordinate system to another.\r\n * A [[GeoConverter]] has a pair of these for converting between iModel coordinates and geographic coordinates.\r\n * Uses a cache to avoid repeatedly requesting the same points, and a batching strategy to avoid making frequent small requests.\r\n * The cache stores every point that was ever converted by [[convert]]. It is currently permitted to grow to unbounded size.\r\n * The batching works as follows:\r\n * When a conversion is requested via [[convert]], if all the requested points are in the cache, they are returned immediately.\r\n * Otherwise, any points not in the cache and not in the current in-flight request (if any) are placed onto the queue of pending requests.\r\n * A pending request is scheduled if one hasn't already been scheduled, via requestAnimationFrame.\r\n * In the animation frame callback, the pending requests are split into batches of no more than options.maxPointsPerRequest and dispatched to the backend.\r\n * Once the response is received, the results are loaded into and returned from the cache.\r\n * If more calls to convert occurred while the request was in flight, another request is dispatched.\r\n * @internal exported strictly for tests.\r\n */\r\nexport class CoordinateConverter {\r\n protected readonly _cache: Dictionary<XYAndZ, PointWithStatus>;\r\n protected _state: CoordinateConverterState = \"idle\";\r\n // The accumulated set of points to be converted by the next request.\r\n protected _pending: SortedArray<XYAndZ>;\r\n // The set of points that were included in the current in-flight request, if any.\r\n protected _inflight: SortedArray<XYAndZ>;\r\n // An event fired when the next request completes.\r\n protected _onCompleted = new BeEvent<() => void>();\r\n // Used for creating cache keys (XYAndZ) from XYZProps without having to allocate temporary objects.\r\n protected readonly _scratchXYZ = { x: 0, y: 0, z: 0 };\r\n protected readonly _maxPointsPerRequest: number;\r\n protected readonly _isIModelClosed: () => boolean;\r\n protected readonly _requestPoints: (points: XYAndZ[]) => Promise<PointWithStatus[]>;\r\n // If true, [[dispatch]] will schedule another dispatch after it receives a response.\r\n // This is needed when all the points requested after the most recent dispatch were included in the currently-in-flight request -\r\n // _pending will be empty but new callers will be awaiting the results of the in-flight request.\r\n protected _redispatchOnCompletion = false;\r\n\r\n public get isIdle(): boolean {\r\n return \"idle\" === this._state;\r\n }\r\n\r\n protected toXYAndZ(input: XYZProps, output: WritableXYAndZ): XYAndZ {\r\n if (Array.isArray(input)) {\r\n output.x = input[0] ?? 0;\r\n output.y = input[1] ?? 0;\r\n output.z = input[2] ?? 0;\r\n } else {\r\n output.x = input.x ?? 0;\r\n output.y = input.y ?? 0;\r\n output.z = input.z ?? 0;\r\n }\r\n\r\n return output;\r\n }\r\n\r\n public constructor(opts: CoordinateConverterOptions) {\r\n this._maxPointsPerRequest = Math.max(1, opts.maxPointsPerRequest ?? 300);\r\n this._isIModelClosed = opts.isIModelClosed;\r\n this._requestPoints = opts.requestPoints;\r\n\r\n this._cache = new Dictionary<XYAndZ, PointWithStatus>(compareXYAndZ, cloneXYAndZ);\r\n this._pending = new SortedArray<XYAndZ>(compareXYAndZ, false, cloneXYAndZ);\r\n this._inflight = new SortedArray<XYAndZ>(compareXYAndZ, false, cloneXYAndZ);\r\n }\r\n\r\n protected async dispatch(): Promise<void> {\r\n assert(this._state === \"scheduled\");\r\n if (this._isIModelClosed() || this._pending.isEmpty) {\r\n this._state = \"idle\";\r\n this._onCompleted.raiseEvent();\r\n return;\r\n }\r\n\r\n this._state = \"in-flight\";\r\n\r\n // Ensure subsequently-enqueued requests listen for the *next* response to be received.\r\n const onCompleted = this._onCompleted;\r\n this._onCompleted = new BeEvent<() => void>();\r\n\r\n // Pending requests are now in flight. Start a new list of pending requests. It's cheaper to swap than to allocate new objects.\r\n const inflight = this._pending;\r\n this._pending = this._inflight;\r\n assert(this._pending.isEmpty);\r\n this._inflight = inflight;\r\n\r\n // Split requests if necessary to avoid requesting more than the maximum allowed number of points.\r\n const promises: Array<Promise<void>> = [];\r\n for (let i = 0; i < inflight.length; i += this._maxPointsPerRequest) {\r\n const requests = inflight.slice(i, i + this._maxPointsPerRequest).extractArray();\r\n const promise = this._requestPoints(requests).then((results) => {\r\n if (this._isIModelClosed())\r\n return;\r\n\r\n if (results.length !== requests.length)\r\n Logger.logError(`${FrontendLoggerCategory.Package}.geoservices`, `requested conversion of ${requests.length} points, but received ${results.length} points`);\r\n\r\n for (let j = 0; j < results.length; j++) {\r\n if (j < requests.length)\r\n this._cache.set(requests[j], results[j]);\r\n }\r\n }).catch((err) => {\r\n Logger.logError(`${FrontendLoggerCategory.Package}.geoservices`, err);\r\n });\r\n\r\n promises.push(promise);\r\n }\r\n\r\n await Promise.all(promises);\r\n\r\n assert(this._state === \"in-flight\");\r\n this._state = \"idle\";\r\n this._inflight.clear();\r\n\r\n // If any more pending conversions arrived while awaiting this request, schedule another request.\r\n if (!this._pending.isEmpty || this._redispatchOnCompletion) {\r\n this._redispatchOnCompletion = false;\r\n this.scheduleDispatch(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n }\r\n\r\n // Resolve promises of all callers who were awaiting this request.\r\n onCompleted.raiseEvent();\r\n }\r\n\r\n // Add any points not present in cache to pending request list.\r\n // Return the number of points present in cache.\r\n protected enqueue(points: XYZProps[]): number {\r\n let numInCache = 0;\r\n for (const point of points) {\r\n const xyz = this.toXYAndZ(point, this._scratchXYZ);\r\n if (this._cache.get(xyz))\r\n ++numInCache;\r\n else if (this._inflight.contains(xyz))\r\n this._redispatchOnCompletion = true;\r\n else\r\n this._pending.insert(xyz);\r\n }\r\n\r\n return numInCache;\r\n }\r\n\r\n // Obtain converted points from the cache. The assumption is that every point in `inputs` is already present in the cache.\r\n // Any point not present will be returned unconverted with an error status.\r\n protected getFromCache(inputs: XYZProps[]): PointWithStatus[] {\r\n const outputs: PointWithStatus[] = [];\r\n for (const input of inputs) {\r\n const xyz = this.toXYAndZ(input, this._scratchXYZ);\r\n let output = this._cache.get(xyz);\r\n if (!output)\r\n output = { p: { ...xyz }, s: GeoCoordStatus.CSMapError };\r\n\r\n outputs.push(output);\r\n }\r\n\r\n return outputs;\r\n }\r\n\r\n protected async scheduleDispatch(): Promise<void> {\r\n if (\"idle\" === this._state) {\r\n this._state = \"scheduled\";\r\n requestAnimationFrame(() => {\r\n this.dispatch(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n });\r\n }\r\n\r\n return new Promise((resolve) => {\r\n this._onCompleted.addOnce(() => resolve());\r\n });\r\n }\r\n\r\n public async convert(inputs: XYZProps[]): Promise<{ points: PointWithStatus[], fromCache: number }> {\r\n const fromCache = this.enqueue(inputs);\r\n assert(fromCache >= 0);\r\n assert(fromCache <= inputs.length);\r\n\r\n if (fromCache === inputs.length)\r\n return { points: this.getFromCache(inputs), fromCache };\r\n\r\n await this.scheduleDispatch();\r\n\r\n return { points: this.getFromCache(inputs), fromCache };\r\n }\r\n\r\n public findCached(inputs: XYZProps[]): CachedIModelCoordinatesResponseProps {\r\n const result: Array<PointWithStatus | undefined> = [];\r\n let missing: XYZProps[] | undefined;\r\n for (const input of inputs) {\r\n const key = this.toXYAndZ(input, this._scratchXYZ);\r\n const output = this._cache.get(key);\r\n result.push(output);\r\n if (!output) {\r\n if (!missing)\r\n missing = [];\r\n\r\n missing.push(input);\r\n }\r\n }\r\n\r\n return { result, missing };\r\n }\r\n}\r\n\r\n/** Response to a request to obtain imodel coordinates from cache.\r\n * @internal\r\n */\r\nexport interface CachedIModelCoordinatesResponseProps {\r\n /** An array of the same length as the input array, with undefined entries at indices corresponding to points not found in cache. */\r\n result: Array<PointWithStatus | undefined>;\r\n /** An array of points in the input array which were not found in the cache, or undefined if all points were found in the cache. */\r\n missing?: XYZProps[];\r\n}\r\n\r\n/** Options used to create a [[GeoConverter]].\r\n * @internal exported strictly for tests.\r\n */\r\nexport interface GeoConverterOptions {\r\n readonly datum: string;\r\n isIModelClosed: () => boolean;\r\n toIModelCoords: (request: IModelCoordinatesRequestProps) => Promise<PointWithStatus[]>;\r\n fromIModelCoords: (request: GeoCoordinatesRequestProps) => Promise<PointWithStatus[]>;\r\n}\r\n\r\n/** An object capable of communicating with the backend to convert between coordinates in a geographic coordinate system and coordinates in an [[IModelConnection]]'s own coordinate system.\r\n * @see [[GeoServices.getConverter]] to obtain a converter.\r\n * @see [GeographicCRS]($common) for more information about geographic coordinate reference systems.\r\n * @public\r\n */\r\nexport class GeoConverter {\r\n private readonly _geoToIModel: CoordinateConverter;\r\n private readonly _iModelToGeo: CoordinateConverter;\r\n /** Used for removing this converter from GeoServices' cache after all requests are completed.\r\n * @internal\r\n */\r\n public readonly onAllRequestsCompleted = new BeEvent<() => void>();\r\n\r\n /** @internal */\r\n constructor(opts: GeoConverterOptions) {\r\n const isIModelClosed = opts.isIModelClosed;\r\n this._geoToIModel = new CoordinateConverter({\r\n isIModelClosed,\r\n requestPoints: async (geoCoords: XYAndZ[]) => opts.toIModelCoords({ source: opts.datum, geoCoords }),\r\n });\r\n\r\n this._iModelToGeo = new CoordinateConverter({\r\n isIModelClosed,\r\n requestPoints: async (iModelCoords: XYAndZ[]) => opts.fromIModelCoords({ target: opts.datum, iModelCoords }),\r\n });\r\n }\r\n\r\n /** Convert the specified geographic coordinates into iModel coordinates. */\r\n public async convertToIModelCoords(geoPoints: XYZProps[]): Promise<PointWithStatus[]> {\r\n const result = await this.getIModelCoordinatesFromGeoCoordinates(geoPoints);\r\n return result.iModelCoords;\r\n }\r\n\r\n /** Convert the specified iModel coordinates into geographic coordinates. */\r\n public async convertFromIModelCoords(iModelCoords: XYZProps[]): Promise<PointWithStatus[]> {\r\n const result = await this.getGeoCoordinatesFromIModelCoordinates(iModelCoords);\r\n return result.geoCoords;\r\n }\r\n\r\n /** @internal */\r\n public async getIModelCoordinatesFromGeoCoordinates(geoPoints: XYZProps[]): Promise<IModelCoordinatesResponseProps> {\r\n const result = await this._geoToIModel.convert(geoPoints);\r\n this.checkCompletion();\r\n return {\r\n iModelCoords: result.points,\r\n fromCache: result.fromCache,\r\n };\r\n }\r\n\r\n /** @internal */\r\n public async getGeoCoordinatesFromIModelCoordinates(iModelPoints: XYZProps[]): Promise<GeoCoordinatesResponseProps> {\r\n const result = await this._iModelToGeo.convert(iModelPoints);\r\n this.checkCompletion();\r\n return {\r\n geoCoords: result.points,\r\n fromCache: result.fromCache,\r\n };\r\n }\r\n\r\n private checkCompletion(): void {\r\n if (this._geoToIModel.isIdle && this._iModelToGeo.isIdle)\r\n this.onAllRequestsCompleted.raiseEvent();\r\n }\r\n\r\n /** @internal */\r\n public getCachedIModelCoordinatesFromGeoCoordinates(geoPoints: XYZProps[]): CachedIModelCoordinatesResponseProps {\r\n return this._geoToIModel.findCached(geoPoints);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport type GeoServicesOptions = Omit<GeoConverterOptions, \"datum\">;\r\n\r\n/** The Geographic Services available for an [[IModelConnection]].\r\n * @see [[IModelConnection.geoServices]] to obtain the GeoServices for a specific iModel.\r\n * @public\r\n */\r\nexport class GeoServices {\r\n private readonly _options: GeoServicesOptions;\r\n /** Each GeoConverter has its own independent request queue and cache of previously-converted points.\r\n * Some callers like RealityTileTree obtain a single GeoConverter and reuse it throughout their own lifetime. Therefore they benefit from both batching and caching, and\r\n * the cache gets deleted once the RealityTileTree becomes disused.\r\n *\r\n * Other callers like IModelConnection.spatialToCartographic obtain a new GeoConverter every time they need one, use it to convert a single point(!), and then discard the converter.\r\n * This entirely prevents batching - e.g., calling spatialToCartographic 20 times in one frame results in 20 http requests.\r\n * To address that, we cache each GeoConverter returned by getConverter until it has converted at least one point and has no further outstanding conversion requests.\r\n * In this way, the converter lives for as long as (and no longer than) any caller is awaiting conversion to/from its datum - it and its cache are deleted once it becomes disused.\r\n * This makes the coordinate caching generally less useful, but at least bounded - and maximizes batching of requests.\r\n */\r\n private readonly _cache = new Map<string, GeoConverter>();\r\n\r\n /** @internal */\r\n public constructor(options: GeoServicesOptions) {\r\n this._options = options;\r\n }\r\n\r\n /** @internal */\r\n public static createForIModel(iModel: IModelConnection): GeoServices {\r\n return new GeoServices({\r\n isIModelClosed: () => iModel.isClosed,\r\n toIModelCoords: async (request) => {\r\n const rpc = IModelReadRpcInterface.getClientForRouting(iModel.routingContext.token);\r\n const response = await rpc.getIModelCoordinatesFromGeoCoordinates(iModel.getRpcProps(), request);\r\n return response.iModelCoords;\r\n },\r\n fromIModelCoords: async (request) => {\r\n const rpc = IModelReadRpcInterface.getClientForRouting(iModel.routingContext.token);\r\n const response = await rpc.getGeoCoordinatesFromIModelCoordinates(iModel.getRpcProps(), request);\r\n return response.geoCoords;\r\n },\r\n });\r\n }\r\n\r\n /** Obtain a converter that can convert between a geographic coordinate system and the iModel's own coordinate system.\r\n * @param datumOrGCRS The name or JSON representation of the geographic coordinate system datum - for example, \"WGS84\".\r\n * @returns a converter, or `undefined` if the iModel is not open.\r\n * @note A [[BlankConnection]] has no connection to a backend, so it is never \"open\"; therefore it always returns `undefined`.\r\n */\r\n public getConverter(datumOrGCRS?: string | GeographicCRSProps): GeoConverter | undefined {\r\n if (this._options.isIModelClosed())\r\n return undefined;\r\n\r\n const datum = (typeof datumOrGCRS === \"object\" ? JSON.stringify(datumOrGCRS) : datumOrGCRS) ?? \"\";\r\n\r\n let converter = this._cache.get(datum);\r\n if (!converter) {\r\n converter = new GeoConverter({ ...this._options, datum });\r\n this._cache.set(datum, converter);\r\n\r\n converter.onAllRequestsCompleted.addOnce(() => {\r\n if (converter === this._cache.get(datum))\r\n this._cache.delete(datum);\r\n });\r\n }\r\n\r\n return converter;\r\n }\r\n}\r\n"]}
@@ -390,8 +390,6 @@ export declare namespace IModelConnection {
390
390
  /** The collection of loaded ModelState objects for an [[IModelConnection]]. */
391
391
  class Models implements Iterable<ModelState> {
392
392
  private _iModel;
393
- private readonly _modelExtentsQuery;
394
- private readonly _modelExistenceQuery;
395
393
  private _loadedExtents;
396
394
  private _geometryChangedListener?;
397
395
  private _loaded;
@@ -1 +1 @@
1
- {"version":3,"file":"IModelConnection.d.ts","sourceRoot":"","sources":["../../src/IModelConnection.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EACG,OAAO,EAAE,iBAAiB,EAAmC,UAAU,EAAQ,OAAO,EAAE,OAAO,EAAE,UAAU,EACnH,gBAAgB,EAAE,mBAAmB,EACtC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,YAAY,EAAE,SAAS,EAAiB,QAAQ,EAAoD,iBAAiB,EAAE,WAAW,EAAE,kBAAkB,EAAE,uBAAuB,EAC/K,YAAY,EAAE,iBAAiB,EAAE,OAAO,EAAkB,kBAAkB,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,2BAA2B,EAAE,MAAM,EAAE,qBAAqB,EAC5J,sCAAsC,EAAE,uCAAuC,EAC9H,0BAA0B,EAAE,2BAA2B,EAAE,iBAAiB,EAA0B,UAAU,EAAE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ACH,MAAa,UAAU;QACrB,gBAAgB;QAChB,SAAgB,KAAK,EAAE,kBAAkB,CAAC;QAE1C,gBAAgB;oBACG,MAAM,EAAE,gBAAgB;QAI3C,mEAAmE;QACtD,eAAe,CAAC,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;QAIlH,sHAAsH;QACzG,kBAAkB,CAAC,IAAI,EAAE;YACpC,QAAQ,EAAE,UAAU,CAAC;YACrB,aAAa,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;SACrC,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC;KAGzD;CACF"}
@@ -634,72 +634,7 @@ exports.SnapshotConnection = SnapshotConnection;
634
634
  /** The collection of loaded ModelState objects for an [[IModelConnection]]. */
635
635
  class Models {
636
636
  _iModel;
637
- _modelExtentsQuery = `
638
- SELECT
639
- Model.Id AS ECInstanceId,
640
- iModel_bbox_union(
641
- iModel_placement_aabb(
642
- iModel_placement(
643
- iModel_point(Origin.X, Origin.Y, 0),
644
- iModel_angles(Rotation, 0, 0),
645
- iModel_bbox(
646
- BBoxLow.X, BBoxLow.Y, -1,
647
- BBoxHigh.X, BBoxHigh.Y, 1
648
- )
649
- )
650
- )
651
- ) AS bbox
652
- FROM bis.GeometricElement2d
653
- WHERE InVirtualSet(:ids64, Model.Id) AND Origin.X IS NOT NULL
654
- GROUP BY Model.Id
655
- UNION
656
- SELECT
657
- ge.Model.Id AS ECInstanceId,
658
- iModel_bbox(
659
- min(i.MinX), min(i.MinY), min(i.MinZ),
660
- max(i.MaxX), max(i.MaxY), max(i.MaxZ)
661
- ) AS bbox
662
- FROM bis.SpatialIndex AS i, bis.GeometricElement3d AS ge, bis.GeometricModel3d AS gm
663
- WHERE InVirtualSet(:ids64, ge.Model.Id) AND ge.ECInstanceId=i.ECInstanceId AND InVirtualSet(:ids64, gm.ECInstanceId) AND (gm.$->isNotSpatiallyLocated?=false OR gm.$->isNotSpatiallyLocated? IS NULL)
664
- GROUP BY ge.Model.Id
665
- UNION
666
- SELECT
667
- ge.Model.Id AS ECInstanceId,
668
- iModel_bbox_union(
669
- iModel_placement_aabb(
670
- iModel_placement(
671
- iModel_point(ge.Origin.X, ge.Origin.Y, ge.Origin.Z),
672
- iModel_angles(ge.Yaw, ge.Pitch, ge.Roll),
673
- iModel_bbox(
674
- ge.BBoxLow.X, ge.BBoxLow.Y, ge.BBoxLow.Z,
675
- ge.BBoxHigh.X, ge.BBoxHigh.Y, ge.BBoxHigh.Z
676
- )
677
- )
678
- )
679
- ) AS bbox
680
- FROM bis.GeometricElement3d AS ge, bis.GeometricModel3d as gm
681
- WHERE InVirtualSet(:ids64, ge.Model.Id) AND ge.Origin.X IS NOT NULL AND InVirtualSet(:ids64, gm.ECInstanceId) AND gm.$->isNotSpatiallyLocated?=true
682
- GROUP BY ge.Model.Id`;
683
- _modelExistenceQuery = `
684
- WITH
685
- GeometricModels AS(
686
- SELECT
687
- ECInstanceId
688
- FROM bis.GeometricModel
689
- WHERE InVirtualSet(: ids64, ECInstanceId)
690
- )
691
- SELECT
692
- ECInstanceId,
693
- true AS isGeometricModel
694
- FROM GeometricModels
695
- UNION ALL
696
- SELECT
697
- ECInstanceId,
698
- false AS isGeometricModel
699
- FROM bis.Model
700
- WHERE InVirtualSet(: ids64, ECInstanceId)
701
- AND ECInstanceId NOT IN(SELECT ECInstanceId FROM GeometricModels)`;
702
- _loadedExtents = [];
637
+ _loadedExtents = new Map();
703
638
  _geometryChangedListener;
704
639
  _loaded = new Map();
705
640
  /** @internal */
@@ -714,7 +649,9 @@ exports.SnapshotConnection = SnapshotConnection;
714
649
  IModelConnection.onOpen.addListener(() => {
715
650
  if (this._iModel.isBriefcaseConnection()) {
716
651
  this._geometryChangedListener = (changes) => {
717
- this._loadedExtents = this._loadedExtents.filter((extent) => !changes.some((change) => change.id === extent.id));
652
+ changes.forEach((change) => {
653
+ this._loadedExtents.delete(change.id);
654
+ });
718
655
  };
719
656
  this._iModel.txns.onModelGeometryChanged.addListener(this._geometryChangedListener);
720
657
  }
@@ -818,64 +755,132 @@ exports.SnapshotConnection = SnapshotConnection;
818
755
  return [];
819
756
  if (typeof modelIds === "string")
820
757
  modelIds = [modelIds];
821
- const modelExtents = [];
758
+ const resolvedExtents = new Map();
759
+ const uncachedModelIds = [];
760
+ // Add the cached model ids and the invalid ids
822
761
  for (const modelId of modelIds) {
823
- if (!core_bentley_1.Id64.isValidId64(modelId)) {
824
- modelExtents.push({ id: modelId, extents: core_geometry_1.Range3d.createNull(), status: core_bentley_1.IModelStatus.InvalidId });
762
+ if (this._loadedExtents.has(modelId)) {
763
+ resolvedExtents.set(modelId, this._loadedExtents.get(modelId));
825
764
  }
826
- }
827
- const getUnloadedModelIds = () => modelIds.filter((modelId) => !modelExtents.some((loadedExtent) => loadedExtent.id === modelId));
828
- let remainingModelIds = getUnloadedModelIds();
829
- for (const modelId of remainingModelIds) {
830
- const modelExtent = this._loadedExtents.find((extent) => modelId === extent.id);
831
- if (modelExtent) {
832
- modelExtents.push(modelExtent);
765
+ else if (!core_bentley_1.Id64.isValidId64(modelId)) {
766
+ resolvedExtents.set(modelId, { id: modelId, extents: core_geometry_1.Range3d.createNull(), status: core_bentley_1.IModelStatus.InvalidId });
767
+ }
768
+ else {
769
+ uncachedModelIds.push(modelId);
833
770
  }
834
771
  }
835
- remainingModelIds = getUnloadedModelIds();
836
- if (remainingModelIds.length > 0) {
837
- const params = new core_common_1.QueryBinder();
838
- params.bindIdSet("ids64", remainingModelIds);
839
- const extentsQueryReader = this._iModel.createQueryReader(this._modelExtentsQuery, params, {
772
+ // Run the ECSql to get uncached model extents
773
+ if (uncachedModelIds.length > 0) {
774
+ const modelList = uncachedModelIds.join(",");
775
+ const useSingleModelQuery = uncachedModelIds.length === 1;
776
+ const modelExtentsQuery = `
777
+ SELECT
778
+ Model.Id AS ECInstanceId,
779
+ iModel_bbox_union(
780
+ iModel_placement_aabb(
781
+ iModel_placement(
782
+ iModel_point(Origin.X, Origin.Y, 0),
783
+ iModel_angles(Rotation, 0, 0),
784
+ iModel_bbox(
785
+ BBoxLow.X, BBoxLow.Y, -1,
786
+ BBoxHigh.X, BBoxHigh.Y, 1
787
+ )
788
+ )
789
+ )
790
+ ) AS bbox
791
+ FROM bis.GeometricElement2d
792
+ WHERE Model.Id ${useSingleModelQuery ? `= ${uncachedModelIds[0]}` : `IN (${modelList})`}
793
+ AND Origin.X IS NOT NULL
794
+ GROUP BY Model.Id
795
+
796
+ UNION
797
+
798
+ SELECT
799
+ ge.Model.Id AS ECInstanceId,
800
+ iModel_bbox(
801
+ min(i.MinX), min(i.MinY), min(i.MinZ),
802
+ max(i.MaxX), max(i.MaxY), max(i.MaxZ)
803
+ ) AS bbox
804
+ FROM bis.SpatialIndex AS i
805
+ INNER JOIN bis.GeometricElement3d AS ge
806
+ ON ge.ECInstanceId = i.ECInstanceId
807
+ INNER JOIN bis.GeometricModel3d AS gm
808
+ ON ge.Model.Id = gm.ECInstanceId
809
+ WHERE ge.Model.Id ${useSingleModelQuery ? `= ${uncachedModelIds[0]}` : `IN (${modelList})`}
810
+ AND (gm.$->IsNotSpatiallyLocated? IS NULL OR gm.$->IsNotSpatiallyLocated? IS FALSE)
811
+ GROUP BY ge.Model.Id
812
+
813
+ UNION
814
+
815
+ SELECT
816
+ ge.Model.Id AS ECInstanceId,
817
+ iModel_bbox_union(
818
+ iModel_placement_aabb(
819
+ iModel_placement(
820
+ iModel_point(ge.Origin.X, ge.Origin.Y, ge.Origin.Z),
821
+ iModel_angles(ge.Yaw, ge.Pitch, ge.Roll),
822
+ iModel_bbox(
823
+ ge.BBoxLow.X, ge.BBoxLow.Y, ge.BBoxLow.Z,
824
+ ge.BBoxHigh.X, ge.BBoxHigh.Y, ge.BBoxHigh.Z
825
+ )
826
+ )
827
+ )
828
+ ) AS bbox
829
+ FROM bis.GeometricElement3d ge
830
+ INNER JOIN bis.GeometricModel3d gm
831
+ ON ge.Model.Id = gm.ECInstanceId
832
+ WHERE ge.Model.Id ${useSingleModelQuery ? `= ${uncachedModelIds[0]}` : `IN (${modelList})`}
833
+ AND gm.$->IsNotSpatiallyLocated? IS TRUE
834
+ AND ge.Origin.X IS NOT NULL
835
+ GROUP BY ge.Model.Id
836
+ `;
837
+ const extentsQueryReader = this._iModel.createQueryReader(modelExtentsQuery, undefined, {
840
838
  rowFormat: core_common_1.QueryRowFormat.UseECSqlPropertyNames,
841
839
  });
842
840
  for await (const row of extentsQueryReader) {
843
841
  const byteArray = new Uint8Array(Object.values(row.bbox));
844
842
  const extents = core_geometry_1.Range3d.fromArrayBuffer(byteArray.buffer);
845
843
  const extent = { id: row.ECInstanceId, extents, status: core_bentley_1.IModelStatus.Success };
846
- modelExtents.push(extent);
847
- this._loadedExtents.push(extent);
844
+ resolvedExtents.set(extent.id, extent);
845
+ this._loadedExtents.set(extent.id, extent);
848
846
  }
849
847
  }
850
- remainingModelIds = getUnloadedModelIds();
851
- if (remainingModelIds.length > 0) {
852
- const params = new core_common_1.QueryBinder();
853
- params.bindIdSet("ids64", remainingModelIds);
854
- const modelExistenceQueryReader = this._iModel.createQueryReader(this._modelExistenceQuery, params, {
848
+ // Check if there still are any unresolved model IDs
849
+ const unresolvedModelIds = uncachedModelIds.filter((id) => !resolvedExtents.has(id));
850
+ if (unresolvedModelIds.length > 0) {
851
+ const modelList = unresolvedModelIds.join(",");
852
+ const modelExistenceQuery = `
853
+ SELECT
854
+ m.ECInstanceId,
855
+ CASE WHEN g.ECInstanceId IS NOT NULL THEN 1 ELSE 0 END AS isGeometricModel
856
+ FROM bis.Model m
857
+ LEFT JOIN bis.GeometricModel g
858
+ ON m.ECInstanceId = g.ECInstanceId
859
+ WHERE m.ECInstanceId ${unresolvedModelIds.length === 1 ? `= ${unresolvedModelIds[0]}` : `IN (${modelList})`}
860
+ `;
861
+ const modelExistenceQueryReader = this._iModel.createQueryReader(modelExistenceQuery, undefined, {
855
862
  rowFormat: core_common_1.QueryRowFormat.UseECSqlPropertyNames,
856
863
  });
857
864
  for await (const row of modelExistenceQueryReader) {
858
- let extent;
859
- if (row.isGeometricModel) {
860
- extent = { id: row.ECInstanceId, extents: core_geometry_1.Range3d.createNull(), status: core_bentley_1.IModelStatus.Success };
861
- }
862
- else {
863
- extent = { id: row.ECInstanceId, extents: core_geometry_1.Range3d.createNull(), status: core_bentley_1.IModelStatus.WrongModel };
864
- }
865
- modelExtents.push(extent);
866
- this._loadedExtents.push(extent);
865
+ const extent = {
866
+ id: row.ECInstanceId,
867
+ extents: core_geometry_1.Range3d.createNull(),
868
+ status: row.isGeometricModel ? core_bentley_1.IModelStatus.Success : core_bentley_1.IModelStatus.WrongModel,
869
+ };
870
+ resolvedExtents.set(extent.id, extent);
871
+ this._loadedExtents.set(extent.id, extent);
867
872
  }
868
873
  }
874
+ // Return the results while maintaining the same order
869
875
  return modelIds.map((modelId) => {
870
- let extent = modelExtents.find((loadedExtent) => loadedExtent.id === modelId);
876
+ const extent = resolvedExtents.get(modelId);
871
877
  if (extent === undefined) {
872
- extent = { id: modelId, extents: core_geometry_1.Range3d.createNull(), status: core_bentley_1.IModelStatus.NotFound };
873
- this._loadedExtents.push(extent);
874
- return extent;
878
+ const notFound = { id: modelId, extents: core_geometry_1.Range3d.createNull(), status: core_bentley_1.IModelStatus.NotFound };
879
+ this._loadedExtents.set(notFound.id, notFound);
880
+ return notFound;
875
881
  }
876
- else if (extent.status === core_bentley_1.IModelStatus.InvalidId) {
877
- extent.id = "0";
878
- return extent;
882
+ if (extent.status === core_bentley_1.IModelStatus.InvalidId) {
883
+ return { ...extent, id: "0" };
879
884
  }
880
885
  return extent;
881
886
  });