@loaders.gl/tile-converter 3.2.7 → 3.3.0-alpha.3

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 (77) hide show
  1. package/dist/3d-tiles-attributes-worker.js +3 -3
  2. package/dist/3d-tiles-attributes-worker.js.map +1 -1
  3. package/dist/converter-cli.js +30 -7
  4. package/dist/converter.min.js +1 -1
  5. package/dist/dist.min.js +1105 -621
  6. package/dist/es5/3d-tiles-attributes-worker.js +1 -1
  7. package/dist/es5/3d-tiles-attributes-worker.js.map +1 -1
  8. package/dist/es5/converter-cli.js +42 -12
  9. package/dist/es5/converter-cli.js.map +1 -1
  10. package/dist/es5/i3s-attributes-worker.js +1 -1
  11. package/dist/es5/i3s-attributes-worker.js.map +1 -1
  12. package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js +146 -0
  13. package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -0
  14. package/dist/es5/i3s-converter/helpers/feature-attributes.js +60 -0
  15. package/dist/es5/i3s-converter/helpers/feature-attributes.js.map +1 -0
  16. package/dist/es5/i3s-converter/helpers/geometry-attributes.js +39 -7
  17. package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +1 -1
  18. package/dist/es5/i3s-converter/helpers/geometry-converter.js +177 -59
  19. package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
  20. package/dist/es5/i3s-converter/helpers/gltf-attributes.js +15 -1
  21. package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -1
  22. package/dist/es5/i3s-converter/i3s-converter.js +50 -51
  23. package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
  24. package/dist/es5/lib/utils/write-queue.js +3 -5
  25. package/dist/es5/lib/utils/write-queue.js.map +1 -1
  26. package/dist/es5/pgm-loader.js +1 -1
  27. package/dist/es5/pgm-loader.js.map +1 -1
  28. package/dist/esm/3d-tiles-attributes-worker.js +1 -1
  29. package/dist/esm/3d-tiles-attributes-worker.js.map +1 -1
  30. package/dist/esm/converter-cli.js +37 -7
  31. package/dist/esm/converter-cli.js.map +1 -1
  32. package/dist/esm/i3s-attributes-worker.js +1 -1
  33. package/dist/esm/i3s-attributes-worker.js.map +1 -1
  34. package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js +128 -0
  35. package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -0
  36. package/dist/esm/i3s-converter/helpers/feature-attributes.js +34 -0
  37. package/dist/esm/i3s-converter/helpers/feature-attributes.js.map +1 -0
  38. package/dist/esm/i3s-converter/helpers/geometry-attributes.js +23 -7
  39. package/dist/esm/i3s-converter/helpers/geometry-attributes.js.map +1 -1
  40. package/dist/esm/i3s-converter/helpers/geometry-converter.js +145 -38
  41. package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
  42. package/dist/esm/i3s-converter/helpers/gltf-attributes.js +15 -1
  43. package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -1
  44. package/dist/esm/i3s-converter/i3s-converter.js +21 -27
  45. package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
  46. package/dist/esm/lib/utils/write-queue.js +3 -5
  47. package/dist/esm/lib/utils/write-queue.js.map +1 -1
  48. package/dist/esm/pgm-loader.js +1 -1
  49. package/dist/esm/pgm-loader.js.map +1 -1
  50. package/dist/i3s-attributes-worker.js +3 -3
  51. package/dist/i3s-attributes-worker.js.map +3 -3
  52. package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +12 -0
  53. package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -0
  54. package/dist/i3s-converter/helpers/batch-ids-extensions.js +138 -0
  55. package/dist/i3s-converter/helpers/feature-attributes.d.ts +24 -0
  56. package/dist/i3s-converter/helpers/feature-attributes.d.ts.map +1 -0
  57. package/dist/i3s-converter/helpers/feature-attributes.js +55 -0
  58. package/dist/i3s-converter/helpers/geometry-attributes.js +26 -7
  59. package/dist/i3s-converter/helpers/geometry-converter.d.ts +9 -2
  60. package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
  61. package/dist/i3s-converter/helpers/geometry-converter.js +140 -44
  62. package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
  63. package/dist/i3s-converter/helpers/gltf-attributes.js +13 -0
  64. package/dist/i3s-converter/i3s-converter.d.ts +7 -14
  65. package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
  66. package/dist/i3s-converter/i3s-converter.js +44 -35
  67. package/dist/lib/utils/write-queue.d.ts.map +1 -1
  68. package/dist/lib/utils/write-queue.js +3 -4
  69. package/package.json +15 -15
  70. package/src/converter-cli.ts +33 -7
  71. package/src/i3s-converter/helpers/batch-ids-extensions.ts +199 -0
  72. package/src/i3s-converter/helpers/feature-attributes.ts +65 -0
  73. package/src/i3s-converter/helpers/geometry-attributes.ts +30 -7
  74. package/src/i3s-converter/helpers/geometry-converter.ts +187 -48
  75. package/src/i3s-converter/helpers/gltf-attributes.ts +15 -0
  76. package/src/i3s-converter/i3s-converter.ts +38 -41
  77. package/src/lib/utils/write-queue.ts +7 -5
@@ -2,6 +2,8 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
 
5
+ var _typeof3 = require("@babel/runtime/helpers/typeof");
6
+
5
7
  Object.defineProperty(exports, "__esModule", {
6
8
  value: true
7
9
  });
@@ -47,7 +49,7 @@ var _compressUtil = require("../lib/utils/compress-util");
47
49
 
48
50
  var _statisticUtills = require("../lib/utils/statistic-utills");
49
51
 
50
- var _geometryConverter = _interopRequireDefault(require("./helpers/geometry-converter"));
52
+ var _geometryConverter = _interopRequireWildcard(require("./helpers/geometry-converter"));
51
53
 
52
54
  var _coordinateConverter = require("./helpers/coordinate-converter");
53
55
 
@@ -81,6 +83,10 @@ var _constants = require("../constants");
81
83
 
82
84
  var _process$env;
83
85
 
86
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
87
+
88
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
89
+
84
90
  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; } } }; }
85
91
 
86
92
  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); }
@@ -896,9 +902,9 @@ var I3SConverter = function () {
896
902
  key: "_createNode",
897
903
  value: function () {
898
904
  var _createNode2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee10(parentTile, sourceTile, parentId, level) {
899
- var _sourceTile$content;
905
+ var _this$layers, _this$layers$attribut;
900
906
 
901
- var boundingVolumes, batchTable, resourcesData, nodes, nodesInPage, emptyResources, _iterator5, _step5, resources, lodSelection, maxScreenThresholdSQ, nodeInPage, node, _console;
907
+ var boundingVolumes, propertyTable, resourcesData, nodes, nodesInPage, emptyResources, _iterator5, _step5, resources, lodSelection, maxScreenThresholdSQ, nodeInPage, node, _console;
902
908
 
903
909
  return _regenerator.default.wrap(function _callee10$(_context10) {
904
910
  while (1) {
@@ -917,14 +923,14 @@ var I3SConverter = function () {
917
923
 
918
924
  case 5:
919
925
  boundingVolumes = (0, _coordinateConverter.createBoundingVolumes)(sourceTile, this.geoidHeightModel);
920
- batchTable = sourceTile === null || sourceTile === void 0 ? void 0 : (_sourceTile$content = sourceTile.content) === null || _sourceTile$content === void 0 ? void 0 : _sourceTile$content.batchTableJson;
926
+ propertyTable = (0, _geometryConverter.getPropertyTable)(sourceTile);
921
927
 
922
- if (batchTable) {
923
- this._convertAttributeStorageInfo(sourceTile.content);
928
+ if (propertyTable && !((_this$layers = this.layers0) !== null && _this$layers !== void 0 && (_this$layers$attribut = _this$layers.attributeStorageInfo) !== null && _this$layers$attribut !== void 0 && _this$layers$attribut.length)) {
929
+ this._convertPropertyTableToNodeAttributes(propertyTable);
924
930
  }
925
931
 
926
932
  _context10.next = 10;
927
- return this._convertResources(sourceTile);
933
+ return this._convertResources(sourceTile, propertyTable);
928
934
 
929
935
  case 10:
930
936
  resourcesData = _context10.sent;
@@ -1036,21 +1042,10 @@ var I3SConverter = function () {
1036
1042
 
1037
1043
  return _createNode;
1038
1044
  }()
1039
- }, {
1040
- key: "_convertAttributeStorageInfo",
1041
- value: function _convertAttributeStorageInfo(sourceTileContent) {
1042
- var _this$layers, _this$layers$attribut;
1043
-
1044
- var batchTable = sourceTileContent && sourceTileContent.batchTableJson;
1045
-
1046
- if (batchTable && !((_this$layers = this.layers0) !== null && _this$layers !== void 0 && (_this$layers$attribut = _this$layers.attributeStorageInfo) !== null && _this$layers$attribut !== void 0 && _this$layers$attribut.length)) {
1047
- this._convertBatchTableInfoToNodeAttributes(batchTable);
1048
- }
1049
- }
1050
1045
  }, {
1051
1046
  key: "_convertResources",
1052
1047
  value: function () {
1053
- var _convertResources2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee11(sourceTile) {
1048
+ var _convertResources2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee11(sourceTile, propertyTable) {
1054
1049
  var _this$layers2;
1055
1050
 
1056
1051
  var resourcesData;
@@ -1067,7 +1062,7 @@ var I3SConverter = function () {
1067
1062
 
1068
1063
  case 2:
1069
1064
  _context11.next = 4;
1070
- return (0, _geometryConverter.default)(sourceTile.content, Number(this.nodePages.nodesCounter), this.featuresHashArray, (_this$layers2 = this.layers0) === null || _this$layers2 === void 0 ? void 0 : _this$layers2.attributeStorageInfo, this.options.draco, this.generateBoundingVolumes, this.geoidHeightModel, this.workerSource);
1065
+ return (0, _geometryConverter.default)(sourceTile.content, Number(this.nodePages.nodesCounter), propertyTable, this.featuresHashArray, (_this$layers2 = this.layers0) === null || _this$layers2 === void 0 ? void 0 : _this$layers2.attributeStorageInfo, this.options.draco, this.generateBoundingVolumes, this.geoidHeightModel, this.workerSource);
1071
1066
 
1072
1067
  case 4:
1073
1068
  resourcesData = _context11.sent;
@@ -1081,7 +1076,7 @@ var I3SConverter = function () {
1081
1076
  }, _callee11, this);
1082
1077
  }));
1083
1078
 
1084
- function _convertResources(_x20) {
1079
+ function _convertResources(_x20, _x21) {
1085
1080
  return _convertResources2.apply(this, arguments);
1086
1081
  }
1087
1082
 
@@ -1234,7 +1229,7 @@ var I3SConverter = function () {
1234
1229
  }, _callee12, this);
1235
1230
  }));
1236
1231
 
1237
- function _writeResources(_x21, _x22) {
1232
+ function _writeResources(_x22, _x23) {
1238
1233
  return _writeResources2.apply(this, arguments);
1239
1234
  }
1240
1235
 
@@ -1309,7 +1304,7 @@ var I3SConverter = function () {
1309
1304
  }, _callee13, this);
1310
1305
  }));
1311
1306
 
1312
- function _writeGeometries(_x23, _x24, _x25, _x26) {
1307
+ function _writeGeometries(_x24, _x25, _x26, _x27) {
1313
1308
  return _writeGeometries2.apply(this, arguments);
1314
1309
  }
1315
1310
 
@@ -1367,7 +1362,7 @@ var I3SConverter = function () {
1367
1362
  }, _callee14, this);
1368
1363
  }));
1369
1364
 
1370
- function _writeShared(_x27, _x28, _x29, _x30) {
1365
+ function _writeShared(_x28, _x29, _x30, _x31) {
1371
1366
  return _writeShared2.apply(this, arguments);
1372
1367
  }
1373
1368
 
@@ -1377,13 +1372,13 @@ var I3SConverter = function () {
1377
1372
  key: "_writeTexture",
1378
1373
  value: function () {
1379
1374
  var _writeTexture2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee15(texture, childPath, slpkChildPath) {
1380
- var format, formats, textureData, ktx2TextureData, decodedFromKTX2TextureData;
1375
+ var format, formats, textureData, copyArrayBuffer, arrayToEncode, ktx2TextureData, decodedFromKTX2TextureData;
1381
1376
  return _regenerator.default.wrap(function _callee15$(_context15) {
1382
1377
  while (1) {
1383
1378
  switch (_context15.prev = _context15.next) {
1384
1379
  case 0:
1385
1380
  if (!texture) {
1386
- _context15.next = 25;
1381
+ _context15.next = 27;
1387
1382
  break;
1388
1383
  }
1389
1384
 
@@ -1391,7 +1386,7 @@ var I3SConverter = function () {
1391
1386
  formats = [];
1392
1387
  textureData = texture.bufferView.data;
1393
1388
  _context15.t0 = format;
1394
- _context15.next = _context15.t0 === 'jpg' ? 7 : _context15.t0 === 'png' ? 7 : _context15.t0 === 'ktx2' ? 16 : 24;
1389
+ _context15.next = _context15.t0 === 'jpg' ? 7 : _context15.t0 === 'png' ? 7 : _context15.t0 === 'ktx2' ? 18 : 26;
1395
1390
  break;
1396
1391
 
1397
1392
  case 7:
@@ -1404,7 +1399,7 @@ var I3SConverter = function () {
1404
1399
 
1405
1400
  case 10:
1406
1401
  if (!this.generateTextures) {
1407
- _context15.next = 15;
1402
+ _context15.next = 17;
1408
1403
  break;
1409
1404
  }
1410
1405
 
@@ -1412,28 +1407,32 @@ var I3SConverter = function () {
1412
1407
  name: '1',
1413
1408
  format: 'ktx2'
1414
1409
  });
1415
- ktx2TextureData = (0, _core.encode)(texture.image, _textures.KTX2BasisWriterWorker, _objectSpread(_objectSpread({}, _textures.KTX2BasisWriterWorker.options), {}, {
1410
+ copyArrayBuffer = texture.image.data.subarray();
1411
+ arrayToEncode = new Uint8Array(copyArrayBuffer);
1412
+ ktx2TextureData = (0, _core.encode)(_objectSpread(_objectSpread({}, texture.image), {}, {
1413
+ data: arrayToEncode
1414
+ }), _textures.KTX2BasisWriterWorker, _objectSpread(_objectSpread({}, _textures.KTX2BasisWriterWorker.options), {}, {
1416
1415
  source: this.workerSource.ktx2,
1417
1416
  reuseWorkers: true,
1418
1417
  _nodeWorkers: true
1419
1418
  }));
1420
- _context15.next = 15;
1419
+ _context15.next = 17;
1421
1420
  return this.writeTextureFile(ktx2TextureData, '1', 'ktx2', childPath, slpkChildPath);
1422
1421
 
1423
- case 15:
1424
- return _context15.abrupt("break", 24);
1422
+ case 17:
1423
+ return _context15.abrupt("break", 26);
1425
1424
 
1426
- case 16:
1425
+ case 18:
1427
1426
  formats.push({
1428
1427
  name: '1',
1429
1428
  format: format
1430
1429
  });
1431
- _context15.next = 19;
1430
+ _context15.next = 21;
1432
1431
  return this.writeTextureFile(textureData, '1', format, childPath, slpkChildPath);
1433
1432
 
1434
- case 19:
1433
+ case 21:
1435
1434
  if (!this.generateTextures) {
1436
- _context15.next = 24;
1435
+ _context15.next = 26;
1437
1436
  break;
1438
1437
  }
1439
1438
 
@@ -1442,17 +1441,17 @@ var I3SConverter = function () {
1442
1441
  format: 'jpg'
1443
1442
  });
1444
1443
  decodedFromKTX2TextureData = (0, _core.encode)(texture.image.data[0], _images.ImageWriter);
1445
- _context15.next = 24;
1444
+ _context15.next = 26;
1446
1445
  return this.writeTextureFile(decodedFromKTX2TextureData, '0', 'jpg', childPath, slpkChildPath);
1447
1446
 
1448
- case 24:
1447
+ case 26:
1449
1448
  if (!this.layers0.textureSetDefinitions.length) {
1450
1449
  this.layers0.textureSetDefinitions.push({
1451
1450
  formats: formats
1452
1451
  });
1453
1452
  }
1454
1453
 
1455
- case 25:
1454
+ case 27:
1456
1455
  case "end":
1457
1456
  return _context15.stop();
1458
1457
  }
@@ -1460,7 +1459,7 @@ var I3SConverter = function () {
1460
1459
  }, _callee15, this);
1461
1460
  }));
1462
1461
 
1463
- function _writeTexture(_x31, _x32, _x33) {
1462
+ function _writeTexture(_x32, _x33, _x34) {
1464
1463
  return _writeTexture2.apply(this, arguments);
1465
1464
  }
1466
1465
 
@@ -1507,7 +1506,7 @@ var I3SConverter = function () {
1507
1506
  }, _callee16, this);
1508
1507
  }));
1509
1508
 
1510
- function writeTextureFile(_x34, _x35, _x36, _x37, _x38) {
1509
+ function writeTextureFile(_x35, _x36, _x37, _x38, _x39) {
1511
1510
  return _writeTextureFile.apply(this, arguments);
1512
1511
  }
1513
1512
 
@@ -1726,16 +1725,16 @@ var I3SConverter = function () {
1726
1725
  };
1727
1726
  }
1728
1727
  }, {
1729
- key: "_convertBatchTableInfoToNodeAttributes",
1730
- value: function _convertBatchTableInfoToNodeAttributes(batchTable) {
1728
+ key: "_convertPropertyTableToNodeAttributes",
1729
+ value: function _convertPropertyTableToNodeAttributes(propertyTable) {
1731
1730
  var attributeIndex = 0;
1732
1731
 
1733
- var batchTableWithObjectId = _objectSpread({
1732
+ var propertyTableWithObjectId = _objectSpread({
1734
1733
  OBJECTID: [0]
1735
- }, batchTable);
1734
+ }, propertyTable);
1736
1735
 
1737
- for (var _key in batchTableWithObjectId) {
1738
- var firstAttribute = batchTableWithObjectId[_key][0];
1736
+ for (var _key in propertyTableWithObjectId) {
1737
+ var firstAttribute = propertyTableWithObjectId[_key][0];
1739
1738
  var attributeType = this.getAttributeType(_key, firstAttribute);
1740
1739
 
1741
1740
  var storageAttribute = this._createdStorageAttribute(attributeIndex, _key, attributeType);
@@ -1744,7 +1743,7 @@ var I3SConverter = function () {
1744
1743
 
1745
1744
  var fieldAttribute = this._createFieldAttribute(_key, fieldAttributeType);
1746
1745
 
1747
- var popupInfo = this._createPopupInfo(batchTableWithObjectId);
1746
+ var popupInfo = this._createPopupInfo(propertyTableWithObjectId);
1748
1747
 
1749
1748
  this.layers0.attributeStorageInfo.push(storageAttribute);
1750
1749
  this.layers0.fields.push(fieldAttribute);
@@ -1775,14 +1774,14 @@ var I3SConverter = function () {
1775
1774
  }
1776
1775
  }, {
1777
1776
  key: "_createPopupInfo",
1778
- value: function _createPopupInfo(batchTable) {
1777
+ value: function _createPopupInfo(propertyTable) {
1779
1778
  var title = '{OBJECTID}';
1780
1779
  var mediaInfos = [];
1781
1780
  var fieldInfos = [];
1782
1781
  var popupElements = [];
1783
1782
  var expressionInfos = [];
1784
1783
 
1785
- for (var _key2 in batchTable) {
1784
+ for (var _key2 in propertyTable) {
1786
1785
  fieldInfos.push({
1787
1786
  fieldName: _key2,
1788
1787
  visible: true,
@@ -1838,7 +1837,7 @@ var I3SConverter = function () {
1838
1837
  }, _callee18, this);
1839
1838
  }));
1840
1839
 
1841
- function _finishConversion(_x39) {
1840
+ function _finishConversion(_x40) {
1842
1841
  return _finishConversion2.apply(this, arguments);
1843
1842
  }
1844
1843