@loaders.gl/tiles 3.4.13 → 3.4.15
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 +122 -338
- package/dist/es5/bundle.js +1 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/constants.js +6 -6
- package/dist/es5/constants.js.map +1 -1
- package/dist/es5/index.js +13 -13
- package/dist/es5/tileset/format-3d-tiles/tileset-3d-traverser.js +32 -53
- package/dist/es5/tileset/format-3d-tiles/tileset-3d-traverser.js.map +1 -1
- package/dist/es5/tileset/format-i3s/i3s-pending-tiles-register.js +21 -32
- package/dist/es5/tileset/format-i3s/i3s-pending-tiles-register.js.map +1 -1
- package/dist/es5/tileset/format-i3s/i3s-tile-manager.js +66 -63
- package/dist/es5/tileset/format-i3s/i3s-tile-manager.js.map +1 -1
- package/dist/es5/tileset/format-i3s/i3s-tileset-traverser.js +54 -121
- package/dist/es5/tileset/format-i3s/i3s-tileset-traverser.js.map +1 -1
- package/dist/es5/tileset/helpers/bounding-volume.js +48 -62
- package/dist/es5/tileset/helpers/bounding-volume.js.map +1 -1
- package/dist/es5/tileset/helpers/frame-state.js +67 -80
- package/dist/es5/tileset/helpers/frame-state.js.map +1 -1
- package/dist/es5/tileset/helpers/i3s-lod.js +27 -27
- package/dist/es5/tileset/helpers/i3s-lod.js.map +1 -1
- package/dist/es5/tileset/helpers/tiles-3d-lod.js +51 -45
- package/dist/es5/tileset/helpers/tiles-3d-lod.js.map +1 -1
- package/dist/es5/tileset/helpers/transform-utils.js +17 -11
- package/dist/es5/tileset/helpers/transform-utils.js.map +1 -1
- package/dist/es5/tileset/helpers/zoom.js +28 -28
- package/dist/es5/tileset/helpers/zoom.js.map +1 -1
- package/dist/es5/tileset/tile-3d.js +316 -430
- package/dist/es5/tileset/tile-3d.js.map +1 -1
- package/dist/es5/tileset/tileset-3d.js +460 -701
- package/dist/es5/tileset/tileset-3d.js.map +1 -1
- package/dist/es5/tileset/tileset-cache.js +41 -58
- package/dist/es5/tileset/tileset-cache.js.map +1 -1
- package/dist/es5/tileset/tileset-traverser.js +189 -264
- package/dist/es5/tileset/tileset-traverser.js.map +1 -1
- package/dist/es5/utils/doubly-linked-list-node.js +10 -11
- package/dist/es5/utils/doubly-linked-list-node.js.map +1 -1
- package/dist/es5/utils/doubly-linked-list.js +53 -68
- package/dist/es5/utils/doubly-linked-list.js.map +1 -1
- package/dist/es5/utils/managed-array.js +69 -100
- package/dist/es5/utils/managed-array.js.map +1 -1
- package/package.json +5 -5
|
@@ -5,139 +5,72 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.I3STilesetTraverser = void 0;
|
|
8
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
13
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
15
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
16
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
9
|
var _core = require("@loaders.gl/core");
|
|
18
10
|
var _tilesetTraverser = require("../tileset-traverser");
|
|
19
11
|
var _i3sLod = require("../helpers/i3s-lod");
|
|
20
12
|
var _tile3d = require("../tile-3d");
|
|
21
13
|
var _i3sTileManager = require("./i3s-tile-manager");
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
28
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
29
|
-
var I3STilesetTraverser = function (_TilesetTraverser) {
|
|
30
|
-
(0, _inherits2.default)(I3STilesetTraverser, _TilesetTraverser);
|
|
31
|
-
var _super = _createSuper(I3STilesetTraverser);
|
|
32
|
-
function I3STilesetTraverser(options) {
|
|
33
|
-
var _this;
|
|
34
|
-
(0, _classCallCheck2.default)(this, I3STilesetTraverser);
|
|
35
|
-
_this = _super.call(this, options);
|
|
36
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_tileManager", void 0);
|
|
37
|
-
_this._tileManager = new _i3sTileManager.I3STileManager();
|
|
38
|
-
return _this;
|
|
14
|
+
class I3STilesetTraverser extends _tilesetTraverser.TilesetTraverser {
|
|
15
|
+
constructor(options) {
|
|
16
|
+
super(options);
|
|
17
|
+
(0, _defineProperty2.default)(this, "_tileManager", void 0);
|
|
18
|
+
this._tileManager = new _i3sTileManager.I3STileManager();
|
|
39
19
|
}
|
|
40
|
-
(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
var _loop = function _loop() {
|
|
62
|
-
var child = _step.value;
|
|
63
|
-
var extendedId = "".concat(child.id, "-").concat(frameState.viewport.id);
|
|
64
|
-
var childTile = childTiles && childTiles.find(function (t) {
|
|
65
|
-
return t.id === extendedId;
|
|
66
|
-
});
|
|
67
|
-
if (!childTile) {
|
|
68
|
-
var request = function request() {
|
|
69
|
-
return _this2._loadTile(child.id, tileset);
|
|
70
|
-
};
|
|
71
|
-
var cachedRequest = _this2._tileManager.find(extendedId);
|
|
72
|
-
if (!cachedRequest) {
|
|
73
|
-
if (tileset.tileset.nodePages) {
|
|
74
|
-
request = function request() {
|
|
75
|
-
return tileset.tileset.nodePagesTile.formTileFromNodePages(child.id);
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
_this2._tileManager.add(request, extendedId, function (header) {
|
|
79
|
-
return _this2._onTileLoad(header, tile, extendedId);
|
|
80
|
-
}, frameState);
|
|
81
|
-
} else {
|
|
82
|
-
_this2._tileManager.update(extendedId, frameState);
|
|
83
|
-
}
|
|
84
|
-
} else if (childTile) {
|
|
85
|
-
_this2.updateTile(childTile, frameState);
|
|
20
|
+
traversalFinished(frameState) {
|
|
21
|
+
return !this._tileManager.hasPendingTiles(frameState.viewport.id, this._frameNumber || 0);
|
|
22
|
+
}
|
|
23
|
+
shouldRefine(tile, frameState) {
|
|
24
|
+
tile._lodJudge = (0, _i3sLod.getLodStatus)(tile, frameState);
|
|
25
|
+
return tile._lodJudge === 'DIG';
|
|
26
|
+
}
|
|
27
|
+
updateChildTiles(tile, frameState) {
|
|
28
|
+
const children = tile.header.children || [];
|
|
29
|
+
const childTiles = tile.children;
|
|
30
|
+
const tileset = tile.tileset;
|
|
31
|
+
for (const child of children) {
|
|
32
|
+
const extendedId = "".concat(child.id, "-").concat(frameState.viewport.id);
|
|
33
|
+
const childTile = childTiles && childTiles.find(t => t.id === extendedId);
|
|
34
|
+
if (!childTile) {
|
|
35
|
+
let request = () => this._loadTile(child.id, tileset);
|
|
36
|
+
const cachedRequest = this._tileManager.find(extendedId);
|
|
37
|
+
if (!cachedRequest) {
|
|
38
|
+
if (tileset.tileset.nodePages) {
|
|
39
|
+
request = () => tileset.tileset.nodePagesTile.formTileFromNodePages(child.id);
|
|
86
40
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
41
|
+
this._tileManager.add(request, extendedId, header => this._onTileLoad(header, tile, extendedId), frameState);
|
|
42
|
+
} else {
|
|
43
|
+
this._tileManager.update(extendedId, frameState);
|
|
90
44
|
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
} finally {
|
|
94
|
-
_iterator.f();
|
|
45
|
+
} else if (childTile) {
|
|
46
|
+
this.updateTile(childTile, frameState);
|
|
95
47
|
}
|
|
96
|
-
return false;
|
|
97
48
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
isTileHeader: true
|
|
111
|
-
})
|
|
112
|
-
});
|
|
113
|
-
_context.next = 5;
|
|
114
|
-
return (0, _core.load)(nodeUrl, loader, options);
|
|
115
|
-
case 5:
|
|
116
|
-
return _context.abrupt("return", _context.sent);
|
|
117
|
-
case 6:
|
|
118
|
-
case "end":
|
|
119
|
-
return _context.stop();
|
|
120
|
-
}
|
|
121
|
-
}, _callee);
|
|
122
|
-
}));
|
|
123
|
-
function _loadTile(_x, _x2) {
|
|
124
|
-
return _loadTile2.apply(this, arguments);
|
|
125
|
-
}
|
|
126
|
-
return _loadTile;
|
|
127
|
-
}()
|
|
128
|
-
}, {
|
|
129
|
-
key: "_onTileLoad",
|
|
130
|
-
value: function _onTileLoad(header, tile, extendedId) {
|
|
131
|
-
var childTile = new _tile3d.Tile3D(tile.tileset, header, tile, extendedId);
|
|
132
|
-
tile.children.push(childTile);
|
|
133
|
-
var frameState = this._tileManager.find(childTile.id).frameState;
|
|
134
|
-
this.updateTile(childTile, frameState);
|
|
135
|
-
if (this._frameNumber === frameState.frameNumber && (this.traversalFinished(frameState) || new Date().getTime() - this.lastUpdate > this.updateDebounceTime)) {
|
|
136
|
-
this.executeTraversal(childTile, frameState);
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
async _loadTile(nodeId, tileset) {
|
|
52
|
+
const {
|
|
53
|
+
loader
|
|
54
|
+
} = tileset;
|
|
55
|
+
const nodeUrl = tileset.getTileUrl("".concat(tileset.url, "/nodes/").concat(nodeId));
|
|
56
|
+
const options = {
|
|
57
|
+
...tileset.loadOptions,
|
|
58
|
+
i3s: {
|
|
59
|
+
...tileset.loadOptions.i3s,
|
|
60
|
+
isTileHeader: true
|
|
137
61
|
}
|
|
62
|
+
};
|
|
63
|
+
return await (0, _core.load)(nodeUrl, loader, options);
|
|
64
|
+
}
|
|
65
|
+
_onTileLoad(header, tile, extendedId) {
|
|
66
|
+
const childTile = new _tile3d.Tile3D(tile.tileset, header, tile, extendedId);
|
|
67
|
+
tile.children.push(childTile);
|
|
68
|
+
const frameState = this._tileManager.find(childTile.id).frameState;
|
|
69
|
+
this.updateTile(childTile, frameState);
|
|
70
|
+
if (this._frameNumber === frameState.frameNumber && (this.traversalFinished(frameState) || new Date().getTime() - this.lastUpdate > this.updateDebounceTime)) {
|
|
71
|
+
this.executeTraversal(childTile, frameState);
|
|
138
72
|
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
}(_tilesetTraverser.TilesetTraverser);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
142
75
|
exports.I3STilesetTraverser = I3STilesetTraverser;
|
|
143
76
|
//# sourceMappingURL=i3s-tileset-traverser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-tileset-traverser.js","names":["_core","require","_tilesetTraverser","_i3sLod","_tile3d","_i3sTileManager","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","_createForOfIteratorHelper","o","allowArrayLike","it","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","F","s","n","done","value","e","_e","f","TypeError","normalCompletion","didErr","err","call","step","next","_e2","return","minLen","_arrayLikeToArray","prototype","toString","slice","constructor","name","from","test","arr","len","arr2","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","result","NewTarget","Reflect","construct","_possibleConstructorReturn2","sham","Proxy","Boolean","valueOf","I3STilesetTraverser","_TilesetTraverser","_inherits2","_super","options","_this","_classCallCheck2","_assertThisInitialized2","_tileManager","I3STileManager","_createClass2","traversalFinished","frameState","hasPendingTiles","viewport","id","_frameNumber","shouldRefine","tile","_lodJudge","getLodStatus","updateChildTiles","_this2","children","header","childTiles","tileset","_iterator","_step","_loop","child","extendedId","concat","childTile","find","t","request","_loadTile","cachedRequest","nodePages","nodePagesTile","formTileFromNodePages","add","_onTileLoad","update","updateTile","_loadTile2","_asyncToGenerator2","_regenerator","mark","_callee","nodeId","loader","nodeUrl","wrap","_callee$","_context","prev","getTileUrl","url","loadOptions","i3s","isTileHeader","load","abrupt","sent","stop","_x","_x2","Tile3D","frameNumber","Date","getTime","lastUpdate","updateDebounceTime","executeTraversal","TilesetTraverser","exports"],"sources":["../../../../src/tileset/format-i3s/i3s-tileset-traverser.ts"],"sourcesContent":["import {load} from '@loaders.gl/core';\nimport {TilesetTraverser} from '../tileset-traverser';\n\nimport {getLodStatus} from '../helpers/i3s-lod';\nimport {Tile3D} from '../tile-3d';\nimport {I3STileManager} from './i3s-tile-manager';\nimport {FrameState} from '../helpers/frame-state';\n\nexport class I3STilesetTraverser extends TilesetTraverser {\n private _tileManager: I3STileManager;\n\n constructor(options) {\n super(options);\n this._tileManager = new I3STileManager();\n }\n\n /**\n * Check if there are no penging tile header requests,\n * that means the traversal is finished and we can call\n * following-up callbacks.\n */\n traversalFinished(frameState: FrameState): boolean {\n return !this._tileManager.hasPendingTiles(frameState.viewport.id, this._frameNumber || 0);\n }\n\n shouldRefine(tile, frameState: FrameState) {\n tile._lodJudge = getLodStatus(tile, frameState);\n return tile._lodJudge === 'DIG';\n }\n\n updateChildTiles(tile, frameState: FrameState): boolean {\n const children = tile.header.children || [];\n // children which are already fetched and constructed as Tile3D instances\n const childTiles = tile.children;\n const tileset = tile.tileset;\n\n for (const child of children) {\n const extendedId = `${child.id}-${frameState.viewport.id}`;\n // if child tile is not fetched\n const childTile = childTiles && childTiles.find((t) => t.id === extendedId);\n if (!childTile) {\n let request = () => this._loadTile(child.id, tileset);\n const cachedRequest = this._tileManager.find(extendedId);\n if (!cachedRequest) {\n // eslint-disable-next-line max-depth\n if (tileset.tileset.nodePages) {\n request = () => tileset.tileset.nodePagesTile.formTileFromNodePages(child.id);\n }\n this._tileManager.add(\n request,\n extendedId,\n (header) => this._onTileLoad(header, tile, extendedId),\n frameState\n );\n } else {\n // update frameNumber since it is still needed in current frame\n this._tileManager.update(extendedId, frameState);\n }\n } else if (childTile) {\n // if child tile is fetched and available\n this.updateTile(childTile, frameState);\n }\n }\n return false;\n }\n\n async _loadTile(nodeId, tileset) {\n const {loader} = tileset;\n const nodeUrl = tileset.getTileUrl(`${tileset.url}/nodes/${nodeId}`);\n // load metadata\n const options = {\n ...tileset.loadOptions,\n i3s: {\n ...tileset.loadOptions.i3s,\n isTileHeader: true\n }\n };\n\n return await load(nodeUrl, loader, options);\n }\n\n /**\n * The callback to init Tile3D instance after loading the tile JSON\n * @param {Object} header - the tile JSON from a dataset\n * @param {Tile3D} tile - the parent Tile3D instance\n * @param {string} extendedId - optional ID to separate copies of a tile for different viewports.\n * const extendedId = `${tile.id}-${frameState.viewport.id}`;\n * @return {void}\n */\n _onTileLoad(header, tile, extendedId) {\n // after child tile is fetched\n const childTile = new Tile3D(tile.tileset, header, tile, extendedId);\n tile.children.push(childTile);\n const frameState = this._tileManager.find(childTile.id).frameState;\n this.updateTile(childTile, frameState);\n\n // after tile fetched, resume traversal if still in current update/traversal frame\n if (\n this._frameNumber === frameState.frameNumber &&\n (this.traversalFinished(frameState) ||\n new Date().getTime() - this.lastUpdate > this.updateDebounceTime)\n ) {\n this.executeTraversal(childTile, frameState);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AAAkD,SAAAK,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA,IAAAC,SAAA,CAAAD,CAAA,QAAAA,CAAA,OAAAf,OAAA,CAAAI,MAAA,CAAAc,MAAA,OAAAC,OAAA,WAAAC,GAAA,QAAAC,gBAAA,CAAAC,OAAA,EAAAR,MAAA,EAAAM,GAAA,EAAAF,MAAA,CAAAE,GAAA,SAAAhB,MAAA,CAAAmB,yBAAA,GAAAnB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i3sTileManager","I3STilesetTraverser","TilesetTraverser","constructor","options","_defineProperty2","default","_tileManager","I3STileManager","traversalFinished","frameState","hasPendingTiles","viewport","id","_frameNumber","shouldRefine","tile","_lodJudge","getLodStatus","updateChildTiles","children","header","childTiles","tileset","child","extendedId","concat","childTile","find","t","request","_loadTile","cachedRequest","nodePages","nodePagesTile","formTileFromNodePages","add","_onTileLoad","update","updateTile","nodeId","loader","nodeUrl","getTileUrl","url","loadOptions","i3s","isTileHeader","load","Tile3D","push","frameNumber","Date","getTime","lastUpdate","updateDebounceTime","executeTraversal","exports"],"sources":["../../../../src/tileset/format-i3s/i3s-tileset-traverser.ts"],"sourcesContent":["import {load} from '@loaders.gl/core';\nimport {TilesetTraverser} from '../tileset-traverser';\n\nimport {getLodStatus} from '../helpers/i3s-lod';\nimport {Tile3D} from '../tile-3d';\nimport {I3STileManager} from './i3s-tile-manager';\nimport {FrameState} from '../helpers/frame-state';\n\nexport class I3STilesetTraverser extends TilesetTraverser {\n private _tileManager: I3STileManager;\n\n constructor(options) {\n super(options);\n this._tileManager = new I3STileManager();\n }\n\n /**\n * Check if there are no penging tile header requests,\n * that means the traversal is finished and we can call\n * following-up callbacks.\n */\n traversalFinished(frameState: FrameState): boolean {\n return !this._tileManager.hasPendingTiles(frameState.viewport.id, this._frameNumber || 0);\n }\n\n shouldRefine(tile, frameState: FrameState) {\n tile._lodJudge = getLodStatus(tile, frameState);\n return tile._lodJudge === 'DIG';\n }\n\n updateChildTiles(tile, frameState: FrameState): boolean {\n const children = tile.header.children || [];\n // children which are already fetched and constructed as Tile3D instances\n const childTiles = tile.children;\n const tileset = tile.tileset;\n\n for (const child of children) {\n const extendedId = `${child.id}-${frameState.viewport.id}`;\n // if child tile is not fetched\n const childTile = childTiles && childTiles.find((t) => t.id === extendedId);\n if (!childTile) {\n let request = () => this._loadTile(child.id, tileset);\n const cachedRequest = this._tileManager.find(extendedId);\n if (!cachedRequest) {\n // eslint-disable-next-line max-depth\n if (tileset.tileset.nodePages) {\n request = () => tileset.tileset.nodePagesTile.formTileFromNodePages(child.id);\n }\n this._tileManager.add(\n request,\n extendedId,\n (header) => this._onTileLoad(header, tile, extendedId),\n frameState\n );\n } else {\n // update frameNumber since it is still needed in current frame\n this._tileManager.update(extendedId, frameState);\n }\n } else if (childTile) {\n // if child tile is fetched and available\n this.updateTile(childTile, frameState);\n }\n }\n return false;\n }\n\n async _loadTile(nodeId, tileset) {\n const {loader} = tileset;\n const nodeUrl = tileset.getTileUrl(`${tileset.url}/nodes/${nodeId}`);\n // load metadata\n const options = {\n ...tileset.loadOptions,\n i3s: {\n ...tileset.loadOptions.i3s,\n isTileHeader: true\n }\n };\n\n return await load(nodeUrl, loader, options);\n }\n\n /**\n * The callback to init Tile3D instance after loading the tile JSON\n * @param {Object} header - the tile JSON from a dataset\n * @param {Tile3D} tile - the parent Tile3D instance\n * @param {string} extendedId - optional ID to separate copies of a tile for different viewports.\n * const extendedId = `${tile.id}-${frameState.viewport.id}`;\n * @return {void}\n */\n _onTileLoad(header, tile, extendedId) {\n // after child tile is fetched\n const childTile = new Tile3D(tile.tileset, header, tile, extendedId);\n tile.children.push(childTile);\n const frameState = this._tileManager.find(childTile.id).frameState;\n this.updateTile(childTile, frameState);\n\n // after tile fetched, resume traversal if still in current update/traversal frame\n if (\n this._frameNumber === frameState.frameNumber &&\n (this.traversalFinished(frameState) ||\n new Date().getTime() - this.lastUpdate > this.updateDebounceTime)\n ) {\n this.executeTraversal(childTile, frameState);\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AAGO,MAAMK,mBAAmB,SAASC,kCAAgB,CAAC;EAGxDC,WAAWA,CAACC,OAAO,EAAE;IACnB,KAAK,CAACA,OAAO,CAAC;IAAC,IAAAC,gBAA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CAACD,SAAS,CAACd,EAAE,CAAC,CAACH,UAAU;IAClE,IAAI,CAAC6B,UAAU,CAACZ,SAAS,EAAEjB,UAAU,CAAC;IAGtC,IACE,IAAI,CAACI,YAAY,KAAKJ,UAAU,CAACyC,WAAW,KAC3C,IAAI,CAAC1C,iBAAiB,CAACC,UAAU,CAAC,IACjC,IAAI0C,IAAI,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC,GAAG,IAAI,CAACC,UAAU,GAAG,IAAI,CAACC,kBAAkB,CAAC,EACnE;MACA,IAAI,CAACC,gBAAgB,CAAC7B,SAAS,EAAEjB,UAAU,CAAC;IAC9C;EACF;AACF;AAAC+C,OAAA,CAAAxD,mBAAA,GAAAA,mBAAA"}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.createBoundingVolume = createBoundingVolume;
|
|
8
7
|
exports.getCartographicBounds = getCartographicBounds;
|
|
9
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
8
|
var _core = require("@math.gl/core");
|
|
12
9
|
var _culling = require("@math.gl/culling");
|
|
13
10
|
var _geospatial = require("@math.gl/geospatial");
|
|
@@ -15,27 +12,21 @@ var _loaderUtils = require("@loaders.gl/loader-utils");
|
|
|
15
12
|
function defined(x) {
|
|
16
13
|
return x !== undefined && x !== null;
|
|
17
14
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
const scratchPoint = new _core.Vector3();
|
|
16
|
+
const scratchScale = new _core.Vector3();
|
|
17
|
+
const scratchNorthWest = new _core.Vector3();
|
|
18
|
+
const scratchSouthEast = new _core.Vector3();
|
|
22
19
|
function createBoundingVolume(boundingVolumeHeader, transform, result) {
|
|
23
20
|
(0, _loaderUtils.assert)(boundingVolumeHeader, '3D Tile: boundingVolume must be defined');
|
|
24
21
|
if (boundingVolumeHeader.box) {
|
|
25
22
|
return createBox(boundingVolumeHeader.box, transform, result);
|
|
26
23
|
}
|
|
27
24
|
if (boundingVolumeHeader.region) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
minHeight = _boundingVolumeHeader[4],
|
|
34
|
-
maxHeight = _boundingVolumeHeader[5];
|
|
35
|
-
var northWest = _geospatial.Ellipsoid.WGS84.cartographicToCartesian([(0, _core.degrees)(west), (0, _core.degrees)(north), minHeight], scratchNorthWest);
|
|
36
|
-
var southEast = _geospatial.Ellipsoid.WGS84.cartographicToCartesian([(0, _core.degrees)(east), (0, _core.degrees)(south), maxHeight], scratchSouthEast);
|
|
37
|
-
var centerInCartesian = new _core.Vector3().addVectors(northWest, southEast).multiplyScalar(0.5);
|
|
38
|
-
var radius = new _core.Vector3().subVectors(northWest, southEast).len() / 2.0;
|
|
25
|
+
const [west, south, east, north, minHeight, maxHeight] = boundingVolumeHeader.region;
|
|
26
|
+
const northWest = _geospatial.Ellipsoid.WGS84.cartographicToCartesian([(0, _core.degrees)(west), (0, _core.degrees)(north), minHeight], scratchNorthWest);
|
|
27
|
+
const southEast = _geospatial.Ellipsoid.WGS84.cartographicToCartesian([(0, _core.degrees)(east), (0, _core.degrees)(south), maxHeight], scratchSouthEast);
|
|
28
|
+
const centerInCartesian = new _core.Vector3().addVectors(northWest, southEast).multiplyScalar(0.5);
|
|
29
|
+
const radius = new _core.Vector3().subVectors(northWest, southEast).len() / 2.0;
|
|
39
30
|
return createSphere([centerInCartesian[0], centerInCartesian[1], centerInCartesian[2], radius], new _core.Matrix4());
|
|
40
31
|
}
|
|
41
32
|
if (boundingVolumeHeader.sphere) {
|
|
@@ -48,13 +39,7 @@ function getCartographicBounds(boundingVolumeHeader, boundingVolume) {
|
|
|
48
39
|
return orientedBoundingBoxToCartographicBounds(boundingVolume);
|
|
49
40
|
}
|
|
50
41
|
if (boundingVolumeHeader.region) {
|
|
51
|
-
|
|
52
|
-
west = _boundingVolumeHeader2[0],
|
|
53
|
-
south = _boundingVolumeHeader2[1],
|
|
54
|
-
east = _boundingVolumeHeader2[2],
|
|
55
|
-
north = _boundingVolumeHeader2[3],
|
|
56
|
-
minHeight = _boundingVolumeHeader2[4],
|
|
57
|
-
maxHeight = _boundingVolumeHeader2[5];
|
|
42
|
+
const [west, south, east, north, minHeight, maxHeight] = boundingVolumeHeader.region;
|
|
58
43
|
return [[(0, _core.degrees)(west), (0, _core.degrees)(south), minHeight], [(0, _core.degrees)(east), (0, _core.degrees)(north), maxHeight]];
|
|
59
44
|
}
|
|
60
45
|
if (boundingVolumeHeader.sphere) {
|
|
@@ -63,30 +48,30 @@ function getCartographicBounds(boundingVolumeHeader, boundingVolume) {
|
|
|
63
48
|
throw new Error('Unkown boundingVolume type');
|
|
64
49
|
}
|
|
65
50
|
function createBox(box, transform, result) {
|
|
66
|
-
|
|
51
|
+
const center = new _core.Vector3(box[0], box[1], box[2]);
|
|
67
52
|
transform.transform(center, center);
|
|
68
|
-
|
|
53
|
+
let origin = [];
|
|
69
54
|
if (box.length === 10) {
|
|
70
|
-
|
|
71
|
-
|
|
55
|
+
const halfSize = box.slice(3, 6);
|
|
56
|
+
const quaternion = new _core.Quaternion();
|
|
72
57
|
quaternion.fromArray(box, 6);
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
58
|
+
const x = new _core.Vector3([1, 0, 0]);
|
|
59
|
+
const y = new _core.Vector3([0, 1, 0]);
|
|
60
|
+
const z = new _core.Vector3([0, 0, 1]);
|
|
76
61
|
x.transformByQuaternion(quaternion);
|
|
77
62
|
x.scale(halfSize[0]);
|
|
78
63
|
y.transformByQuaternion(quaternion);
|
|
79
64
|
y.scale(halfSize[1]);
|
|
80
65
|
z.transformByQuaternion(quaternion);
|
|
81
66
|
z.scale(halfSize[2]);
|
|
82
|
-
origin = [
|
|
67
|
+
origin = [...x.toArray(), ...y.toArray(), ...z.toArray()];
|
|
83
68
|
} else {
|
|
84
|
-
origin = [
|
|
69
|
+
origin = [...box.slice(3, 6), ...box.slice(6, 9), ...box.slice(9, 12)];
|
|
85
70
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
71
|
+
const xAxis = transform.transformAsVector(origin.slice(0, 3));
|
|
72
|
+
const yAxis = transform.transformAsVector(origin.slice(3, 6));
|
|
73
|
+
const zAxis = transform.transformAsVector(origin.slice(6, 9));
|
|
74
|
+
const halfAxes = new _core.Matrix3([xAxis[0], xAxis[1], xAxis[2], yAxis[0], yAxis[1], yAxis[2], zAxis[0], zAxis[1], zAxis[2]]);
|
|
90
75
|
if (defined(result)) {
|
|
91
76
|
result.center = center;
|
|
92
77
|
result.halfAxes = halfAxes;
|
|
@@ -95,11 +80,11 @@ function createBox(box, transform, result) {
|
|
|
95
80
|
return new _culling.OrientedBoundingBox(center, halfAxes);
|
|
96
81
|
}
|
|
97
82
|
function createSphere(sphere, transform, result) {
|
|
98
|
-
|
|
83
|
+
const center = new _core.Vector3(sphere[0], sphere[1], sphere[2]);
|
|
99
84
|
transform.transform(center, center);
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
85
|
+
const scale = transform.getScale(scratchScale);
|
|
86
|
+
const uniformScale = Math.max(Math.max(scale[0], scale[1]), scale[2]);
|
|
87
|
+
const radius = sphere[3] * uniformScale;
|
|
103
88
|
if (defined(result)) {
|
|
104
89
|
result.center = center;
|
|
105
90
|
result.radius = radius;
|
|
@@ -108,15 +93,16 @@ function createSphere(sphere, transform, result) {
|
|
|
108
93
|
return new _culling.BoundingSphere(center, radius);
|
|
109
94
|
}
|
|
110
95
|
function orientedBoundingBoxToCartographicBounds(boundingVolume) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
halfAxes
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
96
|
+
const result = emptyCartographicBounds();
|
|
97
|
+
const {
|
|
98
|
+
halfAxes
|
|
99
|
+
} = boundingVolume;
|
|
100
|
+
const xAxis = new _core.Vector3(halfAxes.getColumn(0));
|
|
101
|
+
const yAxis = new _core.Vector3(halfAxes.getColumn(1));
|
|
102
|
+
const zAxis = new _core.Vector3(halfAxes.getColumn(2));
|
|
103
|
+
for (let x = 0; x < 2; x++) {
|
|
104
|
+
for (let y = 0; y < 2; y++) {
|
|
105
|
+
for (let z = 0; z < 2; z++) {
|
|
120
106
|
scratchPoint.copy(boundingVolume.center);
|
|
121
107
|
scratchPoint.add(xAxis);
|
|
122
108
|
scratchPoint.add(yAxis);
|
|
@@ -131,28 +117,28 @@ function orientedBoundingBoxToCartographicBounds(boundingVolume) {
|
|
|
131
117
|
return result;
|
|
132
118
|
}
|
|
133
119
|
function boundingSphereToCartographicBounds(boundingVolume) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
center
|
|
137
|
-
radius
|
|
138
|
-
|
|
139
|
-
|
|
120
|
+
const result = emptyCartographicBounds();
|
|
121
|
+
const {
|
|
122
|
+
center,
|
|
123
|
+
radius
|
|
124
|
+
} = boundingVolume;
|
|
125
|
+
const point = _geospatial.Ellipsoid.WGS84.scaleToGeodeticSurface(center, scratchPoint);
|
|
126
|
+
let zAxis;
|
|
140
127
|
if (point) {
|
|
141
128
|
zAxis = _geospatial.Ellipsoid.WGS84.geodeticSurfaceNormal(point);
|
|
142
129
|
} else {
|
|
143
130
|
zAxis = new _core.Vector3(0, 0, 1);
|
|
144
131
|
}
|
|
145
|
-
|
|
132
|
+
let xAxis = new _core.Vector3(zAxis[2], -zAxis[1], 0);
|
|
146
133
|
if (xAxis.len() > 0) {
|
|
147
134
|
xAxis.normalize();
|
|
148
135
|
} else {
|
|
149
136
|
xAxis = new _core.Vector3(0, 1, 0);
|
|
150
137
|
}
|
|
151
|
-
|
|
152
|
-
for (
|
|
153
|
-
var axis = _arr[_i];
|
|
138
|
+
const yAxis = xAxis.clone().cross(zAxis);
|
|
139
|
+
for (const axis of [xAxis, yAxis, zAxis]) {
|
|
154
140
|
scratchScale.copy(axis).scale(radius);
|
|
155
|
-
for (
|
|
141
|
+
for (let dir = 0; dir < 2; dir++) {
|
|
156
142
|
scratchPoint.copy(center);
|
|
157
143
|
scratchPoint.add(scratchScale);
|
|
158
144
|
addToCartographicBounds(result, scratchPoint);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bounding-volume.js","names":["_core","require","_culling","_geospatial","_loaderUtils","defined","x","undefined","scratchPoint","Vector3","scratchScale","scratchNorthWest","scratchSouthEast","createBoundingVolume","boundingVolumeHeader","transform","result","assert","box","createBox","region","_boundingVolumeHeader","_slicedToArray2","default","west","south","east","north","minHeight","maxHeight","northWest","Ellipsoid","WGS84","cartographicToCartesian","degrees","southEast","centerInCartesian","addVectors","multiplyScalar","radius","subVectors","len","createSphere","Matrix4","sphere","Error","getCartographicBounds","boundingVolume","orientedBoundingBoxToCartographicBounds","_boundingVolumeHeader2","boundingSphereToCartographicBounds","center","origin","length","halfSize","slice","quaternion","Quaternion","fromArray","y","z","transformByQuaternion","scale","concat","_toConsumableArray2","toArray","xAxis","transformAsVector","yAxis","zAxis","halfAxes","Matrix3","OrientedBoundingBox","getScale","uniformScale","Math","max","BoundingSphere","emptyCartographicBounds","_ref","getColumn","copy","add","addToCartographicBounds","negate","_ref2","point","scaleToGeodeticSurface","geodeticSurfaceNormal","normalize","clone","cross","_i","_arr","axis","dir","Infinity","target","cartesian","cartesianToCartographic","min"],"sources":["../../../../src/tileset/helpers/bounding-volume.ts"],"sourcesContent":["// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\n/* eslint-disable */\nimport {Quaternion, Vector3, Matrix3, Matrix4, degrees} from '@math.gl/core';\nimport {BoundingSphere, OrientedBoundingBox} from '@math.gl/culling';\nimport {Ellipsoid} from '@math.gl/geospatial';\nimport {assert} from '@loaders.gl/loader-utils';\n\n// const scratchProjectedBoundingSphere = new BoundingSphere();\n\nfunction defined(x) {\n return x !== undefined && x !== null;\n}\n\n// const scratchMatrix = new Matrix3();\nconst scratchPoint = new Vector3();\nconst scratchScale = new Vector3();\nconst scratchNorthWest = new Vector3();\nconst scratchSouthEast = new Vector3();\n// const scratchRectangle = new Rectangle();\n// const scratchOrientedBoundingBox = new OrientedBoundingBox();\n// const scratchTransform = new Matrix4();\n\n/**\n * Create a bounding volume from the tile's bounding volume header.\n * @param {Object} boundingVolumeHeader The tile's bounding volume header.\n * @param {Matrix4} transform The transform to apply to the bounding volume.\n * @param [result] The object onto which to store the result.\n * @returns The modified result parameter or a new TileBoundingVolume instance if none was provided.\n */\nexport function createBoundingVolume(boundingVolumeHeader, transform, result) {\n assert(boundingVolumeHeader, '3D Tile: boundingVolume must be defined');\n\n // boundingVolume schema:\n // https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/specification/schema/boundingVolume.schema.json\n if (boundingVolumeHeader.box) {\n return createBox(boundingVolumeHeader.box, transform, result);\n }\n if (boundingVolumeHeader.region) {\n // [west, south, east, north, minimum height, maximum height]\n // Latitudes and longitudes are in the WGS 84 datum as defined in EPSG 4979 and are in radians.\n // Heights are in meters above (or below) the WGS 84 ellipsoid.\n const [west, south, east, north, minHeight, maxHeight] = boundingVolumeHeader.region;\n\n const northWest = Ellipsoid.WGS84.cartographicToCartesian(\n [degrees(west), degrees(north), minHeight],\n scratchNorthWest\n );\n const southEast = Ellipsoid.WGS84.cartographicToCartesian(\n [degrees(east), degrees(south), maxHeight],\n scratchSouthEast\n );\n const centerInCartesian = new Vector3().addVectors(northWest, southEast).multiplyScalar(0.5);\n const radius = new Vector3().subVectors(northWest, southEast).len() / 2.0;\n\n // TODO improve region boundingVolume\n // for now, create a sphere as the boundingVolume instead of box\n return createSphere(\n [centerInCartesian[0], centerInCartesian[1], centerInCartesian[2], radius],\n new Matrix4()\n );\n }\n\n if (boundingVolumeHeader.sphere) {\n return createSphere(boundingVolumeHeader.sphere, transform, result);\n }\n\n throw new Error('3D Tile: boundingVolume must contain a sphere, region, or box');\n}\n\n/** [min, max] each in [longitude, latitude, altitude] */\nexport type CartographicBounds = [min: number[], max: number[]];\n\n/**\n * Calculate the cartographic bounding box the tile's bounding volume.\n * @param {Object} boundingVolumeHeader The tile's bounding volume header.\n * @param {BoundingVolume} boundingVolume The bounding volume.\n * @returns {CartographicBounds}\n */\nexport function getCartographicBounds(\n boundingVolumeHeader,\n boundingVolume: OrientedBoundingBox | BoundingSphere\n): CartographicBounds {\n // boundingVolume schema:\n // https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/specification/schema/boundingVolume.schema.json\n if (boundingVolumeHeader.box) {\n return orientedBoundingBoxToCartographicBounds(boundingVolume as OrientedBoundingBox);\n }\n if (boundingVolumeHeader.region) {\n // [west, south, east, north, minimum height, maximum height]\n // Latitudes and longitudes are in the WGS 84 datum as defined in EPSG 4979 and are in radians.\n // Heights are in meters above (or below) the WGS 84 ellipsoid.\n const [west, south, east, north, minHeight, maxHeight] = boundingVolumeHeader.region;\n\n return [\n [degrees(west), degrees(south), minHeight],\n [degrees(east), degrees(north), maxHeight]\n ];\n }\n\n if (boundingVolumeHeader.sphere) {\n return boundingSphereToCartographicBounds(boundingVolume as BoundingSphere);\n }\n\n throw new Error('Unkown boundingVolume type');\n}\n\nfunction createBox(box, transform, result) {\n // https://math.gl/modules/culling/docs/api-reference/oriented-bounding-box\n // 1. A half-axes based representation.\n // box: An array of 12 numbers that define an oriented bounding box.\n // The first three elements define the x, y, and z values for the center of the box.\n // The next three elements (with indices 3, 4, and 5) define the x axis direction and half-length.\n // The next three elements (indices 6, 7, and 8) define the y axis direction and half-length.\n // The last three elements (indices 9, 10, and 11) define the z axis direction and half-length.\n // 2. A half-size-quaternion based representation.\n // box: An array of 10 numbers that define an oriented bounding box.\n // The first three elements define the x, y, and z values for the center of the box in a right-handed 3-axis (x, y, z) Cartesian coordinate system where the z-axis is up.\n // The next three elements (with indices 3, 4, and 5) define the halfSize.\n // The last four elements (indices 6, 7, 8 and 10) define the quaternion.\n const center = new Vector3(box[0], box[1], box[2]);\n transform.transform(center, center);\n let origin: number[] = [];\n if (box.length === 10) {\n const halfSize = box.slice(3, 6);\n const quaternion = new Quaternion();\n quaternion.fromArray(box, 6);\n const x = new Vector3([1, 0, 0]);\n const y = new Vector3([0, 1, 0]);\n const z = new Vector3([0, 0, 1]);\n x.transformByQuaternion(quaternion);\n x.scale(halfSize[0]);\n y.transformByQuaternion(quaternion);\n y.scale(halfSize[1]);\n z.transformByQuaternion(quaternion);\n z.scale(halfSize[2]);\n origin = [...x.toArray(), ...y.toArray(), ...z.toArray()];\n } else {\n origin = [...box.slice(3, 6), ...box.slice(6, 9), ...box.slice(9, 12)];\n }\n const xAxis = transform.transformAsVector(origin.slice(0, 3));\n const yAxis = transform.transformAsVector(origin.slice(3, 6));\n const zAxis = transform.transformAsVector(origin.slice(6, 9));\n const halfAxes = new Matrix3([\n xAxis[0],\n xAxis[1],\n xAxis[2],\n yAxis[0],\n yAxis[1],\n yAxis[2],\n zAxis[0],\n zAxis[1],\n zAxis[2]\n ]);\n\n if (defined(result)) {\n result.center = center;\n result.halfAxes = halfAxes;\n return result;\n }\n\n return new OrientedBoundingBox(center, halfAxes);\n}\n\n/*\nfunction createBoxFromTransformedRegion(region, transform, initialTransform, result) {\n const rectangle = Rectangle.unpack(region, 0, scratchRectangle);\n const minimumHeight = region[4];\n const maximumHeight = region[5];\n\n const orientedBoundingBox = OrientedBoundingBox.fromRectangle(\n rectangle,\n minimumHeight,\n maximumHeight,\n Ellipsoid.WGS84,\n scratchOrientedBoundingBox\n );\n const center = orientedBoundingBox.center;\n const halfAxes = orientedBoundingBox.halfAxes;\n\n // A region bounding volume is not transformed by the transform in the tileset JSON,\n // but may be transformed by additional transforms applied in Cesium.\n // This is why the transform is calculated as the difference between the initial transform and the current transform.\n transform = Matrix4.multiplyTransformation(\n transform,\n Matrix4.inverseTransformation(initialTransform, scratchTransform),\n scratchTransform\n );\n center = Matrix4.multiplyByPoint(transform, center, center);\n const rotationScale = Matrix4.getRotation(transform, scratchMatrix);\n halfAxes = Matrix3.multiply(rotationScale, halfAxes, halfAxes);\n\n if (defined(result) && result instanceof TileOrientedBoundingBox) {\n result.update(center, halfAxes);\n return result;\n }\n\n return new TileOrientedBoundingBox(center, halfAxes);\n}\n\nfunction createRegion(region, transform, initialTransform, result) {\n if (!Matrix4.equalsEpsilon(transform, initialTransform, CesiumMath.EPSILON8)) {\n return createBoxFromTransformedRegion(region, transform, initialTransform, result);\n }\n\n if (defined(result)) {\n return result;\n }\n\n const rectangleRegion = Rectangle.unpack(region, 0, scratchRectangle);\n\n return new TileBoundingRegion({\n rectangle: rectangleRegion,\n minimumHeight: region[4],\n maximumHeight: region[5]\n });\n}\n*/\n\nfunction createSphere(sphere, transform, result?) {\n // Find the transformed center\n const center = new Vector3(sphere[0], sphere[1], sphere[2]);\n transform.transform(center, center);\n const scale = transform.getScale(scratchScale);\n\n const uniformScale = Math.max(Math.max(scale[0], scale[1]), scale[2]);\n const radius = sphere[3] * uniformScale;\n\n if (defined(result)) {\n result.center = center;\n result.radius = radius;\n return result;\n }\n\n return new BoundingSphere(center, radius);\n}\n\n/**\n * Convert a bounding volume defined by OrientedBoundingBox to cartographic bounds\n * @returns {CartographicBounds}\n */\nfunction orientedBoundingBoxToCartographicBounds(\n boundingVolume: OrientedBoundingBox\n): CartographicBounds {\n const result = emptyCartographicBounds();\n\n const {halfAxes} = boundingVolume as OrientedBoundingBox;\n const xAxis = new Vector3(halfAxes.getColumn(0));\n const yAxis = new Vector3(halfAxes.getColumn(1));\n const zAxis = new Vector3(halfAxes.getColumn(2));\n\n // Test all 8 corners of the box\n for (let x = 0; x < 2; x++) {\n for (let y = 0; y < 2; y++) {\n for (let z = 0; z < 2; z++) {\n scratchPoint.copy(boundingVolume.center);\n scratchPoint.add(xAxis);\n scratchPoint.add(yAxis);\n scratchPoint.add(zAxis);\n\n addToCartographicBounds(result, scratchPoint);\n zAxis.negate();\n }\n yAxis.negate();\n }\n xAxis.negate();\n }\n return result;\n}\n\n/**\n * Convert a bounding volume defined by BoundingSphere to cartographic bounds\n * @returns {CartographicBounds}\n */\nfunction boundingSphereToCartographicBounds(boundingVolume: BoundingSphere): CartographicBounds {\n const result = emptyCartographicBounds();\n\n const {center, radius} = boundingVolume as BoundingSphere;\n const point = Ellipsoid.WGS84.scaleToGeodeticSurface(center, scratchPoint);\n\n let zAxis: Vector3;\n if (point) {\n zAxis = Ellipsoid.WGS84.geodeticSurfaceNormal(point) as Vector3;\n } else {\n zAxis = new Vector3(0, 0, 1);\n }\n let xAxis = new Vector3(zAxis[2], -zAxis[1], 0);\n if (xAxis.len() > 0) {\n xAxis.normalize();\n } else {\n xAxis = new Vector3(0, 1, 0);\n }\n const yAxis = xAxis.clone().cross(zAxis);\n\n // Test 6 end points of the 3 axes\n for (const axis of [xAxis, yAxis, zAxis]) {\n scratchScale.copy(axis).scale(radius);\n for (let dir = 0; dir < 2; dir++) {\n scratchPoint.copy(center);\n scratchPoint.add(scratchScale);\n addToCartographicBounds(result, scratchPoint);\n // Flip the axis\n scratchScale.negate();\n }\n }\n return result;\n}\n\n/**\n * Create a new cartographic bounds that contains no points\n * @returns {CartographicBounds}\n */\nfunction emptyCartographicBounds(): CartographicBounds {\n return [\n [Infinity, Infinity, Infinity],\n [-Infinity, -Infinity, -Infinity]\n ];\n}\n\n/**\n * Add a point to the target cartographic bounds\n * @param {CartographicBounds} target\n * @param {Vector3} cartesian coordinates of the point to add\n */\nfunction addToCartographicBounds(target: CartographicBounds, cartesian: Readonly<Vector3>) {\n Ellipsoid.WGS84.cartesianToCartographic(cartesian, scratchPoint);\n target[0][0] = Math.min(target[0][0], scratchPoint[0]);\n target[0][1] = Math.min(target[0][1], scratchPoint[1]);\n target[0][2] = Math.min(target[0][2], scratchPoint[2]);\n\n target[1][0] = Math.max(target[1][0], scratchPoint[0]);\n target[1][1] = Math.max(target[1][1], scratchPoint[1]);\n target[1][2] = Math.max(target[1][2], scratchPoint[2]);\n}\n"],"mappings":";;;;;;;;;;AAIA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAIA,SAASI,OAAOA,CAACC,CAAC,EAAE;EAClB,OAAOA,CAAC,KAAKC,SAAS,IAAID,CAAC,KAAK,IAAI;AACtC;AAGA,IAAME,YAAY,GAAG,IAAIC,aAAO,CAAC,CAAC;AAClC,IAAMC,YAAY,GAAG,IAAID,aAAO,CAAC,CAAC;AAClC,IAAME,gBAAgB,GAAG,IAAIF,aAAO,CAAC,CAAC;AACtC,IAAMG,gBAAgB,GAAG,IAAIH,aAAO,CAAC,CAAC;AAY/B,SAASI,oBAAoBA,CAACC,oBAAoB,EAAEC,SAAS,EAAEC,MAAM,EAAE;EAC5E,IAAAC,mBAAM,EAACH,oBAAoB,EAAE,yCAAyC,CAAC;EAIvE,IAAIA,oBAAoB,CAACI,GAAG,EAAE;IAC5B,OAAOC,SAAS,CAACL,oBAAoB,CAACI,GAAG,EAAEH,SAAS,EAAEC,MAAM,CAAC;EAC/D;EACA,IAAIF,oBAAoB,CAACM,MAAM,EAAE;IAI/B,IAAAC,qBAAA,OAAAC,eAAA,CAAAC,OAAA,EAAyDT,oBAAoB,CAACM,MAAM;MAA7EI,IAAI,GAAAH,qBAAA;MAAEI,KAAK,GAAAJ,qBAAA;MAAEK,IAAI,GAAAL,qBAAA;MAAEM,KAAK,GAAAN,qBAAA;MAAEO,SAAS,GAAAP,qBAAA;MAAEQ,SAAS,GAAAR,qBAAA;IAErD,IAAMS,SAAS,GAAGC,qBAAS,CAACC,KAAK,CAACC,uBAAuB,CACvD,CAAC,IAAAC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AAC,CAAC,CAAC,CAAC,GAAGtB,IAAI,CAACC,GAAG,CAACqB,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAEzF,YAAY,CAAC,CAAC,CAAC,CAAC;EACtDyF,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAGtB,IAAI,CAACC,GAAG,CAACqB,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAEzF,YAAY,CAAC,CAAC,CAAC,CAAC;EACtDyF,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAGtB,IAAI,CAACC,GAAG,CAACqB,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAEzF,YAAY,CAAC,CAAC,CAAC,CAAC;AACxD"}
|
|
1
|
+
{"version":3,"file":"bounding-volume.js","names":["_core","require","_culling","_geospatial","_loaderUtils","defined","x","undefined","scratchPoint","Vector3","scratchScale","scratchNorthWest","scratchSouthEast","createBoundingVolume","boundingVolumeHeader","transform","result","assert","box","createBox","region","west","south","east","north","minHeight","maxHeight","northWest","Ellipsoid","WGS84","cartographicToCartesian","degrees","southEast","centerInCartesian","addVectors","multiplyScalar","radius","subVectors","len","createSphere","Matrix4","sphere","Error","getCartographicBounds","boundingVolume","orientedBoundingBoxToCartographicBounds","boundingSphereToCartographicBounds","center","origin","length","halfSize","slice","quaternion","Quaternion","fromArray","y","z","transformByQuaternion","scale","toArray","xAxis","transformAsVector","yAxis","zAxis","halfAxes","Matrix3","OrientedBoundingBox","getScale","uniformScale","Math","max","BoundingSphere","emptyCartographicBounds","getColumn","copy","add","addToCartographicBounds","negate","point","scaleToGeodeticSurface","geodeticSurfaceNormal","normalize","clone","cross","axis","dir","Infinity","target","cartesian","cartesianToCartographic","min"],"sources":["../../../../src/tileset/helpers/bounding-volume.ts"],"sourcesContent":["// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\n/* eslint-disable */\nimport {Quaternion, Vector3, Matrix3, Matrix4, degrees} from '@math.gl/core';\nimport {BoundingSphere, OrientedBoundingBox} from '@math.gl/culling';\nimport {Ellipsoid} from '@math.gl/geospatial';\nimport {assert} from '@loaders.gl/loader-utils';\n\n// const scratchProjectedBoundingSphere = new BoundingSphere();\n\nfunction defined(x) {\n return x !== undefined && x !== null;\n}\n\n// const scratchMatrix = new Matrix3();\nconst scratchPoint = new Vector3();\nconst scratchScale = new Vector3();\nconst scratchNorthWest = new Vector3();\nconst scratchSouthEast = new Vector3();\n// const scratchRectangle = new Rectangle();\n// const scratchOrientedBoundingBox = new OrientedBoundingBox();\n// const scratchTransform = new Matrix4();\n\n/**\n * Create a bounding volume from the tile's bounding volume header.\n * @param {Object} boundingVolumeHeader The tile's bounding volume header.\n * @param {Matrix4} transform The transform to apply to the bounding volume.\n * @param [result] The object onto which to store the result.\n * @returns The modified result parameter or a new TileBoundingVolume instance if none was provided.\n */\nexport function createBoundingVolume(boundingVolumeHeader, transform, result) {\n assert(boundingVolumeHeader, '3D Tile: boundingVolume must be defined');\n\n // boundingVolume schema:\n // https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/specification/schema/boundingVolume.schema.json\n if (boundingVolumeHeader.box) {\n return createBox(boundingVolumeHeader.box, transform, result);\n }\n if (boundingVolumeHeader.region) {\n // [west, south, east, north, minimum height, maximum height]\n // Latitudes and longitudes are in the WGS 84 datum as defined in EPSG 4979 and are in radians.\n // Heights are in meters above (or below) the WGS 84 ellipsoid.\n const [west, south, east, north, minHeight, maxHeight] = boundingVolumeHeader.region;\n\n const northWest = Ellipsoid.WGS84.cartographicToCartesian(\n [degrees(west), degrees(north), minHeight],\n scratchNorthWest\n );\n const southEast = Ellipsoid.WGS84.cartographicToCartesian(\n [degrees(east), degrees(south), maxHeight],\n scratchSouthEast\n );\n const centerInCartesian = new Vector3().addVectors(northWest, southEast).multiplyScalar(0.5);\n const radius = new Vector3().subVectors(northWest, southEast).len() / 2.0;\n\n // TODO improve region boundingVolume\n // for now, create a sphere as the boundingVolume instead of box\n return createSphere(\n [centerInCartesian[0], centerInCartesian[1], centerInCartesian[2], radius],\n new Matrix4()\n );\n }\n\n if (boundingVolumeHeader.sphere) {\n return createSphere(boundingVolumeHeader.sphere, transform, result);\n }\n\n throw new Error('3D Tile: boundingVolume must contain a sphere, region, or box');\n}\n\n/** [min, max] each in [longitude, latitude, altitude] */\nexport type CartographicBounds = [min: number[], max: number[]];\n\n/**\n * Calculate the cartographic bounding box the tile's bounding volume.\n * @param {Object} boundingVolumeHeader The tile's bounding volume header.\n * @param {BoundingVolume} boundingVolume The bounding volume.\n * @returns {CartographicBounds}\n */\nexport function getCartographicBounds(\n boundingVolumeHeader,\n boundingVolume: OrientedBoundingBox | BoundingSphere\n): CartographicBounds {\n // boundingVolume schema:\n // https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/specification/schema/boundingVolume.schema.json\n if (boundingVolumeHeader.box) {\n return orientedBoundingBoxToCartographicBounds(boundingVolume as OrientedBoundingBox);\n }\n if (boundingVolumeHeader.region) {\n // [west, south, east, north, minimum height, maximum height]\n // Latitudes and longitudes are in the WGS 84 datum as defined in EPSG 4979 and are in radians.\n // Heights are in meters above (or below) the WGS 84 ellipsoid.\n const [west, south, east, north, minHeight, maxHeight] = boundingVolumeHeader.region;\n\n return [\n [degrees(west), degrees(south), minHeight],\n [degrees(east), degrees(north), maxHeight]\n ];\n }\n\n if (boundingVolumeHeader.sphere) {\n return boundingSphereToCartographicBounds(boundingVolume as BoundingSphere);\n }\n\n throw new Error('Unkown boundingVolume type');\n}\n\nfunction createBox(box, transform, result) {\n // https://math.gl/modules/culling/docs/api-reference/oriented-bounding-box\n // 1. A half-axes based representation.\n // box: An array of 12 numbers that define an oriented bounding box.\n // The first three elements define the x, y, and z values for the center of the box.\n // The next three elements (with indices 3, 4, and 5) define the x axis direction and half-length.\n // The next three elements (indices 6, 7, and 8) define the y axis direction and half-length.\n // The last three elements (indices 9, 10, and 11) define the z axis direction and half-length.\n // 2. A half-size-quaternion based representation.\n // box: An array of 10 numbers that define an oriented bounding box.\n // The first three elements define the x, y, and z values for the center of the box in a right-handed 3-axis (x, y, z) Cartesian coordinate system where the z-axis is up.\n // The next three elements (with indices 3, 4, and 5) define the halfSize.\n // The last four elements (indices 6, 7, 8 and 10) define the quaternion.\n const center = new Vector3(box[0], box[1], box[2]);\n transform.transform(center, center);\n let origin: number[] = [];\n if (box.length === 10) {\n const halfSize = box.slice(3, 6);\n const quaternion = new Quaternion();\n quaternion.fromArray(box, 6);\n const x = new Vector3([1, 0, 0]);\n const y = new Vector3([0, 1, 0]);\n const z = new Vector3([0, 0, 1]);\n x.transformByQuaternion(quaternion);\n x.scale(halfSize[0]);\n y.transformByQuaternion(quaternion);\n y.scale(halfSize[1]);\n z.transformByQuaternion(quaternion);\n z.scale(halfSize[2]);\n origin = [...x.toArray(), ...y.toArray(), ...z.toArray()];\n } else {\n origin = [...box.slice(3, 6), ...box.slice(6, 9), ...box.slice(9, 12)];\n }\n const xAxis = transform.transformAsVector(origin.slice(0, 3));\n const yAxis = transform.transformAsVector(origin.slice(3, 6));\n const zAxis = transform.transformAsVector(origin.slice(6, 9));\n const halfAxes = new Matrix3([\n xAxis[0],\n xAxis[1],\n xAxis[2],\n yAxis[0],\n yAxis[1],\n yAxis[2],\n zAxis[0],\n zAxis[1],\n zAxis[2]\n ]);\n\n if (defined(result)) {\n result.center = center;\n result.halfAxes = halfAxes;\n return result;\n }\n\n return new OrientedBoundingBox(center, halfAxes);\n}\n\n/*\nfunction createBoxFromTransformedRegion(region, transform, initialTransform, result) {\n const rectangle = Rectangle.unpack(region, 0, scratchRectangle);\n const minimumHeight = region[4];\n const maximumHeight = region[5];\n\n const orientedBoundingBox = OrientedBoundingBox.fromRectangle(\n rectangle,\n minimumHeight,\n maximumHeight,\n Ellipsoid.WGS84,\n scratchOrientedBoundingBox\n );\n const center = orientedBoundingBox.center;\n const halfAxes = orientedBoundingBox.halfAxes;\n\n // A region bounding volume is not transformed by the transform in the tileset JSON,\n // but may be transformed by additional transforms applied in Cesium.\n // This is why the transform is calculated as the difference between the initial transform and the current transform.\n transform = Matrix4.multiplyTransformation(\n transform,\n Matrix4.inverseTransformation(initialTransform, scratchTransform),\n scratchTransform\n );\n center = Matrix4.multiplyByPoint(transform, center, center);\n const rotationScale = Matrix4.getRotation(transform, scratchMatrix);\n halfAxes = Matrix3.multiply(rotationScale, halfAxes, halfAxes);\n\n if (defined(result) && result instanceof TileOrientedBoundingBox) {\n result.update(center, halfAxes);\n return result;\n }\n\n return new TileOrientedBoundingBox(center, halfAxes);\n}\n\nfunction createRegion(region, transform, initialTransform, result) {\n if (!Matrix4.equalsEpsilon(transform, initialTransform, CesiumMath.EPSILON8)) {\n return createBoxFromTransformedRegion(region, transform, initialTransform, result);\n }\n\n if (defined(result)) {\n return result;\n }\n\n const rectangleRegion = Rectangle.unpack(region, 0, scratchRectangle);\n\n return new TileBoundingRegion({\n rectangle: rectangleRegion,\n minimumHeight: region[4],\n maximumHeight: region[5]\n });\n}\n*/\n\nfunction createSphere(sphere, transform, result?) {\n // Find the transformed center\n const center = new Vector3(sphere[0], sphere[1], sphere[2]);\n transform.transform(center, center);\n const scale = transform.getScale(scratchScale);\n\n const uniformScale = Math.max(Math.max(scale[0], scale[1]), scale[2]);\n const radius = sphere[3] * uniformScale;\n\n if (defined(result)) {\n result.center = center;\n result.radius = radius;\n return result;\n }\n\n return new BoundingSphere(center, radius);\n}\n\n/**\n * Convert a bounding volume defined by OrientedBoundingBox to cartographic bounds\n * @returns {CartographicBounds}\n */\nfunction orientedBoundingBoxToCartographicBounds(\n boundingVolume: OrientedBoundingBox\n): CartographicBounds {\n const result = emptyCartographicBounds();\n\n const {halfAxes} = boundingVolume as OrientedBoundingBox;\n const xAxis = new Vector3(halfAxes.getColumn(0));\n const yAxis = new Vector3(halfAxes.getColumn(1));\n const zAxis = new Vector3(halfAxes.getColumn(2));\n\n // Test all 8 corners of the box\n for (let x = 0; x < 2; x++) {\n for (let y = 0; y < 2; y++) {\n for (let z = 0; z < 2; z++) {\n scratchPoint.copy(boundingVolume.center);\n scratchPoint.add(xAxis);\n scratchPoint.add(yAxis);\n scratchPoint.add(zAxis);\n\n addToCartographicBounds(result, scratchPoint);\n zAxis.negate();\n }\n yAxis.negate();\n }\n xAxis.negate();\n }\n return result;\n}\n\n/**\n * Convert a bounding volume defined by BoundingSphere to cartographic bounds\n * @returns {CartographicBounds}\n */\nfunction boundingSphereToCartographicBounds(boundingVolume: BoundingSphere): CartographicBounds {\n const result = emptyCartographicBounds();\n\n const {center, radius} = boundingVolume as BoundingSphere;\n const point = Ellipsoid.WGS84.scaleToGeodeticSurface(center, scratchPoint);\n\n let zAxis: Vector3;\n if (point) {\n zAxis = Ellipsoid.WGS84.geodeticSurfaceNormal(point) as Vector3;\n } else {\n zAxis = new Vector3(0, 0, 1);\n }\n let xAxis = new Vector3(zAxis[2], -zAxis[1], 0);\n if (xAxis.len() > 0) {\n xAxis.normalize();\n } else {\n xAxis = new Vector3(0, 1, 0);\n }\n const yAxis = xAxis.clone().cross(zAxis);\n\n // Test 6 end points of the 3 axes\n for (const axis of [xAxis, yAxis, zAxis]) {\n scratchScale.copy(axis).scale(radius);\n for (let dir = 0; dir < 2; dir++) {\n scratchPoint.copy(center);\n scratchPoint.add(scratchScale);\n addToCartographicBounds(result, scratchPoint);\n // Flip the axis\n scratchScale.negate();\n }\n }\n return result;\n}\n\n/**\n * Create a new cartographic bounds that contains no points\n * @returns {CartographicBounds}\n */\nfunction emptyCartographicBounds(): CartographicBounds {\n return [\n [Infinity, Infinity, Infinity],\n [-Infinity, -Infinity, -Infinity]\n ];\n}\n\n/**\n * Add a point to the target cartographic bounds\n * @param {CartographicBounds} target\n * @param {Vector3} cartesian coordinates of the point to add\n */\nfunction addToCartographicBounds(target: CartographicBounds, cartesian: Readonly<Vector3>) {\n Ellipsoid.WGS84.cartesianToCartographic(cartesian, scratchPoint);\n target[0][0] = Math.min(target[0][0], scratchPoint[0]);\n target[0][1] = Math.min(target[0][1], scratchPoint[1]);\n target[0][2] = Math.min(target[0][2], scratchPoint[2]);\n\n target[1][0] = Math.max(target[1][0], scratchPoint[0]);\n target[1][1] = Math.max(target[1][1], scratchPoint[1]);\n target[1][2] = Math.max(target[1][2], scratchPoint[2]);\n}\n"],"mappings":";;;;;;;AAIA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAIA,SAASI,OAAOA,CAACC,CAAC,EAAE;EAClB,OAAOA,CAAC,KAAKC,SAAS,IAAID,CAAC,KAAK,IAAI;AACtC;AAGA,MAAME,YAAY,GAAG,IAAIC,aAAO,CAAC,CAAC;AAClC,MAAMC,YAAY,GAAG,IAAID,aAAO,CAAC,CAAC;AAClC,MAAME,gBAAgB,GAAG,IAAIF,aAAO,CAAC,CAAC;AACtC,MAAMG,gBAAgB,GAAG,IAAIH,aAAO,CAAC,CAAC;AAY/B,SAASI,oBAAoBA,CAACC,oBAAoB,EAAEC,SAAS,EAAEC,MAAM,EAAE;EAC5E,IAAAC,mBAAM,EAACH,oBAAoB,EAAE,yCAAyC,CAAC;EAIvE,IAAIA,oBAAoB,CAACI,GAAG,EAAE;IAC5B,OAAOC,SAAS,CAACL,oBAAoB,CAACI,GAAG,EAAEH,SAAS,EAAEC,MAAM,CAAC;EAC/D;EACA,IAAIF,oBAAoB,CAACM,MAAM,EAAE;IAI/B,MAAM,CAACC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,KAAK,EAAEC,SAAS,EAAEC,SAAS,CAAC,GAAGZ,oBAAoB,CAACM,MAAM;IAEpF,MAAMO,SAAS,GAAGC,qBAAS,CAACC,KAAK,CAACC,uBAAuB,CACvD,CAAC,IAAAC,aAAO,EAACV,IAAI,CAAC,EAAE,IAAAU,aAAO,EAACP,KAAK,CAAC,EAAEC,SAAS,CAAC,EA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