@itwin/core-frontend 3.1.0-dev.0 → 3.1.0-dev.13

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 (350) hide show
  1. package/lib/cjs/ApproximateTerrainHeights.d.ts +1 -1
  2. package/lib/cjs/ApproximateTerrainHeights.d.ts.map +1 -1
  3. package/lib/cjs/ApproximateTerrainHeights.js +21 -9
  4. package/lib/cjs/ApproximateTerrainHeights.js.map +1 -1
  5. package/lib/cjs/ApproximateTerrainHeightsProps.d.ts +12 -0
  6. package/lib/cjs/ApproximateTerrainHeightsProps.d.ts.map +1 -0
  7. package/lib/cjs/ApproximateTerrainHeightsProps.js +13 -0
  8. package/lib/cjs/ApproximateTerrainHeightsProps.js.map +1 -0
  9. package/lib/cjs/BriefcaseConnection.d.ts.map +1 -1
  10. package/lib/cjs/BriefcaseConnection.js +6 -5
  11. package/lib/cjs/BriefcaseConnection.js.map +1 -1
  12. package/lib/cjs/DisplayStyleState.d.ts +1 -0
  13. package/lib/cjs/DisplayStyleState.d.ts.map +1 -1
  14. package/lib/cjs/DisplayStyleState.js.map +1 -1
  15. package/lib/cjs/DrawingViewState.js +3 -3
  16. package/lib/cjs/DrawingViewState.js.map +1 -1
  17. package/lib/cjs/EnvironmentDecorations.d.ts.map +1 -1
  18. package/lib/cjs/EnvironmentDecorations.js +7 -10
  19. package/lib/cjs/EnvironmentDecorations.js.map +1 -1
  20. package/lib/cjs/SheetViewState.d.ts.map +1 -1
  21. package/lib/cjs/SheetViewState.js +4 -6
  22. package/lib/cjs/SheetViewState.js.map +1 -1
  23. package/lib/cjs/Viewport.d.ts +6 -3
  24. package/lib/cjs/Viewport.d.ts.map +1 -1
  25. package/lib/cjs/Viewport.js +16 -9
  26. package/lib/cjs/Viewport.js.map +1 -1
  27. package/lib/cjs/core-frontend.d.ts +1 -0
  28. package/lib/cjs/core-frontend.d.ts.map +1 -1
  29. package/lib/cjs/core-frontend.js +1 -0
  30. package/lib/cjs/core-frontend.js.map +1 -1
  31. package/lib/cjs/render/RenderMaterial.d.ts +61 -0
  32. package/lib/cjs/render/RenderMaterial.d.ts.map +1 -0
  33. package/lib/cjs/render/RenderMaterial.js +10 -0
  34. package/lib/cjs/render/RenderMaterial.js.map +1 -0
  35. package/lib/cjs/render/RenderSystem.d.ts +10 -3
  36. package/lib/cjs/render/RenderSystem.d.ts.map +1 -1
  37. package/lib/cjs/render/RenderSystem.js +11 -3
  38. package/lib/cjs/render/RenderSystem.js.map +1 -1
  39. package/lib/cjs/render/primitives/mesh/RealityMeshPrimitive.d.ts +2 -0
  40. package/lib/cjs/render/primitives/mesh/RealityMeshPrimitive.d.ts.map +1 -1
  41. package/lib/cjs/render/primitives/mesh/RealityMeshPrimitive.js +39 -2
  42. package/lib/cjs/render/primitives/mesh/RealityMeshPrimitive.js.map +1 -1
  43. package/lib/cjs/render/webgl/DrawCommand.js +1 -1
  44. package/lib/cjs/render/webgl/DrawCommand.js.map +1 -1
  45. package/lib/cjs/render/webgl/Material.d.ts.map +1 -1
  46. package/lib/cjs/render/webgl/Material.js +2 -0
  47. package/lib/cjs/render/webgl/Material.js.map +1 -1
  48. package/lib/cjs/render/webgl/RealityMesh.d.ts +1 -0
  49. package/lib/cjs/render/webgl/RealityMesh.d.ts.map +1 -1
  50. package/lib/cjs/render/webgl/RealityMesh.js +1 -0
  51. package/lib/cjs/render/webgl/RealityMesh.js.map +1 -1
  52. package/lib/cjs/render/webgl/SceneCompositor.d.ts +3 -0
  53. package/lib/cjs/render/webgl/SceneCompositor.d.ts.map +1 -1
  54. package/lib/cjs/render/webgl/SceneCompositor.js +31 -6
  55. package/lib/cjs/render/webgl/SceneCompositor.js.map +1 -1
  56. package/lib/cjs/render/webgl/ShaderProgram.d.ts +1 -0
  57. package/lib/cjs/render/webgl/ShaderProgram.d.ts.map +1 -1
  58. package/lib/cjs/render/webgl/ShaderProgram.js +1 -0
  59. package/lib/cjs/render/webgl/ShaderProgram.js.map +1 -1
  60. package/lib/cjs/render/webgl/System.d.ts +2 -0
  61. package/lib/cjs/render/webgl/System.d.ts.map +1 -1
  62. package/lib/cjs/render/webgl/System.js +43 -0
  63. package/lib/cjs/render/webgl/System.js.map +1 -1
  64. package/lib/cjs/render/webgl/Texture.d.ts.map +1 -1
  65. package/lib/cjs/render/webgl/Texture.js +2 -2
  66. package/lib/cjs/render/webgl/Texture.js.map +1 -1
  67. package/lib/cjs/tile/DynamicIModelTile.d.ts.map +1 -1
  68. package/lib/cjs/tile/DynamicIModelTile.js +1 -1
  69. package/lib/cjs/tile/DynamicIModelTile.js.map +1 -1
  70. package/lib/cjs/tile/GltfReader.d.ts +6 -1
  71. package/lib/cjs/tile/GltfReader.d.ts.map +1 -1
  72. package/lib/cjs/tile/GltfReader.js +102 -27
  73. package/lib/cjs/tile/GltfReader.js.map +1 -1
  74. package/lib/cjs/tile/ImdlReader.d.ts.map +1 -1
  75. package/lib/cjs/tile/ImdlReader.js +2 -0
  76. package/lib/cjs/tile/ImdlReader.js.map +1 -1
  77. package/lib/cjs/tile/LRUTileList.d.ts +29 -29
  78. package/lib/cjs/tile/LRUTileList.d.ts.map +1 -1
  79. package/lib/cjs/tile/LRUTileList.js +50 -50
  80. package/lib/cjs/tile/LRUTileList.js.map +1 -1
  81. package/lib/cjs/tile/OrbitGtTileTree.js +1 -1
  82. package/lib/cjs/tile/OrbitGtTileTree.js.map +1 -1
  83. package/lib/cjs/tile/RealityModelTileTree.d.ts +24 -2
  84. package/lib/cjs/tile/RealityModelTileTree.d.ts.map +1 -1
  85. package/lib/cjs/tile/RealityModelTileTree.js +36 -11
  86. package/lib/cjs/tile/RealityModelTileTree.js.map +1 -1
  87. package/lib/cjs/tile/RealityTile.d.ts +17 -3
  88. package/lib/cjs/tile/RealityTile.d.ts.map +1 -1
  89. package/lib/cjs/tile/RealityTile.js +34 -2
  90. package/lib/cjs/tile/RealityTile.js.map +1 -1
  91. package/lib/cjs/tile/RealityTileLoader.d.ts +8 -5
  92. package/lib/cjs/tile/RealityTileLoader.d.ts.map +1 -1
  93. package/lib/cjs/tile/RealityTileLoader.js +19 -5
  94. package/lib/cjs/tile/RealityTileLoader.js.map +1 -1
  95. package/lib/cjs/tile/RealityTileTree.d.ts +3 -1
  96. package/lib/cjs/tile/RealityTileTree.d.ts.map +1 -1
  97. package/lib/cjs/tile/RealityTileTree.js +5 -1
  98. package/lib/cjs/tile/RealityTileTree.js.map +1 -1
  99. package/lib/cjs/tile/Tile.d.ts +5 -4
  100. package/lib/cjs/tile/Tile.d.ts.map +1 -1
  101. package/lib/cjs/tile/Tile.js +3 -2
  102. package/lib/cjs/tile/Tile.js.map +1 -1
  103. package/lib/cjs/tile/TileAdmin.d.ts +43 -45
  104. package/lib/cjs/tile/TileAdmin.d.ts.map +1 -1
  105. package/lib/cjs/tile/TileAdmin.js +104 -99
  106. package/lib/cjs/tile/TileAdmin.js.map +1 -1
  107. package/lib/cjs/tile/TileGeometryCollector.d.ts +80 -0
  108. package/lib/cjs/tile/TileGeometryCollector.d.ts.map +1 -0
  109. package/lib/cjs/tile/TileGeometryCollector.js +71 -0
  110. package/lib/cjs/tile/TileGeometryCollector.js.map +1 -0
  111. package/lib/cjs/tile/TileRequest.d.ts +12 -9
  112. package/lib/cjs/tile/TileRequest.d.ts.map +1 -1
  113. package/lib/cjs/tile/TileRequest.js +19 -11
  114. package/lib/cjs/tile/TileRequest.js.map +1 -1
  115. package/lib/cjs/tile/TileRequestChannel.js +3 -3
  116. package/lib/cjs/tile/TileRequestChannel.js.map +1 -1
  117. package/lib/cjs/tile/TileTree.d.ts +7 -1
  118. package/lib/cjs/tile/TileTree.d.ts.map +1 -1
  119. package/lib/cjs/tile/TileTree.js +8 -1
  120. package/lib/cjs/tile/TileTree.js.map +1 -1
  121. package/lib/cjs/tile/TileTreeReference.d.ts +23 -2
  122. package/lib/cjs/tile/TileTreeReference.d.ts.map +1 -1
  123. package/lib/cjs/tile/TileTreeReference.js +37 -1
  124. package/lib/cjs/tile/TileTreeReference.js.map +1 -1
  125. package/lib/cjs/tile/TileUsageMarker.d.ts +9 -9
  126. package/lib/cjs/tile/TileUsageMarker.d.ts.map +1 -1
  127. package/lib/cjs/tile/TileUsageMarker.js +9 -9
  128. package/lib/cjs/tile/TileUsageMarker.js.map +1 -1
  129. package/lib/cjs/tile/TileUser.d.ts +33 -0
  130. package/lib/cjs/tile/TileUser.d.ts.map +1 -0
  131. package/lib/cjs/tile/TileUser.js +28 -0
  132. package/lib/cjs/tile/TileUser.js.map +1 -0
  133. package/lib/cjs/tile/TileUserSet.d.ts +28 -0
  134. package/lib/cjs/tile/TileUserSet.d.ts.map +1 -0
  135. package/lib/cjs/tile/TileUserSet.js +123 -0
  136. package/lib/cjs/tile/TileUserSet.js.map +1 -0
  137. package/lib/cjs/tile/internal.d.ts +3 -0
  138. package/lib/cjs/tile/internal.d.ts.map +1 -1
  139. package/lib/cjs/tile/internal.js +3 -0
  140. package/lib/cjs/tile/internal.js.map +1 -1
  141. package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts +1 -2
  142. package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
  143. package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +1 -1
  144. package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
  145. package/lib/cjs/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.d.ts +1 -2
  146. package/lib/cjs/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.d.ts.map +1 -1
  147. package/lib/cjs/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.js +1 -1
  148. package/lib/cjs/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.js.map +1 -1
  149. package/lib/cjs/tile/map/ImageryProviders/BingImageryProvider.js +1 -1
  150. package/lib/cjs/tile/map/ImageryProviders/BingImageryProvider.js.map +1 -1
  151. package/lib/cjs/tile/map/ImageryProviders/MapBoxLayerImageryProvider.d.ts +1 -2
  152. package/lib/cjs/tile/map/ImageryProviders/MapBoxLayerImageryProvider.d.ts.map +1 -1
  153. package/lib/cjs/tile/map/ImageryProviders/MapBoxLayerImageryProvider.js +1 -1
  154. package/lib/cjs/tile/map/ImageryProviders/MapBoxLayerImageryProvider.js.map +1 -1
  155. package/lib/cjs/tile/map/ImageryTileTree.d.ts +2 -2
  156. package/lib/cjs/tile/map/ImageryTileTree.d.ts.map +1 -1
  157. package/lib/cjs/tile/map/ImageryTileTree.js +1 -1
  158. package/lib/cjs/tile/map/ImageryTileTree.js.map +1 -1
  159. package/lib/cjs/tile/map/MapTile.d.ts +7 -6
  160. package/lib/cjs/tile/map/MapTile.d.ts.map +1 -1
  161. package/lib/cjs/tile/map/MapTile.js +47 -34
  162. package/lib/cjs/tile/map/MapTile.js.map +1 -1
  163. package/lib/cjs/tile/map/MapTileLoader.d.ts +2 -1
  164. package/lib/cjs/tile/map/MapTileLoader.d.ts.map +1 -1
  165. package/lib/cjs/tile/map/MapTileLoader.js +4 -1
  166. package/lib/cjs/tile/map/MapTileLoader.js.map +1 -1
  167. package/lib/cjs/tile/map/MapTileTree.d.ts +8 -5
  168. package/lib/cjs/tile/map/MapTileTree.d.ts.map +1 -1
  169. package/lib/cjs/tile/map/MapTileTree.js +25 -7
  170. package/lib/cjs/tile/map/MapTileTree.js.map +1 -1
  171. package/lib/esm/ApproximateTerrainHeights.d.ts +1 -1
  172. package/lib/esm/ApproximateTerrainHeights.d.ts.map +1 -1
  173. package/lib/esm/ApproximateTerrainHeights.js +2 -9
  174. package/lib/esm/ApproximateTerrainHeights.js.map +1 -1
  175. package/lib/esm/ApproximateTerrainHeightsProps.d.ts +12 -0
  176. package/lib/esm/ApproximateTerrainHeightsProps.d.ts.map +1 -0
  177. package/lib/esm/ApproximateTerrainHeightsProps.js +10 -0
  178. package/lib/esm/ApproximateTerrainHeightsProps.js.map +1 -0
  179. package/lib/esm/BriefcaseConnection.d.ts.map +1 -1
  180. package/lib/esm/BriefcaseConnection.js +6 -5
  181. package/lib/esm/BriefcaseConnection.js.map +1 -1
  182. package/lib/esm/DisplayStyleState.d.ts +1 -0
  183. package/lib/esm/DisplayStyleState.d.ts.map +1 -1
  184. package/lib/esm/DisplayStyleState.js.map +1 -1
  185. package/lib/esm/DrawingViewState.js +3 -3
  186. package/lib/esm/DrawingViewState.js.map +1 -1
  187. package/lib/esm/EnvironmentDecorations.d.ts.map +1 -1
  188. package/lib/esm/EnvironmentDecorations.js +8 -11
  189. package/lib/esm/EnvironmentDecorations.js.map +1 -1
  190. package/lib/esm/SheetViewState.d.ts.map +1 -1
  191. package/lib/esm/SheetViewState.js +5 -7
  192. package/lib/esm/SheetViewState.js.map +1 -1
  193. package/lib/esm/Viewport.d.ts +6 -3
  194. package/lib/esm/Viewport.d.ts.map +1 -1
  195. package/lib/esm/Viewport.js +17 -10
  196. package/lib/esm/Viewport.js.map +1 -1
  197. package/lib/esm/core-frontend.d.ts +1 -0
  198. package/lib/esm/core-frontend.d.ts.map +1 -1
  199. package/lib/esm/core-frontend.js +1 -0
  200. package/lib/esm/core-frontend.js.map +1 -1
  201. package/lib/esm/render/RenderMaterial.d.ts +61 -0
  202. package/lib/esm/render/RenderMaterial.d.ts.map +1 -0
  203. package/lib/esm/render/RenderMaterial.js +9 -0
  204. package/lib/esm/render/RenderMaterial.js.map +1 -0
  205. package/lib/esm/render/RenderSystem.d.ts +10 -3
  206. package/lib/esm/render/RenderSystem.d.ts.map +1 -1
  207. package/lib/esm/render/RenderSystem.js +9 -1
  208. package/lib/esm/render/RenderSystem.js.map +1 -1
  209. package/lib/esm/render/primitives/mesh/RealityMeshPrimitive.d.ts +2 -0
  210. package/lib/esm/render/primitives/mesh/RealityMeshPrimitive.d.ts.map +1 -1
  211. package/lib/esm/render/primitives/mesh/RealityMeshPrimitive.js +39 -2
  212. package/lib/esm/render/primitives/mesh/RealityMeshPrimitive.js.map +1 -1
  213. package/lib/esm/render/webgl/DrawCommand.js +1 -1
  214. package/lib/esm/render/webgl/DrawCommand.js.map +1 -1
  215. package/lib/esm/render/webgl/Material.d.ts.map +1 -1
  216. package/lib/esm/render/webgl/Material.js +2 -0
  217. package/lib/esm/render/webgl/Material.js.map +1 -1
  218. package/lib/esm/render/webgl/RealityMesh.d.ts +1 -0
  219. package/lib/esm/render/webgl/RealityMesh.d.ts.map +1 -1
  220. package/lib/esm/render/webgl/RealityMesh.js +1 -0
  221. package/lib/esm/render/webgl/RealityMesh.js.map +1 -1
  222. package/lib/esm/render/webgl/SceneCompositor.d.ts +3 -0
  223. package/lib/esm/render/webgl/SceneCompositor.d.ts.map +1 -1
  224. package/lib/esm/render/webgl/SceneCompositor.js +31 -6
  225. package/lib/esm/render/webgl/SceneCompositor.js.map +1 -1
  226. package/lib/esm/render/webgl/ShaderProgram.d.ts +1 -0
  227. package/lib/esm/render/webgl/ShaderProgram.d.ts.map +1 -1
  228. package/lib/esm/render/webgl/ShaderProgram.js +1 -0
  229. package/lib/esm/render/webgl/ShaderProgram.js.map +1 -1
  230. package/lib/esm/render/webgl/System.d.ts +2 -0
  231. package/lib/esm/render/webgl/System.d.ts.map +1 -1
  232. package/lib/esm/render/webgl/System.js +44 -1
  233. package/lib/esm/render/webgl/System.js.map +1 -1
  234. package/lib/esm/render/webgl/Texture.d.ts.map +1 -1
  235. package/lib/esm/render/webgl/Texture.js +2 -2
  236. package/lib/esm/render/webgl/Texture.js.map +1 -1
  237. package/lib/esm/tile/DynamicIModelTile.d.ts.map +1 -1
  238. package/lib/esm/tile/DynamicIModelTile.js +1 -1
  239. package/lib/esm/tile/DynamicIModelTile.js.map +1 -1
  240. package/lib/esm/tile/GltfReader.d.ts +6 -1
  241. package/lib/esm/tile/GltfReader.d.ts.map +1 -1
  242. package/lib/esm/tile/GltfReader.js +103 -28
  243. package/lib/esm/tile/GltfReader.js.map +1 -1
  244. package/lib/esm/tile/ImdlReader.d.ts.map +1 -1
  245. package/lib/esm/tile/ImdlReader.js +2 -0
  246. package/lib/esm/tile/ImdlReader.js.map +1 -1
  247. package/lib/esm/tile/LRUTileList.d.ts +29 -29
  248. package/lib/esm/tile/LRUTileList.d.ts.map +1 -1
  249. package/lib/esm/tile/LRUTileList.js +47 -47
  250. package/lib/esm/tile/LRUTileList.js.map +1 -1
  251. package/lib/esm/tile/OrbitGtTileTree.js +1 -1
  252. package/lib/esm/tile/OrbitGtTileTree.js.map +1 -1
  253. package/lib/esm/tile/RealityModelTileTree.d.ts +24 -2
  254. package/lib/esm/tile/RealityModelTileTree.d.ts.map +1 -1
  255. package/lib/esm/tile/RealityModelTileTree.js +36 -12
  256. package/lib/esm/tile/RealityModelTileTree.js.map +1 -1
  257. package/lib/esm/tile/RealityTile.d.ts +17 -3
  258. package/lib/esm/tile/RealityTile.d.ts.map +1 -1
  259. package/lib/esm/tile/RealityTile.js +34 -2
  260. package/lib/esm/tile/RealityTile.js.map +1 -1
  261. package/lib/esm/tile/RealityTileLoader.d.ts +8 -5
  262. package/lib/esm/tile/RealityTileLoader.d.ts.map +1 -1
  263. package/lib/esm/tile/RealityTileLoader.js +19 -5
  264. package/lib/esm/tile/RealityTileLoader.js.map +1 -1
  265. package/lib/esm/tile/RealityTileTree.d.ts +3 -1
  266. package/lib/esm/tile/RealityTileTree.d.ts.map +1 -1
  267. package/lib/esm/tile/RealityTileTree.js +7 -3
  268. package/lib/esm/tile/RealityTileTree.js.map +1 -1
  269. package/lib/esm/tile/Tile.d.ts +5 -4
  270. package/lib/esm/tile/Tile.d.ts.map +1 -1
  271. package/lib/esm/tile/Tile.js +3 -2
  272. package/lib/esm/tile/Tile.js.map +1 -1
  273. package/lib/esm/tile/TileAdmin.d.ts +43 -45
  274. package/lib/esm/tile/TileAdmin.d.ts.map +1 -1
  275. package/lib/esm/tile/TileAdmin.js +105 -100
  276. package/lib/esm/tile/TileAdmin.js.map +1 -1
  277. package/lib/esm/tile/TileGeometryCollector.d.ts +80 -0
  278. package/lib/esm/tile/TileGeometryCollector.d.ts.map +1 -0
  279. package/lib/esm/tile/TileGeometryCollector.js +67 -0
  280. package/lib/esm/tile/TileGeometryCollector.js.map +1 -0
  281. package/lib/esm/tile/TileRequest.d.ts +12 -9
  282. package/lib/esm/tile/TileRequest.d.ts.map +1 -1
  283. package/lib/esm/tile/TileRequest.js +19 -11
  284. package/lib/esm/tile/TileRequest.js.map +1 -1
  285. package/lib/esm/tile/TileRequestChannel.js +3 -3
  286. package/lib/esm/tile/TileRequestChannel.js.map +1 -1
  287. package/lib/esm/tile/TileTree.d.ts +7 -1
  288. package/lib/esm/tile/TileTree.d.ts.map +1 -1
  289. package/lib/esm/tile/TileTree.js +8 -1
  290. package/lib/esm/tile/TileTree.js.map +1 -1
  291. package/lib/esm/tile/TileTreeReference.d.ts +23 -2
  292. package/lib/esm/tile/TileTreeReference.d.ts.map +1 -1
  293. package/lib/esm/tile/TileTreeReference.js +39 -3
  294. package/lib/esm/tile/TileTreeReference.js.map +1 -1
  295. package/lib/esm/tile/TileUsageMarker.d.ts +9 -9
  296. package/lib/esm/tile/TileUsageMarker.d.ts.map +1 -1
  297. package/lib/esm/tile/TileUsageMarker.js +9 -9
  298. package/lib/esm/tile/TileUsageMarker.js.map +1 -1
  299. package/lib/esm/tile/TileUser.d.ts +33 -0
  300. package/lib/esm/tile/TileUser.d.ts.map +1 -0
  301. package/lib/esm/tile/TileUser.js +25 -0
  302. package/lib/esm/tile/TileUser.js.map +1 -0
  303. package/lib/esm/tile/TileUserSet.d.ts +28 -0
  304. package/lib/esm/tile/TileUserSet.d.ts.map +1 -0
  305. package/lib/esm/tile/TileUserSet.js +118 -0
  306. package/lib/esm/tile/TileUserSet.js.map +1 -0
  307. package/lib/esm/tile/internal.d.ts +3 -0
  308. package/lib/esm/tile/internal.d.ts.map +1 -1
  309. package/lib/esm/tile/internal.js +3 -0
  310. package/lib/esm/tile/internal.js.map +1 -1
  311. package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts +1 -2
  312. package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
  313. package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +1 -1
  314. package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
  315. package/lib/esm/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.d.ts +1 -2
  316. package/lib/esm/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.d.ts.map +1 -1
  317. package/lib/esm/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.js +1 -1
  318. package/lib/esm/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.js.map +1 -1
  319. package/lib/esm/tile/map/ImageryProviders/BingImageryProvider.js +1 -1
  320. package/lib/esm/tile/map/ImageryProviders/BingImageryProvider.js.map +1 -1
  321. package/lib/esm/tile/map/ImageryProviders/MapBoxLayerImageryProvider.d.ts +1 -2
  322. package/lib/esm/tile/map/ImageryProviders/MapBoxLayerImageryProvider.d.ts.map +1 -1
  323. package/lib/esm/tile/map/ImageryProviders/MapBoxLayerImageryProvider.js +1 -1
  324. package/lib/esm/tile/map/ImageryProviders/MapBoxLayerImageryProvider.js.map +1 -1
  325. package/lib/esm/tile/map/ImageryTileTree.d.ts +2 -2
  326. package/lib/esm/tile/map/ImageryTileTree.d.ts.map +1 -1
  327. package/lib/esm/tile/map/ImageryTileTree.js +1 -1
  328. package/lib/esm/tile/map/ImageryTileTree.js.map +1 -1
  329. package/lib/esm/tile/map/MapTile.d.ts +7 -6
  330. package/lib/esm/tile/map/MapTile.d.ts.map +1 -1
  331. package/lib/esm/tile/map/MapTile.js +47 -34
  332. package/lib/esm/tile/map/MapTile.js.map +1 -1
  333. package/lib/esm/tile/map/MapTileLoader.d.ts +2 -1
  334. package/lib/esm/tile/map/MapTileLoader.d.ts.map +1 -1
  335. package/lib/esm/tile/map/MapTileLoader.js +4 -1
  336. package/lib/esm/tile/map/MapTileLoader.js.map +1 -1
  337. package/lib/esm/tile/map/MapTileTree.d.ts +8 -5
  338. package/lib/esm/tile/map/MapTileTree.d.ts.map +1 -1
  339. package/lib/esm/tile/map/MapTileTree.js +26 -8
  340. package/lib/esm/tile/map/MapTileTree.js.map +1 -1
  341. package/package.json +20 -20
  342. package/lib/cjs/ViewportSet.d.ts +0 -28
  343. package/lib/cjs/ViewportSet.d.ts.map +0 -1
  344. package/lib/cjs/ViewportSet.js +0 -126
  345. package/lib/cjs/ViewportSet.js.map +0 -1
  346. package/lib/esm/ViewportSet.d.ts +0 -28
  347. package/lib/esm/ViewportSet.d.ts.map +0 -1
  348. package/lib/esm/ViewportSet.js +0 -121
  349. package/lib/esm/ViewportSet.js.map +0 -1
  350. package/lib/public/assets/approximateTerrainHeights.json +0 -1
@@ -3,8 +3,7 @@
3
3
  */
4
4
  import { ImageSource } from "@itwin/core-common";
5
5
  import { Viewport } from "../Viewport";
6
- import { ReadonlyViewportSet } from "../ViewportSet";
7
- import { Tile, TileContent, TileRequestChannel, TileTree } from "./internal";
6
+ import { ReadonlyTileUserSet, Tile, TileContent, TileRequestChannel, TileTree, TileUser } from "./internal";
8
7
  /** Represents a pending or active request to load the contents of a [[Tile]]. The request coordinates with the [[Tile.requestContent]] to obtain the raw content and
9
8
  * [[Tile.readContent]] to convert the result into a [[RenderGraphic]]. TileRequests are created internally as needed; it is never necessary or useful for external code to create them.
10
9
  * @public
@@ -14,13 +13,17 @@ export declare class TileRequest {
14
13
  readonly tile: Tile;
15
14
  /** The channel via which the request will be executed. */
16
15
  readonly channel: TileRequestChannel;
17
- /** The set of [[Viewport]]s that are awaiting the result of this request. When this becomes empty, the request is canceled because no viewport cares about it. */
18
- viewports: ReadonlyViewportSet;
16
+ /** The set of [[TileUser]]s that are awaiting the result of this request. When this becomes empty, the request is canceled because no user cares about it.
17
+ * @internal
18
+ */
19
+ users: ReadonlyTileUserSet;
19
20
  private _state;
20
21
  /** Determines the order in which pending requests are pulled off the queue to become active. A tile with a lower priority value takes precedence over one with a higher value. */
21
22
  priority: number;
22
23
  /** Constructor */
23
- constructor(tile: Tile, vp: Viewport);
24
+ constructor(tile: Tile, user: TileUser);
25
+ /** The set of [[Viewport]]s that are awaiting the result of this request. When this becomes empty, the request is canceled because no user cares about it. */
26
+ get viewports(): Iterable<Viewport>;
24
27
  /** The request's current state. */
25
28
  get state(): TileRequest.State;
26
29
  /** True if the request has been enqueued but not yet dispatched. */
@@ -29,10 +32,10 @@ export declare class TileRequest {
29
32
  get isCanceled(): boolean;
30
33
  /** The tile tree to which the requested [[Tile]] belongs. */
31
34
  get tree(): TileTree;
32
- /** Indicate that the specified viewport is awaiting the result of this request.
35
+ /** Indicate that the specified user is awaiting the result of this request.
33
36
  * @internal
34
37
  */
35
- addViewport(vp: Viewport): void;
38
+ addUser(user: TileUser): void;
36
39
  /** Transition the request from "queued" to "active", kicking off a series of asynchronous operations usually beginning with an http request, and -
37
40
  * if the request is not subsequently canceled - resulting in either a successfully-loaded Tile, or a failed ("not found") Tile.
38
41
  * @internal
@@ -42,9 +45,9 @@ export declare class TileRequest {
42
45
  * @internal
43
46
  */
44
47
  cancel(): void;
45
- /** Invalidates the scene of each [[Viewport]] interested in this request - typically because the request succeeded, failed, or was canceled. */
48
+ /** Invalidates the scene of each [[TileUser]] interested in this request - typically because the request succeeded, failed, or was canceled. */
46
49
  private notify;
47
- /** Invalidates the scene of each [[Viewport]] interested in this request and clears the set of interested viewports. */
50
+ /** Invalidates the scene of each [[TileUser]] interested in this request and clears the set of interested users. */
48
51
  private notifyAndClear;
49
52
  private setFailed;
50
53
  /** Invoked when the raw tile content becomes available, to convert it into a tile graphic. */
@@ -1 +1 @@
1
- {"version":3,"file":"TileRequest.d.ts","sourceRoot":"","sources":["../../../src/tile/TileRequest.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,C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AC;IA0ChE;;OAEG;IACI,MAAM,IAAI,IAAI;IAQrB,gJAAgJ;IAChJ,OAAO,CAAC,MAAM;IAOd,oHAAoH;IACpH,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,SAAS;IAOjB,8FAA8F;YAChF,cAAc;CAmC7B;AAED,cAAc;AACd,yBAAiB,WAAW,CAAC;IAC3B;;;;OAIG;IACH,KAAY,QAAQ,GAAG,UAAU,GAAG,WAAW,GAAG,MAAM,GAAG,WAAW,GAAG;QAAE,OAAO,EAAE,WAAW,CAAA;KAAE,GAAG,SAAS,CAAC;IAE9G;;OAEG;IACH,KAAY,YAAY,GAAG,UAAU,GAAG,WAAW,CAAC;IAEpD;;;OAGG;IACH,KAAY,KAAK;QACf,gEAAgE;QAChE,MAAM,IAAA;QACN,qEAAqE;QACrE,UAAU,IAAA;QACV,mGAAmG;QACnG,OAAO,IAAA;QACP,0EAA0E;QAC1E,SAAS,IAAA;QACT,0GAA0G;QAC1G,MAAM,IAAA;KACP;CACF"}
@@ -8,19 +8,24 @@
8
8
  import { assert, base64StringToUint8Array, IModelStatus } from "@itwin/core-bentley";
9
9
  import { ImageSource } from "@itwin/core-common";
10
10
  import { IModelApp } from "../IModelApp";
11
+ import { TileUser } from "./internal";
11
12
  /** Represents a pending or active request to load the contents of a [[Tile]]. The request coordinates with the [[Tile.requestContent]] to obtain the raw content and
12
13
  * [[Tile.readContent]] to convert the result into a [[RenderGraphic]]. TileRequests are created internally as needed; it is never necessary or useful for external code to create them.
13
14
  * @public
14
15
  */
15
16
  export class TileRequest {
16
17
  /** Constructor */
17
- constructor(tile, vp) {
18
+ constructor(tile, user) {
18
19
  /** Determines the order in which pending requests are pulled off the queue to become active. A tile with a lower priority value takes precedence over one with a higher value. */
19
20
  this.priority = 0;
20
21
  this._state = TileRequest.State.Queued;
21
22
  this.tile = tile;
22
23
  this.channel = tile.channel;
23
- this.viewports = IModelApp.tileAdmin.getViewportSetForRequest(vp);
24
+ this.users = IModelApp.tileAdmin.getTileUserSetForRequest(user);
25
+ }
26
+ /** The set of [[Viewport]]s that are awaiting the result of this request. When this becomes empty, the request is canceled because no user cares about it. */
27
+ get viewports() {
28
+ return TileUser.viewportsFromUsers(this.users);
24
29
  }
25
30
  /** The request's current state. */
26
31
  get state() { return this._state; }
@@ -34,16 +39,16 @@ export class TileRequest {
34
39
  // After we've received the raw tile data, always finish processing it - otherwise tile may end up in limbo (and producing tile content should be faster than re-requesting raw data).
35
40
  if (TileRequest.State.Loading === this._state)
36
41
  return false;
37
- // If no viewport cares about this tile any more, we're canceled.
38
- return this.viewports.isEmpty;
42
+ // If no user cares about this tile any more, we're canceled.
43
+ return this.users.isEmpty;
39
44
  }
40
45
  /** The tile tree to which the requested [[Tile]] belongs. */
41
46
  get tree() { return this.tile.tree; }
42
- /** Indicate that the specified viewport is awaiting the result of this request.
47
+ /** Indicate that the specified user is awaiting the result of this request.
43
48
  * @internal
44
49
  */
45
- addViewport(vp) {
46
- this.viewports = IModelApp.tileAdmin.getViewportSetForRequest(vp, this.viewports);
50
+ addUser(user) {
51
+ this.users = IModelApp.tileAdmin.getTileUserSetForRequest(user, this.users);
47
52
  }
48
53
  /** Transition the request from "queued" to "active", kicking off a series of asynchronous operations usually beginning with an http request, and -
49
54
  * if the request is not subsequently canceled - resulting in either a successfully-loaded Tile, or a failed ("not found") Tile.
@@ -95,14 +100,17 @@ export class TileRequest {
95
100
  this.channel.onActiveRequestCanceled(this);
96
101
  this._state = TileRequest.State.Failed;
97
102
  }
98
- /** Invalidates the scene of each [[Viewport]] interested in this request - typically because the request succeeded, failed, or was canceled. */
103
+ /** Invalidates the scene of each [[TileUser]] interested in this request - typically because the request succeeded, failed, or was canceled. */
99
104
  notify() {
100
- this.viewports.forEach((vp) => vp.invalidateScene());
105
+ this.users.forEach((user) => {
106
+ if (user.onRequestStateChanged)
107
+ user.onRequestStateChanged(this);
108
+ });
101
109
  }
102
- /** Invalidates the scene of each [[Viewport]] interested in this request and clears the set of interested viewports. */
110
+ /** Invalidates the scene of each [[TileUser]] interested in this request and clears the set of interested users. */
103
111
  notifyAndClear() {
104
112
  this.notify();
105
- this.viewports = IModelApp.tileAdmin.emptyViewportSet;
113
+ this.users = IModelApp.tileAdmin.emptyTileUserSet;
106
114
  this.tile.request = undefined;
107
115
  }
108
116
  setFailed() {
@@ -1 +1 @@
1
- {"version":3,"file":"TileRequest.js","sourceRoot":"","sources":["../../../src/tile/TileRequest.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAKzC;;;GAGG;AACH,MAAM,OAAO,WAAW;IAWtB,kBAAkB;IAClB,YAAmB,IAAU,EAAE,EAAY;QAJ3C,kLAAkL;QAC3K,aAAQ,GAAG,CAAC,CAAC;QAIlB,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC;QACvC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,wBAAwB,CAAC,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,mCAAmC;IACnC,IAAW,KAAK,KAAwB,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAE7D,oEAAoE;IACpE,IAAW,QAAQ,KAAK,OAAO,WAAW,CAAC,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAE1E,6CAA6C;IAC7C,IAAW,UAAU;QACnB,2CAA2C;QAC3C,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU;YACnC,OAAO,IAAI,CAAC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,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;SACnD;QAAC,OAAO,IAAI,EAAE;YACb,IAAI,CAAC,SAAS,EAAE,CAAC;SAClB;IACH,CAAC;CACF;AAED,cAAc;AACd,WAAiB,WAAW;IAa1B;;;OAGG;IACH,IAAY,KAWX;IAXD,WAAY,KAAK;QACf,gEAAgE;QAChE,qCAAM,CAAA;QACN,qEAAqE;QACrE,6CAAU,CAAA;QACV,mGAAmG;QACnG,uCAAO,CAAA;QACP,0EAA0E;QAC1E,2CAAS,CAAA;QACT,0GAA0G;QAC1G,qCAAM,CAAA;IACR,CAAC,EAXW,KAAK,GAAL,iBAAK,KAAL,iBAAK,QAWhB;AACH,CAAC,EA7BgB,WAAW,KAAX,WAAW,QA6B3B","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\n\r\nimport { assert, base64StringToUint8Array, IModelStatus } from \"@itwin/core-bentley\";\r\nimport { ImageSource } from \"@itwin/core-common\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport { Viewport } from \"../Viewport\";\r\nimport { ReadonlyViewportSet } from \"../ViewportSet\";\r\nimport { Tile, TileContent, TileRequestChannel, TileTree } from \"./internal\";\r\n\r\n/** Represents a pending or active request to load the contents of a [[Tile]]. The request coordinates with the [[Tile.requestContent]] to obtain the raw content and\r\n * [[Tile.readContent]] to convert the result into a [[RenderGraphic]]. TileRequests are created internally as needed; it is never necessary or useful for external code to create them.\r\n * @public\r\n */\r\nexport class TileRequest {\r\n /** The requested tile. While the request is pending or active, `tile.request` points back to this TileRequest. */\r\n public readonly tile: Tile;\r\n /** The channel via which the request will be executed. */\r\n public readonly channel: TileRequestChannel;\r\n /** The set of [[Viewport]]s that are awaiting the result of this request. When this becomes empty, the request is canceled because no viewport cares about it. */\r\n public viewports: ReadonlyViewportSet;\r\n private _state: TileRequest.State;\r\n /** Determines the order in which pending requests are pulled off the queue to become active. A tile with a lower priority value takes precedence over one with a higher value. */\r\n public priority = 0;\r\n\r\n /** Constructor */\r\n public constructor(tile: Tile, vp: Viewport) {\r\n this._state = TileRequest.State.Queued;\r\n this.tile = tile;\r\n this.channel = tile.channel;\r\n this.viewports = IModelApp.tileAdmin.getViewportSetForRequest(vp);\r\n }\r\n\r\n /** The request's current state. */\r\n public get state(): TileRequest.State { return this._state; }\r\n\r\n /** True if the request has been enqueued but not yet dispatched. */\r\n public get isQueued() { return TileRequest.State.Queued === this._state; }\r\n\r\n /** True if the request has been canceled. */\r\n public get isCanceled(): boolean {\r\n // If iModel was closed, cancel immediately\r\n if (this.tile.iModel.tiles.isDisposed)\r\n return true;\r\n\r\n // After we've received the raw tile data, always finish processing it - otherwise tile may end up in limbo (and producing tile content should be faster than re-requesting raw data).\r\n if (TileRequest.State.Loading === this._state)\r\n return false;\r\n\r\n // If no viewport cares about this tile any more, we're canceled.\r\n return this.viewports.isEmpty;\r\n }\r\n\r\n /** The tile tree to which the requested [[Tile]] belongs. */\r\n public get tree(): TileTree { return this.tile.tree; }\r\n\r\n /** Indicate that the specified viewport is awaiting the result of this request.\r\n * @internal\r\n */\r\n public addViewport(vp: Viewport): void {\r\n this.viewports = IModelApp.tileAdmin.getViewportSetForRequest(vp, this.viewports);\r\n }\r\n\r\n /** Transition the request from \"queued\" to \"active\", kicking off a series of asynchronous operations usually beginning with an http request, and -\r\n * if the request is not subsequently canceled - resulting in either a successfully-loaded Tile, or a failed (\"not found\") Tile.\r\n * @internal\r\n */\r\n public async dispatch(onHttpResponse: () => void): Promise<void> {\r\n if (this.isCanceled)\r\n return;\r\n\r\n assert(this._state === TileRequest.State.Queued);\r\n this._state = TileRequest.State.Dispatched;\r\n let response;\r\n let gotResponse = false;\r\n try {\r\n response = await this.channel.requestContent(this.tile, () => this.isCanceled);\r\n gotResponse = true;\r\n\r\n // Set this now, so our `isCanceled` check can see it.\r\n this._state = TileRequest.State.Loading;\r\n } catch (err: any) {\r\n if (err.errorNumber && err.errorNumber === IModelStatus.ServerTimeout) {\r\n // Invalidate scene - if tile is re-selected, it will be re-requested.\r\n this.notifyAndClear();\r\n this._state = TileRequest.State.Failed;\r\n this.channel.recordTimeout();\r\n } else {\r\n // Unknown error - not retryable\r\n this.setFailed();\r\n }\r\n }\r\n\r\n // Notify caller that we have finished http activity.\r\n onHttpResponse();\r\n\r\n if (!gotResponse || this.isCanceled)\r\n return;\r\n\r\n if (undefined === response && this.channel.onNoContent(this)) {\r\n // Invalidate scene - if tile is re-selected, it will be re-requested - presumably via a different channel.\r\n this.notifyAndClear();\r\n this._state = TileRequest.State.Failed;\r\n return;\r\n }\r\n\r\n return this.handleResponse(response);\r\n }\r\n\r\n /** Cancels this request. This leaves the associated Tile's state untouched.\r\n * @internal\r\n */\r\n public cancel(): void {\r\n this.notifyAndClear();\r\n if (TileRequest.State.Dispatched === this._state)\r\n this.channel.onActiveRequestCanceled(this);\r\n\r\n this._state = TileRequest.State.Failed;\r\n }\r\n\r\n /** Invalidates the scene of each [[Viewport]] interested in this request - typically because the request succeeded, failed, or was canceled. */\r\n private notify(): void {\r\n this.viewports.forEach((vp) => vp.invalidateScene());\r\n }\r\n\r\n /** Invalidates the scene of each [[Viewport]] interested in this request and clears the set of interested viewports. */\r\n private notifyAndClear(): void {\r\n this.notify();\r\n this.viewports = IModelApp.tileAdmin.emptyViewportSet;\r\n this.tile.request = undefined;\r\n }\r\n\r\n private setFailed() {\r\n this.notifyAndClear();\r\n this._state = TileRequest.State.Failed;\r\n this.tile.setNotFound();\r\n this.channel.recordFailure();\r\n }\r\n\r\n /** Invoked when the raw tile content becomes available, to convert it into a tile graphic. */\r\n private async handleResponse(response: TileRequest.Response): Promise<void> {\r\n let content: TileContent | undefined;\r\n let data: TileRequest.ResponseData | undefined;\r\n if (undefined !== response) {\r\n if (typeof response === \"string\")\r\n data = base64StringToUint8Array(response);\r\n else if (response instanceof Uint8Array || response instanceof ImageSource)\r\n data = response;\r\n else if (response instanceof ArrayBuffer)\r\n data = new Uint8Array(response);\r\n else if (typeof response === \"object\" && undefined !== response.content)\r\n content = response.content;\r\n }\r\n\r\n if (!content && !data) {\r\n this.setFailed();\r\n return;\r\n }\r\n\r\n try {\r\n if (!content) {\r\n assert(undefined !== data);\r\n content = await this.tile.readContent(data, IModelApp.renderSystem, () => this.isCanceled);\r\n if (this.isCanceled)\r\n return;\r\n }\r\n\r\n this._state = TileRequest.State.Completed;\r\n this.tile.setContent(content);\r\n this.notifyAndClear();\r\n this.channel.recordCompletion(this.tile, content);\r\n } catch (_err) {\r\n this.setFailed();\r\n }\r\n }\r\n}\r\n\r\n/** @public */\r\nexport namespace TileRequest { // eslint-disable-line no-redeclare\r\n /** The type of a raw response to a request for tile content. Processed upon receipt into a [[TileRequest.Response]] type.\r\n * [[Tile.requestContent]] produces a response of this type; it is then converted to a [[Tile.ResponseData]] from which [[Tile.readContent]]\r\n * can produce a [[RenderGraphic]].\r\n * @public\r\n */\r\n export type Response = Uint8Array | ArrayBuffer | string | ImageSource | { content: TileContent } | undefined;\r\n\r\n /** The input to [[Tile.readContent]], to be converted into a [[RenderGraphic]].\r\n * @public\r\n */\r\n export type ResponseData = Uint8Array | ImageSource;\r\n\r\n /** The states through which a [[TileRequest]] proceeds. During the first 3 states, the [[Tile]]'s `request` member is defined,\r\n * and its [[Tile.LoadStatus]] is computed based on the state of its request.\r\n *@ public\r\n */\r\n export enum State {\r\n /** Initial state. Request is pending but not yet dispatched. */\r\n Queued,\r\n /** Follows `Queued` when request begins to be actively processed. */\r\n Dispatched,\r\n /** Follows `Dispatched` when the response to the request is being converted into tile graphics. */\r\n Loading,\r\n /** Follows `Loading` when tile graphic has successfully been produced. */\r\n Completed,\r\n /** Follows any state in which an error prevents progression, or during which the request was canceled. */\r\n Failed,\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"T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AC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;SACnD;QAAC,OAAO,IAAI,EAAE;YACb,IAAI,CAAC,SAAS,EAAE,CAAC;SAClB;IACH,CAAC;CACF;AAED,cAAc;AACd,WAAiB,WAAW;IAa1B;;;OAGG;IACH,IAAY,KAWX;IAXD,WAAY,KAAK;QACf,gEAAgE;QAChE,qCAAM,CAAA;QACN,qEAAqE;QACrE,6CAAU,CAAA;QACV,mGAAmG;QACnG,uCAAO,CAAA;QACP,0EAA0E;QAC1E,2CAAS,CAAA;QACT,0GAA0G;QAC1G,qCAAM,CAAA;IACR,CAAC,EAXW,KAAK,GAAL,iBAAK,KAAL,iBAAK,QAWhB;AACH,CAAC,EA7BgB,WAAW,KAAX,WAAW,QA6B3B","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\n\r\nimport { assert, base64StringToUint8Array, IModelStatus } from \"@itwin/core-bentley\";\r\nimport { ImageSource } from \"@itwin/core-common\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport { Viewport } from \"../Viewport\";\r\nimport { ReadonlyTileUserSet, Tile, TileContent, TileRequestChannel, TileTree, TileUser } from \"./internal\";\r\n\r\n/** Represents a pending or active request to load the contents of a [[Tile]]. The request coordinates with the [[Tile.requestContent]] to obtain the raw content and\r\n * [[Tile.readContent]] to convert the result into a [[RenderGraphic]]. TileRequests are created internally as needed; it is never necessary or useful for external code to create them.\r\n * @public\r\n */\r\nexport class TileRequest {\r\n /** The requested tile. While the request is pending or active, `tile.request` points back to this TileRequest. */\r\n public readonly tile: Tile;\r\n /** The channel via which the request will be executed. */\r\n public readonly channel: TileRequestChannel;\r\n /** The set of [[TileUser]]s that are awaiting the result of this request. When this becomes empty, the request is canceled because no user cares about it.\r\n * @internal\r\n */\r\n public users: ReadonlyTileUserSet;\r\n private _state: TileRequest.State;\r\n /** Determines the order in which pending requests are pulled off the queue to become active. A tile with a lower priority value takes precedence over one with a higher value. */\r\n public priority = 0;\r\n\r\n /** Constructor */\r\n public constructor(tile: Tile, user: TileUser) {\r\n this._state = TileRequest.State.Queued;\r\n this.tile = tile;\r\n this.channel = tile.channel;\r\n this.users = IModelApp.tileAdmin.getTileUserSetForRequest(user);\r\n }\r\n\r\n /** The set of [[Viewport]]s that are awaiting the result of this request. When this becomes empty, the request is canceled because no user cares about it. */\r\n public get viewports(): Iterable<Viewport> {\r\n return TileUser.viewportsFromUsers(this.users);\r\n }\r\n\r\n /** The request's current state. */\r\n public get state(): TileRequest.State { return this._state; }\r\n\r\n /** True if the request has been enqueued but not yet dispatched. */\r\n public get isQueued() { return TileRequest.State.Queued === this._state; }\r\n\r\n /** True if the request has been canceled. */\r\n public get isCanceled(): boolean {\r\n // If iModel was closed, cancel immediately\r\n if (this.tile.iModel.tiles.isDisposed)\r\n return true;\r\n\r\n // After we've received the raw tile data, always finish processing it - otherwise tile may end up in limbo (and producing tile content should be faster than re-requesting raw data).\r\n if (TileRequest.State.Loading === this._state)\r\n return false;\r\n\r\n // If no user cares about this tile any more, we're canceled.\r\n return this.users.isEmpty;\r\n }\r\n\r\n /** The tile tree to which the requested [[Tile]] belongs. */\r\n public get tree(): TileTree { return this.tile.tree; }\r\n\r\n /** Indicate that the specified user is awaiting the result of this request.\r\n * @internal\r\n */\r\n public addUser(user: TileUser): void {\r\n this.users = IModelApp.tileAdmin.getTileUserSetForRequest(user, this.users);\r\n }\r\n\r\n /** Transition the request from \"queued\" to \"active\", kicking off a series of asynchronous operations usually beginning with an http request, and -\r\n * if the request is not subsequently canceled - resulting in either a successfully-loaded Tile, or a failed (\"not found\") Tile.\r\n * @internal\r\n */\r\n public async dispatch(onHttpResponse: () => void): Promise<void> {\r\n if (this.isCanceled)\r\n return;\r\n\r\n assert(this._state === TileRequest.State.Queued);\r\n this._state = TileRequest.State.Dispatched;\r\n let response;\r\n let gotResponse = false;\r\n try {\r\n response = await this.channel.requestContent(this.tile, () => this.isCanceled);\r\n gotResponse = true;\r\n\r\n // Set this now, so our `isCanceled` check can see it.\r\n this._state = TileRequest.State.Loading;\r\n } catch (err: any) {\r\n if (err.errorNumber && err.errorNumber === IModelStatus.ServerTimeout) {\r\n // Invalidate scene - if tile is re-selected, it will be re-requested.\r\n this.notifyAndClear();\r\n this._state = TileRequest.State.Failed;\r\n this.channel.recordTimeout();\r\n } else {\r\n // Unknown error - not retryable\r\n this.setFailed();\r\n }\r\n }\r\n\r\n // Notify caller that we have finished http activity.\r\n onHttpResponse();\r\n\r\n if (!gotResponse || this.isCanceled)\r\n return;\r\n\r\n if (undefined === response && this.channel.onNoContent(this)) {\r\n // Invalidate scene - if tile is re-selected, it will be re-requested - presumably via a different channel.\r\n this.notifyAndClear();\r\n this._state = TileRequest.State.Failed;\r\n return;\r\n }\r\n\r\n return this.handleResponse(response);\r\n }\r\n\r\n /** Cancels this request. This leaves the associated Tile's state untouched.\r\n * @internal\r\n */\r\n public cancel(): void {\r\n this.notifyAndClear();\r\n if (TileRequest.State.Dispatched === this._state)\r\n this.channel.onActiveRequestCanceled(this);\r\n\r\n this._state = TileRequest.State.Failed;\r\n }\r\n\r\n /** Invalidates the scene of each [[TileUser]] interested in this request - typically because the request succeeded, failed, or was canceled. */\r\n private notify(): void {\r\n this.users.forEach((user) => {\r\n if (user.onRequestStateChanged)\r\n user.onRequestStateChanged(this);\r\n });\r\n }\r\n\r\n /** Invalidates the scene of each [[TileUser]] interested in this request and clears the set of interested users. */\r\n private notifyAndClear(): void {\r\n this.notify();\r\n this.users = IModelApp.tileAdmin.emptyTileUserSet;\r\n this.tile.request = undefined;\r\n }\r\n\r\n private setFailed() {\r\n this.notifyAndClear();\r\n this._state = TileRequest.State.Failed;\r\n this.tile.setNotFound();\r\n this.channel.recordFailure();\r\n }\r\n\r\n /** Invoked when the raw tile content becomes available, to convert it into a tile graphic. */\r\n private async handleResponse(response: TileRequest.Response): Promise<void> {\r\n let content: TileContent | undefined;\r\n let data: TileRequest.ResponseData | undefined;\r\n if (undefined !== response) {\r\n if (typeof response === \"string\")\r\n data = base64StringToUint8Array(response);\r\n else if (response instanceof Uint8Array || response instanceof ImageSource)\r\n data = response;\r\n else if (response instanceof ArrayBuffer)\r\n data = new Uint8Array(response);\r\n else if (typeof response === \"object\" && undefined !== response.content)\r\n content = response.content;\r\n }\r\n\r\n if (!content && !data) {\r\n this.setFailed();\r\n return;\r\n }\r\n\r\n try {\r\n if (!content) {\r\n assert(undefined !== data);\r\n content = await this.tile.readContent(data, IModelApp.renderSystem, () => this.isCanceled);\r\n if (this.isCanceled)\r\n return;\r\n }\r\n\r\n this._state = TileRequest.State.Completed;\r\n this.tile.setContent(content);\r\n this.notifyAndClear();\r\n this.channel.recordCompletion(this.tile, content);\r\n } catch (_err) {\r\n this.setFailed();\r\n }\r\n }\r\n}\r\n\r\n/** @public */\r\nexport namespace TileRequest { // eslint-disable-line no-redeclare\r\n /** The type of a raw response to a request for tile content. Processed upon receipt into a [[TileRequest.Response]] type.\r\n * [[Tile.requestContent]] produces a response of this type; it is then converted to a [[Tile.ResponseData]] from which [[Tile.readContent]]\r\n * can produce a [[RenderGraphic]].\r\n * @public\r\n */\r\n export type Response = Uint8Array | ArrayBuffer | string | ImageSource | { content: TileContent } | undefined;\r\n\r\n /** The input to [[Tile.readContent]], to be converted into a [[RenderGraphic]].\r\n * @public\r\n */\r\n export type ResponseData = Uint8Array | ImageSource;\r\n\r\n /** The states through which a [[TileRequest]] proceeds. During the first 3 states, the [[Tile]]'s `request` member is defined,\r\n * and its [[Tile.LoadStatus]] is computed based on the state of its request.\r\n *@ public\r\n */\r\n export enum State {\r\n /** Initial state. Request is pending but not yet dispatched. */\r\n Queued,\r\n /** Follows `Queued` when request begins to be actively processed. */\r\n Dispatched,\r\n /** Follows `Dispatched` when the response to the request is being converted into tile graphics. */\r\n Loading,\r\n /** Follows `Loading` when tile graphic has successfully been produced. */\r\n Completed,\r\n /** Follows any state in which an error prevents progression, or during which the request was canceled. */\r\n Failed,\r\n }\r\n}\r\n"]}
@@ -163,18 +163,18 @@ export class TileRequestChannel {
163
163
  this._statistics.numCanceled = 0;
164
164
  // Recompute priority of each request.
165
165
  for (const pending of this._pending)
166
- pending.priority = pending.tile.computeLoadPriority(pending.viewports);
166
+ pending.priority = pending.tile.computeLoadPriority(pending.viewports, pending.users);
167
167
  // Sort pending requests by priority.
168
168
  this._pending.sort();
169
169
  // Cancel any previously pending requests that are no longer needed.
170
170
  for (const queued of this._previouslyPending)
171
- if (queued.viewports.isEmpty)
171
+ if (queued.users.isEmpty)
172
172
  this.cancel(queued);
173
173
  this._previouslyPending.clear();
174
174
  // Cancel any active requests that are no longer needed.
175
175
  // NB: Do NOT remove them from the active set until their http activity has completed.
176
176
  for (const active of this._active)
177
- if (active.viewports.isEmpty)
177
+ if (active.users.isEmpty)
178
178
  this.cancel(active);
179
179
  // Batch-cancel running requests.
180
180
  this.processCancellations();
@@ -1 +1 @@
1
- {"version":3,"file":"TileRequestChannel.js","sourceRoot":"","sources":["../../../src/tile/TileRequestChannel.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAI5D,MAAM,gBAAiB,SAAQ,aAA0B;IACvD;QACE,KAAK,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YACjB,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;YACrE,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;QACzD,CAAC,CAAC,CAAC;IACL,C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,OAAO,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;YACb,EAAE;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACO,MAAM,CAAC,OAAoB;QACnC,OAAO,CAAC,MAAM,EAAE,CAAC;QACjB,EAAE,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;IACjC,CAAC;IAED;;OAEG;IACO,iBAAiB,CAAC,OAAoB;QAC9C,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;QACxD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport { assert, PriorityQueue } from \"@itwin/core-bentley\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { Tile, TileContent, TileRequest } from \"./internal\";\r\n\r\nclass TileRequestQueue extends PriorityQueue<TileRequest> {\r\n public constructor() {\r\n super((lhs, rhs) => {\r\n const diff = lhs.tile.tree.loadPriority - rhs.tile.tree.loadPriority;\r\n return 0 !== diff ? diff : lhs.priority - rhs.priority;\r\n });\r\n }\r\n}\r\n\r\n/** Statistics regarding the current and cumulative state of one or more [[TileRequestChannel]]s. Useful for monitoring performance and diagnosing problems.\r\n * @see [[TileRequestChannel.statistics]] for a specific channel's statistics.\r\n * @see [[TileRequestChannels.statistics]] for statistics from all channels.\r\n * @see [[TileAdmin.statistics]] for additional statistics.\r\n * @public\r\n */\r\nexport class TileRequestChannelStatistics {\r\n /** The number of queued requests that have not yet been dispatched. */\r\n public numPendingRequests = 0;\r\n /** The number of requests that have been dispatched but not yet completed. */\r\n public numActiveRequests = 0;\r\n /** The number of requests canceled during the most recent update. */\r\n public numCanceled = 0;\r\n /** The total number of completed requests during this session. */\r\n public totalCompletedRequests = 0;\r\n /** The total number of failed requests during this session. */\r\n public totalFailedRequests = 0;\r\n /** The total number of timed-out requests during this session. */\r\n public totalTimedOutRequests = 0;\r\n /** The total number of completed requests during this session which produced an empty tile.\r\n * These tiles also contribute to [[totalCompletedRequests]], but not to [[totalUndisplayableTiles]].\r\n */\r\n public totalEmptyTiles = 0;\r\n /** The total number of completed requests during this session that produced an undisplayable tile.\r\n * These tiles also contribute to [[totalCompletedRequests]], but not to [[totalEmptyTiles]].\r\n */\r\n public totalUndisplayableTiles = 0;\r\n /** The total number of tiles whose contents were not found in cloud storage cache and therefore resulted in a backend request to generate the tile content. */\r\n public totalCacheMisses = 0;\r\n /** The total number of tiles for which content requests were dispatched. */\r\n public totalDispatchedRequests = 0;\r\n /** The total number of tiles for which content requests were dispatched and then canceled on the backend before completion. */\r\n public totalAbortedRequests = 0;\r\n\r\n /** @internal */\r\n public addTo(stats: TileRequestChannelStatistics): void {\r\n for (const propName in this) { // eslint-disable-line guard-for-in\r\n const key = propName as keyof TileRequestChannelStatistics;\r\n const val = this[key];\r\n if (typeof val === \"number\") {\r\n // This type guard ought to suffice but doesn't.\r\n assert(typeof stats[key] === \"number\");\r\n (stats[key] as number) += val;\r\n }\r\n }\r\n }\r\n}\r\n\r\n/** A channel over which requests for tile content can be made. The channel may request content over HTTP, calls to the backend via IPC or RPC, or any other method like generating the content\r\n * on the frontend. The channel consists of a queue of pending requests and a set of \"active\" requests (dispatched and awaiting a response). Incoming requests are placed onto the queue. Requests are popped of the queue in order of priority and dispatched, until the maximum number of simultaneously-active requests is reached.\r\n * The maximum number of active requests depends on the transport mechanism. For HTTP 1.1, browsers impose a limit of 6 simultaneous connections to a given domain, so ideally each unique domain will use its own unique channel with a limit of 6 active requests. Even for requests satisfied entirely by the frontend, imposing a limit is important for throttling the amount of work done at one time, especially because as the user navigates the view, tiles that were previously requested may no longer be of interest and we shouldn't waste resources producing their content.\r\n * A channel must be registered with [[TileRequestChannels]] and must have a unique name among all registered channels.\r\n * @see [[TileRequestChannels.getForHttp]] to obtain (and register if not already registered) an HTTP-based channel.\r\n * @see [[TileAdmin.channels]] for the channels configured for use with the iTwin.js display system.\r\n * @see [[Tile.channel]] to specify the channel to be used to request a given tile's content.\r\n * @public\r\n */\r\nexport class TileRequestChannel {\r\n /** The channel's name. It must be unique among all registered [[TileRequestChannels]]. */\r\n public readonly name: string;\r\n private _concurrency: number;\r\n /** Protected strictly for tests. @internal */\r\n protected readonly _active = new Set<TileRequest>();\r\n private _pending = new TileRequestQueue();\r\n private _previouslyPending = new TileRequestQueue();\r\n protected _statistics = new TileRequestChannelStatistics();\r\n /** Callback invoked by recordCompletion. See IModelTileMetadataCacheChannel.\r\n * @internal\r\n */\r\n public contentCallback?: (tile: Tile, content: TileContent) => void;\r\n\r\n /** Create a new channel.\r\n * @param name The unique name of the channel.\r\n * @param concurrency The maximum number of requests that can be dispatched and awaiting a response at any given time. Requests beyond this maximum are enqueued for deferred dispatch.\r\n * @see [[TileRequestChannels.getForHttp]] to create an HTTP-based channel.\r\n */\r\n public constructor(name: string, concurrency: number) {\r\n this.name = name;\r\n this._concurrency = concurrency;\r\n }\r\n\r\n /** The maximum number of active requests. This is generally only modified for debugging purposes.\r\n * @note When reducing `concurrency`, the number of active requests ([[numActive]]) will only decrease to the new value after a sufficient number of dispatched requests are resolved.\r\n */\r\n public get concurrency(): number {\r\n return this._concurrency;\r\n }\r\n public set concurrency(max: number) {\r\n this._concurrency = max;\r\n }\r\n\r\n /** The number of requests that have been dispatched and are awaiting a response. */\r\n public get numActive(): number {\r\n return this._active.size;\r\n }\r\n\r\n /** The number of requests that have been enqueued for later dispatch. */\r\n public get numPending(): number {\r\n return this._pending.length;\r\n }\r\n\r\n /** The total number of requests in this channel, whether dispatched or enqueued. */\r\n public get size(): number {\r\n return this.numActive + this.numPending;\r\n }\r\n\r\n /** Statistics intended primarily for debugging. */\r\n public get statistics(): Readonly<TileRequestChannelStatistics> {\r\n this._statistics.numPendingRequests = this.numPending;\r\n this._statistics.numActiveRequests = this.numActive;\r\n return this._statistics;\r\n }\r\n\r\n /** Reset all of this channel's [[statistics]] to zero. */\r\n public resetStatistics(): void {\r\n this._statistics = new TileRequestChannelStatistics();\r\n }\r\n\r\n /** Invoked by [[TileRequest]] when a request times out.\r\n * @internal\r\n */\r\n public recordTimeout(): void {\r\n ++this._statistics.totalTimedOutRequests;\r\n }\r\n\r\n /** Invoked by [[TileRequest]] when a request fails to produce a response.\r\n * @internal\r\n */\r\n public recordFailure(): void {\r\n ++this._statistics.totalFailedRequests;\r\n }\r\n\r\n /** Invoked by [[TileRequest]] after a request completes.\r\n * @internal\r\n */\r\n public recordCompletion(tile: Tile, content: TileContent): void {\r\n ++this._statistics.totalCompletedRequests;\r\n if (tile.isEmpty)\r\n ++this._statistics.totalEmptyTiles;\r\n else if (!tile.isDisplayable)\r\n ++this._statistics.totalUndisplayableTiles;\r\n\r\n if (this.contentCallback)\r\n this.contentCallback(tile, content);\r\n }\r\n\r\n /** Invoked by [[TileRequestChannels.swapPending]] when [[TileAdmin]] is about to start enqueuing new requests.\r\n * @internal\r\n */\r\n public swapPending(): void {\r\n const previouslyPending = this._pending;\r\n this._pending = this._previouslyPending;\r\n this._previouslyPending = previouslyPending;\r\n }\r\n\r\n /** Invoked by [[TileAdmin.processRequests]] to enqueue a request. Ordering is ignored - the queue will be re-sorted later.\r\n * @internal\r\n */\r\n public append(request: TileRequest): void {\r\n assert(request.channel === this);\r\n this._pending.append(request);\r\n }\r\n\r\n /** Invoked by [[TileRequestChannels.process]] to process the active and pending requests.\r\n * @internal\r\n */\r\n public process(): void {\r\n this._statistics.numCanceled = 0;\r\n\r\n // Recompute priority of each request.\r\n for (const pending of this._pending)\r\n pending.priority = pending.tile.computeLoadPriority(pending.viewports);\r\n\r\n // Sort pending requests by priority.\r\n this._pending.sort();\r\n\r\n // Cancel any previously pending requests that are no longer needed.\r\n for (const queued of this._previouslyPending)\r\n if (queued.viewports.isEmpty)\r\n this.cancel(queued);\r\n\r\n this._previouslyPending.clear();\r\n\r\n // Cancel any active requests that are no longer needed.\r\n // NB: Do NOT remove them from the active set until their http activity has completed.\r\n for (const active of this._active)\r\n if (active.viewports.isEmpty)\r\n this.cancel(active);\r\n\r\n // Batch-cancel running requests.\r\n this.processCancellations();\r\n\r\n // Dispatch requests from the queue up to our maximum.\r\n while (this._active.size < this._concurrency) {\r\n const request = this._pending.pop();\r\n if (!request)\r\n break;\r\n\r\n this.dispatch(request);\r\n }\r\n }\r\n\r\n /** Cancel all active and queued requests and clear the active set and queue.\r\n * @internal\r\n */\r\n public cancelAndClearAll(): void {\r\n for (const active of this._active)\r\n active.cancel();\r\n\r\n for (const queued of this._pending)\r\n queued.cancel();\r\n\r\n this._active.clear();\r\n this._pending.clear();\r\n }\r\n\r\n /** Invoked when [[Tile.requestContent]] returns `undefined`. Return true if the request can be retried, e.g., via different channel.\r\n * If so, the tile will remain marked as \"not loaded\" and, if re-selected for display, a new [[TileRequest]] will be enqueued for it.\r\n * Otherwise, the tile will be marked as \"failed to load\" and no further requests will be made for its content.\r\n * The default implementation always returns `false`.\r\n */\r\n public onNoContent(_request: TileRequest): boolean {\r\n return false;\r\n }\r\n\r\n /** Invoked when a request that was previously dispatched is canceled before a response is received.\r\n * Some channels accumulate such requests for later cancellation in [[processCancellations]].\r\n */\r\n public onActiveRequestCanceled(_request: TileRequest): void { }\r\n\r\n /** Invoked to do any additional work to cancel tiles accumulated by [[onActiveRequestCanceled]]. For example, a channel that requests tile content\r\n * over IPC may signal to the tile generation process that it should cease generating content for those tiles.\r\n */\r\n public processCancellations(): void { }\r\n\r\n /** Invoked when an iModel is closed, to clean up any state associated with that iModel. */\r\n public onIModelClosed(_iModel: IModelConnection): void { }\r\n\r\n /** Request content for the specified tile. The default implementation simply forwards to [[Tile.requestContent]]. */\r\n public async requestContent(tile: Tile, isCanceled: () => boolean): Promise<TileRequest.Response> {\r\n return tile.requestContent(isCanceled);\r\n }\r\n\r\n /** Protected only for tests - do not override.\r\n * @internal\r\n */\r\n protected dispatch(request: TileRequest): void {\r\n ++this._statistics.totalDispatchedRequests;\r\n this._active.add(request);\r\n request.dispatch(() => {\r\n this.dropActiveRequest(request);\r\n }).catch((_) => {\r\n //\r\n });\r\n }\r\n\r\n /** Protected only for tests - do not override.\r\n * @internal\r\n */\r\n protected cancel(request: TileRequest): void {\r\n request.cancel();\r\n ++this._statistics.numCanceled;\r\n }\r\n\r\n /** Protected only for tests - do not override.\r\n * @internal\r\n */\r\n protected dropActiveRequest(request: TileRequest): void {\r\n assert(this._active.has(request) || request.isCanceled);\r\n this._active.delete(request);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"TileRequestChannel.js","sourceRoot":"","sources":["../../../src/tile/TileRequestChannel.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAI5D,MAAM,gBAAiB,SAAQ,aAA0B;IACvD;QACE,KAAK,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YACjB,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;YACrE,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;QACzD,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,4BAA4B;IAAzC;QACE,uEAAuE;QAChE,uBAAkB,GAAG,CAAC,CAAC;QAC9B,8EAA8E;QACvE,sBAAiB,GAAG,CAAC,CAAC;QAC7B,qEAAqE;QAC9D,gBAAW,GAAG,CA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AO,CAAC,MAAM,EAAE,CAAC;QACjB,EAAE,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;IACjC,CAAC;IAED;;OAEG;IACO,iBAAiB,CAAC,OAAoB;QAC9C,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;QACxD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport { assert, PriorityQueue } from \"@itwin/core-bentley\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { Tile, TileContent, TileRequest } from \"./internal\";\r\n\r\nclass TileRequestQueue extends PriorityQueue<TileRequest> {\r\n public constructor() {\r\n super((lhs, rhs) => {\r\n const diff = lhs.tile.tree.loadPriority - rhs.tile.tree.loadPriority;\r\n return 0 !== diff ? diff : lhs.priority - rhs.priority;\r\n });\r\n }\r\n}\r\n\r\n/** Statistics regarding the current and cumulative state of one or more [[TileRequestChannel]]s. Useful for monitoring performance and diagnosing problems.\r\n * @see [[TileRequestChannel.statistics]] for a specific channel's statistics.\r\n * @see [[TileRequestChannels.statistics]] for statistics from all channels.\r\n * @see [[TileAdmin.statistics]] for additional statistics.\r\n * @public\r\n */\r\nexport class TileRequestChannelStatistics {\r\n /** The number of queued requests that have not yet been dispatched. */\r\n public numPendingRequests = 0;\r\n /** The number of requests that have been dispatched but not yet completed. */\r\n public numActiveRequests = 0;\r\n /** The number of requests canceled during the most recent update. */\r\n public numCanceled = 0;\r\n /** The total number of completed requests during this session. */\r\n public totalCompletedRequests = 0;\r\n /** The total number of failed requests during this session. */\r\n public totalFailedRequests = 0;\r\n /** The total number of timed-out requests during this session. */\r\n public totalTimedOutRequests = 0;\r\n /** The total number of completed requests during this session which produced an empty tile.\r\n * These tiles also contribute to [[totalCompletedRequests]], but not to [[totalUndisplayableTiles]].\r\n */\r\n public totalEmptyTiles = 0;\r\n /** The total number of completed requests during this session that produced an undisplayable tile.\r\n * These tiles also contribute to [[totalCompletedRequests]], but not to [[totalEmptyTiles]].\r\n */\r\n public totalUndisplayableTiles = 0;\r\n /** The total number of tiles whose contents were not found in cloud storage cache and therefore resulted in a backend request to generate the tile content. */\r\n public totalCacheMisses = 0;\r\n /** The total number of tiles for which content requests were dispatched. */\r\n public totalDispatchedRequests = 0;\r\n /** The total number of tiles for which content requests were dispatched and then canceled on the backend before completion. */\r\n public totalAbortedRequests = 0;\r\n\r\n /** @internal */\r\n public addTo(stats: TileRequestChannelStatistics): void {\r\n for (const propName in this) { // eslint-disable-line guard-for-in\r\n const key = propName as keyof TileRequestChannelStatistics;\r\n const val = this[key];\r\n if (typeof val === \"number\") {\r\n // This type guard ought to suffice but doesn't.\r\n assert(typeof stats[key] === \"number\");\r\n (stats[key] as number) += val;\r\n }\r\n }\r\n }\r\n}\r\n\r\n/** A channel over which requests for tile content can be made. The channel may request content over HTTP, calls to the backend via IPC or RPC, or any other method like generating the content\r\n * on the frontend. The channel consists of a queue of pending requests and a set of \"active\" requests (dispatched and awaiting a response). Incoming requests are placed onto the queue. Requests are popped of the queue in order of priority and dispatched, until the maximum number of simultaneously-active requests is reached.\r\n * The maximum number of active requests depends on the transport mechanism. For HTTP 1.1, browsers impose a limit of 6 simultaneous connections to a given domain, so ideally each unique domain will use its own unique channel with a limit of 6 active requests. Even for requests satisfied entirely by the frontend, imposing a limit is important for throttling the amount of work done at one time, especially because as the user navigates the view, tiles that were previously requested may no longer be of interest and we shouldn't waste resources producing their content.\r\n * A channel must be registered with [[TileRequestChannels]] and must have a unique name among all registered channels.\r\n * @see [[TileRequestChannels.getForHttp]] to obtain (and register if not already registered) an HTTP-based channel.\r\n * @see [[TileAdmin.channels]] for the channels configured for use with the iTwin.js display system.\r\n * @see [[Tile.channel]] to specify the channel to be used to request a given tile's content.\r\n * @public\r\n */\r\nexport class TileRequestChannel {\r\n /** The channel's name. It must be unique among all registered [[TileRequestChannels]]. */\r\n public readonly name: string;\r\n private _concurrency: number;\r\n /** Protected strictly for tests. @internal */\r\n protected readonly _active = new Set<TileRequest>();\r\n private _pending = new TileRequestQueue();\r\n private _previouslyPending = new TileRequestQueue();\r\n protected _statistics = new TileRequestChannelStatistics();\r\n /** Callback invoked by recordCompletion. See IModelTileMetadataCacheChannel.\r\n * @internal\r\n */\r\n public contentCallback?: (tile: Tile, content: TileContent) => void;\r\n\r\n /** Create a new channel.\r\n * @param name The unique name of the channel.\r\n * @param concurrency The maximum number of requests that can be dispatched and awaiting a response at any given time. Requests beyond this maximum are enqueued for deferred dispatch.\r\n * @see [[TileRequestChannels.getForHttp]] to create an HTTP-based channel.\r\n */\r\n public constructor(name: string, concurrency: number) {\r\n this.name = name;\r\n this._concurrency = concurrency;\r\n }\r\n\r\n /** The maximum number of active requests. This is generally only modified for debugging purposes.\r\n * @note When reducing `concurrency`, the number of active requests ([[numActive]]) will only decrease to the new value after a sufficient number of dispatched requests are resolved.\r\n */\r\n public get concurrency(): number {\r\n return this._concurrency;\r\n }\r\n public set concurrency(max: number) {\r\n this._concurrency = max;\r\n }\r\n\r\n /** The number of requests that have been dispatched and are awaiting a response. */\r\n public get numActive(): number {\r\n return this._active.size;\r\n }\r\n\r\n /** The number of requests that have been enqueued for later dispatch. */\r\n public get numPending(): number {\r\n return this._pending.length;\r\n }\r\n\r\n /** The total number of requests in this channel, whether dispatched or enqueued. */\r\n public get size(): number {\r\n return this.numActive + this.numPending;\r\n }\r\n\r\n /** Statistics intended primarily for debugging. */\r\n public get statistics(): Readonly<TileRequestChannelStatistics> {\r\n this._statistics.numPendingRequests = this.numPending;\r\n this._statistics.numActiveRequests = this.numActive;\r\n return this._statistics;\r\n }\r\n\r\n /** Reset all of this channel's [[statistics]] to zero. */\r\n public resetStatistics(): void {\r\n this._statistics = new TileRequestChannelStatistics();\r\n }\r\n\r\n /** Invoked by [[TileRequest]] when a request times out.\r\n * @internal\r\n */\r\n public recordTimeout(): void {\r\n ++this._statistics.totalTimedOutRequests;\r\n }\r\n\r\n /** Invoked by [[TileRequest]] when a request fails to produce a response.\r\n * @internal\r\n */\r\n public recordFailure(): void {\r\n ++this._statistics.totalFailedRequests;\r\n }\r\n\r\n /** Invoked by [[TileRequest]] after a request completes.\r\n * @internal\r\n */\r\n public recordCompletion(tile: Tile, content: TileContent): void {\r\n ++this._statistics.totalCompletedRequests;\r\n if (tile.isEmpty)\r\n ++this._statistics.totalEmptyTiles;\r\n else if (!tile.isDisplayable)\r\n ++this._statistics.totalUndisplayableTiles;\r\n\r\n if (this.contentCallback)\r\n this.contentCallback(tile, content);\r\n }\r\n\r\n /** Invoked by [[TileRequestChannels.swapPending]] when [[TileAdmin]] is about to start enqueuing new requests.\r\n * @internal\r\n */\r\n public swapPending(): void {\r\n const previouslyPending = this._pending;\r\n this._pending = this._previouslyPending;\r\n this._previouslyPending = previouslyPending;\r\n }\r\n\r\n /** Invoked by [[TileAdmin.processRequests]] to enqueue a request. Ordering is ignored - the queue will be re-sorted later.\r\n * @internal\r\n */\r\n public append(request: TileRequest): void {\r\n assert(request.channel === this);\r\n this._pending.append(request);\r\n }\r\n\r\n /** Invoked by [[TileRequestChannels.process]] to process the active and pending requests.\r\n * @internal\r\n */\r\n public process(): void {\r\n this._statistics.numCanceled = 0;\r\n\r\n // Recompute priority of each request.\r\n for (const pending of this._pending)\r\n pending.priority = pending.tile.computeLoadPriority(pending.viewports, pending.users);\r\n\r\n // Sort pending requests by priority.\r\n this._pending.sort();\r\n\r\n // Cancel any previously pending requests that are no longer needed.\r\n for (const queued of this._previouslyPending)\r\n if (queued.users.isEmpty)\r\n this.cancel(queued);\r\n\r\n this._previouslyPending.clear();\r\n\r\n // Cancel any active requests that are no longer needed.\r\n // NB: Do NOT remove them from the active set until their http activity has completed.\r\n for (const active of this._active)\r\n if (active.users.isEmpty)\r\n this.cancel(active);\r\n\r\n // Batch-cancel running requests.\r\n this.processCancellations();\r\n\r\n // Dispatch requests from the queue up to our maximum.\r\n while (this._active.size < this._concurrency) {\r\n const request = this._pending.pop();\r\n if (!request)\r\n break;\r\n\r\n this.dispatch(request);\r\n }\r\n }\r\n\r\n /** Cancel all active and queued requests and clear the active set and queue.\r\n * @internal\r\n */\r\n public cancelAndClearAll(): void {\r\n for (const active of this._active)\r\n active.cancel();\r\n\r\n for (const queued of this._pending)\r\n queued.cancel();\r\n\r\n this._active.clear();\r\n this._pending.clear();\r\n }\r\n\r\n /** Invoked when [[Tile.requestContent]] returns `undefined`. Return true if the request can be retried, e.g., via different channel.\r\n * If so, the tile will remain marked as \"not loaded\" and, if re-selected for display, a new [[TileRequest]] will be enqueued for it.\r\n * Otherwise, the tile will be marked as \"failed to load\" and no further requests will be made for its content.\r\n * The default implementation always returns `false`.\r\n */\r\n public onNoContent(_request: TileRequest): boolean {\r\n return false;\r\n }\r\n\r\n /** Invoked when a request that was previously dispatched is canceled before a response is received.\r\n * Some channels accumulate such requests for later cancellation in [[processCancellations]].\r\n */\r\n public onActiveRequestCanceled(_request: TileRequest): void { }\r\n\r\n /** Invoked to do any additional work to cancel tiles accumulated by [[onActiveRequestCanceled]]. For example, a channel that requests tile content\r\n * over IPC may signal to the tile generation process that it should cease generating content for those tiles.\r\n */\r\n public processCancellations(): void { }\r\n\r\n /** Invoked when an iModel is closed, to clean up any state associated with that iModel. */\r\n public onIModelClosed(_iModel: IModelConnection): void { }\r\n\r\n /** Request content for the specified tile. The default implementation simply forwards to [[Tile.requestContent]]. */\r\n public async requestContent(tile: Tile, isCanceled: () => boolean): Promise<TileRequest.Response> {\r\n return tile.requestContent(isCanceled);\r\n }\r\n\r\n /** Protected only for tests - do not override.\r\n * @internal\r\n */\r\n protected dispatch(request: TileRequest): void {\r\n ++this._statistics.totalDispatchedRequests;\r\n this._active.add(request);\r\n request.dispatch(() => {\r\n this.dropActiveRequest(request);\r\n }).catch((_) => {\r\n //\r\n });\r\n }\r\n\r\n /** Protected only for tests - do not override.\r\n * @internal\r\n */\r\n protected cancel(request: TileRequest): void {\r\n request.cancel();\r\n ++this._statistics.numCanceled;\r\n }\r\n\r\n /** Protected only for tests - do not override.\r\n * @internal\r\n */\r\n protected dropActiveRequest(request: TileRequest): void {\r\n assert(this._active.has(request) || request.isCanceled);\r\n this._active.delete(request);\r\n }\r\n}\r\n"]}
@@ -7,7 +7,7 @@ import { ElementAlignedBox3d, FrustumPlanes, ViewFlagOverrides } from "@itwin/co
7
7
  import { IModelConnection } from "../IModelConnection";
8
8
  import { RenderClipVolume } from "../render/RenderClipVolume";
9
9
  import { RenderMemory } from "../render/RenderMemory";
10
- import { Tile, TileDrawArgs, TileLoadPriority, TileTreeParams } from "./internal";
10
+ import { Tile, TileDrawArgs, TileGeometryCollector, TileLoadPriority, TileTreeParams } from "./internal";
11
11
  /** Describes the current state of a [[TileTree]]. TileTrees are loaded asynchronously and may be unloaded after a period of disuse.
12
12
  * @see [[TileTreeOwner]].
13
13
  * @public
@@ -112,5 +112,11 @@ export declare abstract class TileTree {
112
112
  * @beta
113
113
  */
114
114
  getEcefTransform(): Promise<Transform | undefined>;
115
+ /** Populate [[TileGeometryCollector.polyfaces]] with geometry obtained from this tile tree's tiles satisfying the collector's criteria.
116
+ * The base implementation does nothing.
117
+ * @see [[TileTreeReference.createGeometryTreeReference]] to attempt to create a TileTree that can collect geometry.
118
+ * @beta
119
+ */
120
+ collectTileGeometry(_collector: TileGeometryCollector): void;
115
121
  }
116
122
  //# sourceMappingURL=TileTree.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TileTree.d.ts","sourceRoot":"","sources":["../../../src/tile/TileTree.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAW,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACnF,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BAAgB;IACT,iBAAiB,CAAC,KAAK,EAAE,YAAY,CAAC,UAAU,GAAG,IAAI;IAI9D,2GAA2G;IACpG,UAAU,IAAI,MAAM;IAI3B,gBAAgB;IACT,0BAA0B,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,CAAC,EAAE,aAAa,GAAG,IAAI;IAI7H;;;;OAIG;IACU,gBAAgB,IAAI,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAkB/D;;;;OAIG;IACI,mBAAmB,CAAC,UAAU,EAAE,qBAAqB,GAAG,IAAI;CAEpE"}
@@ -82,7 +82,7 @@ export class TileTree {
82
82
  selectTiles(args) {
83
83
  this._lastSelected = BeTimePoint.now();
84
84
  const tiles = this._selectTiles(args);
85
- IModelApp.tileAdmin.addTilesForViewport(args.context.viewport, tiles, args.readyTiles);
85
+ IModelApp.tileAdmin.addTilesForUser(args.context.viewport, tiles, args.readyTiles);
86
86
  args.processSelectedTiles(tiles);
87
87
  return tiles;
88
88
  }
@@ -127,5 +127,12 @@ export class TileTree {
127
127
  dbToEcef = this.iModel.ecefLocation.getTransform();
128
128
  return dbToEcef.multiplyTransformTransform(this.iModelTransform);
129
129
  }
130
+ /** Populate [[TileGeometryCollector.polyfaces]] with geometry obtained from this tile tree's tiles satisfying the collector's criteria.
131
+ * The base implementation does nothing.
132
+ * @see [[TileTreeReference.createGeometryTreeReference]] to attempt to create a TileTree that can collect geometry.
133
+ * @beta
134
+ */
135
+ collectTileGeometry(_collector) {
136
+ }
130
137
  }
131
138
  //# sourceMappingURL=TileTree.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TileTree.js","sourceRoot":"","sources":["../../../src/tile/TileTree.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAc,WAAW,EAAE,OAAO,EAAc,MAAM,qBAAqB,CAAC;AAGnF,OAAO,EAAE,oCAAoC,EAAE,MA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AC;IACzC,CAAC;IAED,2GAA2G;IACpG,UAAU;QACf,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC;IAC9C,CAAC;IAED,gBAAgB;IACT,0BAA0B,CAAC,KAAc,EAAE,MAAgB,EAAE,QAAmB,EAAE,aAA6B;QACpH,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;IAC9E,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,gBAAgB;QAC3B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY;YAC3B,OAAO,SAAS,CAAC;QAEnB,IAAI,QAA+B,CAAC;QACpC,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;QACjE,MAAM,MAAM,GAAG,KAAK,CAAC,eAAe,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;QACjD,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YACrD,MAAM,QAAQ,GAAG,MAAM,oCAAoC,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACjF,QAAQ,GAAG,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,EAAE,CAAC;SAChC;QACD,IAAI,CAAC,QAAQ;YACX,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC;QAErD,OAAO,QAAQ,CAAC,0BAA0B,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IACnE,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport { BeDuration, BeTimePoint, dispose, Id64String } from \"@itwin/core-bentley\";\r\nimport { Matrix4d, Range3d, Transform } from \"@itwin/core-geometry\";\r\nimport { ElementAlignedBox3d, FrustumPlanes, ViewFlagOverrides } from \"@itwin/core-common\";\r\nimport { calculateEcefToDbTransformAtLocation } from \"../BackgroundMapGeometry\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { RenderClipVolume } from \"../render/RenderClipVolume\";\r\nimport { RenderMemory } from \"../render/RenderMemory\";\r\nimport { Tile, TileDrawArgs, TileLoadPriority, TileTreeParams } from \"./internal\";\r\n\r\n/** Describes the current state of a [[TileTree]]. TileTrees are loaded asynchronously and may be unloaded after a period of disuse.\r\n * @see [[TileTreeOwner]].\r\n * @public\r\n */\r\nexport enum TileTreeLoadStatus {\r\n /** No attempt to load the tile tree has yet been made. */\r\n NotLoaded,\r\n /** The tile tree is in the process of being loaded. */\r\n Loading,\r\n /** The tile tree has been successfully loaded. */\r\n Loaded,\r\n /** An attempt to load the tile tree failed. */\r\n NotFound,\r\n}\r\n\r\n/** A hierarchical level-of-detail tree of [3d Tiles](https://github.com/CesiumGS/3d-tiles) to be rendered in a [[Viewport]].\r\n * Tile trees originate from a variety of sources:\r\n * - Each [[GeometricModelState]] can supply its graphics as a tile tree;\r\n * - A [[DisplayStyleState]]'s map settings or reality models;\r\n * - [ViewAttachment]($backend)s in a [[SheetModelState]];\r\n * - [[TiledGraphicsProvider]]s associated with a viewport.\r\n *\r\n * The same TileTree can be displayed in any number of viewports using multiple [[TileTreeReference]]s.\r\n * A TileTree's lifetime is managed by a [[TileTreeOwner]].\r\n *\r\n * @note Some methods carry a warning that they should **not** be overridden by subclasses; typically a protected method exists that can be\r\n * overridden instead to customize the behavior. For example, [[selectTiles]] should not be overridden; instead, override the[[_selectTiles]] method\r\n * that it calls.\r\n * @public\r\n */\r\nexport abstract class TileTree {\r\n private _isDisposed = false;\r\n /** @internal */\r\n protected _lastSelected = BeTimePoint.now();\r\n /** @internal */\r\n protected _clipVolume?: RenderClipVolume;\r\n public readonly iModel: IModelConnection;\r\n /** Transform from this tile tree's coordinate space to the iModel's coordinate space. */\r\n public readonly iModelTransform: Transform;\r\n /** Uniquely identifies this tree among all other tile trees associated with the iModel. */\r\n public readonly id: string;\r\n /** A 64-bit identifier for this tile tree, unique within the context of its [[IModelConnection]].\r\n * For a tile tree associated with a [[GeometricModelState]], this is the Id of the model. Other types of tile trees\r\n * typically use a transient Id obtained from [[IModelConnection.transientIds]].\r\n */\r\n public readonly modelId: Id64String;\r\n /** The length of time after which tiles belonging to this tree are considered elegible for disposal if they are no longer in use. */\r\n public readonly expirationTime: BeDuration;\r\n /** @internal */\r\n public get loadPriority(): TileLoadPriority { return this._loadPriority; }\r\n private readonly _loadPriority: TileLoadPriority;\r\n /** Optional tight bounding box around the entire contents of all of this tree's tiles. */\r\n public readonly contentRange?: ElementAlignedBox3d;\r\n\r\n /** The lowest-resolution tile in this tree. */\r\n public abstract get rootTile(): Tile;\r\n /** True if this tile tree contains 3d graphics. */\r\n public abstract get is3d(): boolean;\r\n /** Returns the maximum depth of this tree, if any. */\r\n public abstract get maxDepth(): number | undefined;\r\n\r\n /** The overrides that should be applied to the view's [ViewFlags]($common) when this tile tree is drawn. Can be overridden by individual [[TileTreeReference]]s. */\r\n public abstract get viewFlagOverrides(): ViewFlagOverrides;\r\n\r\n /** True if this tile tree has no bounds - e.g., a tile tree representing a globe is unbounded. */\r\n public get isContentUnbounded(): boolean {\r\n return false;\r\n }\r\n\r\n /** Implement this method to select tiles of appropriate resolution. */\r\n protected abstract _selectTiles(args: TileDrawArgs): Tile[];\r\n\r\n /** Produce graphics of appropriate resolution to be drawn in a [[Viewport]]. */\r\n public abstract draw(args: TileDrawArgs): void;\r\n\r\n /** Discard tiles and/or tile contents, presumably based on a least-recently-used and/or least-likely-to-be-needed criterion. */\r\n public abstract prune(): void;\r\n\r\n /** True if this tile tree contains 2d graphics. */\r\n public get is2d(): boolean { return !this.is3d; }\r\n /** @internal */\r\n public get isPointCloud(): boolean { return false; }\r\n /** @internal */\r\n public get clipVolume(): RenderClipVolume | undefined { return this._clipVolume; }\r\n\r\n /** The volume of space occupied by this tile tree. */\r\n public get range(): ElementAlignedBox3d { return this.rootTile.range; }\r\n /** The most recent time at which tiles [[selectTiles]] was called. */\r\n public get lastSelectedTime(): BeTimePoint { return this._lastSelected; }\r\n /** True if a tile and its child tiles should not be drawn simultaneously.\r\n * Default: true.\r\n */\r\n public get parentsAndChildrenExclusive(): boolean { return true; }\r\n\r\n /** Constructor */\r\n protected constructor(params: TileTreeParams) {\r\n this._lastSelected = BeTimePoint.now();\r\n this.iModel = params.iModel;\r\n this.iModelTransform = params.location;\r\n this._clipVolume = params.clipVolume;\r\n this.modelId = params.modelId;\r\n this.id = params.id;\r\n this.contentRange = params.contentRange;\r\n\r\n const admin = IModelApp.tileAdmin;\r\n this._loadPriority = params.priority;\r\n this.expirationTime = params.expirationTime ?? admin.tileExpirationTime;\r\n }\r\n\r\n /** Selects tiles of appropriate resolution for some purpose like drawing to the screen, producing a shadow map, etc.\r\n * @note Do **not** override this method. Implement [[_selectTiles]].\r\n */\r\n public selectTiles(args: TileDrawArgs): Tile[] {\r\n this._lastSelected = BeTimePoint.now();\r\n const tiles = this._selectTiles(args);\r\n IModelApp.tileAdmin.addTilesForViewport(args.context.viewport, tiles, args.readyTiles);\r\n args.processSelectedTiles(tiles);\r\n return tiles;\r\n }\r\n\r\n /** True if [[dispose]] has been called on this tile tree. */\r\n public get isDisposed(): boolean { return this._isDisposed; }\r\n\r\n /** Dispose of this tree and any resources owned by it. This is typically invoked by a [[TileTreeOwner]]. */\r\n public dispose(): void {\r\n if (this.isDisposed)\r\n return;\r\n\r\n this._isDisposed = true;\r\n dispose(this.rootTile);\r\n }\r\n\r\n /** @internal */\r\n public collectStatistics(stats: RenderMemory.Statistics): void {\r\n this.rootTile.collectStatistics(stats);\r\n }\r\n\r\n /** Returns the number of [[Tile]]s currently in memory belonging to this tree, primarily for debugging. */\r\n public countTiles(): number {\r\n return 1 + this.rootTile.countDescendants();\r\n }\r\n\r\n /** @internal */\r\n public accumulateTransformedRange(range: Range3d, matrix: Matrix4d, location: Transform, frustumPlanes?: FrustumPlanes): void {\r\n this.rootTile.extendRangeForContent(range, matrix, location, frustumPlanes);\r\n }\r\n\r\n /**\r\n * Return the transform from the tile tree's coordinate space to [ECEF](https://en.wikipedia.org/wiki/ECEF) (Earth Centered Earth Fixed) coordinates.\r\n * If a geographic coordinate system is present then this transform will be calculated at the tile tree center.\r\n * @beta\r\n */\r\n public async getEcefTransform(): Promise<Transform | undefined> {\r\n if (!this.iModel.ecefLocation)\r\n return undefined;\r\n\r\n let dbToEcef: Transform | undefined;\r\n const range = this.contentRange ? this.contentRange : this.range;\r\n const center = range.localXYZToWorld(.5, .5, .5);\r\n if (center) {\r\n this.iModelTransform.multiplyPoint3d(center, center);\r\n const ecefToDb = await calculateEcefToDbTransformAtLocation(center, this.iModel);\r\n dbToEcef = ecefToDb?.inverse();\r\n }\r\n if (!dbToEcef)\r\n dbToEcef = this.iModel.ecefLocation.getTransform();\r\n\r\n return dbToEcef.multiplyTransformTransform(this.iModelTransform);\r\n }\r\n}\r\n\r\n"]}
1
+ {"version":3,"file":"TileTree.js","sourceRoot":"","sources":["../../../src/tile/TileTree.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAc,WAAW,EAAE,OAAO,EAAc,MAAM,qBAAqB,CAAC;AAGnF,OAAO,EAAE,oCAAoC,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAMzC;;;GAGG;AACH,MAAM,CAAN,IAAY,kBASX;AATD,WAAY,kBAAkB;IAC5B,0DAA0D;IAC1D,qEAAS,CAAA;IACT,uDAAuD;IACvD,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EAAE,aAA6B;QACpH,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;IAC9E,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,gBAAgB;QAC3B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY;YAC3B,OAAO,SAAS,CAAC;QAEnB,IAAI,QAA+B,CAAC;QACpC,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;QACjE,MAAM,MAAM,GAAG,KAAK,CAAC,eAAe,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;QACjD,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YACrD,MAAM,QAAQ,GAAG,MAAM,oCAAoC,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACjF,QAAQ,GAAG,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,EAAE,CAAC;SAChC;QACD,IAAI,CAAC,QAAQ;YACX,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC;QAErD,OAAO,QAAQ,CAAC,0BAA0B,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IACnE,CAAC;IAED;;;;OAIG;IACI,mBAAmB,CAAC,UAAiC;IAC5D,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport { BeDuration, BeTimePoint, dispose, Id64String } from \"@itwin/core-bentley\";\r\nimport { Matrix4d, Range3d, Transform } from \"@itwin/core-geometry\";\r\nimport { ElementAlignedBox3d, FrustumPlanes, ViewFlagOverrides } from \"@itwin/core-common\";\r\nimport { calculateEcefToDbTransformAtLocation } from \"../BackgroundMapGeometry\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { RenderClipVolume } from \"../render/RenderClipVolume\";\r\nimport { RenderMemory } from \"../render/RenderMemory\";\r\nimport { Tile, TileDrawArgs, TileGeometryCollector, TileLoadPriority, TileTreeParams } from \"./internal\";\r\n\r\n/** Describes the current state of a [[TileTree]]. TileTrees are loaded asynchronously and may be unloaded after a period of disuse.\r\n * @see [[TileTreeOwner]].\r\n * @public\r\n */\r\nexport enum TileTreeLoadStatus {\r\n /** No attempt to load the tile tree has yet been made. */\r\n NotLoaded,\r\n /** The tile tree is in the process of being loaded. */\r\n Loading,\r\n /** The tile tree has been successfully loaded. */\r\n Loaded,\r\n /** An attempt to load the tile tree failed. */\r\n NotFound,\r\n}\r\n\r\n/** A hierarchical level-of-detail tree of [3d Tiles](https://github.com/CesiumGS/3d-tiles) to be rendered in a [[Viewport]].\r\n * Tile trees originate from a variety of sources:\r\n * - Each [[GeometricModelState]] can supply its graphics as a tile tree;\r\n * - A [[DisplayStyleState]]'s map settings or reality models;\r\n * - [ViewAttachment]($backend)s in a [[SheetModelState]];\r\n * - [[TiledGraphicsProvider]]s associated with a viewport.\r\n *\r\n * The same TileTree can be displayed in any number of viewports using multiple [[TileTreeReference]]s.\r\n * A TileTree's lifetime is managed by a [[TileTreeOwner]].\r\n *\r\n * @note Some methods carry a warning that they should **not** be overridden by subclasses; typically a protected method exists that can be\r\n * overridden instead to customize the behavior. For example, [[selectTiles]] should not be overridden; instead, override the[[_selectTiles]] method\r\n * that it calls.\r\n * @public\r\n */\r\nexport abstract class TileTree {\r\n private _isDisposed = false;\r\n /** @internal */\r\n protected _lastSelected = BeTimePoint.now();\r\n /** @internal */\r\n protected _clipVolume?: RenderClipVolume;\r\n public readonly iModel: IModelConnection;\r\n /** Transform from this tile tree's coordinate space to the iModel's coordinate space. */\r\n public readonly iModelTransform: Transform;\r\n /** Uniquely identifies this tree among all other tile trees associated with the iModel. */\r\n public readonly id: string;\r\n /** A 64-bit identifier for this tile tree, unique within the context of its [[IModelConnection]].\r\n * For a tile tree associated with a [[GeometricModelState]], this is the Id of the model. Other types of tile trees\r\n * typically use a transient Id obtained from [[IModelConnection.transientIds]].\r\n */\r\n public readonly modelId: Id64String;\r\n /** The length of time after which tiles belonging to this tree are considered elegible for disposal if they are no longer in use. */\r\n public readonly expirationTime: BeDuration;\r\n /** @internal */\r\n public get loadPriority(): TileLoadPriority { return this._loadPriority; }\r\n private readonly _loadPriority: TileLoadPriority;\r\n /** Optional tight bounding box around the entire contents of all of this tree's tiles. */\r\n public readonly contentRange?: ElementAlignedBox3d;\r\n\r\n /** The lowest-resolution tile in this tree. */\r\n public abstract get rootTile(): Tile;\r\n /** True if this tile tree contains 3d graphics. */\r\n public abstract get is3d(): boolean;\r\n /** Returns the maximum depth of this tree, if any. */\r\n public abstract get maxDepth(): number | undefined;\r\n\r\n /** The overrides that should be applied to the view's [ViewFlags]($common) when this tile tree is drawn. Can be overridden by individual [[TileTreeReference]]s. */\r\n public abstract get viewFlagOverrides(): ViewFlagOverrides;\r\n\r\n /** True if this tile tree has no bounds - e.g., a tile tree representing a globe is unbounded. */\r\n public get isContentUnbounded(): boolean {\r\n return false;\r\n }\r\n\r\n /** Implement this method to select tiles of appropriate resolution. */\r\n protected abstract _selectTiles(args: TileDrawArgs): Tile[];\r\n\r\n /** Produce graphics of appropriate resolution to be drawn in a [[Viewport]]. */\r\n public abstract draw(args: TileDrawArgs): void;\r\n\r\n /** Discard tiles and/or tile contents, presumably based on a least-recently-used and/or least-likely-to-be-needed criterion. */\r\n public abstract prune(): void;\r\n\r\n /** True if this tile tree contains 2d graphics. */\r\n public get is2d(): boolean { return !this.is3d; }\r\n /** @internal */\r\n public get isPointCloud(): boolean { return false; }\r\n /** @internal */\r\n public get clipVolume(): RenderClipVolume | undefined { return this._clipVolume; }\r\n\r\n /** The volume of space occupied by this tile tree. */\r\n public get range(): ElementAlignedBox3d { return this.rootTile.range; }\r\n /** The most recent time at which tiles [[selectTiles]] was called. */\r\n public get lastSelectedTime(): BeTimePoint { return this._lastSelected; }\r\n /** True if a tile and its child tiles should not be drawn simultaneously.\r\n * Default: true.\r\n */\r\n public get parentsAndChildrenExclusive(): boolean { return true; }\r\n\r\n /** Constructor */\r\n protected constructor(params: TileTreeParams) {\r\n this._lastSelected = BeTimePoint.now();\r\n this.iModel = params.iModel;\r\n this.iModelTransform = params.location;\r\n this._clipVolume = params.clipVolume;\r\n this.modelId = params.modelId;\r\n this.id = params.id;\r\n this.contentRange = params.contentRange;\r\n\r\n const admin = IModelApp.tileAdmin;\r\n this._loadPriority = params.priority;\r\n this.expirationTime = params.expirationTime ?? admin.tileExpirationTime;\r\n }\r\n\r\n /** Selects tiles of appropriate resolution for some purpose like drawing to the screen, producing a shadow map, etc.\r\n * @note Do **not** override this method. Implement [[_selectTiles]].\r\n */\r\n public selectTiles(args: TileDrawArgs): Tile[] {\r\n this._lastSelected = BeTimePoint.now();\r\n const tiles = this._selectTiles(args);\r\n IModelApp.tileAdmin.addTilesForUser(args.context.viewport, tiles, args.readyTiles);\r\n args.processSelectedTiles(tiles);\r\n return tiles;\r\n }\r\n\r\n /** True if [[dispose]] has been called on this tile tree. */\r\n public get isDisposed(): boolean { return this._isDisposed; }\r\n\r\n /** Dispose of this tree and any resources owned by it. This is typically invoked by a [[TileTreeOwner]]. */\r\n public dispose(): void {\r\n if (this.isDisposed)\r\n return;\r\n\r\n this._isDisposed = true;\r\n dispose(this.rootTile);\r\n }\r\n\r\n /** @internal */\r\n public collectStatistics(stats: RenderMemory.Statistics): void {\r\n this.rootTile.collectStatistics(stats);\r\n }\r\n\r\n /** Returns the number of [[Tile]]s currently in memory belonging to this tree, primarily for debugging. */\r\n public countTiles(): number {\r\n return 1 + this.rootTile.countDescendants();\r\n }\r\n\r\n /** @internal */\r\n public accumulateTransformedRange(range: Range3d, matrix: Matrix4d, location: Transform, frustumPlanes?: FrustumPlanes): void {\r\n this.rootTile.extendRangeForContent(range, matrix, location, frustumPlanes);\r\n }\r\n\r\n /**\r\n * Return the transform from the tile tree's coordinate space to [ECEF](https://en.wikipedia.org/wiki/ECEF) (Earth Centered Earth Fixed) coordinates.\r\n * If a geographic coordinate system is present then this transform will be calculated at the tile tree center.\r\n * @beta\r\n */\r\n public async getEcefTransform(): Promise<Transform | undefined> {\r\n if (!this.iModel.ecefLocation)\r\n return undefined;\r\n\r\n let dbToEcef: Transform | undefined;\r\n const range = this.contentRange ? this.contentRange : this.range;\r\n const center = range.localXYZToWorld(.5, .5, .5);\r\n if (center) {\r\n this.iModelTransform.multiplyPoint3d(center, center);\r\n const ecefToDb = await calculateEcefToDbTransformAtLocation(center, this.iModel);\r\n dbToEcef = ecefToDb?.inverse();\r\n }\r\n if (!dbToEcef)\r\n dbToEcef = this.iModel.ecefLocation.getTransform();\r\n\r\n return dbToEcef.multiplyTransformTransform(this.iModelTransform);\r\n }\r\n\r\n /** Populate [[TileGeometryCollector.polyfaces]] with geometry obtained from this tile tree's tiles satisfying the collector's criteria.\r\n * The base implementation does nothing.\r\n * @see [[TileTreeReference.createGeometryTreeReference]] to attempt to create a TileTree that can collect geometry.\r\n * @beta\r\n */\r\n public collectTileGeometry(_collector: TileGeometryCollector): void {\r\n }\r\n}\r\n\r\n"]}
@@ -9,7 +9,7 @@ import { RenderClipVolume } from "../render/RenderClipVolume";
9
9
  import { RenderMemory } from "../render/RenderMemory";
10
10
  import { DecorateContext, SceneContext } from "../ViewContext";
11
11
  import { ScreenViewport } from "../Viewport";
12
- import { DisclosedTileTreeSet, TileDrawArgs, TileTree, TileTreeOwner } from "./internal";
12
+ import { DisclosedTileTreeSet, GeometryTileTreeReference, TileDrawArgs, TileGeometryCollector, TileTree, TileTreeOwner } from "./internal";
13
13
  /** Describes the type of graphics produced by a [[TileTreeReference]].
14
14
  * @public
15
15
  */
@@ -22,7 +22,7 @@ export declare enum TileGraphicType {
22
22
  Overlay = 2
23
23
  }
24
24
  /** A reference to a [[TileTree]] suitable for drawing within a [[Viewport]]. The reference does not *own* its tile tree - it merely refers to it by
25
- * way of the tree [[TileTreeOwner]].
25
+ * way of the tree's [[TileTreeOwner]].
26
26
  * The specific [[TileTree]] referenced by this object may change based on the current state of the Viewport in which it is drawn - for example,
27
27
  * as a result of changing the RenderMode, or animation settings, or classification settings, etc.
28
28
  * A reference to a TileTree is typically associated with a [[ViewState]], a [[DisplayStyleState]], or a [[Viewport]].
@@ -106,5 +106,26 @@ export declare abstract class TileTreeReference {
106
106
  get planarclipMaskPriority(): number;
107
107
  /** Add attribution logo cards for the tile tree source logo cards to the viewport's logo div. */
108
108
  addLogoCards(_cards: HTMLTableElement, _vp: ScreenViewport): void;
109
+ /** Create a tile tree reference equivalent to this one that also supplies an implementation of [[GeometryTileTreeReference.collectTileGeometry]].
110
+ * Return `undefined` if geometry collection is not supported.
111
+ * @see [[createGeometryTreeReference]].
112
+ * @beta
113
+ */
114
+ protected _createGeometryTreeReference(): GeometryTileTreeReference | undefined;
115
+ /** If defined, supplies the implementation of [[GeometryTileTreeReference.collectTileGeometry]].
116
+ * @beta
117
+ */
118
+ collectTileGeometry?: (collector: TileGeometryCollector) => void;
119
+ /** A function that can be assigned to [[collectTileGeometry]] to enable geometry collection for references to tile trees that support geometry collection.
120
+ * @beta
121
+ */
122
+ protected _collectTileGeometry(collector: TileGeometryCollector): void;
123
+ /** Obtain a tile tree reference equivalent to this one that also supplies an implementation of [[GeometryTileTreeReference.collectTileGeometry]], or
124
+ * undefined if geometry collection is not supported.
125
+ * Currently, only terrain and reality model tiles support geometry collection.
126
+ * @note Do not override this method - override [[_createGeometryTreeReference]] instead.
127
+ * @beta
128
+ */
129
+ createGeometryTreeReference(): GeometryTileTreeReference | undefined;
109
130
  }
110
131
  //# sourceMappingURL=TileTreeReference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,CAAC,qBAAqB,CAAC,KAAK,EAAE,QAAQ,GAAG,gBAAgB,CAAC,SAAS,GAAG,SAAS;IAIxF,4EAA4E;IAC5E,SAAS,CAAC,qBAAqB,CAAC,KAAK,EAAE,QAAQ,GAAG,yBAAyB,GAAG,SAAS;IAIvF,yEAAyE;IACzE,SAAS,CAAC,qBAAqB,CAAC,KAAK,EAAE,QAAQ,GAAG,UAAU,CAAC,QAAQ,GAAG,SAAS;IAO1E,0BAA0B,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,CAAC,EAAE,aAAa;IASjG,gBAAgB;IACT,gBAAgB,CAAC,eAAe,EAAE,OAAO,GAAG,IAAI;IAEvD,6GAA6G;IAC7G,IAAW,YAAY,IAAI,OAAO,CAEjC;IAED,iKAAiK;IACjK,IAAW,QAAQ,IAAI,OAAO,CAAkB;IAEhD;;;OAGG;IACH,IAAW,sBAAsB,IAAI,MAAM,CAA+C;IAE1F,iGAAiG;IAC1F,YAAY,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,EAAE,cAAc,GAAG,IAAI;IAExE;;;;OAIG;IACH,SAAS,CAAC,4BAA4B,IAAI,yBAAyB,GAAG,SAAS;IAI/E;;OAEG;IACI,mBAAmB,CAAC,EAAE,CAAC,SAAS,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAExE;;OAEG;IACH,SAAS,CAAC,oBAAoB,CAAC,SAAS,EAAE,qBAAqB,GAAG,IAAI;IAatE;;;;;OAKG;IACI,2BAA2B,IAAI,yBAAyB,GAAG,SAAS;CAQ5E"}
@@ -5,10 +5,10 @@
5
5
  /** @packageDocumentation
6
6
  * @module Tiles
7
7
  */
8
- import { BeTimePoint } from "@itwin/core-bentley";
8
+ import { assert, BeTimePoint } from "@itwin/core-bentley";
9
9
  import { Range3d } from "@itwin/core-geometry";
10
10
  import { PlanarClipMaskPriority } from "@itwin/core-common";
11
- import { TileDrawArgs, TileTreeLoadStatus } from "./internal";
11
+ import { TileDrawArgs, TileTreeLoadStatus, } from "./internal";
12
12
  /** Describes the type of graphics produced by a [[TileTreeReference]].
13
13
  * @public
14
14
  */
@@ -22,7 +22,7 @@ export var TileGraphicType;
22
22
  TileGraphicType[TileGraphicType["Overlay"] = 2] = "Overlay";
23
23
  })(TileGraphicType || (TileGraphicType = {}));
24
24
  /** A reference to a [[TileTree]] suitable for drawing within a [[Viewport]]. The reference does not *own* its tile tree - it merely refers to it by
25
- * way of the tree [[TileTreeOwner]].
25
+ * way of the tree's [[TileTreeOwner]].
26
26
  * The specific [[TileTree]] referenced by this object may change based on the current state of the Viewport in which it is drawn - for example,
27
27
  * as a result of changing the RenderMode, or animation settings, or classification settings, etc.
28
28
  * A reference to a TileTree is typically associated with a [[ViewState]], a [[DisplayStyleState]], or a [[Viewport]].
@@ -185,5 +185,41 @@ export class TileTreeReference /* implements RenderMemory.Consumer */ {
185
185
  get planarclipMaskPriority() { return PlanarClipMaskPriority.DesignModel; }
186
186
  /** Add attribution logo cards for the tile tree source logo cards to the viewport's logo div. */
187
187
  addLogoCards(_cards, _vp) { }
188
+ /** Create a tile tree reference equivalent to this one that also supplies an implementation of [[GeometryTileTreeReference.collectTileGeometry]].
189
+ * Return `undefined` if geometry collection is not supported.
190
+ * @see [[createGeometryTreeReference]].
191
+ * @beta
192
+ */
193
+ _createGeometryTreeReference() {
194
+ return undefined;
195
+ }
196
+ /** A function that can be assigned to [[collectTileGeometry]] to enable geometry collection for references to tile trees that support geometry collection.
197
+ * @beta
198
+ */
199
+ _collectTileGeometry(collector) {
200
+ const tree = this.treeOwner.load();
201
+ switch (this.treeOwner.loadStatus) {
202
+ case TileTreeLoadStatus.Loaded:
203
+ assert(undefined !== tree);
204
+ tree.collectTileGeometry(collector);
205
+ break;
206
+ case TileTreeLoadStatus.Loading:
207
+ collector.markLoading();
208
+ break;
209
+ }
210
+ }
211
+ /** Obtain a tile tree reference equivalent to this one that also supplies an implementation of [[GeometryTileTreeReference.collectTileGeometry]], or
212
+ * undefined if geometry collection is not supported.
213
+ * Currently, only terrain and reality model tiles support geometry collection.
214
+ * @note Do not override this method - override [[_createGeometryTreeReference]] instead.
215
+ * @beta
216
+ */
217
+ createGeometryTreeReference() {
218
+ if (this.collectTileGeometry) {
219
+ // Unclear why compiler doesn't detect that `this` satisfies the GeometryTileTreeReference interface...it must be looking only at the types, not this particular instance.
220
+ return this;
221
+ }
222
+ return this._createGeometryTreeReference();
223
+ }
188
224
  }
189
225
  //# sourceMappingURL=TileTreeReference.js.map