@loaders.gl/i3s 3.4.13 → 3.4.15
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/dist.min.js +124 -111
- package/dist/es5/arcgis-webscene-loader.js +5 -22
- package/dist/es5/arcgis-webscene-loader.js.map +1 -1
- package/dist/es5/bundle.js +1 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/i3s-attribute-loader.js +58 -123
- package/dist/es5/i3s-attribute-loader.js.map +1 -1
- package/dist/es5/i3s-building-scene-layer-loader.js +8 -28
- package/dist/es5/i3s-building-scene-layer-loader.js.map +1 -1
- package/dist/es5/i3s-content-loader.js +16 -35
- package/dist/es5/i3s-content-loader.js.map +1 -1
- package/dist/es5/i3s-loader.js +49 -148
- package/dist/es5/i3s-loader.js.map +1 -1
- package/dist/es5/i3s-node-page-loader.js +8 -39
- package/dist/es5/i3s-node-page-loader.js.map +1 -1
- package/dist/es5/i3s-slpk-loader.js +2 -2
- package/dist/es5/i3s-slpk-loader.js.map +1 -1
- package/dist/es5/index.js +8 -8
- package/dist/es5/lib/helpers/i3s-nodepages-tiles.js +161 -267
- package/dist/es5/lib/helpers/i3s-nodepages-tiles.js.map +1 -1
- package/dist/es5/lib/parsers/constants.js +6 -6
- package/dist/es5/lib/parsers/constants.js.map +1 -1
- package/dist/es5/lib/parsers/parse-arcgis-webscene.js +64 -146
- package/dist/es5/lib/parsers/parse-arcgis-webscene.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-attribute.js +26 -55
- package/dist/es5/lib/parsers/parse-i3s-attribute.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js +27 -47
- package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js +278 -347
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s.js +55 -79
- package/dist/es5/lib/parsers/parse-i3s.js.map +1 -1
- package/dist/es5/lib/parsers/parse-slpk/parse-slpk.js +30 -81
- package/dist/es5/lib/parsers/parse-slpk/parse-slpk.js.map +1 -1
- package/dist/es5/lib/parsers/parse-slpk/slpk-archieve.js +44 -90
- package/dist/es5/lib/parsers/parse-slpk/slpk-archieve.js.map +1 -1
- package/dist/es5/lib/parsers/parse-zip/cd-file-header.js +17 -17
- package/dist/es5/lib/parsers/parse-zip/cd-file-header.js.map +1 -1
- package/dist/es5/lib/parsers/parse-zip/local-file-header.js +10 -10
- package/dist/es5/lib/parsers/parse-zip/local-file-header.js.map +1 -1
- package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js +4 -6
- package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -1
- package/dist/es5/lib/utils/customizeColors.js +79 -140
- package/dist/es5/lib/utils/customizeColors.js.map +1 -1
- package/dist/es5/lib/utils/url-utils.js +14 -11
- package/dist/es5/lib/utils/url-utils.js.map +1 -1
- package/dist/es5/types.js +2 -2
- package/dist/esm/arcgis-webscene-loader.js +1 -1
- package/dist/esm/i3s-attribute-loader.js +1 -1
- package/dist/esm/i3s-building-scene-layer-loader.js +1 -1
- package/dist/esm/i3s-content-loader.js +1 -1
- package/dist/esm/i3s-loader.js +1 -1
- package/dist/esm/i3s-node-page-loader.js +1 -1
- package/dist/esm/i3s-slpk-loader.js +1 -1
- package/dist/i3s-content-nodejs-worker.js +61 -59
- package/dist/i3s-content-nodejs-worker.js.map +3 -3
- package/dist/i3s-content-worker.js +69 -81
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customizeColors.js","names":["_core","require","_i3sAttributeLoader","_urlUtils","customizeColors","_x","_x2","_x3","_x4","_x5","_customizeColors","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","colors","featureIds","tileOptions","tilesetOptions","options","_options$i3s2","colorizeAttributeField","colorizeAttributeData","objectIdField","objectIdAttributeData","attributeValuesMap","i","_i","color","wrap","_callee$","_context","prev","next","i3s","colorsByAttribute","abrupt","fields","find","_ref3","_options$i3s3","_options$i3s3$colorsB","name","attributeName","includes","type","loadFeatureAttributeData","sent","_ref4","length","calculateColorForAttribute","value","set","stop","attributeValue","_options$i3s","_options$i3s$colorsBy","minValue","maxValue","minColor","maxColor","rate","Math","round","_x6","_x7","_x8","_x9","_loadFeatureAttributeData","_callee2","_ref","_ref2","_options$i3s4","attributeUrls","attributeStorageInfo","attributeIndex","objectIdAttributeUrl","attributeType","_callee2$","_context2","findIndex","_ref5","getUrlWithToken","token","getAttributeValueType","load","I3SAttributeLoader"],"sources":["../../../../src/lib/utils/customizeColors.ts"],"sourcesContent":["import type {MeshAttribute} from '@loaders.gl/schema';\nimport type {COLOR, I3STileOptions, I3STilesetOptions} from '../../types';\n\nimport {load} from '@loaders.gl/core';\nimport {getAttributeValueType, I3SAttributeLoader} from '../../i3s-attribute-loader';\nimport {I3SLoaderOptions} from '../../i3s-loader';\nimport {getUrlWithToken} from '../utils/url-utils';\n\n/**\n * Modify 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 tileOptions - tile - related options\n * @param tilesetOptions - tileset-related options\n * @param options - loader options\n * @returns midified colors attribute\n */\nexport async function customizeColors(\n colors: MeshAttribute,\n featureIds: MeshAttribute,\n tileOptions: I3STileOptions,\n tilesetOptions: I3STilesetOptions,\n options?: I3SLoaderOptions\n): Promise<MeshAttribute> {\n if (!options?.i3s?.colorsByAttribute) {\n return colors;\n }\n\n const colorizeAttributeField = tilesetOptions.fields.find(\n ({name}) => name === options?.i3s?.colorsByAttribute?.attributeName\n );\n if (\n !colorizeAttributeField ||\n !['esriFieldTypeDouble', 'esriFieldTypeInteger', 'esriFieldTypeSmallInteger'].includes(\n colorizeAttributeField.type\n )\n ) {\n return colors;\n }\n\n const colorizeAttributeData = await loadFeatureAttributeData(\n colorizeAttributeField.name,\n tileOptions,\n tilesetOptions,\n options\n );\n if (!colorizeAttributeData) {\n return colors;\n }\n\n const objectIdField = tilesetOptions.fields.find(({type}) => type === 'esriFieldTypeOID');\n if (!objectIdField) {\n return colors;\n }\n\n const objectIdAttributeData = await loadFeatureAttributeData(\n objectIdField.name,\n tileOptions,\n tilesetOptions,\n options\n );\n if (!objectIdAttributeData) {\n return colors;\n }\n\n const attributeValuesMap: {[key: number]: COLOR} = {};\n for (let i = 0; i < objectIdAttributeData[objectIdField.name].length; i++) {\n attributeValuesMap[objectIdAttributeData[objectIdField.name][i]] = calculateColorForAttribute(\n colorizeAttributeData[colorizeAttributeField.name][i] as number,\n options\n );\n }\n\n for (let i = 0; i < featureIds.value.length; i++) {\n const color = attributeValuesMap[featureIds.value[i]];\n if (!color) {\n continue; // eslint-disable-line no-continue\n }\n colors.value.set(color, i * 4);\n }\n\n return colors;\n}\n\n/**\n * Calculate rgba color from the attribute value\n * @param attributeValue - value of the attribute\n * @param options - loader options\n * @returns - color array for a specific attribute value\n */\nfunction calculateColorForAttribute(attributeValue: number, options?: I3SLoaderOptions): COLOR {\n if (!options?.i3s?.colorsByAttribute) {\n return [255, 255, 255, 255];\n }\n const {minValue, maxValue, minColor, maxColor} = options.i3s.colorsByAttribute;\n const rate = (attributeValue - minValue) / (maxValue - minValue);\n const color: 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/**\n * Load feature attribute data from the ArcGIS rest service\n * @param attributeName - attribute name\n * @param tileOptions - tile-related options\n * @param tilesetOptions - tileset-related options\n * @param options - loader options\n * @returns - Array-like list of the attribute values\n */\nasync function loadFeatureAttributeData(\n attributeName: string,\n {attributeUrls}: I3STileOptions,\n {attributeStorageInfo}: I3STilesetOptions,\n options?: I3SLoaderOptions\n): Promise<{[key: string]: string[] | Uint32Array | Uint16Array | Float64Array} | null> {\n const attributeIndex = attributeStorageInfo.findIndex(({name}) => attributeName === name);\n if (attributeIndex === -1) {\n return null;\n }\n const objectIdAttributeUrl = getUrlWithToken(attributeUrls[attributeIndex], options?.i3s?.token);\n const attributeType = getAttributeValueType(attributeStorageInfo[attributeIndex]);\n const objectIdAttributeData = await load(objectIdAttributeUrl, I3SAttributeLoader, {\n attributeName,\n attributeType\n });\n return objectIdAttributeData;\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AAAmD,SAW7BG,eAAeA,CAAAC,EAAA,EAAAC,GAAA,EAAAC,GAAA,EAAAC,GAAA,EAAAC,GAAA;EAAA,OAAAC,gBAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAAA,SAAAF,iBAAA;EAAAA,gBAAA,OAAAG,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAA9B,SAAAC,QACLC,MAAqB,EACrBC,UAAyB,EACzBC,WAA2B,EAC3BC,cAAiC,EACjCC,OAA0B;IAAA,IAAAC,aAAA;IAAA,IAAAC,sBAAA,EAAAC,qBAAA,EAAAC,aAAA,EAAAC,qBAAA,EAAAC,kBAAA,EAAAC,CAAA,EAAAC,EAAA,EAAAC,KAAA;IAAA,OAAAhB,YAAA,CAAAD,OAAA,CAAAkB,IAAA,UAAAC,SAAAC,QAAA;MAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;QAAA;UAAA,IAErBd,OAAO,aAAPA,OAAO,gBAAAC,aAAA,GAAPD,OAAO,CAAEe,GAAG,cAAAd,aAAA,eAAZA,aAAA,CAAce,iBAAiB;YAAAJ,QAAA,CAAAE,IAAA;YAAA;UAAA;UAAA,OAAAF,QAAA,CAAAK,MAAA,WAC3BrB,MAAM;QAAA;UAGTM,sBAAsB,GAAGH,cAAc,CAACmB,MAAM,CAACC,IAAI,CACvD,UAAAC,KAAA;YAAA,IAAAC,aAAA,E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AAC,SAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"customizeColors.js","names":["_core","require","_i3sAttributeLoader","_urlUtils","customizeColors","colors","featureIds","tileOptions","tilesetOptions","options","_options$i3s","i3s","colorsByAttribute","colorizeAttributeField","fields","find","_ref","_options$i3s2","_options$i3s2$colorsB","name","attributeName","includes","type","colorizeAttributeData","loadFeatureAttributeData","objectIdField","_ref2","objectIdAttributeData","attributeValuesMap","i","length","calculateColorForAttribute","value","color","set","attributeValue","_options$i3s3","minValue","maxValue","minColor","maxColor","rate","Math","round","_ref3","_ref4","_options$i3s4","attributeUrls","attributeStorageInfo","attributeIndex","findIndex","_ref5","objectIdAttributeUrl","getUrlWithToken","token","attributeType","getAttributeValueType","load","I3SAttributeLoader"],"sources":["../../../../src/lib/utils/customizeColors.ts"],"sourcesContent":["import type {MeshAttribute} from '@loaders.gl/schema';\nimport type {COLOR, I3STileOptions, I3STilesetOptions} from '../../types';\n\nimport {load} from '@loaders.gl/core';\nimport {getAttributeValueType, I3SAttributeLoader} from '../../i3s-attribute-loader';\nimport {I3SLoaderOptions} from '../../i3s-loader';\nimport {getUrlWithToken} from '../utils/url-utils';\n\n/**\n * Modify 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 tileOptions - tile - related options\n * @param tilesetOptions - tileset-related options\n * @param options - loader options\n * @returns midified colors attribute\n */\nexport async function customizeColors(\n colors: MeshAttribute,\n featureIds: MeshAttribute,\n tileOptions: I3STileOptions,\n tilesetOptions: I3STilesetOptions,\n options?: I3SLoaderOptions\n): Promise<MeshAttribute> {\n if (!options?.i3s?.colorsByAttribute) {\n return colors;\n }\n\n const colorizeAttributeField = tilesetOptions.fields.find(\n ({name}) => name === options?.i3s?.colorsByAttribute?.attributeName\n );\n if (\n !colorizeAttributeField ||\n !['esriFieldTypeDouble', 'esriFieldTypeInteger', 'esriFieldTypeSmallInteger'].includes(\n colorizeAttributeField.type\n )\n ) {\n return colors;\n }\n\n const colorizeAttributeData = await loadFeatureAttributeData(\n colorizeAttributeField.name,\n tileOptions,\n tilesetOptions,\n options\n );\n if (!colorizeAttributeData) {\n return colors;\n }\n\n const objectIdField = tilesetOptions.fields.find(({type}) => type === 'esriFieldTypeOID');\n if (!objectIdField) {\n return colors;\n }\n\n const objectIdAttributeData = await loadFeatureAttributeData(\n objectIdField.name,\n tileOptions,\n tilesetOptions,\n options\n );\n if (!objectIdAttributeData) {\n return colors;\n }\n\n const attributeValuesMap: {[key: number]: COLOR} = {};\n for (let i = 0; i < objectIdAttributeData[objectIdField.name].length; i++) {\n attributeValuesMap[objectIdAttributeData[objectIdField.name][i]] = calculateColorForAttribute(\n colorizeAttributeData[colorizeAttributeField.name][i] as number,\n options\n );\n }\n\n for (let i = 0; i < featureIds.value.length; i++) {\n const color = attributeValuesMap[featureIds.value[i]];\n if (!color) {\n continue; // eslint-disable-line no-continue\n }\n colors.value.set(color, i * 4);\n }\n\n return colors;\n}\n\n/**\n * Calculate rgba color from the attribute value\n * @param attributeValue - value of the attribute\n * @param options - loader options\n * @returns - color array for a specific attribute value\n */\nfunction calculateColorForAttribute(attributeValue: number, options?: I3SLoaderOptions): COLOR {\n if (!options?.i3s?.colorsByAttribute) {\n return [255, 255, 255, 255];\n }\n const {minValue, maxValue, minColor, maxColor} = options.i3s.colorsByAttribute;\n const rate = (attributeValue - minValue) / (maxValue - minValue);\n const color: 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/**\n * Load feature attribute data from the ArcGIS rest service\n * @param attributeName - attribute name\n * @param tileOptions - tile-related options\n * @param tilesetOptions - tileset-related options\n * @param options - loader options\n * @returns - Array-like list of the attribute values\n */\nasync function loadFeatureAttributeData(\n attributeName: string,\n {attributeUrls}: I3STileOptions,\n {attributeStorageInfo}: I3STilesetOptions,\n options?: I3SLoaderOptions\n): Promise<{[key: string]: string[] | Uint32Array | Uint16Array | Float64Array} | null> {\n const attributeIndex = attributeStorageInfo.findIndex(({name}) => attributeName === name);\n if (attributeIndex === -1) {\n return null;\n }\n const objectIdAttributeUrl = getUrlWithToken(attributeUrls[attributeIndex], options?.i3s?.token);\n const attributeType = getAttributeValueType(attributeStorageInfo[attributeIndex]);\n const objectIdAttributeData = await load(objectIdAttributeUrl, I3SAttributeLoader, {\n attributeName,\n attributeType\n });\n return objectIdAttributeData;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AAWO,eAAeG,eAAeA,CACnCC,MAAqB,EACrBC,UAAyB,EACzBC,WAA2B,EAC3BC,cAAiC,EACjCC,OAA0B,EACF;EAAA,IAAAC,YAAA;EACxB,IAAI,EAACD,OAAO,aAAPA,OAAO,gBAAAC,YAAA,GAAPD,OAAO,CAAEE,GAAG,cAAAD,YAAA,eAAZA,YAAA,CAAcE,iBAAiB,GAAE;IACpC,OAAOP,MAAM;EACf;EAEA,MAAMQ,sBAAsB,GAAGL,cAAc,CAACM,MAAM,CAACC,IAAI,CACvDC,IAAA;IAAA,IAAAC,aAAA,EAAAC,qBAAA;IAAA,IAAC;MAACC;IAAI,CAAC,GAAAH,IAAA;IAAA,OAAKG,IAAI,MAAKV,OAAO,aAAPA,OAAO,wBAAAQ,aAAA,GAAPR,OAAO,CAAEE,GAAG,cAAAM,aAAA,wBAAAC,qBAAA,GAAZD,aAAA,CAAcL,iBAAiB,cAAAM,qBAAA,uBAA/BA,qBAAA,CAAiCE,aAAa;EAAA,CACrE,CAAC;EACD,IACE,CAACP,sBAAsB,IACvB,CAAC,CAAC,qBAAqB,EAAE,sBAAsB,EAAE,2BAA2B,CAAC,CAACQ,QAAQ,CACpFR,sBAAsB,CAACS,IACzB,CAAC,EACD;IACA,OAAOjB,MAAM;EACf;EAEA,MAAMkB,qBAAqB,GAAG,MAAMC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,KAAKD,IAAI;EAAA,EAAC;EACzF,IAAI8B,cAAc,KAAK,CAAC,CAAC,EAAE;IACzB,OAAO,IAAI;EACb;EACA,MAAMG,oBAAoB,GAAG,IAAAC,yBAAe,EAACN,aAAa,CAACE,cAAc,CAAC,EAAExC,OAAO,aAAPA,OAAO,wBAAAqC,aAAA,GAAPrC,OAAO,CAAEE,GAAG,cAAAmC,aAAA,uBAAZA,aAAA,CAAcQ,KAAK,CAAC;EAChG,MAAMC,aAAa,GAAG,IAAAC,yCAAqB,EAACR,oBAAoB,CAACC,cAAc,CAAC,CAAC;EACjF,MAAMtB,qBAAqB,GAAG,MAAM,IAAA8B,UAAI,EAACL,oBAAoB,EAAEM,sCAAkB,EAAE;IACjFtC,aAAa;IACbmC;EACF,CAAC,CAAC;EACF,OAAO5B,qBAAqB;AAC9B"}
|
|
@@ -7,25 +7,28 @@ exports.generateTileAttributeUrls = generateTileAttributeUrls;
|
|
|
7
7
|
exports.generateTilesetAttributeUrls = generateTilesetAttributeUrls;
|
|
8
8
|
exports.getUrlWithToken = getUrlWithToken;
|
|
9
9
|
function getUrlWithToken(url) {
|
|
10
|
-
|
|
10
|
+
let token = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
11
11
|
return token ? "".concat(url, "?token=").concat(token) : url;
|
|
12
12
|
}
|
|
13
13
|
function generateTileAttributeUrls(url, tile) {
|
|
14
|
-
|
|
15
|
-
attributeData =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
const {
|
|
15
|
+
attributeData = []
|
|
16
|
+
} = tile;
|
|
17
|
+
const attributeUrls = [];
|
|
18
|
+
for (let index = 0; index < attributeData.length; index++) {
|
|
19
|
+
const attributeUrl = attributeData[index].href.replace('./', '');
|
|
19
20
|
attributeUrls.push("".concat(url, "/").concat(attributeUrl));
|
|
20
21
|
}
|
|
21
22
|
return attributeUrls;
|
|
22
23
|
}
|
|
23
24
|
function generateTilesetAttributeUrls(tileset, resource) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
const attributeUrls = [];
|
|
26
|
+
const {
|
|
27
|
+
attributeStorageInfo,
|
|
28
|
+
url
|
|
29
|
+
} = tileset;
|
|
30
|
+
for (let index = 0; index < attributeStorageInfo.length; index++) {
|
|
31
|
+
const fileName = attributeStorageInfo[index].key;
|
|
29
32
|
attributeUrls.push("".concat(url, "/nodes/").concat(resource, "/attributes/").concat(fileName, "/0"));
|
|
30
33
|
}
|
|
31
34
|
return attributeUrls;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url-utils.js","names":["getUrlWithToken","url","token","arguments","length","undefined","concat","generateTileAttributeUrls","tile","
|
|
1
|
+
{"version":3,"file":"url-utils.js","names":["getUrlWithToken","url","token","arguments","length","undefined","concat","generateTileAttributeUrls","tile","attributeData","attributeUrls","index","attributeUrl","href","replace","push","generateTilesetAttributeUrls","tileset","resource","attributeStorageInfo","fileName","key"],"sources":["../../../../src/lib/utils/url-utils.ts"],"sourcesContent":["import {Node3DIndexDocument} from '../../types';\n\n/**\n * Generates url with token if it is exists.\n * @param url\n * @param token\n * @returns\n */\nexport function getUrlWithToken(url: string, token: string | null = null): string {\n return token ? `${url}?token=${token}` : url;\n}\n\n/**\n * Generates attribute urls for tile.\n * @param tile\n * @returns list of attribute urls\n */\nexport function generateTileAttributeUrls(url: string, tile: Node3DIndexDocument): string[] {\n const {attributeData = []} = tile;\n const attributeUrls: string[] = [];\n\n for (let index = 0; index < attributeData.length; index++) {\n const attributeUrl = attributeData[index].href.replace('./', '');\n attributeUrls.push(`${url}/${attributeUrl}`);\n }\n\n return attributeUrls;\n}\n\n/**\n * Generates attribute urls for tileset based on tileset and resource\n * @param {Object} tileset\n * @param {number} resource\n * @returns {Array}\n */\nexport function generateTilesetAttributeUrls(tileset, resource) {\n const attributeUrls: string[] = [];\n const {attributeStorageInfo, url} = tileset;\n\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\n return attributeUrls;\n}\n"],"mappings":";;;;;;;;AAQO,SAASA,eAAeA,CAACC,GAAW,EAAuC;EAAA,IAArCC,KAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;EACtE,OAAOD,KAAK,MAAAI,MAAA,CAAML,GAAG,aAAAK,MAAA,CAAUJ,KAAK,IAAKD,GAAG;AAC9C;AAOO,SAASM,yBAAyBA,CAACN,GAAW,EAAEO,IAAyB,EAAY;EAC1F,MAAM;IAACC,aAAa,GAAG;EAAE,CAAC,GAAGD,IAAI;EACjC,MAAME,aAAuB,GAAG,EAAE;EAElC,KAAK,IAAIC,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGF,aAAa,CAACL,MAAM,EAAEO,KAAK,EAAE,EAAE;IACzD,MAAMC,YAAY,GAAGH,aAAa,CAACE,KAAK,CAAC,CAACE,IAAI,CAACC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;IAChEJ,aAAa,CAACK,IAAI,IAAAT,MAAA,CAAIL,GAAG,OAAAK,MAAA,CAAIM,YAAY,CAAE,CAAC;EAC9C;EAEA,OAAOF,aAAa;AACtB;AAQO,SAASM,4BAA4BA,CAACC,OAAO,EAAEC,QAAQ,EAAE;EAC9D,MAAMR,aAAuB,GAAG,EAAE;EAClC,MAAM;IAACS,oBAAoB;IAAElB;EAAG,CAAC,GAAGgB,OAAO;EAE3C,KAAK,IAAIN,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGQ,oBAAoB,CAACf,MAAM,EAAEO,KAAK,EAAE,EAAE;IAChE,MAAMS,QAAQ,GAAGD,oBAAoB,CAACR,KAAK,CAAC,CAACU,GAAG;IAChDX,aAAa,CAACK,IAAI,IAAAT,MAAA,CAAIL,GAAG,aAAAK,MAAA,CAAUY,QAAQ,kBAAAZ,MAAA,CAAec,QAAQ,OAAI,CAAC;EACzE;EAEA,OAAOV,aAAa;AACtB"}
|
package/dist/es5/types.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.HeaderAttributeProperty = exports.DATA_TYPE = void 0;
|
|
7
|
-
|
|
7
|
+
let DATA_TYPE = function (DATA_TYPE) {
|
|
8
8
|
DATA_TYPE["UInt8"] = "UInt8";
|
|
9
9
|
DATA_TYPE["UInt16"] = "UInt16";
|
|
10
10
|
DATA_TYPE["UInt32"] = "UInt32";
|
|
@@ -17,7 +17,7 @@ var DATA_TYPE = function (DATA_TYPE) {
|
|
|
17
17
|
return DATA_TYPE;
|
|
18
18
|
}({});
|
|
19
19
|
exports.DATA_TYPE = DATA_TYPE;
|
|
20
|
-
|
|
20
|
+
let HeaderAttributeProperty = function (HeaderAttributeProperty) {
|
|
21
21
|
HeaderAttributeProperty["vertexCount"] = "vertexCount";
|
|
22
22
|
HeaderAttributeProperty["featureCount"] = "featureCount";
|
|
23
23
|
return HeaderAttributeProperty;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseWebscene } from './lib/parsers/parse-arcgis-webscene';
|
|
2
|
-
const VERSION = typeof "3.4.
|
|
2
|
+
const VERSION = typeof "3.4.15" !== 'undefined' ? "3.4.15" : 'latest';
|
|
3
3
|
export const ArcGisWebSceneLoader = {
|
|
4
4
|
name: 'ArcGIS Web Scene Loader',
|
|
5
5
|
id: 'arcgis-web-scene',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { load } from '@loaders.gl/core';
|
|
2
2
|
import { parseI3STileAttribute } from './lib/parsers/parse-i3s-attribute';
|
|
3
3
|
import { getUrlWithToken } from './lib/utils/url-utils';
|
|
4
|
-
const VERSION = typeof "3.4.
|
|
4
|
+
const VERSION = typeof "3.4.15" !== 'undefined' ? "3.4.15" : 'latest';
|
|
5
5
|
const EMPTY_VALUE = '';
|
|
6
6
|
const REJECTED_STATUS = 'rejected';
|
|
7
7
|
export const I3SAttributeLoader = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseBuildingSceneLayer } from './lib/parsers/parse-i3s-building-scene-layer';
|
|
2
|
-
const VERSION = typeof "3.4.
|
|
2
|
+
const VERSION = typeof "3.4.15" !== 'undefined' ? "3.4.15" : 'latest';
|
|
3
3
|
export const I3SBuildingSceneLayerLoader = {
|
|
4
4
|
name: 'I3S Building Scene Layer',
|
|
5
5
|
id: 'i3s-building-scene-layer',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isBrowser } from '@loaders.gl/worker-utils';
|
|
2
2
|
import { parseI3STileContent } from './lib/parsers/parse-i3s-tile-content';
|
|
3
|
-
const VERSION = typeof "3.4.
|
|
3
|
+
const VERSION = typeof "3.4.15" !== 'undefined' ? "3.4.15" : 'latest';
|
|
4
4
|
export const I3SContentLoader = {
|
|
5
5
|
name: 'I3S Content (Indexed Scene Layers)',
|
|
6
6
|
id: isBrowser ? 'i3s-content' : 'i3s-content-nodejs',
|
package/dist/esm/i3s-loader.js
CHANGED
|
@@ -2,7 +2,7 @@ import { parse } from '@loaders.gl/core';
|
|
|
2
2
|
import { I3SContentLoader } from './i3s-content-loader';
|
|
3
3
|
import { normalizeTileData, normalizeTilesetData } from './lib/parsers/parse-i3s';
|
|
4
4
|
import { COORDINATE_SYSTEM } from './lib/parsers/constants';
|
|
5
|
-
const VERSION = typeof "3.4.
|
|
5
|
+
const VERSION = typeof "3.4.15" !== 'undefined' ? "3.4.15" : 'latest';
|
|
6
6
|
const TILESET_REGEX = /layers\/[0-9]+$/;
|
|
7
7
|
const TILE_HEADER_REGEX = /nodes\/([0-9-]+|root)$/;
|
|
8
8
|
const SLPK_HEX = '504b0304';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseSLPK } from './lib/parsers/parse-slpk/parse-slpk';
|
|
2
|
-
const VERSION = typeof "3.4.
|
|
2
|
+
const VERSION = typeof "3.4.15" !== 'undefined' ? "3.4.15" : 'latest';
|
|
3
3
|
export const SLPKLoader = {
|
|
4
4
|
name: 'I3S SLPK (Scene Layer Package)',
|
|
5
5
|
id: 'slpk',
|