@itwin/core-frontend 4.8.0-dev.3 → 4.8.0-dev.32

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 (296) hide show
  1. package/CHANGELOG.md +57 -1
  2. package/ThirdPartyNotices.md +3 -3
  3. package/lib/cjs/AccuSnap.d.ts.map +1 -1
  4. package/lib/cjs/AccuSnap.js +4 -1
  5. package/lib/cjs/AccuSnap.js.map +1 -1
  6. package/lib/cjs/IModelApp.d.ts +2 -3
  7. package/lib/cjs/IModelApp.d.ts.map +1 -1
  8. package/lib/cjs/IModelApp.js +2 -2
  9. package/lib/cjs/IModelApp.js.map +1 -1
  10. package/lib/cjs/IModelConnection.d.ts +16 -6
  11. package/lib/cjs/IModelConnection.d.ts.map +1 -1
  12. package/lib/cjs/IModelConnection.js +21 -7
  13. package/lib/cjs/IModelConnection.js.map +1 -1
  14. package/lib/cjs/IpcApp.d.ts +5 -1
  15. package/lib/cjs/IpcApp.d.ts.map +1 -1
  16. package/lib/cjs/IpcApp.js +11 -5
  17. package/lib/cjs/IpcApp.js.map +1 -1
  18. package/lib/cjs/LocalhostIpcApp.d.ts.map +1 -1
  19. package/lib/cjs/LocalhostIpcApp.js +2 -1
  20. package/lib/cjs/LocalhostIpcApp.js.map +1 -1
  21. package/lib/cjs/NativeApp.d.ts.map +1 -1
  22. package/lib/cjs/NativeApp.js +2 -1
  23. package/lib/cjs/NativeApp.js.map +1 -1
  24. package/lib/cjs/PlanarClipMaskState.d.ts +8 -3
  25. package/lib/cjs/PlanarClipMaskState.d.ts.map +1 -1
  26. package/lib/cjs/PlanarClipMaskState.js +47 -17
  27. package/lib/cjs/PlanarClipMaskState.js.map +1 -1
  28. package/lib/cjs/RealityDataSourceTilesetUrlImpl.d.ts +3 -0
  29. package/lib/cjs/RealityDataSourceTilesetUrlImpl.d.ts.map +1 -1
  30. package/lib/cjs/RealityDataSourceTilesetUrlImpl.js +15 -4
  31. package/lib/cjs/RealityDataSourceTilesetUrlImpl.js.map +1 -1
  32. package/lib/cjs/SpatialViewState.d.ts +14 -1
  33. package/lib/cjs/SpatialViewState.d.ts.map +1 -1
  34. package/lib/cjs/SpatialViewState.js +17 -0
  35. package/lib/cjs/SpatialViewState.js.map +1 -1
  36. package/lib/cjs/SubCategoriesCache.d.ts +3 -1
  37. package/lib/cjs/SubCategoriesCache.d.ts.map +1 -1
  38. package/lib/cjs/SubCategoriesCache.js +19 -5
  39. package/lib/cjs/SubCategoriesCache.js.map +1 -1
  40. package/lib/cjs/ViewCreator3d.d.ts.map +1 -1
  41. package/lib/cjs/ViewCreator3d.js +1 -0
  42. package/lib/cjs/ViewCreator3d.js.map +1 -1
  43. package/lib/cjs/ViewManager.d.ts +4 -7
  44. package/lib/cjs/ViewManager.d.ts.map +1 -1
  45. package/lib/cjs/ViewManager.js +4 -7
  46. package/lib/cjs/ViewManager.js.map +1 -1
  47. package/lib/cjs/ViewingSpace.d.ts +3 -1
  48. package/lib/cjs/ViewingSpace.d.ts.map +1 -1
  49. package/lib/cjs/ViewingSpace.js +11 -2
  50. package/lib/cjs/ViewingSpace.js.map +1 -1
  51. package/lib/cjs/common/gltf/GltfSchema.d.ts +15 -1
  52. package/lib/cjs/common/gltf/GltfSchema.d.ts.map +1 -1
  53. package/lib/cjs/common/gltf/GltfSchema.js.map +1 -1
  54. package/lib/cjs/core-frontend.d.ts +1 -0
  55. package/lib/cjs/core-frontend.d.ts.map +1 -1
  56. package/lib/cjs/core-frontend.js +1 -0
  57. package/lib/cjs/core-frontend.js.map +1 -1
  58. package/lib/cjs/internal/Symbols.d.ts +7 -0
  59. package/lib/cjs/internal/Symbols.d.ts.map +1 -0
  60. package/lib/cjs/internal/Symbols.js +17 -0
  61. package/lib/cjs/internal/Symbols.js.map +1 -0
  62. package/lib/cjs/internal/cross-package.d.ts +5 -0
  63. package/lib/cjs/internal/cross-package.d.ts.map +1 -0
  64. package/lib/cjs/internal/cross-package.js +13 -0
  65. package/lib/cjs/internal/cross-package.js.map +1 -0
  66. package/lib/cjs/render/FeatureSymbology.js +3 -3
  67. package/lib/cjs/render/FeatureSymbology.js.map +1 -1
  68. package/lib/cjs/render/GraphicBuilder.d.ts +4 -0
  69. package/lib/cjs/render/GraphicBuilder.d.ts.map +1 -1
  70. package/lib/cjs/render/GraphicBuilder.js +49 -0
  71. package/lib/cjs/render/GraphicBuilder.js.map +1 -1
  72. package/lib/cjs/render/RenderTarget.d.ts +1 -0
  73. package/lib/cjs/render/RenderTarget.d.ts.map +1 -1
  74. package/lib/cjs/render/RenderTarget.js.map +1 -1
  75. package/lib/cjs/render/webgl/BackgroundMapDrape.js +1 -1
  76. package/lib/cjs/render/webgl/BackgroundMapDrape.js.map +1 -1
  77. package/lib/cjs/render/webgl/PlanarClassifier.d.ts +2 -0
  78. package/lib/cjs/render/webgl/PlanarClassifier.d.ts.map +1 -1
  79. package/lib/cjs/render/webgl/PlanarClassifier.js +38 -11
  80. package/lib/cjs/render/webgl/PlanarClassifier.js.map +1 -1
  81. package/lib/cjs/render/webgl/PlanarTextureProjection.d.ts +3 -3
  82. package/lib/cjs/render/webgl/PlanarTextureProjection.d.ts.map +1 -1
  83. package/lib/cjs/render/webgl/PlanarTextureProjection.js +53 -19
  84. package/lib/cjs/render/webgl/PlanarTextureProjection.js.map +1 -1
  85. package/lib/cjs/render/webgl/SolarShadowMap.js +2 -2
  86. package/lib/cjs/render/webgl/SolarShadowMap.js.map +1 -1
  87. package/lib/cjs/render/webgl/Target.d.ts +1 -0
  88. package/lib/cjs/render/webgl/Target.d.ts.map +1 -1
  89. package/lib/cjs/render/webgl/Target.js +1 -0
  90. package/lib/cjs/render/webgl/Target.js.map +1 -1
  91. package/lib/cjs/render/webgl/glsl/AmbientOcclusion.js.map +1 -1
  92. package/lib/cjs/tile/B3dmReader.d.ts +0 -1
  93. package/lib/cjs/tile/B3dmReader.d.ts.map +1 -1
  94. package/lib/cjs/tile/B3dmReader.js +1 -2
  95. package/lib/cjs/tile/B3dmReader.js.map +1 -1
  96. package/lib/cjs/tile/GltfReader.d.ts +25 -1
  97. package/lib/cjs/tile/GltfReader.d.ts.map +1 -1
  98. package/lib/cjs/tile/GltfReader.js +239 -3
  99. package/lib/cjs/tile/GltfReader.js.map +1 -1
  100. package/lib/cjs/tile/GraphicsCollector.d.ts.map +1 -1
  101. package/lib/cjs/tile/GraphicsCollector.js +5 -2
  102. package/lib/cjs/tile/GraphicsCollector.js.map +1 -1
  103. package/lib/cjs/tile/I3dmReader.d.ts +0 -1
  104. package/lib/cjs/tile/I3dmReader.d.ts.map +1 -1
  105. package/lib/cjs/tile/I3dmReader.js +1 -2
  106. package/lib/cjs/tile/I3dmReader.js.map +1 -1
  107. package/lib/cjs/tile/PrimaryTileTree.d.ts +6 -2
  108. package/lib/cjs/tile/PrimaryTileTree.d.ts.map +1 -1
  109. package/lib/cjs/tile/PrimaryTileTree.js +25 -0
  110. package/lib/cjs/tile/PrimaryTileTree.js.map +1 -1
  111. package/lib/cjs/tile/RealityModelTileTree.js +1 -1
  112. package/lib/cjs/tile/RealityModelTileTree.js.map +1 -1
  113. package/lib/cjs/tile/RealityTile.d.ts +2 -3
  114. package/lib/cjs/tile/RealityTile.d.ts.map +1 -1
  115. package/lib/cjs/tile/RealityTile.js +0 -1
  116. package/lib/cjs/tile/RealityTile.js.map +1 -1
  117. package/lib/cjs/tile/RealityTileLoader.d.ts.map +1 -1
  118. package/lib/cjs/tile/RealityTileLoader.js +1 -0
  119. package/lib/cjs/tile/RealityTileLoader.js.map +1 -1
  120. package/lib/cjs/tile/TileGeometryCollector.d.ts +4 -4
  121. package/lib/cjs/tile/TileGeometryCollector.js +1 -1
  122. package/lib/cjs/tile/TileGeometryCollector.js.map +1 -1
  123. package/lib/cjs/tile/TileTreeReference.d.ts +0 -4
  124. package/lib/cjs/tile/TileTreeReference.d.ts.map +1 -1
  125. package/lib/cjs/tile/TileTreeReference.js +0 -3
  126. package/lib/cjs/tile/TileTreeReference.js.map +1 -1
  127. package/lib/cjs/tile/map/ArcGisUtilities.d.ts +1 -0
  128. package/lib/cjs/tile/map/ArcGisUtilities.d.ts.map +1 -1
  129. package/lib/cjs/tile/map/ArcGisUtilities.js +5 -3
  130. package/lib/cjs/tile/map/ArcGisUtilities.js.map +1 -1
  131. package/lib/cjs/tile/map/ImageryProviders/ArcGISImageryProvider.d.ts.map +1 -1
  132. package/lib/cjs/tile/map/ImageryProviders/ArcGISImageryProvider.js +7 -2
  133. package/lib/cjs/tile/map/ImageryProviders/ArcGISImageryProvider.js.map +1 -1
  134. package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
  135. package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +3 -1
  136. package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
  137. package/lib/cjs/tile/map/MapTileTree.d.ts.map +1 -1
  138. package/lib/cjs/tile/map/MapTileTree.js +5 -5
  139. package/lib/cjs/tile/map/MapTileTree.js.map +1 -1
  140. package/lib/cjs/tools/ElementSetTool.d.ts +8 -4
  141. package/lib/cjs/tools/ElementSetTool.d.ts.map +1 -1
  142. package/lib/cjs/tools/ElementSetTool.js +5 -3
  143. package/lib/cjs/tools/ElementSetTool.js.map +1 -1
  144. package/lib/cjs/tools/ToolAdmin.d.ts +2 -0
  145. package/lib/cjs/tools/ToolAdmin.d.ts.map +1 -1
  146. package/lib/cjs/tools/ToolAdmin.js +5 -1
  147. package/lib/cjs/tools/ToolAdmin.js.map +1 -1
  148. package/lib/esm/AccuSnap.d.ts.map +1 -1
  149. package/lib/esm/AccuSnap.js +4 -1
  150. package/lib/esm/AccuSnap.js.map +1 -1
  151. package/lib/esm/IModelApp.d.ts +2 -3
  152. package/lib/esm/IModelApp.d.ts.map +1 -1
  153. package/lib/esm/IModelApp.js +2 -2
  154. package/lib/esm/IModelApp.js.map +1 -1
  155. package/lib/esm/IModelConnection.d.ts +16 -6
  156. package/lib/esm/IModelConnection.d.ts.map +1 -1
  157. package/lib/esm/IModelConnection.js +21 -7
  158. package/lib/esm/IModelConnection.js.map +1 -1
  159. package/lib/esm/IpcApp.d.ts +5 -1
  160. package/lib/esm/IpcApp.d.ts.map +1 -1
  161. package/lib/esm/IpcApp.js +11 -5
  162. package/lib/esm/IpcApp.js.map +1 -1
  163. package/lib/esm/LocalhostIpcApp.d.ts.map +1 -1
  164. package/lib/esm/LocalhostIpcApp.js +2 -1
  165. package/lib/esm/LocalhostIpcApp.js.map +1 -1
  166. package/lib/esm/NativeApp.d.ts.map +1 -1
  167. package/lib/esm/NativeApp.js +2 -1
  168. package/lib/esm/NativeApp.js.map +1 -1
  169. package/lib/esm/PlanarClipMaskState.d.ts +8 -3
  170. package/lib/esm/PlanarClipMaskState.d.ts.map +1 -1
  171. package/lib/esm/PlanarClipMaskState.js +48 -18
  172. package/lib/esm/PlanarClipMaskState.js.map +1 -1
  173. package/lib/esm/RealityDataSourceTilesetUrlImpl.d.ts +3 -0
  174. package/lib/esm/RealityDataSourceTilesetUrlImpl.d.ts.map +1 -1
  175. package/lib/esm/RealityDataSourceTilesetUrlImpl.js +15 -4
  176. package/lib/esm/RealityDataSourceTilesetUrlImpl.js.map +1 -1
  177. package/lib/esm/SpatialViewState.d.ts +14 -1
  178. package/lib/esm/SpatialViewState.d.ts.map +1 -1
  179. package/lib/esm/SpatialViewState.js +17 -0
  180. package/lib/esm/SpatialViewState.js.map +1 -1
  181. package/lib/esm/SubCategoriesCache.d.ts +3 -1
  182. package/lib/esm/SubCategoriesCache.d.ts.map +1 -1
  183. package/lib/esm/SubCategoriesCache.js +19 -5
  184. package/lib/esm/SubCategoriesCache.js.map +1 -1
  185. package/lib/esm/ViewCreator3d.d.ts.map +1 -1
  186. package/lib/esm/ViewCreator3d.js +1 -0
  187. package/lib/esm/ViewCreator3d.js.map +1 -1
  188. package/lib/esm/ViewManager.d.ts +4 -7
  189. package/lib/esm/ViewManager.d.ts.map +1 -1
  190. package/lib/esm/ViewManager.js +4 -7
  191. package/lib/esm/ViewManager.js.map +1 -1
  192. package/lib/esm/ViewingSpace.d.ts +3 -1
  193. package/lib/esm/ViewingSpace.d.ts.map +1 -1
  194. package/lib/esm/ViewingSpace.js +11 -2
  195. package/lib/esm/ViewingSpace.js.map +1 -1
  196. package/lib/esm/common/gltf/GltfSchema.d.ts +15 -1
  197. package/lib/esm/common/gltf/GltfSchema.d.ts.map +1 -1
  198. package/lib/esm/common/gltf/GltfSchema.js.map +1 -1
  199. package/lib/esm/core-frontend.d.ts +1 -0
  200. package/lib/esm/core-frontend.d.ts.map +1 -1
  201. package/lib/esm/core-frontend.js +1 -0
  202. package/lib/esm/core-frontend.js.map +1 -1
  203. package/lib/esm/internal/Symbols.d.ts +7 -0
  204. package/lib/esm/internal/Symbols.d.ts.map +1 -0
  205. package/lib/esm/internal/Symbols.js +14 -0
  206. package/lib/esm/internal/Symbols.js.map +1 -0
  207. package/lib/esm/internal/cross-package.d.ts +5 -0
  208. package/lib/esm/internal/cross-package.d.ts.map +1 -0
  209. package/lib/esm/internal/cross-package.js +9 -0
  210. package/lib/esm/internal/cross-package.js.map +1 -0
  211. package/lib/esm/render/FeatureSymbology.js +3 -3
  212. package/lib/esm/render/FeatureSymbology.js.map +1 -1
  213. package/lib/esm/render/GraphicBuilder.d.ts +4 -0
  214. package/lib/esm/render/GraphicBuilder.d.ts.map +1 -1
  215. package/lib/esm/render/GraphicBuilder.js +49 -0
  216. package/lib/esm/render/GraphicBuilder.js.map +1 -1
  217. package/lib/esm/render/RenderTarget.d.ts +1 -0
  218. package/lib/esm/render/RenderTarget.d.ts.map +1 -1
  219. package/lib/esm/render/RenderTarget.js.map +1 -1
  220. package/lib/esm/render/webgl/BackgroundMapDrape.js +2 -2
  221. package/lib/esm/render/webgl/BackgroundMapDrape.js.map +1 -1
  222. package/lib/esm/render/webgl/PlanarClassifier.d.ts +2 -0
  223. package/lib/esm/render/webgl/PlanarClassifier.d.ts.map +1 -1
  224. package/lib/esm/render/webgl/PlanarClassifier.js +40 -13
  225. package/lib/esm/render/webgl/PlanarClassifier.js.map +1 -1
  226. package/lib/esm/render/webgl/PlanarTextureProjection.d.ts +3 -3
  227. package/lib/esm/render/webgl/PlanarTextureProjection.d.ts.map +1 -1
  228. package/lib/esm/render/webgl/PlanarTextureProjection.js +54 -20
  229. package/lib/esm/render/webgl/PlanarTextureProjection.js.map +1 -1
  230. package/lib/esm/render/webgl/SolarShadowMap.js +2 -2
  231. package/lib/esm/render/webgl/SolarShadowMap.js.map +1 -1
  232. package/lib/esm/render/webgl/Target.d.ts +1 -0
  233. package/lib/esm/render/webgl/Target.d.ts.map +1 -1
  234. package/lib/esm/render/webgl/Target.js +1 -0
  235. package/lib/esm/render/webgl/Target.js.map +1 -1
  236. package/lib/esm/render/webgl/glsl/AmbientOcclusion.js.map +1 -1
  237. package/lib/esm/tile/B3dmReader.d.ts +0 -1
  238. package/lib/esm/tile/B3dmReader.d.ts.map +1 -1
  239. package/lib/esm/tile/B3dmReader.js +1 -2
  240. package/lib/esm/tile/B3dmReader.js.map +1 -1
  241. package/lib/esm/tile/GltfReader.d.ts +25 -1
  242. package/lib/esm/tile/GltfReader.d.ts.map +1 -1
  243. package/lib/esm/tile/GltfReader.js +239 -3
  244. package/lib/esm/tile/GltfReader.js.map +1 -1
  245. package/lib/esm/tile/GraphicsCollector.d.ts.map +1 -1
  246. package/lib/esm/tile/GraphicsCollector.js +5 -2
  247. package/lib/esm/tile/GraphicsCollector.js.map +1 -1
  248. package/lib/esm/tile/I3dmReader.d.ts +0 -1
  249. package/lib/esm/tile/I3dmReader.d.ts.map +1 -1
  250. package/lib/esm/tile/I3dmReader.js +1 -2
  251. package/lib/esm/tile/I3dmReader.js.map +1 -1
  252. package/lib/esm/tile/PrimaryTileTree.d.ts +6 -2
  253. package/lib/esm/tile/PrimaryTileTree.d.ts.map +1 -1
  254. package/lib/esm/tile/PrimaryTileTree.js +25 -0
  255. package/lib/esm/tile/PrimaryTileTree.js.map +1 -1
  256. package/lib/esm/tile/RealityModelTileTree.js +1 -1
  257. package/lib/esm/tile/RealityModelTileTree.js.map +1 -1
  258. package/lib/esm/tile/RealityTile.d.ts +2 -3
  259. package/lib/esm/tile/RealityTile.d.ts.map +1 -1
  260. package/lib/esm/tile/RealityTile.js +0 -1
  261. package/lib/esm/tile/RealityTile.js.map +1 -1
  262. package/lib/esm/tile/RealityTileLoader.d.ts.map +1 -1
  263. package/lib/esm/tile/RealityTileLoader.js +1 -0
  264. package/lib/esm/tile/RealityTileLoader.js.map +1 -1
  265. package/lib/esm/tile/TileGeometryCollector.d.ts +4 -4
  266. package/lib/esm/tile/TileGeometryCollector.js +1 -1
  267. package/lib/esm/tile/TileGeometryCollector.js.map +1 -1
  268. package/lib/esm/tile/TileTreeReference.d.ts +0 -4
  269. package/lib/esm/tile/TileTreeReference.d.ts.map +1 -1
  270. package/lib/esm/tile/TileTreeReference.js +0 -3
  271. package/lib/esm/tile/TileTreeReference.js.map +1 -1
  272. package/lib/esm/tile/map/ArcGisUtilities.d.ts +1 -0
  273. package/lib/esm/tile/map/ArcGisUtilities.d.ts.map +1 -1
  274. package/lib/esm/tile/map/ArcGisUtilities.js +5 -3
  275. package/lib/esm/tile/map/ArcGisUtilities.js.map +1 -1
  276. package/lib/esm/tile/map/ImageryProviders/ArcGISImageryProvider.d.ts.map +1 -1
  277. package/lib/esm/tile/map/ImageryProviders/ArcGISImageryProvider.js +7 -2
  278. package/lib/esm/tile/map/ImageryProviders/ArcGISImageryProvider.js.map +1 -1
  279. package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
  280. package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +3 -1
  281. package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
  282. package/lib/esm/tile/map/MapTileTree.d.ts.map +1 -1
  283. package/lib/esm/tile/map/MapTileTree.js +5 -5
  284. package/lib/esm/tile/map/MapTileTree.js.map +1 -1
  285. package/lib/esm/tools/ElementSetTool.d.ts +8 -4
  286. package/lib/esm/tools/ElementSetTool.d.ts.map +1 -1
  287. package/lib/esm/tools/ElementSetTool.js +5 -3
  288. package/lib/esm/tools/ElementSetTool.js.map +1 -1
  289. package/lib/esm/tools/ToolAdmin.d.ts +2 -0
  290. package/lib/esm/tools/ToolAdmin.d.ts.map +1 -1
  291. package/lib/esm/tools/ToolAdmin.js +5 -1
  292. package/lib/esm/tools/ToolAdmin.js.map +1 -1
  293. package/lib/public/locales/en/iModelJs.json +5 -0
  294. package/lib/public/scripts/parse-imdl-worker.js +1 -1
  295. package/lib/workers/webpack/parse-imdl-worker.js +1 -1
  296. package/package.json +18 -18
@@ -1 +1 @@
1
- {"version":3,"file":"RealityDataSourceTilesetUrlImpl.js","sourceRoot":"","sources":["../../src/RealityDataSourceTilesetUrlImpl.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAwE;AACxE,oDAAoJ;AAEpJ,+CAA4C;AAE5C,8CAA8D;AAE9D;;;;;;EAME;AACF,MAAa,+BAA+B;IAO1C;;OAEG;IACH,YAAsB,KAA6B;QANnD,sIAAsI;QAC9H,aAAQ,GAAW,EAAE,CAAC;QAM5B,IAAA,qBAAM,EAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,KAAK,iCAAmB,CAAC,UAAU,IAAI,KAAK,CAAC,SAAS,CAAC,QAAQ,KAAK,iCAAmB,CAAC,WAAW,CAAC,CAAC;QACpI,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,SAA+B,EAAE,QAAgC;QACjG,IAAI,SAAS,CAAC,QAAQ,KAAK,iCAAmB,CAAC,UAAU;YACvD,OAAO,SAAS,CAAC;QACnB,MAAM,QAAQ,GAA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AG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErC,OAAO,IAAA,iBAAO,EAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IACzC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,WAAW,CAAC,IAAY;QACnC,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErC,OAAO,IAAA,iBAAO,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAClC,CAAC;IAEM,kBAAkB,CAAC,GAAW;QACnC,OAAO,IAAI,GAAG,CAAC,GAAG,EAAE,oBAAoB,CAAC,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;IACzG,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,4BAA4B;QACvC,IAAI,eAAsD,CAAC;QAC3D,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,KAAK,+BAAiB,CAAC,UAAU,EAAE,CAAC;YACrD,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;YAC3D,eAAe,GAAG,sCAA2B,CAAC,4BAA4B,CAAC,YAAY,CAAC,CAAC;QAC3F,CAAC;QACD,OAAO,eAAe,CAAC;IACzB,CAAC;IACD;;;;;OAKG;IACI,KAAK,CAAC,uBAAuB;QAClC,IAAI,aAA+C,CAAC;QACpD,OAAO,aAAa,CAAC;IACvB,CAAC;CACF;AA1HD,0EA0HC","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 Tiles\r\n */\r\nimport { assert, BentleyStatus, GuidString } from \"@itwin/core-bentley\";\r\nimport { IModelError, RealityData, RealityDataFormat, RealityDataProvider, RealityDataSourceKey, RealityDataSourceProps } from \"@itwin/core-common\";\r\n\r\nimport { request } from \"./request/Request\";\r\nimport { PublisherProductInfo, RealityDataSource, SpatialLocationAndExtents } from \"./RealityDataSource\";\r\nimport { ThreeDTileFormatInterpreter } from \"./tile/internal\";\r\n\r\n/** This class provides access to the reality data provider services.\r\n * It encapsulates access to a reality data weiter it be from local access, http or ProjectWise Context Share.\r\n * The key provided at the creation determines if this is ProjectWise Context Share reference.\r\n * If not then it is considered local (ex: C:\\temp\\TileRoot.json) or plain http access (http://someserver.com/data/TileRoot.json)\r\n * There is a one to one relationship between a reality data and the instances of present class.\r\n* @internal\r\n*/\r\nexport class RealityDataSourceTilesetUrlImpl implements RealityDataSource {\r\n public readonly key: RealityDataSourceKey;\r\n /** The URL that supplies the 3d tiles for displaying the reality model. */\r\n private _tilesetUrl: string | undefined;\r\n /** For use by all Reality Data. For RD stored on PW Context Share, represents the portion from the root of the Azure Blob Container*/\r\n private _baseUrl: string = \"\";\r\n\r\n /** Construct a new reality data source.\r\n * @param props JSON representation of the reality data source\r\n */\r\n protected constructor(props: RealityDataSourceProps) {\r\n assert(props.sourceKey.provider === RealityDataProvider.TilesetUrl || props.sourceKey.provider === RealityDataProvider.OrbitGtBlob);\r\n this.key = props.sourceKey;\r\n this._tilesetUrl = this.key.id;\r\n }\r\n\r\n /**\r\n * Create an instance of this class from a source key and iTwin context/\r\n */\r\n public static async createFromKey(sourceKey: RealityDataSourceKey, _iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined> {\r\n if (sourceKey.provider !== RealityDataProvider.TilesetUrl)\r\n return undefined;\r\n const rdSource = new RealityDataSourceTilesetUrlImpl({ sourceKey });\r\n return rdSource;\r\n }\r\n\r\n public get isContextShare(): boolean {\r\n return false;\r\n }\r\n /**\r\n * Returns Reality Data if available\r\n */\r\n public get realityData(): RealityData | undefined {\r\n return undefined;\r\n }\r\n public get realityDataId(): string | undefined {\r\n return undefined;\r\n }\r\n /**\r\n * Returns Reality Data type if available\r\n */\r\n public get realityDataType(): string | undefined {\r\n return undefined;\r\n }\r\n\r\n // This is to set the root url from the provided root document path.\r\n // If the root document is stored on PW Context Share then the root document property of the Reality Data is provided,\r\n // otherwise the full path to root document is given.\r\n // The base URL contains the base URL from which tile relative path are constructed.\r\n // The tile's path root will need to be reinserted for child tiles to return a 200\r\n private setBaseUrl(url: string): void {\r\n const urlParts = url.split(\"/\");\r\n urlParts.pop();\r\n if (urlParts.length === 0)\r\n this._baseUrl = \"\";\r\n else\r\n this._baseUrl = `${urlParts.join(\"/\")}/`;\r\n }\r\n\r\n /**\r\n * This method returns the URL to access the actual 3d tiles from the service provider.\r\n * @returns string containing the URL to reality data.\r\n */\r\n public async getServiceUrl(_iTwinId: GuidString | undefined): Promise<string | undefined> {\r\n return this._tilesetUrl;\r\n }\r\n\r\n public async getRootDocument(iTwinId: GuidString | undefined): Promise<any> {\r\n const url = await this.getServiceUrl(iTwinId);\r\n if (!url)\r\n throw new IModelError(BentleyStatus.ERROR, \"Unable to get service url\");\r\n\r\n // The following is only if the reality data is not stored on PW Context Share.\r\n this.setBaseUrl(url);\r\n return request(url, \"json\");\r\n }\r\n\r\n /**\r\n * Returns the tile content. The path to the tile is relative to the base url of present reality data whatever the type.\r\n */\r\n public async getTileContent(name: string): Promise<ArrayBuffer> {\r\n const tileUrl = this._baseUrl + name;\r\n\r\n return request(tileUrl, \"arraybuffer\");\r\n }\r\n\r\n /**\r\n * Returns the tile content in json format. The path to the tile is relative to the base url of present reality data whatever the type.\r\n */\r\n public async getTileJson(name: string): Promise<any> {\r\n const tileUrl = this._baseUrl + name;\r\n\r\n return request(tileUrl, \"json\");\r\n }\r\n\r\n public getTileContentType(url: string): \"tile\" | \"tileset\" {\r\n return new URL(url, \"https://localhost/\").pathname.toLowerCase().endsWith(\"json\") ? \"tileset\" : \"tile\";\r\n }\r\n\r\n /**\r\n * Gets spatial location and extents of this reality data source\r\n * @returns spatial location and extents\r\n * @internal\r\n */\r\n public async getSpatialLocationAndExtents(): Promise<SpatialLocationAndExtents | undefined> {\r\n let spatialLocation: SpatialLocationAndExtents | undefined;\r\n if (this.key.format === RealityDataFormat.ThreeDTile) {\r\n const rootDocument = await this.getRootDocument(undefined);\r\n spatialLocation = ThreeDTileFormatInterpreter.getSpatialLocationAndExtents(rootDocument);\r\n }\r\n return spatialLocation;\r\n }\r\n /**\r\n * Gets information to identify the product and engine that create this reality data\r\n * Will return undefined if cannot be resolved\r\n * @returns information to identify the product and engine that create this reality data\r\n * @alpha\r\n */\r\n public async getPublisherProductInfo(): Promise<PublisherProductInfo | undefined> {\r\n let publisherInfo: PublisherProductInfo | undefined;\r\n return publisherInfo;\r\n }\r\n}\r\n\r\n"]}
1
+ {"version":3,"file":"RealityDataSourceTilesetUrlImpl.js","sourceRoot":"","sources":["../../src/RealityDataSourceTilesetUrlImpl.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAwE;AACxE,oDAAoJ;AAEpJ,+CAA4C;AAE5C,8CAA8D;AAE9D;;;;;;EAME;AACF,MAAa,+BAA+B;IAO1C;;OAEG;IACH,YAAsB,KAA6B;QANnD,sIAAsI;QAC9H,aAAQ,GAAW,EAAE,CAAC;QAM5B,IAAA,qBAAM,EAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,KAAK,iCAAmB,CAAC,UAAU,IAAI,KAAK,CAAC,SAAS,CAAC,QAAQ,KAAK,iCAAmB,CAAC,WAAW,CAAC,CAAC;QACpI,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,SAA+B,EAAE,QAAgC;QACjG,IAAI,SAAS,CAAC,QAAQ,KAAK,iCAAmB,CAAC,UAAU;YACvD,OAAO,SAAS,CAAC;QACnB,MAAM,QAAQ,GAAG,IAAI,+BAA+B,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CAAC;CACF;AApID,0EAoIC","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 Tiles\r\n */\r\nimport { assert, BentleyStatus, GuidString } from \"@itwin/core-bentley\";\r\nimport { IModelError, RealityData, RealityDataFormat, RealityDataProvider, RealityDataSourceKey, RealityDataSourceProps } from \"@itwin/core-common\";\r\n\r\nimport { request } from \"./request/Request\";\r\nimport { PublisherProductInfo, RealityDataSource, SpatialLocationAndExtents } from \"./RealityDataSource\";\r\nimport { ThreeDTileFormatInterpreter } from \"./tile/internal\";\r\n\r\n/** This class provides access to the reality data provider services.\r\n * It encapsulates access to a reality data weiter it be from local access, http or ProjectWise Context Share.\r\n * The key provided at the creation determines if this is ProjectWise Context Share reference.\r\n * If not then it is considered local (ex: C:\\temp\\TileRoot.json) or plain http access (http://someserver.com/data/TileRoot.json)\r\n * There is a one to one relationship between a reality data and the instances of present class.\r\n* @internal\r\n*/\r\nexport class RealityDataSourceTilesetUrlImpl implements RealityDataSource {\r\n public readonly key: RealityDataSourceKey;\r\n /** The URL that supplies the 3d tiles for displaying the reality model. */\r\n private _tilesetUrl: string | undefined;\r\n /** For use by all Reality Data. For RD stored on PW Context Share, represents the portion from the root of the Azure Blob Container*/\r\n private _baseUrl: string = \"\";\r\n\r\n /** Construct a new reality data source.\r\n * @param props JSON representation of the reality data source\r\n */\r\n protected constructor(props: RealityDataSourceProps) {\r\n assert(props.sourceKey.provider === RealityDataProvider.TilesetUrl || props.sourceKey.provider === RealityDataProvider.OrbitGtBlob);\r\n this.key = props.sourceKey;\r\n this._tilesetUrl = this.key.id;\r\n }\r\n\r\n /**\r\n * Create an instance of this class from a source key and iTwin context/\r\n */\r\n public static async createFromKey(sourceKey: RealityDataSourceKey, _iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined> {\r\n if (sourceKey.provider !== RealityDataProvider.TilesetUrl)\r\n return undefined;\r\n const rdSource = new RealityDataSourceTilesetUrlImpl({ sourceKey });\r\n return rdSource;\r\n }\r\n\r\n public get isContextShare(): boolean {\r\n return false;\r\n }\r\n /**\r\n * Returns Reality Data if available\r\n */\r\n public get realityData(): RealityData | undefined {\r\n return undefined;\r\n }\r\n public get realityDataId(): string | undefined {\r\n return undefined;\r\n }\r\n /**\r\n * Returns Reality Data type if available\r\n */\r\n public get realityDataType(): string | undefined {\r\n return undefined;\r\n }\r\n\r\n // This is to set the root url from the provided root document path.\r\n // If the root document is stored on PW Context Share then the root document property of the Reality Data is provided,\r\n // otherwise the full path to root document is given.\r\n // The base URL contains the base URL from which tile relative path are constructed.\r\n // The tile's path root will need to be reinserted for child tiles to return a 200\r\n private setBaseUrl(url: string): void {\r\n const urlParts = url.split(\"/\");\r\n urlParts.pop();\r\n if (urlParts.length === 0)\r\n this._baseUrl = \"\";\r\n else\r\n this._baseUrl = `${urlParts.join(\"/\")}/`;\r\n }\r\n\r\n /**\r\n * This method returns the URL to access the actual 3d tiles from the service provider.\r\n * @returns string containing the URL to reality data.\r\n */\r\n public async getServiceUrl(_iTwinId: GuidString | undefined): Promise<string | undefined> {\r\n return this._tilesetUrl;\r\n }\r\n\r\n public async getRootDocument(iTwinId: GuidString | undefined): Promise<any> {\r\n const url = await this.getServiceUrl(iTwinId);\r\n if (!url)\r\n throw new IModelError(BentleyStatus.ERROR, \"Unable to get service url\");\r\n\r\n // The following is only if the reality data is not stored on PW Context Share.\r\n this.setBaseUrl(url);\r\n return request(url, \"json\");\r\n }\r\n\r\n private isValidURL(url: string){\r\n try {\r\n new URL(url);\r\n } catch (_) {\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n /** Returns the tile URL. If the tile path is a full URL, it is returned as is. Otherwise, the base URL is prepended to the tile path. */\r\n private getTileUrl(tilePath: string){\r\n return this.isValidURL(tilePath) ? tilePath : this._baseUrl + tilePath;\r\n }\r\n\r\n /**\r\n * Returns the tile content. The path to the tile is relative to the base url of present reality data whatever the type.\r\n */\r\n public async getTileContent(name: string): Promise<ArrayBuffer> {\r\n return request(this.getTileUrl(name), \"arraybuffer\");\r\n }\r\n\r\n /**\r\n * Returns the tile content in json format. The path to the tile is relative to the base url of present reality data whatever the type.\r\n */\r\n public async getTileJson(name: string): Promise<any> {\r\n return request(this.getTileUrl(name), \"json\");\r\n }\r\n\r\n public getTileContentType(url: string): \"tile\" | \"tileset\" {\r\n return new URL(url, \"https://localhost/\").pathname.toLowerCase().endsWith(\"json\") ? \"tileset\" : \"tile\";\r\n }\r\n\r\n /**\r\n * Gets spatial location and extents of this reality data source\r\n * @returns spatial location and extents\r\n * @internal\r\n */\r\n public async getSpatialLocationAndExtents(): Promise<SpatialLocationAndExtents | undefined> {\r\n let spatialLocation: SpatialLocationAndExtents | undefined;\r\n if (this.key.format === RealityDataFormat.ThreeDTile) {\r\n const rootDocument = await this.getRootDocument(undefined);\r\n spatialLocation = ThreeDTileFormatInterpreter.getSpatialLocationAndExtents(rootDocument);\r\n }\r\n return spatialLocation;\r\n }\r\n /**\r\n * Gets information to identify the product and engine that create this reality data\r\n * Will return undefined if cannot be resolved\r\n * @returns information to identify the product and engine that create this reality data\r\n * @alpha\r\n */\r\n public async getPublisherProductInfo(): Promise<PublisherProductInfo | undefined> {\r\n let publisherInfo: PublisherProductInfo | undefined;\r\n return publisherInfo;\r\n }\r\n}\r\n\r\n"]}
@@ -1,7 +1,7 @@
1
1
  /** @packageDocumentation
2
2
  * @module Views
3
3
  */
4
- import { BeEvent, Id64String } from "@itwin/core-bentley";
4
+ import { BeEvent, Id64String, OrderedId64Iterable } from "@itwin/core-bentley";
5
5
  import { Matrix3d, Range3d, XYAndZ } from "@itwin/core-geometry";
6
6
  import { AxisAlignedBox3d, HydrateViewStateRequestProps, HydrateViewStateResponseProps, SpatialViewDefinitionProps, ViewStateProps } from "@itwin/core-common";
7
7
  import { AuxCoordSystemState } from "./AuxCoordSys";
@@ -101,6 +101,19 @@ export declare class SpatialViewState extends ViewState3d {
101
101
  * @internal
102
102
  */
103
103
  setTileTreeReferencesDeactivated(modelIds: Id64String | Id64String[] | undefined, deactivated: boolean | undefined, which: "all" | "animated" | "primary" | "section" | number[]): void;
104
+ /** For getting the [TileTreeReference]s that are in the modelIds, for planar classification.
105
+ * @param modelIds modelIds for which to get the TileTreeReferences
106
+ * @param maskTreeRefs where to store the TileTreeReferences
107
+ * @param maskRange range to extend for the maskRefs
108
+ * @internal
109
+ */
110
+ collectMaskRefs(modelIds: OrderedId64Iterable, maskTreeRefs: TileTreeReference[], maskRange: Range3d): void;
111
+ /** For getting a list of modelIds which do not participate in masking for planar classification.
112
+ * @param maskModels models which DO participate in planar clip masking
113
+ * @param useVisible when true, use visible models to set flag
114
+ * @internal
115
+ */
116
+ getModelsNotInMask(maskModels: OrderedId64Iterable | undefined, useVisible: boolean): Id64String[] | undefined;
104
117
  private registerModelSelectorListeners;
105
118
  private unregisterModelSelectorListeners;
106
119
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SpatialViewState.d.ts","sourceRoot":"","sources":["../../src/SpatialViewState.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAqB,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC7E,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,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAyB,mBAAmB,EAAE,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BAAkB;IAEhK,cAAc,IAAI,OAAO;CAC1C"}
@@ -203,6 +203,23 @@ class SpatialViewState extends ViewState_1.ViewState3d {
203
203
  setTileTreeReferencesDeactivated(modelIds, deactivated, which) {
204
204
  this._treeRefs.setDeactivated(modelIds, deactivated, which);
205
205
  }
206
+ /** For getting the [TileTreeReference]s that are in the modelIds, for planar classification.
207
+ * @param modelIds modelIds for which to get the TileTreeReferences
208
+ * @param maskTreeRefs where to store the TileTreeReferences
209
+ * @param maskRange range to extend for the maskRefs
210
+ * @internal
211
+ */
212
+ collectMaskRefs(modelIds, maskTreeRefs, maskRange) {
213
+ this._treeRefs.collectMaskRefs(modelIds, maskTreeRefs, maskRange);
214
+ }
215
+ /** For getting a list of modelIds which do not participate in masking for planar classification.
216
+ * @param maskModels models which DO participate in planar clip masking
217
+ * @param useVisible when true, use visible models to set flag
218
+ * @internal
219
+ */
220
+ getModelsNotInMask(maskModels, useVisible) {
221
+ return this._treeRefs.getModelsNotInMask(maskModels, useVisible);
222
+ }
206
223
  registerModelSelectorListeners() {
207
224
  const models = this.modelSelector.observableModels;
208
225
  const func = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"SpatialViewState.js","sourceRoot":"","sources":["../../src/SpatialViewState.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6E;AAC7E,wDAA2E;AAE3E,+CAAgF;AAChF,6DAA0D;AAC1D,mEAAgE;AAChE,2DAA0D;AAI1D,2CAAgE;AAChE,8CAA+E;AAU/E;;;;GAIG;AACH,MAAa,gBAAiB,SAAQ,uBAAW;IACxC,MAAM,KAAc,SAAS,KAAK,OAAO,uBAAuB,CAAC,CAAC,CAAC;IAW1E,IAAW,aAAa;QACtB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED,IAAW,aAAa,CAAC,QAA4B;QACnD,IAAI,QAAQ,KAAK,IAAI,CAAC,aAAa;YACjC,OAAO;QAET,MAAM,UAAU,GAAG,IAAI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C;IACpD,CAAC;CACF;AAhPD,4CAgPC;AACD;;;GAGG;AACH,MAAa,qBAAsB,SAAQ,gBAAgB;IAClD,MAAM,KAAc,SAAS,KAAK,OAAO,4BAA4B,CAAC,CAAC,CAAC;IAE/E,YAAY,KAAiC,EAAE,MAAwB,EAAE,UAAiC,EAAE,YAAiC,EAAE,aAAiC,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IAEpO,cAAc,KAAc,OAAO,KAAK,CAAC,CAAC,CAAC;CAC5D;AAND,sDAMC","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\n\r\nimport { BeEvent, CompressedId64Set, Id64String } from \"@itwin/core-bentley\";\r\nimport { Constant, Matrix3d, Range3d, XYAndZ } from \"@itwin/core-geometry\";\r\nimport { AxisAlignedBox3d, HydrateViewStateRequestProps, HydrateViewStateResponseProps, SpatialViewDefinitionProps, ViewStateProps } from \"@itwin/core-common\";\r\nimport { AuxCoordSystemSpatialState, AuxCoordSystemState } from \"./AuxCoordSys\";\r\nimport { ModelSelectorState } from \"./ModelSelectorState\";\r\nimport { CategorySelectorState } from \"./CategorySelectorState\";\r\nimport { DisplayStyle3dState } from \"./DisplayStyleState\";\r\nimport { GeometricModel3dState, GeometricModelState } from \"./ModelState\";\r\nimport { SceneContext } from \"./ViewContext\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\nimport { AttachToViewportArgs, ViewState3d } from \"./ViewState\";\r\nimport { SpatialTileTreeReferences, TileTreeReference } from \"./tile/internal\";\r\n\r\n/** Options supplied to [[SpatialViewState.computeFitRange]].\r\n * @public\r\n */\r\nexport interface ComputeSpatialViewFitRangeOptions {\r\n /** The minimal extents. The computed range will be unioned with this range if supplied. */\r\n baseExtents?: Range3d;\r\n}\r\n\r\n/** Defines a view of one or more SpatialModels.\r\n * The list of viewed models is stored in the ModelSelector.\r\n * @public\r\n * @extensions\r\n */\r\nexport class SpatialViewState extends ViewState3d {\r\n public static override get className() { return \"SpatialViewDefinition\"; }\r\n\r\n private readonly _treeRefs: SpatialTileTreeReferences;\r\n private _modelSelector: ModelSelectorState;\r\n private readonly _unregisterModelSelectorListeners: VoidFunction[] = [];\r\n\r\n /** An event raised when the set of models viewed by this view changes, *only* if the view is attached to a [[Viewport]].\r\n * @public\r\n */\r\n public readonly onViewedModelsChanged = new BeEvent<() => void>();\r\n\r\n public get modelSelector(): ModelSelectorState {\r\n return this._modelSelector;\r\n }\r\n\r\n public set modelSelector(selector: ModelSelectorState) {\r\n if (selector === this.modelSelector)\r\n return;\r\n\r\n const isAttached = this.isAttachedToViewport;\r\n this.unregisterModelSelectorListeners();\r\n\r\n this._modelSelector = selector;\r\n\r\n if (isAttached) {\r\n this.registerModelSelectorListeners();\r\n this.onViewedModelsChanged.raiseEvent();\r\n }\r\n\r\n this.markModelSelectorChanged();\r\n }\r\n\r\n /** Create a new *blank* SpatialViewState. The returned SpatialViewState will nave non-persistent empty [[CategorySelectorState]] and [[ModelSelectorState]],\r\n * and a non-persistent [[DisplayStyle3dState]] with default values for all of its components. Generally after creating a blank SpatialViewState,\r\n * callers will modify the state to suit specific needs.\r\n * @param iModel The IModelConnection for the new SpatialViewState\r\n * @param origin The origin for the new SpatialViewState\r\n * @param extents The extents for the new SpatialViewState\r\n * @param rotation The rotation of the new SpatialViewState. If undefined, use top view.\r\n * @public\r\n */\r\n public static createBlank(iModel: IModelConnection, origin: XYAndZ, extents: XYAndZ, rotation?: Matrix3d): SpatialViewState {\r\n const blank = {} as any;\r\n const cat = new CategorySelectorState(blank, iModel);\r\n const modelSelectorState = new ModelSelectorState(blank, iModel);\r\n const displayStyleState = new DisplayStyle3dState(blank, iModel);\r\n const view = new this(blank, iModel, cat, displayStyleState, modelSelectorState);\r\n view.setOrigin(origin);\r\n view.setExtents(extents);\r\n if (undefined !== rotation)\r\n view.setRotation(rotation);\r\n return view;\r\n }\r\n\r\n public static override createFromProps(props: ViewStateProps, iModel: IModelConnection): SpatialViewState {\r\n const cat = new CategorySelectorState(props.categorySelectorProps, iModel);\r\n const displayStyleState = new DisplayStyle3dState(props.displayStyleProps, iModel);\r\n const modelSelectorState = new ModelSelectorState(props.modelSelectorProps!, iModel);\r\n return new this(props.viewDefinitionProps as SpatialViewDefinitionProps, iModel, cat, displayStyleState, modelSelectorState);\r\n }\r\n\r\n public override toProps(): ViewStateProps {\r\n const props = super.toProps();\r\n props.modelSelectorProps = this.modelSelector.toJSON();\r\n return props;\r\n }\r\n\r\n constructor(props: SpatialViewDefinitionProps, iModel: IModelConnection, arg3: CategorySelectorState, displayStyle: DisplayStyle3dState, modelSelector: ModelSelectorState) {\r\n super(props, iModel, arg3, displayStyle);\r\n this._modelSelector = modelSelector;\r\n if (arg3 instanceof SpatialViewState) // from clone\r\n this._modelSelector = arg3.modelSelector.clone();\r\n\r\n this._treeRefs = SpatialTileTreeReferences.create(this);\r\n }\r\n\r\n /** @internal */\r\n public override isSpatialView(): this is SpatialViewState { return true; }\r\n\r\n public override equals(other: this): boolean { return super.equals(other) && this.modelSelector.equals(other.modelSelector); }\r\n\r\n public override createAuxCoordSystem(acsName: string): AuxCoordSystemState { return AuxCoordSystemSpatialState.createNew(acsName, this.iModel); }\r\n public get defaultExtentLimits() { return { min: Constant.oneMillimeter, max: 3 * Constant.diameterOfEarth }; } // Increased max by 3X to support globe mode.\r\n\r\n /** @internal */\r\n public markModelSelectorChanged(): void {\r\n this._treeRefs.update();\r\n }\r\n\r\n /** Get world-space viewed extents based on the iModel's project extents.\r\n * @deprecated in 3.6. These extents are based on [[IModelConnection.displayedExtents]], which is deprecated. Consider using [[computeFitRange]] or [[getViewedExtents]] instead.\r\n */\r\n protected getDisplayedExtents(): AxisAlignedBox3d {\r\n /* eslint-disable-next-line deprecation/deprecation */\r\n const extents = Range3d.fromJSON<AxisAlignedBox3d>(this.iModel.displayedExtents);\r\n extents.scaleAboutCenterInPlace(1.0001); // projectExtents. lying smack up against the extents is not excluded by frustum...\r\n extents.extendRange(this.getGroundExtents());\r\n return extents;\r\n }\r\n\r\n private computeBaseExtents(): AxisAlignedBox3d {\r\n const extents = Range3d.fromJSON<AxisAlignedBox3d>(this.iModel.projectExtents);\r\n\r\n // Ensure geometry coincident with planes of the project extents is not clipped.\r\n extents.scaleAboutCenterInPlace(1.0001);\r\n\r\n // Ensure ground plane is not clipped, if it's being drawn.\r\n extents.extendRange(this.getGroundExtents());\r\n\r\n return extents;\r\n }\r\n\r\n /** Compute a volume in world coordinates tightly encompassing the contents of the view. The volume is computed from the union of the volumes of the\r\n * view's viewed models, including [GeometricModel]($backend)s and reality models.\r\n * Those volumes are obtained from the [[TileTree]]s used to render those models, so any tile tree that has not yet been loaded will not contribute to the computation.\r\n * If `options.baseExtents` is defined, it will be unioned with the computed volume.\r\n * If the computed volume is null (empty), a default volume will be computed from [IModel.projectExtents]($common), which may be a looser approximation of the\r\n * models' volumes.\r\n * @param options Options used to customize how the volume is computed.\r\n * @returns A non-null volume in world coordinates encompassing the contents of the view.\r\n */\r\n public computeFitRange(options?: ComputeSpatialViewFitRangeOptions): AxisAlignedBox3d {\r\n // Fit to the union of the ranges of all loaded tile trees.\r\n const range = options?.baseExtents?.clone() ?? new Range3d();\r\n this.forEachTileTreeRef((ref) => {\r\n ref.unionFitRange(range);\r\n });\r\n\r\n // Fall back to the project extents if necessary.\r\n if (range.isNull)\r\n range.setFrom(this.computeBaseExtents());\r\n\r\n // Avoid ridiculously small extents.\r\n range.ensureMinLengths(1.0);\r\n\r\n return range;\r\n }\r\n\r\n public getViewedExtents(): AxisAlignedBox3d {\r\n // Encompass the project extents and ground plane.\r\n const extents = this.computeBaseExtents();\r\n\r\n // Include any tile trees that extend outside the project extents.\r\n extents.extendRange(this.computeFitRange());\r\n\r\n return extents;\r\n }\r\n\r\n public override toJSON(): SpatialViewDefinitionProps {\r\n const val = super.toJSON() as SpatialViewDefinitionProps;\r\n val.modelSelectorId = this.modelSelector.id;\r\n return val;\r\n }\r\n\r\n /** @internal */\r\n protected override preload(hydrateRequest: HydrateViewStateRequestProps): void {\r\n super.preload(hydrateRequest);\r\n const notLoaded = this.iModel.models.filterLoaded(this.modelSelector.models);\r\n if (undefined === notLoaded)\r\n return; // all requested models are already loaded\r\n hydrateRequest.notLoadedModelSelectorStateModels = CompressedId64Set.sortAndCompress(notLoaded);\r\n }\r\n\r\n /** @internal */\r\n protected override async postload(hydrateResponse: HydrateViewStateResponseProps): Promise<void> {\r\n const promises = [];\r\n promises.push(super.postload(hydrateResponse));\r\n if (hydrateResponse.modelSelectorStateModels !== undefined)\r\n promises.push(this.iModel.models.updateLoadedWithModelProps(hydrateResponse.modelSelectorStateModels));\r\n await Promise.all(promises);\r\n }\r\n\r\n public viewsModel(modelId: Id64String): boolean { return this.modelSelector.containsModel(modelId); }\r\n public clearViewedModels() { this.modelSelector.models.clear(); }\r\n public addViewedModel(id: Id64String) { this.modelSelector.addModels(id); }\r\n public removeViewedModel(id: Id64String) { this.modelSelector.dropModels(id); }\r\n\r\n public forEachModel(func: (model: GeometricModelState) => void) {\r\n for (const modelId of this.modelSelector.models) {\r\n const model = this.iModel.models.getLoaded(modelId);\r\n if (undefined !== model && undefined !== model.asGeometricModel3d)\r\n func(model as GeometricModel3dState);\r\n }\r\n }\r\n\r\n /** @internal */\r\n public override forEachModelTreeRef(func: (treeRef: TileTreeReference) => void): void {\r\n for (const ref of this._treeRefs)\r\n func(ref);\r\n }\r\n\r\n /** @internal */\r\n public override createScene(context: SceneContext): void {\r\n super.createScene(context);\r\n context.textureDrapes.forEach((drape) => drape.collectGraphics(context));\r\n context.viewport.target.updateSolarShadows(this.getDisplayStyle3d().wantShadows ? context : undefined);\r\n }\r\n\r\n /** See [[ViewState.attachToViewport]]. */\r\n public override attachToViewport(args: AttachToViewportArgs): void {\r\n super.attachToViewport(args);\r\n this.registerModelSelectorListeners();\r\n this._treeRefs.attachToViewport(args);\r\n }\r\n\r\n /** See [[ViewState.detachFromViewport]]. */\r\n public override detachFromViewport(): void {\r\n super.detachFromViewport();\r\n this._treeRefs.detachFromViewport();\r\n this.unregisterModelSelectorListeners();\r\n }\r\n\r\n /** Chiefly for debugging: change the \"deactivated\" state of one or more tile tree references. Deactivated references are\r\n * omitted when iterating the references, so e.g. their graphics are omitted from the scene.\r\n * @param modelIds The Ids of one or more models whose tile tree references are to be affected. If omitted, all models are affected.\r\n * @param deactivated True to deactivate the specified references, false to reactivate them, undefined to invert each one's current state.\r\n * @param which The references to be affected as either a broad category or one or more indices of animated references.\r\n * @internal\r\n */\r\n public setTileTreeReferencesDeactivated(modelIds: Id64String | Id64String[] | undefined, deactivated: boolean | undefined, which: \"all\" | \"animated\" | \"primary\" | \"section\" | number[]): void {\r\n this._treeRefs.setDeactivated(modelIds, deactivated, which);\r\n }\r\n\r\n private registerModelSelectorListeners(): void {\r\n const models = this.modelSelector.observableModels;\r\n const func = () => {\r\n this.markModelSelectorChanged();\r\n this.onViewedModelsChanged.raiseEvent();\r\n };\r\n\r\n this._unregisterModelSelectorListeners.push(models.onAdded.addListener(func));\r\n this._unregisterModelSelectorListeners.push(models.onDeleted.addListener(func));\r\n this._unregisterModelSelectorListeners.push(models.onCleared.addListener(func));\r\n }\r\n\r\n private unregisterModelSelectorListeners(): void {\r\n this._unregisterModelSelectorListeners.forEach((f) => f());\r\n this._unregisterModelSelectorListeners.length = 0;\r\n }\r\n}\r\n/** Defines a spatial view that displays geometry on the image plane using a parallel orthographic projection.\r\n * @public\r\n * @extensions\r\n */\r\nexport class OrthographicViewState extends SpatialViewState {\r\n public static override get className() { return \"OrthographicViewDefinition\"; }\r\n\r\n constructor(props: SpatialViewDefinitionProps, iModel: IModelConnection, categories: CategorySelectorState, displayStyle: DisplayStyle3dState, modelSelector: ModelSelectorState) { super(props, iModel, categories, displayStyle, modelSelector); }\r\n\r\n public override supportsCamera(): boolean { return false; }\r\n}\r\n"]}
1
+ {"version":3,"file":"SpatialViewState.js","sourceRoot":"","sources":["../../src/SpatialViewState.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAkG;AAClG,wDAA2E;AAE3E,+CAAgF;AAChF,6DAA0D;AAC1D,mEAAgE;AAChE,2DAA0D;AAI1D,2CAAgE;AAChE,8CAA+E;AAU/E;;;;GAIG;AACH,MAAa,gBAAiB,SAAQ,uBAAW;IACxC,MAAM,KAAc,SAAS,KAAK,OAAO,uBAAuB,CAAC,CAAC,CAAC;IAW1E,IAAW,aAAa;QACtB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED,IAAW,aAAa,CAAC,QAA4B;QACnD,IAAI,QAAQ,KAAK,IAAI,CAAC,aAAa;YACjC,OAAO;QAET,MAAM,UAAU,GAAG,IAAI,CAAC,oBAAoB,CAAC;QAC7C,IAAI,CAAC,gCAAgC,EAAE,CAAC;QAExC,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC;QAE/B,IAAI,UAAU,EAAE,CAAC;YACf,IAAI,CAAC,8BAA8B,EAAE,CAAC;YACtC,IAAI,CAAC,qBAAqB,CAAC,UAAU,EAAE,CAAC;QAC1C,CAAC;QAED,IAAI,CAAC,wBAAwB,EAAE,CAAC;IAClC,CAAC;IAED;;;;;;;;OAQG;IACI,MAAM,CAAC,WAAW,CAAC,MAAwB,EAAE,MAAc,EAAE,OAAe,EAAE,QAAmB;QACtG,MAAM,KAAK,GAAG,EAAS,CAAC;QACxB,MAAM,GAAG,GAAG,IAAI,6CAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrD,MAAM,kBAAkB,GAAG,IAAI,uCAAkB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACjE,MAAM,iBAAiB,GAAG,IAAI,uCAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACjE,M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KAAK,CAAC,CAAC,CAAC;CAC5D;AAND,sDAMC","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\n\r\nimport { BeEvent, CompressedId64Set, Id64String, OrderedId64Iterable } from \"@itwin/core-bentley\";\r\nimport { Constant, Matrix3d, Range3d, XYAndZ } from \"@itwin/core-geometry\";\r\nimport { AxisAlignedBox3d, HydrateViewStateRequestProps, HydrateViewStateResponseProps, SpatialViewDefinitionProps, ViewStateProps } from \"@itwin/core-common\";\r\nimport { AuxCoordSystemSpatialState, AuxCoordSystemState } from \"./AuxCoordSys\";\r\nimport { ModelSelectorState } from \"./ModelSelectorState\";\r\nimport { CategorySelectorState } from \"./CategorySelectorState\";\r\nimport { DisplayStyle3dState } from \"./DisplayStyleState\";\r\nimport { GeometricModel3dState, GeometricModelState } from \"./ModelState\";\r\nimport { SceneContext } from \"./ViewContext\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\nimport { AttachToViewportArgs, ViewState3d } from \"./ViewState\";\r\nimport { SpatialTileTreeReferences, TileTreeReference } from \"./tile/internal\";\r\n\r\n/** Options supplied to [[SpatialViewState.computeFitRange]].\r\n * @public\r\n */\r\nexport interface ComputeSpatialViewFitRangeOptions {\r\n /** The minimal extents. The computed range will be unioned with this range if supplied. */\r\n baseExtents?: Range3d;\r\n}\r\n\r\n/** Defines a view of one or more SpatialModels.\r\n * The list of viewed models is stored in the ModelSelector.\r\n * @public\r\n * @extensions\r\n */\r\nexport class SpatialViewState extends ViewState3d {\r\n public static override get className() { return \"SpatialViewDefinition\"; }\r\n\r\n private readonly _treeRefs: SpatialTileTreeReferences;\r\n private _modelSelector: ModelSelectorState;\r\n private readonly _unregisterModelSelectorListeners: VoidFunction[] = [];\r\n\r\n /** An event raised when the set of models viewed by this view changes, *only* if the view is attached to a [[Viewport]].\r\n * @public\r\n */\r\n public readonly onViewedModelsChanged = new BeEvent<() => void>();\r\n\r\n public get modelSelector(): ModelSelectorState {\r\n return this._modelSelector;\r\n }\r\n\r\n public set modelSelector(selector: ModelSelectorState) {\r\n if (selector === this.modelSelector)\r\n return;\r\n\r\n const isAttached = this.isAttachedToViewport;\r\n this.unregisterModelSelectorListeners();\r\n\r\n this._modelSelector = selector;\r\n\r\n if (isAttached) {\r\n this.registerModelSelectorListeners();\r\n this.onViewedModelsChanged.raiseEvent();\r\n }\r\n\r\n this.markModelSelectorChanged();\r\n }\r\n\r\n /** Create a new *blank* SpatialViewState. The returned SpatialViewState will nave non-persistent empty [[CategorySelectorState]] and [[ModelSelectorState]],\r\n * and a non-persistent [[DisplayStyle3dState]] with default values for all of its components. Generally after creating a blank SpatialViewState,\r\n * callers will modify the state to suit specific needs.\r\n * @param iModel The IModelConnection for the new SpatialViewState\r\n * @param origin The origin for the new SpatialViewState\r\n * @param extents The extents for the new SpatialViewState\r\n * @param rotation The rotation of the new SpatialViewState. If undefined, use top view.\r\n * @public\r\n */\r\n public static createBlank(iModel: IModelConnection, origin: XYAndZ, extents: XYAndZ, rotation?: Matrix3d): SpatialViewState {\r\n const blank = {} as any;\r\n const cat = new CategorySelectorState(blank, iModel);\r\n const modelSelectorState = new ModelSelectorState(blank, iModel);\r\n const displayStyleState = new DisplayStyle3dState(blank, iModel);\r\n const view = new this(blank, iModel, cat, displayStyleState, modelSelectorState);\r\n view.setOrigin(origin);\r\n view.setExtents(extents);\r\n if (undefined !== rotation)\r\n view.setRotation(rotation);\r\n return view;\r\n }\r\n\r\n public static override createFromProps(props: ViewStateProps, iModel: IModelConnection): SpatialViewState {\r\n const cat = new CategorySelectorState(props.categorySelectorProps, iModel);\r\n const displayStyleState = new DisplayStyle3dState(props.displayStyleProps, iModel);\r\n const modelSelectorState = new ModelSelectorState(props.modelSelectorProps!, iModel);\r\n return new this(props.viewDefinitionProps as SpatialViewDefinitionProps, iModel, cat, displayStyleState, modelSelectorState);\r\n }\r\n\r\n public override toProps(): ViewStateProps {\r\n const props = super.toProps();\r\n props.modelSelectorProps = this.modelSelector.toJSON();\r\n return props;\r\n }\r\n\r\n constructor(props: SpatialViewDefinitionProps, iModel: IModelConnection, arg3: CategorySelectorState, displayStyle: DisplayStyle3dState, modelSelector: ModelSelectorState) {\r\n super(props, iModel, arg3, displayStyle);\r\n this._modelSelector = modelSelector;\r\n if (arg3 instanceof SpatialViewState) // from clone\r\n this._modelSelector = arg3.modelSelector.clone();\r\n\r\n this._treeRefs = SpatialTileTreeReferences.create(this);\r\n }\r\n\r\n /** @internal */\r\n public override isSpatialView(): this is SpatialViewState { return true; }\r\n\r\n public override equals(other: this): boolean { return super.equals(other) && this.modelSelector.equals(other.modelSelector); }\r\n\r\n public override createAuxCoordSystem(acsName: string): AuxCoordSystemState { return AuxCoordSystemSpatialState.createNew(acsName, this.iModel); }\r\n public get defaultExtentLimits() { return { min: Constant.oneMillimeter, max: 3 * Constant.diameterOfEarth }; } // Increased max by 3X to support globe mode.\r\n\r\n /** @internal */\r\n public markModelSelectorChanged(): void {\r\n this._treeRefs.update();\r\n }\r\n\r\n /** Get world-space viewed extents based on the iModel's project extents.\r\n * @deprecated in 3.6. These extents are based on [[IModelConnection.displayedExtents]], which is deprecated. Consider using [[computeFitRange]] or [[getViewedExtents]] instead.\r\n */\r\n protected getDisplayedExtents(): AxisAlignedBox3d {\r\n /* eslint-disable-next-line deprecation/deprecation */\r\n const extents = Range3d.fromJSON<AxisAlignedBox3d>(this.iModel.displayedExtents);\r\n extents.scaleAboutCenterInPlace(1.0001); // projectExtents. lying smack up against the extents is not excluded by frustum...\r\n extents.extendRange(this.getGroundExtents());\r\n return extents;\r\n }\r\n\r\n private computeBaseExtents(): AxisAlignedBox3d {\r\n const extents = Range3d.fromJSON<AxisAlignedBox3d>(this.iModel.projectExtents);\r\n\r\n // Ensure geometry coincident with planes of the project extents is not clipped.\r\n extents.scaleAboutCenterInPlace(1.0001);\r\n\r\n // Ensure ground plane is not clipped, if it's being drawn.\r\n extents.extendRange(this.getGroundExtents());\r\n\r\n return extents;\r\n }\r\n\r\n /** Compute a volume in world coordinates tightly encompassing the contents of the view. The volume is computed from the union of the volumes of the\r\n * view's viewed models, including [GeometricModel]($backend)s and reality models.\r\n * Those volumes are obtained from the [[TileTree]]s used to render those models, so any tile tree that has not yet been loaded will not contribute to the computation.\r\n * If `options.baseExtents` is defined, it will be unioned with the computed volume.\r\n * If the computed volume is null (empty), a default volume will be computed from [IModel.projectExtents]($common), which may be a looser approximation of the\r\n * models' volumes.\r\n * @param options Options used to customize how the volume is computed.\r\n * @returns A non-null volume in world coordinates encompassing the contents of the view.\r\n */\r\n public computeFitRange(options?: ComputeSpatialViewFitRangeOptions): AxisAlignedBox3d {\r\n // Fit to the union of the ranges of all loaded tile trees.\r\n const range = options?.baseExtents?.clone() ?? new Range3d();\r\n this.forEachTileTreeRef((ref) => {\r\n ref.unionFitRange(range);\r\n });\r\n\r\n // Fall back to the project extents if necessary.\r\n if (range.isNull)\r\n range.setFrom(this.computeBaseExtents());\r\n\r\n // Avoid ridiculously small extents.\r\n range.ensureMinLengths(1.0);\r\n\r\n return range;\r\n }\r\n\r\n public getViewedExtents(): AxisAlignedBox3d {\r\n // Encompass the project extents and ground plane.\r\n const extents = this.computeBaseExtents();\r\n\r\n // Include any tile trees that extend outside the project extents.\r\n extents.extendRange(this.computeFitRange());\r\n\r\n return extents;\r\n }\r\n\r\n public override toJSON(): SpatialViewDefinitionProps {\r\n const val = super.toJSON() as SpatialViewDefinitionProps;\r\n val.modelSelectorId = this.modelSelector.id;\r\n return val;\r\n }\r\n\r\n /** @internal */\r\n protected override preload(hydrateRequest: HydrateViewStateRequestProps): void {\r\n super.preload(hydrateRequest);\r\n const notLoaded = this.iModel.models.filterLoaded(this.modelSelector.models);\r\n if (undefined === notLoaded)\r\n return; // all requested models are already loaded\r\n hydrateRequest.notLoadedModelSelectorStateModels = CompressedId64Set.sortAndCompress(notLoaded);\r\n }\r\n\r\n /** @internal */\r\n protected override async postload(hydrateResponse: HydrateViewStateResponseProps): Promise<void> {\r\n const promises = [];\r\n promises.push(super.postload(hydrateResponse));\r\n if (hydrateResponse.modelSelectorStateModels !== undefined)\r\n promises.push(this.iModel.models.updateLoadedWithModelProps(hydrateResponse.modelSelectorStateModels));\r\n await Promise.all(promises);\r\n }\r\n\r\n public viewsModel(modelId: Id64String): boolean { return this.modelSelector.containsModel(modelId); }\r\n public clearViewedModels() { this.modelSelector.models.clear(); }\r\n public addViewedModel(id: Id64String) { this.modelSelector.addModels(id); }\r\n public removeViewedModel(id: Id64String) { this.modelSelector.dropModels(id); }\r\n\r\n public forEachModel(func: (model: GeometricModelState) => void) {\r\n for (const modelId of this.modelSelector.models) {\r\n const model = this.iModel.models.getLoaded(modelId);\r\n if (undefined !== model && undefined !== model.asGeometricModel3d)\r\n func(model as GeometricModel3dState);\r\n }\r\n }\r\n\r\n /** @internal */\r\n public override forEachModelTreeRef(func: (treeRef: TileTreeReference) => void): void {\r\n for (const ref of this._treeRefs)\r\n func(ref);\r\n }\r\n\r\n /** @internal */\r\n public override createScene(context: SceneContext): void {\r\n super.createScene(context);\r\n context.textureDrapes.forEach((drape) => drape.collectGraphics(context));\r\n context.viewport.target.updateSolarShadows(this.getDisplayStyle3d().wantShadows ? context : undefined);\r\n }\r\n\r\n /** See [[ViewState.attachToViewport]]. */\r\n public override attachToViewport(args: AttachToViewportArgs): void {\r\n super.attachToViewport(args);\r\n this.registerModelSelectorListeners();\r\n this._treeRefs.attachToViewport(args);\r\n }\r\n\r\n /** See [[ViewState.detachFromViewport]]. */\r\n public override detachFromViewport(): void {\r\n super.detachFromViewport();\r\n this._treeRefs.detachFromViewport();\r\n this.unregisterModelSelectorListeners();\r\n }\r\n\r\n /** Chiefly for debugging: change the \"deactivated\" state of one or more tile tree references. Deactivated references are\r\n * omitted when iterating the references, so e.g. their graphics are omitted from the scene.\r\n * @param modelIds The Ids of one or more models whose tile tree references are to be affected. If omitted, all models are affected.\r\n * @param deactivated True to deactivate the specified references, false to reactivate them, undefined to invert each one's current state.\r\n * @param which The references to be affected as either a broad category or one or more indices of animated references.\r\n * @internal\r\n */\r\n public setTileTreeReferencesDeactivated(modelIds: Id64String | Id64String[] | undefined, deactivated: boolean | undefined, which: \"all\" | \"animated\" | \"primary\" | \"section\" | number[]): void {\r\n this._treeRefs.setDeactivated(modelIds, deactivated, which);\r\n }\r\n\r\n /** For getting the [TileTreeReference]s that are in the modelIds, for planar classification.\r\n * @param modelIds modelIds for which to get the TileTreeReferences\r\n * @param maskTreeRefs where to store the TileTreeReferences\r\n * @param maskRange range to extend for the maskRefs\r\n * @internal\r\n */\r\n public collectMaskRefs(modelIds: OrderedId64Iterable, maskTreeRefs: TileTreeReference[], maskRange: Range3d): void {\r\n this._treeRefs.collectMaskRefs(modelIds, maskTreeRefs, maskRange);\r\n }\r\n\r\n /** For getting a list of modelIds which do not participate in masking for planar classification.\r\n * @param maskModels models which DO participate in planar clip masking\r\n * @param useVisible when true, use visible models to set flag\r\n * @internal\r\n */\r\n public getModelsNotInMask(maskModels: OrderedId64Iterable | undefined, useVisible: boolean): Id64String[] | undefined {\r\n return this._treeRefs.getModelsNotInMask(maskModels, useVisible);\r\n }\r\n\r\n private registerModelSelectorListeners(): void {\r\n const models = this.modelSelector.observableModels;\r\n const func = () => {\r\n this.markModelSelectorChanged();\r\n this.onViewedModelsChanged.raiseEvent();\r\n };\r\n\r\n this._unregisterModelSelectorListeners.push(models.onAdded.addListener(func));\r\n this._unregisterModelSelectorListeners.push(models.onDeleted.addListener(func));\r\n this._unregisterModelSelectorListeners.push(models.onCleared.addListener(func));\r\n }\r\n\r\n private unregisterModelSelectorListeners(): void {\r\n this._unregisterModelSelectorListeners.forEach((f) => f());\r\n this._unregisterModelSelectorListeners.length = 0;\r\n }\r\n}\r\n/** Defines a spatial view that displays geometry on the image plane using a parallel orthographic projection.\r\n * @public\r\n * @extensions\r\n */\r\nexport class OrthographicViewState extends SpatialViewState {\r\n public static override get className() { return \"OrthographicViewDefinition\"; }\r\n\r\n constructor(props: SpatialViewDefinitionProps, iModel: IModelConnection, categories: CategorySelectorState, displayStyle: DisplayStyle3dState, modelSelector: ModelSelectorState) { super(props, iModel, categories, displayStyle, modelSelector); }\r\n\r\n public override supportsCamera(): boolean { return false; }\r\n}\r\n"]}
@@ -34,6 +34,8 @@ export declare class SubCategoriesCache {
34
34
  * containing the corresponding promise and the set of categories still to be loaded.
35
35
  */
36
36
  load(categoryIds: Id64Arg): SubCategoriesRequest | undefined;
37
+ /** Load all subcategories that come from used spatial categories of the iModel into the cache. */
38
+ loadAllUsedSpatialSubCategories(): Promise<void>;
37
39
  /** Given categoryIds, return which of these are not cached. */
38
40
  private getMissing;
39
41
  clear(): void;
@@ -43,7 +45,7 @@ export declare class SubCategoriesCache {
43
45
  /** Exposed strictly for tests.
44
46
  * @internal
45
47
  */
46
- add(categoryId: string, subCategoryId: string, appearance: SubCategoryAppearance): void;
48
+ add(categoryId: string, subCategoryId: string, appearance: SubCategoryAppearance, override: boolean): void;
47
49
  getCategoryInfo(inputCategoryIds: Id64String | Iterable<Id64String>): Promise<Map<Id64String, IModelConnection.Categories.CategoryInfo>>;
48
50
  getSubCategoryInfo(categoryId: Id64String, inputSubCategoryIds: Id64String | Iterable<Id64String>): Promise<Map<Id64String, IModelConnection.Categories.SubCategoryInfo>>;
49
51
  private mapSubCategoryInfos;
@@ -1 +1 @@
1
- {"version":3,"file":"SubCategoriesCache.d.ts","sourceRoot":"","sources":["../../src/SubCategoriesCache.ts"],"names":[],"mappings":"AAKA,OAAO,EAAmC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAuB,MAAM,qBAAqB,CAAC;AACzH,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;GAGG;AACH,MAAM,WAAW,oBAAoB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AAQ,CAAC,EAAE,UAAU,CAAC;QAChC,SAAS,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;QAC7B,SAAS,CAAC,QAAQ,CAAC,EAAE,oBAAoB,CAAC;QAC1C,SAAS,CAAC,SAAS,UAAS;QAE5B;;WAEG;QACI,IAAI,CAAC,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI;QASnF,+CAA+C;QACxC,OAAO,IAAI,IAAI;QAWtB,IAAW,OAAO,IAAI,OAAO,CAE5B;QAED,OAAO,CAAC,WAAW;QAgBnB,OAAO,CAAC,cAAc;QAoCtB,OAAO,CAAC,QAAQ;KAgBjB;CACF"}
@@ -42,6 +42,18 @@ class SubCategoriesCache {
42
42
  cancel: () => request.cancel(),
43
43
  };
44
44
  }
45
+ /** Load all subcategories that come from used spatial categories of the iModel into the cache. */
46
+ async loadAllUsedSpatialSubCategories() {
47
+ try {
48
+ const results = await this._imodel.queryAllUsedSpatialSubCategories();
49
+ if (undefined !== results) {
50
+ this.processResults(results, new Set(), false);
51
+ }
52
+ }
53
+ catch (e) {
54
+ // In case of a truncated response, gracefully handle the error and exit.
55
+ }
56
+ }
45
57
  /** Given categoryIds, return which of these are not cached. */
46
58
  getMissing(categoryIds) {
47
59
  let missing;
@@ -67,9 +79,10 @@ class SubCategoriesCache {
67
79
  props = JSON.parse(json);
68
80
  return new core_common_1.SubCategoryAppearance(props);
69
81
  }
70
- processResults(result, missing) {
71
- for (const row of result)
72
- this.add(row.parentId, row.id, SubCategoriesCache.createSubCategoryAppearance(row.appearance));
82
+ processResults(result, missing, override = true) {
83
+ for (const row of result) {
84
+ this.add(row.parentId, row.id, SubCategoriesCache.createSubCategoryAppearance(row.appearance), override);
85
+ }
73
86
  // Ensure that any category Ids which returned no results (e.g., non-existent category, invalid Id, etc) are still recorded so they are not repeatedly re-requested
74
87
  for (const id of missing)
75
88
  if (undefined === this._byCategoryId.get(id))
@@ -78,12 +91,13 @@ class SubCategoriesCache {
78
91
  /** Exposed strictly for tests.
79
92
  * @internal
80
93
  */
81
- add(categoryId, subCategoryId, appearance) {
94
+ add(categoryId, subCategoryId, appearance, override) {
82
95
  let set = this._byCategoryId.get(categoryId);
83
96
  if (undefined === set)
84
97
  this._byCategoryId.set(categoryId, set = new Set());
85
98
  set.add(subCategoryId);
86
- this._appearances.set(subCategoryId, appearance);
99
+ if (override)
100
+ this._appearances.set(subCategoryId, appearance);
87
101
  }
88
102
  async getCategoryInfo(inputCategoryIds) {
89
103
  // Eliminate duplicates...
@@ -1 +1 @@
1
- {"version":3,"file":"SubCategoriesCache.js","sourceRoot":"","sources":["../../src/SubCategoriesCache.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,sDAAyH;AACzH,oDAAiF;AAkBjF,MAAM,sBAAsB,GAAG,IAAI,GAAG,EAAU,CAAC;AAEjD;;GAEG;AACH,MAAa,kBAAkB;IAM7B,YAAmB,MAAwB;QAL1B,kBAAa,GAAG,IAAI,GAAG,EAAmB,CAAC;QAC3C,iBAAY,GAAG,IAAI,GAAG,EAAiC,CAAC;QAI1B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAAC,CAAC;IAEvE,wIAAwI;IACjI,gBAAgB,CAAC,UAAkB,IAAyB,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAE/G,wHAAwH;IACjH,wBAAwB,CAAC,aAAyB,IAAuC,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;IAEzJ;;;;OAIG;IACI,IAAI,CAAC,WAAoB;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAC7C,IAAI,SAAS,KAAK,OAAO;YACvB,OAAO,SAAS,CAAC;QAEnB,MAAM,OAAO,GAAG,IAAI,kBAAkB,CAAC,OAAO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C,IAAA,qBAAM,EAAC,SAAS,KAAK,IAAI,CAAC,QAAQ,CAAC,CAAC;YAEpC,IAAI,SAAS,KAAK,IAAI,CAAC,KAAK,EAAE,CAAC;gBAC7B,2DAA2D;gBAC3D,sJAAsJ;gBACtJ,iIAAiI;gBACjI,IAAI,CAAC,KAAK,GAAG,IAAI,UAAU,CAAC,mBAAI,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;YACrE,CAAC;iBAAM,CAAC;gBACN,mGAAmG;gBACnG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC5B,KAAK,MAAM,UAAU,IAAI,mBAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;oBACjD,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC;KACF;IAvGY,wBAAK,QAuGjB,CAAA;AACH,CAAC,EAjLgB,kBAAkB,kCAAlB,kBAAkB,QAiLlC","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\r\nimport { assert, CompressedId64Set, Id64, Id64Arg, Id64Set, Id64String, OrderedId64Iterable } from \"@itwin/core-bentley\";\r\nimport { SubCategoryAppearance, SubCategoryResultRow } from \"@itwin/core-common\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\n\r\n/** A cancelable paginated request for subcategory information.\r\n * @see SubCategoriesCache\r\n * @internal\r\n */\r\nexport interface SubCategoriesRequest {\r\n /** The Ids of any categories which were requested but were not yet loaded. */\r\n readonly missingCategoryIds: Id64Set;\r\n /** A promise which resolves to true when all of the requested categories have been loaded, or to false if not all categories were loaded.\r\n * Categories may fail to load if the request is explicitly canceled or if the IModelConnection is closed before all categories are loaded.\r\n */\r\n readonly promise: Promise<boolean>;\r\n /** Cancels the request. */\r\n cancel(): void;\r\n}\r\n\r\nconst invalidCategoryIdEntry = new Set<string>();\r\n\r\n/** A cache of information about the subcategories contained within an [[IModelConnection]]. It is populated on demand.\r\n * @internal\r\n */\r\nexport class SubCategoriesCache {\r\n private readonly _byCategoryId = new Map<string, Id64Set>();\r\n private readonly _appearances = new Map<string, SubCategoryAppearance>();\r\n private readonly _imodel: IModelConnection;\r\n private _missingAtTimeOfPreload: Id64Set | undefined;\r\n\r\n public constructor(imodel: IModelConnection) { this._imodel = imodel; }\r\n\r\n /** Get the Ids of all subcategories belonging to the category with the specified Id, or undefined if no such information is present. */\r\n public getSubCategories(categoryId: string): Id64Set | undefined { return this._byCategoryId.get(categoryId); }\r\n\r\n /** Get the base appearance of the subcategory with the specified Id, or undefined if no such information is present. */\r\n public getSubCategoryAppearance(subCategoryId: Id64String): SubCategoryAppearance | undefined { return this._appearances.get(subCategoryId.toString()); }\r\n\r\n /** Request that the subcategory information for all of the specified categories is loaded.\r\n * If all such information has already been loaded, returns undefined.\r\n * Otherwise, dispatches an asynchronous request to load those categories which are not already loaded and returns a cancellable request object\r\n * containing the corresponding promise and the set of categories still to be loaded.\r\n */\r\n public load(categoryIds: Id64Arg): SubCategoriesRequest | undefined {\r\n const missing = this.getMissing(categoryIds);\r\n if (undefined === missing)\r\n return undefined;\r\n\r\n const request = new SubCategoriesCache.Request(missing, this._imodel);\r\n const promise = request.dispatch().then((result?: SubCategoriesCache.Result) => {\r\n if (undefined !== result)\r\n this.processResults(result, missing);\r\n\r\n return !request.wasCanceled;\r\n });\r\n\r\n return {\r\n missingCategoryIds: missing,\r\n promise,\r\n cancel: () => request.cancel(),\r\n };\r\n }\r\n\r\n /** Given categoryIds, return which of these are not cached. */\r\n private getMissing(categoryIds: Id64Arg): Id64Set | undefined {\r\n let missing: Id64Set | undefined;\r\n for (const catId of Id64.iterable(categoryIds)) {\r\n if (undefined === this._byCategoryId.get(catId)) {\r\n if (undefined === missing)\r\n missing = new Set<string>();\r\n\r\n missing.add(catId);\r\n }\r\n }\r\n\r\n return missing;\r\n }\r\n\r\n public clear(): void {\r\n this._byCategoryId.clear();\r\n this._appearances.clear();\r\n }\r\n\r\n public onIModelConnectionClose(): void {\r\n this.clear();\r\n }\r\n\r\n private static createSubCategoryAppearance(json?: any) {\r\n let props: SubCategoryAppearance.Props | undefined;\r\n if (\"string\" === typeof json && 0 < json.length)\r\n props = JSON.parse(json);\r\n\r\n return new SubCategoryAppearance(props);\r\n }\r\n\r\n private processResults(result: SubCategoriesCache.Result, missing: Id64Set): void {\r\n for (const row of result)\r\n this.add(row.parentId, row.id, SubCategoriesCache.createSubCategoryAppearance(row.appearance));\r\n\r\n // Ensure that any category Ids which returned no results (e.g., non-existent category, invalid Id, etc) are still recorded so they are not repeatedly re-requested\r\n for (const id of missing)\r\n if (undefined === this._byCategoryId.get(id))\r\n this._byCategoryId.set(id, invalidCategoryIdEntry);\r\n }\r\n\r\n /** Exposed strictly for tests.\r\n * @internal\r\n */\r\n public add(categoryId: string, subCategoryId: string, appearance: SubCategoryAppearance) {\r\n let set = this._byCategoryId.get(categoryId);\r\n if (undefined === set)\r\n this._byCategoryId.set(categoryId, set = new Set<string>());\r\n\r\n set.add(subCategoryId);\r\n this._appearances.set(subCategoryId, appearance);\r\n }\r\n\r\n public async getCategoryInfo(inputCategoryIds: Id64String | Iterable<Id64String>): Promise<Map<Id64String, IModelConnection.Categories.CategoryInfo>> {\r\n // Eliminate duplicates...\r\n const categoryIds = new Set<string>(typeof inputCategoryIds === \"string\" ? [inputCategoryIds] : inputCategoryIds);\r\n const req = this.load(categoryIds);\r\n if (req)\r\n await req.promise;\r\n\r\n const map = new Map<Id64String, IModelConnection.Categories.CategoryInfo>();\r\n for (const categoryId of categoryIds) {\r\n const subCategoryIds = this._byCategoryId.get(categoryId);\r\n if (!subCategoryIds)\r\n continue;\r\n\r\n const subCategories = this.mapSubCategoryInfos(categoryId, subCategoryIds);\r\n map.set(categoryId, { id: categoryId, subCategories });\r\n }\r\n\r\n return map;\r\n }\r\n\r\n public async getSubCategoryInfo(categoryId: Id64String, inputSubCategoryIds: Id64String | Iterable<Id64String>): Promise<Map<Id64String, IModelConnection.Categories.SubCategoryInfo>> {\r\n // Eliminate duplicates...\r\n const subCategoryIds = new Set<string>(typeof inputSubCategoryIds === \"string\" ? [inputSubCategoryIds] : inputSubCategoryIds);\r\n const req = this.load(categoryId);\r\n if (req)\r\n await req.promise;\r\n\r\n return this.mapSubCategoryInfos(categoryId, subCategoryIds);\r\n }\r\n\r\n private mapSubCategoryInfos(categoryId: Id64String, subCategoryIds: Set<Id64String>): Map<Id64String, IModelConnection.Categories.SubCategoryInfo> {\r\n const map = new Map<Id64String, IModelConnection.Categories.SubCategoryInfo>();\r\n for (const id of subCategoryIds) {\r\n const appearance = this._appearances.get(id);\r\n if (appearance)\r\n map.set(id, { id, categoryId, appearance });\r\n }\r\n\r\n return map;\r\n }\r\n}\r\n\r\n/** This namespace and the types within it are exported strictly for use in tests.\r\n * @internal\r\n */\r\nexport namespace SubCategoriesCache { // eslint-disable-line no-redeclare\r\n export type Result = SubCategoryResultRow[];\r\n\r\n export class Request {\r\n private readonly _imodel: IModelConnection;\r\n private readonly _categoryIds: CompressedId64Set[] = [];\r\n private readonly _result: Result = [];\r\n private _canceled = false;\r\n private _curCategoryIdsIndex = 0;\r\n\r\n public get wasCanceled() { return this._canceled || this._imodel.isClosed; }\r\n\r\n public constructor(categoryIds: Set<string>, imodel: IModelConnection, maxCategoriesPerQuery = 2500) {\r\n this._imodel = imodel;\r\n\r\n const catIds = [...categoryIds];\r\n OrderedId64Iterable.sortArray(catIds); // sort categories, so that given the same set of categoryIds we will always create the same batches.\r\n while (catIds.length !== 0) {\r\n const end = (catIds.length > maxCategoriesPerQuery) ? maxCategoriesPerQuery : catIds.length;\r\n const compressedIds = CompressedId64Set.compressArray(catIds.splice(0, end));\r\n this._categoryIds.push(compressedIds);\r\n }\r\n }\r\n\r\n public cancel() { this._canceled = true; }\r\n\r\n public async dispatch(): Promise<Result | undefined> {\r\n if (this.wasCanceled || this._curCategoryIdsIndex >= this._categoryIds.length) // handle case of empty category Id set...\r\n return undefined;\r\n\r\n try {\r\n const catIds = this._categoryIds[this._curCategoryIdsIndex];\r\n const result = await this._imodel.querySubCategories(catIds);\r\n this._result.push(...result);\r\n if (this.wasCanceled)\r\n return undefined;\r\n } catch {\r\n // ###TODO: detect cases in which retry is warranted\r\n // Note that currently, if we succeed in obtaining some pages of results and fail to retrieve another page, we will end up processing the\r\n // incomplete results. Since we're not retrying, that's the best we can do.\r\n }\r\n\r\n // Finished with current batch of categoryIds. Dispatch the next batch if one exists.\r\n if (++this._curCategoryIdsIndex < this._categoryIds.length) {\r\n if (this.wasCanceled)\r\n return undefined;\r\n else\r\n return this.dispatch();\r\n }\r\n\r\n // Even if we were canceled, we've retrieved all the rows. Might as well process them to prevent another request for some of the same rows from being enqueued.\r\n return this._result;\r\n }\r\n }\r\n\r\n export type QueueFunc = () => void;\r\n\r\n export class QueueEntry {\r\n public readonly categoryIds: Id64Set;\r\n public readonly funcs: QueueFunc[];\r\n\r\n public constructor(categoryIds: Id64Set, func: QueueFunc) {\r\n this.categoryIds = categoryIds;\r\n this.funcs = [func];\r\n }\r\n }\r\n\r\n /** A \"queue\" of SubCategoriesRequests, which consists of between 0 and 2 entries. Each entry specifies the set of category IDs to be loaded and a list of functions to be executed\r\n * when loading is completed. This is used to enforce ordering of operations upon subcategories despite the need to asynchronously load them. It incidentally also provides an\r\n * opportunity to reduce the number of backend requests by batching consecutive requests.\r\n * Chiefly used by [[Viewport]].\r\n * @internal\r\n */\r\n export class Queue {\r\n /* NB: Members marked protected for use in tests only. */\r\n protected _current?: QueueEntry;\r\n protected _next?: QueueEntry;\r\n protected _request?: SubCategoriesRequest;\r\n protected _disposed = false;\r\n\r\n /** Push a request onto the queue. The requested categories will be loaded if necessary, and then\r\n * the supplied function will be invoked. Any previously-pushed requests are guaranteed to be processed before this one.\r\n */\r\n public push(cache: SubCategoriesCache, categoryIds: Id64Arg, func: QueueFunc): void {\r\n if (this._disposed)\r\n return;\r\n else if (undefined === this._current)\r\n this.pushCurrent(cache, categoryIds, func);\r\n else\r\n this.pushNext(categoryIds, func);\r\n }\r\n\r\n /** Cancel all requests and empty the queue. */\r\n public dispose(): void {\r\n if (undefined !== this._request) {\r\n assert(undefined !== this._current);\r\n this._request.cancel();\r\n this._request = undefined;\r\n }\r\n\r\n this._current = this._next = undefined;\r\n this._disposed = true;\r\n }\r\n\r\n public get isEmpty(): boolean {\r\n return undefined === this._current && undefined === this._next;\r\n }\r\n\r\n private pushCurrent(cache: SubCategoriesCache, categoryIds: Id64Arg, func: QueueFunc): void {\r\n assert(undefined === this._next);\r\n assert(undefined === this._current);\r\n assert(undefined === this._request);\r\n\r\n this._request = cache.load(categoryIds);\r\n if (undefined === this._request) {\r\n // All requested categories are already loaded.\r\n func();\r\n return;\r\n } else {\r\n // We need to load the requested categories before invoking the function.\r\n this.processCurrent(cache, new QueueEntry(Id64.toIdSet(categoryIds, true), func));\r\n }\r\n }\r\n\r\n private processCurrent(cache: SubCategoriesCache, entry: QueueEntry): void {\r\n assert(undefined !== this._request);\r\n assert(undefined === this._current);\r\n assert(undefined === this._next);\r\n\r\n this._current = entry;\r\n this._request.promise.then((completed: boolean) => { // eslint-disable-line @typescript-eslint/no-floating-promises\r\n if (this._disposed)\r\n return;\r\n\r\n // Invoke all the functions which were awaiting this set of IModelConnection.Categories.\r\n assert(undefined !== this._current);\r\n if (completed)\r\n for (const func of this._current.funcs)\r\n func();\r\n\r\n this._request = undefined;\r\n this._current = undefined;\r\n\r\n // If we have more requests, process them.\r\n const next = this._next;\r\n this._next = undefined;\r\n if (undefined !== next) {\r\n this._request = cache.load(next.categoryIds);\r\n if (undefined === this._request) {\r\n // All categories loaded.\r\n for (const func of next.funcs)\r\n func();\r\n } else {\r\n // We need to load the requested categories before invoking the pending functions.\r\n this.processCurrent(cache, next);\r\n }\r\n }\r\n });\r\n }\r\n\r\n private pushNext(categoryIds: Id64Arg, func: QueueFunc): void {\r\n assert(undefined !== this._current);\r\n assert(undefined !== this._request);\r\n\r\n if (undefined === this._next) {\r\n // We have a request currently in process and none pending.\r\n // We could potentially determine that this request doesn't require any categories that are not already loaded or being loaded by the current request.\r\n // But we will find that out (synchronously) when current request completes, unless more requests come in. Probably not worth it.\r\n this._next = new QueueEntry(Id64.toIdSet(categoryIds, true), func);\r\n } else {\r\n // We have a request currently in process, and one or more pending. Append this one to the pending.\r\n this._next.funcs.push(func);\r\n for (const categoryId of Id64.iterable(categoryIds))\r\n this._next.categoryIds.add(categoryId);\r\n }\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"SubCategoriesCache.js","sourceRoot":"","sources":["../../src/SubCategoriesCache.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,sDAAyH;AACzH,oDAAiF;AAkBjF,MAAM,sBAAsB,GAAG,IAAI,GAAG,EAAU,CAAC;AAEjD;;GAEG;AACH,MAAa,kBAAkB;IAM7B,YAAmB,MAAwB;QAL1B,kBAAa,GAAG,IAAI,GAAG,EAAmB,CAAC;QAC3C,iBAAY,GAAG,IAAI,GAAG,EAAiC,CAAC;QAI1B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAAC,CAAC;IAEvE,wIAAwI;IACjI,gBAAgB,CAAC,UAAkB,IAAyB,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAE/G,wHAAwH;IACjH,wBAAwB,CAAC,aAAyB,IAAuC,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;IAEzJ;;;;OAIG;IACI,IAAI,CAAC,WAAoB;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAC7C,IAAI,SAAS,KAAK,OAAO;YACvB,OAAO,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vB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;oBAC7C,IAAI,SAAS,KAAK,IAAI,CAAC,QAAQ,EAAE,CAAC;wBAChC,yBAAyB;wBACzB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK;4BAC3B,IAAI,EAAE,CAAC;oBACX,CAAC;yBAAM,CAAC;wBACN,kFAAkF;wBAClF,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;oBACnC,CAAC;gBACH,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QAEO,QAAQ,CAAC,WAAoB,EAAE,IAAe;YACpD,IAAA,qBAAM,EAAC,SAAS,KAAK,IAAI,CAAC,QAAQ,CAAC,CAAC;YACpC,IAAA,qBAAM,EAAC,SAAS,KAAK,IAAI,CAAC,QAAQ,CAAC,CAAC;YAEpC,IAAI,SAAS,KAAK,IAAI,CAAC,KAAK,EAAE,CAAC;gBAC7B,2DAA2D;gBAC3D,sJAAsJ;gBACtJ,iIAAiI;gBACjI,IAAI,CAAC,KAAK,GAAG,IAAI,UAAU,CAAC,mBAAI,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;YACrE,CAAC;iBAAM,CAAC;gBACN,mGAAmG;gBACnG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC5B,KAAK,MAAM,UAAU,IAAI,mBAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;oBACjD,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC;KACF;IAvGY,wBAAK,QAuGjB,CAAA;AACH,CAAC,EAjLgB,kBAAkB,kCAAlB,kBAAkB,QAiLlC","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\r\nimport { assert, CompressedId64Set, Id64, Id64Arg, Id64Set, Id64String, OrderedId64Iterable } from \"@itwin/core-bentley\";\r\nimport { SubCategoryAppearance, SubCategoryResultRow } from \"@itwin/core-common\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\n\r\n/** A cancelable paginated request for subcategory information.\r\n * @see SubCategoriesCache\r\n * @internal\r\n */\r\nexport interface SubCategoriesRequest {\r\n /** The Ids of any categories which were requested but were not yet loaded. */\r\n readonly missingCategoryIds: Id64Set;\r\n /** A promise which resolves to true when all of the requested categories have been loaded, or to false if not all categories were loaded.\r\n * Categories may fail to load if the request is explicitly canceled or if the IModelConnection is closed before all categories are loaded.\r\n */\r\n readonly promise: Promise<boolean>;\r\n /** Cancels the request. */\r\n cancel(): void;\r\n}\r\n\r\nconst invalidCategoryIdEntry = new Set<string>();\r\n\r\n/** A cache of information about the subcategories contained within an [[IModelConnection]]. It is populated on demand.\r\n * @internal\r\n */\r\nexport class SubCategoriesCache {\r\n private readonly _byCategoryId = new Map<string, Id64Set>();\r\n private readonly _appearances = new Map<string, SubCategoryAppearance>();\r\n private readonly _imodel: IModelConnection;\r\n private _missingAtTimeOfPreload: Id64Set | undefined;\r\n\r\n public constructor(imodel: IModelConnection) { this._imodel = imodel; }\r\n\r\n /** Get the Ids of all subcategories belonging to the category with the specified Id, or undefined if no such information is present. */\r\n public getSubCategories(categoryId: string): Id64Set | undefined { return this._byCategoryId.get(categoryId); }\r\n\r\n /** Get the base appearance of the subcategory with the specified Id, or undefined if no such information is present. */\r\n public getSubCategoryAppearance(subCategoryId: Id64String): SubCategoryAppearance | undefined { return this._appearances.get(subCategoryId.toString()); }\r\n\r\n /** Request that the subcategory information for all of the specified categories is loaded.\r\n * If all such information has already been loaded, returns undefined.\r\n * Otherwise, dispatches an asynchronous request to load those categories which are not already loaded and returns a cancellable request object\r\n * containing the corresponding promise and the set of categories still to be loaded.\r\n */\r\n public load(categoryIds: Id64Arg): SubCategoriesRequest | undefined {\r\n const missing = this.getMissing(categoryIds);\r\n if (undefined === missing)\r\n return undefined;\r\n\r\n const request = new SubCategoriesCache.Request(missing, this._imodel);\r\n const promise = request.dispatch().then((result?: SubCategoriesCache.Result) => {\r\n if (undefined !== result)\r\n this.processResults(result, missing);\r\n\r\n return !request.wasCanceled;\r\n });\r\n return {\r\n missingCategoryIds: missing,\r\n promise,\r\n cancel: () => request.cancel(),\r\n };\r\n }\r\n\r\n /** Load all subcategories that come from used spatial categories of the iModel into the cache. */\r\n public async loadAllUsedSpatialSubCategories(): Promise<void> {\r\n try {\r\n const results = await this._imodel.queryAllUsedSpatialSubCategories();\r\n if (undefined !== results){\r\n this.processResults(results, new Set<string>(), false);\r\n }\r\n } catch (e) {\r\n // In case of a truncated response, gracefully handle the error and exit.\r\n }\r\n\r\n }\r\n /** Given categoryIds, return which of these are not cached. */\r\n private getMissing(categoryIds: Id64Arg): Id64Set | undefined {\r\n let missing: Id64Set | undefined;\r\n for (const catId of Id64.iterable(categoryIds)) {\r\n if (undefined === this._byCategoryId.get(catId)) {\r\n if (undefined === missing)\r\n missing = new Set<string>();\r\n\r\n missing.add(catId);\r\n }\r\n }\r\n\r\n return missing;\r\n }\r\n\r\n public clear(): void {\r\n this._byCategoryId.clear();\r\n this._appearances.clear();\r\n }\r\n\r\n public onIModelConnectionClose(): void {\r\n this.clear();\r\n }\r\n\r\n private static createSubCategoryAppearance(json?: any) {\r\n let props: SubCategoryAppearance.Props | undefined;\r\n if (\"string\" === typeof json && 0 < json.length)\r\n props = JSON.parse(json);\r\n\r\n return new SubCategoryAppearance(props);\r\n }\r\n\r\n private processResults(result: SubCategoriesCache.Result, missing: Id64Set, override: boolean = true): void {\r\n for (const row of result){\r\n this.add(row.parentId, row.id, SubCategoriesCache.createSubCategoryAppearance(row.appearance), override);\r\n }\r\n\r\n // Ensure that any category Ids which returned no results (e.g., non-existent category, invalid Id, etc) are still recorded so they are not repeatedly re-requested\r\n for (const id of missing)\r\n if (undefined === this._byCategoryId.get(id))\r\n this._byCategoryId.set(id, invalidCategoryIdEntry);\r\n }\r\n\r\n /** Exposed strictly for tests.\r\n * @internal\r\n */\r\n public add(categoryId: string, subCategoryId: string, appearance: SubCategoryAppearance, override: boolean) {\r\n let set = this._byCategoryId.get(categoryId);\r\n if (undefined === set)\r\n this._byCategoryId.set(categoryId, set = new Set<string>());\r\n\r\n set.add(subCategoryId);\r\n if (override)\r\n this._appearances.set(subCategoryId, appearance);\r\n }\r\n\r\n public async getCategoryInfo(inputCategoryIds: Id64String | Iterable<Id64String>): Promise<Map<Id64String, IModelConnection.Categories.CategoryInfo>> {\r\n // Eliminate duplicates...\r\n const categoryIds = new Set<string>(typeof inputCategoryIds === \"string\" ? [inputCategoryIds] : inputCategoryIds);\r\n const req = this.load(categoryIds);\r\n if (req)\r\n await req.promise;\r\n\r\n const map = new Map<Id64String, IModelConnection.Categories.CategoryInfo>();\r\n for (const categoryId of categoryIds) {\r\n const subCategoryIds = this._byCategoryId.get(categoryId);\r\n if (!subCategoryIds)\r\n continue;\r\n\r\n const subCategories = this.mapSubCategoryInfos(categoryId, subCategoryIds);\r\n map.set(categoryId, { id: categoryId, subCategories });\r\n }\r\n\r\n return map;\r\n }\r\n\r\n public async getSubCategoryInfo(categoryId: Id64String, inputSubCategoryIds: Id64String | Iterable<Id64String>): Promise<Map<Id64String, IModelConnection.Categories.SubCategoryInfo>> {\r\n // Eliminate duplicates...\r\n const subCategoryIds = new Set<string>(typeof inputSubCategoryIds === \"string\" ? [inputSubCategoryIds] : inputSubCategoryIds);\r\n const req = this.load(categoryId);\r\n if (req)\r\n await req.promise;\r\n\r\n return this.mapSubCategoryInfos(categoryId, subCategoryIds);\r\n }\r\n\r\n private mapSubCategoryInfos(categoryId: Id64String, subCategoryIds: Set<Id64String>): Map<Id64String, IModelConnection.Categories.SubCategoryInfo> {\r\n const map = new Map<Id64String, IModelConnection.Categories.SubCategoryInfo>();\r\n for (const id of subCategoryIds) {\r\n const appearance = this._appearances.get(id);\r\n if (appearance)\r\n map.set(id, { id, categoryId, appearance });\r\n }\r\n\r\n return map;\r\n }\r\n}\r\n\r\n/** This namespace and the types within it are exported strictly for use in tests.\r\n * @internal\r\n */\r\nexport namespace SubCategoriesCache { // eslint-disable-line no-redeclare\r\n export type Result = SubCategoryResultRow[];\r\n\r\n export class Request {\r\n private readonly _imodel: IModelConnection;\r\n private readonly _categoryIds: CompressedId64Set[] = [];\r\n private readonly _result: Result = [];\r\n private _canceled = false;\r\n private _curCategoryIdsIndex = 0;\r\n\r\n public get wasCanceled() { return this._canceled || this._imodel.isClosed; }\r\n\r\n public constructor(categoryIds: Set<string>, imodel: IModelConnection, maxCategoriesPerQuery = 2500) {\r\n this._imodel = imodel;\r\n\r\n const catIds = [...categoryIds];\r\n OrderedId64Iterable.sortArray(catIds); // sort categories, so that given the same set of categoryIds we will always create the same batches.\r\n while (catIds.length !== 0) {\r\n const end = (catIds.length > maxCategoriesPerQuery) ? maxCategoriesPerQuery : catIds.length;\r\n const compressedIds = CompressedId64Set.compressArray(catIds.splice(0, end));\r\n this._categoryIds.push(compressedIds);\r\n }\r\n }\r\n\r\n public cancel() { this._canceled = true; }\r\n\r\n public async dispatch(): Promise<Result | undefined> {\r\n if (this.wasCanceled || this._curCategoryIdsIndex >= this._categoryIds.length) // handle case of empty category Id set...\r\n return undefined;\r\n\r\n try {\r\n const catIds = this._categoryIds[this._curCategoryIdsIndex];\r\n const result = await this._imodel.querySubCategories(catIds);\r\n this._result.push(...result);\r\n if (this.wasCanceled)\r\n return undefined;\r\n } catch {\r\n // ###TODO: detect cases in which retry is warranted\r\n // Note that currently, if we succeed in obtaining some pages of results and fail to retrieve another page, we will end up processing the\r\n // incomplete results. Since we're not retrying, that's the best we can do.\r\n }\r\n\r\n // Finished with current batch of categoryIds. Dispatch the next batch if one exists.\r\n if (++this._curCategoryIdsIndex < this._categoryIds.length) {\r\n if (this.wasCanceled)\r\n return undefined;\r\n else\r\n return this.dispatch();\r\n }\r\n\r\n // Even if we were canceled, we've retrieved all the rows. Might as well process them to prevent another request for some of the same rows from being enqueued.\r\n return this._result;\r\n }\r\n }\r\n\r\n export type QueueFunc = () => void;\r\n\r\n export class QueueEntry {\r\n public readonly categoryIds: Id64Set;\r\n public readonly funcs: QueueFunc[];\r\n\r\n public constructor(categoryIds: Id64Set, func: QueueFunc) {\r\n this.categoryIds = categoryIds;\r\n this.funcs = [func];\r\n }\r\n }\r\n\r\n /** A \"queue\" of SubCategoriesRequests, which consists of between 0 and 2 entries. Each entry specifies the set of category IDs to be loaded and a list of functions to be executed\r\n * when loading is completed. This is used to enforce ordering of operations upon subcategories despite the need to asynchronously load them. It incidentally also provides an\r\n * opportunity to reduce the number of backend requests by batching consecutive requests.\r\n * Chiefly used by [[Viewport]].\r\n * @internal\r\n */\r\n export class Queue {\r\n /* NB: Members marked protected for use in tests only. */\r\n protected _current?: QueueEntry;\r\n protected _next?: QueueEntry;\r\n protected _request?: SubCategoriesRequest;\r\n protected _disposed = false;\r\n\r\n /** Push a request onto the queue. The requested categories will be loaded if necessary, and then\r\n * the supplied function will be invoked. Any previously-pushed requests are guaranteed to be processed before this one.\r\n */\r\n public push(cache: SubCategoriesCache, categoryIds: Id64Arg, func: QueueFunc): void {\r\n if (this._disposed)\r\n return;\r\n else if (undefined === this._current)\r\n this.pushCurrent(cache, categoryIds, func);\r\n else\r\n this.pushNext(categoryIds, func);\r\n }\r\n\r\n /** Cancel all requests and empty the queue. */\r\n public dispose(): void {\r\n if (undefined !== this._request) {\r\n assert(undefined !== this._current);\r\n this._request.cancel();\r\n this._request = undefined;\r\n }\r\n\r\n this._current = this._next = undefined;\r\n this._disposed = true;\r\n }\r\n\r\n public get isEmpty(): boolean {\r\n return undefined === this._current && undefined === this._next;\r\n }\r\n\r\n private pushCurrent(cache: SubCategoriesCache, categoryIds: Id64Arg, func: QueueFunc): void {\r\n assert(undefined === this._next);\r\n assert(undefined === this._current);\r\n assert(undefined === this._request);\r\n\r\n this._request = cache.load(categoryIds);\r\n if (undefined === this._request) {\r\n // All requested categories are already loaded.\r\n func();\r\n return;\r\n } else {\r\n // We need to load the requested categories before invoking the function.\r\n this.processCurrent(cache, new QueueEntry(Id64.toIdSet(categoryIds, true), func));\r\n }\r\n }\r\n\r\n private processCurrent(cache: SubCategoriesCache, entry: QueueEntry): void {\r\n assert(undefined !== this._request);\r\n assert(undefined === this._current);\r\n assert(undefined === this._next);\r\n\r\n this._current = entry;\r\n this._request.promise.then((completed: boolean) => { // eslint-disable-line @typescript-eslint/no-floating-promises\r\n if (this._disposed)\r\n return;\r\n\r\n // Invoke all the functions which were awaiting this set of IModelConnection.Categories.\r\n assert(undefined !== this._current);\r\n if (completed)\r\n for (const func of this._current.funcs)\r\n func();\r\n\r\n this._request = undefined;\r\n this._current = undefined;\r\n\r\n // If we have more requests, process them.\r\n const next = this._next;\r\n this._next = undefined;\r\n if (undefined !== next) {\r\n this._request = cache.load(next.categoryIds);\r\n if (undefined === this._request) {\r\n // All categories loaded.\r\n for (const func of next.funcs)\r\n func();\r\n } else {\r\n // We need to load the requested categories before invoking the pending functions.\r\n this.processCurrent(cache, next);\r\n }\r\n }\r\n });\r\n }\r\n\r\n private pushNext(categoryIds: Id64Arg, func: QueueFunc): void {\r\n assert(undefined !== this._current);\r\n assert(undefined !== this._request);\r\n\r\n if (undefined === this._next) {\r\n // We have a request currently in process and none pending.\r\n // We could potentially determine that this request doesn't require any categories that are not already loaded or being loaded by the current request.\r\n // But we will find that out (synchronously) when current request completes, unless more requests come in. Probably not worth it.\r\n this._next = new QueueEntry(Id64.toIdSet(categoryIds, true), func);\r\n } else {\r\n // We have a request currently in process, and one or more pending. Append this one to the pending.\r\n this._next.funcs.push(func);\r\n for (const categoryId of Id64.iterable(categoryIds))\r\n this._next.categoryIds.add(categoryId);\r\n }\r\n }\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ViewCreator3d.d.ts","sourceRoot":"","sources":["../../src/ViewCreator3d.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAsC,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAMrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,kIAAkI;AAElI;;;EAGE;AACF,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8DAA8D;IAC9D,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;OAOG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED;;;;;;;;;GASG;AACH,qBAAa,aAAa;IAKZ,OAAO,CAAC,OAAO;IAJ3B;;;OAGG;gBACiB,OAAO,EAAE,gBAAgB;IAE7C;;;;;OAKG;IACU,iBAAiB,CAAC,OAAO,CAAC,EAAE,oBAAoB,EAAE,QAAQ,CAAC,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC;IA+B3G;;;;OAIG;YACW,qBAAqB;IAkGnC;;;OAGG;YACW,cAAc;IAwB5B;;OAEG;YACW,iBAAiB;CAUhC"}
1
+ {"version":3,"file":"ViewCreator3d.d.ts","sourceRoot":"","sources":["../../src/ViewCreator3d.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAsC,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAMrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,kIAAkI;AAElI;;;EAGE;AACF,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8DAA8D;IAC9D,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;OAOG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED;;;;;;;;;GASG;AACH,qBAAa,aAAa;IAKZ,OAAO,CAAC,OAAO;IAJ3B;;;OAGG;gBACiB,OAAO,EAAE,gBAAgB;IAE7C;;;;;OAKG;IACU,iBAAiB,CAAC,OAAO,CAAC,EAAE,oBAAoB,EAAE,QAAQ,CAAC,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC;IAgC3G;;;;OAIG;YACW,qBAAqB;IAkGnC;;;OAGG;YACW,cAAc;IAwB5B;;OAEG;YACW,iBAAiB;CAUhC"}
@@ -44,6 +44,7 @@ class ViewCreator3d {
44
44
  const props = await this._createViewStateProps(core_bentley_1.CompressedId64Set.decompressArray(serializedProps.modelIds), core_bentley_1.CompressedId64Set.decompressArray(serializedProps.categoryIds), baseExtents, options);
45
45
  const viewState = SpatialViewState_1.SpatialViewState.createFromProps(props, this._imodel);
46
46
  try {
47
+ await viewState.iModel.subcategories.loadAllUsedSpatialSubCategories();
47
48
  await viewState.load();
48
49
  }
49
50
  catch {
@@ -1 +1 @@
1
- {"version":3,"file":"ViewCreator3d.js","sourceRoot":"","sources":["../../src/ViewCreator3d.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sDAAqF;AACrF,oDAG4B;AAC5B,wDAA+C;AAE/C,yDAAsD;AAsCt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;YACxD,mBAAmB,EAAE,aAAa,CAAC,MAAM,EAAE;YAC3C,iBAAiB,EAAE,aAAa,CAAC,YAAY,CAAC,MAAM,EAAE;SACvD,CAAC;QACF,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,iBAAiB,CAAC;QAChE,IAAI,kBAAkB,CAAC,cAAc,KAAK,SAAS,EAAE,CAAC;YACpD,kBAAkB,CAAC,cAAc,CAAC,MAAM,GAAG;gBACzC,GAAG,kBAAkB,CAAC,cAAc,CAAC,MAAM;gBAC3C,GAAG,cAAc,CAAC,iBAAiB,CAAC,cAAe,CAAC,MAAM;aAC3D,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,GAAG,kBAAkB,EAAE,GAAG,cAAc,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,CAAC;IAC7F,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,iBAAiB;QAC7B,mDAAmD;QACnD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,kBAAkB,EAAE,CAAC;QAC7D,IAAI,MAAM,KAAK,mBAAI,CAAC,OAAO;YACzB,OAAO,MAAM,CAAC;QAEhB,gCAAgC;QAChC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,mCAAgB,CAAC,aAAa,EAAE,CAAC,CAAC;QAC9H,OAAO,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5D,CAAC;CACF;AA5LD,sCA4LC","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\r\n/** @packageDocumentation\r\n * @module Views\r\n */\r\n\r\nimport { CompressedId64Set, Id64, Id64Array, Id64String } from \"@itwin/core-bentley\";\r\nimport {\r\n Camera, CategorySelectorProps, Code, CustomViewState3dCreatorOptions, DisplayStyle3dProps, Environment, IModel, IModelReadRpcInterface,\r\n ModelSelectorProps, RenderMode, ViewDefinition3dProps, ViewStateProps,\r\n} from \"@itwin/core-common\";\r\nimport { Range3d } from \"@itwin/core-geometry\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\nimport { SpatialViewState } from \"./SpatialViewState\";\r\nimport { StandardViewId } from \"./StandardView\";\r\nimport { ViewState } from \"./ViewState\";\r\n\r\n/** Api for creating a 3d default view for an iModel. Either takes in a list of modelIds, or displays all 3d models by default. */\r\n\r\n/** Options for creating a [[ViewState3d]] via [[ViewCreator3d]].\r\n * @public\r\n * @extensions\r\n*/\r\nexport interface ViewCreator3dOptions {\r\n /** Turn the [[Camera]] on to produce a perspective view.\r\n * Default: true\r\n */\r\n cameraOn?: boolean;\r\n /** Enables display of a [[SkyBox]] in the view. */\r\n skyboxOn?: boolean;\r\n /** Orients the view to one of the standard view rotations. */\r\n standardViewId?: StandardViewId;\r\n /** Merge in props from a persistent \"seed\" view obtained from the iModel.\r\n * @note The selection of the seed view is somewhat arbitrary, and the contents and styling of that view are unpredictable, so this option is not recommended.\r\n */\r\n useSeedView?: boolean;\r\n /** The desired aspect ratio of the [[Viewport]] in which the view is to be displayed.\r\n * This is used to adjust the view's frustum so that the viewed models are better centered within the viewport.\r\n */\r\n vpAspect?: number;\r\n /** Indicates that geometry belonging to every [SubCategory]($backend) should be visible within the view.\r\n * Each subcategory has a [SubCategoryAppearance]($common) that specifies how its geometry is displayed. This includes a [SubCategoryAppearance.invisible]($common) property that,\r\n * when set to `true`, indicates the geometry should not be displayed at all. A view can override the appearances of any subcategories using a [SubCategoryOverride]($common).\r\n * If `allSubCategoriesVisible` is `true`, [[ViewCreator3d]] will apply such an override to every viewed subcategory to change [SubCategoryOverride.invisible]($common) to `false`, making\r\n * every subcategory visible.\r\n * @note Subcategories are typically set to invisible by default for a reason.\r\n * Forcing them all to be visible may produce undesirable results, such as z-fighting between geometry on different subcategories that are not intended to be viewed together.\r\n */\r\n allSubCategoriesVisible?: boolean;\r\n}\r\n\r\n/**\r\n * API for creating a 3D default [[ViewState3d]] for an iModel. @see [[ViewCreator2d]] to create a view for a 2d model.\r\n * Example usage:\r\n * ```ts\r\n * const viewCreator = new ViewCreator3d(imodel);\r\n * const defaultView = await viewCreator.createDefaultView({skyboxOn: true});\r\n * ```\r\n * @public\r\n * @extensions\r\n */\r\nexport class ViewCreator3d {\r\n /**\r\n * Constructs a ViewCreator3d using an [[IModelConnection]].\r\n * @param _imodel [[IModelConnection]] to query for categories and/or models.\r\n */\r\n constructor(private _imodel: IModelConnection) { }\r\n\r\n /**\r\n * Creates a default [[ViewState3d]] based on the model ids passed in. If no model ids are passed in, all 3D models in the iModel are used.\r\n * @param [options] Options for creating the view.\r\n * @param [modelIds] Ids of models to display in the view.\r\n * @throws [IModelError]($common) If no 3d models are found in the iModel.\r\n */\r\n public async createDefaultView(options?: ViewCreator3dOptions, modelIds?: Id64String[]): Promise<ViewState> {\r\n const rpcOptions: CustomViewState3dCreatorOptions = modelIds ? { modelIds: CompressedId64Set.sortAndCompress(modelIds) } : {};\r\n const rpc = IModelReadRpcInterface.getClientForRouting(this._imodel.routingContext.token);\r\n const serializedProps = await rpc.getCustomViewState3dData(this._imodel.getRpcProps(), rpcOptions);\r\n\r\n const baseExtents = Range3d.fromJSON(serializedProps.modelExtents);\r\n const props = await this._createViewStateProps(\r\n CompressedId64Set.decompressArray(serializedProps.modelIds),\r\n CompressedId64Set.decompressArray(serializedProps.categoryIds),\r\n baseExtents,\r\n options,\r\n );\r\n\r\n const viewState = SpatialViewState.createFromProps(props, this._imodel);\r\n try {\r\n await viewState.load();\r\n } catch {\r\n }\r\n\r\n if (options?.standardViewId)\r\n viewState.setStandardRotation(options.standardViewId);\r\n\r\n if (options?.allSubCategoriesVisible)\r\n viewState.displayStyle.enableAllLoadedSubCategories(viewState.categorySelector.categories);\r\n\r\n const range = viewState.computeFitRange({ baseExtents });\r\n viewState.lookAtVolume(range, options?.vpAspect);\r\n\r\n return viewState;\r\n }\r\n\r\n /**\r\n * Generates a view state props object for creating a view. Merges display styles with a seed view if the options.useSeedView is true\r\n * @param models Models to put in view props\r\n * @param options view creation options like camera On and skybox On\r\n */\r\n private async _createViewStateProps(models: Id64Array, categories: Id64Array, modelExtents: Range3d, options?: ViewCreator3dOptions): Promise<ViewStateProps> {\r\n // Use dictionary model in all props\r\n const dictionaryId = IModel.dictionaryId;\r\n\r\n if (modelExtents.isNull)\r\n modelExtents.setFrom(this._imodel.projectExtents);\r\n\r\n let originX = modelExtents.low.x;\r\n let originY = modelExtents.low.y;\r\n const originZ = modelExtents.low.z;\r\n let deltaX = modelExtents.xLength();\r\n let deltaY = modelExtents.yLength();\r\n const deltaZ = modelExtents.zLength();\r\n\r\n // if vp aspect given, update model extents to fit view\r\n if (options?.vpAspect) {\r\n const modelAspect = deltaY / deltaX;\r\n\r\n if (modelAspect > options.vpAspect) {\r\n const xFix = deltaY / options.vpAspect;\r\n originX = originX - xFix / 2;\r\n deltaX = deltaX + xFix;\r\n } else if (modelAspect < options.vpAspect) {\r\n const yFix = deltaX * options.vpAspect;\r\n originY = originY - yFix / 2;\r\n deltaY = deltaY + yFix;\r\n }\r\n }\r\n\r\n const categorySelectorProps: CategorySelectorProps = {\r\n categories,\r\n code: Code.createEmpty(),\r\n model: dictionaryId,\r\n classFullName: \"BisCore:CategorySelector\",\r\n };\r\n\r\n const modelSelectorProps: ModelSelectorProps = {\r\n models,\r\n code: Code.createEmpty(),\r\n model: dictionaryId,\r\n classFullName: \"BisCore:ModelSelector\",\r\n };\r\n\r\n const cameraData = new Camera();\r\n const cameraOn = options?.cameraOn !== false;\r\n const viewDefinitionProps: ViewDefinition3dProps = {\r\n categorySelectorId: \"\",\r\n displayStyleId: \"\",\r\n code: Code.createEmpty(),\r\n model: dictionaryId,\r\n origin: { x: originX, y: originY, z: originZ },\r\n extents: { x: deltaX, y: deltaY, z: deltaZ },\r\n classFullName: \"BisCore:SpatialViewDefinition\",\r\n cameraOn,\r\n camera: {\r\n lens: cameraData.lens.toJSON(),\r\n focusDist: cameraData.focusDist,\r\n eye: cameraData.eye.toJSON(),\r\n },\r\n };\r\n\r\n const displayStyleProps: DisplayStyle3dProps = {\r\n code: Code.createEmpty(),\r\n model: dictionaryId,\r\n classFullName: \"BisCore:DisplayStyle3d\",\r\n jsonProperties: {\r\n styles: {\r\n viewflags: {\r\n renderMode: RenderMode.SmoothShade,\r\n noSourceLights: false,\r\n noCameraLights: false,\r\n noSolarLight: false,\r\n noConstruct: true,\r\n noTransp: false,\r\n visEdges: false,\r\n backgroundMap: this._imodel.isGeoLocated,\r\n },\r\n environment:\r\n options !== undefined &&\r\n options.skyboxOn !== undefined &&\r\n options.skyboxOn\r\n ? Environment.defaults.withDisplay({ sky: true }).toJSON()\r\n : undefined,\r\n },\r\n },\r\n };\r\n\r\n const viewStateProps: ViewStateProps = {\r\n displayStyleProps,\r\n categorySelectorProps,\r\n modelSelectorProps,\r\n viewDefinitionProps,\r\n };\r\n\r\n // merge seed view props if needed\r\n return options?.useSeedView ? this._mergeSeedView(viewStateProps) : viewStateProps;\r\n }\r\n\r\n /**\r\n * Merges a seed view in the iModel with the passed view state props. It will be a no-op if there are no default 3D views in the iModel\r\n * @param viewStateProps Input view props to be merged\r\n */\r\n private async _mergeSeedView(viewStateProps: ViewStateProps): Promise<ViewStateProps> {\r\n const viewId = await this._getDefaultViewId();\r\n // Handle iModels without any default view id\r\n if (viewId === undefined)\r\n return viewStateProps;\r\n\r\n const seedViewState = (await this._imodel.views.load(viewId) as SpatialViewState);\r\n const seedViewStateProps = {\r\n categorySelectorProps: seedViewState.categorySelector.toJSON(),\r\n modelSelectorProps: seedViewState.modelSelector.toJSON(),\r\n viewDefinitionProps: seedViewState.toJSON(),\r\n displayStyleProps: seedViewState.displayStyle.toJSON(),\r\n };\r\n const mergedDisplayProps = seedViewStateProps.displayStyleProps;\r\n if (mergedDisplayProps.jsonProperties !== undefined) {\r\n mergedDisplayProps.jsonProperties.styles = {\r\n ...mergedDisplayProps.jsonProperties.styles,\r\n ...viewStateProps.displayStyleProps.jsonProperties!.styles,\r\n };\r\n }\r\n\r\n return { ...seedViewStateProps, ...viewStateProps, displayStyleProps: mergedDisplayProps };\r\n }\r\n\r\n /**\r\n * Get the Id of the default view.\r\n */\r\n private async _getDefaultViewId(): Promise<Id64String | undefined> {\r\n // eslint-disable-next-line deprecation/deprecation\r\n const viewId = await this._imodel.views.queryDefaultViewId();\r\n if (viewId !== Id64.invalid)\r\n return viewId;\r\n\r\n // Return the first spatial view\r\n const viewList = await this._imodel.views.getViewList({ wantPrivate: false, limit: 1, from: SpatialViewState.classFullName });\r\n return viewList.length === 0 ? undefined : viewList[0].id;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ViewCreator3d.js","sourceRoot":"","sources":["../../src/ViewCreator3d.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sDAAqF;AACrF,oDAG4B;AAC5B,wDAA+C;AAE/C,yDAAsD;AAsCtD;;;;;;;;;GASG;AACH,MAAa,aAAa;IACxB;;;OAGG;IACH,YAAoB,OAAyB;QAAzB,YAAO,GAAP,OAAO,CAAkB;IAAI,CAAC;IAElD;;;;;OAKG;IACI,KAAK,CAAC,iBAAiB,CAAC,OAA8B,EAAE,QAAuB;QACpF,MAAM,UAAU,GAAoC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,gCAAiB,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9H,MAAM,GAAG,GAAG,oCAAsB,CAAC,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAC1F,MAAM,eAAe,GAAG,MAAM,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AC;QAED,OAAO,EAAE,GAAG,kBAAkB,EAAE,GAAG,cAAc,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,CAAC;IAC7F,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,iBAAiB;QAC7B,mDAAmD;QACnD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,kBAAkB,EAAE,CAAC;QAC7D,IAAI,MAAM,KAAK,mBAAI,CAAC,OAAO;YACzB,OAAO,MAAM,CAAC;QAEhB,gCAAgC;QAChC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,mCAAgB,CAAC,aAAa,EAAE,CAAC,CAAC;QAC9H,OAAO,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5D,CAAC;CACF;AA7LD,sCA6LC","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\r\n/** @packageDocumentation\r\n * @module Views\r\n */\r\n\r\nimport { CompressedId64Set, Id64, Id64Array, Id64String } from \"@itwin/core-bentley\";\r\nimport {\r\n Camera, CategorySelectorProps, Code, CustomViewState3dCreatorOptions, DisplayStyle3dProps, Environment, IModel, IModelReadRpcInterface,\r\n ModelSelectorProps, RenderMode, ViewDefinition3dProps, ViewStateProps,\r\n} from \"@itwin/core-common\";\r\nimport { Range3d } from \"@itwin/core-geometry\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\nimport { SpatialViewState } from \"./SpatialViewState\";\r\nimport { StandardViewId } from \"./StandardView\";\r\nimport { ViewState } from \"./ViewState\";\r\n\r\n/** Api for creating a 3d default view for an iModel. Either takes in a list of modelIds, or displays all 3d models by default. */\r\n\r\n/** Options for creating a [[ViewState3d]] via [[ViewCreator3d]].\r\n * @public\r\n * @extensions\r\n*/\r\nexport interface ViewCreator3dOptions {\r\n /** Turn the [[Camera]] on to produce a perspective view.\r\n * Default: true\r\n */\r\n cameraOn?: boolean;\r\n /** Enables display of a [[SkyBox]] in the view. */\r\n skyboxOn?: boolean;\r\n /** Orients the view to one of the standard view rotations. */\r\n standardViewId?: StandardViewId;\r\n /** Merge in props from a persistent \"seed\" view obtained from the iModel.\r\n * @note The selection of the seed view is somewhat arbitrary, and the contents and styling of that view are unpredictable, so this option is not recommended.\r\n */\r\n useSeedView?: boolean;\r\n /** The desired aspect ratio of the [[Viewport]] in which the view is to be displayed.\r\n * This is used to adjust the view's frustum so that the viewed models are better centered within the viewport.\r\n */\r\n vpAspect?: number;\r\n /** Indicates that geometry belonging to every [SubCategory]($backend) should be visible within the view.\r\n * Each subcategory has a [SubCategoryAppearance]($common) that specifies how its geometry is displayed. This includes a [SubCategoryAppearance.invisible]($common) property that,\r\n * when set to `true`, indicates the geometry should not be displayed at all. A view can override the appearances of any subcategories using a [SubCategoryOverride]($common).\r\n * If `allSubCategoriesVisible` is `true`, [[ViewCreator3d]] will apply such an override to every viewed subcategory to change [SubCategoryOverride.invisible]($common) to `false`, making\r\n * every subcategory visible.\r\n * @note Subcategories are typically set to invisible by default for a reason.\r\n * Forcing them all to be visible may produce undesirable results, such as z-fighting between geometry on different subcategories that are not intended to be viewed together.\r\n */\r\n allSubCategoriesVisible?: boolean;\r\n}\r\n\r\n/**\r\n * API for creating a 3D default [[ViewState3d]] for an iModel. @see [[ViewCreator2d]] to create a view for a 2d model.\r\n * Example usage:\r\n * ```ts\r\n * const viewCreator = new ViewCreator3d(imodel);\r\n * const defaultView = await viewCreator.createDefaultView({skyboxOn: true});\r\n * ```\r\n * @public\r\n * @extensions\r\n */\r\nexport class ViewCreator3d {\r\n /**\r\n * Constructs a ViewCreator3d using an [[IModelConnection]].\r\n * @param _imodel [[IModelConnection]] to query for categories and/or models.\r\n */\r\n constructor(private _imodel: IModelConnection) { }\r\n\r\n /**\r\n * Creates a default [[ViewState3d]] based on the model ids passed in. If no model ids are passed in, all 3D models in the iModel are used.\r\n * @param [options] Options for creating the view.\r\n * @param [modelIds] Ids of models to display in the view.\r\n * @throws [IModelError]($common) If no 3d models are found in the iModel.\r\n */\r\n public async createDefaultView(options?: ViewCreator3dOptions, modelIds?: Id64String[]): Promise<ViewState> {\r\n const rpcOptions: CustomViewState3dCreatorOptions = modelIds ? { modelIds: CompressedId64Set.sortAndCompress(modelIds) } : {};\r\n const rpc = IModelReadRpcInterface.getClientForRouting(this._imodel.routingContext.token);\r\n const serializedProps = await rpc.getCustomViewState3dData(this._imodel.getRpcProps(), rpcOptions);\r\n\r\n const baseExtents = Range3d.fromJSON(serializedProps.modelExtents);\r\n const props = await this._createViewStateProps(\r\n CompressedId64Set.decompressArray(serializedProps.modelIds),\r\n CompressedId64Set.decompressArray(serializedProps.categoryIds),\r\n baseExtents,\r\n options,\r\n );\r\n\r\n const viewState = SpatialViewState.createFromProps(props, this._imodel);\r\n try {\r\n await viewState.iModel.subcategories.loadAllUsedSpatialSubCategories();\r\n await viewState.load();\r\n } catch {\r\n }\r\n\r\n if (options?.standardViewId)\r\n viewState.setStandardRotation(options.standardViewId);\r\n\r\n if (options?.allSubCategoriesVisible)\r\n viewState.displayStyle.enableAllLoadedSubCategories(viewState.categorySelector.categories);\r\n\r\n const range = viewState.computeFitRange({ baseExtents });\r\n viewState.lookAtVolume(range, options?.vpAspect);\r\n\r\n return viewState;\r\n }\r\n\r\n /**\r\n * Generates a view state props object for creating a view. Merges display styles with a seed view if the options.useSeedView is true\r\n * @param models Models to put in view props\r\n * @param options view creation options like camera On and skybox On\r\n */\r\n private async _createViewStateProps(models: Id64Array, categories: Id64Array, modelExtents: Range3d, options?: ViewCreator3dOptions): Promise<ViewStateProps> {\r\n // Use dictionary model in all props\r\n const dictionaryId = IModel.dictionaryId;\r\n\r\n if (modelExtents.isNull)\r\n modelExtents.setFrom(this._imodel.projectExtents);\r\n\r\n let originX = modelExtents.low.x;\r\n let originY = modelExtents.low.y;\r\n const originZ = modelExtents.low.z;\r\n let deltaX = modelExtents.xLength();\r\n let deltaY = modelExtents.yLength();\r\n const deltaZ = modelExtents.zLength();\r\n\r\n // if vp aspect given, update model extents to fit view\r\n if (options?.vpAspect) {\r\n const modelAspect = deltaY / deltaX;\r\n\r\n if (modelAspect > options.vpAspect) {\r\n const xFix = deltaY / options.vpAspect;\r\n originX = originX - xFix / 2;\r\n deltaX = deltaX + xFix;\r\n } else if (modelAspect < options.vpAspect) {\r\n const yFix = deltaX * options.vpAspect;\r\n originY = originY - yFix / 2;\r\n deltaY = deltaY + yFix;\r\n }\r\n }\r\n\r\n const categorySelectorProps: CategorySelectorProps = {\r\n categories,\r\n code: Code.createEmpty(),\r\n model: dictionaryId,\r\n classFullName: \"BisCore:CategorySelector\",\r\n };\r\n\r\n const modelSelectorProps: ModelSelectorProps = {\r\n models,\r\n code: Code.createEmpty(),\r\n model: dictionaryId,\r\n classFullName: \"BisCore:ModelSelector\",\r\n };\r\n\r\n const cameraData = new Camera();\r\n const cameraOn = options?.cameraOn !== false;\r\n const viewDefinitionProps: ViewDefinition3dProps = {\r\n categorySelectorId: \"\",\r\n displayStyleId: \"\",\r\n code: Code.createEmpty(),\r\n model: dictionaryId,\r\n origin: { x: originX, y: originY, z: originZ },\r\n extents: { x: deltaX, y: deltaY, z: deltaZ },\r\n classFullName: \"BisCore:SpatialViewDefinition\",\r\n cameraOn,\r\n camera: {\r\n lens: cameraData.lens.toJSON(),\r\n focusDist: cameraData.focusDist,\r\n eye: cameraData.eye.toJSON(),\r\n },\r\n };\r\n\r\n const displayStyleProps: DisplayStyle3dProps = {\r\n code: Code.createEmpty(),\r\n model: dictionaryId,\r\n classFullName: \"BisCore:DisplayStyle3d\",\r\n jsonProperties: {\r\n styles: {\r\n viewflags: {\r\n renderMode: RenderMode.SmoothShade,\r\n noSourceLights: false,\r\n noCameraLights: false,\r\n noSolarLight: false,\r\n noConstruct: true,\r\n noTransp: false,\r\n visEdges: false,\r\n backgroundMap: this._imodel.isGeoLocated,\r\n },\r\n environment:\r\n options !== undefined &&\r\n options.skyboxOn !== undefined &&\r\n options.skyboxOn\r\n ? Environment.defaults.withDisplay({ sky: true }).toJSON()\r\n : undefined,\r\n },\r\n },\r\n };\r\n\r\n const viewStateProps: ViewStateProps = {\r\n displayStyleProps,\r\n categorySelectorProps,\r\n modelSelectorProps,\r\n viewDefinitionProps,\r\n };\r\n\r\n // merge seed view props if needed\r\n return options?.useSeedView ? this._mergeSeedView(viewStateProps) : viewStateProps;\r\n }\r\n\r\n /**\r\n * Merges a seed view in the iModel with the passed view state props. It will be a no-op if there are no default 3D views in the iModel\r\n * @param viewStateProps Input view props to be merged\r\n */\r\n private async _mergeSeedView(viewStateProps: ViewStateProps): Promise<ViewStateProps> {\r\n const viewId = await this._getDefaultViewId();\r\n // Handle iModels without any default view id\r\n if (viewId === undefined)\r\n return viewStateProps;\r\n\r\n const seedViewState = (await this._imodel.views.load(viewId) as SpatialViewState);\r\n const seedViewStateProps = {\r\n categorySelectorProps: seedViewState.categorySelector.toJSON(),\r\n modelSelectorProps: seedViewState.modelSelector.toJSON(),\r\n viewDefinitionProps: seedViewState.toJSON(),\r\n displayStyleProps: seedViewState.displayStyle.toJSON(),\r\n };\r\n const mergedDisplayProps = seedViewStateProps.displayStyleProps;\r\n if (mergedDisplayProps.jsonProperties !== undefined) {\r\n mergedDisplayProps.jsonProperties.styles = {\r\n ...mergedDisplayProps.jsonProperties.styles,\r\n ...viewStateProps.displayStyleProps.jsonProperties!.styles,\r\n };\r\n }\r\n\r\n return { ...seedViewStateProps, ...viewStateProps, displayStyleProps: mergedDisplayProps };\r\n }\r\n\r\n /**\r\n * Get the Id of the default view.\r\n */\r\n private async _getDefaultViewId(): Promise<Id64String | undefined> {\r\n // eslint-disable-next-line deprecation/deprecation\r\n const viewId = await this._imodel.views.queryDefaultViewId();\r\n if (viewId !== Id64.invalid)\r\n return viewId;\r\n\r\n // Return the first spatial view\r\n const viewList = await this._imodel.views.getViewList({ wantPrivate: false, limit: 1, from: SpatialViewState.classFullName });\r\n return viewList.length === 0 ? undefined : viewList[0].id;\r\n }\r\n}\r\n"]}
@@ -163,10 +163,8 @@ export declare class ViewManager implements Iterable<ScreenViewport> {
163
163
  dropViewport(vp: ScreenViewport, disposeOfViewport?: boolean): BentleyStatus;
164
164
  /** Iterate over the viewports registered with the view manager. */
165
165
  [Symbol.iterator](): Iterator<ScreenViewport>;
166
- /** Force each registered [[Viewport]] to regenerate all of its cached [[Decorations]] on the next frame. If the decorator parameter is specified, only
167
- * the specified decorator will have its cached decorations invalidated for all viewports.
168
- * @see [[Viewport.invalidateCachedDecorations]] to manually remove a decorator's cached decorations from a viewport, forcing them to be regenerated.
169
- * @beta
166
+ /** Instruct each registered [[Viewport]] that the cached [[Decorations]] for the specified `decorator` should be discarded and recreated on the next frame.
167
+ * @see [[Viewport.invalidateCachedDecorations]] to invalidate the cached decorations for a single viewport.
170
168
  */
171
169
  invalidateCachedDecorationsAllViews(decorator: ViewportDecorator): void;
172
170
  /** Force each registered [[Viewport]] to regenerate its [[Decorations]] on the next frame. */
@@ -196,9 +194,8 @@ export declare class ViewManager implements Iterable<ScreenViewport> {
196
194
  * @internal
197
195
  */
198
196
  purgeTileTrees(olderThan: BeTimePoint): void;
199
- /** Get the tooltip for a persistent element.
200
- * Calls the backend method [Element.getToolTipMessage]($backend), and replaces all instances of `${localizeTag}` with localized string from IModelApp.i18n.
201
- * @beta
197
+ /** Compute the tooltip for a persistent element.
198
+ * This method calls the backend method [Element.getToolTipMessage]($backend), and replaces all instances of `${localizeTag}` with localized string from IModelApp.i18n.
202
199
  */
203
200
  getElementToolTip(hit: HitDetail): Promise<HTMLElement | string>;
204
201
  /** Register a new [[ToolTipProvider]] to customize the locate tooltip.
@@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