@loaders.gl/tile-converter 4.2.0-alpha.5 → 4.2.0-beta.1
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 +1 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.js +42 -22
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js +4 -0
- package/dist/3d-tiles-converter/helpers/load-i3s.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/load-i3s.js +3 -28
- package/dist/converter-cli.js +4 -2
- package/dist/converter.min.cjs +95 -95
- package/dist/deps-installer/deps-installer.d.ts.map +1 -1
- package/dist/deps-installer/deps-installer.js +9 -1
- package/dist/i3s-converter/helpers/attribute-metadata-info.js +4 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.js +2 -1
- package/dist/i3s-converter/helpers/coordinate-converter.js +2 -2
- package/dist/i3s-converter/helpers/feature-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/feature-attributes.js +4 -2
- package/dist/i3s-converter/helpers/geometry-attributes.js +6 -5
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +15 -1
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.js +52 -12
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/gltf-attributes.js +12 -14
- package/dist/i3s-converter/helpers/node-index-document.d.ts +8 -1
- package/dist/i3s-converter/helpers/node-index-document.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-index-document.js +18 -11
- package/dist/i3s-converter/helpers/node-pages.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-pages.js +27 -26
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/progress.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/progress.js +23 -18
- package/dist/i3s-converter/helpers/tileset-traversal.d.ts +8 -1
- package/dist/i3s-converter/helpers/tileset-traversal.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/tileset-traversal.js +12 -3
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +190 -66
- package/dist/i3s-converter/json-templates/node.js +1 -1
- package/dist/i3s-server/bin/i3s-server.min.cjs +76 -76
- package/dist/i3s-server/bin/www.js +6 -4
- package/dist/i3s-server/controllers/slpk-controller.d.ts.map +1 -1
- package/dist/i3s-server/controllers/slpk-controller.js +3 -1
- package/dist/i3s-server/routes/index.js +11 -8
- package/dist/i3s-server/routes/slpk-router.d.ts.map +1 -1
- package/dist/i3s-server/routes/slpk-router.js +24 -18
- package/dist/i3s-server/utils/server-utils.d.ts.map +1 -1
- package/dist/i3s-server/utils/server-utils.js +8 -5
- package/dist/index.cjs +421 -211
- package/dist/index.cjs.map +3 -3
- package/dist/lib/utils/cli-utils.d.ts.map +1 -1
- package/dist/lib/utils/cli-utils.js +2 -0
- package/dist/lib/utils/conversion-dump.d.ts +9 -1
- package/dist/lib/utils/conversion-dump.d.ts.map +1 -1
- package/dist/lib/utils/conversion-dump.js +44 -21
- package/dist/lib/utils/file-utils.d.ts +1 -1
- package/dist/lib/utils/file-utils.d.ts.map +1 -1
- package/dist/lib/utils/file-utils.js +10 -12
- package/dist/lib/utils/statistic-utills.d.ts.map +1 -1
- package/dist/lib/utils/statistic-utills.js +5 -7
- package/dist/lib/utils/write-queue.d.ts.map +1 -1
- package/dist/lib/utils/write-queue.js +7 -3
- package/dist/pgm-loader.d.ts +17 -2
- package/dist/pgm-loader.d.ts.map +1 -1
- package/dist/pgm-loader.js +3 -1
- package/dist/slpk-extractor/slpk-extractor.d.ts.map +1 -1
- package/dist/slpk-extractor/slpk-extractor.js +2 -1
- package/dist/slpk-extractor-cli.d.ts.map +1 -1
- package/dist/slpk-extractor-cli.js +16 -8
- package/dist/slpk-extractor.min.cjs +36 -36
- package/package.json +23 -22
- package/src/3d-tiles-converter/3d-tiles-converter.ts +21 -10
- package/src/3d-tiles-converter/helpers/b3dm-converter.ts +1 -0
- package/src/3d-tiles-converter/helpers/load-i3s.ts +3 -27
- package/src/converter-cli.ts +4 -2
- package/src/deps-installer/deps-installer.ts +11 -0
- package/src/i3s-converter/helpers/attribute-metadata-info.ts +1 -1
- package/src/i3s-converter/helpers/batch-ids-extensions.ts +3 -1
- package/src/i3s-converter/helpers/coordinate-converter.ts +2 -2
- package/src/i3s-converter/helpers/feature-attributes.ts +5 -2
- package/src/i3s-converter/helpers/geometry-attributes.ts +6 -5
- package/src/i3s-converter/helpers/geometry-converter.ts +118 -72
- package/src/i3s-converter/helpers/gltf-attributes.ts +12 -13
- package/src/i3s-converter/helpers/node-index-document.ts +18 -10
- package/src/i3s-converter/helpers/node-pages.ts +27 -29
- package/src/i3s-converter/helpers/preprocess-3d-tiles.ts +1 -0
- package/src/i3s-converter/helpers/progress.ts +1 -0
- package/src/i3s-converter/helpers/tileset-traversal.ts +22 -13
- package/src/i3s-converter/i3s-converter.ts +173 -114
- package/src/i3s-converter/json-templates/node.ts +1 -1
- package/src/i3s-server/bin/www.ts +6 -4
- package/src/i3s-server/controllers/slpk-controller.ts +4 -2
- package/src/i3s-server/routes/index.ts +10 -7
- package/src/i3s-server/routes/slpk-router.ts +22 -16
- package/src/i3s-server/utils/server-utils.ts +6 -4
- package/src/lib/utils/cli-utils.ts +2 -0
- package/src/lib/utils/conversion-dump.ts +35 -20
- package/src/lib/utils/file-utils.ts +11 -11
- package/src/lib/utils/statistic-utills.ts +5 -6
- package/src/lib/utils/write-queue.ts +2 -2
- package/src/pgm-loader.ts +5 -2
- package/src/slpk-extractor/slpk-extractor.ts +2 -1
- package/src/slpk-extractor-cli.ts +16 -8
- package/src/lib/utils/statistic-utills.d.ts +0 -25
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/tile-converter",
|
|
3
|
-
"version": "4.2.0-
|
|
3
|
+
"version": "4.2.0-beta.1",
|
|
4
4
|
"description": "Converter",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
},
|
|
29
29
|
"sideEffects": false,
|
|
30
30
|
"bin": {
|
|
31
|
-
"
|
|
31
|
+
"i3s-server": "./bin/i3s-server.js",
|
|
32
32
|
"slpk-extractor": "./bin/slpk-extractor.js",
|
|
33
|
-
"
|
|
33
|
+
"tile-converter": "./bin/converter.js"
|
|
34
34
|
},
|
|
35
35
|
"files": [
|
|
36
36
|
"src",
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"README.md"
|
|
40
40
|
],
|
|
41
41
|
"browser": {
|
|
42
|
+
"archiver": false,
|
|
42
43
|
"fs": false,
|
|
44
|
+
"join-images": false,
|
|
43
45
|
"path": false,
|
|
44
|
-
"process": false
|
|
45
|
-
"archiver": false,
|
|
46
|
-
"join-images": false
|
|
46
|
+
"process": false
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"pre-build": "npm run build-converter-bundle && npm run build-slpk-extractor-bundle && npm run build-i3s-server-bundle",
|
|
@@ -52,18 +52,20 @@
|
|
|
52
52
|
"build-i3s-server-bundle": "esbuild src/i3s-server/bin/www.ts --outfile=dist/i3s-server/bin/i3s-server.min.cjs --platform=node --target=esnext,node14 --minify --bundle --define:__VERSION__=\\\"$npm_package_version\\\""
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@loaders.gl/3d-tiles": "4.2.0-
|
|
56
|
-
"@loaders.gl/
|
|
57
|
-
"@loaders.gl/
|
|
58
|
-
"@loaders.gl/
|
|
59
|
-
"@loaders.gl/
|
|
60
|
-
"@loaders.gl/
|
|
61
|
-
"@loaders.gl/
|
|
62
|
-
"@loaders.gl/
|
|
63
|
-
"@loaders.gl/
|
|
64
|
-
"@loaders.gl/
|
|
65
|
-
"@loaders.gl/
|
|
66
|
-
"@loaders.gl/
|
|
55
|
+
"@loaders.gl/3d-tiles": "4.2.0-beta.1",
|
|
56
|
+
"@loaders.gl/compression": "4.2.0-beta.1",
|
|
57
|
+
"@loaders.gl/crypto": "4.2.0-beta.1",
|
|
58
|
+
"@loaders.gl/draco": "4.2.0-beta.1",
|
|
59
|
+
"@loaders.gl/gltf": "4.2.0-beta.1",
|
|
60
|
+
"@loaders.gl/i3s": "4.2.0-beta.1",
|
|
61
|
+
"@loaders.gl/images": "4.2.0-beta.1",
|
|
62
|
+
"@loaders.gl/loader-utils": "4.2.0-beta.1",
|
|
63
|
+
"@loaders.gl/math": "4.2.0-beta.1",
|
|
64
|
+
"@loaders.gl/polyfills": "4.2.0-beta.1",
|
|
65
|
+
"@loaders.gl/textures": "4.2.0-beta.1",
|
|
66
|
+
"@loaders.gl/tiles": "4.2.0-beta.1",
|
|
67
|
+
"@loaders.gl/worker-utils": "4.2.0-beta.1",
|
|
68
|
+
"@loaders.gl/zip": "4.2.0-beta.1",
|
|
67
69
|
"@math.gl/core": "^4.0.0",
|
|
68
70
|
"@math.gl/culling": "^4.0.0",
|
|
69
71
|
"@math.gl/geoid": "^4.0.0",
|
|
@@ -73,7 +75,7 @@
|
|
|
73
75
|
"cors": "^2.8.5",
|
|
74
76
|
"crypt": "^0.0.2",
|
|
75
77
|
"debug": "~4.3.4",
|
|
76
|
-
"express": "~4.
|
|
78
|
+
"express": "~4.19.2",
|
|
77
79
|
"inquirer": "^8.0.0",
|
|
78
80
|
"json-map-transform": "^1.2.6",
|
|
79
81
|
"jszip": "^3.5.0",
|
|
@@ -86,11 +88,10 @@
|
|
|
86
88
|
"sharp": "^0.31.3"
|
|
87
89
|
},
|
|
88
90
|
"devDependencies": {
|
|
89
|
-
"@types/express": "^4.17.17"
|
|
90
|
-
"@types/node": "^20.4.2"
|
|
91
|
+
"@types/express": "^4.17.17"
|
|
91
92
|
},
|
|
92
93
|
"peerDependencies": {
|
|
93
94
|
"@loaders.gl/core": "^4.0.0"
|
|
94
95
|
},
|
|
95
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "c386a9196516fe3ff24847b40e6c77be039cf905"
|
|
96
97
|
}
|
|
@@ -81,6 +81,7 @@ export default class Tiles3DConverter {
|
|
|
81
81
|
* @param options.egmFilePath location of *.pgm file to convert heights from ellipsoidal to gravity-related format
|
|
82
82
|
* @param options.maxDepth The max tree depth of conversion
|
|
83
83
|
*/
|
|
84
|
+
// eslint-disable-next-line complexity, max-statements
|
|
84
85
|
public async convert(options: {
|
|
85
86
|
inputUrl: string;
|
|
86
87
|
outputPath: string;
|
|
@@ -89,9 +90,9 @@ export default class Tiles3DConverter {
|
|
|
89
90
|
egmFilePath: string;
|
|
90
91
|
inquirer?: Promise<unknown>;
|
|
91
92
|
analyze?: boolean;
|
|
92
|
-
}): Promise<
|
|
93
|
+
}): Promise<string | undefined> {
|
|
93
94
|
if (isBrowser) {
|
|
94
|
-
console.log(BROWSER_ERROR_MESSAGE);
|
|
95
|
+
console.log(BROWSER_ERROR_MESSAGE); // eslint-disable-line no-console
|
|
95
96
|
return BROWSER_ERROR_MESSAGE;
|
|
96
97
|
}
|
|
97
98
|
const {inputUrl, outputPath, tilesetName, maxDepth, egmFilePath, inquirer, analyze} = options;
|
|
@@ -108,7 +109,7 @@ export default class Tiles3DConverter {
|
|
|
108
109
|
if (analyze || this.slpkFilesystem) {
|
|
109
110
|
preprocessResult = await this.preprocessConversion();
|
|
110
111
|
if (!preprocessResult || analyze) {
|
|
111
|
-
return;
|
|
112
|
+
return undefined;
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
115
|
|
|
@@ -126,7 +127,7 @@ export default class Tiles3DConverter {
|
|
|
126
127
|
);
|
|
127
128
|
|
|
128
129
|
if (!this.sourceTileset) {
|
|
129
|
-
return;
|
|
130
|
+
return undefined;
|
|
130
131
|
}
|
|
131
132
|
|
|
132
133
|
const rootNode = this.sourceTileset?.root;
|
|
@@ -186,6 +187,7 @@ export default class Tiles3DConverter {
|
|
|
186
187
|
// Clean up worker pools
|
|
187
188
|
const workerFarm = WorkerFarm.getWorkerFarm({});
|
|
188
189
|
workerFarm.destroy();
|
|
190
|
+
return undefined;
|
|
189
191
|
}
|
|
190
192
|
|
|
191
193
|
/**
|
|
@@ -193,24 +195,32 @@ export default class Tiles3DConverter {
|
|
|
193
195
|
* @returns true - the conversion is possible, false - the tileset's content is not supported
|
|
194
196
|
*/
|
|
195
197
|
private async preprocessConversion(): Promise<boolean> {
|
|
196
|
-
|
|
198
|
+
// eslint-disable-next-line no-console
|
|
199
|
+
console.log('Analyze source layer');
|
|
197
200
|
const nodesCount = await getNodeCount(this.slpkFilesystem);
|
|
198
201
|
this.progress.stepsTotal = nodesCount;
|
|
199
202
|
|
|
200
|
-
console
|
|
201
|
-
console.log(
|
|
203
|
+
// eslint-disable-next-line no-console
|
|
204
|
+
console.log('------------------------------------------------');
|
|
205
|
+
// eslint-disable-next-line no-console
|
|
206
|
+
console.log('Preprocess results:');
|
|
202
207
|
if (this.slpkFilesystem) {
|
|
208
|
+
// eslint-disable-next-line no-console
|
|
203
209
|
console.log(`Node count: ${nodesCount}`);
|
|
204
210
|
if (nodesCount === 0) {
|
|
211
|
+
// eslint-disable-next-line no-console
|
|
205
212
|
console.log('Node count is 0. The conversion will be interrupted.');
|
|
206
|
-
console
|
|
213
|
+
// eslint-disable-next-line no-console
|
|
214
|
+
console.log('------------------------------------------------');
|
|
207
215
|
return false;
|
|
208
216
|
}
|
|
209
217
|
} else {
|
|
210
|
-
|
|
218
|
+
// eslint-disable-next-line no-console
|
|
219
|
+
console.log('Node count cannot be calculated for the remote dataset');
|
|
211
220
|
}
|
|
212
221
|
|
|
213
|
-
console
|
|
222
|
+
// eslint-disable-next-line no-console
|
|
223
|
+
console.log('------------------------------------------------');
|
|
214
224
|
return true;
|
|
215
225
|
}
|
|
216
226
|
|
|
@@ -221,6 +231,7 @@ export default class Tiles3DConverter {
|
|
|
221
231
|
* @param level a current level of a tree depth
|
|
222
232
|
* @param childNodeInfo child node to convert
|
|
223
233
|
*/
|
|
234
|
+
// eslint-disable-next-line complexity, max-statements
|
|
224
235
|
private async convertChildNode(
|
|
225
236
|
parentSourceNode: I3STileHeader,
|
|
226
237
|
parentNode: Tiles3DTileJSON,
|
|
@@ -54,6 +54,7 @@ export default class B3dmConverter {
|
|
|
54
54
|
* @param i3sTile - Tile3D instance for I3S node
|
|
55
55
|
* @returns - encoded glb content
|
|
56
56
|
*/
|
|
57
|
+
// eslint-disable-next-line max-statements
|
|
57
58
|
async buildGLTF(
|
|
58
59
|
i3sAttributesData: I3SAttributesData,
|
|
59
60
|
featureAttributes: any
|
|
@@ -73,8 +73,7 @@ export const loadI3SContent = async (
|
|
|
73
73
|
*/
|
|
74
74
|
export async function openSLPK(url: string): Promise<ZipFileSystem | null> {
|
|
75
75
|
const slpkUrlParts = url.split('.slpk');
|
|
76
|
-
|
|
77
|
-
if (slpkFileName) {
|
|
76
|
+
if (slpkUrlParts.length === 2) {
|
|
78
77
|
const slpkFileName = `${slpkUrlParts[0]}.slpk`;
|
|
79
78
|
const fileProvider = new FileHandleFile(slpkFileName);
|
|
80
79
|
const archive = await parseSLPKArchive(fileProvider, undefined, slpkFileName);
|
|
@@ -97,10 +96,8 @@ export async function loadFromArchive(
|
|
|
97
96
|
loadOptions: I3SLoaderOptions,
|
|
98
97
|
fileSystem: ZipFileSystem | null
|
|
99
98
|
) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
const {internalFileName} = slpkUrlParts;
|
|
103
|
-
const content = await load(internalFileName, loader, {
|
|
99
|
+
if (fileSystem !== null) {
|
|
100
|
+
const content = await load(url, loader, {
|
|
104
101
|
...loadOptions,
|
|
105
102
|
fetch: fileSystem.fetch.bind(fileSystem)
|
|
106
103
|
});
|
|
@@ -109,27 +106,6 @@ export async function loadFromArchive(
|
|
|
109
106
|
return await load(url, loader, loadOptions);
|
|
110
107
|
}
|
|
111
108
|
|
|
112
|
-
/**
|
|
113
|
-
* Extract slpk file path and internal from the url
|
|
114
|
-
* For example, for `./path/to/file.slpk/nodes/0` it returns
|
|
115
|
-
* {"slpkFileName": "./path/to/file.slpk", "internalFileName": "/nodes/0" }
|
|
116
|
-
* @param url full internal file path
|
|
117
|
-
* @returns object with internal slpk file parts
|
|
118
|
-
*/
|
|
119
|
-
function getSlpkUrlParts(url: string): SLPKUrlParts | null {
|
|
120
|
-
const slpkUrlParts = url.split('.slpk');
|
|
121
|
-
let result: SLPKUrlParts | null;
|
|
122
|
-
// Not '.slpk'. The file will be loaded with global fetch function
|
|
123
|
-
if (slpkUrlParts.length === 1) {
|
|
124
|
-
result = null;
|
|
125
|
-
} else if (slpkUrlParts.length === 2) {
|
|
126
|
-
result = {slpkFileName: `${slpkUrlParts[0]}.slpk`, internalFileName: slpkUrlParts[1].slice(1)};
|
|
127
|
-
} else {
|
|
128
|
-
throw new Error('Unexpected URL format');
|
|
129
|
-
}
|
|
130
|
-
return result;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
109
|
/**
|
|
134
110
|
* Get nodes count inside SLPK
|
|
135
111
|
* @param fileSystem - file system of SLPK
|
package/src/converter-cli.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
} from './lib/utils/cli-utils';
|
|
14
14
|
import {addOneFile, composeHashFile, makeZipCDHeaderIterator} from '@loaders.gl/zip';
|
|
15
15
|
import {FileHandleFile} from '@loaders.gl/loader-utils';
|
|
16
|
+
// @ts-ignore
|
|
16
17
|
import {copyFile} from 'node:fs/promises';
|
|
17
18
|
|
|
18
19
|
type TileConversionOptions = {
|
|
@@ -82,6 +83,7 @@ const TILESET_TYPE = {
|
|
|
82
83
|
* CLI entry
|
|
83
84
|
* @returns
|
|
84
85
|
*/
|
|
86
|
+
// eslint-disable-next-line max-statements
|
|
85
87
|
async function main() {
|
|
86
88
|
const [, , ...args] = process.argv;
|
|
87
89
|
|
|
@@ -152,7 +154,7 @@ async function main() {
|
|
|
152
154
|
|
|
153
155
|
main().catch((error) => {
|
|
154
156
|
console.log(error);
|
|
155
|
-
process.exit(1); // eslint-disable-line
|
|
157
|
+
process.exit(1); // eslint-disable-line no-process-exit
|
|
156
158
|
});
|
|
157
159
|
|
|
158
160
|
/**
|
|
@@ -295,7 +297,7 @@ function validateOptions(
|
|
|
295
297
|
}
|
|
296
298
|
if (exceptions.length) {
|
|
297
299
|
exceptions.forEach((exeption) => exeption());
|
|
298
|
-
process.exit(1);
|
|
300
|
+
process.exit(1); // eslint-disable-line no-process-exit
|
|
299
301
|
}
|
|
300
302
|
return <ValidatedTileConversionOptions>options;
|
|
301
303
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright vis.gl contributors
|
|
4
|
+
|
|
1
5
|
import {load, fetchFile} from '@loaders.gl/core';
|
|
2
6
|
import {ZipLoader} from '@loaders.gl/zip';
|
|
3
7
|
import {writeFile} from '../lib/utils/file-utils';
|
|
@@ -25,6 +29,7 @@ export class DepsInstaller {
|
|
|
25
29
|
* This path is '' by default and is not used by tile-converter.
|
|
26
30
|
* It is used in tests to prevent rewriting actual workers during tests running
|
|
27
31
|
*/
|
|
32
|
+
// eslint-disable-next-line max-statements
|
|
28
33
|
async install(path: string = ''): Promise<void> {
|
|
29
34
|
console.log('Installing "EGM2008-5" model...'); // eslint-disable-line no-console
|
|
30
35
|
const fileMap = await load(PGM_LINK, ZipLoader, {});
|
|
@@ -78,6 +83,7 @@ export class DepsInstaller {
|
|
|
78
83
|
await this.installFromNpm('textures', BASIS_EXTERNAL_LIBRARIES.ENCODER, 'libs');
|
|
79
84
|
await this.installFromNpm('textures', BASIS_EXTERNAL_LIBRARIES.ENCODER_WASM, 'libs');
|
|
80
85
|
|
|
86
|
+
// eslint-disable-next-line no-console
|
|
81
87
|
console.log('Installing "join-images" npm package');
|
|
82
88
|
const childProcess = new ChildProcessProxy();
|
|
83
89
|
const nodeDir = dirname(process.execPath);
|
|
@@ -98,6 +104,11 @@ export class DepsInstaller {
|
|
|
98
104
|
const fileResponse = await fetchFile(
|
|
99
105
|
`https://unpkg.com/@loaders.gl/${module}@${VERSION}/dist/${extraPath}/${name}`
|
|
100
106
|
);
|
|
107
|
+
|
|
108
|
+
if (fileResponse.status < 200 || fileResponse.status >= 300) {
|
|
109
|
+
throw new Error(`Failed to load resource ${name}`);
|
|
110
|
+
}
|
|
111
|
+
|
|
101
112
|
const fileData = await fileResponse.arrayBuffer();
|
|
102
113
|
if (!fileData) {
|
|
103
114
|
return;
|
|
@@ -94,7 +94,7 @@ export class AttributeMetadataInfo {
|
|
|
94
94
|
Use attributeStorageInfo as a source of attribute names to create the popupInfo.
|
|
95
95
|
*/
|
|
96
96
|
const attributeNames: string[] = [];
|
|
97
|
-
for (
|
|
97
|
+
for (const info of this._attributeStorageInfo) {
|
|
98
98
|
attributeNames.push(info.name);
|
|
99
99
|
}
|
|
100
100
|
this._popupInfo = this.createPopupInfo(attributeNames);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable camelcase */
|
|
1
2
|
import {GLTFAccessorPostprocessed, GLTFMeshPrimitivePostprocessed} from '@loaders.gl/gltf';
|
|
2
3
|
import type {NumericArray} from '@loaders.gl/loader-utils';
|
|
3
4
|
import type {
|
|
@@ -94,7 +95,7 @@ function handleExtMeshFeaturesExtension(
|
|
|
94
95
|
},
|
|
95
96
|
extMeshFeatures: GLTF_EXT_mesh_features
|
|
96
97
|
): NumericArray {
|
|
97
|
-
for (
|
|
98
|
+
for (const ids of extMeshFeatures.featureIds) {
|
|
98
99
|
if (typeof ids.propertyTable !== 'undefined') {
|
|
99
100
|
// propertyTable is an index that can be 0
|
|
100
101
|
// return the first featureID set that corresponts to property table.
|
|
@@ -240,6 +241,7 @@ function generateBatchIdsFromTexture(
|
|
|
240
241
|
batchIds.push(batchId);
|
|
241
242
|
}
|
|
242
243
|
} else {
|
|
244
|
+
// eslint-disable-next-line no-console
|
|
243
245
|
console.warn(`Can't get batch Ids from ${image?.mimeType || ''} compressed texture`);
|
|
244
246
|
}
|
|
245
247
|
|
|
@@ -67,8 +67,8 @@ export function createBoundingVolumesFromGeometry(
|
|
|
67
67
|
const geometryObb = makeOrientedBoundingBoxFromPoints(positionVectors);
|
|
68
68
|
const geometryMbs = makeBoundingSphereFromPoints(positionVectors);
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
const mbsCenter = Ellipsoid.WGS84.cartesianToCartographic(geometryMbs.center, new Vector3());
|
|
71
|
+
const obbCenter = Ellipsoid.WGS84.cartesianToCartographic(geometryObb.center, new Vector3());
|
|
72
72
|
|
|
73
73
|
mbsCenter[2] = mbsCenter[2] - geoidHeightModel.getHeight(mbsCenter[1], mbsCenter[0]);
|
|
74
74
|
obbCenter[2] = obbCenter[2] - geoidHeightModel.getHeight(obbCenter[1], obbCenter[0]);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable camelcase */
|
|
1
2
|
import type {FeatureTableJson} from '@loaders.gl/3d-tiles';
|
|
2
3
|
import type {Attribute} from '@loaders.gl/i3s';
|
|
3
4
|
import type {
|
|
@@ -137,7 +138,7 @@ export const getAttributeTypesMapFromSchema = (
|
|
|
137
138
|
gltfJson.extensions?.[EXT_FEATURE_METADATA] as GLTF_EXT_feature_metadata_GLTF
|
|
138
139
|
)?.schema?.classes?.[metadataClass];
|
|
139
140
|
if (extFeatureMetadataSchemaClass) {
|
|
140
|
-
for (
|
|
141
|
+
for (const propertyName in extFeatureMetadataSchemaClass.properties) {
|
|
141
142
|
const property = extFeatureMetadataSchemaClass.properties[propertyName];
|
|
142
143
|
const attributeProperty = getAttributeTypeFromExtFeatureMetadata(property);
|
|
143
144
|
attributeTypesMap[propertyName] = attributeProperty;
|
|
@@ -149,7 +150,7 @@ export const getAttributeTypesMapFromSchema = (
|
|
|
149
150
|
gltfJson.extensions?.[EXT_STRUCTURAL_METADATA] as GLTF_EXT_structural_metadata_GLTF
|
|
150
151
|
)?.schema?.classes?.[metadataClass];
|
|
151
152
|
if (extStructuralMetadataSchemaClass) {
|
|
152
|
-
for (
|
|
153
|
+
for (const propertyName in extStructuralMetadataSchemaClass.properties) {
|
|
153
154
|
const property = extStructuralMetadataSchemaClass.properties[propertyName];
|
|
154
155
|
const attributeProperty = getAttributeTypeFromExtStructuralMetadata(property);
|
|
155
156
|
attributeTypesMap[propertyName] = attributeProperty;
|
|
@@ -166,6 +167,7 @@ export const getAttributeTypesMapFromSchema = (
|
|
|
166
167
|
* @param property - schema of the class property for Ext_feature_metadata
|
|
167
168
|
* @returns attribute's type
|
|
168
169
|
*/
|
|
170
|
+
// eslint-disable-next-line complexity
|
|
169
171
|
const getAttributeTypeFromExtFeatureMetadata = (
|
|
170
172
|
property: GLTF_EXT_feature_metadata_ClassProperty
|
|
171
173
|
): Attribute => {
|
|
@@ -207,6 +209,7 @@ const getAttributeTypeFromExtFeatureMetadata = (
|
|
|
207
209
|
* @param property - schema of the class property for Ext_structural_metadata
|
|
208
210
|
* @returns attribute's type
|
|
209
211
|
*/
|
|
212
|
+
// eslint-disable-next-line complexity
|
|
210
213
|
const getAttributeTypeFromExtStructuralMetadata = (
|
|
211
214
|
property: GLTF_EXT_structural_metadata_ClassProperty
|
|
212
215
|
): Attribute => {
|
|
@@ -113,6 +113,7 @@ function getFrequentValue(values: number[]): number {
|
|
|
113
113
|
* @param attributes
|
|
114
114
|
* @returns sorted list of attribute objects.
|
|
115
115
|
*/
|
|
116
|
+
// eslint-disable-next-line max-statements
|
|
116
117
|
function makeAttributeObjects(attributes: GeometryAttributes): GroupedByFeatureIdAttributes[] {
|
|
117
118
|
const {
|
|
118
119
|
featureIds,
|
|
@@ -125,11 +126,11 @@ function makeAttributeObjects(attributes: GeometryAttributes): GroupedByFeatureI
|
|
|
125
126
|
} = attributes;
|
|
126
127
|
const groupedData: GroupedByFeatureIdAttributes[] = [];
|
|
127
128
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
const positionsList = new Float32Array(positions);
|
|
130
|
+
const normalsList = new Float32Array(normals);
|
|
131
|
+
const colorsList = new Uint8Array(colors);
|
|
132
|
+
const texCoordsList = new Float32Array(texCoords);
|
|
133
|
+
const uvRegionsList = new Uint16Array(uvRegions);
|
|
133
134
|
let positionsOffset = 0;
|
|
134
135
|
let normalsOffset = 0;
|
|
135
136
|
let colorsOffset = 0;
|