@cesium/engine 24.0.0 → 26.0.0

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 (362) hide show
  1. package/Build/Workers/{chunk-6WLHJFD3.js → chunk-3VFEWOBI.js} +59 -32
  2. package/Build/Workers/{chunk-UQU4RXLT.js → chunk-424RNO3D.js} +50 -45
  3. package/Build/Workers/chunk-4MGMYHOO.js +147 -0
  4. package/Build/Workers/{chunk-AMIHNSST.js → chunk-4S7IE3LB.js} +2 -2
  5. package/Build/Workers/{chunk-J6AW5YHS.js → chunk-52JDLOEM.js} +14 -14
  6. package/Build/Workers/{chunk-6RMS4S72.js → chunk-54I6Y66F.js} +6 -6
  7. package/Build/Workers/{chunk-C6P4IG5P.js → chunk-6YEE6JDR.js} +6 -6
  8. package/Build/Workers/{chunk-72VYSVEW.js → chunk-7J2HKPRH.js} +11 -10
  9. package/Build/Workers/{chunk-7O5XJTVE.js → chunk-7WM2PX4V.js} +5 -5
  10. package/Build/Workers/{chunk-5A2SW66E.js → chunk-ACXQXN46.js} +16 -16
  11. package/Build/Workers/{chunk-VLDEUTOP.js → chunk-AYKR4VBR.js} +2 -2
  12. package/Build/Workers/{chunk-YQFTYQMZ.js → chunk-C6J67V5A.js} +3 -2
  13. package/Build/Workers/{chunk-D4EJ2NXG.js → chunk-C6KNZ7T4.js} +17 -17
  14. package/Build/Workers/{chunk-7MDYBRYJ.js → chunk-CFQP6LYM.js} +4 -4
  15. package/Build/Workers/{chunk-YAOZMOFL.js → chunk-CXOYE2WM.js} +5 -5
  16. package/Build/Workers/{chunk-B6SCUUFP.js → chunk-CZEYZU4N.js} +10 -10
  17. package/Build/Workers/{chunk-NPF7SSHZ.js → chunk-DBOEKL43.js} +7 -7
  18. package/Build/Workers/{chunk-44EMEGKW.js → chunk-DDWSZVMY.js} +5 -5
  19. package/Build/Workers/{chunk-7X322WP2.js → chunk-DOBXCNC3.js} +13 -13
  20. package/Build/Workers/{chunk-JCI63T3K.js → chunk-E7VQ76KE.js} +6 -6
  21. package/Build/Workers/{chunk-7TYLCBGK.js → chunk-EBSIOBXY.js} +12 -10
  22. package/Build/Workers/{chunk-GQUNK2XC.js → chunk-EF2QYXGA.js} +14 -14
  23. package/Build/Workers/{chunk-BJD6QGXZ.js → chunk-EPYXRCDB.js} +12 -12
  24. package/Build/Workers/{chunk-63SIWPLS.js → chunk-F6QDY6HU.js} +13 -13
  25. package/Build/Workers/{chunk-XY6HMDGI.js → chunk-FRQZECAO.js} +5 -5
  26. package/Build/Workers/{chunk-VMVOUQ5J.js → chunk-G7PXZRVF.js} +7 -7
  27. package/Build/Workers/{chunk-N65BAKSH.js → chunk-INUEEEQA.js} +8 -8
  28. package/Build/Workers/{chunk-7QRFIKWQ.js → chunk-IRBKFCEJ.js} +2 -2
  29. package/Build/Workers/{chunk-UIGVOKKI.js → chunk-IYOUHCZB.js} +3 -2
  30. package/Build/Workers/{chunk-5GXYJQ2K.js → chunk-J6BWOHUF.js} +3 -3
  31. package/Build/Workers/{chunk-A47HVBC5.js → chunk-KFSTQKNM.js} +7 -7
  32. package/Build/Workers/{chunk-EV3VGO6Y.js → chunk-KKOSKAZB.js} +17 -17
  33. package/Build/Workers/{chunk-6MPGQEHA.js → chunk-KSSWJIZW.js} +2 -2
  34. package/Build/Workers/{chunk-DHKPFLSJ.js → chunk-M3B5JKSM.js} +3 -2
  35. package/Build/Workers/chunk-MPZHGZU6.js +2342 -0
  36. package/Build/Workers/{chunk-YJZGW74L.js → chunk-MYP774IS.js} +2213 -1349
  37. package/Build/Workers/{chunk-LIB2H534.js → chunk-O3EA5HS7.js} +12 -11
  38. package/Build/Workers/{chunk-ILMFADZA.js → chunk-P3CK7MCY.js} +27 -5
  39. package/Build/Workers/chunk-Q3PY526V.js +3201 -0
  40. package/Build/Workers/chunk-QN67VG36.js +973 -0
  41. package/Build/Workers/{chunk-XJRBB253.js → chunk-QRWGUWI6.js} +11 -11
  42. package/Build/Workers/{chunk-AF3MU2RL.js → chunk-S4MCOY6I.js} +7 -6
  43. package/Build/Workers/{chunk-Y7HNNPNK.js → chunk-SMQZZOW6.js} +10 -10
  44. package/Build/Workers/{chunk-PVV64VFW.js → chunk-TKKIREQ6.js} +3 -2
  45. package/Build/Workers/{chunk-MKM27KGV.js → chunk-U3ZA64U7.js} +2 -2
  46. package/Build/Workers/{chunk-2N4KDHS3.js → chunk-UA25D5MX.js} +12 -11
  47. package/Build/Workers/{chunk-RQNJD3O4.js → chunk-UOOIQ3KX.js} +12 -12
  48. package/Build/Workers/{chunk-GOQBUCXH.js → chunk-V7VQKN6N.js} +709 -431
  49. package/Build/Workers/{chunk-LXMCPFFS.js → chunk-VQYETPWC.js} +4 -4
  50. package/Build/Workers/{chunk-NKT5K3K3.js → chunk-VWV2IJRB.js} +13 -12
  51. package/Build/Workers/chunk-XZMBNNDX.js +1287 -0
  52. package/Build/Workers/{chunk-ISY4EZCA.js → chunk-Y57HREW5.js} +4 -4
  53. package/Build/Workers/{chunk-EDXL4W76.js → chunk-Y5BF6AFU.js} +2 -2
  54. package/Build/Workers/{chunk-Q3C6VQH6.js → chunk-YLY7NKAB.js} +4 -4
  55. package/Build/Workers/{chunk-4TIG36AW.js → chunk-ZK3CF7ZD.js} +12 -12
  56. package/Build/Workers/{chunk-AJLTU6PF.js → chunk-ZP7JMQV4.js} +4 -1
  57. package/Build/Workers/{chunk-HXJMS2ZI.js → chunk-ZZ46LWL6.js} +1 -1
  58. package/Build/Workers/combineGeometry.js +24 -24
  59. package/Build/Workers/createBoxGeometry.js +18 -18
  60. package/Build/Workers/createBoxOutlineGeometry.js +16 -16
  61. package/Build/Workers/createCircleGeometry.js +26 -26
  62. package/Build/Workers/createCircleOutlineGeometry.js +19 -19
  63. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
  64. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
  65. package/Build/Workers/createCorridorGeometry.js +29 -29
  66. package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
  67. package/Build/Workers/createCylinderGeometry.js +20 -20
  68. package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
  69. package/Build/Workers/createEllipseGeometry.js +26 -26
  70. package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
  71. package/Build/Workers/createEllipsoidGeometry.js +19 -19
  72. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
  73. package/Build/Workers/createFrustumGeometry.js +18 -18
  74. package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
  75. package/Build/Workers/createGeometry.js +24 -24
  76. package/Build/Workers/createGroundPolylineGeometry.js +175 -118
  77. package/Build/Workers/createPlaneGeometry.js +16 -16
  78. package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
  79. package/Build/Workers/createPolygonGeometry.js +32 -32
  80. package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
  81. package/Build/Workers/createPolylineGeometry.js +25 -25
  82. package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
  83. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
  84. package/Build/Workers/createRectangleGeometry.js +27 -27
  85. package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
  86. package/Build/Workers/createSimplePolylineGeometry.js +23 -23
  87. package/Build/Workers/createSphereGeometry.js +19 -19
  88. package/Build/Workers/createSphereOutlineGeometry.js +18 -18
  89. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  90. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  91. package/Build/Workers/createVectorTileGeometries.js +24 -24
  92. package/Build/Workers/createVectorTilePoints.js +13 -13
  93. package/Build/Workers/createVectorTilePolygons.js +22 -22
  94. package/Build/Workers/createVectorTilePolylines.js +14 -14
  95. package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
  96. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
  97. package/Build/Workers/createVerticesFromHeightmap.js +24 -23
  98. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
  99. package/Build/Workers/createWallGeometry.js +24 -24
  100. package/Build/Workers/createWallOutlineGeometry.js +23 -23
  101. package/Build/Workers/decodeDraco.js +10 -10
  102. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  103. package/Build/Workers/decodeI3S.js +10 -10
  104. package/Build/Workers/gaussianSplatSorter.js +4 -4
  105. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  106. package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
  107. package/Build/Workers/transcodeKTX2.js +12 -9
  108. package/Build/Workers/transferTypedArrayTest.js +1 -1
  109. package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
  110. package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
  111. package/Source/Core/ArcType.js +6 -1
  112. package/Source/Core/ArticulationStageType.js +5 -1
  113. package/Source/Core/AssociativeArray.js +100 -94
  114. package/Source/Core/BoundingSphere.js +1296 -1300
  115. package/Source/Core/Cartesian2.js +1 -1
  116. package/Source/Core/Cartesian3.js +2 -3
  117. package/Source/Core/Cartesian4.js +1 -1
  118. package/Source/Core/Cartographic.js +257 -249
  119. package/Source/Core/ClockRange.js +6 -1
  120. package/Source/Core/ClockStep.js +6 -1
  121. package/Source/Core/Color.js +844 -835
  122. package/Source/Core/ComponentDatatype.js +39 -1
  123. package/Source/Core/CornerType.js +6 -1
  124. package/Source/Core/Credit.js +121 -124
  125. package/Source/Core/Ellipsoid.js +637 -660
  126. package/Source/Core/ExtrapolationType.js +6 -1
  127. package/Source/Core/GeocodeType.js +6 -1
  128. package/Source/Core/GeographicProjection.js +74 -74
  129. package/Source/Core/GeographicTilingScheme.js +179 -198
  130. package/Source/Core/GeometryOffsetAttribute.js +7 -1
  131. package/Source/Core/GeometryType.js +7 -1
  132. package/Source/Core/HeightmapEncoding.js +6 -1
  133. package/Source/Core/Iau2006XysData.js +24 -13
  134. package/Source/Core/IndexDatatype.js +3 -1
  135. package/Source/Core/InterpolationType.js +5 -1
  136. package/Source/Core/Intersect.js +6 -1
  137. package/Source/Core/Ion.js +1 -1
  138. package/Source/Core/IonGeocodeProviderType.js +5 -1
  139. package/Source/Core/JulianDate.js +850 -848
  140. package/Source/Core/KeyboardEventModifier.js +6 -1
  141. package/Source/Core/MapProjection.js +40 -44
  142. package/Source/Core/Matrix2.js +906 -893
  143. package/Source/Core/Matrix3.js +1643 -1575
  144. package/Source/Core/Matrix4.js +2903 -2872
  145. package/Source/Core/PixelFormat.js +3 -1
  146. package/Source/Core/PrimitiveType.js +11 -1
  147. package/Source/Core/Ray.js +62 -60
  148. package/Source/Core/Rectangle.js +913 -904
  149. package/Source/Core/ReferenceFrame.js +6 -1
  150. package/Source/Core/RequestScheduler.js +8 -3
  151. package/Source/Core/RequestState.js +6 -1
  152. package/Source/Core/RequestType.js +6 -1
  153. package/Source/Core/Resource.js +1 -1
  154. package/Source/Core/ScreenSpaceEventHandler.js +51 -41
  155. package/Source/Core/ScreenSpaceEventType.js +6 -1
  156. package/Source/Core/TerrainQuantization.js +6 -1
  157. package/Source/Core/TilingScheme.js +100 -98
  158. package/Source/Core/TimeConstants.js +6 -1
  159. package/Source/Core/TimeStandard.js +6 -1
  160. package/Source/Core/TrackingReferenceFrame.js +6 -1
  161. package/Source/Core/Visibility.js +6 -1
  162. package/Source/Core/VulkanConstants.js +6 -1
  163. package/Source/Core/WebGLConstants.js +6 -1
  164. package/Source/Core/WebMercatorProjection.js +108 -109
  165. package/Source/Core/WebMercatorTilingScheme.js +246 -242
  166. package/Source/Core/WindingOrder.js +3 -1
  167. package/Source/Core/createColorRamp.js +37 -0
  168. package/Source/Core/globalTypes.js +25 -0
  169. package/Source/DataSources/StaticGroundGeometryPerMaterialBatch.js +1 -0
  170. package/Source/DataSources/StaticGroundPolylinePerMaterialBatch.js +1 -0
  171. package/Source/DataSources/StripeOrientation.js +6 -1
  172. package/Source/Renderer/BufferUsage.js +20 -9
  173. package/Source/Renderer/Context.js +2 -29
  174. package/Source/Renderer/DrawCommand.js +435 -403
  175. package/Source/Renderer/MipmapHint.js +5 -1
  176. package/Source/Renderer/Pass.js +10 -3
  177. package/Source/Renderer/PickId.js +44 -0
  178. package/Source/Renderer/PixelDatatype.js +3 -1
  179. package/Source/Renderer/RenderbufferFormat.js +5 -1
  180. package/Source/Renderer/ShaderDestination.js +4 -1
  181. package/Source/Renderer/TextureMagnificationFilter.js +3 -1
  182. package/Source/Renderer/TextureMinificationFilter.js +3 -1
  183. package/Source/Renderer/TextureWrap.js +5 -1
  184. package/Source/Renderer/createUniform.js +346 -239
  185. package/Source/Renderer/createUniformArray.js +494 -381
  186. package/Source/Scene/AlphaMode.js +5 -1
  187. package/Source/Scene/ArcGisBaseMapType.js +6 -1
  188. package/Source/Scene/ArcGisMapService.js +1 -1
  189. package/Source/Scene/AttributeType.js +3 -1
  190. package/Source/Scene/Axis.js +3 -1
  191. package/Source/Scene/BingMapsStyle.js +6 -1
  192. package/Source/Scene/BlendEquation.js +6 -1
  193. package/Source/Scene/BlendFunction.js +6 -1
  194. package/Source/Scene/BlendOption.js +6 -1
  195. package/Source/Scene/BlendingState.js +6 -1
  196. package/Source/Scene/BufferLoader.js +0 -2
  197. package/Source/Scene/BufferPoint.js +1 -0
  198. package/Source/Scene/BufferPointCollection.js +17 -1
  199. package/Source/Scene/BufferPolygon.js +3 -2
  200. package/Source/Scene/BufferPolygonCollection.js +13 -1
  201. package/Source/Scene/BufferPolyline.js +1 -0
  202. package/Source/Scene/BufferPolylineCollection.js +5 -1
  203. package/Source/Scene/BufferPrimitiveCollection.js +210 -43
  204. package/Source/Scene/CameraEventAggregator.js +30 -18
  205. package/Source/Scene/CameraEventType.js +6 -1
  206. package/Source/Scene/Cesium3DTile.js +54 -1
  207. package/Source/Scene/Cesium3DTileColorBlendMode.js +6 -1
  208. package/Source/Scene/Cesium3DTileContent.js +195 -254
  209. package/Source/Scene/Cesium3DTileContentFactory.js +10 -2
  210. package/Source/Scene/Cesium3DTileContentState.js +6 -1
  211. package/Source/Scene/Cesium3DTileContentType.js +3 -1
  212. package/Source/Scene/Cesium3DTileFeature.js +289 -306
  213. package/Source/Scene/Cesium3DTileOptimizationHint.js +6 -1
  214. package/Source/Scene/Cesium3DTilePass.js +5 -1
  215. package/Source/Scene/Cesium3DTilePointFeature.js +433 -511
  216. package/Source/Scene/Cesium3DTileRefine.js +6 -1
  217. package/Source/Scene/Cesium3DTileVectorFeature.js +586 -0
  218. package/Source/Scene/Cesium3DTileset.js +46 -6
  219. package/Source/Scene/ClassificationType.js +3 -1
  220. package/Source/Scene/CloudType.js +3 -1
  221. package/Source/Scene/ColorBlendMode.js +4 -1
  222. package/Source/Scene/Composite3DTileContent.js +254 -292
  223. package/Source/Scene/CullFace.js +6 -1
  224. package/Source/Scene/DepthFunction.js +6 -1
  225. package/Source/Scene/DynamicAtmosphereLightingType.js +3 -1
  226. package/Source/Scene/EdgeDisplayMode.js +50 -0
  227. package/Source/Scene/Empty3DTileContent.js +100 -132
  228. package/Source/Scene/EquirectangularPanorama.js +1 -0
  229. package/Source/Scene/ExpressionNodeType.js +6 -1
  230. package/Source/Scene/GaussianSplat3DTileContent.js +436 -478
  231. package/Source/Scene/GeoJsonPrimitive.js +874 -0
  232. package/Source/Scene/Geometry3DTileContent.js +151 -185
  233. package/Source/Scene/GltfBufferViewLoader.js +0 -2
  234. package/Source/Scene/GltfDracoLoader.js +0 -2
  235. package/Source/Scene/GltfImageLoader.js +0 -3
  236. package/Source/Scene/GltfIndexBufferLoader.js +0 -4
  237. package/Source/Scene/GltfJsonLoader.js +0 -2
  238. package/Source/Scene/GltfLoader.js +109 -5
  239. package/Source/Scene/GltfLoaderUtil.js +14 -0
  240. package/Source/Scene/GltfSpzLoader.js +0 -2
  241. package/Source/Scene/GltfStructuralMetadataLoader.js +0 -2
  242. package/Source/Scene/GltfTextureLoader.js +0 -2
  243. package/Source/Scene/GltfVertexBufferLoader.js +0 -4
  244. package/Source/Scene/HeightReference.js +5 -1
  245. package/Source/Scene/HorizontalOrigin.js +6 -1
  246. package/Source/Scene/ImageryProvider.js +1 -1
  247. package/Source/Scene/ImageryState.js +6 -1
  248. package/Source/Scene/Implicit3DTileContent.js +179 -214
  249. package/Source/Scene/ImplicitSubdivisionScheme.js +3 -1
  250. package/Source/Scene/InstanceAttributeSemantic.js +3 -1
  251. package/Source/Scene/IonWorldImageryStyle.js +6 -1
  252. package/Source/Scene/JobType.js +6 -1
  253. package/Source/Scene/LabelStyle.js +6 -1
  254. package/Source/Scene/MVTDataProvider.js +147 -0
  255. package/Source/Scene/MapMode2D.js +6 -1
  256. package/Source/Scene/MetadataComponentType.js +3 -1
  257. package/Source/Scene/MetadataSchemaLoader.js +0 -2
  258. package/Source/Scene/MetadataSemantic.js +6 -2
  259. package/Source/Scene/MetadataType.js +3 -1
  260. package/Source/Scene/Model/B3dmLoader.js +0 -3
  261. package/Source/Scene/Model/CustomShaderMode.js +3 -1
  262. package/Source/Scene/Model/CustomShaderTranslucencyMode.js +5 -1
  263. package/Source/Scene/Model/EdgeVisibilityPipelineStage.js +78 -337
  264. package/Source/Scene/Model/Extensions/Gpm/PpeSource.js +5 -1
  265. package/Source/Scene/Model/Extensions/Gpm/StorageType.js +5 -1
  266. package/Source/Scene/Model/GeoJsonLoader.js +0 -2
  267. package/Source/Scene/Model/I3dmLoader.js +0 -3
  268. package/Source/Scene/Model/InstancingPipelineStage.js +1 -1
  269. package/Source/Scene/Model/LightingModel.js +5 -1
  270. package/Source/Scene/Model/MaterialPipelineStage.js +184 -3
  271. package/Source/Scene/Model/Model.js +34 -0
  272. package/Source/Scene/Model/Model3DTileContent.js +424 -458
  273. package/Source/Scene/Model/ModelDrawCommand.js +31 -3
  274. package/Source/Scene/Model/ModelReader.js +474 -3
  275. package/Source/Scene/Model/ModelRuntimePrimitive.js +2 -1
  276. package/Source/Scene/Model/ModelType.js +3 -1
  277. package/Source/Scene/Model/ModelUtility.js +4 -0
  278. package/Source/Scene/Model/PntsLoader.js +4 -3
  279. package/Source/Scene/Model/StyleCommandsNeeded.js +3 -1
  280. package/Source/Scene/Model/UniformType.js +5 -1
  281. package/Source/Scene/Model/VaryingType.js +5 -1
  282. package/Source/Scene/Model/createVectorTileBuffersFromModelComponents.js +500 -139
  283. package/Source/Scene/Model/pickModel.js +94 -299
  284. package/Source/Scene/ModelAnimationLoop.js +6 -1
  285. package/Source/Scene/ModelAnimationState.js +6 -1
  286. package/Source/Scene/ModelComponents.js +47 -2
  287. package/Source/Scene/Multiple3DTileContent.js +291 -334
  288. package/Source/Scene/PrimitiveState.js +7 -1
  289. package/Source/Scene/QuadtreeOccluders.js +20 -15
  290. package/Source/Scene/QuadtreeTile.js +547 -541
  291. package/Source/Scene/QuadtreeTileLoadState.js +6 -1
  292. package/Source/Scene/QuadtreeTileProvider.js +159 -175
  293. package/Source/Scene/ResourceLoader.js +0 -1
  294. package/Source/Scene/ResourceLoaderState.js +7 -1
  295. package/Source/Scene/Scene.js +26 -0
  296. package/Source/Scene/SceneMode.js +4 -1
  297. package/Source/Scene/ShadowMode.js +3 -1
  298. package/Source/Scene/SkyBox.js +1 -1
  299. package/Source/Scene/SplitDirection.js +6 -1
  300. package/Source/Scene/StencilFunction.js +6 -1
  301. package/Source/Scene/StencilOperation.js +6 -1
  302. package/Source/Scene/TerrainState.js +7 -1
  303. package/Source/Scene/TileState.js +7 -1
  304. package/Source/Scene/Tileset3DTileContent.js +113 -146
  305. package/Source/Scene/Tonemapper.js +5 -1
  306. package/Source/Scene/UrlTemplate3DTilesDataProvider.js +499 -0
  307. package/Source/Scene/Vector3DTileContent.js +205 -234
  308. package/Source/Scene/VectorGltf3DTileContent.js +131 -61
  309. package/Source/Scene/VertexAttributeSemantic.js +3 -1
  310. package/Source/Scene/VerticalOrigin.js +6 -1
  311. package/Source/Scene/VoxelBoxShape.js +12 -6
  312. package/Source/Scene/VoxelContent.js +2 -0
  313. package/Source/Scene/VoxelCylinderShape.js +39 -38
  314. package/Source/Scene/VoxelEllipsoidShape.js +46 -96
  315. package/Source/Scene/VoxelMetadataOrder.js +6 -1
  316. package/Source/Scene/VoxelPrimitive.js +159 -175
  317. package/Source/Scene/VoxelProvider.js +64 -90
  318. package/Source/Scene/VoxelShapeType.js +3 -1
  319. package/Source/Scene/buildVectorGltfFromMVT.js +1059 -0
  320. package/Source/Scene/buildVoxelCustomShader.js +199 -0
  321. package/Source/Scene/decodeMVT.js +634 -0
  322. package/Source/Scene/renderBufferPointCollection.js +124 -127
  323. package/Source/Scene/renderBufferPolygonCollection.js +122 -122
  324. package/Source/Scene/renderBufferPolylineCollection.js +386 -238
  325. package/Source/Shaders/BufferPointMaterialFS.glsl +1 -0
  326. package/Source/Shaders/BufferPointMaterialFS.js +1 -0
  327. package/Source/Shaders/BufferPointMaterialVS.glsl +19 -9
  328. package/Source/Shaders/BufferPointMaterialVS.js +20 -10
  329. package/Source/Shaders/BufferPolygonMaterialVS.glsl +13 -4
  330. package/Source/Shaders/BufferPolygonMaterialVS.js +14 -5
  331. package/Source/Shaders/BufferPolylineMaterialVS.glsl +16 -2
  332. package/Source/Shaders/BufferPolylineMaterialVS.js +17 -3
  333. package/Source/Shaders/Builtin/Constants/passCesium3DTileEdgesDirect.glsl +9 -0
  334. package/Source/Shaders/Builtin/Constants/passCesium3DTileEdgesDirect.js +11 -0
  335. package/Source/Shaders/Builtin/Constants/passOverlay.glsl +1 -1
  336. package/Source/Shaders/Builtin/Constants/passOverlay.js +1 -1
  337. package/Source/Shaders/Builtin/CzmBuiltins.js +4 -0
  338. package/Source/Shaders/Builtin/Functions/computeTextureTransform.glsl +24 -0
  339. package/Source/Shaders/Builtin/Functions/computeTextureTransform.js +25 -0
  340. package/Source/Shaders/Model/ConstantLodStageFS.glsl +60 -0
  341. package/Source/Shaders/Model/ConstantLodStageFS.js +62 -0
  342. package/Source/Shaders/Model/ConstantLodStageVS.glsl +12 -0
  343. package/Source/Shaders/Model/ConstantLodStageVS.js +13 -0
  344. package/Source/Shaders/Model/EdgeVisibilityStageVS.glsl +0 -1
  345. package/Source/Shaders/Model/EdgeVisibilityStageVS.js +0 -1
  346. package/Source/Shaders/Model/MaterialStageFS.glsl +46 -20
  347. package/Source/Shaders/Model/MaterialStageFS.js +46 -20
  348. package/Source/Shaders/Voxels/convertLocalToBoxUv.glsl +0 -1
  349. package/Source/Shaders/Voxels/convertLocalToBoxUv.js +0 -1
  350. package/Source/Shaders/Voxels/convertLocalToCylinderUv.glsl +7 -9
  351. package/Source/Shaders/Voxels/convertLocalToCylinderUv.js +7 -9
  352. package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.glsl +7 -17
  353. package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.js +7 -17
  354. package/Source/Widget/CesiumWidget.js +11 -4
  355. package/index.d.ts +595 -343
  356. package/index.js +392 -378
  357. package/package.json +3 -3
  358. package/Build/Workers/chunk-DVB56LG7.js +0 -114
  359. package/Build/Workers/chunk-HKUES6UG.js +0 -2357
  360. package/Build/Workers/chunk-HRHRYFHS.js +0 -940
  361. package/Build/Workers/chunk-KLPGTXS3.js +0 -642
  362. package/Build/Workers/chunk-ZBZRTRJB.js +0 -1829
@@ -1,3 +1,5 @@
1
+ // @ts-check
2
+
1
3
  import defined from "../Core/defined.js";
2
4
  import DeveloperError from "../Core/DeveloperError.js";
3
5
  import Rectangle from "../Core/Rectangle.js";
@@ -5,15 +7,24 @@ import Cartographic from "../Core/Cartographic.js";
5
7
  import QuadtreeTileLoadState from "./QuadtreeTileLoadState.js";
6
8
  import TileSelectionResult from "./TileSelectionResult.js";
7
9
 
10
+ /** @import TilingScheme from "../Core/TilingScheme.js"; */
11
+
8
12
  /**
9
13
  * A simple Least Recently Used (LRU) cache implementation.
14
+ *
15
+ * @private
10
16
  */
11
17
  class LRUCache {
18
+ /** @param {number} maxSize */
12
19
  constructor(maxSize) {
13
20
  this.maxSize = maxSize;
14
21
  this.cache = new Map();
15
22
  }
16
23
 
24
+ /**
25
+ * @param {unknown} key
26
+ * @returns {unknown}
27
+ */
17
28
  get(key) {
18
29
  if (!this.cache.has(key)) {
19
30
  return undefined;
@@ -25,6 +36,10 @@ class LRUCache {
25
36
  return value;
26
37
  }
27
38
 
39
+ /**
40
+ * @param {unknown} key
41
+ * @param {unknown} value
42
+ */
28
43
  set(key, value) {
29
44
  if (this.cache.has(key)) {
30
45
  this.cache.delete(key);
@@ -36,6 +51,14 @@ class LRUCache {
36
51
  this.cache.set(key, value);
37
52
  }
38
53
 
54
+ /**
55
+ * @type {number}
56
+ * @readonly
57
+ */
58
+ get size() {
59
+ return this.cache.size;
60
+ }
61
+
39
62
  clear() {
40
63
  this.cache.clear();
41
64
  }
@@ -47,523 +70,391 @@ const MAX_CACHE_ENTRIES = 1000;
47
70
  /**
48
71
  * A single tile in a {@link QuadtreePrimitive}.
49
72
  *
50
- * @alias QuadtreeTile
51
- * @constructor
52
73
  * @private
53
- *
54
- * @param {number} options.level The level of the tile in the quadtree.
55
- * @param {number} options.x The X coordinate of the tile in the quadtree. 0 is the westernmost tile.
56
- * @param {number} options.y The Y coordinate of the tile in the quadtree. 0 is the northernmost tile.
57
- * @param {TilingScheme} options.tilingScheme The tiling scheme in which this tile exists.
58
- * @param {QuadtreeTile} [options.parent] This tile's parent, or undefined if this is a root tile.
59
74
  */
60
- function QuadtreeTile(options) {
61
- //>>includeStart('debug', pragmas.debug);
62
- if (!defined(options)) {
63
- throw new DeveloperError("options is required.");
64
- }
65
- if (!defined(options.x)) {
66
- throw new DeveloperError("options.x is required.");
67
- } else if (!defined(options.y)) {
68
- throw new DeveloperError("options.y is required.");
69
- } else if (options.x < 0 || options.y < 0) {
70
- throw new DeveloperError(
71
- "options.x and options.y must be greater than or equal to zero.",
72
- );
73
- }
74
- if (!defined(options.level)) {
75
- throw new DeveloperError(
76
- "options.level is required and must be greater than or equal to zero.",
77
- );
78
- }
79
- if (!defined(options.tilingScheme)) {
80
- throw new DeveloperError("options.tilingScheme is required.");
81
- }
82
- //>>includeEnd('debug');
83
-
84
- this._tilingScheme = options.tilingScheme;
85
- this._x = options.x;
86
- this._y = options.y;
87
- this._level = options.level;
88
- this._parent = options.parent;
89
- this._rectangle = this._tilingScheme.tileXYToRectangle(
90
- this._x,
91
- this._y,
92
- this._level,
93
- );
94
-
95
- this._southwestChild = undefined;
96
- this._southeastChild = undefined;
97
- this._northwestChild = undefined;
98
- this._northeastChild = undefined;
99
-
100
- // TileReplacementQueue gets/sets these private properties.
101
- this.replacementPrevious = undefined;
102
- this.replacementNext = undefined;
103
-
104
- // The distance from the camera to this tile, updated when the tile is selected
105
- // for rendering. We can get rid of this if we have a better way to sort by
106
- // distance - for example, by using the natural ordering of a quadtree.
107
- // QuadtreePrimitive gets/sets this private property.
108
- this._distance = 0.0;
109
- this._loadPriority = 0.0;
110
-
111
- this._customData = new Set();
112
- this._customDataIterator = undefined;
113
- this._addedCustomData = [];
114
- this._removedCustomData = [];
115
- this._lastSelectionResult = TileSelectionResult.NONE;
116
- this._lastSelectionResultFrame = undefined;
117
- this._loadedCallbacks = {};
118
-
119
- // Cache for storing computed position values per tile to avoid redundant calculations
120
- this._positionCache = new LRUCache(MAX_CACHE_ENTRIES);
121
-
122
- /**
123
- * Gets or sets the current state of the tile in the tile load pipeline.
124
- * @type {QuadtreeTileLoadState}
125
- * @default {@link QuadtreeTileLoadState.START}
126
- */
127
- this.state = QuadtreeTileLoadState.START;
128
-
75
+ class QuadtreeTile {
129
76
  /**
130
- * Gets or sets a value indicating whether or not the tile is currently renderable.
131
- * @type {boolean}
132
- * @default false
77
+ * @param {object} options
78
+ * @param {number} options.level The level of the tile in the quadtree.
79
+ * @param {number} options.x The X coordinate of the tile in the quadtree. 0 is the westernmost tile.
80
+ * @param {number} options.y The Y coordinate of the tile in the quadtree. 0 is the northernmost tile.
81
+ * @param {TilingScheme} options.tilingScheme The tiling scheme in which this tile exists.
82
+ * @param {QuadtreeTile} [options.parent] This tile's parent, or undefined if this is a root tile.
133
83
  */
134
- this.renderable = false;
84
+ constructor(options) {
85
+ //>>includeStart('debug', pragmas.debug);
86
+ if (!defined(options)) {
87
+ throw new DeveloperError("options is required.");
88
+ }
89
+ if (!defined(options.x)) {
90
+ throw new DeveloperError("options.x is required.");
91
+ } else if (!defined(options.y)) {
92
+ throw new DeveloperError("options.y is required.");
93
+ } else if (options.x < 0 || options.y < 0) {
94
+ throw new DeveloperError(
95
+ "options.x and options.y must be greater than or equal to zero.",
96
+ );
97
+ }
98
+ if (!defined(options.level)) {
99
+ throw new DeveloperError(
100
+ "options.level is required and must be greater than or equal to zero.",
101
+ );
102
+ }
103
+ if (!defined(options.tilingScheme)) {
104
+ throw new DeveloperError("options.tilingScheme is required.");
105
+ }
106
+ //>>includeEnd('debug');
107
+
108
+ this._tilingScheme = options.tilingScheme;
109
+ this._x = options.x;
110
+ this._y = options.y;
111
+ this._level = options.level;
112
+ this._parent = options.parent;
113
+
114
+ /** @type {Rectangle} */
115
+ this._rectangle = this._tilingScheme.tileXYToRectangle(
116
+ this._x,
117
+ this._y,
118
+ this._level,
119
+ );
135
120
 
136
- /**
137
- * Gets or set a value indicating whether or not the tile was entirely upsampled from its
138
- * parent tile. If all four children of a parent tile were upsampled from the parent,
139
- * we will render the parent instead of the children even if the LOD indicates that
140
- * the children would be preferable.
141
- * @type {boolean}
142
- * @default false
143
- */
144
- this.upsampledFromParent = false;
121
+ this._southwestChild = undefined;
122
+ this._southeastChild = undefined;
123
+ this._northwestChild = undefined;
124
+ this._northeastChild = undefined;
125
+
126
+ // TileReplacementQueue gets/sets these private properties.
127
+ this.replacementPrevious = undefined;
128
+ this.replacementNext = undefined;
129
+
130
+ // The distance from the camera to this tile, updated when the tile is selected
131
+ // for rendering. We can get rid of this if we have a better way to sort by
132
+ // distance - for example, by using the natural ordering of a quadtree.
133
+ // QuadtreePrimitive gets/sets this private property.
134
+ this._distance = 0.0;
135
+ this._loadPriority = 0.0;
136
+
137
+ this._customData = new Set();
138
+ this._customDataIterator = undefined;
139
+ /** @type {unknown[]} */
140
+ this._addedCustomData = [];
141
+ /** @type {unknown[]} */
142
+ this._removedCustomData = [];
143
+ this._lastSelectionResult = TileSelectionResult.NONE;
144
+ this._lastSelectionResultFrame = undefined;
145
+ this._loadedCallbacks = {};
146
+
147
+ // Cache for storing computed position values per tile to avoid redundant calculations
148
+ this._positionCache = new LRUCache(MAX_CACHE_ENTRIES);
149
+
150
+ /**
151
+ * Gets or sets the current state of the tile in the tile load pipeline.
152
+ * @type {QuadtreeTileLoadState}
153
+ * @default {@link QuadtreeTileLoadState.START}
154
+ */
155
+ this.state = QuadtreeTileLoadState.START;
156
+
157
+ /**
158
+ * Gets or sets a value indicating whether or not the tile is currently renderable.
159
+ * @type {boolean}
160
+ * @default false
161
+ */
162
+ this.renderable = false;
163
+
164
+ /**
165
+ * Gets or set a value indicating whether or not the tile was entirely upsampled from its
166
+ * parent tile. If all four children of a parent tile were upsampled from the parent,
167
+ * we will render the parent instead of the children even if the LOD indicates that
168
+ * the children would be preferable.
169
+ * @type {boolean}
170
+ * @default false
171
+ */
172
+ this.upsampledFromParent = false;
173
+
174
+ /**
175
+ * Gets or sets the additional data associated with this tile. The exact content is specific to the
176
+ * {@link QuadtreeTileProvider}.
177
+ * @type {object}
178
+ * @default undefined
179
+ */
180
+ this.data = undefined;
181
+ }
145
182
 
146
183
  /**
147
- * Gets or sets the additional data associated with this tile. The exact content is specific to the
148
- * {@link QuadtreeTileProvider}.
149
- * @type {object}
150
- * @default undefined
184
+ * Creates a rectangular set of tiles for level of detail zero, the coarsest, least detailed level.
185
+ *
186
+ *
187
+ * @param {TilingScheme} tilingScheme The tiling scheme for which the tiles are to be created.
188
+ * @returns {QuadtreeTile[]} An array containing the tiles at level of detail zero, starting with the
189
+ * tile in the northwest corner and followed by the tile (if any) to its east.
151
190
  */
152
- this.data = undefined;
153
- }
154
-
155
- /**
156
- * Creates a rectangular set of tiles for level of detail zero, the coarsest, least detailed level.
157
- *
158
- * @memberof QuadtreeTile
159
- *
160
- * @param {TilingScheme} tilingScheme The tiling scheme for which the tiles are to be created.
161
- * @returns {QuadtreeTile[]} An array containing the tiles at level of detail zero, starting with the
162
- * tile in the northwest corner and followed by the tile (if any) to its east.
163
- */
164
- QuadtreeTile.createLevelZeroTiles = function (tilingScheme) {
165
- //>>includeStart('debug', pragmas.debug);
166
- if (!defined(tilingScheme)) {
167
- throw new DeveloperError("tilingScheme is required.");
168
- }
169
- //>>includeEnd('debug');
170
-
171
- const numberOfLevelZeroTilesX = tilingScheme.getNumberOfXTilesAtLevel(0);
172
- const numberOfLevelZeroTilesY = tilingScheme.getNumberOfYTilesAtLevel(0);
173
-
174
- const result = new Array(numberOfLevelZeroTilesX * numberOfLevelZeroTilesY);
175
-
176
- let index = 0;
177
- for (let y = 0; y < numberOfLevelZeroTilesY; ++y) {
178
- for (let x = 0; x < numberOfLevelZeroTilesX; ++x) {
179
- result[index++] = new QuadtreeTile({
180
- tilingScheme: tilingScheme,
181
- x: x,
182
- y: y,
183
- level: 0,
184
- });
191
+ static createLevelZeroTiles(tilingScheme) {
192
+ //>>includeStart('debug', pragmas.debug);
193
+ if (!defined(tilingScheme)) {
194
+ throw new DeveloperError("tilingScheme is required.");
185
195
  }
186
- }
187
-
188
- return result;
189
- };
190
-
191
- /**
192
- * Creates a spatial hash key for the given longitude, latitude, and tile level.
193
- * The precision is adjusted based on the tile level and extent to achieve finer precision at higher levels.
194
- *
195
- * This function calculates the spatial hash key by first determining the precision at the given tile for the current maximum screenspace error (MAX_ERROR_PX),
196
- * and then rounding the longitude and latitude to that precision for consistency.
197
- *
198
- * The steps for computing the level precision are as follows:
199
- *
200
- * 1. Compute the resolution (meters per pixel) at the given level:
201
- * level_resolution_m = (2 * PI * RADIUS) / (2^level * TILE_SIZE)
202
- *
203
- * 2. Compute the target precision in meters:
204
- * level_precision_m = level_resolution_m * MAX_ERROR_PX
205
- *
206
- * 3. Compute the target precision to radians:
207
- * level_precision_rad = level_precision_m / BODY_RADIUS
208
- *
209
- * This simplifies to:
210
- * level_precision_rad = (2 * PI * MAX_ERROR_PX) / (2^level * TILE_SIZE)
211
- * which can also be written as:
212
- * level_precision_rad = (PI * MAX_ERROR_PX) / (2^(level-1) * TILE_SIZE)
213
- *
214
- * The computed level_precision_rad is then used to round the input longitude and latitude,
215
- * ensuring that positions that fall within the same spatial bin produce the same hash key.
216
- *
217
- * The constants below are computed once since they are fixed for the given configuration.
218
- *
219
- * @param {number} longitude - The longitude in radians.
220
- * @param {number} latitude - The latitude in radians.
221
- * @param {Rectangle} rectangle - The quadtree tile extents.
222
- * @returns {string} A string representing the spatial hash key.
223
- */
224
- const TILE_SIZE = 256;
225
-
226
- function createSpatialHashKey(
227
- longitude,
228
- latitude,
229
- rectangle,
230
- maximumScreenSpaceError,
231
- ) {
232
- // Adjust precision based on quadtree level - higher levels get finer precision
233
- const maxError = (rectangle.width / TILE_SIZE) * maximumScreenSpaceError;
234
- // Round to the grid precision
235
- const lonGrid = Math.floor(longitude / maxError) * maxError;
236
- const latGrid = Math.floor(latitude / maxError) * maxError;
237
- return `${lonGrid.toFixed(10)},${latGrid.toFixed(10)}`;
238
- }
196
+ //>>includeEnd('debug');
239
197
 
240
- /**
241
- * Generates a unique cache key for a given cartographic position.
242
- * @memberof QuadtreeTile
243
- *
244
- * @param {Cartographic} cartographic The cartographic coordinates.
245
- * @param {number} maximumScreenSpaceError The maximum screen-space error, in pixels, that is allowed.
246
- * A higher maximum error will render fewer tiles and improve performance, while a lower
247
- * value will improve visual quality.
248
- * @returns {string} A string representing the spatial hash key.
249
- */
250
- QuadtreeTile.prototype._getCacheKey = function (
251
- cartographic,
252
- maximumScreenSpaceError,
253
- ) {
254
- return createSpatialHashKey(
255
- cartographic.longitude,
256
- cartographic.latitude,
257
- this._rectangle,
258
- maximumScreenSpaceError,
259
- );
260
- };
198
+ const numberOfLevelZeroTilesX = tilingScheme.getNumberOfXTilesAtLevel(0);
199
+ const numberOfLevelZeroTilesY = tilingScheme.getNumberOfYTilesAtLevel(0);
261
200
 
262
- /**
263
- * Retrieves a cached position for the specified cartographic position.
264
- *
265
- * @memberof QuadtreeTile
266
- *
267
- * @param {Cartographic} cartographic - The cartographic coordinates.
268
- * @param {number} maximumScreenSpaceError The maximum screen-space error, in pixels, that is allowed.
269
- * A higher maximum error will render fewer tiles and improve performance, while a lower
270
- * value will improve visual quality.
271
- * @returns {object|undefined} The cached position data or undefined if not found.
272
- */
273
- QuadtreeTile.prototype.getPositionCacheEntry = function (
274
- cartographic,
275
- maximumScreenSpaceError,
276
- ) {
277
- return this._positionCache.get(
278
- this._getCacheKey(cartographic, maximumScreenSpaceError),
279
- );
280
- };
201
+ const result = new Array(numberOfLevelZeroTilesX * numberOfLevelZeroTilesY);
281
202
 
282
- /**
283
- * Sets a position on the cache for this tile.
284
- *
285
- * @memberof QuadtreeTile
286
- *
287
- * @param {Cartographic} cartographic - The cartographic coordinates.
288
- * @param {number} maximumScreenSpaceError The maximum screen-space error, in pixels, that is allowed.
289
- * A higher maximum error will render fewer tiles and improve performance, while a lower
290
- * value will improve visual quality.
291
- * @param {object} value - The object to be cached.
292
- */
293
- QuadtreeTile.prototype.setPositionCacheEntry = function (
294
- cartographic,
295
- maximumScreenSpaceError,
296
- value,
297
- ) {
298
- this._positionCache.set(
299
- this._getCacheKey(cartographic, maximumScreenSpaceError),
300
- value,
301
- );
302
- };
203
+ let index = 0;
204
+ for (let y = 0; y < numberOfLevelZeroTilesY; ++y) {
205
+ for (let x = 0; x < numberOfLevelZeroTilesX; ++x) {
206
+ result[index++] = new QuadtreeTile({
207
+ tilingScheme: tilingScheme,
208
+ x: x,
209
+ y: y,
210
+ level: 0,
211
+ });
212
+ }
213
+ }
303
214
 
304
- /**
305
- * Clears the position cache for this tile.
306
- * This function removes all cached positions that were previously stored
307
- * to optimize height computations.
308
- *
309
- * @memberof QuadtreeTile
310
- */
311
- QuadtreeTile.prototype.clearPositionCache = function () {
312
- if (this._positionCache.size > 0) {
313
- this._positionCache.clear();
215
+ return result;
314
216
  }
315
- };
316
217
 
317
- QuadtreeTile.prototype.updateCustomData = function () {
318
- const added = this._addedCustomData;
319
- const removed = this._removedCustomData;
320
- if (added.length === 0 && removed.length === 0) {
321
- return;
218
+ /**
219
+ * Generates a unique cache key for a given cartographic position.
220
+ *
221
+ * @param {Cartographic} cartographic The cartographic coordinates.
222
+ * @param {number} maximumScreenSpaceError The maximum screen-space error, in pixels, that is allowed.
223
+ * A higher maximum error will render fewer tiles and improve performance, while a lower
224
+ * value will improve visual quality.
225
+ * @returns {string} A string representing the spatial hash key.
226
+ */
227
+ _getCacheKey(cartographic, maximumScreenSpaceError) {
228
+ return createSpatialHashKey(
229
+ cartographic.longitude,
230
+ cartographic.latitude,
231
+ this._rectangle,
232
+ maximumScreenSpaceError,
233
+ );
322
234
  }
323
235
 
324
- const customData = this.customData;
325
- for (let i = 0; i < added.length; ++i) {
326
- const data = added[i];
327
- customData.add(data);
236
+ /**
237
+ * Retrieves a cached position for the specified cartographic position.
238
+ *
239
+ *
240
+ * @param {Cartographic} cartographic - The cartographic coordinates.
241
+ * @param {number} maximumScreenSpaceError The maximum screen-space error, in pixels, that is allowed.
242
+ * A higher maximum error will render fewer tiles and improve performance, while a lower
243
+ * value will improve visual quality.
244
+ * @returns {object|undefined} The cached position data or undefined if not found.
245
+ */
246
+ getPositionCacheEntry(cartographic, maximumScreenSpaceError) {
247
+ const result = this._positionCache.get(
248
+ this._getCacheKey(cartographic, maximumScreenSpaceError),
249
+ );
250
+ return /** @type {object|undefined} */ (result);
251
+ }
328
252
 
329
- const child = childTileAtPosition(this, data.positionCartographic);
330
- child._addedCustomData.push(data);
253
+ /**
254
+ * Sets a position on the cache for this tile.
255
+ *
256
+ *
257
+ * @param {Cartographic} cartographic - The cartographic coordinates.
258
+ * @param {number} maximumScreenSpaceError The maximum screen-space error, in pixels, that is allowed.
259
+ * A higher maximum error will render fewer tiles and improve performance, while a lower
260
+ * value will improve visual quality.
261
+ * @param {object} value - The object to be cached.
262
+ */
263
+ setPositionCacheEntry(cartographic, maximumScreenSpaceError, value) {
264
+ this._positionCache.set(
265
+ this._getCacheKey(cartographic, maximumScreenSpaceError),
266
+ value,
267
+ );
331
268
  }
332
- this._addedCustomData.length = 0;
333
269
 
334
- for (let i = 0; i < removed.length; ++i) {
335
- const data = removed[i];
336
- if (customData.has(data)) {
337
- customData.delete(data);
270
+ /**
271
+ * Clears the position cache for this tile.
272
+ * This function removes all cached positions that were previously stored
273
+ * to optimize height computations.
274
+ *
275
+ */
276
+ clearPositionCache() {
277
+ if (this._positionCache.size > 0) {
278
+ this._positionCache.clear();
338
279
  }
339
-
340
- const child = childTileAtPosition(this, data.positionCartographic);
341
- child._removedCustomData.push(data);
342
280
  }
343
- this._removedCustomData.length = 0;
344
- };
345
281
 
346
- const splitPointScratch = new Cartographic();
282
+ updateCustomData() {
283
+ const added = this._addedCustomData;
284
+ const removed = this._removedCustomData;
285
+ if (added.length === 0 && removed.length === 0) {
286
+ return;
287
+ }
347
288
 
348
- /**
349
- * Determines which child tile that contains the specified position. Assumes the position is within
350
- * the bounds of the parent tile.
351
- * @private
352
- * @param {QuadtreeTile} tile - The parent tile.
353
- * @param {Cartographic} positionCartographic - The cartographic position.
354
- * @returns {QuadtreeTile} The child tile that contains the position.
355
- */
356
- function childTileAtPosition(tile, positionCartographic) {
357
- // Can't assume that a given tiling scheme divides a parent into four tiles at its rectangle's center.
358
- // But we can safely take any child tile's rectangle and take its center-facing corner as the parent's split point.
359
- const nwChildRectangle = tile.northwestChild.rectangle;
360
- const tileSplitPoint = Rectangle.southeast(
361
- nwChildRectangle,
362
- splitPointScratch,
363
- );
289
+ const customData = this.customData;
290
+ for (let i = 0; i < added.length; ++i) {
291
+ const data = /** @type {*} */ (added[i]);
292
+ customData.add(data);
364
293
 
365
- const x = positionCartographic.longitude >= tileSplitPoint.longitude ? 1 : 0;
366
- const y = positionCartographic.latitude < tileSplitPoint.latitude ? 1 : 0;
294
+ const child = childTileAtPosition(this, data.positionCartographic);
295
+ child._addedCustomData.push(data);
296
+ }
297
+ this._addedCustomData.length = 0;
367
298
 
368
- switch (y * 2 + x) {
369
- case 0:
370
- return tile.northwestChild;
371
- case 1:
372
- return tile.northeastChild;
373
- case 2:
374
- return tile.southwestChild;
375
- default:
376
- return tile.southeastChild;
299
+ for (let i = 0; i < removed.length; ++i) {
300
+ const data = /** @type {*} */ (removed[i]);
301
+ if (customData.has(data)) {
302
+ customData.delete(data);
303
+ }
304
+
305
+ const child = childTileAtPosition(this, data.positionCartographic);
306
+ child._removedCustomData.push(data);
307
+ }
308
+ this._removedCustomData.length = 0;
377
309
  }
378
- }
379
310
 
380
- Object.defineProperties(QuadtreeTile.prototype, {
381
311
  /**
382
312
  * Gets the tiling scheme used to tile the surface.
383
- * @memberof QuadtreeTile.prototype
384
313
  * @type {TilingScheme}
385
314
  */
386
- tilingScheme: {
387
- get: function () {
388
- return this._tilingScheme;
389
- },
390
- },
315
+ get tilingScheme() {
316
+ return this._tilingScheme;
317
+ }
391
318
 
392
319
  /**
393
320
  * Gets the tile X coordinate.
394
- * @memberof QuadtreeTile.prototype
395
321
  * @type {number}
396
322
  */
397
- x: {
398
- get: function () {
399
- return this._x;
400
- },
401
- },
323
+ get x() {
324
+ return this._x;
325
+ }
402
326
 
403
327
  /**
404
328
  * Gets the tile Y coordinate.
405
- * @memberof QuadtreeTile.prototype
406
329
  * @type {number}
407
330
  */
408
- y: {
409
- get: function () {
410
- return this._y;
411
- },
412
- },
331
+ get y() {
332
+ return this._y;
333
+ }
413
334
 
414
335
  /**
415
336
  * Gets the level-of-detail, where zero is the coarsest, least-detailed.
416
- * @memberof QuadtreeTile.prototype
417
337
  * @type {number}
418
338
  */
419
- level: {
420
- get: function () {
421
- return this._level;
422
- },
423
- },
339
+ get level() {
340
+ return this._level;
341
+ }
424
342
 
425
343
  /**
426
344
  * Gets the parent tile of this tile.
427
- * @memberof QuadtreeTile.prototype
428
345
  * @type {QuadtreeTile}
429
346
  */
430
- parent: {
431
- get: function () {
432
- return this._parent;
433
- },
434
- },
347
+ get parent() {
348
+ return this._parent;
349
+ }
435
350
 
436
351
  /**
437
352
  * Gets the cartographic rectangle of the tile, with north, south, east and
438
353
  * west properties in radians.
439
- * @memberof QuadtreeTile.prototype
440
354
  * @type {Rectangle}
441
355
  */
442
- rectangle: {
443
- get: function () {
444
- return this._rectangle;
445
- },
446
- },
356
+ get rectangle() {
357
+ return this._rectangle;
358
+ }
447
359
 
448
360
  /**
449
361
  * An array of tiles that is at the next level of the tile tree.
450
- * @memberof QuadtreeTile.prototype
451
362
  * @type {QuadtreeTile[]}
452
363
  */
453
- children: {
454
- get: function () {
455
- return [
456
- this.northwestChild,
457
- this.northeastChild,
458
- this.southwestChild,
459
- this.southeastChild,
460
- ];
461
- },
462
- },
364
+ get children() {
365
+ return [
366
+ this.northwestChild,
367
+ this.northeastChild,
368
+ this.southwestChild,
369
+ this.southeastChild,
370
+ ];
371
+ }
463
372
 
464
373
  /**
465
374
  * Gets the southwest child tile.
466
- * @memberof QuadtreeTile.prototype
467
375
  * @type {QuadtreeTile}
468
376
  */
469
- southwestChild: {
470
- get: function () {
471
- if (!defined(this._southwestChild)) {
472
- this._southwestChild = new QuadtreeTile({
473
- tilingScheme: this.tilingScheme,
474
- x: this.x * 2,
475
- y: this.y * 2 + 1,
476
- level: this.level + 1,
477
- parent: this,
478
- });
479
- }
480
- return this._southwestChild;
481
- },
482
- },
377
+ get southwestChild() {
378
+ if (!defined(this._southwestChild)) {
379
+ this._southwestChild = new QuadtreeTile({
380
+ tilingScheme: this.tilingScheme,
381
+ x: this.x * 2,
382
+ y: this.y * 2 + 1,
383
+ level: this.level + 1,
384
+ parent: this,
385
+ });
386
+ }
387
+ return this._southwestChild;
388
+ }
483
389
 
484
390
  /**
485
391
  * Gets the southeast child tile.
486
- * @memberof QuadtreeTile.prototype
487
392
  * @type {QuadtreeTile}
488
393
  */
489
- southeastChild: {
490
- get: function () {
491
- if (!defined(this._southeastChild)) {
492
- this._southeastChild = new QuadtreeTile({
493
- tilingScheme: this.tilingScheme,
494
- x: this.x * 2 + 1,
495
- y: this.y * 2 + 1,
496
- level: this.level + 1,
497
- parent: this,
498
- });
499
- }
500
- return this._southeastChild;
501
- },
502
- },
394
+ get southeastChild() {
395
+ if (!defined(this._southeastChild)) {
396
+ this._southeastChild = new QuadtreeTile({
397
+ tilingScheme: this.tilingScheme,
398
+ x: this.x * 2 + 1,
399
+ y: this.y * 2 + 1,
400
+ level: this.level + 1,
401
+ parent: this,
402
+ });
403
+ }
404
+ return this._southeastChild;
405
+ }
503
406
 
504
407
  /**
505
408
  * Gets the northwest child tile.
506
- * @memberof QuadtreeTile.prototype
507
409
  * @type {QuadtreeTile}
508
410
  */
509
- northwestChild: {
510
- get: function () {
511
- if (!defined(this._northwestChild)) {
512
- this._northwestChild = new QuadtreeTile({
513
- tilingScheme: this.tilingScheme,
514
- x: this.x * 2,
515
- y: this.y * 2,
516
- level: this.level + 1,
517
- parent: this,
518
- });
519
- }
520
- return this._northwestChild;
521
- },
522
- },
411
+ get northwestChild() {
412
+ if (!defined(this._northwestChild)) {
413
+ this._northwestChild = new QuadtreeTile({
414
+ tilingScheme: this.tilingScheme,
415
+ x: this.x * 2,
416
+ y: this.y * 2,
417
+ level: this.level + 1,
418
+ parent: this,
419
+ });
420
+ }
421
+ return this._northwestChild;
422
+ }
523
423
 
524
424
  /**
525
425
  * Gets the northeast child tile.
526
- * @memberof QuadtreeTile.prototype
527
426
  * @type {QuadtreeTile}
528
427
  */
529
- northeastChild: {
530
- get: function () {
531
- if (!defined(this._northeastChild)) {
532
- this._northeastChild = new QuadtreeTile({
533
- tilingScheme: this.tilingScheme,
534
- x: this.x * 2 + 1,
535
- y: this.y * 2,
536
- level: this.level + 1,
537
- parent: this,
538
- });
539
- }
540
- return this._northeastChild;
541
- },
542
- },
428
+ get northeastChild() {
429
+ if (!defined(this._northeastChild)) {
430
+ this._northeastChild = new QuadtreeTile({
431
+ tilingScheme: this.tilingScheme,
432
+ x: this.x * 2 + 1,
433
+ y: this.y * 2,
434
+ level: this.level + 1,
435
+ parent: this,
436
+ });
437
+ }
438
+ return this._northeastChild;
439
+ }
543
440
 
544
441
  /**
545
442
  * A set of objects associated with this tile.
546
- * @memberof QuadtreeTile.prototype
547
- * @type {Set}
443
+ * @type {Set<*>}
548
444
  */
549
- customData: {
550
- get: function () {
551
- return this._customData;
552
- },
553
- },
445
+ get customData() {
446
+ return this._customData;
447
+ }
554
448
 
555
449
  /**
556
450
  * Gets a value indicating whether or not this tile needs further loading.
557
451
  * This property will return true if the {@link QuadtreeTile#state} is
558
452
  * <code>START</code> or <code>LOADING</code>.
559
- * @memberof QuadtreeTile.prototype
560
453
  * @type {boolean}
561
454
  */
562
- needsLoading: {
563
- get: function () {
564
- return this.state < QuadtreeTileLoadState.DONE;
565
- },
566
- },
455
+ get needsLoading() {
456
+ return this.state < QuadtreeTileLoadState.DONE;
457
+ }
567
458
 
568
459
  /**
569
460
  * Gets a value indicating whether or not this tile is eligible to be unloaded.
@@ -573,157 +464,272 @@ Object.defineProperties(QuadtreeTile.prototype, {
573
464
  * property. If {@link QuadtreeTile#data} is defined and has an
574
465
  * <code>eligibleForUnloading</code> property, the value of that property is returned.
575
466
  * Otherwise, this property returns true.
576
- * @memberof QuadtreeTile.prototype
577
467
  * @type {boolean}
578
468
  */
579
- eligibleForUnloading: {
580
- get: function () {
581
- let result = true;
582
-
583
- if (defined(this.data)) {
584
- result = this.data.eligibleForUnloading;
585
- if (!defined(result)) {
586
- result = true;
587
- }
588
- }
469
+ get eligibleForUnloading() {
470
+ let result = true;
589
471
 
590
- return result;
591
- },
592
- },
593
- });
472
+ if (defined(this.data)) {
473
+ result = /** @type {*} */ (this.data).eligibleForUnloading;
474
+ if (!defined(result)) {
475
+ result = true;
476
+ }
477
+ }
594
478
 
595
- QuadtreeTile.prototype.findLevelZeroTile = function (levelZeroTiles, x, y) {
596
- const xTiles = this.tilingScheme.getNumberOfXTilesAtLevel(0);
597
- if (x < 0) {
598
- x += xTiles;
599
- } else if (x >= xTiles) {
600
- x -= xTiles;
479
+ return result;
601
480
  }
602
481
 
603
- if (y < 0 || y >= this.tilingScheme.getNumberOfYTilesAtLevel(0)) {
604
- return undefined;
605
- }
482
+ /**
483
+ * @param {QuadtreeTile[]} levelZeroTiles
484
+ * @param {number} x
485
+ * @param {number} y
486
+ * @returns {QuadtreeTile}
487
+ */
488
+ findLevelZeroTile(levelZeroTiles, x, y) {
489
+ const xTiles = this.tilingScheme.getNumberOfXTilesAtLevel(0);
490
+ if (x < 0) {
491
+ x += xTiles;
492
+ } else if (x >= xTiles) {
493
+ x -= xTiles;
494
+ }
606
495
 
607
- return levelZeroTiles.filter(function (tile) {
608
- return tile.x === x && tile.y === y;
609
- })[0];
610
- };
496
+ if (y < 0 || y >= this.tilingScheme.getNumberOfYTilesAtLevel(0)) {
497
+ return undefined;
498
+ }
611
499
 
612
- QuadtreeTile.prototype.findTileToWest = function (levelZeroTiles) {
613
- const parent = this.parent;
614
- if (parent === undefined) {
615
- return this.findLevelZeroTile(levelZeroTiles, this.x - 1, this.y);
500
+ return levelZeroTiles.filter(function (tile) {
501
+ return tile.x === x && tile.y === y;
502
+ })[0];
616
503
  }
617
504
 
618
- if (parent.southeastChild === this) {
619
- return parent.southwestChild;
620
- } else if (parent.northeastChild === this) {
621
- return parent.northwestChild;
622
- }
505
+ /**
506
+ * @param {QuadtreeTile[]} levelZeroTiles
507
+ * @returns {QuadtreeTile|undefined}
508
+ */
509
+ findTileToWest(levelZeroTiles) {
510
+ const parent = this.parent;
511
+ if (parent === undefined) {
512
+ return this.findLevelZeroTile(levelZeroTiles, this.x - 1, this.y);
513
+ }
623
514
 
624
- const westOfParent = parent.findTileToWest(levelZeroTiles);
625
- if (westOfParent === undefined) {
626
- return undefined;
627
- } else if (parent.southwestChild === this) {
628
- return westOfParent.southeastChild;
629
- }
630
- return westOfParent.northeastChild;
631
- };
515
+ if (parent.southeastChild === this) {
516
+ return parent.southwestChild;
517
+ } else if (parent.northeastChild === this) {
518
+ return parent.northwestChild;
519
+ }
632
520
 
633
- QuadtreeTile.prototype.findTileToEast = function (levelZeroTiles) {
634
- const parent = this.parent;
635
- if (parent === undefined) {
636
- return this.findLevelZeroTile(levelZeroTiles, this.x + 1, this.y);
521
+ const westOfParent = parent.findTileToWest(levelZeroTiles);
522
+ if (westOfParent === undefined) {
523
+ return undefined;
524
+ } else if (parent.southwestChild === this) {
525
+ return westOfParent.southeastChild;
526
+ }
527
+ return westOfParent.northeastChild;
637
528
  }
638
529
 
639
- if (parent.southwestChild === this) {
640
- return parent.southeastChild;
641
- } else if (parent.northwestChild === this) {
642
- return parent.northeastChild;
643
- }
530
+ /**
531
+ * @param {QuadtreeTile[]} levelZeroTiles
532
+ * @returns {QuadtreeTile|undefined}
533
+ */
534
+ findTileToEast(levelZeroTiles) {
535
+ const parent = this.parent;
536
+ if (parent === undefined) {
537
+ return this.findLevelZeroTile(levelZeroTiles, this.x + 1, this.y);
538
+ }
644
539
 
645
- const eastOfParent = parent.findTileToEast(levelZeroTiles);
646
- if (eastOfParent === undefined) {
647
- return undefined;
648
- } else if (parent.southeastChild === this) {
649
- return eastOfParent.southwestChild;
650
- }
651
- return eastOfParent.northwestChild;
652
- };
540
+ if (parent.southwestChild === this) {
541
+ return parent.southeastChild;
542
+ } else if (parent.northwestChild === this) {
543
+ return parent.northeastChild;
544
+ }
653
545
 
654
- QuadtreeTile.prototype.findTileToSouth = function (levelZeroTiles) {
655
- const parent = this.parent;
656
- if (parent === undefined) {
657
- return this.findLevelZeroTile(levelZeroTiles, this.x, this.y + 1);
546
+ const eastOfParent = parent.findTileToEast(levelZeroTiles);
547
+ if (eastOfParent === undefined) {
548
+ return undefined;
549
+ } else if (parent.southeastChild === this) {
550
+ return eastOfParent.southwestChild;
551
+ }
552
+ return eastOfParent.northwestChild;
658
553
  }
659
554
 
660
- if (parent.northwestChild === this) {
661
- return parent.southwestChild;
662
- } else if (parent.northeastChild === this) {
663
- return parent.southeastChild;
664
- }
555
+ /**
556
+ * @param {QuadtreeTile[]} levelZeroTiles
557
+ * @returns {QuadtreeTile|undefined}
558
+ */
559
+ findTileToSouth(levelZeroTiles) {
560
+ const parent = this.parent;
561
+ if (parent === undefined) {
562
+ return this.findLevelZeroTile(levelZeroTiles, this.x, this.y + 1);
563
+ }
665
564
 
666
- const southOfParent = parent.findTileToSouth(levelZeroTiles);
667
- if (southOfParent === undefined) {
668
- return undefined;
669
- } else if (parent.southwestChild === this) {
670
- return southOfParent.northwestChild;
671
- }
672
- return southOfParent.northeastChild;
673
- };
565
+ if (parent.northwestChild === this) {
566
+ return parent.southwestChild;
567
+ } else if (parent.northeastChild === this) {
568
+ return parent.southeastChild;
569
+ }
674
570
 
675
- QuadtreeTile.prototype.findTileToNorth = function (levelZeroTiles) {
676
- const parent = this.parent;
677
- if (parent === undefined) {
678
- return this.findLevelZeroTile(levelZeroTiles, this.x, this.y - 1);
571
+ const southOfParent = parent.findTileToSouth(levelZeroTiles);
572
+ if (southOfParent === undefined) {
573
+ return undefined;
574
+ } else if (parent.southwestChild === this) {
575
+ return southOfParent.northwestChild;
576
+ }
577
+ return southOfParent.northeastChild;
679
578
  }
680
579
 
681
- if (parent.southwestChild === this) {
682
- return parent.northwestChild;
683
- } else if (parent.southeastChild === this) {
684
- return parent.northeastChild;
580
+ /**
581
+ * @param {QuadtreeTile[]} levelZeroTiles
582
+ * @returns {QuadtreeTile|undefined}
583
+ */
584
+ findTileToNorth(levelZeroTiles) {
585
+ const parent = this.parent;
586
+ if (parent === undefined) {
587
+ return this.findLevelZeroTile(levelZeroTiles, this.x, this.y - 1);
588
+ }
589
+
590
+ if (parent.southwestChild === this) {
591
+ return parent.northwestChild;
592
+ } else if (parent.southeastChild === this) {
593
+ return parent.northeastChild;
594
+ }
595
+
596
+ const northOfParent = parent.findTileToNorth(levelZeroTiles);
597
+ if (northOfParent === undefined) {
598
+ return undefined;
599
+ } else if (parent.northwestChild === this) {
600
+ return northOfParent.southwestChild;
601
+ }
602
+ return northOfParent.southeastChild;
685
603
  }
686
604
 
687
- const northOfParent = parent.findTileToNorth(levelZeroTiles);
688
- if (northOfParent === undefined) {
689
- return undefined;
690
- } else if (parent.northwestChild === this) {
691
- return northOfParent.southwestChild;
605
+ /**
606
+ * Frees the resources associated with this tile and returns it to the <code>START</code>
607
+ * {@link QuadtreeTileLoadState}. If the {@link QuadtreeTile#data} property is defined and it
608
+ * has a <code>freeResources</code> method, the method will be invoked.
609
+ *
610
+ */
611
+ freeResources() {
612
+ // Clears cached heights when the tile is freed
613
+ this.clearPositionCache();
614
+ this.state = QuadtreeTileLoadState.START;
615
+ this.renderable = false;
616
+ this.upsampledFromParent = false;
617
+
618
+ const data = /** @type {*} */ (this.data);
619
+ if (defined(data) && defined(data.freeResources)) {
620
+ data.freeResources();
621
+ }
622
+
623
+ freeTile(this._southwestChild);
624
+ this._southwestChild = undefined;
625
+ freeTile(this._southeastChild);
626
+ this._southeastChild = undefined;
627
+ freeTile(this._northwestChild);
628
+ this._northwestChild = undefined;
629
+ freeTile(this._northeastChild);
630
+ this._northeastChild = undefined;
692
631
  }
693
- return northOfParent.southeastChild;
694
- };
632
+ }
695
633
 
696
634
  /**
697
- * Frees the resources associated with this tile and returns it to the <code>START</code>
698
- * {@link QuadtreeTileLoadState}. If the {@link QuadtreeTile#data} property is defined and it
699
- * has a <code>freeResources</code> method, the method will be invoked.
635
+ * Creates a spatial hash key for the given longitude, latitude, and tile level.
636
+ * The precision is adjusted based on the tile level and extent to achieve finer precision at higher levels.
700
637
  *
701
- * @memberof QuadtreeTile
638
+ * This function calculates the spatial hash key by first determining the precision at the given tile for the current maximum screenspace error (MAX_ERROR_PX),
639
+ * and then rounding the longitude and latitude to that precision for consistency.
640
+ *
641
+ * The steps for computing the level precision are as follows:
642
+ *
643
+ * 1. Compute the resolution (meters per pixel) at the given level:
644
+ * level_resolution_m = (2 * PI * RADIUS) / (2^level * TILE_SIZE)
645
+ *
646
+ * 2. Compute the target precision in meters:
647
+ * level_precision_m = level_resolution_m * MAX_ERROR_PX
648
+ *
649
+ * 3. Compute the target precision to radians:
650
+ * level_precision_rad = level_precision_m / BODY_RADIUS
651
+ *
652
+ * This simplifies to:
653
+ * level_precision_rad = (2 * PI * MAX_ERROR_PX) / (2^level * TILE_SIZE)
654
+ * which can also be written as:
655
+ * level_precision_rad = (PI * MAX_ERROR_PX) / (2^(level-1) * TILE_SIZE)
656
+ *
657
+ * The computed level_precision_rad is then used to round the input longitude and latitude,
658
+ * ensuring that positions that fall within the same spatial bin produce the same hash key.
659
+ *
660
+ * The constants below are computed once since they are fixed for the given configuration.
661
+ *
662
+ * @param {number} longitude - The longitude in radians.
663
+ * @param {number} latitude - The latitude in radians.
664
+ * @param {Rectangle} rectangle - The quadtree tile extents.
665
+ * @returns {string} A string representing the spatial hash key.
702
666
  */
703
- QuadtreeTile.prototype.freeResources = function () {
704
- // Clears cached heights when the tile is freed
705
- this.clearPositionCache();
706
- this.state = QuadtreeTileLoadState.START;
707
- this.renderable = false;
708
- this.upsampledFromParent = false;
709
-
710
- if (defined(this.data) && defined(this.data.freeResources)) {
711
- this.data.freeResources();
712
- }
713
-
714
- freeTile(this._southwestChild);
715
- this._southwestChild = undefined;
716
- freeTile(this._southeastChild);
717
- this._southeastChild = undefined;
718
- freeTile(this._northwestChild);
719
- this._northwestChild = undefined;
720
- freeTile(this._northeastChild);
721
- this._northeastChild = undefined;
722
- };
667
+ const TILE_SIZE = 256;
723
668
 
669
+ /**
670
+ * @param {number} longitude
671
+ * @param {number} latitude
672
+ * @param {Rectangle} rectangle
673
+ * @param {number} maximumScreenSpaceError
674
+ * @returns {string}
675
+ * @ignore
676
+ */
677
+ function createSpatialHashKey(
678
+ longitude,
679
+ latitude,
680
+ rectangle,
681
+ maximumScreenSpaceError,
682
+ ) {
683
+ // Adjust precision based on quadtree level - higher levels get finer precision
684
+ const maxError = (rectangle.width / TILE_SIZE) * maximumScreenSpaceError;
685
+ // Round to the grid precision
686
+ const lonGrid = Math.floor(longitude / maxError) * maxError;
687
+ const latGrid = Math.floor(latitude / maxError) * maxError;
688
+ return `${lonGrid.toFixed(10)},${latGrid.toFixed(10)}`;
689
+ }
690
+
691
+ const splitPointScratch = new Cartographic();
692
+
693
+ /**
694
+ * Determines which child tile that contains the specified position. Assumes the position is within
695
+ * the bounds of the parent tile.
696
+ * @private
697
+ * @param {QuadtreeTile} tile - The parent tile.
698
+ * @param {Cartographic} positionCartographic - The cartographic position.
699
+ * @returns {QuadtreeTile} The child tile that contains the position.
700
+ */
701
+ function childTileAtPosition(tile, positionCartographic) {
702
+ // Can't assume that a given tiling scheme divides a parent into four tiles at its rectangle's center.
703
+ // But we can safely take any child tile's rectangle and take its center-facing corner as the parent's split point.
704
+ const nwChildRectangle = tile.northwestChild.rectangle;
705
+ const tileSplitPoint = Rectangle.southeast(
706
+ nwChildRectangle,
707
+ splitPointScratch,
708
+ );
709
+
710
+ const x = positionCartographic.longitude >= tileSplitPoint.longitude ? 1 : 0;
711
+ const y = positionCartographic.latitude < tileSplitPoint.latitude ? 1 : 0;
712
+
713
+ switch (y * 2 + x) {
714
+ case 0:
715
+ return tile.northwestChild;
716
+ case 1:
717
+ return tile.northeastChild;
718
+ case 2:
719
+ return tile.southwestChild;
720
+ default:
721
+ return tile.southeastChild;
722
+ }
723
+ }
724
+
725
+ /**
726
+ * @param {QuadtreeTile} tile
727
+ * @ignore
728
+ */
724
729
  function freeTile(tile) {
725
730
  if (defined(tile)) {
726
731
  tile.freeResources();
727
732
  }
728
733
  }
734
+
729
735
  export default QuadtreeTile;