@loaders.gl/i3s 4.2.0-alpha.3 → 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/arcgis-webscene-loader.d.ts +1 -1
- package/dist/arcgis-webscene-loader.d.ts.map +1 -1
- package/dist/arcgis-webscene-loader.js +20 -11
- package/dist/dist.dev.js +1244 -731
- package/dist/dist.min.js +9 -0
- package/dist/i3s-attribute-loader.d.ts +2 -2
- package/dist/i3s-attribute-loader.d.ts.map +1 -1
- package/dist/i3s-attribute-loader.js +146 -95
- package/dist/i3s-building-scene-layer-loader.d.ts +2 -2
- package/dist/i3s-building-scene-layer-loader.d.ts.map +1 -1
- package/dist/i3s-building-scene-layer-loader.js +18 -14
- package/dist/i3s-content-loader.d.ts +2 -2
- package/dist/i3s-content-loader.d.ts.map +1 -1
- package/dist/i3s-content-loader.js +24 -25
- package/dist/i3s-content-worker-node.js +2 -2
- package/dist/i3s-content-worker-node.js.map +2 -2
- package/dist/i3s-content-worker.js +9 -7
- package/dist/i3s-loader.d.ts +2 -2
- package/dist/i3s-loader.d.ts.map +1 -1
- package/dist/i3s-loader.js +77 -66
- package/dist/i3s-node-page-loader.d.ts +2 -2
- package/dist/i3s-node-page-loader.d.ts.map +1 -1
- package/dist/i3s-node-page-loader.js +17 -13
- package/dist/i3s-slpk-loader.js +19 -15
- package/dist/index.cjs +73 -138
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +14 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/lib/helpers/i3s-nodepages-tiles.d.ts +1 -1
- package/dist/lib/helpers/i3s-nodepages-tiles.d.ts.map +1 -1
- package/dist/lib/helpers/i3s-nodepages-tiles.js +226 -184
- package/dist/lib/parsers/constants.js +72 -45
- package/dist/lib/parsers/parse-arcgis-webscene.d.ts +1 -1
- package/dist/lib/parsers/parse-arcgis-webscene.d.ts.map +1 -1
- package/dist/lib/parsers/parse-arcgis-webscene.js +79 -59
- package/dist/lib/parsers/parse-i3s-attribute.js +83 -46
- package/dist/lib/parsers/parse-i3s-building-scene-layer.d.ts +1 -1
- package/dist/lib/parsers/parse-i3s-building-scene-layer.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s-building-scene-layer.js +36 -33
- package/dist/lib/parsers/parse-i3s-tile-content.d.ts +1 -1
- package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s-tile-content.js +460 -394
- package/dist/lib/parsers/parse-i3s.d.ts +1 -1
- package/dist/lib/parsers/parse-i3s.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s.js +84 -81
- package/dist/lib/parsers/parse-slpk/parse-slpk.d.ts +1 -1
- package/dist/lib/parsers/parse-slpk/parse-slpk.d.ts.map +1 -1
- package/dist/lib/parsers/parse-slpk/parse-slpk.js +23 -16
- package/dist/lib/parsers/parse-slpk/slpk-archieve.js +132 -97
- package/dist/lib/utils/convert-i3s-obb-to-mbs.js +12 -5
- package/dist/lib/utils/customize-colors.d.ts +1 -1
- package/dist/lib/utils/customize-colors.d.ts.map +1 -1
- package/dist/lib/utils/customize-colors.js +95 -81
- package/dist/lib/utils/url-utils.d.ts +1 -1
- package/dist/lib/utils/url-utils.d.ts.map +1 -1
- package/dist/lib/utils/url-utils.js +48 -28
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +5 -6
- package/dist/workers/i3s-content-worker-node.js +1 -1
- package/dist/workers/i3s-content-worker.js +0 -1
- package/package.json +13 -12
- package/dist/arcgis-webscene-loader.js.map +0 -1
- package/dist/i3s-attribute-loader.js.map +0 -1
- package/dist/i3s-building-scene-layer-loader.js.map +0 -1
- package/dist/i3s-content-loader.js.map +0 -1
- package/dist/i3s-loader.js.map +0 -1
- package/dist/i3s-node-page-loader.js.map +0 -1
- package/dist/i3s-slpk-loader.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/helpers/i3s-nodepages-tiles.js.map +0 -1
- package/dist/lib/parsers/constants.js.map +0 -1
- package/dist/lib/parsers/parse-arcgis-webscene.js.map +0 -1
- package/dist/lib/parsers/parse-i3s-attribute.js.map +0 -1
- package/dist/lib/parsers/parse-i3s-building-scene-layer.js.map +0 -1
- package/dist/lib/parsers/parse-i3s-tile-content.js.map +0 -1
- package/dist/lib/parsers/parse-i3s.js.map +0 -1
- package/dist/lib/parsers/parse-slpk/parse-slpk.js.map +0 -1
- package/dist/lib/parsers/parse-slpk/slpk-archieve.js.map +0 -1
- package/dist/lib/utils/convert-i3s-obb-to-mbs.js.map +0 -1
- package/dist/lib/utils/customize-colors.js.map +0 -1
- package/dist/lib/utils/url-utils.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/workers/i3s-content-worker-node.js.map +0 -1
- package/dist/workers/i3s-content-worker.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I3STilesetHeader, I3STileHeader, I3SMinimalNodeData, Node3DIndexDocument, SceneLayer3D } from
|
|
1
|
+
import { I3STilesetHeader, I3STileHeader, I3SMinimalNodeData, Node3DIndexDocument, SceneLayer3D } from "../../types.js";
|
|
2
2
|
import type { LoaderOptions, LoaderContext } from '@loaders.gl/loader-utils';
|
|
3
3
|
export declare function normalizeTileData(tile: Node3DIndexDocument, context: LoaderContext): I3STileHeader;
|
|
4
4
|
export declare function normalizeTileNonUrlData(tile: I3SMinimalNodeData): I3STileHeader;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-i3s.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/parse-i3s.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,gBAAgB,EAChB,aAAa,EAEb,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EAEb,
|
|
1
|
+
{"version":3,"file":"parse-i3s.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/parse-i3s.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,gBAAgB,EAChB,aAAa,EAEb,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EAEb,uBAAoB;AACrB,OAAO,KAAK,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAG3E,wBAAgB,iBAAiB,CAAC,IAAI,EAAG,mBAAmB,EAAE,OAAO,EAAE,aAAa,GAAG,aAAa,CA6BnG;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAG,kBAAkB,GAAG,aAAa,CAkChF;AAED,wBAAsB,oBAAoB,CAAC,OAAO,EAAG,YAAY,EAAE,OAAO,EAAG,aAAa,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,GAAG,gBAAgB,CAAC,CAgC7J"}
|
|
@@ -6,89 +6,92 @@ import I3SNodePagesTiles from "../helpers/i3s-nodepages-tiles.js";
|
|
|
6
6
|
import { generateTileAttributeUrls, getUrlWithToken, getUrlWithoutParams } from "../utils/url-utils.js";
|
|
7
7
|
import { I3SLoader } from "../../i3s-loader.js";
|
|
8
8
|
export function normalizeTileData(tile, context) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
9
|
+
const url = context.url || '';
|
|
10
|
+
let contentUrl;
|
|
11
|
+
if (tile.geometryData) {
|
|
12
|
+
contentUrl = `${url}/${tile.geometryData[0].href}`;
|
|
13
|
+
}
|
|
14
|
+
let textureUrl;
|
|
15
|
+
if (tile.textureData) {
|
|
16
|
+
textureUrl = `${url}/${tile.textureData[0].href}`;
|
|
17
|
+
}
|
|
18
|
+
let attributeUrls;
|
|
19
|
+
if (tile.attributeData) {
|
|
20
|
+
attributeUrls = generateTileAttributeUrls(url, tile);
|
|
21
|
+
}
|
|
22
|
+
const children = tile.children || [];
|
|
23
|
+
return normalizeTileNonUrlData({
|
|
24
|
+
...tile,
|
|
25
|
+
children,
|
|
26
|
+
url,
|
|
27
|
+
contentUrl,
|
|
28
|
+
textureUrl,
|
|
29
|
+
textureFormat: 'jpg', // `jpg` format will cause `ImageLoader` usage that will be able to handle `png` as well
|
|
30
|
+
attributeUrls,
|
|
31
|
+
isDracoGeometry: false
|
|
32
|
+
});
|
|
33
33
|
}
|
|
34
34
|
export function normalizeTileNonUrlData(tile) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
35
|
+
const boundingVolume = {};
|
|
36
|
+
let mbs = [0, 0, 0, 1];
|
|
37
|
+
if (tile.mbs) {
|
|
38
|
+
mbs = tile.mbs;
|
|
39
|
+
boundingVolume.sphere = [
|
|
40
|
+
...Ellipsoid.WGS84.cartographicToCartesian(tile.mbs.slice(0, 3)), // cartesian center of sphere
|
|
41
|
+
tile.mbs[3] // radius of sphere
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
else if (tile.obb) {
|
|
45
|
+
boundingVolume.box = [
|
|
46
|
+
...Ellipsoid.WGS84.cartographicToCartesian(tile.obb.center), // cartesian center of box
|
|
47
|
+
...tile.obb.halfSize, // halfSize
|
|
48
|
+
...tile.obb.quaternion // quaternion
|
|
49
|
+
];
|
|
50
|
+
const obb = new OrientedBoundingBox().fromCenterHalfSizeQuaternion(boundingVolume.box.slice(0, 3), tile.obb.halfSize, tile.obb.quaternion);
|
|
51
|
+
const boundingSphere = obb.getBoundingSphere();
|
|
52
|
+
boundingVolume.sphere = [...boundingSphere.center, boundingSphere.radius];
|
|
53
|
+
mbs = [...tile.obb.center, boundingSphere.radius];
|
|
54
|
+
}
|
|
55
|
+
const lodMetricType = tile.lodSelection?.[0].metricType;
|
|
56
|
+
const lodMetricValue = tile.lodSelection?.[0].maxError;
|
|
57
|
+
const type = TILE_TYPE.MESH;
|
|
58
|
+
/**
|
|
59
|
+
* I3S specification supports only REPLACE
|
|
60
|
+
*/
|
|
61
|
+
const refine = TILE_REFINEMENT.REPLACE;
|
|
62
|
+
return { ...tile, mbs, boundingVolume, lodMetricType, lodMetricValue, type, refine };
|
|
61
63
|
}
|
|
62
64
|
export async function normalizeTilesetData(tileset, options, context) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
65
|
+
const url = getUrlWithoutParams(context.url || '');
|
|
66
|
+
let nodePagesTile;
|
|
67
|
+
let root;
|
|
68
|
+
if (tileset.nodePages) {
|
|
69
|
+
nodePagesTile = new I3SNodePagesTiles(tileset, url, options);
|
|
70
|
+
root = await nodePagesTile.formTileFromNodePages(0);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
const parseOptions = options.i3s;
|
|
74
|
+
const rootNodeUrl = getUrlWithToken(`${url}/nodes/root`, parseOptions.token);
|
|
75
|
+
// eslint-disable-next-line no-use-before-define
|
|
76
|
+
root = await load(rootNodeUrl, I3SLoader, {
|
|
77
|
+
...options,
|
|
78
|
+
i3s: {
|
|
79
|
+
// @ts-expect-error options is not properly typed
|
|
80
|
+
...options.i3s,
|
|
81
|
+
loadContent: false, isTileHeader: true, isTileset: false
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
...tileset,
|
|
87
|
+
loader: I3SLoader,
|
|
88
|
+
url,
|
|
89
|
+
basePath: url,
|
|
90
|
+
type: TILESET_TYPE.I3S,
|
|
91
|
+
nodePagesTile,
|
|
92
|
+
// @ts-expect-error
|
|
93
|
+
root,
|
|
94
|
+
lodMetricType: root.lodMetricType,
|
|
95
|
+
lodMetricValue: root.lodMetricValue
|
|
96
|
+
};
|
|
93
97
|
}
|
|
94
|
-
//# sourceMappingURL=parse-i3s.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-slpk.d.ts","sourceRoot":"","sources":["../../../../src/lib/parsers/parse-slpk/parse-slpk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAStD,OAAO,EAAC,WAAW,EAAC,
|
|
1
|
+
{"version":3,"file":"parse-slpk.d.ts","sourceRoot":"","sources":["../../../../src/lib/parsers/parse-slpk/parse-slpk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAStD,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAE5C;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,YAAY,EAAE,YAAY,EAC1B,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,EAC1B,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,WAAW,CAAC,CA+BtB"}
|
|
@@ -1,21 +1,28 @@
|
|
|
1
1
|
import { parseZipCDFileHeader, CD_HEADER_SIGNATURE, parseZipLocalFileHeader, searchFromTheEnd, parseHashTable, makeHashTableFromZipHeaders } from '@loaders.gl/zip';
|
|
2
2
|
import { SLPKArchive } from "./slpk-archieve.js";
|
|
3
|
+
/**
|
|
4
|
+
* Creates slpk file handler from raw file
|
|
5
|
+
* @param fileProvider raw file data
|
|
6
|
+
* @param cb is called with information message during parsing
|
|
7
|
+
* @returns slpk file handler
|
|
8
|
+
*/
|
|
3
9
|
export async function parseSLPKArchive(fileProvider, cb, fileName) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} else {
|
|
11
|
-
const localFileHeader = await parseZipLocalFileHeader(cdFileHeader.localHeaderOffset, fileProvider);
|
|
12
|
-
if (!localFileHeader) {
|
|
13
|
-
throw new Error('corrupted SLPK');
|
|
10
|
+
const hashCDOffset = await searchFromTheEnd(fileProvider, CD_HEADER_SIGNATURE);
|
|
11
|
+
const cdFileHeader = await parseZipCDFileHeader(hashCDOffset, fileProvider);
|
|
12
|
+
let hashTable;
|
|
13
|
+
if (cdFileHeader?.fileName !== '@specialIndexFileHASH128@') {
|
|
14
|
+
hashTable = await makeHashTableFromZipHeaders(fileProvider);
|
|
15
|
+
cb?.('SLPK doesnt contain hash file, hash info has been composed according to zip archive headers');
|
|
14
16
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
else {
|
|
18
|
+
// cb?.('SLPK contains hash file');
|
|
19
|
+
const localFileHeader = await parseZipLocalFileHeader(cdFileHeader.localHeaderOffset, fileProvider);
|
|
20
|
+
if (!localFileHeader) {
|
|
21
|
+
throw new Error('corrupted SLPK');
|
|
22
|
+
}
|
|
23
|
+
const fileDataOffset = localFileHeader.fileDataOffset;
|
|
24
|
+
const hashFile = await fileProvider.slice(fileDataOffset, fileDataOffset + localFileHeader.compressedSize);
|
|
25
|
+
hashTable = parseHashTable(hashFile);
|
|
26
|
+
}
|
|
27
|
+
return new SLPKArchive(fileProvider, hashTable, fileName);
|
|
20
28
|
}
|
|
21
|
-
//# sourceMappingURL=parse-slpk.js.map
|
|
@@ -1,107 +1,142 @@
|
|
|
1
1
|
import { MD5Hash } from '@loaders.gl/crypto';
|
|
2
2
|
import { IndexedArchive, parseZipLocalFileHeader } from '@loaders.gl/zip';
|
|
3
3
|
import { GZipCompression } from '@loaders.gl/compression';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
4
|
+
/** Description of real paths for different file types */
|
|
5
|
+
const PATH_DESCRIPTIONS = [
|
|
6
|
+
{
|
|
7
|
+
test: /^$/,
|
|
8
|
+
extensions: ['3dSceneLayer.json.gz']
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
test: /^nodepages\/\d+$/,
|
|
12
|
+
extensions: ['.json.gz']
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
test: /^nodes\/(\d+|root)$/,
|
|
16
|
+
extensions: ['/3dNodeIndexDocument.json.gz']
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
test: /^nodes\/\d+\/textures\/.+$/,
|
|
20
|
+
extensions: ['.jpg', '.png', '.bin.dds.gz', '.ktx']
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
test: /^nodes\/\d+\/geometries\/\d+$/,
|
|
24
|
+
extensions: ['.bin.gz', '.draco.gz']
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
test: /^nodes\/\d+\/attributes\/f_\d+\/\d+$/,
|
|
28
|
+
extensions: ['.bin.gz']
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
test: /^statistics\/f_\d+\/\d+$/,
|
|
32
|
+
extensions: ['.json.gz']
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
test: /^nodes\/\d+\/shared$/,
|
|
36
|
+
extensions: ['/sharedResource.json.gz']
|
|
37
|
+
}
|
|
38
|
+
];
|
|
39
|
+
/**
|
|
40
|
+
* Class for handling information about slpk file
|
|
41
|
+
*/
|
|
29
42
|
export class SLPKArchive extends IndexedArchive {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Constructor
|
|
45
|
+
* @param fileProvider - instance of a binary data reader
|
|
46
|
+
* @param hashTable - pre-loaded hashTable. If presented, getFile will skip reading the hash file
|
|
47
|
+
* @param fileName - name of the archive. It is used to add to an URL of a loader context
|
|
48
|
+
*/
|
|
49
|
+
constructor(fileProvider, hashTable, fileName) {
|
|
50
|
+
super(fileProvider, hashTable, fileName);
|
|
51
|
+
this._textEncoder = new TextEncoder();
|
|
52
|
+
this._textDecoder = new TextDecoder();
|
|
53
|
+
this._md5Hash = new MD5Hash();
|
|
54
|
+
this.hashTable = hashTable;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Returns file with the given path from slpk archive
|
|
58
|
+
* @param path - path inside the slpk
|
|
59
|
+
* @param mode - currently only raw mode supported
|
|
60
|
+
* @returns buffer with ready to use file
|
|
61
|
+
*/
|
|
62
|
+
async getFile(path, mode = 'raw') {
|
|
63
|
+
if (mode === 'http') {
|
|
64
|
+
const extensions = PATH_DESCRIPTIONS.find((val) => val.test.test(path))?.extensions;
|
|
65
|
+
if (extensions) {
|
|
66
|
+
let data;
|
|
67
|
+
for (const ext of extensions) {
|
|
68
|
+
data = await this.getDataByPath(`${path}${ext}`);
|
|
69
|
+
if (data) {
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (data) {
|
|
74
|
+
return data;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
50
77
|
}
|
|
51
|
-
if (
|
|
52
|
-
|
|
78
|
+
if (mode === 'raw') {
|
|
79
|
+
const decompressedFile = await this.getDataByPath(`${path}.gz`);
|
|
80
|
+
if (decompressedFile) {
|
|
81
|
+
return decompressedFile;
|
|
82
|
+
}
|
|
83
|
+
const fileWithoutCompression = await this.getFileBytes(path);
|
|
84
|
+
if (fileWithoutCompression) {
|
|
85
|
+
return fileWithoutCompression;
|
|
86
|
+
}
|
|
53
87
|
}
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
if (mode === 'raw') {
|
|
57
|
-
const decompressedFile = await this.getDataByPath(`${path}.gz`);
|
|
58
|
-
if (decompressedFile) {
|
|
59
|
-
return decompressedFile;
|
|
60
|
-
}
|
|
61
|
-
const fileWithoutCompression = await this.getFileBytes(path);
|
|
62
|
-
if (fileWithoutCompression) {
|
|
63
|
-
return fileWithoutCompression;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
throw new Error(`No such file in the archive: ${path}`);
|
|
67
|
-
}
|
|
68
|
-
async getDataByPath(path) {
|
|
69
|
-
let data = await this.getFileBytes(path.toLocaleLowerCase());
|
|
70
|
-
if (!data) {
|
|
71
|
-
data = await this.getFileBytes(path);
|
|
72
|
-
}
|
|
73
|
-
if (!data) {
|
|
74
|
-
return undefined;
|
|
88
|
+
throw new Error(`No such file in the archive: ${path}`);
|
|
75
89
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
90
|
+
/**
|
|
91
|
+
* returning uncompressed data for paths that ends with .gz and raw data for all other paths
|
|
92
|
+
* @param path - path inside the archive
|
|
93
|
+
* @returns buffer with the file data
|
|
94
|
+
*/
|
|
95
|
+
async getDataByPath(path) {
|
|
96
|
+
// sometimes paths are not in lower case when hash file is created,
|
|
97
|
+
// so first we're looking for lower case file name and then for original one
|
|
98
|
+
let data = await this.getFileBytes(path.toLocaleLowerCase());
|
|
99
|
+
if (!data) {
|
|
100
|
+
data = await this.getFileBytes(path);
|
|
101
|
+
}
|
|
102
|
+
if (!data) {
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
if (/\.gz$/.test(path)) {
|
|
106
|
+
const compression = new GZipCompression();
|
|
107
|
+
const decompressedData = await compression.decompress(data);
|
|
108
|
+
return decompressedData;
|
|
109
|
+
}
|
|
110
|
+
return data;
|
|
80
111
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
112
|
+
/**
|
|
113
|
+
* Trying to get raw file data by address
|
|
114
|
+
* @param path - path inside the archive
|
|
115
|
+
* @returns buffer with the raw file data
|
|
116
|
+
*/
|
|
117
|
+
async getFileBytes(path) {
|
|
118
|
+
let compressedFile;
|
|
119
|
+
if (this.hashTable) {
|
|
120
|
+
const binaryPath = this._textEncoder.encode(path);
|
|
121
|
+
const nameHash = await this._md5Hash.hash(binaryPath.buffer, 'hex');
|
|
122
|
+
const offset = this.hashTable[nameHash];
|
|
123
|
+
if (offset === undefined) {
|
|
124
|
+
return undefined;
|
|
125
|
+
}
|
|
126
|
+
const localFileHeader = await parseZipLocalFileHeader(offset, this.fileProvider);
|
|
127
|
+
if (!localFileHeader) {
|
|
128
|
+
return undefined;
|
|
129
|
+
}
|
|
130
|
+
compressedFile = await this.fileProvider.slice(localFileHeader.fileDataOffset, localFileHeader.fileDataOffset + localFileHeader.compressedSize);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
try {
|
|
134
|
+
compressedFile = await this.getFileWithoutHash(path);
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
compressedFile = undefined;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return compressedFile;
|
|
103
141
|
}
|
|
104
|
-
return compressedFile;
|
|
105
|
-
}
|
|
106
142
|
}
|
|
107
|
-
//# sourceMappingURL=slpk-archieve.js.map
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { BoundingSphere } from '@math.gl/culling';
|
|
2
2
|
import { Ellipsoid } from '@math.gl/geospatial';
|
|
3
3
|
export function convertI3SObbToMbs(obb) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const halfSize = obb.halfSize;
|
|
5
|
+
const centerCartesian = Ellipsoid.WGS84.cartographicToCartesian(obb.center);
|
|
6
|
+
const sphere = new BoundingSphere().fromCornerPoints([
|
|
7
|
+
centerCartesian[0] - halfSize[0],
|
|
8
|
+
centerCartesian[1] - halfSize[1],
|
|
9
|
+
centerCartesian[2] - halfSize[2]
|
|
10
|
+
], [
|
|
11
|
+
centerCartesian[0] + halfSize[0],
|
|
12
|
+
centerCartesian[1] + halfSize[1],
|
|
13
|
+
centerCartesian[2] + halfSize[2]
|
|
14
|
+
]);
|
|
15
|
+
return [...obb.center, sphere.radius];
|
|
8
16
|
}
|
|
9
|
-
//# sourceMappingURL=convert-i3s-obb-to-mbs.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MeshAttribute, TypedArray } from '@loaders.gl/schema';
|
|
2
|
-
import type { AttributeStorageInfo, Field } from
|
|
2
|
+
import type { AttributeStorageInfo, Field } from "../../types.js";
|
|
3
3
|
type ColorsByAttribute = {
|
|
4
4
|
/** Feature attribute name */
|
|
5
5
|
attributeName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customize-colors.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/customize-colors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAE,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAClE,OAAO,KAAK,EAAC,oBAAoB,EAAS,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"customize-colors.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/customize-colors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAE,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAClE,OAAO,KAAK,EAAC,oBAAoB,EAAS,KAAK,EAAC,uBAAoB;AAOpE,KAAK,iBAAiB,GAAG;IACvB,6BAA6B;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,8BAA8B;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,2FAA2F;IAC3F,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,2FAA2F;IAC3F,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,kIAAkI;IAClI,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;;;;;;;;GAUG;AAEH,wBAAsB,eAAe,CACnC,MAAM,EAAE,aAAa,EACrB,UAAU,EAAE,MAAM,EAAE,GAAG,UAAU,EACjC,aAAa,EAAE,MAAM,EAAE,EACvB,MAAM,EAAE,KAAK,EAAE,EACf,oBAAoB,EAAE,oBAAoB,EAAE,EAC5C,iBAAiB,EAAE,iBAAiB,GAAG,IAAI,EAC3C,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,aAAa,CAAC,CA2ExB"}
|