@loaders.gl/tile-converter 4.0.0-alpha.11 → 4.0.0-alpha.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dist.min.js CHANGED
@@ -57466,16 +57466,6 @@ async function parse3DTilesSubtree(data, options, context) {
57466
57466
  }
57467
57467
  return subtree;
57468
57468
  }
57469
- function resolveBufferUri(bitstreamRelativeUri, basePath) {
57470
- const hasProtocol = basePath.startsWith("http");
57471
- if (hasProtocol) {
57472
- const resolvedUri2 = new URL(bitstreamRelativeUri, basePath);
57473
- return decodeURI(resolvedUri2.toString());
57474
- }
57475
- const basePathWithProtocol = `http://${basePath}`;
57476
- const resolvedUri = new URL(bitstreamRelativeUri, basePathWithProtocol);
57477
- return `/${resolvedUri.host}${resolvedUri.pathname}`;
57478
- }
57479
57469
  async function getExplicitBitstream(subtree, name10, internalBinaryBuffer, context) {
57480
57470
  const bufferViewIndex = subtree[name10].bufferView;
57481
57471
  const bufferView = subtree.bufferViews[bufferViewIndex];
@@ -57487,7 +57477,7 @@ async function getExplicitBitstream(subtree, name10, internalBinaryBuffer, conte
57487
57477
  throw new Error("fetch is not provided");
57488
57478
  }
57489
57479
  if (buffer.uri) {
57490
- const bufferUri = resolveBufferUri(buffer.uri, context?.url);
57480
+ const bufferUri = `${context?.baseUrl || ""}/${buffer.uri}`;
57491
57481
  const response = await context.fetch(bufferUri);
57492
57482
  const data = await response.arrayBuffer();
57493
57483
  return new Uint8Array(data, bufferView.byteOffset, bufferView.byteLength);
@@ -62286,10 +62276,15 @@ var I3SConverter = class {
62286
62276
  if (sourceTile.id) {
62287
62277
  console.log(`[analyze]: ${sourceTile.id}`);
62288
62278
  }
62289
- const tileContent = await loadTile3DContent(this.sourceTileset, sourceTile, {
62290
- ...this.loadOptions,
62291
- "3d-tiles": { ...this.loadOptions["3d-tiles"], loadGLTF: false }
62292
- });
62279
+ let tileContent = null;
62280
+ try {
62281
+ tileContent = await loadTile3DContent(this.sourceTileset, sourceTile, {
62282
+ ...this.loadOptions,
62283
+ "3d-tiles": { ...this.loadOptions["3d-tiles"], loadGLTF: false }
62284
+ });
62285
+ } catch (error) {
62286
+ console.log(`[warning]: Failed to load ${sourceTile.contentUrl}. An I3S tile with empty content will be added to the output tileset`);
62287
+ }
62293
62288
  const tilePreprocessData = await analyzeTileContent(tileContent);
62294
62289
  mergePreprocessData(this.preprocessData, tilePreprocessData);
62295
62290
  return null;
@@ -62425,7 +62420,12 @@ var I3SConverter = class {
62425
62420
  async _createNode(parentNode, sourceTile, transformationMatrix) {
62426
62421
  this._checkAddRefinementTypeForTile(sourceTile);
62427
62422
  await this._updateTilesetOptions();
62428
- const tileContent = await loadTile3DContent(this.sourceTileset, sourceTile, this.loadOptions);
62423
+ let tileContent = null;
62424
+ try {
62425
+ tileContent = await loadTile3DContent(this.sourceTileset, sourceTile, this.loadOptions);
62426
+ } catch (error) {
62427
+ console.log(`[warning]: Failed to load ${sourceTile.contentUrl}`);
62428
+ }
62429
62429
  const sourceBoundingVolume = createBoundingVolume(sourceTile.boundingVolume, transformationMatrix, null);
62430
62430
  let boundingVolumes = createBoundingVolumes(sourceBoundingVolume, this.geoidHeightModel);
62431
62431
  const propertyTable = getPropertyTable(tileContent);
@@ -62514,6 +62514,9 @@ var I3SConverter = class {
62514
62514
  } else {
62515
62515
  node2 = await this.nodePages.getNodeById(nodeId);
62516
62516
  }
62517
+ if (!nodeInPage.mesh) {
62518
+ console.log(`[warning]: node ${node2.index} is created with empty content`);
62519
+ }
62517
62520
  NodePages.updateAll(node2, nodeInPage);
62518
62521
  if (meshMaterial) {
62519
62522
  NodePages.updateMaterialByNodeId(node2, this._findOrCreateMaterial(meshMaterial));
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports._typecheckI3SAttributesWorker = exports.Tile3dAttributesWorker = void 0;
7
7
  exports.transform3DTilesAttributesOnWorker = transform3DTilesAttributesOnWorker;
8
8
  var _workerUtils = require("@loaders.gl/worker-utils");
9
- var VERSION = typeof "4.0.0-alpha.11" !== 'undefined' ? "4.0.0-alpha.11" : 'latest';
9
+ var VERSION = typeof "4.0.0-alpha.12" !== 'undefined' ? "4.0.0-alpha.12" : 'latest';
10
10
  var Tile3dAttributesWorker = {
11
11
  id: '3d-tiles-attributes',
12
12
  name: '3DTiles Attributes Worker',
@@ -14,7 +14,7 @@ var _zip = require("@loaders.gl/zip");
14
14
  var _fileUtils = require("../lib/utils/file-utils");
15
15
  var _path = require("path");
16
16
  var _workerUtils = require("@loaders.gl/worker-utils");
17
- var VERSION = typeof "4.0.0-alpha.11" !== 'undefined' ? "4.0.0-alpha.11" : 'beta';
17
+ var VERSION = typeof "4.0.0-alpha.12" !== 'undefined' ? "4.0.0-alpha.12" : 'beta';
18
18
  var PGM_LINK = 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/egm/egm2008-5.zip';
19
19
  var DepsInstaller = function () {
20
20
  function DepsInstaller() {
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports._typecheckI3SAttributesWorker = exports.I3SAttributesWorker = void 0;
7
7
  exports.transformI3SAttributesOnWorker = transformI3SAttributesOnWorker;
8
8
  var _workerUtils = require("@loaders.gl/worker-utils");
9
- var VERSION = typeof "4.0.0-alpha.11" !== 'undefined' ? "4.0.0-alpha.11" : 'latest';
9
+ var VERSION = typeof "4.0.0-alpha.12" !== 'undefined' ? "4.0.0-alpha.12" : 'latest';
10
10
  var I3SAttributesWorker = {
11
11
  id: 'i3s-attributes',
12
12
  name: 'I3S Attributes Worker',
@@ -287,25 +287,34 @@ var I3SConverter = function () {
287
287
  if (sourceTile.id) {
288
288
  console.log("[analyze]: ".concat(sourceTile.id));
289
289
  }
290
- _context3.next = 7;
290
+ tileContent = null;
291
+ _context3.prev = 6;
292
+ _context3.next = 9;
291
293
  return (0, _load3dTiles.loadTile3DContent)(this.sourceTileset, sourceTile, _objectSpread(_objectSpread({}, this.loadOptions), {}, {
292
294
  '3d-tiles': _objectSpread(_objectSpread({}, this.loadOptions['3d-tiles']), {}, {
293
295
  loadGLTF: false
294
296
  })
295
297
  }));
296
- case 7:
298
+ case 9:
297
299
  tileContent = _context3.sent;
298
- _context3.next = 10;
300
+ _context3.next = 15;
301
+ break;
302
+ case 12:
303
+ _context3.prev = 12;
304
+ _context3.t0 = _context3["catch"](6);
305
+ console.log("[warning]: Failed to load ".concat(sourceTile.contentUrl, ". An I3S tile with empty content will be added to the output tileset"));
306
+ case 15:
307
+ _context3.next = 17;
299
308
  return (0, _preprocess3dTiles.analyzeTileContent)(tileContent);
300
- case 10:
309
+ case 17:
301
310
  tilePreprocessData = _context3.sent;
302
311
  (0, _preprocess3dTiles.mergePreprocessData)(this.preprocessData, tilePreprocessData);
303
312
  return _context3.abrupt("return", null);
304
- case 13:
313
+ case 20:
305
314
  case "end":
306
315
  return _context3.stop();
307
316
  }
308
- }, _callee3, this);
317
+ }, _callee3, this, [[6, 12]]);
309
318
  }));
310
319
  function analyzeTile(_x2, _x3) {
311
320
  return _analyzeTile.apply(this, arguments);
@@ -694,19 +703,28 @@ var I3SConverter = function () {
694
703
  _context9.next = 3;
695
704
  return this._updateTilesetOptions();
696
705
  case 3:
697
- _context9.next = 5;
706
+ tileContent = null;
707
+ _context9.prev = 4;
708
+ _context9.next = 7;
698
709
  return (0, _load3dTiles.loadTile3DContent)(this.sourceTileset, sourceTile, this.loadOptions);
699
- case 5:
710
+ case 7:
700
711
  tileContent = _context9.sent;
712
+ _context9.next = 13;
713
+ break;
714
+ case 10:
715
+ _context9.prev = 10;
716
+ _context9.t0 = _context9["catch"](4);
717
+ console.log("[warning]: Failed to load ".concat(sourceTile.contentUrl));
718
+ case 13:
701
719
  sourceBoundingVolume = (0, _tiles.createBoundingVolume)(sourceTile.boundingVolume, transformationMatrix, null);
702
720
  boundingVolumes = (0, _coordinateConverter.createBoundingVolumes)(sourceBoundingVolume, this.geoidHeightModel);
703
721
  propertyTable = (0, _geometryConverter.getPropertyTable)(tileContent);
704
722
  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)) {
705
723
  this._convertPropertyTableToNodeAttributes(propertyTable);
706
724
  }
707
- _context9.next = 12;
725
+ _context9.next = 19;
708
726
  return this._convertResources(sourceTile, transformationMatrix, sourceBoundingVolume, tileContent, parentNode.inPageId, propertyTable);
709
- case 12:
727
+ case 19:
710
728
  resourcesData = _context9.sent;
711
729
  nodes = [];
712
730
  nodeIds = [];
@@ -724,11 +742,11 @@ var I3SConverter = function () {
724
742
  boundingVolumes: null
725
743
  };
726
744
  _iterator5 = _createForOfIteratorHelper(resourcesData || [emptyResources]);
727
- _context9.prev = 18;
745
+ _context9.prev = 25;
728
746
  _iterator5.s();
729
- case 20:
747
+ case 27:
730
748
  if ((_step5 = _iterator5.n()).done) {
731
- _context9.next = 44;
749
+ _context9.next = 51;
732
750
  break;
733
751
  }
734
752
  resources = _step5.value;
@@ -742,26 +760,26 @@ var I3SConverter = function () {
742
760
  }) || {
743
761
  maxError: 0
744
762
  };
745
- _context9.next = 28;
763
+ _context9.next = 35;
746
764
  return this._updateNodeInNodePages(maxScreenThresholdSQ, boundingVolumes, sourceTile, parentNode.inPageId, resources);
747
- case 28:
765
+ case 35:
748
766
  nodeInPage = _context9.sent;
749
- _context9.next = 31;
767
+ _context9.next = 38;
750
768
  return _nodeIndexDocument.NodeIndexDocument.createNodeIndexDocument(parentNode, boundingVolumes, lodSelection, nodeInPage, resources);
751
- case 31:
769
+ case 38:
752
770
  nodeData = _context9.sent;
753
- _context9.next = 34;
771
+ _context9.next = 41;
754
772
  return new _nodeIndexDocument.NodeIndexDocument(nodeInPage.index, this).addData(nodeData);
755
- case 34:
773
+ case 41:
756
774
  node = _context9.sent;
757
775
  nodes.push(node);
758
776
  if (!nodeInPage.mesh) {
759
- _context9.next = 39;
777
+ _context9.next = 46;
760
778
  break;
761
779
  }
762
- _context9.next = 39;
780
+ _context9.next = 46;
763
781
  return this._writeResources(resources, node.id);
764
- case 39:
782
+ case 46:
765
783
  if (this.validate) {
766
784
  this.boundingVolumeWarnings = (0, _nodeDebug.validateNodeBoundingVolumes)(nodeData);
767
785
  if (this.boundingVolumeWarnings && this.boundingVolumeWarnings.length) {
@@ -770,27 +788,27 @@ var I3SConverter = function () {
770
788
  }
771
789
  nodeIds.push(nodeInPage.index);
772
790
  nodesInPage.push(nodeInPage);
773
- case 42:
774
- _context9.next = 20;
791
+ case 49:
792
+ _context9.next = 27;
775
793
  break;
776
- case 44:
777
- _context9.next = 49;
794
+ case 51:
795
+ _context9.next = 56;
778
796
  break;
779
- case 46:
780
- _context9.prev = 46;
781
- _context9.t0 = _context9["catch"](18);
782
- _iterator5.e(_context9.t0);
783
- case 49:
784
- _context9.prev = 49;
797
+ case 53:
798
+ _context9.prev = 53;
799
+ _context9.t1 = _context9["catch"](25);
800
+ _iterator5.e(_context9.t1);
801
+ case 56:
802
+ _context9.prev = 56;
785
803
  _iterator5.f();
786
- return _context9.finish(49);
787
- case 52:
804
+ return _context9.finish(56);
805
+ case 59:
788
806
  return _context9.abrupt("return", nodes);
789
- case 53:
807
+ case 60:
790
808
  case "end":
791
809
  return _context9.stop();
792
810
  }
793
- }, _callee9, this, [[18, 46, 49, 52]]);
811
+ }, _callee9, this, [[4, 10], [25, 53, 56, 59]]);
794
812
  }));
795
813
  function _createNode(_x11, _x12, _x13) {
796
814
  return _createNode2.apply(this, arguments);
@@ -896,6 +914,9 @@ var I3SConverter = function () {
896
914
  case 12:
897
915
  node = _context12.sent;
898
916
  case 13:
917
+ if (!nodeInPage.mesh) {
918
+ console.log("[warning]: node ".concat(node.index, " is created with empty content"));
919
+ }
899
920
  _nodePages.default.updateAll(node, nodeInPage);
900
921
  if (meshMaterial) {
901
922
  _nodePages.default.updateMaterialByNodeId(node, this._findOrCreateMaterial(meshMaterial));
@@ -914,7 +935,7 @@ var I3SConverter = function () {
914
935
  }
915
936
  this.nodePages.saveNode(node);
916
937
  return _context12.abrupt("return", node);
917
- case 21:
938
+ case 22:
918
939
  case "end":
919
940
  return _context12.stop();
920
941
  }