@loaders.gl/3d-tiles 4.0.0-alpha.5 → 4.0.0-alpha.6

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 (313) hide show
  1. package/dist/bundle.js +2 -2
  2. package/dist/cesium-ion-loader.d.ts.map +1 -1
  3. package/dist/cesium-ion-loader.js +37 -32
  4. package/dist/dist.min.js +3850 -1551
  5. package/dist/es5/bundle.js +6 -0
  6. package/dist/es5/bundle.js.map +1 -0
  7. package/dist/es5/cesium-ion-loader.js +77 -0
  8. package/dist/es5/cesium-ion-loader.js.map +1 -0
  9. package/dist/es5/index.js +63 -0
  10. package/dist/es5/index.js.map +1 -0
  11. package/dist/es5/lib/classes/helpers/tile-3d-accessor-utils.js +114 -0
  12. package/dist/es5/lib/classes/helpers/tile-3d-accessor-utils.js.map +1 -0
  13. package/dist/es5/lib/classes/tile-3d-batch-table-hierarchy.js +180 -0
  14. package/dist/es5/lib/classes/tile-3d-batch-table-hierarchy.js.map +1 -0
  15. package/dist/es5/lib/classes/tile-3d-batch-table.js +285 -0
  16. package/dist/es5/lib/classes/tile-3d-batch-table.js.map +1 -0
  17. package/dist/es5/lib/classes/tile-3d-feature-table.js +97 -0
  18. package/dist/es5/lib/classes/tile-3d-feature-table.js.map +1 -0
  19. package/dist/es5/lib/constants.js +32 -0
  20. package/dist/es5/lib/constants.js.map +1 -0
  21. package/dist/es5/lib/encoders/encode-3d-tile-batched-model.js +49 -0
  22. package/dist/es5/lib/encoders/encode-3d-tile-batched-model.js.map +1 -0
  23. package/dist/es5/lib/encoders/encode-3d-tile-composite.js +30 -0
  24. package/dist/es5/lib/encoders/encode-3d-tile-composite.js.map +1 -0
  25. package/dist/es5/lib/encoders/encode-3d-tile-instanced-model.js +47 -0
  26. package/dist/es5/lib/encoders/encode-3d-tile-instanced-model.js.map +1 -0
  27. package/dist/es5/lib/encoders/encode-3d-tile-point-cloud.js +48 -0
  28. package/dist/es5/lib/encoders/encode-3d-tile-point-cloud.js.map +1 -0
  29. package/dist/es5/lib/encoders/encode-3d-tile.js +35 -0
  30. package/dist/es5/lib/encoders/encode-3d-tile.js.map +1 -0
  31. package/dist/es5/lib/encoders/helpers/encode-3d-tile-header.js +35 -0
  32. package/dist/es5/lib/encoders/helpers/encode-3d-tile-header.js.map +1 -0
  33. package/dist/es5/lib/ion/ion.js +170 -0
  34. package/dist/es5/lib/ion/ion.js.map +1 -0
  35. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-colors.js +64 -0
  36. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-colors.js.map +1 -0
  37. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-normals.js +32 -0
  38. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-normals.js.map +1 -0
  39. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-positions.js +32 -0
  40. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-positions.js.map +1 -0
  41. package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js +280 -0
  42. package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +1 -0
  43. package/dist/es5/lib/parsers/helpers/parse-3d-tile-gltf-view.js +96 -0
  44. package/dist/es5/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +1 -0
  45. package/dist/es5/lib/parsers/helpers/parse-3d-tile-header.js +22 -0
  46. package/dist/es5/lib/parsers/helpers/parse-3d-tile-header.js.map +1 -0
  47. package/dist/es5/lib/parsers/helpers/parse-3d-tile-subtree.js +145 -0
  48. package/dist/es5/lib/parsers/helpers/parse-3d-tile-subtree.js.map +1 -0
  49. package/dist/es5/lib/parsers/helpers/parse-3d-tile-tables.js +85 -0
  50. package/dist/es5/lib/parsers/helpers/parse-3d-tile-tables.js.map +1 -0
  51. package/dist/es5/lib/parsers/helpers/parse-utils.js +28 -0
  52. package/dist/es5/lib/parsers/helpers/parse-utils.js.map +1 -0
  53. package/dist/es5/lib/parsers/parse-3d-tile-batched-model.js +51 -0
  54. package/dist/es5/lib/parsers/parse-3d-tile-batched-model.js.map +1 -0
  55. package/dist/es5/lib/parsers/parse-3d-tile-composite.js +48 -0
  56. package/dist/es5/lib/parsers/parse-3d-tile-composite.js.map +1 -0
  57. package/dist/es5/lib/parsers/parse-3d-tile-gltf.js +35 -0
  58. package/dist/es5/lib/parsers/parse-3d-tile-gltf.js.map +1 -0
  59. package/dist/es5/lib/parsers/parse-3d-tile-header.js +271 -0
  60. package/dist/es5/lib/parsers/parse-3d-tile-header.js.map +1 -0
  61. package/dist/es5/lib/parsers/parse-3d-tile-instanced-model.js +172 -0
  62. package/dist/es5/lib/parsers/parse-3d-tile-instanced-model.js.map +1 -0
  63. package/dist/es5/lib/parsers/parse-3d-tile-point-cloud.js +271 -0
  64. package/dist/es5/lib/parsers/parse-3d-tile-point-cloud.js.map +1 -0
  65. package/dist/es5/lib/parsers/parse-3d-tile.js +74 -0
  66. package/dist/es5/lib/parsers/parse-3d-tile.js.map +1 -0
  67. package/dist/es5/lib/utils/obb/s2-corners-to-obb.js +30 -0
  68. package/dist/es5/lib/utils/obb/s2-corners-to-obb.js.map +1 -0
  69. package/dist/es5/lib/utils/s2/converters/s2-to-boundary.js +44 -0
  70. package/dist/es5/lib/utils/s2/converters/s2-to-boundary.js.map +1 -0
  71. package/dist/es5/lib/utils/s2/converters/s2-to-obb-points.js +30 -0
  72. package/dist/es5/lib/utils/s2/converters/s2-to-obb-points.js.map +1 -0
  73. package/dist/es5/lib/utils/s2/converters/s2-to-region.js +52 -0
  74. package/dist/es5/lib/utils/s2/converters/s2-to-region.js.map +1 -0
  75. package/dist/es5/lib/utils/s2/index.js +90 -0
  76. package/dist/es5/lib/utils/s2/index.js.map +1 -0
  77. package/dist/es5/lib/utils/s2/s2-geometry-functions.js +19 -0
  78. package/dist/es5/lib/utils/s2/s2-geometry-functions.js.map +1 -0
  79. package/dist/es5/lib/utils/s2/s2-token-functions.js +41 -0
  80. package/dist/es5/lib/utils/s2/s2-token-functions.js.map +1 -0
  81. package/dist/es5/lib/utils/s2/s2geometry/s2-cell-utils.js +22 -0
  82. package/dist/es5/lib/utils/s2/s2geometry/s2-cell-utils.js.map +1 -0
  83. package/dist/es5/lib/utils/s2/s2geometry/s2-geometry.js +207 -0
  84. package/dist/es5/lib/utils/s2/s2geometry/s2-geometry.js.map +1 -0
  85. package/dist/es5/lib/utils/version.js +9 -0
  86. package/dist/es5/lib/utils/version.js.map +1 -0
  87. package/dist/es5/tile-3d-subtree-loader.js +22 -0
  88. package/dist/es5/tile-3d-subtree-loader.js.map +1 -0
  89. package/dist/es5/tile-3d-writer.js +26 -0
  90. package/dist/es5/tile-3d-writer.js.map +1 -0
  91. package/dist/es5/tiles-3d-loader.js +134 -0
  92. package/dist/es5/tiles-3d-loader.js.map +1 -0
  93. package/dist/es5/types.js +2 -0
  94. package/dist/es5/types.js.map +1 -0
  95. package/dist/esm/bundle.js +4 -0
  96. package/dist/esm/bundle.js.map +1 -0
  97. package/dist/esm/cesium-ion-loader.js +36 -0
  98. package/dist/esm/cesium-ion-loader.js.map +1 -0
  99. package/dist/esm/index.js +9 -0
  100. package/dist/esm/index.js.map +1 -0
  101. package/dist/esm/lib/classes/helpers/tile-3d-accessor-utils.js +96 -0
  102. package/dist/esm/lib/classes/helpers/tile-3d-accessor-utils.js.map +1 -0
  103. package/dist/esm/lib/classes/tile-3d-batch-table-hierarchy.js +171 -0
  104. package/dist/esm/lib/classes/tile-3d-batch-table-hierarchy.js.map +1 -0
  105. package/dist/esm/lib/classes/tile-3d-batch-table.js +231 -0
  106. package/dist/esm/lib/classes/tile-3d-batch-table.js.map +1 -0
  107. package/dist/esm/lib/classes/tile-3d-feature-table.js +70 -0
  108. package/dist/esm/lib/classes/tile-3d-feature-table.js.map +1 -0
  109. package/dist/esm/lib/constants.js +22 -0
  110. package/dist/esm/lib/constants.js.map +1 -0
  111. package/dist/esm/lib/encoders/encode-3d-tile-batched-model.js +40 -0
  112. package/dist/esm/lib/encoders/encode-3d-tile-batched-model.js.map +1 -0
  113. package/dist/esm/lib/encoders/encode-3d-tile-composite.js +21 -0
  114. package/dist/esm/lib/encoders/encode-3d-tile-composite.js.map +1 -0
  115. package/dist/esm/lib/encoders/encode-3d-tile-instanced-model.js +36 -0
  116. package/dist/esm/lib/encoders/encode-3d-tile-instanced-model.js.map +1 -0
  117. package/dist/esm/lib/encoders/encode-3d-tile-point-cloud.js +39 -0
  118. package/dist/esm/lib/encoders/encode-3d-tile-point-cloud.js.map +1 -0
  119. package/dist/esm/lib/encoders/encode-3d-tile.js +29 -0
  120. package/dist/esm/lib/encoders/encode-3d-tile.js.map +1 -0
  121. package/dist/esm/lib/encoders/helpers/encode-3d-tile-header.js +28 -0
  122. package/dist/esm/lib/encoders/helpers/encode-3d-tile-header.js.map +1 -0
  123. package/dist/esm/lib/ion/ion.js +70 -0
  124. package/dist/esm/lib/ion/ion.js.map +1 -0
  125. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-colors.js +58 -0
  126. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-colors.js.map +1 -0
  127. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-normals.js +26 -0
  128. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-normals.js.map +1 -0
  129. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-positions.js +26 -0
  130. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-positions.js.map +1 -0
  131. package/dist/esm/lib/parsers/helpers/parse-3d-implicit-tiles.js +241 -0
  132. package/dist/esm/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +1 -0
  133. package/dist/esm/lib/parsers/helpers/parse-3d-tile-gltf-view.js +59 -0
  134. package/dist/esm/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +1 -0
  135. package/dist/esm/lib/parsers/helpers/parse-3d-tile-header.js +16 -0
  136. package/dist/esm/lib/parsers/helpers/parse-3d-tile-header.js.map +1 -0
  137. package/dist/esm/lib/parsers/helpers/parse-3d-tile-subtree.js +67 -0
  138. package/dist/esm/lib/parsers/helpers/parse-3d-tile-subtree.js.map +1 -0
  139. package/dist/esm/lib/parsers/helpers/parse-3d-tile-tables.js +80 -0
  140. package/dist/esm/lib/parsers/helpers/parse-3d-tile-tables.js.map +1 -0
  141. package/dist/esm/lib/parsers/helpers/parse-utils.js +20 -0
  142. package/dist/esm/lib/parsers/helpers/parse-utils.js.map +1 -0
  143. package/dist/esm/lib/parsers/parse-3d-tile-batched-model.js +25 -0
  144. package/dist/esm/lib/parsers/parse-3d-tile-batched-model.js.map +1 -0
  145. package/dist/esm/lib/parsers/parse-3d-tile-composite.js +15 -0
  146. package/dist/esm/lib/parsers/parse-3d-tile-composite.js.map +1 -0
  147. package/dist/esm/lib/parsers/parse-3d-tile-gltf.js +10 -0
  148. package/dist/esm/lib/parsers/parse-3d-tile-gltf.js.map +1 -0
  149. package/dist/esm/lib/parsers/parse-3d-tile-header.js +164 -0
  150. package/dist/esm/lib/parsers/parse-3d-tile-header.js.map +1 -0
  151. package/dist/esm/lib/parsers/parse-3d-tile-instanced-model.js +147 -0
  152. package/dist/{lib → esm/lib}/parsers/parse-3d-tile-instanced-model.js.map +1 -1
  153. package/dist/esm/lib/parsers/parse-3d-tile-point-cloud.js +211 -0
  154. package/dist/esm/lib/parsers/parse-3d-tile-point-cloud.js.map +1 -0
  155. package/dist/esm/lib/parsers/parse-3d-tile.js +30 -0
  156. package/dist/esm/lib/parsers/parse-3d-tile.js.map +1 -0
  157. package/dist/esm/lib/utils/obb/s2-corners-to-obb.js +23 -0
  158. package/dist/esm/lib/utils/obb/s2-corners-to-obb.js.map +1 -0
  159. package/dist/esm/lib/utils/s2/converters/s2-to-boundary.js +40 -0
  160. package/dist/esm/lib/utils/s2/converters/s2-to-boundary.js.map +1 -0
  161. package/dist/esm/lib/utils/s2/converters/s2-to-obb-points.js +24 -0
  162. package/dist/esm/lib/utils/s2/converters/s2-to-obb-points.js.map +1 -0
  163. package/dist/esm/lib/utils/s2/converters/s2-to-region.js +42 -0
  164. package/dist/esm/lib/utils/s2/converters/s2-to-region.js.map +1 -0
  165. package/dist/esm/lib/utils/s2/index.js +7 -0
  166. package/dist/esm/lib/utils/s2/index.js.map +1 -0
  167. package/dist/esm/lib/utils/s2/s2-geometry-functions.js +12 -0
  168. package/dist/esm/lib/utils/s2/s2-geometry-functions.js.map +1 -0
  169. package/dist/esm/lib/utils/s2/s2-token-functions.js +32 -0
  170. package/dist/esm/lib/utils/s2/s2-token-functions.js.map +1 -0
  171. package/dist/esm/lib/utils/s2/s2geometry/s2-cell-utils.js +15 -0
  172. package/dist/esm/lib/utils/s2/s2geometry/s2-cell-utils.js.map +1 -0
  173. package/dist/esm/lib/utils/s2/s2geometry/s2-geometry.js +186 -0
  174. package/dist/esm/lib/utils/s2/s2geometry/s2-geometry.js.map +1 -0
  175. package/dist/esm/lib/utils/version.js +2 -0
  176. package/dist/esm/lib/utils/version.js.map +1 -0
  177. package/dist/esm/tile-3d-subtree-loader.js +14 -0
  178. package/dist/esm/tile-3d-subtree-loader.js.map +1 -0
  179. package/dist/esm/tile-3d-writer.js +19 -0
  180. package/dist/esm/tile-3d-writer.js.map +1 -0
  181. package/dist/esm/tiles-3d-loader.js +64 -0
  182. package/dist/esm/tiles-3d-loader.js.map +1 -0
  183. package/dist/esm/types.js +2 -0
  184. package/dist/esm/types.js.map +1 -0
  185. package/dist/index.d.ts +1 -1
  186. package/dist/index.d.ts.map +1 -1
  187. package/dist/index.js +26 -9
  188. package/dist/lib/classes/helpers/tile-3d-accessor-utils.d.ts +1 -1
  189. package/dist/lib/classes/helpers/tile-3d-accessor-utils.js +106 -89
  190. package/dist/lib/classes/tile-3d-batch-table-hierarchy.js +184 -202
  191. package/dist/lib/classes/tile-3d-batch-table.d.ts +1 -1
  192. package/dist/lib/classes/tile-3d-batch-table.js +223 -282
  193. package/dist/lib/classes/tile-3d-feature-table.js +64 -86
  194. package/dist/lib/constants.js +23 -19
  195. package/dist/lib/encoders/encode-3d-tile-batched-model.js +45 -45
  196. package/dist/lib/encoders/encode-3d-tile-composite.js +23 -24
  197. package/dist/lib/encoders/encode-3d-tile-instanced-model.js +37 -37
  198. package/dist/lib/encoders/encode-3d-tile-point-cloud.js +36 -38
  199. package/dist/lib/encoders/encode-3d-tile.js +30 -32
  200. package/dist/lib/encoders/helpers/encode-3d-tile-header.js +28 -29
  201. package/dist/lib/ion/ion.js +60 -69
  202. package/dist/lib/parsers/helpers/normalize-3d-tile-colors.js +60 -62
  203. package/dist/lib/parsers/helpers/normalize-3d-tile-normals.js +26 -26
  204. package/dist/lib/parsers/helpers/normalize-3d-tile-positions.js +39 -28
  205. package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts +11 -0
  206. package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts.map +1 -1
  207. package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.js +247 -203
  208. package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.js +82 -63
  209. package/dist/lib/parsers/helpers/parse-3d-tile-header.js +26 -15
  210. package/dist/lib/parsers/helpers/parse-3d-tile-subtree.d.ts +2 -1
  211. package/dist/lib/parsers/helpers/parse-3d-tile-subtree.d.ts.map +1 -1
  212. package/dist/lib/parsers/helpers/parse-3d-tile-subtree.js +98 -58
  213. package/dist/lib/parsers/helpers/parse-3d-tile-tables.js +84 -80
  214. package/dist/lib/parsers/helpers/parse-utils.js +29 -16
  215. package/dist/lib/parsers/parse-3d-tile-batched-model.js +30 -26
  216. package/dist/lib/parsers/parse-3d-tile-composite.js +25 -16
  217. package/dist/lib/parsers/parse-3d-tile-gltf.d.ts +1 -1
  218. package/dist/lib/parsers/parse-3d-tile-gltf.d.ts.map +1 -1
  219. package/dist/lib/parsers/parse-3d-tile-gltf.js +17 -9
  220. package/dist/lib/parsers/parse-3d-tile-header.d.ts +5 -4
  221. package/dist/lib/parsers/parse-3d-tile-header.d.ts.map +1 -1
  222. package/dist/lib/parsers/parse-3d-tile-header.js +166 -138
  223. package/dist/lib/parsers/parse-3d-tile-instanced-model.js +179 -170
  224. package/dist/lib/parsers/parse-3d-tile-point-cloud.js +350 -184
  225. package/dist/lib/parsers/parse-3d-tile.js +36 -31
  226. package/dist/lib/utils/obb/s2-corners-to-obb.d.ts +15 -0
  227. package/dist/lib/utils/obb/s2-corners-to-obb.d.ts.map +1 -0
  228. package/dist/lib/utils/obb/s2-corners-to-obb.js +37 -0
  229. package/dist/lib/utils/s2/converters/s2-to-boundary.d.ts +9 -0
  230. package/dist/lib/utils/s2/converters/s2-to-boundary.d.ts.map +1 -0
  231. package/dist/lib/utils/s2/converters/s2-to-boundary.js +61 -0
  232. package/dist/lib/utils/s2/converters/s2-to-obb-points.d.ts +15 -0
  233. package/dist/lib/utils/s2/converters/s2-to-obb-points.d.ts.map +1 -0
  234. package/dist/lib/utils/s2/converters/s2-to-obb-points.js +36 -0
  235. package/dist/lib/utils/s2/converters/s2-to-region.d.ts +13 -0
  236. package/dist/lib/utils/s2/converters/s2-to-region.d.ts.map +1 -0
  237. package/dist/lib/utils/s2/converters/s2-to-region.js +59 -0
  238. package/dist/lib/utils/s2/index.d.ts +8 -0
  239. package/dist/lib/utils/s2/index.d.ts.map +1 -0
  240. package/dist/lib/utils/s2/index.js +23 -0
  241. package/dist/lib/utils/s2/s2-geometry-functions.d.ts +14 -0
  242. package/dist/lib/utils/s2/s2-geometry-functions.d.ts.map +1 -0
  243. package/dist/lib/utils/s2/s2-geometry-functions.js +29 -0
  244. package/dist/lib/utils/s2/s2-token-functions.d.ts +23 -0
  245. package/dist/lib/utils/s2/s2-token-functions.d.ts.map +1 -0
  246. package/dist/lib/utils/s2/s2-token-functions.js +68 -0
  247. package/dist/lib/utils/s2/s2geometry/s2-cell-utils.d.ts +14 -0
  248. package/dist/lib/utils/s2/s2geometry/s2-cell-utils.d.ts.map +1 -0
  249. package/dist/lib/utils/s2/s2geometry/s2-cell-utils.js +32 -0
  250. package/dist/lib/utils/s2/s2geometry/s2-geometry.d.ts +52 -0
  251. package/dist/lib/utils/s2/s2geometry/s2-geometry.d.ts.map +1 -0
  252. package/dist/lib/utils/s2/s2geometry/s2-geometry.js +260 -0
  253. package/dist/lib/utils/version.js +7 -2
  254. package/dist/tile-3d-subtree-loader.js +22 -13
  255. package/dist/tile-3d-writer.js +24 -17
  256. package/dist/tiles-3d-loader.d.ts.map +1 -1
  257. package/dist/tiles-3d-loader.js +63 -69
  258. package/dist/types.d.ts +28 -15
  259. package/dist/types.d.ts.map +1 -1
  260. package/dist/types.js +2 -2
  261. package/package.json +12 -11
  262. package/src/cesium-ion-loader.ts +1 -0
  263. package/src/index.ts +1 -1
  264. package/src/lib/parsers/helpers/parse-3d-implicit-tiles.ts +104 -27
  265. package/src/lib/parsers/helpers/parse-3d-tile-subtree.ts +50 -7
  266. package/src/lib/parsers/parse-3d-tile-header.ts +91 -23
  267. package/src/lib/utils/obb/s2-corners-to-obb.ts +51 -0
  268. package/src/lib/utils/s2/converters/s2-to-boundary.ts +67 -0
  269. package/src/lib/utils/s2/converters/s2-to-obb-points.ts +46 -0
  270. package/src/lib/utils/s2/converters/s2-to-region.ts +69 -0
  271. package/src/lib/utils/s2/index.ts +17 -0
  272. package/src/lib/utils/s2/s2-geometry-functions.ts +28 -0
  273. package/src/lib/utils/s2/s2-token-functions.ts +67 -0
  274. package/src/lib/utils/s2/s2geometry/s2-cell-utils.ts +33 -0
  275. package/src/lib/utils/s2/s2geometry/s2-geometry.ts +296 -0
  276. package/src/tiles-3d-loader.ts +2 -16
  277. package/src/types.ts +20 -5
  278. package/dist/bundle.js.map +0 -1
  279. package/dist/cesium-ion-loader.js.map +0 -1
  280. package/dist/index.js.map +0 -1
  281. package/dist/lib/classes/helpers/tile-3d-accessor-utils.js.map +0 -1
  282. package/dist/lib/classes/tile-3d-batch-table-hierarchy.js.map +0 -1
  283. package/dist/lib/classes/tile-3d-batch-table.js.map +0 -1
  284. package/dist/lib/classes/tile-3d-feature-table.js.map +0 -1
  285. package/dist/lib/constants.js.map +0 -1
  286. package/dist/lib/encoders/encode-3d-tile-batched-model.js.map +0 -1
  287. package/dist/lib/encoders/encode-3d-tile-composite.js.map +0 -1
  288. package/dist/lib/encoders/encode-3d-tile-instanced-model.js.map +0 -1
  289. package/dist/lib/encoders/encode-3d-tile-point-cloud.js.map +0 -1
  290. package/dist/lib/encoders/encode-3d-tile.js.map +0 -1
  291. package/dist/lib/encoders/helpers/encode-3d-tile-header.js.map +0 -1
  292. package/dist/lib/ion/ion.js.map +0 -1
  293. package/dist/lib/parsers/helpers/normalize-3d-tile-colors.js.map +0 -1
  294. package/dist/lib/parsers/helpers/normalize-3d-tile-normals.js.map +0 -1
  295. package/dist/lib/parsers/helpers/normalize-3d-tile-positions.js.map +0 -1
  296. package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +0 -1
  297. package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +0 -1
  298. package/dist/lib/parsers/helpers/parse-3d-tile-header.js.map +0 -1
  299. package/dist/lib/parsers/helpers/parse-3d-tile-subtree.js.map +0 -1
  300. package/dist/lib/parsers/helpers/parse-3d-tile-tables.js.map +0 -1
  301. package/dist/lib/parsers/helpers/parse-utils.js.map +0 -1
  302. package/dist/lib/parsers/parse-3d-tile-batched-model.js.map +0 -1
  303. package/dist/lib/parsers/parse-3d-tile-composite.js.map +0 -1
  304. package/dist/lib/parsers/parse-3d-tile-gltf.js.map +0 -1
  305. package/dist/lib/parsers/parse-3d-tile-header.js.map +0 -1
  306. package/dist/lib/parsers/parse-3d-tile-point-cloud.js.map +0 -1
  307. package/dist/lib/parsers/parse-3d-tile.js.map +0 -1
  308. package/dist/lib/utils/version.js.map +0 -1
  309. package/dist/tile-3d-subtree-loader.js.map +0 -1
  310. package/dist/tile-3d-writer.js.map +0 -1
  311. package/dist/tiles-3d-loader.js.map +0 -1
  312. package/dist/types.js.map +0 -1
  313. /package/src/lib/parsers/{parse-3d-tile-gltf.js → parse-3d-tile-gltf.ts} +0 -0
@@ -1,32 +1,37 @@
1
- import { TILE3D_TYPE } from '../constants';
2
- import { getMagicString } from './helpers/parse-utils';
3
- import { parsePointCloud3DTile } from './parse-3d-tile-point-cloud';
4
- import { parseBatchedModel3DTile } from './parse-3d-tile-batched-model';
5
- import { parseInstancedModel3DTile } from './parse-3d-tile-instanced-model';
6
- import { parseComposite3DTile } from './parse-3d-tile-composite';
7
- import { parseGltf3DTile } from './parse-3d-tile-gltf';
8
- export async function parse3DTile(arrayBuffer, byteOffset = 0, options, context, tile = {}) {
9
- tile.byteOffset = byteOffset;
10
- tile.type = getMagicString(arrayBuffer, byteOffset);
11
-
12
- switch (tile.type) {
13
- case TILE3D_TYPE.COMPOSITE:
14
- return await parseComposite3DTile(tile, arrayBuffer, byteOffset, options, context, parse3DTile);
15
-
16
- case TILE3D_TYPE.BATCHED_3D_MODEL:
17
- return await parseBatchedModel3DTile(tile, arrayBuffer, byteOffset, options, context);
18
-
19
- case TILE3D_TYPE.GLTF:
20
- return await parseGltf3DTile(tile, arrayBuffer, options, context);
21
-
22
- case TILE3D_TYPE.INSTANCED_3D_MODEL:
23
- return await parseInstancedModel3DTile(tile, arrayBuffer, byteOffset, options, context);
24
-
25
- case TILE3D_TYPE.POINT_CLOUD:
26
- return await parsePointCloud3DTile(tile, arrayBuffer, byteOffset, options, context);
27
-
28
- default:
29
- throw new Error("3DTileLoader: unknown type ".concat(tile.type));
30
- }
1
+ "use strict";
2
+ // This file is derived from the Cesium code base under Apache 2 license
3
+ // See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.parse3DTile = void 0;
6
+ const constants_1 = require("../constants");
7
+ const parse_utils_1 = require("./helpers/parse-utils");
8
+ const parse_3d_tile_point_cloud_1 = require("./parse-3d-tile-point-cloud");
9
+ const parse_3d_tile_batched_model_1 = require("./parse-3d-tile-batched-model");
10
+ const parse_3d_tile_instanced_model_1 = require("./parse-3d-tile-instanced-model");
11
+ const parse_3d_tile_composite_1 = require("./parse-3d-tile-composite");
12
+ const parse_3d_tile_gltf_1 = require("./parse-3d-tile-gltf");
13
+ // Extracts
14
+ async function parse3DTile(arrayBuffer, byteOffset = 0, options, context, tile = {}) {
15
+ // @ts-expect-error
16
+ tile.byteOffset = byteOffset;
17
+ // @ts-expect-error
18
+ tile.type = (0, parse_utils_1.getMagicString)(arrayBuffer, byteOffset);
19
+ // @ts-expect-error
20
+ switch (tile.type) {
21
+ case constants_1.TILE3D_TYPE.COMPOSITE:
22
+ // Note: We pass this function as argument so that embedded tiles can be parsed recursively
23
+ return await (0, parse_3d_tile_composite_1.parseComposite3DTile)(tile, arrayBuffer, byteOffset, options, context, parse3DTile);
24
+ case constants_1.TILE3D_TYPE.BATCHED_3D_MODEL:
25
+ return await (0, parse_3d_tile_batched_model_1.parseBatchedModel3DTile)(tile, arrayBuffer, byteOffset, options, context);
26
+ case constants_1.TILE3D_TYPE.GLTF:
27
+ return await (0, parse_3d_tile_gltf_1.parseGltf3DTile)(tile, arrayBuffer, options, context);
28
+ case constants_1.TILE3D_TYPE.INSTANCED_3D_MODEL:
29
+ return await (0, parse_3d_tile_instanced_model_1.parseInstancedModel3DTile)(tile, arrayBuffer, byteOffset, options, context);
30
+ case constants_1.TILE3D_TYPE.POINT_CLOUD:
31
+ return await (0, parse_3d_tile_point_cloud_1.parsePointCloud3DTile)(tile, arrayBuffer, byteOffset, options, context);
32
+ default:
33
+ // @ts-expect-error
34
+ throw new Error(`3DTileLoader: unknown type ${tile.type}`); // eslint-disable-line
35
+ }
31
36
  }
32
- //# sourceMappingURL=parse-3d-tile.js.map
37
+ exports.parse3DTile = parse3DTile;
@@ -0,0 +1,15 @@
1
+ export type S2VolumeInfo = {
2
+ /** S2 key or token */
3
+ token: string;
4
+ /** minimum height in meters */
5
+ minimumHeight: number;
6
+ /** maximum height in meters */
7
+ maximumHeight: number;
8
+ };
9
+ /**
10
+ * Converts S2VolumeInfo to OrientedBoundingBox
11
+ * @param {S2VolumeInfo} s2VolumeInfo - s2 volume to convert
12
+ * @returns Oriented Bounding Box of type Box
13
+ */
14
+ export declare function convertS2BoundingVolumetoOBB(s2VolumeInfo: S2VolumeInfo): number[];
15
+ //# sourceMappingURL=s2-corners-to-obb.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s2-corners-to-obb.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/obb/s2-corners-to-obb.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,YAAY,GAAG;IACzB,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,+BAA+B;IAC/B,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,YAAY,GAAG,MAAM,EAAE,CA2BjF"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertS2BoundingVolumetoOBB = void 0;
4
+ const core_1 = require("@math.gl/core");
5
+ const culling_1 = require("@math.gl/culling");
6
+ const index_1 = require("../../utils/s2/index");
7
+ const index_2 = require("../../utils/s2/index");
8
+ const geospatial_1 = require("@math.gl/geospatial");
9
+ /**
10
+ * Converts S2VolumeInfo to OrientedBoundingBox
11
+ * @param {S2VolumeInfo} s2VolumeInfo - s2 volume to convert
12
+ * @returns Oriented Bounding Box of type Box
13
+ */
14
+ function convertS2BoundingVolumetoOBB(s2VolumeInfo) {
15
+ const token = s2VolumeInfo.token;
16
+ const heightInfo = {
17
+ minimumHeight: s2VolumeInfo.minimumHeight,
18
+ maximumHeight: s2VolumeInfo.maximumHeight
19
+ };
20
+ const corners = (0, index_1.getS2OrientedBoundingBoxCornerPoints)(token, heightInfo);
21
+ // Add a point that doesn't allow the box dive under the Earth
22
+ const center = (0, index_2.getS2LngLat)(token);
23
+ const centerLng = center[0];
24
+ const centerLat = center[1];
25
+ const point = geospatial_1.Ellipsoid.WGS84.cartographicToCartesian([
26
+ centerLng,
27
+ centerLat,
28
+ heightInfo.maximumHeight
29
+ ]);
30
+ const centerPointAdditional = new core_1.Vector3(point[0], point[1], point[2]);
31
+ corners.push(centerPointAdditional);
32
+ // corners should be an array of Vector3 (XYZ)
33
+ const obb = (0, culling_1.makeOrientedBoundingBoxFromPoints)(corners);
34
+ const box = [...obb.center, ...obb.halfAxes];
35
+ return box;
36
+ }
37
+ exports.convertS2BoundingVolumetoOBB = convertS2BoundingVolumetoOBB;
@@ -0,0 +1,9 @@
1
+ import type { S2Cell } from '../s2geometry/s2-geometry';
2
+ /**
3
+ * Get a polygon with corner coordinates for an S2 cell
4
+ * @param s2cell {S2Cell} S2 cell
5
+ * @return {Float64Array} - a simple polygon in flat array format: [lng0, lat0, lng1, lat1, ...]
6
+ * - the polygon is closed, i.e. last coordinate is a copy of the first coordinate
7
+ */
8
+ export declare function getS2BoundaryFlatFromS2Cell(s2cell: S2Cell): Float64Array;
9
+ //# sourceMappingURL=s2-to-boundary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s2-to-boundary.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/s2/converters/s2-to-boundary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,2BAA2B,CAAC;AAKtD;;;;;GAKG;AAEH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAsDxE"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getS2BoundaryFlatFromS2Cell = void 0;
4
+ const s2_geometry_1 = require("../s2geometry/s2-geometry");
5
+ const MAX_RESOLUTION = 100;
6
+ /**
7
+ * Get a polygon with corner coordinates for an S2 cell
8
+ * @param s2cell {S2Cell} S2 cell
9
+ * @return {Float64Array} - a simple polygon in flat array format: [lng0, lat0, lng1, lat1, ...]
10
+ * - the polygon is closed, i.e. last coordinate is a copy of the first coordinate
11
+ */
12
+ // eslint-disable-next-line max-statements
13
+ function getS2BoundaryFlatFromS2Cell(s2cell) {
14
+ const { face, ij, level } = s2cell;
15
+ const offsets = [
16
+ [0, 0],
17
+ [0, 1],
18
+ [1, 1],
19
+ [1, 0],
20
+ [0, 0]
21
+ ];
22
+ // The S2 cell edge is curved: http://s2geometry.io/
23
+ // This is more prominent at lower levels
24
+ // resolution is the number of segments to generate per edge.
25
+ // We exponentially reduce resolution as level increases so it doesn't affect perf
26
+ // when there are a large number of cells
27
+ const resolution = Math.max(1, Math.ceil(MAX_RESOLUTION * Math.pow(2, -level)));
28
+ const result = new Float64Array(4 * resolution * 2 + 2);
29
+ let ptIndex = 0;
30
+ let prevLng = 0;
31
+ for (let i = 0; i < 4; i++) {
32
+ const offset = offsets[i].slice(0);
33
+ const nextOffset = offsets[i + 1];
34
+ const stepI = (nextOffset[0] - offset[0]) / resolution;
35
+ const stepJ = (nextOffset[1] - offset[1]) / resolution;
36
+ for (let j = 0; j < resolution; j++) {
37
+ offset[0] += stepI;
38
+ offset[1] += stepJ;
39
+ // Cell can be represented by coordinates IJ, ST, UV, XYZ
40
+ // http://s2geometry.io/devguide/s2cell_hierarchy#coordinate-systems
41
+ const st = (0, s2_geometry_1.IJToST)(ij, level, offset);
42
+ const uv = (0, s2_geometry_1.STToUV)(st);
43
+ const xyz = (0, s2_geometry_1.FaceUVToXYZ)(face, uv);
44
+ const lngLat = (0, s2_geometry_1.XYZToLngLat)(xyz);
45
+ // Adjust longitude for Web Mercator projection
46
+ if (Math.abs(lngLat[1]) > 89.999) {
47
+ lngLat[0] = prevLng;
48
+ }
49
+ const deltaLng = lngLat[0] - prevLng;
50
+ lngLat[0] += deltaLng > 180 ? -360 : deltaLng < -180 ? 360 : 0;
51
+ result[ptIndex++] = lngLat[0];
52
+ result[ptIndex++] = lngLat[1];
53
+ prevLng = lngLat[0];
54
+ }
55
+ }
56
+ // close the loop
57
+ result[ptIndex++] = result[0];
58
+ result[ptIndex++] = result[1];
59
+ return result;
60
+ }
61
+ exports.getS2BoundaryFlatFromS2Cell = getS2BoundaryFlatFromS2Cell;
@@ -0,0 +1,15 @@
1
+ import { Vector3 } from '@math.gl/core';
2
+ export type S2HeightInfo = {
3
+ minimumHeight: number;
4
+ maximumHeight: number;
5
+ };
6
+ /**
7
+ * Converts S2HeightInfo to corner points of an oriented bounding box
8
+ * Can be used to constuct an OrientedBoundingBox instance
9
+ * @param tokenOrKey {string} A string that is the cell's hex token or the Hilbert quad key (containing /)
10
+ * @param heightInfo {S2HeightInfo} min and max height of the box
11
+ * @returns corner points of the oriented bounding box
12
+ */
13
+ export declare function getS2OrientedBoundingBoxCornerPoints(tokenOrKey: string, // This can be an S2 key or token
14
+ heightInfo?: S2HeightInfo): Vector3[];
15
+ //# sourceMappingURL=s2-to-obb-points.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s2-to-obb-points.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/s2/converters/s2-to-obb-points.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AAEtC,MAAM,MAAM,YAAY,GAAG;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,oCAAoC,CAClD,UAAU,EAAE,MAAM,EAAE,iCAAiC;AACrD,UAAU,CAAC,EAAE,YAAY,GACxB,OAAO,EAAE,CA0BX"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getS2OrientedBoundingBoxCornerPoints = void 0;
4
+ const s2_cell_utils_1 = require("../s2geometry/s2-cell-utils");
5
+ const s2_to_region_1 = require("./s2-to-region");
6
+ const core_1 = require("@math.gl/core");
7
+ /**
8
+ * Converts S2HeightInfo to corner points of an oriented bounding box
9
+ * Can be used to constuct an OrientedBoundingBox instance
10
+ * @param tokenOrKey {string} A string that is the cell's hex token or the Hilbert quad key (containing /)
11
+ * @param heightInfo {S2HeightInfo} min and max height of the box
12
+ * @returns corner points of the oriented bounding box
13
+ */
14
+ function getS2OrientedBoundingBoxCornerPoints(tokenOrKey, // This can be an S2 key or token
15
+ heightInfo) {
16
+ const min = heightInfo?.minimumHeight || 0;
17
+ const max = heightInfo?.maximumHeight || 0;
18
+ const s2cell = (0, s2_cell_utils_1.getS2Cell)(tokenOrKey);
19
+ const region = (0, s2_to_region_1.getS2Region)(s2cell);
20
+ // region lng/lat are in degrees
21
+ const W = region.west;
22
+ const S = region.south;
23
+ const E = region.east;
24
+ const N = region.north;
25
+ const points = [];
26
+ points.push(new core_1.Vector3(W, N, min));
27
+ points.push(new core_1.Vector3(E, N, min));
28
+ points.push(new core_1.Vector3(E, S, min));
29
+ points.push(new core_1.Vector3(W, S, min));
30
+ points.push(new core_1.Vector3(W, N, max));
31
+ points.push(new core_1.Vector3(E, N, max));
32
+ points.push(new core_1.Vector3(E, S, max));
33
+ points.push(new core_1.Vector3(W, S, max));
34
+ return points;
35
+ }
36
+ exports.getS2OrientedBoundingBoxCornerPoints = getS2OrientedBoundingBoxCornerPoints;
@@ -0,0 +1,13 @@
1
+ import type { S2Cell } from '../s2geometry/s2-geometry';
2
+ /**
3
+ * Converts S2 cell to the 2D region
4
+ * @param s2cell {S2Cell} S2 cell to convert to 2D region
5
+ * @returns 2D region as an object containing: west, north, east, south in degrees
6
+ */
7
+ export declare function getS2Region(s2cell: S2Cell): {
8
+ west: number;
9
+ east: number;
10
+ north: number;
11
+ south: number;
12
+ };
13
+ //# sourceMappingURL=s2-to-region.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s2-to-region.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/s2/converters/s2-to-region.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,2BAA2B,CAAC;AAItD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAqBA"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getS2Region = void 0;
4
+ const s2_to_boundary_1 = require("./s2-to-boundary");
5
+ const s2_cell_utils_1 = require("../s2geometry/s2-cell-utils");
6
+ /**
7
+ * Converts S2 cell to the 2D region
8
+ * @param s2cell {S2Cell} S2 cell to convert to 2D region
9
+ * @returns 2D region as an object containing: west, north, east, south in degrees
10
+ */
11
+ function getS2Region(s2cell) {
12
+ let region;
13
+ if (s2cell.face === 2 || s2cell.face === 5) {
14
+ // let corners: Float64Array;
15
+ let corners = null;
16
+ let len = 0;
17
+ for (let i = 0; i < 4; i++) {
18
+ const key = `${s2cell.face}/${i}`;
19
+ const cell = (0, s2_cell_utils_1.getS2Cell)(key);
20
+ const corns = (0, s2_to_boundary_1.getS2BoundaryFlatFromS2Cell)(cell);
21
+ if (typeof corners === 'undefined' || corners === null)
22
+ corners = new Float64Array(4 * corns.length);
23
+ corners.set(corns, len);
24
+ len += corns.length;
25
+ }
26
+ region = get2DRegionFromS2Corners(corners);
27
+ }
28
+ else {
29
+ const corners = (0, s2_to_boundary_1.getS2BoundaryFlatFromS2Cell)(s2cell);
30
+ region = get2DRegionFromS2Corners(corners);
31
+ }
32
+ return region;
33
+ }
34
+ exports.getS2Region = getS2Region;
35
+ /**
36
+ * Converts the S2 cell defined by its corners to the 2D region
37
+ * @param corners {Float64Array} - a simple polygon in flat array format: [lng0, lat0, lng1, lat1, ...]
38
+ * @returns 2D region as an object containing: west, north, east, south in degrees
39
+ */
40
+ function get2DRegionFromS2Corners(corners) {
41
+ if (corners.length % 2 !== 0) {
42
+ throw new Error('Invalid corners');
43
+ }
44
+ const longitudes = [];
45
+ const latitudes = [];
46
+ for (let i = 0; i < corners.length; i += 2) {
47
+ longitudes.push(corners[i]);
48
+ latitudes.push(corners[i + 1]);
49
+ }
50
+ longitudes.sort((a, b) => a - b);
51
+ latitudes.sort((a, b) => a - b);
52
+ // Return the region in degrees
53
+ return {
54
+ west: longitudes[0],
55
+ east: longitudes[longitudes.length - 1],
56
+ north: latitudes[latitudes.length - 1],
57
+ south: latitudes[0]
58
+ };
59
+ }
@@ -0,0 +1,8 @@
1
+ export { getS2CellIdFromToken, getS2TokenFromCellId, getS2ChildCellId } from './s2-token-functions';
2
+ export { getS2BoundaryFlat, getS2LngLat } from './s2-geometry-functions';
3
+ export { getS2Cell, getS2QuadKey } from './s2geometry/s2-cell-utils';
4
+ export { getS2QuadkeyFromCellId, getS2CellFromQuadKey, getS2CellIdFromQuadkey, getS2LngLatFromS2Cell } from './s2geometry/s2-geometry';
5
+ export { getS2Region } from './converters/s2-to-region';
6
+ export type { S2HeightInfo } from './converters/s2-to-obb-points';
7
+ export { getS2OrientedBoundingBoxCornerPoints } from './converters/s2-to-obb-points';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/s2/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,oBAAoB,EAAE,oBAAoB,EAAE,gBAAgB,EAAC,MAAM,sBAAsB,CAAC;AAClG,OAAO,EAAC,iBAAiB,EAAE,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAEvE,OAAO,EAAC,SAAS,EAAE,YAAY,EAAC,MAAM,4BAA4B,CAAC;AACnE,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAC;AAEtD,YAAY,EAAC,YAAY,EAAC,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAC,oCAAoC,EAAC,MAAM,+BAA+B,CAAC"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ // math.gl MIT license
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.getS2OrientedBoundingBoxCornerPoints = exports.getS2Region = exports.getS2LngLatFromS2Cell = exports.getS2CellIdFromQuadkey = exports.getS2CellFromQuadKey = exports.getS2QuadkeyFromCellId = exports.getS2QuadKey = exports.getS2Cell = exports.getS2LngLat = exports.getS2BoundaryFlat = exports.getS2ChildCellId = exports.getS2TokenFromCellId = exports.getS2CellIdFromToken = void 0;
5
+ var s2_token_functions_1 = require("./s2-token-functions");
6
+ Object.defineProperty(exports, "getS2CellIdFromToken", { enumerable: true, get: function () { return s2_token_functions_1.getS2CellIdFromToken; } });
7
+ Object.defineProperty(exports, "getS2TokenFromCellId", { enumerable: true, get: function () { return s2_token_functions_1.getS2TokenFromCellId; } });
8
+ Object.defineProperty(exports, "getS2ChildCellId", { enumerable: true, get: function () { return s2_token_functions_1.getS2ChildCellId; } });
9
+ var s2_geometry_functions_1 = require("./s2-geometry-functions");
10
+ Object.defineProperty(exports, "getS2BoundaryFlat", { enumerable: true, get: function () { return s2_geometry_functions_1.getS2BoundaryFlat; } });
11
+ Object.defineProperty(exports, "getS2LngLat", { enumerable: true, get: function () { return s2_geometry_functions_1.getS2LngLat; } });
12
+ var s2_cell_utils_1 = require("./s2geometry/s2-cell-utils");
13
+ Object.defineProperty(exports, "getS2Cell", { enumerable: true, get: function () { return s2_cell_utils_1.getS2Cell; } });
14
+ Object.defineProperty(exports, "getS2QuadKey", { enumerable: true, get: function () { return s2_cell_utils_1.getS2QuadKey; } });
15
+ var s2_geometry_1 = require("./s2geometry/s2-geometry");
16
+ Object.defineProperty(exports, "getS2QuadkeyFromCellId", { enumerable: true, get: function () { return s2_geometry_1.getS2QuadkeyFromCellId; } });
17
+ Object.defineProperty(exports, "getS2CellFromQuadKey", { enumerable: true, get: function () { return s2_geometry_1.getS2CellFromQuadKey; } });
18
+ Object.defineProperty(exports, "getS2CellIdFromQuadkey", { enumerable: true, get: function () { return s2_geometry_1.getS2CellIdFromQuadkey; } });
19
+ Object.defineProperty(exports, "getS2LngLatFromS2Cell", { enumerable: true, get: function () { return s2_geometry_1.getS2LngLatFromS2Cell; } });
20
+ var s2_to_region_1 = require("./converters/s2-to-region");
21
+ Object.defineProperty(exports, "getS2Region", { enumerable: true, get: function () { return s2_to_region_1.getS2Region; } });
22
+ var s2_to_obb_points_1 = require("./converters/s2-to-obb-points");
23
+ Object.defineProperty(exports, "getS2OrientedBoundingBoxCornerPoints", { enumerable: true, get: function () { return s2_to_obb_points_1.getS2OrientedBoundingBoxCornerPoints; } });
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Retrieve S2 geometry center
3
+ * @param s2Token {string} A string that is the cell's hex token
4
+ * @returns {[number, number]} Longitude and Latitude coordinates of the S2 cell's center
5
+ */
6
+ export declare function getS2LngLat(s2Token: string): [number, number];
7
+ /**
8
+ * Get a polygon with corner coordinates for an s2 cell
9
+ * @param tokenOrKey {string} A string that is the cell's hex token or the Hilbert quad key (containing /)
10
+ * @return {Float64Array} - a simple polygon in flat array format: [lng0, lat0, lng1, lat1, ...]
11
+ * - the polygon is closed, i.e. last coordinate is a copy of the first coordinate
12
+ */
13
+ export declare function getS2BoundaryFlat(tokenOrKey: string): Float64Array;
14
+ //# sourceMappingURL=s2-geometry-functions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s2-geometry-functions.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/s2/s2-geometry-functions.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAG7D;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,YAAY,CAGlE"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ // math.gl, MIT license
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.getS2BoundaryFlat = exports.getS2LngLat = void 0;
5
+ const s2_to_boundary_1 = require("./converters/s2-to-boundary");
6
+ const s2_geometry_1 = require("./s2geometry/s2-geometry");
7
+ const s2_cell_utils_1 = require("./s2geometry/s2-cell-utils");
8
+ // GEOMETRY
9
+ /**
10
+ * Retrieve S2 geometry center
11
+ * @param s2Token {string} A string that is the cell's hex token
12
+ * @returns {[number, number]} Longitude and Latitude coordinates of the S2 cell's center
13
+ */
14
+ function getS2LngLat(s2Token) {
15
+ const s2cell = (0, s2_cell_utils_1.getS2Cell)(s2Token);
16
+ return (0, s2_geometry_1.getS2LngLatFromS2Cell)(s2cell);
17
+ }
18
+ exports.getS2LngLat = getS2LngLat;
19
+ /**
20
+ * Get a polygon with corner coordinates for an s2 cell
21
+ * @param tokenOrKey {string} A string that is the cell's hex token or the Hilbert quad key (containing /)
22
+ * @return {Float64Array} - a simple polygon in flat array format: [lng0, lat0, lng1, lat1, ...]
23
+ * - the polygon is closed, i.e. last coordinate is a copy of the first coordinate
24
+ */
25
+ function getS2BoundaryFlat(tokenOrKey) {
26
+ const s2cell = (0, s2_cell_utils_1.getS2Cell)(tokenOrKey);
27
+ return (0, s2_to_boundary_1.getS2BoundaryFlatFromS2Cell)(s2cell);
28
+ }
29
+ exports.getS2BoundaryFlat = getS2BoundaryFlat;
@@ -0,0 +1,23 @@
1
+ import Long from 'long';
2
+ /**
3
+ * Convert the S2 token to the S2 cell ID
4
+ * @param token {string} A string that is the cell's hex token. Zero cell ID is represented as 'X'.
5
+ * @returns {Long} Cell id that is a 64-bit encoding of a face and a Hilbert curve parameter on that face.
6
+ * See {@link https://github.com/google/s2-geometry-library-java/blob/c04b68bf3197a9c34082327eeb3aec7ab7c85da1/src/com/google/common/geometry/S2CellId.java#L439} for more information
7
+ */
8
+ export declare function getS2CellIdFromToken(token: string): Long;
9
+ /**
10
+ * Convert the S2 cell ID to the S2 token
11
+ * @param cellId {Long} A 64-bit encoding of a face and a Hilbert curve parameter on that face.
12
+ * @returns {string} A string that is the cell's hex token. Zero cell ID is represented as 'X'.
13
+ */
14
+ export declare function getS2TokenFromCellId(cellId: Long): string;
15
+ /**
16
+ * Get one of four S2 cell's children.
17
+ * @param cellId {Long} A 64-bit encoding of a face and a Hilbert curve parameter on that face.
18
+ * The cell must NOT be a leaf one. So, the cell's level is in the range [0-29].
19
+ * @param index {number} Child index defines one of four S2 cell's children. Must be in the range [0-3].
20
+ * @returns The ID of the cell's child.
21
+ */
22
+ export declare function getS2ChildCellId(cellId: Long, index: number): Long;
23
+ //# sourceMappingURL=s2-token-functions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s2-token-functions.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/s2/s2-token-functions.ts"],"names":[],"mappings":"AAEA,OAAO,IAAI,MAAM,MAAM,CAAC;AAIxB;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAOxD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,IAAI,GAAG,MAAM,CAezD;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAMlE"}
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ // loaders.gl, MIT license
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.getS2ChildCellId = exports.getS2TokenFromCellId = exports.getS2CellIdFromToken = void 0;
8
+ const long_1 = __importDefault(require("long"));
9
+ const MAXIMUM_TOKEN_LENGTH = 16;
10
+ /**
11
+ * Convert the S2 token to the S2 cell ID
12
+ * @param token {string} A string that is the cell's hex token. Zero cell ID is represented as 'X'.
13
+ * @returns {Long} Cell id that is a 64-bit encoding of a face and a Hilbert curve parameter on that face.
14
+ * See {@link https://github.com/google/s2-geometry-library-java/blob/c04b68bf3197a9c34082327eeb3aec7ab7c85da1/src/com/google/common/geometry/S2CellId.java#L439} for more information
15
+ */
16
+ function getS2CellIdFromToken(token) {
17
+ if (token === 'X') {
18
+ token = '';
19
+ }
20
+ // pad token with zeros to make the length 16 that is defined in MAXIMUM_TOKEN_LENGTH
21
+ const paddedToken = token.padEnd(MAXIMUM_TOKEN_LENGTH, '0');
22
+ return long_1.default.fromString(paddedToken, true, 16); // Hex base
23
+ }
24
+ exports.getS2CellIdFromToken = getS2CellIdFromToken;
25
+ /**
26
+ * Convert the S2 cell ID to the S2 token
27
+ * @param cellId {Long} A 64-bit encoding of a face and a Hilbert curve parameter on that face.
28
+ * @returns {string} A string that is the cell's hex token. Zero cell ID is represented as 'X'.
29
+ */
30
+ function getS2TokenFromCellId(cellId) {
31
+ if (cellId.isZero()) {
32
+ return 'X';
33
+ }
34
+ let numZeroDigits = cellId.countTrailingZeros();
35
+ const remainder = numZeroDigits % 4;
36
+ numZeroDigits = (numZeroDigits - remainder) / 4;
37
+ const trailingZeroHexChars = numZeroDigits;
38
+ numZeroDigits *= 4;
39
+ const x = cellId.shiftRightUnsigned(numZeroDigits);
40
+ const hexString = x.toString(16).replace(/0+$/, '');
41
+ const zeroString = Array(17 - trailingZeroHexChars - hexString.length).join('0');
42
+ return zeroString + hexString;
43
+ }
44
+ exports.getS2TokenFromCellId = getS2TokenFromCellId;
45
+ /**
46
+ * Get one of four S2 cell's children.
47
+ * @param cellId {Long} A 64-bit encoding of a face and a Hilbert curve parameter on that face.
48
+ * The cell must NOT be a leaf one. So, the cell's level is in the range [0-29].
49
+ * @param index {number} Child index defines one of four S2 cell's children. Must be in the range [0-3].
50
+ * @returns The ID of the cell's child.
51
+ */
52
+ function getS2ChildCellId(cellId, index) {
53
+ // Shift sentinel bit 2 positions to the right.
54
+ const newLsb = lsb(cellId).shiftRightUnsigned(2);
55
+ // Insert child index before the sentinel bit.
56
+ const childCellId = cellId.add(long_1.default.fromNumber(2 * index + 1 - 4).multiply(newLsb));
57
+ return childCellId;
58
+ }
59
+ exports.getS2ChildCellId = getS2ChildCellId;
60
+ /**
61
+ * Return the lowest-numbered bit that is on for this cell id.
62
+ * @private
63
+ * @param cellId {Long} Cell id.
64
+ * @returns {Long} The lowest-numbered bit that is on for this cell id.
65
+ */
66
+ function lsb(cellId) {
67
+ return cellId.and(cellId.not().add(1)); // eslint-disable-line
68
+ }
@@ -0,0 +1,14 @@
1
+ import type { S2Cell } from './s2-geometry';
2
+ /**
3
+ * Return the S2Cell from the cell's hex token or the Hilbert quad key
4
+ * @param tokenOrKey {string} A string that is the cell's hex token or the Hilbert quad key (containing /)
5
+ * @returns {@link S2Cell}
6
+ */
7
+ export declare function getS2Cell(tokenOrKey: string): S2Cell;
8
+ /**
9
+ * Get the underlying Hilbert quad key
10
+ * @param tokenOrKey {string} A string that is the cell's hex token or the Hilbert quad key (containing /)
11
+ * @returns Hilbert quad key
12
+ */
13
+ export declare function getS2QuadKey(tokenOrKey: string): string;
14
+ //# sourceMappingURL=s2-cell-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s2-cell-utils.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/s2/s2geometry/s2-cell-utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAM1C;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAIpD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAQvD"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ // math.gl, MIT license
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.getS2QuadKey = exports.getS2Cell = void 0;
5
+ const s2_geometry_1 = require("./s2-geometry");
6
+ const s2_token_functions_1 = require("../s2-token-functions");
7
+ /**
8
+ * Return the S2Cell from the cell's hex token or the Hilbert quad key
9
+ * @param tokenOrKey {string} A string that is the cell's hex token or the Hilbert quad key (containing /)
10
+ * @returns {@link S2Cell}
11
+ */
12
+ function getS2Cell(tokenOrKey) {
13
+ const key = getS2QuadKey(tokenOrKey);
14
+ const s2cell = (0, s2_geometry_1.getS2CellFromQuadKey)(key);
15
+ return s2cell;
16
+ }
17
+ exports.getS2Cell = getS2Cell;
18
+ /**
19
+ * Get the underlying Hilbert quad key
20
+ * @param tokenOrKey {string} A string that is the cell's hex token or the Hilbert quad key (containing /)
21
+ * @returns Hilbert quad key
22
+ */
23
+ function getS2QuadKey(tokenOrKey) {
24
+ if (tokenOrKey.indexOf('/') > 0) {
25
+ // is Hilbert quad key
26
+ return tokenOrKey;
27
+ }
28
+ // is S2 cell's hex token
29
+ const id = (0, s2_token_functions_1.getS2CellIdFromToken)(tokenOrKey);
30
+ return (0, s2_geometry_1.getS2QuadkeyFromCellId)(id);
31
+ }
32
+ exports.getS2QuadKey = getS2QuadKey;
@@ -0,0 +1,52 @@
1
+ import Long from 'long';
2
+ /**
3
+ * An object describing the S2 cell
4
+ * @param face {number} Selects one of the six cube faces. The value is in the range [0..5]
5
+ * @param ij {[number, number]} “i” and “j” are integers in the range [0..2**30-1] that identify the cell.
6
+ * @param level {number} The number of times the cell has been subdivided (starting with a face cell). The value is in the range [0..30]
7
+ */
8
+ export type S2Cell = {
9
+ face: number;
10
+ ij: [number, number];
11
+ level: number;
12
+ };
13
+ /**
14
+ * Return the S2Cell
15
+ * @param hilbertQuadkey {string} A string that is the Hilbert quad key (containing /)
16
+ * @returns {@link S2Cell}
17
+ */
18
+ export declare function getS2CellFromQuadKey(hilbertQuadkey: string): S2Cell;
19
+ /**
20
+ * Convets S2 cell ID to the Hilbert quad key
21
+ * @param cellId {Long} Cell id that is a 64-bit encoding of a face and a Hilbert curve parameter on that face
22
+ * @returns {string} the Hilbert quad key (containing /) as a string in the format 'face/pos', where
23
+ * - face is a 10-base representation of the face number
24
+ * - pos is a 4-base representation of the position along the Hilbert curve. For example,
25
+ * pos == '13' means the following:
26
+ * The face is divided two times. After the first time the child cell with position 1 will be selected.
27
+ * Then, this cell will be divided the second time, and the child cell with position 3 will be selected.
28
+ */
29
+ export declare function getS2QuadkeyFromCellId(cellId: Long): string;
30
+ /**
31
+ * Convets S2 the Hilbert quad key to cell ID.
32
+ * @param quadkey {string} The Hilbert quad key (containing /) as a string in the format 'face/pos'
33
+ * @returns {Long} Cell id that is a 64-bit encoding of a face and a Hilbert curve parameter on that face
34
+ */
35
+ export declare function getS2CellIdFromQuadkey(hilbertQuadkey: string): Long;
36
+ export declare function IJToST(ij: [number, number], level: number, offsets: [number, number]): [number, number];
37
+ export declare function STToUV(st: [number, number]): [number, number];
38
+ export declare function FaceUVToXYZ(face: number, [u, v]: [number, number]): [number, number, number];
39
+ export declare function XYZToLngLat([x, y, z]: [number, number, number]): [number, number];
40
+ /**
41
+ * Retrieve S2 geometry center
42
+ * @param s2cell {S2Cell} S2 cell
43
+ * @returns {[number, number]} Longitude and Latitude coordinates of the S2 cell's center
44
+ */
45
+ export declare function getS2LngLatFromS2Cell(s2Cell: S2Cell): [number, number];
46
+ /**
47
+ * Return longitude and latitude of four corners of the cell.
48
+ * @param s2Cell {S2Cell} S2 cell
49
+ * @returns {Array<[number, number]>} Array of longitude and latitude pairs (in degrees) for four corners of the cell.
50
+ */
51
+ export declare function getCornerLngLats(s2Cell: S2Cell): Array<[number, number]>;
52
+ //# sourceMappingURL=s2-geometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s2-geometry.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/s2/s2geometry/s2-geometry.ts"],"names":[],"mappings":"AASA,OAAO,IAAI,MAAM,MAAM,CAAC;AAUxB;;;;;GAKG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;GAIG;AAEH,wBAAgB,oBAAoB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAwCnE;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,IAAI,GAAG,MAAM,CAyC3D;AAED;;;;GAIG;AAEH,wBAAgB,sBAAsB,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CA4DnE;AAED,wBAAgB,MAAM,CACpB,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EACpB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GACxB,CAAC,MAAM,EAAE,MAAM,CAAC,CAIlB;AASD,wBAAgB,MAAM,CAAC,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAE7D;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAiB5F;AAED,wBAAgB,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAKjF;AAeD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAMtE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAiBxE"}