@loaders.gl/tile-converter 4.0.0-alpha.5 → 4.0.0-alpha.7

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 (368) hide show
  1. package/bin/converter.js +1 -1
  2. package/dist/3d-tiles-attributes-worker.d.ts +28 -0
  3. package/dist/3d-tiles-attributes-worker.d.ts.map +1 -0
  4. package/dist/3d-tiles-attributes-worker.js +3 -0
  5. package/dist/3d-tiles-attributes-worker.js.map +7 -0
  6. package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +13 -1
  7. package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
  8. package/dist/3d-tiles-converter/3d-tiles-converter.js +274 -233
  9. package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts +9 -16
  10. package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
  11. package/dist/3d-tiles-converter/helpers/b3dm-converter.js +256 -246
  12. package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +22 -9
  13. package/dist/3d-tiles-converter/helpers/texture-atlas.js +47 -28
  14. package/dist/3d-tiles-converter/json-templates/tileset.js +38 -35
  15. package/dist/bundle.js +2 -2
  16. package/dist/constants.d.ts +2 -0
  17. package/dist/constants.d.ts.map +1 -0
  18. package/dist/constants.js +4 -0
  19. package/dist/converter-cli.d.ts +2 -0
  20. package/dist/converter-cli.d.ts.map +1 -0
  21. package/dist/converter-cli.js +280 -0
  22. package/dist/converter.min.js +185 -190
  23. package/dist/deps-installer/deps-installer.d.ts +11 -3
  24. package/dist/deps-installer/deps-installer.d.ts.map +1 -1
  25. package/dist/deps-installer/deps-installer.js +59 -18
  26. package/dist/dist.min.js +15153 -37895
  27. package/dist/es5/3d-tiles-attributes-worker.js +25 -0
  28. package/dist/es5/3d-tiles-attributes-worker.js.map +1 -0
  29. package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +467 -0
  30. package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -0
  31. package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +293 -0
  32. package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -0
  33. package/dist/es5/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +18 -0
  34. package/dist/es5/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +1 -0
  35. package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js +33 -0
  36. package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js.map +1 -0
  37. package/dist/es5/3d-tiles-converter/json-templates/tileset.js +61 -0
  38. package/dist/es5/3d-tiles-converter/json-templates/tileset.js.map +1 -0
  39. package/dist/es5/bundle.js +6 -0
  40. package/dist/es5/bundle.js.map +1 -0
  41. package/dist/es5/constants.js +9 -0
  42. package/dist/es5/constants.js.map +1 -0
  43. package/dist/es5/converter-cli.js +289 -0
  44. package/dist/es5/converter-cli.js.map +1 -0
  45. package/dist/es5/deps-installer/deps-installer.js +123 -0
  46. package/dist/es5/deps-installer/deps-installer.js.map +1 -0
  47. package/dist/es5/i3s-attributes-worker.js +25 -0
  48. package/dist/es5/i3s-attributes-worker.js.map +1 -0
  49. package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js +116 -0
  50. package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -0
  51. package/dist/es5/i3s-converter/helpers/coordinate-converter.js +90 -0
  52. package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +1 -0
  53. package/dist/es5/i3s-converter/helpers/create-scene-server-path.js +41 -0
  54. package/dist/es5/i3s-converter/helpers/create-scene-server-path.js.map +1 -0
  55. package/dist/es5/i3s-converter/helpers/feature-attributes.js +174 -0
  56. package/dist/es5/i3s-converter/helpers/feature-attributes.js.map +1 -0
  57. package/dist/es5/i3s-converter/helpers/geometry-attributes.js +213 -0
  58. package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +1 -0
  59. package/dist/es5/i3s-converter/helpers/geometry-converter.js +1181 -0
  60. package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -0
  61. package/dist/es5/i3s-converter/helpers/gltf-attributes.js +80 -0
  62. package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -0
  63. package/dist/es5/i3s-converter/helpers/node-debug.js +76 -0
  64. package/dist/es5/i3s-converter/helpers/node-debug.js.map +1 -0
  65. package/dist/es5/i3s-converter/helpers/node-index-document.js +492 -0
  66. package/dist/es5/i3s-converter/helpers/node-index-document.js.map +1 -0
  67. package/dist/es5/i3s-converter/helpers/node-pages.js +519 -0
  68. package/dist/es5/i3s-converter/helpers/node-pages.js.map +1 -0
  69. package/dist/es5/i3s-converter/i3s-converter.js +1512 -0
  70. package/dist/es5/i3s-converter/i3s-converter.js.map +1 -0
  71. package/dist/es5/i3s-converter/json-templates/geometry-definitions.js +107 -0
  72. package/dist/es5/i3s-converter/json-templates/geometry-definitions.js.map +1 -0
  73. package/dist/es5/i3s-converter/json-templates/layers.js +163 -0
  74. package/dist/es5/i3s-converter/json-templates/layers.js.map +1 -0
  75. package/dist/es5/i3s-converter/json-templates/metadata.js +31 -0
  76. package/dist/es5/i3s-converter/json-templates/metadata.js.map +1 -0
  77. package/dist/es5/i3s-converter/json-templates/node.js +99 -0
  78. package/dist/es5/i3s-converter/json-templates/node.js.map +1 -0
  79. package/dist/es5/i3s-converter/json-templates/scene-server.js +39 -0
  80. package/dist/es5/i3s-converter/json-templates/scene-server.js.map +1 -0
  81. package/dist/es5/i3s-converter/json-templates/shared-resources.js +173 -0
  82. package/dist/es5/i3s-converter/json-templates/shared-resources.js.map +1 -0
  83. package/dist/es5/i3s-converter/json-templates/store.js +107 -0
  84. package/dist/es5/i3s-converter/json-templates/store.js.map +1 -0
  85. package/dist/es5/i3s-converter/types.js +2 -0
  86. package/dist/es5/i3s-converter/types.js.map +1 -0
  87. package/dist/es5/i3s-server/app.js +18 -0
  88. package/dist/es5/i3s-server/app.js.map +1 -0
  89. package/dist/es5/i3s-server/controllers/index-controller.js +55 -0
  90. package/dist/es5/i3s-server/controllers/index-controller.js.map +1 -0
  91. package/dist/es5/i3s-server/routes/index.js +37 -0
  92. package/dist/es5/i3s-server/routes/index.js.map +1 -0
  93. package/dist/es5/index.js +21 -0
  94. package/dist/es5/index.js.map +1 -0
  95. package/dist/es5/lib/utils/compress-util.js +346 -0
  96. package/dist/es5/lib/utils/compress-util.js.map +1 -0
  97. package/dist/es5/lib/utils/file-utils.js +208 -0
  98. package/dist/es5/lib/utils/file-utils.js.map +1 -0
  99. package/dist/es5/lib/utils/geometry-utils.js +15 -0
  100. package/dist/es5/lib/utils/geometry-utils.js.map +1 -0
  101. package/dist/es5/lib/utils/lod-conversion-utils.js +44 -0
  102. package/dist/es5/lib/utils/lod-conversion-utils.js.map +1 -0
  103. package/dist/es5/lib/utils/queue.js +47 -0
  104. package/dist/es5/lib/utils/queue.js.map +1 -0
  105. package/dist/es5/lib/utils/statistic-utills.d.ts +25 -0
  106. package/dist/es5/lib/utils/statistic-utills.js +147 -0
  107. package/dist/es5/lib/utils/statistic-utills.js.map +1 -0
  108. package/dist/es5/lib/utils/write-queue.js +214 -0
  109. package/dist/es5/lib/utils/write-queue.js.map +1 -0
  110. package/dist/es5/pgm-loader.js +41 -0
  111. package/dist/es5/pgm-loader.js.map +1 -0
  112. package/dist/es5/workers/3d-tiles-attributes-worker.js +28 -0
  113. package/dist/es5/workers/3d-tiles-attributes-worker.js.map +1 -0
  114. package/dist/es5/workers/i3s-attributes-worker.js +30 -0
  115. package/dist/es5/workers/i3s-attributes-worker.js.map +1 -0
  116. package/dist/esm/3d-tiles-attributes-worker.js +16 -0
  117. package/dist/esm/3d-tiles-attributes-worker.js.map +1 -0
  118. package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +245 -0
  119. package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -0
  120. package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js +218 -0
  121. package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -0
  122. package/dist/esm/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +10 -0
  123. package/dist/esm/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +1 -0
  124. package/dist/esm/3d-tiles-converter/helpers/texture-atlas.js +27 -0
  125. package/dist/esm/3d-tiles-converter/helpers/texture-atlas.js.map +1 -0
  126. package/dist/esm/3d-tiles-converter/json-templates/tileset.js +37 -0
  127. package/dist/esm/3d-tiles-converter/json-templates/tileset.js.map +1 -0
  128. package/dist/esm/bundle.js +4 -0
  129. package/dist/esm/bundle.js.map +1 -0
  130. package/dist/esm/constants.js +2 -0
  131. package/dist/esm/constants.js.map +1 -0
  132. package/dist/esm/converter-cli.js +232 -0
  133. package/dist/esm/converter-cli.js.map +1 -0
  134. package/dist/esm/deps-installer/deps-installer.js +44 -0
  135. package/dist/esm/deps-installer/deps-installer.js.map +1 -0
  136. package/dist/esm/i3s-attributes-worker.js +16 -0
  137. package/dist/esm/i3s-attributes-worker.js.map +1 -0
  138. package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js +105 -0
  139. package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -0
  140. package/dist/esm/i3s-converter/helpers/coordinate-converter.js +80 -0
  141. package/dist/esm/i3s-converter/helpers/coordinate-converter.js.map +1 -0
  142. package/dist/esm/i3s-converter/helpers/create-scene-server-path.js +16 -0
  143. package/dist/esm/i3s-converter/helpers/create-scene-server-path.js.map +1 -0
  144. package/dist/esm/i3s-converter/helpers/feature-attributes.js +147 -0
  145. package/dist/esm/i3s-converter/helpers/feature-attributes.js.map +1 -0
  146. package/dist/esm/i3s-converter/helpers/geometry-attributes.js +190 -0
  147. package/dist/esm/i3s-converter/helpers/geometry-attributes.js.map +1 -0
  148. package/dist/esm/i3s-converter/helpers/geometry-converter.js +895 -0
  149. package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -0
  150. package/dist/esm/i3s-converter/helpers/gltf-attributes.js +73 -0
  151. package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -0
  152. package/dist/esm/i3s-converter/helpers/node-debug.js +72 -0
  153. package/dist/esm/i3s-converter/helpers/node-debug.js.map +1 -0
  154. package/dist/esm/i3s-converter/helpers/node-index-document.js +188 -0
  155. package/dist/esm/i3s-converter/helpers/node-index-document.js.map +1 -0
  156. package/dist/esm/i3s-converter/helpers/node-pages.js +206 -0
  157. package/dist/esm/i3s-converter/helpers/node-pages.js.map +1 -0
  158. package/dist/esm/i3s-converter/i3s-converter.js +764 -0
  159. package/dist/esm/i3s-converter/i3s-converter.js.map +1 -0
  160. package/dist/esm/i3s-converter/json-templates/geometry-definitions.js +89 -0
  161. package/dist/esm/i3s-converter/json-templates/geometry-definitions.js.map +1 -0
  162. package/dist/esm/i3s-converter/json-templates/layers.js +133 -0
  163. package/dist/esm/i3s-converter/json-templates/layers.js.map +1 -0
  164. package/dist/esm/i3s-converter/json-templates/metadata.js +22 -0
  165. package/dist/esm/i3s-converter/json-templates/metadata.js.map +1 -0
  166. package/dist/esm/i3s-converter/json-templates/node.js +80 -0
  167. package/dist/esm/i3s-converter/json-templates/node.js.map +1 -0
  168. package/dist/esm/i3s-converter/json-templates/scene-server.js +28 -0
  169. package/dist/esm/i3s-converter/json-templates/scene-server.js.map +1 -0
  170. package/dist/esm/i3s-converter/json-templates/shared-resources.js +123 -0
  171. package/dist/esm/i3s-converter/json-templates/shared-resources.js.map +1 -0
  172. package/dist/esm/i3s-converter/json-templates/store.js +98 -0
  173. package/dist/esm/i3s-converter/json-templates/store.js.map +1 -0
  174. package/dist/esm/i3s-converter/types.js +2 -0
  175. package/dist/esm/i3s-converter/types.js.map +1 -0
  176. package/dist/esm/i3s-server/app.js +16 -0
  177. package/dist/esm/i3s-server/app.js.map +1 -0
  178. package/dist/esm/i3s-server/bin/www +102 -0
  179. package/dist/esm/i3s-server/certs/cert.pem +19 -0
  180. package/dist/esm/i3s-server/certs/key.pem +27 -0
  181. package/dist/esm/i3s-server/controllers/index-controller.js +24 -0
  182. package/dist/esm/i3s-server/controllers/index-controller.js.map +1 -0
  183. package/dist/esm/i3s-server/routes/index.js +16 -0
  184. package/dist/esm/i3s-server/routes/index.js.map +1 -0
  185. package/dist/esm/index.js +3 -0
  186. package/dist/esm/index.js.map +1 -0
  187. package/dist/esm/lib/utils/compress-util.js +168 -0
  188. package/dist/esm/lib/utils/compress-util.js.map +1 -0
  189. package/dist/esm/lib/utils/file-utils.js +87 -0
  190. package/dist/esm/lib/utils/file-utils.js.map +1 -0
  191. package/dist/esm/lib/utils/geometry-utils.js +8 -0
  192. package/dist/esm/lib/utils/geometry-utils.js.map +1 -0
  193. package/dist/esm/lib/utils/lod-conversion-utils.js +37 -0
  194. package/dist/esm/lib/utils/lod-conversion-utils.js.map +1 -0
  195. package/dist/esm/lib/utils/queue.js +15 -0
  196. package/dist/esm/lib/utils/queue.js.map +1 -0
  197. package/dist/esm/lib/utils/statistic-utills.d.ts +25 -0
  198. package/dist/esm/lib/utils/statistic-utills.js +62 -0
  199. package/dist/esm/lib/utils/statistic-utills.js.map +1 -0
  200. package/dist/esm/lib/utils/write-queue.js +85 -0
  201. package/dist/esm/lib/utils/write-queue.js.map +1 -0
  202. package/dist/esm/pgm-loader.js +15 -0
  203. package/dist/esm/pgm-loader.js.map +1 -0
  204. package/dist/esm/workers/3d-tiles-attributes-worker.js +8 -0
  205. package/dist/esm/workers/3d-tiles-attributes-worker.js.map +1 -0
  206. package/dist/esm/workers/i3s-attributes-worker.js +7 -0
  207. package/dist/esm/workers/i3s-attributes-worker.js.map +1 -0
  208. package/dist/i3s-attributes-worker.d.ts +45 -0
  209. package/dist/i3s-attributes-worker.d.ts.map +1 -0
  210. package/dist/i3s-attributes-worker.js +9 -0
  211. package/dist/i3s-attributes-worker.js.map +7 -0
  212. package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +13 -0
  213. package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -0
  214. package/dist/i3s-converter/helpers/batch-ids-extensions.js +141 -0
  215. package/dist/i3s-converter/helpers/coordinate-converter.d.ts +9 -9
  216. package/dist/i3s-converter/helpers/coordinate-converter.d.ts.map +1 -1
  217. package/dist/i3s-converter/helpers/coordinate-converter.js +118 -72
  218. package/dist/i3s-converter/helpers/create-scene-server-path.d.ts +5 -5
  219. package/dist/i3s-converter/helpers/create-scene-server-path.d.ts.map +1 -1
  220. package/dist/i3s-converter/helpers/create-scene-server-path.js +27 -15
  221. package/dist/i3s-converter/helpers/feature-attributes.d.ts +56 -0
  222. package/dist/i3s-converter/helpers/feature-attributes.d.ts.map +1 -0
  223. package/dist/i3s-converter/helpers/feature-attributes.js +216 -0
  224. package/dist/i3s-converter/helpers/geometry-attributes.d.ts +4 -19
  225. package/dist/i3s-converter/helpers/geometry-attributes.d.ts.map +1 -1
  226. package/dist/i3s-converter/helpers/geometry-attributes.js +188 -185
  227. package/dist/i3s-converter/helpers/geometry-converter.d.ts +36 -39
  228. package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
  229. package/dist/i3s-converter/helpers/geometry-converter.js +1150 -689
  230. package/dist/i3s-converter/helpers/gltf-attributes.d.ts +9 -0
  231. package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -0
  232. package/dist/i3s-converter/helpers/gltf-attributes.js +85 -0
  233. package/dist/i3s-converter/helpers/node-debug.d.ts +7 -1
  234. package/dist/i3s-converter/helpers/node-debug.d.ts.map +1 -1
  235. package/dist/i3s-converter/helpers/node-debug.js +106 -72
  236. package/dist/i3s-converter/helpers/node-index-document.d.ts +95 -0
  237. package/dist/i3s-converter/helpers/node-index-document.d.ts.map +1 -0
  238. package/dist/i3s-converter/helpers/node-index-document.js +250 -0
  239. package/dist/i3s-converter/helpers/node-pages.d.ts +81 -41
  240. package/dist/i3s-converter/helpers/node-pages.d.ts.map +1 -1
  241. package/dist/i3s-converter/helpers/node-pages.js +313 -144
  242. package/dist/i3s-converter/i3s-converter.d.ts +60 -113
  243. package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
  244. package/dist/i3s-converter/i3s-converter.js +858 -951
  245. package/dist/i3s-converter/json-templates/geometry-definitions.d.ts +7 -0
  246. package/dist/i3s-converter/json-templates/geometry-definitions.d.ts.map +1 -0
  247. package/dist/i3s-converter/json-templates/geometry-definitions.js +87 -0
  248. package/dist/i3s-converter/json-templates/layers.d.ts +5 -30
  249. package/dist/i3s-converter/json-templates/layers.d.ts.map +1 -1
  250. package/dist/i3s-converter/json-templates/layers.js +132 -194
  251. package/dist/i3s-converter/json-templates/metadata.js +24 -21
  252. package/dist/i3s-converter/json-templates/node.js +82 -77
  253. package/dist/i3s-converter/json-templates/scene-server.js +30 -27
  254. package/dist/i3s-converter/json-templates/shared-resources.js +116 -122
  255. package/dist/i3s-converter/json-templates/store.js +100 -95
  256. package/dist/i3s-converter/types.d.ts +137 -6
  257. package/dist/i3s-converter/types.d.ts.map +1 -1
  258. package/dist/i3s-converter/types.js +2 -2
  259. package/dist/i3s-server/app.js +2 -9
  260. package/dist/i3s-server/controllers/index-controller.js +16 -24
  261. package/dist/i3s-server/routes/index.js +11 -15
  262. package/dist/index.d.ts +0 -2
  263. package/dist/index.d.ts.map +1 -1
  264. package/dist/index.js +10 -5
  265. package/dist/lib/utils/compress-util.d.ts +12 -20
  266. package/dist/lib/utils/compress-util.d.ts.map +1 -1
  267. package/dist/lib/utils/compress-util.js +238 -160
  268. package/dist/lib/utils/file-utils.d.ts +22 -14
  269. package/dist/lib/utils/file-utils.d.ts.map +1 -1
  270. package/dist/lib/utils/file-utils.js +133 -36
  271. package/dist/lib/utils/geometry-utils.d.ts +9 -0
  272. package/dist/lib/utils/geometry-utils.d.ts.map +1 -0
  273. package/dist/lib/utils/geometry-utils.js +18 -0
  274. package/dist/lib/utils/lod-conversion-utils.d.ts +21 -12
  275. package/dist/lib/utils/lod-conversion-utils.d.ts.map +1 -1
  276. package/dist/lib/utils/lod-conversion-utils.js +72 -39
  277. package/dist/lib/utils/queue.d.ts +7 -0
  278. package/dist/lib/utils/queue.d.ts.map +1 -0
  279. package/dist/lib/utils/queue.js +18 -0
  280. package/dist/lib/utils/statistic-utills.d.ts +3 -25
  281. package/dist/lib/utils/statistic-utills.d.ts.map +1 -1
  282. package/dist/lib/utils/statistic-utills.js +58 -67
  283. package/dist/lib/utils/write-queue.d.ts +39 -0
  284. package/dist/lib/utils/write-queue.d.ts.map +1 -0
  285. package/dist/lib/utils/write-queue.js +80 -0
  286. package/dist/pgm-loader.d.ts.map +1 -1
  287. package/dist/pgm-loader.js +23 -14
  288. package/dist/workers/3d-tiles-attributes-worker.d.ts +2 -0
  289. package/dist/workers/3d-tiles-attributes-worker.d.ts.map +1 -0
  290. package/dist/workers/3d-tiles-attributes-worker.js +9 -0
  291. package/dist/workers/i3s-attributes-worker.d.ts +2 -0
  292. package/dist/workers/i3s-attributes-worker.d.ts.map +1 -0
  293. package/dist/workers/i3s-attributes-worker.js +5 -0
  294. package/package.json +32 -24
  295. package/src/3d-tiles-attributes-worker.ts +43 -0
  296. package/src/3d-tiles-converter/3d-tiles-converter.ts +102 -40
  297. package/src/3d-tiles-converter/helpers/b3dm-converter.ts +39 -44
  298. package/src/constants.ts +2 -0
  299. package/src/converter-cli.ts +370 -0
  300. package/src/deps-installer/deps-installer.ts +71 -0
  301. package/src/i3s-attributes-worker.ts +59 -0
  302. package/src/i3s-converter/helpers/batch-ids-extensions.ts +205 -0
  303. package/src/i3s-converter/helpers/coordinate-converter.ts +33 -26
  304. package/src/i3s-converter/helpers/create-scene-server-path.ts +9 -5
  305. package/src/i3s-converter/helpers/feature-attributes.ts +247 -0
  306. package/src/i3s-converter/helpers/geometry-attributes.ts +98 -47
  307. package/src/i3s-converter/helpers/geometry-converter.ts +1635 -0
  308. package/src/i3s-converter/helpers/gltf-attributes.ts +100 -0
  309. package/src/i3s-converter/helpers/node-debug.ts +68 -16
  310. package/src/i3s-converter/helpers/node-index-document.ts +315 -0
  311. package/src/i3s-converter/helpers/node-pages.ts +222 -101
  312. package/src/i3s-converter/i3s-converter.ts +408 -555
  313. package/src/i3s-converter/json-templates/geometry-definitions.ts +83 -0
  314. package/src/i3s-converter/json-templates/layers.ts +27 -91
  315. package/src/i3s-converter/json-templates/shared-resources.ts +3 -3
  316. package/src/i3s-converter/types.ts +156 -5
  317. package/src/index.ts +0 -4
  318. package/src/lib/utils/{compress-util.js → compress-util.ts} +105 -18
  319. package/src/lib/utils/file-utils.ts +139 -0
  320. package/src/lib/utils/geometry-utils.ts +14 -0
  321. package/src/lib/utils/{lod-conversion-utils.js → lod-conversion-utils.ts} +27 -5
  322. package/src/lib/utils/queue.ts +17 -0
  323. package/src/lib/utils/write-queue.ts +110 -0
  324. package/src/pgm-loader.ts +2 -2
  325. package/src/workers/3d-tiles-attributes-worker.ts +6 -0
  326. package/src/workers/i3s-attributes-worker.ts +7 -0
  327. package/dist/3d-tiles-converter/3d-tiles-converter.js.map +0 -1
  328. package/dist/3d-tiles-converter/helpers/b3dm-converter.js.map +0 -1
  329. package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +0 -1
  330. package/dist/3d-tiles-converter/helpers/texture-atlas.js.map +0 -1
  331. package/dist/3d-tiles-converter/json-templates/tileset.js.map +0 -1
  332. package/dist/bundle.js.map +0 -1
  333. package/dist/deps-installer/deps-installer.js.map +0 -1
  334. package/dist/i3s-converter/helpers/coordinate-converter.js.map +0 -1
  335. package/dist/i3s-converter/helpers/create-scene-server-path.js.map +0 -1
  336. package/dist/i3s-converter/helpers/geometry-attributes.js.map +0 -1
  337. package/dist/i3s-converter/helpers/geometry-converter.js.map +0 -1
  338. package/dist/i3s-converter/helpers/node-debug.js.map +0 -1
  339. package/dist/i3s-converter/helpers/node-pages.js.map +0 -1
  340. package/dist/i3s-converter/i3s-converter.js.map +0 -1
  341. package/dist/i3s-converter/json-templates/layers.js.map +0 -1
  342. package/dist/i3s-converter/json-templates/metadata.js.map +0 -1
  343. package/dist/i3s-converter/json-templates/node.js.map +0 -1
  344. package/dist/i3s-converter/json-templates/scene-server.js.map +0 -1
  345. package/dist/i3s-converter/json-templates/shared-resources.js.map +0 -1
  346. package/dist/i3s-converter/json-templates/store.js.map +0 -1
  347. package/dist/i3s-converter/types.js.map +0 -1
  348. package/dist/i3s-server/app.js.map +0 -1
  349. package/dist/i3s-server/controllers/index-controller.js.map +0 -1
  350. package/dist/i3s-server/routes/index.js.map +0 -1
  351. package/dist/index.js.map +0 -1
  352. package/dist/lib/utils/compress-util.js.map +0 -1
  353. package/dist/lib/utils/file-utils.js.map +0 -1
  354. package/dist/lib/utils/lod-conversion-utils.js.map +0 -1
  355. package/dist/lib/utils/statistic-utills.js.map +0 -1
  356. package/dist/pgm-loader.js.map +0 -1
  357. package/src/deps-installer/deps-installer.d.ts +0 -10
  358. package/src/deps-installer/deps-installer.js +0 -22
  359. package/src/i3s-converter/helpers/geometry-converter.d.ts +0 -44
  360. package/src/i3s-converter/helpers/geometry-converter.js +0 -992
  361. package/src/lib/utils/compress-util.d.ts +0 -53
  362. package/src/lib/utils/file-utils.d.ts +0 -43
  363. package/src/lib/utils/file-utils.js +0 -38
  364. package/src/lib/utils/lod-conversion-utils.d.ts +0 -32
  365. /package/dist/{i3s-server → es5/i3s-server}/bin/www +0 -0
  366. /package/dist/{i3s-server → es5/i3s-server}/certs/cert.pem +0 -0
  367. /package/dist/{i3s-server → es5/i3s-server}/certs/key.pem +0 -0
  368. /package/src/lib/utils/{statistic-utills.js → statistic-utills.ts} +0 -0
@@ -0,0 +1,80 @@
1
+ import { Matrix3, Quaternion, Vector3 } from '@math.gl/core';
2
+ import { Ellipsoid } from '@math.gl/geospatial';
3
+ import { OrientedBoundingBox, makeOrientedBoundingBoxFromPoints, makeBoundingSphereFromPoints, BoundingSphere } from '@math.gl/culling';
4
+ export function createBoundingVolumes(tile, geoidHeightModel) {
5
+ let radius;
6
+ let halfSize;
7
+ let quaternion;
8
+ const boundingVolume = tile.boundingVolume;
9
+ const cartographicCenter = Ellipsoid.WGS84.cartesianToCartographic(boundingVolume.center, new Vector3());
10
+ cartographicCenter[2] = cartographicCenter[2] - geoidHeightModel.getHeight(cartographicCenter[1], cartographicCenter[0]);
11
+ if (boundingVolume instanceof OrientedBoundingBox) {
12
+ halfSize = boundingVolume.halfSize;
13
+ radius = new Vector3(halfSize[0], halfSize[1], halfSize[2]).len();
14
+ quaternion = boundingVolume.quaternion;
15
+ } else {
16
+ radius = tile.boundingVolume.radius;
17
+ halfSize = [radius, radius, radius];
18
+ quaternion = new Quaternion().fromMatrix3(new Matrix3([halfSize[0], 0, 0, 0, halfSize[1], 0, 0, 0, halfSize[2]])).normalize();
19
+ }
20
+ return {
21
+ mbs: [cartographicCenter[0], cartographicCenter[1], cartographicCenter[2], radius],
22
+ obb: {
23
+ center: [cartographicCenter[0], cartographicCenter[1], cartographicCenter[2]],
24
+ halfSize,
25
+ quaternion
26
+ }
27
+ };
28
+ }
29
+ export function createBoundingVolumesFromGeometry(cartesianPositions, geoidHeightModel) {
30
+ const positionVectors = convertPositionsToVectors(cartesianPositions);
31
+ const geometryObb = makeOrientedBoundingBoxFromPoints(positionVectors);
32
+ const geometryMbs = makeBoundingSphereFromPoints(positionVectors);
33
+ let mbsCenter = Ellipsoid.WGS84.cartesianToCartographic(geometryMbs.center, new Vector3());
34
+ let obbCenter = Ellipsoid.WGS84.cartesianToCartographic(geometryObb.center, new Vector3());
35
+ mbsCenter[2] = mbsCenter[2] - geoidHeightModel.getHeight(mbsCenter[1], mbsCenter[0]);
36
+ obbCenter[2] = obbCenter[2] - geoidHeightModel.getHeight(obbCenter[1], obbCenter[0]);
37
+ return {
38
+ mbs: [mbsCenter[0], mbsCenter[1], mbsCenter[2], geometryMbs.radius],
39
+ obb: {
40
+ center: obbCenter,
41
+ halfSize: geometryObb.halfSize,
42
+ quaternion: geometryObb.quaternion
43
+ }
44
+ };
45
+ }
46
+ export function convertPositionsToVectors(positions) {
47
+ const result = [];
48
+ for (let i = 0; i < positions.length; i += 3) {
49
+ const positionVector = new Vector3([positions[i], positions[i + 1], positions[i + 2]]);
50
+ result.push(positionVector);
51
+ }
52
+ return result;
53
+ }
54
+ export function convertBoundingVolumeToI3SFullExtent(boundingVolume) {
55
+ let sphere;
56
+ if (boundingVolume instanceof BoundingSphere) {
57
+ sphere = boundingVolume;
58
+ } else {
59
+ sphere = boundingVolume.getBoundingSphere();
60
+ }
61
+ const center = sphere.center;
62
+ const radius = sphere.radius;
63
+ const vertexMax = Ellipsoid.WGS84.cartesianToCartographic(new Vector3(center[0] + radius, center[1] + radius, center[2] + radius), new Vector3());
64
+ const vertexMin = Ellipsoid.WGS84.cartesianToCartographic(new Vector3(center[0] - radius, center[1] - radius, center[2] - radius), new Vector3());
65
+ return {
66
+ xmin: Math.min(vertexMin[0], vertexMax[0]),
67
+ xmax: Math.max(vertexMin[0], vertexMax[0]),
68
+ ymin: Math.min(vertexMin[1], vertexMax[1]),
69
+ ymax: Math.max(vertexMin[1], vertexMax[1]),
70
+ zmin: Math.min(vertexMin[2], vertexMax[2]),
71
+ zmax: Math.max(vertexMin[2], vertexMax[2])
72
+ };
73
+ }
74
+ export function createObbFromMbs(mbs) {
75
+ const radius = mbs[3];
76
+ const center = new Vector3(mbs[0], mbs[1], mbs[2]);
77
+ const halfAxex = new Matrix3([radius, 0, 0, 0, radius, 0, 0, 0, radius]);
78
+ return new OrientedBoundingBox(center, halfAxex);
79
+ }
80
+ //# sourceMappingURL=coordinate-converter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinate-converter.js","names":["Matrix3","Quaternion","Vector3","Ellipsoid","OrientedBoundingBox","makeOrientedBoundingBoxFromPoints","makeBoundingSphereFromPoints","BoundingSphere","createBoundingVolumes","tile","geoidHeightModel","radius","halfSize","quaternion","boundingVolume","cartographicCenter","WGS84","cartesianToCartographic","center","getHeight","len","fromMatrix3","normalize","mbs","obb","createBoundingVolumesFromGeometry","cartesianPositions","positionVectors","convertPositionsToVectors","geometryObb","geometryMbs","mbsCenter","obbCenter","positions","result","i","length","positionVector","push","convertBoundingVolumeToI3SFullExtent","sphere","getBoundingSphere","vertexMax","vertexMin","xmin","Math","min","xmax","max","ymin","ymax","zmin","zmax","createObbFromMbs","halfAxex"],"sources":["../../../../src/i3s-converter/helpers/coordinate-converter.ts"],"sourcesContent":["import type {BoundingVolumes, FullExtent, Mbs, Obb} from '@loaders.gl/i3s';\n\nimport {Matrix3, Quaternion, Vector3} from '@math.gl/core';\nimport {Ellipsoid} from '@math.gl/geospatial';\nimport {\n OrientedBoundingBox,\n makeOrientedBoundingBoxFromPoints,\n makeBoundingSphereFromPoints,\n BoundingSphere\n} from '@math.gl/culling';\nimport {Tile3D} from '@loaders.gl/tiles';\nimport {Geoid} from '@math.gl/geoid';\n\n/**\n * Create bounding volumes object from tile and geoid height model.\n * @param tile\n * @param geoidHeightModel\n * @returns - Bounding volumes object\n */\nexport function createBoundingVolumes(tile: Tile3D, geoidHeightModel: Geoid): BoundingVolumes {\n let radius;\n let halfSize;\n let quaternion;\n\n const boundingVolume = tile.boundingVolume;\n const cartographicCenter = Ellipsoid.WGS84.cartesianToCartographic(\n boundingVolume.center,\n new Vector3()\n );\n cartographicCenter[2] =\n cartographicCenter[2] -\n geoidHeightModel.getHeight(cartographicCenter[1], cartographicCenter[0]);\n if (boundingVolume instanceof OrientedBoundingBox) {\n halfSize = boundingVolume.halfSize;\n radius = new Vector3(halfSize[0], halfSize[1], halfSize[2]).len();\n quaternion = boundingVolume.quaternion;\n } else {\n radius = tile.boundingVolume.radius;\n halfSize = [radius, radius, radius];\n quaternion = new Quaternion()\n .fromMatrix3(new Matrix3([halfSize[0], 0, 0, 0, halfSize[1], 0, 0, 0, halfSize[2]]))\n .normalize();\n }\n\n return {\n mbs: [cartographicCenter[0], cartographicCenter[1], cartographicCenter[2], radius],\n obb: {\n center: [cartographicCenter[0], cartographicCenter[1], cartographicCenter[2]],\n halfSize,\n quaternion\n }\n };\n}\n\n/**\n * Generates bounding volumes from geometry positions\n * @param cartesianPositions\n * @param geoidHeightModel\n */\nexport function createBoundingVolumesFromGeometry(\n cartesianPositions: Float32Array,\n geoidHeightModel: Geoid\n): {mbs: Mbs; obb: Obb} {\n const positionVectors = convertPositionsToVectors(cartesianPositions);\n\n const geometryObb = makeOrientedBoundingBoxFromPoints(positionVectors);\n const geometryMbs = makeBoundingSphereFromPoints(positionVectors);\n\n let mbsCenter = Ellipsoid.WGS84.cartesianToCartographic(geometryMbs.center, new Vector3());\n let obbCenter = Ellipsoid.WGS84.cartesianToCartographic(geometryObb.center, new Vector3());\n\n mbsCenter[2] = mbsCenter[2] - geoidHeightModel.getHeight(mbsCenter[1], mbsCenter[0]);\n obbCenter[2] = obbCenter[2] - geoidHeightModel.getHeight(obbCenter[1], obbCenter[0]);\n\n return {\n mbs: [mbsCenter[0], mbsCenter[1], mbsCenter[2], geometryMbs.radius],\n obb: {\n center: obbCenter,\n halfSize: geometryObb.halfSize,\n quaternion: geometryObb.quaternion\n }\n };\n}\n\n/**\n * Create array of posisitons where each vertex is vector\n * @param {array} positions\n * @returns {Vector3[]}\n */\nexport function convertPositionsToVectors(positions: Float32Array): Vector3[] {\n const result: Vector3[] = [];\n\n for (let i = 0; i < positions.length; i += 3) {\n // TODO: (perf) new Vector3 is not optimal but required in `makeOrientedBoundingBoxFromPoints`.\n // modify `makeOrientedBoundingBoxFromPoints` to use scratch vectors\n const positionVector = new Vector3([positions[i], positions[i + 1], positions[i + 2]]);\n result.push(positionVector);\n }\n\n return result;\n}\n\n/**\n * Convert common coordinate to fullExtent https://github.com/Esri/i3s-spec/blob/master/docs/1.8/fullExtent.cmn.md\n * @param\n * @param boundingVolume\n * @returns - fullExtent object\n */\nexport function convertBoundingVolumeToI3SFullExtent(\n boundingVolume: OrientedBoundingBox | BoundingSphere\n): FullExtent {\n let sphere: BoundingSphere;\n if (boundingVolume instanceof BoundingSphere) {\n sphere = boundingVolume;\n } else {\n sphere = boundingVolume.getBoundingSphere();\n }\n const center: Vector3 = sphere.center;\n const radius: number = sphere.radius;\n const vertexMax = Ellipsoid.WGS84.cartesianToCartographic(\n new Vector3(center[0] + radius, center[1] + radius, center[2] + radius),\n new Vector3()\n );\n const vertexMin = Ellipsoid.WGS84.cartesianToCartographic(\n new Vector3(center[0] - radius, center[1] - radius, center[2] - radius),\n new Vector3()\n );\n\n // Converter sometimes returns min values that are bigger then max,\n // so we should check and take bigger value from max and smaller for nim\n return {\n xmin: Math.min(vertexMin[0], vertexMax[0]),\n xmax: Math.max(vertexMin[0], vertexMax[0]),\n ymin: Math.min(vertexMin[1], vertexMax[1]),\n ymax: Math.max(vertexMin[1], vertexMax[1]),\n zmin: Math.min(vertexMin[2], vertexMax[2]),\n zmax: Math.max(vertexMin[2], vertexMax[2])\n };\n}\n\n/**\n * Creates oriented boundinb box from mbs.\n * @param mbs - Minimum Bounding Sphere\n * @returns - Oriented BOunding Box\n */\nexport function createObbFromMbs(mbs: Mbs): Obb {\n const radius = mbs[3];\n const center = new Vector3(mbs[0], mbs[1], mbs[2]);\n const halfAxex = new Matrix3([radius, 0, 0, 0, radius, 0, 0, 0, radius]);\n return new OrientedBoundingBox(center, halfAxex);\n}\n"],"mappings":"AAEA,SAAQA,OAAO,EAAEC,UAAU,EAAEC,OAAO,QAAO,eAAe;AAC1D,SAAQC,SAAS,QAAO,qBAAqB;AAC7C,SACEC,mBAAmB,EACnBC,iCAAiC,EACjCC,4BAA4B,EAC5BC,cAAc,QACT,kBAAkB;AAUzB,OAAO,SAASC,qBAAqBA,CAACC,IAAY,EAAEC,gBAAuB,EAAmB;EAC5F,IAAIC,MAAM;EACV,IAAIC,QAAQ;EACZ,IAAIC,UAAU;EAEd,MAAMC,cAAc,GAAGL,IAAI,CAACK,cAAc;EAC1C,MAAMC,kBAAkB,GAAGZ,SAAS,CAACa,KAAK,CAACC,uBAAuB,CAChEH,cAAc,CAACI,MAAM,EACrB,IAAIhB,OAAO,CAAC,CACd,CAAC;EACDa,kBAAkB,CAAC,CAAC,CAAC,GACnBA,kB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,CAACG,GAAG,CAACL,SAAS,CAAC,CAAC,CAAC,EAAED,SAAS,CAAC,CAAC,CAAC,CAAC;IAC1CO,IAAI,EAAEJ,IAAI,CAACC,GAAG,CAACH,SAAS,CAAC,CAAC,CAAC,EAAED,SAAS,CAAC,CAAC,CAAC,CAAC;IAC1CQ,IAAI,EAAEL,IAAI,CAACG,GAAG,CAACL,SAAS,CAAC,CAAC,CAAC,EAAED,SAAS,CAAC,CAAC,CAAC,CAAC;IAC1CS,IAAI,EAAEN,IAAI,CAACC,GAAG,CAACH,SAAS,CAAC,CAAC,CAAC,EAAED,SAAS,CAAC,CAAC,CAAC,CAAC;IAC1CU,IAAI,EAAEP,IAAI,CAACG,GAAG,CAACL,SAAS,CAAC,CAAC,CAAC,EAAED,SAAS,CAAC,CAAC,CAAC;EAC3C,CAAC;AACH;AAOA,OAAO,SAASW,gBAAgBA,CAAC9B,GAAQ,EAAO;EAC9C,MAAMZ,MAAM,GAAGY,GAAG,CAAC,CAAC,CAAC;EACrB,MAAML,MAAM,GAAG,IAAIhB,OAAO,CAACqB,GAAG,CAAC,CAAC,CAAC,EAAEA,GAAG,CAAC,CAAC,CAAC,EAAEA,GAAG,CAAC,CAAC,CAAC,CAAC;EAClD,MAAM+B,QAAQ,GAAG,IAAItD,OAAO,CAAC,CAACW,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAEA,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAEA,MAAM,CAAC,CAAC;EACxE,OAAO,IAAIP,mBAAmB,CAACc,MAAM,EAAEoC,QAAQ,CAAC;AAClD"}
@@ -0,0 +1,16 @@
1
+ import { v4 as uuidv4 } from 'uuid';
2
+ import transform from 'json-map-transform';
3
+ import { join } from 'path';
4
+ import { SCENE_SERVER as sceneServerTemplate } from '../json-templates/scene-server';
5
+ import { writeFile } from '../../lib/utils/file-utils';
6
+ export async function createSceneServerPath(layerName, layers0, rootPath) {
7
+ const sceneServerData = {
8
+ serviceItemId: uuidv4().replace(/-/gi, ''),
9
+ layerName,
10
+ layers0
11
+ };
12
+ const sceneServer = transform(sceneServerData, sceneServerTemplate());
13
+ const nodePagePath = join(rootPath, 'SceneServer');
14
+ await writeFile(nodePagePath, JSON.stringify(sceneServer));
15
+ }
16
+ //# sourceMappingURL=create-scene-server-path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-scene-server-path.js","names":["v4","uuidv4","transform","join","SCENE_SERVER","sceneServerTemplate","writeFile","createSceneServerPath","layerName","layers0","rootPath","sceneServerData","serviceItemId","replace","sceneServer","nodePagePath","JSON","stringify"],"sources":["../../../../src/i3s-converter/helpers/create-scene-server-path.ts"],"sourcesContent":["import type {SceneLayer3D} from '@loaders.gl/i3s';\nimport {v4 as uuidv4} from 'uuid';\nimport transform from 'json-map-transform';\nimport {join} from 'path';\n\nimport {SCENE_SERVER as sceneServerTemplate} from '../json-templates/scene-server';\nimport {writeFile} from '../../lib/utils/file-utils';\n\n/**\n * Form and save sceneServer meta data into a file\n * @param layerName - layer name to display\n * @param layers0 - layer object embedded into sceneServer meta data\n * @param rootPath - root path of new converted tileset\n */\nexport async function createSceneServerPath(\n layerName: string,\n layers0: SceneLayer3D,\n rootPath: string\n): Promise<void> {\n const sceneServerData = {\n serviceItemId: uuidv4().replace(/-/gi, ''),\n layerName,\n layers0\n };\n\n const sceneServer = transform(sceneServerData, sceneServerTemplate());\n const nodePagePath = join(rootPath, 'SceneServer');\n await writeFile(nodePagePath, JSON.stringify(sceneServer));\n}\n"],"mappings":"AACA,SAAQA,EAAE,IAAIC,MAAM,QAAO,MAAM;AACjC,OAAOC,SAAS,MAAM,oBAAoB;AAC1C,SAAQC,IAAI,QAAO,MAAM;AAEzB,SAAQC,YAAY,IAAIC,mBAAmB,QAAO,gCAAgC;AAClF,SAAQC,SAAS,QAAO,4BAA4B;AAQpD,OAAO,eAAeC,qBAAqBA,CACzCC,SAAiB,EACjBC,OAAqB,EACrBC,QAAgB,EACD;EACf,MAAMC,eAAe,GAAG;IACtBC,aAAa,EAAEX,MAAM,CAAC,CAAC,CAACY,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;IAC1CL,SAAS;IACTC;EACF,CAAC;EAED,MAAMK,WAAW,GAAGZ,SAAS,CAACS,eAAe,EAAEN,mBAAmB,CAAC,CAAC,CAAC;EACrE,MAAMU,YAAY,GAAGZ,IAAI,CAACO,QAAQ,EAAE,aAAa,CAAC;EAClD,MAAMJ,SAAS,CAACS,YAAY,EAAEC,IAAI,CAACC,SAAS,CAACH,WAAW,CAAC,CAAC;AAC5D"}
@@ -0,0 +1,147 @@
1
+ export function flattenPropertyTableByFeatureIds(featureIds, propertyTable) {
2
+ const resultPropertyTable = {};
3
+ for (const propertyName in propertyTable) {
4
+ const properties = propertyTable[propertyName];
5
+ resultPropertyTable[propertyName] = getPropertiesByFeatureIds(properties, featureIds);
6
+ }
7
+ return resultPropertyTable;
8
+ }
9
+ function getPropertiesByFeatureIds(properties, featureIds) {
10
+ const resultProperties = [];
11
+ for (const featureId of featureIds) {
12
+ const property = properties[featureId] || null;
13
+ resultProperties.push(property);
14
+ }
15
+ return resultProperties;
16
+ }
17
+ export function checkPropertiesLength(featureIds, propertyTable) {
18
+ let needFlatten = false;
19
+ for (const attribute of Object.values(propertyTable)) {
20
+ if (featureIds.length !== attribute.length) {
21
+ needFlatten = true;
22
+ }
23
+ }
24
+ return needFlatten;
25
+ }
26
+ const STRING_TYPE = 'string';
27
+ const SHORT_INT_TYPE = 'Int32';
28
+ const DOUBLE_TYPE = 'double';
29
+ const OBJECT_ID_TYPE = 'OBJECTID';
30
+ export function getAttributeType(key, attribute) {
31
+ if (key === OBJECT_ID_TYPE) {
32
+ return OBJECT_ID_TYPE;
33
+ }
34
+ if (typeof attribute === STRING_TYPE) {
35
+ return STRING_TYPE;
36
+ } else if (typeof attribute === 'number') {
37
+ return Number.isInteger(attribute) ? SHORT_INT_TYPE : DOUBLE_TYPE;
38
+ }
39
+ return STRING_TYPE;
40
+ }
41
+ export function createdStorageAttribute(attributeIndex, key, attributeType) {
42
+ const storageAttribute = {
43
+ key: "f_".concat(attributeIndex),
44
+ name: key,
45
+ ordering: ['attributeValues'],
46
+ header: [{
47
+ property: 'count',
48
+ valueType: 'UInt32'
49
+ }],
50
+ attributeValues: {
51
+ valueType: 'Int32',
52
+ valuesPerElement: 1
53
+ }
54
+ };
55
+ switch (attributeType) {
56
+ case OBJECT_ID_TYPE:
57
+ setupIdAttribute(storageAttribute);
58
+ break;
59
+ case STRING_TYPE:
60
+ setupStringAttribute(storageAttribute);
61
+ break;
62
+ case DOUBLE_TYPE:
63
+ setupDoubleAttribute(storageAttribute);
64
+ break;
65
+ case SHORT_INT_TYPE:
66
+ break;
67
+ default:
68
+ setupStringAttribute(storageAttribute);
69
+ }
70
+ return storageAttribute;
71
+ }
72
+ export function getFieldAttributeType(attributeType) {
73
+ switch (attributeType) {
74
+ case OBJECT_ID_TYPE:
75
+ return 'esriFieldTypeOID';
76
+ case STRING_TYPE:
77
+ return 'esriFieldTypeString';
78
+ case SHORT_INT_TYPE:
79
+ return 'esriFieldTypeInteger';
80
+ case DOUBLE_TYPE:
81
+ return 'esriFieldTypeDouble';
82
+ default:
83
+ return 'esriFieldTypeString';
84
+ }
85
+ }
86
+ export function createFieldAttribute(key, fieldAttributeType) {
87
+ return {
88
+ name: key,
89
+ type: fieldAttributeType,
90
+ alias: key
91
+ };
92
+ }
93
+ export function createPopupInfo(propertyTable) {
94
+ const title = '{OBJECTID}';
95
+ const mediaInfos = [];
96
+ const fieldInfos = [];
97
+ const popupElements = [];
98
+ const expressionInfos = [];
99
+ for (const key in propertyTable) {
100
+ fieldInfos.push({
101
+ fieldName: key,
102
+ visible: true,
103
+ isEditable: false,
104
+ label: key
105
+ });
106
+ }
107
+ popupElements.push({
108
+ fieldInfos,
109
+ type: 'fields'
110
+ });
111
+ return {
112
+ title,
113
+ mediaInfos,
114
+ popupElements,
115
+ fieldInfos,
116
+ expressionInfos
117
+ };
118
+ }
119
+ function setupStringAttribute(storageAttribute) {
120
+ storageAttribute.ordering.unshift('attributeByteCounts');
121
+ storageAttribute.header.push({
122
+ property: 'attributeValuesByteCount',
123
+ valueType: 'UInt32'
124
+ });
125
+ storageAttribute.attributeValues = {
126
+ valueType: 'String',
127
+ encoding: 'UTF-8',
128
+ valuesPerElement: 1
129
+ };
130
+ storageAttribute.attributeByteCounts = {
131
+ valueType: 'UInt32',
132
+ valuesPerElement: 1
133
+ };
134
+ }
135
+ function setupIdAttribute(storageAttribute) {
136
+ storageAttribute.attributeValues = {
137
+ valueType: 'Oid32',
138
+ valuesPerElement: 1
139
+ };
140
+ }
141
+ function setupDoubleAttribute(storageAttribute) {
142
+ storageAttribute.attributeValues = {
143
+ valueType: 'Float64',
144
+ valuesPerElement: 1
145
+ };
146
+ }
147
+ //# sourceMappingURL=feature-attributes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature-attributes.js","names":["flattenPropertyTableByFeatureIds","featureIds","propertyTable","resultPropertyTable","propertyName","properties","getPropertiesByFeatureIds","resultProperties","featureId","property","push","checkPropertiesLength","needFlatten","attribute","Object","values","length","STRING_TYPE","SHORT_INT_TYPE","DOUBLE_TYPE","OBJECT_ID_TYPE","getAttributeType","key","Number","isInteger","createdStorageAttribute","attributeIndex","attributeType","storageAttribute","concat","name","ordering","header","valueType","attributeValues","valuesPerElement","setupIdAttribute","setupStringAttribute","setupDoubleAttribute","getFieldAttributeType","createFieldAttribute","fieldAttributeType","type","alias","createPopupInfo","title","mediaInfos","fieldInfos","popupElements","expressionInfos","fieldName","visible","isEditable","label","unshift","encoding","attributeByteCounts"],"sources":["../../../../src/i3s-converter/helpers/feature-attributes.ts"],"sourcesContent":["import type {FeatureTableJson} from '@loaders.gl/3d-tiles';\nimport {\n Attribute,\n AttributeStorageInfo,\n ESRIField,\n Field,\n FieldInfo,\n PopupInfo\n} from '@loaders.gl/i3s';\n\n/**\n * Takes attributes from property table based on featureIds.\n * If there is no property value for particular featureId (index) the property will be null.\n * Example:\n * Initial data:\n * OBJECTID: [0, 1, 5]\n * component: ['Windows', 'Frames', 'Wall', 'Roof', 'Skylight']\n * Result:\n * OBJECTID: [0, 1, 5]\n * component: ['Windows', 'Frames', 'null']\n * @param featureIds\n * @param propertyTable\n */\nexport function flattenPropertyTableByFeatureIds(\n featureIds: number[],\n propertyTable: FeatureTableJson\n): FeatureTableJson {\n const resultPropertyTable: FeatureTableJson = {};\n for (const propertyName in propertyTable) {\n const properties = propertyTable[propertyName];\n resultPropertyTable[propertyName] = getPropertiesByFeatureIds(properties, featureIds);\n }\n\n return resultPropertyTable;\n}\n\n/**\n * Getting properties by featureId index\n * @param properties\n * @param featureIds\n */\nfunction getPropertiesByFeatureIds(properties: any[], featureIds: number[]): any[] {\n const resultProperties: any = [];\n\n for (const featureId of featureIds) {\n const property = properties[featureId] || null;\n resultProperties.push(property);\n }\n\n return resultProperties;\n}\n\n/**\n * Check that all attributes in propertyTable have the same length as FeatureIds.\n * If there are differencies between lengths we should flatten property table based on exiesting featureIds.\n * @param featureIds\n * @param propertyTable\n * @returns\n */\nexport function checkPropertiesLength(\n featureIds: number[],\n propertyTable: FeatureTableJson\n): boolean {\n let needFlatten = false;\n\n for (const attribute of Object.values(propertyTable)) {\n if (featureIds.length !== attribute.length) {\n needFlatten = true;\n }\n }\n\n return needFlatten;\n}\n\n/** String data type name for feature attributes */\nconst STRING_TYPE = 'string';\n/** Integer data type name for feature attributes */\nconst SHORT_INT_TYPE = 'Int32';\n/** Double data type name for feature attributes */\nconst DOUBLE_TYPE = 'double';\n/** Type of attribute that is linked with feature ids */\nconst OBJECT_ID_TYPE = 'OBJECTID';\n/**\n * Get the attribute type for attributeStorageInfo https://github.com/Esri/i3s-spec/blob/master/docs/1.7/attributeStorageInfo.cmn.md\n * @param key - attribute's key\n * @param attribute - attribute's type in propertyTable\n */\nexport function getAttributeType(key: string, attribute: string): string {\n if (key === OBJECT_ID_TYPE) {\n return OBJECT_ID_TYPE;\n }\n if (typeof attribute === STRING_TYPE) {\n return STRING_TYPE;\n } else if (typeof attribute === 'number') {\n return Number.isInteger(attribute) ? SHORT_INT_TYPE : DOUBLE_TYPE;\n }\n return STRING_TYPE;\n}\n\n/**\n * Generate storage attribute for map segmentation.\n * @param attributeIndex - order index of attribute (f_0, f_1 ...).\n * @param key - attribute key from propertyTable.\n * @param attributeType - attribute type.\n * @return Updated storageAttribute.\n */\nexport function createdStorageAttribute(\n attributeIndex: number,\n key: string,\n attributeType: Attribute\n): AttributeStorageInfo {\n const storageAttribute = {\n key: `f_${attributeIndex}`,\n name: key,\n ordering: ['attributeValues'],\n header: [{property: 'count', valueType: 'UInt32'}],\n attributeValues: {valueType: 'Int32', valuesPerElement: 1}\n };\n\n switch (attributeType) {\n case OBJECT_ID_TYPE:\n setupIdAttribute(storageAttribute);\n break;\n case STRING_TYPE:\n setupStringAttribute(storageAttribute);\n break;\n case DOUBLE_TYPE:\n setupDoubleAttribute(storageAttribute);\n break;\n case SHORT_INT_TYPE:\n break;\n default:\n setupStringAttribute(storageAttribute);\n }\n\n return storageAttribute;\n}\n\n/**\n * Find and return attribute type based on key form propertyTable.\n * @param attributeType\n */\nexport function getFieldAttributeType(attributeType: Attribute): ESRIField {\n switch (attributeType) {\n case OBJECT_ID_TYPE:\n return 'esriFieldTypeOID';\n case STRING_TYPE:\n return 'esriFieldTypeString';\n case SHORT_INT_TYPE:\n return 'esriFieldTypeInteger';\n case DOUBLE_TYPE:\n return 'esriFieldTypeDouble';\n default:\n return 'esriFieldTypeString';\n }\n}\n\n/**\n * Setup field attribute for map segmentation.\n * @param key - attribute for map segmentation.\n * @param fieldAttributeType - esri attribute type ('esriFieldTypeString' or 'esriFieldTypeOID').\n */\nexport function createFieldAttribute(key: string, fieldAttributeType: ESRIField): Field {\n return {\n name: key,\n type: fieldAttributeType,\n alias: key\n };\n}\n\n/**\n * Generate popup info to show metadata on the map.\n * @param propertyTable - table data with OBJECTID.\n * @return data for correct rendering of popup.\n */\nexport function createPopupInfo(propertyTable: FeatureTableJson): PopupInfo {\n const title = '{OBJECTID}';\n const mediaInfos = [];\n const fieldInfos: FieldInfo[] = [];\n const popupElements: {\n fieldInfos: FieldInfo[];\n type: string;\n }[] = [];\n const expressionInfos = [];\n\n for (const key in propertyTable) {\n fieldInfos.push({\n fieldName: key,\n visible: true,\n isEditable: false,\n label: key\n });\n }\n popupElements.push({\n fieldInfos,\n type: 'fields'\n });\n\n return {\n title,\n mediaInfos,\n popupElements,\n fieldInfos,\n expressionInfos\n };\n}\n\n/**\n * Setup storage attribute as string.\n * @param storageAttribute - attribute for map segmentation.\n */\nfunction setupStringAttribute(storageAttribute: AttributeStorageInfo): void {\n // @ts-expect-error\n storageAttribute.ordering.unshift('attributeByteCounts');\n storageAttribute.header.push({property: 'attributeValuesByteCount', valueType: 'UInt32'});\n storageAttribute.attributeValues = {\n valueType: 'String',\n encoding: 'UTF-8',\n valuesPerElement: 1\n };\n storageAttribute.attributeByteCounts = {\n valueType: 'UInt32',\n valuesPerElement: 1\n };\n}\n\n/**\n * Setup Id attribute for map segmentation.\n * @param storageAttribute - attribute for map segmentation .\n */\nfunction setupIdAttribute(storageAttribute: AttributeStorageInfo): void {\n storageAttribute.attributeValues = {\n valueType: 'Oid32',\n valuesPerElement: 1\n };\n}\n\n/**\n * Setup double attribute for map segmentation.\n * @param storageAttribute - attribute for map segmentation .\n */\nfunction setupDoubleAttribute(storageAttribute: AttributeStorageInfo): void {\n storageAttribute.attributeValues = {\n valueType: 'Float64',\n valuesPerElement: 1\n };\n}\n"],"mappings":"AAuBA,OAAO,SAASA,gCAAgCA,CAC9CC,UAAoB,EACpBC,aAA+B,EACb;EAClB,MAAMC,mBAAqC,GAAG,CAAC,CAAC;EAChD,KAAK,MAAMC,YAAY,IAAIF,aAAa,EAAE;IACxC,MAAMG,UAAU,GAAGH,aAAa,CAACE,YAAY,CAAC;IAC9CD,mBAAmB,CAACC,YAAY,CAAC,GAAGE,yBAAyB,CAACD,UAAU,EAAEJ,UAAU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,aAAa,EAAE;IAC/B6C,UAAU,CAACrC,IAAI,CAAC;MACdwC,SAAS,EAAE5B,GAAG;MACd6B,OAAO,EAAE,IAAI;MACbC,UAAU,EAAE,KAAK;MACjBC,KAAK,EAAE/B;IACT,CAAC,CAAC;EACJ;EACA0B,aAAa,CAACtC,IAAI,CAAC;IACjBqC,UAAU;IACVL,IAAI,EAAE;EACR,CAAC,CAAC;EAEF,OAAO;IACLG,KAAK;IACLC,UAAU;IACVE,aAAa;IACbD,UAAU;IACVE;EACF,CAAC;AACH;AAMA,SAASZ,oBAAoBA,CAACT,gBAAsC,EAAQ;EAE1EA,gBAAgB,CAACG,QAAQ,CAACuB,OAAO,CAAC,qBAAqB,CAAC;EACxD1B,gBAAgB,CAACI,MAAM,CAACtB,IAAI,CAAC;IAACD,QAAQ,EAAE,0BAA0B;IAAEwB,SAAS,EAAE;EAAQ,CAAC,CAAC;EACzFL,gBAAgB,CAACM,eAAe,GAAG;IACjCD,SAAS,EAAE,QAAQ;IACnBsB,QAAQ,EAAE,OAAO;IACjBpB,gBAAgB,EAAE;EACpB,CAAC;EACDP,gBAAgB,CAAC4B,mBAAmB,GAAG;IACrCvB,SAAS,EAAE,QAAQ;IACnBE,gBAAgB,EAAE;EACpB,CAAC;AACH;AAMA,SAASC,gBAAgBA,CAACR,gBAAsC,EAAQ;EACtEA,gBAAgB,CAACM,eAAe,GAAG;IACjCD,SAAS,EAAE,OAAO;IAClBE,gBAAgB,EAAE;EACpB,CAAC;AACH;AAMA,SAASG,oBAAoBA,CAACV,gBAAsC,EAAQ;EAC1EA,gBAAgB,CAACM,eAAe,GAAG;IACjCD,SAAS,EAAE,SAAS;IACpBE,gBAAgB,EAAE;EACpB,CAAC;AACH"}
@@ -0,0 +1,190 @@
1
+ import { concatenateTypedArrays } from '@loaders.gl/loader-utils';
2
+ const VALUES_PER_VERTEX = 3;
3
+ const POSITIONS_AND_NORMALS_PER_TRIANGLE = 9;
4
+ export function generateAttributes(attributes) {
5
+ const {
6
+ positions,
7
+ normals,
8
+ texCoords,
9
+ colors,
10
+ uvRegions,
11
+ featureIndices
12
+ } = attributes;
13
+ const triangleCount = positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE;
14
+ if (!featureIndices.length) {
15
+ return {
16
+ faceRange: new Uint32Array([0, triangleCount - 1]),
17
+ featureIds: [0],
18
+ featureCount: 1,
19
+ positions,
20
+ normals,
21
+ texCoords,
22
+ colors,
23
+ uvRegions
24
+ };
25
+ }
26
+ const data = calculateFaceRangesAndFeaturesCount(featureIndices);
27
+ const attributeObjects = makeAttributeObjects({
28
+ ...data,
29
+ ...attributes
30
+ });
31
+ const unifiedAttributeObjectsByFeatureIds = unifyObjectsByFeatureId(attributeObjects);
32
+ const groupedAttributes = groupAttributesAndRangesByFeatureId(unifiedAttributeObjectsByFeatureIds, data.featureCount);
33
+ return groupedAttributes;
34
+ }
35
+ function calculateFaceRangesAndFeaturesCount(featureIndices) {
36
+ let rangeIndex = 1;
37
+ let featureIndex = 1;
38
+ let currentFeatureId = getFrequentValue(featureIndices.slice(0, VALUES_PER_VERTEX));
39
+ const faceRangeList = [];
40
+ const featureIds = [];
41
+ const uniqueFeatureIds = [currentFeatureId];
42
+ faceRangeList[0] = 0;
43
+ featureIds[0] = currentFeatureId;
44
+ for (let index = VALUES_PER_VERTEX; index < featureIndices.length; index += VALUES_PER_VERTEX) {
45
+ const newFeatureId = getFrequentValue(featureIndices.slice(index, index + VALUES_PER_VERTEX));
46
+ if (currentFeatureId !== newFeatureId) {
47
+ faceRangeList[rangeIndex] = index / VALUES_PER_VERTEX - 1;
48
+ faceRangeList[rangeIndex + 1] = index / VALUES_PER_VERTEX;
49
+ featureIds[featureIndex] = newFeatureId;
50
+ if (!uniqueFeatureIds.includes(newFeatureId)) {
51
+ uniqueFeatureIds.push(newFeatureId);
52
+ }
53
+ rangeIndex += 2;
54
+ featureIndex += 1;
55
+ }
56
+ currentFeatureId = newFeatureId;
57
+ }
58
+ faceRangeList[rangeIndex] = featureIndices.length / VALUES_PER_VERTEX - 1;
59
+ const faceRange = new Uint32Array(faceRangeList);
60
+ const featureCount = uniqueFeatureIds.length;
61
+ return {
62
+ faceRange,
63
+ featureCount,
64
+ featureIds
65
+ };
66
+ }
67
+ function getFrequentValue(values) {
68
+ const map = {};
69
+ let mostFrequentValue = values[0];
70
+ let maxCount = 1;
71
+ for (const value of values) {
72
+ map[value] = (map[value] || 0) + 1;
73
+ maxCount = maxCount > map[value] ? maxCount : map[value];
74
+ mostFrequentValue = maxCount > map[value] ? mostFrequentValue : value;
75
+ }
76
+ return mostFrequentValue;
77
+ }
78
+ function makeAttributeObjects(attributes) {
79
+ const {
80
+ featureIds,
81
+ positions,
82
+ normals,
83
+ colors,
84
+ uvRegions,
85
+ texCoords,
86
+ faceRange = new Uint32Array(0)
87
+ } = attributes;
88
+ const groupedData = [];
89
+ let positionsList = new Float32Array(positions);
90
+ let normalsList = new Float32Array(normals);
91
+ let colorsList = new Uint8Array(colors);
92
+ let texCoordsList = new Float32Array(texCoords);
93
+ let uvRegionsList = new Uint16Array(uvRegions);
94
+ for (let index = 0; index < featureIds.length; index++) {
95
+ const startIndex = faceRange[index * 2];
96
+ const endIndex = faceRange[index * 2 + 1];
97
+ const positionsCount = getSliceAttributeCount('positions', startIndex, endIndex);
98
+ const normalsCount = getSliceAttributeCount('normals', startIndex, endIndex);
99
+ const colorsCount = getSliceAttributeCount('colors', startIndex, endIndex);
100
+ const uvRegionsCount = getSliceAttributeCount('uvRegions', startIndex, endIndex);
101
+ const texCoordsCount = getSliceAttributeCount('texCoords', startIndex, endIndex);
102
+ groupedData.push({
103
+ featureId: featureIds[index],
104
+ positions: positionsList.slice(0, positionsCount),
105
+ normals: normalsList.slice(0, normalsCount),
106
+ colors: colorsList.slice(0, colorsCount),
107
+ uvRegions: uvRegionsList.slice(0, uvRegionsCount),
108
+ texCoords: texCoordsList.slice(0, texCoordsCount)
109
+ });
110
+ positionsList = positionsList.slice(positionsCount);
111
+ normalsList = normalsList.slice(normalsCount);
112
+ colorsList = colorsList.slice(colorsCount);
113
+ uvRegionsList = uvRegionsList.slice(uvRegionsCount);
114
+ texCoordsList = texCoordsList.slice(texCoordsCount);
115
+ }
116
+ return groupedData.sort((first, second) => first.featureId - second.featureId);
117
+ }
118
+ function getSliceAttributeCount(attributeName, startIndex, endIndex) {
119
+ const itemsPerVertex4 = 4;
120
+ const texCoordsPerVertex = 2;
121
+ const trianglesCount = endIndex - startIndex + 1;
122
+ const vertexCount = trianglesCount * 3;
123
+ switch (attributeName) {
124
+ case 'positions':
125
+ case 'normals':
126
+ return trianglesCount * POSITIONS_AND_NORMALS_PER_TRIANGLE;
127
+ case 'colors':
128
+ case 'uvRegions':
129
+ return vertexCount * itemsPerVertex4;
130
+ case 'texCoords':
131
+ return vertexCount * texCoordsPerVertex;
132
+ default:
133
+ return 0;
134
+ }
135
+ }
136
+ function unifyObjectsByFeatureId(sortedData) {
137
+ const uniqueObjects = [];
138
+ for (let index = 0; index < sortedData.length; index++) {
139
+ const currentObject = sortedData[index];
140
+ const existedObject = uniqueObjects.find(obj => obj.featureId === currentObject.featureId);
141
+ if (existedObject) {
142
+ existedObject.positions = concatenateTypedArrays(existedObject.positions, currentObject.positions);
143
+ existedObject.normals = concatenateTypedArrays(existedObject.normals, currentObject.normals);
144
+ existedObject.colors = concatenateTypedArrays(existedObject.colors, currentObject.colors);
145
+ existedObject.texCoords = concatenateTypedArrays(existedObject.texCoords, currentObject.texCoords);
146
+ } else {
147
+ uniqueObjects.push(currentObject);
148
+ }
149
+ }
150
+ return uniqueObjects;
151
+ }
152
+ function groupAttributesAndRangesByFeatureId(unifiedObjects, featureCount) {
153
+ const firstAttributeObject = unifiedObjects[0];
154
+ const featureIds = [firstAttributeObject.featureId || 0];
155
+ let positions = new Float32Array(firstAttributeObject.positions);
156
+ let normals = new Float32Array(firstAttributeObject.normals);
157
+ let colors = new Uint8Array(firstAttributeObject.colors);
158
+ let uvRegions = new Uint16Array(firstAttributeObject.uvRegions);
159
+ let texCoords = new Float32Array(firstAttributeObject.texCoords);
160
+ const range = [0];
161
+ let objIndex = 0;
162
+ let sum = 0;
163
+ for (let index = 1; index < unifiedObjects.length; index++) {
164
+ const currentAttributesObject = unifiedObjects[index];
165
+ featureIds.push(currentAttributesObject.featureId || 0);
166
+ positions = concatenateTypedArrays(positions, currentAttributesObject.positions);
167
+ normals = concatenateTypedArrays(normals, currentAttributesObject.normals);
168
+ colors = concatenateTypedArrays(colors, currentAttributesObject.colors);
169
+ uvRegions = concatenateTypedArrays(uvRegions, currentAttributesObject.uvRegions);
170
+ texCoords = concatenateTypedArrays(texCoords, currentAttributesObject.texCoords);
171
+ const groupedObject = unifiedObjects[objIndex];
172
+ range.push(groupedObject.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE - 1 + sum);
173
+ range.push(groupedObject.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE + sum);
174
+ sum += groupedObject.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE;
175
+ objIndex += 1;
176
+ }
177
+ range.push(positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE - 1);
178
+ const faceRange = new Uint32Array(range);
179
+ return {
180
+ faceRange,
181
+ featureIds,
182
+ positions,
183
+ normals,
184
+ colors,
185
+ uvRegions,
186
+ texCoords,
187
+ featureCount
188
+ };
189
+ }
190
+ //# sourceMappingURL=geometry-attributes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geometry-attributes.js","names":["concatenateTypedArrays","VALUES_PER_VERTEX","POSITIONS_AND_NORMALS_PER_TRIANGLE","generateAttributes","attributes","positions","normals","texCoords","colors","uvRegions","featureIndices","triangleCount","length","faceRange","Uint32Array","featureIds","featureCount","data","calculateFaceRangesAndFeaturesCount","attributeObjects","makeAttributeObjects","unifiedAttributeObjectsByFeatureIds","unifyObjectsByFeatureId","groupedAttributes","groupAttributesAndRangesByFeatureId","rangeIndex","featureIndex","currentFeatureId","getFrequentValue","slice","faceRangeList","uniqueFeatureIds","index","newFeatureId","includes","push","values","map","mostFrequentValue","maxCount","value","groupedData","positionsList","Float32Array","normalsList","colorsList","Uint8Array","texCoordsList","uvRegionsList","Uint16Array","startIndex","endIndex","positionsCount","getSliceAttributeCount","normalsCount","colorsCount","uvRegionsCount","texCoordsCount","featureId","sort","first","second","attributeName","itemsPerVertex4","texCoordsPerVertex","trianglesCount","vertexCount","sortedData","uniqueObjects","currentObject","existedObject","find","obj","unifiedObjects","firstAttributeObject","range","objIndex","sum","currentAttributesObject","groupedObject"],"sources":["../../../../src/i3s-converter/helpers/geometry-attributes.ts"],"sourcesContent":["import type {GeometryAttributes, ConvertedAttributes, GroupedByFeatureIdAttributes} from '../types';\nimport {concatenateTypedArrays} from '@loaders.gl/loader-utils';\n\nconst VALUES_PER_VERTEX = 3;\nconst POSITIONS_AND_NORMALS_PER_TRIANGLE = 9;\n\n/**\n * Generate geometry attributes with faceRange and featureCount\n * @param attributes\n * @returns attirbutes with featureCount, featureIds and changed faceRange.\n */\nexport function generateAttributes(attributes: ConvertedAttributes): GeometryAttributes {\n const {positions, normals, texCoords, colors, uvRegions, featureIndices} = attributes;\n const triangleCount = positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE;\n\n if (!featureIndices.length) {\n return {\n faceRange: new Uint32Array([0, triangleCount - 1]),\n featureIds: [0],\n featureCount: 1,\n positions,\n normals,\n texCoords,\n colors,\n uvRegions\n };\n }\n\n const data = calculateFaceRangesAndFeaturesCount(featureIndices);\n const attributeObjects = makeAttributeObjects({...data, ...attributes});\n const unifiedAttributeObjectsByFeatureIds = unifyObjectsByFeatureId(attributeObjects);\n const groupedAttributes = groupAttributesAndRangesByFeatureId(\n unifiedAttributeObjectsByFeatureIds,\n data.featureCount\n );\n return groupedAttributes;\n}\n\n/**\n * Calculates face Ranges and feature count based on featureIndices.\n * @param featureIndices\n * @returns Object with featureCount, reordered attributes and changed faceRange.\n */\nfunction calculateFaceRangesAndFeaturesCount(featureIndices: number[]): {\n faceRange: Uint32Array;\n featureCount: number;\n featureIds: number[];\n} {\n let rangeIndex = 1;\n let featureIndex = 1;\n let currentFeatureId = getFrequentValue(featureIndices.slice(0, VALUES_PER_VERTEX));\n const faceRangeList: any[] = [];\n const featureIds: any[] = [];\n const uniqueFeatureIds = [currentFeatureId];\n\n faceRangeList[0] = 0;\n featureIds[0] = currentFeatureId;\n\n for (let index = VALUES_PER_VERTEX; index < featureIndices.length; index += VALUES_PER_VERTEX) {\n const newFeatureId = getFrequentValue(featureIndices.slice(index, index + VALUES_PER_VERTEX));\n if (currentFeatureId !== newFeatureId) {\n faceRangeList[rangeIndex] = index / VALUES_PER_VERTEX - 1;\n faceRangeList[rangeIndex + 1] = index / VALUES_PER_VERTEX;\n featureIds[featureIndex] = newFeatureId;\n\n if (!uniqueFeatureIds.includes(newFeatureId)) {\n uniqueFeatureIds.push(newFeatureId);\n }\n\n rangeIndex += 2;\n featureIndex += 1;\n }\n currentFeatureId = newFeatureId;\n }\n\n faceRangeList[rangeIndex] = featureIndices.length / VALUES_PER_VERTEX - 1;\n\n const faceRange = new Uint32Array(faceRangeList);\n const featureCount = uniqueFeatureIds.length;\n\n return {faceRange, featureCount, featureIds};\n}\n\n/**\n * Find most frequent value to avoid situation where one vertex can be part of multiple features (objects).\n * @param values\n */\nfunction getFrequentValue(values: number[]): number {\n const map: {[key: number]: number} = {};\n\n let mostFrequentValue = values[0];\n let maxCount = 1;\n\n for (const value of values) {\n // Save item and it's frequency count to the map.\n map[value] = (map[value] || 0) + 1;\n // Find max count of frequency.\n maxCount = maxCount > map[value] ? maxCount : map[value];\n // Find the most frequent value.\n mostFrequentValue = maxCount > map[value] ? mostFrequentValue : value;\n }\n\n return mostFrequentValue;\n}\n\n/**\n * Generate list of attribute object grouped by feature ids.\n * @param attributes\n * @returns sorted list of attribute objects.\n */\nfunction makeAttributeObjects(attributes: GeometryAttributes): GroupedByFeatureIdAttributes[] {\n const {\n featureIds,\n positions,\n normals,\n colors,\n uvRegions,\n texCoords,\n faceRange = new Uint32Array(0)\n } = attributes;\n const groupedData: GroupedByFeatureIdAttributes[] = [];\n\n let positionsList = new Float32Array(positions);\n let normalsList = new Float32Array(normals);\n let colorsList = new Uint8Array(colors);\n let texCoordsList = new Float32Array(texCoords);\n let uvRegionsList = new Uint16Array(uvRegions);\n\n for (let index = 0; index < featureIds.length; index++) {\n const startIndex = faceRange[index * 2];\n const endIndex = faceRange[index * 2 + 1];\n\n const positionsCount = getSliceAttributeCount('positions', startIndex, endIndex);\n const normalsCount = getSliceAttributeCount('normals', startIndex, endIndex);\n const colorsCount = getSliceAttributeCount('colors', startIndex, endIndex);\n const uvRegionsCount = getSliceAttributeCount('uvRegions', startIndex, endIndex);\n const texCoordsCount = getSliceAttributeCount('texCoords', startIndex, endIndex);\n\n groupedData.push({\n featureId: featureIds[index],\n positions: positionsList.slice(0, positionsCount),\n normals: normalsList.slice(0, normalsCount),\n colors: colorsList.slice(0, colorsCount),\n uvRegions: uvRegionsList.slice(0, uvRegionsCount),\n texCoords: texCoordsList.slice(0, texCoordsCount)\n });\n\n positionsList = positionsList.slice(positionsCount);\n normalsList = normalsList.slice(normalsCount);\n colorsList = colorsList.slice(colorsCount);\n uvRegionsList = uvRegionsList.slice(uvRegionsCount);\n texCoordsList = texCoordsList.slice(texCoordsCount);\n }\n\n return groupedData.sort((first, second) => first.featureId - second.featureId);\n}\n\n/**\n * Generate sliced count for generating attribute objects depends on attribute name and range.\n * @param attributeName\n * @param startIndex\n * @param endIndex\n * @returns sliced count\n */\nfunction getSliceAttributeCount(\n attributeName: string,\n startIndex: number,\n endIndex: number\n): number {\n const itemsPerVertex4 = 4;\n const texCoordsPerVertex = 2;\n\n const trianglesCount = endIndex - startIndex + 1;\n const vertexCount = trianglesCount * 3;\n\n switch (attributeName) {\n case 'positions':\n case 'normals':\n return trianglesCount * POSITIONS_AND_NORMALS_PER_TRIANGLE;\n case 'colors':\n case 'uvRegions':\n return vertexCount * itemsPerVertex4;\n case 'texCoords':\n return vertexCount * texCoordsPerVertex;\n default:\n return 0;\n }\n}\n\n/**\n * Generates unique object list depends on feature ids and concantenate their attributes.\n * @param sortedData\n * @returns unique list of objects\n */\nfunction unifyObjectsByFeatureId(\n sortedData: GroupedByFeatureIdAttributes[]\n): GroupedByFeatureIdAttributes[] {\n const uniqueObjects: GroupedByFeatureIdAttributes[] = [];\n\n for (let index = 0; index < sortedData.length; index++) {\n const currentObject = sortedData[index];\n const existedObject = uniqueObjects.find((obj) => obj.featureId === currentObject.featureId);\n\n if (existedObject) {\n existedObject.positions = concatenateTypedArrays(\n existedObject.positions,\n currentObject.positions\n );\n existedObject.normals = concatenateTypedArrays(existedObject.normals, currentObject.normals);\n existedObject.colors = concatenateTypedArrays(existedObject.colors, currentObject.colors);\n existedObject.texCoords = concatenateTypedArrays(\n existedObject.texCoords,\n currentObject.texCoords\n );\n } else {\n uniqueObjects.push(currentObject);\n }\n }\n\n return uniqueObjects;\n}\n\n/**\n * Generates attribute objects with new faceRange and reordered attributes.\n * @param unifiedObjects\n * @returns generated attributes with new faceRange.\n */\nfunction groupAttributesAndRangesByFeatureId(\n unifiedObjects: GroupedByFeatureIdAttributes[],\n featureCount: number\n): GeometryAttributes {\n const firstAttributeObject = unifiedObjects[0];\n const featureIds = [firstAttributeObject.featureId || 0];\n\n let positions = new Float32Array(firstAttributeObject.positions);\n let normals = new Float32Array(firstAttributeObject.normals);\n let colors = new Uint8Array(firstAttributeObject.colors);\n let uvRegions = new Uint16Array(firstAttributeObject.uvRegions);\n let texCoords = new Float32Array(firstAttributeObject.texCoords);\n const range = [0];\n\n let objIndex = 0;\n let sum = 0;\n\n for (let index = 1; index < unifiedObjects.length; index++) {\n const currentAttributesObject = unifiedObjects[index];\n featureIds.push(currentAttributesObject.featureId || 0);\n\n positions = concatenateTypedArrays(positions, currentAttributesObject.positions);\n normals = concatenateTypedArrays(normals, currentAttributesObject.normals);\n colors = concatenateTypedArrays(colors, currentAttributesObject.colors);\n uvRegions = concatenateTypedArrays(uvRegions, currentAttributesObject.uvRegions);\n texCoords = concatenateTypedArrays(texCoords, currentAttributesObject.texCoords);\n\n const groupedObject = unifiedObjects[objIndex];\n range.push(groupedObject.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE - 1 + sum);\n range.push(groupedObject.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE + sum);\n\n sum += groupedObject.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE;\n objIndex += 1;\n }\n\n range.push(positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE - 1);\n\n const faceRange = new Uint32Array(range);\n return {faceRange, featureIds, positions, normals, colors, uvRegions, texCoords, featureCount};\n}\n"],"mappings":"AACA,SAAQA,sBAAsB,QAAO,0BAA0B;AAE/D,MAAMC,iBAAiB,GAAG,CAAC;AAC3B,MAAMC,kCAAkC,GAAG,CAAC;AAO5C,OAAO,SAASC,kBAAkBA,CAACC,UAA+B,EAAsB;EACtF,MAAM;IAACC,SAAS;IAAEC,OAAO;IAAEC,SAAS;IAAEC,MAAM;IAAEC,SAAS;IAAEC;EAAc,CAAC,GAAGN,UAAU;EACrF,MAAMO,aAAa,GAAGN,SAAS,CAACO,MAAM,GAAGV,kCAAkC;EAE3E,IAAI,CAACQ,cAAc,CAACE,MAAM,EAAE;IAC1B,OAAO;MACLC,SAAS,EAAE,IAAIC,WAAW,CAAC,CAAC,CAAC,EAAEH,aAAa,GAAG,CAAC,CAAC,CAAC;MAClDI,UAAU,EAAE,CAAC,CAAC,CAAC;MACfC,YAAY,EAAE,CAAC;MACfX,SAAS;MACTC,OAAO;MACPC,SAAS;MACTC,MAAM;MACNC;IACF,CAAC;EACH;EAEA,MAAMQ,IAAI,GAAGC,mCAAmC,CAACR,cAAc,CAAC;EAChE,MAAMS,gBAAgB,GAAGC,oBAAoB,CAAC;IAAC,GAAGH,IAAI;IAAE,GAAGb;EAAU,CAAC,CAAC;EACvE,MAAMiB,mCAAmC,GAAGC,uBAAuB,CAACH,gBAAgB,CAAC;EACrF,MAAMI,iBAA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