@loaders.gl/i3s 4.2.3 → 4.2.4
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.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 +68 -59
- package/dist/i3s-content-worker-node.js.map +4 -4
- package/dist/i3s-content-worker.js +6 -6
- package/dist/i3s-loader.js +1 -1
- package/dist/i3s-node-page-loader.js +1 -1
- package/dist/i3s-slpk-loader.js +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.cjs.map +1 -1
- package/package.json +12 -12
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
var navigator_ = globalThis.navigator || {};
|
|
119
119
|
|
|
120
120
|
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/utils/globals.js
|
|
121
|
-
var VERSION = true ? "4.2.
|
|
121
|
+
var VERSION = true ? "4.2.3" : "untranspiled source";
|
|
122
122
|
var isBrowser3 = isBrowser2();
|
|
123
123
|
|
|
124
124
|
// ../../node_modules/@probe.gl/log/dist/utils/local-storage.js
|
|
@@ -660,7 +660,7 @@
|
|
|
660
660
|
);
|
|
661
661
|
globalThis._loadersgl_.version = NPM_TAG;
|
|
662
662
|
} else {
|
|
663
|
-
globalThis._loadersgl_.version = "4.2.
|
|
663
|
+
globalThis._loadersgl_.version = "4.2.3";
|
|
664
664
|
}
|
|
665
665
|
}
|
|
666
666
|
return globalThis._loadersgl_.version;
|
|
@@ -5329,7 +5329,7 @@
|
|
|
5329
5329
|
_defineProperty(Ellipsoid, "WGS84", new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z));
|
|
5330
5330
|
|
|
5331
5331
|
// ../images/src/lib/utils/version.ts
|
|
5332
|
-
var VERSION3 = true ? "4.2.
|
|
5332
|
+
var VERSION3 = true ? "4.2.3" : "latest";
|
|
5333
5333
|
|
|
5334
5334
|
// ../images/src/lib/category-api/image-type.ts
|
|
5335
5335
|
var parseImageNode = globalThis.loaders?.parseImageNode;
|
|
@@ -5737,7 +5737,7 @@
|
|
|
5737
5737
|
};
|
|
5738
5738
|
|
|
5739
5739
|
// ../draco/src/lib/utils/version.ts
|
|
5740
|
-
var VERSION4 = true ? "4.2.
|
|
5740
|
+
var VERSION4 = true ? "4.2.3" : "latest";
|
|
5741
5741
|
|
|
5742
5742
|
// ../draco/src/draco-loader.ts
|
|
5743
5743
|
var DracoLoader = {
|
|
@@ -6353,7 +6353,7 @@
|
|
|
6353
6353
|
}
|
|
6354
6354
|
|
|
6355
6355
|
// ../textures/src/lib/utils/version.ts
|
|
6356
|
-
var VERSION5 = true ? "4.2.
|
|
6356
|
+
var VERSION5 = true ? "4.2.3" : "latest";
|
|
6357
6357
|
|
|
6358
6358
|
// ../textures/src/lib/parsers/basis-module-loader.ts
|
|
6359
6359
|
var BASIS_EXTERNAL_LIBRARIES = {
|
|
@@ -7884,7 +7884,7 @@
|
|
|
7884
7884
|
}
|
|
7885
7885
|
|
|
7886
7886
|
// src/i3s-content-loader.ts
|
|
7887
|
-
var VERSION6 = true ? "4.2.
|
|
7887
|
+
var VERSION6 = true ? "4.2.3" : "latest";
|
|
7888
7888
|
var I3SContentLoader = {
|
|
7889
7889
|
dataType: null,
|
|
7890
7890
|
batchType: null,
|
package/dist/i3s-loader.js
CHANGED
|
@@ -8,7 +8,7 @@ import { COORDINATE_SYSTEM } from "./lib/parsers/constants.js";
|
|
|
8
8
|
import { getUrlWithoutParams } from "./lib/utils/url-utils.js";
|
|
9
9
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
10
10
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
11
|
-
const VERSION = typeof "4.2.
|
|
11
|
+
const VERSION = typeof "4.2.3" !== 'undefined' ? "4.2.3" : 'latest';
|
|
12
12
|
const TILESET_REGEX = /layers\/[0-9]+$/;
|
|
13
13
|
const LOCAL_SLPK_REGEX = /\.slpk$/;
|
|
14
14
|
const TILE_HEADER_REGEX = /nodes\/([0-9-]+|root)$/;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright vis.gl contributors
|
|
4
4
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
5
5
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
6
|
-
const VERSION = typeof "4.2.
|
|
6
|
+
const VERSION = typeof "4.2.3" !== 'undefined' ? "4.2.3" : 'latest';
|
|
7
7
|
/**
|
|
8
8
|
* Loader for I3S node pages
|
|
9
9
|
*/
|
package/dist/i3s-slpk-loader.js
CHANGED
|
@@ -5,7 +5,7 @@ import { DataViewFile } from '@loaders.gl/loader-utils';
|
|
|
5
5
|
import { parseSLPKArchive } from "./lib/parsers/parse-slpk/parse-slpk.js";
|
|
6
6
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
7
7
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
8
|
-
const VERSION = typeof "4.2.
|
|
8
|
+
const VERSION = typeof "4.2.3" !== 'undefined' ? "4.2.3" : 'latest';
|
|
9
9
|
/**
|
|
10
10
|
* Loader for SLPK - Scene Layer Package (Archive I3S format)
|
|
11
11
|
* @todo - this reloads the entire archive for every tile, should be optimized
|
package/dist/index.cjs
CHANGED
|
@@ -521,7 +521,7 @@ function getFeatureIdsFromFeatureIndexMetadata(featureIndex) {
|
|
|
521
521
|
}
|
|
522
522
|
|
|
523
523
|
// dist/i3s-content-loader.js
|
|
524
|
-
var VERSION = true ? "4.2.
|
|
524
|
+
var VERSION = true ? "4.2.3" : "latest";
|
|
525
525
|
var I3SContentLoader = {
|
|
526
526
|
dataType: null,
|
|
527
527
|
batchType: null,
|
|
@@ -558,7 +558,7 @@ var import_core3 = require("@loaders.gl/core");
|
|
|
558
558
|
var import_textures2 = require("@loaders.gl/textures");
|
|
559
559
|
|
|
560
560
|
// dist/i3s-node-page-loader.js
|
|
561
|
-
var VERSION2 = true ? "4.2.
|
|
561
|
+
var VERSION2 = true ? "4.2.3" : "latest";
|
|
562
562
|
var I3SNodePageLoader = {
|
|
563
563
|
dataType: null,
|
|
564
564
|
batchType: null,
|
|
@@ -904,7 +904,7 @@ async function normalizeTilesetData(tileset, options, context) {
|
|
|
904
904
|
}
|
|
905
905
|
|
|
906
906
|
// dist/i3s-loader.js
|
|
907
|
-
var VERSION3 = true ? "4.2.
|
|
907
|
+
var VERSION3 = true ? "4.2.3" : "latest";
|
|
908
908
|
var TILESET_REGEX = /layers\/[0-9]+$/;
|
|
909
909
|
var LOCAL_SLPK_REGEX = /\.slpk$/;
|
|
910
910
|
var TILE_HEADER_REGEX = /nodes\/([0-9-]+|root)$/;
|
|
@@ -1153,7 +1153,7 @@ async function parseSLPKArchive(fileProvider, cb, fileName) {
|
|
|
1153
1153
|
}
|
|
1154
1154
|
|
|
1155
1155
|
// dist/i3s-slpk-loader.js
|
|
1156
|
-
var VERSION4 = true ? "4.2.
|
|
1156
|
+
var VERSION4 = true ? "4.2.3" : "latest";
|
|
1157
1157
|
var SLPKLoader = {
|
|
1158
1158
|
dataType: null,
|
|
1159
1159
|
batchType: null,
|
|
@@ -1232,7 +1232,7 @@ function parseStringsAttribute(arrayBuffer) {
|
|
|
1232
1232
|
}
|
|
1233
1233
|
|
|
1234
1234
|
// dist/i3s-attribute-loader.js
|
|
1235
|
-
var VERSION5 = true ? "4.2.
|
|
1235
|
+
var VERSION5 = true ? "4.2.3" : "latest";
|
|
1236
1236
|
var EMPTY_VALUE = "";
|
|
1237
1237
|
var REJECTED_STATUS = "rejected";
|
|
1238
1238
|
var I3SAttributeLoader = {
|
|
@@ -1372,7 +1372,7 @@ function parseSublayersTree(sublayers, url) {
|
|
|
1372
1372
|
}
|
|
1373
1373
|
|
|
1374
1374
|
// dist/i3s-building-scene-layer-loader.js
|
|
1375
|
-
var VERSION6 = true ? "4.2.
|
|
1375
|
+
var VERSION6 = true ? "4.2.3" : "latest";
|
|
1376
1376
|
var I3SBuildingSceneLayerLoader = {
|
|
1377
1377
|
dataType: null,
|
|
1378
1378
|
batchType: null,
|
|
@@ -1466,7 +1466,7 @@ async function checkSupportedIndexCRS(layer) {
|
|
|
1466
1466
|
}
|
|
1467
1467
|
|
|
1468
1468
|
// dist/arcgis-webscene-loader.js
|
|
1469
|
-
var VERSION7 = true ? "4.2.
|
|
1469
|
+
var VERSION7 = true ? "4.2.3" : "latest";
|
|
1470
1470
|
var ArcGISWebSceneLoader = {
|
|
1471
1471
|
dataType: null,
|
|
1472
1472
|
batchType: null,
|
package/dist/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["index.js", "lib/parsers/constants.js", "i3s-loader.js", "lib/parsers/parse-i3s-tile-content.js", "types.js", "lib/utils/url-utils.js", "i3s-content-loader.js", "lib/parsers/parse-i3s.js", "lib/helpers/i3s-nodepages-tiles.js", "i3s-node-page-loader.js", "i3s-slpk-loader.js", "lib/parsers/parse-slpk/parse-slpk.js", "lib/parsers/parse-slpk/slpk-archieve.js", "i3s-attribute-loader.js", "lib/parsers/parse-i3s-attribute.js", "lib/parsers/parse-i3s-building-scene-layer.js", "i3s-building-scene-layer-loader.js", "lib/parsers/parse-arcgis-webscene.js", "arcgis-webscene-loader.js", "lib/utils/customize-colors.js"],
|
|
4
|
-
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport { COORDINATE_SYSTEM } from \"./lib/parsers/constants.js\";\nexport { I3SLoader } from \"./i3s-loader.js\";\nexport { SLPKLoader } from \"./i3s-slpk-loader.js\";\nexport { I3SContentLoader } from \"./i3s-content-loader.js\";\nexport { I3SAttributeLoader, loadFeatureAttributes } from \"./i3s-attribute-loader.js\";\nexport { I3SBuildingSceneLayerLoader } from \"./i3s-building-scene-layer-loader.js\";\nexport { I3SNodePageLoader } from \"./i3s-node-page-loader.js\";\nexport { ArcGISWebSceneLoader } from \"./arcgis-webscene-loader.js\";\nexport { SLPKArchive } from \"./lib/parsers/parse-slpk/slpk-archieve.js\";\nexport { parseSLPKArchive } from \"./lib/parsers/parse-slpk/parse-slpk.js\";\nexport { LayerError } from \"./lib/parsers/parse-arcgis-webscene.js\";\nexport { customizeColors } from \"./lib/utils/customize-colors.js\";\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { GL } from '@loaders.gl/math';\nexport function getConstructorForDataFormat(dataType) {\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}\nexport const GL_TYPE_MAP = {\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) {\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}\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// https://github.com/visgl/deck.gl/blob/9548f43cba2234a1f4877b6b17f6c88eb35b2e08/modules/core/src/lib/constants.js#L27\n// Describes the format of positions\nexport var COORDINATE_SYSTEM;\n(function (COORDINATE_SYSTEM) {\n /**\n * `LNGLAT` if rendering into a geospatial viewport, `CARTESIAN` otherwise\n */\n COORDINATE_SYSTEM[COORDINATE_SYSTEM[\"DEFAULT\"] = -1] = \"DEFAULT\";\n /**\n * Positions are interpreted as [lng, lat, elevation]\n * lng lat are degrees, elevation is meters. distances as meters.\n */\n COORDINATE_SYSTEM[COORDINATE_SYSTEM[\"LNGLAT\"] = 1] = \"LNGLAT\";\n /**\n * Positions are interpreted as meter offsets, distances as meters\n */\n COORDINATE_SYSTEM[COORDINATE_SYSTEM[\"METER_OFFSETS\"] = 2] = \"METER_OFFSETS\";\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 COORDINATE_SYSTEM[COORDINATE_SYSTEM[\"LNGLAT_OFFSETS\"] = 3] = \"LNGLAT_OFFSETS\";\n /**\n * Non-geospatial\n */\n COORDINATE_SYSTEM[COORDINATE_SYSTEM[\"CARTESIAN\"] = 0] = \"CARTESIAN\";\n})(COORDINATE_SYSTEM || (COORDINATE_SYSTEM = {}));\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { parse } from '@loaders.gl/core';\nimport { I3SContentLoader } from \"./i3s-content-loader.js\";\nimport { normalizeTileData, normalizeTilesetData } from \"./lib/parsers/parse-i3s.js\";\nimport { COORDINATE_SYSTEM } from \"./lib/parsers/constants.js\";\nimport { getUrlWithoutParams } from \"./lib/utils/url-utils.js\";\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.2.2\" !== 'undefined' ? \"4.2.2\" : 'latest';\nconst TILESET_REGEX = /layers\\/[0-9]+$/;\nconst LOCAL_SLPK_REGEX = /\\.slpk$/;\nconst TILE_HEADER_REGEX = /nodes\\/([0-9-]+|root)$/;\nconst SLPK_HEX = '504b0304';\nconst POINT_CLOUD = 'PointCloud';\n/**\n * Loader for I3S - Indexed 3D Scene Layer\n */\nexport const I3SLoader = {\n dataType: null,\n batchType: null,\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};\nasync function parseI3S(data, options = {}, context) {\n const url = context.url;\n options.i3s = options.i3s || {};\n const magicNumber = getMagicNumber(data);\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 const urlWithoutParams = getUrlWithoutParams(url);\n // auto detect file type based on url\n let isTileset;\n if (options.i3s.isTileset === 'auto') {\n isTileset = TILESET_REGEX.test(urlWithoutParams) || LOCAL_SLPK_REGEX.test(urlWithoutParams);\n }\n else {\n isTileset = options.i3s.isTileset;\n }\n let isTileHeader;\n if (options.isTileHeader === 'auto') {\n isTileHeader = TILE_HEADER_REGEX.test(urlWithoutParams);\n }\n else {\n isTileHeader = options.i3s.isTileHeader;\n }\n if (isTileset) {\n data = await parseTileset(data, options, context);\n }\n else if (isTileHeader) {\n data = await parseTile(data, context);\n }\n else {\n data = await parseTileContent(data, options);\n }\n return data;\n}\nasync function parseTileContent(arrayBuffer, options) {\n return await parse(arrayBuffer, I3SContentLoader, options);\n}\nasync function parseTileset(data, options, context) {\n const tilesetJson = JSON.parse(new TextDecoder().decode(data));\n if (tilesetJson?.layerType === POINT_CLOUD) {\n throw new Error('Point Cloud layers currently are not supported by I3SLoader');\n }\n const tilesetPostprocessed = await normalizeTilesetData(tilesetJson, options, context);\n return tilesetPostprocessed;\n}\nasync function parseTile(data, context) {\n data = JSON.parse(new TextDecoder().decode(data));\n return normalizeTileData(data, context);\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", "import { load, parse } from '@loaders.gl/core';\nimport { Vector3, Matrix4 } from '@math.gl/core';\nimport { Ellipsoid } from '@math.gl/geospatial';\nimport { parseFromContext } from '@loaders.gl/loader-utils';\nimport { ImageLoader } from '@loaders.gl/images';\nimport { DracoLoader } from '@loaders.gl/draco';\nimport { BasisLoader, CompressedTextureLoader } from '@loaders.gl/textures';\nimport { HeaderAttributeProperty } from \"../../types.js\";\nimport { getUrlWithToken } from \"../utils/url-utils.js\";\nimport { GL_TYPE_MAP, getConstructorForDataFormat, sizeOf, COORDINATE_SYSTEM } from \"./constants.js\";\nconst scratchVector = new Vector3([0, 0, 0]);\nfunction getLoaderForTextureFormat(textureFormat) {\n switch (textureFormat) {\n case 'ktx-etc2':\n case 'dds':\n return CompressedTextureLoader;\n case 'ktx2':\n return BasisLoader;\n case 'jpg':\n case 'png':\n default:\n return ImageLoader;\n }\n}\nconst I3S_ATTRIBUTE_TYPE = 'i3s-attribute-type';\nexport async function parseI3STileContent(arrayBuffer, tileOptions, tilesetOptions, options, context) {\n const content = {\n attributes: {},\n indices: null,\n featureIds: [],\n vertexCount: 0,\n modelMatrix: new Matrix4(),\n coordinateSystem: 0,\n byteLength: 0,\n texture: null\n };\n if (tileOptions.textureUrl) {\n // @ts-expect-error options is not properly typed\n const url = getUrlWithToken(tileOptions.textureUrl, options?.i3s?.token);\n const loader = getLoaderForTextureFormat(tileOptions.textureFormat);\n const fetchFunc = context?.fetch || fetch;\n const response = await fetchFunc(url); // options?.fetch\n const arrayBuffer = await response.arrayBuffer();\n // @ts-expect-error options is not properly typed\n if (options?.i3s.decodeTextures) {\n // TODO - replace with switch\n if (loader === ImageLoader) {\n const options = { ...tileOptions.textureLoaderOptions, image: { type: 'data' } };\n try {\n // Image constructor is not supported in worker thread.\n // Do parsing image data on the main thread by using context to avoid worker issues.\n const texture = await parseFromContext(arrayBuffer, [], options, context);\n content.texture = texture;\n }\n catch (e) {\n // context object is different between worker and node.js conversion script.\n // To prevent error we parse data in ordinary way if it is not parsed by using context.\n const texture = await parse(arrayBuffer, loader, options, context);\n content.texture = texture;\n }\n }\n else if (loader === CompressedTextureLoader || loader === BasisLoader) {\n let texture = await load(arrayBuffer, loader, tileOptions.textureLoaderOptions);\n if (loader === BasisLoader) {\n texture = texture[0];\n }\n content.texture = {\n compressed: true,\n mipmaps: false,\n width: texture[0].width,\n height: texture[0].height,\n data: texture\n };\n }\n }\n else {\n content.texture = arrayBuffer;\n }\n }\n content.material = makePbrMaterial(tileOptions.materialDefinition, content.texture);\n if (content.material) {\n content.texture = null;\n }\n return await parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOptions, options);\n}\n/* eslint-disable max-statements */\nasync function parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOptions, options) {\n const contentByteLength = arrayBuffer.byteLength;\n let attributes;\n let vertexCount;\n let byteOffset = 0;\n let featureCount = 0;\n let indices;\n if (tileOptions.isDracoGeometry) {\n const decompressedGeometry = await parse(arrayBuffer, DracoLoader, {\n draco: {\n attributeNameEntry: I3S_ATTRIBUTE_TYPE\n }\n });\n // @ts-expect-error\n vertexCount = decompressedGeometry.header.vertexCount;\n indices = decompressedGeometry.indices?.value;\n const { POSITION, NORMAL, COLOR_0, TEXCOORD_0, ['feature-index']: featureIndex, ['uv-region']: uvRegion } = decompressedGeometry.attributes;\n attributes = {\n position: POSITION,\n normal: NORMAL,\n color: COLOR_0,\n uv0: TEXCOORD_0,\n uvRegion,\n id: featureIndex\n };\n updateAttributesMetadata(attributes, decompressedGeometry);\n const featureIds = getFeatureIdsFromFeatureIndexMetadata(featureIndex);\n if (featureIds) {\n flattenFeatureIdsByFeatureIndices(attributes, featureIds);\n }\n }\n else {\n const { vertexAttributes, ordering: attributesOrder, featureAttributes, featureAttributeOrder } = tilesetOptions.store.defaultGeometrySchema;\n // First 8 bytes reserved for header (vertexCount and featureCount)\n const headers = parseHeaders(arrayBuffer, tilesetOptions);\n byteOffset = headers.byteOffset;\n vertexCount = headers.vertexCount;\n featureCount = headers.featureCount;\n // Getting vertex attributes such as positions, normals, colors, etc...\n const { attributes: normalizedVertexAttributes, byteOffset: offset } = normalizeAttributes(arrayBuffer, byteOffset, vertexAttributes, vertexCount, attributesOrder);\n // Getting feature attributes such as featureIds and faceRange\n const { attributes: normalizedFeatureAttributes } = normalizeAttributes(arrayBuffer, offset, featureAttributes, featureCount, featureAttributeOrder);\n flattenFeatureIdsByFaceRanges(normalizedFeatureAttributes);\n attributes = concatAttributes(normalizedVertexAttributes, normalizedFeatureAttributes);\n }\n if (!options?.i3s?.coordinateSystem ||\n // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison\n options.i3s.coordinateSystem === COORDINATE_SYSTEM.METER_OFFSETS) {\n const enuMatrix = parsePositions(attributes.position, tileOptions);\n content.modelMatrix = enuMatrix.invert();\n content.coordinateSystem = COORDINATE_SYSTEM.METER_OFFSETS;\n }\n else {\n content.modelMatrix = getModelMatrix(attributes.position);\n content.coordinateSystem = COORDINATE_SYSTEM.LNGLAT_OFFSETS;\n }\n content.attributes = {\n positions: attributes.position,\n normals: attributes.normal,\n colors: normalizeAttribute(attributes.color), // Normalize from UInt8\n texCoords: attributes.uv0,\n uvRegions: normalizeAttribute(attributes.uvRegion || attributes.region) // Normalize from UInt16\n };\n content.indices = indices || null;\n if (attributes.id && attributes.id.value) {\n content.featureIds = attributes.id.value;\n }\n // Remove undefined attributes\n for (const attributeIndex in content.attributes) {\n if (!content.attributes[attributeIndex]) {\n delete content.attributes[attributeIndex];\n }\n }\n content.vertexCount = vertexCount;\n content.byteLength = contentByteLength;\n return content;\n}\n/**\n * Update attributes with metadata from decompressed geometry.\n * @param decompressedGeometry\n * @param attributes\n */\nfunction updateAttributesMetadata(attributes, decompressedGeometry) {\n for (const key in decompressedGeometry.loaderData.attributes) {\n const dracoAttribute = decompressedGeometry.loaderData.attributes[key];\n switch (dracoAttribute.name) {\n case 'POSITION':\n attributes.position.metadata = dracoAttribute.metadata;\n break;\n case 'feature-index':\n attributes.id.metadata = dracoAttribute.metadata;\n break;\n default:\n break;\n }\n }\n}\n/**\n * Do concatenation of attribute objects.\n * Done as separate fucntion to avoid ts errors.\n * @param normalizedVertexAttributes\n * @param normalizedFeatureAttributes\n * @returns - result of attributes concatenation.\n */\nfunction concatAttributes(normalizedVertexAttributes, normalizedFeatureAttributes) {\n return { ...normalizedVertexAttributes, ...normalizedFeatureAttributes };\n}\n/**\n * Normalize attribute to range [0..1] . Eg. convert colors buffer from [255,255,255,255] to [1,1,1,1]\n * @param attribute - geometry attribute\n * @returns - geometry attribute in right format\n */\nfunction normalizeAttribute(attribute) {\n if (!attribute) {\n return attribute;\n }\n attribute.normalized = true;\n return attribute;\n}\nfunction parseHeaders(arrayBuffer, options) {\n let byteOffset = 0;\n // First 8 bytes reserved for header (vertexCount and featurecount)\n let vertexCount = 0;\n let featureCount = 0;\n for (const { property, type } of options.store.defaultGeometrySchema.header) {\n const TypedArrayTypeHeader = getConstructorForDataFormat(type);\n switch (property) {\n case HeaderAttributeProperty.vertexCount.toString():\n vertexCount = new TypedArrayTypeHeader(arrayBuffer, 0, 4)[0];\n byteOffset += sizeOf(type);\n break;\n case HeaderAttributeProperty.featureCount.toString():\n featureCount = new TypedArrayTypeHeader(arrayBuffer, 4, 4)[0];\n byteOffset += sizeOf(type);\n break;\n default:\n break;\n }\n }\n return {\n vertexCount,\n featureCount,\n byteOffset\n };\n}\n/* eslint-enable max-statements */\nfunction normalizeAttributes(arrayBuffer, byteOffset, vertexAttributes, attributeCount, attributesOrder) {\n const attributes = {};\n // the order of attributes depend on the order being added to the vertexAttributes object\n for (const attribute of attributesOrder) {\n if (vertexAttributes[attribute]) {\n const { valueType, valuesPerElement } = vertexAttributes[attribute];\n // protect from arrayBuffer read overunns by NOT assuming node has regions always even though its declared in defaultGeometrySchema.\n // In i3s 1.6: client is required to decide that based on ./shared resource of the node (materialDefinitions.[Mat_id].params.vertexRegions == true)\n // In i3s 1.7 the property has been rolled into the 3d scene layer json/node pages.\n // Code below does not account when the bytelength is actually bigger than\n // the calculated value (b\\c the tile potentially could have mesh segmentation information).\n // In those cases tiles without regions could fail or have garbage values.\n if (byteOffset + attributeCount * valuesPerElement * sizeOf(valueType) <=\n arrayBuffer.byteLength) {\n const buffer = arrayBuffer.slice(byteOffset);\n let value;\n if (valueType === 'UInt64') {\n value = parseUint64Values(buffer, attributeCount * valuesPerElement, sizeOf(valueType));\n }\n else {\n const TypedArrayType = getConstructorForDataFormat(valueType);\n value = new TypedArrayType(buffer, 0, attributeCount * valuesPerElement);\n }\n attributes[attribute] = {\n value,\n type: GL_TYPE_MAP[valueType],\n size: valuesPerElement\n };\n switch (attribute) {\n case 'color':\n attributes.color.normalized = true;\n break;\n case 'position':\n case 'region':\n case 'normal':\n default:\n }\n byteOffset = byteOffset + attributeCount * valuesPerElement * sizeOf(valueType);\n }\n else if (attribute !== 'uv0') {\n break;\n }\n }\n }\n return { attributes, byteOffset };\n}\n/**\n * Parse buffer to return array of uint64 values\n *\n * @param buffer\n * @param elementsCount\n * @returns 64-bit array of values until precision is lost after Number.MAX_SAFE_INTEGER\n */\nfunction parseUint64Values(buffer, elementsCount, attributeSize) {\n const values = [];\n const dataView = new DataView(buffer);\n let offset = 0;\n for (let index = 0; index < elementsCount; index++) {\n // split 64-bit number into two 32-bit parts\n const left = dataView.getUint32(offset, true);\n const right = dataView.getUint32(offset + 4, true);\n // combine the two 32-bit values\n const value = left + 2 ** 32 * right;\n values.push(value);\n offset += attributeSize;\n }\n return new Uint32Array(values);\n}\nfunction parsePositions(attribute, options) {\n const mbs = options.mbs;\n const value = attribute.value;\n const metadata = attribute.metadata;\n const enuMatrix = new Matrix4();\n const cartographicOrigin = new Vector3(mbs[0], mbs[1], mbs[2]);\n const cartesianOrigin = new Vector3();\n Ellipsoid.WGS84.cartographicToCartesian(cartographicOrigin, cartesianOrigin);\n Ellipsoid.WGS84.eastNorthUpToFixedFrame(cartesianOrigin, enuMatrix);\n attribute.value = offsetsToCartesians(value, metadata, cartographicOrigin);\n return enuMatrix;\n}\n/**\n * Converts position coordinates to absolute cartesian coordinates\n * @param vertices - \"position\" attribute data\n * @param metadata - When the geometry is DRACO compressed, contain position attribute's metadata\n * https://github.com/Esri/i3s-spec/blob/master/docs/1.7/compressedAttributes.cmn.md\n * @param cartographicOrigin - Cartographic origin coordinates\n * @returns - converted \"position\" data\n */\nfunction offsetsToCartesians(vertices, metadata = {}, cartographicOrigin) {\n const positions = new Float64Array(vertices.length);\n const scaleX = (metadata['i3s-scale_x'] && metadata['i3s-scale_x'].double) || 1;\n const scaleY = (metadata['i3s-scale_y'] && metadata['i3s-scale_y'].double) || 1;\n for (let i = 0; i < positions.length; i += 3) {\n positions[i] = vertices[i] * scaleX + cartographicOrigin.x;\n positions[i + 1] = vertices[i + 1] * scaleY + cartographicOrigin.y;\n positions[i + 2] = vertices[i + 2] + cartographicOrigin.z;\n }\n for (let i = 0; i < positions.length; i += 3) {\n // @ts-ignore\n Ellipsoid.WGS84.cartographicToCartesian(positions.subarray(i, i + 3), scratchVector);\n positions[i] = scratchVector.x;\n positions[i + 1] = scratchVector.y;\n positions[i + 2] = scratchVector.z;\n }\n return positions;\n}\n/**\n * Get model matrix for loaded vertices\n * @param positions positions attribute\n * @returns Matrix4 - model matrix for geometry transformation\n */\nfunction getModelMatrix(positions) {\n const metadata = positions.metadata;\n const scaleX = metadata?.['i3s-scale_x']?.double || 1;\n const scaleY = metadata?.['i3s-scale_y']?.double || 1;\n const modelMatrix = new Matrix4();\n modelMatrix[0] = scaleX;\n modelMatrix[5] = scaleY;\n return modelMatrix;\n}\n/**\n * Makes a glTF-compatible PBR material from an I3S material definition\n * @param materialDefinition - i3s material definition\n * https://github.com/Esri/i3s-spec/blob/master/docs/1.7/materialDefinitions.cmn.md\n * @param texture - texture image\n * @returns {object}\n */\nfunction makePbrMaterial(materialDefinition, texture) {\n let pbrMaterial;\n if (materialDefinition) {\n pbrMaterial = {\n ...materialDefinition,\n pbrMetallicRoughness: materialDefinition.pbrMetallicRoughness\n ? { ...materialDefinition.pbrMetallicRoughness }\n : { baseColorFactor: [255, 255, 255, 255] }\n };\n }\n else {\n pbrMaterial = {\n pbrMetallicRoughness: {}\n };\n if (texture) {\n pbrMaterial.pbrMetallicRoughness.baseColorTexture = { texCoord: 0 };\n }\n else {\n pbrMaterial.pbrMetallicRoughness.baseColorFactor = [255, 255, 255, 255];\n }\n }\n // Set default 0.25 per spec https://github.com/Esri/i3s-spec/blob/master/docs/1.7/materialDefinitions.cmn.md\n pbrMaterial.alphaCutoff = pbrMaterial.alphaCutoff || 0.25;\n if (pbrMaterial.alphaMode) {\n // I3S contain alphaMode in lowerCase\n pbrMaterial.alphaMode = pbrMaterial.alphaMode.toUpperCase();\n }\n // Convert colors from [255,255,255,255] to [1,1,1,1]\n if (pbrMaterial.emissiveFactor) {\n pbrMaterial.emissiveFactor = convertColorFormat(pbrMaterial.emissiveFactor);\n }\n if (pbrMaterial.pbrMetallicRoughness && pbrMaterial.pbrMetallicRoughness.baseColorFactor) {\n pbrMaterial.pbrMetallicRoughness.baseColorFactor = convertColorFormat(pbrMaterial.pbrMetallicRoughness.baseColorFactor);\n }\n if (texture) {\n setMaterialTexture(pbrMaterial, texture);\n }\n return pbrMaterial;\n}\n/**\n * Convert color from [255,255,255,255] to [1,1,1,1]\n * @param colorFactor - color array\n * @returns - new color array\n */\nfunction convertColorFormat(colorFactor) {\n const normalizedColor = [...colorFactor];\n for (let index = 0; index < colorFactor.length; index++) {\n normalizedColor[index] = colorFactor[index] / 255;\n }\n return normalizedColor;\n}\n/**\n * Set texture in PBR material\n * @param {object} material - i3s material definition\n * @param image - texture image\n * @returns\n */\nfunction setMaterialTexture(material, image) {\n const texture = { source: { image } };\n // I3SLoader now support loading only one texture. This elseif sequence will assign this texture to one of\n // properties defined in materialDefinition\n if (material.pbrMetallicRoughness && material.pbrMetallicRoughness.baseColorTexture) {\n material.pbrMetallicRoughness.baseColorTexture = {\n ...material.pbrMetallicRoughness.baseColorTexture,\n texture\n };\n }\n else if (material.emissiveTexture) {\n material.emissiveTexture = { ...material.emissiveTexture, texture };\n }\n else if (material.pbrMetallicRoughness &&\n material.pbrMetallicRoughness.metallicRoughnessTexture) {\n material.pbrMetallicRoughness.metallicRoughnessTexture = {\n ...material.pbrMetallicRoughness.metallicRoughnessTexture,\n texture\n };\n }\n else if (material.normalTexture) {\n material.normalTexture = { ...material.normalTexture, texture };\n }\n else if (material.occlusionTexture) {\n material.occlusionTexture = { ...material.occlusionTexture, texture };\n }\n}\n/**\n * Flatten feature ids using face ranges\n * @param normalizedFeatureAttributes\n * @returns\n */\nfunction flattenFeatureIdsByFaceRanges(normalizedFeatureAttributes) {\n const { id, faceRange } = normalizedFeatureAttributes;\n if (!id || !faceRange) {\n return;\n }\n const featureIds = id.value;\n const range = faceRange.value;\n const featureIdsLength = range[range.length - 1] + 1;\n const orderedFeatureIndices = new Uint32Array(featureIdsLength * 3);\n let featureIndex = 0;\n let startIndex = 0;\n for (let index = 1; index < range.length; index += 2) {\n const fillId = Number(featureIds[featureIndex]);\n const endValue = range[index];\n const prevValue = range[index - 1];\n const trianglesCount = endValue - prevValue + 1;\n const endIndex = startIndex + trianglesCount * 3;\n orderedFeatureIndices.fill(fillId, startIndex, endIndex);\n featureIndex++;\n startIndex = endIndex;\n }\n normalizedFeatureAttributes.id.value = orderedFeatureIndices;\n}\n/**\n * Flatten feature ids using featureIndices\n * @param attributes\n * @param featureIds\n * @returns\n */\nfunction flattenFeatureIdsByFeatureIndices(attributes, featureIds) {\n const featureIndices = attributes.id.value;\n const result = new Float32Array(featureIndices.length);\n for (let index = 0; index < featureIndices.length; index++) {\n result[index] = featureIds[featureIndices[index]];\n }\n attributes.id.value = result;\n}\n/**\n * Flatten feature ids using featureIndices\n * @param featureIndex\n * @returns\n */\nfunction getFeatureIdsFromFeatureIndexMetadata(featureIndex) {\n return featureIndex?.metadata?.['i3s-feature-ids']?.intArray;\n}\n", "export var HeaderAttributeProperty;\n(function (HeaderAttributeProperty) {\n HeaderAttributeProperty[\"vertexCount\"] = \"vertexCount\";\n HeaderAttributeProperty[\"featureCount\"] = \"featureCount\";\n})(HeaderAttributeProperty || (HeaderAttributeProperty = {}));\n", "/**\n * Return URL seperated from search params\n * @param url - URL that might have search params\n * @returns url without search params\n */\nexport function getUrlWithoutParams(url) {\n let urlWithoutParams;\n try {\n const urlObj = new URL(url);\n urlWithoutParams = `${urlObj.origin}${urlObj.pathname}`;\n // On Windows `new URL(url)` makes `C:\\...` -> `null\\...`\n if (urlWithoutParams.startsWith('null')) {\n urlWithoutParams = null;\n }\n }\n catch (e) {\n urlWithoutParams = null;\n }\n return urlWithoutParams || url;\n}\n/**\n * Generates url with token if it is exists.\n * @param url\n * @param token\n * @returns\n */\nexport function getUrlWithToken(url, token = null) {\n return token ? `${url}?token=${token}` : url;\n}\n/**\n * Generates attribute urls for tile.\n * @param tile\n * @returns list of attribute urls\n */\nexport function generateTileAttributeUrls(url, tile) {\n const { attributeData = [] } = tile;\n const attributeUrls = [];\n for (let index = 0; index < attributeData.length; index++) {\n const attributeUrl = attributeData[index].href.replace('./', '');\n attributeUrls.push(`${url}/${attributeUrl}`);\n }\n return attributeUrls;\n}\n/**\n * Generates attribute urls for tileset based on tileset and resource\n * @param tileset - tileset metadata\n * @param url - tileset base url\n * @param resource - resource id per I3S spec\n * @returns {Array}\n */\nexport function generateTilesetAttributeUrls(tileset, url, resource) {\n const attributeUrls = [];\n const { attributeStorageInfo = [] } = tileset;\n for (let index = 0; index < attributeStorageInfo.length; index++) {\n const fileName = attributeStorageInfo[index].key;\n attributeUrls.push(`${url}/nodes/${resource}/attributes/${fileName}/0`);\n }\n return attributeUrls;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { parseI3STileContent } from \"./lib/parsers/parse-i3s-tile-content.js\";\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.2.2\" !== 'undefined' ? \"4.2.2\" : 'latest';\n/**\n * Loader for I3S - Indexed 3D Scene Layer\n */\nexport const I3SContentLoader = {\n dataType: null,\n batchType: null,\n name: 'I3S Content (Indexed Scene Layers)',\n id: 'i3s-content',\n module: 'i3s',\n worker: true,\n version: VERSION,\n mimeTypes: ['application/octet-stream'],\n parse,\n extensions: ['bin'],\n options: {\n 'i3s-content': {}\n }\n};\nasync function parse(data, options, context) {\n const { tile, _tileOptions, tileset, _tilesetOptions } = options?.i3s || {};\n const tileOptions = _tileOptions || tile;\n const tilesetOptions = _tilesetOptions || tileset;\n if (!tileOptions || !tilesetOptions) {\n return null;\n }\n return await parseI3STileContent(data, tileOptions, tilesetOptions, options, context);\n}\n", "import { OrientedBoundingBox } from '@math.gl/culling';\nimport { Ellipsoid } from '@math.gl/geospatial';\nimport { load } from '@loaders.gl/core';\nimport { TILE_TYPE, TILE_REFINEMENT, TILESET_TYPE } from '@loaders.gl/tiles';\nimport I3SNodePagesTiles from \"../helpers/i3s-nodepages-tiles.js\";\nimport { generateTileAttributeUrls, getUrlWithToken, getUrlWithoutParams } from \"../utils/url-utils.js\";\nimport { I3SLoader } from \"../../i3s-loader.js\";\nexport function normalizeTileData(tile, context) {\n const url = context.url || '';\n let contentUrl;\n if (tile.geometryData) {\n contentUrl = `${url}/${tile.geometryData[0].href}`;\n }\n let textureUrl;\n if (tile.textureData) {\n textureUrl = `${url}/${tile.textureData[0].href}`;\n }\n let attributeUrls;\n if (tile.attributeData) {\n attributeUrls = generateTileAttributeUrls(url, tile);\n }\n const children = tile.children || [];\n return normalizeTileNonUrlData({\n ...tile,\n children,\n url,\n contentUrl,\n textureUrl,\n textureFormat: 'jpg', // `jpg` format will cause `ImageLoader` usage that will be able to handle `png` as well\n attributeUrls,\n isDracoGeometry: false\n });\n}\nexport function normalizeTileNonUrlData(tile) {\n const boundingVolume = {};\n let mbs = [0, 0, 0, 1];\n if (tile.mbs) {\n mbs = tile.mbs;\n boundingVolume.sphere = [\n ...Ellipsoid.WGS84.cartographicToCartesian(tile.mbs.slice(0, 3)), // cartesian center of sphere\n tile.mbs[3] // radius of sphere\n ];\n }\n else if (tile.obb) {\n boundingVolume.box = [\n ...Ellipsoid.WGS84.cartographicToCartesian(tile.obb.center), // cartesian center of box\n ...tile.obb.halfSize, // halfSize\n ...tile.obb.quaternion // quaternion\n ];\n const obb = new OrientedBoundingBox().fromCenterHalfSizeQuaternion(boundingVolume.box.slice(0, 3), tile.obb.halfSize, tile.obb.quaternion);\n const boundingSphere = obb.getBoundingSphere();\n boundingVolume.sphere = [...boundingSphere.center, boundingSphere.radius];\n mbs = [...tile.obb.center, boundingSphere.radius];\n }\n const lodMetricType = tile.lodSelection?.[0].metricType;\n const lodMetricValue = tile.lodSelection?.[0].maxError;\n const type = TILE_TYPE.MESH;\n /**\n * I3S specification supports only REPLACE\n */\n const refine = TILE_REFINEMENT.REPLACE;\n return { ...tile, mbs, boundingVolume, lodMetricType, lodMetricValue, type, refine };\n}\nexport async function normalizeTilesetData(tileset, options, context) {\n const url = getUrlWithoutParams(context.url || '');\n let nodePagesTile;\n let root;\n if (tileset.nodePages) {\n nodePagesTile = new I3SNodePagesTiles(tileset, url, options);\n root = await nodePagesTile.formTileFromNodePages(0);\n }\n else {\n const parseOptions = options.i3s;\n const rootNodeUrl = getUrlWithToken(`${url}/nodes/root`, parseOptions.token);\n // eslint-disable-next-line no-use-before-define\n root = await load(rootNodeUrl, I3SLoader, {\n ...options,\n i3s: {\n // @ts-expect-error options is not properly typed\n ...options.i3s,\n loadContent: false, isTileHeader: true, isTileset: false\n }\n });\n }\n return {\n ...tileset,\n loader: I3SLoader,\n url,\n basePath: url,\n type: TILESET_TYPE.I3S,\n nodePagesTile,\n // @ts-expect-error\n root,\n lodMetricType: root.lodMetricType,\n lodMetricValue: root.lodMetricValue\n };\n}\n", "import { load } from '@loaders.gl/core';\nimport { getSupportedGPUTextureFormats, selectSupportedBasisFormat } from '@loaders.gl/textures';\nimport { I3SNodePageLoader } from \"../../i3s-node-page-loader.js\";\nimport { normalizeTileNonUrlData } from \"../parsers/parse-i3s.js\";\nimport { getUrlWithToken, generateTilesetAttributeUrls } from \"../utils/url-utils.js\";\n/**\n * class I3SNodePagesTiles - loads nodePages and form i3s tiles from them\n */\nexport default class I3SNodePagesTiles {\n tileset;\n nodePages = [];\n pendingNodePages = [];\n nodesPerPage;\n options;\n lodSelectionMetricType;\n textureDefinitionsSelectedFormats = [];\n nodesInNodePages;\n url;\n textureLoaderOptions = {};\n /**\n * @constructs\n * Create a I3SNodePagesTiles instance.\n * @param tileset - i3s tileset header ('layers/0')\n * @param url - tileset url\n * @param options - i3s loader options\n */\n constructor(tileset, url = '', options) {\n this.tileset = { ...tileset }; // spread the tileset to avoid circular reference\n this.url = url;\n this.nodesPerPage = tileset.nodePages?.nodesPerPage || 64;\n this.lodSelectionMetricType = tileset.nodePages?.lodSelectionMetricType;\n this.options = options;\n this.nodesInNodePages = 0;\n this.initSelectedFormatsForTextureDefinitions(tileset);\n }\n /**\n * Loads some nodePage and return a particular node from it\n * @param id - id of node through all node pages\n */\n async getNodeById(id) {\n const pageIndex = Math.floor(id / this.nodesPerPage);\n if (!this.nodePages[pageIndex] && !this.pendingNodePages[pageIndex]) {\n const nodePageUrl = getUrlWithToken(`${this.url}/nodepages/${pageIndex}`, \n // @ts-expect-error this.options is not properly typed\n this.options.i3s?.token);\n this.pendingNodePages[pageIndex] = {\n status: 'Pending',\n promise: load(nodePageUrl, I3SNodePageLoader, this.options)\n };\n this.nodePages[pageIndex] = await this.pendingNodePages[pageIndex].promise;\n this.nodesInNodePages += this.nodePages[pageIndex].nodes.length;\n this.pendingNodePages[pageIndex].status = 'Done';\n }\n if (this.pendingNodePages[pageIndex].status === 'Pending') {\n this.nodePages[pageIndex] = await this.pendingNodePages[pageIndex].promise;\n }\n const nodeIndex = id % this.nodesPerPage;\n return this.nodePages[pageIndex].nodes[nodeIndex];\n }\n /**\n * Forms tile header using node and tileset data\n * @param id - id of node through all node pages\n */\n // eslint-disable-next-line complexity, max-statements\n async formTileFromNodePages(id) {\n const node = await this.getNodeById(id);\n const children = [];\n const childNodesPromises = [];\n for (const child of node.children || []) {\n childNodesPromises.push(this.getNodeById(child));\n }\n const childNodes = await Promise.all(childNodesPromises);\n for (const childNode of childNodes) {\n children.push({\n id: childNode.index.toString(),\n obb: childNode.obb\n });\n }\n let contentUrl;\n let textureUrl;\n let materialDefinition;\n let textureFormat = 'jpg';\n let attributeUrls = [];\n let isDracoGeometry = false;\n if (node && node.mesh) {\n // Get geometry resource URL and type (compressed / non-compressed)\n const { url, isDracoGeometry: isDracoGeometryResult } = (node.mesh.geometry &&\n this.getContentUrl(node.mesh.geometry)) || { isDracoGeometry: false };\n contentUrl = url;\n isDracoGeometry = isDracoGeometryResult;\n const { textureData, materialDefinition: nodeMaterialDefinition } = this.getInformationFromMaterial(node.mesh.material);\n materialDefinition = nodeMaterialDefinition;\n textureFormat = textureData.format || textureFormat;\n if (textureData.name) {\n textureUrl = `${this.url}/nodes/${node.mesh.material.resource}/textures/${textureData.name}`;\n }\n if (this.tileset.attributeStorageInfo) {\n attributeUrls = generateTilesetAttributeUrls(this.tileset, this.url, node.mesh.attribute.resource);\n }\n }\n const lodSelection = this.getLodSelection(node);\n return normalizeTileNonUrlData({\n id: id.toString(),\n lodSelection,\n obb: node.obb,\n contentUrl,\n textureUrl,\n attributeUrls,\n materialDefinition,\n textureFormat,\n textureLoaderOptions: this.textureLoaderOptions,\n children,\n isDracoGeometry\n });\n }\n /**\n * Forms url and type of geometry resource by nodepage's data and `geometryDefinitions` in the tileset\n * @param - data about the node's mesh from the nodepage\n * @returns -\n * {string} url - url to the geometry resource\n * {boolean} isDracoGeometry - whether the geometry resource contain DRACO compressed geometry\n */\n getContentUrl(meshGeometryData) {\n let result = null;\n // @ts-ignore\n const geometryDefinition = this.tileset.geometryDefinitions[meshGeometryData.definition];\n let geometryIndex = -1;\n // Try to find DRACO geometryDefinition of `useDracoGeometry` option is set\n // @ts-expect-error this.options is not properly typed\n if (this.options.i3s && this.options.i3s.useDracoGeometry) {\n geometryIndex = geometryDefinition.geometryBuffers.findIndex((buffer) => buffer.compressedAttributes && buffer.compressedAttributes.encoding === 'draco');\n }\n // If DRACO geometry is not applicable try to select non-compressed geometry\n if (geometryIndex === -1) {\n geometryIndex = geometryDefinition.geometryBuffers.findIndex((buffer) => !buffer.compressedAttributes);\n }\n if (geometryIndex !== -1) {\n const isDracoGeometry = Boolean(geometryDefinition.geometryBuffers[geometryIndex].compressedAttributes);\n result = {\n url: `${this.url}/nodes/${meshGeometryData.resource}/geometries/${geometryIndex}`,\n isDracoGeometry\n };\n }\n return result;\n }\n /**\n * Forms 1.6 compatible LOD selection object from a nodepage's node data\n * @param node - a node from nodepage\n * @returns- Array of LodSelection\n */\n getLodSelection(node) {\n const lodSelection = [];\n if (this.lodSelectionMetricType === 'maxScreenThresholdSQ') {\n lodSelection.push({\n metricType: 'maxScreenThreshold',\n // @ts-ignore\n maxError: Math.sqrt(node.lodThreshold / (Math.PI * 0.25))\n });\n }\n lodSelection.push({\n metricType: this.lodSelectionMetricType,\n // @ts-ignore\n maxError: node.lodThreshold\n });\n return lodSelection;\n }\n /**\n * Returns information about texture and material from `materialDefinitions`\n * @param material - material data from nodepage\n * @returns - Couple {textureData, materialDefinition}\n * {string} textureData.name - path name of the texture\n * {string} textureData.format - format of the texture\n * materialDefinition - PBR-like material definition from `materialDefinitions`\n */\n getInformationFromMaterial(material) {\n const informationFromMaterial = { textureData: { name: null } };\n if (material) {\n const materialDefinition = this.tileset.materialDefinitions?.[material.definition];\n if (materialDefinition) {\n informationFromMaterial.materialDefinition = materialDefinition;\n const textureSetDefinitionIndex = materialDefinition?.pbrMetallicRoughness?.baseColorTexture?.textureSetDefinitionId;\n if (typeof textureSetDefinitionIndex === 'number') {\n informationFromMaterial.textureData =\n this.textureDefinitionsSelectedFormats[textureSetDefinitionIndex] ||\n informationFromMaterial.textureData;\n }\n }\n }\n return informationFromMaterial;\n }\n /**\n * Sets preferable and supported format for each textureDefinition of the tileset\n * @param tileset - I3S layer data\n * @returns\n */\n initSelectedFormatsForTextureDefinitions(tileset) {\n this.textureDefinitionsSelectedFormats = [];\n const possibleI3sFormats = this.getSupportedTextureFormats();\n const textureSetDefinitions = tileset.textureSetDefinitions || [];\n for (const textureSetDefinition of textureSetDefinitions) {\n const formats = (textureSetDefinition && textureSetDefinition.formats) || [];\n let selectedFormat = null;\n for (const i3sFormat of possibleI3sFormats) {\n const format = formats.find((value) => value.format === i3sFormat);\n if (format) {\n selectedFormat = format;\n break;\n }\n }\n // For I3S 1.8 need to define basis target format to decode\n if (selectedFormat && selectedFormat.format === 'ktx2') {\n this.textureLoaderOptions.basis = {\n format: selectSupportedBasisFormat(),\n containerFormat: 'ktx2',\n module: 'encoder'\n };\n }\n this.textureDefinitionsSelectedFormats.push(selectedFormat);\n }\n }\n /**\n * Returns the array of supported texture format\n * @returns list of format strings\n */\n getSupportedTextureFormats() {\n const formats = [];\n // @ts-expect-error this.options is not properly typed\n if (!this.options.i3s || this.options.i3s.useCompressedTextures) {\n // I3S 1.7 selection\n const supportedCompressedFormats = getSupportedGPUTextureFormats();\n // List of possible in i3s formats:\n // https://github.com/Esri/i3s-spec/blob/master/docs/1.7/textureSetDefinitionFormat.cmn.md\n if (supportedCompressedFormats.has('etc2')) {\n formats.push('ktx-etc2');\n }\n if (supportedCompressedFormats.has('dxt')) {\n formats.push('dds');\n }\n // I3S 1.8 selection\n // ktx2 wraps basis texture which at the edge case can be decoded as uncompressed image\n formats.push('ktx2');\n }\n formats.push('jpg');\n formats.push('png');\n return formats;\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.2.2\" !== 'undefined' ? \"4.2.2\" : 'latest';\n/**\n * Loader for I3S node pages\n */\nexport const I3SNodePageLoader = {\n dataType: null,\n batchType: null,\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};\nasync function parseNodePage(data, options) {\n return JSON.parse(new TextDecoder().decode(data));\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { DataViewFile } from '@loaders.gl/loader-utils';\nimport { parseSLPKArchive } from \"./lib/parsers/parse-slpk/parse-slpk.js\";\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.2.2\" !== 'undefined' ? \"4.2.2\" : 'latest';\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 = {\n dataType: null,\n batchType: null,\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, options = {}) => {\n const archive = await parseSLPKArchive(new DataViewFile(new DataView(data)));\n return archive.getFile(options.slpk?.path ?? '', options.slpk?.pathMode);\n }\n};\n", "import { parseZipCDFileHeader, CD_HEADER_SIGNATURE, parseZipLocalFileHeader, searchFromTheEnd, parseHashTable, makeHashTableFromZipHeaders } from '@loaders.gl/zip';\nimport { SLPKArchive } from \"./slpk-archieve.js\";\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(fileProvider, cb, fileName) {\n const hashCDOffset = await searchFromTheEnd(fileProvider, CD_HEADER_SIGNATURE);\n const cdFileHeader = await parseZipCDFileHeader(hashCDOffset, fileProvider);\n let hashTable;\n if (cdFileHeader?.fileName !== '@specialIndexFileHASH128@') {\n hashTable = await makeHashTableFromZipHeaders(fileProvider);\n cb?.('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(cdFileHeader.localHeaderOffset, fileProvider);\n if (!localFileHeader) {\n throw new Error('corrupted SLPK');\n }\n const fileDataOffset = localFileHeader.fileDataOffset;\n const hashFile = await fileProvider.slice(fileDataOffset, fileDataOffset + localFileHeader.compressedSize);\n hashTable = parseHashTable(hashFile);\n }\n return new SLPKArchive(fileProvider, hashTable, fileName);\n}\n", "import { MD5Hash } from '@loaders.gl/crypto';\nimport { IndexedArchive, parseZipLocalFileHeader } from '@loaders.gl/zip';\nimport { GZipCompression } from '@loaders.gl/compression';\n/** Description of real paths for different file types */\nconst PATH_DESCRIPTIONS = [\n {\n test: /^$/,\n extensions: ['3dSceneLayer.json.gz']\n },\n {\n test: /^nodepages\\/\\d+$/,\n extensions: ['.json.gz']\n },\n {\n test: /^nodes\\/(\\d+|root)$/,\n extensions: ['/3dNodeIndexDocument.json.gz']\n },\n {\n test: /^nodes\\/\\d+\\/textures\\/.+$/,\n extensions: ['.jpg', '.png', '.bin.dds.gz', '.ktx']\n },\n {\n test: /^nodes\\/\\d+\\/geometries\\/\\d+$/,\n extensions: ['.bin.gz', '.draco.gz']\n },\n {\n test: /^nodes\\/\\d+\\/attributes\\/f_\\d+\\/\\d+$/,\n extensions: ['.bin.gz']\n },\n {\n test: /^statistics\\/f_\\d+\\/\\d+$/,\n extensions: ['.json.gz']\n },\n {\n test: /^nodes\\/\\d+\\/shared$/,\n extensions: ['/sharedResource.json.gz']\n }\n];\n/**\n * Class for handling information about slpk file\n */\nexport class SLPKArchive extends IndexedArchive {\n // Maps hex-encoded md5 filename hashes to bigint offsets into the archive\n hashTable;\n _textEncoder = new TextEncoder();\n _textDecoder = new TextDecoder();\n _md5Hash = new MD5Hash();\n /**\n * Constructor\n * @param fileProvider - instance of a binary data reader\n * @param hashTable - pre-loaded hashTable. If presented, getFile will skip reading the hash file\n * @param fileName - name of the archive. It is used to add to an URL of a loader context\n */\n constructor(fileProvider, hashTable, fileName) {\n super(fileProvider, hashTable, fileName);\n this.hashTable = hashTable;\n }\n /**\n * Returns file with the given path from slpk archive\n * @param path - path inside the slpk\n * @param mode - currently only raw mode supported\n * @returns buffer with ready to use file\n */\n async getFile(path, mode = 'raw') {\n if (mode === 'http') {\n const extensions = PATH_DESCRIPTIONS.find((val) => val.test.test(path))?.extensions;\n if (extensions) {\n let data;\n for (const ext of extensions) {\n data = await this.getDataByPath(`${path}${ext}`);\n if (data) {\n break;\n }\n }\n if (data) {\n return data;\n }\n }\n }\n if (mode === 'raw') {\n const decompressedFile = await this.getDataByPath(`${path}.gz`);\n if (decompressedFile) {\n return decompressedFile;\n }\n const fileWithoutCompression = await this.getFileBytes(path);\n if (fileWithoutCompression) {\n return fileWithoutCompression;\n }\n }\n throw new Error(`No such file in the archive: ${path}`);\n }\n /**\n * returning uncompressed data for paths that ends with .gz and raw data for all other paths\n * @param path - path inside the archive\n * @returns buffer with the file data\n */\n async getDataByPath(path) {\n // sometimes paths are not in lower case when hash file is created,\n // so first we're looking for lower case file name and then for original one\n let data = await this.getFileBytes(path.toLocaleLowerCase());\n if (!data) {\n data = await this.getFileBytes(path);\n }\n if (!data) {\n return undefined;\n }\n if (/\\.gz$/.test(path)) {\n const compression = new GZipCompression();\n const decompressedData = await compression.decompress(data);\n return decompressedData;\n }\n return data;\n }\n /**\n * Trying to get raw file data by address\n * @param path - path inside the archive\n * @returns buffer with the raw file data\n */\n async getFileBytes(path) {\n let compressedFile;\n if (this.hashTable) {\n const binaryPath = this._textEncoder.encode(path);\n const nameHash = await this._md5Hash.hash(binaryPath.buffer, 'hex');\n const offset = this.hashTable[nameHash];\n if (offset === undefined) {\n return undefined;\n }\n const localFileHeader = await parseZipLocalFileHeader(offset, this.fileProvider);\n if (!localFileHeader) {\n return undefined;\n }\n compressedFile = await this.fileProvider.slice(localFileHeader.fileDataOffset, localFileHeader.fileDataOffset + localFileHeader.compressedSize);\n }\n else {\n try {\n compressedFile = await this.getFileWithoutHash(path);\n }\n catch {\n compressedFile = undefined;\n }\n }\n return compressedFile;\n }\n}\n", "import { load } from '@loaders.gl/core';\nimport { parseI3STileAttribute } from \"./lib/parsers/parse-i3s-attribute.js\";\nimport { getUrlWithToken } from \"./lib/utils/url-utils.js\";\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.2.2\" !== 'undefined' ? \"4.2.2\" : 'latest';\nconst EMPTY_VALUE = '';\nconst REJECTED_STATUS = 'rejected';\n/**\n * Loader for I3S attributes\n */\nexport const I3SAttributeLoader = {\n dataType: null,\n batchType: null,\n name: 'I3S Attribute',\n id: 'i3s-attribute',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/binary'],\n parse: async (arrayBuffer, options) => parseI3STileAttribute(arrayBuffer, options),\n extensions: ['bin'],\n options: {},\n binary: true\n};\n// TODO - these seem to use the loader rather than being part of the loader. Move to different file...\n/**\n * Load attributes based on feature id\n * @param {Object} tile\n * @param {number} featureId\n * @param {Object} options\n * @returns {Promise}\n */\n// eslint-disable-next-line complexity\nexport async function loadFeatureAttributes(tile, featureId, options = {}) {\n const { attributeStorageInfo, attributeUrls, tilesetFields } = getAttributesData(tile);\n if (!attributeStorageInfo || !attributeUrls || featureId < 0) {\n return null;\n }\n let attributes = [];\n const attributeLoadPromises = [];\n for (let index = 0; index < attributeStorageInfo.length; index++) {\n // @ts-ignore\n const url = getUrlWithToken(attributeUrls[index], options.i3s?.token);\n const attributeName = attributeStorageInfo[index].name;\n const attributeType = getAttributeValueType(attributeStorageInfo[index]);\n const loadOptions = { ...options, attributeName, attributeType };\n const promise = load(url, I3SAttributeLoader, loadOptions);\n attributeLoadPromises.push(promise);\n }\n try {\n attributes = await Promise.allSettled(attributeLoadPromises);\n }\n catch (error) {\n // do nothing\n }\n if (!attributes.length) {\n return null;\n }\n return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);\n}\n/**\n * Gets attributes data from tile.\n * @param tile\n * @returns\n */\nfunction getAttributesData(tile) {\n const attributeStorageInfo = tile.tileset?.tileset?.attributeStorageInfo;\n const attributeUrls = tile.header?.attributeUrls;\n const tilesetFields = tile.tileset?.tileset?.fields || [];\n return { attributeStorageInfo, attributeUrls, tilesetFields };\n}\n/**\n * Get attribute value type based on property names\n * @param {Object} attribute\n * @returns {String}\n */\nexport function getAttributeValueType(attribute) {\n if (attribute.hasOwnProperty('objectIds')) {\n return 'Oid32';\n }\n else if (attribute.hasOwnProperty('attributeValues')) {\n return attribute.attributeValues.valueType;\n }\n return '';\n}\n/**\n * Find in attributeStorageInfo attribute name responsible for feature ids list.\n * @param attributeStorageInfo\n * @returns Feature ids attribute name\n */\nfunction getFeatureIdsAttributeName(attributeStorageInfo) {\n const objectIdsAttribute = attributeStorageInfo.find(attribute => attribute.name.includes('OBJECTID'));\n return objectIdsAttribute?.name;\n}\n/**\n * Generates mapping featureId to feature attributes\n * @param {Array} attributes\n * @param {Object} attributeStorageInfo\n * @param {number} featureId\n * @returns {Object}\n */\nfunction generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields) {\n const objectIdsAttributeName = getFeatureIdsAttributeName(attributeStorageInfo);\n const objectIds = attributes.find((attribute) => attribute.value[objectIdsAttributeName]);\n if (!objectIds) {\n return null;\n }\n const attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);\n if (attributeIndex < 0) {\n return null;\n }\n return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);\n}\n/**\n * Generates attribute object for feature mapping by feature id\n * @param {Array} attributes\n * @param {Number} featureIdIndex\n * @param {Object} attributeStorageInfo\n * @returns {Object}\n */\nfunction getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo, tilesetFields) {\n const attributesObject = {};\n for (let index = 0; index < attributeStorageInfo.length; index++) {\n const attributeName = attributeStorageInfo[index].name;\n const codedValues = getAttributeCodedValues(attributeName, tilesetFields);\n const attribute = getAttributeByIndexAndAttributeName(attributes, index, attributeName);\n attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex, codedValues);\n }\n return attributesObject;\n}\n/**\n * Get coded values list from tileset.\n * @param attributeName\n * @param tilesetFields\n */\nfunction getAttributeCodedValues(attributeName, tilesetFields) {\n const attributeField = tilesetFields\n .find(field => field.name === attributeName || field.alias === attributeName);\n return attributeField?.domain?.codedValues || [];\n}\n/**\n * Return attribute value if it presents in atrributes list\n * @param {array} attributes\n * @param {number} index\n * @param {string} attributesName\n */\nfunction getAttributeByIndexAndAttributeName(attributes, index, attributesName) {\n const attributeObject = attributes[index];\n if (attributeObject.status === REJECTED_STATUS) {\n return null;\n }\n return attributeObject.value[attributesName];\n}\n/**\n * Do formatting of attribute values or return empty string.\n * @param {Array} attribute\n * @param {Number} featureIdIndex\n * @returns {String}\n */\nfunction formatAttributeValue(attribute, featureIdIndex, codedValues) {\n let value = EMPTY_VALUE;\n if (attribute && (featureIdIndex in attribute)) {\n // eslint-disable-next-line no-control-regex\n value = String(attribute[featureIdIndex]).replace(/\\u0000|NaN/g, '').trim();\n }\n // Check if coded values are existed. If so we use them.\n if (codedValues.length) {\n const codeValue = codedValues.find(codedValue => codedValue.code === Number(value));\n value = codeValue?.name || EMPTY_VALUE;\n }\n return value;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { STRING_ATTRIBUTE_TYPE, OBJECT_ID_ATTRIBUTE_TYPE, FLOAT_64_TYPE, INT_16_ATTRIBUTE_TYPE } from \"./constants.js\";\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, options) {\n const { attributeName, attributeType } = options;\n if (!attributeName) {\n return {};\n }\n return {\n [attributeName]: attributeType ? parseAttribute(attributeType, arrayBuffer) : null\n };\n}\n/**\n * Parse attributes based on attribute type.\n * @param {String} attributeType\n * @param arrayBuffer\n * @returns\n */\nfunction parseAttribute(attributeType, arrayBuffer) {\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 * 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) {\n const countOffset = 4;\n return new Uint32Array(arrayBuffer, countOffset);\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) {\n const countOffset = 4;\n return new Int16Array(arrayBuffer, countOffset);\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) {\n const countOffset = 8;\n return new Float64Array(arrayBuffer, countOffset);\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) {\n const stringsCountOffset = 0;\n const dataOffset = 8;\n const bytesPerStringSize = 4;\n const stringsArray = [];\n try {\n // Use DataView to avoid multiple of 4 error on Uint32Array constructor\n const stringsCount = new DataView(arrayBuffer, stringsCountOffset, bytesPerStringSize).getUint32(stringsCountOffset, true);\n const stringSizes = new Uint32Array(arrayBuffer, dataOffset, stringsCount);\n let stringOffset = dataOffset + stringsCount * bytesPerStringSize;\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 }\n catch (error) {\n console.error('Parse string attribute error: ', error.message); // eslint-disable-line\n }\n return stringsArray;\n}\n", "const OBJECT_3D_LAYER_TYPE = '3DObject';\n/**\n * Parses Builiding Scene Layer and creates tileset\n * @param data\n * @param options\n * @param context\n */\nexport async function parseBuildingSceneLayer(data, url) {\n const layer0 = JSON.parse(new TextDecoder().decode(data));\n const { sublayers } = layer0;\n return {\n header: layer0,\n sublayers: parseSublayersTree(sublayers, url)\n };\n}\n/**\n * Recursively parses Building Scene Layer sublayers.\n * @param sublayers\n * @param url\n */\nfunction parseSublayersTree(sublayers, url) {\n let layers = [];\n for (let index = 0; index < sublayers.length; index++) {\n const subLayer = sublayers[index];\n const { id, layerType, visibility = true, ...rest } = subLayer;\n // Add support only for 3DObject layer type for I3S purposes.\n if (layerType === OBJECT_3D_LAYER_TYPE) {\n const sublayerUrl = `${url}/sublayers/${id}`;\n layers.push({\n url: sublayerUrl,\n id,\n layerType,\n visibility,\n ...rest\n });\n }\n if (subLayer?.sublayers?.length) {\n layers = [...layers, ...parseSublayersTree(subLayer.sublayers, url)];\n }\n }\n return layers;\n}\n", "import { parseBuildingSceneLayer } from \"./lib/parsers/parse-i3s-building-scene-layer.js\";\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.2.2\" !== 'undefined' ? \"4.2.2\" : 'latest';\n/**\n * Loader for I3S - Building Scene Layer\n */\nexport const I3SBuildingSceneLayerLoader = {\n dataType: null,\n batchType: null,\n name: 'I3S Building Scene Layer',\n id: 'i3s-building-scene-layer',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/json'],\n parse,\n extensions: ['json'],\n options: {}\n};\nasync function parse(data, options, context) {\n if (!context?.url) {\n throw new Error('Url is not provided');\n }\n return parseBuildingSceneLayer(data, context.url);\n}\n", "import { JSONLoader, load } from '@loaders.gl/core';\n/**\n * WKID, or Well-Known ID, of the CRS. Specify either WKID or WKT of the CRS.\n * Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/spatialReference.cmn.md\n */\nconst SUPPORTED_WKID = 4326;\nconst ARCGIS_SCENE_SERVER_LAYER_TYPE = 'ArcGISSceneServiceLayer';\nconst BUILDING_SCENE_LAYER = 'BuildingSceneLayer';\nconst INTEGRATED_MESH_LAYER = 'IntegratedMeshLayer';\nconst GROUP_LAYER = 'GroupLayer';\n/**\n * Supported layers list\n * Possible operational layers in WebScene: https://developers.arcgis.com/web-scene-specification/objects/operationalLayers/\n */\nconst SUPPORTED_LAYERS_TYPES = [\n ARCGIS_SCENE_SERVER_LAYER_TYPE,\n INTEGRATED_MESH_LAYER,\n BUILDING_SCENE_LAYER,\n GROUP_LAYER\n];\nconst NO_AVAILABLE_SUPPORTED_LAYERS_ERROR = 'NO_AVAILABLE_SUPPORTED_LAYERS_ERROR';\nconst NOT_SUPPORTED_CRS_ERROR = 'NOT_SUPPORTED_CRS_ERROR';\n/**\n * Provides additional information in the exception Error object, e.g. unsupported layer types.\n * @param message - message used in the Error object\n * @param details - additional information that can be used to handle the exception.\n * @example throw new LayerError(NO_AVAILABLE_SUPPORTED_LAYERS_ERROR, unsupportedLayers);\n */\nexport class LayerError extends Error {\n details;\n constructor(message, details) {\n super(message);\n this.details = details;\n this.name = 'LayerError';\n }\n}\n/**\n * Parses ArcGIS WebScene\n * @param data\n */\nexport async function parseWebscene(data) {\n const layer0 = JSON.parse(new TextDecoder().decode(data));\n const { operationalLayers } = layer0;\n const { layers, unsupportedLayers } = await parseOperationalLayers(operationalLayers, true);\n if (!layers.length) {\n throw new LayerError(NO_AVAILABLE_SUPPORTED_LAYERS_ERROR, unsupportedLayers);\n }\n return {\n header: layer0,\n layers,\n unsupportedLayers\n };\n}\n/**\n * Recursively parses WebScene operational layers.\n * @param layersList\n */\nasync function parseOperationalLayers(layersList, needToCheckCRS) {\n const layers = [];\n let unsupportedLayers = [];\n for (let index = 0; index < layersList.length; index++) {\n const layer = layersList[index];\n const isLayerSupported = SUPPORTED_LAYERS_TYPES.includes(layer.layerType);\n if (isLayerSupported) {\n if (needToCheckCRS && layer.layerType !== GROUP_LAYER) {\n await checkSupportedIndexCRS(layer);\n needToCheckCRS = false;\n }\n layers.push(layer);\n }\n else {\n unsupportedLayers.push(layer);\n }\n if (layer.layers?.length) {\n const { layers: childLayers, unsupportedLayers: childUnsupportedLayers } = await parseOperationalLayers(layer.layers, needToCheckCRS);\n layer.layers = childLayers;\n unsupportedLayers = [...unsupportedLayers, ...childUnsupportedLayers];\n }\n }\n return { layers, unsupportedLayers };\n}\n/**\n * Check if layer has supported CRS\n * @param layer\n */\nasync function checkSupportedIndexCRS(layer) {\n try {\n const layerJson = await load(layer.url, JSONLoader);\n // @ts-expect-error\n const wkid = layerJson?.spatialReference?.wkid;\n if (wkid !== SUPPORTED_WKID) {\n throw new Error(NOT_SUPPORTED_CRS_ERROR);\n }\n }\n catch (error) {\n throw error;\n }\n}\n", "import { parseWebscene } from \"./lib/parsers/parse-arcgis-webscene.js\";\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.2.2\" !== 'undefined' ? \"4.2.2\" : 'latest';\n/**\n * Loader for ArcGIS WebScene\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/webscene/\n */\nexport const ArcGISWebSceneLoader = {\n dataType: null,\n batchType: null,\n name: 'ArcGIS Web Scene Loader',\n id: 'arcgis-web-scene',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/json'],\n parse,\n extensions: ['json'],\n options: {}\n};\n/**\n * Parse ArcGIS webscene\n * @param data\n */\nasync function parse(data) {\n return parseWebscene(data);\n}\n", "import { load } from '@loaders.gl/core';\nimport { getAttributeValueType, I3SAttributeLoader } from \"../../i3s-attribute-loader.js\";\nimport { getUrlWithToken } from \"./url-utils.js\";\n/**\n * Calculate new vertex colors array to visualize 3D objects in a attribute driven way\n * @param colors - vertex colors attribute\n * @param featureIds - feature Ids attribute\n * @param attributeUrls - array of attribute's urls\n * @param fields - array of attribute's fileds\n * @param attributeStorageInfo - array of attributeStorageInfo\n * @param colorsByAttribute - attribute color options\n * @param token - access token\n * @returns new colors attribute\n */\n// eslint-disable-next-line max-params\nexport async function customizeColors(colors, featureIds, attributeUrls, fields, attributeStorageInfo, colorsByAttribute, token) {\n if (!colorsByAttribute) {\n return colors;\n }\n const resultColors = {\n ...colors,\n value: new Uint8Array(colors.value)\n };\n const colorizeAttributeField = fields.find(({ name }) => name === colorsByAttribute?.attributeName);\n if (!colorizeAttributeField ||\n !['esriFieldTypeDouble', 'esriFieldTypeInteger', 'esriFieldTypeSmallInteger'].includes(colorizeAttributeField.type)) {\n return colors;\n }\n const colorizeAttributeData = await loadFeatureAttributeData(colorizeAttributeField.name, attributeUrls, attributeStorageInfo, token);\n if (!colorizeAttributeData) {\n return colors;\n }\n const objectIdField = fields.find(({ type }) => type === 'esriFieldTypeOID');\n if (!objectIdField) {\n return colors;\n }\n const objectIdAttributeData = await loadFeatureAttributeData(objectIdField.name, attributeUrls, attributeStorageInfo, token);\n if (!objectIdAttributeData) {\n return colors;\n }\n const attributeValuesMap = {};\n // @ts-expect-error\n for (let i = 0; i < objectIdAttributeData[objectIdField.name].length; i++) {\n // @ts-expect-error\n attributeValuesMap[objectIdAttributeData[objectIdField.name][i]] = calculateColorForAttribute(\n // @ts-expect-error\n colorizeAttributeData[colorizeAttributeField.name][i], colorsByAttribute);\n }\n for (let i = 0; i < featureIds.length; i++) {\n const color = attributeValuesMap[featureIds[i]];\n if (!color) {\n continue; // eslint-disable-line no-continue\n }\n /* eslint max-statements: [\"error\", 30] */\n /* eslint complexity: [\"error\", 12] */\n if (colorsByAttribute.mode === 'multiply') {\n // multiplying original mesh and calculated for attribute rgba colors in range 0-255\n color.forEach((colorItem, index) => {\n resultColors.value[i * 4 + index] = (resultColors.value[i * 4 + index] * colorItem) / 255;\n });\n }\n else {\n resultColors.value.set(color, i * 4);\n }\n }\n return resultColors;\n}\n/**\n * Calculate rgba color from the attribute value\n * @param attributeValue - value of the attribute\n * @param colorsByAttribute - attribute color options\n * @returns - color array for a specific attribute value\n */\nfunction calculateColorForAttribute(attributeValue, colorsByAttribute) {\n if (!colorsByAttribute) {\n return [255, 255, 255, 255];\n }\n const { minValue, maxValue, minColor, maxColor } = colorsByAttribute;\n const rate = (attributeValue - minValue) / (maxValue - minValue);\n const color = [255, 255, 255, 255];\n for (let i = 0; i < minColor.length; i++) {\n color[i] = Math.round((maxColor[i] - minColor[i]) * rate + minColor[i]);\n }\n return color;\n}\n/**\n * Load feature attribute data from the ArcGIS rest service\n * @param attributeName - attribute name\n * @param attributeUrls - array of attribute's urls\n * @param attributeStorageInfo - array of attributeStorageInfo\n * @param token - access token\n * @returns - Array-like list of the attribute values\n */\nasync function loadFeatureAttributeData(attributeName, attributeUrls, attributeStorageInfo, token) {\n const attributeIndex = attributeStorageInfo.findIndex(({ name }) => attributeName === name);\n if (attributeIndex === -1) {\n return null;\n }\n const objectIdAttributeUrl = getUrlWithToken(attributeUrls[attributeIndex], token);\n const attributeType = getAttributeValueType(attributeStorageInfo[attributeIndex]);\n const objectIdAttributeData = await load(objectIdAttributeUrl, I3SAttributeLoader, {\n attributeName,\n attributeType\n });\n return objectIdAttributeData;\n}\n"],
|
|
4
|
+
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport { COORDINATE_SYSTEM } from \"./lib/parsers/constants.js\";\nexport { I3SLoader } from \"./i3s-loader.js\";\nexport { SLPKLoader } from \"./i3s-slpk-loader.js\";\nexport { I3SContentLoader } from \"./i3s-content-loader.js\";\nexport { I3SAttributeLoader, loadFeatureAttributes } from \"./i3s-attribute-loader.js\";\nexport { I3SBuildingSceneLayerLoader } from \"./i3s-building-scene-layer-loader.js\";\nexport { I3SNodePageLoader } from \"./i3s-node-page-loader.js\";\nexport { ArcGISWebSceneLoader } from \"./arcgis-webscene-loader.js\";\nexport { SLPKArchive } from \"./lib/parsers/parse-slpk/slpk-archieve.js\";\nexport { parseSLPKArchive } from \"./lib/parsers/parse-slpk/parse-slpk.js\";\nexport { LayerError } from \"./lib/parsers/parse-arcgis-webscene.js\";\nexport { customizeColors } from \"./lib/utils/customize-colors.js\";\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { GL } from '@loaders.gl/math';\nexport function getConstructorForDataFormat(dataType) {\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}\nexport const GL_TYPE_MAP = {\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) {\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}\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// https://github.com/visgl/deck.gl/blob/9548f43cba2234a1f4877b6b17f6c88eb35b2e08/modules/core/src/lib/constants.js#L27\n// Describes the format of positions\nexport var COORDINATE_SYSTEM;\n(function (COORDINATE_SYSTEM) {\n /**\n * `LNGLAT` if rendering into a geospatial viewport, `CARTESIAN` otherwise\n */\n COORDINATE_SYSTEM[COORDINATE_SYSTEM[\"DEFAULT\"] = -1] = \"DEFAULT\";\n /**\n * Positions are interpreted as [lng, lat, elevation]\n * lng lat are degrees, elevation is meters. distances as meters.\n */\n COORDINATE_SYSTEM[COORDINATE_SYSTEM[\"LNGLAT\"] = 1] = \"LNGLAT\";\n /**\n * Positions are interpreted as meter offsets, distances as meters\n */\n COORDINATE_SYSTEM[COORDINATE_SYSTEM[\"METER_OFFSETS\"] = 2] = \"METER_OFFSETS\";\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 COORDINATE_SYSTEM[COORDINATE_SYSTEM[\"LNGLAT_OFFSETS\"] = 3] = \"LNGLAT_OFFSETS\";\n /**\n * Non-geospatial\n */\n COORDINATE_SYSTEM[COORDINATE_SYSTEM[\"CARTESIAN\"] = 0] = \"CARTESIAN\";\n})(COORDINATE_SYSTEM || (COORDINATE_SYSTEM = {}));\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { parse } from '@loaders.gl/core';\nimport { I3SContentLoader } from \"./i3s-content-loader.js\";\nimport { normalizeTileData, normalizeTilesetData } from \"./lib/parsers/parse-i3s.js\";\nimport { COORDINATE_SYSTEM } from \"./lib/parsers/constants.js\";\nimport { getUrlWithoutParams } from \"./lib/utils/url-utils.js\";\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.2.3\" !== 'undefined' ? \"4.2.3\" : 'latest';\nconst TILESET_REGEX = /layers\\/[0-9]+$/;\nconst LOCAL_SLPK_REGEX = /\\.slpk$/;\nconst TILE_HEADER_REGEX = /nodes\\/([0-9-]+|root)$/;\nconst SLPK_HEX = '504b0304';\nconst POINT_CLOUD = 'PointCloud';\n/**\n * Loader for I3S - Indexed 3D Scene Layer\n */\nexport const I3SLoader = {\n dataType: null,\n batchType: null,\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};\nasync function parseI3S(data, options = {}, context) {\n const url = context.url;\n options.i3s = options.i3s || {};\n const magicNumber = getMagicNumber(data);\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 const urlWithoutParams = getUrlWithoutParams(url);\n // auto detect file type based on url\n let isTileset;\n if (options.i3s.isTileset === 'auto') {\n isTileset = TILESET_REGEX.test(urlWithoutParams) || LOCAL_SLPK_REGEX.test(urlWithoutParams);\n }\n else {\n isTileset = options.i3s.isTileset;\n }\n let isTileHeader;\n if (options.isTileHeader === 'auto') {\n isTileHeader = TILE_HEADER_REGEX.test(urlWithoutParams);\n }\n else {\n isTileHeader = options.i3s.isTileHeader;\n }\n if (isTileset) {\n data = await parseTileset(data, options, context);\n }\n else if (isTileHeader) {\n data = await parseTile(data, context);\n }\n else {\n data = await parseTileContent(data, options);\n }\n return data;\n}\nasync function parseTileContent(arrayBuffer, options) {\n return await parse(arrayBuffer, I3SContentLoader, options);\n}\nasync function parseTileset(data, options, context) {\n const tilesetJson = JSON.parse(new TextDecoder().decode(data));\n if (tilesetJson?.layerType === POINT_CLOUD) {\n throw new Error('Point Cloud layers currently are not supported by I3SLoader');\n }\n const tilesetPostprocessed = await normalizeTilesetData(tilesetJson, options, context);\n return tilesetPostprocessed;\n}\nasync function parseTile(data, context) {\n data = JSON.parse(new TextDecoder().decode(data));\n return normalizeTileData(data, context);\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", "import { load, parse } from '@loaders.gl/core';\nimport { Vector3, Matrix4 } from '@math.gl/core';\nimport { Ellipsoid } from '@math.gl/geospatial';\nimport { parseFromContext } from '@loaders.gl/loader-utils';\nimport { ImageLoader } from '@loaders.gl/images';\nimport { DracoLoader } from '@loaders.gl/draco';\nimport { BasisLoader, CompressedTextureLoader } from '@loaders.gl/textures';\nimport { HeaderAttributeProperty } from \"../../types.js\";\nimport { getUrlWithToken } from \"../utils/url-utils.js\";\nimport { GL_TYPE_MAP, getConstructorForDataFormat, sizeOf, COORDINATE_SYSTEM } from \"./constants.js\";\nconst scratchVector = new Vector3([0, 0, 0]);\nfunction getLoaderForTextureFormat(textureFormat) {\n switch (textureFormat) {\n case 'ktx-etc2':\n case 'dds':\n return CompressedTextureLoader;\n case 'ktx2':\n return BasisLoader;\n case 'jpg':\n case 'png':\n default:\n return ImageLoader;\n }\n}\nconst I3S_ATTRIBUTE_TYPE = 'i3s-attribute-type';\nexport async function parseI3STileContent(arrayBuffer, tileOptions, tilesetOptions, options, context) {\n const content = {\n attributes: {},\n indices: null,\n featureIds: [],\n vertexCount: 0,\n modelMatrix: new Matrix4(),\n coordinateSystem: 0,\n byteLength: 0,\n texture: null\n };\n if (tileOptions.textureUrl) {\n // @ts-expect-error options is not properly typed\n const url = getUrlWithToken(tileOptions.textureUrl, options?.i3s?.token);\n const loader = getLoaderForTextureFormat(tileOptions.textureFormat);\n const fetchFunc = context?.fetch || fetch;\n const response = await fetchFunc(url); // options?.fetch\n const arrayBuffer = await response.arrayBuffer();\n // @ts-expect-error options is not properly typed\n if (options?.i3s.decodeTextures) {\n // TODO - replace with switch\n if (loader === ImageLoader) {\n const options = { ...tileOptions.textureLoaderOptions, image: { type: 'data' } };\n try {\n // Image constructor is not supported in worker thread.\n // Do parsing image data on the main thread by using context to avoid worker issues.\n const texture = await parseFromContext(arrayBuffer, [], options, context);\n content.texture = texture;\n }\n catch (e) {\n // context object is different between worker and node.js conversion script.\n // To prevent error we parse data in ordinary way if it is not parsed by using context.\n const texture = await parse(arrayBuffer, loader, options, context);\n content.texture = texture;\n }\n }\n else if (loader === CompressedTextureLoader || loader === BasisLoader) {\n let texture = await load(arrayBuffer, loader, tileOptions.textureLoaderOptions);\n if (loader === BasisLoader) {\n texture = texture[0];\n }\n content.texture = {\n compressed: true,\n mipmaps: false,\n width: texture[0].width,\n height: texture[0].height,\n data: texture\n };\n }\n }\n else {\n content.texture = arrayBuffer;\n }\n }\n content.material = makePbrMaterial(tileOptions.materialDefinition, content.texture);\n if (content.material) {\n content.texture = null;\n }\n return await parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOptions, options);\n}\n/* eslint-disable max-statements */\nasync function parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOptions, options) {\n const contentByteLength = arrayBuffer.byteLength;\n let attributes;\n let vertexCount;\n let byteOffset = 0;\n let featureCount = 0;\n let indices;\n if (tileOptions.isDracoGeometry) {\n const decompressedGeometry = await parse(arrayBuffer, DracoLoader, {\n draco: {\n attributeNameEntry: I3S_ATTRIBUTE_TYPE\n }\n });\n // @ts-expect-error\n vertexCount = decompressedGeometry.header.vertexCount;\n indices = decompressedGeometry.indices?.value;\n const { POSITION, NORMAL, COLOR_0, TEXCOORD_0, ['feature-index']: featureIndex, ['uv-region']: uvRegion } = decompressedGeometry.attributes;\n attributes = {\n position: POSITION,\n normal: NORMAL,\n color: COLOR_0,\n uv0: TEXCOORD_0,\n uvRegion,\n id: featureIndex\n };\n updateAttributesMetadata(attributes, decompressedGeometry);\n const featureIds = getFeatureIdsFromFeatureIndexMetadata(featureIndex);\n if (featureIds) {\n flattenFeatureIdsByFeatureIndices(attributes, featureIds);\n }\n }\n else {\n const { vertexAttributes, ordering: attributesOrder, featureAttributes, featureAttributeOrder } = tilesetOptions.store.defaultGeometrySchema;\n // First 8 bytes reserved for header (vertexCount and featureCount)\n const headers = parseHeaders(arrayBuffer, tilesetOptions);\n byteOffset = headers.byteOffset;\n vertexCount = headers.vertexCount;\n featureCount = headers.featureCount;\n // Getting vertex attributes such as positions, normals, colors, etc...\n const { attributes: normalizedVertexAttributes, byteOffset: offset } = normalizeAttributes(arrayBuffer, byteOffset, vertexAttributes, vertexCount, attributesOrder);\n // Getting feature attributes such as featureIds and faceRange\n const { attributes: normalizedFeatureAttributes } = normalizeAttributes(arrayBuffer, offset, featureAttributes, featureCount, featureAttributeOrder);\n flattenFeatureIdsByFaceRanges(normalizedFeatureAttributes);\n attributes = concatAttributes(normalizedVertexAttributes, normalizedFeatureAttributes);\n }\n if (!options?.i3s?.coordinateSystem ||\n // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison\n options.i3s.coordinateSystem === COORDINATE_SYSTEM.METER_OFFSETS) {\n const enuMatrix = parsePositions(attributes.position, tileOptions);\n content.modelMatrix = enuMatrix.invert();\n content.coordinateSystem = COORDINATE_SYSTEM.METER_OFFSETS;\n }\n else {\n content.modelMatrix = getModelMatrix(attributes.position);\n content.coordinateSystem = COORDINATE_SYSTEM.LNGLAT_OFFSETS;\n }\n content.attributes = {\n positions: attributes.position,\n normals: attributes.normal,\n colors: normalizeAttribute(attributes.color), // Normalize from UInt8\n texCoords: attributes.uv0,\n uvRegions: normalizeAttribute(attributes.uvRegion || attributes.region) // Normalize from UInt16\n };\n content.indices = indices || null;\n if (attributes.id && attributes.id.value) {\n content.featureIds = attributes.id.value;\n }\n // Remove undefined attributes\n for (const attributeIndex in content.attributes) {\n if (!content.attributes[attributeIndex]) {\n delete content.attributes[attributeIndex];\n }\n }\n content.vertexCount = vertexCount;\n content.byteLength = contentByteLength;\n return content;\n}\n/**\n * Update attributes with metadata from decompressed geometry.\n * @param decompressedGeometry\n * @param attributes\n */\nfunction updateAttributesMetadata(attributes, decompressedGeometry) {\n for (const key in decompressedGeometry.loaderData.attributes) {\n const dracoAttribute = decompressedGeometry.loaderData.attributes[key];\n switch (dracoAttribute.name) {\n case 'POSITION':\n attributes.position.metadata = dracoAttribute.metadata;\n break;\n case 'feature-index':\n attributes.id.metadata = dracoAttribute.metadata;\n break;\n default:\n break;\n }\n }\n}\n/**\n * Do concatenation of attribute objects.\n * Done as separate fucntion to avoid ts errors.\n * @param normalizedVertexAttributes\n * @param normalizedFeatureAttributes\n * @returns - result of attributes concatenation.\n */\nfunction concatAttributes(normalizedVertexAttributes, normalizedFeatureAttributes) {\n return { ...normalizedVertexAttributes, ...normalizedFeatureAttributes };\n}\n/**\n * Normalize attribute to range [0..1] . Eg. convert colors buffer from [255,255,255,255] to [1,1,1,1]\n * @param attribute - geometry attribute\n * @returns - geometry attribute in right format\n */\nfunction normalizeAttribute(attribute) {\n if (!attribute) {\n return attribute;\n }\n attribute.normalized = true;\n return attribute;\n}\nfunction parseHeaders(arrayBuffer, options) {\n let byteOffset = 0;\n // First 8 bytes reserved for header (vertexCount and featurecount)\n let vertexCount = 0;\n let featureCount = 0;\n for (const { property, type } of options.store.defaultGeometrySchema.header) {\n const TypedArrayTypeHeader = getConstructorForDataFormat(type);\n switch (property) {\n case HeaderAttributeProperty.vertexCount.toString():\n vertexCount = new TypedArrayTypeHeader(arrayBuffer, 0, 4)[0];\n byteOffset += sizeOf(type);\n break;\n case HeaderAttributeProperty.featureCount.toString():\n featureCount = new TypedArrayTypeHeader(arrayBuffer, 4, 4)[0];\n byteOffset += sizeOf(type);\n break;\n default:\n break;\n }\n }\n return {\n vertexCount,\n featureCount,\n byteOffset\n };\n}\n/* eslint-enable max-statements */\nfunction normalizeAttributes(arrayBuffer, byteOffset, vertexAttributes, attributeCount, attributesOrder) {\n const attributes = {};\n // the order of attributes depend on the order being added to the vertexAttributes object\n for (const attribute of attributesOrder) {\n if (vertexAttributes[attribute]) {\n const { valueType, valuesPerElement } = vertexAttributes[attribute];\n // protect from arrayBuffer read overunns by NOT assuming node has regions always even though its declared in defaultGeometrySchema.\n // In i3s 1.6: client is required to decide that based on ./shared resource of the node (materialDefinitions.[Mat_id].params.vertexRegions == true)\n // In i3s 1.7 the property has been rolled into the 3d scene layer json/node pages.\n // Code below does not account when the bytelength is actually bigger than\n // the calculated value (b\\c the tile potentially could have mesh segmentation information).\n // In those cases tiles without regions could fail or have garbage values.\n if (byteOffset + attributeCount * valuesPerElement * sizeOf(valueType) <=\n arrayBuffer.byteLength) {\n const buffer = arrayBuffer.slice(byteOffset);\n let value;\n if (valueType === 'UInt64') {\n value = parseUint64Values(buffer, attributeCount * valuesPerElement, sizeOf(valueType));\n }\n else {\n const TypedArrayType = getConstructorForDataFormat(valueType);\n value = new TypedArrayType(buffer, 0, attributeCount * valuesPerElement);\n }\n attributes[attribute] = {\n value,\n type: GL_TYPE_MAP[valueType],\n size: valuesPerElement\n };\n switch (attribute) {\n case 'color':\n attributes.color.normalized = true;\n break;\n case 'position':\n case 'region':\n case 'normal':\n default:\n }\n byteOffset = byteOffset + attributeCount * valuesPerElement * sizeOf(valueType);\n }\n else if (attribute !== 'uv0') {\n break;\n }\n }\n }\n return { attributes, byteOffset };\n}\n/**\n * Parse buffer to return array of uint64 values\n *\n * @param buffer\n * @param elementsCount\n * @returns 64-bit array of values until precision is lost after Number.MAX_SAFE_INTEGER\n */\nfunction parseUint64Values(buffer, elementsCount, attributeSize) {\n const values = [];\n const dataView = new DataView(buffer);\n let offset = 0;\n for (let index = 0; index < elementsCount; index++) {\n // split 64-bit number into two 32-bit parts\n const left = dataView.getUint32(offset, true);\n const right = dataView.getUint32(offset + 4, true);\n // combine the two 32-bit values\n const value = left + 2 ** 32 * right;\n values.push(value);\n offset += attributeSize;\n }\n return new Uint32Array(values);\n}\nfunction parsePositions(attribute, options) {\n const mbs = options.mbs;\n const value = attribute.value;\n const metadata = attribute.metadata;\n const enuMatrix = new Matrix4();\n const cartographicOrigin = new Vector3(mbs[0], mbs[1], mbs[2]);\n const cartesianOrigin = new Vector3();\n Ellipsoid.WGS84.cartographicToCartesian(cartographicOrigin, cartesianOrigin);\n Ellipsoid.WGS84.eastNorthUpToFixedFrame(cartesianOrigin, enuMatrix);\n attribute.value = offsetsToCartesians(value, metadata, cartographicOrigin);\n return enuMatrix;\n}\n/**\n * Converts position coordinates to absolute cartesian coordinates\n * @param vertices - \"position\" attribute data\n * @param metadata - When the geometry is DRACO compressed, contain position attribute's metadata\n * https://github.com/Esri/i3s-spec/blob/master/docs/1.7/compressedAttributes.cmn.md\n * @param cartographicOrigin - Cartographic origin coordinates\n * @returns - converted \"position\" data\n */\nfunction offsetsToCartesians(vertices, metadata = {}, cartographicOrigin) {\n const positions = new Float64Array(vertices.length);\n const scaleX = (metadata['i3s-scale_x'] && metadata['i3s-scale_x'].double) || 1;\n const scaleY = (metadata['i3s-scale_y'] && metadata['i3s-scale_y'].double) || 1;\n for (let i = 0; i < positions.length; i += 3) {\n positions[i] = vertices[i] * scaleX + cartographicOrigin.x;\n positions[i + 1] = vertices[i + 1] * scaleY + cartographicOrigin.y;\n positions[i + 2] = vertices[i + 2] + cartographicOrigin.z;\n }\n for (let i = 0; i < positions.length; i += 3) {\n // @ts-ignore\n Ellipsoid.WGS84.cartographicToCartesian(positions.subarray(i, i + 3), scratchVector);\n positions[i] = scratchVector.x;\n positions[i + 1] = scratchVector.y;\n positions[i + 2] = scratchVector.z;\n }\n return positions;\n}\n/**\n * Get model matrix for loaded vertices\n * @param positions positions attribute\n * @returns Matrix4 - model matrix for geometry transformation\n */\nfunction getModelMatrix(positions) {\n const metadata = positions.metadata;\n const scaleX = metadata?.['i3s-scale_x']?.double || 1;\n const scaleY = metadata?.['i3s-scale_y']?.double || 1;\n const modelMatrix = new Matrix4();\n modelMatrix[0] = scaleX;\n modelMatrix[5] = scaleY;\n return modelMatrix;\n}\n/**\n * Makes a glTF-compatible PBR material from an I3S material definition\n * @param materialDefinition - i3s material definition\n * https://github.com/Esri/i3s-spec/blob/master/docs/1.7/materialDefinitions.cmn.md\n * @param texture - texture image\n * @returns {object}\n */\nfunction makePbrMaterial(materialDefinition, texture) {\n let pbrMaterial;\n if (materialDefinition) {\n pbrMaterial = {\n ...materialDefinition,\n pbrMetallicRoughness: materialDefinition.pbrMetallicRoughness\n ? { ...materialDefinition.pbrMetallicRoughness }\n : { baseColorFactor: [255, 255, 255, 255] }\n };\n }\n else {\n pbrMaterial = {\n pbrMetallicRoughness: {}\n };\n if (texture) {\n pbrMaterial.pbrMetallicRoughness.baseColorTexture = { texCoord: 0 };\n }\n else {\n pbrMaterial.pbrMetallicRoughness.baseColorFactor = [255, 255, 255, 255];\n }\n }\n // Set default 0.25 per spec https://github.com/Esri/i3s-spec/blob/master/docs/1.7/materialDefinitions.cmn.md\n pbrMaterial.alphaCutoff = pbrMaterial.alphaCutoff || 0.25;\n if (pbrMaterial.alphaMode) {\n // I3S contain alphaMode in lowerCase\n pbrMaterial.alphaMode = pbrMaterial.alphaMode.toUpperCase();\n }\n // Convert colors from [255,255,255,255] to [1,1,1,1]\n if (pbrMaterial.emissiveFactor) {\n pbrMaterial.emissiveFactor = convertColorFormat(pbrMaterial.emissiveFactor);\n }\n if (pbrMaterial.pbrMetallicRoughness && pbrMaterial.pbrMetallicRoughness.baseColorFactor) {\n pbrMaterial.pbrMetallicRoughness.baseColorFactor = convertColorFormat(pbrMaterial.pbrMetallicRoughness.baseColorFactor);\n }\n if (texture) {\n setMaterialTexture(pbrMaterial, texture);\n }\n return pbrMaterial;\n}\n/**\n * Convert color from [255,255,255,255] to [1,1,1,1]\n * @param colorFactor - color array\n * @returns - new color array\n */\nfunction convertColorFormat(colorFactor) {\n const normalizedColor = [...colorFactor];\n for (let index = 0; index < colorFactor.length; index++) {\n normalizedColor[index] = colorFactor[index] / 255;\n }\n return normalizedColor;\n}\n/**\n * Set texture in PBR material\n * @param {object} material - i3s material definition\n * @param image - texture image\n * @returns\n */\nfunction setMaterialTexture(material, image) {\n const texture = { source: { image } };\n // I3SLoader now support loading only one texture. This elseif sequence will assign this texture to one of\n // properties defined in materialDefinition\n if (material.pbrMetallicRoughness && material.pbrMetallicRoughness.baseColorTexture) {\n material.pbrMetallicRoughness.baseColorTexture = {\n ...material.pbrMetallicRoughness.baseColorTexture,\n texture\n };\n }\n else if (material.emissiveTexture) {\n material.emissiveTexture = { ...material.emissiveTexture, texture };\n }\n else if (material.pbrMetallicRoughness &&\n material.pbrMetallicRoughness.metallicRoughnessTexture) {\n material.pbrMetallicRoughness.metallicRoughnessTexture = {\n ...material.pbrMetallicRoughness.metallicRoughnessTexture,\n texture\n };\n }\n else if (material.normalTexture) {\n material.normalTexture = { ...material.normalTexture, texture };\n }\n else if (material.occlusionTexture) {\n material.occlusionTexture = { ...material.occlusionTexture, texture };\n }\n}\n/**\n * Flatten feature ids using face ranges\n * @param normalizedFeatureAttributes\n * @returns\n */\nfunction flattenFeatureIdsByFaceRanges(normalizedFeatureAttributes) {\n const { id, faceRange } = normalizedFeatureAttributes;\n if (!id || !faceRange) {\n return;\n }\n const featureIds = id.value;\n const range = faceRange.value;\n const featureIdsLength = range[range.length - 1] + 1;\n const orderedFeatureIndices = new Uint32Array(featureIdsLength * 3);\n let featureIndex = 0;\n let startIndex = 0;\n for (let index = 1; index < range.length; index += 2) {\n const fillId = Number(featureIds[featureIndex]);\n const endValue = range[index];\n const prevValue = range[index - 1];\n const trianglesCount = endValue - prevValue + 1;\n const endIndex = startIndex + trianglesCount * 3;\n orderedFeatureIndices.fill(fillId, startIndex, endIndex);\n featureIndex++;\n startIndex = endIndex;\n }\n normalizedFeatureAttributes.id.value = orderedFeatureIndices;\n}\n/**\n * Flatten feature ids using featureIndices\n * @param attributes\n * @param featureIds\n * @returns\n */\nfunction flattenFeatureIdsByFeatureIndices(attributes, featureIds) {\n const featureIndices = attributes.id.value;\n const result = new Float32Array(featureIndices.length);\n for (let index = 0; index < featureIndices.length; index++) {\n result[index] = featureIds[featureIndices[index]];\n }\n attributes.id.value = result;\n}\n/**\n * Flatten feature ids using featureIndices\n * @param featureIndex\n * @returns\n */\nfunction getFeatureIdsFromFeatureIndexMetadata(featureIndex) {\n return featureIndex?.metadata?.['i3s-feature-ids']?.intArray;\n}\n", "export var HeaderAttributeProperty;\n(function (HeaderAttributeProperty) {\n HeaderAttributeProperty[\"vertexCount\"] = \"vertexCount\";\n HeaderAttributeProperty[\"featureCount\"] = \"featureCount\";\n})(HeaderAttributeProperty || (HeaderAttributeProperty = {}));\n", "/**\n * Return URL seperated from search params\n * @param url - URL that might have search params\n * @returns url without search params\n */\nexport function getUrlWithoutParams(url) {\n let urlWithoutParams;\n try {\n const urlObj = new URL(url);\n urlWithoutParams = `${urlObj.origin}${urlObj.pathname}`;\n // On Windows `new URL(url)` makes `C:\\...` -> `null\\...`\n if (urlWithoutParams.startsWith('null')) {\n urlWithoutParams = null;\n }\n }\n catch (e) {\n urlWithoutParams = null;\n }\n return urlWithoutParams || url;\n}\n/**\n * Generates url with token if it is exists.\n * @param url\n * @param token\n * @returns\n */\nexport function getUrlWithToken(url, token = null) {\n return token ? `${url}?token=${token}` : url;\n}\n/**\n * Generates attribute urls for tile.\n * @param tile\n * @returns list of attribute urls\n */\nexport function generateTileAttributeUrls(url, tile) {\n const { attributeData = [] } = tile;\n const attributeUrls = [];\n for (let index = 0; index < attributeData.length; index++) {\n const attributeUrl = attributeData[index].href.replace('./', '');\n attributeUrls.push(`${url}/${attributeUrl}`);\n }\n return attributeUrls;\n}\n/**\n * Generates attribute urls for tileset based on tileset and resource\n * @param tileset - tileset metadata\n * @param url - tileset base url\n * @param resource - resource id per I3S spec\n * @returns {Array}\n */\nexport function generateTilesetAttributeUrls(tileset, url, resource) {\n const attributeUrls = [];\n const { attributeStorageInfo = [] } = tileset;\n for (let index = 0; index < attributeStorageInfo.length; index++) {\n const fileName = attributeStorageInfo[index].key;\n attributeUrls.push(`${url}/nodes/${resource}/attributes/${fileName}/0`);\n }\n return attributeUrls;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { parseI3STileContent } from \"./lib/parsers/parse-i3s-tile-content.js\";\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.2.3\" !== 'undefined' ? \"4.2.3\" : 'latest';\n/**\n * Loader for I3S - Indexed 3D Scene Layer\n */\nexport const I3SContentLoader = {\n dataType: null,\n batchType: null,\n name: 'I3S Content (Indexed Scene Layers)',\n id: 'i3s-content',\n module: 'i3s',\n worker: true,\n version: VERSION,\n mimeTypes: ['application/octet-stream'],\n parse,\n extensions: ['bin'],\n options: {\n 'i3s-content': {}\n }\n};\nasync function parse(data, options, context) {\n const { tile, _tileOptions, tileset, _tilesetOptions } = options?.i3s || {};\n const tileOptions = _tileOptions || tile;\n const tilesetOptions = _tilesetOptions || tileset;\n if (!tileOptions || !tilesetOptions) {\n return null;\n }\n return await parseI3STileContent(data, tileOptions, tilesetOptions, options, context);\n}\n", "import { OrientedBoundingBox } from '@math.gl/culling';\nimport { Ellipsoid } from '@math.gl/geospatial';\nimport { load } from '@loaders.gl/core';\nimport { TILE_TYPE, TILE_REFINEMENT, TILESET_TYPE } from '@loaders.gl/tiles';\nimport I3SNodePagesTiles from \"../helpers/i3s-nodepages-tiles.js\";\nimport { generateTileAttributeUrls, getUrlWithToken, getUrlWithoutParams } from \"../utils/url-utils.js\";\nimport { I3SLoader } from \"../../i3s-loader.js\";\nexport function normalizeTileData(tile, context) {\n const url = context.url || '';\n let contentUrl;\n if (tile.geometryData) {\n contentUrl = `${url}/${tile.geometryData[0].href}`;\n }\n let textureUrl;\n if (tile.textureData) {\n textureUrl = `${url}/${tile.textureData[0].href}`;\n }\n let attributeUrls;\n if (tile.attributeData) {\n attributeUrls = generateTileAttributeUrls(url, tile);\n }\n const children = tile.children || [];\n return normalizeTileNonUrlData({\n ...tile,\n children,\n url,\n contentUrl,\n textureUrl,\n textureFormat: 'jpg', // `jpg` format will cause `ImageLoader` usage that will be able to handle `png` as well\n attributeUrls,\n isDracoGeometry: false\n });\n}\nexport function normalizeTileNonUrlData(tile) {\n const boundingVolume = {};\n let mbs = [0, 0, 0, 1];\n if (tile.mbs) {\n mbs = tile.mbs;\n boundingVolume.sphere = [\n ...Ellipsoid.WGS84.cartographicToCartesian(tile.mbs.slice(0, 3)), // cartesian center of sphere\n tile.mbs[3] // radius of sphere\n ];\n }\n else if (tile.obb) {\n boundingVolume.box = [\n ...Ellipsoid.WGS84.cartographicToCartesian(tile.obb.center), // cartesian center of box\n ...tile.obb.halfSize, // halfSize\n ...tile.obb.quaternion // quaternion\n ];\n const obb = new OrientedBoundingBox().fromCenterHalfSizeQuaternion(boundingVolume.box.slice(0, 3), tile.obb.halfSize, tile.obb.quaternion);\n const boundingSphere = obb.getBoundingSphere();\n boundingVolume.sphere = [...boundingSphere.center, boundingSphere.radius];\n mbs = [...tile.obb.center, boundingSphere.radius];\n }\n const lodMetricType = tile.lodSelection?.[0].metricType;\n const lodMetricValue = tile.lodSelection?.[0].maxError;\n const type = TILE_TYPE.MESH;\n /**\n * I3S specification supports only REPLACE\n */\n const refine = TILE_REFINEMENT.REPLACE;\n return { ...tile, mbs, boundingVolume, lodMetricType, lodMetricValue, type, refine };\n}\nexport async function normalizeTilesetData(tileset, options, context) {\n const url = getUrlWithoutParams(context.url || '');\n let nodePagesTile;\n let root;\n if (tileset.nodePages) {\n nodePagesTile = new I3SNodePagesTiles(tileset, url, options);\n root = await nodePagesTile.formTileFromNodePages(0);\n }\n else {\n const parseOptions = options.i3s;\n const rootNodeUrl = getUrlWithToken(`${url}/nodes/root`, parseOptions.token);\n // eslint-disable-next-line no-use-before-define\n root = await load(rootNodeUrl, I3SLoader, {\n ...options,\n i3s: {\n // @ts-expect-error options is not properly typed\n ...options.i3s,\n loadContent: false, isTileHeader: true, isTileset: false\n }\n });\n }\n return {\n ...tileset,\n loader: I3SLoader,\n url,\n basePath: url,\n type: TILESET_TYPE.I3S,\n nodePagesTile,\n // @ts-expect-error\n root,\n lodMetricType: root.lodMetricType,\n lodMetricValue: root.lodMetricValue\n };\n}\n", "import { load } from '@loaders.gl/core';\nimport { getSupportedGPUTextureFormats, selectSupportedBasisFormat } from '@loaders.gl/textures';\nimport { I3SNodePageLoader } from \"../../i3s-node-page-loader.js\";\nimport { normalizeTileNonUrlData } from \"../parsers/parse-i3s.js\";\nimport { getUrlWithToken, generateTilesetAttributeUrls } from \"../utils/url-utils.js\";\n/**\n * class I3SNodePagesTiles - loads nodePages and form i3s tiles from them\n */\nexport default class I3SNodePagesTiles {\n tileset;\n nodePages = [];\n pendingNodePages = [];\n nodesPerPage;\n options;\n lodSelectionMetricType;\n textureDefinitionsSelectedFormats = [];\n nodesInNodePages;\n url;\n textureLoaderOptions = {};\n /**\n * @constructs\n * Create a I3SNodePagesTiles instance.\n * @param tileset - i3s tileset header ('layers/0')\n * @param url - tileset url\n * @param options - i3s loader options\n */\n constructor(tileset, url = '', options) {\n this.tileset = { ...tileset }; // spread the tileset to avoid circular reference\n this.url = url;\n this.nodesPerPage = tileset.nodePages?.nodesPerPage || 64;\n this.lodSelectionMetricType = tileset.nodePages?.lodSelectionMetricType;\n this.options = options;\n this.nodesInNodePages = 0;\n this.initSelectedFormatsForTextureDefinitions(tileset);\n }\n /**\n * Loads some nodePage and return a particular node from it\n * @param id - id of node through all node pages\n */\n async getNodeById(id) {\n const pageIndex = Math.floor(id / this.nodesPerPage);\n if (!this.nodePages[pageIndex] && !this.pendingNodePages[pageIndex]) {\n const nodePageUrl = getUrlWithToken(`${this.url}/nodepages/${pageIndex}`, \n // @ts-expect-error this.options is not properly typed\n this.options.i3s?.token);\n this.pendingNodePages[pageIndex] = {\n status: 'Pending',\n promise: load(nodePageUrl, I3SNodePageLoader, this.options)\n };\n this.nodePages[pageIndex] = await this.pendingNodePages[pageIndex].promise;\n this.nodesInNodePages += this.nodePages[pageIndex].nodes.length;\n this.pendingNodePages[pageIndex].status = 'Done';\n }\n if (this.pendingNodePages[pageIndex].status === 'Pending') {\n this.nodePages[pageIndex] = await this.pendingNodePages[pageIndex].promise;\n }\n const nodeIndex = id % this.nodesPerPage;\n return this.nodePages[pageIndex].nodes[nodeIndex];\n }\n /**\n * Forms tile header using node and tileset data\n * @param id - id of node through all node pages\n */\n // eslint-disable-next-line complexity, max-statements\n async formTileFromNodePages(id) {\n const node = await this.getNodeById(id);\n const children = [];\n const childNodesPromises = [];\n for (const child of node.children || []) {\n childNodesPromises.push(this.getNodeById(child));\n }\n const childNodes = await Promise.all(childNodesPromises);\n for (const childNode of childNodes) {\n children.push({\n id: childNode.index.toString(),\n obb: childNode.obb\n });\n }\n let contentUrl;\n let textureUrl;\n let materialDefinition;\n let textureFormat = 'jpg';\n let attributeUrls = [];\n let isDracoGeometry = false;\n if (node && node.mesh) {\n // Get geometry resource URL and type (compressed / non-compressed)\n const { url, isDracoGeometry: isDracoGeometryResult } = (node.mesh.geometry &&\n this.getContentUrl(node.mesh.geometry)) || { isDracoGeometry: false };\n contentUrl = url;\n isDracoGeometry = isDracoGeometryResult;\n const { textureData, materialDefinition: nodeMaterialDefinition } = this.getInformationFromMaterial(node.mesh.material);\n materialDefinition = nodeMaterialDefinition;\n textureFormat = textureData.format || textureFormat;\n if (textureData.name) {\n textureUrl = `${this.url}/nodes/${node.mesh.material.resource}/textures/${textureData.name}`;\n }\n if (this.tileset.attributeStorageInfo) {\n attributeUrls = generateTilesetAttributeUrls(this.tileset, this.url, node.mesh.attribute.resource);\n }\n }\n const lodSelection = this.getLodSelection(node);\n return normalizeTileNonUrlData({\n id: id.toString(),\n lodSelection,\n obb: node.obb,\n contentUrl,\n textureUrl,\n attributeUrls,\n materialDefinition,\n textureFormat,\n textureLoaderOptions: this.textureLoaderOptions,\n children,\n isDracoGeometry\n });\n }\n /**\n * Forms url and type of geometry resource by nodepage's data and `geometryDefinitions` in the tileset\n * @param - data about the node's mesh from the nodepage\n * @returns -\n * {string} url - url to the geometry resource\n * {boolean} isDracoGeometry - whether the geometry resource contain DRACO compressed geometry\n */\n getContentUrl(meshGeometryData) {\n let result = null;\n // @ts-ignore\n const geometryDefinition = this.tileset.geometryDefinitions[meshGeometryData.definition];\n let geometryIndex = -1;\n // Try to find DRACO geometryDefinition of `useDracoGeometry` option is set\n // @ts-expect-error this.options is not properly typed\n if (this.options.i3s && this.options.i3s.useDracoGeometry) {\n geometryIndex = geometryDefinition.geometryBuffers.findIndex((buffer) => buffer.compressedAttributes && buffer.compressedAttributes.encoding === 'draco');\n }\n // If DRACO geometry is not applicable try to select non-compressed geometry\n if (geometryIndex === -1) {\n geometryIndex = geometryDefinition.geometryBuffers.findIndex((buffer) => !buffer.compressedAttributes);\n }\n if (geometryIndex !== -1) {\n const isDracoGeometry = Boolean(geometryDefinition.geometryBuffers[geometryIndex].compressedAttributes);\n result = {\n url: `${this.url}/nodes/${meshGeometryData.resource}/geometries/${geometryIndex}`,\n isDracoGeometry\n };\n }\n return result;\n }\n /**\n * Forms 1.6 compatible LOD selection object from a nodepage's node data\n * @param node - a node from nodepage\n * @returns- Array of LodSelection\n */\n getLodSelection(node) {\n const lodSelection = [];\n if (this.lodSelectionMetricType === 'maxScreenThresholdSQ') {\n lodSelection.push({\n metricType: 'maxScreenThreshold',\n // @ts-ignore\n maxError: Math.sqrt(node.lodThreshold / (Math.PI * 0.25))\n });\n }\n lodSelection.push({\n metricType: this.lodSelectionMetricType,\n // @ts-ignore\n maxError: node.lodThreshold\n });\n return lodSelection;\n }\n /**\n * Returns information about texture and material from `materialDefinitions`\n * @param material - material data from nodepage\n * @returns - Couple {textureData, materialDefinition}\n * {string} textureData.name - path name of the texture\n * {string} textureData.format - format of the texture\n * materialDefinition - PBR-like material definition from `materialDefinitions`\n */\n getInformationFromMaterial(material) {\n const informationFromMaterial = { textureData: { name: null } };\n if (material) {\n const materialDefinition = this.tileset.materialDefinitions?.[material.definition];\n if (materialDefinition) {\n informationFromMaterial.materialDefinition = materialDefinition;\n const textureSetDefinitionIndex = materialDefinition?.pbrMetallicRoughness?.baseColorTexture?.textureSetDefinitionId;\n if (typeof textureSetDefinitionIndex === 'number') {\n informationFromMaterial.textureData =\n this.textureDefinitionsSelectedFormats[textureSetDefinitionIndex] ||\n informationFromMaterial.textureData;\n }\n }\n }\n return informationFromMaterial;\n }\n /**\n * Sets preferable and supported format for each textureDefinition of the tileset\n * @param tileset - I3S layer data\n * @returns\n */\n initSelectedFormatsForTextureDefinitions(tileset) {\n this.textureDefinitionsSelectedFormats = [];\n const possibleI3sFormats = this.getSupportedTextureFormats();\n const textureSetDefinitions = tileset.textureSetDefinitions || [];\n for (const textureSetDefinition of textureSetDefinitions) {\n const formats = (textureSetDefinition && textureSetDefinition.formats) || [];\n let selectedFormat = null;\n for (const i3sFormat of possibleI3sFormats) {\n const format = formats.find((value) => value.format === i3sFormat);\n if (format) {\n selectedFormat = format;\n break;\n }\n }\n // For I3S 1.8 need to define basis target format to decode\n if (selectedFormat && selectedFormat.format === 'ktx2') {\n this.textureLoaderOptions.basis = {\n format: selectSupportedBasisFormat(),\n containerFormat: 'ktx2',\n module: 'encoder'\n };\n }\n this.textureDefinitionsSelectedFormats.push(selectedFormat);\n }\n }\n /**\n * Returns the array of supported texture format\n * @returns list of format strings\n */\n getSupportedTextureFormats() {\n const formats = [];\n // @ts-expect-error this.options is not properly typed\n if (!this.options.i3s || this.options.i3s.useCompressedTextures) {\n // I3S 1.7 selection\n const supportedCompressedFormats = getSupportedGPUTextureFormats();\n // List of possible in i3s formats:\n // https://github.com/Esri/i3s-spec/blob/master/docs/1.7/textureSetDefinitionFormat.cmn.md\n if (supportedCompressedFormats.has('etc2')) {\n formats.push('ktx-etc2');\n }\n if (supportedCompressedFormats.has('dxt')) {\n formats.push('dds');\n }\n // I3S 1.8 selection\n // ktx2 wraps basis texture which at the edge case can be decoded as uncompressed image\n formats.push('ktx2');\n }\n formats.push('jpg');\n formats.push('png');\n return formats;\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.2.3\" !== 'undefined' ? \"4.2.3\" : 'latest';\n/**\n * Loader for I3S node pages\n */\nexport const I3SNodePageLoader = {\n dataType: null,\n batchType: null,\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};\nasync function parseNodePage(data, options) {\n return JSON.parse(new TextDecoder().decode(data));\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { DataViewFile } from '@loaders.gl/loader-utils';\nimport { parseSLPKArchive } from \"./lib/parsers/parse-slpk/parse-slpk.js\";\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.2.3\" !== 'undefined' ? \"4.2.3\" : 'latest';\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 = {\n dataType: null,\n batchType: null,\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, options = {}) => {\n const archive = await parseSLPKArchive(new DataViewFile(new DataView(data)));\n return archive.getFile(options.slpk?.path ?? '', options.slpk?.pathMode);\n }\n};\n", "import { parseZipCDFileHeader, CD_HEADER_SIGNATURE, parseZipLocalFileHeader, searchFromTheEnd, parseHashTable, makeHashTableFromZipHeaders } from '@loaders.gl/zip';\nimport { SLPKArchive } from \"./slpk-archieve.js\";\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(fileProvider, cb, fileName) {\n const hashCDOffset = await searchFromTheEnd(fileProvider, CD_HEADER_SIGNATURE);\n const cdFileHeader = await parseZipCDFileHeader(hashCDOffset, fileProvider);\n let hashTable;\n if (cdFileHeader?.fileName !== '@specialIndexFileHASH128@') {\n hashTable = await makeHashTableFromZipHeaders(fileProvider);\n cb?.('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(cdFileHeader.localHeaderOffset, fileProvider);\n if (!localFileHeader) {\n throw new Error('corrupted SLPK');\n }\n const fileDataOffset = localFileHeader.fileDataOffset;\n const hashFile = await fileProvider.slice(fileDataOffset, fileDataOffset + localFileHeader.compressedSize);\n hashTable = parseHashTable(hashFile);\n }\n return new SLPKArchive(fileProvider, hashTable, fileName);\n}\n", "import { MD5Hash } from '@loaders.gl/crypto';\nimport { IndexedArchive, parseZipLocalFileHeader } from '@loaders.gl/zip';\nimport { GZipCompression } from '@loaders.gl/compression';\n/** Description of real paths for different file types */\nconst PATH_DESCRIPTIONS = [\n {\n test: /^$/,\n extensions: ['3dSceneLayer.json.gz']\n },\n {\n test: /^nodepages\\/\\d+$/,\n extensions: ['.json.gz']\n },\n {\n test: /^nodes\\/(\\d+|root)$/,\n extensions: ['/3dNodeIndexDocument.json.gz']\n },\n {\n test: /^nodes\\/\\d+\\/textures\\/.+$/,\n extensions: ['.jpg', '.png', '.bin.dds.gz', '.ktx']\n },\n {\n test: /^nodes\\/\\d+\\/geometries\\/\\d+$/,\n extensions: ['.bin.gz', '.draco.gz']\n },\n {\n test: /^nodes\\/\\d+\\/attributes\\/f_\\d+\\/\\d+$/,\n extensions: ['.bin.gz']\n },\n {\n test: /^statistics\\/f_\\d+\\/\\d+$/,\n extensions: ['.json.gz']\n },\n {\n test: /^nodes\\/\\d+\\/shared$/,\n extensions: ['/sharedResource.json.gz']\n }\n];\n/**\n * Class for handling information about slpk file\n */\nexport class SLPKArchive extends IndexedArchive {\n // Maps hex-encoded md5 filename hashes to bigint offsets into the archive\n hashTable;\n _textEncoder = new TextEncoder();\n _textDecoder = new TextDecoder();\n _md5Hash = new MD5Hash();\n /**\n * Constructor\n * @param fileProvider - instance of a binary data reader\n * @param hashTable - pre-loaded hashTable. If presented, getFile will skip reading the hash file\n * @param fileName - name of the archive. It is used to add to an URL of a loader context\n */\n constructor(fileProvider, hashTable, fileName) {\n super(fileProvider, hashTable, fileName);\n this.hashTable = hashTable;\n }\n /**\n * Returns file with the given path from slpk archive\n * @param path - path inside the slpk\n * @param mode - currently only raw mode supported\n * @returns buffer with ready to use file\n */\n async getFile(path, mode = 'raw') {\n if (mode === 'http') {\n const extensions = PATH_DESCRIPTIONS.find((val) => val.test.test(path))?.extensions;\n if (extensions) {\n let data;\n for (const ext of extensions) {\n data = await this.getDataByPath(`${path}${ext}`);\n if (data) {\n break;\n }\n }\n if (data) {\n return data;\n }\n }\n }\n if (mode === 'raw') {\n const decompressedFile = await this.getDataByPath(`${path}.gz`);\n if (decompressedFile) {\n return decompressedFile;\n }\n const fileWithoutCompression = await this.getFileBytes(path);\n if (fileWithoutCompression) {\n return fileWithoutCompression;\n }\n }\n throw new Error(`No such file in the archive: ${path}`);\n }\n /**\n * returning uncompressed data for paths that ends with .gz and raw data for all other paths\n * @param path - path inside the archive\n * @returns buffer with the file data\n */\n async getDataByPath(path) {\n // sometimes paths are not in lower case when hash file is created,\n // so first we're looking for lower case file name and then for original one\n let data = await this.getFileBytes(path.toLocaleLowerCase());\n if (!data) {\n data = await this.getFileBytes(path);\n }\n if (!data) {\n return undefined;\n }\n if (/\\.gz$/.test(path)) {\n const compression = new GZipCompression();\n const decompressedData = await compression.decompress(data);\n return decompressedData;\n }\n return data;\n }\n /**\n * Trying to get raw file data by address\n * @param path - path inside the archive\n * @returns buffer with the raw file data\n */\n async getFileBytes(path) {\n let compressedFile;\n if (this.hashTable) {\n const binaryPath = this._textEncoder.encode(path);\n const nameHash = await this._md5Hash.hash(binaryPath.buffer, 'hex');\n const offset = this.hashTable[nameHash];\n if (offset === undefined) {\n return undefined;\n }\n const localFileHeader = await parseZipLocalFileHeader(offset, this.fileProvider);\n if (!localFileHeader) {\n return undefined;\n }\n compressedFile = await this.fileProvider.slice(localFileHeader.fileDataOffset, localFileHeader.fileDataOffset + localFileHeader.compressedSize);\n }\n else {\n try {\n compressedFile = await this.getFileWithoutHash(path);\n }\n catch {\n compressedFile = undefined;\n }\n }\n return compressedFile;\n }\n}\n", "import { load } from '@loaders.gl/core';\nimport { parseI3STileAttribute } from \"./lib/parsers/parse-i3s-attribute.js\";\nimport { getUrlWithToken } from \"./lib/utils/url-utils.js\";\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.2.3\" !== 'undefined' ? \"4.2.3\" : 'latest';\nconst EMPTY_VALUE = '';\nconst REJECTED_STATUS = 'rejected';\n/**\n * Loader for I3S attributes\n */\nexport const I3SAttributeLoader = {\n dataType: null,\n batchType: null,\n name: 'I3S Attribute',\n id: 'i3s-attribute',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/binary'],\n parse: async (arrayBuffer, options) => parseI3STileAttribute(arrayBuffer, options),\n extensions: ['bin'],\n options: {},\n binary: true\n};\n// TODO - these seem to use the loader rather than being part of the loader. Move to different file...\n/**\n * Load attributes based on feature id\n * @param {Object} tile\n * @param {number} featureId\n * @param {Object} options\n * @returns {Promise}\n */\n// eslint-disable-next-line complexity\nexport async function loadFeatureAttributes(tile, featureId, options = {}) {\n const { attributeStorageInfo, attributeUrls, tilesetFields } = getAttributesData(tile);\n if (!attributeStorageInfo || !attributeUrls || featureId < 0) {\n return null;\n }\n let attributes = [];\n const attributeLoadPromises = [];\n for (let index = 0; index < attributeStorageInfo.length; index++) {\n // @ts-ignore\n const url = getUrlWithToken(attributeUrls[index], options.i3s?.token);\n const attributeName = attributeStorageInfo[index].name;\n const attributeType = getAttributeValueType(attributeStorageInfo[index]);\n const loadOptions = { ...options, attributeName, attributeType };\n const promise = load(url, I3SAttributeLoader, loadOptions);\n attributeLoadPromises.push(promise);\n }\n try {\n attributes = await Promise.allSettled(attributeLoadPromises);\n }\n catch (error) {\n // do nothing\n }\n if (!attributes.length) {\n return null;\n }\n return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);\n}\n/**\n * Gets attributes data from tile.\n * @param tile\n * @returns\n */\nfunction getAttributesData(tile) {\n const attributeStorageInfo = tile.tileset?.tileset?.attributeStorageInfo;\n const attributeUrls = tile.header?.attributeUrls;\n const tilesetFields = tile.tileset?.tileset?.fields || [];\n return { attributeStorageInfo, attributeUrls, tilesetFields };\n}\n/**\n * Get attribute value type based on property names\n * @param {Object} attribute\n * @returns {String}\n */\nexport function getAttributeValueType(attribute) {\n if (attribute.hasOwnProperty('objectIds')) {\n return 'Oid32';\n }\n else if (attribute.hasOwnProperty('attributeValues')) {\n return attribute.attributeValues.valueType;\n }\n return '';\n}\n/**\n * Find in attributeStorageInfo attribute name responsible for feature ids list.\n * @param attributeStorageInfo\n * @returns Feature ids attribute name\n */\nfunction getFeatureIdsAttributeName(attributeStorageInfo) {\n const objectIdsAttribute = attributeStorageInfo.find(attribute => attribute.name.includes('OBJECTID'));\n return objectIdsAttribute?.name;\n}\n/**\n * Generates mapping featureId to feature attributes\n * @param {Array} attributes\n * @param {Object} attributeStorageInfo\n * @param {number} featureId\n * @returns {Object}\n */\nfunction generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields) {\n const objectIdsAttributeName = getFeatureIdsAttributeName(attributeStorageInfo);\n const objectIds = attributes.find((attribute) => attribute.value[objectIdsAttributeName]);\n if (!objectIds) {\n return null;\n }\n const attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);\n if (attributeIndex < 0) {\n return null;\n }\n return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);\n}\n/**\n * Generates attribute object for feature mapping by feature id\n * @param {Array} attributes\n * @param {Number} featureIdIndex\n * @param {Object} attributeStorageInfo\n * @returns {Object}\n */\nfunction getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo, tilesetFields) {\n const attributesObject = {};\n for (let index = 0; index < attributeStorageInfo.length; index++) {\n const attributeName = attributeStorageInfo[index].name;\n const codedValues = getAttributeCodedValues(attributeName, tilesetFields);\n const attribute = getAttributeByIndexAndAttributeName(attributes, index, attributeName);\n attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex, codedValues);\n }\n return attributesObject;\n}\n/**\n * Get coded values list from tileset.\n * @param attributeName\n * @param tilesetFields\n */\nfunction getAttributeCodedValues(attributeName, tilesetFields) {\n const attributeField = tilesetFields\n .find(field => field.name === attributeName || field.alias === attributeName);\n return attributeField?.domain?.codedValues || [];\n}\n/**\n * Return attribute value if it presents in atrributes list\n * @param {array} attributes\n * @param {number} index\n * @param {string} attributesName\n */\nfunction getAttributeByIndexAndAttributeName(attributes, index, attributesName) {\n const attributeObject = attributes[index];\n if (attributeObject.status === REJECTED_STATUS) {\n return null;\n }\n return attributeObject.value[attributesName];\n}\n/**\n * Do formatting of attribute values or return empty string.\n * @param {Array} attribute\n * @param {Number} featureIdIndex\n * @returns {String}\n */\nfunction formatAttributeValue(attribute, featureIdIndex, codedValues) {\n let value = EMPTY_VALUE;\n if (attribute && (featureIdIndex in attribute)) {\n // eslint-disable-next-line no-control-regex\n value = String(attribute[featureIdIndex]).replace(/\\u0000|NaN/g, '').trim();\n }\n // Check if coded values are existed. If so we use them.\n if (codedValues.length) {\n const codeValue = codedValues.find(codedValue => codedValue.code === Number(value));\n value = codeValue?.name || EMPTY_VALUE;\n }\n return value;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { STRING_ATTRIBUTE_TYPE, OBJECT_ID_ATTRIBUTE_TYPE, FLOAT_64_TYPE, INT_16_ATTRIBUTE_TYPE } from \"./constants.js\";\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, options) {\n const { attributeName, attributeType } = options;\n if (!attributeName) {\n return {};\n }\n return {\n [attributeName]: attributeType ? parseAttribute(attributeType, arrayBuffer) : null\n };\n}\n/**\n * Parse attributes based on attribute type.\n * @param {String} attributeType\n * @param arrayBuffer\n * @returns\n */\nfunction parseAttribute(attributeType, arrayBuffer) {\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 * 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) {\n const countOffset = 4;\n return new Uint32Array(arrayBuffer, countOffset);\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) {\n const countOffset = 4;\n return new Int16Array(arrayBuffer, countOffset);\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) {\n const countOffset = 8;\n return new Float64Array(arrayBuffer, countOffset);\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) {\n const stringsCountOffset = 0;\n const dataOffset = 8;\n const bytesPerStringSize = 4;\n const stringsArray = [];\n try {\n // Use DataView to avoid multiple of 4 error on Uint32Array constructor\n const stringsCount = new DataView(arrayBuffer, stringsCountOffset, bytesPerStringSize).getUint32(stringsCountOffset, true);\n const stringSizes = new Uint32Array(arrayBuffer, dataOffset, stringsCount);\n let stringOffset = dataOffset + stringsCount * bytesPerStringSize;\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 }\n catch (error) {\n console.error('Parse string attribute error: ', error.message); // eslint-disable-line\n }\n return stringsArray;\n}\n", "const OBJECT_3D_LAYER_TYPE = '3DObject';\n/**\n * Parses Builiding Scene Layer and creates tileset\n * @param data\n * @param options\n * @param context\n */\nexport async function parseBuildingSceneLayer(data, url) {\n const layer0 = JSON.parse(new TextDecoder().decode(data));\n const { sublayers } = layer0;\n return {\n header: layer0,\n sublayers: parseSublayersTree(sublayers, url)\n };\n}\n/**\n * Recursively parses Building Scene Layer sublayers.\n * @param sublayers\n * @param url\n */\nfunction parseSublayersTree(sublayers, url) {\n let layers = [];\n for (let index = 0; index < sublayers.length; index++) {\n const subLayer = sublayers[index];\n const { id, layerType, visibility = true, ...rest } = subLayer;\n // Add support only for 3DObject layer type for I3S purposes.\n if (layerType === OBJECT_3D_LAYER_TYPE) {\n const sublayerUrl = `${url}/sublayers/${id}`;\n layers.push({\n url: sublayerUrl,\n id,\n layerType,\n visibility,\n ...rest\n });\n }\n if (subLayer?.sublayers?.length) {\n layers = [...layers, ...parseSublayersTree(subLayer.sublayers, url)];\n }\n }\n return layers;\n}\n", "import { parseBuildingSceneLayer } from \"./lib/parsers/parse-i3s-building-scene-layer.js\";\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.2.3\" !== 'undefined' ? \"4.2.3\" : 'latest';\n/**\n * Loader for I3S - Building Scene Layer\n */\nexport const I3SBuildingSceneLayerLoader = {\n dataType: null,\n batchType: null,\n name: 'I3S Building Scene Layer',\n id: 'i3s-building-scene-layer',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/json'],\n parse,\n extensions: ['json'],\n options: {}\n};\nasync function parse(data, options, context) {\n if (!context?.url) {\n throw new Error('Url is not provided');\n }\n return parseBuildingSceneLayer(data, context.url);\n}\n", "import { JSONLoader, load } from '@loaders.gl/core';\n/**\n * WKID, or Well-Known ID, of the CRS. Specify either WKID or WKT of the CRS.\n * Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/spatialReference.cmn.md\n */\nconst SUPPORTED_WKID = 4326;\nconst ARCGIS_SCENE_SERVER_LAYER_TYPE = 'ArcGISSceneServiceLayer';\nconst BUILDING_SCENE_LAYER = 'BuildingSceneLayer';\nconst INTEGRATED_MESH_LAYER = 'IntegratedMeshLayer';\nconst GROUP_LAYER = 'GroupLayer';\n/**\n * Supported layers list\n * Possible operational layers in WebScene: https://developers.arcgis.com/web-scene-specification/objects/operationalLayers/\n */\nconst SUPPORTED_LAYERS_TYPES = [\n ARCGIS_SCENE_SERVER_LAYER_TYPE,\n INTEGRATED_MESH_LAYER,\n BUILDING_SCENE_LAYER,\n GROUP_LAYER\n];\nconst NO_AVAILABLE_SUPPORTED_LAYERS_ERROR = 'NO_AVAILABLE_SUPPORTED_LAYERS_ERROR';\nconst NOT_SUPPORTED_CRS_ERROR = 'NOT_SUPPORTED_CRS_ERROR';\n/**\n * Provides additional information in the exception Error object, e.g. unsupported layer types.\n * @param message - message used in the Error object\n * @param details - additional information that can be used to handle the exception.\n * @example throw new LayerError(NO_AVAILABLE_SUPPORTED_LAYERS_ERROR, unsupportedLayers);\n */\nexport class LayerError extends Error {\n details;\n constructor(message, details) {\n super(message);\n this.details = details;\n this.name = 'LayerError';\n }\n}\n/**\n * Parses ArcGIS WebScene\n * @param data\n */\nexport async function parseWebscene(data) {\n const layer0 = JSON.parse(new TextDecoder().decode(data));\n const { operationalLayers } = layer0;\n const { layers, unsupportedLayers } = await parseOperationalLayers(operationalLayers, true);\n if (!layers.length) {\n throw new LayerError(NO_AVAILABLE_SUPPORTED_LAYERS_ERROR, unsupportedLayers);\n }\n return {\n header: layer0,\n layers,\n unsupportedLayers\n };\n}\n/**\n * Recursively parses WebScene operational layers.\n * @param layersList\n */\nasync function parseOperationalLayers(layersList, needToCheckCRS) {\n const layers = [];\n let unsupportedLayers = [];\n for (let index = 0; index < layersList.length; index++) {\n const layer = layersList[index];\n const isLayerSupported = SUPPORTED_LAYERS_TYPES.includes(layer.layerType);\n if (isLayerSupported) {\n if (needToCheckCRS && layer.layerType !== GROUP_LAYER) {\n await checkSupportedIndexCRS(layer);\n needToCheckCRS = false;\n }\n layers.push(layer);\n }\n else {\n unsupportedLayers.push(layer);\n }\n if (layer.layers?.length) {\n const { layers: childLayers, unsupportedLayers: childUnsupportedLayers } = await parseOperationalLayers(layer.layers, needToCheckCRS);\n layer.layers = childLayers;\n unsupportedLayers = [...unsupportedLayers, ...childUnsupportedLayers];\n }\n }\n return { layers, unsupportedLayers };\n}\n/**\n * Check if layer has supported CRS\n * @param layer\n */\nasync function checkSupportedIndexCRS(layer) {\n try {\n const layerJson = await load(layer.url, JSONLoader);\n // @ts-expect-error\n const wkid = layerJson?.spatialReference?.wkid;\n if (wkid !== SUPPORTED_WKID) {\n throw new Error(NOT_SUPPORTED_CRS_ERROR);\n }\n }\n catch (error) {\n throw error;\n }\n}\n", "import { parseWebscene } from \"./lib/parsers/parse-arcgis-webscene.js\";\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.2.3\" !== 'undefined' ? \"4.2.3\" : 'latest';\n/**\n * Loader for ArcGIS WebScene\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/webscene/\n */\nexport const ArcGISWebSceneLoader = {\n dataType: null,\n batchType: null,\n name: 'ArcGIS Web Scene Loader',\n id: 'arcgis-web-scene',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/json'],\n parse,\n extensions: ['json'],\n options: {}\n};\n/**\n * Parse ArcGIS webscene\n * @param data\n */\nasync function parse(data) {\n return parseWebscene(data);\n}\n", "import { load } from '@loaders.gl/core';\nimport { getAttributeValueType, I3SAttributeLoader } from \"../../i3s-attribute-loader.js\";\nimport { getUrlWithToken } from \"./url-utils.js\";\n/**\n * Calculate new vertex colors array to visualize 3D objects in a attribute driven way\n * @param colors - vertex colors attribute\n * @param featureIds - feature Ids attribute\n * @param attributeUrls - array of attribute's urls\n * @param fields - array of attribute's fileds\n * @param attributeStorageInfo - array of attributeStorageInfo\n * @param colorsByAttribute - attribute color options\n * @param token - access token\n * @returns new colors attribute\n */\n// eslint-disable-next-line max-params\nexport async function customizeColors(colors, featureIds, attributeUrls, fields, attributeStorageInfo, colorsByAttribute, token) {\n if (!colorsByAttribute) {\n return colors;\n }\n const resultColors = {\n ...colors,\n value: new Uint8Array(colors.value)\n };\n const colorizeAttributeField = fields.find(({ name }) => name === colorsByAttribute?.attributeName);\n if (!colorizeAttributeField ||\n !['esriFieldTypeDouble', 'esriFieldTypeInteger', 'esriFieldTypeSmallInteger'].includes(colorizeAttributeField.type)) {\n return colors;\n }\n const colorizeAttributeData = await loadFeatureAttributeData(colorizeAttributeField.name, attributeUrls, attributeStorageInfo, token);\n if (!colorizeAttributeData) {\n return colors;\n }\n const objectIdField = fields.find(({ type }) => type === 'esriFieldTypeOID');\n if (!objectIdField) {\n return colors;\n }\n const objectIdAttributeData = await loadFeatureAttributeData(objectIdField.name, attributeUrls, attributeStorageInfo, token);\n if (!objectIdAttributeData) {\n return colors;\n }\n const attributeValuesMap = {};\n // @ts-expect-error\n for (let i = 0; i < objectIdAttributeData[objectIdField.name].length; i++) {\n // @ts-expect-error\n attributeValuesMap[objectIdAttributeData[objectIdField.name][i]] = calculateColorForAttribute(\n // @ts-expect-error\n colorizeAttributeData[colorizeAttributeField.name][i], colorsByAttribute);\n }\n for (let i = 0; i < featureIds.length; i++) {\n const color = attributeValuesMap[featureIds[i]];\n if (!color) {\n continue; // eslint-disable-line no-continue\n }\n /* eslint max-statements: [\"error\", 30] */\n /* eslint complexity: [\"error\", 12] */\n if (colorsByAttribute.mode === 'multiply') {\n // multiplying original mesh and calculated for attribute rgba colors in range 0-255\n color.forEach((colorItem, index) => {\n resultColors.value[i * 4 + index] = (resultColors.value[i * 4 + index] * colorItem) / 255;\n });\n }\n else {\n resultColors.value.set(color, i * 4);\n }\n }\n return resultColors;\n}\n/**\n * Calculate rgba color from the attribute value\n * @param attributeValue - value of the attribute\n * @param colorsByAttribute - attribute color options\n * @returns - color array for a specific attribute value\n */\nfunction calculateColorForAttribute(attributeValue, colorsByAttribute) {\n if (!colorsByAttribute) {\n return [255, 255, 255, 255];\n }\n const { minValue, maxValue, minColor, maxColor } = colorsByAttribute;\n const rate = (attributeValue - minValue) / (maxValue - minValue);\n const color = [255, 255, 255, 255];\n for (let i = 0; i < minColor.length; i++) {\n color[i] = Math.round((maxColor[i] - minColor[i]) * rate + minColor[i]);\n }\n return color;\n}\n/**\n * Load feature attribute data from the ArcGIS rest service\n * @param attributeName - attribute name\n * @param attributeUrls - array of attribute's urls\n * @param attributeStorageInfo - array of attributeStorageInfo\n * @param token - access token\n * @returns - Array-like list of the attribute values\n */\nasync function loadFeatureAttributeData(attributeName, attributeUrls, attributeStorageInfo, token) {\n const attributeIndex = attributeStorageInfo.findIndex(({ name }) => attributeName === name);\n if (attributeIndex === -1) {\n return null;\n }\n const objectIdAttributeUrl = getUrlWithToken(attributeUrls[attributeIndex], token);\n const attributeType = getAttributeValueType(attributeStorageInfo[attributeIndex]);\n const objectIdAttributeData = await load(objectIdAttributeUrl, I3SAttributeLoader, {\n attributeName,\n attributeType\n });\n return objectIdAttributeData;\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,kBAAmB;AACZ,SAAS,4BAA4B,UAAU;AAClD,UAAQ,UAAU;AAAA,IACd,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX;AACI,YAAM,IAAI,MAAM,iDAAiD,UAAU;AAAA,EACnF;AACJ;AACO,IAAM,cAAc;AAAA,EACvB,OAAO,eAAG;AAAA,EACV,QAAQ,eAAG;AAAA,EACX,SAAS,eAAG;AAAA,EACZ,QAAQ,eAAG;AAAA,EACX,QAAQ,eAAG;AACf;AAMO,SAAS,OAAO,UAAU;AAC7B,UAAQ,UAAU;AAAA,IACd,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AAAA,IACL,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACD,aAAO;AAAA,IACX;AACI,YAAM,IAAI,MAAM,iDAAiD,UAAU;AAAA,EACnF;AACJ;AACO,IAAM,wBAAwB;AAC9B,IAAM,2BAA2B;AACjC,IAAM,gBAAgB;AACtB,IAAM,wBAAwB;AAG9B,IAAI;AAAA,CACV,SAAUA,oBAAmB;AAI1B,EA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sB,oBAAoB;AAAA,IAC/E;AAAA,IACA;AAAA,EACJ,CAAC;AACD,SAAO;AACX;",
|
|
6
6
|
"names": ["COORDINATE_SYSTEM", "import_core", "import_core", "HeaderAttributeProperty", "arrayBuffer", "options", "parse", "import_geospatial", "import_core", "import_core", "import_textures", "VERSION", "VERSION", "import_loader_utils", "import_zip", "VERSION", "import_core", "VERSION", "VERSION", "parse", "import_core", "VERSION", "parse", "import_core"]
|
|
7
7
|
}
|