@loaders.gl/tile-converter 4.3.0-alpha.4 → 4.3.0-alpha.5
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/converter-cli.js +0 -13
- package/dist/converter.min.cjs +89 -89
- 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/i3s-converter.d.ts +24 -23
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +60 -130
- 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 +82 -194
- package/dist/index.cjs.map +2 -2
- package/dist/lib/utils/statistic-utills.d.ts +4 -1
- package/dist/lib/utils/statistic-utills.d.ts.map +1 -1
- package/dist/lib/utils/statistic-utills.js +4 -23
- package/dist/pgm-loader.js +1 -1
- package/package.json +19 -20
- package/src/3d-tiles-converter/3d-tiles-converter.ts +2 -1
- package/src/converter-cli.ts +0 -19
- 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/i3s-converter.ts +88 -154
- package/src/i3s-server/app.ts +7 -10
- package/src/i3s-server/bin/www.ts +6 -0
- package/src/lib/utils/statistic-utills.ts +5 -27
- 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/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
|
@@ -9,7 +9,7 @@ import { ChildProcessProxy } from '@loaders.gl/worker-utils';
|
|
|
9
9
|
import { DRACO_EXTERNAL_LIBRARIES, DRACO_EXTERNAL_LIBRARY_URLS } from '@loaders.gl/draco';
|
|
10
10
|
import { BASIS_EXTERNAL_LIBRARIES } from '@loaders.gl/textures';
|
|
11
11
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
12
|
-
const VERSION = typeof "4.3.0-alpha.
|
|
12
|
+
const VERSION = typeof "4.3.0-alpha.4" !== 'undefined' ? "4.3.0-alpha.4" : 'latest';
|
|
13
13
|
const PGM_LINK = 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/egm/egm2008-5.zip';
|
|
14
14
|
/**
|
|
15
15
|
* Install external dependencies for converter:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-index-document.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/node-index-document.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,UAAU,EAEX,MAAM,iBAAiB,CAAC;AAIzB,OAAO,YAAY,4BAAyB;AAE5C,OAAO,EAAC,qBAAqB,EAAC,oBAAiB;AAC/C,OAAO,EAAC,YAAY,EAAC,2CAAwC;AAE7D;;;;;GAKG;AACH,qBAAa,iBAAiB;IAC5B,cAAc;IACP,EAAE,EAAE,MAAM,CAAC;IAClB,uBAAuB;IAChB,QAAQ,EAAE,MAAM,CAAC;IACxB,+BAA+B;IACxB,IAAI,EAAE,mBAAmB,GAAG,IAAI,CAAQ;IAC/C,eAAe;IACR,QAAQ,EAAE,iBAAiB,EAAE,CAAM;IAC1C,yBAAyB;IACzB,OAAO,CAAC,SAAS,CAAe;IAEhC;;;OAGG;IACH,OAAO,CAAC,UAAU,CAAkB;IACpC,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED;;;;OAIG;gBACS,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY;IAM/C;;;;OAIG;IACU,OAAO,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAS3E;;;OAGG;IACU,WAAW,CAAC,UAAU,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BxE;;OAEG;IACU,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAmC1C,+CAA+C;IAClC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAMlC,wBAAwB;IACxB,OAAO,CAAC,QAAQ;IAOhB;;;OAGG;YACW,KAAK;
|
|
1
|
+
{"version":3,"file":"node-index-document.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/node-index-document.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,UAAU,EAEX,MAAM,iBAAiB,CAAC;AAIzB,OAAO,YAAY,4BAAyB;AAE5C,OAAO,EAAC,qBAAqB,EAAC,oBAAiB;AAC/C,OAAO,EAAC,YAAY,EAAC,2CAAwC;AAE7D;;;;;GAKG;AACH,qBAAa,iBAAi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C;KACzB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAY9B;;;;OAIG;IACH,MAAM,CAAC,2BAA2B,CAAC,eAAe,EAAE,eAAe,GAAG,mBAAmB;IAqBzF;;;;;;;;;;OAUG;WAEU,uBAAuB,CAClC,UAAU,EAAE,iBAAiB,EAC7B,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY,EAAE,EAC5B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,qBAAqB,GAAG,YAAY,GAC9C,OAAO,CAAC,mBAAmB,CAAC;CAyDhC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { join } from 'path';
|
|
2
2
|
import transform from 'json-map-transform';
|
|
3
3
|
import { v4 as uuidv4 } from 'uuid';
|
|
4
|
-
import { openJson,
|
|
4
|
+
import { openJson, writeFileForSlpk } from "../../lib/utils/file-utils.js";
|
|
5
5
|
import { NODE as nodeTemplate } from "../json-templates/node.js";
|
|
6
6
|
/**
|
|
7
7
|
* Wrapper for https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md data
|
|
@@ -132,15 +132,10 @@ export class NodeIndexDocument {
|
|
|
132
132
|
*/
|
|
133
133
|
async write(node) {
|
|
134
134
|
const path = join(this.converter.layers0Path, 'nodes', this.id);
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}, true);
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
await this.converter.writeQueue.enqueue({ writePromise: () => writeFile(path, JSON.stringify(node)) }, true);
|
|
143
|
-
}
|
|
135
|
+
await this.converter.writeQueue.enqueue({
|
|
136
|
+
archiveKey: `nodes/${this.id}/3dNodeIndexDocument.json.gz`,
|
|
137
|
+
writePromise: () => writeFileForSlpk(path, JSON.stringify(node), '3dNodeIndexDocument.json', true, this.converter.compressList)
|
|
138
|
+
}, true);
|
|
144
139
|
}
|
|
145
140
|
/**
|
|
146
141
|
* Load 3DNodeIndexDocument data from file on disk
|
|
@@ -152,10 +147,7 @@ export class NodeIndexDocument {
|
|
|
152
147
|
}
|
|
153
148
|
const path = this.id;
|
|
154
149
|
const parentNodePath = join(this.converter.layers0Path, 'nodes', path);
|
|
155
|
-
|
|
156
|
-
if (this.converter.options.slpk) {
|
|
157
|
-
parentNodeFileName = '3dNodeIndexDocument.json';
|
|
158
|
-
}
|
|
150
|
+
const parentNodeFileName = '3dNodeIndexDocument.json';
|
|
159
151
|
return (await openJson(parentNodePath, parentNodeFileName));
|
|
160
152
|
}
|
|
161
153
|
/**
|
|
@@ -47,7 +47,7 @@ export default class NodePages {
|
|
|
47
47
|
* @param writeFileFunc - function to save one nodePage into a file
|
|
48
48
|
* @param nodesPerPage - length limit for one nodePage. An additional nodePage is created when this limit is met
|
|
49
49
|
*/
|
|
50
|
-
constructor(writeFileFunc: any, nodesPerPage:
|
|
50
|
+
constructor(writeFileFunc: any, nodesPerPage: number, converter: I3SConverter);
|
|
51
51
|
/**
|
|
52
52
|
* Setup function to save node pages
|
|
53
53
|
* @param func - function which should be used to save node pages
|
|
@@ -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;AAE3C,OAAO,YAAY,4BAAyB;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,Q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AC,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;IAwB/C;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAenC;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAgB3B;;;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"}
|
|
@@ -70,16 +70,8 @@ export default class NodePages {
|
|
|
70
70
|
* @returns file path and file name
|
|
71
71
|
*/
|
|
72
72
|
getNodePageFileName(nodePageId) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (this.converter.options.slpk) {
|
|
76
|
-
filePath = join(this.converter.layers0Path, 'nodepages');
|
|
77
|
-
fileName = `${nodePageId.toString()}.json`;
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
filePath = join(this.converter.layers0Path, 'nodepages', nodePageId.toString());
|
|
81
|
-
fileName = 'index.json';
|
|
82
|
-
}
|
|
73
|
+
const filePath = join(this.converter.layers0Path, 'nodepages');
|
|
74
|
+
const fileName = `${nodePageId.toString()}.json`;
|
|
83
75
|
return { filePath, fileName };
|
|
84
76
|
}
|
|
85
77
|
/**
|
|
@@ -179,17 +171,10 @@ export default class NodePages {
|
|
|
179
171
|
nodePage.nodes.push(node);
|
|
180
172
|
}
|
|
181
173
|
const nodePageStr = JSON.stringify(nodePage);
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}, true);
|
|
187
|
-
}
|
|
188
|
-
else {
|
|
189
|
-
await this.converter.writeQueue.enqueue({
|
|
190
|
-
writePromise: () => this.writeFile(filePath, nodePageStr)
|
|
191
|
-
}, true);
|
|
192
|
-
}
|
|
174
|
+
await this.converter.writeQueue.enqueue({
|
|
175
|
+
archiveKey: `nodePages/${nodePageIndex.toString()}.json.gz`,
|
|
176
|
+
writePromise: () => this.writeFile(filePath, nodePageStr, fileName, true, this.converter.compressList)
|
|
177
|
+
}, true);
|
|
193
178
|
}
|
|
194
179
|
/**
|
|
195
180
|
* Save metadata file (for slpk only)
|
|
@@ -211,26 +196,15 @@ export default class NodePages {
|
|
|
211
196
|
await this.saveMetadata();
|
|
212
197
|
return;
|
|
213
198
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
await this.saveMetadata();
|
|
224
|
-
}
|
|
225
|
-
else {
|
|
226
|
-
for (const [index, nodePage] of this.nodePages.entries()) {
|
|
227
|
-
const nodePageStr = JSON.stringify(nodePage);
|
|
228
|
-
const nodePagePath = join(this.converter.layers0Path, 'nodepages', index.toString());
|
|
229
|
-
await this.converter.writeQueue.enqueue({
|
|
230
|
-
writePromise: () => this.writeFile(nodePagePath, nodePageStr)
|
|
231
|
-
});
|
|
232
|
-
}
|
|
199
|
+
for (const [index, nodePage] of this.nodePages.entries()) {
|
|
200
|
+
const nodePageStr = JSON.stringify(nodePage);
|
|
201
|
+
const slpkPath = join(this.converter.layers0Path, 'nodepages');
|
|
202
|
+
await this.converter.writeQueue.enqueue({
|
|
203
|
+
archiveKey: `nodePages/${index.toString()}.json.gz`,
|
|
204
|
+
writePromise: () => this.writeFile(slpkPath, nodePageStr, `${index.toString()}.json`)
|
|
205
|
+
});
|
|
233
206
|
}
|
|
207
|
+
await this.saveMetadata();
|
|
234
208
|
}
|
|
235
209
|
/**
|
|
236
210
|
* Update resource index in node.mesh object
|
|
@@ -10,13 +10,34 @@ import { PreprocessData } from "./types.js";
|
|
|
10
10
|
import WriteQueue from "../lib/utils/write-queue.js";
|
|
11
11
|
import { Progress } from "./helpers/progress.js";
|
|
12
12
|
import { ConversionDump } from "../lib/utils/conversion-dump.js";
|
|
13
|
+
import { PromptModule } from 'inquirer';
|
|
14
|
+
type ConverterProps = {
|
|
15
|
+
inputUrl: string;
|
|
16
|
+
outputPath: string;
|
|
17
|
+
tilesetName: string;
|
|
18
|
+
egmFilePath: string;
|
|
19
|
+
maxDepth?: number;
|
|
20
|
+
token?: string;
|
|
21
|
+
draco?: boolean;
|
|
22
|
+
mergeMaterials?: boolean;
|
|
23
|
+
validate?: boolean;
|
|
24
|
+
generateTextures?: boolean;
|
|
25
|
+
generateBoundingVolumes?: boolean;
|
|
26
|
+
instantNodeWriting?: boolean;
|
|
27
|
+
inquirer?: {
|
|
28
|
+
prompt: PromptModule;
|
|
29
|
+
};
|
|
30
|
+
metadataClass?: string;
|
|
31
|
+
analyze?: boolean;
|
|
32
|
+
noEgm?: boolean;
|
|
33
|
+
};
|
|
13
34
|
/**
|
|
14
35
|
* Converter from 3d-tiles tileset to i3s layer
|
|
15
36
|
*/
|
|
16
37
|
export default class I3SConverter {
|
|
17
38
|
attributeMetadataInfo: AttributeMetadataInfo;
|
|
18
39
|
nodePages: NodePages;
|
|
19
|
-
options:
|
|
40
|
+
options: Partial<ConverterProps>;
|
|
20
41
|
layers0Path: string;
|
|
21
42
|
materialMap: Map<string, number>;
|
|
22
43
|
materialDefinitions: I3SMaterialDefinition[];
|
|
@@ -59,8 +80,6 @@ export default class I3SConverter {
|
|
|
59
80
|
* @param options.outputPath the output filename
|
|
60
81
|
* @param options.tilesetName the output name of the tileset
|
|
61
82
|
* @param options.maxDepth The max tree depth of conversion
|
|
62
|
-
* @param options.slpk Generate slpk (Scene Layer Packages) output file
|
|
63
|
-
* @param options.sevenZipExe Location of 7z.exe archiver to create slpk on Windows
|
|
64
83
|
* @param options.egmFilePath location of *.pgm file to convert heights from ellipsoidal to gravity-related format
|
|
65
84
|
* @param options.token Token for Cesium ION tilesets authentication
|
|
66
85
|
* @param options.draco Generate I3S 1.7 draco compressed geometries
|
|
@@ -69,26 +88,7 @@ export default class I3SConverter {
|
|
|
69
88
|
* @param options.generateBoundingVolumes - generate bounding volumes from vertices coordinates instead of source tiles bounding volumes
|
|
70
89
|
* @param options.instantNodeWriting - Keep created 3DNodeIndexDocument files on disk instead of memory. This option reduce memory usage but decelerates conversion speed
|
|
71
90
|
*/
|
|
72
|
-
convert(options:
|
|
73
|
-
inputUrl: string;
|
|
74
|
-
outputPath: string;
|
|
75
|
-
tilesetName: string;
|
|
76
|
-
sevenZipExe: string;
|
|
77
|
-
egmFilePath: string;
|
|
78
|
-
maxDepth?: number;
|
|
79
|
-
slpk?: boolean;
|
|
80
|
-
token?: string;
|
|
81
|
-
draco?: boolean;
|
|
82
|
-
mergeMaterials?: boolean;
|
|
83
|
-
validate?: boolean;
|
|
84
|
-
generateTextures?: boolean;
|
|
85
|
-
generateBoundingVolumes?: boolean;
|
|
86
|
-
instantNodeWriting?: boolean;
|
|
87
|
-
inquirer?: Promise<unknown>;
|
|
88
|
-
metadataClass?: string;
|
|
89
|
-
analyze?: boolean;
|
|
90
|
-
noEgm?: boolean;
|
|
91
|
-
}): Promise<string>;
|
|
91
|
+
convert(options: ConverterProps): Promise<string>;
|
|
92
92
|
/**
|
|
93
93
|
* Preprocess stage of the tile converter. Traverse all the tiles tree and
|
|
94
94
|
* check a tile content to be sure that the data is supported
|
|
@@ -309,4 +309,5 @@ export default class I3SConverter {
|
|
|
309
309
|
*/
|
|
310
310
|
private isContentSupported;
|
|
311
311
|
}
|
|
312
|
+
export {};
|
|
312
313
|
//# sourceMappingURL=i3s-converter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-converter.d.ts","sourceRoot":"","sources":["../../src/i3s-converter/i3s-converter.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,qBAAqB,EAAC,6CAA0C;AAExE,OAAO,KAAK,EAEV,oBAAoB,EAGpB,+BAA+B,EAChC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAC,cAAc,EAAC,oCAAiC;AAC7D,OAAO,KAAK,EACV,YAAY,EAMb,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAC,KAAK,EAAC,MAAM,gBAAgB,CAAC;AAOrC,OAAO,SAAS,gCAA6B;AAkB7C,OAAO,EAAC,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAC,qBAAqB,EAA8B,MAAM,iBAAiB,CAAC;AAGnF,OAAO,EAGL,cAAc,EAGf,mBAAgB;AAEjB,OAAO,UAAU,oCAAiC;AAkBlD,OAAO,EAAC,QAAQ,EAAC,8BAA2B;AAE5C,OAAO,EAAC,cAAc,EAAsC,wCAAqC;
|
|
1
|
+
{"version":3,"file":"i3s-converter.d.ts","sourceRoot":"","sources":["../../src/i3s-converter/i3s-converter.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,qBAAqB,EAAC,6CAA0C;AAExE,OAAO,KAAK,EAEV,oBAAoB,EAGpB,+BAA+B,EAChC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAC,cAAc,EAAC,oCAAiC;AAC7D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c,EAAE,cAAc,CAAC;;IA0B/B;;;;;;;;;;;;;;OAcG;IAEG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;IAyFvD;;;;OAIG;YACW,oBAAoB;IAkDlC;;;;;OAKG;YACW,WAAW;IA+BzB;;;OAGG;YACW,mBAAmB;IAiCjC;;;;OAIG;YAEW,qBAAqB;IAwHnC;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAgCpB;;OAEG;YACW,aAAa;IAQ3B;;;OAGG;YACW,WAAW;IAiBzB;;;;;;OAMG;YAEW,WAAW;IAuDzB;;;;OAIG;YACW,YAAY;IAc1B;;;;;;;;OAQG;YACW,0BAA0B;IAoDxC;;;;;;OAMG;YACW,YAAY;IAwC1B;;;;;;;OAOG;YAEW,WAAW;IAuGzB;;;;;;;;;;OAUG;YACW,iBAAiB;IA0C/B;;;;;;;;;;;;;;OAcG;YAEW,sBAAsB;IA0EpC;;;;;;;;;;;OAWG;YACW,eAAe;IA+C7B;;;;;;;;OAQG;YACW,gBAAgB;IA6C9B;;;;;;;;OAQG;YACW,YAAY;IAgC1B;;;;;;;OAOG;YAEW,aAAa;IA8H3B;;;;;;;;;OASG;YACW,gBAAgB;IA8B9B;;;;;;;OAOG;YACW,gBAAgB;IAkC9B;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAa5B;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IAU7B;;;;;;OAMG;IACH,OAAO,CAAC,8BAA8B;IAWtC;;;;OAIG;IACH,OAAO,CAAC,0BAA0B;IA4BlC;;;OAGG;YACW,iBAAiB;IAoB/B;;OAEG;YACW,oBAAoB;IAYlC;;OAEG;YACW,qBAAqB;IAiBnC;;OAEG;IACH,OAAO,CAAC,8BAA8B;IAWtC;;;;OAIG;IACH,OAAO,CAAC,kBAAkB;CAG3B"}
|
|
@@ -125,8 +125,6 @@ export default class I3SConverter {
|
|
|
125
125
|
* @param options.outputPath the output filename
|
|
126
126
|
* @param options.tilesetName the output name of the tileset
|
|
127
127
|
* @param options.maxDepth The max tree depth of conversion
|
|
128
|
-
* @param options.slpk Generate slpk (Scene Layer Packages) output file
|
|
129
|
-
* @param options.sevenZipExe Location of 7z.exe archiver to create slpk on Windows
|
|
130
128
|
* @param options.egmFilePath location of *.pgm file to convert heights from ellipsoidal to gravity-related format
|
|
131
129
|
* @param options.token Token for Cesium ION tilesets authentication
|
|
132
130
|
* @param options.draco Generate I3S 1.7 draco compressed geometries
|
|
@@ -142,13 +140,11 @@ export default class I3SConverter {
|
|
|
142
140
|
return BROWSER_ERROR_MESSAGE;
|
|
143
141
|
}
|
|
144
142
|
this.conversionStartTime = process.hrtime();
|
|
145
|
-
const { tilesetName,
|
|
143
|
+
const { tilesetName, egmFilePath, inputUrl, validate, outputPath, draco = true, maxDepth, token, generateTextures, generateBoundingVolumes, instantNodeWriting = false, mergeMaterials = true, inquirer, metadataClass, analyze = false, noEgm = false } = options;
|
|
146
144
|
this.options = {
|
|
147
145
|
outputPath,
|
|
148
146
|
tilesetName,
|
|
149
147
|
maxDepth,
|
|
150
|
-
slpk,
|
|
151
|
-
sevenZipExe,
|
|
152
148
|
egmFilePath,
|
|
153
149
|
draco,
|
|
154
150
|
token,
|
|
@@ -174,9 +170,7 @@ export default class I3SConverter {
|
|
|
174
170
|
this.geoidHeightModel = await load(egmFilePath, PGMLoader);
|
|
175
171
|
console.log('Loading egm file completed!'); // eslint-disable-line
|
|
176
172
|
}
|
|
177
|
-
|
|
178
|
-
this.nodePages.useWriteFunction(writeFileForSlpk);
|
|
179
|
-
}
|
|
173
|
+
this.nodePages.useWriteFunction(writeFileForSlpk);
|
|
180
174
|
try {
|
|
181
175
|
const preloadOptions = await this._fetchPreloadOptions();
|
|
182
176
|
let tilesetUrl = inputUrl;
|
|
@@ -192,7 +186,7 @@ export default class I3SConverter {
|
|
|
192
186
|
const selectMetadataClassResult = await this.selectMetadataClass();
|
|
193
187
|
if (selectMetadataClassResult) {
|
|
194
188
|
await this._createAndSaveTileset(outputPath, tilesetName);
|
|
195
|
-
await this._finishConversion({
|
|
189
|
+
await this._finishConversion({ outputPath, tilesetName });
|
|
196
190
|
}
|
|
197
191
|
}
|
|
198
192
|
}
|
|
@@ -450,17 +444,10 @@ export default class I3SConverter {
|
|
|
450
444
|
* Write 3DSceneLayer https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DSceneLayer.cmn.md in file
|
|
451
445
|
*/
|
|
452
446
|
async _writeLayers0() {
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
});
|
|
458
|
-
}
|
|
459
|
-
else {
|
|
460
|
-
await this.writeQueue.enqueue({
|
|
461
|
-
writePromise: () => writeFile(this.layers0Path, JSON.stringify(this.layers0))
|
|
462
|
-
});
|
|
463
|
-
}
|
|
447
|
+
await this.writeQueue.enqueue({
|
|
448
|
+
archiveKey: '3dSceneLayer.json.gz',
|
|
449
|
+
writePromise: () => writeFileForSlpk(this.layers0Path, JSON.stringify(this.layers0), '3dSceneLayer.json')
|
|
450
|
+
});
|
|
464
451
|
}
|
|
465
452
|
/**
|
|
466
453
|
* Pack files into *.slpk archive
|
|
@@ -468,19 +455,17 @@ export default class I3SConverter {
|
|
|
468
455
|
*/
|
|
469
456
|
async _createSlpk(tilesetPath) {
|
|
470
457
|
await this.conversionDump.deleteDumpFile();
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
// do nothing
|
|
483
|
-
}
|
|
458
|
+
const slpkTilesetPath = join(tilesetPath, 'SceneServer', 'layers', '0');
|
|
459
|
+
const slpkFileName = `${tilesetPath}.slpk`;
|
|
460
|
+
await createZip(slpkTilesetPath, slpkFileName, async (fileList) => ({
|
|
461
|
+
path: '@specialIndexFileHASH128@',
|
|
462
|
+
file: await composeHashFile(fileList)
|
|
463
|
+
}));
|
|
464
|
+
try {
|
|
465
|
+
await removeDir(tilesetPath);
|
|
466
|
+
}
|
|
467
|
+
catch (e) {
|
|
468
|
+
// do nothing
|
|
484
469
|
}
|
|
485
470
|
}
|
|
486
471
|
/**
|
|
@@ -728,9 +713,9 @@ export default class I3SConverter {
|
|
|
728
713
|
propertyTable,
|
|
729
714
|
featuresHashArray: this.featuresHashArray,
|
|
730
715
|
attributeStorageInfo: this.attributeMetadataInfo.attributeStorageInfo,
|
|
731
|
-
draco: this.options.draco,
|
|
716
|
+
draco: this.options.draco ?? false,
|
|
732
717
|
generateBoundingVolumes: this.generateBoundingVolumes,
|
|
733
|
-
shouldMergeMaterials: this.options.mergeMaterials,
|
|
718
|
+
shouldMergeMaterials: this.options.mergeMaterials ?? false,
|
|
734
719
|
geoidHeightModel: this.geoidHeightModel,
|
|
735
720
|
libraries: this.loadOptions.modules,
|
|
736
721
|
metadataClass: this.options.metadataClass
|
|
@@ -862,47 +847,25 @@ export default class I3SConverter {
|
|
|
862
847
|
return;
|
|
863
848
|
}
|
|
864
849
|
this.conversionDump.updateDoneStatus(sourceId, nodeId, ResourceType.GEOMETRY, false);
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
const geometryPath = join(childPath, 'geometries/0/');
|
|
850
|
+
const slpkGeometryPath = join(childPath, 'geometries');
|
|
851
|
+
await this.writeQueue.enqueue({
|
|
852
|
+
archiveKey: `${slpkChildPath}/geometries/0.bin.gz`,
|
|
853
|
+
sourceId,
|
|
854
|
+
outputId: nodeId,
|
|
855
|
+
resourceType: ResourceType.GEOMETRY,
|
|
856
|
+
writePromise: () => writeFileForSlpk(slpkGeometryPath, geometryBuffer, '0.bin')
|
|
857
|
+
});
|
|
858
|
+
if (this.options.draco && compressedGeometry) {
|
|
859
|
+
this.conversionDump.updateDoneStatus(sourceId, nodeId, ResourceType.DRACO_GEOMETRY, false);
|
|
860
|
+
const slpkCompressedGeometryPath = join(childPath, 'geometries');
|
|
877
861
|
await this.writeQueue.enqueue({
|
|
862
|
+
archiveKey: `${slpkChildPath}/geometries/1.bin.gz`,
|
|
878
863
|
sourceId,
|
|
879
864
|
outputId: nodeId,
|
|
880
|
-
resourceType: ResourceType.
|
|
881
|
-
writePromise: () =>
|
|
865
|
+
resourceType: ResourceType.DRACO_GEOMETRY,
|
|
866
|
+
writePromise: () => writeFileForSlpk(slpkCompressedGeometryPath, compressedGeometry, '1.bin')
|
|
882
867
|
});
|
|
883
868
|
}
|
|
884
|
-
if (this.options.draco && compressedGeometry) {
|
|
885
|
-
this.conversionDump.updateDoneStatus(sourceId, nodeId, ResourceType.DRACO_GEOMETRY, false);
|
|
886
|
-
if (this.options.slpk) {
|
|
887
|
-
const slpkCompressedGeometryPath = join(childPath, 'geometries');
|
|
888
|
-
await this.writeQueue.enqueue({
|
|
889
|
-
archiveKey: `${slpkChildPath}/geometries/1.bin.gz`,
|
|
890
|
-
sourceId,
|
|
891
|
-
outputId: nodeId,
|
|
892
|
-
resourceType: ResourceType.DRACO_GEOMETRY,
|
|
893
|
-
writePromise: () => writeFileForSlpk(slpkCompressedGeometryPath, compressedGeometry, '1.bin')
|
|
894
|
-
});
|
|
895
|
-
}
|
|
896
|
-
else {
|
|
897
|
-
const compressedGeometryPath = join(childPath, 'geometries/1/');
|
|
898
|
-
await this.writeQueue.enqueue({
|
|
899
|
-
sourceId,
|
|
900
|
-
outputId: nodeId,
|
|
901
|
-
resourceType: ResourceType.DRACO_GEOMETRY,
|
|
902
|
-
writePromise: () => writeFile(compressedGeometryPath, compressedGeometry, 'index.bin')
|
|
903
|
-
});
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
869
|
}
|
|
907
870
|
/**
|
|
908
871
|
* Write shared resources in a file
|
|
@@ -921,25 +884,14 @@ export default class I3SConverter {
|
|
|
921
884
|
const sharedData = transform(sharedResources, sharedResourcesTemplate());
|
|
922
885
|
const sharedDataStr = JSON.stringify(sharedData);
|
|
923
886
|
this.conversionDump.updateDoneStatus(sourceId, nodeId, ResourceType.SHARED, false);
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
});
|
|
933
|
-
}
|
|
934
|
-
else {
|
|
935
|
-
const sharedPath = join(childPath, 'shared/');
|
|
936
|
-
await this.writeQueue.enqueue({
|
|
937
|
-
sourceId,
|
|
938
|
-
outputId: nodeId,
|
|
939
|
-
resourceType: ResourceType.SHARED,
|
|
940
|
-
writePromise: () => writeFile(sharedPath, sharedDataStr)
|
|
941
|
-
});
|
|
942
|
-
}
|
|
887
|
+
const slpkSharedPath = join(childPath, 'shared');
|
|
888
|
+
await this.writeQueue.enqueue({
|
|
889
|
+
archiveKey: `${slpkChildPath}/shared/sharedResource.json.gz`,
|
|
890
|
+
sourceId,
|
|
891
|
+
outputId: nodeId,
|
|
892
|
+
resourceType: ResourceType.SHARED,
|
|
893
|
+
writePromise: () => writeFileForSlpk(slpkSharedPath, sharedDataStr, 'sharedResource.json')
|
|
894
|
+
});
|
|
943
895
|
}
|
|
944
896
|
/**
|
|
945
897
|
* Generates textures based on texture mime type and fill in textureSetDefinitions data.
|
|
@@ -1049,26 +1001,15 @@ export default class I3SConverter {
|
|
|
1049
1001
|
* @param nodeId
|
|
1050
1002
|
*/
|
|
1051
1003
|
async writeTextureFile({ textureData, name, format, childPath, slpkChildPath, sourceId, nodeId }) {
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
});
|
|
1062
|
-
}
|
|
1063
|
-
else {
|
|
1064
|
-
const texturePath = join(childPath, `textures/${name}/`);
|
|
1065
|
-
await this.writeQueue.enqueue({
|
|
1066
|
-
sourceId,
|
|
1067
|
-
outputId: nodeId,
|
|
1068
|
-
resourceType: `${ResourceType.TEXTURE}/${format}`,
|
|
1069
|
-
writePromise: () => writeFile(texturePath, textureData, `index.${format}`)
|
|
1070
|
-
});
|
|
1071
|
-
}
|
|
1004
|
+
const slpkTexturePath = join(childPath, 'textures');
|
|
1005
|
+
const compress = false;
|
|
1006
|
+
await this.writeQueue.enqueue({
|
|
1007
|
+
archiveKey: `${slpkChildPath}/textures/${name}.${format}`,
|
|
1008
|
+
sourceId,
|
|
1009
|
+
outputId: nodeId,
|
|
1010
|
+
resourceType: `${ResourceType.TEXTURE}/${format}`,
|
|
1011
|
+
writePromise: () => writeFileForSlpk(slpkTexturePath, textureData, `${name}.${format}`, compress)
|
|
1012
|
+
});
|
|
1072
1013
|
}
|
|
1073
1014
|
/**
|
|
1074
1015
|
* Write feature attributes in files
|
|
@@ -1087,25 +1028,14 @@ export default class I3SConverter {
|
|
|
1087
1028
|
const folderName = this.attributeMetadataInfo.attributeStorageInfo[index].key;
|
|
1088
1029
|
const fileBuffer = new Uint8Array(attributes[index]);
|
|
1089
1030
|
this.conversionDump.updateDoneStatus(sourceId, nodeId, `${ResourceType.ATTRIBUTES}/${folderName}`, false);
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
});
|
|
1099
|
-
}
|
|
1100
|
-
else {
|
|
1101
|
-
const attributesPath = join(childPath, `attributes/${folderName}/0`);
|
|
1102
|
-
await this.writeQueue.enqueue({
|
|
1103
|
-
sourceId,
|
|
1104
|
-
outputId: nodeId,
|
|
1105
|
-
resourceType: `${ResourceType.ATTRIBUTES}/${folderName}`,
|
|
1106
|
-
writePromise: () => writeFile(attributesPath, fileBuffer, 'index.bin')
|
|
1107
|
-
});
|
|
1108
|
-
}
|
|
1031
|
+
const slpkAttributesPath = join(childPath, 'attributes', folderName);
|
|
1032
|
+
await this.writeQueue.enqueue({
|
|
1033
|
+
archiveKey: `${slpkChildPath}/attributes/${folderName}.bin.gz`,
|
|
1034
|
+
sourceId,
|
|
1035
|
+
outputId: nodeId,
|
|
1036
|
+
resourceType: `${ResourceType.ATTRIBUTES}/${folderName}`,
|
|
1037
|
+
writePromise: () => writeFileForSlpk(slpkAttributesPath, fileBuffer, '0.bin')
|
|
1038
|
+
});
|
|
1109
1039
|
}
|
|
1110
1040
|
}
|
|
1111
1041
|
}
|
|
@@ -1212,7 +1142,7 @@ export default class I3SConverter {
|
|
|
1212
1142
|
const options = {
|
|
1213
1143
|
'cesium-ion': { accessToken: this.options.token || ION_DEFAULT_TOKEN }
|
|
1214
1144
|
};
|
|
1215
|
-
const preloadOptions = await this.Loader.preload(this.options.inputUrl, options);
|
|
1145
|
+
const preloadOptions = await this.Loader.preload(this.options.inputUrl ?? '', options);
|
|
1216
1146
|
this.refreshTokenTime = process.hrtime();
|
|
1217
1147
|
return { ...options, ...preloadOptions };
|
|
1218
1148
|
}
|
package/dist/i3s-server/app.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/i3s-server/app.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/i3s-server/app.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAgB9B,eAAO,IAAI,GAAG,EAAE,UAAU,CAAC,OAAO,OAAO,CAAC,GAAG,SAAS,CAAC"}
|
package/dist/i3s-server/app.js
CHANGED
|
@@ -5,20 +5,20 @@ import cors from 'cors';
|
|
|
5
5
|
// For local debug
|
|
6
6
|
// import {fileURLToPath} from 'url';
|
|
7
7
|
import { loadArchive } from "./controllers/slpk-controller.js";
|
|
8
|
-
import { router as indexRouter } from "./routes.js";
|
|
9
8
|
import { sceneServerRouter, router } from "./routes/slpk-router.js";
|
|
10
9
|
// For local debug
|
|
11
10
|
// const __filename = fileURLToPath(import.meta.url);
|
|
12
11
|
// const __dirname = path.dirname(__filename);
|
|
13
12
|
const I3S_LAYER_PATH = process.env.I3sLayerPath || ''; // eslint-disable-line no-process-env, no-undef
|
|
14
13
|
const FULL_LAYER_PATH = path.join(process.cwd(), I3S_LAYER_PATH); // eslint-disable-line no-undef
|
|
15
|
-
export
|
|
16
|
-
app.use(logger('dev'));
|
|
17
|
-
app.use(express.json());
|
|
18
|
-
app.use(express.urlencoded({ extended: false }));
|
|
19
|
-
app.use(express.static(path.join(__dirname, 'public')));
|
|
20
|
-
app.use(cors());
|
|
14
|
+
export let app;
|
|
21
15
|
if (/\.slpk$/.test(I3S_LAYER_PATH)) {
|
|
16
|
+
app = express();
|
|
17
|
+
app.use(logger('dev'));
|
|
18
|
+
app.use(express.json());
|
|
19
|
+
app.use(express.urlencoded({ extended: false }));
|
|
20
|
+
app.use(express.static(path.join(__dirname, 'public')));
|
|
21
|
+
app.use(cors());
|
|
22
22
|
let filePath = FULL_LAYER_PATH;
|
|
23
23
|
// Checks if the first character is not a point to indicate absolute path
|
|
24
24
|
const absolutePath = /^[^.]/.exec(I3S_LAYER_PATH);
|
|
@@ -29,6 +29,3 @@ if (/\.slpk$/.test(I3S_LAYER_PATH)) {
|
|
|
29
29
|
app.use('/SceneServer/layers/0', router);
|
|
30
30
|
app.use('/SceneServer', sceneServerRouter);
|
|
31
31
|
}
|
|
32
|
-
else {
|
|
33
|
-
app.use('/', indexRouter);
|
|
34
|
-
}
|