@itwin/core-frontend 4.1.0-dev.35 → 4.1.0-dev.40

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 (851) hide show
  1. package/lib/cjs/AccuDraw.js.map +1 -1
  2. package/lib/cjs/AccuSnap.js.map +1 -1
  3. package/lib/cjs/ApproximateTerrainHeights.js.map +1 -1
  4. package/lib/cjs/ApproximateTerrainHeightsProps.js.map +1 -1
  5. package/lib/cjs/AuxCoordSys.js.map +1 -1
  6. package/lib/cjs/BackgroundMapGeometry.js.map +1 -1
  7. package/lib/cjs/BingLocation.js.map +1 -1
  8. package/lib/cjs/BriefcaseConnection.js.map +1 -1
  9. package/lib/cjs/BriefcaseTxns.js.map +1 -1
  10. package/lib/cjs/CategorySelectorState.js.map +1 -1
  11. package/lib/cjs/ChangeFlags.js.map +1 -1
  12. package/lib/cjs/CheckpointConnection.js.map +1 -1
  13. package/lib/cjs/CoordSystem.js.map +1 -1
  14. package/lib/cjs/DecorationsCache.js.map +1 -1
  15. package/lib/cjs/DevTools.js.map +1 -1
  16. package/lib/cjs/DisplayStyleState.js.map +1 -1
  17. package/lib/cjs/DrawingViewState.js +5 -5
  18. package/lib/cjs/DrawingViewState.js.map +1 -1
  19. package/lib/cjs/ElementLocateManager.js.map +1 -1
  20. package/lib/cjs/EmphasizeElements.js.map +1 -1
  21. package/lib/cjs/EntityState.js.map +1 -1
  22. package/lib/cjs/EnvironmentDecorations.js.map +1 -1
  23. package/lib/cjs/FeatureOverrideProvider.js.map +1 -1
  24. package/lib/cjs/FlashSettings.js.map +1 -1
  25. package/lib/cjs/FrontendHubAccess.js.map +1 -1
  26. package/lib/cjs/Frustum2d.js.map +1 -1
  27. package/lib/cjs/FrustumAnimator.js.map +1 -1
  28. package/lib/cjs/FuzzySearch.js.map +1 -1
  29. package/lib/cjs/GeoServices.js.map +1 -1
  30. package/lib/cjs/GlobeAnimator.js.map +1 -1
  31. package/lib/cjs/GraphicalEditingScope.js.map +1 -1
  32. package/lib/cjs/HitDetail.js.map +1 -1
  33. package/lib/cjs/IModelApp.js.map +1 -1
  34. package/lib/cjs/IModelConnection.js +23 -23
  35. package/lib/cjs/IModelConnection.js.map +1 -1
  36. package/lib/cjs/IModelRoutingContext.js.map +1 -1
  37. package/lib/cjs/IModeljs-css.js +133 -133
  38. package/lib/cjs/IModeljs-css.js.map +1 -1
  39. package/lib/cjs/IpcApp.js.map +1 -1
  40. package/lib/cjs/LinePlaneIntersect.js.map +1 -1
  41. package/lib/cjs/LocalhostIpcApp.js.map +1 -1
  42. package/lib/cjs/MarginPercent.js.map +1 -1
  43. package/lib/cjs/Marker.js.map +1 -1
  44. package/lib/cjs/ModelSelectorState.js.map +1 -1
  45. package/lib/cjs/NativeApp.js.map +1 -1
  46. package/lib/cjs/NativeAppLogger.js.map +1 -1
  47. package/lib/cjs/NoRenderApp.js.map +1 -1
  48. package/lib/cjs/NotificationManager.js.map +1 -1
  49. package/lib/cjs/PerModelCategoryVisibility.js.map +1 -1
  50. package/lib/cjs/PlanarClipMaskState.js.map +1 -1
  51. package/lib/cjs/RealityDataSource.js.map +1 -1
  52. package/lib/cjs/RealityDataSourceCesiumIonAssetImpl.js.map +1 -1
  53. package/lib/cjs/RealityDataSourceContextShareImpl.js.map +1 -1
  54. package/lib/cjs/RealityDataSourceTilesetUrlImpl.js.map +1 -1
  55. package/lib/cjs/SelectionSet.js.map +1 -1
  56. package/lib/cjs/SheetViewState.js.map +1 -1
  57. package/lib/cjs/SpatialViewState.js.map +1 -1
  58. package/lib/cjs/Sprites.js.map +1 -1
  59. package/lib/cjs/StandardView.js.map +1 -1
  60. package/lib/cjs/SubCategoriesCache.js.map +1 -1
  61. package/lib/cjs/TentativePoint.js.map +1 -1
  62. package/lib/cjs/Tiles.js.map +1 -1
  63. package/lib/cjs/UserPreferences.js.map +1 -1
  64. package/lib/cjs/ViewAnimation.js.map +1 -1
  65. package/lib/cjs/ViewContext.js.map +1 -1
  66. package/lib/cjs/ViewCreator2d.js.map +1 -1
  67. package/lib/cjs/ViewCreator3d.js.map +1 -1
  68. package/lib/cjs/ViewGlobalLocation.js.map +1 -1
  69. package/lib/cjs/ViewManager.js.map +1 -1
  70. package/lib/cjs/ViewPose.js.map +1 -1
  71. package/lib/cjs/ViewState.js.map +1 -1
  72. package/lib/cjs/ViewStatus.js.map +1 -1
  73. package/lib/cjs/ViewingSpace.js.map +1 -1
  74. package/lib/cjs/Viewport.js.map +1 -1
  75. package/lib/cjs/ViewportSync.js.map +1 -1
  76. package/lib/cjs/common/FrontendLoggerCategory.js.map +1 -1
  77. package/lib/cjs/common/ImageUtil.js.map +1 -1
  78. package/lib/cjs/common/ViewRect.js.map +1 -1
  79. package/lib/cjs/common/WorkerProxy.js.map +1 -1
  80. package/lib/cjs/common/gltf/GltfModel.js.map +1 -1
  81. package/lib/cjs/common/gltf/GltfParser.js.map +1 -1
  82. package/lib/cjs/common/gltf/GltfSchema.js.map +1 -1
  83. package/lib/cjs/common/imdl/CompactEdges.js.map +1 -1
  84. package/lib/cjs/common/imdl/ImdlModel.js.map +1 -1
  85. package/lib/cjs/common/imdl/ImdlSchema.js.map +1 -1
  86. package/lib/cjs/common/imdl/ParseImdlDocument.js.map +1 -1
  87. package/lib/cjs/common/render/AnimationNodeId.js.map +1 -1
  88. package/lib/cjs/common/render/MaterialParams.js.map +1 -1
  89. package/lib/cjs/common/render/TextureParams.js.map +1 -1
  90. package/lib/cjs/common/render/primitives/AuxChannelTable.js.map +1 -1
  91. package/lib/cjs/common/render/primitives/DisplayParams.js.map +1 -1
  92. package/lib/cjs/common/render/primitives/EdgeParams.js.map +1 -1
  93. package/lib/cjs/common/render/primitives/MeshParams.js.map +1 -1
  94. package/lib/cjs/common/render/primitives/MeshPrimitive.js.map +1 -1
  95. package/lib/cjs/common/render/primitives/PointStringParams.js.map +1 -1
  96. package/lib/cjs/common/render/primitives/PolylineParams.js.map +1 -1
  97. package/lib/cjs/common/render/primitives/SurfaceParams.js.map +1 -1
  98. package/lib/cjs/common/render/primitives/VertexIndices.js.map +1 -1
  99. package/lib/cjs/common/render/primitives/VertexTable.js.map +1 -1
  100. package/lib/cjs/common/render/primitives/VertexTableSplitter.js.map +1 -1
  101. package/lib/cjs/core-frontend.js.map +1 -1
  102. package/lib/cjs/extension/Extension.js.map +1 -1
  103. package/lib/cjs/extension/ExtensionAdmin.js.map +1 -1
  104. package/lib/cjs/extension/ExtensionHost.js.map +1 -1
  105. package/lib/cjs/extension/ExtensionRuntime.js.map +1 -1
  106. package/lib/cjs/extension/providers/ExtensionLoadScript.js.map +1 -1
  107. package/lib/cjs/extension/providers/LocalExtensionProvider.js.map +1 -1
  108. package/lib/cjs/extension/providers/RemoteExtensionProvider.js.map +1 -1
  109. package/lib/cjs/properties/AngleDescription.js.map +1 -1
  110. package/lib/cjs/properties/FormattedQuantityDescription.js.map +1 -1
  111. package/lib/cjs/properties/LengthDescription.js.map +1 -1
  112. package/lib/cjs/public/scripts/checkbrowser.js +24 -24
  113. package/lib/cjs/quantity-formatting/BaseUnitFormattingSettingsProvider.js.map +1 -1
  114. package/lib/cjs/quantity-formatting/BasicUnitsProvider.js.map +1 -1
  115. package/lib/cjs/quantity-formatting/LocalUnitFormatProvider.js.map +1 -1
  116. package/lib/cjs/quantity-formatting/QuantityFormatter.js.map +1 -1
  117. package/lib/cjs/quantity-formatting/QuantityTypesEditorSpecs.js.map +1 -1
  118. package/lib/cjs/quantity-formatting/UnitsData.js.map +1 -1
  119. package/lib/cjs/render/CanvasDecoration.js.map +1 -1
  120. package/lib/cjs/render/CreateRenderMaterialArgs.js.map +1 -1
  121. package/lib/cjs/render/CreateTextureArgs.js.map +1 -1
  122. package/lib/cjs/render/Decorations.js.map +1 -1
  123. package/lib/cjs/render/FeatureSymbology.js.map +1 -1
  124. package/lib/cjs/render/FrameStats.js.map +1 -1
  125. package/lib/cjs/render/GraphicBranch.js.map +1 -1
  126. package/lib/cjs/render/GraphicBuilder.js.map +1 -1
  127. package/lib/cjs/render/GraphicPrimitive.js.map +1 -1
  128. package/lib/cjs/render/InstancedGraphicParams.js.map +1 -1
  129. package/lib/cjs/render/MockRender.js.map +1 -1
  130. package/lib/cjs/render/ParticleCollectionBuilder.js.map +1 -1
  131. package/lib/cjs/render/Pixel.js.map +1 -1
  132. package/lib/cjs/render/RealityMeshGraphicParams.js.map +1 -1
  133. package/lib/cjs/render/RealityMeshParams.js.map +1 -1
  134. package/lib/cjs/render/RenderClipVolume.js.map +1 -1
  135. package/lib/cjs/render/RenderGraphic.js.map +1 -1
  136. package/lib/cjs/render/RenderMemory.js.map +1 -1
  137. package/lib/cjs/render/RenderPlan.js.map +1 -1
  138. package/lib/cjs/render/RenderPlanarClassifier.js.map +1 -1
  139. package/lib/cjs/render/RenderSystem.js.map +1 -1
  140. package/lib/cjs/render/RenderTarget.js.map +1 -1
  141. package/lib/cjs/render/Scene.js.map +1 -1
  142. package/lib/cjs/render/ScreenSpaceEffectBuilder.js.map +1 -1
  143. package/lib/cjs/render/UpsampleRealityMeshParams.js.map +1 -1
  144. package/lib/cjs/render/VisibleFeature.js.map +1 -1
  145. package/lib/cjs/render/primitives/ColorMap.js.map +1 -1
  146. package/lib/cjs/render/primitives/EdgeParams.js.map +1 -1
  147. package/lib/cjs/render/primitives/PointCloudPrimitive.js.map +1 -1
  148. package/lib/cjs/render/primitives/PointStringParams.js.map +1 -1
  149. package/lib/cjs/render/primitives/Polyface.js.map +1 -1
  150. package/lib/cjs/render/primitives/PolylineParams.js.map +1 -1
  151. package/lib/cjs/render/primitives/Primitives.js.map +1 -1
  152. package/lib/cjs/render/primitives/Strokes.js.map +1 -1
  153. package/lib/cjs/render/primitives/VertexKey.js.map +1 -1
  154. package/lib/cjs/render/primitives/VertexTableBuilder.js.map +1 -1
  155. package/lib/cjs/render/primitives/geometry/GeometryAccumulator.js.map +1 -1
  156. package/lib/cjs/render/primitives/geometry/GeometryList.js.map +1 -1
  157. package/lib/cjs/render/primitives/geometry/GeometryListBuilder.js.map +1 -1
  158. package/lib/cjs/render/primitives/geometry/GeometryPrimitives.js.map +1 -1
  159. package/lib/cjs/render/primitives/mesh/MeshBuilder.js.map +1 -1
  160. package/lib/cjs/render/primitives/mesh/MeshBuilderMap.js.map +1 -1
  161. package/lib/cjs/render/primitives/mesh/MeshPrimitives.js.map +1 -1
  162. package/lib/cjs/render/webgl/AtmosphereUniforms.js.map +1 -1
  163. package/lib/cjs/render/webgl/AttributeBuffers.js.map +1 -1
  164. package/lib/cjs/render/webgl/AttributeMap.js.map +1 -1
  165. package/lib/cjs/render/webgl/BackgroundMapDrape.js.map +1 -1
  166. package/lib/cjs/render/webgl/BatchState.js.map +1 -1
  167. package/lib/cjs/render/webgl/BatchUniforms.js.map +1 -1
  168. package/lib/cjs/render/webgl/BranchStack.js.map +1 -1
  169. package/lib/cjs/render/webgl/BranchState.js.map +1 -1
  170. package/lib/cjs/render/webgl/BranchUniforms.js.map +1 -1
  171. package/lib/cjs/render/webgl/CachedGeometry.js.map +1 -1
  172. package/lib/cjs/render/webgl/ClipStack.js.map +1 -1
  173. package/lib/cjs/render/webgl/ClipVolume.js.map +1 -1
  174. package/lib/cjs/render/webgl/ClippingProgram.js.map +1 -1
  175. package/lib/cjs/render/webgl/ColorInfo.js.map +1 -1
  176. package/lib/cjs/render/webgl/Diagnostics.js.map +1 -1
  177. package/lib/cjs/render/webgl/Disposable.js.map +1 -1
  178. package/lib/cjs/render/webgl/DrawCommand.js.map +1 -1
  179. package/lib/cjs/render/webgl/EDL.js.map +1 -1
  180. package/lib/cjs/render/webgl/EdgeGeometry.js.map +1 -1
  181. package/lib/cjs/render/webgl/EdgeSettings.js.map +1 -1
  182. package/lib/cjs/render/webgl/FeatureOverrides.js.map +1 -1
  183. package/lib/cjs/render/webgl/FloatRGBA.js.map +1 -1
  184. package/lib/cjs/render/webgl/FrameBuffer.js.map +1 -1
  185. package/lib/cjs/render/webgl/FrustumUniforms.js.map +1 -1
  186. package/lib/cjs/render/webgl/GL.js.map +1 -1
  187. package/lib/cjs/render/webgl/GLTimer.js.map +1 -1
  188. package/lib/cjs/render/webgl/Graphic.js.map +1 -1
  189. package/lib/cjs/render/webgl/HiliteUniforms.js.map +1 -1
  190. package/lib/cjs/render/webgl/IModelFrameLifecycle.js.map +1 -1
  191. package/lib/cjs/render/webgl/IndexedEdgeGeometry.js.map +1 -1
  192. package/lib/cjs/render/webgl/InstancedGeometry.js.map +1 -1
  193. package/lib/cjs/render/webgl/Layer.js.map +1 -1
  194. package/lib/cjs/render/webgl/LayerCommands.js.map +1 -1
  195. package/lib/cjs/render/webgl/LightingUniforms.js.map +1 -1
  196. package/lib/cjs/render/webgl/LineCode.js.map +1 -1
  197. package/lib/cjs/render/webgl/Material.js.map +1 -1
  198. package/lib/cjs/render/webgl/Matrix.js.map +1 -1
  199. package/lib/cjs/render/webgl/Mesh.js.map +1 -1
  200. package/lib/cjs/render/webgl/MeshData.js.map +1 -1
  201. package/lib/cjs/render/webgl/MeshGeometry.js.map +1 -1
  202. package/lib/cjs/render/webgl/PerformanceMetrics.js.map +1 -1
  203. package/lib/cjs/render/webgl/PlanarClassifier.js.map +1 -1
  204. package/lib/cjs/render/webgl/PlanarGrid.js.map +1 -1
  205. package/lib/cjs/render/webgl/PlanarTextureProjection.js.map +1 -1
  206. package/lib/cjs/render/webgl/PointCloud.js.map +1 -1
  207. package/lib/cjs/render/webgl/PointString.js.map +1 -1
  208. package/lib/cjs/render/webgl/Polyline.js.map +1 -1
  209. package/lib/cjs/render/webgl/Primitive.js.map +1 -1
  210. package/lib/cjs/render/webgl/RealityMesh.js.map +1 -1
  211. package/lib/cjs/render/webgl/RealityModelUniforms.js.map +1 -1
  212. package/lib/cjs/render/webgl/RenderBuffer.js.map +1 -1
  213. package/lib/cjs/render/webgl/RenderCommands.js.map +1 -1
  214. package/lib/cjs/render/webgl/RenderFlags.js.map +1 -1
  215. package/lib/cjs/render/webgl/RenderState.js.map +1 -1
  216. package/lib/cjs/render/webgl/SceneCompositor.js.map +1 -1
  217. package/lib/cjs/render/webgl/ScratchDrawParams.js.map +1 -1
  218. package/lib/cjs/render/webgl/ScreenSpaceEffect.js.map +1 -1
  219. package/lib/cjs/render/webgl/ShaderBuilder.js.map +1 -1
  220. package/lib/cjs/render/webgl/ShaderProgram.js.map +1 -1
  221. package/lib/cjs/render/webgl/ShadowUniforms.js.map +1 -1
  222. package/lib/cjs/render/webgl/SolarShadowMap.js.map +1 -1
  223. package/lib/cjs/render/webgl/StyleUniforms.js.map +1 -1
  224. package/lib/cjs/render/webgl/SurfaceGeometry.js.map +1 -1
  225. package/lib/cjs/render/webgl/Sync.js.map +1 -1
  226. package/lib/cjs/render/webgl/System.js.map +1 -1
  227. package/lib/cjs/render/webgl/Target.js.map +1 -1
  228. package/lib/cjs/render/webgl/TargetGraphics.js.map +1 -1
  229. package/lib/cjs/render/webgl/TargetUniforms.js.map +1 -1
  230. package/lib/cjs/render/webgl/Technique.js.map +1 -1
  231. package/lib/cjs/render/webgl/TechniqueFlags.js.map +1 -1
  232. package/lib/cjs/render/webgl/TechniqueId.js.map +1 -1
  233. package/lib/cjs/render/webgl/Texture.js.map +1 -1
  234. package/lib/cjs/render/webgl/TextureDrape.js.map +1 -1
  235. package/lib/cjs/render/webgl/ThematicSensors.js.map +1 -1
  236. package/lib/cjs/render/webgl/ThematicUniforms.js.map +1 -1
  237. package/lib/cjs/render/webgl/UniformHandle.js.map +1 -1
  238. package/lib/cjs/render/webgl/VertexLUT.js.map +1 -1
  239. package/lib/cjs/render/webgl/ViewRectUniforms.js.map +1 -1
  240. package/lib/cjs/render/webgl/VisibleTileFeatures.js.map +1 -1
  241. package/lib/cjs/render/webgl/glsl/AmbientOcclusion.js +154 -154
  242. package/lib/cjs/render/webgl/glsl/AmbientOcclusion.js.map +1 -1
  243. package/lib/cjs/render/webgl/glsl/Animation.js +83 -83
  244. package/lib/cjs/render/webgl/glsl/Animation.js.map +1 -1
  245. package/lib/cjs/render/webgl/glsl/Atmosphere.js +266 -266
  246. package/lib/cjs/render/webgl/glsl/Atmosphere.js.map +1 -1
  247. package/lib/cjs/render/webgl/glsl/Blur.js +37 -37
  248. package/lib/cjs/render/webgl/glsl/Blur.js.map +1 -1
  249. package/lib/cjs/render/webgl/glsl/ClearPickAndColor.js +4 -4
  250. package/lib/cjs/render/webgl/glsl/ClearPickAndColor.js.map +1 -1
  251. package/lib/cjs/render/webgl/glsl/ClearTranslucent.js +3 -3
  252. package/lib/cjs/render/webgl/glsl/ClearTranslucent.js.map +1 -1
  253. package/lib/cjs/render/webgl/glsl/Clipping.js +60 -60
  254. package/lib/cjs/render/webgl/glsl/Clipping.js.map +1 -1
  255. package/lib/cjs/render/webgl/glsl/Color.js +12 -12
  256. package/lib/cjs/render/webgl/glsl/Color.js.map +1 -1
  257. package/lib/cjs/render/webgl/glsl/Combine3Textures.js +7 -7
  258. package/lib/cjs/render/webgl/glsl/Combine3Textures.js.map +1 -1
  259. package/lib/cjs/render/webgl/glsl/CombineTextures.js +5 -5
  260. package/lib/cjs/render/webgl/glsl/CombineTextures.js.map +1 -1
  261. package/lib/cjs/render/webgl/glsl/Common.js +16 -16
  262. package/lib/cjs/render/webgl/glsl/Common.js.map +1 -1
  263. package/lib/cjs/render/webgl/glsl/Composite.js +71 -71
  264. package/lib/cjs/render/webgl/glsl/Composite.js.map +1 -1
  265. package/lib/cjs/render/webgl/glsl/CopyColor.js +6 -6
  266. package/lib/cjs/render/webgl/glsl/CopyColor.js.map +1 -1
  267. package/lib/cjs/render/webgl/glsl/CopyPickBuffers.js +3 -3
  268. package/lib/cjs/render/webgl/glsl/CopyPickBuffers.js.map +1 -1
  269. package/lib/cjs/render/webgl/glsl/CopyStencil.js +4 -4
  270. package/lib/cjs/render/webgl/glsl/CopyStencil.js.map +1 -1
  271. package/lib/cjs/render/webgl/glsl/Decode.js +65 -65
  272. package/lib/cjs/render/webgl/glsl/Decode.js.map +1 -1
  273. package/lib/cjs/render/webgl/glsl/EDL.js +103 -103
  274. package/lib/cjs/render/webgl/glsl/EDL.js.map +1 -1
  275. package/lib/cjs/render/webgl/glsl/EVSMFromDepth.js +25 -25
  276. package/lib/cjs/render/webgl/glsl/EVSMFromDepth.js.map +1 -1
  277. package/lib/cjs/render/webgl/glsl/Edge.js +146 -146
  278. package/lib/cjs/render/webgl/glsl/Edge.js.map +1 -1
  279. package/lib/cjs/render/webgl/glsl/FeatureSymbology.js +232 -232
  280. package/lib/cjs/render/webgl/glsl/FeatureSymbology.js.map +1 -1
  281. package/lib/cjs/render/webgl/glsl/Fragment.js +41 -41
  282. package/lib/cjs/render/webgl/glsl/Fragment.js.map +1 -1
  283. package/lib/cjs/render/webgl/glsl/Instancing.js +21 -21
  284. package/lib/cjs/render/webgl/glsl/Instancing.js.map +1 -1
  285. package/lib/cjs/render/webgl/glsl/Lighting.js +92 -92
  286. package/lib/cjs/render/webgl/glsl/Lighting.js.map +1 -1
  287. package/lib/cjs/render/webgl/glsl/LogarithmicDepthBuffer.js.map +1 -1
  288. package/lib/cjs/render/webgl/glsl/LookupTable.js +19 -19
  289. package/lib/cjs/render/webgl/glsl/LookupTable.js.map +1 -1
  290. package/lib/cjs/render/webgl/glsl/Monochrome.js +13 -13
  291. package/lib/cjs/render/webgl/glsl/Monochrome.js.map +1 -1
  292. package/lib/cjs/render/webgl/glsl/PlanarClassification.js +188 -188
  293. package/lib/cjs/render/webgl/glsl/PlanarClassification.js.map +1 -1
  294. package/lib/cjs/render/webgl/glsl/PlanarGrid.js +22 -22
  295. package/lib/cjs/render/webgl/glsl/PlanarGrid.js.map +1 -1
  296. package/lib/cjs/render/webgl/glsl/PointCloud.js +28 -28
  297. package/lib/cjs/render/webgl/glsl/PointCloud.js.map +1 -1
  298. package/lib/cjs/render/webgl/glsl/PointString.js +9 -9
  299. package/lib/cjs/render/webgl/glsl/PointString.js.map +1 -1
  300. package/lib/cjs/render/webgl/glsl/Polyline.js +213 -213
  301. package/lib/cjs/render/webgl/glsl/Polyline.js.map +1 -1
  302. package/lib/cjs/render/webgl/glsl/RealityMesh.js +83 -83
  303. package/lib/cjs/render/webgl/glsl/RealityMesh.js.map +1 -1
  304. package/lib/cjs/render/webgl/glsl/RenderPass.js.map +1 -1
  305. package/lib/cjs/render/webgl/glsl/ScreenSpaceEffect.js +9 -9
  306. package/lib/cjs/render/webgl/glsl/ScreenSpaceEffect.js.map +1 -1
  307. package/lib/cjs/render/webgl/glsl/SkyBox.js.map +1 -1
  308. package/lib/cjs/render/webgl/glsl/SkySphere.js +49 -49
  309. package/lib/cjs/render/webgl/glsl/SkySphere.js.map +1 -1
  310. package/lib/cjs/render/webgl/glsl/SolarShadowMapping.js +51 -51
  311. package/lib/cjs/render/webgl/glsl/SolarShadowMapping.js.map +1 -1
  312. package/lib/cjs/render/webgl/glsl/Surface.js +239 -239
  313. package/lib/cjs/render/webgl/glsl/Surface.js.map +1 -1
  314. package/lib/cjs/render/webgl/glsl/Thematic.js +134 -134
  315. package/lib/cjs/render/webgl/glsl/Thematic.js.map +1 -1
  316. package/lib/cjs/render/webgl/glsl/Translucency.js +19 -19
  317. package/lib/cjs/render/webgl/glsl/Translucency.js.map +1 -1
  318. package/lib/cjs/render/webgl/glsl/Vertex.js +73 -73
  319. package/lib/cjs/render/webgl/glsl/Vertex.js.map +1 -1
  320. package/lib/cjs/render/webgl/glsl/Viewport.js +38 -38
  321. package/lib/cjs/render/webgl/glsl/Viewport.js.map +1 -1
  322. package/lib/cjs/render/webgl/glsl/ViewportQuad.js.map +1 -1
  323. package/lib/cjs/render/webgl/glsl/Wiremesh.js +10 -10
  324. package/lib/cjs/render/webgl/glsl/Wiremesh.js.map +1 -1
  325. package/lib/cjs/render-primitives.js.map +1 -1
  326. package/lib/cjs/request/Request.js.map +1 -1
  327. package/lib/cjs/tile/B3dmReader.js.map +1 -1
  328. package/lib/cjs/tile/BatchedTileIdMap.js.map +1 -1
  329. package/lib/cjs/tile/CesiumAssetProvider.js.map +1 -1
  330. package/lib/cjs/tile/ClassifierTileTree.js.map +1 -1
  331. package/lib/cjs/tile/ContextShareProvider.js.map +1 -1
  332. package/lib/cjs/tile/DisclosedTileTreeSet.js.map +1 -1
  333. package/lib/cjs/tile/DynamicIModelTile.js.map +1 -1
  334. package/lib/cjs/tile/GltfReader.js.map +1 -1
  335. package/lib/cjs/tile/GraphicsCollector.js.map +1 -1
  336. package/lib/cjs/tile/I3dmReader.js.map +1 -1
  337. package/lib/cjs/tile/IModelTile.js.map +1 -1
  338. package/lib/cjs/tile/IModelTileRequestChannels.js.map +1 -1
  339. package/lib/cjs/tile/IModelTileTree.js.map +1 -1
  340. package/lib/cjs/tile/ImdlDecoder.js.map +1 -1
  341. package/lib/cjs/tile/ImdlGraphicsCreator.js.map +1 -1
  342. package/lib/cjs/tile/ImdlParser.js.map +1 -1
  343. package/lib/cjs/tile/ImdlReader.js.map +1 -1
  344. package/lib/cjs/tile/LRUTileList.js.map +1 -1
  345. package/lib/cjs/tile/OPCFormatInterpreter.js.map +1 -1
  346. package/lib/cjs/tile/PntsReader.js.map +1 -1
  347. package/lib/cjs/tile/RealityTile.js.map +1 -1
  348. package/lib/cjs/tile/RealityTileDrawArgs.js.map +1 -1
  349. package/lib/cjs/tile/RealityTileLoader.js.map +1 -1
  350. package/lib/cjs/tile/RealityTileTree.js +1 -1
  351. package/lib/cjs/tile/RealityTileTree.js.map +1 -1
  352. package/lib/cjs/tile/ThreeDTileFormatInterpreter.js.map +1 -1
  353. package/lib/cjs/tile/Tile.js.map +1 -1
  354. package/lib/cjs/tile/TileAdmin.js.map +1 -1
  355. package/lib/cjs/tile/TileContent.js.map +1 -1
  356. package/lib/cjs/tile/TileDrawArgs.js.map +1 -1
  357. package/lib/cjs/tile/TileGeometryCollector.js.map +1 -1
  358. package/lib/cjs/tile/TileParams.js.map +1 -1
  359. package/lib/cjs/tile/TileRequest.js.map +1 -1
  360. package/lib/cjs/tile/TileRequestChannel.js.map +1 -1
  361. package/lib/cjs/tile/TileRequestChannels.js.map +1 -1
  362. package/lib/cjs/tile/TileStorage.js.map +1 -1
  363. package/lib/cjs/tile/TileTree.js.map +1 -1
  364. package/lib/cjs/tile/TileTreeOwner.js.map +1 -1
  365. package/lib/cjs/tile/TileTreeParams.js.map +1 -1
  366. package/lib/cjs/tile/TileTreeReference.js.map +1 -1
  367. package/lib/cjs/tile/TileTreeSupplier.js.map +1 -1
  368. package/lib/cjs/tile/TileUsageMarker.js.map +1 -1
  369. package/lib/cjs/tile/TileUser.js.map +1 -1
  370. package/lib/cjs/tile/TileUserSet.js.map +1 -1
  371. package/lib/cjs/tile/TiledGraphicsProvider.js.map +1 -1
  372. package/lib/cjs/tile/ViewFlagOverrides.js.map +1 -1
  373. package/lib/cjs/tile/internal.js.map +1 -1
  374. package/lib/cjs/tile/map/ArcGISTileMap.js.map +1 -1
  375. package/lib/cjs/tile/map/ArcGisUtilities.js.map +1 -1
  376. package/lib/cjs/tile/map/BingElevation.js.map +1 -1
  377. package/lib/cjs/tile/map/CesiumTerrainProvider.js.map +1 -1
  378. package/lib/cjs/tile/map/EllipsoidTerrainProvider.js.map +1 -1
  379. package/lib/cjs/tile/map/ImageryProviders/ArcGISImageryProvider.js.map +1 -1
  380. package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
  381. package/lib/cjs/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.js.map +1 -1
  382. package/lib/cjs/tile/map/ImageryProviders/BingImageryProvider.js.map +1 -1
  383. package/lib/cjs/tile/map/ImageryProviders/MapBoxLayerImageryProvider.js.map +1 -1
  384. package/lib/cjs/tile/map/ImageryProviders/TileUrlImageryProvider.js.map +1 -1
  385. package/lib/cjs/tile/map/ImageryProviders/WmsMapLayerImageryProvider.js.map +1 -1
  386. package/lib/cjs/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js.map +1 -1
  387. package/lib/cjs/tile/map/MapCartoRectangle.js.map +1 -1
  388. package/lib/cjs/tile/map/MapFeatureInfo.js.map +1 -1
  389. package/lib/cjs/tile/map/MapLayerAuthentication.js.map +1 -1
  390. package/lib/cjs/tile/map/MapLayerFormatRegistry.js.map +1 -1
  391. package/lib/cjs/tile/map/MapLayerImageryProvider.js +2 -2
  392. package/lib/cjs/tile/map/MapLayerImageryProvider.js.map +1 -1
  393. package/lib/cjs/tile/map/MapLayerSources.js.map +1 -1
  394. package/lib/cjs/tile/map/MapLayerTileTreeReference.js.map +1 -1
  395. package/lib/cjs/tile/map/MapTile.js.map +1 -1
  396. package/lib/cjs/tile/map/MapTileAvailability.js.map +1 -1
  397. package/lib/cjs/tile/map/MapTileLoader.js.map +1 -1
  398. package/lib/cjs/tile/map/MapTiledGraphicsProvider.js.map +1 -1
  399. package/lib/cjs/tile/map/MapTilingScheme.js.map +1 -1
  400. package/lib/cjs/tile/map/QuadId.js.map +1 -1
  401. package/lib/cjs/tile/map/TerrainMeshProvider.js.map +1 -1
  402. package/lib/cjs/tile/map/TerrainProvider.js.map +1 -1
  403. package/lib/cjs/tile/map/WmsCapabilities.js.map +1 -1
  404. package/lib/cjs/tile/map/WmsUtilities.js.map +1 -1
  405. package/lib/cjs/tile/map/WmtsCapabilities.js.map +1 -1
  406. package/lib/cjs/tools/AccuDrawTool.js.map +1 -1
  407. package/lib/cjs/tools/ClipViewTool.js.map +1 -1
  408. package/lib/cjs/tools/EditManipulator.js.map +1 -1
  409. package/lib/cjs/tools/ElementSetTool.js.map +1 -1
  410. package/lib/cjs/tools/EventController.js.map +1 -1
  411. package/lib/cjs/tools/IdleTool.js.map +1 -1
  412. package/lib/cjs/tools/MeasureTool.js.map +1 -1
  413. package/lib/cjs/tools/PrimitiveTool.js.map +1 -1
  414. package/lib/cjs/tools/SelectTool.js.map +1 -1
  415. package/lib/cjs/tools/ToolAdmin.js.map +1 -1
  416. package/lib/cjs/tools/ToolAssistance.js.map +1 -1
  417. package/lib/cjs/tools/ToolSettings.js.map +1 -1
  418. package/lib/cjs/tools/ViewTool.js.map +1 -1
  419. package/lib/cjs/webgl.js.map +1 -1
  420. package/lib/cjs/workers/ImdlParser/Worker.js.map +1 -1
  421. package/lib/cjs/workers/ImdlParser/webpack.config.js +40 -40
  422. package/lib/cjs/workers/RegisterWorker.js.map +1 -1
  423. package/lib/esm/AccuDraw.js.map +1 -1
  424. package/lib/esm/AccuSnap.js.map +1 -1
  425. package/lib/esm/ApproximateTerrainHeights.js.map +1 -1
  426. package/lib/esm/ApproximateTerrainHeightsProps.js.map +1 -1
  427. package/lib/esm/AuxCoordSys.js.map +1 -1
  428. package/lib/esm/BackgroundMapGeometry.js.map +1 -1
  429. package/lib/esm/BingLocation.js.map +1 -1
  430. package/lib/esm/BriefcaseConnection.js.map +1 -1
  431. package/lib/esm/BriefcaseTxns.js.map +1 -1
  432. package/lib/esm/CategorySelectorState.js.map +1 -1
  433. package/lib/esm/ChangeFlags.js.map +1 -1
  434. package/lib/esm/CheckpointConnection.js.map +1 -1
  435. package/lib/esm/CoordSystem.js.map +1 -1
  436. package/lib/esm/DecorationsCache.js.map +1 -1
  437. package/lib/esm/DevTools.js.map +1 -1
  438. package/lib/esm/DisplayStyleState.js.map +1 -1
  439. package/lib/esm/DrawingViewState.js +5 -5
  440. package/lib/esm/DrawingViewState.js.map +1 -1
  441. package/lib/esm/ElementLocateManager.js.map +1 -1
  442. package/lib/esm/EmphasizeElements.js.map +1 -1
  443. package/lib/esm/EntityState.js.map +1 -1
  444. package/lib/esm/EnvironmentDecorations.js.map +1 -1
  445. package/lib/esm/FeatureOverrideProvider.js.map +1 -1
  446. package/lib/esm/FlashSettings.js.map +1 -1
  447. package/lib/esm/FrontendHubAccess.js.map +1 -1
  448. package/lib/esm/Frustum2d.js.map +1 -1
  449. package/lib/esm/FrustumAnimator.js.map +1 -1
  450. package/lib/esm/FuzzySearch.js.map +1 -1
  451. package/lib/esm/GeoServices.js.map +1 -1
  452. package/lib/esm/GlobeAnimator.js.map +1 -1
  453. package/lib/esm/GraphicalEditingScope.js.map +1 -1
  454. package/lib/esm/HitDetail.js.map +1 -1
  455. package/lib/esm/IModelApp.js.map +1 -1
  456. package/lib/esm/IModelConnection.js +23 -23
  457. package/lib/esm/IModelConnection.js.map +1 -1
  458. package/lib/esm/IModelRoutingContext.js.map +1 -1
  459. package/lib/esm/IModeljs-css.js +133 -133
  460. package/lib/esm/IModeljs-css.js.map +1 -1
  461. package/lib/esm/IpcApp.js.map +1 -1
  462. package/lib/esm/LinePlaneIntersect.js.map +1 -1
  463. package/lib/esm/LocalhostIpcApp.js.map +1 -1
  464. package/lib/esm/MarginPercent.js.map +1 -1
  465. package/lib/esm/Marker.js.map +1 -1
  466. package/lib/esm/ModelSelectorState.js.map +1 -1
  467. package/lib/esm/NativeApp.js.map +1 -1
  468. package/lib/esm/NativeAppLogger.js.map +1 -1
  469. package/lib/esm/NoRenderApp.js.map +1 -1
  470. package/lib/esm/NotificationManager.js.map +1 -1
  471. package/lib/esm/PerModelCategoryVisibility.js.map +1 -1
  472. package/lib/esm/PlanarClipMaskState.js.map +1 -1
  473. package/lib/esm/RealityDataSource.js.map +1 -1
  474. package/lib/esm/RealityDataSourceCesiumIonAssetImpl.js.map +1 -1
  475. package/lib/esm/RealityDataSourceContextShareImpl.js.map +1 -1
  476. package/lib/esm/RealityDataSourceTilesetUrlImpl.js.map +1 -1
  477. package/lib/esm/SelectionSet.js.map +1 -1
  478. package/lib/esm/SheetViewState.js.map +1 -1
  479. package/lib/esm/SpatialViewState.js.map +1 -1
  480. package/lib/esm/Sprites.js.map +1 -1
  481. package/lib/esm/StandardView.js.map +1 -1
  482. package/lib/esm/SubCategoriesCache.js.map +1 -1
  483. package/lib/esm/TentativePoint.js.map +1 -1
  484. package/lib/esm/Tiles.js.map +1 -1
  485. package/lib/esm/UserPreferences.js.map +1 -1
  486. package/lib/esm/ViewAnimation.js.map +1 -1
  487. package/lib/esm/ViewContext.js.map +1 -1
  488. package/lib/esm/ViewCreator2d.js.map +1 -1
  489. package/lib/esm/ViewCreator3d.js.map +1 -1
  490. package/lib/esm/ViewGlobalLocation.js.map +1 -1
  491. package/lib/esm/ViewManager.js.map +1 -1
  492. package/lib/esm/ViewPose.js.map +1 -1
  493. package/lib/esm/ViewState.js.map +1 -1
  494. package/lib/esm/ViewStatus.js.map +1 -1
  495. package/lib/esm/ViewingSpace.js.map +1 -1
  496. package/lib/esm/Viewport.js.map +1 -1
  497. package/lib/esm/ViewportSync.js.map +1 -1
  498. package/lib/esm/common/FrontendLoggerCategory.js.map +1 -1
  499. package/lib/esm/common/ImageUtil.js.map +1 -1
  500. package/lib/esm/common/ViewRect.js.map +1 -1
  501. package/lib/esm/common/WorkerProxy.js.map +1 -1
  502. package/lib/esm/common/gltf/GltfModel.js.map +1 -1
  503. package/lib/esm/common/gltf/GltfParser.js.map +1 -1
  504. package/lib/esm/common/gltf/GltfSchema.js.map +1 -1
  505. package/lib/esm/common/imdl/CompactEdges.js.map +1 -1
  506. package/lib/esm/common/imdl/ImdlModel.js.map +1 -1
  507. package/lib/esm/common/imdl/ImdlSchema.js.map +1 -1
  508. package/lib/esm/common/imdl/ParseImdlDocument.js.map +1 -1
  509. package/lib/esm/common/render/AnimationNodeId.js.map +1 -1
  510. package/lib/esm/common/render/MaterialParams.js.map +1 -1
  511. package/lib/esm/common/render/TextureParams.js.map +1 -1
  512. package/lib/esm/common/render/primitives/AuxChannelTable.js.map +1 -1
  513. package/lib/esm/common/render/primitives/DisplayParams.js.map +1 -1
  514. package/lib/esm/common/render/primitives/EdgeParams.js.map +1 -1
  515. package/lib/esm/common/render/primitives/MeshParams.js.map +1 -1
  516. package/lib/esm/common/render/primitives/MeshPrimitive.js.map +1 -1
  517. package/lib/esm/common/render/primitives/PointStringParams.js.map +1 -1
  518. package/lib/esm/common/render/primitives/PolylineParams.js.map +1 -1
  519. package/lib/esm/common/render/primitives/SurfaceParams.js.map +1 -1
  520. package/lib/esm/common/render/primitives/VertexIndices.js.map +1 -1
  521. package/lib/esm/common/render/primitives/VertexTable.js.map +1 -1
  522. package/lib/esm/common/render/primitives/VertexTableSplitter.js.map +1 -1
  523. package/lib/esm/core-frontend.js.map +1 -1
  524. package/lib/esm/extension/Extension.js.map +1 -1
  525. package/lib/esm/extension/ExtensionAdmin.js.map +1 -1
  526. package/lib/esm/extension/ExtensionHost.js.map +1 -1
  527. package/lib/esm/extension/ExtensionRuntime.js.map +1 -1
  528. package/lib/esm/extension/providers/ExtensionLoadScript.js.map +1 -1
  529. package/lib/esm/extension/providers/LocalExtensionProvider.js.map +1 -1
  530. package/lib/esm/extension/providers/RemoteExtensionProvider.js.map +1 -1
  531. package/lib/esm/properties/AngleDescription.js.map +1 -1
  532. package/lib/esm/properties/FormattedQuantityDescription.js.map +1 -1
  533. package/lib/esm/properties/LengthDescription.js.map +1 -1
  534. package/lib/esm/public/scripts/checkbrowser.js +24 -24
  535. package/lib/esm/quantity-formatting/BaseUnitFormattingSettingsProvider.js.map +1 -1
  536. package/lib/esm/quantity-formatting/BasicUnitsProvider.js.map +1 -1
  537. package/lib/esm/quantity-formatting/LocalUnitFormatProvider.js.map +1 -1
  538. package/lib/esm/quantity-formatting/QuantityFormatter.js.map +1 -1
  539. package/lib/esm/quantity-formatting/QuantityTypesEditorSpecs.js.map +1 -1
  540. package/lib/esm/quantity-formatting/UnitsData.js.map +1 -1
  541. package/lib/esm/render/CanvasDecoration.js.map +1 -1
  542. package/lib/esm/render/CreateRenderMaterialArgs.js.map +1 -1
  543. package/lib/esm/render/CreateTextureArgs.js.map +1 -1
  544. package/lib/esm/render/Decorations.js.map +1 -1
  545. package/lib/esm/render/FeatureSymbology.js.map +1 -1
  546. package/lib/esm/render/FrameStats.js.map +1 -1
  547. package/lib/esm/render/GraphicBranch.js.map +1 -1
  548. package/lib/esm/render/GraphicBuilder.js.map +1 -1
  549. package/lib/esm/render/GraphicPrimitive.js.map +1 -1
  550. package/lib/esm/render/InstancedGraphicParams.js.map +1 -1
  551. package/lib/esm/render/MockRender.js.map +1 -1
  552. package/lib/esm/render/ParticleCollectionBuilder.js.map +1 -1
  553. package/lib/esm/render/Pixel.js.map +1 -1
  554. package/lib/esm/render/RealityMeshGraphicParams.js.map +1 -1
  555. package/lib/esm/render/RealityMeshParams.js.map +1 -1
  556. package/lib/esm/render/RenderClipVolume.js.map +1 -1
  557. package/lib/esm/render/RenderGraphic.js.map +1 -1
  558. package/lib/esm/render/RenderMemory.js.map +1 -1
  559. package/lib/esm/render/RenderPlan.js.map +1 -1
  560. package/lib/esm/render/RenderPlanarClassifier.js.map +1 -1
  561. package/lib/esm/render/RenderSystem.js.map +1 -1
  562. package/lib/esm/render/RenderTarget.js.map +1 -1
  563. package/lib/esm/render/Scene.js.map +1 -1
  564. package/lib/esm/render/ScreenSpaceEffectBuilder.js.map +1 -1
  565. package/lib/esm/render/UpsampleRealityMeshParams.js.map +1 -1
  566. package/lib/esm/render/VisibleFeature.js.map +1 -1
  567. package/lib/esm/render/primitives/ColorMap.js.map +1 -1
  568. package/lib/esm/render/primitives/EdgeParams.js.map +1 -1
  569. package/lib/esm/render/primitives/PointCloudPrimitive.js.map +1 -1
  570. package/lib/esm/render/primitives/PointStringParams.js.map +1 -1
  571. package/lib/esm/render/primitives/Polyface.js.map +1 -1
  572. package/lib/esm/render/primitives/PolylineParams.js.map +1 -1
  573. package/lib/esm/render/primitives/Primitives.js.map +1 -1
  574. package/lib/esm/render/primitives/Strokes.js.map +1 -1
  575. package/lib/esm/render/primitives/VertexKey.js.map +1 -1
  576. package/lib/esm/render/primitives/VertexTableBuilder.js.map +1 -1
  577. package/lib/esm/render/primitives/geometry/GeometryAccumulator.js.map +1 -1
  578. package/lib/esm/render/primitives/geometry/GeometryList.js.map +1 -1
  579. package/lib/esm/render/primitives/geometry/GeometryListBuilder.js.map +1 -1
  580. package/lib/esm/render/primitives/geometry/GeometryPrimitives.js.map +1 -1
  581. package/lib/esm/render/primitives/mesh/MeshBuilder.js.map +1 -1
  582. package/lib/esm/render/primitives/mesh/MeshBuilderMap.js.map +1 -1
  583. package/lib/esm/render/primitives/mesh/MeshPrimitives.js.map +1 -1
  584. package/lib/esm/render/webgl/AtmosphereUniforms.js.map +1 -1
  585. package/lib/esm/render/webgl/AttributeBuffers.js.map +1 -1
  586. package/lib/esm/render/webgl/AttributeMap.js.map +1 -1
  587. package/lib/esm/render/webgl/BackgroundMapDrape.js.map +1 -1
  588. package/lib/esm/render/webgl/BatchState.js.map +1 -1
  589. package/lib/esm/render/webgl/BatchUniforms.js.map +1 -1
  590. package/lib/esm/render/webgl/BranchStack.js.map +1 -1
  591. package/lib/esm/render/webgl/BranchState.js.map +1 -1
  592. package/lib/esm/render/webgl/BranchUniforms.js.map +1 -1
  593. package/lib/esm/render/webgl/CachedGeometry.js.map +1 -1
  594. package/lib/esm/render/webgl/ClipStack.js.map +1 -1
  595. package/lib/esm/render/webgl/ClipVolume.js.map +1 -1
  596. package/lib/esm/render/webgl/ClippingProgram.js.map +1 -1
  597. package/lib/esm/render/webgl/ColorInfo.js.map +1 -1
  598. package/lib/esm/render/webgl/Diagnostics.js.map +1 -1
  599. package/lib/esm/render/webgl/Disposable.js.map +1 -1
  600. package/lib/esm/render/webgl/DrawCommand.js.map +1 -1
  601. package/lib/esm/render/webgl/EDL.js.map +1 -1
  602. package/lib/esm/render/webgl/EdgeGeometry.js.map +1 -1
  603. package/lib/esm/render/webgl/EdgeSettings.js.map +1 -1
  604. package/lib/esm/render/webgl/FeatureOverrides.js.map +1 -1
  605. package/lib/esm/render/webgl/FloatRGBA.js.map +1 -1
  606. package/lib/esm/render/webgl/FrameBuffer.js.map +1 -1
  607. package/lib/esm/render/webgl/FrustumUniforms.js.map +1 -1
  608. package/lib/esm/render/webgl/GL.js.map +1 -1
  609. package/lib/esm/render/webgl/GLTimer.js.map +1 -1
  610. package/lib/esm/render/webgl/Graphic.js.map +1 -1
  611. package/lib/esm/render/webgl/HiliteUniforms.js.map +1 -1
  612. package/lib/esm/render/webgl/IModelFrameLifecycle.js.map +1 -1
  613. package/lib/esm/render/webgl/IndexedEdgeGeometry.js.map +1 -1
  614. package/lib/esm/render/webgl/InstancedGeometry.js.map +1 -1
  615. package/lib/esm/render/webgl/Layer.js.map +1 -1
  616. package/lib/esm/render/webgl/LayerCommands.js.map +1 -1
  617. package/lib/esm/render/webgl/LightingUniforms.js.map +1 -1
  618. package/lib/esm/render/webgl/LineCode.js.map +1 -1
  619. package/lib/esm/render/webgl/Material.js.map +1 -1
  620. package/lib/esm/render/webgl/Matrix.js.map +1 -1
  621. package/lib/esm/render/webgl/Mesh.js.map +1 -1
  622. package/lib/esm/render/webgl/MeshData.js.map +1 -1
  623. package/lib/esm/render/webgl/MeshGeometry.js.map +1 -1
  624. package/lib/esm/render/webgl/PerformanceMetrics.js.map +1 -1
  625. package/lib/esm/render/webgl/PlanarClassifier.js.map +1 -1
  626. package/lib/esm/render/webgl/PlanarGrid.js.map +1 -1
  627. package/lib/esm/render/webgl/PlanarTextureProjection.js.map +1 -1
  628. package/lib/esm/render/webgl/PointCloud.js.map +1 -1
  629. package/lib/esm/render/webgl/PointString.js.map +1 -1
  630. package/lib/esm/render/webgl/Polyline.js.map +1 -1
  631. package/lib/esm/render/webgl/Primitive.js.map +1 -1
  632. package/lib/esm/render/webgl/RealityMesh.js.map +1 -1
  633. package/lib/esm/render/webgl/RealityModelUniforms.js.map +1 -1
  634. package/lib/esm/render/webgl/RenderBuffer.js.map +1 -1
  635. package/lib/esm/render/webgl/RenderCommands.js.map +1 -1
  636. package/lib/esm/render/webgl/RenderFlags.js.map +1 -1
  637. package/lib/esm/render/webgl/RenderState.js.map +1 -1
  638. package/lib/esm/render/webgl/SceneCompositor.js.map +1 -1
  639. package/lib/esm/render/webgl/ScratchDrawParams.js.map +1 -1
  640. package/lib/esm/render/webgl/ScreenSpaceEffect.js.map +1 -1
  641. package/lib/esm/render/webgl/ShaderBuilder.js.map +1 -1
  642. package/lib/esm/render/webgl/ShaderProgram.js.map +1 -1
  643. package/lib/esm/render/webgl/ShadowUniforms.js.map +1 -1
  644. package/lib/esm/render/webgl/SolarShadowMap.js.map +1 -1
  645. package/lib/esm/render/webgl/StyleUniforms.js.map +1 -1
  646. package/lib/esm/render/webgl/SurfaceGeometry.js.map +1 -1
  647. package/lib/esm/render/webgl/Sync.js.map +1 -1
  648. package/lib/esm/render/webgl/System.js.map +1 -1
  649. package/lib/esm/render/webgl/Target.js.map +1 -1
  650. package/lib/esm/render/webgl/TargetGraphics.js.map +1 -1
  651. package/lib/esm/render/webgl/TargetUniforms.js.map +1 -1
  652. package/lib/esm/render/webgl/Technique.js.map +1 -1
  653. package/lib/esm/render/webgl/TechniqueFlags.js.map +1 -1
  654. package/lib/esm/render/webgl/TechniqueId.js.map +1 -1
  655. package/lib/esm/render/webgl/Texture.js.map +1 -1
  656. package/lib/esm/render/webgl/TextureDrape.js.map +1 -1
  657. package/lib/esm/render/webgl/ThematicSensors.js.map +1 -1
  658. package/lib/esm/render/webgl/ThematicUniforms.js.map +1 -1
  659. package/lib/esm/render/webgl/UniformHandle.js.map +1 -1
  660. package/lib/esm/render/webgl/VertexLUT.js.map +1 -1
  661. package/lib/esm/render/webgl/ViewRectUniforms.js.map +1 -1
  662. package/lib/esm/render/webgl/VisibleTileFeatures.js.map +1 -1
  663. package/lib/esm/render/webgl/glsl/AmbientOcclusion.js +154 -154
  664. package/lib/esm/render/webgl/glsl/AmbientOcclusion.js.map +1 -1
  665. package/lib/esm/render/webgl/glsl/Animation.js +83 -83
  666. package/lib/esm/render/webgl/glsl/Animation.js.map +1 -1
  667. package/lib/esm/render/webgl/glsl/Atmosphere.js +266 -266
  668. package/lib/esm/render/webgl/glsl/Atmosphere.js.map +1 -1
  669. package/lib/esm/render/webgl/glsl/Blur.js +37 -37
  670. package/lib/esm/render/webgl/glsl/Blur.js.map +1 -1
  671. package/lib/esm/render/webgl/glsl/ClearPickAndColor.js +4 -4
  672. package/lib/esm/render/webgl/glsl/ClearPickAndColor.js.map +1 -1
  673. package/lib/esm/render/webgl/glsl/ClearTranslucent.js +3 -3
  674. package/lib/esm/render/webgl/glsl/ClearTranslucent.js.map +1 -1
  675. package/lib/esm/render/webgl/glsl/Clipping.js +60 -60
  676. package/lib/esm/render/webgl/glsl/Clipping.js.map +1 -1
  677. package/lib/esm/render/webgl/glsl/Color.js +12 -12
  678. package/lib/esm/render/webgl/glsl/Color.js.map +1 -1
  679. package/lib/esm/render/webgl/glsl/Combine3Textures.js +7 -7
  680. package/lib/esm/render/webgl/glsl/Combine3Textures.js.map +1 -1
  681. package/lib/esm/render/webgl/glsl/CombineTextures.js +5 -5
  682. package/lib/esm/render/webgl/glsl/CombineTextures.js.map +1 -1
  683. package/lib/esm/render/webgl/glsl/Common.js +16 -16
  684. package/lib/esm/render/webgl/glsl/Common.js.map +1 -1
  685. package/lib/esm/render/webgl/glsl/Composite.js +71 -71
  686. package/lib/esm/render/webgl/glsl/Composite.js.map +1 -1
  687. package/lib/esm/render/webgl/glsl/CopyColor.js +6 -6
  688. package/lib/esm/render/webgl/glsl/CopyColor.js.map +1 -1
  689. package/lib/esm/render/webgl/glsl/CopyPickBuffers.js +3 -3
  690. package/lib/esm/render/webgl/glsl/CopyPickBuffers.js.map +1 -1
  691. package/lib/esm/render/webgl/glsl/CopyStencil.js +4 -4
  692. package/lib/esm/render/webgl/glsl/CopyStencil.js.map +1 -1
  693. package/lib/esm/render/webgl/glsl/Decode.js +65 -65
  694. package/lib/esm/render/webgl/glsl/Decode.js.map +1 -1
  695. package/lib/esm/render/webgl/glsl/EDL.js +103 -103
  696. package/lib/esm/render/webgl/glsl/EDL.js.map +1 -1
  697. package/lib/esm/render/webgl/glsl/EVSMFromDepth.js +25 -25
  698. package/lib/esm/render/webgl/glsl/EVSMFromDepth.js.map +1 -1
  699. package/lib/esm/render/webgl/glsl/Edge.js +146 -146
  700. package/lib/esm/render/webgl/glsl/Edge.js.map +1 -1
  701. package/lib/esm/render/webgl/glsl/FeatureSymbology.js +232 -232
  702. package/lib/esm/render/webgl/glsl/FeatureSymbology.js.map +1 -1
  703. package/lib/esm/render/webgl/glsl/Fragment.js +41 -41
  704. package/lib/esm/render/webgl/glsl/Fragment.js.map +1 -1
  705. package/lib/esm/render/webgl/glsl/Instancing.js +21 -21
  706. package/lib/esm/render/webgl/glsl/Instancing.js.map +1 -1
  707. package/lib/esm/render/webgl/glsl/Lighting.js +92 -92
  708. package/lib/esm/render/webgl/glsl/Lighting.js.map +1 -1
  709. package/lib/esm/render/webgl/glsl/LogarithmicDepthBuffer.js.map +1 -1
  710. package/lib/esm/render/webgl/glsl/LookupTable.js +19 -19
  711. package/lib/esm/render/webgl/glsl/LookupTable.js.map +1 -1
  712. package/lib/esm/render/webgl/glsl/Monochrome.js +13 -13
  713. package/lib/esm/render/webgl/glsl/Monochrome.js.map +1 -1
  714. package/lib/esm/render/webgl/glsl/PlanarClassification.js +188 -188
  715. package/lib/esm/render/webgl/glsl/PlanarClassification.js.map +1 -1
  716. package/lib/esm/render/webgl/glsl/PlanarGrid.js +22 -22
  717. package/lib/esm/render/webgl/glsl/PlanarGrid.js.map +1 -1
  718. package/lib/esm/render/webgl/glsl/PointCloud.js +28 -28
  719. package/lib/esm/render/webgl/glsl/PointCloud.js.map +1 -1
  720. package/lib/esm/render/webgl/glsl/PointString.js +9 -9
  721. package/lib/esm/render/webgl/glsl/PointString.js.map +1 -1
  722. package/lib/esm/render/webgl/glsl/Polyline.js +213 -213
  723. package/lib/esm/render/webgl/glsl/Polyline.js.map +1 -1
  724. package/lib/esm/render/webgl/glsl/RealityMesh.js +83 -83
  725. package/lib/esm/render/webgl/glsl/RealityMesh.js.map +1 -1
  726. package/lib/esm/render/webgl/glsl/RenderPass.js.map +1 -1
  727. package/lib/esm/render/webgl/glsl/ScreenSpaceEffect.js +9 -9
  728. package/lib/esm/render/webgl/glsl/ScreenSpaceEffect.js.map +1 -1
  729. package/lib/esm/render/webgl/glsl/SkyBox.js.map +1 -1
  730. package/lib/esm/render/webgl/glsl/SkySphere.js +49 -49
  731. package/lib/esm/render/webgl/glsl/SkySphere.js.map +1 -1
  732. package/lib/esm/render/webgl/glsl/SolarShadowMapping.js +51 -51
  733. package/lib/esm/render/webgl/glsl/SolarShadowMapping.js.map +1 -1
  734. package/lib/esm/render/webgl/glsl/Surface.js +239 -239
  735. package/lib/esm/render/webgl/glsl/Surface.js.map +1 -1
  736. package/lib/esm/render/webgl/glsl/Thematic.js +134 -134
  737. package/lib/esm/render/webgl/glsl/Thematic.js.map +1 -1
  738. package/lib/esm/render/webgl/glsl/Translucency.js +19 -19
  739. package/lib/esm/render/webgl/glsl/Translucency.js.map +1 -1
  740. package/lib/esm/render/webgl/glsl/Vertex.js +73 -73
  741. package/lib/esm/render/webgl/glsl/Vertex.js.map +1 -1
  742. package/lib/esm/render/webgl/glsl/Viewport.js +38 -38
  743. package/lib/esm/render/webgl/glsl/Viewport.js.map +1 -1
  744. package/lib/esm/render/webgl/glsl/ViewportQuad.js.map +1 -1
  745. package/lib/esm/render/webgl/glsl/Wiremesh.js +10 -10
  746. package/lib/esm/render/webgl/glsl/Wiremesh.js.map +1 -1
  747. package/lib/esm/render-primitives.js.map +1 -1
  748. package/lib/esm/request/Request.js.map +1 -1
  749. package/lib/esm/tile/B3dmReader.js.map +1 -1
  750. package/lib/esm/tile/BatchedTileIdMap.js.map +1 -1
  751. package/lib/esm/tile/CesiumAssetProvider.js.map +1 -1
  752. package/lib/esm/tile/ClassifierTileTree.js.map +1 -1
  753. package/lib/esm/tile/ContextShareProvider.js.map +1 -1
  754. package/lib/esm/tile/DisclosedTileTreeSet.js.map +1 -1
  755. package/lib/esm/tile/DynamicIModelTile.js.map +1 -1
  756. package/lib/esm/tile/GltfReader.js.map +1 -1
  757. package/lib/esm/tile/GraphicsCollector.js.map +1 -1
  758. package/lib/esm/tile/I3dmReader.js.map +1 -1
  759. package/lib/esm/tile/IModelTile.js.map +1 -1
  760. package/lib/esm/tile/IModelTileRequestChannels.js.map +1 -1
  761. package/lib/esm/tile/IModelTileTree.js.map +1 -1
  762. package/lib/esm/tile/ImdlDecoder.js.map +1 -1
  763. package/lib/esm/tile/ImdlGraphicsCreator.js.map +1 -1
  764. package/lib/esm/tile/ImdlParser.js.map +1 -1
  765. package/lib/esm/tile/ImdlReader.js.map +1 -1
  766. package/lib/esm/tile/LRUTileList.js.map +1 -1
  767. package/lib/esm/tile/OPCFormatInterpreter.js.map +1 -1
  768. package/lib/esm/tile/PntsReader.js.map +1 -1
  769. package/lib/esm/tile/RealityTile.js.map +1 -1
  770. package/lib/esm/tile/RealityTileDrawArgs.js.map +1 -1
  771. package/lib/esm/tile/RealityTileLoader.js.map +1 -1
  772. package/lib/esm/tile/RealityTileTree.js +1 -1
  773. package/lib/esm/tile/RealityTileTree.js.map +1 -1
  774. package/lib/esm/tile/ThreeDTileFormatInterpreter.js.map +1 -1
  775. package/lib/esm/tile/Tile.js.map +1 -1
  776. package/lib/esm/tile/TileAdmin.js.map +1 -1
  777. package/lib/esm/tile/TileContent.js.map +1 -1
  778. package/lib/esm/tile/TileDrawArgs.js.map +1 -1
  779. package/lib/esm/tile/TileGeometryCollector.js.map +1 -1
  780. package/lib/esm/tile/TileParams.js.map +1 -1
  781. package/lib/esm/tile/TileRequest.js.map +1 -1
  782. package/lib/esm/tile/TileRequestChannel.js.map +1 -1
  783. package/lib/esm/tile/TileRequestChannels.js.map +1 -1
  784. package/lib/esm/tile/TileStorage.js.map +1 -1
  785. package/lib/esm/tile/TileTree.js.map +1 -1
  786. package/lib/esm/tile/TileTreeOwner.js.map +1 -1
  787. package/lib/esm/tile/TileTreeParams.js.map +1 -1
  788. package/lib/esm/tile/TileTreeReference.js.map +1 -1
  789. package/lib/esm/tile/TileTreeSupplier.js.map +1 -1
  790. package/lib/esm/tile/TileUsageMarker.js.map +1 -1
  791. package/lib/esm/tile/TileUser.js.map +1 -1
  792. package/lib/esm/tile/TileUserSet.js.map +1 -1
  793. package/lib/esm/tile/TiledGraphicsProvider.js.map +1 -1
  794. package/lib/esm/tile/ViewFlagOverrides.js.map +1 -1
  795. package/lib/esm/tile/internal.js.map +1 -1
  796. package/lib/esm/tile/map/ArcGISTileMap.js.map +1 -1
  797. package/lib/esm/tile/map/ArcGisUtilities.js.map +1 -1
  798. package/lib/esm/tile/map/BingElevation.js.map +1 -1
  799. package/lib/esm/tile/map/CesiumTerrainProvider.js.map +1 -1
  800. package/lib/esm/tile/map/EllipsoidTerrainProvider.js.map +1 -1
  801. package/lib/esm/tile/map/ImageryProviders/ArcGISImageryProvider.js.map +1 -1
  802. package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
  803. package/lib/esm/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.js.map +1 -1
  804. package/lib/esm/tile/map/ImageryProviders/BingImageryProvider.js.map +1 -1
  805. package/lib/esm/tile/map/ImageryProviders/MapBoxLayerImageryProvider.js.map +1 -1
  806. package/lib/esm/tile/map/ImageryProviders/TileUrlImageryProvider.js.map +1 -1
  807. package/lib/esm/tile/map/ImageryProviders/WmsMapLayerImageryProvider.js.map +1 -1
  808. package/lib/esm/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js.map +1 -1
  809. package/lib/esm/tile/map/MapCartoRectangle.js.map +1 -1
  810. package/lib/esm/tile/map/MapFeatureInfo.js.map +1 -1
  811. package/lib/esm/tile/map/MapLayerAuthentication.js.map +1 -1
  812. package/lib/esm/tile/map/MapLayerFormatRegistry.js.map +1 -1
  813. package/lib/esm/tile/map/MapLayerImageryProvider.js +2 -2
  814. package/lib/esm/tile/map/MapLayerImageryProvider.js.map +1 -1
  815. package/lib/esm/tile/map/MapLayerSources.js.map +1 -1
  816. package/lib/esm/tile/map/MapLayerTileTreeReference.js.map +1 -1
  817. package/lib/esm/tile/map/MapTile.js.map +1 -1
  818. package/lib/esm/tile/map/MapTileAvailability.js.map +1 -1
  819. package/lib/esm/tile/map/MapTileLoader.js.map +1 -1
  820. package/lib/esm/tile/map/MapTiledGraphicsProvider.js.map +1 -1
  821. package/lib/esm/tile/map/MapTilingScheme.js.map +1 -1
  822. package/lib/esm/tile/map/QuadId.js.map +1 -1
  823. package/lib/esm/tile/map/TerrainMeshProvider.js.map +1 -1
  824. package/lib/esm/tile/map/TerrainProvider.js.map +1 -1
  825. package/lib/esm/tile/map/WmsCapabilities.js.map +1 -1
  826. package/lib/esm/tile/map/WmsUtilities.js.map +1 -1
  827. package/lib/esm/tile/map/WmtsCapabilities.js.map +1 -1
  828. package/lib/esm/tools/AccuDrawTool.js.map +1 -1
  829. package/lib/esm/tools/ClipViewTool.js.map +1 -1
  830. package/lib/esm/tools/EditManipulator.js.map +1 -1
  831. package/lib/esm/tools/ElementSetTool.js.map +1 -1
  832. package/lib/esm/tools/EventController.js.map +1 -1
  833. package/lib/esm/tools/IdleTool.js.map +1 -1
  834. package/lib/esm/tools/MeasureTool.js.map +1 -1
  835. package/lib/esm/tools/PrimitiveTool.js.map +1 -1
  836. package/lib/esm/tools/SelectTool.js.map +1 -1
  837. package/lib/esm/tools/ToolAdmin.js.map +1 -1
  838. package/lib/esm/tools/ToolAssistance.js.map +1 -1
  839. package/lib/esm/tools/ToolSettings.js.map +1 -1
  840. package/lib/esm/tools/ViewTool.js.map +1 -1
  841. package/lib/esm/webgl.js.map +1 -1
  842. package/lib/esm/workers/ImdlParser/Worker.js.map +1 -1
  843. package/lib/esm/workers/ImdlParser/webpack.config.js +40 -40
  844. package/lib/esm/workers/RegisterWorker.js.map +1 -1
  845. package/lib/public/assets/MapLayerSources.json +25 -25
  846. package/lib/public/images/cesium-ion.svg +92 -92
  847. package/lib/public/images/imodeljs-icon.svg +2 -2
  848. package/lib/public/locales/en/CoreTools.json +477 -477
  849. package/lib/public/locales/en/iModelJs.json +170 -170
  850. package/lib/public/scripts/checkbrowser.js +24 -24
  851. package/package.json +23 -22
@@ -1 +1 @@
1
- {"version":3,"file":"TileGeometryCollector.js","sourceRoot":"","sources":["../../../src/tile/TileGeometryCollector.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,4CAAyC;AA2BzC;;;;;GAKG;AACH,MAAa,qBAAqB;IAWhC,8BAA8B;IAC9B,YAAmB,OAAqC;QAXxD;;;WAGG;QACa,cA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AC,UAAU,CAAC;IAC1E,CAAC;CACF;AA7DD,sDA6DC","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 { Polyface, Range3d, Transform } from \"@itwin/core-geometry\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport {\r\n Tile, TileTreeReference, TileUser,\r\n} from \"./internal\";\r\n\r\n/** Enumerates the statuses returned by [[TileGeometryCollector.collectTile]].\r\n * - \"accept\": The tile's geometry should be collected.\r\n * - \"reject\": The tile's geometry (and that of all of its child tiles) should be omitted.\r\n * - \"continue\": The tile's geometry should be omitted, but that of its child tiles should be evaluated for collection.\r\n * @beta\r\n */\r\nexport type CollectTileStatus = \"accept\" | \"reject\" | \"continue\";\r\n\r\n/** Options for creating a [[TileGeometryCollector]].\r\n * @beta\r\n */\r\nexport interface TileGeometryCollectorOptions {\r\n /** The chord tolerance in meters describing the minimum level of detail desired of the tile geometry. */\r\n chordTolerance: number;\r\n /** The volume in which to collect tiles. Geometry of tiles that do not intersect this volume will not be collected. */\r\n range: Range3d;\r\n /** The [[TileUser]] that will make use of the tiles. */\r\n user: TileUser;\r\n /** An optional transform to be applied to the tile ranges before testing intersection with [[range]]. Typically this is obtained from [[TileTree.iModelTransform]]. */\r\n transform?: Transform;\r\n}\r\n\r\n/** Collects geoemtry from a [[GeometryTileTreeReference]] within a specified volume at a specified level of detail.\r\n * Subclasses can refine the collection criterion.\r\n * The tile geometry is obtained asynchronously, so successive collections over multiple frames may be required before all of the geometry\r\n * is collected.\r\n * @beta\r\n */\r\nexport class TileGeometryCollector {\r\n /** The list of accumulated polyfaces, populated during [[GeometryTileTreeReference.collectTileGeometry]].\r\n * The polyfaces belong to the [[Tile]]s - they should not be modified.\r\n * If [[isAllGeometryLoaded]] is `false`, then this list is incomplete - another geometry collection should be performed with a new collector on a subsequent frame.\r\n */\r\n public readonly polyfaces: Polyface[] = [];\r\n private readonly _missing = new Set<Tile>();\r\n private _loading = false;\r\n /** The options used to construct this collector. */\r\n protected readonly _options: TileGeometryCollectorOptions;\r\n\r\n /** Create a new collector. */\r\n public constructor(options: TileGeometryCollectorOptions) {\r\n this._options = options;\r\n }\r\n\r\n /** Allows an implementation of [[GeometryTileTreeReference.collectTileGeoemtry]] to indicate that further loading is required before\r\n * the collection can be completed.\r\n * This will cause [[isAllGeometryLoaded]] to return `false`.\r\n */\r\n public markLoading(): void {\r\n this._loading = true;\r\n }\r\n\r\n /** Enqueues requests to obtain the content of any tiles whose content is required to complete the geometry collection.\r\n * @see [[isAllGeometryLoaded]] to determine if geometry collection is complete.\r\n */\r\n public requestMissingTiles(): void {\r\n IModelApp.tileAdmin.requestTiles(this._options.user, this._missing);\r\n }\r\n\r\n /** Allows an implementation of [[GeometryTileTreeReference.collectTileGeometry]] to indicate that the specified tile's content must be loaded\r\n * before geometry collection can be completed.\r\n * This will cause [[isAllGeometryLoaded]] to return `false`.\r\n */\r\n public addMissingTile(tile: Tile): void {\r\n this._missing.add(tile);\r\n }\r\n\r\n /** Returns true if [[polyfaces]] has been fully populated with all the geometry satisfying this collector's criteria.\r\n * If it returns false, another collection using a new collector should be performed on a subsequent frame to load more geometry.\r\n */\r\n public get isAllGeometryLoaded(): boolean {\r\n return !this._loading && this._missing.size === 0;\r\n }\r\n\r\n /** Determine whether to collect the specified tile's geometry, reject it, or to evaluate the geometry of its child tiles for collection.\r\n * This base implementation makes that determination based on the collector's range and chord tolerance. Subclasses should typically call `super.collectTile` and, if\r\n * it returns \"accept\" or \"continue\", apply their own criteria to the tile.\r\n */\r\n public collectTile(tile: Tile): CollectTileStatus {\r\n const range = this._options.transform ? this._options.transform.multiplyRange(tile.range) : tile.range;\r\n if (!range.intersectsRange(this._options.range))\r\n return \"reject\";\r\n\r\n if (tile.maximumSize === 0 || !tile.isDisplayable)\r\n return \"continue\";\r\n\r\n const tolerance = tile.radius / tile.maximumSize;\r\n return tolerance < this._options.chordTolerance ? \"accept\" : \"continue\";\r\n }\r\n}\r\n\r\n/** A [[TileTreeReference]] that can supply geometry in the form of [Polyface]($core-geometry)s from [[Tile]]s belonging to its [[TileTree]] and satisfying the criteria defined\r\n * by a [[TileGeometryCollector]].\r\n * Use [[TileTreeReference.createGeometryTreeReference]] to obtain a GeometryTileTreeReference from an existing TileTreeReference.\r\n * @beta\r\n */\r\nexport interface GeometryTileTreeReference extends TileTreeReference {\r\n /** Populate [[TileGeometryCollector.polyfaces]] with geometry satisfying `collector`'s criteria.\r\n * Because tile geometry is obtained asynchronously, successive collections over multiple frames may be required before the list of polyfaces is fully populated.\r\n * @see [[TileGeometryCollector.isAllGeometryLoaded]] to determine if the list of polyfaces is fully populated.\r\n */\r\n collectTileGeometry: (collector: TileGeometryCollector) => void;\r\n}\r\n"]}
1
+ {"version":3,"file":"TileGeometryCollector.js","sourceRoot":"","sources":["../../../src/tile/TileGeometryCollector.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,4CAAyC;AA2BzC;;;;;GAKG;AACH,MAAa,qBAAqB;IAWhC,8BAA8B;IAC9B,YAAmB,OAAqC;QAXxD;;;WAGG;QACa,cAAS,GAAe,EAAE,CAAC;QAC1B,aAAQ,GAAG,IAAI,GAAG,EAAQ,CAAC;QACpC,aAAQ,GAAG,KAAK,CAAC;QAMvB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACI,WAAW;QAChB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvB,CAAC;IAED;;OAEG;IACI,mBAAmB;QACxB,qBAAS,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtE,CAAC;IAED;;;OAGG;IACI,cAAc,CAAC,IAAU;QAC9B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,IAAW,mBAAmB;QAC5B,OAAO,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,CAAC;IACpD,CAAC;IAED;;;OAGG;IACI,WAAW,CAAC,IAAU;QAC3B,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;QACvG,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;YAC7C,OAAO,QAAQ,CAAC;QAElB,IAAI,IAAI,CAAC,WAAW,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa;YAC/C,OAAO,UAAU,CAAC;QAEpB,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC;QACjD,OAAO,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC;IAC1E,CAAC;CACF;AA7DD,sDA6DC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tiles\n */\n\nimport { Polyface, Range3d, Transform } from \"@itwin/core-geometry\";\nimport { IModelApp } from \"../IModelApp\";\nimport {\n Tile, TileTreeReference, TileUser,\n} from \"./internal\";\n\n/** Enumerates the statuses returned by [[TileGeometryCollector.collectTile]].\n * - \"accept\": The tile's geometry should be collected.\n * - \"reject\": The tile's geometry (and that of all of its child tiles) should be omitted.\n * - \"continue\": The tile's geometry should be omitted, but that of its child tiles should be evaluated for collection.\n * @beta\n */\nexport type CollectTileStatus = \"accept\" | \"reject\" | \"continue\";\n\n/** Options for creating a [[TileGeometryCollector]].\n * @beta\n */\nexport interface TileGeometryCollectorOptions {\n /** The chord tolerance in meters describing the minimum level of detail desired of the tile geometry. */\n chordTolerance: number;\n /** The volume in which to collect tiles. Geometry of tiles that do not intersect this volume will not be collected. */\n range: Range3d;\n /** The [[TileUser]] that will make use of the tiles. */\n user: TileUser;\n /** An optional transform to be applied to the tile ranges before testing intersection with [[range]]. Typically this is obtained from [[TileTree.iModelTransform]]. */\n transform?: Transform;\n}\n\n/** Collects geoemtry from a [[GeometryTileTreeReference]] within a specified volume at a specified level of detail.\n * Subclasses can refine the collection criterion.\n * The tile geometry is obtained asynchronously, so successive collections over multiple frames may be required before all of the geometry\n * is collected.\n * @beta\n */\nexport class TileGeometryCollector {\n /** The list of accumulated polyfaces, populated during [[GeometryTileTreeReference.collectTileGeometry]].\n * The polyfaces belong to the [[Tile]]s - they should not be modified.\n * If [[isAllGeometryLoaded]] is `false`, then this list is incomplete - another geometry collection should be performed with a new collector on a subsequent frame.\n */\n public readonly polyfaces: Polyface[] = [];\n private readonly _missing = new Set<Tile>();\n private _loading = false;\n /** The options used to construct this collector. */\n protected readonly _options: TileGeometryCollectorOptions;\n\n /** Create a new collector. */\n public constructor(options: TileGeometryCollectorOptions) {\n this._options = options;\n }\n\n /** Allows an implementation of [[GeometryTileTreeReference.collectTileGeoemtry]] to indicate that further loading is required before\n * the collection can be completed.\n * This will cause [[isAllGeometryLoaded]] to return `false`.\n */\n public markLoading(): void {\n this._loading = true;\n }\n\n /** Enqueues requests to obtain the content of any tiles whose content is required to complete the geometry collection.\n * @see [[isAllGeometryLoaded]] to determine if geometry collection is complete.\n */\n public requestMissingTiles(): void {\n IModelApp.tileAdmin.requestTiles(this._options.user, this._missing);\n }\n\n /** Allows an implementation of [[GeometryTileTreeReference.collectTileGeometry]] to indicate that the specified tile's content must be loaded\n * before geometry collection can be completed.\n * This will cause [[isAllGeometryLoaded]] to return `false`.\n */\n public addMissingTile(tile: Tile): void {\n this._missing.add(tile);\n }\n\n /** Returns true if [[polyfaces]] has been fully populated with all the geometry satisfying this collector's criteria.\n * If it returns false, another collection using a new collector should be performed on a subsequent frame to load more geometry.\n */\n public get isAllGeometryLoaded(): boolean {\n return !this._loading && this._missing.size === 0;\n }\n\n /** Determine whether to collect the specified tile's geometry, reject it, or to evaluate the geometry of its child tiles for collection.\n * This base implementation makes that determination based on the collector's range and chord tolerance. Subclasses should typically call `super.collectTile` and, if\n * it returns \"accept\" or \"continue\", apply their own criteria to the tile.\n */\n public collectTile(tile: Tile): CollectTileStatus {\n const range = this._options.transform ? this._options.transform.multiplyRange(tile.range) : tile.range;\n if (!range.intersectsRange(this._options.range))\n return \"reject\";\n\n if (tile.maximumSize === 0 || !tile.isDisplayable)\n return \"continue\";\n\n const tolerance = tile.radius / tile.maximumSize;\n return tolerance < this._options.chordTolerance ? \"accept\" : \"continue\";\n }\n}\n\n/** A [[TileTreeReference]] that can supply geometry in the form of [Polyface]($core-geometry)s from [[Tile]]s belonging to its [[TileTree]] and satisfying the criteria defined\n * by a [[TileGeometryCollector]].\n * Use [[TileTreeReference.createGeometryTreeReference]] to obtain a GeometryTileTreeReference from an existing TileTreeReference.\n * @beta\n */\nexport interface GeometryTileTreeReference extends TileTreeReference {\n /** Populate [[TileGeometryCollector.polyfaces]] with geometry satisfying `collector`'s criteria.\n * Because tile geometry is obtained asynchronously, successive collections over multiple frames may be required before the list of polyfaces is fully populated.\n * @see [[TileGeometryCollector.isAllGeometryLoaded]] to determine if the list of polyfaces is fully populated.\n */\n collectTileGeometry: (collector: TileGeometryCollector) => void;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TileParams.js","sourceRoot":"","sources":["../../../src/tile/TileParams.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG","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 { ElementAlignedBox3d } from \"@itwin/core-common\";\r\nimport { Tile } from \"./internal\";\r\n\r\n/**\r\n * Parameters used to construct a [[Tile]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface TileParams {\r\n /** This tile's parent tile, if any.\r\n * @note Every tile has exactly one parent, except for [[TileTree.rootTile]] which has no parent.\r\n */\r\n parent?: Tile;\r\n /** True if this tile has no child tiles - i.e., requires no refinement. */\r\n isLeaf?: boolean;\r\n /** Uniquely identifies this tile's content within the context of its [[TileTree]]. */\r\n contentId: string;\r\n /** The volume of space occupied by this tile. If the tile has a parent tile, this tile's volume must be fully enclosed by its parent tile's volume. */\r\n range: ElementAlignedBox3d;\r\n /** Optionally, a volume more tightly encompassing this tile's contents. Must be fully enclosed by [[range]]. */\r\n contentRange?: ElementAlignedBox3d;\r\n /** The size in pixels beyond which this tile is considered too low-resolution for display. If zero, the tile is considered undisplayable.\r\n * An undisplayable tile may have displayable child tiles.\r\n */\r\n maximumSize: number;\r\n}\r\n"]}
1
+ {"version":3,"file":"TileParams.js","sourceRoot":"","sources":["../../../src/tile/TileParams.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tiles\n */\n\nimport { ElementAlignedBox3d } from \"@itwin/core-common\";\nimport { Tile } from \"./internal\";\n\n/**\n * Parameters used to construct a [[Tile]].\n * @public\n * @extensions\n */\nexport interface TileParams {\n /** This tile's parent tile, if any.\n * @note Every tile has exactly one parent, except for [[TileTree.rootTile]] which has no parent.\n */\n parent?: Tile;\n /** True if this tile has no child tiles - i.e., requires no refinement. */\n isLeaf?: boolean;\n /** Uniquely identifies this tile's content within the context of its [[TileTree]]. */\n contentId: string;\n /** The volume of space occupied by this tile. If the tile has a parent tile, this tile's volume must be fully enclosed by its parent tile's volume. */\n range: ElementAlignedBox3d;\n /** Optionally, a volume more tightly encompassing this tile's contents. Must be fully enclosed by [[range]]. */\n contentRange?: ElementAlignedBox3d;\n /** The size in pixels beyond which this tile is considered too low-resolution for display. If zero, the tile is considered undisplayable.\n * An undisplayable tile may have displayable child tiles.\n */\n maximumSize: number;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TileRequest.js","sourceRoot":"","sources":["../../../src/tile/TileRequest.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAqF;AACrF,oDAAiD;AACjD,4CAAyC;AAEzC,yCAA4G;AAE5G;;;;GAIG;AACH,MAAa,WAAW;IAatB,kBAAkB;IAClB,YAAmB,IAAU,EAAE,IAAc;QAJ7C,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,KAAK,GAAG,qBAAS,CAAC,SAAS,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;IAClE,CAAC;IAED,8JAA8J;IAC9J,IAAW,SAAS;QAClB,OAAO,mBAAQ,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACjD,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,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,CAAC,CAAC;gBAC3B,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,qBAAS,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBAC3F,IAAI,IAAI,CAAC,UAAU;oBACjB,OAAO;aACV;YAED,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC;YAC1C,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YAC9B,IAAI,CAAC,cAAc,EAAE,CAAC;YACtB,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,CAAC;SACvE;QAAC,OAAO,IAAI,EAAE;YACb,IAAI,CAAC,SAAS,EAAE,CAAC;SAClB;IACH,CAAC;CACF;AAhLD,kCAgLC;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,GAAX,mBAAW,KAAX,mBAAW,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 * @extensions\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\") {\r\n if (\"content\" in response)\r\n content = response.content;\r\n else if (\"data\" in response)\r\n data = response;\r\n }\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 const start = Date.now();\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, Date.now() - start);\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 } | { data: any } | 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 | { data: any };\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":"TileRequest.js","sourceRoot":"","sources":["../../../src/tile/TileRequest.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAqF;AACrF,oDAAiD;AACjD,4CAAyC;AAEzC,yCAA4G;AAE5G;;;;GAIG;AACH,MAAa,WAAW;IAatB,kBAAkB;IAClB,YAAmB,IAAU,EAAE,IAAc;QAJ7C,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,KAAK,GAAG,qBAAS,CAAC,SAAS,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;IA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W,KAAX,mBAAW,QA6B3B","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tiles\n */\n\nimport { assert, base64StringToUint8Array, IModelStatus } from \"@itwin/core-bentley\";\nimport { ImageSource } from \"@itwin/core-common\";\nimport { IModelApp } from \"../IModelApp\";\nimport { Viewport } from \"../Viewport\";\nimport { ReadonlyTileUserSet, Tile, TileContent, TileRequestChannel, TileTree, TileUser } from \"./internal\";\n\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\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.\n * @public\n * @extensions\n */\nexport class TileRequest {\n /** The requested tile. While the request is pending or active, `tile.request` points back to this TileRequest. */\n public readonly tile: Tile;\n /** The channel via which the request will be executed. */\n public readonly channel: TileRequestChannel;\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.\n * @internal\n */\n public users: ReadonlyTileUserSet;\n private _state: TileRequest.State;\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. */\n public priority = 0;\n\n /** Constructor */\n public constructor(tile: Tile, user: TileUser) {\n this._state = TileRequest.State.Queued;\n this.tile = tile;\n this.channel = tile.channel;\n this.users = IModelApp.tileAdmin.getTileUserSetForRequest(user);\n }\n\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. */\n public get viewports(): Iterable<Viewport> {\n return TileUser.viewportsFromUsers(this.users);\n }\n\n /** The request's current state. */\n public get state(): TileRequest.State { return this._state; }\n\n /** True if the request has been enqueued but not yet dispatched. */\n public get isQueued() { return TileRequest.State.Queued === this._state; }\n\n /** True if the request has been canceled. */\n public get isCanceled(): boolean {\n // If iModel was closed, cancel immediately\n if (this.tile.iModel.tiles.isDisposed)\n return true;\n\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).\n if (TileRequest.State.Loading === this._state)\n return false;\n\n // If no user cares about this tile any more, we're canceled.\n return this.users.isEmpty;\n }\n\n /** The tile tree to which the requested [[Tile]] belongs. */\n public get tree(): TileTree { return this.tile.tree; }\n\n /** Indicate that the specified user is awaiting the result of this request.\n * @internal\n */\n public addUser(user: TileUser): void {\n this.users = IModelApp.tileAdmin.getTileUserSetForRequest(user, this.users);\n }\n\n /** Transition the request from \"queued\" to \"active\", kicking off a series of asynchronous operations usually beginning with an http request, and -\n * if the request is not subsequently canceled - resulting in either a successfully-loaded Tile, or a failed (\"not found\") Tile.\n * @internal\n */\n public async dispatch(onHttpResponse: () => void): Promise<void> {\n if (this.isCanceled)\n return;\n\n assert(this._state === TileRequest.State.Queued);\n this._state = TileRequest.State.Dispatched;\n let response;\n let gotResponse = false;\n try {\n response = await this.channel.requestContent(this.tile, () => this.isCanceled);\n gotResponse = true;\n\n // Set this now, so our `isCanceled` check can see it.\n this._state = TileRequest.State.Loading;\n } catch (err: any) {\n if (err.errorNumber && err.errorNumber === IModelStatus.ServerTimeout) {\n // Invalidate scene - if tile is re-selected, it will be re-requested.\n this.notifyAndClear();\n this._state = TileRequest.State.Failed;\n this.channel.recordTimeout();\n } else {\n // Unknown error - not retryable\n this.setFailed();\n }\n }\n\n // Notify caller that we have finished http activity.\n onHttpResponse();\n\n if (!gotResponse || this.isCanceled)\n return;\n\n if (undefined === response && this.channel.onNoContent(this)) {\n // Invalidate scene - if tile is re-selected, it will be re-requested - presumably via a different channel.\n this.notifyAndClear();\n this._state = TileRequest.State.Failed;\n return;\n }\n\n return this.handleResponse(response);\n }\n\n /** Cancels this request. This leaves the associated Tile's state untouched.\n * @internal\n */\n public cancel(): void {\n this.notifyAndClear();\n if (TileRequest.State.Dispatched === this._state)\n this.channel.onActiveRequestCanceled(this);\n\n this._state = TileRequest.State.Failed;\n }\n\n /** Invalidates the scene of each [[TileUser]] interested in this request - typically because the request succeeded, failed, or was canceled. */\n private notify(): void {\n this.users.forEach((user) => {\n if (user.onRequestStateChanged)\n user.onRequestStateChanged(this);\n });\n }\n\n /** Invalidates the scene of each [[TileUser]] interested in this request and clears the set of interested users. */\n private notifyAndClear(): void {\n this.notify();\n this.users = IModelApp.tileAdmin.emptyTileUserSet;\n this.tile.request = undefined;\n }\n\n private setFailed() {\n this.notifyAndClear();\n this._state = TileRequest.State.Failed;\n this.tile.setNotFound();\n this.channel.recordFailure();\n }\n\n /** Invoked when the raw tile content becomes available, to convert it into a tile graphic. */\n private async handleResponse(response: TileRequest.Response): Promise<void> {\n let content: TileContent | undefined;\n let data: TileRequest.ResponseData | undefined;\n if (undefined !== response) {\n if (typeof response === \"string\")\n data = base64StringToUint8Array(response);\n else if (response instanceof Uint8Array || response instanceof ImageSource)\n data = response;\n else if (response instanceof ArrayBuffer)\n data = new Uint8Array(response);\n else if (typeof response === \"object\") {\n if (\"content\" in response)\n content = response.content;\n else if (\"data\" in response)\n data = response;\n }\n }\n\n if (!content && !data) {\n this.setFailed();\n return;\n }\n\n try {\n const start = Date.now();\n if (!content) {\n assert(undefined !== data);\n content = await this.tile.readContent(data, IModelApp.renderSystem, () => this.isCanceled);\n if (this.isCanceled)\n return;\n }\n\n this._state = TileRequest.State.Completed;\n this.tile.setContent(content);\n this.notifyAndClear();\n this.channel.recordCompletion(this.tile, content, Date.now() - start);\n } catch (_err) {\n this.setFailed();\n }\n }\n}\n\n/** @public */\nexport namespace TileRequest { // eslint-disable-line no-redeclare\n /** The type of a raw response to a request for tile content. Processed upon receipt into a [[TileRequest.Response]] type.\n * [[Tile.requestContent]] produces a response of this type; it is then converted to a [[Tile.ResponseData]] from which [[Tile.readContent]]\n * can produce a [[RenderGraphic]].\n * @public\n */\n export type Response = Uint8Array | ArrayBuffer | string | ImageSource | { content: TileContent } | { data: any } | undefined;\n\n /** The input to [[Tile.readContent]], to be converted into a [[RenderGraphic]].\n * @public\n */\n export type ResponseData = Uint8Array | ImageSource | { data: any };\n\n /** The states through which a [[TileRequest]] proceeds. During the first 3 states, the [[Tile]]'s `request` member is defined,\n * and its [[Tile.LoadStatus]] is computed based on the state of its request.\n *@ public\n */\n export enum State {\n /** Initial state. Request is pending but not yet dispatched. */\n Queued,\n /** Follows `Queued` when request begins to be actively processed. */\n Dispatched,\n /** Follows `Dispatched` when the response to the request is being converted into tile graphics. */\n Loading,\n /** Follows `Loading` when tile graphic has successfully been produced. */\n Completed,\n /** Follows any state in which an error prevents progression, or during which the request was canceled. */\n Failed,\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TileRequestChannel.js","sourceRoot":"","sources":["../../../src/tile/TileRequestChannel.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA4D;AAI5D,MAAM,gBAAiB,SAAQ,4BAA0B;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;AAmBD;;;;;;GAMG;AACH,MAAa,4BAA4B;IAAzC;QACE,uEAAuE;QAChE,uBAAkB,GAAG,CAAC,CAAC;QAC9B,8EAA8E;QACvE,sBAAiB,GAAG,CAAC,CAAC;QAC7B,qEAAqE;QAC9D,gBAAW,GAAG,CAAC,CAAC;QACvB,kEAAkE;QAC3D,2BAAsB,GAAG,CAAC,CAAC;QAClC,+DAA+D;QACxD,wBAAmB,GAAG,CAAC,CAAC;QAC/B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CAAC;IAED;;OAEG;IACO,iBAAiB,CAAC,OAAoB;QAC9C,IAAA,qBAAM,EAAC,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;AAlND,gDAkNC","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/** As part of a [[TileRequestChannelStatistics]], summarizes cumulative time spent decoding tile content.\r\n * For each Tile, the time elapsed between receiving the raw tile content (e.g., over the network) and converting it to a [[TileContent]] via [[Tile.readContent]]\r\n * is recorded.\r\n * All times are reported in milliseconds.\r\n * @beta\r\n */\r\nexport interface TileContentDecodingStatistics {\r\n /** The total number of milliseconds spent decoding content. */\r\n total: number;\r\n /** The mean (average) number of milliseconds spent decoding content. */\r\n mean: number;\r\n /** The longest amount of time, in milliseconds, spent decoding any single tile's content. */\r\n max: number;\r\n /** The shortest amount of time, in milliseconds, spent decoding any single tile's content. */\r\n min: number;\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 * @extensions\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 /** Statistics summarizing time spent decoding tile content.\r\n * @beta\r\n */\r\n public decoding: TileContentDecodingStatistics = {\r\n total: 0,\r\n mean: 0,\r\n max: Number.MIN_SAFE_INTEGER,\r\n min: Number.MAX_SAFE_INTEGER,\r\n };\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 assert(typeof stats[key] === \"number\");\r\n (stats[key] as number) += val;\r\n }\r\n }\r\n\r\n stats.decoding.total += this.decoding.total;\r\n stats.decoding.max = Math.max(this.decoding.max, stats.decoding.max);\r\n stats.decoding.min = Math.min(this.decoding.min, stats.decoding.min);\r\n\r\n if (stats.totalCompletedRequests > 0)\r\n stats.decoding.mean = (stats.decoding.total) / stats.totalCompletedRequests;\r\n }\r\n\r\n /** @internal */\r\n public recordCompletion(tile: Tile, elapsedMilliseconds: number): void {\r\n ++this.totalCompletedRequests;\r\n if (tile.isEmpty)\r\n ++this.totalEmptyTiles;\r\n else if (!tile.isDisplayable)\r\n ++this.totalUndisplayableTiles;\r\n\r\n this.decoding.total += elapsedMilliseconds;\r\n this.decoding.mean = this.decoding.total / this.totalCompletedRequests;\r\n this.decoding.max = Math.max(this.decoding.max, elapsedMilliseconds);\r\n this.decoding.min = Math.min(this.decoding.min, elapsedMilliseconds);\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 * @extensions\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, elapsedMilliseconds: number): void {\r\n this._statistics.recordCompletion(tile, elapsedMilliseconds);\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"]}
1
+ {"version":3,"file":"TileRequestChannel.js","sourceRoot":"","sources":["../../../src/tile/TileRequestChannel.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA4D;AAI5D,MAAM,gBAAiB,SAAQ,4BAA0B;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;AAmBD;;;;;;GAMG;AACH,MAAa,4BAA4B;IAAzC;QACE,uEAAuE;QAChE,uBAAkB,GAAG,CAAC,CAAC;QAC9B,8EAA8E;QACvE,sBAAiB,GAAG,CAAC,CAAC;QAC7B,qEAAqE;QAC9D,gBAAW,GAAG,CAAC,CAAC;QACvB,kEAAkE;QAC3D,2BAAsB,GAAG,CAAC,CAAC;QAClC,+DAA+D;QACxD,wBAAmB,GAAG,CAAC,CAAC;QAC/B,kEAAkE;QAC3D,0BAAqB,GAAG,CAAC,CAAC;QACjC;;WAEG;QACI,oBAAe,GAAG,CAAC,CAAC;QAC3B;;WAEG;QACI,4BAAuB,GAAG,CAAC,CAAC;QACnC,+JAA+J;QACxJ,qBAAgB,GAAG,CAAC,CAAC;QAC5B,4EAA4E;QACrE,4BAAuB,GAAG,CAAC,CAAC;QACnC,+HAA+H;QACxH,yBAAoB,GAAG,CAAC,CAAC;QAChC;;WAEG;QACI,aAAQ,GAAkC;YAC/C,KAAK,EAAE,CAAC;YACR,IAAI,EAAE,CAAC;YACP,GAAG,EAAE,MAAM,CAAC,gBAAgB;Y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ACxB,CAAC;IAED;;;;OAIG;IACI,WAAW,CAAC,QAAqB;QACtC,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACI,uBAAuB,CAAC,QAAqB,IAAU,CAAC;IAE/D;;OAEG;IACI,oBAAoB,KAAW,CAAC;IAEvC,2FAA2F;IACpF,cAAc,CAAC,OAAyB,IAAU,CAAC;IAE1D,qHAAqH;IAC9G,KAAK,CAAC,cAAc,CAAC,IAAU,EAAE,UAAyB;QAC/D,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IACzC,CAAC;IAED;;OAEG;IACO,QAAQ,CAAC,OAAoB;QACrC,EAAE,IAAI,CAAC,WAAW,CAAC,uBAAuB,CAAC;QAC3C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC1B,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE;YACpB,IAAI,CAAC,iBAAiB,CAAC,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,IAAA,qBAAM,EAAC,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;AAlND,gDAkNC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tiles\n */\n\nimport { assert, PriorityQueue } from \"@itwin/core-bentley\";\nimport { IModelConnection } from \"../IModelConnection\";\nimport { Tile, TileContent, TileRequest } from \"./internal\";\n\nclass TileRequestQueue extends PriorityQueue<TileRequest> {\n public constructor() {\n super((lhs, rhs) => {\n const diff = lhs.tile.tree.loadPriority - rhs.tile.tree.loadPriority;\n return 0 !== diff ? diff : lhs.priority - rhs.priority;\n });\n }\n}\n\n/** As part of a [[TileRequestChannelStatistics]], summarizes cumulative time spent decoding tile content.\n * For each Tile, the time elapsed between receiving the raw tile content (e.g., over the network) and converting it to a [[TileContent]] via [[Tile.readContent]]\n * is recorded.\n * All times are reported in milliseconds.\n * @beta\n */\nexport interface TileContentDecodingStatistics {\n /** The total number of milliseconds spent decoding content. */\n total: number;\n /** The mean (average) number of milliseconds spent decoding content. */\n mean: number;\n /** The longest amount of time, in milliseconds, spent decoding any single tile's content. */\n max: number;\n /** The shortest amount of time, in milliseconds, spent decoding any single tile's content. */\n min: number;\n}\n\n/** Statistics regarding the current and cumulative state of one or more [[TileRequestChannel]]s. Useful for monitoring performance and diagnosing problems.\n * @see [[TileRequestChannel.statistics]] for a specific channel's statistics.\n * @see [[TileRequestChannels.statistics]] for statistics from all channels.\n * @see [[TileAdmin.statistics]] for additional statistics.\n * @public\n * @extensions\n */\nexport class TileRequestChannelStatistics {\n /** The number of queued requests that have not yet been dispatched. */\n public numPendingRequests = 0;\n /** The number of requests that have been dispatched but not yet completed. */\n public numActiveRequests = 0;\n /** The number of requests canceled during the most recent update. */\n public numCanceled = 0;\n /** The total number of completed requests during this session. */\n public totalCompletedRequests = 0;\n /** The total number of failed requests during this session. */\n public totalFailedRequests = 0;\n /** The total number of timed-out requests during this session. */\n public totalTimedOutRequests = 0;\n /** The total number of completed requests during this session which produced an empty tile.\n * These tiles also contribute to [[totalCompletedRequests]], but not to [[totalUndisplayableTiles]].\n */\n public totalEmptyTiles = 0;\n /** The total number of completed requests during this session that produced an undisplayable tile.\n * These tiles also contribute to [[totalCompletedRequests]], but not to [[totalEmptyTiles]].\n */\n public totalUndisplayableTiles = 0;\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. */\n public totalCacheMisses = 0;\n /** The total number of tiles for which content requests were dispatched. */\n public totalDispatchedRequests = 0;\n /** The total number of tiles for which content requests were dispatched and then canceled on the backend before completion. */\n public totalAbortedRequests = 0;\n /** Statistics summarizing time spent decoding tile content.\n * @beta\n */\n public decoding: TileContentDecodingStatistics = {\n total: 0,\n mean: 0,\n max: Number.MIN_SAFE_INTEGER,\n min: Number.MAX_SAFE_INTEGER,\n };\n\n /** @internal */\n public addTo(stats: TileRequestChannelStatistics): void {\n for (const propName in this) { // eslint-disable-line guard-for-in\n const key = propName as keyof TileRequestChannelStatistics;\n const val = this[key];\n if (typeof val === \"number\") {\n assert(typeof stats[key] === \"number\");\n (stats[key] as number) += val;\n }\n }\n\n stats.decoding.total += this.decoding.total;\n stats.decoding.max = Math.max(this.decoding.max, stats.decoding.max);\n stats.decoding.min = Math.min(this.decoding.min, stats.decoding.min);\n\n if (stats.totalCompletedRequests > 0)\n stats.decoding.mean = (stats.decoding.total) / stats.totalCompletedRequests;\n }\n\n /** @internal */\n public recordCompletion(tile: Tile, elapsedMilliseconds: number): void {\n ++this.totalCompletedRequests;\n if (tile.isEmpty)\n ++this.totalEmptyTiles;\n else if (!tile.isDisplayable)\n ++this.totalUndisplayableTiles;\n\n this.decoding.total += elapsedMilliseconds;\n this.decoding.mean = this.decoding.total / this.totalCompletedRequests;\n this.decoding.max = Math.max(this.decoding.max, elapsedMilliseconds);\n this.decoding.min = Math.min(this.decoding.min, elapsedMilliseconds);\n }\n}\n\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\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.\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.\n * A channel must be registered with [[TileRequestChannels]] and must have a unique name among all registered channels.\n * @see [[TileRequestChannels.getForHttp]] to obtain (and register if not already registered) an HTTP-based channel.\n * @see [[TileAdmin.channels]] for the channels configured for use with the iTwin.js display system.\n * @see [[Tile.channel]] to specify the channel to be used to request a given tile's content.\n * @public\n * @extensions\n */\nexport class TileRequestChannel {\n /** The channel's name. It must be unique among all registered [[TileRequestChannels]]. */\n public readonly name: string;\n private _concurrency: number;\n /** Protected strictly for tests. @internal */\n protected readonly _active = new Set<TileRequest>();\n private _pending = new TileRequestQueue();\n private _previouslyPending = new TileRequestQueue();\n protected _statistics = new TileRequestChannelStatistics();\n /** Callback invoked by recordCompletion. See IModelTileMetadataCacheChannel.\n * @internal\n */\n public contentCallback?: (tile: Tile, content: TileContent) => void;\n\n /** Create a new channel.\n * @param name The unique name of the channel.\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.\n * @see [[TileRequestChannels.getForHttp]] to create an HTTP-based channel.\n */\n public constructor(name: string, concurrency: number) {\n this.name = name;\n this._concurrency = concurrency;\n }\n\n /** The maximum number of active requests. This is generally only modified for debugging purposes.\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.\n */\n public get concurrency(): number {\n return this._concurrency;\n }\n public set concurrency(max: number) {\n this._concurrency = max;\n }\n\n /** The number of requests that have been dispatched and are awaiting a response. */\n public get numActive(): number {\n return this._active.size;\n }\n\n /** The number of requests that have been enqueued for later dispatch. */\n public get numPending(): number {\n return this._pending.length;\n }\n\n /** The total number of requests in this channel, whether dispatched or enqueued. */\n public get size(): number {\n return this.numActive + this.numPending;\n }\n\n /** Statistics intended primarily for debugging. */\n public get statistics(): Readonly<TileRequestChannelStatistics> {\n this._statistics.numPendingRequests = this.numPending;\n this._statistics.numActiveRequests = this.numActive;\n return this._statistics;\n }\n\n /** Reset all of this channel's [[statistics]] to zero. */\n public resetStatistics(): void {\n this._statistics = new TileRequestChannelStatistics();\n }\n\n /** Invoked by [[TileRequest]] when a request times out.\n * @internal\n */\n public recordTimeout(): void {\n ++this._statistics.totalTimedOutRequests;\n }\n\n /** Invoked by [[TileRequest]] when a request fails to produce a response.\n * @internal\n */\n public recordFailure(): void {\n ++this._statistics.totalFailedRequests;\n }\n\n /** Invoked by [[TileRequest]] after a request completes.\n * @internal\n */\n public recordCompletion(tile: Tile, content: TileContent, elapsedMilliseconds: number): void {\n this._statistics.recordCompletion(tile, elapsedMilliseconds);\n\n if (this.contentCallback)\n this.contentCallback(tile, content);\n }\n\n /** Invoked by [[TileRequestChannels.swapPending]] when [[TileAdmin]] is about to start enqueuing new requests.\n * @internal\n */\n public swapPending(): void {\n const previouslyPending = this._pending;\n this._pending = this._previouslyPending;\n this._previouslyPending = previouslyPending;\n }\n\n /** Invoked by [[TileAdmin.processRequests]] to enqueue a request. Ordering is ignored - the queue will be re-sorted later.\n * @internal\n */\n public append(request: TileRequest): void {\n assert(request.channel === this);\n this._pending.append(request);\n }\n\n /** Invoked by [[TileRequestChannels.process]] to process the active and pending requests.\n * @internal\n */\n public process(): void {\n this._statistics.numCanceled = 0;\n\n // Recompute priority of each request.\n for (const pending of this._pending)\n pending.priority = pending.tile.computeLoadPriority(pending.viewports, pending.users);\n\n // Sort pending requests by priority.\n this._pending.sort();\n\n // Cancel any previously pending requests that are no longer needed.\n for (const queued of this._previouslyPending)\n if (queued.users.isEmpty)\n this.cancel(queued);\n\n this._previouslyPending.clear();\n\n // Cancel any active requests that are no longer needed.\n // NB: Do NOT remove them from the active set until their http activity has completed.\n for (const active of this._active)\n if (active.users.isEmpty)\n this.cancel(active);\n\n // Batch-cancel running requests.\n this.processCancellations();\n\n // Dispatch requests from the queue up to our maximum.\n while (this._active.size < this._concurrency) {\n const request = this._pending.pop();\n if (!request)\n break;\n\n this.dispatch(request);\n }\n }\n\n /** Cancel all active and queued requests and clear the active set and queue.\n * @internal\n */\n public cancelAndClearAll(): void {\n for (const active of this._active)\n active.cancel();\n\n for (const queued of this._pending)\n queued.cancel();\n\n this._active.clear();\n this._pending.clear();\n }\n\n /** Invoked when [[Tile.requestContent]] returns `undefined`. Return true if the request can be retried, e.g., via different channel.\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.\n * Otherwise, the tile will be marked as \"failed to load\" and no further requests will be made for its content.\n * The default implementation always returns `false`.\n */\n public onNoContent(_request: TileRequest): boolean {\n return false;\n }\n\n /** Invoked when a request that was previously dispatched is canceled before a response is received.\n * Some channels accumulate such requests for later cancellation in [[processCancellations]].\n */\n public onActiveRequestCanceled(_request: TileRequest): void { }\n\n /** Invoked to do any additional work to cancel tiles accumulated by [[onActiveRequestCanceled]]. For example, a channel that requests tile content\n * over IPC may signal to the tile generation process that it should cease generating content for those tiles.\n */\n public processCancellations(): void { }\n\n /** Invoked when an iModel is closed, to clean up any state associated with that iModel. */\n public onIModelClosed(_iModel: IModelConnection): void { }\n\n /** Request content for the specified tile. The default implementation simply forwards to [[Tile.requestContent]]. */\n public async requestContent(tile: Tile, isCanceled: () => boolean): Promise<TileRequest.Response> {\n return tile.requestContent(isCanceled);\n }\n\n /** Protected only for tests - do not override.\n * @internal\n */\n protected dispatch(request: TileRequest): void {\n ++this._statistics.totalDispatchedRequests;\n this._active.add(request);\n request.dispatch(() => {\n this.dropActiveRequest(request);\n }).catch((_) => {\n //\n });\n }\n\n /** Protected only for tests - do not override.\n * @internal\n */\n protected cancel(request: TileRequest): void {\n request.cancel();\n ++this._statistics.numCanceled;\n }\n\n /** Protected only for tests - do not override.\n * @internal\n */\n protected dropActiveRequest(request: TileRequest): void {\n assert(this._active.has(request) || request.isCanceled);\n this._active.delete(request);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TileRequestChannels.js","sourceRoot":"","sources":["../../../src/tile/TileRequestChannels.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sCAAmC;AAEnC,yCAEoB;AAEpB,8FAA8F;AAC9F,MAAM,sBAAuB,SAAQ,6BAAkB;IAAvD;;QACmB,cAAS,GAAG,IAAI,GAAG,EAA8B,CAAC;IAwBrE,CAAC;IAtBiB,uBAAuB,CAAC,OAAoB;QAC1D,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;QACxC,IAAI,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACrC,IAAI,CAAC,GAAG;YACN,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,GAAG,EAAE,CAAC,CAAC;QAEvC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACnC,CAAC;IAEe,oBAAoB;QAClC,KAAK,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,IAAI,IAAI,CAAC,SAAS,EAAE;YACjD,mEAAmE;YACnE,eAAM,CAAC,cAAc,CAAC,6BAA6B,CAAC,MAAM,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;YAC5E,IAAI,CAAC,WAAW,CAAC,oBAAoB,IAAI,UAAU,CAAC,MAAM,CAAC;SAC5D;QAED,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;IAEe,cAAc,CAAC,MAAwB;QACrD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAa,mBAAmB;IAY9B;;OAEG;IACH,YAAmB,cAAkC,EAAE,aAAsB;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AAW,CAAC;IACpD,CAAC;IAED,mDAAmD;IACnD,IAAW,UAAU;QACnB,MAAM,KAAK,GAAG,IAAI,uCAA4B,EAAE,CAAC;QACjD,KAAK,MAAM,OAAO,IAAI,IAAI;YACxB,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAElC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,wCAAwC;IACjC,eAAe;QACpB,KAAK,MAAM,OAAO,IAAI,IAAI;YACxB,OAAO,CAAC,eAAe,EAAE,CAAC;IAC9B,CAAC;IAED;;OAEG;IACI,WAAW;QAChB,KAAK,MAAM,OAAO,IAAI,IAAI;YACxB,OAAO,CAAC,WAAW,EAAE,CAAC;IAC1B,CAAC;IAED;;OAEG;IACI,OAAO;QACZ,KAAK,MAAM,OAAO,IAAI,IAAI;YACxB,OAAO,CAAC,OAAO,EAAE,CAAC;IACtB,CAAC;IAED;;OAEG;IACI,cAAc,CAAC,MAAwB;QAC5C,KAAK,MAAM,OAAO,IAAI,IAAI;YACxB,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IACI,UAAU;QACf,KAAK,MAAM,OAAO,IAAI,IAAI;YACxB,OAAO,CAAC,iBAAiB,EAAE,CAAC;QAE9B,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;CACF;AAhKD,kDAgKC","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 { IpcApp } from \"../IpcApp\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport {\r\n IModelTile, IModelTileRequestChannels, TileRequest, TileRequestChannel, TileRequestChannelStatistics,\r\n} from \"./internal\";\r\n\r\n/** For an [[IpcApp]], allows backend element graphics requests in progress to be canceled. */\r\nclass ElementGraphicsChannel extends TileRequestChannel {\r\n private readonly _canceled = new Map<IModelConnection, string[]>();\r\n\r\n public override onActiveRequestCanceled(request: TileRequest): void {\r\n const imodel = request.tile.tree.iModel;\r\n let ids = this._canceled.get(imodel);\r\n if (!ids)\r\n this._canceled.set(imodel, ids = []);\r\n\r\n ids.push(request.tile.contentId);\r\n }\r\n\r\n public override processCancellations(): void {\r\n for (const [imodel, requestIds] of this._canceled) {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n IpcApp.appFunctionIpc.cancelElementGraphicsRequests(imodel.key, requestIds);\r\n this._statistics.totalAbortedRequests += requestIds.length;\r\n }\r\n\r\n this._canceled.clear();\r\n }\r\n\r\n public override onIModelClosed(imodel: IModelConnection): void {\r\n this._canceled.delete(imodel);\r\n }\r\n}\r\n\r\n/** A set of named [[TileRequestChannel]]s via which content for [[Tile]]s can be requested.\r\n * @see [[TileAdmin.channels]] for the channels configured for use with the iTwin.js display system.\r\n * @see [[TileRequestChannels.getForHttp]] for the most typical way of obtaining or registering a channel.\r\n * @public\r\n * @extensions\r\n */\r\nexport class TileRequestChannels {\r\n /** @internal */\r\n public readonly iModelChannels: IModelTileRequestChannels;\r\n /** The channel over which [[TileAdmin.requestElementGraphics]] executes. If you implement a [[TiledGraphicsProvider]] or [[TileTree]] that obtains its\r\n * content from `requestElementGraphics`, use this channel.\r\n */\r\n public readonly elementGraphicsRpc: TileRequestChannel;\r\n /** The maximum number of active requests for a channel that uses HTTP to request content. */\r\n public readonly httpConcurrency = 6;\r\n private _rpcConcurrency: number;\r\n private readonly _channels = new Map<string, TileRequestChannel>();\r\n\r\n /** `rpcConcurrency` is defined if [[IpcApp.isValid]]; otherwise RPC requests are made over HTTP and use the same limits.\r\n * @internal\r\n */\r\n public constructor(rpcConcurrency: number | undefined, cacheMetadata: boolean) {\r\n this._rpcConcurrency = rpcConcurrency ?? this.httpConcurrency;\r\n\r\n const elementGraphicsChannelName = \"itwinjs-elem-rpc\";\r\n if (undefined !== rpcConcurrency)\r\n this.elementGraphicsRpc = new ElementGraphicsChannel(elementGraphicsChannelName, rpcConcurrency);\r\n else\r\n this.elementGraphicsRpc = new TileRequestChannel(elementGraphicsChannelName, this.rpcConcurrency);\r\n\r\n this.add(this.elementGraphicsRpc);\r\n\r\n this.iModelChannels = new IModelTileRequestChannels({\r\n concurrency: this.rpcConcurrency,\r\n usesHttp: undefined === rpcConcurrency,\r\n cacheMetadata,\r\n cacheConcurrency: this.httpConcurrency,\r\n });\r\n\r\n for (const channel of this.iModelChannels)\r\n this.add(channel);\r\n }\r\n\r\n /** The number of registered channels. */\r\n public get size(): number {\r\n return this._channels.size;\r\n }\r\n\r\n /** Look up a registered channel by its name. */\r\n public get(name: string): TileRequestChannel | undefined {\r\n return this._channels.get(name);\r\n }\r\n\r\n /** Return whether the specified channel has been registered. Primarily for debugging. */\r\n public has(channel: TileRequestChannel): boolean {\r\n const existing = this.get(channel.name);\r\n return existing !== undefined && existing === channel;\r\n }\r\n\r\n /** Add a new channel.\r\n * @throws Error if a channel by the same name has already been registered.\r\n */\r\n public add(channel: TileRequestChannel): void {\r\n if (this.get(channel.name))\r\n throw new Error(`Tile request channel ${channel.name} is already registered.`);\r\n\r\n this._channels.set(channel.name, channel);\r\n }\r\n\r\n /** Extract the host name from a URL for use as the name of the corresponding [[TileRequestChannel]].\r\n * @throws TypeError if `url` is a string and does not represent a valid URL.\r\n * @see [[getForHttp]] to obtain or register a channel for the host name.\r\n */\r\n public static getNameFromUrl(url: URL | string): string {\r\n if (typeof url === \"string\")\r\n url = new URL(url);\r\n\r\n return url.hostname;\r\n }\r\n\r\n /** Obtain a channel that requests content over HTTP using HTTP 1.1 limits on simultaneous connections.\r\n * If a channel with the specified name does not already exist, it will be created and registered.\r\n * @see [[getNameFromUrl]] to obtain a channel name corresponding to a hostname.\r\n */\r\n public getForHttp(name: string): TileRequestChannel {\r\n let channel = this.get(name);\r\n if (!channel)\r\n this.add(channel = new TileRequestChannel(name, this.httpConcurrency));\r\n\r\n return channel;\r\n }\r\n\r\n /** Iterator over all of the channels. */\r\n public [Symbol.iterator](): Iterator<TileRequestChannel> {\r\n return this._channels.values()[Symbol.iterator]();\r\n }\r\n\r\n /** The maximum number of active requests for a channel that uses an RpcInterface to satisfy its requests.\r\n * For web-based applications, this is the same as [[httpConcurrency]], but for [[IpcApp]]s it is determined by the number of workers threads allocated by the backend.\r\n */\r\n public get rpcConcurrency(): number {\r\n return this._rpcConcurrency;\r\n }\r\n\r\n /** @internal */\r\n public getIModelTileChannel(tile: IModelTile): TileRequestChannel {\r\n return this.iModelChannels.getChannelForTile(tile);\r\n }\r\n\r\n /** Chiefly for debugging.\r\n * @internal\r\n */\r\n public setRpcConcurrency(concurrency: number): void {\r\n this._rpcConcurrency = concurrency;\r\n this.iModelChannels.setRpcConcurrency(concurrency);\r\n this.elementGraphicsRpc.concurrency = concurrency;\r\n }\r\n\r\n /** Statistics intended primarily for debugging. */\r\n public get statistics(): TileRequestChannelStatistics {\r\n const stats = new TileRequestChannelStatistics();\r\n for (const channel of this)\r\n channel.statistics.addTo(stats);\r\n\r\n return stats;\r\n }\r\n\r\n /** Reset all [[statistics]] to zero. */\r\n public resetStatistics(): void {\r\n for (const channel of this)\r\n channel.resetStatistics();\r\n }\r\n\r\n /** Invoked by [[TileAdmin.processQueue]] when it is about to start enqueuing new requests.\r\n * @internal\r\n */\r\n public swapPending(): void {\r\n for (const channel of this)\r\n channel.swapPending();\r\n }\r\n\r\n /** Invoked by [[TileAdmin.processQueue]] when it is about to start enqueuing new requests.\r\n * @internal\r\n */\r\n public process(): void {\r\n for (const channel of this)\r\n channel.process();\r\n }\r\n\r\n /** Invoked by [[TileAdmin.onIModelClosed]].\r\n * @internal\r\n */\r\n public onIModelClosed(iModel: IModelConnection): void {\r\n for (const channel of this)\r\n channel.onIModelClosed(iModel);\r\n }\r\n\r\n /** Invoked by [[TileAdmin.onShutDown]].\r\n * @internal\r\n */\r\n public onShutDown(): void {\r\n for (const channel of this)\r\n channel.cancelAndClearAll();\r\n\r\n this._channels.clear();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"TileRequestChannels.js","sourceRoot":"","sources":["../../../src/tile/TileRequestChannels.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sCAAmC;AAEnC,yCAEoB;AAEpB,8FAA8F;AAC9F,MAAM,sBAAuB,SAAQ,6BAAkB;IAAvD;;QACmB,cAAS,GAAG,IAAI,GAAG,EAA8B,CAAC;IAwBrE,CAAC;IAtBiB,uBAAuB,CAAC,OAAoB;QAC1D,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;QACxC,IAAI,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACrC,IAAI,CAAC,GAAG;YACN,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,GAAG,EAAE,CAAC,CAAC;QAEvC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACnC,CAAC;IAEe,oBAAoB;QAClC,KAAK,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,IAAI,IAAI,CAAC,SAAS,EAAE;YACjD,mEAAmE;YACnE,eAAM,CAAC,cAAc,CAAC,6BAA6B,CAAC,MAAM,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;YAC5E,IAAI,CAAC,WAAW,CAAC,oBAAoB,IAAI,UAAU,CAAC,MAAM,CAAC;SAC5D;QAED,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;IAEe,cAAc,CAAC,MAAwB;QACrD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAa,mBAAmB;IAY9B;;OAEG;IACH,YAAmB,cAAkC,EAAE,aAAsB;QAR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,CAAC;IACpD,CAAC;IAED,mDAAmD;IACnD,IAAW,UAAU;QACnB,MAAM,KAAK,GAAG,IAAI,uCAA4B,EAAE,CAAC;QACjD,KAAK,MAAM,OAAO,IAAI,IAAI;YACxB,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAElC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,wCAAwC;IACjC,eAAe;QACpB,KAAK,MAAM,OAAO,IAAI,IAAI;YACxB,OAAO,CAAC,eAAe,EAAE,CAAC;IAC9B,CAAC;IAED;;OAEG;IACI,WAAW;QAChB,KAAK,MAAM,OAAO,IAAI,IAAI;YACxB,OAAO,CAAC,WAAW,EAAE,CAAC;IAC1B,CAAC;IAED;;OAEG;IACI,OAAO;QACZ,KAAK,MAAM,OAAO,IAAI,IAAI;YACxB,OAAO,CAAC,OAAO,EAAE,CAAC;IACtB,CAAC;IAED;;OAEG;IACI,cAAc,CAAC,MAAwB;QAC5C,KAAK,MAAM,OAAO,IAAI,IAAI;YACxB,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IACI,UAAU;QACf,KAAK,MAAM,OAAO,IAAI,IAAI;YACxB,OAAO,CAAC,iBAAiB,EAAE,CAAC;QAE9B,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;CACF;AAhKD,kDAgKC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tiles\n */\n\nimport { IpcApp } from \"../IpcApp\";\nimport { IModelConnection } from \"../IModelConnection\";\nimport {\n IModelTile, IModelTileRequestChannels, TileRequest, TileRequestChannel, TileRequestChannelStatistics,\n} from \"./internal\";\n\n/** For an [[IpcApp]], allows backend element graphics requests in progress to be canceled. */\nclass ElementGraphicsChannel extends TileRequestChannel {\n private readonly _canceled = new Map<IModelConnection, string[]>();\n\n public override onActiveRequestCanceled(request: TileRequest): void {\n const imodel = request.tile.tree.iModel;\n let ids = this._canceled.get(imodel);\n if (!ids)\n this._canceled.set(imodel, ids = []);\n\n ids.push(request.tile.contentId);\n }\n\n public override processCancellations(): void {\n for (const [imodel, requestIds] of this._canceled) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n IpcApp.appFunctionIpc.cancelElementGraphicsRequests(imodel.key, requestIds);\n this._statistics.totalAbortedRequests += requestIds.length;\n }\n\n this._canceled.clear();\n }\n\n public override onIModelClosed(imodel: IModelConnection): void {\n this._canceled.delete(imodel);\n }\n}\n\n/** A set of named [[TileRequestChannel]]s via which content for [[Tile]]s can be requested.\n * @see [[TileAdmin.channels]] for the channels configured for use with the iTwin.js display system.\n * @see [[TileRequestChannels.getForHttp]] for the most typical way of obtaining or registering a channel.\n * @public\n * @extensions\n */\nexport class TileRequestChannels {\n /** @internal */\n public readonly iModelChannels: IModelTileRequestChannels;\n /** The channel over which [[TileAdmin.requestElementGraphics]] executes. If you implement a [[TiledGraphicsProvider]] or [[TileTree]] that obtains its\n * content from `requestElementGraphics`, use this channel.\n */\n public readonly elementGraphicsRpc: TileRequestChannel;\n /** The maximum number of active requests for a channel that uses HTTP to request content. */\n public readonly httpConcurrency = 6;\n private _rpcConcurrency: number;\n private readonly _channels = new Map<string, TileRequestChannel>();\n\n /** `rpcConcurrency` is defined if [[IpcApp.isValid]]; otherwise RPC requests are made over HTTP and use the same limits.\n * @internal\n */\n public constructor(rpcConcurrency: number | undefined, cacheMetadata: boolean) {\n this._rpcConcurrency = rpcConcurrency ?? this.httpConcurrency;\n\n const elementGraphicsChannelName = \"itwinjs-elem-rpc\";\n if (undefined !== rpcConcurrency)\n this.elementGraphicsRpc = new ElementGraphicsChannel(elementGraphicsChannelName, rpcConcurrency);\n else\n this.elementGraphicsRpc = new TileRequestChannel(elementGraphicsChannelName, this.rpcConcurrency);\n\n this.add(this.elementGraphicsRpc);\n\n this.iModelChannels = new IModelTileRequestChannels({\n concurrency: this.rpcConcurrency,\n usesHttp: undefined === rpcConcurrency,\n cacheMetadata,\n cacheConcurrency: this.httpConcurrency,\n });\n\n for (const channel of this.iModelChannels)\n this.add(channel);\n }\n\n /** The number of registered channels. */\n public get size(): number {\n return this._channels.size;\n }\n\n /** Look up a registered channel by its name. */\n public get(name: string): TileRequestChannel | undefined {\n return this._channels.get(name);\n }\n\n /** Return whether the specified channel has been registered. Primarily for debugging. */\n public has(channel: TileRequestChannel): boolean {\n const existing = this.get(channel.name);\n return existing !== undefined && existing === channel;\n }\n\n /** Add a new channel.\n * @throws Error if a channel by the same name has already been registered.\n */\n public add(channel: TileRequestChannel): void {\n if (this.get(channel.name))\n throw new Error(`Tile request channel ${channel.name} is already registered.`);\n\n this._channels.set(channel.name, channel);\n }\n\n /** Extract the host name from a URL for use as the name of the corresponding [[TileRequestChannel]].\n * @throws TypeError if `url` is a string and does not represent a valid URL.\n * @see [[getForHttp]] to obtain or register a channel for the host name.\n */\n public static getNameFromUrl(url: URL | string): string {\n if (typeof url === \"string\")\n url = new URL(url);\n\n return url.hostname;\n }\n\n /** Obtain a channel that requests content over HTTP using HTTP 1.1 limits on simultaneous connections.\n * If a channel with the specified name does not already exist, it will be created and registered.\n * @see [[getNameFromUrl]] to obtain a channel name corresponding to a hostname.\n */\n public getForHttp(name: string): TileRequestChannel {\n let channel = this.get(name);\n if (!channel)\n this.add(channel = new TileRequestChannel(name, this.httpConcurrency));\n\n return channel;\n }\n\n /** Iterator over all of the channels. */\n public [Symbol.iterator](): Iterator<TileRequestChannel> {\n return this._channels.values()[Symbol.iterator]();\n }\n\n /** The maximum number of active requests for a channel that uses an RpcInterface to satisfy its requests.\n * For web-based applications, this is the same as [[httpConcurrency]], but for [[IpcApp]]s it is determined by the number of workers threads allocated by the backend.\n */\n public get rpcConcurrency(): number {\n return this._rpcConcurrency;\n }\n\n /** @internal */\n public getIModelTileChannel(tile: IModelTile): TileRequestChannel {\n return this.iModelChannels.getChannelForTile(tile);\n }\n\n /** Chiefly for debugging.\n * @internal\n */\n public setRpcConcurrency(concurrency: number): void {\n this._rpcConcurrency = concurrency;\n this.iModelChannels.setRpcConcurrency(concurrency);\n this.elementGraphicsRpc.concurrency = concurrency;\n }\n\n /** Statistics intended primarily for debugging. */\n public get statistics(): TileRequestChannelStatistics {\n const stats = new TileRequestChannelStatistics();\n for (const channel of this)\n channel.statistics.addTo(stats);\n\n return stats;\n }\n\n /** Reset all [[statistics]] to zero. */\n public resetStatistics(): void {\n for (const channel of this)\n channel.resetStatistics();\n }\n\n /** Invoked by [[TileAdmin.processQueue]] when it is about to start enqueuing new requests.\n * @internal\n */\n public swapPending(): void {\n for (const channel of this)\n channel.swapPending();\n }\n\n /** Invoked by [[TileAdmin.processQueue]] when it is about to start enqueuing new requests.\n * @internal\n */\n public process(): void {\n for (const channel of this)\n channel.process();\n }\n\n /** Invoked by [[TileAdmin.onIModelClosed]].\n * @internal\n */\n public onIModelClosed(iModel: IModelConnection): void {\n for (const channel of this)\n channel.onIModelClosed(iModel);\n }\n\n /** Invoked by [[TileAdmin.onShutDown]].\n * @internal\n */\n public onShutDown(): void {\n for (const channel of this)\n channel.cancelAndClearAll();\n\n this._channels.clear();\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TileStorage.js","sourceRoot":"","sources":["../../../src/tile/TileStorage.ts"],"names":[],"mappings":";;;AAKA,oDAAoG;AAEpG,YAAY;AACZ,MAAa,WAAW;IACtB,YAAmC,OAAwB;QAAxB,YAAO,GAAP,OAAO,CAAiB;QAEnD,qBAAgB,GAA4C,IAAI,GAAG,EAAE,CAAC;QACtE,mCAA8B,GAAqD,IAAI,GAAG,EAAE,CAAC;IAHtC,CAAC;IAKzD,KAAK,CAAC,YAAY,CACvB,UAA0B,EAC1B,QAAgB,EAChB,WAAmB,EACnB,MAAc,EACd,SAAiB,EACjB,IAAa;QAEb,MAAM,cAAc,GAAG,MAAM,IAA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,KAAK,IAAI,EAAE;YAC1B,MAAM,MAAM,GAAG,MAAM,oCAAsB,CAAC,SAAS,EAAE,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;YACvF,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAC5C,IAAI,CAAC,8BAA8B,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YACrD,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,EAAE,CAAC;QACL,IAAI,CAAC,8BAA8B,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC3D,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA1DD,kCA0DC","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\nimport type { FrontendStorage, TransferConfig } from \"@itwin/object-storage-core/lib/frontend\";\r\nimport { getTileObjectReference, IModelRpcProps, IModelTileRpcInterface } from \"@itwin/core-common\";\r\n\r\n/** @beta */\r\nexport class TileStorage {\r\n public constructor(public readonly storage: FrontendStorage) { }\r\n\r\n private _transferConfigs: Map<string, TransferConfig | undefined> = new Map();\r\n private _pendingTransferConfigRequests: Map<string, Promise<TransferConfig | undefined>> = new Map();\r\n\r\n public async downloadTile(\r\n tokenProps: IModelRpcProps,\r\n iModelId: string,\r\n changesetId: string,\r\n treeId: string,\r\n contentId: string,\r\n guid?: string\r\n ): Promise<Uint8Array | undefined> {\r\n const transferConfig = await this.getTransferConfig(tokenProps, iModelId);\r\n if(transferConfig === undefined)\r\n return undefined;\r\n try {\r\n const buffer = await this.storage.download({\r\n reference: getTileObjectReference(iModelId, changesetId, treeId, contentId, guid),\r\n transferConfig,\r\n transferType: \"buffer\",\r\n });\r\n\r\n return new Uint8Array(buffer); // should always be Buffer because transferType === \"buffer\"\r\n } catch (_) {\r\n // @itwin/object-storage re-throws internal implementation-specific errors, so let's treat them all as 404 for now.\r\n return undefined;\r\n }\r\n }\r\n\r\n private async getTransferConfig(tokenProps: IModelRpcProps, iModelId: string): Promise<TransferConfig | undefined> {\r\n if(this._transferConfigs.has(iModelId)) {\r\n const transferConfig = this._transferConfigs.get(iModelId);\r\n if(transferConfig === undefined)\r\n return undefined;\r\n if(transferConfig.expiration > new Date())\r\n return transferConfig;\r\n else // Refresh expired transferConfig\r\n return this.sendTransferConfigRequest(tokenProps, iModelId);\r\n }\r\n return this.sendTransferConfigRequest(tokenProps, iModelId);\r\n }\r\n\r\n private async sendTransferConfigRequest(tokenProps: IModelRpcProps, iModelId: string): Promise<TransferConfig | undefined> {\r\n const pendingRequest = this._pendingTransferConfigRequests.get(iModelId);\r\n if(pendingRequest !== undefined)\r\n return pendingRequest;\r\n\r\n const request = (async () => {\r\n const config = await IModelTileRpcInterface.getClient().getTileCacheConfig(tokenProps);\r\n this._transferConfigs.set(iModelId, config);\r\n this._pendingTransferConfigRequests.delete(iModelId);\r\n return config;\r\n })();\r\n this._pendingTransferConfigRequests.set(iModelId, request);\r\n return request;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"TileStorage.js","sourceRoot":"","sources":["../../../src/tile/TileStorage.ts"],"names":[],"mappings":";;;AAKA,oDAAoG;AAEpG,YAAY;AACZ,MAAa,WAAW;IACtB,YAAmC,OAAwB;QAAxB,YAAO,GAAP,OAAO,CAAiB;QAEnD,qBAAgB,GAA4C,IAAI,GAAG,EAAE,CAAC;QACtE,mCAA8B,GAAqD,IAAI,GAAG,EAAE,CAAC;IAHtC,CAAC;IAKzD,KAAK,CAAC,YAAY,CACvB,UAA0B,EAC1B,QAAgB,EAChB,WAAmB,EACnB,MAAc,EACd,SAAiB,EACjB,IAAa;QAEb,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAC1E,IAAG,cAAc,KAAK,SAAS;YA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kB,CAAC,UAAU,CAAC,CAAC;YACvF,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAC5C,IAAI,CAAC,8BAA8B,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YACrD,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,EAAE,CAAC;QACL,IAAI,CAAC,8BAA8B,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC3D,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA1DD,kCA0DC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type { FrontendStorage, TransferConfig } from \"@itwin/object-storage-core/lib/frontend\";\nimport { getTileObjectReference, IModelRpcProps, IModelTileRpcInterface } from \"@itwin/core-common\";\n\n/** @beta */\nexport class TileStorage {\n public constructor(public readonly storage: FrontendStorage) { }\n\n private _transferConfigs: Map<string, TransferConfig | undefined> = new Map();\n private _pendingTransferConfigRequests: Map<string, Promise<TransferConfig | undefined>> = new Map();\n\n public async downloadTile(\n tokenProps: IModelRpcProps,\n iModelId: string,\n changesetId: string,\n treeId: string,\n contentId: string,\n guid?: string\n ): Promise<Uint8Array | undefined> {\n const transferConfig = await this.getTransferConfig(tokenProps, iModelId);\n if(transferConfig === undefined)\n return undefined;\n try {\n const buffer = await this.storage.download({\n reference: getTileObjectReference(iModelId, changesetId, treeId, contentId, guid),\n transferConfig,\n transferType: \"buffer\",\n });\n\n return new Uint8Array(buffer); // should always be Buffer because transferType === \"buffer\"\n } catch (_) {\n // @itwin/object-storage re-throws internal implementation-specific errors, so let's treat them all as 404 for now.\n return undefined;\n }\n }\n\n private async getTransferConfig(tokenProps: IModelRpcProps, iModelId: string): Promise<TransferConfig | undefined> {\n if(this._transferConfigs.has(iModelId)) {\n const transferConfig = this._transferConfigs.get(iModelId);\n if(transferConfig === undefined)\n return undefined;\n if(transferConfig.expiration > new Date())\n return transferConfig;\n else // Refresh expired transferConfig\n return this.sendTransferConfigRequest(tokenProps, iModelId);\n }\n return this.sendTransferConfigRequest(tokenProps, iModelId);\n }\n\n private async sendTransferConfigRequest(tokenProps: IModelRpcProps, iModelId: string): Promise<TransferConfig | undefined> {\n const pendingRequest = this._pendingTransferConfigRequests.get(iModelId);\n if(pendingRequest !== undefined)\n return pendingRequest;\n\n const request = (async () => {\n const config = await IModelTileRpcInterface.getClient().getTileCacheConfig(tokenProps);\n this._transferConfigs.set(iModelId, config);\n this._pendingTransferConfigRequests.delete(iModelId);\n return config;\n })();\n this._pendingTransferConfigRequests.set(iModelId, request);\n return request;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TileTree.js","sourceRoot":"","sources":["../../../src/tile/TileTree.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAmF;AAGnF,oEAAgF;AAChF,4CAAyC;AAMzC;;;;GAIG;AACH,IAAY,kBASX;AATD,WAAY,kBAAkB;IAC5B,0DAA0D;IAC1D,qEAAS,CAAA;IACT,uDAAuD;IACvD,iEAAO,CAAA;IACP,kDAAkD;IAClD,+DAAM,CAAA;IACN,+CAA+C;IAC/C,mEAAQ,CAAA;AACV,CAAC,EATW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAS7B;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAsB,QAAQ;IAkB5B,gBAAgB;IAChB,IAAW,YAAY,KAAuB,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;IAe1E,kGAAkG;IAClG,IAAW,kBAAkB;QAC3B,OAAO,KAAK,CAAC;IACf,CAAC;IAWD,mDAAmD;IACnD,IAAW,IAAI,KAAc,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACjD,gBAAgB;IAChB,IAAW,YAAY,KAAc,OAAO,KAAK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,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,IAAA,4DAAoC,EAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACjF,QAAQ,GAAG,QAAQ,EAAE,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;AAnJD,4BAmJC","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 * @extensions\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 * @extensions\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, args.touchedTiles);\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"]}
1
+ {"version":3,"file":"TileTree.js","sourceRoot":"","sources":["../../../src/tile/TileTree.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAmF;AAGnF,oEAAgF;AAChF,4CAAyC;AAMzC;;;;GAIG;AACH,IAAY,kBASX;AATD,WAAY,kBAAkB;IAC5B,0DAA0D;IAC1D,qEAAS,CAAA;IACT,uDAAuD;IACvD,iEAAO,CAAA;IACP,kDAAkD;IAClD,+DAAM,CAAA;IACN,+CAA+C;IAC/C,mEAAQ,CAAA;AACV,CAAC,EATW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAS7B;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAsB,QAAQ;IAkB5B,gBAAgB;IAChB,IAAW,YAAY,KAAuB,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;IAe1E,kGAAkG;IAClG,IAAW,kBAAkB;QAC3B,OAAO,KAAK,CAAC;IACf,CAAC;IAWD,mDAAmD;IACnD,IAAW,IAAI,KAAc,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACjD,gBAAgB;IAChB,IAAW,YAAY,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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,IAAA,4DAAoC,EAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACjF,QAAQ,GAAG,QAAQ,EAAE,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;AAnJD,4BAmJC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tiles\n */\n\nimport { BeDuration, BeTimePoint, dispose, Id64String } from \"@itwin/core-bentley\";\nimport { Matrix4d, Range3d, Transform } from \"@itwin/core-geometry\";\nimport { ElementAlignedBox3d, FrustumPlanes, ViewFlagOverrides } from \"@itwin/core-common\";\nimport { calculateEcefToDbTransformAtLocation } from \"../BackgroundMapGeometry\";\nimport { IModelApp } from \"../IModelApp\";\nimport { IModelConnection } from \"../IModelConnection\";\nimport { RenderClipVolume } from \"../render/RenderClipVolume\";\nimport { RenderMemory } from \"../render/RenderMemory\";\nimport { Tile, TileDrawArgs, TileGeometryCollector, TileLoadPriority, TileTreeParams } from \"./internal\";\n\n/** Describes the current state of a [[TileTree]]. TileTrees are loaded asynchronously and may be unloaded after a period of disuse.\n * @see [[TileTreeOwner]].\n * @public\n * @extensions\n */\nexport enum TileTreeLoadStatus {\n /** No attempt to load the tile tree has yet been made. */\n NotLoaded,\n /** The tile tree is in the process of being loaded. */\n Loading,\n /** The tile tree has been successfully loaded. */\n Loaded,\n /** An attempt to load the tile tree failed. */\n NotFound,\n}\n\n/** A hierarchical level-of-detail tree of [3d Tiles](https://github.com/CesiumGS/3d-tiles) to be rendered in a [[Viewport]].\n * Tile trees originate from a variety of sources:\n * - Each [[GeometricModelState]] can supply its graphics as a tile tree;\n * - A [[DisplayStyleState]]'s map settings or reality models;\n * - [ViewAttachment]($backend)s in a [[SheetModelState]];\n * - [[TiledGraphicsProvider]]s associated with a viewport.\n *\n * The same TileTree can be displayed in any number of viewports using multiple [[TileTreeReference]]s.\n * A TileTree's lifetime is managed by a [[TileTreeOwner]].\n *\n * @note Some methods carry a warning that they should **not** be overridden by subclasses; typically a protected method exists that can be\n * overridden instead to customize the behavior. For example, [[selectTiles]] should not be overridden; instead, override the[[_selectTiles]] method\n * that it calls.\n * @public\n * @extensions\n */\nexport abstract class TileTree {\n private _isDisposed = false;\n /** @internal */\n protected _lastSelected = BeTimePoint.now();\n /** @internal */\n protected _clipVolume?: RenderClipVolume;\n public readonly iModel: IModelConnection;\n /** Transform from this tile tree's coordinate space to the iModel's coordinate space. */\n public readonly iModelTransform: Transform;\n /** Uniquely identifies this tree among all other tile trees associated with the iModel. */\n public readonly id: string;\n /** A 64-bit identifier for this tile tree, unique within the context of its [[IModelConnection]].\n * For a tile tree associated with a [[GeometricModelState]], this is the Id of the model. Other types of tile trees\n * typically use a transient Id obtained from [[IModelConnection.transientIds]].\n */\n public readonly modelId: Id64String;\n /** The length of time after which tiles belonging to this tree are considered elegible for disposal if they are no longer in use. */\n public readonly expirationTime: BeDuration;\n /** @internal */\n public get loadPriority(): TileLoadPriority { return this._loadPriority; }\n private readonly _loadPriority: TileLoadPriority;\n /** Optional tight bounding box around the entire contents of all of this tree's tiles. */\n public readonly contentRange?: ElementAlignedBox3d;\n\n /** The lowest-resolution tile in this tree. */\n public abstract get rootTile(): Tile;\n /** True if this tile tree contains 3d graphics. */\n public abstract get is3d(): boolean;\n /** Returns the maximum depth of this tree, if any. */\n public abstract get maxDepth(): number | undefined;\n\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. */\n public abstract get viewFlagOverrides(): ViewFlagOverrides;\n\n /** True if this tile tree has no bounds - e.g., a tile tree representing a globe is unbounded. */\n public get isContentUnbounded(): boolean {\n return false;\n }\n\n /** Implement this method to select tiles of appropriate resolution. */\n protected abstract _selectTiles(args: TileDrawArgs): Tile[];\n\n /** Produce graphics of appropriate resolution to be drawn in a [[Viewport]]. */\n public abstract draw(args: TileDrawArgs): void;\n\n /** Discard tiles and/or tile contents, presumably based on a least-recently-used and/or least-likely-to-be-needed criterion. */\n public abstract prune(): void;\n\n /** True if this tile tree contains 2d graphics. */\n public get is2d(): boolean { return !this.is3d; }\n /** @internal */\n public get isPointCloud(): boolean { return false; }\n /** @internal */\n public get clipVolume(): RenderClipVolume | undefined { return this._clipVolume; }\n\n /** The volume of space occupied by this tile tree. */\n public get range(): ElementAlignedBox3d { return this.rootTile.range; }\n /** The most recent time at which tiles [[selectTiles]] was called. */\n public get lastSelectedTime(): BeTimePoint { return this._lastSelected; }\n /** True if a tile and its child tiles should not be drawn simultaneously.\n * Default: true.\n */\n public get parentsAndChildrenExclusive(): boolean { return true; }\n\n /** Constructor */\n protected constructor(params: TileTreeParams) {\n this._lastSelected = BeTimePoint.now();\n this.iModel = params.iModel;\n this.iModelTransform = params.location;\n this._clipVolume = params.clipVolume;\n this.modelId = params.modelId;\n this.id = params.id;\n this.contentRange = params.contentRange;\n\n const admin = IModelApp.tileAdmin;\n this._loadPriority = params.priority;\n this.expirationTime = params.expirationTime ?? admin.tileExpirationTime;\n }\n\n /** Selects tiles of appropriate resolution for some purpose like drawing to the screen, producing a shadow map, etc.\n * @note Do **not** override this method. Implement [[_selectTiles]].\n */\n public selectTiles(args: TileDrawArgs): Tile[] {\n this._lastSelected = BeTimePoint.now();\n const tiles = this._selectTiles(args);\n IModelApp.tileAdmin.addTilesForUser(args.context.viewport, tiles, args.readyTiles, args.touchedTiles);\n args.processSelectedTiles(tiles);\n return tiles;\n }\n\n /** True if [[dispose]] has been called on this tile tree. */\n public get isDisposed(): boolean { return this._isDisposed; }\n\n /** Dispose of this tree and any resources owned by it. This is typically invoked by a [[TileTreeOwner]]. */\n public dispose(): void {\n if (this.isDisposed)\n return;\n\n this._isDisposed = true;\n dispose(this.rootTile);\n }\n\n /** @internal */\n public collectStatistics(stats: RenderMemory.Statistics): void {\n this.rootTile.collectStatistics(stats);\n }\n\n /** Returns the number of [[Tile]]s currently in memory belonging to this tree, primarily for debugging. */\n public countTiles(): number {\n return 1 + this.rootTile.countDescendants();\n }\n\n /** @internal */\n public accumulateTransformedRange(range: Range3d, matrix: Matrix4d, location: Transform, frustumPlanes?: FrustumPlanes): void {\n this.rootTile.extendRangeForContent(range, matrix, location, frustumPlanes);\n }\n\n /**\n * Return the transform from the tile tree's coordinate space to [ECEF](https://en.wikipedia.org/wiki/ECEF) (Earth Centered Earth Fixed) coordinates.\n * If a geographic coordinate system is present then this transform will be calculated at the tile tree center.\n * @beta\n */\n public async getEcefTransform(): Promise<Transform | undefined> {\n if (!this.iModel.ecefLocation)\n return undefined;\n\n let dbToEcef: Transform | undefined;\n const range = this.contentRange ? this.contentRange : this.range;\n const center = range.localXYZToWorld(.5, .5, .5);\n if (center) {\n this.iModelTransform.multiplyPoint3d(center, center);\n const ecefToDb = await calculateEcefToDbTransformAtLocation(center, this.iModel);\n dbToEcef = ecefToDb?.inverse();\n }\n if (!dbToEcef)\n dbToEcef = this.iModel.ecefLocation.getTransform();\n\n return dbToEcef.multiplyTransformTransform(this.iModelTransform);\n }\n\n /** Populate [[TileGeometryCollector.polyfaces]] with geometry obtained from this tile tree's tiles satisfying the collector's criteria.\n * The base implementation does nothing.\n * @see [[TileTreeReference.createGeometryTreeReference]] to attempt to create a TileTree that can collect geometry.\n * @beta\n */\n public collectTileGeometry(_collector: TileGeometryCollector): void {\n }\n}\n\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TileTreeOwner.js","sourceRoot":"","sources":["../../../src/tile/TileTreeOwner.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG","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 { IModelConnection } from \"../IModelConnection\";\r\nimport { TileTree, TileTreeLoadStatus } from \"./internal\";\r\n\r\n/** Owns and manages the lifecycle of a [[TileTree]]. It is in turn owned by an IModelConnection.Tiles object.\r\n * @note The *only* legitimate way to obtain a TileTreeOwner is via [[Tiles.getTileTreeOwner]].\r\n * @see [[TileTreeReference]] for an indirect reference to a TileTree by way of a TileTreeOwner.\r\n * @see [[Tiles.getTileTreeOwner]] to obtain a TileTreeOwner.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface TileTreeOwner {\r\n /** The iModel for this TileTree */\r\n readonly iModel: IModelConnection;\r\n\r\n /** The owned [[TileTree]], or `undefined` if the tile tree is not loaded.\r\n * @note Do not store a direct reference to the TileTree, because it may become disposed by its owner.\r\n * @see [[TileTreeOwner.load]] to ensure the tree is enqueued for loading if necessary.\r\n */\r\n readonly tileTree: TileTree | undefined;\r\n\r\n /** The current load state of the tree. This can be reset to NotLoaded after loading if the owner becomes disposed or the tree is not used for a long period of time.\r\n * [[tileTree]] will be `undefined` unless `loadStatus` is [[TileTreeLoadStatus.Loaded]].\r\n * @see [[TileTreeOwner.load]] to ensure the tree is enqueued for loading if necessary.\r\n */\r\n readonly loadStatus: TileTreeLoadStatus;\r\n\r\n /** If the TileTree has not yet been loaded ([[loadStatus]] is [[TileTreeStatus.NotLoaded]]), enqueue an asynchronous request to load it (changing [[loadStatus]] to [[TileTreeLoadStatus.Loading]]).\r\n * [[loadStatus]] will be updated to [[TileTreeLoadStatus.Loaded]] when that request succeeds, or [[TileTreeLoadStatus.NotFound]] if the request fails.\r\n * @returns the loaded TileTree if loading completed successfully, or undefined if the tree is still loading or loading failed.\r\n */\r\n load(): TileTree | undefined;\r\n\r\n /** Do not call this directly.\r\n * @internal\r\n */\r\n dispose(): void;\r\n\r\n /** Waits for [[load]], then resolves. It is generally preferable to call [[load]] directly rather than `await`ing this method. */\r\n loadTree(): Promise<TileTree | undefined>;\r\n}\r\n"]}
1
+ {"version":3,"file":"TileTreeOwner.js","sourceRoot":"","sources":["../../../src/tile/TileTreeOwner.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tiles\n */\n\nimport { IModelConnection } from \"../IModelConnection\";\nimport { TileTree, TileTreeLoadStatus } from \"./internal\";\n\n/** Owns and manages the lifecycle of a [[TileTree]]. It is in turn owned by an IModelConnection.Tiles object.\n * @note The *only* legitimate way to obtain a TileTreeOwner is via [[Tiles.getTileTreeOwner]].\n * @see [[TileTreeReference]] for an indirect reference to a TileTree by way of a TileTreeOwner.\n * @see [[Tiles.getTileTreeOwner]] to obtain a TileTreeOwner.\n * @public\n * @extensions\n */\nexport interface TileTreeOwner {\n /** The iModel for this TileTree */\n readonly iModel: IModelConnection;\n\n /** The owned [[TileTree]], or `undefined` if the tile tree is not loaded.\n * @note Do not store a direct reference to the TileTree, because it may become disposed by its owner.\n * @see [[TileTreeOwner.load]] to ensure the tree is enqueued for loading if necessary.\n */\n readonly tileTree: TileTree | undefined;\n\n /** The current load state of the tree. This can be reset to NotLoaded after loading if the owner becomes disposed or the tree is not used for a long period of time.\n * [[tileTree]] will be `undefined` unless `loadStatus` is [[TileTreeLoadStatus.Loaded]].\n * @see [[TileTreeOwner.load]] to ensure the tree is enqueued for loading if necessary.\n */\n readonly loadStatus: TileTreeLoadStatus;\n\n /** If the TileTree has not yet been loaded ([[loadStatus]] is [[TileTreeStatus.NotLoaded]]), enqueue an asynchronous request to load it (changing [[loadStatus]] to [[TileTreeLoadStatus.Loading]]).\n * [[loadStatus]] will be updated to [[TileTreeLoadStatus.Loaded]] when that request succeeds, or [[TileTreeLoadStatus.NotFound]] if the request fails.\n * @returns the loaded TileTree if loading completed successfully, or undefined if the tree is still loading or loading failed.\n */\n load(): TileTree | undefined;\n\n /** Do not call this directly.\n * @internal\n */\n dispose(): void;\n\n /** Waits for [[load]], then resolves. It is generally preferable to call [[load]] directly rather than `await`ing this method. */\n loadTree(): Promise<TileTree | undefined>;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TileTreeParams.js","sourceRoot":"","sources":["../../../src/tile/TileTreeParams.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG","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, Id64String } from \"@itwin/core-bentley\";\r\nimport { Transform } from \"@itwin/core-geometry\";\r\nimport { ElementAlignedBox3d } from \"@itwin/core-common\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { RenderClipVolume } from \"../render/RenderClipVolume\";\r\nimport { TileLoadPriority } from \"./internal\";\r\n\r\n/** Parameters used to construct a [[TileTree]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface TileTreeParams {\r\n /** Uniquely identifies the tile tree in the context of the [[IModelConnection]]. */\r\n id: string;\r\n /** A 64-bit identifier for the 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 modelId: Id64String;\r\n /** The IModelConnection to which the tile tree belongs. The tile tree will be disposed of when the IModelConnection is closed. */\r\n iModel: IModelConnection;\r\n /** Transform from tile tree coordinates to iModel coordinates. */\r\n location: Transform;\r\n /** Optional clip volume applied to all tiles in the tree. */\r\n clipVolume?: RenderClipVolume;\r\n /** Loose description of the \"importance\" of the tiles exposed by this tile tree, used for prioritizing requests for tile content. */\r\n priority: TileLoadPriority;\r\n /** Optional volume tightly encompassing the contents of this tile tree - used for more accurate culling. */\r\n contentRange?: ElementAlignedBox3d;\r\n /** Optionally specifies the amount of time before tiles belonging to this tile tree are considered eligible for disposal after disuse.\r\n * If unspecified, a default expiration time is chosen based on the tile tree's [[priority]].\r\n * @see [[TileTree.prune]]\r\n */\r\n expirationTime?: BeDuration;\r\n}\r\n"]}
1
+ {"version":3,"file":"TileTreeParams.js","sourceRoot":"","sources":["../../../src/tile/TileTreeParams.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tiles\n */\n\nimport { BeDuration, Id64String } from \"@itwin/core-bentley\";\nimport { Transform } from \"@itwin/core-geometry\";\nimport { ElementAlignedBox3d } from \"@itwin/core-common\";\nimport { IModelConnection } from \"../IModelConnection\";\nimport { RenderClipVolume } from \"../render/RenderClipVolume\";\nimport { TileLoadPriority } from \"./internal\";\n\n/** Parameters used to construct a [[TileTree]].\n * @public\n * @extensions\n */\nexport interface TileTreeParams {\n /** Uniquely identifies the tile tree in the context of the [[IModelConnection]]. */\n id: string;\n /** A 64-bit identifier for the tile tree, unique within the context of its [[IModelConnection]].\n * For a tile tree associated with a [[GeometricModelState]], this is the Id of the model. Other types of tile trees\n * typically use a transient Id obtained from [[IModelConnection.transientIds]].\n */\n modelId: Id64String;\n /** The IModelConnection to which the tile tree belongs. The tile tree will be disposed of when the IModelConnection is closed. */\n iModel: IModelConnection;\n /** Transform from tile tree coordinates to iModel coordinates. */\n location: Transform;\n /** Optional clip volume applied to all tiles in the tree. */\n clipVolume?: RenderClipVolume;\n /** Loose description of the \"importance\" of the tiles exposed by this tile tree, used for prioritizing requests for tile content. */\n priority: TileLoadPriority;\n /** Optional volume tightly encompassing the contents of this tile tree - used for more accurate culling. */\n contentRange?: ElementAlignedBox3d;\n /** Optionally specifies the amount of time before tiles belonging to this tile tree are considered eligible for disposal after disuse.\n * If unspecified, a default expiration time is chosen based on the tile tree's [[priority]].\n * @see [[TileTree.prune]]\n */\n expirationTime?: BeDuration;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TileTreeReference.js","sourceRoot":"","sources":["../../../src/tile/TileTreeReference.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA0D;AAC1D,wDAA6E;AAC7E,oDAA0J;AAO1J,yCAEoB;AAEpB;;;GAGG;AACH,IAAY,eAOX;AAPD,WAAY,eAAe;IACzB,wDAAwD;IACxD,uEAAiB,CAAA;IACjB,2CAA2C;IAC3C,uDAAS,CAAA;IACT,+CAA+C;IAC/C,2DAAW,CAAA;AACb,CAAC,EAPW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAO1B;AAED;;;;;;;;;;GAUG;AACH,MAAsB,iBAAiB,CAAC,sCAAsC;IAI5E;mBACe;IACR,cAAc,KAAI,CAAC;IAE1B;;;OAGG;IACI,iBAAiB,CAAC,KAA2B;QAClD,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;QACrC,IAAI,SAAS,KAAK,IAAI;YACpB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IAED,qFAAqF;IAC9E,UAAU,CAAC,OAAqB;QACrC,MAAM,IAAI,GAAG,IAAI,C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CAAC,CAAC,CAAC;IAEhD;;;OAGG;IACH,IAAW,sBAAsB,KAAa,OAAO,oCAAsB,CAAC,WAAW,CAAC,CAAC,CAAC;IAE1F,iGAAiG;IAC1F,YAAY,CAAC,MAAwB,EAAE,GAAmB,IAAU,CAAC;IAE5E;;;;OAIG;IACO,4BAA4B;QACpC,OAAO,SAAS,CAAC;IACnB,CAAC;IAOD;;OAEG;IACO,oBAAoB,CAAC,SAAgC;QAC7D,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;QACnC,QAAQ,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE;YACjC,KAAK,6BAAkB,CAAC,MAAM;gBAC5B,IAAA,qBAAM,EAAC,SAAS,KAAK,IAAI,CAAC,CAAC;gBAC3B,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;gBACpC,MAAM;YACR,KAAK,6BAAkB,CAAC,OAAO;gBAC7B,SAAS,CAAC,WAAW,EAAE,CAAC;gBACxB,MAAM;SACT;IACH,CAAC;IAED;;;;;OAKG;IACI,2BAA2B;QAChC,IAAI,IAAI,CAAC,mBAAmB,EAAE;YAC5B,0KAA0K;YAC1K,OAAO,IAAiC,CAAC;SAC1C;QAED,OAAO,IAAI,CAAC,4BAA4B,EAAE,CAAC;IAC7C,CAAC;CACF;AA9OD,8CA8OC","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, BeTimePoint } from \"@itwin/core-bentley\";\r\nimport { Matrix4d, Range1d, Range3d, Transform } from \"@itwin/core-geometry\";\r\nimport { ElementAlignedBox3d, FeatureAppearanceProvider, FrustumPlanes, HiddenLine, PlanarClipMaskPriority, ViewFlagOverrides } from \"@itwin/core-common\";\r\nimport { HitDetail } from \"../HitDetail\";\r\nimport { FeatureSymbology } from \"../render/FeatureSymbology\";\r\nimport { RenderClipVolume } from \"../render/RenderClipVolume\";\r\nimport { RenderMemory } from \"../render/RenderMemory\";\r\nimport { DecorateContext, SceneContext } from \"../ViewContext\";\r\nimport { ScreenViewport } from \"../Viewport\";\r\nimport {\r\n DisclosedTileTreeSet, GeometryTileTreeReference, MapLayerFeatureInfo, TileDrawArgs, TileGeometryCollector, TileTree, TileTreeLoadStatus, TileTreeOwner,\r\n} from \"./internal\";\r\n\r\n/** Describes the type of graphics produced by a [[TileTreeReference]].\r\n * @public\r\n * @extensions\r\n */\r\nexport enum TileGraphicType {\r\n /** Rendered behind all other geometry without depth. */\r\n BackgroundMap = 0,\r\n /** Rendered with normal scene graphics. */\r\n Scene = 1,\r\n /** Rendered in front of all other geometry. */\r\n Overlay = 2,\r\n}\r\n\r\n/** 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\r\n * way of the tree's [[TileTreeOwner]].\r\n * The specific [[TileTree]] referenced by this object may change based on the current state of the Viewport in which it is drawn - for example,\r\n * as a result of changing the RenderMode, or animation settings, or classification settings, etc.\r\n * A reference to a TileTree is typically associated with a [[ViewState]], a [[DisplayStyleState]], or a [[Viewport]].\r\n * Multiple TileTreeReferences can refer to the same TileTree with different parameters and logic - for example, the same background map tiles can be displayed in two viewports with\r\n * differing levels of transparency.\r\n * @see [[TiledGraphicsProvider]] to supply custom [[TileTreeReference]]s to be drawn within a [[Viewport]].\r\n * @public\r\n * @extensions\r\n */\r\nexport abstract class TileTreeReference /* implements RenderMemory.Consumer */ {\r\n /** The owner of the currently-referenced [[TileTree]]. Do not store a direct reference to it, because it may change or become disposed at any time. */\r\n public abstract get treeOwner(): TileTreeOwner;\r\n\r\n /** Force a new tree owner / tile tree to be created for the current tile tree reference\r\n /* @internal */\r\n public resetTreeOwner() {}\r\n\r\n /** Disclose *all* TileTrees use by this reference. This may include things like map tiles used for draping on terrain.\r\n * Override this and call super if you have such auxiliary trees.\r\n * @note Any tree *NOT* disclosed becomes a candidate for *purging* (being unloaded from memory along with all of its tiles and graphics).\r\n */\r\n public discloseTileTrees(trees: DisclosedTileTreeSet): void {\r\n const tree = this.treeOwner.tileTree;\r\n if (undefined !== tree)\r\n trees.add(tree);\r\n }\r\n\r\n /** Adds this reference's graphics to the scene. By default this invokes [[draw]]. */\r\n public addToScene(context: SceneContext): void {\r\n const args = this.createDrawArgs(context);\r\n if (undefined !== args)\r\n this.draw(args);\r\n }\r\n\r\n /** Adds this reference's graphics to the scene. By default this invokes [[TileTree.draw]] on the referenced TileTree, if it is loaded. */\r\n public draw(args: TileDrawArgs): void {\r\n args.tree.draw(args);\r\n }\r\n\r\n /** Optionally return a tooltip describing the hit. */\r\n public async getToolTip(_hit: HitDetail): Promise<HTMLElement | string | undefined> { return undefined; }\r\n\r\n /** Optionally return a MapLayerFeatureInfo object describing the hit.].\r\n * @alpha\r\n */\r\n public async getMapFeatureInfo(_hit: HitDetail): Promise<MapLayerFeatureInfo[] | undefined> { return undefined; }\r\n\r\n /** Optionally add any decorations specific to this reference. For example, map tile trees may add a logo image and/or copyright attributions.\r\n * @note This is currently only invoked for background maps and TiledGraphicsProviders - others have no decorations, but if they did implement this it would not be called.\r\n */\r\n public decorate(_context: DecorateContext): void { }\r\n\r\n /** Unions this reference's range with the supplied range to help compute a volume in world space for fitting a viewport to its contents.\r\n * Override this function if a reference's range should not be included in the fit range, or a range different from its tile tree's range should be used.\r\n */\r\n public unionFitRange(union: Range3d): void {\r\n const contentRange = this.computeWorldContentRange();\r\n if (!contentRange.isNull)\r\n union.extendRange(contentRange);\r\n }\r\n\r\n /** Record graphics memory consumed by this tile tree reference. */\r\n public collectStatistics(stats: RenderMemory.Statistics): void {\r\n const tree = this.treeOwner.tileTree;\r\n if (undefined !== tree)\r\n tree.collectStatistics(stats);\r\n }\r\n\r\n /** Return true if the tile tree is fully loaded and ready to draw.\r\n * The default implementation returns true if the tile tree loading process completed (whether it resulted in success or failure).\r\n * @note Do *not* override this property - override [[_isLoadingComplete]] instead..\r\n * @public\r\n */\r\n public get isLoadingComplete(): boolean {\r\n switch (this.treeOwner.loadStatus) {\r\n case TileTreeLoadStatus.NotLoaded:\r\n case TileTreeLoadStatus.Loading:\r\n return false;\r\n case TileTreeLoadStatus.NotFound:\r\n return true; // we tried, and failed, to load.\r\n case TileTreeLoadStatus.Loaded:\r\n return this._isLoadingComplete;\r\n }\r\n }\r\n\r\n /** Override if additional asynchronous loading is required after the tile tree is successfully loaded, to indicate when that loading has completed.\r\n * @public\r\n */\r\n protected get _isLoadingComplete(): boolean {\r\n return true;\r\n }\r\n\r\n /** Create context for drawing the tile tree, if it is ready for drawing.\r\n * TileTreeReferences can override individual portions of the context, e.g. apply their own transform.\r\n * Returns undefined if, e.g., the tile tree is not yet loaded.\r\n */\r\n public createDrawArgs(context: SceneContext): TileDrawArgs | undefined {\r\n const tree = this.treeOwner.load();\r\n if (undefined === tree)\r\n return undefined;\r\n\r\n return new TileDrawArgs({\r\n context,\r\n tree,\r\n now: BeTimePoint.now(),\r\n location: this.computeTransform(tree),\r\n viewFlagOverrides: this.getViewFlagOverrides(tree),\r\n clipVolume: this.getClipVolume(tree),\r\n parentsAndChildrenExclusive: tree.parentsAndChildrenExclusive,\r\n symbologyOverrides: this.getSymbologyOverrides(tree),\r\n appearanceProvider: this.getAppearanceProvider(tree),\r\n hiddenLineSettings: this.getHiddenLineSettings(tree),\r\n animationTransformNodeId: this.getAnimationTransformNodeId(tree),\r\n });\r\n }\r\n\r\n /** @internal */\r\n protected getAnimationTransformNodeId(_tree: TileTree): number | undefined {\r\n return undefined;\r\n }\r\n\r\n /** Supply transform from this tile tree reference's location to iModel coordinate space.\r\n * @returns undefined if the TileTree is not yet loaded.\r\n */\r\n public getLocation(): Transform | undefined {\r\n const tree = this.treeOwner.load();\r\n return undefined !== tree ? this.computeTransform(tree) : undefined;\r\n }\r\n\r\n /** Compute a transform from this tile tree reference's coordinate space to the [[IModelConnection]]'s coordinate space. */\r\n protected computeTransform(tree: TileTree): Transform {\r\n return tree.iModelTransform.clone();\r\n }\r\n\r\n /** Compute the range of this tile tree's contents in world coordinates.\r\n * @returns The content range in world coodinates, or a null range if the tile tree is not loaded or has a null content range.\r\n */\r\n public computeWorldContentRange(): ElementAlignedBox3d {\r\n const range = new Range3d();\r\n const tree = this.treeOwner.tileTree;\r\n if (undefined !== tree && !tree.rootTile.contentRange.isNull)\r\n this.computeTransform(tree).multiplyRange(tree.rootTile.contentRange, range);\r\n\r\n return range;\r\n }\r\n\r\n /** Return the clip volume applied to this reference's tile tree, if any. */\r\n protected getClipVolume(tree: TileTree): RenderClipVolume | undefined {\r\n return tree.clipVolume;\r\n }\r\n\r\n /** Supply overrides that should be applied to the [[ViewState]]'s [ViewFlags]($common) when drawing this tile tree reference. */\r\n protected getViewFlagOverrides(tree: TileTree): ViewFlagOverrides {\r\n return tree.viewFlagOverrides;\r\n }\r\n\r\n /** Return overrides that *replace* any defined for the view. */\r\n protected getSymbologyOverrides(_tree: TileTree): FeatureSymbology.Overrides | undefined {\r\n return undefined;\r\n }\r\n\r\n /** Return a provider that can supplement the view's symbology overrides. */\r\n protected getAppearanceProvider(_tree: TileTree): FeatureAppearanceProvider | undefined {\r\n return undefined;\r\n }\r\n\r\n /** Return hidden line settings to replace those defined for the view. */\r\n protected getHiddenLineSettings(_tree: TileTree): HiddenLine.Settings | undefined {\r\n return undefined;\r\n }\r\n\r\n /* Extend range to include transformed range of this tile tree.\r\n * @internal\r\n */\r\n public accumulateTransformedRange(range: Range3d, matrix: Matrix4d, frustumPlanes?: FrustumPlanes) {\r\n const tree = this.treeOwner.tileTree;\r\n if (undefined === tree)\r\n return;\r\n\r\n const location = this.computeTransform(tree);\r\n tree.accumulateTransformedRange(range, matrix, location, frustumPlanes);\r\n }\r\n\r\n /** @internal */\r\n public getTerrainHeight(_terrainHeights: Range1d): void { }\r\n\r\n /** Return whether the geometry exposed by this tile tree reference should cast shadows on other geometry. */\r\n public get castsShadows(): boolean {\r\n return true;\r\n }\r\n\r\n /** Return whether this reference has global coverage. Mapping data is global and some non-primary models such as the OSM building layer have global coverage */\r\n public get isGlobal(): boolean { return false; }\r\n\r\n /** Return the clip mask priority for this model - models will be clipped by any other viewed model with a higher proirity.\r\n * BIM models have highest prioirty and are never clipped.\r\n * @alpha\r\n */\r\n public get planarclipMaskPriority(): number { return PlanarClipMaskPriority.DesignModel; }\r\n\r\n /** Add attribution logo cards for the tile tree source logo cards to the viewport's logo div. */\r\n public addLogoCards(_cards: HTMLTableElement, _vp: ScreenViewport): void { }\r\n\r\n /** Create a tile tree reference equivalent to this one that also supplies an implementation of [[GeometryTileTreeReference.collectTileGeometry]].\r\n * Return `undefined` if geometry collection is not supported.\r\n * @see [[createGeometryTreeReference]].\r\n * @beta\r\n */\r\n protected _createGeometryTreeReference(): GeometryTileTreeReference | undefined {\r\n return undefined;\r\n }\r\n\r\n /** If defined, supplies the implementation of [[GeometryTileTreeReference.collectTileGeometry]].\r\n * @beta\r\n */\r\n public collectTileGeometry?: (collector: TileGeometryCollector) => void;\r\n\r\n /** A function that can be assigned to [[collectTileGeometry]] to enable geometry collection for references to tile trees that support geometry collection.\r\n * @beta\r\n */\r\n protected _collectTileGeometry(collector: TileGeometryCollector): void {\r\n const tree = this.treeOwner.load();\r\n switch (this.treeOwner.loadStatus) {\r\n case TileTreeLoadStatus.Loaded:\r\n assert(undefined !== tree);\r\n tree.collectTileGeometry(collector);\r\n break;\r\n case TileTreeLoadStatus.Loading:\r\n collector.markLoading();\r\n break;\r\n }\r\n }\r\n\r\n /** Obtain a tile tree reference equivalent to this one that also supplies an implementation of [[GeometryTileTreeReference.collectTileGeometry]], or\r\n * undefined if geometry collection is not supported.\r\n * Currently, only terrain and reality model tiles support geometry collection.\r\n * @note Do not override this method - override [[_createGeometryTreeReference]] instead.\r\n * @beta\r\n */\r\n public createGeometryTreeReference(): GeometryTileTreeReference | undefined {\r\n if (this.collectTileGeometry) {\r\n // Unclear why compiler doesn't detect that `this` satisfies the GeometryTileTreeReference interface...it must be looking only at the types, not this particular instance.\r\n return this as GeometryTileTreeReference;\r\n }\r\n\r\n return this._createGeometryTreeReference();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"TileTreeReference.js","sourceRoot":"","sources":["../../../src/tile/TileTreeReference.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA0D;AAC1D,wDAA6E;AAC7E,oDAA0J;AAO1J,yCAEoB;AAEpB;;;GAGG;AACH,IAAY,eAOX;AAPD,WAAY,eAAe;IACzB,wDAAwD;IACxD,uEAAiB,CAAA;IACjB,2CAA2C;IAC3C,uDAAS,CAAA;IACT,+CAA+C;IAC/C,2DAAW,CAAA;AACb,CAAC,EAPW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAO1B;AAED;;;;;;;;;;GAUG;AACH,MAAsB,iBAAiB,CAAC,sCAAsC;IAI5E;mBACe;IACR,cAAc,KAAI,CAAC;IAE1B;;;OAGG;IACI,iBAAiB,CAAC,KAA2B;QAClD,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;QACrC,IAAI,SAAS,KAAK,IAAI;YACpB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IAED,qFAAqF;IAC9E,UAAU,CAAC,OAAqB;QACrC,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QAC1C,IAAI,SAAS,KAAK,IAAI;YACpB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IAED,0IAA0I;IACnI,IAAI,CAAC,IAAkB;QAC5B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAED,sDAAsD;IAC/C,KAAK,CAAC,UAAU,CAAC,IAAe,IAA+C,OAAO,SAAS,CAAC,CAAC,CAAC;IAEzG;;OAEG;IACI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QACnC,QAAQ,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE;YACjC,KAAK,6BAAkB,CAAC,MAAM;gBAC5B,IAAA,qBAAM,EAAC,SAAS,KAAK,IAAI,CAAC,CAAC;gBAC3B,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;gBACpC,MAAM;YACR,KAAK,6BAAkB,CAAC,OAAO;gBAC7B,SAAS,CAAC,WAAW,EAAE,CAAC;gBACxB,MAAM;SACT;IACH,CAAC;IAED;;;;;OAKG;IACI,2BAA2B;QAChC,IAAI,IAAI,CAAC,mBAAmB,EAAE;YAC5B,0KAA0K;YAC1K,OAAO,IAAiC,CAAC;SAC1C;QAED,OAAO,IAAI,CAAC,4BAA4B,EAAE,CAAC;IAC7C,CAAC;CACF;AA9OD,8CA8OC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tiles\n */\n\nimport { assert, BeTimePoint } from \"@itwin/core-bentley\";\nimport { Matrix4d, Range1d, Range3d, Transform } from \"@itwin/core-geometry\";\nimport { ElementAlignedBox3d, FeatureAppearanceProvider, FrustumPlanes, HiddenLine, PlanarClipMaskPriority, ViewFlagOverrides } from \"@itwin/core-common\";\nimport { HitDetail } from \"../HitDetail\";\nimport { FeatureSymbology } from \"../render/FeatureSymbology\";\nimport { RenderClipVolume } from \"../render/RenderClipVolume\";\nimport { RenderMemory } from \"../render/RenderMemory\";\nimport { DecorateContext, SceneContext } from \"../ViewContext\";\nimport { ScreenViewport } from \"../Viewport\";\nimport {\n DisclosedTileTreeSet, GeometryTileTreeReference, MapLayerFeatureInfo, TileDrawArgs, TileGeometryCollector, TileTree, TileTreeLoadStatus, TileTreeOwner,\n} from \"./internal\";\n\n/** Describes the type of graphics produced by a [[TileTreeReference]].\n * @public\n * @extensions\n */\nexport enum TileGraphicType {\n /** Rendered behind all other geometry without depth. */\n BackgroundMap = 0,\n /** Rendered with normal scene graphics. */\n Scene = 1,\n /** Rendered in front of all other geometry. */\n Overlay = 2,\n}\n\n/** 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\n * way of the tree's [[TileTreeOwner]].\n * The specific [[TileTree]] referenced by this object may change based on the current state of the Viewport in which it is drawn - for example,\n * as a result of changing the RenderMode, or animation settings, or classification settings, etc.\n * A reference to a TileTree is typically associated with a [[ViewState]], a [[DisplayStyleState]], or a [[Viewport]].\n * Multiple TileTreeReferences can refer to the same TileTree with different parameters and logic - for example, the same background map tiles can be displayed in two viewports with\n * differing levels of transparency.\n * @see [[TiledGraphicsProvider]] to supply custom [[TileTreeReference]]s to be drawn within a [[Viewport]].\n * @public\n * @extensions\n */\nexport abstract class TileTreeReference /* implements RenderMemory.Consumer */ {\n /** The owner of the currently-referenced [[TileTree]]. Do not store a direct reference to it, because it may change or become disposed at any time. */\n public abstract get treeOwner(): TileTreeOwner;\n\n /** Force a new tree owner / tile tree to be created for the current tile tree reference\n /* @internal */\n public resetTreeOwner() {}\n\n /** Disclose *all* TileTrees use by this reference. This may include things like map tiles used for draping on terrain.\n * Override this and call super if you have such auxiliary trees.\n * @note Any tree *NOT* disclosed becomes a candidate for *purging* (being unloaded from memory along with all of its tiles and graphics).\n */\n public discloseTileTrees(trees: DisclosedTileTreeSet): void {\n const tree = this.treeOwner.tileTree;\n if (undefined !== tree)\n trees.add(tree);\n }\n\n /** Adds this reference's graphics to the scene. By default this invokes [[draw]]. */\n public addToScene(context: SceneContext): void {\n const args = this.createDrawArgs(context);\n if (undefined !== args)\n this.draw(args);\n }\n\n /** Adds this reference's graphics to the scene. By default this invokes [[TileTree.draw]] on the referenced TileTree, if it is loaded. */\n public draw(args: TileDrawArgs): void {\n args.tree.draw(args);\n }\n\n /** Optionally return a tooltip describing the hit. */\n public async getToolTip(_hit: HitDetail): Promise<HTMLElement | string | undefined> { return undefined; }\n\n /** Optionally return a MapLayerFeatureInfo object describing the hit.].\n * @alpha\n */\n public async getMapFeatureInfo(_hit: HitDetail): Promise<MapLayerFeatureInfo[] | undefined> { return undefined; }\n\n /** Optionally add any decorations specific to this reference. For example, map tile trees may add a logo image and/or copyright attributions.\n * @note This is currently only invoked for background maps and TiledGraphicsProviders - others have no decorations, but if they did implement this it would not be called.\n */\n public decorate(_context: DecorateContext): void { }\n\n /** Unions this reference's range with the supplied range to help compute a volume in world space for fitting a viewport to its contents.\n * Override this function if a reference's range should not be included in the fit range, or a range different from its tile tree's range should be used.\n */\n public unionFitRange(union: Range3d): void {\n const contentRange = this.computeWorldContentRange();\n if (!contentRange.isNull)\n union.extendRange(contentRange);\n }\n\n /** Record graphics memory consumed by this tile tree reference. */\n public collectStatistics(stats: RenderMemory.Statistics): void {\n const tree = this.treeOwner.tileTree;\n if (undefined !== tree)\n tree.collectStatistics(stats);\n }\n\n /** Return true if the tile tree is fully loaded and ready to draw.\n * The default implementation returns true if the tile tree loading process completed (whether it resulted in success or failure).\n * @note Do *not* override this property - override [[_isLoadingComplete]] instead..\n * @public\n */\n public get isLoadingComplete(): boolean {\n switch (this.treeOwner.loadStatus) {\n case TileTreeLoadStatus.NotLoaded:\n case TileTreeLoadStatus.Loading:\n return false;\n case TileTreeLoadStatus.NotFound:\n return true; // we tried, and failed, to load.\n case TileTreeLoadStatus.Loaded:\n return this._isLoadingComplete;\n }\n }\n\n /** Override if additional asynchronous loading is required after the tile tree is successfully loaded, to indicate when that loading has completed.\n * @public\n */\n protected get _isLoadingComplete(): boolean {\n return true;\n }\n\n /** Create context for drawing the tile tree, if it is ready for drawing.\n * TileTreeReferences can override individual portions of the context, e.g. apply their own transform.\n * Returns undefined if, e.g., the tile tree is not yet loaded.\n */\n public createDrawArgs(context: SceneContext): TileDrawArgs | undefined {\n const tree = this.treeOwner.load();\n if (undefined === tree)\n return undefined;\n\n return new TileDrawArgs({\n context,\n tree,\n now: BeTimePoint.now(),\n location: this.computeTransform(tree),\n viewFlagOverrides: this.getViewFlagOverrides(tree),\n clipVolume: this.getClipVolume(tree),\n parentsAndChildrenExclusive: tree.parentsAndChildrenExclusive,\n symbologyOverrides: this.getSymbologyOverrides(tree),\n appearanceProvider: this.getAppearanceProvider(tree),\n hiddenLineSettings: this.getHiddenLineSettings(tree),\n animationTransformNodeId: this.getAnimationTransformNodeId(tree),\n });\n }\n\n /** @internal */\n protected getAnimationTransformNodeId(_tree: TileTree): number | undefined {\n return undefined;\n }\n\n /** Supply transform from this tile tree reference's location to iModel coordinate space.\n * @returns undefined if the TileTree is not yet loaded.\n */\n public getLocation(): Transform | undefined {\n const tree = this.treeOwner.load();\n return undefined !== tree ? this.computeTransform(tree) : undefined;\n }\n\n /** Compute a transform from this tile tree reference's coordinate space to the [[IModelConnection]]'s coordinate space. */\n protected computeTransform(tree: TileTree): Transform {\n return tree.iModelTransform.clone();\n }\n\n /** Compute the range of this tile tree's contents in world coordinates.\n * @returns The content range in world coodinates, or a null range if the tile tree is not loaded or has a null content range.\n */\n public computeWorldContentRange(): ElementAlignedBox3d {\n const range = new Range3d();\n const tree = this.treeOwner.tileTree;\n if (undefined !== tree && !tree.rootTile.contentRange.isNull)\n this.computeTransform(tree).multiplyRange(tree.rootTile.contentRange, range);\n\n return range;\n }\n\n /** Return the clip volume applied to this reference's tile tree, if any. */\n protected getClipVolume(tree: TileTree): RenderClipVolume | undefined {\n return tree.clipVolume;\n }\n\n /** Supply overrides that should be applied to the [[ViewState]]'s [ViewFlags]($common) when drawing this tile tree reference. */\n protected getViewFlagOverrides(tree: TileTree): ViewFlagOverrides {\n return tree.viewFlagOverrides;\n }\n\n /** Return overrides that *replace* any defined for the view. */\n protected getSymbologyOverrides(_tree: TileTree): FeatureSymbology.Overrides | undefined {\n return undefined;\n }\n\n /** Return a provider that can supplement the view's symbology overrides. */\n protected getAppearanceProvider(_tree: TileTree): FeatureAppearanceProvider | undefined {\n return undefined;\n }\n\n /** Return hidden line settings to replace those defined for the view. */\n protected getHiddenLineSettings(_tree: TileTree): HiddenLine.Settings | undefined {\n return undefined;\n }\n\n /* Extend range to include transformed range of this tile tree.\n * @internal\n */\n public accumulateTransformedRange(range: Range3d, matrix: Matrix4d, frustumPlanes?: FrustumPlanes) {\n const tree = this.treeOwner.tileTree;\n if (undefined === tree)\n return;\n\n const location = this.computeTransform(tree);\n tree.accumulateTransformedRange(range, matrix, location, frustumPlanes);\n }\n\n /** @internal */\n public getTerrainHeight(_terrainHeights: Range1d): void { }\n\n /** Return whether the geometry exposed by this tile tree reference should cast shadows on other geometry. */\n public get castsShadows(): boolean {\n return true;\n }\n\n /** Return whether this reference has global coverage. Mapping data is global and some non-primary models such as the OSM building layer have global coverage */\n public get isGlobal(): boolean { return false; }\n\n /** Return the clip mask priority for this model - models will be clipped by any other viewed model with a higher proirity.\n * BIM models have highest prioirty and are never clipped.\n * @alpha\n */\n public get planarclipMaskPriority(): number { return PlanarClipMaskPriority.DesignModel; }\n\n /** Add attribution logo cards for the tile tree source logo cards to the viewport's logo div. */\n public addLogoCards(_cards: HTMLTableElement, _vp: ScreenViewport): void { }\n\n /** Create a tile tree reference equivalent to this one that also supplies an implementation of [[GeometryTileTreeReference.collectTileGeometry]].\n * Return `undefined` if geometry collection is not supported.\n * @see [[createGeometryTreeReference]].\n * @beta\n */\n protected _createGeometryTreeReference(): GeometryTileTreeReference | undefined {\n return undefined;\n }\n\n /** If defined, supplies the implementation of [[GeometryTileTreeReference.collectTileGeometry]].\n * @beta\n */\n public collectTileGeometry?: (collector: TileGeometryCollector) => void;\n\n /** A function that can be assigned to [[collectTileGeometry]] to enable geometry collection for references to tile trees that support geometry collection.\n * @beta\n */\n protected _collectTileGeometry(collector: TileGeometryCollector): void {\n const tree = this.treeOwner.load();\n switch (this.treeOwner.loadStatus) {\n case TileTreeLoadStatus.Loaded:\n assert(undefined !== tree);\n tree.collectTileGeometry(collector);\n break;\n case TileTreeLoadStatus.Loading:\n collector.markLoading();\n break;\n }\n }\n\n /** Obtain a tile tree reference equivalent to this one that also supplies an implementation of [[GeometryTileTreeReference.collectTileGeometry]], or\n * undefined if geometry collection is not supported.\n * Currently, only terrain and reality model tiles support geometry collection.\n * @note Do not override this method - override [[_createGeometryTreeReference]] instead.\n * @beta\n */\n public createGeometryTreeReference(): GeometryTileTreeReference | undefined {\n if (this.collectTileGeometry) {\n // Unclear why compiler doesn't detect that `this` satisfies the GeometryTileTreeReference interface...it must be looking only at the types, not this particular instance.\n return this as GeometryTileTreeReference;\n }\n\n return this._createGeometryTreeReference();\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TileTreeSupplier.js","sourceRoot":"","sources":["../../../src/tile/TileTreeSupplier.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG","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 { Id64String } from \"@itwin/core-bentley\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { TileTree, TileTreeOwner } from \"./internal\";\r\n\r\n/** Interface adopted by an object which can supply a [[TileTree]] for rendering.\r\n * A supplier can supply any number of tile trees; the only requirement is that each tile tree has a unique identifier within the context of the supplier and a single IModelConnection.\r\n * The identifier can be any type, as only the supplier needs to be able to interpret it.\r\n * However, it is *essential* that the identifier is treated as immutable, because it is used as a lookup key in a sorted collection -\r\n * changes to its properties may affect comparison and therefore sorting order.\r\n * @see [[Tiles.getTileTreeOwner]] to obtain a tile tree from a supplier.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface TileTreeSupplier {\r\n /** Compare two tree Ids returning a negative number if `lhs` < rhs, a positive number if `lhs` > rhs, or 0 if the Ids are equivalent. */\r\n compareTileTreeIds(lhs: any, rhs: any): number;\r\n\r\n /** Produce the TileTree corresponding to the specified tree Id. The returned TileTree will be associated with its Id in a Map. */\r\n createTileTree(id: any, iModel: IModelConnection): Promise<TileTree | undefined>;\r\n\r\n /** `true` if this supplier is dependent upon the [[IModelConnection]]'s [EcefLocation]($common).\r\n * Typically this returns true for suppliers of tile trees for map tiles.\r\n * When the IModelConnection's ECEF location is modified (a relatively rare occurrence), all tile trees supplied by this supplier will be discarded, to be recreated using\r\n * the updated ECEF location whenever they are next requested.\r\n */\r\n readonly isEcefDependent?: true;\r\n\r\n /** Given the set of trees belonging to this supplier, add the modelIds associated with any trees that are animated by\r\n * the schedule script hosted by the specified RenderTimeline or DisplayStyle element.\r\n * @see [[Tiles.updateForScheduleScript]].\r\n * @internal\r\n */\r\n addModelsAnimatedByScript?: (modelIds: Set<Id64String>, scriptSourceId: Id64String, trees: Iterable<{ id: any, owner: TileTreeOwner }>) => void;\r\n\r\n /** Given the set of trees belonging to this supplier, add the modelIds associated with any trees representing spatial models.\r\n * @see [[Tiles.getSpatialModels]].\r\n * @internal\r\n */\r\n addSpatialModels?: (modelIds: Set<Id64String>, trees: Iterable<{ id: any, owner: TileTreeOwner }>) => void;\r\n}\r\n"]}
1
+ {"version":3,"file":"TileTreeSupplier.js","sourceRoot":"","sources":["../../../src/tile/TileTreeSupplier.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tiles\n */\n\nimport { Id64String } from \"@itwin/core-bentley\";\nimport { IModelConnection } from \"../IModelConnection\";\nimport { TileTree, TileTreeOwner } from \"./internal\";\n\n/** Interface adopted by an object which can supply a [[TileTree]] for rendering.\n * A supplier can supply any number of tile trees; the only requirement is that each tile tree has a unique identifier within the context of the supplier and a single IModelConnection.\n * The identifier can be any type, as only the supplier needs to be able to interpret it.\n * However, it is *essential* that the identifier is treated as immutable, because it is used as a lookup key in a sorted collection -\n * changes to its properties may affect comparison and therefore sorting order.\n * @see [[Tiles.getTileTreeOwner]] to obtain a tile tree from a supplier.\n * @public\n * @extensions\n */\nexport interface TileTreeSupplier {\n /** Compare two tree Ids returning a negative number if `lhs` < rhs, a positive number if `lhs` > rhs, or 0 if the Ids are equivalent. */\n compareTileTreeIds(lhs: any, rhs: any): number;\n\n /** Produce the TileTree corresponding to the specified tree Id. The returned TileTree will be associated with its Id in a Map. */\n createTileTree(id: any, iModel: IModelConnection): Promise<TileTree | undefined>;\n\n /** `true` if this supplier is dependent upon the [[IModelConnection]]'s [EcefLocation]($common).\n * Typically this returns true for suppliers of tile trees for map tiles.\n * When the IModelConnection's ECEF location is modified (a relatively rare occurrence), all tile trees supplied by this supplier will be discarded, to be recreated using\n * the updated ECEF location whenever they are next requested.\n */\n readonly isEcefDependent?: true;\n\n /** Given the set of trees belonging to this supplier, add the modelIds associated with any trees that are animated by\n * the schedule script hosted by the specified RenderTimeline or DisplayStyle element.\n * @see [[Tiles.updateForScheduleScript]].\n * @internal\n */\n addModelsAnimatedByScript?: (modelIds: Set<Id64String>, scriptSourceId: Id64String, trees: Iterable<{ id: any, owner: TileTreeOwner }>) => void;\n\n /** Given the set of trees belonging to this supplier, add the modelIds associated with any trees representing spatial models.\n * @see [[Tiles.getSpatialModels]].\n * @internal\n */\n addSpatialModels?: (modelIds: Set<Id64String>, trees: Iterable<{ id: any, owner: TileTreeOwner }>) => void;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TileUsageMarker.js","sourceRoot":"","sources":["../../../src/tile/TileUsageMarker.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAkD;AAClD,4CAAyC;AAGzC;;;;;;;;GAQG;AACH,MAAa,eAAe;IAG1B,+GAA+G;IAC/G;QAHQ,eAAU,GAAG,0BAAW,CAAC,GAAG,EAAE,CAAC;IAIvC,CAAC;IAED,sHAAsH;IAC/G,SAAS,CAAC,cAA2B;QAC1C,OAAO,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;IAC3E,CAAC;IAED,yEAAyE;IAClE,cAAc;QACnB,OAAO,qBAAS,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;IAED,0GAA0G;IACnG,kBAAkB,CAAC,cAA2B;QACnD,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAChD,CAAC;IAED,oHAAoH;IAC7G,IAAI,CAAC,IAAc,EAAE,IAAiB;QAC3C,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,qBAAS,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC/C,CAAC;CACF;AA3BD,0CA2BC","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 { BeTimePoint } from \"@itwin/core-bentley\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport { TileUser } from \"./internal\";\r\n\r\n/** A marker associated with a [[Tile]] to track usage of that tile by any number of [[TileUser]]s.\r\n * The marker tracks:\r\n * - the set of [[TileUser]]s by which the tile is in use for some purpose (displayed, preloaded, requested, selected for shadow map, etc); and\r\n * - the most recent time at which any tile user declared its use of the tile.\r\n * The marker is used to allow tiles to be discarded after they become disused by any tile user, via [[Tile.prune]].\r\n * @see [[Tile.usageMarker]].\r\n * @public\r\n * @extensions\r\n */\r\nexport class TileUsageMarker {\r\n private _timePoint = BeTimePoint.now();\r\n\r\n /** Constructs a usage marker with its timepoint set to the current time and its set of [[TileUser]]s empty. */\r\n public constructor() {\r\n }\r\n\r\n /** Returns true if this tile is currently in use by no [[TileUser]]s and its timestamp pre-dates `expirationTime`. */\r\n public isExpired(expirationTime: BeTimePoint): boolean {\r\n return this.isTimestampExpired(expirationTime) && !this.getIsTileInUse();\r\n }\r\n\r\n /** Returns true if this tile is currently in use by any [[TileUser]]. */\r\n public getIsTileInUse(): boolean {\r\n return IModelApp.tileAdmin.isTileInUse(this);\r\n }\r\n\r\n /** Returns true if this tile's timestamp pre-dates `expirationTime`, without checking if it is in use. */\r\n public isTimestampExpired(expirationTime: BeTimePoint): boolean {\r\n return this._timePoint.before(expirationTime);\r\n }\r\n\r\n /** Updates the timestamp to the specified time and marks the tile as being in use by the specified [[TileUser]]. */\r\n public mark(user: TileUser, time: BeTimePoint): void {\r\n this._timePoint = time;\r\n IModelApp.tileAdmin.markTileUsed(this, user);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"TileUsageMarker.js","sourceRoot":"","sources":["../../../src/tile/TileUsageMarker.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAkD;AAClD,4CAAyC;AAGzC;;;;;;;;GAQG;AACH,MAAa,eAAe;IAG1B,+GAA+G;IAC/G;QAHQ,eAAU,GAAG,0BAAW,CAAC,GAAG,EAAE,CAAC;IAIvC,CAAC;IAED,sHAAsH;IAC/G,SAAS,CAAC,cAA2B;QAC1C,OAAO,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;IAC3E,CAAC;IAED,yEAAyE;IAClE,cAAc;QACnB,OAAO,qBAAS,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;IAED,0GAA0G;IACnG,kBAAkB,CAAC,cAA2B;QACnD,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAChD,CAAC;IAED,oHAAoH;IAC7G,IAAI,CAAC,IAAc,EAAE,IAAiB;QAC3C,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,qBAAS,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC/C,CAAC;CACF;AA3BD,0CA2BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tiles\n */\n\nimport { BeTimePoint } from \"@itwin/core-bentley\";\nimport { IModelApp } from \"../IModelApp\";\nimport { TileUser } from \"./internal\";\n\n/** A marker associated with a [[Tile]] to track usage of that tile by any number of [[TileUser]]s.\n * The marker tracks:\n * - the set of [[TileUser]]s by which the tile is in use for some purpose (displayed, preloaded, requested, selected for shadow map, etc); and\n * - the most recent time at which any tile user declared its use of the tile.\n * The marker is used to allow tiles to be discarded after they become disused by any tile user, via [[Tile.prune]].\n * @see [[Tile.usageMarker]].\n * @public\n * @extensions\n */\nexport class TileUsageMarker {\n private _timePoint = BeTimePoint.now();\n\n /** Constructs a usage marker with its timepoint set to the current time and its set of [[TileUser]]s empty. */\n public constructor() {\n }\n\n /** Returns true if this tile is currently in use by no [[TileUser]]s and its timestamp pre-dates `expirationTime`. */\n public isExpired(expirationTime: BeTimePoint): boolean {\n return this.isTimestampExpired(expirationTime) && !this.getIsTileInUse();\n }\n\n /** Returns true if this tile is currently in use by any [[TileUser]]. */\n public getIsTileInUse(): boolean {\n return IModelApp.tileAdmin.isTileInUse(this);\n }\n\n /** Returns true if this tile's timestamp pre-dates `expirationTime`, without checking if it is in use. */\n public isTimestampExpired(expirationTime: BeTimePoint): boolean {\n return this._timePoint.before(expirationTime);\n }\n\n /** Updates the timestamp to the specified time and marks the tile as being in use by the specified [[TileUser]]. */\n public mark(user: TileUser, time: BeTimePoint): void {\n this._timePoint = time;\n IModelApp.tileAdmin.markTileUsed(this, user);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TileUser.js","sourceRoot":"","sources":["../../../src/tile/TileUser.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,0CAAuC;AAwBvC,IAAI,UAAU,GAAG,CAAC,CAAC;AAEnB,cAAc;AACd,IAAiB,QAAQ,CAWxB;AAXD,WAAiB,QAAQ;IACvB,SAAgB,UAAU;QACxB,OAAO,UAAU,EAAE,CAAC;IACtB,CAAC;IAFe,mBAAU,aAEzB,CAAA;IAED,4DAA4D;IAC5D,QAAgB,CAAC,CAAC,kBAAkB,CAAC,KAAyB;QAC5D,KAAK,MAAM,IAAI,IAAI,KAAK;YACtB,IAAI,IAAI,YAAY,mBAAQ;gBAC1B,MAAM,IAAI,CAAC;IACjB,CAAC;IAJiB,2BAAkB,qBAInC,CAAA;AACH,CAAC,EAXgB,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAWxB","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 { IModelConnection } from \"../IModelConnection\";\r\nimport { Viewport } from \"../Viewport\";\r\nimport { DisclosedTileTreeSet, TileRequest } from \"./internal\";\r\n\r\n/** Represents some object that makes use of [[Tile]]s in some way - e.g., by requesting and/or displaying their contents, querying their geometry, etc.\r\n * Each [[Tile]] keeps track of its users via its [[TileUsageMarker]]. A tile with no users is eligible to be discarded view [[Tile.prune]].\r\n * Every [[Viewport]] is a tile user. It is occasionally useful to have a tile user that is **not** a viewport.\r\n * Every TileUser is identified by an integer Id that is unique among all extant TileUsers. This Id **must** be obtained via [[TileUser.generateId]].\r\n * Every TileUser must be registered with [[IModelApp.tileAdmin]] before use via [[TileAdmin.registerUser]] and unregistered via [[TileAdmin.forgetUser]] after\r\n * it ceases using tiles.\r\n * @public\r\n */\r\nexport interface TileUser {\r\n /** A unique integer identifying this user amongst all extant users. This Id **must** be obtained via [[TIleUser.generateId]]. */\r\n readonly tileUserId: number;\r\n /** The iModel with which the user is associated. */\r\n readonly iModel: IModelConnection;\r\n /** Disclose all tile trees currently in use by this user. Any tile tree not disclosed by any user becomes eligible for garbage collection. */\r\n readonly discloseTileTrees: (trees: DisclosedTileTreeSet) => void;\r\n /** An optional function invoked when a [[TileRequest]] associated with a [[Tile]] in use by this user changes state - e.g., when the request completes, fails, or\r\n * is cancelled. For example, a [[Viewport]] responds to such events by invalidating its scene.\r\n */\r\n readonly onRequestStateChanged?: (req: TileRequest) => void;\r\n}\r\n\r\nlet nextUserId = 1;\r\n\r\n/** @public */\r\nexport namespace TileUser {\r\n export function generateId(): number {\r\n return nextUserId++;\r\n }\r\n\r\n /** Iterate the subset of `users` that are [[Viewport]]s. */\r\n export function * viewportsFromUsers(users: Iterable<TileUser>): Iterable<Viewport> {\r\n for (const user of users)\r\n if (user instanceof Viewport)\r\n yield user;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"TileUser.js","sourceRoot":"","sources":["../../../src/tile/TileUser.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,0CAAuC;AAwBvC,IAAI,UAAU,GAAG,CAAC,CAAC;AAEnB,cAAc;AACd,IAAiB,QAAQ,CAWxB;AAXD,WAAiB,QAAQ;IACvB,SAAgB,UAAU;QACxB,OAAO,UAAU,EAAE,CAAC;IACtB,CAAC;IAFe,mBAAU,aAEzB,CAAA;IAED,4DAA4D;IAC5D,QAAgB,CAAC,CAAC,kBAAkB,CAAC,KAAyB;QAC5D,KAAK,MAAM,IAAI,IAAI,KAAK;YACtB,IAAI,IAAI,YAAY,mBAAQ;gBAC1B,MAAM,IAAI,CAAC;IACjB,CAAC;IAJiB,2BAAkB,qBAInC,CAAA;AACH,CAAC,EAXgB,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAWxB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tiles\n */\n\nimport { IModelConnection } from \"../IModelConnection\";\nimport { Viewport } from \"../Viewport\";\nimport { DisclosedTileTreeSet, TileRequest } from \"./internal\";\n\n/** Represents some object that makes use of [[Tile]]s in some way - e.g., by requesting and/or displaying their contents, querying their geometry, etc.\n * Each [[Tile]] keeps track of its users via its [[TileUsageMarker]]. A tile with no users is eligible to be discarded view [[Tile.prune]].\n * Every [[Viewport]] is a tile user. It is occasionally useful to have a tile user that is **not** a viewport.\n * Every TileUser is identified by an integer Id that is unique among all extant TileUsers. This Id **must** be obtained via [[TileUser.generateId]].\n * Every TileUser must be registered with [[IModelApp.tileAdmin]] before use via [[TileAdmin.registerUser]] and unregistered via [[TileAdmin.forgetUser]] after\n * it ceases using tiles.\n * @public\n */\nexport interface TileUser {\n /** A unique integer identifying this user amongst all extant users. This Id **must** be obtained via [[TIleUser.generateId]]. */\n readonly tileUserId: number;\n /** The iModel with which the user is associated. */\n readonly iModel: IModelConnection;\n /** Disclose all tile trees currently in use by this user. Any tile tree not disclosed by any user becomes eligible for garbage collection. */\n readonly discloseTileTrees: (trees: DisclosedTileTreeSet) => void;\n /** An optional function invoked when a [[TileRequest]] associated with a [[Tile]] in use by this user changes state - e.g., when the request completes, fails, or\n * is cancelled. For example, a [[Viewport]] responds to such events by invalidating its scene.\n */\n readonly onRequestStateChanged?: (req: TileRequest) => void;\n}\n\nlet nextUserId = 1;\n\n/** @public */\nexport namespace TileUser {\n export function generateId(): number {\n return nextUserId++;\n }\n\n /** Iterate the subset of `users` that are [[Viewport]]s. */\n export function * viewportsFromUsers(users: Iterable<TileUser>): Iterable<Viewport> {\n for (const user of users)\n if (user instanceof Viewport)\n yield user;\n }\n}\n"]}