@loaders.gl/tile-converter 3.1.8 → 3.2.0-alpha.3

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 (238) hide show
  1. package/dist/3d-tiles-attributes-worker.d.ts +28 -0
  2. package/dist/3d-tiles-attributes-worker.d.ts.map +1 -0
  3. package/dist/3d-tiles-attributes-worker.js +4 -0
  4. package/dist/3d-tiles-attributes-worker.js.map +7 -0
  5. package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +82 -0
  6. package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -0
  7. package/dist/3d-tiles-converter/3d-tiles-converter.js +268 -0
  8. package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts +84 -0
  9. package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -0
  10. package/dist/3d-tiles-converter/helpers/b3dm-converter.js +278 -0
  11. package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.d.ts +13 -0
  12. package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.d.ts.map +1 -0
  13. package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +23 -0
  14. package/dist/3d-tiles-converter/helpers/texture-atlas.d.ts +9 -0
  15. package/dist/3d-tiles-converter/helpers/texture-atlas.d.ts.map +1 -0
  16. package/dist/3d-tiles-converter/helpers/texture-atlas.js +52 -0
  17. package/dist/3d-tiles-converter/json-templates/tileset.d.ts +15 -0
  18. package/dist/3d-tiles-converter/json-templates/tileset.d.ts.map +1 -0
  19. package/dist/3d-tiles-converter/json-templates/tileset.js +43 -0
  20. package/dist/bundle.d.ts +2 -0
  21. package/dist/bundle.d.ts.map +1 -0
  22. package/dist/bundle.js +5 -0
  23. package/dist/converter-cli.d.ts +2 -0
  24. package/dist/converter-cli.d.ts.map +1 -0
  25. package/dist/converter-cli.js +232 -0
  26. package/dist/converter.min.js +68 -68
  27. package/dist/deps-installer/deps-installer.d.ts +14 -0
  28. package/dist/deps-installer/deps-installer.d.ts.map +1 -0
  29. package/dist/deps-installer/deps-installer.js +31 -0
  30. package/dist/dist.min.js +1151 -1264
  31. package/dist/es5/3d-tiles-attributes-worker.js +29 -0
  32. package/dist/es5/3d-tiles-attributes-worker.js.map +1 -0
  33. package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +104 -44
  34. package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
  35. package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +34 -43
  36. package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
  37. package/dist/es5/converter-cli.js +306 -0
  38. package/dist/es5/converter-cli.js.map +1 -0
  39. package/dist/es5/deps-installer/deps-installer.js.map +1 -1
  40. package/dist/es5/i3s-attributes-worker.js +29 -0
  41. package/dist/es5/i3s-attributes-worker.js.map +1 -0
  42. package/dist/es5/i3s-converter/helpers/coordinate-converter.js +19 -11
  43. package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +1 -1
  44. package/dist/es5/i3s-converter/helpers/geometry-attributes.js +2 -2
  45. package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +1 -1
  46. package/dist/es5/i3s-converter/helpers/geometry-converter.js +271 -182
  47. package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
  48. package/dist/es5/i3s-converter/helpers/gltf-attributes.js +71 -0
  49. package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -0
  50. package/dist/es5/i3s-converter/helpers/node-pages.js +47 -99
  51. package/dist/es5/i3s-converter/helpers/node-pages.js.map +1 -1
  52. package/dist/es5/i3s-converter/i3s-converter.js +311 -245
  53. package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
  54. package/dist/es5/index.js +0 -16
  55. package/dist/es5/index.js.map +1 -1
  56. package/dist/es5/lib/utils/compress-util.js +14 -17
  57. package/dist/es5/lib/utils/compress-util.js.map +1 -1
  58. package/dist/es5/lib/utils/file-utils.js +39 -14
  59. package/dist/es5/lib/utils/file-utils.js.map +1 -1
  60. package/dist/es5/lib/utils/lod-conversion-utils.js.map +1 -1
  61. package/dist/es5/lib/utils/queue.js +61 -0
  62. package/dist/es5/lib/utils/queue.js.map +1 -0
  63. package/dist/es5/lib/utils/statistic-utills.js.map +1 -1
  64. package/dist/es5/lib/utils/write-queue.js +225 -0
  65. package/dist/es5/lib/utils/write-queue.js.map +1 -0
  66. package/dist/es5/pgm-loader.js +1 -1
  67. package/dist/es5/pgm-loader.js.map +1 -1
  68. package/dist/es5/workers/3d-tiles-attributes-worker.js +37 -0
  69. package/dist/es5/workers/3d-tiles-attributes-worker.js.map +1 -0
  70. package/dist/es5/workers/i3s-attributes-worker.js +40 -0
  71. package/dist/es5/workers/i3s-attributes-worker.js.map +1 -0
  72. package/dist/esm/3d-tiles-attributes-worker.js +16 -0
  73. package/dist/esm/3d-tiles-attributes-worker.js.map +1 -0
  74. package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +32 -5
  75. package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
  76. package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js +23 -23
  77. package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
  78. package/dist/esm/converter-cli.js +230 -0
  79. package/dist/esm/converter-cli.js.map +1 -0
  80. package/dist/esm/deps-installer/deps-installer.js.map +1 -1
  81. package/dist/esm/i3s-attributes-worker.js +16 -0
  82. package/dist/esm/i3s-attributes-worker.js.map +1 -0
  83. package/dist/esm/i3s-converter/helpers/coordinate-converter.js +19 -11
  84. package/dist/esm/i3s-converter/helpers/coordinate-converter.js.map +1 -1
  85. package/dist/esm/i3s-converter/helpers/geometry-attributes.js +2 -2
  86. package/dist/esm/i3s-converter/helpers/geometry-attributes.js.map +1 -1
  87. package/dist/esm/i3s-converter/helpers/geometry-converter.js +121 -62
  88. package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
  89. package/dist/esm/i3s-converter/helpers/gltf-attributes.js +54 -0
  90. package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -0
  91. package/dist/esm/i3s-converter/helpers/node-pages.js +12 -4
  92. package/dist/esm/i3s-converter/helpers/node-pages.js.map +1 -1
  93. package/dist/esm/i3s-converter/i3s-converter.js +155 -50
  94. package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
  95. package/dist/esm/index.js +0 -2
  96. package/dist/esm/index.js.map +1 -1
  97. package/dist/esm/lib/utils/compress-util.js +6 -8
  98. package/dist/esm/lib/utils/compress-util.js.map +1 -1
  99. package/dist/esm/lib/utils/file-utils.js +11 -1
  100. package/dist/esm/lib/utils/file-utils.js.map +1 -1
  101. package/dist/esm/lib/utils/lod-conversion-utils.js.map +1 -1
  102. package/dist/esm/lib/utils/queue.js +19 -0
  103. package/dist/esm/lib/utils/queue.js.map +1 -0
  104. package/dist/esm/lib/utils/statistic-utills.js.map +1 -1
  105. package/dist/esm/lib/utils/write-queue.js +88 -0
  106. package/dist/esm/lib/utils/write-queue.js.map +1 -0
  107. package/dist/esm/pgm-loader.js +1 -1
  108. package/dist/esm/pgm-loader.js.map +1 -1
  109. package/dist/esm/workers/3d-tiles-attributes-worker.js +5 -0
  110. package/dist/esm/workers/3d-tiles-attributes-worker.js.map +1 -0
  111. package/dist/esm/workers/i3s-attributes-worker.js +4 -0
  112. package/dist/esm/workers/i3s-attributes-worker.js.map +1 -0
  113. package/dist/i3s-attributes-worker.d.ts +33 -0
  114. package/dist/i3s-attributes-worker.d.ts.map +1 -0
  115. package/dist/i3s-attributes-worker.js +10 -0
  116. package/dist/i3s-attributes-worker.js.map +7 -0
  117. package/dist/i3s-converter/helpers/coordinate-converter.d.ts +41 -0
  118. package/dist/i3s-converter/helpers/coordinate-converter.d.ts.map +1 -0
  119. package/dist/i3s-converter/helpers/coordinate-converter.js +122 -0
  120. package/dist/i3s-converter/helpers/create-scene-server-path.d.ts +9 -0
  121. package/dist/i3s-converter/helpers/create-scene-server-path.d.ts.map +1 -0
  122. package/dist/i3s-converter/helpers/create-scene-server-path.js +28 -0
  123. package/dist/i3s-converter/helpers/geometry-attributes.d.ts +8 -0
  124. package/dist/i3s-converter/helpers/geometry-attributes.d.ts.map +1 -0
  125. package/dist/i3s-converter/helpers/geometry-attributes.js +177 -0
  126. package/dist/i3s-converter/helpers/geometry-converter.d.ts +29 -0
  127. package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -0
  128. package/dist/i3s-converter/helpers/geometry-converter.js +901 -0
  129. package/dist/i3s-converter/helpers/gltf-attributes.d.ts +9 -0
  130. package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -0
  131. package/dist/i3s-converter/helpers/gltf-attributes.js +56 -0
  132. package/dist/i3s-converter/helpers/node-debug.d.ts +8 -0
  133. package/dist/i3s-converter/helpers/node-debug.d.ts.map +1 -0
  134. package/dist/i3s-converter/helpers/node-debug.js +114 -0
  135. package/dist/i3s-converter/helpers/node-pages.d.ts +117 -0
  136. package/dist/i3s-converter/helpers/node-pages.d.ts.map +1 -0
  137. package/dist/i3s-converter/helpers/node-pages.js +208 -0
  138. package/dist/i3s-converter/i3s-converter.d.ts +323 -0
  139. package/dist/i3s-converter/i3s-converter.d.ts.map +1 -0
  140. package/dist/i3s-converter/i3s-converter.js +1074 -0
  141. package/dist/i3s-converter/json-templates/layers.d.ts +95 -0
  142. package/dist/i3s-converter/json-templates/layers.d.ts.map +1 -0
  143. package/dist/i3s-converter/json-templates/layers.js +199 -0
  144. package/dist/i3s-converter/json-templates/metadata.d.ts +22 -0
  145. package/dist/i3s-converter/json-templates/metadata.d.ts.map +1 -0
  146. package/dist/i3s-converter/json-templates/metadata.js +25 -0
  147. package/dist/i3s-converter/json-templates/node.d.ts +61 -0
  148. package/dist/i3s-converter/json-templates/node.d.ts.map +1 -0
  149. package/dist/i3s-converter/json-templates/node.js +89 -0
  150. package/dist/i3s-converter/json-templates/scene-server.d.ts +28 -0
  151. package/dist/i3s-converter/json-templates/scene-server.d.ts.map +1 -0
  152. package/dist/i3s-converter/json-templates/scene-server.js +31 -0
  153. package/dist/i3s-converter/json-templates/shared-resources.d.ts +14 -0
  154. package/dist/i3s-converter/json-templates/shared-resources.d.ts.map +1 -0
  155. package/dist/i3s-converter/json-templates/shared-resources.js +129 -0
  156. package/dist/i3s-converter/json-templates/store.d.ts +95 -0
  157. package/dist/i3s-converter/json-templates/store.d.ts.map +1 -0
  158. package/dist/i3s-converter/json-templates/store.js +103 -0
  159. package/dist/i3s-converter/types.d.ts +114 -0
  160. package/dist/i3s-converter/types.d.ts.map +1 -0
  161. package/dist/i3s-converter/types.js +2 -0
  162. package/dist/i3s-server/app.d.ts +3 -0
  163. package/dist/i3s-server/app.d.ts.map +1 -0
  164. package/dist/i3s-server/app.js +14 -0
  165. package/dist/i3s-server/controllers/index-controller.d.ts +2 -0
  166. package/dist/i3s-server/controllers/index-controller.d.ts.map +1 -0
  167. package/dist/i3s-server/controllers/index-controller.js +23 -0
  168. package/dist/i3s-server/routes/index.d.ts +3 -0
  169. package/dist/i3s-server/routes/index.d.ts.map +1 -0
  170. package/dist/i3s-server/routes/index.js +16 -0
  171. package/dist/index.d.ts +3 -0
  172. package/dist/index.d.ts.map +1 -0
  173. package/dist/index.js +10 -0
  174. package/dist/lib/utils/compress-util.d.ts +45 -0
  175. package/dist/lib/utils/compress-util.d.ts.map +1 -0
  176. package/dist/lib/utils/compress-util.js +257 -0
  177. package/dist/{esm/lib → lib}/utils/file-utils.d.ts +6 -14
  178. package/dist/lib/utils/file-utils.d.ts.map +1 -0
  179. package/dist/lib/utils/file-utils.js +81 -0
  180. package/dist/lib/utils/lod-conversion-utils.d.ts +41 -0
  181. package/dist/lib/utils/lod-conversion-utils.d.ts.map +1 -0
  182. package/dist/lib/utils/lod-conversion-utils.js +76 -0
  183. package/dist/lib/utils/queue.d.ts +7 -0
  184. package/dist/lib/utils/queue.d.ts.map +1 -0
  185. package/dist/lib/utils/queue.js +18 -0
  186. package/dist/lib/utils/statistic-utills.d.ts +3 -0
  187. package/dist/lib/utils/statistic-utills.d.ts.map +1 -0
  188. package/dist/lib/utils/statistic-utills.js +64 -0
  189. package/dist/lib/utils/write-queue.d.ts +22 -0
  190. package/dist/lib/utils/write-queue.d.ts.map +1 -0
  191. package/dist/lib/utils/write-queue.js +62 -0
  192. package/dist/pgm-loader.d.ts +6 -0
  193. package/dist/pgm-loader.d.ts.map +1 -0
  194. package/dist/pgm-loader.js +23 -0
  195. package/dist/workers/3d-tiles-attributes-worker.d.ts +2 -0
  196. package/dist/workers/3d-tiles-attributes-worker.d.ts.map +1 -0
  197. package/dist/workers/3d-tiles-attributes-worker.js +9 -0
  198. package/dist/workers/i3s-attributes-worker.d.ts +2 -0
  199. package/dist/workers/i3s-attributes-worker.d.ts.map +1 -0
  200. package/dist/workers/i3s-attributes-worker.js +5 -0
  201. package/package.json +19 -18
  202. package/src/3d-tiles-attributes-worker.ts +43 -0
  203. package/src/3d-tiles-converter/3d-tiles-converter.ts +49 -6
  204. package/src/3d-tiles-converter/helpers/b3dm-converter.ts +21 -18
  205. package/src/converter-cli.ts +310 -0
  206. package/src/deps-installer/{deps-installer.js → deps-installer.ts} +11 -1
  207. package/src/i3s-attributes-worker.ts +46 -0
  208. package/src/i3s-converter/helpers/coordinate-converter.ts +29 -24
  209. package/src/i3s-converter/helpers/geometry-attributes.ts +4 -3
  210. package/src/i3s-converter/helpers/{geometry-converter.js → geometry-converter.ts} +425 -179
  211. package/src/i3s-converter/helpers/gltf-attributes.ts +68 -0
  212. package/src/i3s-converter/helpers/node-pages.ts +25 -17
  213. package/src/i3s-converter/i3s-converter.ts +154 -87
  214. package/src/i3s-converter/types.ts +90 -8
  215. package/src/index.ts +0 -4
  216. package/src/lib/utils/{compress-util.js → compress-util.ts} +105 -18
  217. package/src/lib/utils/file-utils.ts +84 -0
  218. package/src/lib/utils/{lod-conversion-utils.js → lod-conversion-utils.ts} +27 -5
  219. package/src/lib/utils/queue.ts +17 -0
  220. package/src/lib/utils/{statistic-utills.js → statistic-utills.ts} +0 -0
  221. package/src/lib/utils/write-queue.ts +75 -0
  222. package/src/workers/3d-tiles-attributes-worker.ts +6 -0
  223. package/src/workers/i3s-attributes-worker.ts +6 -0
  224. package/dist/es5/deps-installer/deps-installer.d.ts +0 -10
  225. package/dist/es5/i3s-converter/helpers/geometry-converter.d.ts +0 -44
  226. package/dist/es5/lib/utils/compress-util.d.ts +0 -53
  227. package/dist/es5/lib/utils/file-utils.d.ts +0 -43
  228. package/dist/es5/lib/utils/lod-conversion-utils.d.ts +0 -32
  229. package/dist/esm/deps-installer/deps-installer.d.ts +0 -10
  230. package/dist/esm/i3s-converter/helpers/geometry-converter.d.ts +0 -44
  231. package/dist/esm/lib/utils/compress-util.d.ts +0 -53
  232. package/dist/esm/lib/utils/lod-conversion-utils.d.ts +0 -32
  233. package/src/deps-installer/deps-installer.d.ts +0 -10
  234. package/src/i3s-converter/helpers/geometry-converter.d.ts +0 -44
  235. package/src/lib/utils/compress-util.d.ts +0 -53
  236. package/src/lib/utils/file-utils.d.ts +0 -43
  237. package/src/lib/utils/file-utils.js +0 -38
  238. package/src/lib/utils/lod-conversion-utils.d.ts +0 -32
@@ -1,43 +0,0 @@
1
- /**
2
- * Write a file with data and name fileName to path
3
- *
4
- * @param path - output path
5
- * @param data - file content
6
- * @param fileName - name of output file (default: index.json)
7
- */
8
- export function writeFile(path: string, data: string | Uint8Array | ArrayBuffer, fileName?: string);
9
-
10
- /**
11
- * Write a file with data and name fileName to path - specific one for further packaging into slpk
12
- *
13
- * @param path - output path
14
- * @param data - file content
15
- * @param fileName - name of output file (default: index.json)
16
- * @param compress - if need to compress file with gzip (default: true)
17
- */
18
- export function writeFileForSlpk(
19
- path: string,
20
- data: string | Uint8Array | ArrayBuffer,
21
- fileName?: string,
22
- compress?: boolean
23
- );
24
-
25
- /**
26
- * Remove dir with path
27
- *
28
- * @param path
29
- */
30
- export function removeDir(path: string): Promise<void>;
31
-
32
- /**
33
- * Remove file with path
34
- *
35
- * @param path
36
- */
37
- export function removeFile(path: string): Promise<void>;
38
-
39
- /**
40
- * Generates absolute file path
41
- * @param filePath
42
- */
43
- export function getAbsoluteFilePath(filePath: string): string;
@@ -1,32 +0,0 @@
1
- /**
2
- * Convert LOD metric from "Screen Space Error" to "Screen Threshold"
3
- *
4
- * @param tile - 3d-tiles tile Object
5
- * @param coordinates - node converted coordinates
6
- * @returns An array of LOD metrics in format compatible with i3s 3DNodeIndexDocument.lodSelection
7
- * @example
8
- * [
9
- {
10
- "metricType": "maxScreenThresholdSQ",
11
- "maxError": 870638.071285568
12
- },
13
- {
14
- "metricType": "maxScreenThreshold",
15
- "maxError": 1052.8679031638949
16
- }
17
- ]
18
- */
19
- export function convertGeometricErrorToScreenThreshold(
20
- tile: Object,
21
- coordinates: {
22
- mbs?: number[];
23
- }
24
- ): Array<{metricType: string; maxError: number}>;
25
-
26
- /**
27
- * Convert LOD metric from "Screen Threshold" to "Screen Space Error"
28
- * @param node - i3s node data
29
- * @returns lod metric in 3d-tiles format
30
- * @todo implement this function
31
- */
32
- export function convertScreenThresholdToGeometricError(node: Object): number;
@@ -1,10 +0,0 @@
1
- /**
2
- * Install external dependencies for converter:
3
- * * PGM file (implemented);
4
- * * Draco library (not implemented);
5
- * * 7z archiver (not implemented);
6
- */
7
- export class DepsInstaller {
8
- // Run installation
9
- install(path?: string): Promise<void>;
10
- }
@@ -1,44 +0,0 @@
1
- import {Vector3, Matrix4} from '@math.gl/core';
2
- import {GeoidHeightModel} from '../../lib/geoid-height-model';
3
- /**
4
- * Convert binary data from b3dm file to i3s resources
5
- *
6
- * @param tileContent - 3d tile content
7
- * @param options - converter options
8
- * @returns A promise that resolves to object with `geometry`, compressedGeometry`, `texture` and `sharedResources` appropriate
9
- * for use I3S tiles.
10
- */
11
- export default function convertB3dmToI3sGeometry(
12
- tileContent: {
13
- batchTableJson: {
14
- id: [];
15
- };
16
- cartographicOrigin: Vector3;
17
- cartesianModelMatrix: Matrix4;
18
- gltf: {
19
- scene: {
20
- nodes: [];
21
- };
22
- images: [];
23
- materials: [];
24
- };
25
- },
26
- nodeId: number,
27
- featuresHashArray: any,
28
- attributeStorageInfo: any,
29
- draco: boolean,
30
- generateBoundingVolumes: boolean,
31
- geoidHeightModel: GeoidHeightModel
32
- ): Promise<
33
- {
34
- geometry: ArrayBuffer;
35
- compressedGeometry: ArrayBuffer;
36
- texture: any;
37
- sharedResources: any;
38
- meshMaterial: any;
39
- vertexCount: number;
40
- attributes: any;
41
- featureCount: number;
42
- boundingVolumes: any;
43
- }[]
44
- >;
@@ -1,53 +0,0 @@
1
- /**
2
- * Compress file to gzip file
3
- *
4
- * @param pathFile - the path to the file
5
- * @return the path to the gzip file
6
- */
7
- export function compressFileWithGzip(pathFile: string): Promise<string>;
8
-
9
- /**
10
- * Compress files from map into slpk file
11
- *
12
- * @param fileMap - map with file paths (key: output path, value: input path)
13
- * @param outputFile - output slpk file
14
- * @param level - compression level
15
- */
16
- export function compressFilesWithZip(
17
- fileMap: object,
18
- outputFile: string,
19
- level: number
20
- ): Promise<void>;
21
-
22
- /**
23
- * Compress files using external tool 'zip'
24
- *
25
- * @param inputFolder - folder to archive
26
- * @param outputFile - output slpk file
27
- * @param level - compression level
28
- */
29
- export function compressWithChildProcess(
30
- inputFolder: string,
31
- outputFile: string,
32
- level: number,
33
- sevenZipExe: string
34
- ): Promise<void>;
35
-
36
- /**
37
- * Generate hash file from zip archive
38
- * https://github.com/Esri/i3s-spec/blob/master/docs/1.7/slpk_hashtable.cmn.md
39
- *
40
- * @param inputZipFile
41
- * @param outputFile
42
- */
43
- export function generateHash128FromZip(inputZipFile, outputFile): Promise<void>;
44
-
45
- /**
46
- * Add file to zip archive
47
- *
48
- * @param inputFile
49
- * @param fileName
50
- * @param zipFile
51
- * @param sevenZipExe
52
- */
53
- export function addFileToZip(inputFile, fileName, zipFile, sevenZipExe);
@@ -1,32 +0,0 @@
1
- /**
2
- * Convert LOD metric from "Screen Space Error" to "Screen Threshold"
3
- *
4
- * @param tile - 3d-tiles tile Object
5
- * @param coordinates - node converted coordinates
6
- * @returns An array of LOD metrics in format compatible with i3s 3DNodeIndexDocument.lodSelection
7
- * @example
8
- * [
9
- {
10
- "metricType": "maxScreenThresholdSQ",
11
- "maxError": 870638.071285568
12
- },
13
- {
14
- "metricType": "maxScreenThreshold",
15
- "maxError": 1052.8679031638949
16
- }
17
- ]
18
- */
19
- export function convertGeometricErrorToScreenThreshold(
20
- tile: Object,
21
- coordinates: {
22
- mbs?: number[];
23
- }
24
- ): Array<{metricType: string; maxError: number}>;
25
-
26
- /**
27
- * Convert LOD metric from "Screen Threshold" to "Screen Space Error"
28
- * @param node - i3s node data
29
- * @returns lod metric in 3d-tiles format
30
- * @todo implement this function
31
- */
32
- export function convertScreenThresholdToGeometricError(node: Object): number;
@@ -1,10 +0,0 @@
1
- /**
2
- * Install external dependencies for converter:
3
- * * PGM file (implemented);
4
- * * Draco library (not implemented);
5
- * * 7z archiver (not implemented);
6
- */
7
- export class DepsInstaller {
8
- // Run installation
9
- install(path?: string): Promise<void>;
10
- }
@@ -1,44 +0,0 @@
1
- import {Vector3, Matrix4} from '@math.gl/core';
2
- import {GeoidHeightModel} from '../../lib/geoid-height-model';
3
- /**
4
- * Convert binary data from b3dm file to i3s resources
5
- *
6
- * @param tileContent - 3d tile content
7
- * @param options - converter options
8
- * @returns A promise that resolves to object with `geometry`, compressedGeometry`, `texture` and `sharedResources` appropriate
9
- * for use I3S tiles.
10
- */
11
- export default function convertB3dmToI3sGeometry(
12
- tileContent: {
13
- batchTableJson: {
14
- id: [];
15
- };
16
- cartographicOrigin: Vector3;
17
- cartesianModelMatrix: Matrix4;
18
- gltf: {
19
- scene: {
20
- nodes: [];
21
- };
22
- images: [];
23
- materials: [];
24
- };
25
- },
26
- nodeId: number,
27
- featuresHashArray: any,
28
- attributeStorageInfo: any,
29
- draco: boolean,
30
- generateBoundingVolumes: boolean,
31
- geoidHeightModel: GeoidHeightModel
32
- ): Promise<
33
- {
34
- geometry: ArrayBuffer;
35
- compressedGeometry: ArrayBuffer;
36
- texture: any;
37
- sharedResources: any;
38
- meshMaterial: any;
39
- vertexCount: number;
40
- attributes: any;
41
- featureCount: number;
42
- boundingVolumes: any;
43
- }[]
44
- >;
@@ -1,53 +0,0 @@
1
- /**
2
- * Compress file to gzip file
3
- *
4
- * @param pathFile - the path to the file
5
- * @return the path to the gzip file
6
- */
7
- export function compressFileWithGzip(pathFile: string): Promise<string>;
8
-
9
- /**
10
- * Compress files from map into slpk file
11
- *
12
- * @param fileMap - map with file paths (key: output path, value: input path)
13
- * @param outputFile - output slpk file
14
- * @param level - compression level
15
- */
16
- export function compressFilesWithZip(
17
- fileMap: object,
18
- outputFile: string,
19
- level: number
20
- ): Promise<void>;
21
-
22
- /**
23
- * Compress files using external tool 'zip'
24
- *
25
- * @param inputFolder - folder to archive
26
- * @param outputFile - output slpk file
27
- * @param level - compression level
28
- */
29
- export function compressWithChildProcess(
30
- inputFolder: string,
31
- outputFile: string,
32
- level: number,
33
- sevenZipExe: string
34
- ): Promise<void>;
35
-
36
- /**
37
- * Generate hash file from zip archive
38
- * https://github.com/Esri/i3s-spec/blob/master/docs/1.7/slpk_hashtable.cmn.md
39
- *
40
- * @param inputZipFile
41
- * @param outputFile
42
- */
43
- export function generateHash128FromZip(inputZipFile, outputFile): Promise<void>;
44
-
45
- /**
46
- * Add file to zip archive
47
- *
48
- * @param inputFile
49
- * @param fileName
50
- * @param zipFile
51
- * @param sevenZipExe
52
- */
53
- export function addFileToZip(inputFile, fileName, zipFile, sevenZipExe);
@@ -1,43 +0,0 @@
1
- /**
2
- * Write a file with data and name fileName to path
3
- *
4
- * @param path - output path
5
- * @param data - file content
6
- * @param fileName - name of output file (default: index.json)
7
- */
8
- export function writeFile(path: string, data: string | Uint8Array | ArrayBuffer, fileName?: string);
9
-
10
- /**
11
- * Write a file with data and name fileName to path - specific one for further packaging into slpk
12
- *
13
- * @param path - output path
14
- * @param data - file content
15
- * @param fileName - name of output file (default: index.json)
16
- * @param compress - if need to compress file with gzip (default: true)
17
- */
18
- export function writeFileForSlpk(
19
- path: string,
20
- data: string | Uint8Array | ArrayBuffer,
21
- fileName?: string,
22
- compress?: boolean
23
- );
24
-
25
- /**
26
- * Remove dir with path
27
- *
28
- * @param path
29
- */
30
- export function removeDir(path: string): Promise<void>;
31
-
32
- /**
33
- * Remove file with path
34
- *
35
- * @param path
36
- */
37
- export function removeFile(path: string): Promise<void>;
38
-
39
- /**
40
- * Generates absolute file path
41
- * @param filePath
42
- */
43
- export function getAbsoluteFilePath(filePath: string): string;
@@ -1,38 +0,0 @@
1
- import {promises as fs} from 'fs';
2
- import {isAbsolute, join} from 'path';
3
- import {compressFileWithGzip} from './compress-util';
4
-
5
- export async function writeFile(path, data, fileName = 'index.json') {
6
- await fs.mkdir(path, {recursive: true});
7
- const pathFile = join(path, fileName);
8
- try {
9
- await fs.writeFile(pathFile, data);
10
- } catch (err) {
11
- throw err;
12
- }
13
- console.log(`${pathFile} saved.`); // eslint-disable-line
14
- return pathFile;
15
- }
16
-
17
- export async function writeFileForSlpk(path, data, fileName = 'index.json', compress = true) {
18
- const pathFile = await writeFile(path, data, fileName);
19
- if (compress) {
20
- const pathGzFile = await compressFileWithGzip(pathFile);
21
- // After compression, we don't need an uncompressed file
22
- await removeFile(pathFile);
23
- return pathGzFile;
24
- }
25
- return pathFile;
26
- }
27
-
28
- export function removeDir(path) {
29
- return fs.rmdir(path, {recursive: true});
30
- }
31
-
32
- export function removeFile(path) {
33
- return fs.unlink(path);
34
- }
35
-
36
- export function getAbsoluteFilePath(filePath) {
37
- return isAbsolute(filePath) ? filePath : join(process.cwd(), filePath); // eslint-disable-line no-undef
38
- }
@@ -1,32 +0,0 @@
1
- /**
2
- * Convert LOD metric from "Screen Space Error" to "Screen Threshold"
3
- *
4
- * @param tile - 3d-tiles tile Object
5
- * @param coordinates - node converted coordinates
6
- * @returns An array of LOD metrics in format compatible with i3s 3DNodeIndexDocument.lodSelection
7
- * @example
8
- * [
9
- {
10
- "metricType": "maxScreenThresholdSQ",
11
- "maxError": 870638.071285568
12
- },
13
- {
14
- "metricType": "maxScreenThreshold",
15
- "maxError": 1052.8679031638949
16
- }
17
- ]
18
- */
19
- export function convertGeometricErrorToScreenThreshold(
20
- tile: Object,
21
- coordinates: {
22
- mbs?: number[];
23
- }
24
- ): Array<{metricType: string; maxError: number}>;
25
-
26
- /**
27
- * Convert LOD metric from "Screen Threshold" to "Screen Space Error"
28
- * @param node - i3s node data
29
- * @returns lod metric in 3d-tiles format
30
- * @todo implement this function
31
- */
32
- export function convertScreenThresholdToGeometricError(node: Object): number;