@loaders.gl/tile-converter 3.1.0-alpha.4 → 3.1.0-beta.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/bin/converter.js +1 -1
- package/dist/bundle.js +86025 -0
- package/dist/converter.min.js +292 -0
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +189 -421
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +214 -296
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +4 -8
- package/dist/es5/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js +40 -0
- package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js.map +1 -0
- package/dist/es5/3d-tiles-converter/json-templates/tileset.js +7 -17
- package/dist/es5/3d-tiles-converter/json-templates/tileset.js.map +1 -1
- package/dist/es5/bundle.js +1 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/deps-installer/deps-installer.js +17 -65
- package/dist/es5/deps-installer/deps-installer.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js +16 -16
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/create-scene-server-path.js +9 -33
- package/dist/es5/i3s-converter/helpers/create-scene-server-path.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js +93 -103
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-converter.js +348 -511
- package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/node-debug.js +30 -26
- package/dist/es5/i3s-converter/helpers/node-debug.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/node-pages.js +102 -203
- package/dist/es5/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/es5/i3s-converter/i3s-converter.js +701 -1501
- package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/layers.js +15 -25
- package/dist/es5/i3s-converter/json-templates/layers.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/metadata.js +2 -2
- package/dist/es5/i3s-converter/json-templates/metadata.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/node.js +12 -21
- package/dist/es5/i3s-converter/json-templates/node.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/scene-server.js +3 -5
- package/dist/es5/i3s-converter/json-templates/scene-server.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/shared-resources.js +15 -55
- package/dist/es5/i3s-converter/json-templates/shared-resources.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/store.js +4 -6
- package/dist/es5/i3s-converter/json-templates/store.js.map +1 -1
- package/dist/es5/i3s-server/app.js +6 -6
- package/dist/es5/i3s-server/app.js.map +1 -1
- package/dist/es5/i3s-server/controllers/index-controller.js +20 -60
- package/dist/es5/i3s-server/controllers/index-controller.js.map +1 -1
- package/dist/es5/i3s-server/routes/index.js +14 -41
- package/dist/es5/i3s-server/routes/index.js.map +1 -1
- package/dist/es5/index.js +4 -4
- package/dist/es5/lib/geoid-height-model.js +100 -114
- package/dist/es5/lib/geoid-height-model.js.map +1 -1
- package/dist/es5/lib/pgm-parser.js +68 -122
- package/dist/es5/lib/pgm-parser.js.map +1 -1
- package/dist/es5/lib/utils/compress-util.js +123 -345
- package/dist/es5/lib/utils/compress-util.js.map +1 -1
- package/dist/es5/lib/utils/file-utils.js +20 -98
- package/dist/es5/lib/utils/file-utils.js.map +1 -1
- package/dist/es5/lib/utils/lod-conversion-utils.js +9 -9
- package/dist/es5/lib/utils/lod-conversion-utils.js.map +1 -1
- package/dist/es5/lib/utils/statistic-utills.js +41 -152
- package/dist/es5/lib/utils/statistic-utills.js.map +1 -1
- package/dist/es5/pgm-loader.js +3 -5
- package/dist/es5/pgm-loader.js.map +1 -1
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +19 -13
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js +19 -8
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/texture-atlas.js +33 -0
- package/dist/esm/3d-tiles-converter/helpers/texture-atlas.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/geometry-converter.js +29 -31
- package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/node-debug.js +2 -2
- package/dist/esm/i3s-converter/helpers/node-debug.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/node-pages.js +2 -2
- package/dist/esm/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/esm/i3s-converter/i3s-converter.js +50 -31
- package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/metadata.js +1 -1
- package/dist/esm/i3s-converter/json-templates/metadata.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/scene-server.js +1 -1
- package/dist/esm/i3s-converter/json-templates/scene-server.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/shared-resources.js +2 -2
- package/dist/esm/i3s-converter/json-templates/shared-resources.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/store.js +2 -2
- package/dist/esm/i3s-converter/json-templates/store.js.map +1 -1
- package/dist/esm/i3s-server/controllers/index-controller.js +2 -2
- package/dist/esm/i3s-server/controllers/index-controller.js.map +1 -1
- package/dist/esm/lib/utils/compress-util.js +13 -13
- package/dist/esm/lib/utils/compress-util.js.map +1 -1
- package/dist/esm/lib/utils/file-utils.js +1 -1
- package/dist/esm/lib/utils/file-utils.js.map +1 -1
- package/dist/esm/lib/utils/statistic-utills.js +5 -5
- package/dist/esm/lib/utils/statistic-utills.js.map +1 -1
- package/dist/esm/pgm-loader.js +1 -1
- package/dist/esm/pgm-loader.js.map +1 -1
- package/package.json +22 -19
- package/src/3d-tiles-converter/3d-tiles-converter.ts +4 -2
- package/src/3d-tiles-converter/helpers/b3dm-converter.js +35 -7
- package/src/3d-tiles-converter/helpers/texture-atlas.ts +55 -0
- package/src/i3s-converter/helpers/geometry-converter.js +21 -22
- package/src/i3s-converter/i3s-converter.ts +32 -7
- package/src/i3s-converter/json-templates/metadata.js +1 -1
- package/src/i3s-converter/json-templates/scene-server.js +1 -1
- package/src/i3s-converter/json-templates/store.js +2 -2
- package/src/i3s-server/controllers/index-controller.js +1 -1
- package/dist/dist.min.js +0 -94
- package/dist/dist.min.js.map +0 -1
- package/dist/scripts/converter.js +0 -274
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
@@ -11,114 +9,38 @@ exports.removeDir = removeDir;
|
|
|
11
9
|
exports.removeFile = removeFile;
|
|
12
10
|
exports.getAbsoluteFilePath = getAbsoluteFilePath;
|
|
13
11
|
|
|
14
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
15
|
-
|
|
16
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
17
|
-
|
|
18
12
|
var _fs = require("fs");
|
|
19
13
|
|
|
20
14
|
var _path = require("path");
|
|
21
15
|
|
|
22
16
|
var _compressUtil = require("./compress-util");
|
|
23
17
|
|
|
24
|
-
function writeFile(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
_writeFile = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(path, data) {
|
|
30
|
-
var fileName,
|
|
31
|
-
pathFile,
|
|
32
|
-
_args = arguments;
|
|
33
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
34
|
-
while (1) {
|
|
35
|
-
switch (_context.prev = _context.next) {
|
|
36
|
-
case 0:
|
|
37
|
-
fileName = _args.length > 2 && _args[2] !== undefined ? _args[2] : 'index.json';
|
|
38
|
-
_context.next = 3;
|
|
39
|
-
return _fs.promises.mkdir(path, {
|
|
40
|
-
recursive: true
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
case 3:
|
|
44
|
-
pathFile = (0, _path.join)(path, fileName);
|
|
45
|
-
_context.prev = 4;
|
|
46
|
-
_context.next = 7;
|
|
47
|
-
return _fs.promises.writeFile(pathFile, data);
|
|
48
|
-
|
|
49
|
-
case 7:
|
|
50
|
-
_context.next = 12;
|
|
51
|
-
break;
|
|
52
|
-
|
|
53
|
-
case 9:
|
|
54
|
-
_context.prev = 9;
|
|
55
|
-
_context.t0 = _context["catch"](4);
|
|
56
|
-
throw _context.t0;
|
|
57
|
-
|
|
58
|
-
case 12:
|
|
59
|
-
console.log("".concat(pathFile, " saved."));
|
|
60
|
-
return _context.abrupt("return", pathFile);
|
|
18
|
+
async function writeFile(path, data, fileName = 'index.json') {
|
|
19
|
+
await _fs.promises.mkdir(path, {
|
|
20
|
+
recursive: true
|
|
21
|
+
});
|
|
22
|
+
const pathFile = (0, _path.join)(path, fileName);
|
|
61
23
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}, _callee, null, [[4, 9]]);
|
|
68
|
-
}));
|
|
69
|
-
return _writeFile.apply(this, arguments);
|
|
70
|
-
}
|
|
24
|
+
try {
|
|
25
|
+
await _fs.promises.writeFile(pathFile, data);
|
|
26
|
+
} catch (err) {
|
|
27
|
+
throw err;
|
|
28
|
+
}
|
|
71
29
|
|
|
72
|
-
|
|
73
|
-
return
|
|
30
|
+
console.log("".concat(pathFile, " saved."));
|
|
31
|
+
return pathFile;
|
|
74
32
|
}
|
|
75
33
|
|
|
76
|
-
function
|
|
77
|
-
|
|
78
|
-
var fileName,
|
|
79
|
-
compress,
|
|
80
|
-
pathFile,
|
|
81
|
-
pathGzFile,
|
|
82
|
-
_args2 = arguments;
|
|
83
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
84
|
-
while (1) {
|
|
85
|
-
switch (_context2.prev = _context2.next) {
|
|
86
|
-
case 0:
|
|
87
|
-
fileName = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : 'index.json';
|
|
88
|
-
compress = _args2.length > 3 && _args2[3] !== undefined ? _args2[3] : true;
|
|
89
|
-
_context2.next = 4;
|
|
90
|
-
return writeFile(path, data, fileName);
|
|
91
|
-
|
|
92
|
-
case 4:
|
|
93
|
-
pathFile = _context2.sent;
|
|
94
|
-
|
|
95
|
-
if (!compress) {
|
|
96
|
-
_context2.next = 12;
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
_context2.next = 8;
|
|
101
|
-
return (0, _compressUtil.compressFileWithGzip)(pathFile);
|
|
102
|
-
|
|
103
|
-
case 8:
|
|
104
|
-
pathGzFile = _context2.sent;
|
|
105
|
-
_context2.next = 11;
|
|
106
|
-
return removeFile(pathFile);
|
|
107
|
-
|
|
108
|
-
case 11:
|
|
109
|
-
return _context2.abrupt("return", pathGzFile);
|
|
34
|
+
async function writeFileForSlpk(path, data, fileName = 'index.json', compress = true) {
|
|
35
|
+
const pathFile = await writeFile(path, data, fileName);
|
|
110
36
|
|
|
111
|
-
|
|
112
|
-
|
|
37
|
+
if (compress) {
|
|
38
|
+
const pathGzFile = await (0, _compressUtil.compressFileWithGzip)(pathFile);
|
|
39
|
+
await removeFile(pathFile);
|
|
40
|
+
return pathGzFile;
|
|
41
|
+
}
|
|
113
42
|
|
|
114
|
-
|
|
115
|
-
case "end":
|
|
116
|
-
return _context2.stop();
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}, _callee2);
|
|
120
|
-
}));
|
|
121
|
-
return _writeFileForSlpk.apply(this, arguments);
|
|
43
|
+
return pathFile;
|
|
122
44
|
}
|
|
123
45
|
|
|
124
46
|
function removeDir(path) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/utils/file-utils.js"],"names":["writeFile","path","data","fileName","fs","mkdir","recursive","pathFile","console","log","writeFileForSlpk","compress","pathGzFile","removeFile","removeDir","rmdir","unlink","getAbsoluteFilePath","filePath","process","cwd"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/utils/file-utils.js"],"names":["writeFile","path","data","fileName","fs","mkdir","recursive","pathFile","err","console","log","writeFileForSlpk","compress","pathGzFile","removeFile","removeDir","rmdir","unlink","getAbsoluteFilePath","filePath","process","cwd"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AAEO,eAAeA,SAAf,CAAyBC,IAAzB,EAA+BC,IAA/B,EAAqCC,QAAQ,GAAG,YAAhD,EAA8D;AACnE,QAAMC,aAAGC,KAAH,CAASJ,IAAT,EAAe;AAACK,IAAAA,SAAS,EAAE;AAAZ,GAAf,CAAN;AACA,QAAMC,QAAQ,GAAG,gBAAKN,IAAL,EAAWE,QAAX,CAAjB;;AACA,MAAI;AACF,UAAMC,aAAGJ,SAAH,CAAaO,QAAb,EAAuBL,IAAvB,CAAN;AACD,GAFD,CAEE,OAAOM,GAAP,EAAY;AACZ,UAAMA,GAAN;AACD;;AACDC,EAAAA,OAAO,CAACC,GAAR,WAAeH,QAAf;AACA,SAAOA,QAAP;AACD;;AAEM,eAAeI,gBAAf,CAAgCV,IAAhC,EAAsCC,IAAtC,EAA4CC,QAAQ,GAAG,YAAvD,EAAqES,QAAQ,GAAG,IAAhF,EAAsF;AAC3F,QAAML,QAAQ,GAAG,MAAMP,SAAS,CAACC,IAAD,EAAOC,IAAP,EAAaC,QAAb,CAAhC;;AACA,MAAIS,QAAJ,EAAc;AACZ,UAAMC,UAAU,GAAG,MAAM,wCAAqBN,QAArB,CAAzB;AAEA,UAAMO,UAAU,CAACP,QAAD,CAAhB;AACA,WAAOM,UAAP;AACD;;AACD,SAAON,QAAP;AACD;;AAEM,SAASQ,SAAT,CAAmBd,IAAnB,EAAyB;AAC9B,SAAOG,aAAGY,KAAH,CAASf,IAAT,EAAe;AAACK,IAAAA,SAAS,EAAE;AAAZ,GAAf,CAAP;AACD;;AAEM,SAASQ,UAAT,CAAoBb,IAApB,EAA0B;AAC/B,SAAOG,aAAGa,MAAH,CAAUhB,IAAV,CAAP;AACD;;AAEM,SAASiB,mBAAT,CAA6BC,QAA7B,EAAuC;AAC5C,SAAO,sBAAWA,QAAX,IAAuBA,QAAvB,GAAkC,gBAAKC,OAAO,CAACC,GAAR,EAAL,EAAoBF,QAApB,CAAzC;AACD","sourcesContent":["import {promises as fs} from 'fs';\nimport {isAbsolute, join} from 'path';\nimport {compressFileWithGzip} from './compress-util';\n\nexport async function writeFile(path, data, fileName = 'index.json') {\n await fs.mkdir(path, {recursive: true});\n const pathFile = join(path, fileName);\n try {\n await fs.writeFile(pathFile, data);\n } catch (err) {\n throw err;\n }\n console.log(`${pathFile} saved.`); // eslint-disable-line\n return pathFile;\n}\n\nexport async function writeFileForSlpk(path, data, fileName = 'index.json', compress = true) {\n const pathFile = await writeFile(path, data, fileName);\n if (compress) {\n const pathGzFile = await compressFileWithGzip(pathFile);\n // After compression, we don't need an uncompressed file\n await removeFile(pathFile);\n return pathGzFile;\n }\n return pathFile;\n}\n\nexport function removeDir(path) {\n return fs.rmdir(path, {recursive: true});\n}\n\nexport function removeFile(path) {\n return fs.unlink(path);\n}\n\nexport function getAbsoluteFilePath(filePath) {\n return isAbsolute(filePath) ? filePath : join(process.cwd(), filePath); // eslint-disable-line no-undef\n}\n"],"file":"file-utils.js"}
|
|
@@ -5,17 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.convertGeometricErrorToScreenThreshold = convertGeometricErrorToScreenThreshold;
|
|
7
7
|
exports.convertScreenThresholdToGeometricError = convertScreenThresholdToGeometricError;
|
|
8
|
-
|
|
8
|
+
const DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR = 16;
|
|
9
9
|
|
|
10
10
|
function convertGeometricErrorToScreenThreshold(tile, coordinates) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const lodSelection = [];
|
|
12
|
+
const boundingVolume = tile.boundingVolume;
|
|
13
|
+
const lodMetricValue = tile.lodMetricValue || 0.1;
|
|
14
|
+
const maxScreenThreshold = {
|
|
15
15
|
metricType: 'maxScreenThreshold',
|
|
16
16
|
maxError: coordinates.mbs[3] * 2 * DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR / lodMetricValue
|
|
17
17
|
};
|
|
18
|
-
|
|
18
|
+
const maxScreenThresholdSQ = {
|
|
19
19
|
metricType: 'maxScreenThresholdSQ',
|
|
20
20
|
maxError: Math.PI * 0.25 * maxScreenThreshold.maxError * maxScreenThreshold.maxError
|
|
21
21
|
};
|
|
@@ -32,11 +32,11 @@ function convertGeometricErrorToScreenThreshold(tile, coordinates) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
function convertScreenThresholdToGeometricError(node) {
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
const metricData = node.header.lodSelection.maxScreenThreshold || {};
|
|
36
|
+
let maxError = metricData.maxError;
|
|
37
37
|
|
|
38
38
|
if (!maxError) {
|
|
39
|
-
|
|
39
|
+
const sqMetricData = node.header.lodSelection.maxScreenThresholdSQ;
|
|
40
40
|
|
|
41
41
|
if (sqMetricData) {
|
|
42
42
|
maxError = Math.sqrt(sqMetricData.maxError / (Math.PI * 0.25));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/utils/lod-conversion-utils.js"],"names":["DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR","convertGeometricErrorToScreenThreshold","tile","coordinates","lodSelection","boundingVolume","lodMetricValue","maxScreenThreshold","metricType","maxError","mbs","maxScreenThresholdSQ","Math","PI","constructor","name","push","convertScreenThresholdToGeometricError","node","metricData","header","sqMetricData","sqrt"],"mappings":";;;;;;;AACA,
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/utils/lod-conversion-utils.js"],"names":["DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR","convertGeometricErrorToScreenThreshold","tile","coordinates","lodSelection","boundingVolume","lodMetricValue","maxScreenThreshold","metricType","maxError","mbs","maxScreenThresholdSQ","Math","PI","constructor","name","push","convertScreenThresholdToGeometricError","node","metricData","header","sqMetricData","sqrt"],"mappings":";;;;;;;AACA,MAAMA,kCAAkC,GAAG,EAA3C;;AAeO,SAASC,sCAAT,CAAgDC,IAAhD,EAAsDC,WAAtD,EAAmE;AACxE,QAAMC,YAAY,GAAG,EAArB;AACA,QAAMC,cAAc,GAAGH,IAAI,CAACG,cAA5B;AACA,QAAMC,cAAc,GAAGJ,IAAI,CAACI,cAAL,IAAuB,GAA9C;AACA,QAAMC,kBAAkB,GAAG;AACzBC,IAAAA,UAAU,EAAE,oBADa;AAEzBC,IAAAA,QAAQ,EAAGN,WAAW,CAACO,GAAZ,CAAgB,CAAhB,IAAqB,CAArB,GAAyBV,kCAA1B,GAAgEM;AAFjD,GAA3B;AAIA,QAAMK,oBAAoB,GAAG;AAC3BH,IAAAA,UAAU,EAAE,sBADe;AAE3BC,IAAAA,QAAQ,EAAEG,IAAI,CAACC,EAAL,GAAU,IAAV,GAAiBN,kBAAkB,CAACE,QAApC,GAA+CF,kBAAkB,CAACE;AAFjD,GAA7B;;AAKA,MAAIJ,cAAc,CAACS,WAAf,CAA2BC,IAA3B,KAAoC,qBAAxC,EAA+D;AAC7DX,IAAAA,YAAY,CAACY,IAAb,CAAkBL,oBAAlB;AACAP,IAAAA,YAAY,CAACY,IAAb,CAAkBT,kBAAlB;AACD,GAHD,MAGO;AACLH,IAAAA,YAAY,CAACY,IAAb,CAAkBT,kBAAlB;AACAH,IAAAA,YAAY,CAACY,IAAb,CAAkBL,oBAAlB;AACD;;AAED,SAAOP,YAAP;AACD;;AAEM,SAASa,sCAAT,CAAgDC,IAAhD,EAAsD;AAC3D,QAAMC,UAAU,GAAGD,IAAI,CAACE,MAAL,CAAYhB,YAAZ,CAAyBG,kBAAzB,IAA+C,EAAlE;AACA,MAAIE,QAAQ,GAAGU,UAAU,CAACV,QAA1B;;AACA,MAAI,CAACA,QAAL,EAAe;AACb,UAAMY,YAAY,GAAGH,IAAI,CAACE,MAAL,CAAYhB,YAAZ,CAAyBO,oBAA9C;;AACA,QAAIU,YAAJ,EAAkB;AAChBZ,MAAAA,QAAQ,GAAGG,IAAI,CAACU,IAAL,CAAUD,YAAY,CAACZ,QAAb,IAAyBG,IAAI,CAACC,EAAL,GAAU,IAAnC,CAAV,CAAX;AACD;AACF;;AAED,MAAI,CAACJ,QAAL,EAAe;AACbA,IAAAA,QAAQ,GAAGT,kCAAX;AACD;;AAED,SAAQkB,IAAI,CAACE,MAAL,CAAYV,GAAZ,CAAgB,CAAhB,IAAqB,CAArB,GAAyBV,kCAA1B,GAAgES,QAAvE;AACD","sourcesContent":["// https://cesium.com/docs/cesiumjs-ref-doc/Cesium3DTileset.html\nconst DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR = 16;\n/**\n * Do conversion from geometric error to screen threshold\n * @param {Object} tile\n * @param {Object} coordinates\n * In 3DTiles we have HLOD logic and parent tile also has bigger lodMetric value then its children.\n * In I3s we have reverse logic related to maxError. Parent has lower maxError than its child.\n * In nodes where are no children tile.lodMetricValue is 0. This is because of logic of HLOD in 3DTiles\n * 3DTiles spec:\n * https://github.com/CesiumGS/3d-tiles/tree/master/specification#geometric-error\n * I3S spec:\n * https://github.com/Esri/i3s-spec/blob/master/docs/1.7/lodSelection.cmn.md\n * To avoid infinity values when we do calculations of maxError we shold replace 0 with value which allows us\n * to make child maxError bigger than his parent maxError.\n */\nexport function convertGeometricErrorToScreenThreshold(tile, coordinates) {\n const lodSelection = [];\n const boundingVolume = tile.boundingVolume;\n const lodMetricValue = tile.lodMetricValue || 0.1;\n const maxScreenThreshold = {\n metricType: 'maxScreenThreshold',\n maxError: (coordinates.mbs[3] * 2 * DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR) / lodMetricValue\n };\n const maxScreenThresholdSQ = {\n metricType: 'maxScreenThresholdSQ',\n maxError: Math.PI * 0.25 * maxScreenThreshold.maxError * maxScreenThreshold.maxError\n };\n\n if (boundingVolume.constructor.name === 'OrientedBoundingBox') {\n lodSelection.push(maxScreenThresholdSQ);\n lodSelection.push(maxScreenThreshold);\n } else {\n lodSelection.push(maxScreenThreshold);\n lodSelection.push(maxScreenThresholdSQ);\n }\n\n return lodSelection;\n}\n\nexport function convertScreenThresholdToGeometricError(node) {\n const metricData = node.header.lodSelection.maxScreenThreshold || {};\n let maxError = metricData.maxError;\n if (!maxError) {\n const sqMetricData = node.header.lodSelection.maxScreenThresholdSQ;\n if (sqMetricData) {\n maxError = Math.sqrt(sqMetricData.maxError / (Math.PI * 0.25));\n }\n }\n\n if (!maxError) {\n maxError = DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR;\n }\n\n return (node.header.mbs[3] * 2 * DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR) / maxError;\n}\n"],"file":"lod-conversion-utils.js"}
|
|
@@ -1,39 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.timeConverter = timeConverter;
|
|
9
7
|
exports.calculateFilesSize = calculateFilesSize;
|
|
10
8
|
|
|
11
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
12
|
-
|
|
13
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
14
|
-
|
|
15
9
|
var _path = require("path");
|
|
16
10
|
|
|
17
11
|
var _fs = require("fs");
|
|
18
12
|
|
|
19
13
|
var _fileUtils = require("./file-utils");
|
|
20
14
|
|
|
21
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
22
|
-
|
|
23
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
24
|
-
|
|
25
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
26
|
-
|
|
27
15
|
function timeConverter(time) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
16
|
+
const nanoSecondsInMillisecond = 1e6;
|
|
17
|
+
let timeInSeconds = time[0];
|
|
18
|
+
const hours = Math.floor(timeInSeconds / 3600);
|
|
31
19
|
timeInSeconds = timeInSeconds - hours * 3600;
|
|
32
|
-
|
|
20
|
+
const minutes = Math.floor(timeInSeconds / 60);
|
|
33
21
|
timeInSeconds = timeInSeconds - minutes * 60;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
22
|
+
const seconds = Math.floor(timeInSeconds);
|
|
23
|
+
const milliseconds = time[1] / nanoSecondsInMillisecond;
|
|
24
|
+
let result = '';
|
|
37
25
|
|
|
38
26
|
if (hours) {
|
|
39
27
|
result += "".concat(hours, "h ");
|
|
@@ -54,143 +42,44 @@ function timeConverter(time) {
|
|
|
54
42
|
return result;
|
|
55
43
|
}
|
|
56
44
|
|
|
57
|
-
function calculateFilesSize(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
return _fs.promises.stat(slpkPath);
|
|
80
|
-
|
|
81
|
-
case 7:
|
|
82
|
-
stat = _context.sent;
|
|
83
|
-
return _context.abrupt("return", stat.size);
|
|
84
|
-
|
|
85
|
-
case 9:
|
|
86
|
-
directoryPath = (0, _path.join)(fullOutputPath, tilesetName);
|
|
87
|
-
_context.next = 12;
|
|
88
|
-
return getTotalFilesSize(directoryPath);
|
|
89
|
-
|
|
90
|
-
case 12:
|
|
91
|
-
totalSize = _context.sent;
|
|
92
|
-
return _context.abrupt("return", totalSize);
|
|
93
|
-
|
|
94
|
-
case 16:
|
|
95
|
-
_context.prev = 16;
|
|
96
|
-
_context.t0 = _context["catch"](2);
|
|
97
|
-
console.log('Calculate file sizes error: ', _context.t0);
|
|
98
|
-
return _context.abrupt("return", null);
|
|
99
|
-
|
|
100
|
-
case 20:
|
|
101
|
-
case "end":
|
|
102
|
-
return _context.stop();
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}, _callee, null, [[2, 16]]);
|
|
106
|
-
}));
|
|
107
|
-
return _calculateFilesSize.apply(this, arguments);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function getTotalFilesSize(_x2) {
|
|
111
|
-
return _getTotalFilesSize.apply(this, arguments);
|
|
45
|
+
async function calculateFilesSize(params) {
|
|
46
|
+
const {
|
|
47
|
+
slpk,
|
|
48
|
+
outputPath,
|
|
49
|
+
tilesetName
|
|
50
|
+
} = params;
|
|
51
|
+
const fullOutputPath = (0, _fileUtils.getAbsoluteFilePath)(outputPath);
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
if (slpk) {
|
|
55
|
+
const slpkPath = (0, _path.join)(fullOutputPath, "".concat(tilesetName, ".slpk"));
|
|
56
|
+
const stat = await _fs.promises.stat(slpkPath);
|
|
57
|
+
return stat.size;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const directoryPath = (0, _path.join)(fullOutputPath, tilesetName);
|
|
61
|
+
const totalSize = await getTotalFilesSize(directoryPath);
|
|
62
|
+
return totalSize;
|
|
63
|
+
} catch (error) {
|
|
64
|
+
console.log('Calculate file sizes error: ', error);
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
112
67
|
}
|
|
113
68
|
|
|
114
|
-
function
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
119
|
-
while (1) {
|
|
120
|
-
switch (_context2.prev = _context2.next) {
|
|
121
|
-
case 0:
|
|
122
|
-
totalFileSize = 0;
|
|
123
|
-
_context2.next = 3;
|
|
124
|
-
return _fs.promises.readdir(dirPath);
|
|
125
|
-
|
|
126
|
-
case 3:
|
|
127
|
-
files = _context2.sent;
|
|
128
|
-
_iterator = _createForOfIteratorHelper(files);
|
|
129
|
-
_context2.prev = 5;
|
|
130
|
-
|
|
131
|
-
_iterator.s();
|
|
69
|
+
async function getTotalFilesSize(dirPath) {
|
|
70
|
+
let totalFileSize = 0;
|
|
71
|
+
const files = await _fs.promises.readdir(dirPath);
|
|
132
72
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
_context2.next = 22;
|
|
136
|
-
break;
|
|
137
|
-
}
|
|
73
|
+
for (const file of files) {
|
|
74
|
+
const fileStat = await _fs.promises.stat((0, _path.join)(dirPath, file));
|
|
138
75
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
if (!fileStat.isDirectory()) {
|
|
147
|
-
_context2.next = 19;
|
|
148
|
-
break;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
_context2.t0 = totalFileSize;
|
|
152
|
-
_context2.next = 16;
|
|
153
|
-
return getTotalFilesSize((0, _path.join)(dirPath, file));
|
|
154
|
-
|
|
155
|
-
case 16:
|
|
156
|
-
totalFileSize = _context2.t0 += _context2.sent;
|
|
157
|
-
_context2.next = 20;
|
|
158
|
-
break;
|
|
159
|
-
|
|
160
|
-
case 19:
|
|
161
|
-
totalFileSize += fileStat.size;
|
|
162
|
-
|
|
163
|
-
case 20:
|
|
164
|
-
_context2.next = 7;
|
|
165
|
-
break;
|
|
166
|
-
|
|
167
|
-
case 22:
|
|
168
|
-
_context2.next = 27;
|
|
169
|
-
break;
|
|
170
|
-
|
|
171
|
-
case 24:
|
|
172
|
-
_context2.prev = 24;
|
|
173
|
-
_context2.t1 = _context2["catch"](5);
|
|
174
|
-
|
|
175
|
-
_iterator.e(_context2.t1);
|
|
176
|
-
|
|
177
|
-
case 27:
|
|
178
|
-
_context2.prev = 27;
|
|
179
|
-
|
|
180
|
-
_iterator.f();
|
|
181
|
-
|
|
182
|
-
return _context2.finish(27);
|
|
183
|
-
|
|
184
|
-
case 30:
|
|
185
|
-
return _context2.abrupt("return", totalFileSize);
|
|
76
|
+
if (fileStat.isDirectory()) {
|
|
77
|
+
totalFileSize += await getTotalFilesSize((0, _path.join)(dirPath, file));
|
|
78
|
+
} else {
|
|
79
|
+
totalFileSize += fileStat.size;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
186
82
|
|
|
187
|
-
|
|
188
|
-
case "end":
|
|
189
|
-
return _context2.stop();
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}, _callee2, null, [[5, 24, 27, 30]]);
|
|
193
|
-
}));
|
|
194
|
-
return _getTotalFilesSize.apply(this, arguments);
|
|
83
|
+
return totalFileSize;
|
|
195
84
|
}
|
|
196
85
|
//# sourceMappingURL=statistic-utills.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/utils/statistic-utills.js"],"names":["timeConverter","time","nanoSecondsInMillisecond","timeInSeconds","hours","Math","floor","minutes","seconds","milliseconds","result","calculateFilesSize","params","slpk","outputPath","tilesetName","fullOutputPath","slpkPath","
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/utils/statistic-utills.js"],"names":["timeConverter","time","nanoSecondsInMillisecond","timeInSeconds","hours","Math","floor","minutes","seconds","milliseconds","result","calculateFilesSize","params","slpk","outputPath","tilesetName","fullOutputPath","slpkPath","stat","fs","size","directoryPath","totalSize","getTotalFilesSize","error","console","log","dirPath","totalFileSize","files","readdir","file","fileStat","isDirectory"],"mappings":";;;;;;;;AAAA;;AACA;;AACA;;AAEO,SAASA,aAAT,CAAuBC,IAAvB,EAA6B;AAClC,QAAMC,wBAAwB,GAAG,GAAjC;AACA,MAAIC,aAAa,GAAGF,IAAI,CAAC,CAAD,CAAxB;AACA,QAAMG,KAAK,GAAGC,IAAI,CAACC,KAAL,CAAWH,aAAa,GAAG,IAA3B,CAAd;AACAA,EAAAA,aAAa,GAAGA,aAAa,GAAGC,KAAK,GAAG,IAAxC;AACA,QAAMG,OAAO,GAAGF,IAAI,CAACC,KAAL,CAAWH,aAAa,GAAG,EAA3B,CAAhB;AACAA,EAAAA,aAAa,GAAGA,aAAa,GAAGI,OAAO,GAAG,EAA1C;AACA,QAAMC,OAAO,GAAGH,IAAI,CAACC,KAAL,CAAWH,aAAX,CAAhB;AACA,QAAMM,YAAY,GAAGR,IAAI,CAAC,CAAD,CAAJ,GAAUC,wBAA/B;AACA,MAAIQ,MAAM,GAAG,EAAb;;AAEA,MAAIN,KAAJ,EAAW;AACTM,IAAAA,MAAM,cAAON,KAAP,OAAN;AACD;;AAED,MAAIG,OAAJ,EAAa;AACXG,IAAAA,MAAM,cAAOH,OAAP,OAAN;AACD;;AAED,MAAIC,OAAJ,EAAa;AACXE,IAAAA,MAAM,cAAOF,OAAP,MAAN;AACD;;AAED,MAAI,CAACE,MAAL,EAAa;AACXA,IAAAA,MAAM,cAAOD,YAAP,OAAN;AACD;;AAED,SAAOC,MAAP;AACD;;AAEM,eAAeC,kBAAf,CAAkCC,MAAlC,EAA0C;AAC/C,QAAM;AAACC,IAAAA,IAAD;AAAOC,IAAAA,UAAP;AAAmBC,IAAAA;AAAnB,MAAkCH,MAAxC;AACA,QAAMI,cAAc,GAAG,oCAAoBF,UAApB,CAAvB;;AAEA,MAAI;AACF,QAAID,IAAJ,EAAU;AACR,YAAMI,QAAQ,GAAG,gBAAKD,cAAL,YAAwBD,WAAxB,WAAjB;AACA,YAAMG,IAAI,GAAG,MAAMC,aAAGD,IAAH,CAAQD,QAAR,CAAnB;AACA,aAAOC,IAAI,CAACE,IAAZ;AACD;;AAED,UAAMC,aAAa,GAAG,gBAAKL,cAAL,EAAqBD,WAArB,CAAtB;AACA,UAAMO,SAAS,GAAG,MAAMC,iBAAiB,CAACF,aAAD,CAAzC;AACA,WAAOC,SAAP;AACD,GAVD,CAUE,OAAOE,KAAP,EAAc;AACdC,IAAAA,OAAO,CAACC,GAAR,CAAY,8BAAZ,EAA4CF,KAA5C;AACA,WAAO,IAAP;AACD;AACF;;AAED,eAAeD,iBAAf,CAAiCI,OAAjC,EAA0C;AACxC,MAAIC,aAAa,GAAG,CAApB;AAEA,QAAMC,KAAK,GAAG,MAAMV,aAAGW,OAAH,CAAWH,OAAX,CAApB;;AAEA,OAAK,MAAMI,IAAX,IAAmBF,KAAnB,EAA0B;AACxB,UAAMG,QAAQ,GAAG,MAAMb,aAAGD,IAAH,CAAQ,gBAAKS,OAAL,EAAcI,IAAd,CAAR,CAAvB;;AACA,QAAIC,QAAQ,CAACC,WAAT,EAAJ,EAA4B;AAC1BL,MAAAA,aAAa,IAAI,MAAML,iBAAiB,CAAC,gBAAKI,OAAL,EAAcI,IAAd,CAAD,CAAxC;AACD,KAFD,MAEO;AACLH,MAAAA,aAAa,IAAII,QAAQ,CAACZ,IAA1B;AACD;AACF;;AACD,SAAOQ,aAAP;AACD","sourcesContent":["import {join} from 'path';\nimport {promises as fs} from 'fs';\nimport {getAbsoluteFilePath} from './file-utils';\n\nexport function timeConverter(time) {\n const nanoSecondsInMillisecond = 1e6;\n let timeInSeconds = time[0];\n const hours = Math.floor(timeInSeconds / 3600);\n timeInSeconds = timeInSeconds - hours * 3600;\n const minutes = Math.floor(timeInSeconds / 60);\n timeInSeconds = timeInSeconds - minutes * 60;\n const seconds = Math.floor(timeInSeconds);\n const milliseconds = time[1] / nanoSecondsInMillisecond;\n let result = '';\n\n if (hours) {\n result += `${hours}h `;\n }\n\n if (minutes) {\n result += `${minutes}m `;\n }\n\n if (seconds) {\n result += `${seconds}s`;\n }\n\n if (!result) {\n result += `${milliseconds}ms`;\n }\n\n return result;\n}\n\nexport async function calculateFilesSize(params) {\n const {slpk, outputPath, tilesetName} = params;\n const fullOutputPath = getAbsoluteFilePath(outputPath);\n\n try {\n if (slpk) {\n const slpkPath = join(fullOutputPath, `${tilesetName}.slpk`);\n const stat = await fs.stat(slpkPath);\n return stat.size;\n }\n\n const directoryPath = join(fullOutputPath, tilesetName);\n const totalSize = await getTotalFilesSize(directoryPath);\n return totalSize;\n } catch (error) {\n console.log('Calculate file sizes error: ', error); // eslint-disable-line\n return null;\n }\n}\n\nasync function getTotalFilesSize(dirPath) {\n let totalFileSize = 0;\n\n const files = await fs.readdir(dirPath);\n\n for (const file of files) {\n const fileStat = await fs.stat(join(dirPath, file));\n if (fileStat.isDirectory()) {\n totalFileSize += await getTotalFilesSize(join(dirPath, file));\n } else {\n totalFileSize += fileStat.size;\n }\n }\n return totalFileSize;\n}\n"],"file":"statistic-utills.js"}
|
package/dist/es5/pgm-loader.js
CHANGED
|
@@ -7,16 +7,14 @@ exports.PGMLoader = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _pgmParser = require("./lib/pgm-parser");
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const VERSION = typeof "3.1.0-beta.5" !== 'undefined' ? "3.1.0-beta.5" : 'latest';
|
|
11
|
+
const PGMLoader = {
|
|
12
12
|
name: 'PGM - Netpbm grayscale image format',
|
|
13
13
|
id: 'pgm',
|
|
14
14
|
module: 'tile-converter',
|
|
15
15
|
version: VERSION,
|
|
16
16
|
mimeTypes: ['image/x-portable-graymap'],
|
|
17
|
-
parse:
|
|
18
|
-
return (0, _pgmParser.parsePgm)(new Uint8Array(arrayBuffer), options);
|
|
19
|
-
},
|
|
17
|
+
parse: (arrayBuffer, options) => (0, _pgmParser.parsePgm)(new Uint8Array(arrayBuffer), options),
|
|
20
18
|
extensions: ['pgm'],
|
|
21
19
|
options: {
|
|
22
20
|
cubic: false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/pgm-loader.ts"],"names":["VERSION","PGMLoader","name","id","module","version","mimeTypes","parse","arrayBuffer","options","Uint8Array","extensions","cubic"],"mappings":";;;;;;;AAMA;;AAFA,
|
|
1
|
+
{"version":3,"sources":["../../src/pgm-loader.ts"],"names":["VERSION","PGMLoader","name","id","module","version","mimeTypes","parse","arrayBuffer","options","Uint8Array","extensions","cubic"],"mappings":";;;;;;;AAMA;;AAFA,MAAMA,OAAO,GAAG,0BAAuB,WAAvB,oBAAmD,QAAnE;AAOO,MAAMC,SAA2B,GAAG;AACzCC,EAAAA,IAAI,EAAE,qCADmC;AAEzCC,EAAAA,EAAE,EAAE,KAFqC;AAGzCC,EAAAA,MAAM,EAAE,gBAHiC;AAIzCC,EAAAA,OAAO,EAAEL,OAJgC;AAKzCM,EAAAA,SAAS,EAAE,CAAC,0BAAD,CAL8B;AAMzCC,EAAAA,KAAK,EAAE,CAACC,WAAD,EAAcC,OAAd,KAA0B,yBAAS,IAAIC,UAAJ,CAAeF,WAAf,CAAT,EAAsCC,OAAtC,CANQ;AAOzCE,EAAAA,UAAU,EAAE,CAAC,KAAD,CAP6B;AAQzCF,EAAAA,OAAO,EAAE;AAEPG,IAAAA,KAAK,EAAE;AAFA;AARgC,CAApC","sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nimport {parsePgm} from './lib/pgm-parser';\n\n/**\n * Loader for PGM - Netpbm grayscale image format\n */\nexport const PGMLoader: LoaderWithParser = {\n name: 'PGM - Netpbm grayscale image format',\n id: 'pgm',\n module: 'tile-converter',\n version: VERSION,\n mimeTypes: ['image/x-portable-graymap'],\n parse: (arrayBuffer, options) => parsePgm(new Uint8Array(arrayBuffer), options),\n extensions: ['pgm'],\n options: {\n // TODO - use pgm namespace\n cubic: false\n }\n};\n"],"file":"pgm-loader.js"}
|
|
@@ -3,7 +3,7 @@ import { join } from 'path';
|
|
|
3
3
|
import process from 'process';
|
|
4
4
|
import transform from 'json-map-transform';
|
|
5
5
|
import { load } from '@loaders.gl/core';
|
|
6
|
-
import { I3SLoader, I3SAttributeLoader } from '@loaders.gl/i3s';
|
|
6
|
+
import { I3SLoader, I3SAttributeLoader, COORDINATE_SYSTEM } from '@loaders.gl/i3s';
|
|
7
7
|
import { Tileset3D, Tile3D } from '@loaders.gl/tiles';
|
|
8
8
|
import { PGMLoader } from '../pgm-loader';
|
|
9
9
|
import { i3sObbTo3dTilesObb } from './helpers/i3s-obb-to-3d-tiles-obb';
|
|
@@ -55,13 +55,19 @@ export default class Tiles3DConverter {
|
|
|
55
55
|
this.geoidHeightModel = await load(egmFilePath, PGMLoader);
|
|
56
56
|
console.log('Loading egm file completed!');
|
|
57
57
|
const sourceTilesetJson = await load(inputUrl, I3SLoader, {});
|
|
58
|
-
this.sourceTileset = new Tileset3D(sourceTilesetJson, {
|
|
58
|
+
this.sourceTileset = new Tileset3D(sourceTilesetJson, {
|
|
59
|
+
loadOptions: {
|
|
60
|
+
i3s: {
|
|
61
|
+
coordinateSystem: COORDINATE_SYSTEM.LNGLAT_OFFSETS
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
59
65
|
|
|
60
66
|
if (!this.sourceTileset.root.header.obb) {
|
|
61
67
|
this.sourceTileset.root.header.obb = createObbFromMbs(this.sourceTileset.root.header.mbs);
|
|
62
68
|
}
|
|
63
69
|
|
|
64
|
-
this.tilesetPath = join(
|
|
70
|
+
this.tilesetPath = join("".concat(outputPath), "".concat(tilesetName));
|
|
65
71
|
this.attributeStorageInfo = sourceTilesetJson.attributeStorageInfo;
|
|
66
72
|
|
|
67
73
|
try {
|
|
@@ -120,10 +126,10 @@ export default class Tiles3DConverter {
|
|
|
120
126
|
};
|
|
121
127
|
const b3dm = await new B3dmConverter().convert(sourceChild, attributes);
|
|
122
128
|
child.content = {
|
|
123
|
-
uri:
|
|
129
|
+
uri: "".concat(sourceChild.id, ".b3dm"),
|
|
124
130
|
boundingVolume
|
|
125
131
|
};
|
|
126
|
-
await writeFile(this.tilesetPath, new Uint8Array(b3dm),
|
|
132
|
+
await writeFile(this.tilesetPath, new Uint8Array(b3dm), "".concat(sourceChild.id, ".b3dm"));
|
|
127
133
|
parentNode.children.push(child);
|
|
128
134
|
sourceChild.unloadContent();
|
|
129
135
|
await this._addChildren(sourceChild, child, level + 1);
|
|
@@ -137,7 +143,7 @@ export default class Tiles3DConverter {
|
|
|
137
143
|
let header;
|
|
138
144
|
|
|
139
145
|
if (this.sourceTileset.tileset.nodePages) {
|
|
140
|
-
console.log(
|
|
146
|
+
console.log("Node conversion: ".concat(childNodeInfo.id));
|
|
141
147
|
header = await this.sourceTileset.tileset.nodePagesTile.formTileFromNodePages(childNodeInfo.id);
|
|
142
148
|
} else {
|
|
143
149
|
const {
|
|
@@ -152,7 +158,7 @@ export default class Tiles3DConverter {
|
|
|
152
158
|
loadContent: false
|
|
153
159
|
}
|
|
154
160
|
};
|
|
155
|
-
console.log(
|
|
161
|
+
console.log("Node conversion: ".concat(nodeUrl));
|
|
156
162
|
header = await load(nodeUrl, loader, options);
|
|
157
163
|
}
|
|
158
164
|
|
|
@@ -227,12 +233,12 @@ export default class Tiles3DConverter {
|
|
|
227
233
|
const filesSize = await calculateFilesSize(params);
|
|
228
234
|
const diff = process.hrtime(this.conversionStartTime);
|
|
229
235
|
const conversionTime = timeConverter(diff);
|
|
230
|
-
console.log(
|
|
231
|
-
console.log(
|
|
232
|
-
console.log(
|
|
233
|
-
console.log(
|
|
234
|
-
console.log(
|
|
235
|
-
console.log(
|
|
236
|
+
console.log("------------------------------------------------");
|
|
237
|
+
console.log("Finish conversion of ".concat(I3S));
|
|
238
|
+
console.log("Total conversion time: ".concat(conversionTime));
|
|
239
|
+
console.log("Vertex count: ", this.vertexCounter);
|
|
240
|
+
console.log("File(s) size: ", filesSize, ' bytes');
|
|
241
|
+
console.log("------------------------------------------------");
|
|
236
242
|
}
|
|
237
243
|
|
|
238
244
|
}
|