@loaders.gl/i3s 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/arcgis-webscene-loader.d.ts +1 -1
- package/dist/arcgis-webscene-loader.d.ts.map +1 -1
- package/dist/arcgis-webscene-loader.js +19 -10
- 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 +145 -94
- 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 +17 -13
- 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 +23 -24
- package/dist/i3s-content-worker-node.js +1 -1
- package/dist/i3s-content-worker-node.js.map +2 -2
- package/dist/i3s-content-worker.js +3 -1
- package/dist/i3s-loader.d.ts +2 -2
- package/dist/i3s-loader.d.ts.map +1 -1
- package/dist/i3s-loader.js +76 -65
- 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 +16 -12
- package/dist/i3s-slpk-loader.js +18 -14
- 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
|
@@ -2031,7 +2031,9 @@
|
|
|
2031
2031
|
function getGlobalLoaderState() {
|
|
2032
2032
|
globalThis.loaders = globalThis.loaders || {};
|
|
2033
2033
|
const { loaders } = globalThis;
|
|
2034
|
-
|
|
2034
|
+
if (!loaders._state) {
|
|
2035
|
+
loaders._state = {};
|
|
2036
|
+
}
|
|
2035
2037
|
return loaders._state;
|
|
2036
2038
|
}
|
|
2037
2039
|
function getGlobalLoaderOptions() {
|
package/dist/i3s-loader.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LoaderWithParser, LoaderOptions } from '@loaders.gl/loader-utils';
|
|
2
|
-
import type { I3STilesetHeader } from
|
|
3
|
-
import { I3SParseOptions } from
|
|
2
|
+
import type { I3STilesetHeader } from "./types.js";
|
|
3
|
+
import { I3SParseOptions } from "./types.js";
|
|
4
4
|
export type I3SLoaderOptions = LoaderOptions & {
|
|
5
5
|
i3s?: I3SParseOptions;
|
|
6
6
|
};
|
package/dist/i3s-loader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-loader.d.ts","sourceRoot":"","sources":["../src/i3s-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAE9E,OAAO,KAAK,EAAC,gBAAgB,EAAC,
|
|
1
|
+
{"version":3,"file":"i3s-loader.d.ts","sourceRoot":"","sources":["../src/i3s-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAE9E,OAAO,KAAK,EAAC,gBAAgB,EAAC,mBAAgB;AAI9C,OAAO,EAAC,eAAe,EAAC,mBAAgB;AAYxC,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE,eAAe,CAAC;CACvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,gBAAgB,CAAC,gBAAgB,EAAE,KAAK,EAAE,aAAa,CAuB9E,CAAC"}
|
package/dist/i3s-loader.js
CHANGED
|
@@ -3,85 +3,96 @@ import { I3SContentLoader } from "./i3s-content-loader.js";
|
|
|
3
3
|
import { normalizeTileData, normalizeTilesetData } from "./lib/parsers/parse-i3s.js";
|
|
4
4
|
import { COORDINATE_SYSTEM } from "./lib/parsers/constants.js";
|
|
5
5
|
import { getUrlWithoutParams } from "./lib/utils/url-utils.js";
|
|
6
|
+
// __VERSION__ is injected by babel-plugin-version-inline
|
|
7
|
+
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
6
8
|
const VERSION = typeof "4.2.0-alpha.4" !== 'undefined' ? "4.2.0-alpha.4" : 'latest';
|
|
7
9
|
const TILESET_REGEX = /layers\/[0-9]+$/;
|
|
8
10
|
const TILE_HEADER_REGEX = /nodes\/([0-9-]+|root)$/;
|
|
9
11
|
const SLPK_HEX = '504b0304';
|
|
10
12
|
const POINT_CLOUD = 'PointCloud';
|
|
13
|
+
/**
|
|
14
|
+
* Loader for I3S - Indexed 3D Scene Layer
|
|
15
|
+
*/
|
|
11
16
|
export const I3SLoader = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
17
|
+
name: 'I3S (Indexed Scene Layers)',
|
|
18
|
+
id: 'i3s',
|
|
19
|
+
module: 'i3s',
|
|
20
|
+
version: VERSION,
|
|
21
|
+
mimeTypes: ['application/octet-stream'],
|
|
22
|
+
parse: parseI3S,
|
|
23
|
+
extensions: ['bin'],
|
|
24
|
+
options: {
|
|
25
|
+
i3s: {
|
|
26
|
+
token: null,
|
|
27
|
+
isTileset: 'auto',
|
|
28
|
+
isTileHeader: 'auto',
|
|
29
|
+
tile: null,
|
|
30
|
+
tileset: null,
|
|
31
|
+
_tileOptions: null,
|
|
32
|
+
_tilesetOptions: null,
|
|
33
|
+
useDracoGeometry: true,
|
|
34
|
+
useCompressedTextures: true,
|
|
35
|
+
decodeTextures: true,
|
|
36
|
+
coordinateSystem: COORDINATE_SYSTEM.METER_OFFSETS
|
|
37
|
+
}
|
|
32
38
|
}
|
|
33
|
-
}
|
|
34
39
|
};
|
|
35
|
-
async function parseI3S(data) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
isTileHeader
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
40
|
+
async function parseI3S(data, options = {}, context) {
|
|
41
|
+
const url = context.url;
|
|
42
|
+
options.i3s = options.i3s || {};
|
|
43
|
+
const magicNumber = getMagicNumber(data);
|
|
44
|
+
// check if file is slpk
|
|
45
|
+
if (magicNumber === SLPK_HEX) {
|
|
46
|
+
throw new Error('Files with .slpk extention currently are not supported by I3SLoader');
|
|
47
|
+
}
|
|
48
|
+
const urlWithoutParams = getUrlWithoutParams(url);
|
|
49
|
+
// auto detect file type based on url
|
|
50
|
+
let isTileset;
|
|
51
|
+
if (options.i3s.isTileset === 'auto') {
|
|
52
|
+
isTileset = TILESET_REGEX.test(urlWithoutParams);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
isTileset = options.i3s.isTileset;
|
|
56
|
+
}
|
|
57
|
+
let isTileHeader;
|
|
58
|
+
if (options.isTileHeader === 'auto') {
|
|
59
|
+
isTileHeader = TILE_HEADER_REGEX.test(urlWithoutParams);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
isTileHeader = options.i3s.isTileHeader;
|
|
63
|
+
}
|
|
64
|
+
if (isTileset) {
|
|
65
|
+
data = await parseTileset(data, options, context);
|
|
66
|
+
}
|
|
67
|
+
else if (isTileHeader) {
|
|
68
|
+
data = await parseTile(data, context);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
data = await parseTileContent(data, options);
|
|
72
|
+
}
|
|
73
|
+
return data;
|
|
65
74
|
}
|
|
66
75
|
async function parseTileContent(arrayBuffer, options) {
|
|
67
|
-
|
|
76
|
+
return await parse(arrayBuffer, I3SContentLoader, options);
|
|
68
77
|
}
|
|
69
78
|
async function parseTileset(data, options, context) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
79
|
+
const tilesetJson = JSON.parse(new TextDecoder().decode(data));
|
|
80
|
+
if (tilesetJson?.layerType === POINT_CLOUD) {
|
|
81
|
+
throw new Error('Point Cloud layers currently are not supported by I3SLoader');
|
|
82
|
+
}
|
|
83
|
+
const tilesetPostprocessed = await normalizeTilesetData(tilesetJson, options, context);
|
|
84
|
+
return tilesetPostprocessed;
|
|
76
85
|
}
|
|
77
86
|
async function parseTile(data, context) {
|
|
78
|
-
|
|
79
|
-
|
|
87
|
+
data = JSON.parse(new TextDecoder().decode(data));
|
|
88
|
+
return normalizeTileData(data, context);
|
|
80
89
|
}
|
|
81
90
|
function getMagicNumber(data) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
91
|
+
if (data instanceof ArrayBuffer) {
|
|
92
|
+
// slice binary data (4 bytes from the beginning) and transform it to hexadecimal numeral system
|
|
93
|
+
return [...new Uint8Array(data, 0, 4)]
|
|
94
|
+
.map((value) => value.toString(16).padStart(2, '0'))
|
|
95
|
+
.join('');
|
|
96
|
+
}
|
|
97
|
+
return null;
|
|
86
98
|
}
|
|
87
|
-
//# sourceMappingURL=i3s-loader.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LoaderWithParser } from '@loaders.gl/loader-utils';
|
|
2
|
-
import type { I3SLoaderOptions } from
|
|
3
|
-
import type { NodePage } from
|
|
2
|
+
import type { I3SLoaderOptions } from "./i3s-loader.js";
|
|
3
|
+
import type { NodePage } from "./types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Loader for I3S node pages
|
|
6
6
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-node-page-loader.d.ts","sourceRoot":"","sources":["../src/i3s-node-page-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAC9E,OAAO,KAAK,EAAC,gBAAgB,EAAC,
|
|
1
|
+
{"version":3,"file":"i3s-node-page-loader.d.ts","sourceRoot":"","sources":["../src/i3s-node-page-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAC9E,OAAO,KAAK,EAAC,gBAAgB,EAAC,wBAAqB;AACnD,OAAO,KAAK,EAAC,QAAQ,EAAC,mBAAgB;AAMtC;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,gBAAgB,CAAC,QAAQ,EAAE,KAAK,EAAE,gBAAgB,CAWjF,CAAC"}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
+
// __VERSION__ is injected by babel-plugin-version-inline
|
|
2
|
+
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
1
3
|
const VERSION = typeof "4.2.0-alpha.4" !== 'undefined' ? "4.2.0-alpha.4" : 'latest';
|
|
4
|
+
/**
|
|
5
|
+
* Loader for I3S node pages
|
|
6
|
+
*/
|
|
2
7
|
export const I3SNodePageLoader = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
name: 'I3S Node Page',
|
|
9
|
+
id: 'i3s-node-page',
|
|
10
|
+
module: 'i3s',
|
|
11
|
+
version: VERSION,
|
|
12
|
+
mimeTypes: ['application/json'],
|
|
13
|
+
parse: parseNodePage,
|
|
14
|
+
extensions: ['json'],
|
|
15
|
+
options: {
|
|
16
|
+
i3s: {}
|
|
17
|
+
}
|
|
13
18
|
};
|
|
14
19
|
async function parseNodePage(data, options) {
|
|
15
|
-
|
|
20
|
+
return JSON.parse(new TextDecoder().decode(data));
|
|
16
21
|
}
|
|
17
|
-
//# sourceMappingURL=i3s-node-page-loader.js.map
|
package/dist/i3s-slpk-loader.js
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import { DataViewFile } from '@loaders.gl/loader-utils';
|
|
2
2
|
import { parseSLPKArchive } from "./lib/parsers/parse-slpk/parse-slpk.js";
|
|
3
|
+
// __VERSION__ is injected by babel-plugin-version-inline
|
|
4
|
+
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
3
5
|
const VERSION = typeof "4.2.0-alpha.4" !== 'undefined' ? "4.2.0-alpha.4" : 'latest';
|
|
6
|
+
/**
|
|
7
|
+
* Loader for SLPK - Scene Layer Package (Archive I3S format)
|
|
8
|
+
* @todo - this reloads the entire archive for every tile, should be optimized
|
|
9
|
+
* @todo - this should be updated to use `parseFile` and ReadableFile
|
|
10
|
+
*/
|
|
4
11
|
export const SLPKLoader = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return archive.getFile((_options$slpk$path = (_options$slpk = options.slpk) === null || _options$slpk === void 0 ? void 0 : _options$slpk.path) !== null && _options$slpk$path !== void 0 ? _options$slpk$path : '', (_options$slpk2 = options.slpk) === null || _options$slpk2 === void 0 ? void 0 : _options$slpk2.pathMode);
|
|
17
|
-
}
|
|
12
|
+
name: 'I3S SLPK (Scene Layer Package)',
|
|
13
|
+
id: 'slpk',
|
|
14
|
+
module: 'i3s',
|
|
15
|
+
version: VERSION,
|
|
16
|
+
mimeTypes: ['application/octet-stream'],
|
|
17
|
+
extensions: ['slpk'],
|
|
18
|
+
options: {},
|
|
19
|
+
parse: async (data, options = {}) => {
|
|
20
|
+
const archive = await parseSLPKArchive(new DataViewFile(new DataView(data)));
|
|
21
|
+
return archive.getFile(options.slpk?.path ?? '', options.slpk?.pathMode);
|
|
22
|
+
}
|
|
18
23
|
};
|
|
19
|
-
//# sourceMappingURL=i3s-slpk-loader.js.map
|