@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.
- package/bin/converter.js +1 -1
- package/dist/3d-tiles-attributes-worker.d.ts +28 -0
- package/dist/3d-tiles-attributes-worker.d.ts.map +1 -0
- package/dist/3d-tiles-attributes-worker.js +3 -0
- package/dist/3d-tiles-attributes-worker.js.map +7 -0
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +13 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.js +274 -233
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts +9 -16
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js +256 -246
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +22 -9
- package/dist/3d-tiles-converter/helpers/texture-atlas.js +47 -28
- package/dist/3d-tiles-converter/json-templates/tileset.js +38 -35
- package/dist/bundle.js +2 -2
- package/dist/constants.d.ts +2 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +4 -0
- package/dist/converter-cli.d.ts +2 -0
- package/dist/converter-cli.d.ts.map +1 -0
- package/dist/converter-cli.js +280 -0
- package/dist/converter.min.js +185 -190
- package/dist/deps-installer/deps-installer.d.ts +11 -3
- package/dist/deps-installer/deps-installer.d.ts.map +1 -1
- package/dist/deps-installer/deps-installer.js +59 -18
- package/dist/dist.min.js +15153 -37895
- package/dist/es5/3d-tiles-attributes-worker.js +25 -0
- package/dist/es5/3d-tiles-attributes-worker.js.map +1 -0
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +467 -0
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -0
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +293 -0
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -0
- package/dist/es5/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +18 -0
- package/dist/es5/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +1 -0
- package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js +33 -0
- package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js.map +1 -0
- package/dist/es5/3d-tiles-converter/json-templates/tileset.js +61 -0
- package/dist/es5/3d-tiles-converter/json-templates/tileset.js.map +1 -0
- package/dist/es5/bundle.js +6 -0
- package/dist/es5/bundle.js.map +1 -0
- package/dist/es5/constants.js +9 -0
- package/dist/es5/constants.js.map +1 -0
- package/dist/es5/converter-cli.js +289 -0
- package/dist/es5/converter-cli.js.map +1 -0
- package/dist/es5/deps-installer/deps-installer.js +123 -0
- package/dist/es5/deps-installer/deps-installer.js.map +1 -0
- package/dist/es5/i3s-attributes-worker.js +25 -0
- package/dist/es5/i3s-attributes-worker.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js +116 -0
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js +90 -0
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/create-scene-server-path.js +41 -0
- package/dist/es5/i3s-converter/helpers/create-scene-server-path.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/feature-attributes.js +174 -0
- package/dist/es5/i3s-converter/helpers/feature-attributes.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js +213 -0
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/geometry-converter.js +1181 -0
- package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js +80 -0
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/node-debug.js +76 -0
- package/dist/es5/i3s-converter/helpers/node-debug.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/node-index-document.js +492 -0
- package/dist/es5/i3s-converter/helpers/node-index-document.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/node-pages.js +519 -0
- package/dist/es5/i3s-converter/helpers/node-pages.js.map +1 -0
- package/dist/es5/i3s-converter/i3s-converter.js +1512 -0
- package/dist/es5/i3s-converter/i3s-converter.js.map +1 -0
- package/dist/es5/i3s-converter/json-templates/geometry-definitions.js +107 -0
- package/dist/es5/i3s-converter/json-templates/geometry-definitions.js.map +1 -0
- package/dist/es5/i3s-converter/json-templates/layers.js +163 -0
- package/dist/es5/i3s-converter/json-templates/layers.js.map +1 -0
- package/dist/es5/i3s-converter/json-templates/metadata.js +31 -0
- package/dist/es5/i3s-converter/json-templates/metadata.js.map +1 -0
- package/dist/es5/i3s-converter/json-templates/node.js +99 -0
- package/dist/es5/i3s-converter/json-templates/node.js.map +1 -0
- package/dist/es5/i3s-converter/json-templates/scene-server.js +39 -0
- package/dist/es5/i3s-converter/json-templates/scene-server.js.map +1 -0
- package/dist/es5/i3s-converter/json-templates/shared-resources.js +173 -0
- package/dist/es5/i3s-converter/json-templates/shared-resources.js.map +1 -0
- package/dist/es5/i3s-converter/json-templates/store.js +107 -0
- package/dist/es5/i3s-converter/json-templates/store.js.map +1 -0
- package/dist/es5/i3s-converter/types.js +2 -0
- package/dist/es5/i3s-converter/types.js.map +1 -0
- package/dist/es5/i3s-server/app.js +18 -0
- package/dist/es5/i3s-server/app.js.map +1 -0
- package/dist/es5/i3s-server/controllers/index-controller.js +55 -0
- package/dist/es5/i3s-server/controllers/index-controller.js.map +1 -0
- package/dist/es5/i3s-server/routes/index.js +37 -0
- package/dist/es5/i3s-server/routes/index.js.map +1 -0
- package/dist/es5/index.js +21 -0
- package/dist/es5/index.js.map +1 -0
- package/dist/es5/lib/utils/compress-util.js +346 -0
- package/dist/es5/lib/utils/compress-util.js.map +1 -0
- package/dist/es5/lib/utils/file-utils.js +208 -0
- package/dist/es5/lib/utils/file-utils.js.map +1 -0
- package/dist/es5/lib/utils/geometry-utils.js +15 -0
- package/dist/es5/lib/utils/geometry-utils.js.map +1 -0
- package/dist/es5/lib/utils/lod-conversion-utils.js +44 -0
- package/dist/es5/lib/utils/lod-conversion-utils.js.map +1 -0
- package/dist/es5/lib/utils/queue.js +47 -0
- package/dist/es5/lib/utils/queue.js.map +1 -0
- package/dist/es5/lib/utils/statistic-utills.d.ts +25 -0
- package/dist/es5/lib/utils/statistic-utills.js +147 -0
- package/dist/es5/lib/utils/statistic-utills.js.map +1 -0
- package/dist/es5/lib/utils/write-queue.js +214 -0
- package/dist/es5/lib/utils/write-queue.js.map +1 -0
- package/dist/es5/pgm-loader.js +41 -0
- package/dist/es5/pgm-loader.js.map +1 -0
- package/dist/es5/workers/3d-tiles-attributes-worker.js +28 -0
- package/dist/es5/workers/3d-tiles-attributes-worker.js.map +1 -0
- package/dist/es5/workers/i3s-attributes-worker.js +30 -0
- package/dist/es5/workers/i3s-attributes-worker.js.map +1 -0
- package/dist/esm/3d-tiles-attributes-worker.js +16 -0
- package/dist/esm/3d-tiles-attributes-worker.js.map +1 -0
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +245 -0
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -0
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js +218 -0
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -0
- package/dist/esm/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +10 -0
- package/dist/esm/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +1 -0
- package/dist/esm/3d-tiles-converter/helpers/texture-atlas.js +27 -0
- package/dist/esm/3d-tiles-converter/helpers/texture-atlas.js.map +1 -0
- package/dist/esm/3d-tiles-converter/json-templates/tileset.js +37 -0
- package/dist/esm/3d-tiles-converter/json-templates/tileset.js.map +1 -0
- package/dist/esm/bundle.js +4 -0
- package/dist/esm/bundle.js.map +1 -0
- package/dist/esm/constants.js +2 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/converter-cli.js +232 -0
- package/dist/esm/converter-cli.js.map +1 -0
- package/dist/esm/deps-installer/deps-installer.js +44 -0
- package/dist/esm/deps-installer/deps-installer.js.map +1 -0
- package/dist/esm/i3s-attributes-worker.js +16 -0
- package/dist/esm/i3s-attributes-worker.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js +105 -0
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js +80 -0
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/create-scene-server-path.js +16 -0
- package/dist/esm/i3s-converter/helpers/create-scene-server-path.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/feature-attributes.js +147 -0
- package/dist/esm/i3s-converter/helpers/feature-attributes.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js +190 -0
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/geometry-converter.js +895 -0
- package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js +73 -0
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/node-debug.js +72 -0
- package/dist/esm/i3s-converter/helpers/node-debug.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/node-index-document.js +188 -0
- package/dist/esm/i3s-converter/helpers/node-index-document.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/node-pages.js +206 -0
- package/dist/esm/i3s-converter/helpers/node-pages.js.map +1 -0
- package/dist/esm/i3s-converter/i3s-converter.js +764 -0
- package/dist/esm/i3s-converter/i3s-converter.js.map +1 -0
- package/dist/esm/i3s-converter/json-templates/geometry-definitions.js +89 -0
- package/dist/esm/i3s-converter/json-templates/geometry-definitions.js.map +1 -0
- package/dist/esm/i3s-converter/json-templates/layers.js +133 -0
- package/dist/esm/i3s-converter/json-templates/layers.js.map +1 -0
- package/dist/esm/i3s-converter/json-templates/metadata.js +22 -0
- package/dist/esm/i3s-converter/json-templates/metadata.js.map +1 -0
- package/dist/esm/i3s-converter/json-templates/node.js +80 -0
- package/dist/esm/i3s-converter/json-templates/node.js.map +1 -0
- package/dist/esm/i3s-converter/json-templates/scene-server.js +28 -0
- package/dist/esm/i3s-converter/json-templates/scene-server.js.map +1 -0
- package/dist/esm/i3s-converter/json-templates/shared-resources.js +123 -0
- package/dist/esm/i3s-converter/json-templates/shared-resources.js.map +1 -0
- package/dist/esm/i3s-converter/json-templates/store.js +98 -0
- package/dist/esm/i3s-converter/json-templates/store.js.map +1 -0
- package/dist/esm/i3s-converter/types.js +2 -0
- package/dist/esm/i3s-converter/types.js.map +1 -0
- package/dist/esm/i3s-server/app.js +16 -0
- package/dist/esm/i3s-server/app.js.map +1 -0
- package/dist/esm/i3s-server/bin/www +102 -0
- package/dist/esm/i3s-server/certs/cert.pem +19 -0
- package/dist/esm/i3s-server/certs/key.pem +27 -0
- package/dist/esm/i3s-server/controllers/index-controller.js +24 -0
- package/dist/esm/i3s-server/controllers/index-controller.js.map +1 -0
- package/dist/esm/i3s-server/routes/index.js +16 -0
- package/dist/esm/i3s-server/routes/index.js.map +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/lib/utils/compress-util.js +168 -0
- package/dist/esm/lib/utils/compress-util.js.map +1 -0
- package/dist/esm/lib/utils/file-utils.js +87 -0
- package/dist/esm/lib/utils/file-utils.js.map +1 -0
- package/dist/esm/lib/utils/geometry-utils.js +8 -0
- package/dist/esm/lib/utils/geometry-utils.js.map +1 -0
- package/dist/esm/lib/utils/lod-conversion-utils.js +37 -0
- package/dist/esm/lib/utils/lod-conversion-utils.js.map +1 -0
- package/dist/esm/lib/utils/queue.js +15 -0
- package/dist/esm/lib/utils/queue.js.map +1 -0
- package/dist/esm/lib/utils/statistic-utills.d.ts +25 -0
- package/dist/esm/lib/utils/statistic-utills.js +62 -0
- package/dist/esm/lib/utils/statistic-utills.js.map +1 -0
- package/dist/esm/lib/utils/write-queue.js +85 -0
- package/dist/esm/lib/utils/write-queue.js.map +1 -0
- package/dist/esm/pgm-loader.js +15 -0
- package/dist/esm/pgm-loader.js.map +1 -0
- package/dist/esm/workers/3d-tiles-attributes-worker.js +8 -0
- package/dist/esm/workers/3d-tiles-attributes-worker.js.map +1 -0
- package/dist/esm/workers/i3s-attributes-worker.js +7 -0
- package/dist/esm/workers/i3s-attributes-worker.js.map +1 -0
- package/dist/i3s-attributes-worker.d.ts +45 -0
- package/dist/i3s-attributes-worker.d.ts.map +1 -0
- package/dist/i3s-attributes-worker.js +9 -0
- package/dist/i3s-attributes-worker.js.map +7 -0
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +13 -0
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/batch-ids-extensions.js +141 -0
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts +9 -9
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/coordinate-converter.js +118 -72
- package/dist/i3s-converter/helpers/create-scene-server-path.d.ts +5 -5
- package/dist/i3s-converter/helpers/create-scene-server-path.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/create-scene-server-path.js +27 -15
- package/dist/i3s-converter/helpers/feature-attributes.d.ts +56 -0
- package/dist/i3s-converter/helpers/feature-attributes.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/feature-attributes.js +216 -0
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts +4 -19
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-attributes.js +188 -185
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +36 -39
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.js +1150 -689
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts +9 -0
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/gltf-attributes.js +85 -0
- package/dist/i3s-converter/helpers/node-debug.d.ts +7 -1
- package/dist/i3s-converter/helpers/node-debug.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-debug.js +106 -72
- package/dist/i3s-converter/helpers/node-index-document.d.ts +95 -0
- package/dist/i3s-converter/helpers/node-index-document.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/node-index-document.js +250 -0
- package/dist/i3s-converter/helpers/node-pages.d.ts +81 -41
- package/dist/i3s-converter/helpers/node-pages.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-pages.js +313 -144
- package/dist/i3s-converter/i3s-converter.d.ts +60 -113
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +858 -951
- package/dist/i3s-converter/json-templates/geometry-definitions.d.ts +7 -0
- package/dist/i3s-converter/json-templates/geometry-definitions.d.ts.map +1 -0
- package/dist/i3s-converter/json-templates/geometry-definitions.js +87 -0
- package/dist/i3s-converter/json-templates/layers.d.ts +5 -30
- package/dist/i3s-converter/json-templates/layers.d.ts.map +1 -1
- package/dist/i3s-converter/json-templates/layers.js +132 -194
- package/dist/i3s-converter/json-templates/metadata.js +24 -21
- package/dist/i3s-converter/json-templates/node.js +82 -77
- package/dist/i3s-converter/json-templates/scene-server.js +30 -27
- package/dist/i3s-converter/json-templates/shared-resources.js +116 -122
- package/dist/i3s-converter/json-templates/store.js +100 -95
- package/dist/i3s-converter/types.d.ts +137 -6
- package/dist/i3s-converter/types.d.ts.map +1 -1
- package/dist/i3s-converter/types.js +2 -2
- package/dist/i3s-server/app.js +2 -9
- package/dist/i3s-server/controllers/index-controller.js +16 -24
- package/dist/i3s-server/routes/index.js +11 -15
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -5
- package/dist/lib/utils/compress-util.d.ts +12 -20
- package/dist/lib/utils/compress-util.d.ts.map +1 -1
- package/dist/lib/utils/compress-util.js +238 -160
- package/dist/lib/utils/file-utils.d.ts +22 -14
- package/dist/lib/utils/file-utils.d.ts.map +1 -1
- package/dist/lib/utils/file-utils.js +133 -36
- package/dist/lib/utils/geometry-utils.d.ts +9 -0
- package/dist/lib/utils/geometry-utils.d.ts.map +1 -0
- package/dist/lib/utils/geometry-utils.js +18 -0
- package/dist/lib/utils/lod-conversion-utils.d.ts +21 -12
- package/dist/lib/utils/lod-conversion-utils.d.ts.map +1 -1
- package/dist/lib/utils/lod-conversion-utils.js +72 -39
- package/dist/lib/utils/queue.d.ts +7 -0
- package/dist/lib/utils/queue.d.ts.map +1 -0
- package/dist/lib/utils/queue.js +18 -0
- package/dist/lib/utils/statistic-utills.d.ts +3 -25
- package/dist/lib/utils/statistic-utills.d.ts.map +1 -1
- package/dist/lib/utils/statistic-utills.js +58 -67
- package/dist/lib/utils/write-queue.d.ts +39 -0
- package/dist/lib/utils/write-queue.d.ts.map +1 -0
- package/dist/lib/utils/write-queue.js +80 -0
- package/dist/pgm-loader.d.ts.map +1 -1
- package/dist/pgm-loader.js +23 -14
- package/dist/workers/3d-tiles-attributes-worker.d.ts +2 -0
- package/dist/workers/3d-tiles-attributes-worker.d.ts.map +1 -0
- package/dist/workers/3d-tiles-attributes-worker.js +9 -0
- package/dist/workers/i3s-attributes-worker.d.ts +2 -0
- package/dist/workers/i3s-attributes-worker.d.ts.map +1 -0
- package/dist/workers/i3s-attributes-worker.js +5 -0
- package/package.json +32 -24
- package/src/3d-tiles-attributes-worker.ts +43 -0
- package/src/3d-tiles-converter/3d-tiles-converter.ts +102 -40
- package/src/3d-tiles-converter/helpers/b3dm-converter.ts +39 -44
- package/src/constants.ts +2 -0
- package/src/converter-cli.ts +370 -0
- package/src/deps-installer/deps-installer.ts +71 -0
- package/src/i3s-attributes-worker.ts +59 -0
- package/src/i3s-converter/helpers/batch-ids-extensions.ts +205 -0
- package/src/i3s-converter/helpers/coordinate-converter.ts +33 -26
- package/src/i3s-converter/helpers/create-scene-server-path.ts +9 -5
- package/src/i3s-converter/helpers/feature-attributes.ts +247 -0
- package/src/i3s-converter/helpers/geometry-attributes.ts +98 -47
- package/src/i3s-converter/helpers/geometry-converter.ts +1635 -0
- package/src/i3s-converter/helpers/gltf-attributes.ts +100 -0
- package/src/i3s-converter/helpers/node-debug.ts +68 -16
- package/src/i3s-converter/helpers/node-index-document.ts +315 -0
- package/src/i3s-converter/helpers/node-pages.ts +222 -101
- package/src/i3s-converter/i3s-converter.ts +408 -555
- package/src/i3s-converter/json-templates/geometry-definitions.ts +83 -0
- package/src/i3s-converter/json-templates/layers.ts +27 -91
- package/src/i3s-converter/json-templates/shared-resources.ts +3 -3
- package/src/i3s-converter/types.ts +156 -5
- package/src/index.ts +0 -4
- package/src/lib/utils/{compress-util.js → compress-util.ts} +105 -18
- package/src/lib/utils/file-utils.ts +139 -0
- package/src/lib/utils/geometry-utils.ts +14 -0
- package/src/lib/utils/{lod-conversion-utils.js → lod-conversion-utils.ts} +27 -5
- package/src/lib/utils/queue.ts +17 -0
- package/src/lib/utils/write-queue.ts +110 -0
- package/src/pgm-loader.ts +2 -2
- package/src/workers/3d-tiles-attributes-worker.ts +6 -0
- package/src/workers/i3s-attributes-worker.ts +7 -0
- package/dist/3d-tiles-converter/3d-tiles-converter.js.map +0 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js.map +0 -1
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +0 -1
- package/dist/3d-tiles-converter/helpers/texture-atlas.js.map +0 -1
- package/dist/3d-tiles-converter/json-templates/tileset.js.map +0 -1
- package/dist/bundle.js.map +0 -1
- package/dist/deps-installer/deps-installer.js.map +0 -1
- package/dist/i3s-converter/helpers/coordinate-converter.js.map +0 -1
- package/dist/i3s-converter/helpers/create-scene-server-path.js.map +0 -1
- package/dist/i3s-converter/helpers/geometry-attributes.js.map +0 -1
- package/dist/i3s-converter/helpers/geometry-converter.js.map +0 -1
- package/dist/i3s-converter/helpers/node-debug.js.map +0 -1
- package/dist/i3s-converter/helpers/node-pages.js.map +0 -1
- package/dist/i3s-converter/i3s-converter.js.map +0 -1
- package/dist/i3s-converter/json-templates/layers.js.map +0 -1
- package/dist/i3s-converter/json-templates/metadata.js.map +0 -1
- package/dist/i3s-converter/json-templates/node.js.map +0 -1
- package/dist/i3s-converter/json-templates/scene-server.js.map +0 -1
- package/dist/i3s-converter/json-templates/shared-resources.js.map +0 -1
- package/dist/i3s-converter/json-templates/store.js.map +0 -1
- package/dist/i3s-converter/types.js.map +0 -1
- package/dist/i3s-server/app.js.map +0 -1
- package/dist/i3s-server/controllers/index-controller.js.map +0 -1
- package/dist/i3s-server/routes/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/utils/compress-util.js.map +0 -1
- package/dist/lib/utils/file-utils.js.map +0 -1
- package/dist/lib/utils/lod-conversion-utils.js.map +0 -1
- package/dist/lib/utils/statistic-utills.js.map +0 -1
- package/dist/pgm-loader.js.map +0 -1
- package/src/deps-installer/deps-installer.d.ts +0 -10
- package/src/deps-installer/deps-installer.js +0 -22
- package/src/i3s-converter/helpers/geometry-converter.d.ts +0 -44
- package/src/i3s-converter/helpers/geometry-converter.js +0 -992
- package/src/lib/utils/compress-util.d.ts +0 -53
- package/src/lib/utils/file-utils.d.ts +0 -43
- package/src/lib/utils/file-utils.js +0 -38
- package/src/lib/utils/lod-conversion-utils.d.ts +0 -32
- /package/dist/{i3s-server → es5/i3s-server}/bin/www +0 -0
- /package/dist/{i3s-server → es5/i3s-server}/certs/cert.pem +0 -0
- /package/dist/{i3s-server → es5/i3s-server}/certs/key.pem +0 -0
- /package/src/lib/utils/{statistic-utills.js → statistic-utills.ts} +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { NodeInPage } from '@loaders.gl/i3s';
|
|
2
|
+
import I3SConverter from '../i3s-converter';
|
|
2
3
|
/**
|
|
3
4
|
* class NodePages - wrapper of nodePages array
|
|
4
5
|
*
|
|
@@ -9,7 +10,7 @@ import { NodeInPage } from '@loaders.gl/i3s';
|
|
|
9
10
|
* const nodePages = new NodePages(writeFile, HARDCODED_NODES_PER_PAGE);
|
|
10
11
|
* ...
|
|
11
12
|
* // push root node
|
|
12
|
-
* const
|
|
13
|
+
* const parent = await nodePages.push({
|
|
13
14
|
lodThreshold: HARDCODED_MAX_SCREEN_THRESHOLD_SQ,
|
|
14
15
|
obb: coordinates.obb,
|
|
15
16
|
children: []
|
|
@@ -26,7 +27,7 @@ import { NodeInPage } from '@loaders.gl/i3s';
|
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
};
|
|
29
|
-
* const
|
|
30
|
+
* const node = await this.nodePages.push(nodeInPage, parent.index);
|
|
30
31
|
* ...
|
|
31
32
|
* // save all the nodePages in the end of pushing all the nodes
|
|
32
33
|
* await this.nodePages.save(layers0path);
|
|
@@ -34,83 +35,122 @@ import { NodeInPage } from '@loaders.gl/i3s';
|
|
|
34
35
|
export default class NodePages {
|
|
35
36
|
readonly nodesPerPage: number;
|
|
36
37
|
nodesCounter: number;
|
|
37
|
-
writeFile:
|
|
38
|
+
writeFile: (...args: any[]) => Promise<null | string>;
|
|
39
|
+
converter: I3SConverter;
|
|
38
40
|
readonly nodePages: {
|
|
39
41
|
nodes: NodeInPage[];
|
|
40
42
|
}[];
|
|
43
|
+
readonly length: number;
|
|
41
44
|
/**
|
|
42
45
|
* @constructs
|
|
43
46
|
* Create a nodePages instance.
|
|
44
47
|
* @param writeFileFunc - function to save one nodePage into a file
|
|
45
48
|
* @param nodesPerPage - length limit for one nodePage. An additional nodePage is created when this limit is met
|
|
46
49
|
*/
|
|
47
|
-
constructor(writeFileFunc: any, nodesPerPage: any);
|
|
50
|
+
constructor(writeFileFunc: any, nodesPerPage: any, converter: I3SConverter);
|
|
48
51
|
/**
|
|
49
52
|
* Setup function to save node pages
|
|
50
53
|
* @param func - function which should be used to save node pages
|
|
51
54
|
*/
|
|
52
|
-
useWriteFunction(func:
|
|
55
|
+
useWriteFunction(func: (...args: any[]) => Promise<null | string>): void;
|
|
53
56
|
/**
|
|
54
|
-
* Get the node
|
|
55
|
-
* @param
|
|
56
|
-
* @
|
|
57
|
+
* Get file path and file name of the node page with the particular id
|
|
58
|
+
* @param nodePageId - node page id
|
|
59
|
+
* @returns file path and file name
|
|
57
60
|
*/
|
|
58
|
-
|
|
61
|
+
private getNodePageFileName;
|
|
59
62
|
/**
|
|
60
|
-
*
|
|
61
|
-
* @param
|
|
62
|
-
* @
|
|
63
|
+
* Load node page from a file on the disk
|
|
64
|
+
* @param nodePageId - node page id
|
|
65
|
+
* @returns - node page data
|
|
63
66
|
*/
|
|
64
|
-
|
|
67
|
+
private loadNodePage;
|
|
65
68
|
/**
|
|
66
|
-
*
|
|
67
|
-
* @param id
|
|
68
|
-
* @
|
|
69
|
+
* Get nodepage id by node id
|
|
70
|
+
* @param id node id
|
|
71
|
+
* @returns node page id
|
|
69
72
|
*/
|
|
70
|
-
|
|
73
|
+
private getPageIndexByNodeId;
|
|
71
74
|
/**
|
|
72
|
-
*
|
|
73
|
-
* @param id
|
|
74
|
-
|
|
75
|
-
updateNodeAttributeByNodeId(id: number): void;
|
|
76
|
-
/**
|
|
77
|
-
* Update featureCount in node.mesh.geometry object by node id
|
|
78
|
-
* @param id - end-to-end index of the node
|
|
79
|
-
* @param featureCount - features count of the node
|
|
75
|
+
* Get node page data by node id
|
|
76
|
+
* @param id node id
|
|
77
|
+
* @returns node page data
|
|
80
78
|
*/
|
|
81
|
-
|
|
79
|
+
private getPageByNodeId;
|
|
82
80
|
/**
|
|
83
|
-
*
|
|
81
|
+
* Get the node by its end-to-end index
|
|
84
82
|
* @param id - end-to-end index of the node
|
|
85
|
-
* @
|
|
83
|
+
* @return the node object
|
|
86
84
|
*/
|
|
87
|
-
|
|
85
|
+
getNodeById(id: number, nodePage?: {
|
|
86
|
+
nodes: NodeInPage[];
|
|
87
|
+
}): Promise<NodeInPage>;
|
|
88
88
|
/**
|
|
89
89
|
* Add a child id into the parent node.children array
|
|
90
90
|
* @param parentId - end-to-end parent node index
|
|
91
91
|
* @param childId - end-to-end child node index
|
|
92
92
|
*/
|
|
93
|
-
addChildRelation
|
|
94
|
-
/**
|
|
95
|
-
* Update resource index in node.mesh object
|
|
96
|
-
* @param node - node object
|
|
97
|
-
*/
|
|
98
|
-
updateResourceInMesh(node: NodeInPage): void;
|
|
93
|
+
private addChildRelation;
|
|
99
94
|
/**
|
|
100
95
|
* Put new node in nodePages array
|
|
101
96
|
* @param node - node object
|
|
102
97
|
* @param parentId - index of parent node
|
|
103
98
|
* @return
|
|
104
99
|
*/
|
|
105
|
-
push(node: NodeInPage, parentId?: number):
|
|
100
|
+
push(node: NodeInPage, parentId?: number): Promise<NodeInPage>;
|
|
101
|
+
/**
|
|
102
|
+
* Save node to the file on the disk
|
|
103
|
+
* @param node - node data
|
|
104
|
+
*/
|
|
105
|
+
saveNode(node: NodeInPage): Promise<void>;
|
|
106
|
+
/**
|
|
107
|
+
* Save metadata file (for slpk only)
|
|
108
|
+
*/
|
|
109
|
+
saveMetadata(): Promise<void>;
|
|
106
110
|
/**
|
|
107
111
|
* Save all the node pages
|
|
108
112
|
* Run this method when all nodes is pushed in nodePages
|
|
109
|
-
* @param {string} layers0Path - path of layer
|
|
110
|
-
* @param {Object} fileMap - fileMap which keep info for slpk archive
|
|
111
|
-
* @param {boolean} slpk
|
|
112
|
-
* @return {promise}
|
|
113
113
|
*/
|
|
114
|
-
save(
|
|
114
|
+
save(): Promise<void>;
|
|
115
|
+
/**
|
|
116
|
+
* Update resource index in node.mesh object
|
|
117
|
+
* @param node - node object
|
|
118
|
+
*/
|
|
119
|
+
static updateResourceInMesh(node: NodeInPage): void;
|
|
120
|
+
/**
|
|
121
|
+
* Update all fields in the node excluding id
|
|
122
|
+
* @param node - node object
|
|
123
|
+
* @param data - NodeInPage data to replace original data
|
|
124
|
+
*/
|
|
125
|
+
static updateAll(node: NodeInPage, data: NodeInPage): NodeInPage;
|
|
126
|
+
/**
|
|
127
|
+
* Update material in node.mesh object by node id
|
|
128
|
+
* @param id - end-to-end index of the node
|
|
129
|
+
* @param materialId - id from scene layer materialDefinitions
|
|
130
|
+
*/
|
|
131
|
+
static updateMaterialByNodeId(node: NodeInPage, materialId: number): void;
|
|
132
|
+
/**
|
|
133
|
+
* Update vertexCount in node.mesh.geometry object by node id
|
|
134
|
+
* @param id - end-to-end index of the node
|
|
135
|
+
* @param vertexCount - vertex count for particular node
|
|
136
|
+
*/
|
|
137
|
+
static updateVertexCountByNodeId(node: NodeInPage, vertexCount: number): void;
|
|
138
|
+
/**
|
|
139
|
+
* Update resource in node.mesh.attribute object by node id
|
|
140
|
+
* @param node - node object
|
|
141
|
+
*/
|
|
142
|
+
static updateNodeAttributeByNodeId(node: NodeInPage): void;
|
|
143
|
+
/**
|
|
144
|
+
* Update featureCount in node.mesh.geometry object by node id
|
|
145
|
+
* @param node - node object
|
|
146
|
+
* @param featureCount - features count of the node
|
|
147
|
+
*/
|
|
148
|
+
static updateFeatureCountByNodeId(node: NodeInPage, featureCount: number): void;
|
|
149
|
+
/**
|
|
150
|
+
* Update texelCountHint in node.mesh.material object by node id
|
|
151
|
+
* @param node - node object
|
|
152
|
+
* @param texelCountHint - texelCountHint of particular node
|
|
153
|
+
*/
|
|
154
|
+
static updateTexelCountHintByNodeId(node: NodeInPage, texelCountHint: number): void;
|
|
115
155
|
}
|
|
116
156
|
//# sourceMappingURL=node-pages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-pages.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/node-pages.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"node-pages.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/node-pages.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAE3C,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,CAAC,OAAO,OAAO,SAAS;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,CAAC,GAAG,IAAI,OAAA,KAAK,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IAC/C,SAAS,EAAE,YAAY,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE;QAAC,KAAK,EAAE,UAAU,EAAE,CAAA;KAAC,EAAE,CAAC;IAC5C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAK;IAE5B;;;;;OAKG;gBACS,aAAa,KAAA,EAAE,YAAY,KAAA,EAAE,SAAS,EAAE,YAAY;IAWhE;;;OAGG;IACH,gBAAgB,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,OAAA,KAAK,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,GAAG,IAAI;IAIjE;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAa3B;;;;OAIG;YACW,YAAY;IAW1B;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAI5B;;;;OAIG;YACW,eAAe;IAQ7B;;;;OAIG;IACG,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE;QAAC,KAAK,EAAE,UAAU,EAAE,CAAA;KAAC,GAAG,OAAO,CAAC,UAAU,CAAC;IAMpF;;;;OAIG;YACW,gBAAgB;IAS9B;;;;;OAKG;IACG,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAgBpE;;;OAGG;IACG,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAkC/C;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAenC;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA0B3B;;;OAGG;IACH,MAAM,CAAC,oBAAoB,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAMnD;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,GAAG,UAAU;IAMhE;;;;OAIG;IACH,MAAM,CAAC,sBAAsB,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAUzE;;;;OAIG;IACH,MAAM,CAAC,yBAAyB,CAAC,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;IAO7E;;;OAGG;IACH,MAAM,CAAC,2BAA2B,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAO1D;;;;OAIG;IACH,MAAM,CAAC,0BAA0B,CAAC,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI;IAO/E;;;;OAIG;IACH,MAAM,CAAC,4BAA4B,CAAC,IAAI,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,GAAG,IAAI;CAMpF"}
|
|
@@ -1,147 +1,316 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (!node.mesh) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
node.mesh.material = {
|
|
40
|
-
definition: materialId,
|
|
41
|
-
resource: node.index
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
updateVertexCountByNodeId(id, vertexCount) {
|
|
46
|
-
const node = this.getNodeById(id);
|
|
47
|
-
|
|
48
|
-
if (!node.mesh) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
node.mesh.geometry.vertexCount = vertexCount;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
updateNodeAttributeByNodeId(id) {
|
|
56
|
-
const node = this.getNodeById(id);
|
|
57
|
-
|
|
58
|
-
if (!node.mesh) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
node.mesh.attribute.resource = node.index;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
updateFeatureCountByNodeId(id, featureCount) {
|
|
66
|
-
const node = this.getNodeById(id);
|
|
67
|
-
|
|
68
|
-
if (!node.mesh) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
node.mesh.geometry.featureCount = featureCount;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
updateTexelCountHintByNodeId(id, texelCountHint) {
|
|
76
|
-
const node = this.getNodeById(id);
|
|
77
|
-
|
|
78
|
-
if (!node.mesh || !node.mesh.material) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
node.mesh.material.texelCountHint = texelCountHint;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
addChildRelation(parentId, childId) {
|
|
86
|
-
var _parentNode$children;
|
|
87
|
-
|
|
88
|
-
if (parentId === null || parentId === undefined) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const parentNode = this.getNodeById(parentId);
|
|
93
|
-
(_parentNode$children = parentNode.children) === null || _parentNode$children === void 0 ? void 0 : _parentNode$children.push(childId);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
updateResourceInMesh(node) {
|
|
97
|
-
if (node.mesh) {
|
|
98
|
-
node.mesh.geometry.resource = node.index;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
push(node, parentId) {
|
|
103
|
-
let currentNodePage = this.nodePages[this.nodePages.length - 1];
|
|
104
|
-
|
|
105
|
-
if (currentNodePage.nodes.length === this.nodesPerPage) {
|
|
106
|
-
currentNodePage = {
|
|
107
|
-
nodes: []
|
|
108
|
-
};
|
|
109
|
-
this.nodePages.push(currentNodePage);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
node.index = this.nodesCounter++;
|
|
113
|
-
currentNodePage.nodes.push(node);
|
|
114
|
-
this.addChildRelation(parentId, node.index);
|
|
115
|
-
this.updateResourceInMesh(node);
|
|
116
|
-
return node.index;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
async save(layers0Path, fileMap, slpk = false) {
|
|
120
|
-
const promises = [];
|
|
121
|
-
|
|
122
|
-
if (slpk) {
|
|
123
|
-
for (const [index, nodePage] of this.nodePages.entries()) {
|
|
124
|
-
const nodePageStr = JSON.stringify(nodePage);
|
|
125
|
-
const slpkPath = join(layers0Path, 'nodepages');
|
|
126
|
-
promises.push(this.writeFile(slpkPath, nodePageStr, "".concat(index.toString(), ".json")));
|
|
127
|
-
fileMap["nodePages/".concat(index.toString(), ".json.gz")] = "".concat(slpkPath, ".json.gz");
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
const metadata = transform({
|
|
131
|
-
nodeCount: this.nodesCounter
|
|
132
|
-
}, metadataTemplate());
|
|
133
|
-
const compress = false;
|
|
134
|
-
fileMap['metadata.json'] = await this.writeFile(layers0Path, JSON.stringify(metadata), 'metadata.json', compress);
|
|
135
|
-
} else {
|
|
136
|
-
for (const [index, nodePage] of this.nodePages.entries()) {
|
|
137
|
-
const nodePageStr = JSON.stringify(nodePage);
|
|
138
|
-
const nodePagePath = join(layers0Path, 'nodepages', index.toString());
|
|
139
|
-
promises.push(this.writeFile(nodePagePath, nodePageStr));
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const json_map_transform_1 = __importDefault(require("json-map-transform"));
|
|
8
|
+
const metadata_1 = require("../json-templates/metadata");
|
|
9
|
+
const file_utils_1 = require("../../lib/utils/file-utils");
|
|
10
|
+
/**
|
|
11
|
+
* class NodePages - wrapper of nodePages array
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* import {writeFile} from './helpers/write-file.js';
|
|
15
|
+
*
|
|
16
|
+
* // create an instance of the class
|
|
17
|
+
* const nodePages = new NodePages(writeFile, HARDCODED_NODES_PER_PAGE);
|
|
18
|
+
* ...
|
|
19
|
+
* // push root node
|
|
20
|
+
* const parent = await nodePages.push({
|
|
21
|
+
lodThreshold: HARDCODED_MAX_SCREEN_THRESHOLD_SQ,
|
|
22
|
+
obb: coordinates.obb,
|
|
23
|
+
children: []
|
|
24
|
+
});
|
|
25
|
+
* ...
|
|
26
|
+
* // push node with parent relation
|
|
27
|
+
* const nodeInPage = {
|
|
28
|
+
lodThreshold: HARDCODED_MAX_SCREEN_THRESHOLD_SQ,
|
|
29
|
+
obb: coordinates.obb,
|
|
30
|
+
children: [],
|
|
31
|
+
mesh: {
|
|
32
|
+
geometry: {
|
|
33
|
+
definition: 0
|
|
34
|
+
}
|
|
140
35
|
}
|
|
36
|
+
};
|
|
37
|
+
* const node = await this.nodePages.push(nodeInPage, parent.index);
|
|
38
|
+
* ...
|
|
39
|
+
* // save all the nodePages in the end of pushing all the nodes
|
|
40
|
+
* await this.nodePages.save(layers0path);
|
|
41
|
+
*/
|
|
42
|
+
class NodePages {
|
|
43
|
+
/**
|
|
44
|
+
* @constructs
|
|
45
|
+
* Create a nodePages instance.
|
|
46
|
+
* @param writeFileFunc - function to save one nodePage into a file
|
|
47
|
+
* @param nodesPerPage - length limit for one nodePage. An additional nodePage is created when this limit is met
|
|
48
|
+
*/
|
|
49
|
+
constructor(writeFileFunc, nodesPerPage, converter) {
|
|
50
|
+
this.length = 0;
|
|
51
|
+
this.nodesPerPage = nodesPerPage;
|
|
52
|
+
this.nodesCounter = 0;
|
|
53
|
+
// @ts-expect-error
|
|
54
|
+
this.nodePages = [{}];
|
|
55
|
+
this.nodePages[0].nodes = [];
|
|
56
|
+
this.writeFile = writeFileFunc;
|
|
57
|
+
this.converter = converter;
|
|
58
|
+
this.length = 0;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Setup function to save node pages
|
|
62
|
+
* @param func - function which should be used to save node pages
|
|
63
|
+
*/
|
|
64
|
+
useWriteFunction(func) {
|
|
65
|
+
this.writeFile = func;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Get file path and file name of the node page with the particular id
|
|
69
|
+
* @param nodePageId - node page id
|
|
70
|
+
* @returns file path and file name
|
|
71
|
+
*/
|
|
72
|
+
getNodePageFileName(nodePageId) {
|
|
73
|
+
let filePath;
|
|
74
|
+
let fileName;
|
|
75
|
+
if (this.converter.options.slpk) {
|
|
76
|
+
filePath = (0, path_1.join)(this.converter.layers0Path, 'nodepages');
|
|
77
|
+
fileName = `${nodePageId.toString()}.json`;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
filePath = (0, path_1.join)(this.converter.layers0Path, 'nodepages', nodePageId.toString());
|
|
81
|
+
fileName = 'index.json';
|
|
82
|
+
}
|
|
83
|
+
return { filePath, fileName };
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Load node page from a file on the disk
|
|
87
|
+
* @param nodePageId - node page id
|
|
88
|
+
* @returns - node page data
|
|
89
|
+
*/
|
|
90
|
+
async loadNodePage(nodePageId) {
|
|
91
|
+
const { filePath, fileName } = this.getNodePageFileName(nodePageId);
|
|
92
|
+
const fullName = (0, path_1.join)(filePath, fileName);
|
|
93
|
+
if (await (0, file_utils_1.isFileExists)(fullName)) {
|
|
94
|
+
console.log(`load ${fullName}.`); // eslint-disable-line
|
|
95
|
+
return (await (0, file_utils_1.openJson)(filePath, fileName));
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
return { nodes: [] };
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Get nodepage id by node id
|
|
103
|
+
* @param id node id
|
|
104
|
+
* @returns node page id
|
|
105
|
+
*/
|
|
106
|
+
getPageIndexByNodeId(id) {
|
|
107
|
+
return Math.floor(id / this.nodesPerPage);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Get node page data by node id
|
|
111
|
+
* @param id node id
|
|
112
|
+
* @returns node page data
|
|
113
|
+
*/
|
|
114
|
+
async getPageByNodeId(id) {
|
|
115
|
+
const pageIndex = this.getPageIndexByNodeId(id);
|
|
116
|
+
if (this.converter.options.instantNodeWriting) {
|
|
117
|
+
return await this.loadNodePage(pageIndex);
|
|
118
|
+
}
|
|
119
|
+
return this.nodePages[pageIndex];
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Get the node by its end-to-end index
|
|
123
|
+
* @param id - end-to-end index of the node
|
|
124
|
+
* @return the node object
|
|
125
|
+
*/
|
|
126
|
+
async getNodeById(id, nodePage) {
|
|
127
|
+
const nodeIndex = id % this.nodesPerPage;
|
|
128
|
+
nodePage = nodePage || (await this.getPageByNodeId(id));
|
|
129
|
+
return nodePage.nodes[nodeIndex];
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Add a child id into the parent node.children array
|
|
133
|
+
* @param parentId - end-to-end parent node index
|
|
134
|
+
* @param childId - end-to-end child node index
|
|
135
|
+
*/
|
|
136
|
+
async addChildRelation(parentId, childId) {
|
|
137
|
+
if (parentId === null || parentId === undefined) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const parentNode = await this.getNodeById(parentId);
|
|
141
|
+
parentNode.children?.push(childId);
|
|
142
|
+
await this.saveNode(parentNode);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Put new node in nodePages array
|
|
146
|
+
* @param node - node object
|
|
147
|
+
* @param parentId - index of parent node
|
|
148
|
+
* @return
|
|
149
|
+
*/
|
|
150
|
+
async push(node, parentId) {
|
|
151
|
+
node.index = this.nodesCounter++;
|
|
152
|
+
if (!this.converter.options.instantNodeWriting) {
|
|
153
|
+
let currentNodePage = this.nodePages[this.nodePages.length - 1];
|
|
154
|
+
if (currentNodePage.nodes.length === this.nodesPerPage) {
|
|
155
|
+
currentNodePage = { nodes: [] };
|
|
156
|
+
this.nodePages.push(currentNodePage);
|
|
157
|
+
}
|
|
158
|
+
currentNodePage.nodes.push(node);
|
|
159
|
+
}
|
|
160
|
+
await this.addChildRelation(parentId, node.index);
|
|
161
|
+
NodePages.updateResourceInMesh(node);
|
|
162
|
+
await this.saveNode(node);
|
|
163
|
+
return node;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Save node to the file on the disk
|
|
167
|
+
* @param node - node data
|
|
168
|
+
*/
|
|
169
|
+
async saveNode(node) {
|
|
170
|
+
if (!this.converter.options.instantNodeWriting) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
const nodePageIndex = this.getPageIndexByNodeId(node.index);
|
|
175
|
+
const nodePage = await this.getPageByNodeId(node.index);
|
|
176
|
+
const { filePath, fileName } = this.getNodePageFileName(nodePageIndex);
|
|
177
|
+
const nodeToUpdate = await this.getNodeById(node.index, nodePage);
|
|
178
|
+
if (nodeToUpdate) {
|
|
179
|
+
NodePages.updateAll(nodeToUpdate, node);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
nodePage.nodes.push(node);
|
|
183
|
+
}
|
|
184
|
+
const nodePageStr = JSON.stringify(nodePage);
|
|
185
|
+
if (this.converter.options.slpk) {
|
|
186
|
+
await this.converter.writeQueue.enqueue({
|
|
187
|
+
archiveKey: `nodePages/${nodePageIndex.toString()}.json.gz`,
|
|
188
|
+
writePromise: () => this.writeFile(filePath, nodePageStr, fileName, true, this.converter.compressList)
|
|
189
|
+
}, true);
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
await this.converter.writeQueue.enqueue({
|
|
193
|
+
writePromise: () => this.writeFile(filePath, nodePageStr)
|
|
194
|
+
}, true);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Save metadata file (for slpk only)
|
|
200
|
+
*/
|
|
201
|
+
async saveMetadata() {
|
|
202
|
+
const metadata = (0, json_map_transform_1.default)({ nodeCount: this.nodesCounter }, (0, metadata_1.METADATA)());
|
|
203
|
+
const compress = false;
|
|
204
|
+
await this.converter.writeQueue.enqueue({
|
|
205
|
+
archiveKey: 'metadata.json',
|
|
206
|
+
writePromise: () => this.writeFile(this.converter.layers0Path, JSON.stringify(metadata), 'metadata.json', compress)
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Save all the node pages
|
|
211
|
+
* Run this method when all nodes is pushed in nodePages
|
|
212
|
+
*/
|
|
213
|
+
async save() {
|
|
214
|
+
if (this.converter.options.instantNodeWriting) {
|
|
215
|
+
await this.saveMetadata();
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
if (this.converter.options.slpk) {
|
|
219
|
+
for (const [index, nodePage] of this.nodePages.entries()) {
|
|
220
|
+
const nodePageStr = JSON.stringify(nodePage);
|
|
221
|
+
const slpkPath = (0, path_1.join)(this.converter.layers0Path, 'nodepages');
|
|
222
|
+
await this.converter.writeQueue.enqueue({
|
|
223
|
+
archiveKey: `nodePages/${index.toString()}.json.gz`,
|
|
224
|
+
writePromise: () => this.writeFile(slpkPath, nodePageStr, `${index.toString()}.json`)
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
await this.saveMetadata();
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
for (const [index, nodePage] of this.nodePages.entries()) {
|
|
231
|
+
const nodePageStr = JSON.stringify(nodePage);
|
|
232
|
+
const nodePagePath = (0, path_1.join)(this.converter.layers0Path, 'nodepages', index.toString());
|
|
233
|
+
await this.converter.writeQueue.enqueue({
|
|
234
|
+
writePromise: () => this.writeFile(nodePagePath, nodePageStr)
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Update resource index in node.mesh object
|
|
241
|
+
* @param node - node object
|
|
242
|
+
*/
|
|
243
|
+
static updateResourceInMesh(node) {
|
|
244
|
+
if (node.mesh && isFinite(node.index)) {
|
|
245
|
+
node.mesh.geometry.resource = node.index;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Update all fields in the node excluding id
|
|
250
|
+
* @param node - node object
|
|
251
|
+
* @param data - NodeInPage data to replace original data
|
|
252
|
+
*/
|
|
253
|
+
static updateAll(node, data) {
|
|
254
|
+
Object.assign(node, data, { index: node.index });
|
|
255
|
+
NodePages.updateResourceInMesh(node);
|
|
256
|
+
return node;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Update material in node.mesh object by node id
|
|
260
|
+
* @param id - end-to-end index of the node
|
|
261
|
+
* @param materialId - id from scene layer materialDefinitions
|
|
262
|
+
*/
|
|
263
|
+
static updateMaterialByNodeId(node, materialId) {
|
|
264
|
+
if (!node.mesh) {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
node.mesh.material = {
|
|
268
|
+
definition: materialId,
|
|
269
|
+
resource: node.index
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Update vertexCount in node.mesh.geometry object by node id
|
|
274
|
+
* @param id - end-to-end index of the node
|
|
275
|
+
* @param vertexCount - vertex count for particular node
|
|
276
|
+
*/
|
|
277
|
+
static updateVertexCountByNodeId(node, vertexCount) {
|
|
278
|
+
if (!node.mesh) {
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
node.mesh.geometry.vertexCount = vertexCount;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Update resource in node.mesh.attribute object by node id
|
|
285
|
+
* @param node - node object
|
|
286
|
+
*/
|
|
287
|
+
static updateNodeAttributeByNodeId(node) {
|
|
288
|
+
if (!node.mesh || !node.index) {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
node.mesh.attribute.resource = node.index;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Update featureCount in node.mesh.geometry object by node id
|
|
295
|
+
* @param node - node object
|
|
296
|
+
* @param featureCount - features count of the node
|
|
297
|
+
*/
|
|
298
|
+
static updateFeatureCountByNodeId(node, featureCount) {
|
|
299
|
+
if (!node.mesh) {
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
node.mesh.geometry.featureCount = featureCount;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Update texelCountHint in node.mesh.material object by node id
|
|
306
|
+
* @param node - node object
|
|
307
|
+
* @param texelCountHint - texelCountHint of particular node
|
|
308
|
+
*/
|
|
309
|
+
static updateTexelCountHintByNodeId(node, texelCountHint) {
|
|
310
|
+
if (!node.mesh || !node.mesh.material) {
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
node.mesh.material.texelCountHint = texelCountHint;
|
|
141
314
|
}
|
|
142
|
-
|
|
143
|
-
await Promise.all(promises);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
315
|
}
|
|
147
|
-
|
|
316
|
+
exports.default = NodePages;
|