@loaders.gl/tiles-3d 5.0.0-beta.5 → 5.0.0-beta.7
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/3d-tiles/3d-tiles-archive-loader.js +1 -1
- package/dist/3d-tiles/dist.dev.js +50 -1
- package/dist/3d-tiles/dist.min.js +26 -26
- package/dist/3d-tiles/index.cjs +55 -4
- package/dist/3d-tiles/index.cjs.map +1 -1
- package/dist/3d-tiles/lib/utils/version.js +1 -1
- package/dist/3d-tiles-archive-writer.cjs +1 -1
- package/dist/cesium-ion-loader-with-parser.cjs +2 -1
- package/dist/cesium-ion-loader-with-parser.cjs.map +1 -1
- package/dist/copc/copc-source-loader.js +1 -1
- package/dist/copc/copc-writer.js +1 -1
- package/dist/copc/index.cjs +99 -5
- package/dist/copc/index.cjs.map +1 -1
- package/dist/dist.dev.js +92 -2
- package/dist/dist.min.js +10 -10
- package/dist/i3s/arcgis-webscene-loader.js +1 -1
- package/dist/i3s/dist.dev.js +93 -2
- package/dist/i3s/dist.min.js +31 -31
- package/dist/i3s/i3s-attribute-loader.js +1 -1
- package/dist/i3s/i3s-building-scene-layer-loader.js +1 -1
- package/dist/i3s/i3s-content-loader.js +1 -1
- package/dist/i3s/i3s-lepcc-loader-types.js +1 -1
- package/dist/i3s/i3s-loader.js +1 -1
- package/dist/i3s/i3s-node-page-loader.js +1 -1
- package/dist/i3s/i3s-slpk-loader.js +1 -1
- package/dist/i3s/i3s-slpk-writer.js +1 -1
- package/dist/i3s/index.cjs +107 -12
- package/dist/i3s/index.cjs.map +2 -2
- package/dist/i3s-content-worker-node.js +7 -7
- package/dist/i3s-content-worker-node.js.map +1 -1
- package/dist/i3s-content-worker.js +5 -4
- package/dist/i3s-lepcc-worker-node.js +2 -2
- package/dist/i3s-lepcc-worker.js +2 -2
- package/dist/i3s-mesh-writer.cjs +1 -0
- package/dist/i3s-mesh-writer.cjs.map +1 -1
- package/dist/i3s-slpk-writer.cjs +1 -1
- package/dist/index.cjs +98 -4
- package/dist/index.cjs.map +2 -2
- package/dist/point-cloud-tile-source-loader-types.js +1 -1
- package/dist/point-cloud-tile-source-loader.cjs +46 -2
- package/dist/point-cloud-tile-source-loader.cjs.map +2 -2
- package/dist/point-cloud-tile-source.cjs +45 -1
- package/dist/point-cloud-tile-source.cjs.map +1 -1
- package/dist/potree/dist.dev.js +99 -9
- package/dist/potree/dist.min.js +15 -15
- package/dist/potree/index.cjs +107 -16
- package/dist/potree/index.cjs.map +2 -2
- package/dist/potree/potree-bin-loader.js +1 -1
- package/dist/potree/potree-hierarchy-chunk-loader.js +1 -1
- package/dist/potree/potree-loader-types.js +1 -1
- package/dist/potree/potree-source-loader.js +1 -1
- package/dist/potree/potree-writer.js +1 -1
- package/dist/potree/potree2-source.d.ts.map +1 -1
- package/dist/potree/potree2-source.js +3 -13
- package/dist/potree/potree2-source.js.map +1 -1
- package/dist/potree-loader.cjs +1 -1
- package/package.json +13 -13
- package/src/potree/potree2-source.ts +3 -14
package/dist/potree/index.cjs
CHANGED
|
@@ -5183,7 +5183,7 @@ function getSourceLoaderOptions(options) {
|
|
|
5183
5183
|
if (options == null ? void 0 : options.core) {
|
|
5184
5184
|
loadOptions.core = { ...options.core };
|
|
5185
5185
|
const parserCore = loadOptions.core;
|
|
5186
|
-
for (const key of ["type", "attributions", "loaders", "onError", "loadOptions"]) {
|
|
5186
|
+
for (const key of ["type", "name", "attributions", "loaders", "onError", "loadOptions"]) {
|
|
5187
5187
|
delete parserCore[key];
|
|
5188
5188
|
}
|
|
5189
5189
|
if (Object.keys(parserCore).length === 0) {
|
|
@@ -5218,6 +5218,44 @@ function unavailableCoreApiMethod(methodName) {
|
|
|
5218
5218
|
);
|
|
5219
5219
|
};
|
|
5220
5220
|
}
|
|
5221
|
+
function getDataSourceName(data, options) {
|
|
5222
|
+
var _a, _b, _c;
|
|
5223
|
+
const explicitName = (_a = options.core) == null ? void 0 : _a.name;
|
|
5224
|
+
if (explicitName !== void 0) {
|
|
5225
|
+
if (typeof explicitName !== "string" || !explicitName.trim())
|
|
5226
|
+
throw new Error("Data source name must be a non-empty string.");
|
|
5227
|
+
return explicitName;
|
|
5228
|
+
}
|
|
5229
|
+
if (data && typeof data === "object") {
|
|
5230
|
+
const named = data;
|
|
5231
|
+
if (typeof named.name === "string" && named.name.trim())
|
|
5232
|
+
return data instanceof Blob ? removeFileExtension(named.name) : named.name;
|
|
5233
|
+
const metadata = (_b = named.schema) == null ? void 0 : _b.metadata;
|
|
5234
|
+
const embeddedName = metadata instanceof Map ? metadata.get("name") : metadata == null ? void 0 : metadata.name;
|
|
5235
|
+
if (typeof embeddedName === "string" && embeddedName.trim()) return embeddedName;
|
|
5236
|
+
}
|
|
5237
|
+
if (typeof data === "string") {
|
|
5238
|
+
try {
|
|
5239
|
+
const url = new URL(data.replace(/\\/g, "/"), "https://source.invalid/");
|
|
5240
|
+
if (!["data:", "blob:"].includes(url.protocol)) {
|
|
5241
|
+
let basename = url.pathname.split("/").filter(Boolean).pop();
|
|
5242
|
+
if (basename) {
|
|
5243
|
+
try {
|
|
5244
|
+
basename = decodeURIComponent(basename);
|
|
5245
|
+
} catch {
|
|
5246
|
+
}
|
|
5247
|
+
return removeFileExtension(basename);
|
|
5248
|
+
}
|
|
5249
|
+
}
|
|
5250
|
+
} catch {
|
|
5251
|
+
}
|
|
5252
|
+
}
|
|
5253
|
+
return ((_c = options.core) == null ? void 0 : _c.type) && options.core.type !== "auto" ? options.core.type : "source";
|
|
5254
|
+
}
|
|
5255
|
+
function removeFileExtension(name) {
|
|
5256
|
+
const extension = name.lastIndexOf(".");
|
|
5257
|
+
return extension > 0 ? name.slice(0, extension) : name;
|
|
5258
|
+
}
|
|
5221
5259
|
var UNAVAILABLE_CORE_API, DataSource;
|
|
5222
5260
|
var init_data_source = __esm({
|
|
5223
5261
|
"../core/src/loader-utils/lib/sources/data-source.ts"() {
|
|
@@ -5249,6 +5287,8 @@ var init_data_source = __esm({
|
|
|
5249
5287
|
options;
|
|
5250
5288
|
data;
|
|
5251
5289
|
url;
|
|
5290
|
+
/** Stable query-visible name, resolved without fetching source data. */
|
|
5291
|
+
name;
|
|
5252
5292
|
/** Shared parser options derived from the source options, excluding source-only core controls. */
|
|
5253
5293
|
loadOptions;
|
|
5254
5294
|
/** A resolved fetch function extracted from the shared core options. */
|
|
@@ -5265,6 +5305,7 @@ var init_data_source = __esm({
|
|
|
5265
5305
|
);
|
|
5266
5306
|
this.data = data;
|
|
5267
5307
|
this.url = typeof data === "string" ? resolvePath(data) : "";
|
|
5308
|
+
this.name = getDataSourceName(data, this.options);
|
|
5268
5309
|
const loadOptions = resolveAuthenticationOptions(getSourceLoaderOptions(this.options));
|
|
5269
5310
|
this.loadOptions = loadOptions;
|
|
5270
5311
|
const fetch2 = getFetchFunction(loadOptions);
|
|
@@ -5273,6 +5314,9 @@ var init_data_source = __esm({
|
|
|
5273
5314
|
this.fetch = fetch2;
|
|
5274
5315
|
}
|
|
5275
5316
|
setProps(options) {
|
|
5317
|
+
var _a;
|
|
5318
|
+
if (((_a = options.core) == null ? void 0 : _a.name) !== void 0 && options.core.name !== this.name)
|
|
5319
|
+
throw new Error("Data source names are fixed at creation.");
|
|
5276
5320
|
const mergedOptions = mergeOptions(this.options, options);
|
|
5277
5321
|
const loadOptions = resolveAuthenticationOptions(getSourceLoaderOptions(mergedOptions));
|
|
5278
5322
|
this.options = mergedOptions;
|
|
@@ -5615,6 +5659,60 @@ var init_point_cloud_query = __esm({
|
|
|
5615
5659
|
}
|
|
5616
5660
|
});
|
|
5617
5661
|
|
|
5662
|
+
// ../core/src/loader-utils/lib/files/read-range-response.ts
|
|
5663
|
+
async function readRangeResponse(response, offset, length, signal) {
|
|
5664
|
+
var _a, _b, _c;
|
|
5665
|
+
if (typeof offset === "number" && (!Number.isSafeInteger(offset) || offset < 0) || typeof offset === "bigint" && offset < 0n || !Number.isSafeInteger(length) || length <= 0) {
|
|
5666
|
+
await ((_a = response.body) == null ? void 0 : _a.cancel().catch(() => {
|
|
5667
|
+
}));
|
|
5668
|
+
throw new RangeError("Invalid HTTP byte range");
|
|
5669
|
+
}
|
|
5670
|
+
const start = BigInt(offset);
|
|
5671
|
+
const end = start + BigInt(length) - 1n;
|
|
5672
|
+
const value = response.headers.get("Content-Range");
|
|
5673
|
+
const match = value === null ? null : /^bytes (\d+)-(\d+)\/(\d+|\*)$/.exec(value);
|
|
5674
|
+
if (response.status !== 206 || value !== null && (!match || BigInt(match[1]) !== start || BigInt(match[2]) !== end || match[3] !== "*" && BigInt(match[3]) <= end)) {
|
|
5675
|
+
await ((_b = response.body) == null ? void 0 : _b.cancel().catch(() => {
|
|
5676
|
+
}));
|
|
5677
|
+
throw new Error("HTTP range requires 206 and matching Content-Range when visible");
|
|
5678
|
+
}
|
|
5679
|
+
const reader = (_c = response.body) == null ? void 0 : _c.getReader();
|
|
5680
|
+
if (!reader) throw new Error("HTTP range response has no body");
|
|
5681
|
+
let received = 0;
|
|
5682
|
+
const abort = () => {
|
|
5683
|
+
void reader.cancel(signal == null ? void 0 : signal.reason).catch(() => {
|
|
5684
|
+
});
|
|
5685
|
+
};
|
|
5686
|
+
signal == null ? void 0 : signal.addEventListener("abort", abort, { once: true });
|
|
5687
|
+
try {
|
|
5688
|
+
signal == null ? void 0 : signal.throwIfAborted();
|
|
5689
|
+
const bytes = new Uint8Array(length);
|
|
5690
|
+
for (; ; ) {
|
|
5691
|
+
const chunk = await reader.read();
|
|
5692
|
+
signal == null ? void 0 : signal.throwIfAborted();
|
|
5693
|
+
if (chunk.done) break;
|
|
5694
|
+
if (received + chunk.value.byteLength > length)
|
|
5695
|
+
throw new Error("HTTP range body exceeds requested length");
|
|
5696
|
+
bytes.set(chunk.value, received);
|
|
5697
|
+
received += chunk.value.byteLength;
|
|
5698
|
+
}
|
|
5699
|
+
if (received !== length) throw new Error("HTTP range body has truncated length");
|
|
5700
|
+
return bytes;
|
|
5701
|
+
} catch (error) {
|
|
5702
|
+
await reader.cancel(error).catch(() => {
|
|
5703
|
+
});
|
|
5704
|
+
throw error;
|
|
5705
|
+
} finally {
|
|
5706
|
+
signal == null ? void 0 : signal.removeEventListener("abort", abort);
|
|
5707
|
+
reader.releaseLock();
|
|
5708
|
+
}
|
|
5709
|
+
}
|
|
5710
|
+
var init_read_range_response = __esm({
|
|
5711
|
+
"../core/src/loader-utils/lib/files/read-range-response.ts"() {
|
|
5712
|
+
"use strict";
|
|
5713
|
+
}
|
|
5714
|
+
});
|
|
5715
|
+
|
|
5618
5716
|
// ../core/src/loader-utils/index.ts
|
|
5619
5717
|
var init_loader_utils = __esm({
|
|
5620
5718
|
"../core/src/loader-utils/index.ts"() {
|
|
@@ -5628,6 +5726,7 @@ var init_loader_utils = __esm({
|
|
|
5628
5726
|
init_columnar_predicate();
|
|
5629
5727
|
init_scan_query_metadata();
|
|
5630
5728
|
init_point_cloud_query();
|
|
5729
|
+
init_read_range_response();
|
|
5631
5730
|
}
|
|
5632
5731
|
});
|
|
5633
5732
|
|
|
@@ -6220,7 +6319,7 @@ var init_potree_loader_types2 = __esm({
|
|
|
6220
6319
|
"dist/potree/potree-loader-types.js"() {
|
|
6221
6320
|
"use strict";
|
|
6222
6321
|
init_potree_format();
|
|
6223
|
-
VERSION3 = true ? "5.0.0-beta.
|
|
6322
|
+
VERSION3 = true ? "5.0.0-beta.7" : "latest";
|
|
6224
6323
|
PotreeLoader2 = {
|
|
6225
6324
|
...PotreeFormat,
|
|
6226
6325
|
dataType: null,
|
|
@@ -6387,7 +6486,7 @@ var init_potree_hierarchy_chunk_loader = __esm({
|
|
|
6387
6486
|
"dist/potree/potree-hierarchy-chunk-loader.js"() {
|
|
6388
6487
|
"use strict";
|
|
6389
6488
|
init_potree_format();
|
|
6390
|
-
VERSION4 = true ? "5.0.0-beta.
|
|
6489
|
+
VERSION4 = true ? "5.0.0-beta.7" : "latest";
|
|
6391
6490
|
PotreeHierarchyChunkLoader = {
|
|
6392
6491
|
...PotreeHierarchyChunkFormat,
|
|
6393
6492
|
dataType: null,
|
|
@@ -7908,7 +8007,7 @@ var init_potree_bin_loader = __esm({
|
|
|
7908
8007
|
"dist/potree/potree-bin-loader.js"() {
|
|
7909
8008
|
"use strict";
|
|
7910
8009
|
init_potree_format();
|
|
7911
|
-
VERSION5 = true ? "5.0.0-beta.
|
|
8010
|
+
VERSION5 = true ? "5.0.0-beta.7" : "latest";
|
|
7912
8011
|
PotreeBinLoader = {
|
|
7913
8012
|
...PotreeBinFormat,
|
|
7914
8013
|
dataType: null,
|
|
@@ -11484,7 +11583,6 @@ var init_potree2_source = __esm({
|
|
|
11484
11583
|
}
|
|
11485
11584
|
/** Reads a validated 64-bit range; servers must honor Range with an exact Content-Range. */
|
|
11486
11585
|
async readRange(name, offset, size, limit) {
|
|
11487
|
-
var _a;
|
|
11488
11586
|
if (offset < 0n || size <= 0n || size > BigInt(limit) || offset + size > BigInt(Number.MAX_SAFE_INTEGER))
|
|
11489
11587
|
throw new Error("Invalid or oversized Potree byte range");
|
|
11490
11588
|
const end = offset + size - 1n;
|
|
@@ -11493,15 +11591,8 @@ var init_potree2_source = __esm({
|
|
|
11493
11591
|
headers: { Range: `bytes=${offset}-${end}` }
|
|
11494
11592
|
});
|
|
11495
11593
|
this.signal.throwIfAborted();
|
|
11496
|
-
const
|
|
11497
|
-
const
|
|
11498
|
-
if (response.status !== 206 || !contentRange || total !== "*" && (!total || !/^[0-9]+$/.test(total) || BigInt(total) <= end) || !new RegExp(`^bytes ${offset}-${end}/(?:[0-9]+|\\*)$`).test(contentRange)) {
|
|
11499
|
-
await ((_a = response.body) == null ? void 0 : _a.cancel());
|
|
11500
|
-
throw new Error("Potree server must honor the requested byte range");
|
|
11501
|
-
}
|
|
11502
|
-
const data = await this.readResponse(response, Number(size));
|
|
11503
|
-
if (data.byteLength !== Number(size))
|
|
11504
|
-
throw new Error("Truncated Potree byte range");
|
|
11594
|
+
const bytes = await readRangeResponse(response, offset, Number(size), this.signal);
|
|
11595
|
+
const data = bytes.buffer;
|
|
11505
11596
|
return data;
|
|
11506
11597
|
}
|
|
11507
11598
|
/** Collects an incrementally bounded response and cancels on overflow or cancellation. */
|
|
@@ -12688,7 +12779,7 @@ function inferPotreeColumnRole(name) {
|
|
|
12688
12779
|
|
|
12689
12780
|
// dist/potree/potree-source-loader.js
|
|
12690
12781
|
init_potree_format();
|
|
12691
|
-
var VERSION7 = true ? "5.0.0-beta.
|
|
12782
|
+
var VERSION7 = true ? "5.0.0-beta.7" : "latest";
|
|
12692
12783
|
var PotreeSourceLoader = {
|
|
12693
12784
|
...PotreeBinFormat,
|
|
12694
12785
|
dataType: null,
|
|
@@ -12715,7 +12806,7 @@ var PotreeSourceLoader = {
|
|
|
12715
12806
|
|
|
12716
12807
|
// dist/potree/potree-writer.js
|
|
12717
12808
|
init_schema_utils();
|
|
12718
|
-
var VERSION8 = true ? "5.0.0-beta.
|
|
12809
|
+
var VERSION8 = true ? "5.0.0-beta.7" : "latest";
|
|
12719
12810
|
var PotreeWriter = {
|
|
12720
12811
|
name: "Potree metadata",
|
|
12721
12812
|
id: "potree",
|