@loaders.gl/tiles 5.0.0-alpha.12 → 5.0.0-alpha.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (716) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +18 -72
  3. package/dist/dist.dev.js +6979 -42928
  4. package/dist/dist.min.js +3 -22
  5. package/dist/image-set.d.ts +1 -1
  6. package/dist/image-set.d.ts.map +1 -1
  7. package/dist/index.cjs +2847 -8781
  8. package/dist/index.cjs.map +3 -4
  9. package/dist/index.d.ts +4 -45
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +3 -27
  12. package/dist/index.js.map +1 -1
  13. package/dist/mlt/bundled.d.ts +3 -0
  14. package/dist/mlt/bundled.d.ts.map +1 -0
  15. package/dist/mlt/bundled.js +5 -0
  16. package/dist/mlt/bundled.js.map +1 -0
  17. package/dist/mlt/index.cjs +3701 -0
  18. package/dist/mlt/index.cjs.map +6 -0
  19. package/dist/mlt/index.d.ts +10 -0
  20. package/dist/mlt/index.d.ts.map +1 -0
  21. package/dist/mlt/index.js +12 -0
  22. package/dist/mlt/index.js.map +1 -0
  23. package/dist/mlt/lib/encode-mlt-geometry.d.ts +6 -0
  24. package/dist/mlt/lib/encode-mlt-geometry.d.ts.map +1 -0
  25. package/dist/mlt/lib/encode-mlt-geometry.js +150 -0
  26. package/dist/mlt/lib/encode-mlt-geometry.js.map +1 -0
  27. package/dist/mlt/lib/encode-mlt-streams.d.ts +13 -0
  28. package/dist/mlt/lib/encode-mlt-streams.d.ts.map +1 -0
  29. package/dist/mlt/lib/encode-mlt-streams.js +57 -0
  30. package/dist/mlt/lib/encode-mlt-streams.js.map +1 -0
  31. package/dist/mlt/lib/encode-mlt.d.ts +6 -0
  32. package/dist/mlt/lib/encode-mlt.d.ts.map +1 -0
  33. package/dist/mlt/lib/encode-mlt.js +174 -0
  34. package/dist/mlt/lib/encode-mlt.js.map +1 -0
  35. package/dist/mlt/lib/parse-mlt.d.ts +11 -0
  36. package/dist/mlt/lib/parse-mlt.d.ts.map +1 -0
  37. package/dist/mlt/lib/parse-mlt.js +675 -0
  38. package/dist/mlt/lib/parse-mlt.js.map +1 -0
  39. package/dist/mlt/mlt-format.d.ts +14 -0
  40. package/dist/mlt/mlt-format.d.ts.map +1 -0
  41. package/dist/mlt/mlt-format.js +17 -0
  42. package/dist/mlt/mlt-format.js.map +1 -0
  43. package/dist/mlt/mlt-loader-with-parser.d.ts +91 -0
  44. package/dist/mlt/mlt-loader-with-parser.d.ts.map +1 -0
  45. package/dist/mlt/mlt-loader-with-parser.js +29 -0
  46. package/dist/mlt/mlt-loader-with-parser.js.map +1 -0
  47. package/dist/mlt/mlt-loader.d.ts +115 -0
  48. package/dist/mlt/mlt-loader.d.ts.map +1 -0
  49. package/dist/mlt/mlt-loader.js +38 -0
  50. package/dist/mlt/mlt-loader.js.map +1 -0
  51. package/dist/mlt/mlt-source-loader.d.ts +82 -0
  52. package/dist/mlt/mlt-source-loader.d.ts.map +1 -0
  53. package/dist/mlt/mlt-source-loader.js +179 -0
  54. package/dist/mlt/mlt-source-loader.js.map +1 -0
  55. package/dist/mlt/mlt-writer.d.ts +45 -0
  56. package/dist/mlt/mlt-writer.d.ts.map +1 -0
  57. package/dist/mlt/mlt-writer.js +21 -0
  58. package/dist/mlt/mlt-writer.js.map +1 -0
  59. package/dist/mlt/unbundled.d.ts +3 -0
  60. package/dist/mlt/unbundled.d.ts.map +1 -0
  61. package/dist/mlt/unbundled.js +5 -0
  62. package/dist/mlt/unbundled.js.map +1 -0
  63. package/dist/mvt/arrow-table-tile-source-loader-types.d.ts +36 -0
  64. package/dist/mvt/arrow-table-tile-source-loader-types.d.ts.map +1 -0
  65. package/dist/mvt/arrow-table-tile-source-loader-types.js +36 -0
  66. package/dist/mvt/arrow-table-tile-source-loader-types.js.map +1 -0
  67. package/dist/mvt/arrow-table-tile-source-loader.cjs +6343 -0
  68. package/dist/mvt/arrow-table-tile-source-loader.cjs.map +6 -0
  69. package/dist/mvt/arrow-table-tile-source-loader.d.ts +69 -0
  70. package/dist/mvt/arrow-table-tile-source-loader.d.ts.map +1 -0
  71. package/dist/mvt/arrow-table-tile-source-loader.js +216 -0
  72. package/dist/mvt/arrow-table-tile-source-loader.js.map +1 -0
  73. package/dist/mvt/arrow-table-tile-source-types.d.ts +21 -0
  74. package/dist/mvt/arrow-table-tile-source-types.d.ts.map +1 -0
  75. package/dist/mvt/arrow-table-tile-source-types.js +6 -0
  76. package/dist/mvt/arrow-table-tile-source-types.js.map +1 -0
  77. package/dist/mvt/bundled.d.ts +6 -0
  78. package/dist/mvt/bundled.d.ts.map +1 -0
  79. package/dist/mvt/bundled.js +7 -0
  80. package/dist/mvt/bundled.js.map +1 -0
  81. package/dist/mvt/dist.dev.js +46689 -0
  82. package/dist/mvt/dist.min.js +94 -0
  83. package/dist/mvt/index.cjs +10095 -0
  84. package/dist/mvt/index.cjs.map +6 -0
  85. package/dist/mvt/index.d.ts +28 -0
  86. package/dist/mvt/index.d.ts.map +1 -0
  87. package/dist/mvt/index.js +27 -0
  88. package/dist/mvt/index.js.map +1 -0
  89. package/dist/mvt/lib/encode-mvt-arrow.d.ts +6 -0
  90. package/dist/mvt/lib/encode-mvt-arrow.d.ts.map +1 -0
  91. package/dist/mvt/lib/encode-mvt-arrow.js +225 -0
  92. package/dist/mvt/lib/encode-mvt-arrow.js.map +1 -0
  93. package/dist/mvt/lib/encode-mvt.d.ts +30 -0
  94. package/dist/mvt/lib/encode-mvt.d.ts.map +1 -0
  95. package/dist/mvt/lib/encode-mvt.js +20 -0
  96. package/dist/mvt/lib/encode-mvt.js.map +1 -0
  97. package/dist/mvt/lib/get-schemas-from-tilejson.d.ts +4 -0
  98. package/dist/mvt/lib/get-schemas-from-tilejson.d.ts.map +1 -0
  99. package/dist/mvt/lib/get-schemas-from-tilejson.js +56 -0
  100. package/dist/mvt/lib/get-schemas-from-tilejson.js.map +1 -0
  101. package/dist/mvt/lib/is-longitude-latitude-crs.d.ts +3 -0
  102. package/dist/mvt/lib/is-longitude-latitude-crs.d.ts.map +1 -0
  103. package/dist/mvt/lib/is-longitude-latitude-crs.js +13 -0
  104. package/dist/mvt/lib/is-longitude-latitude-crs.js.map +1 -0
  105. package/dist/mvt/lib/mapbox-vt-pbf/geojson-wrapper.d.ts +25 -0
  106. package/dist/mvt/lib/mapbox-vt-pbf/geojson-wrapper.d.ts.map +1 -0
  107. package/dist/mvt/lib/mapbox-vt-pbf/geojson-wrapper.js +73 -0
  108. package/dist/mvt/lib/mapbox-vt-pbf/geojson-wrapper.js.map +1 -0
  109. package/dist/mvt/lib/mapbox-vt-pbf/to-vector-tile.d.ts +52 -0
  110. package/dist/mvt/lib/mapbox-vt-pbf/to-vector-tile.d.ts.map +1 -0
  111. package/dist/mvt/lib/mapbox-vt-pbf/to-vector-tile.js +165 -0
  112. package/dist/mvt/lib/mapbox-vt-pbf/to-vector-tile.js.map +1 -0
  113. package/dist/mvt/lib/mvt-pbf/mvt-constants.d.ts +116 -0
  114. package/dist/mvt/lib/mvt-pbf/mvt-constants.d.ts.map +1 -0
  115. package/dist/mvt/lib/mvt-pbf/mvt-constants.js +127 -0
  116. package/dist/mvt/lib/mvt-pbf/mvt-constants.js.map +1 -0
  117. package/dist/mvt/lib/mvt-pbf/mvt-types.d.ts +17 -0
  118. package/dist/mvt/lib/mvt-pbf/mvt-types.d.ts.map +1 -0
  119. package/dist/mvt/lib/mvt-pbf/mvt-types.js +5 -0
  120. package/dist/mvt/lib/mvt-pbf/mvt-types.js.map +1 -0
  121. package/dist/mvt/lib/mvt-pbf/parse-geometry-from-pbf.d.ts +77 -0
  122. package/dist/mvt/lib/mvt-pbf/parse-geometry-from-pbf.d.ts.map +1 -0
  123. package/dist/mvt/lib/mvt-pbf/parse-geometry-from-pbf.js +235 -0
  124. package/dist/mvt/lib/mvt-pbf/parse-geometry-from-pbf.js.map +1 -0
  125. package/dist/mvt/lib/mvt-pbf/parse-mvt-from-pbf.d.ts +25 -0
  126. package/dist/mvt/lib/mvt-pbf/parse-mvt-from-pbf.d.ts.map +1 -0
  127. package/dist/mvt/lib/mvt-pbf/parse-mvt-from-pbf.js +263 -0
  128. package/dist/mvt/lib/mvt-pbf/parse-mvt-from-pbf.js.map +1 -0
  129. package/dist/mvt/lib/mvt-pbf/write-mvt-to-pbf.d.ts +4 -0
  130. package/dist/mvt/lib/mvt-pbf/write-mvt-to-pbf.d.ts.map +1 -0
  131. package/dist/mvt/lib/mvt-pbf/write-mvt-to-pbf.js +134 -0
  132. package/dist/mvt/lib/mvt-pbf/write-mvt-to-pbf.js.map +1 -0
  133. package/dist/mvt/lib/mvt-worker-transport.d.ts +15 -0
  134. package/dist/mvt/lib/mvt-worker-transport.d.ts.map +1 -0
  135. package/dist/mvt/lib/mvt-worker-transport.js +54 -0
  136. package/dist/mvt/lib/mvt-worker-transport.js.map +1 -0
  137. package/dist/mvt/lib/parse-mvt-geojson.d.ts +6 -0
  138. package/dist/mvt/lib/parse-mvt-geojson.d.ts.map +1 -0
  139. package/dist/mvt/lib/parse-mvt-geojson.js +48 -0
  140. package/dist/mvt/lib/parse-mvt-geojson.js.map +1 -0
  141. package/dist/mvt/lib/parse-mvt.d.ts +14 -0
  142. package/dist/mvt/lib/parse-mvt.d.ts.map +1 -0
  143. package/dist/mvt/lib/parse-mvt.js +105 -0
  144. package/dist/mvt/lib/parse-mvt.js.map +1 -0
  145. package/dist/mvt/lib/parse-tilejson.d.ts +74 -0
  146. package/dist/mvt/lib/parse-tilejson.d.ts.map +1 -0
  147. package/dist/mvt/lib/parse-tilejson.js +267 -0
  148. package/dist/mvt/lib/parse-tilejson.js.map +1 -0
  149. package/dist/mvt/lib/resolve-table-tile-parameters.d.ts +4 -0
  150. package/dist/mvt/lib/resolve-table-tile-parameters.d.ts.map +1 -0
  151. package/dist/mvt/lib/resolve-table-tile-parameters.js +16 -0
  152. package/dist/mvt/lib/resolve-table-tile-parameters.js.map +1 -0
  153. package/dist/mvt/lib/types.d.ts +88 -0
  154. package/dist/mvt/lib/types.d.ts.map +1 -0
  155. package/dist/mvt/lib/types.js.map +1 -0
  156. package/dist/mvt/lib/utils/geometry-utils.d.ts +83 -0
  157. package/dist/mvt/lib/utils/geometry-utils.d.ts.map +1 -0
  158. package/dist/mvt/lib/utils/geometry-utils.js +211 -0
  159. package/dist/mvt/lib/utils/geometry-utils.js.map +1 -0
  160. package/dist/mvt/lib/vector-tile/vector-tile-feature.d.ts +72 -0
  161. package/dist/mvt/lib/vector-tile/vector-tile-feature.d.ts.map +1 -0
  162. package/dist/mvt/lib/vector-tile/vector-tile-feature.js +350 -0
  163. package/dist/mvt/lib/vector-tile/vector-tile-feature.js.map +1 -0
  164. package/dist/mvt/lib/vector-tile/vector-tile-layer.d.ts +29 -0
  165. package/dist/mvt/lib/vector-tile/vector-tile-layer.d.ts.map +1 -0
  166. package/dist/mvt/lib/vector-tile/vector-tile-layer.js +108 -0
  167. package/dist/mvt/lib/vector-tile/vector-tile-layer.js.map +1 -0
  168. package/dist/mvt/lib/vector-tile/vector-tile.d.ts +9 -0
  169. package/dist/mvt/lib/vector-tile/vector-tile.d.ts.map +1 -0
  170. package/dist/mvt/lib/vector-tile/vector-tile.js +28 -0
  171. package/dist/mvt/lib/vector-tile/vector-tile.js.map +1 -0
  172. package/dist/mvt/lib/vector-tiler/arrow-tile.d.ts +6 -0
  173. package/dist/mvt/lib/vector-tiler/arrow-tile.d.ts.map +1 -0
  174. package/dist/mvt/lib/vector-tiler/arrow-tile.js +84 -0
  175. package/dist/mvt/lib/vector-tiler/arrow-tile.js.map +1 -0
  176. package/dist/mvt/lib/vector-tiler/features/clip-features.d.ts +16 -0
  177. package/dist/mvt/lib/vector-tiler/features/clip-features.d.ts.map +1 -0
  178. package/dist/mvt/lib/vector-tiler/features/clip-features.js +211 -0
  179. package/dist/mvt/lib/vector-tiler/features/clip-features.js.map +1 -0
  180. package/dist/mvt/lib/vector-tiler/features/convert-feature.d.ts +18 -0
  181. package/dist/mvt/lib/vector-tiler/features/convert-feature.d.ts.map +1 -0
  182. package/dist/mvt/lib/vector-tiler/features/convert-feature.js +161 -0
  183. package/dist/mvt/lib/vector-tiler/features/convert-feature.js.map +1 -0
  184. package/dist/mvt/lib/vector-tiler/features/proto-feature.d.ts +30 -0
  185. package/dist/mvt/lib/vector-tiler/features/proto-feature.d.ts.map +1 -0
  186. package/dist/mvt/lib/vector-tiler/features/proto-feature.js +53 -0
  187. package/dist/mvt/lib/vector-tiler/features/proto-feature.js.map +1 -0
  188. package/dist/mvt/lib/vector-tiler/features/simplify-path.d.ts +10 -0
  189. package/dist/mvt/lib/vector-tiler/features/simplify-path.d.ts.map +1 -0
  190. package/dist/mvt/lib/vector-tiler/features/simplify-path.js +67 -0
  191. package/dist/mvt/lib/vector-tiler/features/simplify-path.js.map +1 -0
  192. package/dist/mvt/lib/vector-tiler/features/wrap-features.d.ts +17 -0
  193. package/dist/mvt/lib/vector-tiler/features/wrap-features.d.ts.map +1 -0
  194. package/dist/mvt/lib/vector-tiler/features/wrap-features.js +95 -0
  195. package/dist/mvt/lib/vector-tiler/features/wrap-features.js.map +1 -0
  196. package/dist/mvt/lib/vector-tiler/proto-tile.d.ts +40 -0
  197. package/dist/mvt/lib/vector-tiler/proto-tile.d.ts.map +1 -0
  198. package/dist/mvt/lib/vector-tiler/proto-tile.js +139 -0
  199. package/dist/mvt/lib/vector-tiler/proto-tile.js.map +1 -0
  200. package/dist/mvt/lib/vector-tiler/tile-to-geojson.d.ts +12 -0
  201. package/dist/mvt/lib/vector-tiler/tile-to-geojson.d.ts.map +1 -0
  202. package/dist/mvt/lib/vector-tiler/tile-to-geojson.js +81 -0
  203. package/dist/mvt/lib/vector-tiler/tile-to-geojson.js.map +1 -0
  204. package/dist/mvt/lib/vector-tiler/transform-tile.d.ts +7 -0
  205. package/dist/mvt/lib/vector-tiler/transform-tile.d.ts.map +1 -0
  206. package/dist/mvt/lib/vector-tiler/transform-tile.js +42 -0
  207. package/dist/mvt/lib/vector-tiler/transform-tile.js.map +1 -0
  208. package/dist/mvt/map-style-format.d.ts +13 -0
  209. package/dist/mvt/map-style-format.d.ts.map +1 -0
  210. package/dist/mvt/map-style-format.js +16 -0
  211. package/dist/mvt/map-style-format.js.map +1 -0
  212. package/dist/mvt/map-style-loader-with-parser.d.ts +26 -0
  213. package/dist/mvt/map-style-loader-with-parser.d.ts.map +1 -0
  214. package/dist/mvt/map-style-loader-with-parser.js +38 -0
  215. package/dist/mvt/map-style-loader-with-parser.js.map +1 -0
  216. package/dist/mvt/map-style-loader.d.ts +44 -0
  217. package/dist/mvt/map-style-loader.d.ts.map +1 -0
  218. package/dist/mvt/map-style-loader.js +25 -0
  219. package/dist/mvt/map-style-loader.js.map +1 -0
  220. package/dist/mvt/map-style-schema.d.ts +58 -0
  221. package/dist/mvt/map-style-schema.d.ts.map +1 -0
  222. package/dist/mvt/map-style-schema.js +47 -0
  223. package/dist/mvt/map-style-schema.js.map +1 -0
  224. package/dist/mvt/map-style.d.ts +110 -0
  225. package/dist/mvt/map-style.d.ts.map +1 -0
  226. package/dist/mvt/map-style.js +90 -0
  227. package/dist/mvt/map-style.js.map +1 -0
  228. package/dist/mvt/mvt-format.d.ts +14 -0
  229. package/dist/mvt/mvt-format.d.ts.map +1 -0
  230. package/dist/mvt/mvt-format.js +23 -0
  231. package/dist/mvt/mvt-format.js.map +1 -0
  232. package/dist/mvt/mvt-geojson-loader-types.d.ts +82 -0
  233. package/dist/mvt/mvt-geojson-loader-types.d.ts.map +1 -0
  234. package/dist/mvt/mvt-geojson-loader-types.js +34 -0
  235. package/dist/mvt/mvt-geojson-loader-types.js.map +1 -0
  236. package/dist/mvt/mvt-geojson-loader.cjs +1366 -0
  237. package/dist/mvt/mvt-geojson-loader.cjs.map +6 -0
  238. package/dist/mvt/mvt-geojson-loader.d.ts +32 -0
  239. package/dist/mvt/mvt-geojson-loader.d.ts.map +1 -0
  240. package/dist/mvt/mvt-geojson-loader.js +13 -0
  241. package/dist/mvt/mvt-geojson-loader.js.map +1 -0
  242. package/dist/mvt/mvt-loader-with-parser.d.ts +105 -0
  243. package/dist/mvt/mvt-loader-with-parser.d.ts.map +1 -0
  244. package/dist/mvt/mvt-loader-with-parser.js +21 -0
  245. package/dist/mvt/mvt-loader-with-parser.js.map +1 -0
  246. package/dist/mvt/mvt-loader.d.ts +129 -0
  247. package/dist/mvt/mvt-loader.d.ts.map +1 -0
  248. package/dist/mvt/mvt-loader.js +40 -0
  249. package/dist/mvt/mvt-loader.js.map +1 -0
  250. package/dist/mvt/mvt-source-loader.d.ts +102 -0
  251. package/dist/mvt/mvt-source-loader.d.ts.map +1 -0
  252. package/dist/mvt/mvt-source-loader.js +275 -0
  253. package/dist/mvt/mvt-source-loader.js.map +1 -0
  254. package/dist/mvt/mvt-writer.d.ts +28 -0
  255. package/dist/mvt/mvt-writer.d.ts.map +1 -0
  256. package/dist/mvt/mvt-writer.js +32 -0
  257. package/dist/mvt/mvt-writer.js.map +1 -0
  258. package/dist/mvt/table-tile-source-loader.d.ts +169 -0
  259. package/dist/mvt/table-tile-source-loader.d.ts.map +1 -0
  260. package/dist/mvt/table-tile-source-loader.js +478 -0
  261. package/dist/mvt/table-tile-source-loader.js.map +1 -0
  262. package/dist/mvt/tilejson-format.d.ts +13 -0
  263. package/dist/mvt/tilejson-format.d.ts.map +1 -0
  264. package/dist/mvt/tilejson-format.js +16 -0
  265. package/dist/mvt/tilejson-format.js.map +1 -0
  266. package/dist/mvt/tilejson-loader-with-parser.d.ts +13 -0
  267. package/dist/mvt/tilejson-loader-with-parser.d.ts.map +1 -0
  268. package/dist/mvt/tilejson-loader-with-parser.js +25 -0
  269. package/dist/mvt/tilejson-loader-with-parser.js.map +1 -0
  270. package/dist/mvt/tilejson-loader.d.ts +56 -0
  271. package/dist/mvt/tilejson-loader.d.ts.map +1 -0
  272. package/dist/mvt/tilejson-loader.js +28 -0
  273. package/dist/mvt/tilejson-loader.js.map +1 -0
  274. package/dist/mvt/tilejson-zod-schema.cjs +79 -0
  275. package/dist/mvt/tilejson-zod-schema.cjs.map +6 -0
  276. package/dist/mvt/tilejson-zod-schema.d.ts +218 -0
  277. package/dist/mvt/tilejson-zod-schema.d.ts.map +1 -0
  278. package/dist/mvt/tilejson-zod-schema.js +68 -0
  279. package/dist/mvt/tilejson-zod-schema.js.map +1 -0
  280. package/dist/mvt/tilejson.schema.json +197 -0
  281. package/dist/mvt/unbundled.d.ts +8 -0
  282. package/dist/mvt/unbundled.d.ts.map +1 -0
  283. package/dist/mvt/unbundled.js +8 -0
  284. package/dist/mvt/unbundled.js.map +1 -0
  285. package/dist/mvt/workers/mvt-worker-node.d.ts +2 -0
  286. package/dist/mvt/workers/mvt-worker-node.d.ts.map +1 -0
  287. package/dist/mvt/workers/mvt-worker-node.js +8 -0
  288. package/dist/mvt/workers/mvt-worker-node.js.map +1 -0
  289. package/dist/mvt/workers/mvt-worker.d.ts +2 -0
  290. package/dist/mvt/workers/mvt-worker.d.ts.map +1 -0
  291. package/dist/mvt/workers/mvt-worker.js +7 -0
  292. package/dist/mvt/workers/mvt-worker.js.map +1 -0
  293. package/dist/mvt-worker-node.js +72460 -0
  294. package/dist/mvt-worker-node.js.map +7 -0
  295. package/dist/mvt-worker.js +21239 -0
  296. package/dist/pmtiles/bundled.d.ts +3 -0
  297. package/dist/pmtiles/bundled.d.ts.map +1 -0
  298. package/dist/pmtiles/bundled.js +5 -0
  299. package/dist/pmtiles/bundled.js.map +1 -0
  300. package/dist/pmtiles/dist.dev.js +50530 -0
  301. package/dist/pmtiles/dist.min.js +94 -0
  302. package/dist/pmtiles/geoarrow.cjs +6718 -0
  303. package/dist/pmtiles/geoarrow.cjs.map +6 -0
  304. package/dist/pmtiles/geoarrow.d.ts +30 -0
  305. package/dist/pmtiles/geoarrow.d.ts.map +1 -0
  306. package/dist/pmtiles/geoarrow.js +143 -0
  307. package/dist/pmtiles/geoarrow.js.map +1 -0
  308. package/dist/pmtiles/index.cjs +8011 -0
  309. package/dist/pmtiles/index.cjs.map +6 -0
  310. package/dist/pmtiles/index.d.ts +14 -0
  311. package/dist/pmtiles/index.d.ts.map +1 -0
  312. package/dist/pmtiles/index.js +10 -0
  313. package/dist/pmtiles/index.js.map +1 -0
  314. package/dist/pmtiles/lib/blob-source.d.ts +14 -0
  315. package/dist/pmtiles/lib/blob-source.d.ts.map +1 -0
  316. package/dist/pmtiles/lib/blob-source.js +32 -0
  317. package/dist/pmtiles/lib/blob-source.js.map +1 -0
  318. package/dist/pmtiles/lib/encode-pmtiles.d.ts +8 -0
  319. package/dist/pmtiles/lib/encode-pmtiles.d.ts.map +1 -0
  320. package/dist/pmtiles/lib/encode-pmtiles.js +268 -0
  321. package/dist/pmtiles/lib/encode-pmtiles.js.map +1 -0
  322. package/dist/pmtiles/lib/parse-pmtiles.d.ts +52 -0
  323. package/dist/pmtiles/lib/parse-pmtiles.d.ts.map +1 -0
  324. package/dist/pmtiles/lib/parse-pmtiles.js +95 -0
  325. package/dist/pmtiles/lib/parse-pmtiles.js.map +1 -0
  326. package/dist/pmtiles/lib/range-request-source.d.ts +24 -0
  327. package/dist/pmtiles/lib/range-request-source.d.ts.map +1 -0
  328. package/dist/pmtiles/lib/range-request-source.js +45 -0
  329. package/dist/pmtiles/lib/range-request-source.js.map +1 -0
  330. package/dist/pmtiles/lib/version.d.ts +2 -0
  331. package/dist/pmtiles/lib/version.d.ts.map +1 -0
  332. package/dist/pmtiles/lib/version.js +8 -0
  333. package/dist/pmtiles/lib/version.js.map +1 -0
  334. package/dist/pmtiles/pmtiles-format.d.ts +14 -0
  335. package/dist/pmtiles/pmtiles-format.d.ts.map +1 -0
  336. package/dist/pmtiles/pmtiles-format.js +17 -0
  337. package/dist/pmtiles/pmtiles-format.js.map +1 -0
  338. package/dist/pmtiles/pmtiles-loader-with-parser.d.ts +30 -0
  339. package/dist/pmtiles/pmtiles-loader-with-parser.d.ts.map +1 -0
  340. package/dist/pmtiles/pmtiles-loader-with-parser.js +41 -0
  341. package/dist/pmtiles/pmtiles-loader-with-parser.js.map +1 -0
  342. package/dist/pmtiles/pmtiles-loader.d.ts +41 -0
  343. package/dist/pmtiles/pmtiles-loader.d.ts.map +1 -0
  344. package/dist/pmtiles/pmtiles-loader.js +20 -0
  345. package/dist/pmtiles/pmtiles-loader.js.map +1 -0
  346. package/dist/pmtiles/pmtiles-source-loader.d.ts +85 -0
  347. package/dist/pmtiles/pmtiles-source-loader.d.ts.map +1 -0
  348. package/dist/pmtiles/pmtiles-source-loader.js +239 -0
  349. package/dist/pmtiles/pmtiles-source-loader.js.map +1 -0
  350. package/dist/pmtiles/pmtiles-writer-types.d.ts +39 -0
  351. package/dist/pmtiles/pmtiles-writer-types.d.ts.map +1 -0
  352. package/dist/{point-cloud-tile-source-types.js → pmtiles/pmtiles-writer-types.js} +1 -1
  353. package/dist/pmtiles/pmtiles-writer-types.js.map +1 -0
  354. package/dist/pmtiles/pmtiles-writer.d.ts +22 -0
  355. package/dist/pmtiles/pmtiles-writer.d.ts.map +1 -0
  356. package/dist/pmtiles/pmtiles-writer.js +15 -0
  357. package/dist/pmtiles/pmtiles-writer.js.map +1 -0
  358. package/dist/pmtiles/raster.cjs +1183 -0
  359. package/dist/pmtiles/raster.cjs.map +6 -0
  360. package/dist/pmtiles/raster.d.ts +30 -0
  361. package/dist/pmtiles/raster.d.ts.map +1 -0
  362. package/dist/pmtiles/raster.js +212 -0
  363. package/dist/pmtiles/raster.js.map +1 -0
  364. package/dist/pmtiles/source-info.d.ts +25 -0
  365. package/dist/pmtiles/source-info.d.ts.map +1 -0
  366. package/dist/{types.js → pmtiles/source-info.js} +1 -1
  367. package/dist/pmtiles/source-info.js.map +1 -0
  368. package/dist/pmtiles/unbundled.d.ts +3 -0
  369. package/dist/pmtiles/unbundled.d.ts.map +1 -0
  370. package/dist/pmtiles/unbundled.js +5 -0
  371. package/dist/pmtiles/unbundled.js.map +1 -0
  372. package/dist/raster-set.d.ts +1 -1
  373. package/dist/raster-set.d.ts.map +1 -1
  374. package/dist/raster-set.js +1 -1
  375. package/dist/raster-set.js.map +1 -1
  376. package/dist/tile-matrix.cjs +81 -0
  377. package/dist/tile-matrix.cjs.map +6 -0
  378. package/dist/tile-matrix.d.ts +52 -0
  379. package/dist/tile-matrix.d.ts.map +1 -0
  380. package/dist/tile-matrix.js +75 -0
  381. package/dist/tile-matrix.js.map +1 -0
  382. package/dist/tileset-2d/tile-2d-header.d.ts +2 -2
  383. package/dist/tileset-2d/tile-2d-header.d.ts.map +1 -1
  384. package/dist/tileset-2d/tile-2d-header.js +11 -11
  385. package/dist/tileset-2d/tile-2d-header.js.map +1 -1
  386. package/dist/tileset-2d/tileset-2d.d.ts +19 -10
  387. package/dist/tileset-2d/tileset-2d.d.ts.map +1 -1
  388. package/dist/tileset-2d/tileset-2d.js +69 -15
  389. package/dist/tileset-2d/tileset-2d.js.map +1 -1
  390. package/package.json +101 -25
  391. package/src/image-set.ts +1 -1
  392. package/src/index.ts +8 -128
  393. package/src/mlt/bundled.ts +9 -0
  394. package/src/mlt/index.ts +18 -0
  395. package/src/mlt/lib/encode-mlt-geometry.ts +162 -0
  396. package/src/mlt/lib/encode-mlt-streams.ts +66 -0
  397. package/src/mlt/lib/encode-mlt.ts +215 -0
  398. package/src/mlt/lib/parse-mlt.ts +906 -0
  399. package/src/mlt/libs/mlt-decoder.cjs +4552 -0
  400. package/src/mlt/mlt-format.ts +19 -0
  401. package/src/mlt/mlt-loader-with-parser.ts +57 -0
  402. package/src/mlt/mlt-loader.ts +64 -0
  403. package/src/mlt/mlt-source-loader.ts +266 -0
  404. package/src/mlt/mlt-writer.ts +47 -0
  405. package/src/mlt/unbundled.ts +6 -0
  406. package/src/mvt/arrow-table-tile-source-loader-types.ts +55 -0
  407. package/src/mvt/arrow-table-tile-source-loader.ts +307 -0
  408. package/src/mvt/arrow-table-tile-source-types.ts +32 -0
  409. package/src/mvt/bundled.ts +14 -0
  410. package/src/mvt/index.ts +67 -0
  411. package/src/mvt/lib/encode-mvt-arrow.ts +273 -0
  412. package/src/mvt/lib/encode-mvt.ts +46 -0
  413. package/src/mvt/lib/get-schemas-from-tilejson.ts +64 -0
  414. package/src/mvt/lib/is-longitude-latitude-crs.ts +15 -0
  415. package/src/mvt/lib/mapbox-vt-pbf/geojson-to-vt.ts.disabled +76 -0
  416. package/src/mvt/lib/mapbox-vt-pbf/geojson-wrapper.ts +89 -0
  417. package/src/mvt/lib/mapbox-vt-pbf/to-vector-tile.ts +230 -0
  418. package/src/mvt/lib/mvt-pbf/mvt-constants.ts +135 -0
  419. package/src/mvt/lib/mvt-pbf/mvt-types.ts +22 -0
  420. package/src/mvt/lib/mvt-pbf/parse-geometry-from-pbf.ts +285 -0
  421. package/src/mvt/lib/mvt-pbf/parse-mvt-from-pbf.ts +310 -0
  422. package/src/mvt/lib/mvt-pbf/write-mvt-to-pbf.ts +162 -0
  423. package/src/mvt/lib/mvt-worker-transport.ts +74 -0
  424. package/src/mvt/lib/parse-mvt-geojson.ts +65 -0
  425. package/src/mvt/lib/parse-mvt.ts +145 -0
  426. package/src/mvt/lib/parse-tilejson.ts +397 -0
  427. package/src/mvt/lib/resolve-table-tile-parameters.ts +23 -0
  428. package/src/mvt/lib/types.ts +90 -0
  429. package/src/mvt/lib/utils/geometry-utils.ts +238 -0
  430. package/src/mvt/lib/vector-tile/LICENSE.txt +31 -0
  431. package/src/mvt/lib/vector-tile/vector-tile-feature.ts +430 -0
  432. package/src/mvt/lib/vector-tile/vector-tile-layer.ts +130 -0
  433. package/src/mvt/lib/vector-tile/vector-tile.ts +32 -0
  434. package/src/mvt/lib/vector-tiler/LICENSE +19 -0
  435. package/src/mvt/lib/vector-tiler/arrow-tile.ts +93 -0
  436. package/src/mvt/lib/vector-tiler/features/clip-features.ts +250 -0
  437. package/src/mvt/lib/vector-tiler/features/convert-feature.ts +213 -0
  438. package/src/mvt/lib/vector-tiler/features/proto-feature.ts +104 -0
  439. package/src/mvt/lib/vector-tiler/features/simplify-path.ts +84 -0
  440. package/src/mvt/lib/vector-tiler/features/wrap-features.ts +125 -0
  441. package/src/mvt/lib/vector-tiler/proto-tile.ts +217 -0
  442. package/src/mvt/lib/vector-tiler/tile-to-geojson.ts +104 -0
  443. package/src/mvt/lib/vector-tiler/transform-tile.ts +57 -0
  444. package/src/mvt/map-style-format.ts +18 -0
  445. package/src/mvt/map-style-loader-with-parser.ts +62 -0
  446. package/src/mvt/map-style-loader.ts +31 -0
  447. package/src/mvt/map-style-schema.ts +53 -0
  448. package/src/mvt/map-style.ts +218 -0
  449. package/src/mvt/mvt-format.ts +25 -0
  450. package/src/mvt/mvt-geojson-loader-types.ts +60 -0
  451. package/src/mvt/mvt-geojson-loader.ts +20 -0
  452. package/src/mvt/mvt-loader-with-parser.ts +53 -0
  453. package/src/mvt/mvt-loader.ts +73 -0
  454. package/src/mvt/mvt-source-loader.ts +410 -0
  455. package/src/mvt/mvt-writer.ts +35 -0
  456. package/src/mvt/table-tile-source-loader.ts +672 -0
  457. package/src/mvt/tilejson-format.ts +18 -0
  458. package/src/mvt/tilejson-loader-with-parser.ts +38 -0
  459. package/src/mvt/tilejson-loader.ts +42 -0
  460. package/src/mvt/tilejson-zod-schema.ts +199 -0
  461. package/src/mvt/unbundled.ts +13 -0
  462. package/src/mvt/workers/mvt-worker-node.ts +9 -0
  463. package/src/mvt/workers/mvt-worker.ts +8 -0
  464. package/src/pmtiles/bundled.ts +6 -0
  465. package/src/pmtiles/geoarrow.ts +188 -0
  466. package/src/pmtiles/index.ts +27 -0
  467. package/src/pmtiles/lib/blob-source.ts +41 -0
  468. package/src/pmtiles/lib/encode-pmtiles.ts +322 -0
  469. package/src/pmtiles/lib/parse-pmtiles.ts +180 -0
  470. package/src/pmtiles/lib/range-request-source.ts +60 -0
  471. package/src/pmtiles/lib/version.ts +8 -0
  472. package/src/pmtiles/pmtiles-format.ts +19 -0
  473. package/src/pmtiles/pmtiles-loader-with-parser.ts +60 -0
  474. package/src/pmtiles/pmtiles-loader.ts +30 -0
  475. package/src/pmtiles/pmtiles-source-loader.ts +346 -0
  476. package/src/pmtiles/pmtiles-writer-types.ts +45 -0
  477. package/src/pmtiles/pmtiles-writer.ts +26 -0
  478. package/src/pmtiles/raster.ts +289 -0
  479. package/src/pmtiles/source-info.ts +25 -0
  480. package/src/pmtiles/unbundled.ts +6 -0
  481. package/src/raster-set.ts +2 -2
  482. package/src/tile-matrix.ts +138 -0
  483. package/src/tileset-2d/tile-2d-header.ts +14 -13
  484. package/src/tileset-2d/tileset-2d.ts +81 -19
  485. package/dist/constants.d.ts +0 -38
  486. package/dist/constants.d.ts.map +0 -1
  487. package/dist/constants.js +0 -39
  488. package/dist/constants.js.map +0 -1
  489. package/dist/point-cloud/point-cloud-tile.d.ts +0 -47
  490. package/dist/point-cloud/point-cloud-tile.d.ts.map +0 -1
  491. package/dist/point-cloud/point-cloud-tile.js +0 -70
  492. package/dist/point-cloud/point-cloud-tile.js.map +0 -1
  493. package/dist/point-cloud/point-cloud-tileset.d.ts +0 -135
  494. package/dist/point-cloud/point-cloud-tileset.d.ts.map +0 -1
  495. package/dist/point-cloud/point-cloud-tileset.js +0 -549
  496. package/dist/point-cloud/point-cloud-tileset.js.map +0 -1
  497. package/dist/point-cloud/types.d.ts +0 -81
  498. package/dist/point-cloud/types.d.ts.map +0 -1
  499. package/dist/point-cloud/types.js.map +0 -1
  500. package/dist/point-cloud-tile-source-loader-types.d.ts +0 -31
  501. package/dist/point-cloud-tile-source-loader-types.d.ts.map +0 -1
  502. package/dist/point-cloud-tile-source-loader-types.js +0 -34
  503. package/dist/point-cloud-tile-source-loader-types.js.map +0 -1
  504. package/dist/point-cloud-tile-source-loader.cjs +0 -81
  505. package/dist/point-cloud-tile-source-loader.cjs.map +0 -7
  506. package/dist/point-cloud-tile-source-loader.d.ts +0 -27
  507. package/dist/point-cloud-tile-source-loader.d.ts.map +0 -1
  508. package/dist/point-cloud-tile-source-loader.js +0 -17
  509. package/dist/point-cloud-tile-source-loader.js.map +0 -1
  510. package/dist/point-cloud-tile-source-types.d.ts +0 -15
  511. package/dist/point-cloud-tile-source-types.d.ts.map +0 -1
  512. package/dist/point-cloud-tile-source-types.js.map +0 -1
  513. package/dist/point-cloud-tile-source.cjs +0 -105
  514. package/dist/point-cloud-tile-source.cjs.map +0 -7
  515. package/dist/point-cloud-tile-source.d.ts +0 -36
  516. package/dist/point-cloud-tile-source.d.ts.map +0 -1
  517. package/dist/point-cloud-tile-source.js +0 -84
  518. package/dist/point-cloud-tile-source.js.map +0 -1
  519. package/dist/spatial/format-spatial-reference.d.ts +0 -68
  520. package/dist/spatial/format-spatial-reference.d.ts.map +0 -1
  521. package/dist/spatial/format-spatial-reference.js +0 -291
  522. package/dist/spatial/format-spatial-reference.js.map +0 -1
  523. package/dist/spatial/get-spatial-coordinate-frame.d.ts +0 -20
  524. package/dist/spatial/get-spatial-coordinate-frame.d.ts.map +0 -1
  525. package/dist/spatial/get-spatial-coordinate-frame.js +0 -139
  526. package/dist/spatial/get-spatial-coordinate-frame.js.map +0 -1
  527. package/dist/spatial/i3s-elevation.d.ts +0 -20
  528. package/dist/spatial/i3s-elevation.d.ts.map +0 -1
  529. package/dist/spatial/i3s-elevation.js +0 -90
  530. package/dist/spatial/i3s-elevation.js.map +0 -1
  531. package/dist/spatial/i3s-spatial-transformer.d.ts +0 -205
  532. package/dist/spatial/i3s-spatial-transformer.d.ts.map +0 -1
  533. package/dist/spatial/i3s-spatial-transformer.js +0 -731
  534. package/dist/spatial/i3s-spatial-transformer.js.map +0 -1
  535. package/dist/spatial/normalize-crs-identifier.d.ts +0 -15
  536. package/dist/spatial/normalize-crs-identifier.d.ts.map +0 -1
  537. package/dist/spatial/normalize-crs-identifier.js +0 -22
  538. package/dist/spatial/normalize-crs-identifier.js.map +0 -1
  539. package/dist/spatial/spatial-coordinate-transformer.d.ts +0 -54
  540. package/dist/spatial/spatial-coordinate-transformer.d.ts.map +0 -1
  541. package/dist/spatial/spatial-coordinate-transformer.js +0 -311
  542. package/dist/spatial/spatial-coordinate-transformer.js.map +0 -1
  543. package/dist/spatial/spatial-resource-registry.d.ts +0 -47
  544. package/dist/spatial/spatial-resource-registry.d.ts.map +0 -1
  545. package/dist/spatial/spatial-resource-registry.js +0 -76
  546. package/dist/spatial/spatial-resource-registry.js.map +0 -1
  547. package/dist/spatial/spatial-types.d.ts +0 -190
  548. package/dist/spatial/spatial-types.d.ts.map +0 -1
  549. package/dist/spatial/spatial-types.js +0 -192
  550. package/dist/spatial/spatial-types.js.map +0 -1
  551. package/dist/spatial/tiles-3d-spatial-transformer.d.ts +0 -32
  552. package/dist/spatial/tiles-3d-spatial-transformer.d.ts.map +0 -1
  553. package/dist/spatial/tiles-3d-spatial-transformer.js +0 -163
  554. package/dist/spatial/tiles-3d-spatial-transformer.js.map +0 -1
  555. package/dist/tileset-3d/common/indexed-archive-tileset-source.d.ts +0 -60
  556. package/dist/tileset-3d/common/indexed-archive-tileset-source.d.ts.map +0 -1
  557. package/dist/tileset-3d/common/indexed-archive-tileset-source.js +0 -130
  558. package/dist/tileset-3d/common/indexed-archive-tileset-source.js.map +0 -1
  559. package/dist/tileset-3d/common/tile-3d-contracts.d.ts +0 -63
  560. package/dist/tileset-3d/common/tile-3d-contracts.d.ts.map +0 -1
  561. package/dist/tileset-3d/common/tile-3d-contracts.js +0 -51
  562. package/dist/tileset-3d/common/tile-3d-contracts.js.map +0 -1
  563. package/dist/tileset-3d/common/tile-3d.d.ts +0 -410
  564. package/dist/tileset-3d/common/tile-3d.d.ts.map +0 -1
  565. package/dist/tileset-3d/common/tile-3d.js +0 -1056
  566. package/dist/tileset-3d/common/tile-3d.js.map +0 -1
  567. package/dist/tileset-3d/common/tileset-3d.d.ts +0 -369
  568. package/dist/tileset-3d/common/tileset-3d.d.ts.map +0 -1
  569. package/dist/tileset-3d/common/tileset-3d.js +0 -879
  570. package/dist/tileset-3d/common/tileset-3d.js.map +0 -1
  571. package/dist/tileset-3d/common/tileset-cache.d.ts +0 -29
  572. package/dist/tileset-3d/common/tileset-cache.d.ts.map +0 -1
  573. package/dist/tileset-3d/common/tileset-cache.js +0 -82
  574. package/dist/tileset-3d/common/tileset-cache.js.map +0 -1
  575. package/dist/tileset-3d/common/tileset-content-traversal.d.ts +0 -37
  576. package/dist/tileset-3d/common/tileset-content-traversal.d.ts.map +0 -1
  577. package/dist/tileset-3d/common/tileset-content-traversal.js +0 -80
  578. package/dist/tileset-3d/common/tileset-content-traversal.js.map +0 -1
  579. package/dist/tileset-3d/common/tileset-observability.d.ts +0 -60
  580. package/dist/tileset-3d/common/tileset-observability.d.ts.map +0 -1
  581. package/dist/tileset-3d/common/tileset-observability.js +0 -39
  582. package/dist/tileset-3d/common/tileset-observability.js.map +0 -1
  583. package/dist/tileset-3d/common/tileset-source.d.ts +0 -228
  584. package/dist/tileset-3d/common/tileset-source.d.ts.map +0 -1
  585. package/dist/tileset-3d/common/tileset-source.js +0 -17
  586. package/dist/tileset-3d/common/tileset-source.js.map +0 -1
  587. package/dist/tileset-3d/common/tileset-traverser.d.ts +0 -88
  588. package/dist/tileset-3d/common/tileset-traverser.d.ts.map +0 -1
  589. package/dist/tileset-3d/common/tileset-traverser.js +0 -341
  590. package/dist/tileset-3d/common/tileset-traverser.js.map +0 -1
  591. package/dist/tileset-3d/format-3d-tiles/implicit-tiling.d.ts +0 -182
  592. package/dist/tileset-3d/format-3d-tiles/implicit-tiling.d.ts.map +0 -1
  593. package/dist/tileset-3d/format-3d-tiles/implicit-tiling.js +0 -678
  594. package/dist/tileset-3d/format-3d-tiles/implicit-tiling.js.map +0 -1
  595. package/dist/tileset-3d/format-3d-tiles/tiles-3d-source.d.ts +0 -221
  596. package/dist/tileset-3d/format-3d-tiles/tiles-3d-source.d.ts.map +0 -1
  597. package/dist/tileset-3d/format-3d-tiles/tiles-3d-source.js +0 -770
  598. package/dist/tileset-3d/format-3d-tiles/tiles-3d-source.js.map +0 -1
  599. package/dist/tileset-3d/format-3d-tiles/tileset-3d-traverser.d.ts +0 -111
  600. package/dist/tileset-3d/format-3d-tiles/tileset-3d-traverser.d.ts.map +0 -1
  601. package/dist/tileset-3d/format-3d-tiles/tileset-3d-traverser.js +0 -339
  602. package/dist/tileset-3d/format-3d-tiles/tileset-3d-traverser.js.map +0 -1
  603. package/dist/tileset-3d/format-i3s/i3s-pending-tiles-register.d.ts +0 -27
  604. package/dist/tileset-3d/format-i3s/i3s-pending-tiles-register.d.ts.map +0 -1
  605. package/dist/tileset-3d/format-i3s/i3s-pending-tiles-register.js +0 -45
  606. package/dist/tileset-3d/format-i3s/i3s-pending-tiles-register.js.map +0 -1
  607. package/dist/tileset-3d/format-i3s/i3s-source.d.ts +0 -116
  608. package/dist/tileset-3d/format-i3s/i3s-source.d.ts.map +0 -1
  609. package/dist/tileset-3d/format-i3s/i3s-source.js +0 -450
  610. package/dist/tileset-3d/format-i3s/i3s-source.js.map +0 -1
  611. package/dist/tileset-3d/format-i3s/i3s-tile-manager.d.ts +0 -34
  612. package/dist/tileset-3d/format-i3s/i3s-tile-manager.d.ts.map +0 -1
  613. package/dist/tileset-3d/format-i3s/i3s-tile-manager.js +0 -81
  614. package/dist/tileset-3d/format-i3s/i3s-tile-manager.js.map +0 -1
  615. package/dist/tileset-3d/format-i3s/i3s-tileset-traverser.d.ts +0 -25
  616. package/dist/tileset-3d/format-i3s/i3s-tileset-traverser.d.ts.map +0 -1
  617. package/dist/tileset-3d/format-i3s/i3s-tileset-traverser.js +0 -84
  618. package/dist/tileset-3d/format-i3s/i3s-tileset-traverser.js.map +0 -1
  619. package/dist/tileset-3d/helpers/3d-tiles-options.d.ts +0 -5
  620. package/dist/tileset-3d/helpers/3d-tiles-options.d.ts.map +0 -1
  621. package/dist/tileset-3d/helpers/3d-tiles-options.js +0 -9
  622. package/dist/tileset-3d/helpers/3d-tiles-options.js.map +0 -1
  623. package/dist/tileset-3d/helpers/bounding-volume.d.ts +0 -23
  624. package/dist/tileset-3d/helpers/bounding-volume.d.ts.map +0 -1
  625. package/dist/tileset-3d/helpers/bounding-volume.js +0 -236
  626. package/dist/tileset-3d/helpers/bounding-volume.js.map +0 -1
  627. package/dist/tileset-3d/helpers/frame-state.d.ts +0 -93
  628. package/dist/tileset-3d/helpers/frame-state.d.ts.map +0 -1
  629. package/dist/tileset-3d/helpers/frame-state.js +0 -211
  630. package/dist/tileset-3d/helpers/frame-state.js.map +0 -1
  631. package/dist/tileset-3d/helpers/i3s-lod.d.ts +0 -20
  632. package/dist/tileset-3d/helpers/i3s-lod.d.ts.map +0 -1
  633. package/dist/tileset-3d/helpers/i3s-lod.js +0 -95
  634. package/dist/tileset-3d/helpers/i3s-lod.js.map +0 -1
  635. package/dist/tileset-3d/helpers/s2-bounding-volume.d.ts +0 -17
  636. package/dist/tileset-3d/helpers/s2-bounding-volume.d.ts.map +0 -1
  637. package/dist/tileset-3d/helpers/s2-bounding-volume.js +0 -17
  638. package/dist/tileset-3d/helpers/s2-bounding-volume.js.map +0 -1
  639. package/dist/tileset-3d/helpers/tiles-3d-lod.d.ts +0 -72
  640. package/dist/tileset-3d/helpers/tiles-3d-lod.d.ts.map +0 -1
  641. package/dist/tileset-3d/helpers/tiles-3d-lod.js +0 -257
  642. package/dist/tileset-3d/helpers/tiles-3d-lod.js.map +0 -1
  643. package/dist/tileset-3d/helpers/tiles-3d-request-priority.d.ts +0 -134
  644. package/dist/tileset-3d/helpers/tiles-3d-request-priority.d.ts.map +0 -1
  645. package/dist/tileset-3d/helpers/tiles-3d-request-priority.js +0 -179
  646. package/dist/tileset-3d/helpers/tiles-3d-request-priority.js.map +0 -1
  647. package/dist/tileset-3d/helpers/transform-utils.d.ts +0 -3
  648. package/dist/tileset-3d/helpers/transform-utils.d.ts.map +0 -1
  649. package/dist/tileset-3d/helpers/transform-utils.js +0 -86
  650. package/dist/tileset-3d/helpers/transform-utils.js.map +0 -1
  651. package/dist/tileset-3d/helpers/zoom.d.ts +0 -46
  652. package/dist/tileset-3d/helpers/zoom.d.ts.map +0 -1
  653. package/dist/tileset-3d/helpers/zoom.js +0 -86
  654. package/dist/tileset-3d/helpers/zoom.js.map +0 -1
  655. package/dist/types.d.ts +0 -48
  656. package/dist/types.d.ts.map +0 -1
  657. package/dist/types.js.map +0 -1
  658. package/dist/utils/doubly-linked-list-node.d.ts +0 -11
  659. package/dist/utils/doubly-linked-list-node.d.ts.map +0 -1
  660. package/dist/utils/doubly-linked-list-node.js +0 -20
  661. package/dist/utils/doubly-linked-list-node.js.map +0 -1
  662. package/dist/utils/doubly-linked-list.d.ts +0 -30
  663. package/dist/utils/doubly-linked-list.d.ts.map +0 -1
  664. package/dist/utils/doubly-linked-list.js +0 -93
  665. package/dist/utils/doubly-linked-list.js.map +0 -1
  666. package/dist/utils/managed-array.d.ts +0 -85
  667. package/dist/utils/managed-array.d.ts.map +0 -1
  668. package/dist/utils/managed-array.js +0 -152
  669. package/dist/utils/managed-array.js.map +0 -1
  670. package/src/constants.ts +0 -59
  671. package/src/point-cloud/point-cloud-tile.ts +0 -80
  672. package/src/point-cloud/point-cloud-tileset.ts +0 -767
  673. package/src/point-cloud/types.ts +0 -99
  674. package/src/point-cloud-tile-source-loader-types.ts +0 -53
  675. package/src/point-cloud-tile-source-loader.ts +0 -32
  676. package/src/point-cloud-tile-source-types.ts +0 -20
  677. package/src/point-cloud-tile-source.ts +0 -112
  678. package/src/spatial/format-spatial-reference.ts +0 -385
  679. package/src/spatial/get-spatial-coordinate-frame.ts +0 -169
  680. package/src/spatial/i3s-elevation.ts +0 -96
  681. package/src/spatial/i3s-spatial-transformer.ts +0 -1021
  682. package/src/spatial/normalize-crs-identifier.ts +0 -26
  683. package/src/spatial/spatial-coordinate-transformer.ts +0 -397
  684. package/src/spatial/spatial-resource-registry.ts +0 -90
  685. package/src/spatial/spatial-types.ts +0 -422
  686. package/src/spatial/tiles-3d-spatial-transformer.ts +0 -194
  687. package/src/tileset-3d/common/indexed-archive-tileset-source.ts +0 -205
  688. package/src/tileset-3d/common/tile-3d-contracts.ts +0 -115
  689. package/src/tileset-3d/common/tile-3d.ts +0 -1310
  690. package/src/tileset-3d/common/tileset-3d.ts +0 -1210
  691. package/src/tileset-3d/common/tileset-cache.ts +0 -111
  692. package/src/tileset-3d/common/tileset-content-traversal.ts +0 -114
  693. package/src/tileset-3d/common/tileset-observability.ts +0 -100
  694. package/src/tileset-3d/common/tileset-source.ts +0 -284
  695. package/src/tileset-3d/common/tileset-traverser.ts +0 -416
  696. package/src/tileset-3d/format-3d-tiles/implicit-tiling.ts +0 -1056
  697. package/src/tileset-3d/format-3d-tiles/tiles-3d-source.ts +0 -1025
  698. package/src/tileset-3d/format-3d-tiles/tileset-3d-traverser.ts +0 -391
  699. package/src/tileset-3d/format-i3s/i3s-pending-tiles-register.ts +0 -48
  700. package/src/tileset-3d/format-i3s/i3s-source.ts +0 -557
  701. package/src/tileset-3d/format-i3s/i3s-tile-manager.ts +0 -105
  702. package/src/tileset-3d/format-i3s/i3s-tileset-traverser.ts +0 -102
  703. package/src/tileset-3d/helpers/3d-tiles-options.ts +0 -11
  704. package/src/tileset-3d/helpers/bounding-volume.ts +0 -281
  705. package/src/tileset-3d/helpers/frame-state.ts +0 -322
  706. package/src/tileset-3d/helpers/i3s-lod.ts +0 -109
  707. package/src/tileset-3d/helpers/s2-bounding-volume.ts +0 -32
  708. package/src/tileset-3d/helpers/tiles-3d-lod.ts +0 -370
  709. package/src/tileset-3d/helpers/tiles-3d-request-priority.ts +0 -301
  710. package/src/tileset-3d/helpers/transform-utils.ts +0 -109
  711. package/src/tileset-3d/helpers/zoom.ts +0 -120
  712. package/src/types.ts +0 -54
  713. package/src/utils/doubly-linked-list-node.ts +0 -22
  714. package/src/utils/doubly-linked-list.ts +0 -105
  715. package/src/utils/managed-array.ts +0 -174
  716. /package/dist/{point-cloud → mvt/lib}/types.js +0 -0
@@ -1,1210 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- // Copyright (c) vis.gl contributors
3
-
4
- // This file is derived from the Cesium code base under Apache 2 license
5
- // See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
6
-
7
- import {Matrix4, Vector3} from '@math.gl/core';
8
- import {Ellipsoid} from '@math.gl/geospatial';
9
- import {Stats} from '@probe.gl/stats';
10
- import {RequestScheduler, Loader, LoaderOptions} from '@loaders.gl/loader-utils';
11
- import {TilesetCache} from './tileset-cache';
12
- import {calculateTransformProps} from '../helpers/transform-utils';
13
- import {getFrameState, limitSelectedTiles, updateCameraMotionState} from '../helpers/frame-state';
14
- import type {CameraMotionState, FrameState} from '../helpers/frame-state';
15
- import {
16
- calculateDynamicScreenSpaceErrorDensity,
17
- updateRootTransformForDynamicScreenSpaceError
18
- } from '../helpers/tiles-3d-lod';
19
- import {interpolateLinearly} from '../helpers/tiles-3d-request-priority';
20
- import type {FoveatedInterpolationCallback} from '../helpers/tiles-3d-request-priority';
21
-
22
- import type {GeospatialViewport, Viewport} from '../../types';
23
- import {Tile3D} from './tile-3d';
24
- import {TILESET_TYPE} from '../../constants';
25
- import type {TilesetSpatialOptions, TilesetSpatialReference} from '../../spatial/spatial-types';
26
- import {
27
- applyTilesetSpatialOptions,
28
- createTilesetSpatialReference
29
- } from '../../spatial/spatial-types';
30
-
31
- import {TilesetTraverser} from './tileset-traverser';
32
- import {
33
- isTileset3DSource,
34
- TileContentLoadResult,
35
- TilesetContentFormats,
36
- TilesetJSON,
37
- Tileset3DSource,
38
- TilesetSourceMetadata
39
- } from './tileset-source';
40
-
41
- export type {TilesetJSON} from './tileset-source';
42
-
43
- export type Tileset3DProps = {
44
- /** Format options forwarded to I3S content requests, including source-coordinate decoding. */
45
- i3s?: Record<string, unknown>;
46
- throttleRequests?: boolean;
47
- maxRequests?: number;
48
- loadOptions?: LoaderOptions;
49
- loadTiles?: boolean;
50
- basePath?: string;
51
- /**
52
- * Soft target, in bytes, for cached tile content that is not required by the current frame.
53
- * The listed default applies to 3D Tiles; I3S retains its existing 32 MiB default.
54
- * @default 536870912
55
- */
56
- cacheBytes?: number;
57
- /**
58
- * Additional bytes that the current-frame working set may use before memory-adjusted SSE rises.
59
- * The listed default applies to 3D Tiles; I3S retains its existing 1 MiB default.
60
- * @default 536870912
61
- */
62
- maximumCacheOverflowBytes?: number;
63
- maximumTilesSelected?: number;
64
- debounceTime?: number;
65
-
66
- description?: string;
67
- attributions?: string[];
68
-
69
- ellipsoid?: object;
70
- modelMatrix?: Matrix4;
71
- /** Automatic CRS output options and expert source-metadata recovery overrides. */
72
- spatial?: TilesetSpatialOptions;
73
-
74
- maximumScreenSpaceError?: number;
75
- /**
76
- * Enables replacement traversal that may skip hierarchy levels while retaining ready ancestors
77
- * as coverage. This trades temporary overdraw for faster refinement on deep trees.
78
- * Defaults to `true` for 3D Tiles and `false` for I3S. Set to `false` to request every level.
79
- */
80
- skipLevelOfDetail?: boolean;
81
- /**
82
- * SSE above which tiles remain part of the non-skipping base traversal.
83
- * @default 1024
84
- */
85
- baseScreenSpaceError?: number;
86
- /**
87
- * Required SSE reduction from the nearest requested or loaded ancestor before loading a tile.
88
- * @default 16
89
- */
90
- skipScreenSpaceErrorFactor?: number;
91
- /**
92
- * Minimum hierarchy levels between requested tiles during skip-LOD traversal.
93
- * @default 1
94
- */
95
- skipLevels?: number;
96
- /**
97
- * Requests only final tiles that meet the active SSE target when skip-LOD is enabled.
98
- * @default false
99
- */
100
- immediatelyLoadDesiredLevelOfDetail?: boolean;
101
- /** Enables perspective dynamic SSE to reduce distant, horizon-facing refinement. */
102
- dynamicScreenSpaceError?: boolean;
103
- /** Base dynamic SSE fog density in inverse meters. */
104
- dynamicScreenSpaceErrorDensity?: number;
105
- /** Maximum dynamic SSE reduction in logical/CSS pixels. */
106
- dynamicScreenSpaceErrorFactor?: number;
107
- /** Fraction of tileset height at which dynamic SSE begins to fade, clamped to `[0, 1]`. */
108
- dynamicScreenSpaceErrorHeightFalloff?: number;
109
- /**
110
- * Enables adaptive LOD reduction when estimated tile memory exceeds the overflow ceiling.
111
- * Defaults to `true` for 3D Tiles and retains the existing `false` default for I3S.
112
- */
113
- memoryAdjustedScreenSpaceError?: boolean;
114
- viewportTraversersMap?: any;
115
- updateTransforms?: boolean;
116
- viewDistanceScale?: number;
117
- /** Reduced viewport-height fraction used to prioritize coarse initial coverage; `0` disables it. */
118
- progressiveResolutionHeightFraction?: number;
119
- /** Whether requests nearer the center of a perspective viewport receive higher priority. */
120
- foveatedScreenSpaceError?: boolean;
121
- /** Fraction of the perspective field of view that receives no foveated SSE relaxation. */
122
- foveatedConeSize?: number;
123
- /** Minimum logical-pixel SSE relaxation immediately outside the foveated cone. */
124
- foveatedMinimumScreenSpaceErrorRelaxation?: number;
125
- /** Function that increases SSE relaxation from the foveated cone toward the viewport edge. */
126
- foveatedInterpolationCallback?: FoveatedInterpolationCallback;
127
- /** Seconds peripheral requests may wait after the camera moves. */
128
- foveatedTimeDelay?: number;
129
-
130
- onTileLoad?: (tile: Tile3D) => any;
131
- onTileUnload?: (tile: Tile3D) => any;
132
- onTileError?: (tile: Tile3D, message: string, url: string) => any;
133
- /** Called when a format-specific source operation fails. */
134
- onSourceError?: (error: Error, source: Tileset3DSource, tile?: Tile3D | null) => any;
135
- /** Called when tileset initialization fails before traversal can begin. */
136
- onTilesetError?: (error: Error, tileset: Tileset3D) => any;
137
- contentLoader?: (tile: Tile3D) => Promise<void>;
138
- onTraversalComplete?: (selectedTiles: Tile3D[]) => Tile3D[];
139
- onUpdate?: () => void;
140
- };
141
-
142
- type Props = {
143
- description: string;
144
- ellipsoid: object;
145
- modelMatrix: Matrix4;
146
- throttleRequests: boolean;
147
- maxRequests: number;
148
- /** Soft target, in bytes, for evictable cached tile content. */
149
- cacheBytes: number;
150
- /** Current-frame headroom, in bytes, before memory-adjusted SSE rises. */
151
- maximumCacheOverflowBytes: number;
152
- maximumTilesSelected: number;
153
- debounceTime: number;
154
- onTileLoad: (tile: Tile3D) => void;
155
- onTileUnload: (tile: Tile3D) => void;
156
- onTileError: (tile: Tile3D, message: string, url: string) => void;
157
- onSourceError: (error: Error, source: Tileset3DSource, tile?: Tile3D | null) => void;
158
- onTilesetError: (error: Error, tileset: Tileset3D) => void;
159
- onTraversalComplete: (selectedTiles: Tile3D[]) => Tile3D[];
160
- onUpdate: () => void;
161
- maximumScreenSpaceError: number;
162
- /** Whether replacement traversal may skip levels while retaining ancestor coverage. */
163
- skipLevelOfDetail: boolean;
164
- /** SSE above which tiles remain part of the non-skipping base traversal. */
165
- baseScreenSpaceError: number;
166
- /** Required SSE reduction between requested skip-LOD tiles. */
167
- skipScreenSpaceErrorFactor: number;
168
- /** Minimum hierarchy levels between requested skip-LOD tiles. */
169
- skipLevels: number;
170
- /** Whether skip-LOD requests only the final desired tiles. */
171
- immediatelyLoadDesiredLevelOfDetail: boolean;
172
- /** Whether perspective dynamic SSE is enabled. */
173
- dynamicScreenSpaceError: boolean;
174
- /** Base dynamic SSE fog density in inverse meters. */
175
- dynamicScreenSpaceErrorDensity: number;
176
- /** Maximum dynamic SSE reduction in logical/CSS pixels. */
177
- dynamicScreenSpaceErrorFactor: number;
178
- /** Fraction of tileset height at which dynamic SSE begins to fade. */
179
- dynamicScreenSpaceErrorHeightFalloff: number;
180
- /** Whether cache pressure may adapt the active SSE threshold. */
181
- memoryAdjustedScreenSpaceError: boolean;
182
- viewportTraversersMap: Record<string, any> | null;
183
- attributions: string[];
184
- loadTiles: boolean;
185
- loadOptions: LoaderOptions;
186
- updateTransforms: boolean;
187
- viewDistanceScale: number;
188
- /** Reduced viewport-height fraction used to prioritize coarse initial coverage. */
189
- progressiveResolutionHeightFraction: number;
190
- /** Whether perspective requests are prioritized around the viewport center. */
191
- foveatedScreenSpaceError: boolean;
192
- /** Fraction of the perspective field of view with no foveated SSE relaxation. */
193
- foveatedConeSize: number;
194
- /** Minimum logical-pixel SSE relaxation outside the foveated cone. */
195
- foveatedMinimumScreenSpaceErrorRelaxation: number;
196
- /** Function used to interpolate foveated SSE relaxation. */
197
- foveatedInterpolationCallback: FoveatedInterpolationCallback;
198
- /** Seconds eligible peripheral requests wait after camera movement. */
199
- foveatedTimeDelay: number;
200
- basePath: string;
201
- contentLoader?: (tile: Tile3D) => Promise<void>;
202
- i3s: Record<string, any>;
203
- /** Automatic CRS output options and expert source-metadata recovery overrides. */
204
- spatial: TilesetSpatialOptions;
205
- };
206
-
207
- const BYTES_PER_MEBIBYTE = 1024 * 1024;
208
- const DEFAULT_CACHE_BYTES = 512 * BYTES_PER_MEBIBYTE;
209
- const DEFAULT_MAXIMUM_CACHE_OVERFLOW_BYTES = 512 * BYTES_PER_MEBIBYTE;
210
- const DEFAULT_I3S_CACHE_BYTES = 32 * BYTES_PER_MEBIBYTE;
211
- const DEFAULT_I3S_MAXIMUM_CACHE_OVERFLOW_BYTES = BYTES_PER_MEBIBYTE;
212
-
213
- /**
214
- * Validates a byte-based tile-cache budget.
215
- *
216
- * Fractions are accepted because JavaScript memory estimates are numbers, but negative, infinite,
217
- * and `NaN` values cannot define a stable cache threshold.
218
- *
219
- * @param value - Proposed cache budget in bytes.
220
- * @param optionName - Public option name used in an actionable error message.
221
- * @returns The validated byte budget.
222
- */
223
- function validateCacheByteLength(value: number, optionName: string): number {
224
- if (!Number.isFinite(value) || value < 0) {
225
- throw new Error(`${optionName} must be a finite number greater than or equal to 0`);
226
- }
227
- return value;
228
- }
229
-
230
- /**
231
- * Resolves the base cache target from the byte-native option or its fallback.
232
- *
233
- * @param options - Options that may contain a byte-native cache value.
234
- * @param fallbackCacheBytes - Existing or default cache target in bytes.
235
- * @returns The resolved and validated cache target in bytes.
236
- */
237
- function resolveCacheBytes(options: Tileset3DProps, fallbackCacheBytes: number): number {
238
- const cacheBytes = options.cacheBytes ?? fallbackCacheBytes;
239
- return validateCacheByteLength(cacheBytes, 'cacheBytes');
240
- }
241
-
242
- /**
243
- * Resolves cache overflow headroom from the byte-native option or its fallback.
244
- *
245
- * @param options - Options that may contain a byte-native overflow value.
246
- * @param fallbackOverflowBytes - Existing or default overflow headroom in bytes.
247
- * @returns The resolved and validated overflow headroom in bytes.
248
- */
249
- function resolveMaximumCacheOverflowBytes(
250
- options: Tileset3DProps,
251
- fallbackOverflowBytes: number
252
- ): number {
253
- const maximumCacheOverflowBytes = options.maximumCacheOverflowBytes ?? fallbackOverflowBytes;
254
- return validateCacheByteLength(maximumCacheOverflowBytes, 'maximumCacheOverflowBytes');
255
- }
256
-
257
- const DEFAULT_PROPS: Props = {
258
- description: '',
259
- ellipsoid: Ellipsoid.WGS84,
260
- modelMatrix: new Matrix4(),
261
- throttleRequests: true,
262
- maxRequests: 64,
263
- cacheBytes: DEFAULT_CACHE_BYTES,
264
- maximumCacheOverflowBytes: DEFAULT_MAXIMUM_CACHE_OVERFLOW_BYTES,
265
- maximumTilesSelected: 0,
266
- debounceTime: 0,
267
- onTileLoad: () => {},
268
- onTileUnload: () => {},
269
- onTileError: () => {},
270
- onSourceError: () => {},
271
- onTilesetError: () => {},
272
- onTraversalComplete: (selectedTiles: Tile3D[]) => selectedTiles,
273
- onUpdate: () => {},
274
- contentLoader: undefined,
275
- viewDistanceScale: 1.0,
276
- progressiveResolutionHeightFraction: 0.3,
277
- foveatedScreenSpaceError: true,
278
- foveatedConeSize: 0.1,
279
- foveatedMinimumScreenSpaceErrorRelaxation: 0,
280
- foveatedInterpolationCallback: interpolateLinearly,
281
- foveatedTimeDelay: 0.2,
282
- maximumScreenSpaceError: 8,
283
- skipLevelOfDetail: false,
284
- baseScreenSpaceError: 1024,
285
- skipScreenSpaceErrorFactor: 16,
286
- skipLevels: 1,
287
- immediatelyLoadDesiredLevelOfDetail: false,
288
- dynamicScreenSpaceError: true,
289
- dynamicScreenSpaceErrorDensity: 2.0e-4,
290
- dynamicScreenSpaceErrorFactor: 24,
291
- dynamicScreenSpaceErrorHeightFalloff: 0.25,
292
- memoryAdjustedScreenSpaceError: true,
293
- loadTiles: true,
294
- updateTransforms: true,
295
- viewportTraversersMap: null,
296
- loadOptions: {fetch: {}},
297
- attributions: [],
298
- basePath: '',
299
- i3s: {},
300
- spatial: {}
301
- };
302
-
303
- const TILES_TOTAL = 'Tiles In Tileset(s)';
304
- const TILES_IN_MEMORY = 'Tiles In Memory';
305
- const TILES_IN_VIEW = 'Tiles In View';
306
- const TILES_RENDERABLE = 'Tiles To Render';
307
- const TILES_LOADED = 'Tiles Loaded';
308
- const TILES_LOADING = 'Tiles Loading';
309
- const TILES_UNLOADED = 'Tiles Unloaded';
310
- const TILES_LOAD_FAILED = 'Failed Tile Loads';
311
- const POINTS_COUNT = 'Points/Vertices';
312
- const TILES_GPU_MEMORY = 'Tile Memory Use';
313
- const MAXIMUM_SSE = 'Maximum Screen Space Error';
314
-
315
- /**
316
- * Shared runtime for tile traversal, selection, cache management, and request scheduling.
317
- *
318
- * Format-specific loading behavior is delegated to a {@link Tileset3DSource} implementation.
319
- */
320
- export class Tileset3D {
321
- options: Props;
322
- loadOptions: LoaderOptions;
323
- /** Source implementation responsible for format-specific initialization and loading. */
324
- source: Tileset3DSource;
325
-
326
- type: TILESET_TYPE;
327
- tileset: TilesetJSON | null;
328
- loader: Loader;
329
- url: string;
330
- basePath: string;
331
- modelMatrix: Matrix4;
332
- ellipsoid: any;
333
- lodMetricType: string;
334
- lodMetricValue: number;
335
- refine: string;
336
- root: Tile3D | null = null;
337
- roots: Record<string, Tile3D> = {};
338
- asset: Record<string, any> = {};
339
- /** Inline metadata schema declared by the source tileset, when present. */
340
- schema: Record<string, any> | null = null;
341
- /** External metadata schema URI declared by the source tileset, when present. */
342
- schemaUri: string | null = null;
343
- /** Metadata groups declared by the source tileset, in source order. */
344
- groups: Array<Record<string, any>> = [];
345
- /** Tileset-wide metadata entity, preserved without property-table decoding. */
346
- metadata: Record<string, any> | null = null;
347
- /** Tileset statistics metadata, preserved for application-level inspection. */
348
- statistics: unknown = null;
349
- /** Normalized source and target coordinate reference system metadata. */
350
- spatialReference: TilesetSpatialReference = createTilesetSpatialReference({});
351
-
352
- description = '';
353
- properties: any;
354
- extras: any = null;
355
- attributions: any = {};
356
- credits: any = {};
357
-
358
- stats: Stats;
359
- contentFormats: TilesetContentFormats;
360
-
361
- cartographicCenter: Vector3 | null = null;
362
- cartesianCenter: Vector3 | null = null;
363
- zoom = 1;
364
- boundingVolume: any = null;
365
-
366
- /** Effective dynamic SSE density calculated for the most recently traversed viewport. */
367
- dynamicScreenSpaceErrorComputedDensity = 0;
368
-
369
- /** Estimated bytes currently retained by loaded tile content. */
370
- gpuMemoryUsageInBytes = 0;
371
- /** Active SSE threshold after optional cache-pressure adjustment, in logical/CSS pixels. */
372
- memoryAdjustedScreenSpaceError = 0.0;
373
-
374
- private _cacheBytes = DEFAULT_CACHE_BYTES;
375
- private _maximumCacheOverflowBytes = DEFAULT_MAXIMUM_CACHE_OVERFLOW_BYTES;
376
-
377
- _frameNumber = 0;
378
- private _tiles: Record<string, Tile3D> = {};
379
- private _pendingCount = 0;
380
-
381
- selectedTiles: Tile3D[] = [];
382
-
383
- traverseCounter = 0;
384
- geometricError = 0;
385
- private lastUpdatedVieports: Viewport[] | Viewport | null = null;
386
- private _requestedTiles: Tile3D[] = [];
387
- private _emptyTiles: Tile3D[] = [];
388
- private frameStateData: any = {};
389
- /** Last camera pose retained independently for each viewport. */
390
- private _cameraMotionStates: Record<string, CameraMotionState> = {};
391
- /** Pending traversal that releases requests after camera motion settles. */
392
- private _deferredTraversalTimeout: ReturnType<typeof setTimeout> | null = null;
393
-
394
- _traverser: TilesetTraverser;
395
- _cache = new TilesetCache();
396
- _requestScheduler: RequestScheduler;
397
-
398
- /** Drawn fallback instances retained independently for each viewport tree. */
399
- private _heldTiles: Set<Tile3D> = new Set();
400
- private updatePromise: Promise<number> | null = null;
401
- tilesetInitializationPromise: Promise<void>;
402
-
403
- /**
404
- * Creates a tileset runtime from an explicit source implementation.
405
- * @param source Source-backed tileset implementation.
406
- * @param options Traversal and runtime options.
407
- */
408
- constructor(source: Tileset3DSource, options?: Tileset3DProps) {
409
- if (!isTileset3DSource(source)) {
410
- throw new Error('Tileset3D requires a Tileset3DSource instance');
411
- }
412
-
413
- const suppliedOptions = options || {};
414
- const usesTiles3DCacheDefaults = source.type === TILESET_TYPE.TILES3D;
415
- const defaultCacheBytes = usesTiles3DCacheDefaults
416
- ? DEFAULT_PROPS.cacheBytes
417
- : DEFAULT_I3S_CACHE_BYTES;
418
- const defaultMaximumCacheOverflowBytes = usesTiles3DCacheDefaults
419
- ? DEFAULT_PROPS.maximumCacheOverflowBytes
420
- : DEFAULT_I3S_MAXIMUM_CACHE_OVERFLOW_BYTES;
421
- const cacheBytes = resolveCacheBytes(suppliedOptions, defaultCacheBytes);
422
- const maximumCacheOverflowBytes = resolveMaximumCacheOverflowBytes(
423
- suppliedOptions,
424
- defaultMaximumCacheOverflowBytes
425
- );
426
- this.options = {
427
- ...DEFAULT_PROPS,
428
- ...suppliedOptions,
429
- cacheBytes,
430
- maximumCacheOverflowBytes,
431
- skipLevelOfDetail: suppliedOptions.skipLevelOfDetail ?? source.type === TILESET_TYPE.TILES3D,
432
- memoryAdjustedScreenSpaceError:
433
- suppliedOptions.memoryAdjustedScreenSpaceError ?? usesTiles3DCacheDefaults
434
- };
435
- this.loadOptions = this.options.loadOptions || {};
436
- this.source = source;
437
-
438
- this.tileset = null;
439
- this.loader = this.source.loader;
440
- this.type = this.source.type;
441
- this.url = this.source.url;
442
- this.basePath = this.source.basePath;
443
- this.modelMatrix = this.options.modelMatrix;
444
- this.ellipsoid = this.options.ellipsoid;
445
- this.lodMetricType = '';
446
- this.lodMetricValue = 0;
447
- this.refine = '';
448
- this.contentFormats = this.source.contentFormats;
449
-
450
- this._traverser = this._initializeTraverser();
451
- this._requestScheduler = new RequestScheduler({
452
- throttleRequests: this.options.throttleRequests,
453
- maxRequests: this.options.maxRequests
454
- });
455
-
456
- this.memoryAdjustedScreenSpaceError = this.options.maximumScreenSpaceError;
457
- this._cacheBytes = cacheBytes;
458
- this._maximumCacheOverflowBytes = maximumCacheOverflowBytes;
459
- const metadata = this._getSourceMetadata();
460
- if (metadata) {
461
- this.spatialReference = applyTilesetSpatialOptions(
462
- metadata.spatialReference,
463
- this.options.spatial
464
- );
465
- }
466
-
467
- this.stats = new Stats({id: this.url});
468
- this._initializeStats();
469
-
470
- this.tilesetInitializationPromise = this._initializeTileSet();
471
- }
472
-
473
- destroy(): void {
474
- this._clearDeferredTraversal();
475
- this.source.destroy?.();
476
- this._destroy();
477
- }
478
-
479
- isLoaded(): boolean {
480
- return this._pendingCount === 0 && this._frameNumber !== 0 && this._requestedTiles.length === 0;
481
- }
482
-
483
- get tiles(): object[] {
484
- return Object.values(this._tiles);
485
- }
486
-
487
- get frameNumber(): number {
488
- return this._frameNumber;
489
- }
490
-
491
- /**
492
- * Returns the tiles requested during the most recent completed traversal.
493
- *
494
- * A defensive copy makes request ordering deterministic for diagnostics and prevents callers
495
- * from mutating the scheduler's working set.
496
- */
497
- get requestedTiles(): readonly Tile3D[] {
498
- return this._requestedTiles.slice();
499
- }
500
-
501
- /**
502
- * Returns empty tiles considered during the most recent completed traversal.
503
- *
504
- * Empty tiles can still be useful hierarchy placeholders, but their IDs are included in
505
- * observability snapshots so applications can distinguish traversal work from render content.
506
- */
507
- get emptyTiles(): readonly Tile3D[] {
508
- return this._emptyTiles.slice();
509
- }
510
-
511
- /**
512
- * Gets or sets the soft target, in bytes, for cached tile content not needed this frame.
513
- *
514
- * Current-frame tiles remain protected even when their estimated memory exceeds this target.
515
- * Reducing the value makes unused least-recently-used tiles eligible for eviction on the next
516
- * traversal.
517
- * @default 536870912 for 3D Tiles; 33554432 for I3S
518
- */
519
- get cacheBytes(): number {
520
- return this._cacheBytes;
521
- }
522
-
523
- set cacheBytes(value: number) {
524
- this._cacheBytes = validateCacheByteLength(value, 'cacheBytes');
525
- this.options.cacheBytes = this._cacheBytes;
526
- }
527
-
528
- /**
529
- * Gets or sets the additional current-frame headroom, in bytes, before memory-adjusted SSE rises.
530
- *
531
- * The pressure ceiling is `cacheBytes + maximumCacheOverflowBytes`. This value does not change
532
- * the base target used to evict tiles that were not touched in the current frame.
533
- * @default 536870912 for 3D Tiles; 1048576 for I3S
534
- */
535
- get maximumCacheOverflowBytes(): number {
536
- return this._maximumCacheOverflowBytes;
537
- }
538
-
539
- set maximumCacheOverflowBytes(value: number) {
540
- this._maximumCacheOverflowBytes = validateCacheByteLength(value, 'maximumCacheOverflowBytes');
541
- this.options.maximumCacheOverflowBytes = this._maximumCacheOverflowBytes;
542
- }
543
-
544
- get queryParams(): string {
545
- const rootUrl = this.source.getTileUrl(this.url);
546
- const queryIndex = rootUrl.indexOf('?');
547
- return queryIndex >= 0 ? rootUrl.slice(queryIndex + 1) : '';
548
- }
549
-
550
- /**
551
- * Updates traversal and runtime options while retaining unspecified byte budgets.
552
- *
553
- * @param props - Partial runtime options to apply.
554
- */
555
- setProps(props: Tileset3DProps): void {
556
- const cacheBytes = resolveCacheBytes(props, this.cacheBytes);
557
- const maximumCacheOverflowBytes = resolveMaximumCacheOverflowBytes(
558
- props,
559
- this.maximumCacheOverflowBytes
560
- );
561
- this.options = {
562
- ...this.options,
563
- ...props,
564
- cacheBytes,
565
- maximumCacheOverflowBytes
566
- };
567
- this._cacheBytes = cacheBytes;
568
- this._maximumCacheOverflowBytes = maximumCacheOverflowBytes;
569
- }
570
-
571
- getTileUrl(tilePath: string): string {
572
- return this.source.getTileUrl(tilePath);
573
- }
574
-
575
- hasExtension(extensionName: string): boolean {
576
- return Boolean(this.source.hasExtension?.(extensionName));
577
- }
578
-
579
- update(viewports: Viewport[] | Viewport | null = null): void {
580
- this.tilesetInitializationPromise.then(() => {
581
- if (!viewports && this.lastUpdatedVieports) {
582
- viewports = this.lastUpdatedVieports;
583
- } else {
584
- this.lastUpdatedVieports = viewports;
585
- }
586
- if (viewports) {
587
- this.doUpdate(viewports);
588
- }
589
- });
590
- }
591
-
592
- async selectTiles(viewports: Viewport[] | Viewport | null = null): Promise<number> {
593
- await this.tilesetInitializationPromise;
594
- if (viewports) {
595
- this.lastUpdatedVieports = viewports;
596
- }
597
- if (!this.updatePromise) {
598
- this.updatePromise = new Promise<number>(resolve => {
599
- setTimeout(() => {
600
- if (this.lastUpdatedVieports) {
601
- this.doUpdate(this.lastUpdatedVieports);
602
- }
603
- resolve(this._frameNumber);
604
- this.updatePromise = null;
605
- }, this.options.debounceTime);
606
- });
607
- }
608
- return this.updatePromise;
609
- }
610
-
611
- /**
612
- * Moves the active LOD threshold toward the configured SSE or away from cache pressure.
613
- *
614
- * Usage below {@link Tileset3D.cacheBytes} restores quality in two-percent steps. Usage above
615
- * `cacheBytes + maximumCacheOverflowBytes` reduces refinement in two-percent steps. Values in
616
- * the overflow window leave the threshold unchanged, preventing rapid load/evict oscillation.
617
- */
618
- adjustScreenSpaceError(): void {
619
- if (this.gpuMemoryUsageInBytes < this.cacheBytes) {
620
- this.memoryAdjustedScreenSpaceError = Math.max(
621
- this.memoryAdjustedScreenSpaceError / 1.02,
622
- this.options.maximumScreenSpaceError
623
- );
624
- } else if (this.gpuMemoryUsageInBytes > this.cacheBytes + this.maximumCacheOverflowBytes) {
625
- this.memoryAdjustedScreenSpaceError *= 1.02;
626
- }
627
- }
628
-
629
- private doUpdate(viewports: Viewport[] | Viewport): void {
630
- if ('loadTiles' in this.options && !this.options.loadTiles) {
631
- return;
632
- }
633
- if (this.traverseCounter > 0) {
634
- return;
635
- }
636
- const preparedViewports = viewports instanceof Array ? viewports : [viewports];
637
- const activeViewportIds = new Set(preparedViewports.map(viewport => viewport.id));
638
- // A viewport may be removed between frames. Discard its completed state before aggregating
639
- // requested and selected tiles so observability reflects only the current traversal inputs.
640
- for (const frameStateId of Object.keys(this.frameStateData)) {
641
- if (!activeViewportIds.has(frameStateId)) {
642
- delete this.frameStateData[frameStateId];
643
- }
644
- }
645
-
646
- this._cache.reset();
647
- this._frameNumber++;
648
- this.traverseCounter = preparedViewports.length;
649
- const currentTime = Date.now();
650
- let minimumDeferredTraversalDelay = Number.POSITIVE_INFINITY;
651
- const viewportsToTraverse: string[] = [];
652
- for (const viewport of preparedViewports) {
653
- const id = viewport.id;
654
- if (this._needTraverse(id)) {
655
- viewportsToTraverse.push(id);
656
- } else {
657
- this.traverseCounter--;
658
- }
659
- }
660
-
661
- for (const viewport of preparedViewports) {
662
- const id = viewport.id;
663
- if (!this.roots[id]) {
664
- this.roots[id] = this._initializeTileHeaders(this.tileset, null);
665
- }
666
-
667
- if (!viewportsToTraverse.includes(id)) {
668
- continue;
669
- }
670
- const frameState = getFrameState(viewport as GeospatialViewport, this._frameNumber);
671
- const root = this.roots[id];
672
- const cameraMotionUpdate = updateCameraMotionState(
673
- this._cameraMotionStates[id],
674
- frameState.camera.position,
675
- frameState.camera.direction,
676
- currentTime
677
- );
678
- this._cameraMotionStates[id] = cameraMotionUpdate.state;
679
- frameState.camera.timeSinceMovement = cameraMotionUpdate.timeSinceMovement;
680
- // Dynamic SSE reads the root's inverse computed transform before traversal updates tile
681
- // visibility. Refresh it from the current tileset model matrix here so animated local
682
- // box/sphere tilesets never calculate their height falloff one transform behind the frame.
683
- updateRootTransformForDynamicScreenSpaceError(root, this.modelMatrix);
684
- frameState.dynamicScreenSpaceErrorDensity =
685
- this.type === TILESET_TYPE.TILES3D &&
686
- this.options.dynamicScreenSpaceError &&
687
- !frameState.viewport.orthographic
688
- ? calculateDynamicScreenSpaceErrorDensity(root, frameState, this.options)
689
- : 0;
690
- // Keep the legacy diagnostic field, but traversal reads the per-viewport frame value above.
691
- this.dynamicScreenSpaceErrorComputedDensity = frameState.dynamicScreenSpaceErrorDensity;
692
- this._traverser.traverse(root, frameState, this.options);
693
- if (Object.keys(this._traverser.deferredTiles).length > 0) {
694
- minimumDeferredTraversalDelay = Math.min(
695
- minimumDeferredTraversalDelay,
696
- Math.max(this.options.foveatedTimeDelay - cameraMotionUpdate.timeSinceMovement, 0)
697
- );
698
- }
699
- }
700
-
701
- if (Number.isFinite(minimumDeferredTraversalDelay)) {
702
- this._scheduleDeferredTraversal(minimumDeferredTraversalDelay);
703
- } else {
704
- this._clearDeferredTraversal();
705
- }
706
- }
707
-
708
- /**
709
- * Schedules one follow-up traversal when the moving-camera deferral window expires.
710
- *
711
- * Replacing an existing timer ensures continuing camera movement pushes the retry window forward
712
- * instead of creating a queue of redundant traversals.
713
- *
714
- * @param delayInSeconds - Remaining stationary delay before deferred requests become eligible.
715
- */
716
- private _scheduleDeferredTraversal(delayInSeconds: number): void {
717
- this._clearDeferredTraversal();
718
- this._deferredTraversalTimeout = setTimeout(
719
- () => {
720
- this._deferredTraversalTimeout = null;
721
- this.selectTiles().catch((error: unknown) => {
722
- const traversalError = error instanceof Error ? error : new Error(String(error));
723
- this._onTilesetError(traversalError);
724
- });
725
- },
726
- Math.max(delayInSeconds * 1000, 0)
727
- );
728
- }
729
-
730
- /** Clears a pending moving-camera follow-up traversal. */
731
- private _clearDeferredTraversal(): void {
732
- if (this._deferredTraversalTimeout !== null) {
733
- clearTimeout(this._deferredTraversalTimeout);
734
- this._deferredTraversalTimeout = null;
735
- }
736
- }
737
-
738
- _needTraverse(viewportId: string): boolean {
739
- let traverserId = viewportId;
740
- if (this.options.viewportTraversersMap) {
741
- traverserId = this.options.viewportTraversersMap[viewportId];
742
- }
743
- return traverserId === viewportId;
744
- }
745
-
746
- _onTraversalEnd(frameState: FrameState): void {
747
- const id = frameState.viewport.id;
748
- if (!this.frameStateData[id]) {
749
- this.frameStateData[id] = {selectedTiles: [], _requestedTiles: [], _emptyTiles: []};
750
- }
751
- const currentFrameStateData = this.frameStateData[id];
752
- const selectedTiles = Object.values(this._traverser.selectedTiles);
753
- const [filteredSelectedTiles, unselectedTiles] = limitSelectedTiles(
754
- selectedTiles,
755
- frameState,
756
- this.options.maximumTilesSelected
757
- );
758
- currentFrameStateData.selectedTiles = filteredSelectedTiles;
759
- for (const tile of unselectedTiles) {
760
- tile.unselect();
761
- }
762
-
763
- currentFrameStateData._requestedTiles = Object.values(this._traverser.requestedTiles);
764
- currentFrameStateData._emptyTiles = Object.values(this._traverser.emptyTiles);
765
-
766
- this.traverseCounter--;
767
- if (this.traverseCounter > 0) {
768
- return;
769
- }
770
-
771
- this._updateTiles();
772
- }
773
-
774
- _updateTiles(): void {
775
- const previousSelectedTiles = this.selectedTiles;
776
- this.selectedTiles = [];
777
- this._requestedTiles = [];
778
- this._emptyTiles = [];
779
-
780
- for (const frameStateKey in this.frameStateData) {
781
- const frameStateDataValue = this.frameStateData[frameStateKey];
782
- this.selectedTiles = this.selectedTiles.concat(frameStateDataValue.selectedTiles);
783
- this._requestedTiles = this._requestedTiles.concat(frameStateDataValue._requestedTiles);
784
- this._emptyTiles = this._emptyTiles.concat(frameStateDataValue._emptyTiles);
785
- }
786
-
787
- this.selectedTiles = this.options.onTraversalComplete(this.selectedTiles);
788
-
789
- const selectedTiles = new Set(this.selectedTiles);
790
- const hasUndrawnTiles = this.selectedTiles.some(tile => !tile.tileDrawn);
791
-
792
- let heldBackCount = 0;
793
- if (hasUndrawnTiles) {
794
- const activeRoots = new Set(
795
- Object.keys(this.frameStateData).map(viewportId => this.roots[viewportId])
796
- );
797
- const descendantReadiness = new Map<Tile3D, boolean>();
798
- for (const tile of this.selectedTiles) {
799
- for (let ancestor = tile.parent; ancestor; ancestor = ancestor.parent) {
800
- descendantReadiness.set(
801
- ancestor,
802
- (descendantReadiness.get(ancestor) ?? true) && tile.tileDrawn
803
- );
804
- }
805
- }
806
- // Drawing can finish between traversals. Promote only previously selected
807
- // geometry that actually drew; pending tiles cannot provide visible fallback.
808
- for (const tile of previousSelectedTiles) {
809
- if (tile.tileDrawn) this._heldTiles.add(tile);
810
- }
811
- for (const tile of this._heldTiles) {
812
- let root = tile;
813
- while (root.parent) root = root.parent;
814
- // Removed viewport trees cannot contribute fallback to the remaining views.
815
- if (!activeRoots.has(root)) {
816
- this._heldTiles.delete(tile);
817
- continue;
818
- }
819
- if (selectedTiles.has(tile)) continue;
820
- if (
821
- tile.contentAvailable &&
822
- !this._hasDrawnReplacement(tile, selectedTiles, descendantReadiness)
823
- ) {
824
- tile._selectedFrame = this._frameNumber;
825
- this.selectedTiles.push(tile);
826
- heldBackCount++;
827
- } else {
828
- this._heldTiles.delete(tile);
829
- }
830
- }
831
- } else {
832
- this._heldTiles = selectedTiles;
833
- }
834
-
835
- if (heldBackCount > 0) {
836
- setTimeout(() => {
837
- this.selectTiles();
838
- }, 0);
839
- }
840
-
841
- for (const tile of this.selectedTiles) {
842
- this._tiles[tile.id] = tile;
843
- }
844
-
845
- this._loadTiles();
846
- this._unloadTiles();
847
- this._updateStats();
848
-
849
- if (this._tilesChanged(previousSelectedTiles, this.selectedTiles)) {
850
- this.options.onUpdate();
851
- }
852
- }
853
-
854
- /**
855
- * Releases fallback geometry once its own selected replacement has drawn.
856
- * Unrelated pending branches must not delay this region's handoff. When no related
857
- * replacement is selected, retain the fallback until the complete selection has drawn.
858
- */
859
- private _hasDrawnReplacement(
860
- tile: Tile3D,
861
- selectedTiles: Set<Tile3D>,
862
- descendantReadiness: Map<Tile3D, boolean>
863
- ): boolean {
864
- for (let ancestor = tile.parent; ancestor; ancestor = ancestor.parent) {
865
- if (selectedTiles.has(ancestor)) {
866
- return ancestor.tileDrawn;
867
- }
868
- }
869
- return descendantReadiness.get(tile) === true;
870
- }
871
-
872
- _tilesChanged(oldSelectedTiles: Tile3D[], selectedTiles: Tile3D[]): boolean {
873
- if (oldSelectedTiles.length !== selectedTiles.length) {
874
- return true;
875
- }
876
- const oldSet = new Set(oldSelectedTiles.map(tile => tile.id));
877
- const newSet = new Set(selectedTiles.map(tile => tile.id));
878
- let changed = oldSelectedTiles.some(tile => !newSet.has(tile.id));
879
- changed = changed || selectedTiles.some(tile => !oldSet.has(tile.id));
880
- return changed;
881
- }
882
-
883
- _loadTiles(): void {
884
- this._requestedTiles.sort((tileA, tileB) => tileA._priority - tileB._priority);
885
- for (const tile of this._requestedTiles) {
886
- if (tile.contentUnloaded) {
887
- this._loadTile(tile);
888
- }
889
- }
890
- }
891
-
892
- _unloadTiles(): void {
893
- this._cache.unloadTiles(this, (tileset, tile) => tileset._unloadTile(tile));
894
- if (this.options.memoryAdjustedScreenSpaceError) {
895
- this.adjustScreenSpaceError();
896
- }
897
- }
898
-
899
- _updateStats(): void {
900
- let tilesRenderable = 0;
901
- let pointsRenderable = 0;
902
- for (const tile of this.selectedTiles) {
903
- if (tile.contentAvailable && tile.content) {
904
- tilesRenderable++;
905
- const contents = tile.contents.length ? tile.contents : [tile.content];
906
- for (const content of contents) {
907
- if (content.pointCount) {
908
- pointsRenderable += content.pointCount;
909
- } else {
910
- pointsRenderable += content.vertexCount || 0;
911
- }
912
- }
913
- }
914
- }
915
-
916
- this.stats.get(TILES_IN_VIEW).count = this.selectedTiles.length;
917
- this.stats.get(TILES_RENDERABLE).count = tilesRenderable;
918
- this.stats.get(POINTS_COUNT).count = pointsRenderable;
919
- this.stats.get(MAXIMUM_SSE).count = this.memoryAdjustedScreenSpaceError;
920
- }
921
-
922
- async _initializeTileSet(): Promise<void> {
923
- try {
924
- const initializePromise = this.source.initialize();
925
- const initialMetadata = this._getSourceMetadata();
926
- if (initialMetadata) {
927
- this._syncSourceState(initialMetadata);
928
- }
929
- if (
930
- initialMetadata?.tileset?.root &&
931
- typeof initialMetadata.tileset.root.then !== 'function' &&
932
- (!this.source.prepareTileset || this.spatialReference?.status === 'native')
933
- ) {
934
- this.root = this._initializeTileHeaders(initialMetadata.tileset, null);
935
- this._applyViewState();
936
- }
937
-
938
- await initializePromise;
939
- const metadata = this.source.getMetadata();
940
- this._syncSourceState(metadata);
941
- await this.source.prepareTileset?.(this);
942
- if (!this.root) {
943
- this.root = this._initializeTileHeaders(metadata.tileset, null);
944
- }
945
- this._applyViewState();
946
- } catch (error: unknown) {
947
- const sourceError = error instanceof Error ? error : new Error(String(error));
948
- this._onSourceError(sourceError, this.root);
949
- this._onTilesetError(sourceError);
950
- throw sourceError;
951
- }
952
- }
953
-
954
- _initializeStats(): void {
955
- this.stats.get(TILES_TOTAL);
956
- this.stats.get(TILES_LOADING);
957
- this.stats.get(TILES_IN_MEMORY);
958
- this.stats.get(TILES_IN_VIEW);
959
- this.stats.get(TILES_RENDERABLE);
960
- this.stats.get(TILES_LOADED);
961
- this.stats.get(TILES_UNLOADED);
962
- this.stats.get(TILES_LOAD_FAILED);
963
- this.stats.get(POINTS_COUNT);
964
- this.stats.get(TILES_GPU_MEMORY, 'memory');
965
- this.stats.get(MAXIMUM_SSE);
966
- }
967
-
968
- _initializeTileHeaders(tilesetJson: TilesetJSON, parentTileHeader?: Tile3D | null): Tile3D {
969
- return this.source.initializeTileHeaders(this, tilesetJson, parentTileHeader);
970
- }
971
-
972
- _initializeTraverser(): TilesetTraverser {
973
- return this.source.createTraverser({
974
- basePath: this.basePath,
975
- onTraversalEnd: this._onTraversalEnd.bind(this)
976
- });
977
- }
978
-
979
- _destroyTileHeaders(parentTile: Tile3D): void {
980
- this._destroySubtree(parentTile);
981
- }
982
-
983
- async _loadTile(tile: Tile3D): Promise<void> {
984
- let loadResult: TileContentLoadResult | null = null;
985
- try {
986
- this._onStartTileLoading();
987
- loadResult = await tile.loadContent();
988
- } catch (error: unknown) {
989
- const tileError = error instanceof Error ? error : new Error('load failed');
990
- this._onSourceError(tileError, tile);
991
- this._onTileLoadError(tile, tileError);
992
- } finally {
993
- this._onEndTileLoading();
994
- this._onTileLoad(tile, loadResult);
995
- }
996
- }
997
-
998
- /**
999
- * Loads a source-managed lazy child-header group and reports failures through tile callbacks.
1000
- *
1001
- * Subtree metadata shares the normal loading counters but is not reported as render content and
1002
- * is not added to the GPU cache. Traversal is notified separately after the promise settles.
1003
- *
1004
- * @param tile - Runtime tile that owns the lazy subtree reference.
1005
- * @param frameState - View state that made the subtree eligible for refinement.
1006
- */
1007
- async _loadTileChildren(tile: Tile3D, frameState: FrameState): Promise<void> {
1008
- try {
1009
- this._onStartTileLoading();
1010
- await tile.loadChildren(frameState);
1011
- } catch (error: unknown) {
1012
- const tileError = error instanceof Error ? error : new Error('subtree load failed');
1013
- this._onSourceError(tileError, tile);
1014
- this._onTileLoadError(tile, tileError);
1015
- } finally {
1016
- this._onEndTileLoading();
1017
- }
1018
- }
1019
-
1020
- _onTileLoadError(tile: Tile3D, error: Error): void {
1021
- this.stats.get(TILES_LOAD_FAILED).incrementCount();
1022
-
1023
- const message = error.message || error.toString();
1024
- const url = tile.url;
1025
- console.error(`A 3D tile failed to load: ${tile.url} ${message}`);
1026
- this.options.onTileError(tile, message, url);
1027
- }
1028
-
1029
- _onSourceError(error: Error, tile: Tile3D | null = null): void {
1030
- this.options.onSourceError(error, this.source, tile);
1031
- }
1032
-
1033
- _onTilesetError(error: Error): void {
1034
- this.options.onTilesetError(error, this);
1035
- }
1036
-
1037
- _onTileLoad(tile: Tile3D, loadResult: TileContentLoadResult | null): void {
1038
- if (!loadResult?.loaded) {
1039
- return;
1040
- }
1041
-
1042
- if (tile.content) {
1043
- calculateTransformProps(tile, tile.content);
1044
- }
1045
-
1046
- this.source.onTileLoaded?.(this, tile, loadResult);
1047
- this._syncSourceState(this.source.getMetadata());
1048
-
1049
- const totalTiles = this.source.getTilesTotalCount?.();
1050
- if (totalTiles) {
1051
- this.stats.get(TILES_TOTAL).reset();
1052
- this.stats.get(TILES_TOTAL).addCount(totalTiles);
1053
- }
1054
-
1055
- this._addTileToCache(tile);
1056
- this.options.onTileLoad(tile);
1057
- }
1058
-
1059
- _onStartTileLoading(): void {
1060
- this._pendingCount++;
1061
- this.stats.get(TILES_LOADING).incrementCount();
1062
- }
1063
-
1064
- _onEndTileLoading(): void {
1065
- this._pendingCount--;
1066
- this.stats.get(TILES_LOADING).decrementCount();
1067
- }
1068
-
1069
- _addTileToCache(tile: Tile3D): void {
1070
- this._cache.add(this, tile, tileset => tileset._updateCacheStats(tile));
1071
- }
1072
-
1073
- _updateCacheStats(tile: Tile3D): void {
1074
- this.stats.get(TILES_LOADED).incrementCount();
1075
- this.stats.get(TILES_IN_MEMORY).incrementCount();
1076
-
1077
- this.gpuMemoryUsageInBytes += tile.gpuMemoryUsageInBytes || 0;
1078
- this.stats.get(TILES_GPU_MEMORY).count = this.gpuMemoryUsageInBytes;
1079
-
1080
- if (this.options.memoryAdjustedScreenSpaceError) {
1081
- this.adjustScreenSpaceError();
1082
- }
1083
- }
1084
-
1085
- _unloadTile(tile: Tile3D): void {
1086
- this.gpuMemoryUsageInBytes -= tile.gpuMemoryUsageInBytes || 0;
1087
-
1088
- this.stats.get(TILES_IN_MEMORY).decrementCount();
1089
- this.stats.get(TILES_UNLOADED).incrementCount();
1090
- this.stats.get(TILES_GPU_MEMORY).count = this.gpuMemoryUsageInBytes;
1091
-
1092
- this.options.onTileUnload(tile);
1093
- tile.unloadContent();
1094
- }
1095
-
1096
- _destroy(): void {
1097
- const stack: Tile3D[] = [];
1098
-
1099
- if (this.root) {
1100
- stack.push(this.root);
1101
- }
1102
-
1103
- while (stack.length > 0) {
1104
- const tile = stack.pop() as Tile3D;
1105
-
1106
- for (const child of tile.children) {
1107
- stack.push(child);
1108
- }
1109
-
1110
- this._destroyTile(tile);
1111
- }
1112
- this.root = null;
1113
- }
1114
-
1115
- _destroySubtree(tile: Tile3D): void {
1116
- const rootTile = tile;
1117
- const stack: Tile3D[] = [rootTile];
1118
- while (stack.length > 0) {
1119
- tile = stack.pop() as Tile3D;
1120
- for (const child of tile.children) {
1121
- stack.push(child);
1122
- }
1123
- if (tile !== rootTile) {
1124
- this._destroyTile(tile);
1125
- }
1126
- }
1127
- rootTile.children = [];
1128
- }
1129
-
1130
- _destroyTile(tile: Tile3D): void {
1131
- this._cache.unloadTile(this, tile);
1132
- this._unloadTile(tile);
1133
- tile.destroy();
1134
- }
1135
-
1136
- private _syncSourceState(metadata: TilesetSourceMetadata): void {
1137
- this.tileset = metadata.tileset;
1138
- this.loader = metadata.loader;
1139
- this.type = metadata.type;
1140
- this.url = metadata.url;
1141
- this.basePath = metadata.basePath;
1142
- this.lodMetricType = metadata.lodMetricType;
1143
- this.lodMetricValue = metadata.lodMetricValue;
1144
- this.refine = metadata.refine;
1145
- this.contentFormats = this.source.contentFormats;
1146
- this.asset = this.source.asset || this.asset;
1147
- const tileset = metadata.tileset as Record<string, any>;
1148
- this.schema = tileset.schema || null;
1149
- this.schemaUri = tileset.schemaUri || null;
1150
- this.groups = tileset.groups || [];
1151
- this.metadata = tileset.metadata || null;
1152
- this.statistics = tileset.statistics ?? null;
1153
- const spatialReference = applyTilesetSpatialOptions(
1154
- metadata.spatialReference,
1155
- this.options.spatial
1156
- );
1157
- this.spatialReference = preserveTransformedSpatialReference(
1158
- this.spatialReference,
1159
- spatialReference
1160
- );
1161
- this.properties = this.source.properties ?? this.properties;
1162
- this.extras = this.source.extras ?? this.extras;
1163
- if (this.options.attributions?.length) {
1164
- this.credits = {attributions: this.options.attributions};
1165
- } else {
1166
- this.credits = this.source.credits || this.credits;
1167
- }
1168
- }
1169
-
1170
- private _applyViewState(): void {
1171
- const viewState = this.source.getViewState(this.root);
1172
- this.asset = viewState.asset || this.source.asset || {};
1173
- this.properties = viewState.properties ?? this.source.properties;
1174
- this.extras = viewState.extras ?? this.source.extras ?? null;
1175
- this.credits = viewState.credits ||
1176
- this.source.credits ||
1177
- this.credits || {attributions: this.options.attributions || []};
1178
- this.description = viewState.description || this.options.description || '';
1179
- this.boundingVolume = viewState.boundingVolume || this.root?.boundingVolume || null;
1180
- this.cartographicCenter = viewState.cartographicCenter || new Vector3();
1181
- this.cartesianCenter = viewState.cartesianCenter || null;
1182
- this.zoom = viewState.zoom || 1;
1183
- this.geometricError = this.tileset?.geometricError || 0;
1184
- }
1185
-
1186
- /**
1187
- * Returns normalized source metadata when initialization has already populated it.
1188
- */
1189
- private _getSourceMetadata(): TilesetSourceMetadata | null {
1190
- try {
1191
- return this.source.getMetadata();
1192
- } catch {
1193
- return null;
1194
- }
1195
- }
1196
- }
1197
-
1198
- /** Preserve a completed runtime operation when asynchronous source metadata describes the same request. */
1199
- function preserveTransformedSpatialReference(
1200
- current: TilesetSpatialReference,
1201
- next: TilesetSpatialReference
1202
- ): TilesetSpatialReference {
1203
- return current?.status === 'transformed' &&
1204
- current.sourceCrs === next.sourceCrs &&
1205
- current.targetCrs === next.targetCrs &&
1206
- current.targetHeightReference === next.targetHeightReference &&
1207
- current.outputCoordinates === next.outputCoordinates
1208
- ? current
1209
- : next;
1210
- }