@loaders.gl/tile-converter 5.0.0-alpha.10 → 5.0.0-alpha.11
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/README.md +33 -0
- package/dist/converter.min.cjs +103 -103
- package/dist/i3s-server/bin/i3s-server.min.cjs +1 -1
- package/dist/index.cjs +651 -547
- package/dist/index.js +641 -537
- package/dist/v5/adapters.cjs +1756 -200
- package/dist/v5/adapters.d.ts +13 -2
- package/dist/v5/adapters.js +1755 -190
- package/dist/v5/browser.cjs +12 -0
- package/dist/v5/browser.d.ts +12 -2
- package/dist/v5/browser.js +19 -1
- package/dist/v5/core.cjs +54 -0
- package/dist/v5/core.js +54 -0
- package/dist/v5/i3s-mesh-conversion.d.ts +10 -4
- package/dist/v5/i3s-mesh-sink.d.ts +25 -0
- package/dist/v5/i3s-mesh-source-features.d.ts +13 -0
- package/dist/v5/i3s-mesh-source-material.d.ts +5 -0
- package/dist/v5/i3s-mesh-source.d.ts +30 -0
- package/dist/v5/index.cjs +10 -0
- package/dist/v5/index.d.ts +10 -2
- package/dist/v5/index.js +17 -1
- package/dist/v5/mesh-conversion.d.ts +11 -2
- package/dist/v5/mesh-features.d.ts +9 -0
- package/dist/v5/mesh-source-texture.d.ts +2 -0
- package/dist/v5/mesh-source.d.ts +8 -1
- package/dist/v5/mesh.d.ts +6 -1
- package/dist/v5/point-cloud-source-encoder.d.ts +4 -7
- package/dist/v5/point-cloud-spatial.d.ts +22 -0
- package/dist/v5/point-cloud-tileset-sink.d.ts +28 -0
- package/dist/v5/point-cloud.d.ts +26 -1
- package/dist/v5/resource-fetcher.d.ts +18 -0
- package/dist/v5/spatial-conversion.d.ts +3 -1
- package/package.json +23 -23
- package/src/v5/adapters.ts +21 -2
- package/src/v5/browser.ts +36 -2
- package/src/v5/i3s-mesh-conversion.ts +58 -18
- package/src/v5/i3s-mesh-sink.ts +351 -0
- package/src/v5/i3s-mesh-source-features.ts +279 -0
- package/src/v5/i3s-mesh-source-material.ts +157 -0
- package/src/v5/i3s-mesh-source.ts +227 -0
- package/src/v5/index.ts +34 -2
- package/src/v5/mesh-conversion.ts +41 -11
- package/src/v5/mesh-draco.ts +47 -3
- package/src/v5/mesh-features.ts +319 -0
- package/src/v5/mesh-source-features.ts +37 -6
- package/src/v5/mesh-source-texture.ts +47 -0
- package/src/v5/mesh-source.ts +83 -21
- package/src/v5/mesh.ts +16 -7
- package/src/v5/point-cloud-conversion.ts +9 -1
- package/src/v5/point-cloud-source-encoder.ts +31 -20
- package/src/v5/point-cloud-spatial.ts +280 -0
- package/src/v5/point-cloud-tileset-sink.ts +234 -0
- package/src/v5/point-cloud.ts +159 -32
- package/src/v5/resource-fetcher.ts +110 -0
- package/src/v5/spatial-conversion.ts +84 -0
package/dist/index.js
CHANGED
|
@@ -15822,6 +15822,8 @@ async function decompressPrimitive(iterator, primitive, options, context) {
|
|
|
15822
15822
|
...options.draco,
|
|
15823
15823
|
// Internal glTF decoding consumes the legacy mesh contract.
|
|
15824
15824
|
shape: "mesh",
|
|
15825
|
+
// Normalize compressed strips to the triangle indices returned below.
|
|
15826
|
+
topology: "triangle-list",
|
|
15825
15827
|
decoderProfile: options.draco?.decoderProfile || "gltf",
|
|
15826
15828
|
extraAttributes: dracoExtension.attributes
|
|
15827
15829
|
}
|
|
@@ -15850,6 +15852,7 @@ async function decompressPrimitive(iterator, primitive, options, context) {
|
|
|
15850
15852
|
primitive.attributes = decodedAttributes;
|
|
15851
15853
|
if (decodedData.indices) {
|
|
15852
15854
|
primitive.indices = getGLTFAccessor(decodedData.indices);
|
|
15855
|
+
primitive.mode = 4;
|
|
15853
15856
|
}
|
|
15854
15857
|
iterator.removeExtension(primitive, KHR_DRACO_MESH_COMPRESSION);
|
|
15855
15858
|
checkPrimitive(primitive);
|
|
@@ -20725,22 +20728,25 @@ var init_format_spatial_reference = __esm({
|
|
|
20725
20728
|
|
|
20726
20729
|
// ../../modules/tiles/src/spatial/spatial-resource-registry.ts
|
|
20727
20730
|
import { parsePGM } from "@math.gl/geoid";
|
|
20728
|
-
import {
|
|
20731
|
+
import { FullProjectionEngine, parseNTv2Grid } from "@math.gl/projection";
|
|
20732
|
+
function getSpatialProjectionEngine() {
|
|
20733
|
+
return spatialProjectionEngine;
|
|
20734
|
+
}
|
|
20729
20735
|
function getGeoidModel(name18) {
|
|
20730
20736
|
return geoidModels.get(name18);
|
|
20731
20737
|
}
|
|
20732
|
-
var geoidModels;
|
|
20738
|
+
var geoidModels, spatialProjectionEngine;
|
|
20733
20739
|
var init_spatial_resource_registry = __esm({
|
|
20734
20740
|
"../../modules/tiles/src/spatial/spatial-resource-registry.ts"() {
|
|
20735
20741
|
"use strict";
|
|
20736
20742
|
geoidModels = /* @__PURE__ */ new Map();
|
|
20743
|
+
spatialProjectionEngine = new FullProjectionEngine();
|
|
20737
20744
|
}
|
|
20738
20745
|
});
|
|
20739
20746
|
|
|
20740
20747
|
// ../../modules/tiles/src/spatial/spatial-coordinate-transformer.ts
|
|
20741
20748
|
import { Vector3 as Vector34 } from "@math.gl/core";
|
|
20742
20749
|
import { Ellipsoid as Ellipsoid2 } from "@math.gl/geospatial";
|
|
20743
|
-
import { Projection as Projection2 } from "@math.gl/projection";
|
|
20744
20750
|
function getFiniteDifferenceJacobian(transformer, position, epsilon) {
|
|
20745
20751
|
const columns = [];
|
|
20746
20752
|
for (let axis = 0; axis < 3; axis++) {
|
|
@@ -20875,6 +20881,7 @@ var init_spatial_coordinate_transformer = __esm({
|
|
|
20875
20881
|
*/
|
|
20876
20882
|
constructor(spatialReference, options = {}) {
|
|
20877
20883
|
this.spatialReference = spatialReference;
|
|
20884
|
+
const projectionEngine = getSpatialProjectionEngine();
|
|
20878
20885
|
validateTransformRequest(spatialReference);
|
|
20879
20886
|
const outputCrs = spatialReference.targetCrs || spatialReference.sourceCrs;
|
|
20880
20887
|
this.sourceIsGeocentric = isWgs84Geocentric(spatialReference.sourceCrs);
|
|
@@ -20882,7 +20889,7 @@ var init_spatial_coordinate_transformer = __esm({
|
|
|
20882
20889
|
this.sourceIsGeographic = isWgs84Geographic(spatialReference.sourceCrs);
|
|
20883
20890
|
this.outputIsGeographic = isWgs84Geographic(outputCrs);
|
|
20884
20891
|
if (spatialReference.sourceCrs && spatialReference.targetCrs && !this.sourceIsGeocentric && !this.outputIsGeocentric) {
|
|
20885
|
-
this.horizontalProjection =
|
|
20892
|
+
this.horizontalProjection = projectionEngine.createProjection({
|
|
20886
20893
|
from: getHorizontalProjectionDefinition(spatialReference.sourceCrs),
|
|
20887
20894
|
to: getHorizontalProjectionDefinition(spatialReference.targetCrs),
|
|
20888
20895
|
enforceAxis: false
|
|
@@ -20890,14 +20897,14 @@ var init_spatial_coordinate_transformer = __esm({
|
|
|
20890
20897
|
}
|
|
20891
20898
|
if (requiresHeightTransformation(spatialReference) || this.sourceIsGeocentric || this.outputIsGeocentric) {
|
|
20892
20899
|
if (!this.sourceIsGeographic && !this.sourceIsGeocentric) {
|
|
20893
|
-
this.geographicProjection =
|
|
20900
|
+
this.geographicProjection = projectionEngine.createProjection({
|
|
20894
20901
|
from: getHorizontalProjectionDefinition(spatialReference.sourceCrs),
|
|
20895
20902
|
to: WGS84_GEOGRAPHIC_CRS,
|
|
20896
20903
|
enforceAxis: false
|
|
20897
20904
|
});
|
|
20898
20905
|
}
|
|
20899
20906
|
if (!this.outputIsGeographic && !this.outputIsGeocentric) {
|
|
20900
|
-
this.heightOutputProjection =
|
|
20907
|
+
this.heightOutputProjection = projectionEngine.createProjection({
|
|
20901
20908
|
from: WGS84_GEOGRAPHIC_CRS,
|
|
20902
20909
|
to: getHorizontalProjectionDefinition(outputCrs),
|
|
20903
20910
|
enforceAxis: false
|
|
@@ -20944,7 +20951,7 @@ var init_spatial_coordinate_transformer = __esm({
|
|
|
20944
20951
|
return result;
|
|
20945
20952
|
}
|
|
20946
20953
|
if (this.horizontalProjection) {
|
|
20947
|
-
const projected = this.horizontalProjection.
|
|
20954
|
+
const projected = this.horizontalProjection.projectSync(result.slice(0, 3));
|
|
20948
20955
|
result.splice(0, projected.length, ...projected);
|
|
20949
20956
|
}
|
|
20950
20957
|
return result;
|
|
@@ -21008,7 +21015,7 @@ var init_spatial_coordinate_transformer = __esm({
|
|
|
21008
21015
|
if (this.sourceIsGeographic) {
|
|
21009
21016
|
return coordinate.slice(0, 3);
|
|
21010
21017
|
}
|
|
21011
|
-
return this.geographicProjection.
|
|
21018
|
+
return this.geographicProjection.projectSync(coordinate.slice(0, 3));
|
|
21012
21019
|
}
|
|
21013
21020
|
/** Convert one conventional WGS84 geographic coordinate to the selected output CRS. */
|
|
21014
21021
|
fromGeographic(coordinate) {
|
|
@@ -21018,7 +21025,7 @@ var init_spatial_coordinate_transformer = __esm({
|
|
|
21018
21025
|
if (this.outputIsGeographic) {
|
|
21019
21026
|
return coordinate.slice(0, 3);
|
|
21020
21027
|
}
|
|
21021
|
-
return this.heightOutputProjection.
|
|
21028
|
+
return this.heightOutputProjection.projectSync(coordinate.slice(0, 3));
|
|
21022
21029
|
}
|
|
21023
21030
|
};
|
|
21024
21031
|
}
|
|
@@ -21026,7 +21033,6 @@ var init_spatial_coordinate_transformer = __esm({
|
|
|
21026
21033
|
|
|
21027
21034
|
// ../../modules/tiles/src/spatial/tiles-3d-spatial-transformer.ts
|
|
21028
21035
|
import { Matrix4 as Matrix43 } from "@math.gl/core";
|
|
21029
|
-
import { Ellipsoid as Ellipsoid3 } from "@math.gl/geospatial";
|
|
21030
21036
|
function getRegionSamples(region) {
|
|
21031
21037
|
if (region.length < 6 || region.some((value) => !Number.isFinite(value))) {
|
|
21032
21038
|
return [];
|
|
@@ -21131,7 +21137,6 @@ var init_tiles_3d_spatial_transformer = __esm({
|
|
|
21131
21137
|
"../../modules/tiles/src/spatial/tiles-3d-spatial-transformer.ts"() {
|
|
21132
21138
|
"use strict";
|
|
21133
21139
|
init_spatial_coordinate_transformer();
|
|
21134
|
-
init_get_spatial_coordinate_frame();
|
|
21135
21140
|
Tiles3DSpatialTransformer = class {
|
|
21136
21141
|
/** Normalized reference describing the completed operation. */
|
|
21137
21142
|
spatialReference;
|
|
@@ -21175,16 +21180,6 @@ var init_tiles_3d_spatial_transformer = __esm({
|
|
|
21175
21180
|
}
|
|
21176
21181
|
/** Transforms one WGS84 region sample into the selected output frame. */
|
|
21177
21182
|
transformRegionSample(sample) {
|
|
21178
|
-
const [longitudeDegrees, latitudeDegrees, height] = sample;
|
|
21179
|
-
const targetCrs = this.spatialReference.targetCrs || this.spatialReference.sourceCrs;
|
|
21180
|
-
if (targetCrs && getSpatialCoordinateFrame(targetCrs) === "geocentric") {
|
|
21181
|
-
const cartesian = Ellipsoid3.WGS84.cartographicToCartesian([
|
|
21182
|
-
longitudeDegrees,
|
|
21183
|
-
latitudeDegrees,
|
|
21184
|
-
height
|
|
21185
|
-
]);
|
|
21186
|
-
return Array.from(cartesian);
|
|
21187
|
-
}
|
|
21188
21183
|
return this.geographicCoordinateTransformer.transformPosition(sample);
|
|
21189
21184
|
}
|
|
21190
21185
|
};
|
|
@@ -21193,12 +21188,12 @@ var init_tiles_3d_spatial_transformer = __esm({
|
|
|
21193
21188
|
|
|
21194
21189
|
// ../../modules/tiles/src/tileset-3d/helpers/s2-bounding-volume.ts
|
|
21195
21190
|
import { getS2Bounds } from "@math.gl/dggs/s2";
|
|
21196
|
-
import { Ellipsoid as
|
|
21191
|
+
import { Ellipsoid as Ellipsoid3, makeOBBFromRegion as makeOBBFromRegion2 } from "@math.gl/geospatial";
|
|
21197
21192
|
function convertS2BoundingVolumeToOBB(s2VolumeInfo) {
|
|
21198
21193
|
const [[west, south], [east, north]] = getS2Bounds(s2VolumeInfo.token);
|
|
21199
21194
|
const orientedBoundingBox = makeOBBFromRegion2(
|
|
21200
21195
|
[west, south, east, north, s2VolumeInfo.minimumHeight, s2VolumeInfo.maximumHeight],
|
|
21201
|
-
|
|
21196
|
+
Ellipsoid3.WGS84,
|
|
21202
21197
|
{ units: "degrees" }
|
|
21203
21198
|
);
|
|
21204
21199
|
return [...orientedBoundingBox.center, ...orientedBoundingBox.halfAxes];
|
|
@@ -21264,7 +21259,7 @@ var init_implicit_tiling = __esm({
|
|
|
21264
21259
|
|
|
21265
21260
|
// ../../modules/tiles/src/spatial/i3s-spatial-transformer.ts
|
|
21266
21261
|
import { Matrix3 as Matrix33, Matrix4 as Matrix44, Quaternion as Quaternion3, Vector3 as Vector35 } from "@math.gl/core";
|
|
21267
|
-
import { Ellipsoid as
|
|
21262
|
+
import { Ellipsoid as Ellipsoid4 } from "@math.gl/geospatial";
|
|
21268
21263
|
function getElevationProvider(mode, options) {
|
|
21269
21264
|
return mode === "relativeToScene" ? options.sceneElevationProvider : requiresElevationSurface(mode) ? options.terrainElevationProvider : void 0;
|
|
21270
21265
|
}
|
|
@@ -21295,7 +21290,7 @@ function getGeographicBoundingSphere(geographicSamples) {
|
|
|
21295
21290
|
throw new Error("I3S spatial transformation requires at least one bound sample");
|
|
21296
21291
|
}
|
|
21297
21292
|
const cartesianSamples = geographicSamples.map(
|
|
21298
|
-
(position) =>
|
|
21293
|
+
(position) => Ellipsoid4.WGS84.cartographicToCartesian(new Vector35(position))
|
|
21299
21294
|
);
|
|
21300
21295
|
const cartesianCenter = new Vector35();
|
|
21301
21296
|
for (const sample of cartesianSamples) {
|
|
@@ -21306,7 +21301,7 @@ function getGeographicBoundingSphere(geographicSamples) {
|
|
|
21306
21301
|
for (const sample of cartesianSamples) {
|
|
21307
21302
|
radius = Math.max(radius, new Vector35(sample).subtract(cartesianCenter).magnitude());
|
|
21308
21303
|
}
|
|
21309
|
-
const geographicCenter =
|
|
21304
|
+
const geographicCenter = Ellipsoid4.WGS84.cartesianToCartographic(cartesianCenter);
|
|
21310
21305
|
return [geographicCenter[0], geographicCenter[1], geographicCenter[2], radius];
|
|
21311
21306
|
}
|
|
21312
21307
|
function getSourceBoundSamples(bounds, sourceFrame, sourceToGeographicTransformer, sourceVerticalUnitScale) {
|
|
@@ -21323,7 +21318,7 @@ function getSourceBoundSamples(bounds, sourceFrame, sourceToGeographicTransforme
|
|
|
21323
21318
|
];
|
|
21324
21319
|
if (sourceFrame === "geographic") {
|
|
21325
21320
|
const geographicCenter = sourceToGeographicTransformer.transformPosition(center2);
|
|
21326
|
-
const cartesianCenter =
|
|
21321
|
+
const cartesianCenter = Ellipsoid4.WGS84.cartographicToCartesian(
|
|
21327
21322
|
new Vector35(geographicCenter)
|
|
21328
21323
|
);
|
|
21329
21324
|
const cartesianAxes = bounds.normalReferenceFrame === "vertex-reference-frame" ? axes.map((axis) => localEnuVectorToEcef(axis, geographicCenter)) : axes;
|
|
@@ -21332,7 +21327,7 @@ function getSourceBoundSamples(bounds, sourceFrame, sourceToGeographicTransforme
|
|
|
21332
21327
|
for (let axisIndex = 0; axisIndex < 3; axisIndex++) {
|
|
21333
21328
|
corner.add(new Vector35(cartesianAxes[axisIndex]).scale(signs[axisIndex]));
|
|
21334
21329
|
}
|
|
21335
|
-
return Array.from(
|
|
21330
|
+
return Array.from(Ellipsoid4.WGS84.cartesianToCartographic(corner));
|
|
21336
21331
|
});
|
|
21337
21332
|
}
|
|
21338
21333
|
return getBoxSigns().map((signs) => {
|
|
@@ -21352,10 +21347,10 @@ function getSourceBoundSamples(bounds, sourceFrame, sourceToGeographicTransforme
|
|
|
21352
21347
|
const radius = mbs[3];
|
|
21353
21348
|
if (sourceFrame === "geographic") {
|
|
21354
21349
|
const geographicCenter = sourceToGeographicTransformer.transformPosition(center);
|
|
21355
|
-
const cartesianCenter =
|
|
21350
|
+
const cartesianCenter = Ellipsoid4.WGS84.cartographicToCartesian(new Vector35(geographicCenter));
|
|
21356
21351
|
return getAxisDirections().map(
|
|
21357
21352
|
(direction) => Array.from(
|
|
21358
|
-
|
|
21353
|
+
Ellipsoid4.WGS84.cartesianToCartographic(
|
|
21359
21354
|
new Vector35(cartesianCenter).add(new Vector35(direction).scale(radius))
|
|
21360
21355
|
)
|
|
21361
21356
|
)
|
|
@@ -21667,6 +21662,34 @@ var init_i3s_spatial_transformer = __esm({
|
|
|
21667
21662
|
placedPositions.subarray(sourcePositions.length)
|
|
21668
21663
|
);
|
|
21669
21664
|
}
|
|
21665
|
+
/**
|
|
21666
|
+
* Transforms conversion geometry without passing through renderer float32 offsets.
|
|
21667
|
+
* Positions and normals share one batch of elevation samples. Source arrays remain unchanged.
|
|
21668
|
+
* @param sourcePositions - Packed absolute xyz positions in source units.
|
|
21669
|
+
* @param normals - Optional packed normals paired with the positions.
|
|
21670
|
+
* @param normalReferenceFrame - I3S earth-centered or vertex-reference-frame declaration.
|
|
21671
|
+
* @returns Absolute target positions and optional transformed normals.
|
|
21672
|
+
*/
|
|
21673
|
+
async transformGeometryAsync(sourcePositions, normals, normalReferenceFrame = "earth-centered") {
|
|
21674
|
+
if (sourcePositions.length % 3 || normals && normals.length !== sourcePositions.length) {
|
|
21675
|
+
throw new Error("Conversion positions and normals must contain matching finite xyz triples");
|
|
21676
|
+
}
|
|
21677
|
+
for (let index = 0; index < sourcePositions.length; index++) {
|
|
21678
|
+
if (!Number.isFinite(sourcePositions[index]) || normals && !Number.isFinite(normals[index])) {
|
|
21679
|
+
throw new Error(
|
|
21680
|
+
"Conversion positions and normals must contain matching finite xyz triples"
|
|
21681
|
+
);
|
|
21682
|
+
}
|
|
21683
|
+
}
|
|
21684
|
+
if (!["earth-centered", "vertex-reference-frame"].includes(normalReferenceFrame)) {
|
|
21685
|
+
throw new Error("Unsupported I3S normal reference frame");
|
|
21686
|
+
}
|
|
21687
|
+
const placedPositions = await this.placeSourcePositions(sourcePositions);
|
|
21688
|
+
return {
|
|
21689
|
+
positions: this.positionTransformer.transformPositions(placedPositions),
|
|
21690
|
+
normals: normals ? this.transformNormals(normals, placedPositions, normalReferenceFrame) : void 0
|
|
21691
|
+
};
|
|
21692
|
+
}
|
|
21670
21693
|
/** Transform already placed positions into renderer-relative target coordinates. */
|
|
21671
21694
|
transformPlacedPositions(sourcePositions, sourceOrigin) {
|
|
21672
21695
|
const origin = this.transformPlacedPosition(sourceOrigin);
|
|
@@ -21704,7 +21727,19 @@ var init_i3s_spatial_transformer = __esm({
|
|
|
21704
21727
|
* @param normalReferenceFrame - I3S normal frame declaration.
|
|
21705
21728
|
*/
|
|
21706
21729
|
transformNormals(normals, sourcePositions, normalReferenceFrame = "earth-centered") {
|
|
21730
|
+
if (normals.length !== sourcePositions.length || normals.length % 3) {
|
|
21731
|
+
throw new Error("I3S normals and positions must have matching xyz component counts");
|
|
21732
|
+
}
|
|
21707
21733
|
const transformedNormals = new Float32Array(normals.length);
|
|
21734
|
+
if (normalReferenceFrame === "earth-centered" && (this.spatialReference.targetCrs || this.spatialReference.sourceCrs) === "EPSG:4978") {
|
|
21735
|
+
for (let index = 0; index < normals.length; index += 3) {
|
|
21736
|
+
const length = Math.hypot(normals[index], normals[index + 1], normals[index + 2]);
|
|
21737
|
+
for (let axis = 0; axis < 3; axis++) {
|
|
21738
|
+
transformedNormals[index + axis] = length ? normals[index + axis] / length : normals[index + axis];
|
|
21739
|
+
}
|
|
21740
|
+
}
|
|
21741
|
+
return transformedNormals;
|
|
21742
|
+
}
|
|
21708
21743
|
for (let index = 0; index < normals.length; index += 3) {
|
|
21709
21744
|
const geographic = this.sourceToGeographicTransformer.transformPosition([
|
|
21710
21745
|
sourcePositions[index],
|
|
@@ -21754,14 +21789,14 @@ var init_i3s_spatial_transformer = __esm({
|
|
|
21754
21789
|
/** Rebuild an I3S bound as a WGS84 ECEF box for generic `Tileset3D` traversal. */
|
|
21755
21790
|
transformBoundingVolumeToGeocentric(bounds) {
|
|
21756
21791
|
const cartesianSamples = this.getGeographicBoundSamples(bounds).map(
|
|
21757
|
-
(position) => Array.from(
|
|
21792
|
+
(position) => Array.from(Ellipsoid4.WGS84.cartographicToCartesian(new Vector35(position)))
|
|
21758
21793
|
);
|
|
21759
21794
|
return { box: getAxisAlignedBox(cartesianSamples) };
|
|
21760
21795
|
}
|
|
21761
21796
|
/** Rebuild an I3S bound as WGS84 ECEF after asynchronous elevation placement. */
|
|
21762
21797
|
async transformBoundingVolumeToGeocentricAsync(bounds) {
|
|
21763
21798
|
const cartesianSamples = (await this.getGeographicBoundSamplesAsync(bounds)).map(
|
|
21764
|
-
(position) => Array.from(
|
|
21799
|
+
(position) => Array.from(Ellipsoid4.WGS84.cartographicToCartesian(new Vector35(position)))
|
|
21765
21800
|
);
|
|
21766
21801
|
return { box: getAxisAlignedBox(cartesianSamples) };
|
|
21767
21802
|
}
|
|
@@ -21791,7 +21826,7 @@ var init_i3s_spatial_transformer = __esm({
|
|
|
21791
21826
|
async transformBoundsAsync(bounds) {
|
|
21792
21827
|
const geographicSamples = await this.getGeographicBoundSamplesAsync(bounds);
|
|
21793
21828
|
const cartesianSamples = geographicSamples.map(
|
|
21794
|
-
(position) => Array.from(
|
|
21829
|
+
(position) => Array.from(Ellipsoid4.WGS84.cartographicToCartesian(new Vector35(position)))
|
|
21795
21830
|
);
|
|
21796
21831
|
const targetSamples = geographicSamples.map(
|
|
21797
21832
|
(position) => this.geographicToTargetTransformer.transformPosition(position)
|
|
@@ -21950,13 +21985,13 @@ var init_i3s_spatial_transformer = __esm({
|
|
|
21950
21985
|
if (this.targetCoordinateFrame === "geographic") {
|
|
21951
21986
|
return ecefVectorToLocalEnu(ecefNormal, geographic).normalize();
|
|
21952
21987
|
}
|
|
21953
|
-
const cartesian =
|
|
21988
|
+
const cartesian = Ellipsoid4.WGS84.cartographicToCartesian(new Vector35(geographic));
|
|
21954
21989
|
const jacobianColumns = [];
|
|
21955
21990
|
for (const direction of getPositiveAxisDirections()) {
|
|
21956
|
-
const positiveGeographic =
|
|
21991
|
+
const positiveGeographic = Ellipsoid4.WGS84.cartesianToCartographic(
|
|
21957
21992
|
new Vector35(cartesian).add(direction)
|
|
21958
21993
|
);
|
|
21959
|
-
const negativeGeographic =
|
|
21994
|
+
const negativeGeographic = Ellipsoid4.WGS84.cartesianToCartographic(
|
|
21960
21995
|
new Vector35(cartesian).subtract(direction)
|
|
21961
21996
|
);
|
|
21962
21997
|
const positiveTarget = this.geographicToTargetTransformer.transformPosition(positiveGeographic);
|
|
@@ -23328,7 +23363,7 @@ var init_parse_3d_tile_batched_model = __esm({
|
|
|
23328
23363
|
|
|
23329
23364
|
// ../../modules/3d-tiles/src/lib/parsers/parse-3d-tile-instanced-model.ts
|
|
23330
23365
|
import { Vector3 as Vector39, Matrix3 as Matrix34, Matrix4 as Matrix45, Quaternion as Quaternion4 } from "@math.gl/core";
|
|
23331
|
-
import { Ellipsoid as
|
|
23366
|
+
import { Ellipsoid as Ellipsoid5 } from "@math.gl/geospatial";
|
|
23332
23367
|
import { GL as GL8, octDecodeInRange } from "@math.gl/geometry-utils";
|
|
23333
23368
|
async function parseInstancedModel3DTile(tile, arrayBuffer, byteOffset, options, context) {
|
|
23334
23369
|
byteOffset = parseInstancedModel(tile, arrayBuffer, byteOffset, options, context);
|
|
@@ -23462,7 +23497,7 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
|
|
|
23462
23497
|
tile.hasCustomOrientation = true;
|
|
23463
23498
|
hasCustomOrientation = true;
|
|
23464
23499
|
} else if (tile.eastNorthUp) {
|
|
23465
|
-
|
|
23500
|
+
Ellipsoid5.WGS84.eastNorthUpToFixedFrame(instancePosition, instanceTransform);
|
|
23466
23501
|
instanceTransform.getRotationMatrix3(instanceRotation);
|
|
23467
23502
|
} else {
|
|
23468
23503
|
instanceRotation.identity();
|
|
@@ -24243,7 +24278,7 @@ var init_parse_3d_tile_subtree = __esm({
|
|
|
24243
24278
|
|
|
24244
24279
|
// ../../modules/3d-tiles/src/lib/parsers/parse-3d-tiles-2-gltf.ts
|
|
24245
24280
|
import { Matrix4 as Matrix47 } from "@math.gl/core";
|
|
24246
|
-
import { Ellipsoid as
|
|
24281
|
+
import { Ellipsoid as Ellipsoid6 } from "@math.gl/geospatial";
|
|
24247
24282
|
function is3DTiles2Tileset(gltf) {
|
|
24248
24283
|
return isRecord4(gltf.json.extensions?.[TILESET_EXTENSION]);
|
|
24249
24284
|
}
|
|
@@ -25022,7 +25057,7 @@ function getGeoreferenceMatrix(longitudeDegrees, latitudeDegrees, height) {
|
|
|
25022
25057
|
const sinLongitude = Math.sin(longitude);
|
|
25023
25058
|
const cosLatitude = Math.cos(latitude);
|
|
25024
25059
|
const sinLatitude = Math.sin(latitude);
|
|
25025
|
-
const position =
|
|
25060
|
+
const position = Ellipsoid6.WGS84.cartographicToCartesian([longitude, latitude, height]);
|
|
25026
25061
|
return new Matrix47([
|
|
25027
25062
|
sinLongitude,
|
|
25028
25063
|
-cosLongitude,
|
|
@@ -27715,119 +27750,361 @@ var init_compression = __esm({
|
|
|
27715
27750
|
}
|
|
27716
27751
|
});
|
|
27717
27752
|
|
|
27718
|
-
// ../../modules/compression/src/lib/
|
|
27719
|
-
function
|
|
27720
|
-
|
|
27753
|
+
// ../../modules/compression/src/lib/decompression-stream.ts
|
|
27754
|
+
async function decompressWithNativeDecompressionStream(input, format) {
|
|
27755
|
+
const outputBatches = decompressBatchesWithNativeDecompressionStream([input], format);
|
|
27756
|
+
return outputBatches ? await concatenateNativeDecompressionBatches(outputBatches) : null;
|
|
27721
27757
|
}
|
|
27722
|
-
function
|
|
27723
|
-
|
|
27758
|
+
function decompressBatchesWithNativeDecompressionStream(inputBatches, format) {
|
|
27759
|
+
const decompressionStream = createNativeDecompressionStream(format);
|
|
27760
|
+
return decompressionStream ? transformBatchesWithNativeDecompressionStream(inputBatches, decompressionStream) : null;
|
|
27724
27761
|
}
|
|
27725
|
-
function
|
|
27726
|
-
return
|
|
27762
|
+
function isNativeDecompressionSupported(format) {
|
|
27763
|
+
return Boolean(createNativeDecompressionStream(format));
|
|
27727
27764
|
}
|
|
27728
|
-
|
|
27729
|
-
|
|
27730
|
-
|
|
27765
|
+
function createNativeDecompressionStream(format) {
|
|
27766
|
+
if (typeof globalThis.DecompressionStream === "undefined") {
|
|
27767
|
+
return null;
|
|
27768
|
+
}
|
|
27769
|
+
if (globalThis.process?.release?.name === "node" && typeof globalThis.Buffer === "undefined") {
|
|
27770
|
+
return null;
|
|
27771
|
+
}
|
|
27772
|
+
try {
|
|
27773
|
+
const DecompressionStreamConstructor = globalThis.DecompressionStream;
|
|
27774
|
+
return new DecompressionStreamConstructor(format);
|
|
27775
|
+
} catch (error) {
|
|
27776
|
+
if (error instanceof TypeError || error?.name === "TypeError") {
|
|
27777
|
+
return null;
|
|
27778
|
+
}
|
|
27779
|
+
throw error;
|
|
27780
|
+
}
|
|
27781
|
+
}
|
|
27782
|
+
async function* transformBatchesWithNativeDecompressionStream(inputBatches, decompressionStream) {
|
|
27783
|
+
const writer = decompressionStream.writable.getWriter();
|
|
27784
|
+
const reader = decompressionStream.readable.getReader();
|
|
27785
|
+
const writePromise = writeBatchesToNativeDecompressionStream(inputBatches, writer);
|
|
27786
|
+
writePromise.catch(() => {
|
|
27787
|
+
});
|
|
27788
|
+
let outputCompleted = false;
|
|
27789
|
+
try {
|
|
27790
|
+
while (true) {
|
|
27791
|
+
const { done, value } = await reader.read();
|
|
27792
|
+
if (done) {
|
|
27793
|
+
outputCompleted = true;
|
|
27794
|
+
break;
|
|
27795
|
+
}
|
|
27796
|
+
yield copyExactArrayBuffer(value);
|
|
27797
|
+
}
|
|
27798
|
+
await writePromise;
|
|
27799
|
+
} finally {
|
|
27800
|
+
if (!outputCompleted) {
|
|
27801
|
+
await reader.cancel().catch(() => {
|
|
27802
|
+
});
|
|
27803
|
+
await writer.abort().catch(() => {
|
|
27804
|
+
});
|
|
27805
|
+
await writePromise.catch(() => {
|
|
27806
|
+
});
|
|
27807
|
+
}
|
|
27808
|
+
reader.releaseLock();
|
|
27809
|
+
}
|
|
27810
|
+
}
|
|
27811
|
+
async function concatenateNativeDecompressionBatches(outputBatches) {
|
|
27812
|
+
const batches = [];
|
|
27813
|
+
let byteLength = 0;
|
|
27814
|
+
for await (const outputBatch of outputBatches) {
|
|
27815
|
+
const bytes = new Uint8Array(outputBatch);
|
|
27816
|
+
batches.push(bytes);
|
|
27817
|
+
byteLength += bytes.byteLength;
|
|
27818
|
+
}
|
|
27819
|
+
const output = new Uint8Array(byteLength);
|
|
27820
|
+
let byteOffset = 0;
|
|
27821
|
+
for (const batch of batches) {
|
|
27822
|
+
output.set(batch, byteOffset);
|
|
27823
|
+
byteOffset += batch.byteLength;
|
|
27824
|
+
}
|
|
27825
|
+
return output.buffer;
|
|
27826
|
+
}
|
|
27827
|
+
function copyExactArrayBuffer(value) {
|
|
27828
|
+
return new Uint8Array(value).buffer;
|
|
27829
|
+
}
|
|
27830
|
+
async function writeBatchesToNativeDecompressionStream(inputBatches, writer) {
|
|
27831
|
+
try {
|
|
27832
|
+
for await (const inputBatch of inputBatches) {
|
|
27833
|
+
await writer.write(new Uint8Array(inputBatch));
|
|
27834
|
+
}
|
|
27835
|
+
await writer.close();
|
|
27836
|
+
} catch (error) {
|
|
27837
|
+
await writer.abort(error).catch(() => {
|
|
27838
|
+
});
|
|
27839
|
+
throw error;
|
|
27840
|
+
}
|
|
27841
|
+
}
|
|
27842
|
+
var init_decompression_stream = __esm({
|
|
27843
|
+
"../../modules/compression/src/lib/decompression-stream.ts"() {
|
|
27731
27844
|
"use strict";
|
|
27732
|
-
|
|
27733
|
-
|
|
27734
|
-
|
|
27735
|
-
|
|
27736
|
-
|
|
27737
|
-
|
|
27738
|
-
|
|
27739
|
-
|
|
27740
|
-
|
|
27741
|
-
|
|
27742
|
-
|
|
27743
|
-
|
|
27744
|
-
|
|
27745
|
-
|
|
27746
|
-
|
|
27747
|
-
|
|
27748
|
-
|
|
27749
|
-
|
|
27750
|
-
|
|
27751
|
-
|
|
27752
|
-
|
|
27753
|
-
|
|
27754
|
-
|
|
27755
|
-
|
|
27756
|
-
|
|
27757
|
-
|
|
27758
|
-
|
|
27759
|
-
4,
|
|
27760
|
-
5,
|
|
27761
|
-
5,
|
|
27762
|
-
5,
|
|
27763
|
-
5,
|
|
27764
|
-
0,
|
|
27765
|
-
/* unused */
|
|
27766
|
-
0,
|
|
27767
|
-
0,
|
|
27768
|
-
/* impossible */
|
|
27769
|
-
0
|
|
27770
|
-
]);
|
|
27771
|
-
fdeb = new u8([
|
|
27772
|
-
0,
|
|
27773
|
-
0,
|
|
27774
|
-
0,
|
|
27775
|
-
0,
|
|
27776
|
-
1,
|
|
27777
|
-
1,
|
|
27778
|
-
2,
|
|
27779
|
-
2,
|
|
27780
|
-
3,
|
|
27781
|
-
3,
|
|
27782
|
-
4,
|
|
27783
|
-
4,
|
|
27784
|
-
5,
|
|
27785
|
-
5,
|
|
27786
|
-
6,
|
|
27787
|
-
6,
|
|
27788
|
-
7,
|
|
27789
|
-
7,
|
|
27790
|
-
8,
|
|
27791
|
-
8,
|
|
27792
|
-
9,
|
|
27793
|
-
9,
|
|
27794
|
-
10,
|
|
27795
|
-
10,
|
|
27796
|
-
11,
|
|
27797
|
-
11,
|
|
27798
|
-
12,
|
|
27799
|
-
12,
|
|
27800
|
-
13,
|
|
27801
|
-
13,
|
|
27802
|
-
/* unused */
|
|
27803
|
-
0,
|
|
27804
|
-
0
|
|
27805
|
-
]);
|
|
27806
|
-
clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
|
|
27807
|
-
freb = (eb, start) => {
|
|
27808
|
-
const b = new u16(31);
|
|
27809
|
-
for (let i = 0; i < 31; ++i) {
|
|
27810
|
-
b[i] = start += 1 << eb[i - 1];
|
|
27845
|
+
}
|
|
27846
|
+
});
|
|
27847
|
+
|
|
27848
|
+
// ../../modules/compression/src/lib/native-decompressor.ts
|
|
27849
|
+
var native_decompressor_exports = {};
|
|
27850
|
+
__export(native_decompressor_exports, {
|
|
27851
|
+
NativeDecompressor: () => NativeDecompressor
|
|
27852
|
+
});
|
|
27853
|
+
var NativeDecompressor;
|
|
27854
|
+
var init_native_decompressor = __esm({
|
|
27855
|
+
"../../modules/compression/src/lib/native-decompressor.ts"() {
|
|
27856
|
+
"use strict";
|
|
27857
|
+
init_compression();
|
|
27858
|
+
init_decompression_stream();
|
|
27859
|
+
NativeDecompressor = class extends Decompressor {
|
|
27860
|
+
name;
|
|
27861
|
+
extensions;
|
|
27862
|
+
contentEncodings;
|
|
27863
|
+
isSupported = true;
|
|
27864
|
+
/** Runtime stream format used for every operation. */
|
|
27865
|
+
format;
|
|
27866
|
+
constructor(metadata, format, options = {}) {
|
|
27867
|
+
super(options);
|
|
27868
|
+
this.name = metadata.name;
|
|
27869
|
+
this.extensions = [...metadata.extensions];
|
|
27870
|
+
this.contentEncodings = [...metadata.contentEncodings];
|
|
27871
|
+
this.format = format;
|
|
27811
27872
|
}
|
|
27812
|
-
|
|
27813
|
-
|
|
27814
|
-
|
|
27815
|
-
|
|
27816
|
-
|
|
27873
|
+
/** Decompresses one buffer with the runtime-provided stream. */
|
|
27874
|
+
async decompress(input) {
|
|
27875
|
+
const output = await decompressWithNativeDecompressionStream(input, this.format);
|
|
27876
|
+
if (!output) throw new Error(`${this.name}: built-in decompression is no longer available`);
|
|
27877
|
+
return output;
|
|
27878
|
+
}
|
|
27879
|
+
/** Decompresses batches incrementally with the runtime-provided stream. */
|
|
27880
|
+
async *decompressBatches(inputBatches) {
|
|
27881
|
+
const output = decompressBatchesWithNativeDecompressionStream(inputBatches, this.format);
|
|
27882
|
+
if (!output) throw new Error(`${this.name}: built-in decompression is no longer available`);
|
|
27883
|
+
yield* output;
|
|
27817
27884
|
}
|
|
27818
|
-
return [b, r];
|
|
27819
27885
|
};
|
|
27820
|
-
|
|
27821
|
-
|
|
27822
|
-
|
|
27823
|
-
|
|
27824
|
-
|
|
27825
|
-
|
|
27826
|
-
|
|
27827
|
-
|
|
27828
|
-
|
|
27829
|
-
|
|
27830
|
-
|
|
27886
|
+
}
|
|
27887
|
+
});
|
|
27888
|
+
|
|
27889
|
+
// ../../modules/compression/src/lib/lazy-compression.ts
|
|
27890
|
+
function mergeModules(options, modules) {
|
|
27891
|
+
return { ...options, modules: { ...options.modules, ...modules } };
|
|
27892
|
+
}
|
|
27893
|
+
var LazyDecompressor;
|
|
27894
|
+
var init_lazy_compression = __esm({
|
|
27895
|
+
"../../modules/compression/src/lib/lazy-compression.ts"() {
|
|
27896
|
+
"use strict";
|
|
27897
|
+
init_compression();
|
|
27898
|
+
init_decompression_stream();
|
|
27899
|
+
LazyDecompressor = class extends Decompressor {
|
|
27900
|
+
name;
|
|
27901
|
+
extensions;
|
|
27902
|
+
contentEncodings;
|
|
27903
|
+
isSupported = true;
|
|
27904
|
+
/** Constructor options retained until a concrete implementation is selected. */
|
|
27905
|
+
options;
|
|
27906
|
+
/** Built-in stream format to probe, or null when the format has no built-in path. */
|
|
27907
|
+
nativeFormat;
|
|
27908
|
+
/** Returns whether built-in selection remains eligible for the merged preload options. */
|
|
27909
|
+
shouldUseNative;
|
|
27910
|
+
/** Dynamically imports the balanced fallback constructor. */
|
|
27911
|
+
loadFallback;
|
|
27912
|
+
/** Selected concrete implementation after preload completes. */
|
|
27913
|
+
implementation = null;
|
|
27914
|
+
/** Shared in-flight selection used by concurrent asynchronous calls. */
|
|
27915
|
+
implementationPromise = null;
|
|
27916
|
+
constructor(metadata, loadFallback, options = {}, nativeFormat = null, shouldUseNative = () => true) {
|
|
27917
|
+
super(options);
|
|
27918
|
+
this.name = metadata.name;
|
|
27919
|
+
this.extensions = [...metadata.extensions];
|
|
27920
|
+
this.contentEncodings = [...metadata.contentEncodings];
|
|
27921
|
+
this.options = options;
|
|
27922
|
+
this.nativeFormat = nativeFormat;
|
|
27923
|
+
this.shouldUseNative = shouldUseNative;
|
|
27924
|
+
this.loadFallback = loadFallback;
|
|
27925
|
+
}
|
|
27926
|
+
/** Selects and returns the built-in or dynamically imported fallback decompressor. */
|
|
27927
|
+
async preload(modules = {}) {
|
|
27928
|
+
if (this.implementation) return this.implementation;
|
|
27929
|
+
const options = mergeModules(this.options, modules);
|
|
27930
|
+
this.implementationPromise ||= this.loadImplementation(options);
|
|
27931
|
+
try {
|
|
27932
|
+
this.implementation = await this.implementationPromise;
|
|
27933
|
+
return this.implementation;
|
|
27934
|
+
} catch (error) {
|
|
27935
|
+
this.implementationPromise = null;
|
|
27936
|
+
throw error;
|
|
27937
|
+
}
|
|
27938
|
+
}
|
|
27939
|
+
/** Loads the selected concrete decompressor. */
|
|
27940
|
+
async loadImplementation(options) {
|
|
27941
|
+
if (options.useNative !== false && this.nativeFormat && this.shouldUseNative(options) && isNativeDecompressionSupported(this.nativeFormat)) {
|
|
27942
|
+
const { NativeDecompressor: NativeDecompressor2 } = await Promise.resolve().then(() => (init_native_decompressor(), native_decompressor_exports));
|
|
27943
|
+
return new NativeDecompressor2(this, this.nativeFormat, options);
|
|
27944
|
+
}
|
|
27945
|
+
const Decompressor2 = await this.loadFallback();
|
|
27946
|
+
const implementation = new Decompressor2({ ...options, useNative: false });
|
|
27947
|
+
await implementation.preload(options.modules);
|
|
27948
|
+
return implementation;
|
|
27949
|
+
}
|
|
27950
|
+
/** Decompresses after lazily selecting the default implementation. */
|
|
27951
|
+
async decompress(input, size) {
|
|
27952
|
+
return (await this.preload()).decompress(input, size);
|
|
27953
|
+
}
|
|
27954
|
+
/** Decompresses synchronously after an implementation has been preloaded. */
|
|
27955
|
+
decompressSync(input, size) {
|
|
27956
|
+
if (!this.implementation) {
|
|
27957
|
+
throw new Error(`${this.name}: call preload() before decompressSync()`);
|
|
27958
|
+
}
|
|
27959
|
+
return this.implementation.decompressSync(input, size);
|
|
27960
|
+
}
|
|
27961
|
+
/** Decompresses batches after lazily selecting the default implementation. */
|
|
27962
|
+
async *decompressBatches(inputBatches) {
|
|
27963
|
+
yield* (await this.preload()).decompressBatches(inputBatches);
|
|
27964
|
+
}
|
|
27965
|
+
};
|
|
27966
|
+
}
|
|
27967
|
+
});
|
|
27968
|
+
|
|
27969
|
+
// ../../modules/compression/src/no-decompressor.ts
|
|
27970
|
+
var no_decompressor_exports = {};
|
|
27971
|
+
__export(no_decompressor_exports, {
|
|
27972
|
+
NoDecompressor: () => NoDecompressor
|
|
27973
|
+
});
|
|
27974
|
+
var NoDecompressor;
|
|
27975
|
+
var init_no_decompressor = __esm({
|
|
27976
|
+
"../../modules/compression/src/no-decompressor.ts"() {
|
|
27977
|
+
"use strict";
|
|
27978
|
+
init_compression();
|
|
27979
|
+
NoDecompressor = class extends Decompressor {
|
|
27980
|
+
name = "uncompressed";
|
|
27981
|
+
extensions = [];
|
|
27982
|
+
contentEncodings = [];
|
|
27983
|
+
isSupported = true;
|
|
27984
|
+
constructor(options = {}) {
|
|
27985
|
+
super(options);
|
|
27986
|
+
}
|
|
27987
|
+
/** Returns the input without modification. */
|
|
27988
|
+
decompressSync(input) {
|
|
27989
|
+
return input;
|
|
27990
|
+
}
|
|
27991
|
+
};
|
|
27992
|
+
}
|
|
27993
|
+
});
|
|
27994
|
+
|
|
27995
|
+
// ../../modules/compression/src/lib/fflate/index.ts
|
|
27996
|
+
function inflateSync(data, out) {
|
|
27997
|
+
return inflt(data, out);
|
|
27998
|
+
}
|
|
27999
|
+
function gunzipSync(data, out) {
|
|
28000
|
+
return inflt(data.subarray(gzs(data), -8), out || new u8(gzl(data)));
|
|
28001
|
+
}
|
|
28002
|
+
function unzlibSync(data, out) {
|
|
28003
|
+
return inflt((zlv(data), data.subarray(2, -4)), out);
|
|
28004
|
+
}
|
|
28005
|
+
var u8, u16, u32, fleb, fdeb, clim, freb, fl, revfl, fd, revfd, rev, hMap, flt, fdt, flrm, fdrm, max, bits, bits16, shft, slc, ec, err, inflt, gzs, gzl, zlv, Inflate, Gunzip, Unzlib;
|
|
28006
|
+
var init_fflate = __esm({
|
|
28007
|
+
"../../modules/compression/src/lib/fflate/index.ts"() {
|
|
28008
|
+
"use strict";
|
|
28009
|
+
u8 = Uint8Array;
|
|
28010
|
+
u16 = Uint16Array;
|
|
28011
|
+
u32 = Uint32Array;
|
|
28012
|
+
fleb = new u8([
|
|
28013
|
+
0,
|
|
28014
|
+
0,
|
|
28015
|
+
0,
|
|
28016
|
+
0,
|
|
28017
|
+
0,
|
|
28018
|
+
0,
|
|
28019
|
+
0,
|
|
28020
|
+
0,
|
|
28021
|
+
1,
|
|
28022
|
+
1,
|
|
28023
|
+
1,
|
|
28024
|
+
1,
|
|
28025
|
+
2,
|
|
28026
|
+
2,
|
|
28027
|
+
2,
|
|
28028
|
+
2,
|
|
28029
|
+
3,
|
|
28030
|
+
3,
|
|
28031
|
+
3,
|
|
28032
|
+
3,
|
|
28033
|
+
4,
|
|
28034
|
+
4,
|
|
28035
|
+
4,
|
|
28036
|
+
4,
|
|
28037
|
+
5,
|
|
28038
|
+
5,
|
|
28039
|
+
5,
|
|
28040
|
+
5,
|
|
28041
|
+
0,
|
|
28042
|
+
/* unused */
|
|
28043
|
+
0,
|
|
28044
|
+
0,
|
|
28045
|
+
/* impossible */
|
|
28046
|
+
0
|
|
28047
|
+
]);
|
|
28048
|
+
fdeb = new u8([
|
|
28049
|
+
0,
|
|
28050
|
+
0,
|
|
28051
|
+
0,
|
|
28052
|
+
0,
|
|
28053
|
+
1,
|
|
28054
|
+
1,
|
|
28055
|
+
2,
|
|
28056
|
+
2,
|
|
28057
|
+
3,
|
|
28058
|
+
3,
|
|
28059
|
+
4,
|
|
28060
|
+
4,
|
|
28061
|
+
5,
|
|
28062
|
+
5,
|
|
28063
|
+
6,
|
|
28064
|
+
6,
|
|
28065
|
+
7,
|
|
28066
|
+
7,
|
|
28067
|
+
8,
|
|
28068
|
+
8,
|
|
28069
|
+
9,
|
|
28070
|
+
9,
|
|
28071
|
+
10,
|
|
28072
|
+
10,
|
|
28073
|
+
11,
|
|
28074
|
+
11,
|
|
28075
|
+
12,
|
|
28076
|
+
12,
|
|
28077
|
+
13,
|
|
28078
|
+
13,
|
|
28079
|
+
/* unused */
|
|
28080
|
+
0,
|
|
28081
|
+
0
|
|
28082
|
+
]);
|
|
28083
|
+
clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
|
|
28084
|
+
freb = (eb, start) => {
|
|
28085
|
+
const b = new u16(31);
|
|
28086
|
+
for (let i = 0; i < 31; ++i) {
|
|
28087
|
+
b[i] = start += 1 << eb[i - 1];
|
|
28088
|
+
}
|
|
28089
|
+
const r = new u32(b[30]);
|
|
28090
|
+
for (let i = 1; i < 30; ++i) {
|
|
28091
|
+
for (let j = b[i]; j < b[i + 1]; ++j) {
|
|
28092
|
+
r[j] = j - b[i] << 5 | i;
|
|
28093
|
+
}
|
|
28094
|
+
}
|
|
28095
|
+
return [b, r];
|
|
28096
|
+
};
|
|
28097
|
+
[fl, revfl] = freb(fleb, 2);
|
|
28098
|
+
fl[28] = 258, revfl[258] = 28;
|
|
28099
|
+
[fd, revfd] = freb(fdeb, 0);
|
|
28100
|
+
rev = new u16(32768);
|
|
28101
|
+
for (let i = 0; i < 32768; ++i) {
|
|
28102
|
+
let x = (i & 43690) >>> 1 | (i & 21845) << 1;
|
|
28103
|
+
x = (x & 52428) >>> 2 | (x & 13107) << 2;
|
|
28104
|
+
x = (x & 61680) >>> 4 | (x & 3855) << 4;
|
|
28105
|
+
rev[i] = ((x & 65280) >>> 8 | (x & 255) << 8) >>> 1;
|
|
28106
|
+
}
|
|
28107
|
+
hMap = (cd, mb, r) => {
|
|
27831
28108
|
const s = cd.length;
|
|
27832
28109
|
let i = 0;
|
|
27833
28110
|
const l = new u16(mb);
|
|
@@ -28030,374 +28307,132 @@ var init_fflate = __esm({
|
|
|
28030
28307
|
buf[bt + 1] = buf[bt + 1 - dt];
|
|
28031
28308
|
buf[bt + 2] = buf[bt + 2 - dt];
|
|
28032
28309
|
buf[bt + 3] = buf[bt + 3 - dt];
|
|
28033
|
-
}
|
|
28034
|
-
bt = end;
|
|
28035
|
-
}
|
|
28036
|
-
}
|
|
28037
|
-
st.l = lm, st.p = lpos, st.b = bt, st.f = final;
|
|
28038
|
-
if (lm) final = 1, st.m = lbt, st.d = dm, st.n = dbt;
|
|
28039
|
-
} while (!final);
|
|
28040
|
-
return bt == buf.length ? buf : slc(buf, 0, bt);
|
|
28041
|
-
};
|
|
28042
|
-
gzs = (d) => {
|
|
28043
|
-
if (d[0] != 31 || d[1] != 139 || d[2] != 8) err(6, "invalid gzip data");
|
|
28044
|
-
const flg = d[3];
|
|
28045
|
-
let st = 10;
|
|
28046
|
-
if (flg & 4) st += d[10] | (d[11] << 8) + 2;
|
|
28047
|
-
for (let zs = (flg >> 3 & 1) + (flg >> 4 & 1); zs > 0; zs -= !d[st++]) ;
|
|
28048
|
-
return st + (flg & 2);
|
|
28049
|
-
};
|
|
28050
|
-
gzl = (d) => {
|
|
28051
|
-
const l = d.length;
|
|
28052
|
-
return (d[l - 4] | d[l - 3] << 8 | d[l - 2] << 16 | d[l - 1] << 24) >>> 0;
|
|
28053
|
-
};
|
|
28054
|
-
zlv = (d) => {
|
|
28055
|
-
if ((d[0] & 15) != 8 || d[0] >>> 4 > 7 || (d[0] << 8 | d[1]) % 31) err(6, "invalid zlib data");
|
|
28056
|
-
if (d[1] & 32) err(6, "invalid zlib data: preset dictionaries not supported");
|
|
28057
|
-
};
|
|
28058
|
-
Inflate = class {
|
|
28059
|
-
/**
|
|
28060
|
-
* Creates an inflation stream
|
|
28061
|
-
* @param cb The callback to call whenever data is inflated
|
|
28062
|
-
*/
|
|
28063
|
-
constructor(cb) {
|
|
28064
|
-
this.ondata = cb;
|
|
28065
|
-
}
|
|
28066
|
-
/** Persistent bit-reader and Huffman decoding state. */
|
|
28067
|
-
s = {};
|
|
28068
|
-
/** Compression options or retained output window for this stream. */
|
|
28069
|
-
o;
|
|
28070
|
-
/** Compressed bytes pending decoding. */
|
|
28071
|
-
p = new u8(0);
|
|
28072
|
-
/** Whether the stream has received its final chunk. */
|
|
28073
|
-
d;
|
|
28074
|
-
/**
|
|
28075
|
-
* The handler to call whenever data is available
|
|
28076
|
-
*/
|
|
28077
|
-
ondata;
|
|
28078
|
-
/** Appends pending input after checking stream lifecycle. */
|
|
28079
|
-
e(c) {
|
|
28080
|
-
if (!this.ondata) err(5);
|
|
28081
|
-
if (this.d) err(4);
|
|
28082
|
-
const l = this.p.length;
|
|
28083
|
-
const n = new u8(l + c.length);
|
|
28084
|
-
n.set(this.p), n.set(c, l), this.p = n;
|
|
28085
|
-
}
|
|
28086
|
-
/** Decodes pending input and retains the sliding window. */
|
|
28087
|
-
c(final) {
|
|
28088
|
-
this.d = this.s.i = final || false;
|
|
28089
|
-
const bts = this.s.b;
|
|
28090
|
-
const dt = inflt(this.p, this.o, this.s);
|
|
28091
|
-
this.ondata(slc(dt, bts, this.s.b), this.d);
|
|
28092
|
-
this.o = slc(dt, this.s.b - 32768), this.s.b = this.o.length;
|
|
28093
|
-
this.p = slc(this.p, this.s.p / 8 | 0), this.s.p &= 7;
|
|
28094
|
-
}
|
|
28095
|
-
/**
|
|
28096
|
-
* Pushes a chunk to be inflated
|
|
28097
|
-
* @param chunk The chunk to push
|
|
28098
|
-
* @param final Whether this is the final chunk
|
|
28099
|
-
*/
|
|
28100
|
-
push(chunk, final) {
|
|
28101
|
-
this.e(chunk), this.c(final);
|
|
28102
|
-
}
|
|
28103
|
-
};
|
|
28104
|
-
Gunzip = class extends Inflate {
|
|
28105
|
-
/** Whether the stream header still needs to be emitted or consumed. */
|
|
28106
|
-
v = 1;
|
|
28107
|
-
/**
|
|
28108
|
-
* Creates a GUNZIP stream
|
|
28109
|
-
* @param cb The callback to call whenever data is inflated
|
|
28110
|
-
*/
|
|
28111
|
-
constructor(cb) {
|
|
28112
|
-
super(cb);
|
|
28113
|
-
}
|
|
28114
|
-
/**
|
|
28115
|
-
* Pushes a chunk to be GUNZIPped
|
|
28116
|
-
* @param chunk The chunk to push
|
|
28117
|
-
* @param final Whether this is the last chunk
|
|
28118
|
-
*/
|
|
28119
|
-
push(chunk, final) {
|
|
28120
|
-
Inflate.prototype.e.call(this, chunk);
|
|
28121
|
-
if (this.v) {
|
|
28122
|
-
const s = this.p.length > 3 ? gzs(this.p) : 4;
|
|
28123
|
-
if (s >= this.p.length && !final) return;
|
|
28124
|
-
this.p = this.p.subarray(s), this.v = 0;
|
|
28125
|
-
}
|
|
28126
|
-
if (final) {
|
|
28127
|
-
if (this.p.length < 8) err(6, "invalid gzip data");
|
|
28128
|
-
this.p = this.p.subarray(0, -8);
|
|
28129
|
-
}
|
|
28130
|
-
Inflate.prototype.c.call(this, final);
|
|
28131
|
-
}
|
|
28132
|
-
};
|
|
28133
|
-
Unzlib = class extends Inflate {
|
|
28134
|
-
/** Whether the stream header still needs to be emitted or consumed. */
|
|
28135
|
-
v = 1;
|
|
28136
|
-
/**
|
|
28137
|
-
* Creates a Zlib decompression stream
|
|
28138
|
-
* @param cb The callback to call whenever data is inflated
|
|
28139
|
-
*/
|
|
28140
|
-
constructor(cb) {
|
|
28141
|
-
super(cb);
|
|
28142
|
-
}
|
|
28143
|
-
/**
|
|
28144
|
-
* Pushes a chunk to be unzlibbed
|
|
28145
|
-
* @param chunk The chunk to push
|
|
28146
|
-
* @param final Whether this is the last chunk
|
|
28147
|
-
*/
|
|
28148
|
-
push(chunk, final) {
|
|
28149
|
-
Inflate.prototype.e.call(this, chunk);
|
|
28150
|
-
if (this.v) {
|
|
28151
|
-
if (this.p.length < 2 && !final) return;
|
|
28152
|
-
this.p = this.p.subarray(2), this.v = 0;
|
|
28153
|
-
}
|
|
28154
|
-
if (final) {
|
|
28155
|
-
if (this.p.length < 4) err(6, "invalid zlib data");
|
|
28156
|
-
this.p = this.p.subarray(0, -4);
|
|
28157
|
-
}
|
|
28158
|
-
Inflate.prototype.c.call(this, final);
|
|
28159
|
-
}
|
|
28160
|
-
};
|
|
28161
|
-
}
|
|
28162
|
-
});
|
|
28163
|
-
|
|
28164
|
-
// ../../modules/compression/src/lib/decompression-stream.ts
|
|
28165
|
-
async function decompressWithNativeDecompressionStream(input, format) {
|
|
28166
|
-
const outputBatches = decompressBatchesWithNativeDecompressionStream([input], format);
|
|
28167
|
-
return outputBatches ? await concatenateNativeDecompressionBatches(outputBatches) : null;
|
|
28168
|
-
}
|
|
28169
|
-
function decompressBatchesWithNativeDecompressionStream(inputBatches, format) {
|
|
28170
|
-
const decompressionStream = createNativeDecompressionStream(format);
|
|
28171
|
-
return decompressionStream ? transformBatchesWithNativeDecompressionStream(inputBatches, decompressionStream) : null;
|
|
28172
|
-
}
|
|
28173
|
-
function isNativeDecompressionSupported(format) {
|
|
28174
|
-
return Boolean(createNativeDecompressionStream(format));
|
|
28175
|
-
}
|
|
28176
|
-
function createNativeDecompressionStream(format) {
|
|
28177
|
-
if (typeof globalThis.DecompressionStream === "undefined") {
|
|
28178
|
-
return null;
|
|
28179
|
-
}
|
|
28180
|
-
if (globalThis.process?.release?.name === "node" && typeof globalThis.Buffer === "undefined") {
|
|
28181
|
-
return null;
|
|
28182
|
-
}
|
|
28183
|
-
try {
|
|
28184
|
-
const DecompressionStreamConstructor = globalThis.DecompressionStream;
|
|
28185
|
-
return new DecompressionStreamConstructor(format);
|
|
28186
|
-
} catch (error) {
|
|
28187
|
-
if (error instanceof TypeError || error?.name === "TypeError") {
|
|
28188
|
-
return null;
|
|
28189
|
-
}
|
|
28190
|
-
throw error;
|
|
28191
|
-
}
|
|
28192
|
-
}
|
|
28193
|
-
async function* transformBatchesWithNativeDecompressionStream(inputBatches, decompressionStream) {
|
|
28194
|
-
const writer = decompressionStream.writable.getWriter();
|
|
28195
|
-
const reader = decompressionStream.readable.getReader();
|
|
28196
|
-
const writePromise = writeBatchesToNativeDecompressionStream(inputBatches, writer);
|
|
28197
|
-
writePromise.catch(() => {
|
|
28198
|
-
});
|
|
28199
|
-
let outputCompleted = false;
|
|
28200
|
-
try {
|
|
28201
|
-
while (true) {
|
|
28202
|
-
const { done, value } = await reader.read();
|
|
28203
|
-
if (done) {
|
|
28204
|
-
outputCompleted = true;
|
|
28205
|
-
break;
|
|
28206
|
-
}
|
|
28207
|
-
yield copyExactArrayBuffer(value);
|
|
28208
|
-
}
|
|
28209
|
-
await writePromise;
|
|
28210
|
-
} finally {
|
|
28211
|
-
if (!outputCompleted) {
|
|
28212
|
-
await reader.cancel().catch(() => {
|
|
28213
|
-
});
|
|
28214
|
-
await writer.abort().catch(() => {
|
|
28215
|
-
});
|
|
28216
|
-
await writePromise.catch(() => {
|
|
28217
|
-
});
|
|
28218
|
-
}
|
|
28219
|
-
reader.releaseLock();
|
|
28220
|
-
}
|
|
28221
|
-
}
|
|
28222
|
-
async function concatenateNativeDecompressionBatches(outputBatches) {
|
|
28223
|
-
const batches = [];
|
|
28224
|
-
let byteLength = 0;
|
|
28225
|
-
for await (const outputBatch of outputBatches) {
|
|
28226
|
-
const bytes = new Uint8Array(outputBatch);
|
|
28227
|
-
batches.push(bytes);
|
|
28228
|
-
byteLength += bytes.byteLength;
|
|
28229
|
-
}
|
|
28230
|
-
const output = new Uint8Array(byteLength);
|
|
28231
|
-
let byteOffset = 0;
|
|
28232
|
-
for (const batch of batches) {
|
|
28233
|
-
output.set(batch, byteOffset);
|
|
28234
|
-
byteOffset += batch.byteLength;
|
|
28235
|
-
}
|
|
28236
|
-
return output.buffer;
|
|
28237
|
-
}
|
|
28238
|
-
function copyExactArrayBuffer(value) {
|
|
28239
|
-
return new Uint8Array(value).buffer;
|
|
28240
|
-
}
|
|
28241
|
-
async function writeBatchesToNativeDecompressionStream(inputBatches, writer) {
|
|
28242
|
-
try {
|
|
28243
|
-
for await (const inputBatch of inputBatches) {
|
|
28244
|
-
await writer.write(new Uint8Array(inputBatch));
|
|
28245
|
-
}
|
|
28246
|
-
await writer.close();
|
|
28247
|
-
} catch (error) {
|
|
28248
|
-
await writer.abort(error).catch(() => {
|
|
28249
|
-
});
|
|
28250
|
-
throw error;
|
|
28251
|
-
}
|
|
28252
|
-
}
|
|
28253
|
-
var init_decompression_stream = __esm({
|
|
28254
|
-
"../../modules/compression/src/lib/decompression-stream.ts"() {
|
|
28255
|
-
"use strict";
|
|
28256
|
-
}
|
|
28257
|
-
});
|
|
28258
|
-
|
|
28259
|
-
// ../../modules/compression/src/lib/native-decompressor.ts
|
|
28260
|
-
var native_decompressor_exports = {};
|
|
28261
|
-
__export(native_decompressor_exports, {
|
|
28262
|
-
NativeDecompressor: () => NativeDecompressor
|
|
28263
|
-
});
|
|
28264
|
-
var NativeDecompressor;
|
|
28265
|
-
var init_native_decompressor = __esm({
|
|
28266
|
-
"../../modules/compression/src/lib/native-decompressor.ts"() {
|
|
28267
|
-
"use strict";
|
|
28268
|
-
init_compression();
|
|
28269
|
-
init_decompression_stream();
|
|
28270
|
-
NativeDecompressor = class extends Decompressor {
|
|
28271
|
-
name;
|
|
28272
|
-
extensions;
|
|
28273
|
-
contentEncodings;
|
|
28274
|
-
isSupported = true;
|
|
28275
|
-
/** Runtime stream format used for every operation. */
|
|
28276
|
-
format;
|
|
28277
|
-
constructor(metadata, format, options = {}) {
|
|
28278
|
-
super(options);
|
|
28279
|
-
this.name = metadata.name;
|
|
28280
|
-
this.extensions = [...metadata.extensions];
|
|
28281
|
-
this.contentEncodings = [...metadata.contentEncodings];
|
|
28282
|
-
this.format = format;
|
|
28310
|
+
}
|
|
28311
|
+
bt = end;
|
|
28312
|
+
}
|
|
28313
|
+
}
|
|
28314
|
+
st.l = lm, st.p = lpos, st.b = bt, st.f = final;
|
|
28315
|
+
if (lm) final = 1, st.m = lbt, st.d = dm, st.n = dbt;
|
|
28316
|
+
} while (!final);
|
|
28317
|
+
return bt == buf.length ? buf : slc(buf, 0, bt);
|
|
28318
|
+
};
|
|
28319
|
+
gzs = (d) => {
|
|
28320
|
+
if (d[0] != 31 || d[1] != 139 || d[2] != 8) err(6, "invalid gzip data");
|
|
28321
|
+
const flg = d[3];
|
|
28322
|
+
let st = 10;
|
|
28323
|
+
if (flg & 4) st += d[10] | (d[11] << 8) + 2;
|
|
28324
|
+
for (let zs = (flg >> 3 & 1) + (flg >> 4 & 1); zs > 0; zs -= !d[st++]) ;
|
|
28325
|
+
return st + (flg & 2);
|
|
28326
|
+
};
|
|
28327
|
+
gzl = (d) => {
|
|
28328
|
+
const l = d.length;
|
|
28329
|
+
return (d[l - 4] | d[l - 3] << 8 | d[l - 2] << 16 | d[l - 1] << 24) >>> 0;
|
|
28330
|
+
};
|
|
28331
|
+
zlv = (d) => {
|
|
28332
|
+
if ((d[0] & 15) != 8 || d[0] >>> 4 > 7 || (d[0] << 8 | d[1]) % 31) err(6, "invalid zlib data");
|
|
28333
|
+
if (d[1] & 32) err(6, "invalid zlib data: preset dictionaries not supported");
|
|
28334
|
+
};
|
|
28335
|
+
Inflate = class {
|
|
28336
|
+
/**
|
|
28337
|
+
* Creates an inflation stream
|
|
28338
|
+
* @param cb The callback to call whenever data is inflated
|
|
28339
|
+
*/
|
|
28340
|
+
constructor(cb) {
|
|
28341
|
+
this.ondata = cb;
|
|
28283
28342
|
}
|
|
28284
|
-
/**
|
|
28285
|
-
|
|
28286
|
-
|
|
28287
|
-
|
|
28288
|
-
|
|
28343
|
+
/** Persistent bit-reader and Huffman decoding state. */
|
|
28344
|
+
s = {};
|
|
28345
|
+
/** Compression options or retained output window for this stream. */
|
|
28346
|
+
o;
|
|
28347
|
+
/** Compressed bytes pending decoding. */
|
|
28348
|
+
p = new u8(0);
|
|
28349
|
+
/** Whether the stream has received its final chunk. */
|
|
28350
|
+
d;
|
|
28351
|
+
/**
|
|
28352
|
+
* The handler to call whenever data is available
|
|
28353
|
+
*/
|
|
28354
|
+
ondata;
|
|
28355
|
+
/** Appends pending input after checking stream lifecycle. */
|
|
28356
|
+
e(c) {
|
|
28357
|
+
if (!this.ondata) err(5);
|
|
28358
|
+
if (this.d) err(4);
|
|
28359
|
+
const l = this.p.length;
|
|
28360
|
+
const n = new u8(l + c.length);
|
|
28361
|
+
n.set(this.p), n.set(c, l), this.p = n;
|
|
28289
28362
|
}
|
|
28290
|
-
/**
|
|
28291
|
-
|
|
28292
|
-
|
|
28293
|
-
|
|
28294
|
-
|
|
28363
|
+
/** Decodes pending input and retains the sliding window. */
|
|
28364
|
+
c(final) {
|
|
28365
|
+
this.d = this.s.i = final || false;
|
|
28366
|
+
const bts = this.s.b;
|
|
28367
|
+
const dt = inflt(this.p, this.o, this.s);
|
|
28368
|
+
this.ondata(slc(dt, bts, this.s.b), this.d);
|
|
28369
|
+
this.o = slc(dt, this.s.b - 32768), this.s.b = this.o.length;
|
|
28370
|
+
this.p = slc(this.p, this.s.p / 8 | 0), this.s.p &= 7;
|
|
28295
28371
|
}
|
|
28296
|
-
|
|
28297
|
-
|
|
28298
|
-
|
|
28299
|
-
|
|
28300
|
-
|
|
28301
|
-
|
|
28302
|
-
|
|
28303
|
-
}
|
|
28304
|
-
var LazyDecompressor;
|
|
28305
|
-
var init_lazy_compression = __esm({
|
|
28306
|
-
"../../modules/compression/src/lib/lazy-compression.ts"() {
|
|
28307
|
-
"use strict";
|
|
28308
|
-
init_compression();
|
|
28309
|
-
init_decompression_stream();
|
|
28310
|
-
LazyDecompressor = class extends Decompressor {
|
|
28311
|
-
name;
|
|
28312
|
-
extensions;
|
|
28313
|
-
contentEncodings;
|
|
28314
|
-
isSupported = true;
|
|
28315
|
-
/** Constructor options retained until a concrete implementation is selected. */
|
|
28316
|
-
options;
|
|
28317
|
-
/** Built-in stream format to probe, or null when the format has no built-in path. */
|
|
28318
|
-
nativeFormat;
|
|
28319
|
-
/** Returns whether built-in selection remains eligible for the merged preload options. */
|
|
28320
|
-
shouldUseNative;
|
|
28321
|
-
/** Dynamically imports the balanced fallback constructor. */
|
|
28322
|
-
loadFallback;
|
|
28323
|
-
/** Selected concrete implementation after preload completes. */
|
|
28324
|
-
implementation = null;
|
|
28325
|
-
/** Shared in-flight selection used by concurrent asynchronous calls. */
|
|
28326
|
-
implementationPromise = null;
|
|
28327
|
-
constructor(metadata, loadFallback, options = {}, nativeFormat = null, shouldUseNative = () => true) {
|
|
28328
|
-
super(options);
|
|
28329
|
-
this.name = metadata.name;
|
|
28330
|
-
this.extensions = [...metadata.extensions];
|
|
28331
|
-
this.contentEncodings = [...metadata.contentEncodings];
|
|
28332
|
-
this.options = options;
|
|
28333
|
-
this.nativeFormat = nativeFormat;
|
|
28334
|
-
this.shouldUseNative = shouldUseNative;
|
|
28335
|
-
this.loadFallback = loadFallback;
|
|
28372
|
+
/**
|
|
28373
|
+
* Pushes a chunk to be inflated
|
|
28374
|
+
* @param chunk The chunk to push
|
|
28375
|
+
* @param final Whether this is the final chunk
|
|
28376
|
+
*/
|
|
28377
|
+
push(chunk, final) {
|
|
28378
|
+
this.e(chunk), this.c(final);
|
|
28336
28379
|
}
|
|
28337
|
-
|
|
28338
|
-
|
|
28339
|
-
|
|
28340
|
-
|
|
28341
|
-
|
|
28342
|
-
|
|
28343
|
-
|
|
28344
|
-
|
|
28345
|
-
|
|
28346
|
-
|
|
28347
|
-
throw error;
|
|
28348
|
-
}
|
|
28380
|
+
};
|
|
28381
|
+
Gunzip = class extends Inflate {
|
|
28382
|
+
/** Whether the stream header still needs to be emitted or consumed. */
|
|
28383
|
+
v = 1;
|
|
28384
|
+
/**
|
|
28385
|
+
* Creates a GUNZIP stream
|
|
28386
|
+
* @param cb The callback to call whenever data is inflated
|
|
28387
|
+
*/
|
|
28388
|
+
constructor(cb) {
|
|
28389
|
+
super(cb);
|
|
28349
28390
|
}
|
|
28350
|
-
/**
|
|
28351
|
-
|
|
28352
|
-
|
|
28353
|
-
|
|
28354
|
-
|
|
28391
|
+
/**
|
|
28392
|
+
* Pushes a chunk to be GUNZIPped
|
|
28393
|
+
* @param chunk The chunk to push
|
|
28394
|
+
* @param final Whether this is the last chunk
|
|
28395
|
+
*/
|
|
28396
|
+
push(chunk, final) {
|
|
28397
|
+
Inflate.prototype.e.call(this, chunk);
|
|
28398
|
+
if (this.v) {
|
|
28399
|
+
const s = this.p.length > 3 ? gzs(this.p) : 4;
|
|
28400
|
+
if (s >= this.p.length && !final) return;
|
|
28401
|
+
this.p = this.p.subarray(s), this.v = 0;
|
|
28355
28402
|
}
|
|
28356
|
-
|
|
28357
|
-
|
|
28358
|
-
|
|
28359
|
-
return implementation;
|
|
28360
|
-
}
|
|
28361
|
-
/** Decompresses after lazily selecting the default implementation. */
|
|
28362
|
-
async decompress(input, size) {
|
|
28363
|
-
return (await this.preload()).decompress(input, size);
|
|
28364
|
-
}
|
|
28365
|
-
/** Decompresses synchronously after an implementation has been preloaded. */
|
|
28366
|
-
decompressSync(input, size) {
|
|
28367
|
-
if (!this.implementation) {
|
|
28368
|
-
throw new Error(`${this.name}: call preload() before decompressSync()`);
|
|
28403
|
+
if (final) {
|
|
28404
|
+
if (this.p.length < 8) err(6, "invalid gzip data");
|
|
28405
|
+
this.p = this.p.subarray(0, -8);
|
|
28369
28406
|
}
|
|
28370
|
-
|
|
28371
|
-
}
|
|
28372
|
-
/** Decompresses batches after lazily selecting the default implementation. */
|
|
28373
|
-
async *decompressBatches(inputBatches) {
|
|
28374
|
-
yield* (await this.preload()).decompressBatches(inputBatches);
|
|
28407
|
+
Inflate.prototype.c.call(this, final);
|
|
28375
28408
|
}
|
|
28376
28409
|
};
|
|
28377
|
-
|
|
28378
|
-
|
|
28379
|
-
|
|
28380
|
-
|
|
28381
|
-
|
|
28382
|
-
|
|
28383
|
-
|
|
28384
|
-
|
|
28385
|
-
|
|
28386
|
-
var init_no_decompressor = __esm({
|
|
28387
|
-
"../../modules/compression/src/no-decompressor.ts"() {
|
|
28388
|
-
"use strict";
|
|
28389
|
-
init_compression();
|
|
28390
|
-
NoDecompressor = class extends Decompressor {
|
|
28391
|
-
name = "uncompressed";
|
|
28392
|
-
extensions = [];
|
|
28393
|
-
contentEncodings = [];
|
|
28394
|
-
isSupported = true;
|
|
28395
|
-
constructor(options = {}) {
|
|
28396
|
-
super(options);
|
|
28410
|
+
Unzlib = class extends Inflate {
|
|
28411
|
+
/** Whether the stream header still needs to be emitted or consumed. */
|
|
28412
|
+
v = 1;
|
|
28413
|
+
/**
|
|
28414
|
+
* Creates a Zlib decompression stream
|
|
28415
|
+
* @param cb The callback to call whenever data is inflated
|
|
28416
|
+
*/
|
|
28417
|
+
constructor(cb) {
|
|
28418
|
+
super(cb);
|
|
28397
28419
|
}
|
|
28398
|
-
/**
|
|
28399
|
-
|
|
28400
|
-
|
|
28420
|
+
/**
|
|
28421
|
+
* Pushes a chunk to be unzlibbed
|
|
28422
|
+
* @param chunk The chunk to push
|
|
28423
|
+
* @param final Whether this is the last chunk
|
|
28424
|
+
*/
|
|
28425
|
+
push(chunk, final) {
|
|
28426
|
+
Inflate.prototype.e.call(this, chunk);
|
|
28427
|
+
if (this.v) {
|
|
28428
|
+
if (this.p.length < 2 && !final) return;
|
|
28429
|
+
this.p = this.p.subarray(2), this.v = 0;
|
|
28430
|
+
}
|
|
28431
|
+
if (final) {
|
|
28432
|
+
if (this.p.length < 4) err(6, "invalid zlib data");
|
|
28433
|
+
this.p = this.p.subarray(0, -4);
|
|
28434
|
+
}
|
|
28435
|
+
Inflate.prototype.c.call(this, final);
|
|
28401
28436
|
}
|
|
28402
28437
|
};
|
|
28403
28438
|
}
|
|
@@ -29252,6 +29287,7 @@ var init_i3s_loader_options = __esm({
|
|
|
29252
29287
|
decodeTextures: true,
|
|
29253
29288
|
attributeValues: "legacy",
|
|
29254
29289
|
colorFormat: "uint8norm",
|
|
29290
|
+
geometryMode: "render",
|
|
29255
29291
|
coordinateSystem: COORDINATE_SYSTEM.METER_OFFSETS
|
|
29256
29292
|
};
|
|
29257
29293
|
}
|
|
@@ -29320,7 +29356,7 @@ var init_url_utils2 = __esm({
|
|
|
29320
29356
|
|
|
29321
29357
|
// ../../modules/i3s/src/lib/parsers/parse-i3s-tile-content.ts
|
|
29322
29358
|
import { Vector3 as Vector314, Matrix4 as Matrix411 } from "@math.gl/core";
|
|
29323
|
-
import { Ellipsoid as
|
|
29359
|
+
import { Ellipsoid as Ellipsoid11 } from "@math.gl/geospatial";
|
|
29324
29360
|
function getRequiredContext(context, operation) {
|
|
29325
29361
|
if (!context) {
|
|
29326
29362
|
throw new Error(
|
|
@@ -29343,7 +29379,12 @@ function getLoaderForTextureFormat(textureFormat) {
|
|
|
29343
29379
|
}
|
|
29344
29380
|
}
|
|
29345
29381
|
async function parseI3STileContent(arrayBuffer, tileOptions, tilesetOptions, options, context) {
|
|
29382
|
+
const geometryMode = options?.i3s?.geometryMode ?? "render";
|
|
29383
|
+
if (geometryMode !== "render" && geometryMode !== "source") {
|
|
29384
|
+
throw new Error("Unsupported I3S geometry mode");
|
|
29385
|
+
}
|
|
29346
29386
|
const content = {
|
|
29387
|
+
geometryMode,
|
|
29347
29388
|
attributes: {},
|
|
29348
29389
|
indices: null,
|
|
29349
29390
|
featureIds: [],
|
|
@@ -29493,6 +29534,13 @@ async function parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOp
|
|
|
29493
29534
|
id: featureIndex
|
|
29494
29535
|
};
|
|
29495
29536
|
copyDracoTextureCoordinates(attributes, decompressedGeometry.attributes);
|
|
29537
|
+
if (content.geometryMode === "source") {
|
|
29538
|
+
for (const [name18, attribute] of Object.entries(decompressedGeometry.attributes)) {
|
|
29539
|
+
if (!["POSITION", "NORMAL", "COLOR_0", "feature-index", "uv-region"].includes(name18) && !/^TEXCOORD_\d+$/.test(name18)) {
|
|
29540
|
+
attributes[name18] = attribute;
|
|
29541
|
+
}
|
|
29542
|
+
}
|
|
29543
|
+
}
|
|
29496
29544
|
updateAttributesMetadata(attributes, decompressedGeometry);
|
|
29497
29545
|
const featureIds = getFeatureIdsFromFeatureIndexMetadata(featureIndex);
|
|
29498
29546
|
if (featureIds) {
|
|
@@ -29541,7 +29589,32 @@ async function parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOp
|
|
|
29541
29589
|
attributes = concatAttributes(normalizedVertexAttributes, normalizedFeatureAttributes);
|
|
29542
29590
|
}
|
|
29543
29591
|
const spatialReference = tilesetOptions.spatialReference;
|
|
29544
|
-
if (
|
|
29592
|
+
if (content.geometryMode === "source") {
|
|
29593
|
+
if (attributes.position.size !== 3 || attributes.position.transform || attributes.position.normalized || (attributes.position.byteStride ?? 0) !== 0 || (attributes.position.byteOffset ?? 0) !== 0 || attributes.position.value.length !== vertexCount * 3 || tileOptions.mbs.length < 3 || tileOptions.mbs.slice(0, 3).some((value) => !Number.isFinite(value))) {
|
|
29594
|
+
throw new Error("Source I3S geometry requires packed xyz values and a finite source origin");
|
|
29595
|
+
}
|
|
29596
|
+
const positions = offsetsToSourcePositions(
|
|
29597
|
+
attributes.position.value,
|
|
29598
|
+
attributes.position.metadata,
|
|
29599
|
+
tileOptions.mbs
|
|
29600
|
+
);
|
|
29601
|
+
if (positions.some((value) => !Number.isFinite(value))) {
|
|
29602
|
+
throw new Error("Source I3S positions must be finite");
|
|
29603
|
+
}
|
|
29604
|
+
attributes.position = { value: positions, size: 3 };
|
|
29605
|
+
content.origin = [0, 0, 0];
|
|
29606
|
+
content.cartographicOrigin = [0, 0, 0];
|
|
29607
|
+
content.coordinateSystem = spatialReference?.sourceCrs && getSpatialCoordinateFrame(spatialReference.sourceCrs) === "geographic" ? "lnglat" : "cartesian";
|
|
29608
|
+
content.spatialReference = spatialReference ? Object.freeze({
|
|
29609
|
+
...spatialReference,
|
|
29610
|
+
status: "native",
|
|
29611
|
+
targetCrs: void 0,
|
|
29612
|
+
targetHeightReference: "native",
|
|
29613
|
+
outputCoordinates: "auto"
|
|
29614
|
+
}) : void 0;
|
|
29615
|
+
content.normalReferenceFrame = tilesetOptions.store.normalReferenceFrame || "earth-centered";
|
|
29616
|
+
content.sourceAttributes = attributes;
|
|
29617
|
+
} else if (spatialReference?.status === "transformable" || spatialReference?.status === "transformed") {
|
|
29545
29618
|
const spatialTransformer = new I3SSpatialTransformer(
|
|
29546
29619
|
spatialReference,
|
|
29547
29620
|
tilesetOptions.spatialOptions || options?.i3s?.spatial
|
|
@@ -29792,15 +29865,15 @@ function parsePositions2(attribute, options) {
|
|
|
29792
29865
|
const enuMatrix = new Matrix411();
|
|
29793
29866
|
const cartographicOrigin = new Vector314(mbs[0], mbs[1], mbs[2]);
|
|
29794
29867
|
const cartesianOrigin = new Vector314();
|
|
29795
|
-
|
|
29796
|
-
|
|
29868
|
+
Ellipsoid11.WGS84.cartographicToCartesian(cartographicOrigin, cartesianOrigin);
|
|
29869
|
+
Ellipsoid11.WGS84.eastNorthUpToFixedFrame(cartesianOrigin, enuMatrix);
|
|
29797
29870
|
attribute.value = offsetsToCartesians(value, metadata, cartographicOrigin);
|
|
29798
29871
|
return enuMatrix;
|
|
29799
29872
|
}
|
|
29800
29873
|
function offsetsToSourcePositions(vertices, metadata = {}, sourceOrigin) {
|
|
29801
29874
|
const positions = new Float64Array(vertices.length);
|
|
29802
|
-
const scaleX = metadata["i3s-scale_x"]
|
|
29803
|
-
const scaleY = metadata["i3s-scale_y"]
|
|
29875
|
+
const scaleX = metadata["i3s-scale_x"]?.double ?? 1;
|
|
29876
|
+
const scaleY = metadata["i3s-scale_y"]?.double ?? 1;
|
|
29804
29877
|
for (let index = 0; index < positions.length; index += 3) {
|
|
29805
29878
|
positions[index] = vertices[index] * scaleX + sourceOrigin[0];
|
|
29806
29879
|
positions[index + 1] = vertices[index + 1] * scaleY + sourceOrigin[1];
|
|
@@ -29811,7 +29884,7 @@ function offsetsToSourcePositions(vertices, metadata = {}, sourceOrigin) {
|
|
|
29811
29884
|
function offsetsToCartesians(vertices, metadata = {}, cartographicOrigin) {
|
|
29812
29885
|
const positions = offsetsToSourcePositions(vertices, metadata, cartographicOrigin);
|
|
29813
29886
|
for (let i = 0; i < positions.length; i += 3) {
|
|
29814
|
-
|
|
29887
|
+
Ellipsoid11.WGS84.cartographicToCartesian(positions.subarray(i, i + 3), scratchVector3);
|
|
29815
29888
|
positions[i] = scratchVector3.x;
|
|
29816
29889
|
positions[i + 1] = scratchVector3.y;
|
|
29817
29890
|
positions[i + 2] = scratchVector3.z;
|
|
@@ -30499,7 +30572,7 @@ var init_i3s_nodepages_tiles = __esm({
|
|
|
30499
30572
|
|
|
30500
30573
|
// ../../modules/i3s/src/lib/parsers/parse-i3s.ts
|
|
30501
30574
|
import { OrientedBoundingBox as OrientedBoundingBox4 } from "@math.gl/culling";
|
|
30502
|
-
import { Ellipsoid as
|
|
30575
|
+
import { Ellipsoid as Ellipsoid12 } from "@math.gl/geospatial";
|
|
30503
30576
|
async function normalizeTileData2(tile, context) {
|
|
30504
30577
|
const url = context.url || "";
|
|
30505
30578
|
let contentUrl;
|
|
@@ -30624,14 +30697,14 @@ function normalizeTileNonUrlData(tile) {
|
|
|
30624
30697
|
if (tile.mbs) {
|
|
30625
30698
|
mbs = tile.mbs;
|
|
30626
30699
|
boundingVolume.sphere = [
|
|
30627
|
-
...
|
|
30700
|
+
...Ellipsoid12.WGS84.cartographicToCartesian(tile.mbs.slice(0, 3)),
|
|
30628
30701
|
// cartesian center of sphere
|
|
30629
30702
|
tile.mbs[3]
|
|
30630
30703
|
// radius of sphere
|
|
30631
30704
|
];
|
|
30632
30705
|
} else if (tile.obb) {
|
|
30633
30706
|
boundingVolume.box = [
|
|
30634
|
-
...
|
|
30707
|
+
...Ellipsoid12.WGS84.cartographicToCartesian(tile.obb.center),
|
|
30635
30708
|
// cartesian center of box
|
|
30636
30709
|
...tile.obb.halfSize,
|
|
30637
30710
|
// halfSize
|
|
@@ -31013,10 +31086,11 @@ function parseI3STileAttribute(arrayBuffer, options) {
|
|
|
31013
31086
|
[attributeName]: attributeType ? parseAttribute(attributeType, arrayBuffer, options.i3s?.attributeValues === "exact") : null
|
|
31014
31087
|
};
|
|
31015
31088
|
}
|
|
31016
|
-
function parseAttribute(attributeType, arrayBuffer,
|
|
31089
|
+
function parseAttribute(attributeType, arrayBuffer, exactValues = false) {
|
|
31090
|
+
if (exactValues) validateExactNumericLayout(attributeType, arrayBuffer);
|
|
31017
31091
|
switch (attributeType) {
|
|
31018
31092
|
case STRING_ATTRIBUTE_TYPE:
|
|
31019
|
-
return parseStringsAttribute(arrayBuffer,
|
|
31093
|
+
return parseStringsAttribute(arrayBuffer, exactValues);
|
|
31020
31094
|
case OBJECT_ID_ATTRIBUTE_TYPE:
|
|
31021
31095
|
return parseShortNumberAttribute(arrayBuffer);
|
|
31022
31096
|
case FLOAT_64_TYPE:
|
|
@@ -31028,14 +31102,44 @@ function parseAttribute(attributeType, arrayBuffer, exactStrings = false) {
|
|
|
31028
31102
|
case INT_16_ATTRIBUTE_TYPE:
|
|
31029
31103
|
case "Int32":
|
|
31030
31104
|
case "Int64":
|
|
31031
|
-
return parseNumericAttribute(attributeType, arrayBuffer);
|
|
31105
|
+
return parseNumericAttribute(attributeType, arrayBuffer, exactValues);
|
|
31032
31106
|
default:
|
|
31033
31107
|
return parseShortNumberAttribute(arrayBuffer);
|
|
31034
31108
|
}
|
|
31035
31109
|
}
|
|
31036
|
-
function
|
|
31110
|
+
function validateExactNumericLayout(attributeType, arrayBuffer) {
|
|
31111
|
+
if (attributeType === "String") return;
|
|
31112
|
+
const widths = {
|
|
31113
|
+
Oid32: 4,
|
|
31114
|
+
UInt8: 1,
|
|
31115
|
+
UInt16: 2,
|
|
31116
|
+
UInt32: 4,
|
|
31117
|
+
UInt64: 8,
|
|
31118
|
+
Int16: 2,
|
|
31119
|
+
Int32: 4,
|
|
31120
|
+
Int64: 8,
|
|
31121
|
+
Float32: 4,
|
|
31122
|
+
Float64: 8
|
|
31123
|
+
};
|
|
31124
|
+
const width = Object.hasOwn(widths, attributeType) ? widths[attributeType] : void 0;
|
|
31125
|
+
const valueOffset = Math.max(4, width || 0);
|
|
31126
|
+
if (!width || arrayBuffer.byteLength < valueOffset || new DataView(arrayBuffer).getUint32(0, true) * width !== arrayBuffer.byteLength - valueOffset) {
|
|
31127
|
+
throw new Error(
|
|
31128
|
+
"Exact I3S attributes require a supported scalar type and matching count/length"
|
|
31129
|
+
);
|
|
31130
|
+
}
|
|
31131
|
+
}
|
|
31132
|
+
function parseNumericAttribute(attributeType, arrayBuffer, exactValues) {
|
|
31037
31133
|
const valueOffset = attributeType === "Float64" || attributeType === "Int64" || attributeType === "UInt64" ? 8 : 4;
|
|
31038
31134
|
if (attributeType === "UInt64" || attributeType === "Int64") {
|
|
31135
|
+
if (exactValues) {
|
|
31136
|
+
const values = attributeType === "UInt64" ? new BigUint64Array((arrayBuffer.byteLength - valueOffset) / 8) : new BigInt64Array((arrayBuffer.byteLength - valueOffset) / 8);
|
|
31137
|
+
const view = new DataView(arrayBuffer);
|
|
31138
|
+
for (let index = 0; index < values.length; index++) {
|
|
31139
|
+
values[index] = attributeType === "UInt64" ? view.getBigUint64(valueOffset + index * 8, true) : view.getBigInt64(valueOffset + index * 8, true);
|
|
31140
|
+
}
|
|
31141
|
+
return values;
|
|
31142
|
+
}
|
|
31039
31143
|
return parseInt64Attribute(attributeType, arrayBuffer, valueOffset);
|
|
31040
31144
|
}
|
|
31041
31145
|
const TypedArrayType = getNumericAttributeConstructor(attributeType);
|
|
@@ -32349,7 +32453,7 @@ init_src8();
|
|
|
32349
32453
|
init_src5();
|
|
32350
32454
|
init_src2();
|
|
32351
32455
|
import { Vector3 as Vector312, Matrix4 as Matrix49, Vector4 as Vector42 } from "@math.gl/core";
|
|
32352
|
-
import { Ellipsoid as
|
|
32456
|
+
import { Ellipsoid as Ellipsoid9 } from "@math.gl/geospatial";
|
|
32353
32457
|
import { createRequire } from "node:module";
|
|
32354
32458
|
import md5 from "md5";
|
|
32355
32459
|
import { v4 as uuidv4 } from "uuid";
|
|
@@ -32568,7 +32672,7 @@ function encodeStringAttribute(values) {
|
|
|
32568
32672
|
|
|
32569
32673
|
// src/v4/i3s-converter/helpers/coordinate-converter.ts
|
|
32570
32674
|
import { Matrix3 as Matrix35, Quaternion as Quaternion5, Vector3 as Vector310 } from "@math.gl/core";
|
|
32571
|
-
import { Ellipsoid as
|
|
32675
|
+
import { Ellipsoid as Ellipsoid7 } from "@math.gl/geospatial";
|
|
32572
32676
|
import {
|
|
32573
32677
|
OrientedBoundingBox as OrientedBoundingBox2,
|
|
32574
32678
|
makeOrientedBoundingBoxFromPoints,
|
|
@@ -32579,7 +32683,7 @@ function createBoundingVolumes(sourceBoundingVolume, geoidHeightModel) {
|
|
|
32579
32683
|
let radius;
|
|
32580
32684
|
let halfSize;
|
|
32581
32685
|
let quaternion;
|
|
32582
|
-
const cartographicCenter =
|
|
32686
|
+
const cartographicCenter = Ellipsoid7.WGS84.cartesianToCartographic(
|
|
32583
32687
|
sourceBoundingVolume.center,
|
|
32584
32688
|
new Vector310()
|
|
32585
32689
|
);
|
|
@@ -32608,8 +32712,8 @@ function createBoundingVolumesFromGeometry(cartesianPositions, geoidHeightModel)
|
|
|
32608
32712
|
const positionVectors = convertPositionsToVectors(cartesianPositions);
|
|
32609
32713
|
const geometryObb = makeOrientedBoundingBoxFromPoints(positionVectors);
|
|
32610
32714
|
const geometryMbs = makeBoundingSphereFromPoints(positionVectors);
|
|
32611
|
-
const mbsCenter =
|
|
32612
|
-
const obbCenter =
|
|
32715
|
+
const mbsCenter = Ellipsoid7.WGS84.cartesianToCartographic(geometryMbs.center, new Vector310());
|
|
32716
|
+
const obbCenter = Ellipsoid7.WGS84.cartesianToCartographic(geometryObb.center, new Vector310());
|
|
32613
32717
|
if (geoidHeightModel) {
|
|
32614
32718
|
mbsCenter[2] = mbsCenter[2] - geoidHeightModel.getHeight(mbsCenter[1], mbsCenter[0]);
|
|
32615
32719
|
obbCenter[2] = obbCenter[2] - geoidHeightModel.getHeight(obbCenter[1], obbCenter[0]);
|
|
@@ -32640,11 +32744,11 @@ function convertBoundingVolumeToI3SFullExtent(boundingVolume) {
|
|
|
32640
32744
|
}
|
|
32641
32745
|
const center = sphere.center;
|
|
32642
32746
|
const radius = sphere.radius;
|
|
32643
|
-
const vertexMax =
|
|
32747
|
+
const vertexMax = Ellipsoid7.WGS84.cartesianToCartographic(
|
|
32644
32748
|
new Vector310(center[0] + radius, center[1] + radius, center[2] + radius),
|
|
32645
32749
|
new Vector310()
|
|
32646
32750
|
);
|
|
32647
|
-
const vertexMin =
|
|
32751
|
+
const vertexMin = Ellipsoid7.WGS84.cartesianToCartographic(
|
|
32648
32752
|
new Vector310(center[0] - radius, center[1] - radius, center[2] - radius),
|
|
32649
32753
|
new Vector310()
|
|
32650
32754
|
);
|
|
@@ -32667,7 +32771,7 @@ function createObbFromMbs(mbs) {
|
|
|
32667
32771
|
// src/v4/i3s-converter/helpers/gltf-attributes.ts
|
|
32668
32772
|
init_src6();
|
|
32669
32773
|
import { Matrix4 as Matrix48, Vector3 as Vector311 } from "@math.gl/core";
|
|
32670
|
-
import { Ellipsoid as
|
|
32774
|
+
import { Ellipsoid as Ellipsoid8 } from "@math.gl/geospatial";
|
|
32671
32775
|
function prepareDataForAttributesConversion(tileContent, tileTransform, boundingVolume) {
|
|
32672
32776
|
const nodes = tileContent.gltf?.scene?.nodes || tileContent.gltf?.scenes?.[0]?.nodes || tileContent.gltf?.nodes || [];
|
|
32673
32777
|
const images = tileContent.gltf?.images?.map((imageObject) => {
|
|
@@ -32730,7 +32834,7 @@ function calculateTransformProps(tileContent, tileTransform, boundingVolume) {
|
|
|
32730
32834
|
break;
|
|
32731
32835
|
}
|
|
32732
32836
|
const cartesianOrigin = new Vector311(center);
|
|
32733
|
-
const cartographicOrigin =
|
|
32837
|
+
const cartographicOrigin = Ellipsoid8.WGS84.cartesianToCartographic(
|
|
32734
32838
|
cartesianOrigin,
|
|
32735
32839
|
new Vector311()
|
|
32736
32840
|
);
|
|
@@ -33116,7 +33220,7 @@ function _generateBoundingVolumesFromGeometry(convertedAttributesMap, geoidHeigh
|
|
|
33116
33220
|
const cartographicOrigin = boundingVolumes.obb.center;
|
|
33117
33221
|
for (let index = 0; index < attributes.positions.length; index += VALUES_PER_VERTEX2) {
|
|
33118
33222
|
const vertex = attributes.positions.subarray(index, index + VALUES_PER_VERTEX2);
|
|
33119
|
-
|
|
33223
|
+
Ellipsoid9.WGS84.cartesianToCartographic(Array.from(vertex), scratchVector2);
|
|
33120
33224
|
if (geoidHeightModel) {
|
|
33121
33225
|
scratchVector2[2] = scratchVector2[2] - geoidHeightModel.getHeight(scratchVector2[1], scratchVector2[0]);
|
|
33122
33226
|
}
|
|
@@ -33450,7 +33554,7 @@ function transformVertexPositions(vertexVector, calleeArgs) {
|
|
|
33450
33554
|
if (useCartesianPositions) {
|
|
33451
33555
|
return vertexVector;
|
|
33452
33556
|
}
|
|
33453
|
-
|
|
33557
|
+
Ellipsoid9.WGS84.cartesianToCartographic(
|
|
33454
33558
|
[vertexVector[0], vertexVector[1], vertexVector[2]],
|
|
33455
33559
|
vertexVector
|
|
33456
33560
|
);
|
|
@@ -34593,7 +34697,7 @@ function transfromTextureDefinitions(textureDefinitionInfos, thisObject, origina
|
|
|
34593
34697
|
// src/v4/i3s-converter/helpers/node-debug.ts
|
|
34594
34698
|
import { OrientedBoundingBox as OrientedBoundingBox3, BoundingSphere as BoundingSphere3 } from "@math.gl/culling";
|
|
34595
34699
|
import { Vector3 as Vector313 } from "@math.gl/core";
|
|
34596
|
-
import { Ellipsoid as
|
|
34700
|
+
import { Ellipsoid as Ellipsoid10 } from "@math.gl/geospatial";
|
|
34597
34701
|
var CUBE_POSITIONS = new Float32Array([
|
|
34598
34702
|
-1,
|
|
34599
34703
|
-1,
|
|
@@ -34706,7 +34810,7 @@ function createBoundingBoxFromTileObb(obb) {
|
|
|
34706
34810
|
function getTileObbVertices(node) {
|
|
34707
34811
|
const halfSize = node.obb.halfSize;
|
|
34708
34812
|
const positions = CUBE_POSITIONS;
|
|
34709
|
-
const obbCenterCartesian =
|
|
34813
|
+
const obbCenterCartesian = Ellipsoid10.WGS84.cartographicToCartesian(node.obb.center);
|
|
34710
34814
|
let vertices = [];
|
|
34711
34815
|
for (let i = 0; i < positions.length; i += 3) {
|
|
34712
34816
|
positions[i] *= halfSize[0];
|
|
@@ -34722,7 +34826,7 @@ function isAllVerticesInsideBoundingVolume(boundingVolume, positions) {
|
|
|
34722
34826
|
let isVerticesInsideObb = true;
|
|
34723
34827
|
for (let index = 0; index < positions.length / 3; index += 3) {
|
|
34724
34828
|
const point = [positions[index], positions[index + 1], positions[index + 2]];
|
|
34725
|
-
const cartographicPoint =
|
|
34829
|
+
const cartographicPoint = Ellipsoid10.WGS84.cartesianToCartographic(point);
|
|
34726
34830
|
const distance = boundingVolume.distanceTo(cartographicPoint);
|
|
34727
34831
|
if (distance > 0) {
|
|
34728
34832
|
isVerticesInsideObb = false;
|
|
@@ -37492,7 +37596,7 @@ function collectWktNodes(node) {
|
|
|
37492
37596
|
|
|
37493
37597
|
// src/v4/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.ts
|
|
37494
37598
|
import { Vector3 as Vector315 } from "@math.gl/core";
|
|
37495
|
-
import { Ellipsoid as
|
|
37599
|
+
import { Ellipsoid as Ellipsoid13 } from "@math.gl/geospatial";
|
|
37496
37600
|
import { OrientedBoundingBox as OrientedBoundingBox5 } from "@math.gl/culling";
|
|
37497
37601
|
function i3sObbTo3dTilesObb(i3SObb, geoidHeightModel) {
|
|
37498
37602
|
const tiles3DCenter = [
|
|
@@ -37500,7 +37604,7 @@ function i3sObbTo3dTilesObb(i3SObb, geoidHeightModel) {
|
|
|
37500
37604
|
i3SObb.center[1],
|
|
37501
37605
|
i3SObb.center[2] + geoidHeightModel.getHeight(i3SObb.center[1], i3SObb.center[0])
|
|
37502
37606
|
];
|
|
37503
|
-
const cartesianCenter =
|
|
37607
|
+
const cartesianCenter = Ellipsoid13.WGS84.cartographicToCartesian(tiles3DCenter, new Vector315());
|
|
37504
37608
|
const tiles3DObb = new OrientedBoundingBox5().fromCenterHalfSizeQuaternion(
|
|
37505
37609
|
cartesianCenter,
|
|
37506
37610
|
i3SObb.halfSize,
|
|
@@ -37558,7 +37662,7 @@ init_src5();
|
|
|
37558
37662
|
init_src9();
|
|
37559
37663
|
import { Matrix4 as Matrix412, Vector3 as Vector316 } from "@math.gl/core";
|
|
37560
37664
|
import { isTypedArray } from "@math.gl/types";
|
|
37561
|
-
import { Ellipsoid as
|
|
37665
|
+
import { Ellipsoid as Ellipsoid14 } from "@math.gl/geospatial";
|
|
37562
37666
|
|
|
37563
37667
|
// src/v4/3d-tiles-converter/helpers/texture-atlas.ts
|
|
37564
37668
|
function convertTextureAtlas(texCoords, uvRegions) {
|
|
@@ -37653,7 +37757,7 @@ var Tiles3DContentConverter = class {
|
|
|
37653
37757
|
);
|
|
37654
37758
|
}
|
|
37655
37759
|
const cartesianOrigin = new Vector316(box);
|
|
37656
|
-
const cartographicOrigin =
|
|
37760
|
+
const cartographicOrigin = Ellipsoid14.WGS84.cartesianToCartographic(
|
|
37657
37761
|
cartesianOrigin,
|
|
37658
37762
|
new Vector316()
|
|
37659
37763
|
);
|
|
@@ -37818,7 +37922,7 @@ var Tiles3DContentConverter = class {
|
|
|
37818
37922
|
const vertex = positionsValue.subarray(index, index + 3);
|
|
37819
37923
|
const cartesianOriginVector = new Vector316(cartesianOrigin);
|
|
37820
37924
|
let vertexVector = new Vector316(Array.from(vertex)).transform(modelMatrix).add(cartographicOrigin);
|
|
37821
|
-
|
|
37925
|
+
Ellipsoid14.WGS84.cartographicToCartesian(vertexVector, scratchVector4);
|
|
37822
37926
|
vertexVector = scratchVector4.subtract(cartesianOriginVector);
|
|
37823
37927
|
newPositionsValue.set(vertexVector, index);
|
|
37824
37928
|
}
|