@loaders.gl/i3s 4.2.0-alpha.5 → 4.2.0-alpha.6
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.js +1 -1
- package/dist/dist.dev.js +53 -44
- package/dist/dist.min.js +1 -1
- package/dist/i3s-attribute-loader.js +1 -1
- package/dist/i3s-building-scene-layer-loader.js +1 -1
- package/dist/i3s-content-loader.js +1 -1
- package/dist/i3s-content-worker-node.js +46 -46
- package/dist/i3s-content-worker-node.js.map +4 -4
- package/dist/i3s-content-worker.js +12 -26
- package/dist/i3s-loader.d.ts.map +1 -1
- package/dist/i3s-loader.js +3 -2
- package/dist/i3s-node-page-loader.js +1 -1
- package/dist/i3s-slpk-loader.js +1 -1
- package/dist/index.cjs +29 -35
- package/dist/index.cjs.map +2 -2
- package/dist/lib/helpers/i3s-nodepages-tiles.d.ts.map +1 -1
- package/dist/lib/helpers/i3s-nodepages-tiles.js +11 -7
- package/dist/lib/parsers/parse-arcgis-webscene.js +1 -0
- package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s-tile-content.js +3 -24
- package/dist/lib/parsers/parse-slpk/slpk-archieve.js +5 -3
- package/package.json +12 -10
- package/src/i3s-loader.ts +2 -1
- package/src/lib/helpers/i3s-nodepages-tiles.ts +1 -3
- package/src/lib/parsers/parse-i3s-tile-content.ts +4 -26
|
@@ -35,9 +35,8 @@ export async function parseI3STileContent(arrayBuffer, tileOptions, tilesetOptio
|
|
|
35
35
|
texture: null
|
|
36
36
|
};
|
|
37
37
|
if (tileOptions.textureUrl) {
|
|
38
|
-
const url = getUrlWithToken(getInternalPathFromUrl(tileOptions.textureUrl),
|
|
39
38
|
// @ts-expect-error options is not properly typed
|
|
40
|
-
options?.i3s?.token);
|
|
39
|
+
const url = getUrlWithToken(tileOptions.textureUrl, options?.i3s?.token);
|
|
41
40
|
const loader = getLoaderForTextureFormat(tileOptions.textureFormat);
|
|
42
41
|
const fetchFunc = context?.fetch || fetch;
|
|
43
42
|
const response = await fetchFunc(url); // options?.fetch
|
|
@@ -85,26 +84,6 @@ export async function parseI3STileContent(arrayBuffer, tileOptions, tilesetOptio
|
|
|
85
84
|
}
|
|
86
85
|
return await parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOptions, options);
|
|
87
86
|
}
|
|
88
|
-
/**
|
|
89
|
-
* Get the URL inside SLPK archive
|
|
90
|
-
* @param url - full url with *.slpk prefix
|
|
91
|
-
* @returns URL inside SLPK archive
|
|
92
|
-
*/
|
|
93
|
-
function getInternalPathFromUrl(url) {
|
|
94
|
-
const slpkUrlParts = url.split('.slpk');
|
|
95
|
-
let filename;
|
|
96
|
-
// Not '.slpk'. The file will be loaded with global fetch function
|
|
97
|
-
if (slpkUrlParts.length === 1) {
|
|
98
|
-
filename = url;
|
|
99
|
-
}
|
|
100
|
-
else if (slpkUrlParts.length === 2) {
|
|
101
|
-
filename = slpkUrlParts[1].slice(1);
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
filename = url;
|
|
105
|
-
}
|
|
106
|
-
return filename;
|
|
107
|
-
}
|
|
108
87
|
/* eslint-disable max-statements */
|
|
109
88
|
async function parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOptions, options) {
|
|
110
89
|
const contentByteLength = arrayBuffer.byteLength;
|
|
@@ -233,11 +212,11 @@ function parseHeaders(arrayBuffer, options) {
|
|
|
233
212
|
for (const { property, type } of options.store.defaultGeometrySchema.header) {
|
|
234
213
|
const TypedArrayTypeHeader = getConstructorForDataFormat(type);
|
|
235
214
|
switch (property) {
|
|
236
|
-
case HeaderAttributeProperty.vertexCount:
|
|
215
|
+
case HeaderAttributeProperty.vertexCount.toString():
|
|
237
216
|
vertexCount = new TypedArrayTypeHeader(arrayBuffer, 0, 4)[0];
|
|
238
217
|
byteOffset += sizeOf(type);
|
|
239
218
|
break;
|
|
240
|
-
case HeaderAttributeProperty.featureCount:
|
|
219
|
+
case HeaderAttributeProperty.featureCount.toString():
|
|
241
220
|
featureCount = new TypedArrayTypeHeader(arrayBuffer, 4, 4)[0];
|
|
242
221
|
byteOffset += sizeOf(type);
|
|
243
222
|
break;
|
|
@@ -40,6 +40,11 @@ const PATH_DESCRIPTIONS = [
|
|
|
40
40
|
* Class for handling information about slpk file
|
|
41
41
|
*/
|
|
42
42
|
export class SLPKArchive extends IndexedArchive {
|
|
43
|
+
// Maps hex-encoded md5 filename hashes to bigint offsets into the archive
|
|
44
|
+
hashTable;
|
|
45
|
+
_textEncoder = new TextEncoder();
|
|
46
|
+
_textDecoder = new TextDecoder();
|
|
47
|
+
_md5Hash = new MD5Hash();
|
|
43
48
|
/**
|
|
44
49
|
* Constructor
|
|
45
50
|
* @param fileProvider - instance of a binary data reader
|
|
@@ -48,9 +53,6 @@ export class SLPKArchive extends IndexedArchive {
|
|
|
48
53
|
*/
|
|
49
54
|
constructor(fileProvider, hashTable, fileName) {
|
|
50
55
|
super(fileProvider, hashTable, fileName);
|
|
51
|
-
this._textEncoder = new TextEncoder();
|
|
52
|
-
this._textDecoder = new TextDecoder();
|
|
53
|
-
this._md5Hash = new MD5Hash();
|
|
54
56
|
this.hashTable = hashTable;
|
|
55
57
|
}
|
|
56
58
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/i3s",
|
|
3
|
-
"version": "4.2.0-alpha.
|
|
3
|
+
"version": "4.2.0-alpha.6",
|
|
4
4
|
"description": "i3s .",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -42,14 +42,16 @@
|
|
|
42
42
|
"build-worker-node": "esbuild src/workers/i3s-content-worker-node.ts --outfile=dist/i3s-content-worker-node.js --platform=node --target=node16 --minify --bundle --sourcemap --define:__VERSION__=\\\"$npm_package_version\\\""
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@loaders.gl/compression": "4.2.0-alpha.
|
|
46
|
-
"@loaders.gl/crypto": "4.2.0-alpha.
|
|
47
|
-
"@loaders.gl/draco": "4.2.0-alpha.
|
|
48
|
-
"@loaders.gl/images": "4.2.0-alpha.
|
|
49
|
-
"@loaders.gl/loader-utils": "4.2.0-alpha.
|
|
50
|
-
"@loaders.gl/
|
|
51
|
-
"@loaders.gl/
|
|
52
|
-
"@loaders.gl/
|
|
45
|
+
"@loaders.gl/compression": "4.2.0-alpha.6",
|
|
46
|
+
"@loaders.gl/crypto": "4.2.0-alpha.6",
|
|
47
|
+
"@loaders.gl/draco": "4.2.0-alpha.6",
|
|
48
|
+
"@loaders.gl/images": "4.2.0-alpha.6",
|
|
49
|
+
"@loaders.gl/loader-utils": "4.2.0-alpha.6",
|
|
50
|
+
"@loaders.gl/math": "4.2.0-alpha.6",
|
|
51
|
+
"@loaders.gl/schema": "4.2.0-alpha.6",
|
|
52
|
+
"@loaders.gl/textures": "4.2.0-alpha.6",
|
|
53
|
+
"@loaders.gl/tiles": "4.2.0-alpha.6",
|
|
54
|
+
"@loaders.gl/zip": "4.2.0-alpha.6",
|
|
53
55
|
"@math.gl/core": "^4.0.0",
|
|
54
56
|
"@math.gl/culling": "^4.0.0",
|
|
55
57
|
"@math.gl/geospatial": "^4.0.0"
|
|
@@ -57,5 +59,5 @@
|
|
|
57
59
|
"peerDependencies": {
|
|
58
60
|
"@loaders.gl/core": "^4.0.0"
|
|
59
61
|
},
|
|
60
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "37bd8ca71763529f18727ee4bf29dd176aa914ca"
|
|
61
63
|
}
|
package/src/i3s-loader.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {getUrlWithoutParams} from './lib/utils/url-utils';
|
|
|
12
12
|
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
13
13
|
|
|
14
14
|
const TILESET_REGEX = /layers\/[0-9]+$/;
|
|
15
|
+
const LOCAL_SLPK_REGEX = /\.slpk$/;
|
|
15
16
|
const TILE_HEADER_REGEX = /nodes\/([0-9-]+|root)$/;
|
|
16
17
|
const SLPK_HEX = '504b0304';
|
|
17
18
|
const POINT_CLOUD = 'PointCloud';
|
|
@@ -63,7 +64,7 @@ async function parseI3S(data, options: I3SLoaderOptions = {}, context): Promise<
|
|
|
63
64
|
// auto detect file type based on url
|
|
64
65
|
let isTileset;
|
|
65
66
|
if (options.i3s.isTileset === 'auto') {
|
|
66
|
-
isTileset = TILESET_REGEX.test(urlWithoutParams);
|
|
67
|
+
isTileset = TILESET_REGEX.test(urlWithoutParams) || LOCAL_SLPK_REGEX.test(urlWithoutParams);
|
|
67
68
|
} else {
|
|
68
69
|
isTileset = options.i3s.isTileset;
|
|
69
70
|
}
|
|
@@ -58,9 +58,7 @@ export default class I3SNodePagesTiles {
|
|
|
58
58
|
const pageIndex = Math.floor(id / this.nodesPerPage);
|
|
59
59
|
if (!this.nodePages[pageIndex] && !this.pendingNodePages[pageIndex]) {
|
|
60
60
|
const nodePageUrl = getUrlWithToken(
|
|
61
|
-
this.url
|
|
62
|
-
? `nodepages/${pageIndex}`
|
|
63
|
-
: `${this.url}/nodepages/${pageIndex}`,
|
|
61
|
+
`${this.url}/nodepages/${pageIndex}`,
|
|
64
62
|
// @ts-expect-error this.options is not properly typed
|
|
65
63
|
this.options.i3s?.token
|
|
66
64
|
);
|
|
@@ -61,11 +61,8 @@ export async function parseI3STileContent(
|
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
if (tileOptions.textureUrl) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
// @ts-expect-error options is not properly typed
|
|
67
|
-
options?.i3s?.token
|
|
68
|
-
);
|
|
64
|
+
// @ts-expect-error options is not properly typed
|
|
65
|
+
const url = getUrlWithToken(tileOptions.textureUrl, options?.i3s?.token);
|
|
69
66
|
const loader = getLoaderForTextureFormat(tileOptions.textureFormat);
|
|
70
67
|
const fetchFunc = context?.fetch || fetch;
|
|
71
68
|
const response = await fetchFunc(url); // options?.fetch
|
|
@@ -114,25 +111,6 @@ export async function parseI3STileContent(
|
|
|
114
111
|
return await parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOptions, options);
|
|
115
112
|
}
|
|
116
113
|
|
|
117
|
-
/**
|
|
118
|
-
* Get the URL inside SLPK archive
|
|
119
|
-
* @param url - full url with *.slpk prefix
|
|
120
|
-
* @returns URL inside SLPK archive
|
|
121
|
-
*/
|
|
122
|
-
function getInternalPathFromUrl(url: string): string {
|
|
123
|
-
const slpkUrlParts = url.split('.slpk');
|
|
124
|
-
let filename: string | null;
|
|
125
|
-
// Not '.slpk'. The file will be loaded with global fetch function
|
|
126
|
-
if (slpkUrlParts.length === 1) {
|
|
127
|
-
filename = url;
|
|
128
|
-
} else if (slpkUrlParts.length === 2) {
|
|
129
|
-
filename = slpkUrlParts[1].slice(1);
|
|
130
|
-
} else {
|
|
131
|
-
filename = url;
|
|
132
|
-
}
|
|
133
|
-
return filename;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
114
|
/* eslint-disable max-statements */
|
|
137
115
|
async function parseI3SNodeGeometry(
|
|
138
116
|
arrayBuffer: ArrayBuffer,
|
|
@@ -315,11 +293,11 @@ function parseHeaders(arrayBuffer: ArrayBuffer, options: I3STilesetOptions) {
|
|
|
315
293
|
for (const {property, type} of options.store.defaultGeometrySchema.header) {
|
|
316
294
|
const TypedArrayTypeHeader = getConstructorForDataFormat(type);
|
|
317
295
|
switch (property) {
|
|
318
|
-
case HeaderAttributeProperty.vertexCount:
|
|
296
|
+
case HeaderAttributeProperty.vertexCount.toString():
|
|
319
297
|
vertexCount = new TypedArrayTypeHeader(arrayBuffer, 0, 4)[0];
|
|
320
298
|
byteOffset += sizeOf(type);
|
|
321
299
|
break;
|
|
322
|
-
case HeaderAttributeProperty.featureCount:
|
|
300
|
+
case HeaderAttributeProperty.featureCount.toString():
|
|
323
301
|
featureCount = new TypedArrayTypeHeader(arrayBuffer, 4, 4)[0];
|
|
324
302
|
byteOffset += sizeOf(type);
|
|
325
303
|
break;
|