@loaders.gl/tile-converter 4.3.0-alpha.4 → 4.3.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +4 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.js +2 -2
- package/dist/3d-tiles-converter/helpers/load-i3s.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/load-i3s.js +5 -4
- package/dist/converter-cli.js +2 -20
- package/dist/converter.min.cjs +69 -69
- package/dist/deps-installer/deps-installer.js +1 -1
- package/dist/i3s-converter/helpers/node-index-document.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-index-document.js +6 -14
- package/dist/i3s-converter/helpers/node-pages.d.ts +1 -1
- package/dist/i3s-converter/helpers/node-pages.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-pages.js +14 -40
- package/dist/i3s-converter/helpers/progress.js +1 -1
- package/dist/i3s-converter/i3s-converter.d.ts +23 -23
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +64 -134
- package/dist/i3s-server/app.d.ts +2 -1
- package/dist/i3s-server/app.d.ts.map +1 -1
- package/dist/i3s-server/app.js +7 -10
- package/dist/i3s-server/bin/i3s-server.min.cjs +71 -71
- package/dist/i3s-server/bin/www.js +5 -0
- package/dist/index.cjs +92 -185
- package/dist/index.cjs.map +3 -3
- package/dist/lib/utils/statistic-utils.d.ts +20 -0
- package/dist/lib/utils/statistic-utils.d.ts.map +1 -0
- package/dist/lib/utils/{statistic-utills.js → statistic-utils.js} +17 -4
- package/dist/pgm-loader.js +1 -1
- package/package.json +19 -20
- package/src/3d-tiles-converter/3d-tiles-converter.ts +4 -3
- package/src/3d-tiles-converter/helpers/load-i3s.ts +5 -4
- package/src/converter-cli.ts +3 -28
- package/src/i3s-converter/helpers/node-index-document.ts +16 -26
- package/src/i3s-converter/helpers/node-pages.ts +20 -46
- package/src/i3s-converter/helpers/progress.ts +1 -1
- package/src/i3s-converter/i3s-converter.ts +92 -160
- package/src/i3s-server/app.ts +7 -10
- package/src/i3s-server/bin/www.ts +6 -0
- package/src/lib/utils/{statistic-utills.ts → statistic-utils.ts} +21 -4
- package/bin/slpk-extractor.js +0 -2
- package/dist/i3s-server/controllers/index-controller.d.ts +0 -8
- package/dist/i3s-server/controllers/index-controller.d.ts.map +0 -1
- package/dist/i3s-server/controllers/index-controller.js +0 -31
- package/dist/i3s-server/routes/index.d.ts +0 -2
- package/dist/i3s-server/routes/index.d.ts.map +0 -1
- package/dist/i3s-server/routes/index.js +0 -17
- package/dist/lib/utils/statistic-utills.d.ts +0 -8
- package/dist/lib/utils/statistic-utills.d.ts.map +0 -1
- package/dist/slpk-extractor/slpk-extractor.d.ts +0 -23
- package/dist/slpk-extractor/slpk-extractor.d.ts.map +0 -1
- package/dist/slpk-extractor/slpk-extractor.js +0 -73
- package/dist/slpk-extractor-cli.d.ts +0 -17
- package/dist/slpk-extractor-cli.d.ts.map +0 -1
- package/dist/slpk-extractor-cli.js +0 -105
- package/dist/slpk-extractor.min.cjs +0 -344
- package/src/i3s-server/controllers/index-controller.ts +0 -32
- package/src/i3s-server/routes/index.ts +0 -18
- package/src/slpk-extractor/slpk-extractor.ts +0 -102
- package/src/slpk-extractor-cli.ts +0 -136
|
@@ -28,6 +28,11 @@ const options = {
|
|
|
28
28
|
key: fs.readFileSync(path.join(__dirname, '../certs/key.pem')),
|
|
29
29
|
cert: fs.readFileSync(path.join(__dirname, '../certs/cert.pem'))
|
|
30
30
|
};
|
|
31
|
+
if (!app) {
|
|
32
|
+
// eslint-disable-next-line no-console
|
|
33
|
+
console.error('This server supports *.slpk files only');
|
|
34
|
+
process.exit(1); // eslint-disable-line no-process-exit
|
|
35
|
+
}
|
|
31
36
|
const httpServer = http.createServer(app);
|
|
32
37
|
const httpsServer = https.createServer(options, app);
|
|
33
38
|
/** Listen on provided port, on all network interfaces. */
|
package/dist/index.cjs
CHANGED
|
@@ -456,15 +456,8 @@ var NodePages = class {
|
|
|
456
456
|
* @returns file path and file name
|
|
457
457
|
*/
|
|
458
458
|
getNodePageFileName(nodePageId) {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
if (this.converter.options.slpk) {
|
|
462
|
-
filePath = (0, import_path2.join)(this.converter.layers0Path, "nodepages");
|
|
463
|
-
fileName = `${nodePageId.toString()}.json`;
|
|
464
|
-
} else {
|
|
465
|
-
filePath = (0, import_path2.join)(this.converter.layers0Path, "nodepages", nodePageId.toString());
|
|
466
|
-
fileName = "index.json";
|
|
467
|
-
}
|
|
459
|
+
const filePath = (0, import_path2.join)(this.converter.layers0Path, "nodepages");
|
|
460
|
+
const fileName = `${nodePageId.toString()}.json`;
|
|
468
461
|
return { filePath, fileName };
|
|
469
462
|
}
|
|
470
463
|
/**
|
|
@@ -564,16 +557,10 @@ var NodePages = class {
|
|
|
564
557
|
nodePage.nodes.push(node);
|
|
565
558
|
}
|
|
566
559
|
const nodePageStr = JSON.stringify(nodePage);
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
}, true);
|
|
572
|
-
} else {
|
|
573
|
-
await this.converter.writeQueue.enqueue({
|
|
574
|
-
writePromise: () => this.writeFile(filePath, nodePageStr)
|
|
575
|
-
}, true);
|
|
576
|
-
}
|
|
560
|
+
await this.converter.writeQueue.enqueue({
|
|
561
|
+
archiveKey: `nodePages/${nodePageIndex.toString()}.json.gz`,
|
|
562
|
+
writePromise: () => this.writeFile(filePath, nodePageStr, fileName, true, this.converter.compressList)
|
|
563
|
+
}, true);
|
|
577
564
|
}
|
|
578
565
|
/**
|
|
579
566
|
* Save metadata file (for slpk only)
|
|
@@ -595,25 +582,15 @@ var NodePages = class {
|
|
|
595
582
|
await this.saveMetadata();
|
|
596
583
|
return;
|
|
597
584
|
}
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
});
|
|
606
|
-
}
|
|
607
|
-
await this.saveMetadata();
|
|
608
|
-
} else {
|
|
609
|
-
for (const [index, nodePage] of this.nodePages.entries()) {
|
|
610
|
-
const nodePageStr = JSON.stringify(nodePage);
|
|
611
|
-
const nodePagePath = (0, import_path2.join)(this.converter.layers0Path, "nodepages", index.toString());
|
|
612
|
-
await this.converter.writeQueue.enqueue({
|
|
613
|
-
writePromise: () => this.writeFile(nodePagePath, nodePageStr)
|
|
614
|
-
});
|
|
615
|
-
}
|
|
585
|
+
for (const [index, nodePage] of this.nodePages.entries()) {
|
|
586
|
+
const nodePageStr = JSON.stringify(nodePage);
|
|
587
|
+
const slpkPath = (0, import_path2.join)(this.converter.layers0Path, "nodepages");
|
|
588
|
+
await this.converter.writeQueue.enqueue({
|
|
589
|
+
archiveKey: `nodePages/${index.toString()}.json.gz`,
|
|
590
|
+
writePromise: () => this.writeFile(slpkPath, nodePageStr, `${index.toString()}.json`)
|
|
591
|
+
});
|
|
616
592
|
}
|
|
593
|
+
await this.saveMetadata();
|
|
617
594
|
}
|
|
618
595
|
/**
|
|
619
596
|
* Update resource index in node.mesh object
|
|
@@ -693,7 +670,7 @@ var NodePages = class {
|
|
|
693
670
|
}
|
|
694
671
|
};
|
|
695
672
|
|
|
696
|
-
// dist/lib/utils/statistic-
|
|
673
|
+
// dist/lib/utils/statistic-utils.js
|
|
697
674
|
var import_path3 = require("path");
|
|
698
675
|
var import_fs3 = require("fs");
|
|
699
676
|
function timeConverter(time) {
|
|
@@ -729,7 +706,7 @@ function timeConverterFromSecondsAndMilliseconds(timeInSeconds, milliseconds) {
|
|
|
729
706
|
}
|
|
730
707
|
return result;
|
|
731
708
|
}
|
|
732
|
-
async function
|
|
709
|
+
async function calculateDatasetSize(params) {
|
|
733
710
|
const { slpk, outputPath, tilesetName } = params;
|
|
734
711
|
const fullOutputPath = getAbsoluteFilePath(outputPath);
|
|
735
712
|
try {
|
|
@@ -739,20 +716,20 @@ async function calculateFilesSize(params) {
|
|
|
739
716
|
return stat.size;
|
|
740
717
|
}
|
|
741
718
|
const directoryPath = (0, import_path3.join)(fullOutputPath, tilesetName);
|
|
742
|
-
const totalSize = await
|
|
719
|
+
const totalSize = await getDirectorySize(directoryPath);
|
|
743
720
|
return totalSize;
|
|
744
721
|
} catch (error) {
|
|
745
722
|
console.log("Calculate file sizes error: ", error);
|
|
746
723
|
return null;
|
|
747
724
|
}
|
|
748
725
|
}
|
|
749
|
-
async function
|
|
726
|
+
async function getDirectorySize(dirPath) {
|
|
750
727
|
let totalFileSize = 0;
|
|
751
728
|
const files = await import_fs3.promises.readdir(dirPath);
|
|
752
729
|
for (const file of files) {
|
|
753
730
|
const fileStat = await import_fs3.promises.stat((0, import_path3.join)(dirPath, file));
|
|
754
731
|
if (fileStat.isDirectory()) {
|
|
755
|
-
totalFileSize += await
|
|
732
|
+
totalFileSize += await getDirectorySize((0, import_path3.join)(dirPath, file));
|
|
756
733
|
} else {
|
|
757
734
|
totalFileSize += fileStat.size;
|
|
758
735
|
}
|
|
@@ -2348,7 +2325,7 @@ function convertScreenThresholdToGeometricError(node) {
|
|
|
2348
2325
|
|
|
2349
2326
|
// dist/pgm-loader.js
|
|
2350
2327
|
var import_geoid = require("@math.gl/geoid");
|
|
2351
|
-
var VERSION = true ? "4.3.0-alpha.
|
|
2328
|
+
var VERSION = true ? "4.3.0-alpha.5" : "latest";
|
|
2352
2329
|
var PGMLoader = {
|
|
2353
2330
|
dataType: null,
|
|
2354
2331
|
batchType: null,
|
|
@@ -3266,14 +3243,10 @@ var NodeIndexDocument = class {
|
|
|
3266
3243
|
*/
|
|
3267
3244
|
async write(node) {
|
|
3268
3245
|
const path = (0, import_path5.join)(this.converter.layers0Path, "nodes", this.id);
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
}, true);
|
|
3274
|
-
} else {
|
|
3275
|
-
await this.converter.writeQueue.enqueue({ writePromise: () => writeFile(path, JSON.stringify(node)) }, true);
|
|
3276
|
-
}
|
|
3246
|
+
await this.converter.writeQueue.enqueue({
|
|
3247
|
+
archiveKey: `nodes/${this.id}/3dNodeIndexDocument.json.gz`,
|
|
3248
|
+
writePromise: () => writeFileForSlpk(path, JSON.stringify(node), "3dNodeIndexDocument.json", true, this.converter.compressList)
|
|
3249
|
+
}, true);
|
|
3277
3250
|
}
|
|
3278
3251
|
/**
|
|
3279
3252
|
* Load 3DNodeIndexDocument data from file on disk
|
|
@@ -3285,10 +3258,7 @@ var NodeIndexDocument = class {
|
|
|
3285
3258
|
}
|
|
3286
3259
|
const path = this.id;
|
|
3287
3260
|
const parentNodePath = (0, import_path5.join)(this.converter.layers0Path, "nodes", path);
|
|
3288
|
-
|
|
3289
|
-
if (this.converter.options.slpk) {
|
|
3290
|
-
parentNodeFileName = "3dNodeIndexDocument.json";
|
|
3291
|
-
}
|
|
3261
|
+
const parentNodeFileName = "3dNodeIndexDocument.json";
|
|
3292
3262
|
return await openJson(parentNodePath, parentNodeFileName);
|
|
3293
3263
|
}
|
|
3294
3264
|
/**
|
|
@@ -4367,8 +4337,6 @@ var I3SConverter = class {
|
|
|
4367
4337
|
* @param options.outputPath the output filename
|
|
4368
4338
|
* @param options.tilesetName the output name of the tileset
|
|
4369
4339
|
* @param options.maxDepth The max tree depth of conversion
|
|
4370
|
-
* @param options.slpk Generate slpk (Scene Layer Packages) output file
|
|
4371
|
-
* @param options.sevenZipExe Location of 7z.exe archiver to create slpk on Windows
|
|
4372
4340
|
* @param options.egmFilePath location of *.pgm file to convert heights from ellipsoidal to gravity-related format
|
|
4373
4341
|
* @param options.token Token for Cesium ION tilesets authentication
|
|
4374
4342
|
* @param options.draco Generate I3S 1.7 draco compressed geometries
|
|
@@ -4384,13 +4352,11 @@ var I3SConverter = class {
|
|
|
4384
4352
|
return BROWSER_ERROR_MESSAGE;
|
|
4385
4353
|
}
|
|
4386
4354
|
this.conversionStartTime = import_process4.default.hrtime();
|
|
4387
|
-
const { tilesetName,
|
|
4355
|
+
const { tilesetName, egmFilePath, inputUrl, validate, outputPath, draco = true, maxDepth, token, generateTextures, generateBoundingVolumes, instantNodeWriting = false, mergeMaterials: mergeMaterials2 = true, inquirer, metadataClass, analyze = false } = options;
|
|
4388
4356
|
this.options = {
|
|
4389
4357
|
outputPath,
|
|
4390
4358
|
tilesetName,
|
|
4391
4359
|
maxDepth,
|
|
4392
|
-
slpk,
|
|
4393
|
-
sevenZipExe,
|
|
4394
4360
|
egmFilePath,
|
|
4395
4361
|
draco,
|
|
4396
4362
|
token,
|
|
@@ -4408,16 +4374,14 @@ var I3SConverter = class {
|
|
|
4408
4374
|
this.generateBoundingVolumes = Boolean(generateBoundingVolumes);
|
|
4409
4375
|
this.writeQueue = new WriteQueue(this.conversionDump);
|
|
4410
4376
|
this.writeQueue.startListening();
|
|
4411
|
-
if (
|
|
4412
|
-
console.log(
|
|
4377
|
+
if (egmFilePath.toLowerCase() === "none") {
|
|
4378
|
+
console.log('--egm chousen to be "none", skip loading egm file');
|
|
4413
4379
|
} else {
|
|
4414
4380
|
console.log("Loading egm file...");
|
|
4415
4381
|
this.geoidHeightModel = await (0, import_core9.load)(egmFilePath, PGMLoader);
|
|
4416
4382
|
console.log("Loading egm file completed!");
|
|
4417
4383
|
}
|
|
4418
|
-
|
|
4419
|
-
this.nodePages.useWriteFunction(writeFileForSlpk);
|
|
4420
|
-
}
|
|
4384
|
+
this.nodePages.useWriteFunction(writeFileForSlpk);
|
|
4421
4385
|
try {
|
|
4422
4386
|
const preloadOptions = await this._fetchPreloadOptions();
|
|
4423
4387
|
let tilesetUrl = inputUrl;
|
|
@@ -4433,7 +4397,7 @@ var I3SConverter = class {
|
|
|
4433
4397
|
const selectMetadataClassResult = await this.selectMetadataClass();
|
|
4434
4398
|
if (selectMetadataClassResult) {
|
|
4435
4399
|
await this._createAndSaveTileset(outputPath, tilesetName);
|
|
4436
|
-
await this._finishConversion({
|
|
4400
|
+
await this._finishConversion({ outputPath, tilesetName });
|
|
4437
4401
|
}
|
|
4438
4402
|
}
|
|
4439
4403
|
} catch (error) {
|
|
@@ -4664,16 +4628,10 @@ var I3SConverter = class {
|
|
|
4664
4628
|
* Write 3DSceneLayer https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DSceneLayer.cmn.md in file
|
|
4665
4629
|
*/
|
|
4666
4630
|
async _writeLayers0() {
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
});
|
|
4672
|
-
} else {
|
|
4673
|
-
await this.writeQueue.enqueue({
|
|
4674
|
-
writePromise: () => writeFile(this.layers0Path, JSON.stringify(this.layers0))
|
|
4675
|
-
});
|
|
4676
|
-
}
|
|
4631
|
+
await this.writeQueue.enqueue({
|
|
4632
|
+
archiveKey: "3dSceneLayer.json.gz",
|
|
4633
|
+
writePromise: () => writeFileForSlpk(this.layers0Path, JSON.stringify(this.layers0), "3dSceneLayer.json")
|
|
4634
|
+
});
|
|
4677
4635
|
}
|
|
4678
4636
|
/**
|
|
4679
4637
|
* Pack files into *.slpk archive
|
|
@@ -4681,17 +4639,15 @@ var I3SConverter = class {
|
|
|
4681
4639
|
*/
|
|
4682
4640
|
async _createSlpk(tilesetPath) {
|
|
4683
4641
|
await this.conversionDump.deleteDumpFile();
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
} catch (e) {
|
|
4694
|
-
}
|
|
4642
|
+
const slpkTilesetPath = (0, import_path7.join)(tilesetPath, "SceneServer", "layers", "0");
|
|
4643
|
+
const slpkFileName = `${tilesetPath}.slpk`;
|
|
4644
|
+
await (0, import_zip2.createZip)(slpkTilesetPath, slpkFileName, async (fileList) => ({
|
|
4645
|
+
path: "@specialIndexFileHASH128@",
|
|
4646
|
+
file: await (0, import_zip2.composeHashFile)(fileList)
|
|
4647
|
+
}));
|
|
4648
|
+
try {
|
|
4649
|
+
await removeDir(tilesetPath);
|
|
4650
|
+
} catch (e) {
|
|
4695
4651
|
}
|
|
4696
4652
|
}
|
|
4697
4653
|
/**
|
|
@@ -4928,9 +4884,9 @@ var I3SConverter = class {
|
|
|
4928
4884
|
propertyTable,
|
|
4929
4885
|
featuresHashArray: this.featuresHashArray,
|
|
4930
4886
|
attributeStorageInfo: this.attributeMetadataInfo.attributeStorageInfo,
|
|
4931
|
-
draco: this.options.draco,
|
|
4887
|
+
draco: this.options.draco ?? false,
|
|
4932
4888
|
generateBoundingVolumes: this.generateBoundingVolumes,
|
|
4933
|
-
shouldMergeMaterials: this.options.mergeMaterials,
|
|
4889
|
+
shouldMergeMaterials: this.options.mergeMaterials ?? false,
|
|
4934
4890
|
geoidHeightModel: this.geoidHeightModel,
|
|
4935
4891
|
libraries: this.loadOptions.modules,
|
|
4936
4892
|
metadataClass: this.options.metadataClass
|
|
@@ -5057,45 +5013,25 @@ var I3SConverter = class {
|
|
|
5057
5013
|
return;
|
|
5058
5014
|
}
|
|
5059
5015
|
this.conversionDump.updateDoneStatus(sourceId, nodeId, ResourceType.GEOMETRY, false);
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
const
|
|
5016
|
+
const slpkGeometryPath = (0, import_path7.join)(childPath, "geometries");
|
|
5017
|
+
await this.writeQueue.enqueue({
|
|
5018
|
+
archiveKey: `${slpkChildPath}/geometries/0.bin.gz`,
|
|
5019
|
+
sourceId,
|
|
5020
|
+
outputId: nodeId,
|
|
5021
|
+
resourceType: ResourceType.GEOMETRY,
|
|
5022
|
+
writePromise: () => writeFileForSlpk(slpkGeometryPath, geometryBuffer, "0.bin")
|
|
5023
|
+
});
|
|
5024
|
+
if (this.options.draco && compressedGeometry) {
|
|
5025
|
+
this.conversionDump.updateDoneStatus(sourceId, nodeId, ResourceType.DRACO_GEOMETRY, false);
|
|
5026
|
+
const slpkCompressedGeometryPath = (0, import_path7.join)(childPath, "geometries");
|
|
5071
5027
|
await this.writeQueue.enqueue({
|
|
5028
|
+
archiveKey: `${slpkChildPath}/geometries/1.bin.gz`,
|
|
5072
5029
|
sourceId,
|
|
5073
5030
|
outputId: nodeId,
|
|
5074
|
-
resourceType: ResourceType.
|
|
5075
|
-
writePromise: () =>
|
|
5031
|
+
resourceType: ResourceType.DRACO_GEOMETRY,
|
|
5032
|
+
writePromise: () => writeFileForSlpk(slpkCompressedGeometryPath, compressedGeometry, "1.bin")
|
|
5076
5033
|
});
|
|
5077
5034
|
}
|
|
5078
|
-
if (this.options.draco && compressedGeometry) {
|
|
5079
|
-
this.conversionDump.updateDoneStatus(sourceId, nodeId, ResourceType.DRACO_GEOMETRY, false);
|
|
5080
|
-
if (this.options.slpk) {
|
|
5081
|
-
const slpkCompressedGeometryPath = (0, import_path7.join)(childPath, "geometries");
|
|
5082
|
-
await this.writeQueue.enqueue({
|
|
5083
|
-
archiveKey: `${slpkChildPath}/geometries/1.bin.gz`,
|
|
5084
|
-
sourceId,
|
|
5085
|
-
outputId: nodeId,
|
|
5086
|
-
resourceType: ResourceType.DRACO_GEOMETRY,
|
|
5087
|
-
writePromise: () => writeFileForSlpk(slpkCompressedGeometryPath, compressedGeometry, "1.bin")
|
|
5088
|
-
});
|
|
5089
|
-
} else {
|
|
5090
|
-
const compressedGeometryPath = (0, import_path7.join)(childPath, "geometries/1/");
|
|
5091
|
-
await this.writeQueue.enqueue({
|
|
5092
|
-
sourceId,
|
|
5093
|
-
outputId: nodeId,
|
|
5094
|
-
resourceType: ResourceType.DRACO_GEOMETRY,
|
|
5095
|
-
writePromise: () => writeFile(compressedGeometryPath, compressedGeometry, "index.bin")
|
|
5096
|
-
});
|
|
5097
|
-
}
|
|
5098
|
-
}
|
|
5099
5035
|
}
|
|
5100
5036
|
/**
|
|
5101
5037
|
* Write shared resources in a file
|
|
@@ -5114,24 +5050,14 @@ var I3SConverter = class {
|
|
|
5114
5050
|
const sharedData = (0, import_json_map_transform8.default)(sharedResources, SHARED_RESOURCES());
|
|
5115
5051
|
const sharedDataStr = JSON.stringify(sharedData);
|
|
5116
5052
|
this.conversionDump.updateDoneStatus(sourceId, nodeId, ResourceType.SHARED, false);
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
});
|
|
5126
|
-
} else {
|
|
5127
|
-
const sharedPath = (0, import_path7.join)(childPath, "shared/");
|
|
5128
|
-
await this.writeQueue.enqueue({
|
|
5129
|
-
sourceId,
|
|
5130
|
-
outputId: nodeId,
|
|
5131
|
-
resourceType: ResourceType.SHARED,
|
|
5132
|
-
writePromise: () => writeFile(sharedPath, sharedDataStr)
|
|
5133
|
-
});
|
|
5134
|
-
}
|
|
5053
|
+
const slpkSharedPath = (0, import_path7.join)(childPath, "shared");
|
|
5054
|
+
await this.writeQueue.enqueue({
|
|
5055
|
+
archiveKey: `${slpkChildPath}/shared/sharedResource.json.gz`,
|
|
5056
|
+
sourceId,
|
|
5057
|
+
outputId: nodeId,
|
|
5058
|
+
resourceType: ResourceType.SHARED,
|
|
5059
|
+
writePromise: () => writeFileForSlpk(slpkSharedPath, sharedDataStr, "sharedResource.json")
|
|
5060
|
+
});
|
|
5135
5061
|
}
|
|
5136
5062
|
/**
|
|
5137
5063
|
* Generates textures based on texture mime type and fill in textureSetDefinitions data.
|
|
@@ -5243,25 +5169,15 @@ var I3SConverter = class {
|
|
|
5243
5169
|
* @param nodeId
|
|
5244
5170
|
*/
|
|
5245
5171
|
async writeTextureFile({ textureData, name, format, childPath, slpkChildPath, sourceId, nodeId }) {
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
});
|
|
5256
|
-
} else {
|
|
5257
|
-
const texturePath = (0, import_path7.join)(childPath, `textures/${name}/`);
|
|
5258
|
-
await this.writeQueue.enqueue({
|
|
5259
|
-
sourceId,
|
|
5260
|
-
outputId: nodeId,
|
|
5261
|
-
resourceType: `${ResourceType.TEXTURE}/${format}`,
|
|
5262
|
-
writePromise: () => writeFile(texturePath, textureData, `index.${format}`)
|
|
5263
|
-
});
|
|
5264
|
-
}
|
|
5172
|
+
const slpkTexturePath = (0, import_path7.join)(childPath, "textures");
|
|
5173
|
+
const compress = false;
|
|
5174
|
+
await this.writeQueue.enqueue({
|
|
5175
|
+
archiveKey: `${slpkChildPath}/textures/${name}.${format}`,
|
|
5176
|
+
sourceId,
|
|
5177
|
+
outputId: nodeId,
|
|
5178
|
+
resourceType: `${ResourceType.TEXTURE}/${format}`,
|
|
5179
|
+
writePromise: () => writeFileForSlpk(slpkTexturePath, textureData, `${name}.${format}`, compress)
|
|
5180
|
+
});
|
|
5265
5181
|
}
|
|
5266
5182
|
/**
|
|
5267
5183
|
* Write feature attributes in files
|
|
@@ -5278,24 +5194,14 @@ var I3SConverter = class {
|
|
|
5278
5194
|
const folderName = this.attributeMetadataInfo.attributeStorageInfo[index].key;
|
|
5279
5195
|
const fileBuffer = new Uint8Array(attributes[index]);
|
|
5280
5196
|
this.conversionDump.updateDoneStatus(sourceId, nodeId, `${ResourceType.ATTRIBUTES}/${folderName}`, false);
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
});
|
|
5290
|
-
} else {
|
|
5291
|
-
const attributesPath = (0, import_path7.join)(childPath, `attributes/${folderName}/0`);
|
|
5292
|
-
await this.writeQueue.enqueue({
|
|
5293
|
-
sourceId,
|
|
5294
|
-
outputId: nodeId,
|
|
5295
|
-
resourceType: `${ResourceType.ATTRIBUTES}/${folderName}`,
|
|
5296
|
-
writePromise: () => writeFile(attributesPath, fileBuffer, "index.bin")
|
|
5297
|
-
});
|
|
5298
|
-
}
|
|
5197
|
+
const slpkAttributesPath = (0, import_path7.join)(childPath, "attributes", folderName);
|
|
5198
|
+
await this.writeQueue.enqueue({
|
|
5199
|
+
archiveKey: `${slpkChildPath}/attributes/${folderName}.bin.gz`,
|
|
5200
|
+
sourceId,
|
|
5201
|
+
outputId: nodeId,
|
|
5202
|
+
resourceType: `${ResourceType.ATTRIBUTES}/${folderName}`,
|
|
5203
|
+
writePromise: () => writeFileForSlpk(slpkAttributesPath, fileBuffer, "0.bin")
|
|
5204
|
+
});
|
|
5299
5205
|
}
|
|
5300
5206
|
}
|
|
5301
5207
|
}
|
|
@@ -5371,7 +5277,7 @@ var I3SConverter = class {
|
|
|
5371
5277
|
async _finishConversion(params) {
|
|
5372
5278
|
const { tilesCount, tilesWithAddRefineCount } = this.refinementCounter;
|
|
5373
5279
|
const addRefinementPercentage = tilesWithAddRefineCount ? tilesWithAddRefineCount / tilesCount * 100 : 0;
|
|
5374
|
-
const filesSize = await
|
|
5280
|
+
const filesSize = await calculateDatasetSize(params);
|
|
5375
5281
|
const diff = import_process4.default.hrtime(this.conversionStartTime);
|
|
5376
5282
|
const conversionTime = timeConverter(diff);
|
|
5377
5283
|
console.log("------------------------------------------------");
|
|
@@ -5392,7 +5298,7 @@ var I3SConverter = class {
|
|
|
5392
5298
|
const options = {
|
|
5393
5299
|
"cesium-ion": { accessToken: this.options.token || ION_DEFAULT_TOKEN }
|
|
5394
5300
|
};
|
|
5395
|
-
const preloadOptions = await this.Loader.preload(this.options.inputUrl, options);
|
|
5301
|
+
const preloadOptions = await this.Loader.preload(this.options.inputUrl ?? "", options);
|
|
5396
5302
|
this.refreshTokenTime = import_process4.default.hrtime();
|
|
5397
5303
|
return { ...options, ...preloadOptions };
|
|
5398
5304
|
}
|
|
@@ -5859,15 +5765,16 @@ async function getNodeCount(fileSystem) {
|
|
|
5859
5765
|
if (!(fileSystem == null ? void 0 : fileSystem.fileProvider)) {
|
|
5860
5766
|
return 0;
|
|
5861
5767
|
}
|
|
5862
|
-
|
|
5768
|
+
const nodeSet = /* @__PURE__ */ new Set();
|
|
5863
5769
|
const filesIterator = (0, import_zip3.makeZipCDHeaderIterator)(fileSystem.fileProvider);
|
|
5864
5770
|
for await (const file of filesIterator) {
|
|
5865
5771
|
const filename = file.fileName;
|
|
5866
|
-
|
|
5867
|
-
|
|
5772
|
+
const nodeNumberSearchResult = /^nodes\/(\d+)\//.exec(filename);
|
|
5773
|
+
if (nodeNumberSearchResult) {
|
|
5774
|
+
nodeSet.add(nodeNumberSearchResult[1]);
|
|
5868
5775
|
}
|
|
5869
5776
|
}
|
|
5870
|
-
return
|
|
5777
|
+
return nodeSet.size;
|
|
5871
5778
|
}
|
|
5872
5779
|
|
|
5873
5780
|
// dist/3d-tiles-converter/3d-tiles-converter.js
|
|
@@ -6207,7 +6114,7 @@ var Tiles3DConverter = class {
|
|
|
6207
6114
|
* @param params - output files data
|
|
6208
6115
|
*/
|
|
6209
6116
|
async _finishConversion(params) {
|
|
6210
|
-
const filesSize = await
|
|
6117
|
+
const filesSize = await calculateDatasetSize(params);
|
|
6211
6118
|
const diff = import_process5.default.hrtime(this.conversionStartTime);
|
|
6212
6119
|
const conversionTime = timeConverter(diff);
|
|
6213
6120
|
console.log(`------------------------------------------------`);
|