@loaders.gl/pointclouds 5.0.0-beta.2 → 5.0.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.
Files changed (73) hide show
  1. package/LAS-README.md +1 -1
  2. package/PCD-README.md +1 -1
  3. package/PLY-README.md +1 -1
  4. package/README.md +1 -1
  5. package/dist/dist.dev.js +135 -91
  6. package/dist/dist.min.js +20 -20
  7. package/dist/las/las-loader-shared.cjs +1 -1
  8. package/dist/las/las-loader-shared.js +1 -1
  9. package/dist/las/las-loader-types.d.ts +2 -2
  10. package/dist/las/las-loader.cjs +4 -4
  11. package/dist/las/las-loader.cjs.map +2 -2
  12. package/dist/las/las-loader.d.ts +1 -1
  13. package/dist/las/las-loader.d.ts.map +1 -1
  14. package/dist/las/las-loader.js +1 -1
  15. package/dist/las/las-loader.js.map +1 -1
  16. package/dist/las/las-writer.cjs +1 -1
  17. package/dist/las/las-writer.js +1 -1
  18. package/dist/las/lib/las-extra-bytes.cjs +6 -1
  19. package/dist/las/lib/las-extra-bytes.cjs.map +2 -2
  20. package/dist/las/lib/las-extra-bytes.d.ts.map +1 -1
  21. package/dist/las/lib/las-extra-bytes.js +6 -4
  22. package/dist/las/lib/las-extra-bytes.js.map +1 -1
  23. package/dist/las-loader.cjs +4 -4
  24. package/dist/las-loader.cjs.map +2 -2
  25. package/dist/las-worker.js +704 -160
  26. package/dist/las-writer.cjs +1 -1
  27. package/dist/pcd/pcd-loader-types.cjs +3 -3
  28. package/dist/pcd/pcd-loader-types.cjs.map +2 -2
  29. package/dist/pcd/pcd-loader-types.d.ts +1 -1
  30. package/dist/pcd/pcd-loader-types.d.ts.map +1 -1
  31. package/dist/pcd/pcd-loader-types.js +2 -2
  32. package/dist/pcd/pcd-loader-types.js.map +1 -1
  33. package/dist/pcd/pcd-loader.cjs +4 -4
  34. package/dist/pcd/pcd-loader.cjs.map +2 -2
  35. package/dist/pcd/pcd-loader.d.ts +1 -1
  36. package/dist/pcd/pcd-loader.d.ts.map +1 -1
  37. package/dist/pcd/pcd-loader.js +1 -1
  38. package/dist/pcd/pcd-loader.js.map +1 -1
  39. package/dist/pcd/pcd-writer.cjs +1 -1
  40. package/dist/pcd/pcd-writer.js +1 -1
  41. package/dist/pcd-loader-types.cjs +3 -3
  42. package/dist/pcd-loader-types.cjs.map +2 -2
  43. package/dist/pcd-loader.cjs +4 -4
  44. package/dist/pcd-loader.cjs.map +2 -2
  45. package/dist/pcd-worker.js +984 -367
  46. package/dist/pcd-writer.cjs +1 -1
  47. package/dist/ply/ply-loader-types.cjs +3 -3
  48. package/dist/ply/ply-loader-types.cjs.map +2 -2
  49. package/dist/ply/ply-loader-types.d.ts +1 -1
  50. package/dist/ply/ply-loader-types.d.ts.map +1 -1
  51. package/dist/ply/ply-loader-types.js +2 -2
  52. package/dist/ply/ply-loader-types.js.map +1 -1
  53. package/dist/ply/ply-loader.cjs +4 -4
  54. package/dist/ply/ply-loader.cjs.map +2 -2
  55. package/dist/ply/ply-loader.d.ts +1 -1
  56. package/dist/ply/ply-loader.d.ts.map +1 -1
  57. package/dist/ply/ply-loader.js +1 -1
  58. package/dist/ply/ply-loader.js.map +1 -1
  59. package/dist/ply/ply-writer.cjs +1 -1
  60. package/dist/ply/ply-writer.js +1 -1
  61. package/dist/ply-loader-types.cjs +3 -3
  62. package/dist/ply-loader-types.cjs.map +2 -2
  63. package/dist/ply-loader.cjs +4 -4
  64. package/dist/ply-loader.cjs.map +2 -2
  65. package/dist/ply-worker.js +779 -162
  66. package/dist/ply-writer.cjs +1 -1
  67. package/package.json +4 -3
  68. package/src/las/las-loader.ts +1 -1
  69. package/src/las/lib/las-extra-bytes.ts +6 -4
  70. package/src/pcd/pcd-loader-types.ts +1 -1
  71. package/src/pcd/pcd-loader.ts +1 -1
  72. package/src/ply/ply-loader-types.ts +1 -1
  73. package/src/ply/ply-loader.ts +1 -1
package/LAS-README.md CHANGED
@@ -9,4 +9,4 @@ For documentation please visit the [website](https://loaders.gl).
9
9
  ## Sources and credits
10
10
 
11
11
  See [THIRD-PARTY-NOTICES.md](./THIRD-PARTY-NOTICES.md) for implementation lineage
12
- and applicable notices, and the project-wide [References and credits](https://loaders.gl/docs/references-and-credits).
12
+ and applicable notices, and the project-wide [Attributions and Credits](https://loaders.gl/docs/references-and-credits).
package/PCD-README.md CHANGED
@@ -9,4 +9,4 @@ For documentation please visit the [website](https://loaders.gl).
9
9
  ## Sources and credits
10
10
 
11
11
  See [THIRD-PARTY-NOTICES.md](./THIRD-PARTY-NOTICES.md) for implementation lineage
12
- and applicable notices, and the project-wide [References and credits](https://loaders.gl/docs/references-and-credits).
12
+ and applicable notices, and the project-wide [Attributions and Credits](https://loaders.gl/docs/references-and-credits).
package/PLY-README.md CHANGED
@@ -35,4 +35,4 @@ For documentation please visit the [website](https://loaders.gl).
35
35
  ## Sources and credits
36
36
 
37
37
  See [THIRD-PARTY-NOTICES.md](./THIRD-PARTY-NOTICES.md) for implementation lineage
38
- and applicable notices, and the project-wide [References and credits](https://loaders.gl/docs/references-and-credits).
38
+ and applicable notices, and the project-wide [Attributions and Credits](https://loaders.gl/docs/references-and-credits).
package/README.md CHANGED
@@ -9,4 +9,4 @@ LAS, LAZ, PCD, and PLY loaders and writers. PLY supports both point clouds and m
9
9
  ## Sources and credits
10
10
 
11
11
  See the [pointclouds notice inventory](https://github.com/visgl/loaders.gl/blob/master/modules/pointclouds/THIRD-PARTY-NOTICES.md)
12
- and [References and credits](https://loaders.gl/docs/references-and-credits).
12
+ and [Attributions and Credits](https://loaders.gl/docs/references-and-credits).
package/dist/dist.dev.js CHANGED
@@ -15321,12 +15321,6 @@ return true;`);
15321
15321
  metadata: serializeArrowMetadata(arrowSchema.metadata)
15322
15322
  };
15323
15323
  }
15324
- function deserializeArrowSchema(schema, options) {
15325
- return new Schema2(
15326
- schema.fields.map((field) => deserializeArrowField(field, options)),
15327
- deserializeArrowMetadata(schema.metadata)
15328
- );
15329
- }
15330
15324
  function serializeArrowMetadata(arrowMetadata) {
15331
15325
  return Object.fromEntries(arrowMetadata);
15332
15326
  }
@@ -16248,7 +16242,29 @@ return true;`);
16248
16242
  }
16249
16243
  });
16250
16244
 
16251
- // ../core/src/schema-utils/lib/arrow/split-arrow-buffers.ts
16245
+ // ../../node_modules/@math.gl/arrow/dist/arrow/arrow-data.js
16246
+ function getArrowVariadicBuffers(data) {
16247
+ return data.variadicBuffers ?? [];
16248
+ }
16249
+ function createArrowData(type, offset, length, nullCount, buffers, children, dictionary, variadicBuffers) {
16250
+ return Reflect.construct(Data, [
16251
+ type,
16252
+ offset,
16253
+ length,
16254
+ nullCount,
16255
+ buffers,
16256
+ children,
16257
+ dictionary,
16258
+ variadicBuffers
16259
+ ]);
16260
+ }
16261
+ var init_arrow_data = __esm({
16262
+ "../../node_modules/@math.gl/arrow/dist/arrow/arrow-data.js"() {
16263
+ init_Arrow_dom();
16264
+ }
16265
+ });
16266
+
16267
+ // ../../node_modules/@math.gl/arrow/dist/arrow/split-arrow-buffers.js
16252
16268
  function splitArrowBuffers(input, options = {}) {
16253
16269
  const context = { ...options, copies: /* @__PURE__ */ new WeakMap() };
16254
16270
  if (isArrowTable2(input)) {
@@ -16271,17 +16287,12 @@ return true;`);
16271
16287
  function isArrowVector2(input) {
16272
16288
  return "data" in input && Array.isArray(input.data);
16273
16289
  }
16274
- function splitArrowTableBuffersInternal(table, options) {
16275
- const recordBatches = table.batches.map(
16276
- (recordBatch) => splitArrowRecordBatchBuffers(recordBatch, options)
16277
- );
16278
- return new Table(table.schema, recordBatches);
16290
+ function splitArrowTableBuffersInternal(arrowTable, options) {
16291
+ const recordBatches = arrowTable.batches.map((recordBatch) => splitArrowRecordBatchBuffers(recordBatch, options));
16292
+ return new Table(arrowTable.schema, recordBatches);
16279
16293
  }
16280
16294
  function splitArrowRecordBatchBuffers(recordBatch, options) {
16281
- return new RecordBatch3(
16282
- recordBatch.schema,
16283
- splitArrowDataBuffers(recordBatch.data, options)
16284
- );
16295
+ return new RecordBatch3(recordBatch.schema, splitArrowDataBuffers(recordBatch.data, options));
16285
16296
  }
16286
16297
  function splitArrowDataBuffers(data, options) {
16287
16298
  const children = data.children.map((childData) => splitArrowDataBuffers(childData, options));
@@ -16292,7 +16303,7 @@ return true;`);
16292
16303
  [BufferType.VALIDITY]: splitArrowBuffer(data.buffers[BufferType.VALIDITY], options),
16293
16304
  [BufferType.TYPE]: splitArrowBuffer(data.buffers[BufferType.TYPE], options)
16294
16305
  };
16295
- return new Data(
16306
+ return createArrowData(
16296
16307
  data.type,
16297
16308
  data.offset,
16298
16309
  data.length,
@@ -16300,7 +16311,8 @@ return true;`);
16300
16311
  data._nullCount,
16301
16312
  buffers,
16302
16313
  children,
16303
- dictionary
16314
+ dictionary,
16315
+ getArrowVariadicBuffers(data).map((buffer) => splitArrowBuffer(buffer, options))
16304
16316
  );
16305
16317
  }
16306
16318
  function splitArrowVectorBuffers(vector, options) {
@@ -16318,7 +16330,7 @@ return true;`);
16318
16330
  }
16319
16331
  let copy = options.copies.get(array);
16320
16332
  if (!copy) {
16321
- copy = array.slice();
16333
+ copy = array instanceof Uint8Array ? new Uint8Array(array) : array.slice();
16322
16334
  options.copies.set(array, copy);
16323
16335
  }
16324
16336
  return copy;
@@ -16327,29 +16339,106 @@ return true;`);
16327
16339
  return ArrayBuffer.isView(value) && !(value instanceof DataView);
16328
16340
  }
16329
16341
  var init_split_arrow_buffers = __esm({
16330
- "../core/src/schema-utils/lib/arrow/split-arrow-buffers.ts"() {
16331
- "use strict";
16342
+ "../../node_modules/@math.gl/arrow/dist/arrow/split-arrow-buffers.js"() {
16332
16343
  init_Arrow_dom();
16344
+ init_arrow_data();
16333
16345
  }
16334
16346
  });
16335
16347
 
16336
- // ../core/src/schema-utils/lib/arrow/arrow-table-transport.ts
16337
- function dehydrateArrowTable(table, options) {
16338
- const splitTable = splitArrowBuffers(table, options);
16348
+ // ../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-vector.js
16349
+ var init_indexed_arrow_vector = __esm({
16350
+ "../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-vector.js"() {
16351
+ }
16352
+ });
16353
+
16354
+ // ../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-table.js
16355
+ var init_indexed_arrow_table = __esm({
16356
+ "../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-table.js"() {
16357
+ }
16358
+ });
16359
+
16360
+ // ../../node_modules/@math.gl/arrow/dist/arrow/mapped-arrow-table.js
16361
+ var init_mapped_arrow_table = __esm({
16362
+ "../../node_modules/@math.gl/arrow/dist/arrow/mapped-arrow-table.js"() {
16363
+ }
16364
+ });
16365
+
16366
+ // ../../node_modules/@math.gl/arrow/dist/arrow/rename-arrow-columns.js
16367
+ var init_rename_arrow_columns = __esm({
16368
+ "../../node_modules/@math.gl/arrow/dist/arrow/rename-arrow-columns.js"() {
16369
+ }
16370
+ });
16371
+
16372
+ // ../../node_modules/@math.gl/arrow/dist/arrow/arrow-table-transport.js
16373
+ function dehydrateArrowTable(arrowTable, options) {
16374
+ const splitTable = splitArrowBuffers(arrowTable, options);
16339
16375
  return {
16340
- shape: "arrow-table",
16341
16376
  transport: "arrow-js",
16342
- schema: serializeArrowSchema(splitTable.schema),
16343
- batches: splitTable.batches.map((recordBatch) => dehydrateArrowRecordBatch(recordBatch))
16377
+ version: 1,
16378
+ schema: tableToIPC(new Table(splitTable.schema, [])),
16379
+ metadataVersion: splitTable.schema.metadataVersion,
16380
+ batches: splitTable.batches.map((batch) => dehydrateArrowData(batch.data))
16344
16381
  };
16345
16382
  }
16346
16383
  function hydrateArrowTable(table) {
16347
- const schema = deserializeArrowSchema(table.schema);
16348
- const recordBatches = table.batches.map(
16349
- (recordBatch) => new RecordBatch3(schema, hydrateArrowData(recordBatch.data))
16350
- );
16351
- return new Table(schema, recordBatches);
16384
+ if (table.transport !== "arrow-js" || table.version !== 1) {
16385
+ throw new Error("Unsupported Arrow column-buffer transport protocol.");
16386
+ }
16387
+ const decodedSchema = tableFromIPC(table.schema).schema;
16388
+ const schema = new Schema2(decodedSchema.fields, decodedSchema.metadata, decodedSchema.dictionaries, table.metadataVersion);
16389
+ const type = new Struct(schema.fields);
16390
+ const batches = table.batches.map((data) => new RecordBatch3(schema, hydrateArrowData(data, type)));
16391
+ return new Table(schema, batches);
16392
+ }
16393
+ function dehydrateArrowData(data) {
16394
+ return {
16395
+ offset: data.offset,
16396
+ length: data.length,
16397
+ nullCount: data.nullCount,
16398
+ buffers: {
16399
+ [BufferType.OFFSET]: data.buffers[BufferType.OFFSET],
16400
+ [BufferType.DATA]: data.buffers[BufferType.DATA],
16401
+ [BufferType.VALIDITY]: data.buffers[BufferType.VALIDITY],
16402
+ [BufferType.TYPE]: data.buffers[BufferType.TYPE]
16403
+ },
16404
+ children: data.children.map((child) => dehydrateArrowData(child)),
16405
+ variadicBuffers: getArrowVariadicBuffers(data),
16406
+ dictionary: data.dictionary?.data.map((chunk) => dehydrateArrowData(chunk))
16407
+ };
16352
16408
  }
16409
+ function hydrateArrowData(data, type) {
16410
+ const children = data.children.map((child, index) => hydrateArrowData(child, type.children[index].type));
16411
+ const dictionary = data.dictionary && DataType.isDictionary(type) ? new Vector(data.dictionary.map((chunk) => hydrateArrowData(chunk, type.dictionary))) : void 0;
16412
+ return createArrowData(type, data.offset, data.length, data.nullCount, data.buffers, children, dictionary, data.variadicBuffers);
16413
+ }
16414
+ var init_arrow_table_transport = __esm({
16415
+ "../../node_modules/@math.gl/arrow/dist/arrow/arrow-table-transport.js"() {
16416
+ init_Arrow_dom();
16417
+ init_arrow_data();
16418
+ init_split_arrow_buffers();
16419
+ }
16420
+ });
16421
+
16422
+ // ../../node_modules/@math.gl/arrow/dist/arrow/index.js
16423
+ var init_arrow = __esm({
16424
+ "../../node_modules/@math.gl/arrow/dist/arrow/index.js"() {
16425
+ init_indexed_arrow_table();
16426
+ init_indexed_arrow_vector();
16427
+ init_mapped_arrow_table();
16428
+ init_rename_arrow_columns();
16429
+ init_split_arrow_buffers();
16430
+ init_arrow_table_transport();
16431
+ }
16432
+ });
16433
+
16434
+ // ../../node_modules/@math.gl/arrow/dist/index.js
16435
+ var init_dist2 = __esm({
16436
+ "../../node_modules/@math.gl/arrow/dist/index.js"() {
16437
+ init_arrow();
16438
+ }
16439
+ });
16440
+
16441
+ // ../core/src/arrow-worker-transport.ts
16353
16442
  function serializeArrowWorkerTable(result) {
16354
16443
  if (!isArrowTableWrapper(result)) {
16355
16444
  throw new Error("Workers require Arrow table output");
@@ -16378,60 +16467,10 @@ return true;`);
16378
16467
  table && table.shape === "arrow-table" && table.data && table.data.transport === "arrow-js" && Array.isArray(table.data.batches)
16379
16468
  );
16380
16469
  }
16381
- function dehydrateArrowRecordBatch(recordBatch) {
16382
- return { data: dehydrateArrowData(recordBatch.data) };
16383
- }
16384
- function dehydrateArrowData(data) {
16385
- return {
16386
- type: serializeArrowType(data.type),
16387
- offset: data.offset,
16388
- length: data.length,
16389
- // @ts-expect-error _nullCount is protected. Preserve the Arrow lazy null-count state.
16390
- nullCount: data._nullCount,
16391
- buffers: {
16392
- [BufferType.OFFSET]: data.buffers[BufferType.OFFSET],
16393
- [BufferType.DATA]: data.buffers[BufferType.DATA],
16394
- [BufferType.VALIDITY]: data.buffers[BufferType.VALIDITY],
16395
- [BufferType.TYPE]: data.buffers[BufferType.TYPE]
16396
- },
16397
- children: data.children.map((childData) => dehydrateArrowData(childData)),
16398
- dictionary: data.dictionary ? dehydrateArrowVector(data.dictionary) : void 0
16399
- };
16400
- }
16401
- function dehydrateArrowVector(vector) {
16402
- return { data: vector.data.map((data) => dehydrateArrowData(data)) };
16403
- }
16404
- function hydrateArrowData(data) {
16405
- const children = data.children.map((childData) => hydrateArrowData(childData));
16406
- const dictionary = data.dictionary ? hydrateArrowVector(data.dictionary) : void 0;
16407
- return new Data(
16408
- deserializeArrowType(data.type),
16409
- data.offset,
16410
- data.length,
16411
- data.nullCount,
16412
- data.buffers,
16413
- children,
16414
- dictionary
16415
- );
16416
- }
16417
- function hydrateArrowVector(vector) {
16418
- return new Vector(vector.data.map((data) => hydrateArrowData(data)));
16419
- }
16420
- var init_arrow_table_transport = __esm({
16421
- "../core/src/schema-utils/lib/arrow/arrow-table-transport.ts"() {
16470
+ var init_arrow_worker_transport = __esm({
16471
+ "../core/src/arrow-worker-transport.ts"() {
16422
16472
  "use strict";
16423
- init_Arrow_dom();
16424
- init_convert_arrow_schema();
16425
- init_split_arrow_buffers();
16426
- }
16427
- });
16428
-
16429
- // ../core/src/schema-utils/arrow-transport.ts
16430
- var init_arrow_transport = __esm({
16431
- "../core/src/schema-utils/arrow-transport.ts"() {
16432
- "use strict";
16433
- init_arrow_table_transport();
16434
- init_split_arrow_buffers();
16473
+ init_dist2();
16435
16474
  }
16436
16475
  });
16437
16476
 
@@ -23228,7 +23267,12 @@ return true;`);
23228
23267
  return attributes;
23229
23268
  }
23230
23269
  function readLASString(bytes, offset, length) {
23231
- return new TextDecoder().decode(bytes.subarray(offset, offset + length)).replace(/\0+$/, "").trim();
23270
+ const decoded = new TextDecoder().decode(bytes.subarray(offset, offset + length));
23271
+ let end = decoded.length;
23272
+ while (end > 0 && decoded[end - 1] === "\0") {
23273
+ end--;
23274
+ }
23275
+ return decoded.slice(0, end).trim();
23232
23276
  }
23233
23277
  function sanitizeExtraBytesName(name) {
23234
23278
  return name.trim().replace(/[^A-Za-z0-9_]+/g, "_");
@@ -26034,7 +26078,7 @@ return true;`);
26034
26078
  "use strict";
26035
26079
  init_schema_utils();
26036
26080
  init_las_loader_shared();
26037
- init_arrow_transport();
26081
+ init_arrow_worker_transport();
26038
26082
  init_parse_las();
26039
26083
  LASLoaderWithParser = {
26040
26084
  ...LAS_LOADER_METADATA,
@@ -26602,7 +26646,7 @@ return true;`);
26602
26646
  "src/pcd/pcd-loader.ts"() {
26603
26647
  "use strict";
26604
26648
  init_loader_utils();
26605
- init_arrow_transport();
26649
+ init_arrow_worker_transport();
26606
26650
  init_schema_utils();
26607
26651
  init_parse_pcd();
26608
26652
  init_pcd_loader_types();
@@ -26656,7 +26700,7 @@ return true;`);
26656
26700
  "src/pcd/pcd-loader-types.ts"() {
26657
26701
  "use strict";
26658
26702
  init_pcd_format();
26659
- init_arrow_transport();
26703
+ init_arrow_worker_transport();
26660
26704
  VERSION3 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
26661
26705
  PCDLoader = {
26662
26706
  ...PCDFormat,
@@ -28759,7 +28803,7 @@ return true;`);
28759
28803
  "use strict";
28760
28804
  init_loader_utils();
28761
28805
  init_schema3();
28762
- init_arrow_transport();
28806
+ init_arrow_worker_transport();
28763
28807
  init_schema_utils();
28764
28808
  init_parse_ply();
28765
28809
  init_parse_ply_arrow();
@@ -28811,7 +28855,7 @@ return true;`);
28811
28855
  "src/ply/ply-loader-types.ts"() {
28812
28856
  "use strict";
28813
28857
  init_ply_format();
28814
- init_arrow_transport();
28858
+ init_arrow_worker_transport();
28815
28859
  VERSION5 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
28816
28860
  PLYLoader = {
28817
28861
  dataType: null,