@loaders.gl/tile-converter 3.3.2 → 3.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dist.min.js CHANGED
@@ -10556,8 +10556,8 @@ var require_bounding_sphere = __commonJS({
10556
10556
  }, {
10557
10557
  key: "expand",
10558
10558
  value: function expand(point) {
10559
- var scratchPoint = scratchVector7.from(point);
10560
- var radius = scratchPoint.subtract(this.center).magnitude();
10559
+ var scratchPoint2 = scratchVector7.from(point);
10560
+ var radius = scratchPoint2.subtract(this.center).magnitude();
10561
10561
  if (radius > this.radius) {
10562
10562
  this.radius = radius;
10563
10563
  }
@@ -10580,8 +10580,8 @@ var require_bounding_sphere = __commonJS({
10580
10580
  }, {
10581
10581
  key: "distanceTo",
10582
10582
  value: function distanceTo(point) {
10583
- var scratchPoint = scratchVector7.from(point);
10584
- var delta = scratchPoint.subtract(this.center);
10583
+ var scratchPoint2 = scratchVector7.from(point);
10584
+ var delta = scratchPoint2.subtract(this.center);
10585
10585
  return Math.max(0, delta.len() - this.radius);
10586
10586
  }
10587
10587
  }, {
@@ -66975,6 +66975,7 @@ var import_geospatial4 = __toModule(require_es55());
66975
66975
  function defined2(x) {
66976
66976
  return x !== void 0 && x !== null;
66977
66977
  }
66978
+ var scratchPoint = new import_core4.Vector3();
66978
66979
  var scratchScale = new import_core4.Vector3();
66979
66980
  var scratchNorthWest = new import_core4.Vector3();
66980
66981
  var scratchSouthEast = new import_core4.Vector3();
@@ -66996,6 +66997,22 @@ function createBoundingVolume(boundingVolumeHeader, transform11, result) {
66996
66997
  }
66997
66998
  throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box");
66998
66999
  }
67000
+ function getCartographicBounds(boundingVolumeHeader, boundingVolume) {
67001
+ if (boundingVolumeHeader.box) {
67002
+ return orientedBoundingBoxToCartographicBounds(boundingVolume);
67003
+ }
67004
+ if (boundingVolumeHeader.region) {
67005
+ const [west, south, east, north, minHeight, maxHeight] = boundingVolumeHeader.region;
67006
+ return [
67007
+ [(0, import_core4.degrees)(west), (0, import_core4.degrees)(south), minHeight],
67008
+ [(0, import_core4.degrees)(east), (0, import_core4.degrees)(north), maxHeight]
67009
+ ];
67010
+ }
67011
+ if (boundingVolumeHeader.sphere) {
67012
+ return boundingSphereToCartographicBounds(boundingVolume);
67013
+ }
67014
+ throw new Error("Unkown boundingVolume type");
67015
+ }
66999
67016
  function createBox(box, transform11, result) {
67000
67017
  const center = new import_core4.Vector3(box[0], box[1], box[2]);
67001
67018
  transform11.transform(center, center);
@@ -67051,6 +67068,71 @@ function createSphere(sphere, transform11, result) {
67051
67068
  }
67052
67069
  return new import_culling3.BoundingSphere(center, radius);
67053
67070
  }
67071
+ function orientedBoundingBoxToCartographicBounds(boundingVolume) {
67072
+ const result = emptyCartographicBounds();
67073
+ const { halfAxes } = boundingVolume;
67074
+ const xAxis = new import_core4.Vector3(halfAxes.getColumn(0));
67075
+ const yAxis = new import_core4.Vector3(halfAxes.getColumn(1));
67076
+ const zAxis = new import_core4.Vector3(halfAxes.getColumn(2));
67077
+ for (let x = 0; x < 2; x++) {
67078
+ for (let y = 0; y < 2; y++) {
67079
+ for (let z = 0; z < 2; z++) {
67080
+ scratchPoint.copy(boundingVolume.center);
67081
+ scratchPoint.add(xAxis);
67082
+ scratchPoint.add(yAxis);
67083
+ scratchPoint.add(zAxis);
67084
+ addToCartographicBounds(result, scratchPoint);
67085
+ zAxis.negate();
67086
+ }
67087
+ yAxis.negate();
67088
+ }
67089
+ xAxis.negate();
67090
+ }
67091
+ return result;
67092
+ }
67093
+ function boundingSphereToCartographicBounds(boundingVolume) {
67094
+ const result = emptyCartographicBounds();
67095
+ const { center, radius } = boundingVolume;
67096
+ const point = import_geospatial4.Ellipsoid.WGS84.scaleToGeodeticSurface(center, scratchPoint);
67097
+ let zAxis;
67098
+ if (point) {
67099
+ zAxis = import_geospatial4.Ellipsoid.WGS84.geodeticSurfaceNormal(point);
67100
+ } else {
67101
+ zAxis = new import_core4.Vector3(0, 0, 1);
67102
+ }
67103
+ let xAxis = new import_core4.Vector3(zAxis[2], -zAxis[1], 0);
67104
+ if (xAxis.len() > 0) {
67105
+ xAxis.normalize();
67106
+ } else {
67107
+ xAxis = new import_core4.Vector3(0, 1, 0);
67108
+ }
67109
+ const yAxis = xAxis.clone().cross(zAxis);
67110
+ for (const axis of [xAxis, yAxis, zAxis]) {
67111
+ scratchScale.copy(axis).scale(radius);
67112
+ for (let dir = 0; dir < 2; dir++) {
67113
+ scratchPoint.copy(center);
67114
+ scratchPoint.add(scratchScale);
67115
+ addToCartographicBounds(result, scratchPoint);
67116
+ scratchScale.negate();
67117
+ }
67118
+ }
67119
+ return result;
67120
+ }
67121
+ function emptyCartographicBounds() {
67122
+ return [
67123
+ [Infinity, Infinity, Infinity],
67124
+ [-Infinity, -Infinity, -Infinity]
67125
+ ];
67126
+ }
67127
+ function addToCartographicBounds(target, cartesian) {
67128
+ import_geospatial4.Ellipsoid.WGS84.cartesianToCartographic(cartesian, scratchPoint);
67129
+ target[0][0] = Math.min(target[0][0], scratchPoint[0]);
67130
+ target[0][1] = Math.min(target[0][1], scratchPoint[1]);
67131
+ target[0][2] = Math.min(target[0][2], scratchPoint[2]);
67132
+ target[1][0] = Math.max(target[1][0], scratchPoint[0]);
67133
+ target[1][1] = Math.max(target[1][1], scratchPoint[1]);
67134
+ target[1][2] = Math.max(target[1][2], scratchPoint[2]);
67135
+ }
67054
67136
 
67055
67137
  // ../tiles/src/tileset/helpers/tiles-3d-lod.ts
67056
67138
  var import_core5 = __toModule(require_es54());
@@ -67557,6 +67639,12 @@ var Tile3D = class {
67557
67639
  get screenSpaceError() {
67558
67640
  return this._screenSpaceError;
67559
67641
  }
67642
+ get boundingBox() {
67643
+ if (!this._boundingBox) {
67644
+ this._boundingBox = getCartographicBounds(this.header.boundingVolume, this.boundingVolume);
67645
+ }
67646
+ return this._boundingBox;
67647
+ }
67560
67648
  getScreenSpaceError(frameState, useParentLodMetric) {
67561
67649
  switch (this.tileset.type) {
67562
67650
  case TILESET_TYPE.I3S:
@@ -68112,7 +68200,7 @@ var Tileset3D = class {
68112
68200
  }
68113
68201
  get queryParams() {
68114
68202
  if (!this._queryParamsString) {
68115
- this._queryParamsString = getQueryParamString(this._queryParams);
68203
+ this._queryParamsString = new URLSearchParams(this._queryParams).toString();
68116
68204
  }
68117
68205
  return this._queryParamsString;
68118
68206
  }
@@ -68127,7 +68215,7 @@ var Tileset3D = class {
68127
68215
  if (isDataUrl) {
68128
68216
  return tilePath;
68129
68217
  }
68130
- return `${tilePath}${this.queryParams}`;
68218
+ return `${tilePath}${tilePath.includes("?") ? "&" : "?"}${this.queryParams}`;
68131
68219
  }
68132
68220
  hasExtension(extensionName) {
68133
68221
  return Boolean(this._extensionsUsed && this._extensionsUsed.indexOf(extensionName) > -1);
@@ -68360,6 +68448,10 @@ var Tileset3D = class {
68360
68448
  const children = tile.header.children || [];
68361
68449
  for (const childHeader of children) {
68362
68450
  const childTile = new Tile3D(this, childHeader, tile);
68451
+ if (childTile.contentUrl?.includes("?session=")) {
68452
+ const url = new URL(childTile.contentUrl);
68453
+ this._queryParams.session = url.searchParams.get("session");
68454
+ }
68363
68455
  tile.children.push(childTile);
68364
68456
  childTile.depth = tile.depth + 1;
68365
68457
  stack2.push(childTile);
@@ -68536,20 +68628,6 @@ var Tileset3D = class {
68536
68628
  }
68537
68629
  }
68538
68630
  };
68539
- function getQueryParamString(queryParams) {
68540
- const queryParamStrings = [];
68541
- for (const key of Object.keys(queryParams)) {
68542
- queryParamStrings.push(`${key}=${queryParams[key]}`);
68543
- }
68544
- switch (queryParamStrings.length) {
68545
- case 0:
68546
- return "";
68547
- case 1:
68548
- return `?${queryParamStrings[0]}`;
68549
- default:
68550
- return `?${queryParamStrings.join("&")}`;
68551
- }
68552
- }
68553
68631
 
68554
68632
  // ../3d-tiles/src/lib/utils/version.ts
68555
68633
  var VERSION5 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
@@ -74684,7 +74762,7 @@ function getTileType(tile) {
74684
74762
  if (!tile.contentUrl) {
74685
74763
  return TILE_TYPE.EMPTY;
74686
74764
  }
74687
- const contentUrl = tile.contentUrl;
74765
+ const contentUrl = tile.contentUrl.split("?")[0];
74688
74766
  const fileExtension = contentUrl.split(".").pop();
74689
74767
  switch (fileExtension) {
74690
74768
  case "pnts":
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports._typecheckI3SAttributesWorker = exports.Tile3dAttributesWorker = void 0;
7
7
  exports.transform3DTilesAttributesOnWorker = transform3DTilesAttributesOnWorker;
8
8
  var _workerUtils = require("@loaders.gl/worker-utils");
9
- var VERSION = typeof "3.3.2" !== 'undefined' ? "3.3.2" : 'latest';
9
+ var VERSION = typeof "3.3.4" !== 'undefined' ? "3.3.4" : 'latest';
10
10
  var Tile3dAttributesWorker = {
11
11
  id: '3d-tiles-attributes',
12
12
  name: '3DTiles Attributes Worker',
@@ -14,7 +14,7 @@ var _zip = require("@loaders.gl/zip");
14
14
  var _fileUtils = require("../lib/utils/file-utils");
15
15
  var _path = require("path");
16
16
  var _workerUtils = require("@loaders.gl/worker-utils");
17
- var VERSION = typeof "3.3.2" !== 'undefined' ? "3.3.2" : 'beta';
17
+ var VERSION = typeof "3.3.4" !== 'undefined' ? "3.3.4" : 'beta';
18
18
  var PGM_LINK = 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/egm/egm2008-5.zip';
19
19
 
20
20
  var DepsInstaller = function () {
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports._typecheckI3SAttributesWorker = exports.I3SAttributesWorker = void 0;
7
7
  exports.transformI3SAttributesOnWorker = transformI3SAttributesOnWorker;
8
8
  var _workerUtils = require("@loaders.gl/worker-utils");
9
- var VERSION = typeof "3.3.2" !== 'undefined' ? "3.3.2" : 'latest';
9
+ var VERSION = typeof "3.3.4" !== 'undefined' ? "3.3.4" : 'latest';
10
10
  var I3SAttributesWorker = {
11
11
  id: 'i3s-attributes',
12
12
  name: 'I3S Attributes Worker',
@@ -8,7 +8,7 @@ exports.PGMLoader = void 0;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
10
  var _geoid = require("@math.gl/geoid");
11
- var VERSION = typeof "3.3.2" !== 'undefined' ? "3.3.2" : 'latest';
11
+ var VERSION = typeof "3.3.4" !== 'undefined' ? "3.3.4" : 'latest';
12
12
 
13
13
  var PGMLoader = {
14
14
  name: 'PGM - Netpbm grayscale image format',
@@ -1,6 +1,6 @@
1
1
  import { processOnWorker } from '@loaders.gl/worker-utils';
2
2
 
3
- const VERSION = typeof "3.3.2" !== 'undefined' ? "3.3.2" : 'latest';
3
+ const VERSION = typeof "3.3.4" !== 'undefined' ? "3.3.4" : 'latest';
4
4
  export const Tile3dAttributesWorker = {
5
5
  id: '3d-tiles-attributes',
6
6
  name: '3DTiles Attributes Worker',
@@ -4,7 +4,7 @@ import { writeFile } from '../lib/utils/file-utils';
4
4
  import { join } from 'path';
5
5
  import { ChildProcessProxy } from '@loaders.gl/worker-utils';
6
6
 
7
- const VERSION = typeof "3.3.2" !== 'undefined' ? "3.3.2" : 'beta';
7
+ const VERSION = typeof "3.3.4" !== 'undefined' ? "3.3.4" : 'beta';
8
8
  const PGM_LINK = 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/egm/egm2008-5.zip';
9
9
 
10
10
  export class DepsInstaller {
@@ -1,6 +1,6 @@
1
1
  import { processOnWorker } from '@loaders.gl/worker-utils';
2
2
 
3
- const VERSION = typeof "3.3.2" !== 'undefined' ? "3.3.2" : 'latest';
3
+ const VERSION = typeof "3.3.4" !== 'undefined' ? "3.3.4" : 'latest';
4
4
  export const I3SAttributesWorker = {
5
5
  id: 'i3s-attributes',
6
6
  name: 'I3S Attributes Worker',
@@ -1,6 +1,6 @@
1
1
  import { parsePGM } from '@math.gl/geoid';
2
2
 
3
- const VERSION = typeof "3.3.2" !== 'undefined' ? "3.3.2" : 'latest';
3
+ const VERSION = typeof "3.3.4" !== 'undefined' ? "3.3.4" : 'latest';
4
4
 
5
5
  export const PGMLoader = {
6
6
  name: 'PGM - Netpbm grayscale image format',
@@ -11,7 +11,7 @@ const file_utils_1 = require("../../lib/utils/file-utils");
11
11
  * class NodePages - wrapper of nodePages array
12
12
  *
13
13
  * @example
14
- * import {writeFile} from './helpers/write-file';
14
+ * import {writeFile} from './helpers/write-file.js';
15
15
  *
16
16
  * // create an instance of the class
17
17
  * const nodePages = new NodePages(writeFile, HARDCODED_NODES_PER_PAGE);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/tile-converter",
3
- "version": "3.3.2",
3
+ "version": "3.3.4",
4
4
  "description": "Converter",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -44,19 +44,19 @@
44
44
  "build-3d-tiles-attributes-worker": "esbuild src/workers/3d-tiles-attributes-worker.ts --outfile=dist/3d-tiles-attributes-worker.js --platform=node --target=esnext,node14 --external:join-images --minify --bundle --sourcemap --define:__VERSION__=\\\"$npm_package_version\\\""
45
45
  },
46
46
  "dependencies": {
47
- "@loaders.gl/3d-tiles": "3.3.2",
48
- "@loaders.gl/crypto": "3.3.2",
49
- "@loaders.gl/draco": "3.3.2",
50
- "@loaders.gl/gltf": "3.3.2",
51
- "@loaders.gl/i3s": "3.3.2",
52
- "@loaders.gl/images": "3.3.2",
53
- "@loaders.gl/loader-utils": "3.3.2",
54
- "@loaders.gl/polyfills": "3.3.2",
55
- "@loaders.gl/schema": "3.3.2",
56
- "@loaders.gl/textures": "3.3.2",
57
- "@loaders.gl/tiles": "3.3.2",
58
- "@loaders.gl/worker-utils": "3.3.2",
59
- "@loaders.gl/zip": "3.3.2",
47
+ "@loaders.gl/3d-tiles": "3.3.4",
48
+ "@loaders.gl/crypto": "3.3.4",
49
+ "@loaders.gl/draco": "3.3.4",
50
+ "@loaders.gl/gltf": "3.3.4",
51
+ "@loaders.gl/i3s": "3.3.4",
52
+ "@loaders.gl/images": "3.3.4",
53
+ "@loaders.gl/loader-utils": "3.3.4",
54
+ "@loaders.gl/polyfills": "3.3.4",
55
+ "@loaders.gl/schema": "3.3.4",
56
+ "@loaders.gl/textures": "3.3.4",
57
+ "@loaders.gl/tiles": "3.3.4",
58
+ "@loaders.gl/worker-utils": "3.3.4",
59
+ "@loaders.gl/zip": "3.3.4",
60
60
  "@luma.gl/engine": "^8.5.4",
61
61
  "@math.gl/core": "^3.5.1",
62
62
  "@math.gl/culling": "^3.5.1",
@@ -80,5 +80,5 @@
80
80
  "join-images": "^1.1.3",
81
81
  "sharp": "^0.31.3"
82
82
  },
83
- "gitHead": "a37b0af509ca05468aec6e5667d6a427b9c15d29"
83
+ "gitHead": "1d1a722ea9a04665acbe41359dfd01bf6d43a214"
84
84
  }