@loaders.gl/tile-converter 4.0.0-alpha.13 → 4.0.0-alpha.15
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/i3s-server.js +4 -0
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +0 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.js +8 -19
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts +4 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
- package/dist/converter.min.js +65 -65
- package/dist/dist.min.js +881 -261
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +34 -67
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/es5/deps-installer/deps-installer.js +1 -1
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/i3s-converter.js +36 -43
- package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/es5/i3s-converter/types.js.map +1 -1
- package/dist/es5/i3s-server/README.md +46 -2
- package/dist/es5/i3s-server/app.js +3 -3
- package/dist/es5/i3s-server/app.js.map +1 -1
- package/dist/es5/i3s-server/bin/www.js +61 -0
- package/dist/es5/i3s-server/bin/www.js.map +1 -0
- package/dist/es5/i3s-server/controllers/slpk-controller.js +14 -18
- package/dist/es5/i3s-server/controllers/slpk-controller.js.map +1 -1
- package/dist/es5/index.js +7 -0
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/pgm-loader.js +1 -1
- package/dist/es5/slpk-extractor/helpers/file-handle-provider.js +59 -26
- package/dist/es5/slpk-extractor/helpers/file-handle-provider.js.map +1 -1
- package/dist/es5/slpk-extractor/helpers/fs-promises.js +77 -0
- package/dist/es5/slpk-extractor/helpers/fs-promises.js.map +1 -0
- package/dist/es5/slpk-extractor/slpk-extractor.js +7 -7
- package/dist/es5/slpk-extractor/slpk-extractor.js.map +1 -1
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +8 -18
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/esm/deps-installer/deps-installer.js +1 -1
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/i3s-converter.js +5 -8
- package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/esm/i3s-converter/types.js.map +1 -1
- package/dist/esm/i3s-server/README.md +46 -2
- package/dist/esm/i3s-server/app.js +4 -4
- package/dist/esm/i3s-server/app.js.map +1 -1
- package/dist/esm/i3s-server/bin/i3s-server.min.js +614 -0
- package/{src/i3s-server/bin/www → dist/esm/i3s-server/bin/www.js} +12 -55
- package/dist/esm/i3s-server/bin/www.js.map +1 -0
- package/dist/esm/i3s-server/controllers/slpk-controller.js +6 -12
- package/dist/esm/i3s-server/controllers/slpk-controller.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/pgm-loader.js +1 -1
- package/dist/esm/slpk-extractor/helpers/file-handle-provider.js +17 -6
- package/dist/esm/slpk-extractor/helpers/file-handle-provider.js.map +1 -1
- package/dist/esm/slpk-extractor/helpers/fs-promises.js +32 -0
- package/dist/esm/slpk-extractor/helpers/fs-promises.js.map +1 -0
- package/dist/esm/slpk-extractor/slpk-extractor.js +2 -2
- package/dist/esm/slpk-extractor/slpk-extractor.js.map +1 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +1 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +2 -3
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts +2 -2
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +5 -6
- package/dist/i3s-converter/types.d.ts +32 -1
- package/dist/i3s-converter/types.d.ts.map +1 -1
- package/dist/i3s-server/app.d.ts.map +1 -1
- package/dist/i3s-server/app.js +1 -1
- package/dist/i3s-server/bin/www.d.ts +3 -0
- package/dist/i3s-server/bin/www.d.ts.map +1 -0
- package/dist/i3s-server/bin/www.js +83 -0
- package/dist/i3s-server/controllers/slpk-controller.d.ts.map +1 -1
- package/dist/i3s-server/controllers/slpk-controller.js +4 -9
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/slpk-extractor/helpers/file-handle-provider.d.ts +15 -12
- package/dist/slpk-extractor/helpers/file-handle-provider.d.ts.map +1 -1
- package/dist/slpk-extractor/helpers/file-handle-provider.js +25 -10
- package/dist/slpk-extractor/helpers/fs-promises.d.ts +38 -0
- package/dist/slpk-extractor/helpers/fs-promises.d.ts.map +1 -0
- package/dist/slpk-extractor/helpers/fs-promises.js +51 -0
- package/dist/slpk-extractor/slpk-extractor.d.ts +2 -2
- package/dist/slpk-extractor/slpk-extractor.d.ts.map +1 -1
- package/dist/slpk-extractor/slpk-extractor.js +4 -7
- package/dist/slpk-extractor.min.js +44 -44
- package/package.json +20 -21
- package/src/3d-tiles-converter/3d-tiles-converter.ts +10 -28
- package/src/3d-tiles-converter/helpers/b3dm-converter.ts +5 -2
- package/src/i3s-converter/helpers/batch-ids-extensions.ts +1 -1
- package/src/i3s-converter/helpers/geometry-converter.ts +2 -7
- package/src/i3s-converter/helpers/gltf-attributes.ts +2 -2
- package/src/i3s-converter/i3s-converter.ts +5 -6
- package/src/i3s-converter/types.ts +32 -1
- package/src/i3s-server/README.md +46 -2
- package/src/i3s-server/app.js +1 -1
- package/{dist/es5/i3s-server/bin/www → src/i3s-server/bin/www.js} +7 -7
- package/src/i3s-server/controllers/slpk-controller.js +4 -11
- package/src/index.ts +1 -0
- package/src/slpk-extractor/helpers/file-handle-provider.ts +36 -18
- package/src/slpk-extractor/helpers/fs-promises.ts +66 -0
- package/src/slpk-extractor/slpk-extractor.ts +5 -6
- package/dist/3d-tiles-attributes-worker.d.ts +0 -28
- package/dist/3d-tiles-attributes-worker.d.ts.map +0 -1
- package/dist/3d-tiles-attributes-worker.js +0 -3
- package/dist/3d-tiles-attributes-worker.js.map +0 -7
- package/dist/es5/3d-tiles-attributes-worker.js +0 -25
- package/dist/es5/3d-tiles-attributes-worker.js.map +0 -1
- package/dist/es5/i3s-attributes-worker.js +0 -25
- package/dist/es5/i3s-attributes-worker.js.map +0 -1
- package/dist/es5/workers/3d-tiles-attributes-worker.js +0 -28
- package/dist/es5/workers/3d-tiles-attributes-worker.js.map +0 -1
- package/dist/es5/workers/i3s-attributes-worker.js +0 -30
- package/dist/es5/workers/i3s-attributes-worker.js.map +0 -1
- package/dist/esm/3d-tiles-attributes-worker.js +0 -16
- package/dist/esm/3d-tiles-attributes-worker.js.map +0 -1
- package/dist/esm/i3s-attributes-worker.js +0 -16
- package/dist/esm/i3s-attributes-worker.js.map +0 -1
- package/dist/esm/i3s-server/bin/www +0 -102
- package/dist/esm/workers/3d-tiles-attributes-worker.js +0 -8
- package/dist/esm/workers/3d-tiles-attributes-worker.js.map +0 -1
- package/dist/esm/workers/i3s-attributes-worker.js +0 -7
- package/dist/esm/workers/i3s-attributes-worker.js.map +0 -1
- package/dist/i3s-attributes-worker.d.ts +0 -45
- package/dist/i3s-attributes-worker.d.ts.map +0 -1
- package/dist/i3s-attributes-worker.js +0 -9
- package/dist/i3s-attributes-worker.js.map +0 -7
- package/dist/workers/3d-tiles-attributes-worker.d.ts +0 -2
- package/dist/workers/3d-tiles-attributes-worker.d.ts.map +0 -1
- package/dist/workers/3d-tiles-attributes-worker.js +0 -9
- package/dist/workers/i3s-attributes-worker.d.ts +0 -2
- package/dist/workers/i3s-attributes-worker.d.ts.map +0 -1
- package/dist/workers/i3s-attributes-worker.js +0 -5
- package/src/3d-tiles-attributes-worker.ts +0 -43
- package/src/i3s-attributes-worker.ts +0 -59
- package/src/workers/3d-tiles-attributes-worker.ts +0 -6
- package/src/workers/i3s-attributes-worker.ts +0 -7
|
@@ -1,102 +1,59 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Module dependencies.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
2
|
const app = require('../app');
|
|
8
3
|
const debug = require('debug')('i3s-server:server');
|
|
9
4
|
const https = require('https');
|
|
10
5
|
const http = require('http');
|
|
11
6
|
const fs = require('fs');
|
|
12
7
|
const path = require('path');
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
* Get port from environment and store in Express.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
const httpPort = normalizePort(process.env.PORT || '80'); // eslint-disable-line no-process-env, no-undef
|
|
19
|
-
const httpsPort = normalizePort(process.env.HTTPS_PORT || '443'); // eslint-disable-line no-process-env, no-undef
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Create HTTP server.
|
|
23
|
-
*/
|
|
24
|
-
|
|
8
|
+
const httpPort = normalizePort(process.env.PORT || '80');
|
|
9
|
+
const httpsPort = normalizePort(process.env.HTTPS_PORT || '443');
|
|
25
10
|
const options = {
|
|
26
11
|
key: fs.readFileSync(path.join(__dirname, '../certs/key.pem')),
|
|
27
12
|
cert: fs.readFileSync(path.join(__dirname, '../certs/cert.pem'))
|
|
28
13
|
};
|
|
29
|
-
|
|
30
14
|
const httpServer = http.createServer(app);
|
|
31
15
|
const httpsServer = https.createServer(options, app);
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Listen on provided port, on all network interfaces.
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
16
|
httpServer.listen(httpPort);
|
|
38
17
|
httpServer.on('error', formErrorHandler(httpPort));
|
|
39
18
|
httpServer.on('listening', formListeningHandler(httpServer));
|
|
40
|
-
|
|
41
19
|
httpsServer.listen(httpsPort);
|
|
42
20
|
httpsServer.on('error', formErrorHandler(httpsPort));
|
|
43
21
|
httpsServer.on('listening', formListeningHandler(httpsServer));
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Normalize a port into a number, string, or false.
|
|
47
|
-
*/
|
|
48
|
-
|
|
49
22
|
function normalizePort(val) {
|
|
50
23
|
const chkPort = parseInt(val, 10);
|
|
51
|
-
|
|
52
24
|
if (isNaN(chkPort)) {
|
|
53
|
-
// named pipe
|
|
54
25
|
return val;
|
|
55
26
|
}
|
|
56
|
-
|
|
57
27
|
if (chkPort >= 0) {
|
|
58
|
-
// port number
|
|
59
28
|
return chkPort;
|
|
60
29
|
}
|
|
61
|
-
|
|
62
30
|
return false;
|
|
63
31
|
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Event listener for HTTP/HTTPS server "error" event.
|
|
67
|
-
*/
|
|
68
|
-
|
|
69
32
|
function formErrorHandler(optionalPort) {
|
|
70
33
|
return function onError(error) {
|
|
71
34
|
if (error.syscall !== 'listen') {
|
|
72
35
|
throw error;
|
|
73
36
|
}
|
|
74
|
-
|
|
75
|
-
const bind = typeof port === 'string' ? `Pipe ${optionalPort}`: `Port ${optionalPort}`;
|
|
76
|
-
|
|
77
|
-
// handle specific listen errors with friendly messages
|
|
37
|
+
const bind = typeof global.port === 'string' ? "Pipe ".concat(optionalPort) : "Port ".concat(optionalPort);
|
|
78
38
|
switch (error.code) {
|
|
79
39
|
case 'EACCES':
|
|
80
|
-
console.error(
|
|
81
|
-
process.exit(1)
|
|
40
|
+
console.error("".concat(bind, " requires elevated privileges"));
|
|
41
|
+
process.exit(1);
|
|
82
42
|
break;
|
|
83
43
|
case 'EADDRINUSE':
|
|
84
|
-
console.error(
|
|
85
|
-
process.exit(1)
|
|
44
|
+
console.error("".concat(bind, " is already in use"));
|
|
45
|
+
process.exit(1);
|
|
86
46
|
break;
|
|
87
47
|
default:
|
|
88
48
|
throw error;
|
|
89
49
|
}
|
|
90
|
-
}
|
|
50
|
+
};
|
|
91
51
|
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Event listener for HTTP/HTTPS server "listening" event.
|
|
95
|
-
*/
|
|
96
52
|
function formListeningHandler(optionalServer) {
|
|
97
53
|
return function onListening() {
|
|
98
54
|
const addr = optionalServer.address();
|
|
99
|
-
const bind = typeof addr === 'string' ?
|
|
100
|
-
debug(
|
|
101
|
-
}
|
|
55
|
+
const bind = typeof addr === 'string' ? "pipe ".concat(addr) : "port ".concat(addr.port);
|
|
56
|
+
debug("Listening on ".concat(bind));
|
|
57
|
+
};
|
|
102
58
|
}
|
|
59
|
+
//# sourceMappingURL=www.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"www.js","names":["app","require","debug","https","http","fs","path","httpPort","normalizePort","process","env","PORT","httpsPort","HTTPS_PORT","options","key","readFileSync","join","__dirname","cert","httpServer","createServer","httpsServer","listen","on","formErrorHandler","formListeningHandler","val","chkPort","parseInt","isNaN","optionalPort","onError","error","syscall","bind","global","port","concat","code","console","exit","optionalServer","onListening","addr","address"],"sources":["../../../../src/i3s-server/bin/www.js"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * Module dependencies.\n */\n\nconst app = require('../app');\nconst debug = require('debug')('i3s-server:server');\nconst https = require('https');\nconst http = require('http');\nconst fs = require('fs');\nconst path = require('path');\n\n/**\n * Get port from environment and store in Express.\n */\n\nconst httpPort = normalizePort(process.env.PORT || '80'); // eslint-disable-line no-process-env, no-undef\nconst httpsPort = normalizePort(process.env.HTTPS_PORT || '443'); // eslint-disable-line no-process-env, no-undef\n\n/**\n * Create HTTP server.\n */\n\nconst options = {\n key: fs.readFileSync(path.join(__dirname, '../certs/key.pem')),\n cert: fs.readFileSync(path.join(__dirname, '../certs/cert.pem'))\n};\n\nconst httpServer = http.createServer(app);\nconst httpsServer = https.createServer(options, app);\n\n/**\n * Listen on provided port, on all network interfaces.\n */\n\nhttpServer.listen(httpPort);\nhttpServer.on('error', formErrorHandler(httpPort));\nhttpServer.on('listening', formListeningHandler(httpServer));\n\nhttpsServer.listen(httpsPort);\nhttpsServer.on('error', formErrorHandler(httpsPort));\nhttpsServer.on('listening', formListeningHandler(httpsServer));\n\n/**\n * Normalize a port into a number, string, or false.\n */\n\nfunction normalizePort(val) {\n const chkPort = parseInt(val, 10);\n\n if (isNaN(chkPort)) {\n // named pipe\n return val;\n }\n\n if (chkPort >= 0) {\n // port number\n return chkPort;\n }\n\n return false;\n}\n\n/**\n * Event listener for HTTP/HTTPS server \"error\" event.\n */\n\nfunction formErrorHandler(optionalPort) {\n return function onError(error) {\n if (error.syscall !== 'listen') {\n throw error;\n }\n\n const bind = typeof global.port === 'string' ? `Pipe ${optionalPort}` : `Port ${optionalPort}`;\n\n // handle specific listen errors with friendly messages\n switch (error.code) {\n case 'EACCES':\n console.error(`${bind} requires elevated privileges`); // eslint-disable-line no-console, no-undef\n process.exit(1); // eslint-disable-line no-process-exit, no-undef\n break;\n case 'EADDRINUSE':\n console.error(`${bind} is already in use`); // eslint-disable-line no-console, no-undef\n process.exit(1); // eslint-disable-line no-process-exit, no-undef\n break;\n default:\n throw error;\n }\n };\n}\n\n/**\n * Event listener for HTTP/HTTPS server \"listening\" event.\n */\nfunction formListeningHandler(optionalServer) {\n return function onListening() {\n const addr = optionalServer.address();\n const bind = typeof addr === 'string' ? `pipe ${addr}` : `port ${addr.port}`;\n debug(`Listening on ${bind}`);\n };\n}\n"],"mappings":"AAAA;AAMA,MAAMA,GAAG,GAAGC,OAAO,CAAC,QAAQ,CAAC;AAC7B,MAA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,15 +1,14 @@
|
|
|
1
1
|
require('@loaders.gl/polyfills');
|
|
2
2
|
const {
|
|
3
|
-
|
|
4
|
-
parse
|
|
5
|
-
} = require('@loaders.gl/core');
|
|
6
|
-
const {
|
|
7
|
-
SLPKLoader
|
|
3
|
+
parseSLPK
|
|
8
4
|
} = require('@loaders.gl/i3s');
|
|
9
5
|
const path = require('path');
|
|
6
|
+
const {
|
|
7
|
+
FileHandleProvider
|
|
8
|
+
} = require('@loaders.gl/tile-converter');
|
|
10
9
|
let slpkArchive;
|
|
11
10
|
const loadArchive = async fullLayerPath => {
|
|
12
|
-
slpkArchive = await (await
|
|
11
|
+
slpkArchive = await parseSLPK(await FileHandleProvider.from(fullLayerPath));
|
|
13
12
|
};
|
|
14
13
|
const I3S_LAYER_PATH = process.env.I3sLayerPath || '';
|
|
15
14
|
const FULL_LAYER_PATH = path.join(process.cwd(), I3S_LAYER_PATH);
|
|
@@ -19,12 +18,7 @@ async function getFileByUrl(url) {
|
|
|
19
18
|
let uncompressedFile;
|
|
20
19
|
if (trimmedPath) {
|
|
21
20
|
try {
|
|
22
|
-
uncompressedFile = Buffer.from(await
|
|
23
|
-
slpk: {
|
|
24
|
-
path: trimmedPath[1],
|
|
25
|
-
pathMode: 'http'
|
|
26
|
-
}
|
|
27
|
-
}));
|
|
21
|
+
uncompressedFile = Buffer.from(await slpkArchive.getFile(trimmedPath[1], 'http'));
|
|
28
22
|
} catch (e) {}
|
|
29
23
|
}
|
|
30
24
|
return uncompressedFile;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slpk-controller.js","names":["require","
|
|
1
|
+
{"version":3,"file":"slpk-controller.js","names":["require","parseSLPK","path","FileHandleProvider","slpkArchive","loadArchive","fullLayerPath","from","I3S_LAYER_PATH","process","env","I3sLayerPath","FULL_LAYER_PATH","join","cwd","getFileByUrl","url","trimmedPath","exec","uncompressedFile","Buffer","getFile","e","module","exports"],"sources":["../../../../src/i3s-server/controllers/slpk-controller.js"],"sourcesContent":["require('@loaders.gl/polyfills');\nconst {parseSLPK} = require('@loaders.gl/i3s');\nconst path = require('path');\nconst {FileHandleProvider} = require('@loaders.gl/tile-converter');\n\nlet slpkArchive;\n\nconst loadArchive = async (fullLayerPath) => {\n slpkArchive = await parseSLPK(await FileHandleProvider.from(fullLayerPath));\n};\n\nconst I3S_LAYER_PATH = process.env.I3sLayerPath || ''; // eslint-disable-line no-process-env, no-undef\nconst FULL_LAYER_PATH = path.join(process.cwd(), I3S_LAYER_PATH); // eslint-disable-line no-undef\n\nloadArchive(FULL_LAYER_PATH);\n\nasync function getFileByUrl(url) {\n const trimmedPath = /^\\/?(.*)\\/?$/.exec(url);\n let uncompressedFile;\n if (trimmedPath) {\n try {\n uncompressedFile = Buffer.from(await slpkArchive.getFile(trimmedPath[1], 'http'));\n } catch (e) {}\n }\n return uncompressedFile;\n}\n\nmodule.exports = {\n loadArchive,\n getFileByUrl\n};\n"],"mappings":"AAAAA,OAAO,CAAC,uBAAuB,CAAC;AAChC,MAAM;EAACC;AAAS,CAAC,GAAGD,OAAO,CAAC,iBAAiB,CAAC;AAC9C,MAAME,IAAI,GAAGF,OAAO,CAAC,MAAM,CAAC;AAC5B,MAAM;EAACG;AAAkB,CAAC,GAAGH,OAAO,CAAC,4BAA4B,CAAC;AAElE,IAAII,WAAW;AAEf,MAAMC,WAAW,GAAG,MAAOC,aAAa,IAAK;EAC3CF,WAAW,GAAG,MAAMH,SAAS,CAAC,MAAME,kBAAkB,CAACI,IAAI,CAACD,aAAa,CAAC,CAAC;AAC7E,CAAC;AAED,MAAME,cAAc,GAAGC,OAAO,CAACC,GAAG,CAACC,YAAY,IAAI,EAAE;AACrD,MAAMC,eAAe,GAAGV,IAAI,CAACW,IAAI,CAACJ,OAAO,CAACK,GAAG,CAAC,CAAC,EAAEN,cAAc,CAAC;AAEhEH,WAAW,CAACO,eAAe,CAAC;AAE5B,eAAeG,YAAYA,CAACC,GAAG,EAAE;EAC/B,MAAMC,WAAW,GAAG,cAAc,CAACC,IAAI,CAACF,GAAG,CAAC;EAC5C,IAAIG,gBAAgB;EACpB,IAAIF,WAAW,EAAE;IACf,IAAI;MACFE,gBAAgB,GAAGC,MAAM,CAACb,IAAI,CAAC,MAAMH,WAAW,CAACiB,OAAO,CAACJ,WAAW,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IACnF,CAAC,CAAC,OAAOK,CAAC,EAAE,CAAC;EACf;EACA,OAAOH,gBAAgB;AACzB;AAEAI,MAAM,CAACC,OAAO,GAAG;EACfnB,WAAW;EACXU;AACF,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { default as I3SConverter } from './i3s-converter/i3s-converter';
|
|
2
2
|
export { default as Tiles3DConverter } from './3d-tiles-converter/3d-tiles-converter';
|
|
3
|
+
export { FileHandleProvider } from './slpk-extractor/helpers/file-handle-provider';
|
|
3
4
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","I3SConverter","Tiles3DConverter"],"sources":["../../src/index.ts"],"sourcesContent":["export {default as I3SConverter} from './i3s-converter/i3s-converter';\nexport {default as Tiles3DConverter} from './3d-tiles-converter/3d-tiles-converter';\n"],"mappings":"AAAA,SAAQA,OAAO,IAAIC,YAAY,QAAO,+BAA+B;AACrE,SAAQD,OAAO,IAAIE,gBAAgB,QAAO,yCAAyC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","I3SConverter","Tiles3DConverter","FileHandleProvider"],"sources":["../../src/index.ts"],"sourcesContent":["export {default as I3SConverter} from './i3s-converter/i3s-converter';\nexport {default as Tiles3DConverter} from './3d-tiles-converter/3d-tiles-converter';\nexport {FileHandleProvider} from './slpk-extractor/helpers/file-handle-provider';\n"],"mappings":"AAAA,SAAQA,OAAO,IAAIC,YAAY,QAAO,+BAA+B;AACrE,SAAQD,OAAO,IAAIE,gBAAgB,QAAO,yCAAyC;AACnF,SAAQC,kBAAkB,QAAO,+CAA+C"}
|
package/dist/esm/pgm-loader.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parsePGM } from '@math.gl/geoid';
|
|
2
|
-
const VERSION = typeof "4.0.0-alpha.
|
|
2
|
+
const VERSION = typeof "4.0.0-alpha.15" !== 'undefined' ? "4.0.0-alpha.15" : 'latest';
|
|
3
3
|
export const PGMLoader = {
|
|
4
4
|
name: 'PGM - Netpbm grayscale image format',
|
|
5
5
|
id: 'pgm',
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import {
|
|
2
|
+
import { FileHandle } from './fs-promises';
|
|
3
3
|
export class FileHandleProvider {
|
|
4
4
|
static async from(path) {
|
|
5
|
-
const fileDescriptor = await
|
|
6
|
-
return new FileHandleProvider(fileDescriptor,
|
|
5
|
+
const fileDescriptor = await FileHandle.open(path);
|
|
6
|
+
return new FileHandleProvider(fileDescriptor, fileDescriptor.stat.size);
|
|
7
7
|
}
|
|
8
8
|
constructor(fileDescriptor, size) {
|
|
9
9
|
_defineProperty(this, "fileDescriptor", void 0);
|
|
@@ -32,9 +32,20 @@ export class FileHandleProvider {
|
|
|
32
32
|
}
|
|
33
33
|
return val;
|
|
34
34
|
}
|
|
35
|
-
async
|
|
36
|
-
const
|
|
37
|
-
|
|
35
|
+
async getBigUint64(offset) {
|
|
36
|
+
const val = new BigInt64Array((await this.fileDescriptor.read(Buffer.alloc(8), 0, 4, offset)).buffer.buffer).at(0);
|
|
37
|
+
if (val === undefined) {
|
|
38
|
+
throw new Error('something went wrong');
|
|
39
|
+
}
|
|
40
|
+
return val;
|
|
41
|
+
}
|
|
42
|
+
async slice(startOffsset, endOffset) {
|
|
43
|
+
const bigLength = endOffset - startOffsset;
|
|
44
|
+
if (bigLength > Number.MAX_SAFE_INTEGER) {
|
|
45
|
+
throw new Error('too big slice');
|
|
46
|
+
}
|
|
47
|
+
const length = Number(bigLength);
|
|
48
|
+
return (await this.fileDescriptor.read(Buffer.alloc(length), 0, length, startOffsset)).buffer.buffer;
|
|
38
49
|
}
|
|
39
50
|
get length() {
|
|
40
51
|
return this.size;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-handle-provider.js","names":["
|
|
1
|
+
{"version":3,"file":"file-handle-provider.js","names":["FileHandle","FileHandleProvider","from","path","fileDescriptor","open","stat","size","constructor","_defineProperty","getUint8","offset","val","Uint8Array","read","Buffer","alloc","buffer","at","undefined","Error","getUint16","Uint16Array","getUint32","Uint32Array","getBigUint64","BigInt64Array","slice","startOffsset","endOffset","bigLength","Number","MAX_SAFE_INTEGER","length"],"sources":["../../../../src/slpk-extractor/helpers/file-handle-provider.ts"],"sourcesContent":["import {FileProvider} from '@loaders.gl/i3s';\nimport {FileHandle} from './fs-promises';\n\n/**\n * Provides file data using node fs library\n */\nexport class FileHandleProvider implements FileProvider {\n /**\n * Returns a new copy of FileHandleProvider\n * @param path The path to the file in file system\n */\n static async from(path: string): Promise<FileHandleProvider> {\n const fileDescriptor = await FileHandle.open(path);\n return new FileHandleProvider(fileDescriptor, fileDescriptor.stat.size);\n }\n\n /**\n * The FileHandle from which data is provided\n */\n private fileDescriptor: FileHandle;\n\n /**\n * The file length in bytes\n */\n private size: bigint;\n\n private constructor(fileDescriptor: FileHandle, size: bigint) {\n this.fileDescriptor = fileDescriptor;\n this.size = size;\n }\n\n /**\n * Gets an unsigned 8-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n async getUint8(offset: bigint): Promise<number> {\n const val = new Uint8Array(\n (await this.fileDescriptor.read(Buffer.alloc(1), 0, 1, offset)).buffer.buffer\n ).at(0);\n if (val === undefined) {\n throw new Error('something went wrong');\n }\n return val;\n }\n\n /**\n * Gets an unsigned 16-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n async getUint16(offset: bigint): Promise<number> {\n const val = new Uint16Array(\n (await this.fileDescriptor.read(Buffer.alloc(2), 0, 2, offset)).buffer.buffer\n ).at(0);\n if (val === undefined) {\n throw new Error('something went wrong');\n }\n return val;\n }\n\n /**\n * Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n async getUint32(offset: bigint): Promise<number> {\n const val = new Uint32Array(\n (await this.fileDescriptor.read(Buffer.alloc(4), 0, 4, offset)).buffer.buffer\n ).at(0);\n if (val === undefined) {\n throw new Error('something went wrong');\n }\n return val;\n }\n\n /**\n * Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.\n * @param offset The offset, in bytes, from the start of the file where to read the data.\n */\n async getBigUint64(offset: bigint): Promise<bigint> {\n const val = new BigInt64Array(\n (await this.fileDescriptor.read(Buffer.alloc(8), 0, 4, offset)).buffer.buffer\n ).at(0);\n if (val === undefined) {\n throw new Error('something went wrong');\n }\n return val;\n }\n\n /**\n * returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.\n * @param startOffsset The offset, in byte, from the start of the file where to start reading the data.\n * @param endOffset The offset, in bytes, from the start of the file where to end reading the data.\n */\n async slice(startOffsset: bigint, endOffset: bigint): Promise<ArrayBuffer> {\n const bigLength = endOffset - startOffsset;\n if (bigLength > Number.MAX_SAFE_INTEGER) {\n throw new Error('too big slice');\n }\n const length = Number(bigLength);\n return (await this.fileDescriptor.read(Buffer.alloc(length), 0, length, startOffsset)).buffer\n .buffer;\n }\n\n /**\n * the length (in bytes) of the data.\n */\n get length(): bigint {\n return this.size;\n }\n}\n"],"mappings":";AACA,SAAQA,UAAU,QAAO,eAAe;AAKxC,OAAO,MAAMC,kBAAkB,CAAyB;EAKtD,aAAaC,IAAIA,CAACC,IAAY,EAA+B;IAC3D,MAAMC,cAAc,GAAG,MAAMJ,UAAU,CAACK,IAAI,CAACF,IAAI,CAAC;IAClD,OAAO,IAAIF,kBA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ACzE,CAAC,CAACC,EAAE,CAAC,CAAC,CAAC;IACP,IAAIN,GAAG,KAAKO,SAAS,EAAE;MACrB,MAAM,IAAIC,KAAK,CAAC,sBAAsB,CAAC;IACzC;IACA,OAAOR,GAAG;EACZ;EAMA,MAAMa,YAAYA,CAACd,MAAc,EAAmB;IAClD,MAAMC,GAAG,GAAG,IAAIc,aAAa,CAC3B,CAAC,MAAM,IAAI,CAACtB,cAAc,CAACU,IAAI,CAACC,MAAM,CAACC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAEL,MAAM,CAAC,EAAEM,MAAM,CAACA,MACzE,CAAC,CAACC,EAAE,CAAC,CAAC,CAAC;IACP,IAAIN,GAAG,KAAKO,SAAS,EAAE;MACrB,MAAM,IAAIC,KAAK,CAAC,sBAAsB,CAAC;IACzC;IACA,OAAOR,GAAG;EACZ;EAOA,MAAMe,KAAKA,CAACC,YAAoB,EAAEC,SAAiB,EAAwB;IACzE,MAAMC,SAAS,GAAGD,SAAS,GAAGD,YAAY;IAC1C,IAAIE,SAAS,GAAGC,MAAM,CAACC,gBAAgB,EAAE;MACvC,MAAM,IAAIZ,KAAK,CAAC,eAAe,CAAC;IAClC;IACA,MAAMa,MAAM,GAAGF,MAAM,CAACD,SAAS,CAAC;IAChC,OAAO,CAAC,MAAM,IAAI,CAAC1B,cAAc,CAACU,IAAI,CAACC,MAAM,CAACC,KAAK,CAACiB,MAAM,CAAC,EAAE,CAAC,EAAEA,MAAM,EAAEL,YAAY,CAAC,EAAEX,MAAM,CAC1FA,MAAM;EACX;EAKA,IAAIgB,MAAMA,CAAA,EAAW;IACnB,OAAO,IAAI,CAAC1B,IAAI;EAClB;AACF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import { read, open, stat } from 'fs';
|
|
3
|
+
export class FileHandle {
|
|
4
|
+
constructor(fileDescriptor, stats) {
|
|
5
|
+
_defineProperty(this, "fileDescriptor", void 0);
|
|
6
|
+
_defineProperty(this, "stats", void 0);
|
|
7
|
+
_defineProperty(this, "read", (buffer, offset, length, position) => {
|
|
8
|
+
return new Promise(s => {
|
|
9
|
+
read(this.fileDescriptor, buffer, offset, length, position, (_err, bytesRead, buffer) => s({
|
|
10
|
+
bytesRead,
|
|
11
|
+
buffer
|
|
12
|
+
}));
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
this.fileDescriptor = fileDescriptor;
|
|
16
|
+
this.stats = stats;
|
|
17
|
+
}
|
|
18
|
+
get stat() {
|
|
19
|
+
return this.stats;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
_defineProperty(FileHandle, "open", async path => {
|
|
23
|
+
const [fd, stats] = await Promise.all([new Promise(s => {
|
|
24
|
+
open(path, undefined, undefined, (_err, fd) => s(fd));
|
|
25
|
+
}), new Promise(s => {
|
|
26
|
+
stat(path, {
|
|
27
|
+
bigint: true
|
|
28
|
+
}, (_err, stats) => s(stats));
|
|
29
|
+
})]);
|
|
30
|
+
return new FileHandle(fd, stats);
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=fs-promises.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs-promises.js","names":["read","open","stat","FileHandle","constructor","fileDescriptor","stats","_defineProperty","buffer","offset","length","position","Promise","s","_err","bytesRead","path","fd","all","undefined","bigint"],"sources":["../../../../src/slpk-extractor/helpers/fs-promises.ts"],"sourcesContent":["import {read, open, stat, BigIntStats} from 'fs';\n\n/** file reading result */\nexport type FileReadResult = {\n /** amount of the bytes read */\n bytesRead: number;\n /** the buffer filled with data from file*/\n buffer: Buffer;\n};\n\n/** Object handling file info */\nexport class FileHandle {\n private fileDescriptor: number;\n private stats: BigIntStats;\n private constructor(fileDescriptor: number, stats: BigIntStats) {\n this.fileDescriptor = fileDescriptor;\n this.stats = stats;\n }\n /**\n * Opens a `FileHandle`.\n *\n * @param path path to the file\n * @return Fulfills with a {FileHandle} object.\n */\n\n static open = async (path: string): Promise<FileHandle> => {\n const [fd, stats] = await Promise.all([\n new Promise<number>((s) => {\n open(path, undefined, undefined, (_err, fd) => s(fd));\n }),\n new Promise<BigIntStats>((s) => {\n stat(path, {bigint: true}, (_err, stats) => s(stats));\n })\n ]);\n return new FileHandle(fd, stats);\n };\n\n /**\n * Reads data from the file and stores that in the given buffer.\n *\n * If the file is not modified concurrently, the end-of-file is reached when the\n * number of bytes read is zero.\n * @param buffer A buffer that will be filled with the file data read.\n * @param offset The location in the buffer at which to start filling.\n * @param length The number of bytes to read.\n * @param position The location where to begin reading data from the file. If `null`, data will be read from the current file position, and the position will be updated. If `position` is an\n * integer, the current file position will remain unchanged.\n * @return Fulfills upon success with a FileReadResult object\n */\n read = (\n buffer: Buffer,\n offset: number,\n length: number,\n position: number | bigint\n ): Promise<FileReadResult> => {\n return new Promise((s) => {\n read(this.fileDescriptor, buffer, offset, length, position, (_err, bytesRead, buffer) =>\n s({bytesRead, buffer})\n );\n });\n };\n\n get stat(): BigIntStats {\n return this.stats;\n }\n}\n"],"mappings":";AAAA,SAAQA,IAAI,EAAEC,IAAI,EAAEC,IAAI,QAAoB,IAAI;AAWhD,OAAO,MAAMC,UAAU,CAAC;EAGdC,WAAWA,CAACC,cAAsB,EAAEC,KAAkB,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA,eAmCzD,CACLC,MAAc,EACdC,MAAc,EACdC,MAAc,EACdC,QAAyB,KACG;MAC5B,OAAO,IAAIC,OAAO,CAAEC,CAAC,IAAK;QACxBb,IAAI,CAAC,IAAI,CAACK,cAAc,EAAEG,MAAM,EAAEC,MAAM,EAAEC,MAAM,EAAEC,QAAQ,EAAE,CAACG,IAAI,EAAEC,SAAS,EAAEP,MAAM,KAClFK,CAAC,CAAC;UAACE,SAAS;UAAEP;QAAM,CAAC,CACvB,CAAC;MACH,CAAC,CAAC;IACJ,CAAC;IA7CC,IAAI,CAACH,cAAc,GAAGA,cAAc;IACpC,IAAI,CAACC,KAAK,GAAGA,KAAK;EACpB;EA6CA,IAAIJ,IAAIA,CAAA,EAAgB;IACtB,OAAO,IAAI,CAACI,KAAK;EACnB;AACF;AAACC,eAAA,CAtDYJ,UAAU,UAcP,MAAOa,IAAY,IAA0B;EACzD,MAAM,CAACC,EAAE,EAAEX,KAAK,CAAC,GAAG,MAAMM,OAAO,CAACM,GAAG,CAAC,CACpC,IAAIN,OAAO,CAAUC,CAAC,IAAK;IACzBZ,IAAI,CAACe,IAAI,EAAEG,SAAS,EAAEA,SAAS,EAAE,CAACL,IAAI,EAAEG,EAAE,KAAKJ,CAAC,CAACI,EAAE,CAAC,CAAC;EACvD,CAAC,CAAC,EACF,IAAIL,OAAO,CAAeC,CAAC,IAAK;IAC9BX,IAAI,CAACc,IAAI,EAAE;MAACI,MAAM,EAAE;IAAI,CAAC,EAAE,CAACN,IAAI,EAAER,KAAK,KAAKO,CAAC,CAACP,KAAK,CAAC,CAAC;EACvD,CAAC,CAAC,CACH,CAAC;EACF,OAAO,IAAIH,UAAU,CAACc,EAAE,EAAEX,KAAK,CAAC;AAClC,CAAC"}
|
|
@@ -6,7 +6,7 @@ import { path } from '@loaders.gl/loader-utils';
|
|
|
6
6
|
import { GZipCompression } from '@loaders.gl/compression';
|
|
7
7
|
import { writeFile } from '../lib/utils/file-utils';
|
|
8
8
|
const indexNames = ['3dSceneLayer.json.gz', '3dNodeIndexDocument.json.gz', 'sharedResource.json.gz'];
|
|
9
|
-
export default class
|
|
9
|
+
export default class SLPKConverter {
|
|
10
10
|
async extract(options) {
|
|
11
11
|
if (isBrowser) {
|
|
12
12
|
console.log(BROWSER_ERROR_MESSAGE);
|
|
@@ -16,7 +16,7 @@ export default class SLPKExtractor {
|
|
|
16
16
|
inputUrl
|
|
17
17
|
} = options;
|
|
18
18
|
const provider = await FileHandleProvider.from(inputUrl);
|
|
19
|
-
let localHeader = await parseZipLocalFileHeader(
|
|
19
|
+
let localHeader = await parseZipLocalFileHeader(0n, provider);
|
|
20
20
|
while (localHeader) {
|
|
21
21
|
var _localHeader, _localHeader2;
|
|
22
22
|
await this.writeFile(await this.unGzip({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slpk-extractor.js","names":["isBrowser","BROWSER_ERROR_MESSAGE","FileHandleProvider","parseZipLocalFileHeader","path","GZipCompression","writeFile","indexNames","
|
|
1
|
+
{"version":3,"file":"slpk-extractor.js","names":["isBrowser","BROWSER_ERROR_MESSAGE","FileHandleProvider","parseZipLocalFileHeader","path","GZipCompression","writeFile","indexNames","SLPKConverter","extract","options","console","log","inputUrl","provider","from","localHeader","_localHeader","_localHeader2","unGzip","name","correctIndexNames","fileName","data","slice","fileDataOffset","compressedSize","outputPath","includes","filename","join","dirname","parts","exec","concat","at","file","_file$name","test","_file$name2","compression","decompressedData","decompress","Promise","resolve","finalPath","dirName"],"sources":["../../../src/slpk-extractor/slpk-extractor.ts"],"sourcesContent":["import {isBrowser} from '@loaders.gl/core';\n\nimport {BROWSER_ERROR_MESSAGE} from '../constants';\nimport {FileHandleProvider} from './helpers/file-handle-provider';\nimport {parseZipLocalFileHeader} from '@loaders.gl/i3s';\nimport {path} from '@loaders.gl/loader-utils';\nimport {GZipCompression} from '@loaders.gl/compression';\nimport {writeFile} from '../lib/utils/file-utils';\n\nconst indexNames = [\n '3dSceneLayer.json.gz',\n '3dNodeIndexDocument.json.gz',\n 'sharedResource.json.gz'\n];\n\n/**\n * Description of the file in the SLPK\n */\ntype File = {\n name: string | null;\n data: ArrayBuffer;\n};\n\n/**\n * Converter from slpk to i3s\n */\nexport default class SLPKConverter {\n /**\n * Extract slpk to i3s\n * @param options\n * @param options.inputUrl the url to read SLPK file\n * @param options.outputPath the output filename\n */\n public async extract(options: {inputUrl: string; outputPath: string}): Promise<string> {\n if (isBrowser) {\n console.log(BROWSER_ERROR_MESSAGE);\n return BROWSER_ERROR_MESSAGE;\n }\n const {inputUrl} = options;\n\n const provider = await FileHandleProvider.from(inputUrl);\n\n let localHeader = await parseZipLocalFileHeader(0n, provider);\n while (localHeader) {\n await this.writeFile(\n await this.unGzip({\n name: this.correctIndexNames(localHeader.fileName),\n data: await provider.slice(\n localHeader.fileDataOffset,\n localHeader.fileDataOffset + localHeader.compressedSize\n )\n }),\n options.outputPath\n );\n localHeader = await parseZipLocalFileHeader(\n localHeader?.fileDataOffset + localHeader?.compressedSize,\n provider\n );\n }\n\n return 'success';\n }\n\n /**\n * Defines file name and path for i3s format\n * @param fileName initial file name and path\n */\n\n private correctIndexNames(fileName: string): string | null {\n if (indexNames.includes(path.filename(path.join('/', fileName)))) {\n return path.join(path.dirname(fileName), 'index.json.gz');\n }\n // finds path with name part and extention part\n let parts = /^(.*\\/[^\\/\\.]*)(\\..+)$/.exec(fileName);\n if (!parts) {\n return null;\n }\n return `${parts?.at(1)}/index${parts?.at(2)}`;\n }\n\n private async unGzip(file: File): Promise<File> {\n if (/\\.gz$/.test(file.name ?? '')) {\n const compression = new GZipCompression();\n\n const decompressedData = await compression.decompress(file.data);\n\n return {data: decompressedData, name: (file.name ?? '').slice(0, -3)};\n }\n return Promise.resolve(file);\n }\n\n private async writeFile(options: File, outputPath: string): Promise<void> {\n if (!options.name) {\n return;\n }\n const finalPath = path.join(outputPath, options.name);\n const dirName = path.dirname(finalPath);\n const fileName = path.filename(finalPath);\n await writeFile(dirName, options.data, fileName);\n }\n}\n"],"mappings":"AAAA,SAAQA,SAAS,QAAO,kBAAkB;AAE1C,SAAQC,qBAAqB,QAAO,cAAc;AAClD,SAAQC,kBAAkB,QAAO,gCAAgC;AACjE,SAAQC,uBAAuB,QAAO,iBAAiB;AACvD,SAAQC,IAAI,QAAO,0BAA0B;AAC7C,SAAQC,eAAe,QAAO,yBAAyB;AACvD,SAAQC,SAAS,QAAO,yBAAyB;AAEjD,MAAMC,UAAU,GAAG,CACjB,sBAAsB,EACtB,6BAA6B,EAC7B,wBAAwB,CACzB;AAaD,eAAe,MAAMC,aAAa,CAAC;EAOjC,MAA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AAEpC,OAAO,CAACa,IAAI,EAAED,QAAQ,CAAC;EAClD;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GLTFAccessorPostprocessed, GLTFMeshPrimitivePostprocessed } from '@loaders.gl/gltf';
|
|
2
2
|
import type { NumericArray } from '@loaders.gl/loader-utils';
|
|
3
|
-
import { TextureImageProperties } from '
|
|
3
|
+
import { TextureImageProperties } from '../types';
|
|
4
4
|
/**
|
|
5
5
|
* Getting batchIds from 3DTilesNext extensions.
|
|
6
6
|
* @param attributes - gltf accessors
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batch-ids-extensions.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/batch-ids-extensions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,yBAAyB,EAAE,8BAA8B,EAAC,MAAM,kBAAkB,CAAC;AAC3F,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAM3D,OAAO,EAAC,sBAAsB,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"batch-ids-extensions.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/batch-ids-extensions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,yBAAyB,EAAE,8BAA8B,EAAC,MAAM,kBAAkB,CAAC;AAC3F,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAM3D,OAAO,EAAC,sBAAsB,EAAC,MAAM,UAAU,CAAC;AAKhD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE;IACV,CAAC,GAAG,EAAE,MAAM,GAAG,yBAAyB,CAAC;CAC1C,EACD,SAAS,EAAE,8BAA8B,EACzC,MAAM,EAAE,CAAC,sBAAsB,GAAG,IAAI,CAAC,EAAE,GACxC,YAAY,CAwBd"}
|
|
@@ -3,8 +3,7 @@ import { Matrix4 } from '@math.gl/core';
|
|
|
3
3
|
import { ConvertedAttributes, I3SConvertedResources, I3SMaterialWithTexture } from '../types';
|
|
4
4
|
import { AttributeStorageInfo } from '@loaders.gl/i3s';
|
|
5
5
|
import { Geoid } from '@math.gl/geoid';
|
|
6
|
-
|
|
7
|
-
import { B3DMAttributesData } from '../../i3s-attributes-worker';
|
|
6
|
+
import type { GLTFAttributesData } from '../types';
|
|
8
7
|
import { BoundingSphere, OrientedBoundingBox } from '@math.gl/culling';
|
|
9
8
|
/**
|
|
10
9
|
* Convert binary data from b3dm file to i3s resources
|
|
@@ -35,7 +34,7 @@ export default function convertB3dmToI3sGeometry(tileContent: Tiles3DTileContent
|
|
|
35
34
|
* Cartesian coordinates will be required for creating bounding voulmest from geometry positions
|
|
36
35
|
* @returns map of converted geometry attributes
|
|
37
36
|
*/
|
|
38
|
-
export declare function convertAttributes(attributesData:
|
|
37
|
+
export declare function convertAttributes(attributesData: GLTFAttributesData, materialAndTextureList: I3SMaterialWithTexture[], useCartesianPositions: boolean): Promise<Map<string, ConvertedAttributes>>;
|
|
39
38
|
/**
|
|
40
39
|
* Find property table in tile
|
|
41
40
|
* For example it can be batchTable for b3dm files or property table in gLTF extension.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry-converter.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/geometry-converter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAE,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAW/E,OAAO,EAAU,OAAO,EAAU,MAAM,eAAe,CAAC;AAUxD,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EAGvB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,oBAAoB,EAIrB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAC,KAAK,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"geometry-converter.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/geometry-converter.ts"],"names":[],"mappings":"AAAA,OAAO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AAE,kBAAkB,GAAG,IAAI,GAAG,gBAAgB,GAAG,IAAI,CAwBhG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Tiles3DTileContent } from '@loaders.gl/3d-tiles';
|
|
2
|
-
import type { B3DMAttributesData } from '../../i3s-attributes-worker';
|
|
3
2
|
import { Matrix4, Vector3 } from '@math.gl/core';
|
|
4
3
|
import { BoundingSphere, OrientedBoundingBox } from '@math.gl/culling';
|
|
4
|
+
import { GLTFAttributesData } from '../types';
|
|
5
5
|
/**
|
|
6
6
|
* Prepare attributes for conversion to avoid binary data breaking in worker thread.
|
|
7
7
|
* @param tileContent - 3DTiles tile content
|
|
@@ -10,7 +10,7 @@ import { BoundingSphere, OrientedBoundingBox } from '@math.gl/culling';
|
|
|
10
10
|
* @param boundingVolume - initialized bounding volume of the source tile
|
|
11
11
|
* @returns 3DTiles content data, prepared for conversion
|
|
12
12
|
*/
|
|
13
|
-
export declare function prepareDataForAttributesConversion(tileContent: Tiles3DTileContent, tileTransform: Matrix4, boundingVolume: OrientedBoundingBox | BoundingSphere):
|
|
13
|
+
export declare function prepareDataForAttributesConversion(tileContent: Tiles3DTileContent, tileTransform: Matrix4, boundingVolume: OrientedBoundingBox | BoundingSphere): GLTFAttributesData;
|
|
14
14
|
/**
|
|
15
15
|
* Calculate transformation properties to transform vertex attributes (POSITION, NORMAL, etc.)
|
|
16
16
|
* from METER_OFFSET coorditantes to LNGLAT_OFFSET coordinates
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gltf-attributes.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/gltf-attributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAE7D,OAAO,
|
|
1
|
+
{"version":3,"file":"gltf-attributes.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/gltf-attributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAC,OAAO,EAAc,OAAO,EAAC,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,cAAc,EAAE,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AAErE,OAAO,EAAC,kBAAkB,EAAC,MAAM,UAAU,CAAC;AAE5C;;;;;;;GAOG;AACH,wBAAgB,kCAAkC,CAChD,WAAW,EAAE,kBAAkB,EAC/B,aAAa,EAAE,OAAO,EACtB,cAAc,EAAE,mBAAmB,GAAG,cAAc,GACnD,kBAAkB,CAyCpB;AAqBD;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,kBAAkB,EAC/B,aAAa,EAAE,OAAO,EACtB,cAAc,EAAE,mBAAmB,GAAG,cAAc,GACnD;IAAC,WAAW,EAAE,OAAO,CAAC;IAAC,kBAAkB,EAAE,OAAO,CAAA;CAAC,CAkCrD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-converter.d.ts","sourceRoot":"","sources":["../../src/i3s-converter/i3s-converter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,oBAAoB,EAGpB,+BAA+B,EAChC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EACV,YAAY,EAIb,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAC,KAAK,EAAC,MAAM,gBAAgB,CAAC;AAOrC,OAAO,SAAS,MAAM,sBAAsB,CAAC;AAuB7C,OAAO,EAAC,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAC,qBAAqB,EAA8B,MAAM,iBAAiB,CAAC;AAGnF,OAAO,EAGL,cAAc,EAEf,MAAM,SAAS,CAAC;AAGjB,OAAO,UAAU,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"i3s-converter.d.ts","sourceRoot":"","sources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B;IA2EnC;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAgCpB;;OAEG;YACW,aAAa;IAc3B;;;OAGG;YACW,WAAW;IAsCzB;;;;;;OAMG;YACW,WAAW;IAiCzB;;;;OAIG;YACW,YAAY;IAc1B;;;;;;;OAOG;YACW,WAAW;IAsGzB;;;;;;;;;;OAUG;YACW,iBAAiB;IAiC/B;;;;;;;;;;;;;;OAcG;YACW,sBAAsB;IA+DpC;;;;;;;;;OASG;YACW,eAAe;IAiB7B;;;;;;OAMG;YACW,gBAAgB;IAoC9B;;;;;;OAMG;YACW,YAAY;IAwB1B;;;;;OAKG;YACW,aAAa;IA+D3B;;;;;;;OAOG;YACW,gBAAgB;IAwB9B;;;;;OAKG;YACW,gBAAgB;IA0B9B;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAa5B;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IAU7B;;;;;;OAMG;IACH,OAAO,CAAC,8BAA8B;IAWtC;;;OAGG;IACH,OAAO,CAAC,qCAAqC;IAyB7C;;;OAGG;YACW,iBAAiB;IAqB/B;;OAEG;YACW,oBAAoB;IAYlC;;OAEG;YACW,qBAAqB;IAiBnC;;OAEG;IACH,OAAO,CAAC,8BAA8B;IAWtC;;;;OAIG;IACH,OAAO,CAAC,kBAAkB;YAIZ,WAAW;CAkB1B"}
|
|
@@ -53,7 +53,6 @@ const types_1 = require("./types");
|
|
|
53
53
|
const worker_utils_1 = require("@loaders.gl/worker-utils");
|
|
54
54
|
const draco_1 = require("@loaders.gl/draco");
|
|
55
55
|
const write_queue_1 = __importDefault(require("../lib/utils/write-queue"));
|
|
56
|
-
const i3s_attributes_worker_1 = require("../i3s-attributes-worker");
|
|
57
56
|
const constants_1 = require("../constants");
|
|
58
57
|
const feature_attributes_1 = require("./helpers/feature-attributes");
|
|
59
58
|
const node_index_document_1 = require("./helpers/node-index-document");
|
|
@@ -170,10 +169,14 @@ class I3SConverter {
|
|
|
170
169
|
await this.loadWorkers();
|
|
171
170
|
try {
|
|
172
171
|
const preloadOptions = await this._fetchPreloadOptions();
|
|
172
|
+
let tilesetUrl = inputUrl;
|
|
173
|
+
if (preloadOptions.url) {
|
|
174
|
+
tilesetUrl = preloadOptions.url;
|
|
175
|
+
}
|
|
173
176
|
if (preloadOptions.headers) {
|
|
174
177
|
this.loadOptions.fetch = { headers: preloadOptions.headers };
|
|
175
178
|
}
|
|
176
|
-
this.sourceTileset = await (0, core_1.load)(
|
|
179
|
+
this.sourceTileset = await (0, core_1.load)(tilesetUrl, this.Loader, this.loadOptions);
|
|
177
180
|
const preprocessResult = await this.preprocessConversion();
|
|
178
181
|
if (preprocessResult) {
|
|
179
182
|
await this._createAndSaveTileset(outputPath, tilesetName);
|
|
@@ -916,10 +919,6 @@ class I3SConverter {
|
|
|
916
919
|
const source = await sourceResponse.text();
|
|
917
920
|
this.workerSource.ktx2 = source;
|
|
918
921
|
}
|
|
919
|
-
const i3sAttributesWorkerUrl = (0, worker_utils_1.getWorkerURL)(i3s_attributes_worker_1.I3SAttributesWorker, { ...(0, core_1.getLoaderOptions)() });
|
|
920
|
-
const sourceResponse = await (0, core_1.fetchFile)(i3sAttributesWorkerUrl);
|
|
921
|
-
const source = await sourceResponse.text();
|
|
922
|
-
this.workerSource.I3SAttributes = source;
|
|
923
922
|
console.log(`Loading workers source completed!`); // eslint-disable-line no-undef, no-console
|
|
924
923
|
}
|
|
925
924
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { GLTFImagePostprocessed } from '@loaders.gl/gltf';
|
|
1
|
+
import { GLTFImagePostprocessed, GLTFNodePostprocessed } from '@loaders.gl/gltf';
|
|
2
2
|
import { BoundingVolumes, I3SMaterialDefinition, MaterialDefinitionInfo, TextureDefinitionInfo } from '@loaders.gl/i3s';
|
|
3
|
+
import { Matrix4, Vector3 } from '@math.gl/core';
|
|
3
4
|
/** Converted resources for specific node */
|
|
4
5
|
export type I3SConvertedResources = {
|
|
5
6
|
/**
|
|
@@ -160,4 +161,34 @@ export type PreprocessData = {
|
|
|
160
161
|
/** Mesh topology types used in gltf primitives of the tileset */
|
|
161
162
|
meshTopologyTypes: Set<GltfPrimitiveModeString>;
|
|
162
163
|
};
|
|
164
|
+
/** Texture image properties required for conversion */
|
|
165
|
+
export type TextureImageProperties = {
|
|
166
|
+
/** Array with image data */
|
|
167
|
+
data: Uint8Array;
|
|
168
|
+
/** Is the texture compressed */
|
|
169
|
+
compressed?: boolean;
|
|
170
|
+
/** Height of the texture's image */
|
|
171
|
+
height?: number;
|
|
172
|
+
/** Width of the texture's image */
|
|
173
|
+
width?: number;
|
|
174
|
+
/** Number of components (3 for RGB, 4 for RGBA) */
|
|
175
|
+
components?: number;
|
|
176
|
+
/** Mime type of the texture's image */
|
|
177
|
+
mimeType?: string;
|
|
178
|
+
};
|
|
179
|
+
/** glTF attributes data, prepared for conversion */
|
|
180
|
+
export type GLTFAttributesData = {
|
|
181
|
+
/** glTF PBR materials (only id is required) */
|
|
182
|
+
gltfMaterials?: {
|
|
183
|
+
id: string;
|
|
184
|
+
}[];
|
|
185
|
+
/** glTF geometry nodes */
|
|
186
|
+
nodes: GLTFNodePostprocessed[];
|
|
187
|
+
/** glTF texture images (set to null for compressed textures) */
|
|
188
|
+
images: (null | TextureImageProperties)[];
|
|
189
|
+
/** Source tile origin coordinates in cartographic coordinate system */
|
|
190
|
+
cartographicOrigin: Vector3;
|
|
191
|
+
/** Model matrix to convert coordinate system of POSITION and NORMAL attributes from METER_OFFSETS to CARTESIAN */
|
|
192
|
+
cartesianModelMatrix: Matrix4;
|
|
193
|
+
};
|
|
163
194
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/i3s-converter/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,sBAAsB,EAAC,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/i3s-converter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AAC;CACnB,CAAC;AAEF,oDAAoD;AACpD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,+CAA+C;IAC/C,aAAa,CAAC,EAAE;QAAC,EAAE,EAAE,MAAM,CAAA;KAAC,EAAE,CAAC;IAC/B,0BAA0B;IAC1B,KAAK,EAAE,qBAAqB,EAAE,CAAC;IAC/B,gEAAgE;IAChE,MAAM,EAAE,CAAC,IAAI,GAAG,sBAAsB,CAAC,EAAE,CAAC;IAC1C,uEAAuE;IACvE,kBAAkB,EAAE,OAAO,CAAC;IAC5B,mHAAmH;IACnH,oBAAoB,EAAE,OAAO,CAAC;CAC/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/i3s-server/app.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/i3s-server/app.js"],"names":[],"mappings":";AAQA,uBAAsB"}
|
package/dist/i3s-server/app.js
CHANGED
|
@@ -4,7 +4,6 @@ const path = require('path');
|
|
|
4
4
|
const logger = require('morgan');
|
|
5
5
|
const cors = require('cors');
|
|
6
6
|
const indexRouter = require('./routes/index');
|
|
7
|
-
const { sceneServerRouter, router } = require('./routes/slpk-router');
|
|
8
7
|
const I3S_LAYER_PATH = process.env.I3sLayerPath || ''; // eslint-disable-line no-process-env, no-undef
|
|
9
8
|
const app = express();
|
|
10
9
|
app.use(logger('dev'));
|
|
@@ -13,6 +12,7 @@ app.use(express.urlencoded({ extended: false }));
|
|
|
13
12
|
app.use(express.static(path.join(__dirname, 'public')));
|
|
14
13
|
app.use(cors());
|
|
15
14
|
if (/\.slpk$/.test(I3S_LAYER_PATH)) {
|
|
15
|
+
const { sceneServerRouter, router } = require('./routes/slpk-router');
|
|
16
16
|
app.use('/SceneServer/layers/0', router);
|
|
17
17
|
app.use('/SceneServer', sceneServerRouter);
|
|
18
18
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"www.d.ts","sourceRoot":"","sources":["../../../src/i3s-server/bin/www.js"],"names":[],"mappings":""}
|