@loaders.gl/i3s 4.0.4 → 4.1.0-alpha.10
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/arcgis-webscene-loader.js.map +1 -1
- package/dist/dist.dev.js +152 -30
- package/dist/i3s-attribute-loader.js +1 -1
- package/dist/i3s-attribute-loader.js.map +1 -1
- package/dist/i3s-building-scene-layer-loader.js +1 -1
- package/dist/i3s-building-scene-layer-loader.js.map +1 -1
- package/dist/i3s-content-loader.js +1 -1
- package/dist/i3s-content-loader.js.map +1 -1
- package/dist/i3s-content-worker-node.js +34 -34
- package/dist/i3s-content-worker-node.js.map +3 -3
- package/dist/i3s-content-worker.js +24 -18
- package/dist/i3s-loader.js +1 -1
- package/dist/i3s-loader.js.map +1 -1
- package/dist/i3s-node-page-loader.js +1 -1
- package/dist/i3s-node-page-loader.js.map +1 -1
- package/dist/i3s-slpk-loader.js +1 -1
- package/dist/i3s-slpk-loader.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/parsers/constants.d.ts.map +1 -1
- package/dist/lib/parsers/constants.js.map +1 -1
- package/dist/lib/parsers/parse-i3s-attribute.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s-attribute.js.map +1 -1
- package/dist/lib/parsers/parse-slpk/parse-slpk.js +2 -2
- package/dist/lib/parsers/parse-slpk/parse-slpk.js.map +1 -1
- package/package.json +12 -12
- package/src/index.ts +2 -1
- package/src/lib/parsers/constants.ts +2 -1
- package/src/lib/parsers/parse-i3s-attribute.ts +2 -1
- package/src/lib/parsers/parse-slpk/parse-slpk.ts +2 -2
|
@@ -76,13 +76,17 @@
|
|
|
76
76
|
function mergeLoaderOptions(baseOptions, newOptions) {
|
|
77
77
|
return mergeOptionsRecursively(baseOptions || {}, newOptions);
|
|
78
78
|
}
|
|
79
|
-
function mergeOptionsRecursively(baseOptions, newOptions) {
|
|
79
|
+
function mergeOptionsRecursively(baseOptions, newOptions, level = 0) {
|
|
80
|
+
if (level > 3) {
|
|
81
|
+
return newOptions;
|
|
82
|
+
}
|
|
80
83
|
const options = { ...baseOptions };
|
|
81
84
|
for (const [key, newValue] of Object.entries(newOptions)) {
|
|
82
85
|
if (newValue && typeof newValue === "object" && !Array.isArray(newValue)) {
|
|
83
86
|
options[key] = mergeOptionsRecursively(
|
|
84
87
|
options[key] || {},
|
|
85
|
-
newOptions[key]
|
|
88
|
+
newOptions[key],
|
|
89
|
+
level + 1
|
|
86
90
|
);
|
|
87
91
|
} else {
|
|
88
92
|
options[key] = newOptions[key];
|
|
@@ -102,7 +106,7 @@
|
|
|
102
106
|
);
|
|
103
107
|
globalThis._loadersgl_.version = NPM_TAG;
|
|
104
108
|
} else {
|
|
105
|
-
globalThis._loadersgl_.version = "4.0.
|
|
109
|
+
globalThis._loadersgl_.version = "4.1.0-alpha.10";
|
|
106
110
|
}
|
|
107
111
|
}
|
|
108
112
|
return globalThis._loadersgl_.version;
|
|
@@ -952,6 +956,9 @@
|
|
|
952
956
|
return true;
|
|
953
957
|
}
|
|
954
958
|
function concatenateArrayBuffers(...sources) {
|
|
959
|
+
return concatenateArrayBuffersFromArray(sources);
|
|
960
|
+
}
|
|
961
|
+
function concatenateArrayBuffersFromArray(sources) {
|
|
955
962
|
const sourceArrays = sources.map(
|
|
956
963
|
(source2) => source2 instanceof ArrayBuffer ? new Uint8Array(source2) : source2
|
|
957
964
|
);
|
|
@@ -1435,7 +1442,7 @@
|
|
|
1435
1442
|
var navigator_ = globalThis.navigator || {};
|
|
1436
1443
|
|
|
1437
1444
|
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/utils/globals.js
|
|
1438
|
-
var VERSION2 = true ? "4.0.
|
|
1445
|
+
var VERSION2 = true ? "4.1.0-alpha.10" : "untranspiled source";
|
|
1439
1446
|
var isBrowser4 = isBrowser3();
|
|
1440
1447
|
|
|
1441
1448
|
// ../../node_modules/@probe.gl/log/dist/utils/local-storage.js
|
|
@@ -5303,7 +5310,7 @@
|
|
|
5303
5310
|
_defineProperty(Ellipsoid, "WGS84", new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z));
|
|
5304
5311
|
|
|
5305
5312
|
// ../images/src/lib/utils/version.ts
|
|
5306
|
-
var VERSION3 = true ? "4.0.
|
|
5313
|
+
var VERSION3 = true ? "4.1.0-alpha.10" : "latest";
|
|
5307
5314
|
|
|
5308
5315
|
// ../images/src/lib/category-api/image-type.ts
|
|
5309
5316
|
var parseImageNode = globalThis.loaders?.parseImageNode;
|
|
@@ -5709,18 +5716,9 @@
|
|
|
5709
5716
|
};
|
|
5710
5717
|
|
|
5711
5718
|
// ../draco/src/lib/utils/version.ts
|
|
5712
|
-
var VERSION4 = true ? "4.0.
|
|
5719
|
+
var VERSION4 = true ? "4.1.0-alpha.10" : "latest";
|
|
5713
5720
|
|
|
5714
5721
|
// ../draco/src/draco-loader.ts
|
|
5715
|
-
var DEFAULT_DRACO_OPTIONS = {
|
|
5716
|
-
draco: {
|
|
5717
|
-
decoderType: typeof WebAssembly === "object" ? "wasm" : "js",
|
|
5718
|
-
// 'js' for IE11
|
|
5719
|
-
libraryPath: "libs/",
|
|
5720
|
-
extraAttributes: {},
|
|
5721
|
-
attributeNameEntry: void 0
|
|
5722
|
-
}
|
|
5723
|
-
};
|
|
5724
5722
|
var DracoLoader = {
|
|
5725
5723
|
name: "Draco",
|
|
5726
5724
|
id: "draco",
|
|
@@ -5732,7 +5730,15 @@
|
|
|
5732
5730
|
mimeTypes: ["application/octet-stream"],
|
|
5733
5731
|
binary: true,
|
|
5734
5732
|
tests: ["DRACO"],
|
|
5735
|
-
options:
|
|
5733
|
+
options: {
|
|
5734
|
+
draco: {
|
|
5735
|
+
decoderType: typeof WebAssembly === "object" ? "wasm" : "js",
|
|
5736
|
+
// 'js' for IE11
|
|
5737
|
+
libraryPath: "libs/",
|
|
5738
|
+
extraAttributes: {},
|
|
5739
|
+
attributeNameEntry: void 0
|
|
5740
|
+
}
|
|
5741
|
+
}
|
|
5736
5742
|
};
|
|
5737
5743
|
|
|
5738
5744
|
// ../draco/src/lib/utils/get-draco-schema.ts
|
|
@@ -6313,7 +6319,7 @@
|
|
|
6313
6319
|
}
|
|
6314
6320
|
|
|
6315
6321
|
// ../textures/src/lib/utils/version.ts
|
|
6316
|
-
var VERSION5 = true ? "4.0.
|
|
6322
|
+
var VERSION5 = true ? "4.1.0-alpha.10" : "latest";
|
|
6317
6323
|
|
|
6318
6324
|
// ../textures/src/lib/parsers/basis-module-loader.ts
|
|
6319
6325
|
var BASIS_EXTERNAL_LIBRARIES = {
|
|
@@ -7841,7 +7847,7 @@
|
|
|
7841
7847
|
}
|
|
7842
7848
|
|
|
7843
7849
|
// src/i3s-content-loader.ts
|
|
7844
|
-
var VERSION6 = true ? "4.0.
|
|
7850
|
+
var VERSION6 = true ? "4.1.0-alpha.10" : "latest";
|
|
7845
7851
|
var I3SContentLoader = {
|
|
7846
7852
|
name: "I3S Content (Indexed Scene Layers)",
|
|
7847
7853
|
id: "i3s-content",
|
package/dist/i3s-loader.js
CHANGED
|
@@ -3,7 +3,7 @@ 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
|
-
const VERSION = typeof
|
|
6
|
+
const VERSION = typeof "4.1.0-alpha.10" !== 'undefined' ? "4.1.0-alpha.10" : 'latest';
|
|
7
7
|
const TILESET_REGEX = /layers\/[0-9]+$/;
|
|
8
8
|
const TILE_HEADER_REGEX = /nodes\/([0-9-]+|root)$/;
|
|
9
9
|
const SLPK_HEX = '504b0304';
|
package/dist/i3s-loader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-loader.js","names":["parse","I3SContentLoader","normalizeTileData","normalizeTilesetData","COORDINATE_SYSTEM","getUrlWithoutParams","VERSION","
|
|
1
|
+
{"version":3,"file":"i3s-loader.js","names":["parse","I3SContentLoader","normalizeTileData","normalizeTilesetData","COORDINATE_SYSTEM","getUrlWithoutParams","VERSION","TILESET_REGEX","TILE_HEADER_REGEX","SLPK_HEX","POINT_CLOUD","I3SLoader","name","id","module","version","mimeTypes","parseI3S","extensions","options","i3s","token","isTileset","isTileHeader","tile","tileset","_tileOptions","_tilesetOptions","useDracoGeometry","useCompressedTextures","decodeTextures","coordinateSystem","METER_OFFSETS","data","arguments","length","undefined","context","url","magicNumber","getMagicNumber","Error","urlWithoutParams","test","parseTileset","parseTile","parseTileContent","arrayBuffer","tilesetJson","JSON","TextDecoder","decode","layerType","tilesetPostprocessed","ArrayBuffer","Uint8Array","map","value","toString","padStart","join"],"sources":["../src/i3s-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {parse} from '@loaders.gl/core';\nimport type {I3STilesetHeader} from './types';\nimport {I3SContentLoader} from './i3s-content-loader';\nimport {normalizeTileData, normalizeTilesetData} from './lib/parsers/parse-i3s';\nimport {COORDINATE_SYSTEM} from './lib/parsers/constants';\nimport {I3SParseOptions} from './types';\nimport {getUrlWithoutParams} from './lib/utils/url-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nconst TILESET_REGEX = /layers\\/[0-9]+$/;\nconst TILE_HEADER_REGEX = /nodes\\/([0-9-]+|root)$/;\nconst SLPK_HEX = '504b0304';\nconst POINT_CLOUD = 'PointCloud';\n\nexport type I3SLoaderOptions = LoaderOptions & {\n i3s?: I3SParseOptions;\n};\n\n/**\n * Loader for I3S - Indexed 3D Scene Layer\n */\nexport const I3SLoader: LoaderWithParser<I3STilesetHeader, never, LoaderOptions> = {\n name: 'I3S (Indexed Scene Layers)',\n id: 'i3s',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/octet-stream'],\n parse: parseI3S,\n extensions: ['bin'],\n options: {\n i3s: {\n token: null,\n isTileset: 'auto',\n isTileHeader: 'auto',\n tile: null,\n tileset: null,\n _tileOptions: null,\n _tilesetOptions: null,\n useDracoGeometry: true,\n useCompressedTextures: true,\n decodeTextures: true,\n coordinateSystem: COORDINATE_SYSTEM.METER_OFFSETS\n }\n }\n};\n\nasync function parseI3S(data, options: I3SLoaderOptions = {}, context): Promise<I3STilesetHeader> {\n const url = context.url;\n options.i3s = options.i3s || {};\n const magicNumber = getMagicNumber(data);\n\n // check if file is slpk\n if (magicNumber === SLPK_HEX) {\n throw new Error('Files with .slpk extention currently are not supported by I3SLoader');\n }\n\n const urlWithoutParams = getUrlWithoutParams(url);\n\n // auto detect file type based on url\n let isTileset;\n if (options.i3s.isTileset === 'auto') {\n isTileset = TILESET_REGEX.test(urlWithoutParams);\n } else {\n isTileset = options.i3s.isTileset;\n }\n\n let isTileHeader;\n if (options.isTileHeader === 'auto') {\n isTileHeader = TILE_HEADER_REGEX.test(urlWithoutParams);\n } else {\n isTileHeader = options.i3s.isTileHeader;\n }\n\n if (isTileset) {\n data = await parseTileset(data, options, context);\n } else if (isTileHeader) {\n data = await parseTile(data, context);\n } else {\n data = await parseTileContent(data, options);\n }\n\n return data;\n}\n\nasync function parseTileContent(arrayBuffer, options: I3SLoaderOptions) {\n return await parse(arrayBuffer, I3SContentLoader, options);\n}\n\nasync function parseTileset(data, options: I3SLoaderOptions, context) {\n const tilesetJson = JSON.parse(new TextDecoder().decode(data));\n\n if (tilesetJson?.layerType === POINT_CLOUD) {\n throw new Error('Point Cloud layers currently are not supported by I3SLoader');\n }\n\n const tilesetPostprocessed = await normalizeTilesetData(tilesetJson, options, context);\n return tilesetPostprocessed;\n}\n\nasync function parseTile(data, context) {\n data = JSON.parse(new TextDecoder().decode(data));\n return normalizeTileData(data, context);\n}\n\nfunction getMagicNumber(data) {\n if (data instanceof ArrayBuffer) {\n // slice binary data (4 bytes from the beginning) and transform it to hexadecimal numeral system\n return [...new Uint8Array(data, 0, 4)]\n .map((value) => value.toString(16).padStart(2, '0'))\n .join('');\n }\n return null;\n}\n"],"mappings":"AACA,SAAQA,KAAK,QAAO,kBAAkB;AAAC,SAE/BC,gBAAgB;AAAA,SAChBC,iBAAiB,EAAEC,oBAAoB;AAAA,SACvCC,iBAAiB;AAAA,SAEjBC,mBAAmB;AAI3B,MAAMC,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAE3E,MAAMC,aAAa,GAAG,iBAAiB;AACvC,MAAMC,iBAAiB,GAAG,wBAAwB;AAClD,MAAMC,QAAQ,GAAG,UAAU;AAC3B,MAAMC,WAAW,GAAG,YAAY;AAShC,OAAO,MAAMC,SAAmE,GAAG;EACjFC,IAAI,EAAE,4BAA4B;EAClCC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAET,OAAO;EAChBU,SAAS,EAAE,CAAC,0BAA0B,CAAC;EACvChB,KAAK,EAAEiB,QAAQ;EACfC,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,OAAO,EAAE;IACPC,GAAG,EAAE;MACHC,KAAK,EAAE,IAAI;MACXC,SAAS,EAAE,MAAM;MACjBC,YAAY,EAAE,MAAM;MACpBC,IAAI,EAAE,IAAI;MACVC,OAAO,EAAE,IAAI;MACbC,YAAY,EAAE,IAAI;MAClBC,eAAe,EAAE,IAAI;MACrBC,gBAAgB,EAAE,IAAI;MACtBC,qBAAqB,EAAE,IAAI;MAC3BC,cAAc,EAAE,IAAI;MACpBC,gBAAgB,EAAE3B,iBAAiB,CAAC4B;IACtC;EACF;AACF,CAAC;AAED,eAAef,QAAQA,CAACgB,IAAI,EAAsE;EAAA,IAApEd,OAAyB,GAAAe,SAAA,CAAA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s-node-page-loader.js","names":["VERSION","I3SNodePageLoader","name","id","module","version","mimeTypes","parse","parseNodePage","extensions","options","i3s","data","JSON","TextDecoder","decode"],"sources":["../src/i3s-node-page-loader.ts"],"sourcesContent":["import type {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {I3SLoaderOptions} from './i3s-loader';\nimport type {NodePage} from './types';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/**\n * Loader for I3S node pages\n */\nexport const I3SNodePageLoader: LoaderWithParser<NodePage, never, I3SLoaderOptions> = {\n name: 'I3S Node Page',\n id: 'i3s-node-page',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/json'],\n parse: parseNodePage,\n extensions: ['json'],\n options: {\n i3s: {}\n }\n};\n\nasync function parseNodePage(data: ArrayBuffer, options?: LoaderOptions): Promise<NodePage> {\n return JSON.parse(new TextDecoder().decode(data)) as NodePage;\n}\n"],"mappings":"AAMA,MAAMA,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAK3E,OAAO,MAAMC,iBAAsE,GAAG;EACpFC,IAAI,EAAE,eAAe;EACrBC,EAAE,EAAE,eAAe;EACnBC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEL,OAAO;EAChBM,SAAS,EAAE,CAAC,kBAAkB,CAAC;EAC/BC,KAAK,EAAEC,aAAa;EACpBC,UAAU,EAAE,CAAC,MAAM,CAAC;EACpBC,OAAO,EAAE;IACPC,GAAG,EAAE,CAAC;EACR;AACF,CAAC;AAED,eAAeH,aAAaA,CAACI,IAAiB,EAAEF,OAAuB,EAAqB;EAC1F,OAAOG,IAAI,CAACN,KAAK,CAAC,IAAIO,WAAW,CAAC,CAAC,CAACC,MAAM,CAACH,IAAI,CAAC,CAAC;AACnD"}
|
package/dist/i3s-slpk-loader.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DataViewFile } from '@loaders.gl/loader-utils';
|
|
2
2
|
import { parseSLPKArchive } from "./lib/parsers/parse-slpk/parse-slpk.js";
|
|
3
|
-
const VERSION = typeof
|
|
3
|
+
const VERSION = typeof "4.1.0-alpha.10" !== 'undefined' ? "4.1.0-alpha.10" : 'latest';
|
|
4
4
|
export const SLPKLoader = {
|
|
5
5
|
name: 'I3S SLPK (Scene Layer Package)',
|
|
6
6
|
id: 'slpk',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-slpk-loader.js","names":["DataViewFile","parseSLPKArchive","VERSION","
|
|
1
|
+
{"version":3,"file":"i3s-slpk-loader.js","names":["DataViewFile","parseSLPKArchive","VERSION","SLPKLoader","name","id","module","version","mimeTypes","extensions","options","parse","data","_options$slpk$path","_options$slpk","_options$slpk2","arguments","length","undefined","archive","DataView","getFile","slpk","path","pathMode"],"sources":["../src/i3s-slpk-loader.ts"],"sourcesContent":["import type {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {DataViewFile} from '@loaders.gl/loader-utils';\nimport {parseSLPKArchive} from './lib/parsers/parse-slpk/parse-slpk';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/** options to load data from SLPK */\nexport type SLPKLoaderOptions = LoaderOptions & {\n slpk?: {\n /** path inside the slpk archive */\n path?: string;\n /** mode of the path */\n pathMode?: 'http' | 'raw';\n };\n};\n\n/**\n * Loader for SLPK - Scene Layer Package (Archive I3S format)\n * @todo - this reloads the entire archive for every tile, should be optimized\n * @todo - this should be updated to use `parseFile` and ReadableFile\n */\nexport const SLPKLoader: LoaderWithParser<ArrayBuffer, never, SLPKLoaderOptions> = {\n name: 'I3S SLPK (Scene Layer Package)',\n id: 'slpk',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/octet-stream'],\n extensions: ['slpk'],\n options: {},\n parse: async (data: ArrayBuffer, options: SLPKLoaderOptions = {}): Promise<ArrayBuffer> => {\n const archive = await parseSLPKArchive(new DataViewFile(new DataView(data)));\n return archive.getFile(options.slpk?.path ?? '', options.slpk?.pathMode);\n }\n};\n"],"mappings":"AACA,SAAQA,YAAY,QAAO,0BAA0B;AAAC,SAC9CC,gBAAgB;AAIxB,MAAMC,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAiB3E,OAAO,MAAMC,UAAmE,GAAG;EACjFC,IAAI,EAAE,gCAAgC;EACtCC,EAAE,EAAE,MAAM;EACVC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEL,OAAO;EAChBM,SAAS,EAAE,CAAC,0BAA0B,CAAC;EACvCC,UAAU,EAAE,CAAC,MAAM,CAAC;EACpBC,OAAO,EAAE,CAAC,CAAC;EACXC,KAAK,EAAE,eAAAA,CAAOC,IAAiB,EAA4D;IAAA,IAAAC,kBAAA,EAAAC,aAAA,EAAAC,cAAA;IAAA,IAA1DL,OAA0B,GAAAM,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IAC9D,MAAMG,OAAO,GAAG,MAAMlB,gBAAgB,CAAC,IAAID,YAAY,CAAC,IAAIoB,QAAQ,CAACR,IAAI,CAAC,CAAC,CAAC;IAC5E,OAAOO,OAAO,CAACE,OAAO,EAAAR,kBAAA,IAAAC,aAAA,GAACJ,OAAO,CAACY,IAAI,cAAAR,aAAA,uBAAZA,aAAA,CAAcS,IAAI,cAAAV,kBAAA,cAAAA,kBAAA,GAAI,EAAE,GAAAE,cAAA,GAAEL,OAAO,CAACY,IAAI,cAAAP,cAAA,uBAAZA,cAAA,CAAcS,QAAQ,CAAC;EAC1E;AACF,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1141,7 +1141,7 @@ var SLPKArchive = class {
|
|
|
1141
1141
|
|
|
1142
1142
|
// src/lib/parsers/parse-slpk/parse-slpk.ts
|
|
1143
1143
|
async function parseSLPKArchive(fileProvider, cb) {
|
|
1144
|
-
const hashCDOffset = await (0, import_zip2.searchFromTheEnd)(fileProvider, import_zip2.
|
|
1144
|
+
const hashCDOffset = await (0, import_zip2.searchFromTheEnd)(fileProvider, import_zip2.CD_HEADER_SIGNATURE);
|
|
1145
1145
|
const cdFileHeader = await (0, import_zip2.parseZipCDFileHeader)(hashCDOffset, fileProvider);
|
|
1146
1146
|
let hashTable;
|
|
1147
1147
|
if ((cdFileHeader == null ? void 0 : cdFileHeader.fileName) !== "@specialIndexFileHASH128@") {
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,YAAY,EACV,eAAe,EACf,GAAG,EACH,GAAG,EACH,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,KAAK,EACL,SAAS,EACT,SAAS,EACT,mBAAmB,EACnB,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,oBAAoB,EACpB,UAAU,EACV,eAAe,EACf,SAAS,EACT,MAAM,EACN,gBAAgB,EAChB,SAAS,EACT,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,UAAU,EACV,cAAc,EACd,SAAS,EACT,SAAS,EACT,UAAU,EACV,qBAAqB,EACrB,gBAAgB,EAChB,2BAA2B,EAC5B,MAAM,SAAS,CAAC;AACjB,YAAY,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAC,iBAAiB,EAAC,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AACvC,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAC,kBAAkB,EAAE,qBAAqB,EAAC,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAC,2BAA2B,EAAC,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAC,iBAAiB,EAAC,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAC,oBAAoB,EAAC,MAAM,0BAA0B,CAAC;AAE9D,YAAY,EAAC,WAAW,EAAC,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAC,gBAAgB,EAAC,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["COORDINATE_SYSTEM","I3SLoader","SLPKLoader","I3SContentLoader","I3SAttributeLoader","loadFeatureAttributes","I3SBuildingSceneLayerLoader","I3SNodePageLoader","ArcGISWebSceneLoader","parseSLPKArchive","customizeColors"],"sources":["../src/index.ts"],"sourcesContent":["// loaders.gl
|
|
1
|
+
{"version":3,"file":"index.js","names":["COORDINATE_SYSTEM","I3SLoader","SLPKLoader","I3SContentLoader","I3SAttributeLoader","loadFeatureAttributes","I3SBuildingSceneLayerLoader","I3SNodePageLoader","ArcGISWebSceneLoader","parseSLPKArchive","customizeColors"],"sources":["../src/index.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport type {\n BoundingVolumes,\n Mbs,\n Obb,\n I3STilesetHeader,\n I3STileContent,\n I3STileHeader,\n SceneLayer3D,\n AttributeStorageInfo,\n Field,\n ESRIField,\n PopupInfo,\n Node3DIndexDocument,\n LodSelection,\n NodeReference,\n Resource,\n MaxScreenThresholdSQ,\n NodeInPage,\n SharedResources,\n Attribute,\n Extent,\n FeatureAttribute,\n FieldInfo,\n I3SMaterialDefinition,\n TextureDefinitionInfo,\n MaterialDefinitionInfo,\n FullExtent,\n StatisticsInfo,\n StatsInfo,\n Histogram,\n ValueCount,\n BuildingSceneSublayer,\n OperationalLayer,\n TextureSetDefinitionFormats\n} from './types';\nexport type {I3SLoaderOptions} from './i3s-loader';\n\nexport {COORDINATE_SYSTEM} from './lib/parsers/constants';\n\nexport {I3SLoader} from './i3s-loader';\nexport {SLPKLoader} from './i3s-slpk-loader';\nexport {I3SContentLoader} from './i3s-content-loader';\nexport {I3SAttributeLoader, loadFeatureAttributes} from './i3s-attribute-loader';\nexport {I3SBuildingSceneLayerLoader} from './i3s-building-scene-layer-loader';\nexport {I3SNodePageLoader} from './i3s-node-page-loader';\nexport {ArcGISWebSceneLoader} from './arcgis-webscene-loader';\n\nexport type {SLPKArchive} from './lib/parsers/parse-slpk/slpk-archieve';\nexport {parseSLPKArchive} from './lib/parsers/parse-slpk/parse-slpk';\nexport {customizeColors} from './lib/utils/customize-colors';\n"],"mappings":"SAyCQA,iBAAiB;AAAA,SAEjBC,SAAS;AAAA,SACTC,UAAU;AAAA,SACVC,gBAAgB;AAAA,SAChBC,kBAAkB,EAAEC,qBAAqB;AAAA,SACzCC,2BAA2B;AAAA,SAC3BC,iBAAiB;AAAA,SACjBC,oBAAoB;AAAA,SAGpBC,gBAAgB;AAAA,SAChBC,eAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/constants.ts"],"names":[],"mappings":"AAMA,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,+HAe3D;AAED,eAAO,MAAM,WAAW,EAAE;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAM/C,CAAC;AACF;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAkB/C;AAED,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAC9C,eAAO,MAAM,wBAAwB,UAAU,CAAC;AAChD,eAAO,MAAM,aAAa,YAAY,CAAC;AACvC,eAAO,MAAM,qBAAqB,UAAU,CAAC;AAI7C,oBAAY,iBAAiB;IAC3B;;OAEG;IACH,OAAO,KAAK;IACZ;;;OAGG;IACH,MAAM,IAAI;IACV;;OAEG;IACH,aAAa,IAAI;IACjB;;;;OAIG;IACH,cAAc,IAAI;IAClB;;OAEG;IACH,SAAS,IAAI;CACd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":["GL","getConstructorForDataFormat","dataType","Uint8Array","Uint16Array","Uint32Array","Float32Array","Float64Array","Error","GL_TYPE_MAP","UInt8","UNSIGNED_BYTE","UInt16","UNSIGNED_SHORT","Float32","FLOAT","UInt32","UNSIGNED_INT","UInt64","DOUBLE","sizeOf","STRING_ATTRIBUTE_TYPE","OBJECT_ID_ATTRIBUTE_TYPE","FLOAT_64_TYPE","INT_16_ATTRIBUTE_TYPE","COORDINATE_SYSTEM"],"sources":["../../../src/lib/parsers/constants.ts"],"sourcesContent":["// loaders.gl
|
|
1
|
+
{"version":3,"file":"constants.js","names":["GL","getConstructorForDataFormat","dataType","Uint8Array","Uint16Array","Uint32Array","Float32Array","Float64Array","Error","GL_TYPE_MAP","UInt8","UNSIGNED_BYTE","UInt16","UNSIGNED_SHORT","Float32","FLOAT","UInt32","UNSIGNED_INT","UInt64","DOUBLE","sizeOf","STRING_ATTRIBUTE_TYPE","OBJECT_ID_ATTRIBUTE_TYPE","FLOAT_64_TYPE","INT_16_ATTRIBUTE_TYPE","COORDINATE_SYSTEM"],"sources":["../../../src/lib/parsers/constants.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {GL} from '@loaders.gl/math';\n\nexport function getConstructorForDataFormat(dataType: string) {\n switch (dataType) {\n case 'UInt8':\n return Uint8Array;\n case 'UInt16':\n return Uint16Array;\n case 'UInt32':\n return Uint32Array;\n case 'Float32':\n return Float32Array;\n case 'UInt64':\n return Float64Array;\n default:\n throw new Error(`parse i3s tile content: unknown type of data: ${dataType}`);\n }\n}\n\nexport const GL_TYPE_MAP: {[key: string]: number} = {\n UInt8: GL.UNSIGNED_BYTE,\n UInt16: GL.UNSIGNED_SHORT,\n Float32: GL.FLOAT,\n UInt32: GL.UNSIGNED_INT,\n UInt64: GL.DOUBLE\n};\n/**\n * Returns how many bytes a type occupies\n * @param dataType\n * @returns\n */\nexport function sizeOf(dataType: string): number {\n switch (dataType) {\n case 'UInt8':\n return 1;\n case 'UInt16':\n case 'Int16':\n return 2;\n case 'UInt32':\n case 'Int32':\n case 'Float32':\n return 4;\n case 'UInt64':\n case 'Int64':\n case 'Float64':\n return 8;\n default:\n throw new Error(`parse i3s tile content: unknown size of data: ${dataType}`);\n }\n}\n\nexport const STRING_ATTRIBUTE_TYPE = 'String';\nexport const OBJECT_ID_ATTRIBUTE_TYPE = 'Oid32';\nexport const FLOAT_64_TYPE = 'Float64';\nexport const INT_16_ATTRIBUTE_TYPE = 'Int16';\n\n// https://github.com/visgl/deck.gl/blob/9548f43cba2234a1f4877b6b17f6c88eb35b2e08/modules/core/src/lib/constants.js#L27\n// Describes the format of positions\nexport enum COORDINATE_SYSTEM {\n /**\n * `LNGLAT` if rendering into a geospatial viewport, `CARTESIAN` otherwise\n */\n DEFAULT = -1,\n /**\n * Positions are interpreted as [lng, lat, elevation]\n * lng lat are degrees, elevation is meters. distances as meters.\n */\n LNGLAT = 1,\n /**\n * Positions are interpreted as meter offsets, distances as meters\n */\n METER_OFFSETS = 2,\n /**\n * Positions are interpreted as lng lat offsets: [deltaLng, deltaLat, elevation]\n * deltaLng, deltaLat are delta degrees, elevation is meters.\n * distances as meters.\n */\n LNGLAT_OFFSETS = 3,\n /**\n * Non-geospatial\n */\n CARTESIAN = 0\n}\n"],"mappings":"AAIA,SAAQA,EAAE,QAAO,kBAAkB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B;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-i3s-attribute.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/parse-i3s-attribute.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parse-i3s-attribute.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/parse-i3s-attribute.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAS9C,KAAK,SAAS,GAAG,MAAM,EAAE,GAAG,UAAU,GAAG,IAAI,CAAC;AAC9C,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAE1D;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,KAAA,GAAG,iBAAiB,CAS1F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-i3s-attribute.js","names":["STRING_ATTRIBUTE_TYPE","OBJECT_ID_ATTRIBUTE_TYPE","FLOAT_64_TYPE","INT_16_ATTRIBUTE_TYPE","parseI3STileAttribute","arrayBuffer","options","attributeName","attributeType","parseAttribute","parseStringsAttribute","parseShortNumberAttribute","parseFloatAttribute","parseInt16ShortNumberAttribute","countOffset","Uint32Array","Int16Array","Float64Array","stringsCountOffset","dataOffset","bytesPerStringSize","stringsArray","stringsCount","DataView","getUint32","stringSizes","stringOffset","stringByteSize","textDecoder","TextDecoder","stringAttribute","Uint8Array","push","decode","error","console","message"],"sources":["../../../src/lib/parsers/parse-i3s-attribute.ts"],"sourcesContent":["// loaders.gl
|
|
1
|
+
{"version":3,"file":"parse-i3s-attribute.js","names":["STRING_ATTRIBUTE_TYPE","OBJECT_ID_ATTRIBUTE_TYPE","FLOAT_64_TYPE","INT_16_ATTRIBUTE_TYPE","parseI3STileAttribute","arrayBuffer","options","attributeName","attributeType","parseAttribute","parseStringsAttribute","parseShortNumberAttribute","parseFloatAttribute","parseInt16ShortNumberAttribute","countOffset","Uint32Array","Int16Array","Float64Array","stringsCountOffset","dataOffset","bytesPerStringSize","stringsArray","stringsCount","DataView","getUint32","stringSizes","stringOffset","stringByteSize","textDecoder","TextDecoder","stringAttribute","Uint8Array","push","decode","error","console","message"],"sources":["../../../src/lib/parsers/parse-i3s-attribute.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {TypedArray} from '@loaders.gl/schema';\n\nimport {\n STRING_ATTRIBUTE_TYPE,\n OBJECT_ID_ATTRIBUTE_TYPE,\n FLOAT_64_TYPE,\n INT_16_ATTRIBUTE_TYPE\n} from './constants';\n\ntype Attribute = string[] | TypedArray | null;\nexport type I3STileAttributes = Record<string, Attribute>;\n\n/**\n * Get particular tile and creates attribute object inside.\n * @param arrayBuffer\n * @param {Object} options\n * @returns {Promise<object>}\n */\nexport function parseI3STileAttribute(arrayBuffer: ArrayBuffer, options): I3STileAttributes {\n const {attributeName, attributeType} = options;\n\n if (!attributeName) {\n return {};\n }\n return {\n [attributeName]: attributeType ? parseAttribute(attributeType, arrayBuffer) : null\n };\n}\n\n/**\n * Parse attributes based on attribute type.\n * @param {String} attributeType\n * @param arrayBuffer\n * @returns\n */\nfunction parseAttribute(attributeType, arrayBuffer: ArrayBuffer): Attribute {\n switch (attributeType) {\n case STRING_ATTRIBUTE_TYPE:\n return parseStringsAttribute(arrayBuffer);\n case OBJECT_ID_ATTRIBUTE_TYPE:\n return parseShortNumberAttribute(arrayBuffer);\n case FLOAT_64_TYPE:\n return parseFloatAttribute(arrayBuffer);\n case INT_16_ATTRIBUTE_TYPE:\n return parseInt16ShortNumberAttribute(arrayBuffer);\n default:\n return parseShortNumberAttribute(arrayBuffer);\n }\n}\n\n/**\n * Parse short number attribute.\n * Short Integer spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.7/attributeStorageInfo.cmn.md\n * @param arrayBuffer\n * @returns\n */\nfunction parseShortNumberAttribute(arrayBuffer: ArrayBuffer): Uint32Array {\n const countOffset = 4;\n return new Uint32Array(arrayBuffer, countOffset);\n}\n\n/**\n * Parse Int16 short number attribute.\n * Parsing of such data is not documented. Added to handle Building Scene Layer Tileset attributes data.\n * @param arrayBuffer\n * @returns\n */\nfunction parseInt16ShortNumberAttribute(arrayBuffer: ArrayBuffer): Int16Array {\n const countOffset = 4;\n return new Int16Array(arrayBuffer, countOffset);\n}\n\n/**\n * Parse float attribute.\n * Double Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.7/attributeStorageInfo.cmn.md\n * @param arrayBuffer\n * @returns\n */\nfunction parseFloatAttribute(arrayBuffer: ArrayBuffer): Float64Array {\n const countOffset = 8;\n return new Float64Array(arrayBuffer, countOffset);\n}\n\n/**\n * Parse string attribute.\n * String spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.7/attributeStorageInfo.cmn.md\n * @param arrayBuffer\n * @returns list of strings\n */\nfunction parseStringsAttribute(arrayBuffer: ArrayBuffer): string[] {\n const stringsCountOffset = 0;\n const dataOffset = 8;\n const bytesPerStringSize = 4;\n const stringsArray: string[] = [];\n\n try {\n // Use DataView to avoid multiple of 4 error on Uint32Array constructor\n const stringsCount = new DataView(\n arrayBuffer,\n stringsCountOffset,\n bytesPerStringSize\n ).getUint32(stringsCountOffset, true);\n const stringSizes = new Uint32Array(arrayBuffer, dataOffset, stringsCount);\n let stringOffset = dataOffset + stringsCount * bytesPerStringSize;\n\n for (const stringByteSize of stringSizes) {\n const textDecoder = new TextDecoder('utf-8');\n const stringAttribute = new Uint8Array(arrayBuffer, stringOffset, stringByteSize);\n stringsArray.push(textDecoder.decode(stringAttribute));\n stringOffset += stringByteSize;\n }\n } catch (error) {\n console.error('Parse string attribute error: ', (error as Error).message); // eslint-disable-line\n }\n\n return stringsArray;\n}\n"],"mappings":"SAOEA,q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,MAAMC,kBAAkB,GAAG,CAAC;EAC5B,MAAMC,YAAsB,GAAG,EAAE;EAEjC,IAAI;IAEF,MAAMC,YAAY,GAAG,IAAIC,QAAQ,CAC/BlB,WAAW,EACXa,kBAAkB,EAClBE,kBACF,CAAC,CAACI,SAAS,CAACN,kBAAkB,EAAE,IAAI,CAAC;IACrC,MAAMO,WAAW,GAAG,IAAIV,WAAW,CAACV,WAAW,EAAEc,UAAU,EAAEG,YAAY,CAAC;IAC1E,IAAII,YAAY,GAAGP,UAAU,GAAGG,YAAY,GAAGF,kBAAkB;IAEjE,KAAK,MAAMO,cAAc,IAAIF,WAAW,EAAE;MACxC,MAAMG,WAAW,GAAG,IAAIC,WAAW,CAAC,OAAO,CAAC;MAC5C,MAAMC,eAAe,GAAG,IAAIC,UAAU,CAAC1B,WAAW,EAAEqB,YAAY,EAAEC,cAAc,CAAC;MACjFN,YAAY,CAACW,IAAI,CAACJ,WAAW,CAACK,MAAM,CAACH,eAAe,CAAC,CAAC;MACtDJ,YAAY,IAAIC,cAAc;IAChC;EACF,CAAC,CAAC,OAAOO,KAAK,EAAE;IACdC,OAAO,CAACD,KAAK,CAAC,gCAAgC,EAAGA,KAAK,CAAWE,OAAO,CAAC;EAC3E;EAEA,OAAOf,YAAY;AACrB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { parseZipCDFileHeader,
|
|
1
|
+
import { parseZipCDFileHeader, CD_HEADER_SIGNATURE, parseZipLocalFileHeader, searchFromTheEnd, parseHashTable, makeHashTableFromZipHeaders } from '@loaders.gl/zip';
|
|
2
2
|
import { SLPKArchive } from "./slpk-archieve.js";
|
|
3
3
|
export async function parseSLPKArchive(fileProvider, cb) {
|
|
4
|
-
const hashCDOffset = await searchFromTheEnd(fileProvider,
|
|
4
|
+
const hashCDOffset = await searchFromTheEnd(fileProvider, CD_HEADER_SIGNATURE);
|
|
5
5
|
const cdFileHeader = await parseZipCDFileHeader(hashCDOffset, fileProvider);
|
|
6
6
|
let hashTable;
|
|
7
7
|
if ((cdFileHeader === null || cdFileHeader === void 0 ? void 0 : cdFileHeader.fileName) !== '@specialIndexFileHASH128@') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-slpk.js","names":["parseZipCDFileHeader","
|
|
1
|
+
{"version":3,"file":"parse-slpk.js","names":["parseZipCDFileHeader","CD_HEADER_SIGNATURE","parseZipLocalFileHeader","searchFromTheEnd","parseHashTable","makeHashTableFromZipHeaders","SLPKArchive","parseSLPKArchive","fileProvider","cb","hashCDOffset","cdFileHeader","hashTable","fileName","localFileHeader","localHeaderOffset","Error","fileDataOffset","hashFile","slice","compressedSize"],"sources":["../../../../src/lib/parsers/parse-slpk/parse-slpk.ts"],"sourcesContent":["import {FileProvider} from '@loaders.gl/loader-utils';\nimport {\n parseZipCDFileHeader,\n CD_HEADER_SIGNATURE,\n parseZipLocalFileHeader,\n searchFromTheEnd,\n parseHashTable,\n makeHashTableFromZipHeaders\n} from '@loaders.gl/zip';\nimport {SLPKArchive} from './slpk-archieve';\n\n/**\n * Creates slpk file handler from raw file\n * @param fileProvider raw file data\n * @param cb is called with information message during parsing\n * @returns slpk file handler\n */\nexport async function parseSLPKArchive(\n fileProvider: FileProvider,\n cb?: (msg: string) => void\n): Promise<SLPKArchive> {\n const hashCDOffset = await searchFromTheEnd(fileProvider, CD_HEADER_SIGNATURE);\n\n const cdFileHeader = await parseZipCDFileHeader(hashCDOffset, fileProvider);\n\n let hashTable: Record<string, bigint>;\n if (cdFileHeader?.fileName !== '@specialIndexFileHASH128@') {\n hashTable = await makeHashTableFromZipHeaders(fileProvider);\n cb?.(\n 'SLPK doesnt contain hash file, hash info has been composed according to zip archive headers'\n );\n } else {\n // cb?.('SLPK contains hash file');\n const localFileHeader = await parseZipLocalFileHeader(\n cdFileHeader.localHeaderOffset,\n fileProvider\n );\n if (!localFileHeader) {\n throw new Error('corrupted SLPK');\n }\n\n const fileDataOffset = localFileHeader.fileDataOffset;\n const hashFile = await fileProvider.slice(\n fileDataOffset,\n fileDataOffset + localFileHeader.compressedSize\n );\n\n hashTable = parseHashTable(hashFile);\n }\n\n return new SLPKArchive(fileProvider, hashTable);\n}\n"],"mappings":"AACA,SACEA,oBAAoB,EACpBC,mBAAmB,EACnBC,uBAAuB,EACvBC,gBAAgB,EAChBC,cAAc,EACdC,2BAA2B,QACtB,iBAAiB;AAAC,SACjBC,WAAW;AAQnB,OAAO,eAAeC,gBAAgBA,CACpCC,YAA0B,EAC1BC,EAA0B,EACJ;EACtB,MAAMC,YAAY,GAAG,MAAMP,gBAAgB,CAACK,YAAY,EAAEP,mBAAmB,CAAC;EAE9E,MAAMU,YAAY,GAAG,MAAMX,oBAAoB,CAACU,YAAY,EAAEF,YAAY,CAAC;EAE3E,IAAII,SAAiC;EACrC,IAAI,CAAAD,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEE,QAAQ,MAAK,2BAA2B,EAAE;IAC1DD,SAAS,GAAG,MAAMP,2BAA2B,CAACG,YAAY,CAAC;IAC3DC,EAAE,aAAFA,EAAE,uBAAFA,EAAE,CACA,6FACF,CAAC;EACH,CAAC,MAAM;IAEL,MAAMK,eAAe,GAAG,MAAMZ,uBAAuB,CACnDS,YAAY,CAACI,iBAAiB,EAC9BP,YACF,CAAC;IACD,IAAI,CAACM,eAAe,EAAE;MACpB,MAAM,IAAIE,KAAK,CAAC,gBAAgB,CAAC;IACnC;IAEA,MAAMC,cAAc,GAAGH,eAAe,CAACG,cAAc;IACrD,MAAMC,QAAQ,GAAG,MAAMV,YAAY,CAACW,KAAK,CACvCF,cAAc,EACdA,cAAc,GAAGH,eAAe,CAACM,cACnC,CAAC;IAEDR,SAAS,GAAGR,cAAc,CAACc,QAAQ,CAAC;EACtC;EAEA,OAAO,IAAIZ,WAAW,CAACE,YAAY,EAAEI,SAAS,CAAC;AACjD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/i3s",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.1.0-alpha.10",
|
|
4
4
|
"description": "i3s .",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"module": "dist/index.js",
|
|
24
24
|
"exports": {
|
|
25
25
|
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
26
27
|
"import": "./dist/index.js",
|
|
27
|
-
"require": "./dist/index.cjs"
|
|
28
|
-
"types": "./dist/index.d.ts"
|
|
28
|
+
"require": "./dist/index.cjs"
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"sideEffects": false,
|
|
@@ -41,14 +41,14 @@
|
|
|
41
41
|
"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\\\""
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@loaders.gl/compression": "4.0.
|
|
45
|
-
"@loaders.gl/crypto": "4.0.
|
|
46
|
-
"@loaders.gl/draco": "4.0.
|
|
47
|
-
"@loaders.gl/images": "4.0.
|
|
48
|
-
"@loaders.gl/loader-utils": "4.0.
|
|
49
|
-
"@loaders.gl/schema": "4.0.
|
|
50
|
-
"@loaders.gl/textures": "4.0.
|
|
51
|
-
"@loaders.gl/tiles": "4.0.
|
|
44
|
+
"@loaders.gl/compression": "4.1.0-alpha.10",
|
|
45
|
+
"@loaders.gl/crypto": "4.1.0-alpha.10",
|
|
46
|
+
"@loaders.gl/draco": "4.1.0-alpha.10",
|
|
47
|
+
"@loaders.gl/images": "4.1.0-alpha.10",
|
|
48
|
+
"@loaders.gl/loader-utils": "4.1.0-alpha.10",
|
|
49
|
+
"@loaders.gl/schema": "4.1.0-alpha.10",
|
|
50
|
+
"@loaders.gl/textures": "4.1.0-alpha.10",
|
|
51
|
+
"@loaders.gl/tiles": "4.1.0-alpha.10",
|
|
52
52
|
"@math.gl/core": "^4.0.0",
|
|
53
53
|
"@math.gl/culling": "^4.0.0",
|
|
54
54
|
"@math.gl/geospatial": "^4.0.0"
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"@loaders.gl/core": "^4.0.0"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "19f43c2d90d8b50860c3f8e487429779a386287d"
|
|
60
60
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {FileProvider} from '@loaders.gl/loader-utils';
|
|
2
2
|
import {
|
|
3
3
|
parseZipCDFileHeader,
|
|
4
|
-
|
|
4
|
+
CD_HEADER_SIGNATURE,
|
|
5
5
|
parseZipLocalFileHeader,
|
|
6
6
|
searchFromTheEnd,
|
|
7
7
|
parseHashTable,
|
|
@@ -19,7 +19,7 @@ export async function parseSLPKArchive(
|
|
|
19
19
|
fileProvider: FileProvider,
|
|
20
20
|
cb?: (msg: string) => void
|
|
21
21
|
): Promise<SLPKArchive> {
|
|
22
|
-
const hashCDOffset = await searchFromTheEnd(fileProvider,
|
|
22
|
+
const hashCDOffset = await searchFromTheEnd(fileProvider, CD_HEADER_SIGNATURE);
|
|
23
23
|
|
|
24
24
|
const cdFileHeader = await parseZipCDFileHeader(hashCDOffset, fileProvider);
|
|
25
25
|
|