@loaders.gl/tile-converter 3.0.13 → 3.0.14

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.
Files changed (69) hide show
  1. package/dist/dist.es5.min.js +3 -3
  2. package/dist/dist.es5.min.js.map +1 -1
  3. package/dist/dist.min.js +11 -11
  4. package/dist/dist.min.js.map +1 -1
  5. package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +422 -184
  6. package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
  7. package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +299 -202
  8. package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
  9. package/dist/es5/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +8 -4
  10. package/dist/es5/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +1 -1
  11. package/dist/es5/3d-tiles-converter/json-templates/tileset.js +17 -7
  12. package/dist/es5/3d-tiles-converter/json-templates/tileset.js.map +1 -1
  13. package/dist/es5/bundle.js +2 -2
  14. package/dist/es5/bundle.js.map +1 -1
  15. package/dist/es5/deps-installer/deps-installer.js +65 -17
  16. package/dist/es5/deps-installer/deps-installer.js.map +1 -1
  17. package/dist/es5/i3s-converter/helpers/coordinate-converter.js +16 -16
  18. package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +1 -1
  19. package/dist/es5/i3s-converter/helpers/create-scene-server-path.js +33 -9
  20. package/dist/es5/i3s-converter/helpers/create-scene-server-path.js.map +1 -1
  21. package/dist/es5/i3s-converter/helpers/geometry-attributes.js +103 -93
  22. package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +1 -1
  23. package/dist/es5/i3s-converter/helpers/geometry-converter.js +505 -344
  24. package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
  25. package/dist/es5/i3s-converter/helpers/node-debug.js +26 -30
  26. package/dist/es5/i3s-converter/helpers/node-debug.js.map +1 -1
  27. package/dist/es5/i3s-converter/helpers/node-pages.js +203 -102
  28. package/dist/es5/i3s-converter/helpers/node-pages.js.map +1 -1
  29. package/dist/es5/i3s-converter/i3s-converter.js +1510 -680
  30. package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
  31. package/dist/es5/i3s-converter/json-templates/layers.js +25 -15
  32. package/dist/es5/i3s-converter/json-templates/layers.js.map +1 -1
  33. package/dist/es5/i3s-converter/json-templates/metadata.js +1 -1
  34. package/dist/es5/i3s-converter/json-templates/metadata.js.map +1 -1
  35. package/dist/es5/i3s-converter/json-templates/node.js +21 -12
  36. package/dist/es5/i3s-converter/json-templates/node.js.map +1 -1
  37. package/dist/es5/i3s-converter/json-templates/scene-server.js +4 -2
  38. package/dist/es5/i3s-converter/json-templates/scene-server.js.map +1 -1
  39. package/dist/es5/i3s-converter/json-templates/shared-resources.js +55 -15
  40. package/dist/es5/i3s-converter/json-templates/shared-resources.js.map +1 -1
  41. package/dist/es5/i3s-converter/json-templates/store.js +4 -2
  42. package/dist/es5/i3s-converter/json-templates/store.js.map +1 -1
  43. package/dist/es5/i3s-server/app.js +6 -6
  44. package/dist/es5/i3s-server/app.js.map +1 -1
  45. package/dist/es5/i3s-server/controllers/index-controller.js +60 -20
  46. package/dist/es5/i3s-server/controllers/index-controller.js.map +1 -1
  47. package/dist/es5/i3s-server/routes/index.js +41 -14
  48. package/dist/es5/i3s-server/routes/index.js.map +1 -1
  49. package/dist/es5/index.js +4 -4
  50. package/dist/es5/lib/geoid-height-model.js +114 -100
  51. package/dist/es5/lib/geoid-height-model.js.map +1 -1
  52. package/dist/es5/lib/pgm-parser.js +122 -68
  53. package/dist/es5/lib/pgm-parser.js.map +1 -1
  54. package/dist/es5/lib/utils/compress-util.js +345 -123
  55. package/dist/es5/lib/utils/compress-util.js.map +1 -1
  56. package/dist/es5/lib/utils/file-utils.js +98 -20
  57. package/dist/es5/lib/utils/file-utils.js.map +1 -1
  58. package/dist/es5/lib/utils/lod-conversion-utils.js +9 -9
  59. package/dist/es5/lib/utils/lod-conversion-utils.js.map +1 -1
  60. package/dist/es5/lib/utils/statistic-utills.js +152 -41
  61. package/dist/es5/lib/utils/statistic-utills.js.map +1 -1
  62. package/dist/es5/pgm-loader.js +5 -3
  63. package/dist/es5/pgm-loader.js.map +1 -1
  64. package/dist/esm/i3s-converter/i3s-converter.js +11 -3
  65. package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
  66. package/dist/esm/pgm-loader.js +1 -1
  67. package/dist/scripts/converter.js +134 -71
  68. package/package.json +14 -14
  69. package/src/i3s-converter/i3s-converter.ts +10 -3
@@ -7,6 +7,16 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
 
10
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
+
12
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
+
14
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
15
+
16
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
17
+
18
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
19
+
10
20
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
21
 
12
22
  var _path = require("path");
@@ -37,10 +47,21 @@ var _b3dmConverter = _interopRequireDefault(require("./helpers/b3dm-converter"))
37
47
 
38
48
  var _coordinateConverter = require("../i3s-converter/helpers/coordinate-converter");
39
49
 
40
- const I3S = 'I3S';
50
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
51
+
52
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
53
+
54
+ 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; } } }; }
41
55
 
42
- class Tiles3DConverter {
43
- constructor() {
56
+ 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); }
57
+
58
+ 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; }
59
+
60
+ var I3S = 'I3S';
61
+
62
+ var Tiles3DConverter = function () {
63
+ function Tiles3DConverter() {
64
+ (0, _classCallCheck2.default)(this, Tiles3DConverter);
44
65
  (0, _defineProperty2.default)(this, "options", void 0);
45
66
  (0, _defineProperty2.default)(this, "tilesetPath", void 0);
46
67
  (0, _defineProperty2.default)(this, "vertexCounter", void 0);
@@ -57,205 +78,422 @@ class Tiles3DConverter {
57
78
  this.attributeStorageInfo = null;
58
79
  }
59
80
 
60
- async convert(options) {
61
- const {
62
- inputUrl,
63
- outputPath,
64
- tilesetName,
65
- maxDepth,
66
- egmFilePath
67
- } = options;
68
- this.conversionStartTime = _process.default.hrtime();
69
- this.options = {
70
- maxDepth
71
- };
72
- console.log('Loading egm file...');
73
- this.geoidHeightModel = await (0, _core.load)(egmFilePath, _pgmLoader.PGMLoader);
74
- console.log('Loading egm file completed!');
75
- const sourceTilesetJson = await (0, _core.load)(inputUrl, _i3s.I3SLoader, {});
76
- this.sourceTileset = new _tiles.Tileset3D(sourceTilesetJson, {});
77
-
78
- if (!this.sourceTileset.root.header.obb) {
79
- this.sourceTileset.root.header.obb = (0, _coordinateConverter.createObbFromMbs)(this.sourceTileset.root.header.mbs);
80
- }
81
-
82
- this.tilesetPath = (0, _path.join)("".concat(outputPath), "".concat(tilesetName));
83
- this.attributeStorageInfo = sourceTilesetJson.attributeStorageInfo;
84
-
85
- try {
86
- await (0, _fileUtils.removeDir)(this.tilesetPath);
87
- } catch (e) {}
88
-
89
- const rootTile = {
90
- boundingVolume: {
91
- box: (0, _i3sObbTo3dTilesObb.i3sObbTo3dTilesObb)(this.sourceTileset.root.header.obb, this.geoidHeightModel)
92
- },
93
- geometricError: (0, _lodConversionUtils.convertScreenThresholdToGeometricError)(this.sourceTileset.root),
94
- children: []
95
- };
96
- await this._addChildren(this.sourceTileset.root, rootTile, 1);
97
- const tileset = (0, _jsonMapTransform.default)({
98
- root: rootTile
99
- }, _tileset.TILESET);
100
- await (0, _fileUtils.writeFile)(this.tilesetPath, JSON.stringify(tileset), 'tileset.json');
101
-
102
- this._finishConversion({
103
- slpk: false,
104
- outputPath,
105
- tilesetName
106
- });
107
- }
108
-
109
- async _addChildren(parentSourceNode, parentNode, level) {
110
- if (this.options.maxDepth && level > this.options.maxDepth) {
111
- return;
112
- }
113
-
114
- for (const childNodeInfo of parentSourceNode.header.children || []) {
115
- const sourceChild = await this._loadChildNode(parentSourceNode, childNodeInfo);
116
- parentSourceNode.children.push(sourceChild);
117
-
118
- if (sourceChild.contentUrl) {
119
- await this.sourceTileset._loadTile(sourceChild);
120
- this.vertexCounter += sourceChild.content.vertexCount;
121
- let attributes = null;
122
-
123
- if (this.attributeStorageInfo) {
124
- attributes = await this._loadChildAttributes(sourceChild, this.attributeStorageInfo);
125
- }
126
-
127
- if (!sourceChild.header.obb) {
128
- sourceChild.header.obb = (0, _coordinateConverter.createObbFromMbs)(sourceChild.header.mbs);
129
- }
130
-
131
- const boundingVolume = {
132
- box: (0, _i3sObbTo3dTilesObb.i3sObbTo3dTilesObb)(sourceChild.header.obb, this.geoidHeightModel)
133
- };
134
- const child = {
135
- boundingVolume,
136
- geometricError: (0, _lodConversionUtils.convertScreenThresholdToGeometricError)(sourceChild),
137
- children: []
138
- };
139
- const b3dm = await new _b3dmConverter.default().convert(sourceChild, attributes);
140
- child.content = {
141
- uri: "".concat(sourceChild.id, ".b3dm"),
142
- boundingVolume
143
- };
144
- await (0, _fileUtils.writeFile)(this.tilesetPath, new Uint8Array(b3dm), "".concat(sourceChild.id, ".b3dm"));
145
- parentNode.children.push(child);
146
- sourceChild.unloadContent();
147
- await this._addChildren(sourceChild, child, level + 1);
148
- } else {
149
- await this._addChildren(sourceChild, parentNode, level + 1);
81
+ (0, _createClass2.default)(Tiles3DConverter, [{
82
+ key: "convert",
83
+ value: function () {
84
+ var _convert = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(options) {
85
+ var inputUrl, outputPath, tilesetName, maxDepth, egmFilePath, sourceTilesetJson, rootTile, tileset;
86
+ return _regenerator.default.wrap(function _callee$(_context) {
87
+ while (1) {
88
+ switch (_context.prev = _context.next) {
89
+ case 0:
90
+ inputUrl = options.inputUrl, outputPath = options.outputPath, tilesetName = options.tilesetName, maxDepth = options.maxDepth, egmFilePath = options.egmFilePath;
91
+ this.conversionStartTime = _process.default.hrtime();
92
+ this.options = {
93
+ maxDepth: maxDepth
94
+ };
95
+ console.log('Loading egm file...');
96
+ _context.next = 6;
97
+ return (0, _core.load)(egmFilePath, _pgmLoader.PGMLoader);
98
+
99
+ case 6:
100
+ this.geoidHeightModel = _context.sent;
101
+ console.log('Loading egm file completed!');
102
+ _context.next = 10;
103
+ return (0, _core.load)(inputUrl, _i3s.I3SLoader, {});
104
+
105
+ case 10:
106
+ sourceTilesetJson = _context.sent;
107
+ this.sourceTileset = new _tiles.Tileset3D(sourceTilesetJson, {});
108
+
109
+ if (!this.sourceTileset.root.header.obb) {
110
+ this.sourceTileset.root.header.obb = (0, _coordinateConverter.createObbFromMbs)(this.sourceTileset.root.header.mbs);
111
+ }
112
+
113
+ this.tilesetPath = (0, _path.join)("".concat(outputPath), "".concat(tilesetName));
114
+ this.attributeStorageInfo = sourceTilesetJson.attributeStorageInfo;
115
+ _context.prev = 15;
116
+ _context.next = 18;
117
+ return (0, _fileUtils.removeDir)(this.tilesetPath);
118
+
119
+ case 18:
120
+ _context.next = 22;
121
+ break;
122
+
123
+ case 20:
124
+ _context.prev = 20;
125
+ _context.t0 = _context["catch"](15);
126
+
127
+ case 22:
128
+ rootTile = {
129
+ boundingVolume: {
130
+ box: (0, _i3sObbTo3dTilesObb.i3sObbTo3dTilesObb)(this.sourceTileset.root.header.obb, this.geoidHeightModel)
131
+ },
132
+ geometricError: (0, _lodConversionUtils.convertScreenThresholdToGeometricError)(this.sourceTileset.root),
133
+ children: []
134
+ };
135
+ _context.next = 25;
136
+ return this._addChildren(this.sourceTileset.root, rootTile, 1);
137
+
138
+ case 25:
139
+ tileset = (0, _jsonMapTransform.default)({
140
+ root: rootTile
141
+ }, _tileset.TILESET);
142
+ _context.next = 28;
143
+ return (0, _fileUtils.writeFile)(this.tilesetPath, JSON.stringify(tileset), 'tileset.json');
144
+
145
+ case 28:
146
+ this._finishConversion({
147
+ slpk: false,
148
+ outputPath: outputPath,
149
+ tilesetName: tilesetName
150
+ });
151
+
152
+ case 29:
153
+ case "end":
154
+ return _context.stop();
155
+ }
156
+ }
157
+ }, _callee, this, [[15, 20]]);
158
+ }));
159
+
160
+ function convert(_x) {
161
+ return _convert.apply(this, arguments);
150
162
  }
151
- }
152
- }
153
-
154
- async _loadChildNode(parentNode, childNodeInfo) {
155
- let header;
156
163
 
157
- if (this.sourceTileset.tileset.nodePages) {
158
- console.log("Node conversion: ".concat(childNodeInfo.id));
159
- header = await this.sourceTileset.tileset.nodePagesTile.formTileFromNodePages(childNodeInfo.id);
160
- } else {
161
- const {
162
- loader
163
- } = this.sourceTileset;
164
+ return convert;
165
+ }()
166
+ }, {
167
+ key: "_addChildren",
168
+ value: function () {
169
+ var _addChildren2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(parentSourceNode, parentNode, level) {
170
+ var _iterator, _step, childNodeInfo, sourceChild, attributes, boundingVolume, child, b3dm;
171
+
172
+ return _regenerator.default.wrap(function _callee2$(_context2) {
173
+ while (1) {
174
+ switch (_context2.prev = _context2.next) {
175
+ case 0:
176
+ if (!(this.options.maxDepth && level > this.options.maxDepth)) {
177
+ _context2.next = 2;
178
+ break;
179
+ }
180
+
181
+ return _context2.abrupt("return");
182
+
183
+ case 2:
184
+ _iterator = _createForOfIteratorHelper(parentSourceNode.header.children || []);
185
+ _context2.prev = 3;
186
+
187
+ _iterator.s();
188
+
189
+ case 5:
190
+ if ((_step = _iterator.n()).done) {
191
+ _context2.next = 39;
192
+ break;
193
+ }
194
+
195
+ childNodeInfo = _step.value;
196
+ _context2.next = 9;
197
+ return this._loadChildNode(parentSourceNode, childNodeInfo);
198
+
199
+ case 9:
200
+ sourceChild = _context2.sent;
201
+ parentSourceNode.children.push(sourceChild);
202
+
203
+ if (!sourceChild.contentUrl) {
204
+ _context2.next = 35;
205
+ break;
206
+ }
207
+
208
+ _context2.next = 14;
209
+ return this.sourceTileset._loadTile(sourceChild);
210
+
211
+ case 14:
212
+ this.vertexCounter += sourceChild.content.vertexCount;
213
+ attributes = null;
214
+
215
+ if (!this.attributeStorageInfo) {
216
+ _context2.next = 20;
217
+ break;
218
+ }
219
+
220
+ _context2.next = 19;
221
+ return this._loadChildAttributes(sourceChild, this.attributeStorageInfo);
222
+
223
+ case 19:
224
+ attributes = _context2.sent;
225
+
226
+ case 20:
227
+ if (!sourceChild.header.obb) {
228
+ sourceChild.header.obb = (0, _coordinateConverter.createObbFromMbs)(sourceChild.header.mbs);
229
+ }
230
+
231
+ boundingVolume = {
232
+ box: (0, _i3sObbTo3dTilesObb.i3sObbTo3dTilesObb)(sourceChild.header.obb, this.geoidHeightModel)
233
+ };
234
+ child = {
235
+ boundingVolume: boundingVolume,
236
+ geometricError: (0, _lodConversionUtils.convertScreenThresholdToGeometricError)(sourceChild),
237
+ children: []
238
+ };
239
+ _context2.next = 25;
240
+ return new _b3dmConverter.default().convert(sourceChild, attributes);
241
+
242
+ case 25:
243
+ b3dm = _context2.sent;
244
+ child.content = {
245
+ uri: "".concat(sourceChild.id, ".b3dm"),
246
+ boundingVolume: boundingVolume
247
+ };
248
+ _context2.next = 29;
249
+ return (0, _fileUtils.writeFile)(this.tilesetPath, new Uint8Array(b3dm), "".concat(sourceChild.id, ".b3dm"));
250
+
251
+ case 29:
252
+ parentNode.children.push(child);
253
+ sourceChild.unloadContent();
254
+ _context2.next = 33;
255
+ return this._addChildren(sourceChild, child, level + 1);
256
+
257
+ case 33:
258
+ _context2.next = 37;
259
+ break;
260
+
261
+ case 35:
262
+ _context2.next = 37;
263
+ return this._addChildren(sourceChild, parentNode, level + 1);
264
+
265
+ case 37:
266
+ _context2.next = 5;
267
+ break;
268
+
269
+ case 39:
270
+ _context2.next = 44;
271
+ break;
272
+
273
+ case 41:
274
+ _context2.prev = 41;
275
+ _context2.t0 = _context2["catch"](3);
276
+
277
+ _iterator.e(_context2.t0);
278
+
279
+ case 44:
280
+ _context2.prev = 44;
281
+
282
+ _iterator.f();
283
+
284
+ return _context2.finish(44);
285
+
286
+ case 47:
287
+ case "end":
288
+ return _context2.stop();
289
+ }
290
+ }
291
+ }, _callee2, this, [[3, 41, 44, 47]]);
292
+ }));
293
+
294
+ function _addChildren(_x2, _x3, _x4) {
295
+ return _addChildren2.apply(this, arguments);
296
+ }
164
297
 
165
- const nodeUrl = this._relativeUrlToFullUrl(parentNode.url, childNodeInfo.href);
298
+ return _addChildren;
299
+ }()
300
+ }, {
301
+ key: "_loadChildNode",
302
+ value: function () {
303
+ var _loadChildNode2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee3(parentNode, childNodeInfo) {
304
+ var header, loader, nodeUrl, options;
305
+ return _regenerator.default.wrap(function _callee3$(_context3) {
306
+ while (1) {
307
+ switch (_context3.prev = _context3.next) {
308
+ case 0:
309
+ if (!this.sourceTileset.tileset.nodePages) {
310
+ _context3.next = 7;
311
+ break;
312
+ }
313
+
314
+ console.log("Node conversion: ".concat(childNodeInfo.id));
315
+ _context3.next = 4;
316
+ return this.sourceTileset.tileset.nodePagesTile.formTileFromNodePages(childNodeInfo.id);
317
+
318
+ case 4:
319
+ header = _context3.sent;
320
+ _context3.next = 14;
321
+ break;
322
+
323
+ case 7:
324
+ loader = this.sourceTileset.loader;
325
+ nodeUrl = this._relativeUrlToFullUrl(parentNode.url, childNodeInfo.href);
326
+ options = {
327
+ i3s: _objectSpread(_objectSpread({}, this.sourceTileset.loadOptions), {}, {
328
+ isTileHeader: true,
329
+ loadContent: false
330
+ })
331
+ };
332
+ console.log("Node conversion: ".concat(nodeUrl));
333
+ _context3.next = 13;
334
+ return (0, _core.load)(nodeUrl, loader, options);
335
+
336
+ case 13:
337
+ header = _context3.sent;
338
+
339
+ case 14:
340
+ return _context3.abrupt("return", new _tiles.Tile3D(this.sourceTileset, header, parentNode));
341
+
342
+ case 15:
343
+ case "end":
344
+ return _context3.stop();
345
+ }
346
+ }
347
+ }, _callee3, this);
348
+ }));
349
+
350
+ function _loadChildNode(_x5, _x6) {
351
+ return _loadChildNode2.apply(this, arguments);
352
+ }
166
353
 
167
- const options = {
168
- i3s: { ...this.sourceTileset.loadOptions,
169
- isTileHeader: true,
170
- loadContent: false
171
- }
172
- };
173
- console.log("Node conversion: ".concat(nodeUrl));
174
- header = await (0, _core.load)(nodeUrl, loader, options);
175
- }
354
+ return _loadChildNode;
355
+ }()
356
+ }, {
357
+ key: "_relativeUrlToFullUrl",
358
+ value: function _relativeUrlToFullUrl(baseUrl, relativeUrl) {
359
+ var resultArray = baseUrl.split('/');
360
+ var relativeUrlArray = relativeUrl.split('/');
176
361
 
177
- return new _tiles.Tile3D(this.sourceTileset, header, parentNode);
178
- }
362
+ var _iterator2 = _createForOfIteratorHelper(relativeUrlArray),
363
+ _step2;
179
364
 
180
- _relativeUrlToFullUrl(baseUrl, relativeUrl) {
181
- let resultArray = baseUrl.split('/');
182
- const relativeUrlArray = relativeUrl.split('/');
365
+ try {
366
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
367
+ var folder = _step2.value;
183
368
 
184
- for (const folder of relativeUrlArray) {
185
- switch (folder) {
186
- case '.':
187
- continue;
369
+ switch (folder) {
370
+ case '.':
371
+ continue;
188
372
 
189
- case '..':
190
- resultArray = resultArray.slice(0, -1);
191
- break;
373
+ case '..':
374
+ resultArray = resultArray.slice(0, -1);
375
+ break;
192
376
 
193
- default:
194
- resultArray.push(folder);
377
+ default:
378
+ resultArray.push(folder);
379
+ }
380
+ }
381
+ } catch (err) {
382
+ _iterator2.e(err);
383
+ } finally {
384
+ _iterator2.f();
195
385
  }
196
- }
197
386
 
198
- return resultArray.join('/');
199
- }
200
-
201
- async _loadChildAttributes(sourceChild, attributeStorageInfo) {
202
- const promises = [];
203
- const {
204
- attributeUrls
205
- } = sourceChild.header;
206
-
207
- for (let index = 0; index < attributeUrls.length; index++) {
208
- const inputUrl = attributeUrls[index];
209
- const attribute = attributeStorageInfo[index];
210
- const options = {
211
- attributeName: attribute.name,
212
- attributeType: this._getAttributeType(attribute)
213
- };
214
- promises.push((0, _core.load)(inputUrl, _i3s.I3SAttributeLoader, options));
387
+ return resultArray.join('/');
215
388
  }
389
+ }, {
390
+ key: "_loadChildAttributes",
391
+ value: function () {
392
+ var _loadChildAttributes2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee4(sourceChild, attributeStorageInfo) {
393
+ var promises, attributeUrls, index, inputUrl, attribute, options, attributesList;
394
+ return _regenerator.default.wrap(function _callee4$(_context4) {
395
+ while (1) {
396
+ switch (_context4.prev = _context4.next) {
397
+ case 0:
398
+ promises = [];
399
+ attributeUrls = sourceChild.header.attributeUrls;
400
+
401
+ for (index = 0; index < attributeUrls.length; index++) {
402
+ inputUrl = attributeUrls[index];
403
+ attribute = attributeStorageInfo[index];
404
+ options = {
405
+ attributeName: attribute.name,
406
+ attributeType: this._getAttributeType(attribute)
407
+ };
408
+ promises.push((0, _core.load)(inputUrl, _i3s.I3SAttributeLoader, options));
409
+ }
410
+
411
+ _context4.next = 5;
412
+ return Promise.all(promises);
413
+
414
+ case 5:
415
+ attributesList = _context4.sent;
416
+
417
+ this._replaceNestedArrays(attributesList);
418
+
419
+ return _context4.abrupt("return", Object.assign.apply(Object, [{}].concat((0, _toConsumableArray2.default)(attributesList))));
420
+
421
+ case 8:
422
+ case "end":
423
+ return _context4.stop();
424
+ }
425
+ }
426
+ }, _callee4, this);
427
+ }));
428
+
429
+ function _loadChildAttributes(_x7, _x8) {
430
+ return _loadChildAttributes2.apply(this, arguments);
431
+ }
216
432
 
217
- const attributesList = await Promise.all(promises);
218
-
219
- this._replaceNestedArrays(attributesList);
220
-
221
- return Object.assign({}, ...attributesList);
222
- }
433
+ return _loadChildAttributes;
434
+ }()
435
+ }, {
436
+ key: "_getAttributeType",
437
+ value: function _getAttributeType(attribute) {
438
+ if (attribute.attributeValues) {
439
+ return attribute.attributeValues.valueType;
440
+ } else if (attribute.objectIds) {
441
+ return 'Oid32';
442
+ }
223
443
 
224
- _getAttributeType(attribute) {
225
- if (attribute.attributeValues) {
226
- return attribute.attributeValues.valueType;
227
- } else if (attribute.objectIds) {
228
- return 'Oid32';
444
+ return '';
229
445
  }
230
-
231
- return '';
232
- }
233
-
234
- _replaceNestedArrays(attributesList) {
235
- for (let index = 0; index < attributesList.length; index++) {
236
- const attributeObject = attributesList[index];
237
-
238
- for (const key in attributeObject) {
239
- attributeObject[key] = Array.from(attributeObject[key]);
446
+ }, {
447
+ key: "_replaceNestedArrays",
448
+ value: function _replaceNestedArrays(attributesList) {
449
+ for (var index = 0; index < attributesList.length; index++) {
450
+ var attributeObject = attributesList[index];
451
+
452
+ for (var key in attributeObject) {
453
+ attributeObject[key] = Array.from(attributeObject[key]);
454
+ }
240
455
  }
241
456
  }
242
- }
243
-
244
- async _finishConversion(params) {
245
- const filesSize = await (0, _statisticUtills.calculateFilesSize)(params);
246
-
247
- const diff = _process.default.hrtime(this.conversionStartTime);
248
-
249
- const conversionTime = (0, _statisticUtills.timeConverter)(diff);
250
- console.log("------------------------------------------------");
251
- console.log("Finish conversion of ".concat(I3S));
252
- console.log("Total conversion time: ".concat(conversionTime));
253
- console.log("Vertex count: ", this.vertexCounter);
254
- console.log("File(s) size: ", filesSize, ' bytes');
255
- console.log("------------------------------------------------");
256
- }
457
+ }, {
458
+ key: "_finishConversion",
459
+ value: function () {
460
+ var _finishConversion2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee5(params) {
461
+ var filesSize, diff, conversionTime;
462
+ return _regenerator.default.wrap(function _callee5$(_context5) {
463
+ while (1) {
464
+ switch (_context5.prev = _context5.next) {
465
+ case 0:
466
+ _context5.next = 2;
467
+ return (0, _statisticUtills.calculateFilesSize)(params);
468
+
469
+ case 2:
470
+ filesSize = _context5.sent;
471
+ diff = _process.default.hrtime(this.conversionStartTime);
472
+ conversionTime = (0, _statisticUtills.timeConverter)(diff);
473
+ console.log("------------------------------------------------");
474
+ console.log("Finish conversion of ".concat(I3S));
475
+ console.log("Total conversion time: ".concat(conversionTime));
476
+ console.log("Vertex count: ", this.vertexCounter);
477
+ console.log("File(s) size: ", filesSize, ' bytes');
478
+ console.log("------------------------------------------------");
479
+
480
+ case 11:
481
+ case "end":
482
+ return _context5.stop();
483
+ }
484
+ }
485
+ }, _callee5, this);
486
+ }));
487
+
488
+ function _finishConversion(_x9) {
489
+ return _finishConversion2.apply(this, arguments);
490
+ }
257
491
 
258
- }
492
+ return _finishConversion;
493
+ }()
494
+ }]);
495
+ return Tiles3DConverter;
496
+ }();
259
497
 
260
498
  exports.default = Tiles3DConverter;
261
499
  //# sourceMappingURL=3d-tiles-converter.js.map