@loaders.gl/3d-tiles 4.2.0-alpha.4 → 4.2.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/3d-tiles-archive/3d-tiles-archive-archive.js +66 -41
- package/dist/3d-tiles-archive/3d-tiles-archive-parser.d.ts +1 -1
- package/dist/3d-tiles-archive/3d-tiles-archive-parser.d.ts.map +1 -1
- package/dist/3d-tiles-archive/3d-tiles-archive-parser.js +26 -16
- package/dist/3d-tiles-archive-loader.js +25 -14
- package/dist/cesium-ion-loader.js +34 -30
- package/dist/dist.dev.js +1963 -1037
- package/dist/dist.min.js +32 -0
- package/dist/index.cjs +122 -337
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +13 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/lib/classes/helpers/tile-3d-accessor-utils.js +103 -87
- package/dist/lib/classes/tile-3d-batch-table-hierarchy.js +179 -155
- package/dist/lib/classes/tile-3d-batch-table.js +232 -217
- package/dist/lib/classes/tile-3d-feature-table.js +62 -59
- package/dist/lib/constants.js +19 -15
- package/dist/lib/encoders/encode-3d-tile-batched-model.js +40 -35
- package/dist/lib/encoders/encode-3d-tile-composite.js +19 -17
- package/dist/lib/encoders/encode-3d-tile-instanced-model.js +32 -31
- package/dist/lib/encoders/encode-3d-tile-point-cloud.js +31 -32
- package/dist/lib/encoders/encode-3d-tile.js +23 -19
- package/dist/lib/encoders/helpers/encode-3d-tile-header.js +23 -23
- package/dist/lib/ion/ion.js +55 -54
- package/dist/lib/parsers/helpers/normalize-3d-tile-colors.d.ts +1 -1
- package/dist/lib/parsers/helpers/normalize-3d-tile-colors.d.ts.map +1 -1
- package/dist/lib/parsers/helpers/normalize-3d-tile-colors.js +57 -51
- package/dist/lib/parsers/helpers/normalize-3d-tile-normals.d.ts +1 -1
- package/dist/lib/parsers/helpers/normalize-3d-tile-normals.d.ts.map +1 -1
- package/dist/lib/parsers/helpers/normalize-3d-tile-normals.js +21 -18
- package/dist/lib/parsers/helpers/normalize-3d-tile-positions.js +35 -20
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts +4 -4
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts.map +1 -1
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.js +269 -234
- package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.d.ts +2 -2
- package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.d.ts.map +1 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.js +83 -55
- package/dist/lib/parsers/helpers/parse-3d-tile-header.d.ts +1 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-header.d.ts.map +1 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-header.js +23 -14
- package/dist/lib/parsers/helpers/parse-3d-tile-subtree.d.ts +1 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-subtree.d.ts.map +1 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-subtree.js +82 -54
- package/dist/lib/parsers/helpers/parse-3d-tile-tables.d.ts +2 -2
- package/dist/lib/parsers/helpers/parse-3d-tile-tables.d.ts.map +1 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-tables.js +79 -68
- package/dist/lib/parsers/helpers/parse-utils.js +19 -14
- package/dist/lib/parsers/parse-3d-tile-batched-model.d.ts +2 -2
- package/dist/lib/parsers/parse-3d-tile-batched-model.d.ts.map +1 -1
- package/dist/lib/parsers/parse-3d-tile-batched-model.js +21 -17
- package/dist/lib/parsers/parse-3d-tile-composite.d.ts +2 -2
- package/dist/lib/parsers/parse-3d-tile-composite.d.ts.map +1 -1
- package/dist/lib/parsers/parse-3d-tile-composite.js +18 -14
- package/dist/lib/parsers/parse-3d-tile-gltf.d.ts +2 -2
- package/dist/lib/parsers/parse-3d-tile-gltf.d.ts.map +1 -1
- package/dist/lib/parsers/parse-3d-tile-gltf.js +22 -14
- package/dist/lib/parsers/parse-3d-tile-header.d.ts +2 -2
- package/dist/lib/parsers/parse-3d-tile-header.d.ts.map +1 -1
- package/dist/lib/parsers/parse-3d-tile-header.js +168 -159
- package/dist/lib/parsers/parse-3d-tile-instanced-model.d.ts +2 -2
- package/dist/lib/parsers/parse-3d-tile-instanced-model.d.ts.map +1 -1
- package/dist/lib/parsers/parse-3d-tile-instanced-model.js +153 -123
- package/dist/lib/parsers/parse-3d-tile-point-cloud.d.ts +2 -2
- package/dist/lib/parsers/parse-3d-tile-point-cloud.d.ts.map +1 -1
- package/dist/lib/parsers/parse-3d-tile-point-cloud.js +380 -174
- package/dist/lib/parsers/parse-3d-tile.d.ts +2 -2
- package/dist/lib/parsers/parse-3d-tile.d.ts.map +1 -1
- package/dist/lib/parsers/parse-3d-tile.js +24 -24
- package/dist/lib/utils/obb/s2-corners-to-obb.js +29 -16
- package/dist/lib/utils/s2/converters/s2-to-boundary.d.ts +1 -1
- package/dist/lib/utils/s2/converters/s2-to-boundary.d.ts.map +1 -1
- package/dist/lib/utils/s2/converters/s2-to-boundary.js +55 -35
- package/dist/lib/utils/s2/converters/s2-to-obb-points.js +31 -20
- package/dist/lib/utils/s2/converters/s2-to-region.d.ts +1 -1
- package/dist/lib/utils/s2/converters/s2-to-region.d.ts.map +1 -1
- package/dist/lib/utils/s2/converters/s2-to-region.js +51 -35
- package/dist/lib/utils/s2/index.d.ts +7 -7
- package/dist/lib/utils/s2/index.d.ts.map +1 -1
- package/dist/lib/utils/s2/index.js +3 -1
- package/dist/lib/utils/s2/s2-geometry-functions.js +19 -5
- package/dist/lib/utils/s2/s2-token-functions.js +51 -22
- package/dist/lib/utils/s2/s2geometry/s2-cell-utils.d.ts +1 -1
- package/dist/lib/utils/s2/s2geometry/s2-cell-utils.d.ts.map +1 -1
- package/dist/lib/utils/s2/s2geometry/s2-cell-utils.js +23 -9
- package/dist/lib/utils/s2/s2geometry/s2-geometry.js +218 -157
- package/dist/lib/utils/version.js +3 -1
- package/dist/tile-3d-subtree-loader.d.ts +1 -1
- package/dist/tile-3d-subtree-loader.d.ts.map +1 -1
- package/dist/tile-3d-subtree-loader.js +15 -10
- package/dist/tile-3d-writer.js +19 -14
- package/dist/tiles-3d-loader.js +65 -55
- package/dist/types.js +3 -1
- package/package.json +11 -10
- package/dist/3d-tiles-archive/3d-tiles-archive-archive.js.map +0 -1
- package/dist/3d-tiles-archive/3d-tiles-archive-parser.js.map +0 -1
- package/dist/3d-tiles-archive-loader.js.map +0 -1
- package/dist/cesium-ion-loader.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/classes/helpers/tile-3d-accessor-utils.js.map +0 -1
- package/dist/lib/classes/tile-3d-batch-table-hierarchy.js.map +0 -1
- package/dist/lib/classes/tile-3d-batch-table.js.map +0 -1
- package/dist/lib/classes/tile-3d-feature-table.js.map +0 -1
- package/dist/lib/constants.js.map +0 -1
- package/dist/lib/encoders/encode-3d-tile-batched-model.js.map +0 -1
- package/dist/lib/encoders/encode-3d-tile-composite.js.map +0 -1
- package/dist/lib/encoders/encode-3d-tile-instanced-model.js.map +0 -1
- package/dist/lib/encoders/encode-3d-tile-point-cloud.js.map +0 -1
- package/dist/lib/encoders/encode-3d-tile.js.map +0 -1
- package/dist/lib/encoders/helpers/encode-3d-tile-header.js.map +0 -1
- package/dist/lib/ion/ion.js.map +0 -1
- package/dist/lib/parsers/helpers/normalize-3d-tile-colors.js.map +0 -1
- package/dist/lib/parsers/helpers/normalize-3d-tile-normals.js.map +0 -1
- package/dist/lib/parsers/helpers/normalize-3d-tile-positions.js.map +0 -1
- package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +0 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +0 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-header.js.map +0 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-subtree.js.map +0 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-tables.js.map +0 -1
- package/dist/lib/parsers/helpers/parse-utils.js.map +0 -1
- package/dist/lib/parsers/parse-3d-tile-batched-model.js.map +0 -1
- package/dist/lib/parsers/parse-3d-tile-composite.js.map +0 -1
- package/dist/lib/parsers/parse-3d-tile-gltf.js.map +0 -1
- package/dist/lib/parsers/parse-3d-tile-header.js.map +0 -1
- package/dist/lib/parsers/parse-3d-tile-instanced-model.js.map +0 -1
- package/dist/lib/parsers/parse-3d-tile-point-cloud.js.map +0 -1
- package/dist/lib/parsers/parse-3d-tile.js.map +0 -1
- package/dist/lib/utils/obb/s2-corners-to-obb.js.map +0 -1
- package/dist/lib/utils/s2/converters/s2-to-boundary.js.map +0 -1
- package/dist/lib/utils/s2/converters/s2-to-obb-points.js.map +0 -1
- package/dist/lib/utils/s2/converters/s2-to-region.js.map +0 -1
- package/dist/lib/utils/s2/index.js.map +0 -1
- package/dist/lib/utils/s2/s2-geometry-functions.js.map +0 -1
- package/dist/lib/utils/s2/s2-token-functions.js.map +0 -1
- package/dist/lib/utils/s2/s2geometry/s2-cell-utils.js.map +0 -1
- package/dist/lib/utils/s2/s2geometry/s2-geometry.js.map +0 -1
- package/dist/lib/utils/version.js.map +0 -1
- package/dist/tile-3d-subtree-loader.js.map +0 -1
- package/dist/tile-3d-writer.js.map +0 -1
- package/dist/tiles-3d-loader.js.map +0 -1
- package/dist/types.js.map +0 -1
|
@@ -1,51 +1,76 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright vis.gl contributors
|
|
1
4
|
import { MD5Hash } from '@loaders.gl/crypto';
|
|
2
5
|
import { DeflateCompression, NoCompression } from '@loaders.gl/compression';
|
|
3
6
|
import { IndexedArchive, parseZipLocalFileHeader } from '@loaders.gl/zip';
|
|
7
|
+
/**
|
|
8
|
+
* Handling different compression types in zip
|
|
9
|
+
*/
|
|
4
10
|
const COMPRESSION_METHODS = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
11
|
+
/** No compression */
|
|
12
|
+
0: (data) => new NoCompression().decompress(data),
|
|
13
|
+
/** Deflation */
|
|
14
|
+
8: (data) => new DeflateCompression({ raw: true }).decompress(data)
|
|
9
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Class for handling information about 3tz file
|
|
18
|
+
*/
|
|
10
19
|
export class Tiles3DArchive extends IndexedArchive {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
data = await this.getFileBytes(path);
|
|
20
|
+
/**
|
|
21
|
+
* creates Tiles3DArchive handler
|
|
22
|
+
* @param fileProvider - FileProvider with the whole file
|
|
23
|
+
* @param hashTable - hash info
|
|
24
|
+
*/
|
|
25
|
+
constructor(fileProvider, hashTable, fileName) {
|
|
26
|
+
super(fileProvider, hashTable, fileName);
|
|
27
|
+
this.hashTable = hashTable;
|
|
20
28
|
}
|
|
21
|
-
|
|
22
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Returns file with the given path from 3tz archive
|
|
31
|
+
* @param path - path inside the 3tz
|
|
32
|
+
* @returns buffer with ready to use file
|
|
33
|
+
*/
|
|
34
|
+
async getFile(path) {
|
|
35
|
+
// sometimes paths are not in lower case when hash file is created,
|
|
36
|
+
// so first we're looking for lower case file name and then for original one
|
|
37
|
+
let data = await this.getFileBytes(path.toLocaleLowerCase());
|
|
38
|
+
if (!data) {
|
|
39
|
+
data = await this.getFileBytes(path);
|
|
40
|
+
}
|
|
41
|
+
if (!data) {
|
|
42
|
+
throw new Error(`No such file in the archive: ${path}`);
|
|
43
|
+
}
|
|
44
|
+
return data;
|
|
23
45
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Trying to get raw file data by adress
|
|
48
|
+
* @param path - path inside the archive
|
|
49
|
+
* @returns buffer with the raw file data
|
|
50
|
+
*/
|
|
51
|
+
async getFileBytes(path) {
|
|
52
|
+
let uncompressedFile;
|
|
53
|
+
if (this.hashTable) {
|
|
54
|
+
const arrayBuffer = new TextEncoder().encode(path).buffer;
|
|
55
|
+
const nameHash = await new MD5Hash().hash(arrayBuffer, 'hex');
|
|
56
|
+
const byteOffset = this.hashTable[nameHash];
|
|
57
|
+
if (byteOffset === undefined) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
const localFileHeader = await parseZipLocalFileHeader(byteOffset, this.fileProvider);
|
|
61
|
+
if (!localFileHeader) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
const compressedFile = await this.fileProvider.slice(localFileHeader.fileDataOffset, localFileHeader.fileDataOffset + localFileHeader.compressedSize);
|
|
65
|
+
const compressionMethod = COMPRESSION_METHODS[localFileHeader.compressionMethod];
|
|
66
|
+
if (!compressionMethod) {
|
|
67
|
+
throw Error('Only Deflation compression is supported');
|
|
68
|
+
}
|
|
69
|
+
uncompressedFile = await compressionMethod(compressedFile);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
uncompressedFile = await this.getFileWithoutHash(path);
|
|
73
|
+
}
|
|
74
|
+
return uncompressedFile;
|
|
47
75
|
}
|
|
48
|
-
return uncompressedFile;
|
|
49
|
-
}
|
|
50
76
|
}
|
|
51
|
-
//# sourceMappingURL=3d-tiles-archive-archive.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FileProvider } from '@loaders.gl/loader-utils';
|
|
2
|
-
import { Tiles3DArchive } from
|
|
2
|
+
import { Tiles3DArchive } from "./3d-tiles-archive-archive.js";
|
|
3
3
|
/**
|
|
4
4
|
* Creates 3tz file handler from raw file
|
|
5
5
|
* @param fileProvider raw file data
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"3d-tiles-archive-parser.d.ts","sourceRoot":"","sources":["../../src/3d-tiles-archive/3d-tiles-archive-parser.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAStD,OAAO,EAAC,cAAc,EAAC,
|
|
1
|
+
{"version":3,"file":"3d-tiles-archive-parser.d.ts","sourceRoot":"","sources":["../../src/3d-tiles-archive/3d-tiles-archive-parser.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAStD,OAAO,EAAC,cAAc,EAAC,sCAAmC;AAE1D;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,iBAChB,YAAY,cACf,MAAM,KAAK,IAAI,kBACzB,QAAQ,cAAc,CA+BxB,CAAC"}
|
|
@@ -1,21 +1,31 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright vis.gl contributors
|
|
1
4
|
import { CD_HEADER_SIGNATURE, makeHashTableFromZipHeaders, parseHashTable, parseZipCDFileHeader, parseZipLocalFileHeader, searchFromTheEnd } from '@loaders.gl/zip';
|
|
2
5
|
import { Tiles3DArchive } from "./3d-tiles-archive-archive.js";
|
|
6
|
+
/**
|
|
7
|
+
* Creates 3tz file handler from raw file
|
|
8
|
+
* @param fileProvider raw file data
|
|
9
|
+
* @param cb is called with information message during parsing
|
|
10
|
+
* @returns 3tz file handler
|
|
11
|
+
*/
|
|
3
12
|
export const parse3DTilesArchive = async (fileProvider, cb) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} else {
|
|
11
|
-
const localFileHeader = await parseZipLocalFileHeader(cdFileHeader.localHeaderOffset, fileProvider);
|
|
12
|
-
if (!localFileHeader) {
|
|
13
|
-
throw new Error('corrupted 3tz zip archive');
|
|
13
|
+
const hashCDOffset = await searchFromTheEnd(fileProvider, CD_HEADER_SIGNATURE);
|
|
14
|
+
const cdFileHeader = await parseZipCDFileHeader(hashCDOffset, fileProvider);
|
|
15
|
+
let hashTable;
|
|
16
|
+
if (cdFileHeader?.fileName !== '@3dtilesIndex1@') {
|
|
17
|
+
hashTable = await makeHashTableFromZipHeaders(fileProvider);
|
|
18
|
+
cb?.('3tz doesnt contain hash file, hash info has been composed according to zip archive headers');
|
|
14
19
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
else {
|
|
21
|
+
// cb?.('3tz contains hash file');
|
|
22
|
+
const localFileHeader = await parseZipLocalFileHeader(cdFileHeader.localHeaderOffset, fileProvider);
|
|
23
|
+
if (!localFileHeader) {
|
|
24
|
+
throw new Error('corrupted 3tz zip archive');
|
|
25
|
+
}
|
|
26
|
+
const fileDataOffset = localFileHeader.fileDataOffset;
|
|
27
|
+
const hashFile = await fileProvider.slice(fileDataOffset, fileDataOffset + localFileHeader.compressedSize);
|
|
28
|
+
hashTable = parseHashTable(hashFile);
|
|
29
|
+
}
|
|
30
|
+
return new Tiles3DArchive(fileProvider, hashTable);
|
|
20
31
|
};
|
|
21
|
-
//# sourceMappingURL=3d-tiles-archive-parser.js.map
|
|
@@ -1,20 +1,31 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright vis.gl contributors
|
|
1
4
|
import { DataViewFile } from '@loaders.gl/loader-utils';
|
|
2
5
|
import { parse3DTilesArchive as parse3DTilesArchiveFromProvider } from "./3d-tiles-archive/3d-tiles-archive-parser.js";
|
|
6
|
+
// __VERSION__ is injected by babel-plugin-version-inline
|
|
7
|
+
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
3
8
|
const VERSION = typeof "4.2.0-alpha.4" !== 'undefined' ? "4.2.0-alpha.4" : 'latest';
|
|
9
|
+
/**
|
|
10
|
+
* Loader for 3tz packages
|
|
11
|
+
*/
|
|
4
12
|
export const Tiles3DArchiveFileLoader = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
name: '3tz',
|
|
14
|
+
id: '3tz',
|
|
15
|
+
module: '3d-tiles',
|
|
16
|
+
version: VERSION,
|
|
17
|
+
mimeTypes: ['application/octet-stream', 'application/vnd.maxar.archive.3tz+zip'],
|
|
18
|
+
parse: parse3DTilesArchive,
|
|
19
|
+
extensions: ['3tz'],
|
|
20
|
+
options: {}
|
|
13
21
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
22
|
+
/**
|
|
23
|
+
* returns a single file from the 3tz archive
|
|
24
|
+
* @param data 3tz archive data
|
|
25
|
+
* @param options options
|
|
26
|
+
* @returns requested file
|
|
27
|
+
*/
|
|
28
|
+
async function parse3DTilesArchive(data, options = {}) {
|
|
29
|
+
const archive = await parse3DTilesArchiveFromProvider(new DataViewFile(new DataView(data)));
|
|
30
|
+
return archive.getFile(options['3d-tiles-archive']?.path ?? '');
|
|
19
31
|
}
|
|
20
|
-
//# sourceMappingURL=3d-tiles-archive-loader.js.map
|
|
@@ -1,36 +1,40 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright vis.gl contributors
|
|
1
4
|
import { Tiles3DLoader } from "./tiles-3d-loader.js";
|
|
2
5
|
import { getIonTilesetMetadata } from "./lib/ion/ion.js";
|
|
3
|
-
async function preload(url) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return getIonTilesetMetadata(accessToken, assetId);
|
|
6
|
+
async function preload(url, options = {}) {
|
|
7
|
+
options = options['cesium-ion'] || {};
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
const { accessToken } = options;
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
let assetId = options.assetId;
|
|
12
|
+
if (!Number.isFinite(assetId)) {
|
|
13
|
+
const matched = url.match(/\/([0-9]+)\/tileset.json/);
|
|
14
|
+
assetId = matched && matched[1];
|
|
15
|
+
}
|
|
16
|
+
return getIonTilesetMetadata(accessToken, assetId);
|
|
15
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Loader for 3D tiles from Cesium ION
|
|
20
|
+
*/
|
|
16
21
|
export const CesiumIonLoader = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
options
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
...Tiles3DLoader,
|
|
23
|
+
id: 'cesium-ion',
|
|
24
|
+
name: 'Cesium Ion',
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
preload,
|
|
27
|
+
parse: async (data, options, context) => {
|
|
28
|
+
options = { ...options };
|
|
29
|
+
options['3d-tiles'] = options['cesium-ion'];
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
options.loader = CesiumIonLoader;
|
|
32
|
+
return Tiles3DLoader.parse(data, options, context); // , loader);
|
|
33
|
+
},
|
|
34
|
+
options: {
|
|
35
|
+
'cesium-ion': {
|
|
36
|
+
...Tiles3DLoader.options['3d-tiles'],
|
|
37
|
+
accessToken: null
|
|
38
|
+
}
|
|
33
39
|
}
|
|
34
|
-
}
|
|
35
40
|
};
|
|
36
|
-
//# sourceMappingURL=cesium-ion-loader.js.map
|