@loaders.gl/i3s 3.4.9 → 3.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es5/arcgis-webscene-loader.js +1 -1
- package/dist/es5/arcgis-webscene-loader.js.map +1 -1
- package/dist/es5/i3s-attribute-loader.js +1 -1
- package/dist/es5/i3s-attribute-loader.js.map +1 -1
- package/dist/es5/i3s-building-scene-layer-loader.js +1 -1
- package/dist/es5/i3s-building-scene-layer-loader.js.map +1 -1
- package/dist/es5/i3s-content-loader.js +1 -1
- package/dist/es5/i3s-content-loader.js.map +1 -1
- package/dist/es5/i3s-loader.js +1 -1
- package/dist/es5/i3s-loader.js.map +1 -1
- package/dist/es5/i3s-node-page-loader.js +1 -1
- package/dist/es5/i3s-node-page-loader.js.map +1 -1
- package/dist/es5/i3s-slpk-loader.js +1 -1
- package/dist/es5/i3s-slpk-loader.js.map +1 -1
- package/dist/esm/arcgis-webscene-loader.js +1 -1
- package/dist/esm/arcgis-webscene-loader.js.map +1 -1
- package/dist/esm/i3s-attribute-loader.js +1 -1
- package/dist/esm/i3s-attribute-loader.js.map +1 -1
- package/dist/esm/i3s-building-scene-layer-loader.js +1 -1
- package/dist/esm/i3s-building-scene-layer-loader.js.map +1 -1
- package/dist/esm/i3s-content-loader.js +1 -1
- package/dist/esm/i3s-content-loader.js.map +1 -1
- package/dist/esm/i3s-loader.js +1 -1
- package/dist/esm/i3s-loader.js.map +1 -1
- package/dist/esm/i3s-node-page-loader.js +1 -1
- package/dist/esm/i3s-node-page-loader.js.map +1 -1
- package/dist/esm/i3s-slpk-loader.js +1 -1
- package/dist/esm/i3s-slpk-loader.js.map +1 -1
- package/dist/i3s-content-nodejs-worker.js +43 -42
- package/dist/i3s-content-nodejs-worker.js.map +2 -2
- package/dist/i3s-content-worker.js +8 -8
- package/package.json +9 -9
|
@@ -8,7 +8,7 @@ exports.ArcGisWebSceneLoader = void 0;
|
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _parseArcgisWebscene = require("./lib/parsers/parse-arcgis-webscene");
|
|
11
|
-
var VERSION = typeof "3.4.
|
|
11
|
+
var VERSION = typeof "3.4.10" !== 'undefined' ? "3.4.10" : 'latest';
|
|
12
12
|
var ArcGisWebSceneLoader = {
|
|
13
13
|
name: 'ArcGIS Web Scene Loader',
|
|
14
14
|
id: 'arcgis-web-scene',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arcgis-webscene-loader.js","names":["_parseArcgisWebscene","require","VERSION","ArcGisWebSceneLoader","name","id","module","version","mimeTypes","parse","extensions","options","exports","_x","_parse","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","data","wrap","_callee$","_context","prev","next","abrupt","parseWebscene","stop"],"sources":["../../src/arcgis-webscene-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {ArcGisWebSceneData} from './types';\n\nimport {parseWebscene} from './lib/parsers/parse-arcgis-webscene';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/**\n * Loader for ArcGis WebScene\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/webscene/\n */\nexport const ArcGisWebSceneLoader: LoaderWithParser = {\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/**\n * Parse ArcGis webscene\n * @param data\n */\nasync function parse(data: ArrayBuffer): Promise<ArcGisWebSceneData> {\n return parseWebscene(data);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,oBAAA,GAAAC,OAAA;AAIA,IAAMC,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"arcgis-webscene-loader.js","names":["_parseArcgisWebscene","require","VERSION","ArcGisWebSceneLoader","name","id","module","version","mimeTypes","parse","extensions","options","exports","_x","_parse","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","data","wrap","_callee$","_context","prev","next","abrupt","parseWebscene","stop"],"sources":["../../src/arcgis-webscene-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {ArcGisWebSceneData} from './types';\n\nimport {parseWebscene} from './lib/parsers/parse-arcgis-webscene';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/**\n * Loader for ArcGis WebScene\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/webscene/\n */\nexport const ArcGisWebSceneLoader: LoaderWithParser = {\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/**\n * Parse ArcGis webscene\n * @param data\n */\nasync function parse(data: ArrayBuffer): Promise<ArcGisWebSceneData> {\n return parseWebscene(data);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,oBAAA,GAAAC,OAAA;AAIA,IAAMC,OAAO,GAAG,eAAkB,KAAK,WAAW,cAAiB,QAAQ;AAMpE,IAAMC,oBAAsC,GAAG;EACpDC,IAAI,EAAE,yBAAyB;EAC/BC,EAAE,EAAE,kBAAkB;EACtBC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEL,OAAO;EAChBM,SAAS,EAAE,CAAC,kBAAkB,CAAC;EAC/BC,KAAK,EAALA,KAAK;EACLC,UAAU,EAAE,CAAC,MAAM,CAAC;EACpBC,OAAO,EAAE,CAAC;AACZ,CAAC;AAACC,OAAA,CAAAT,oBAAA,GAAAA,oBAAA;AAAA,SAMaM,KAAKA,CAAAI,EAAA;EAAA,OAAAC,MAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAAA,SAAAF,OAAA;EAAAA,MAAA,OAAAG,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAApB,SAAAC,QAAqBC,IAAiB;IAAA,OAAAH,YAAA,CAAAD,OAAA,CAAAK,IAAA,UAAAC,SAAAC,QAAA;MAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;QAAA;UAAA,OAAAF,QAAA,CAAAG,MAAA,WAC7B,IAAAC,kCAAa,EAACP,IAAI,CAAC;QAAA;QAAA;UAAA,OAAAG,QAAA,CAAAK,IAAA;MAAA;IAAA,GAAAT,OAAA;EAAA,CAC3B;EAAA,OAAAP,MAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA"}
|
|
@@ -15,7 +15,7 @@ var _parseI3sAttribute = require("./lib/parsers/parse-i3s-attribute");
|
|
|
15
15
|
var _urlUtils = require("./lib/utils/url-utils");
|
|
16
16
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
17
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
|
-
var VERSION = typeof "3.4.
|
|
18
|
+
var VERSION = typeof "3.4.10" !== 'undefined' ? "3.4.10" : 'latest';
|
|
19
19
|
var EMPTY_VALUE = '';
|
|
20
20
|
var REJECTED_STATUS = 'rejected';
|
|
21
21
|
var I3SAttributeLoader = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-attribute-loader.js","names":["_core","require","_parseI3sAttribute","_urlUtils","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","VERSION","EMPTY_VALUE","REJECTED_STATUS","I3SAttributeLoader","name","id","module","version","mimeTypes","parse","extensions","options","binary","exports","_x","_x2","_parse","_asyncToGenerator2","_regenerator","mark","_callee","data","wrap","_callee$","_context","prev","next","parseI3STileAttribute","abrupt","stop","loadFeatureAttributes","_x3","_x4","_loadFeatureAttributes","_callee2","tile","featureId","_getAttributesData","attributeStorageInfo","attributeUrls","tilesetFields","attributes","attributeLoadPromises","index","_options$i3s","url","attributeName","attributeType","loadOptions","promise","_args2","_callee2$","_context2","undefined","getAttributesData","getUrlWithToken","i3s","token","getAttributeValueType","load","Promise","allSettled","sent","t0","generateAttributesByFeatureId","_tile$tileset","_tile$tileset$tileset","_tile$header","_tile$tileset2","_tile$tileset2$tilese","tileset","header","fields","attribute","hasOwnProperty","attributeValues","valueType","getFeatureIdsAttributeName","objectIdsAttribute","find","includes","objectIdsAttributeName","objectIds","value","attributeIndex","indexOf","getFeatureAttributesByIndex","featureIdIndex","attributesObject","codedValues","getAttributeCodedValues","getAttributeByIndexAndAttributeName","formatAttributeValue","_attributeField$domai","attributeField","field","alias","domain","attributesName","attributeObject","status","String","replace","trim","codeValue","codedValue","code","Number"],"sources":["../../src/i3s-attribute-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {load} from '@loaders.gl/core';\nimport {parseI3STileAttribute} from './lib/parsers/parse-i3s-attribute';\nimport {getUrlWithToken} from './lib/utils/url-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\nconst EMPTY_VALUE = '';\nconst REJECTED_STATUS = 'rejected';\n/**\n * Loader for I3S attributes\n */\nexport const I3SAttributeLoader: LoaderWithParser = {\n name: 'I3S Attribute',\n id: 'i3s-attribute',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/binary'],\n parse,\n extensions: ['bin'],\n options: {},\n binary: true\n};\n\nasync function parse(data, options) {\n data = parseI3STileAttribute(data, options);\n return data;\n}\n\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\n if (!attributeStorageInfo || !attributeUrls || featureId < 0) {\n return null;\n }\n\n let attributes: object[] = [];\n const attributeLoadPromises: Promise<object>[] = [];\n\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\n attributeLoadPromises.push(promise);\n }\n try {\n attributes = await Promise.allSettled(attributeLoadPromises);\n } catch (error) {\n // do nothing\n }\n\n if (!attributes.length) {\n return null;\n }\n\n return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);\n}\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\n return {attributeStorageInfo, attributeUrls, tilesetFields};\n}\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 } else if (attribute.hasOwnProperty('attributeValues')) {\n return attribute.attributeValues.valueType;\n }\n return '';\n}\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\n return objectIdsAttribute?.name;\n}\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\n if (!objectIds) {\n return null;\n }\n\n const attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);\n\n if (attributeIndex < 0) {\n return null;\n }\n\n return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);\n}\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\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\n return attributesObject;\n}\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\n return attributeField?.domain?.codedValues || [];\n}\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\n if (attributeObject.status === REJECTED_STATUS) {\n return null;\n }\n\n return attributeObject.value[attributesName];\n}\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\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\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\n return value;\n}\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAAsD,SAAAG,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAA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;EAGA,IAAId,WAAW,CAAClG,MAAM,EAAE;IACtB,IAAMiH,SAAS,GAAGf,WAAW,CAACV,IAAI,CAAC,UAAA0B,UAAU;MAAA,OAAIA,UAAU,CAACC,IAAI,KAAKC,MAAM,CAACxB,KAAK,CAAC;IAAA,EAAC;IACnFA,KAAK,GAAG,CAAAqB,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEpG,IAAI,KAAIH,WAAW;EACxC;EAEA,OAAOkF,KAAK;AACd"}
|
|
1
|
+
{"version":3,"file":"i3s-attribute-loader.js","names":["_core","require","_parseI3sAttribute","_urlUtils","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","VERSION","EMPTY_VALUE","REJECTED_STATUS","I3SAttributeLoader","name","id","module","version","mimeTypes","parse","extensions","options","binary","exports","_x","_x2","_parse","_asyncToGenerator2","_regenerator","mark","_callee","data","wrap","_callee$","_context","prev","next","parseI3STileAttribute","abrupt","stop","loadFeatureAttributes","_x3","_x4","_loadFeatureAttributes","_callee2","tile","featureId","_getAttributesData","attributeStorageInfo","attributeUrls","tilesetFields","attributes","attributeLoadPromises","index","_options$i3s","url","attributeName","attributeType","loadOptions","promise","_args2","_callee2$","_context2","undefined","getAttributesData","getUrlWithToken","i3s","token","getAttributeValueType","load","Promise","allSettled","sent","t0","generateAttributesByFeatureId","_tile$tileset","_tile$tileset$tileset","_tile$header","_tile$tileset2","_tile$tileset2$tilese","tileset","header","fields","attribute","hasOwnProperty","attributeValues","valueType","getFeatureIdsAttributeName","objectIdsAttribute","find","includes","objectIdsAttributeName","objectIds","value","attributeIndex","indexOf","getFeatureAttributesByIndex","featureIdIndex","attributesObject","codedValues","getAttributeCodedValues","getAttributeByIndexAndAttributeName","formatAttributeValue","_attributeField$domai","attributeField","field","alias","domain","attributesName","attributeObject","status","String","replace","trim","codeValue","codedValue","code","Number"],"sources":["../../src/i3s-attribute-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {load} from '@loaders.gl/core';\nimport {parseI3STileAttribute} from './lib/parsers/parse-i3s-attribute';\nimport {getUrlWithToken} from './lib/utils/url-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\nconst EMPTY_VALUE = '';\nconst REJECTED_STATUS = 'rejected';\n/**\n * Loader for I3S attributes\n */\nexport const I3SAttributeLoader: LoaderWithParser = {\n name: 'I3S Attribute',\n id: 'i3s-attribute',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/binary'],\n parse,\n extensions: ['bin'],\n options: {},\n binary: true\n};\n\nasync function parse(data, options) {\n data = parseI3STileAttribute(data, options);\n return data;\n}\n\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\n if (!attributeStorageInfo || !attributeUrls || featureId < 0) {\n return null;\n }\n\n let attributes: object[] = [];\n const attributeLoadPromises: Promise<object>[] = [];\n\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\n attributeLoadPromises.push(promise);\n }\n try {\n attributes = await Promise.allSettled(attributeLoadPromises);\n } catch (error) {\n // do nothing\n }\n\n if (!attributes.length) {\n return null;\n }\n\n return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);\n}\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\n return {attributeStorageInfo, attributeUrls, tilesetFields};\n}\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 } else if (attribute.hasOwnProperty('attributeValues')) {\n return attribute.attributeValues.valueType;\n }\n return '';\n}\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\n return objectIdsAttribute?.name;\n}\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\n if (!objectIds) {\n return null;\n }\n\n const attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);\n\n if (attributeIndex < 0) {\n return null;\n }\n\n return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);\n}\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\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\n return attributesObject;\n}\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\n return attributeField?.domain?.codedValues || [];\n}\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\n if (attributeObject.status === REJECTED_STATUS) {\n return null;\n }\n\n return attributeObject.value[attributesName];\n}\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\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\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\n return value;\n}\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAAsD,SAAAG,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,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,WAAW;EAEvB,IAAIwE,SAAS,IAAKc,cAAc,IAAId,SAAU,EAAE;IAE9CU,KAAK,GAAGkB,MAAM,CAAC5B,SAAS,CAACc,cAAc,CAAC,CAAC,CAACe,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAACC,IAAI,CAAC,CAAC;EAC7E;EAGA,IAAId,WAAW,CAAClG,MAAM,EAAE;IACtB,IAAMiH,SAAS,GAAGf,WAAW,CAACV,IAAI,CAAC,UAAA0B,UAAU;MAAA,OAAIA,UAAU,CAACC,IAAI,KAAKC,MAAM,CAACxB,KAAK,CAAC;IAAA,EAAC;IACnFA,KAAK,GAAG,CAAAqB,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEpG,IAAI,KAAIH,WAAW;EACxC;EAEA,OAAOkF,KAAK;AACd"}
|
|
@@ -8,7 +8,7 @@ exports.I3SBuildingSceneLayerLoader = void 0;
|
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _parseI3sBuildingSceneLayer = require("./lib/parsers/parse-i3s-building-scene-layer");
|
|
11
|
-
var VERSION = typeof "3.4.
|
|
11
|
+
var VERSION = typeof "3.4.10" !== 'undefined' ? "3.4.10" : 'latest';
|
|
12
12
|
var I3SBuildingSceneLayerLoader = {
|
|
13
13
|
name: 'I3S Building Scene Layer',
|
|
14
14
|
id: 'i3s-building-scene-layer',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-building-scene-layer-loader.js","names":["_parseI3sBuildingSceneLayer","require","VERSION","I3SBuildingSceneLayerLoader","name","id","module","version","mimeTypes","parse","extensions","options","exports","_x","_x2","_x3","_parse","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","data","context","wrap","_callee$","_context","prev","next","url","Error","abrupt","parseBuildingSceneLayer","stop"],"sources":["../../src/i3s-building-scene-layer-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions, LoaderContext} from '@loaders.gl/loader-utils';\nimport type {BuildingSceneLayerTileset} from './types';\n\nimport {parseBuildingSceneLayer} from './lib/parsers/parse-i3s-building-scene-layer';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\n\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n/**\n * Loader for I3S - Building Scene Layer\n */\nexport const I3SBuildingSceneLayerLoader: LoaderWithParser = {\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};\n\nasync function parse(\n data: ArrayBuffer,\n options?: LoaderOptions,\n context?: LoaderContext\n): Promise<BuildingSceneLayerTileset> {\n if (!context?.url) {\n throw new Error('Url is not provided');\n }\n\n return parseBuildingSceneLayer(data, context.url);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,2BAAA,GAAAC,OAAA;AAKA,IAAMC,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"i3s-building-scene-layer-loader.js","names":["_parseI3sBuildingSceneLayer","require","VERSION","I3SBuildingSceneLayerLoader","name","id","module","version","mimeTypes","parse","extensions","options","exports","_x","_x2","_x3","_parse","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","data","context","wrap","_callee$","_context","prev","next","url","Error","abrupt","parseBuildingSceneLayer","stop"],"sources":["../../src/i3s-building-scene-layer-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions, LoaderContext} from '@loaders.gl/loader-utils';\nimport type {BuildingSceneLayerTileset} from './types';\n\nimport {parseBuildingSceneLayer} from './lib/parsers/parse-i3s-building-scene-layer';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\n\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n/**\n * Loader for I3S - Building Scene Layer\n */\nexport const I3SBuildingSceneLayerLoader: LoaderWithParser = {\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};\n\nasync function parse(\n data: ArrayBuffer,\n options?: LoaderOptions,\n context?: LoaderContext\n): Promise<BuildingSceneLayerTileset> {\n if (!context?.url) {\n throw new Error('Url is not provided');\n }\n\n return parseBuildingSceneLayer(data, context.url);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,2BAAA,GAAAC,OAAA;AAKA,IAAMC,OAAO,GAAG,eAAkB,KAAK,WAAW,cAAiB,QAAQ;AAIpE,IAAMC,2BAA6C,GAAG;EAC3DC,IAAI,EAAE,0BAA0B;EAChCC,EAAE,EAAE,0BAA0B;EAC9BC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEL,OAAO;EAChBM,SAAS,EAAE,CAAC,kBAAkB,CAAC;EAC/BC,KAAK,EAALA,KAAK;EACLC,UAAU,EAAE,CAAC,MAAM,CAAC;EACpBC,OAAO,EAAE,CAAC;AACZ,CAAC;AAACC,OAAA,CAAAT,2BAAA,GAAAA,2BAAA;AAAA,SAEaM,KAAKA,CAAAI,EAAA,EAAAC,GAAA,EAAAC,GAAA;EAAA,OAAAC,MAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAAA,SAAAF,OAAA;EAAAA,MAAA,OAAAG,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAApB,SAAAC,QACEC,IAAiB,EACjBb,OAAuB,EACvBc,OAAuB;IAAA,OAAAJ,YAAA,CAAAD,OAAA,CAAAM,IAAA,UAAAC,SAAAC,QAAA;MAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;QAAA;UAAA,IAElBL,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEM,GAAG;YAAAH,QAAA,CAAAE,IAAA;YAAA;UAAA;UAAA,MACT,IAAIE,KAAK,CAAC,qBAAqB,CAAC;QAAA;UAAA,OAAAJ,QAAA,CAAAK,MAAA,WAGjC,IAAAC,mDAAuB,EAACV,IAAI,EAAEC,OAAO,CAACM,GAAG,CAAC;QAAA;QAAA;UAAA,OAAAH,QAAA,CAAAO,IAAA;MAAA;IAAA,GAAAZ,OAAA;EAAA,CAClD;EAAA,OAAAP,MAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA"}
|
|
@@ -9,7 +9,7 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _workerUtils = require("@loaders.gl/worker-utils");
|
|
11
11
|
var _parseI3sTileContent = require("./lib/parsers/parse-i3s-tile-content");
|
|
12
|
-
var VERSION = typeof "3.4.
|
|
12
|
+
var VERSION = typeof "3.4.10" !== 'undefined' ? "3.4.10" : 'latest';
|
|
13
13
|
var I3SContentLoader = {
|
|
14
14
|
name: 'I3S Content (Indexed Scene Layers)',
|
|
15
15
|
id: _workerUtils.isBrowser ? 'i3s-content' : 'i3s-content-nodejs',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-content-loader.js","names":["_workerUtils","require","_parseI3sTileContent","VERSION","I3SContentLoader","name","id","isBrowser","module","worker","version","mimeTypes","parse","extensions","options","exports","_x","_x2","_x3","_parse","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","data","context","_ref","tile","_tileOptions","tileset","_tilesetOptions","tileOptions","tilesetOptions","wrap","_callee$","_context","prev","next","i3s","abrupt","parseI3STileContent","sent","stop"],"sources":["../../src/i3s-content-loader.ts"],"sourcesContent":["import {isBrowser} from '@loaders.gl/worker-utils';\nimport type {LoaderWithParser, LoaderContext} from '@loaders.gl/loader-utils';\nimport type {I3SLoaderOptions} from './i3s-loader';\nimport {parseI3STileContent} from './lib/parsers/parse-i3s-tile-content';\nimport {I3STileOptions, I3STilesetOptions} from './types';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\n\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n/**\n * Loader for I3S - Indexed 3D Scene Layer\n */\nexport const I3SContentLoader: LoaderWithParser = {\n name: 'I3S Content (Indexed Scene Layers)',\n id: isBrowser ? 'i3s-content' : 'i3s-content-nodejs',\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};\n\nasync function parse(data, options?: I3SLoaderOptions, context?: LoaderContext) {\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(\n data,\n tileOptions as I3STileOptions,\n tilesetOptions as I3STilesetOptions,\n options,\n context\n );\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGA,IAAAC,oBAAA,GAAAD,OAAA;AAMA,IAAME,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"i3s-content-loader.js","names":["_workerUtils","require","_parseI3sTileContent","VERSION","I3SContentLoader","name","id","isBrowser","module","worker","version","mimeTypes","parse","extensions","options","exports","_x","_x2","_x3","_parse","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","data","context","_ref","tile","_tileOptions","tileset","_tilesetOptions","tileOptions","tilesetOptions","wrap","_callee$","_context","prev","next","i3s","abrupt","parseI3STileContent","sent","stop"],"sources":["../../src/i3s-content-loader.ts"],"sourcesContent":["import {isBrowser} from '@loaders.gl/worker-utils';\nimport type {LoaderWithParser, LoaderContext} from '@loaders.gl/loader-utils';\nimport type {I3SLoaderOptions} from './i3s-loader';\nimport {parseI3STileContent} from './lib/parsers/parse-i3s-tile-content';\nimport {I3STileOptions, I3STilesetOptions} from './types';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\n\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n/**\n * Loader for I3S - Indexed 3D Scene Layer\n */\nexport const I3SContentLoader: LoaderWithParser = {\n name: 'I3S Content (Indexed Scene Layers)',\n id: isBrowser ? 'i3s-content' : 'i3s-content-nodejs',\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};\n\nasync function parse(data, options?: I3SLoaderOptions, context?: LoaderContext) {\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(\n data,\n tileOptions as I3STileOptions,\n tilesetOptions as I3STilesetOptions,\n options,\n context\n );\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGA,IAAAC,oBAAA,GAAAD,OAAA;AAMA,IAAME,OAAO,GAAG,eAAkB,KAAK,WAAW,cAAiB,QAAQ;AAIpE,IAAMC,gBAAkC,GAAG;EAChDC,IAAI,EAAE,oCAAoC;EAC1CC,EAAE,EAAEC,sBAAS,GAAG,aAAa,GAAG,oBAAoB;EACpDC,MAAM,EAAE,KAAK;EACbC,MAAM,EAAE,IAAI;EACZC,OAAO,EAAEP,OAAO;EAChBQ,SAAS,EAAE,CAAC,0BAA0B,CAAC;EACvCC,KAAK,EAALA,KAAK;EACLC,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,OAAO,EAAE;IACP,aAAa,EAAE,CAAC;EAClB;AACF,CAAC;AAACC,OAAA,CAAAX,gBAAA,GAAAA,gBAAA;AAAA,SAEaQ,K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AAP,MAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA"}
|
package/dist/es5/i3s-loader.js
CHANGED
|
@@ -12,7 +12,7 @@ var _core = require("@loaders.gl/core");
|
|
|
12
12
|
var _i3sContentLoader = require("./i3s-content-loader");
|
|
13
13
|
var _parseI3s = require("./lib/parsers/parse-i3s");
|
|
14
14
|
var _constants = require("./lib/parsers/constants");
|
|
15
|
-
var VERSION = typeof "3.4.
|
|
15
|
+
var VERSION = typeof "3.4.10" !== 'undefined' ? "3.4.10" : 'latest';
|
|
16
16
|
var TILESET_REGEX = /layers\/[0-9]+$/;
|
|
17
17
|
var TILE_HEADER_REGEX = /nodes\/([0-9-]+|root)$/;
|
|
18
18
|
var SLPK_HEX = '504b0304';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-loader.js","names":["_core","require","_i3sContentLoader","_parseI3s","_constants","VERSION","TILESET_REGEX","TILE_HEADER_REGEX","SLPK_HEX","POINT_CLOUD","I3SLoader","name","id","module","version","mimeTypes","parse","parseI3S","extensions","options","i3s","token","isTileset","isTileHeader","tile","tileset","_tileOptions","_tilesetOptions","useDracoGeometry","useCompressedTextures","decodeTextures","coordinateSystem","COORDINATE_SYSTEM","METER_OFFSETS","colorsByAttribute","exports","_x","_parseI3S","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","data","context","url","magicNumber","_args","wrap","_callee$","_context","prev","next","length","undefined","getMagicNumber","Error","test","parseTileset","sent","parseTile","parseTileContent","abrupt","stop","_x2","_x3","_parseTileContent","_callee2","arrayBuffer","_callee2$","_context2","I3SContentLoader","_x4","_x5","_x6","_parseTileset","_callee3","tilesetJson","_callee3$","_context3","JSON","TextDecoder","decode","layerType","loader","normalizeTilesetData","_x7","_x8","_parseTile","_callee4","_callee4$","_context4","normalizeTileData","ArrayBuffer","_toConsumableArray2","Uint8Array","map","value","toString","padStart","join"],"sources":["../../src/i3s-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {parse} from '@loaders.gl/core';\nimport {I3SContentLoader} from './i3s-content-loader';\nimport {normalizeTileData, normalizeTilesetData} from './lib/parsers/parse-i3s';\nimport {COORDINATE_SYSTEM} from './lib/parsers/constants';\nimport {I3SParseOptions} from './types';\nimport {LoaderOptions} from './../../loader-utils/src/types';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nconst TILESET_REGEX = /layers\\/[0-9]+$/;\nconst TILE_HEADER_REGEX = /nodes\\/([0-9-]+|root)$/;\nconst SLPK_HEX = '504b0304';\nconst POINT_CLOUD = 'PointCloud';\n\nexport type I3SLoaderOptions = LoaderOptions & {\n i3s?: I3SParseOptions;\n};\n\n/**\n * Loader for I3S - Indexed 3D Scene Layer\n */\nexport const I3SLoader: LoaderWithParser = {\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 colorsByAttribute: null\n }\n }\n};\n\nasync function parseI3S(data, options: I3SLoaderOptions = {}, context) {\n const url = context.url;\n options.i3s = options.i3s || {};\n const magicNumber = getMagicNumber(data);\n\n // check if file is slpk\n if (magicNumber === SLPK_HEX) {\n throw new Error('Files with .slpk extention currently are not supported by I3SLoader');\n }\n\n // auto detect file type based on url\n let isTileset;\n if (options.i3s.isTileset === 'auto') {\n isTileset = TILESET_REGEX.test(url);\n } else {\n isTileset = options.i3s.isTileset;\n }\n\n let isTileHeader;\n if (options.isTileHeader === 'auto') {\n isTileHeader = TILE_HEADER_REGEX.test(url);\n } else {\n isTileHeader = options.i3s.isTileHeader;\n }\n\n if (isTileset) {\n data = await parseTileset(data, options, context);\n } else if (isTileHeader) {\n data = await parseTile(data, context);\n } else {\n data = await parseTileContent(data, options);\n }\n\n return data;\n}\n\nasync function parseTileContent(arrayBuffer, options: I3SLoaderOptions) {\n return await parse(arrayBuffer, I3SContentLoader, options);\n}\n\nasync function parseTileset(data, options: I3SLoaderOptions, context) {\n const tilesetJson = JSON.parse(new TextDecoder().decode(data));\n\n if (tilesetJson?.layerType === POINT_CLOUD) {\n throw new Error('Point Cloud layers currently are not supported by I3SLoader');\n }\n // eslint-disable-next-line no-use-before-define\n tilesetJson.loader = I3SLoader;\n await normalizeTilesetData(tilesetJson, options, context);\n\n return tilesetJson;\n}\n\nasync function parseTile(data, context) {\n data = JSON.parse(new TextDecoder().decode(data));\n return normalizeTileData(data, context);\n}\n\nfunction getMagicNumber(data) {\n if (data instanceof ArrayBuffer) {\n // slice binary data (4 bytes from the beginning) and transform it to hexadecimal numeral system\n return [...new Uint8Array(data, 0, 4)]\n .map((value) => value.toString(16).padStart(2, '0'))\n .join('');\n }\n return null;\n}\n"],"mappings":";;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAMA,IAAMI,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"i3s-loader.js","names":["_core","require","_i3sContentLoader","_parseI3s","_constants","VERSION","TILESET_REGEX","TILE_HEADER_REGEX","SLPK_HEX","POINT_CLOUD","I3SLoader","name","id","module","version","mimeTypes","parse","parseI3S","extensions","options","i3s","token","isTileset","isTileHeader","tile","tileset","_tileOptions","_tilesetOptions","useDracoGeometry","useCompressedTextures","decodeTextures","coordinateSystem","COORDINATE_SYSTEM","METER_OFFSETS","colorsByAttribute","exports","_x","_parseI3S","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","data","context","url","magicNumber","_args","wrap","_callee$","_context","prev","next","length","undefined","getMagicNumber","Error","test","parseTileset","sent","parseTile","parseTileContent","abrupt","stop","_x2","_x3","_parseTileContent","_callee2","arrayBuffer","_callee2$","_context2","I3SContentLoader","_x4","_x5","_x6","_parseTileset","_callee3","tilesetJson","_callee3$","_context3","JSON","TextDecoder","decode","layerType","loader","normalizeTilesetData","_x7","_x8","_parseTile","_callee4","_callee4$","_context4","normalizeTileData","ArrayBuffer","_toConsumableArray2","Uint8Array","map","value","toString","padStart","join"],"sources":["../../src/i3s-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {parse} from '@loaders.gl/core';\nimport {I3SContentLoader} from './i3s-content-loader';\nimport {normalizeTileData, normalizeTilesetData} from './lib/parsers/parse-i3s';\nimport {COORDINATE_SYSTEM} from './lib/parsers/constants';\nimport {I3SParseOptions} from './types';\nimport {LoaderOptions} from './../../loader-utils/src/types';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nconst TILESET_REGEX = /layers\\/[0-9]+$/;\nconst TILE_HEADER_REGEX = /nodes\\/([0-9-]+|root)$/;\nconst SLPK_HEX = '504b0304';\nconst POINT_CLOUD = 'PointCloud';\n\nexport type I3SLoaderOptions = LoaderOptions & {\n i3s?: I3SParseOptions;\n};\n\n/**\n * Loader for I3S - Indexed 3D Scene Layer\n */\nexport const I3SLoader: LoaderWithParser = {\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 colorsByAttribute: null\n }\n }\n};\n\nasync function parseI3S(data, options: I3SLoaderOptions = {}, context) {\n const url = context.url;\n options.i3s = options.i3s || {};\n const magicNumber = getMagicNumber(data);\n\n // check if file is slpk\n if (magicNumber === SLPK_HEX) {\n throw new Error('Files with .slpk extention currently are not supported by I3SLoader');\n }\n\n // auto detect file type based on url\n let isTileset;\n if (options.i3s.isTileset === 'auto') {\n isTileset = TILESET_REGEX.test(url);\n } else {\n isTileset = options.i3s.isTileset;\n }\n\n let isTileHeader;\n if (options.isTileHeader === 'auto') {\n isTileHeader = TILE_HEADER_REGEX.test(url);\n } else {\n isTileHeader = options.i3s.isTileHeader;\n }\n\n if (isTileset) {\n data = await parseTileset(data, options, context);\n } else if (isTileHeader) {\n data = await parseTile(data, context);\n } else {\n data = await parseTileContent(data, options);\n }\n\n return data;\n}\n\nasync function parseTileContent(arrayBuffer, options: I3SLoaderOptions) {\n return await parse(arrayBuffer, I3SContentLoader, options);\n}\n\nasync function parseTileset(data, options: I3SLoaderOptions, context) {\n const tilesetJson = JSON.parse(new TextDecoder().decode(data));\n\n if (tilesetJson?.layerType === POINT_CLOUD) {\n throw new Error('Point Cloud layers currently are not supported by I3SLoader');\n }\n // eslint-disable-next-line no-use-before-define\n tilesetJson.loader = I3SLoader;\n await normalizeTilesetData(tilesetJson, options, context);\n\n return tilesetJson;\n}\n\nasync function parseTile(data, context) {\n data = JSON.parse(new TextDecoder().decode(data));\n return normalizeTileData(data, context);\n}\n\nfunction getMagicNumber(data) {\n if (data instanceof ArrayBuffer) {\n // slice binary data (4 bytes from the beginning) and transform it to hexadecimal numeral system\n return [...new Uint8Array(data, 0, 4)]\n .map((value) => value.toString(16).padStart(2, '0'))\n .join('');\n }\n return null;\n}\n"],"mappings":";;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,G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SAAAgD,SAAyB9C,IAAI,EAAEC,OAAO;IAAA,OAAAJ,YAAA,CAAAD,OAAA,CAAAS,IAAA,UAAA0C,UAAAC,SAAA;MAAA,kBAAAA,SAAA,CAAAxC,IAAA,GAAAwC,SAAA,CAAAvC,IAAA;QAAA;UACpCT,IAAI,GAAGqC,IAAI,CAAClE,KAAK,CAAC,IAAImE,WAAW,CAAC,CAAC,CAACC,MAAM,CAACvC,IAAI,CAAC,CAAC;UAAC,OAAAgD,SAAA,CAAA7B,MAAA,WAC3C,IAAA8B,2BAAiB,EAACjD,IAAI,EAAEC,OAAO,CAAC;QAAA;QAAA;UAAA,OAAA+C,SAAA,CAAA5B,IAAA;MAAA;IAAA,GAAA0B,QAAA;EAAA,CACxC;EAAA,OAAAD,UAAA,CAAApD,KAAA,OAAAC,SAAA;AAAA;AAED,SAASkB,cAAcA,CAACZ,IAAI,EAAE;EAC5B,IAAIA,IAAI,YAAYkD,WAAW,EAAE;IAE/B,OAAO,IAAAC,mBAAA,CAAAvD,OAAA,EAAI,IAAIwD,UAAU,CAACpD,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,EAClCqD,GAAG,CAAC,UAACC,KAAK;MAAA,OAAKA,KAAK,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;IAAA,EAAC,CACnDC,IAAI,CAAC,EAAE,CAAC;EACb;EACA,OAAO,IAAI;AACb"}
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.I3SNodePageLoader = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
-
var VERSION = typeof "3.4.
|
|
10
|
+
var VERSION = typeof "3.4.10" !== 'undefined' ? "3.4.10" : 'latest';
|
|
11
11
|
function parseNodePage(_x) {
|
|
12
12
|
return _parseNodePage.apply(this, arguments);
|
|
13
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-node-page-loader.js","names":["VERSION","parseNodePage","_x","_parseNodePage","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","data","wrap","_callee$","_context","prev","next","abrupt","JSON","parse","TextDecoder","decode","stop","I3SNodePageLoader","name","id","module","version","mimeTypes","extensions","options","exports","_x2","_parse","_callee2","_callee2$","_context2"],"sources":["../../src/i3s-node-page-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nasync function parseNodePage(data) {\n return JSON.parse(new TextDecoder().decode(data));\n}\n\n/**\n * Loader for I3S node pages\n */\nexport const I3SNodePageLoader: LoaderWithParser = {\n name: 'I3S Node Page',\n id: 'i3s-node-page',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/json'],\n parse,\n extensions: ['json'],\n options: {}\n};\n\nasync function parse(data) {\n data = parseNodePage(data);\n return data;\n}\n"],"mappings":";;;;;;;;;AAIA,IAAMA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"i3s-node-page-loader.js","names":["VERSION","parseNodePage","_x","_parseNodePage","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","data","wrap","_callee$","_context","prev","next","abrupt","JSON","parse","TextDecoder","decode","stop","I3SNodePageLoader","name","id","module","version","mimeTypes","extensions","options","exports","_x2","_parse","_callee2","_callee2$","_context2"],"sources":["../../src/i3s-node-page-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nasync function parseNodePage(data) {\n return JSON.parse(new TextDecoder().decode(data));\n}\n\n/**\n * Loader for I3S node pages\n */\nexport const I3SNodePageLoader: LoaderWithParser = {\n name: 'I3S Node Page',\n id: 'i3s-node-page',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/json'],\n parse,\n extensions: ['json'],\n options: {}\n};\n\nasync function parse(data) {\n data = parseNodePage(data);\n return data;\n}\n"],"mappings":";;;;;;;;;AAIA,IAAMA,OAAO,GAAG,eAAkB,KAAK,WAAW,cAAiB,QAAQ;AAAC,SAE7DC,aAAaA,CAAAC,EAAA;EAAA,OAAAC,cAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAAA,SAAAF,eAAA;EAAAA,cAAA,OAAAG,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAA5B,SAAAC,QAA6BC,IAAI;IAAA,OAAAH,YAAA,CAAAD,OAAA,CAAAK,IAAA,UAAAC,SAAAC,QAAA;MAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;QAAA;UAAA,OAAAF,QAAA,CAAAG,MAAA,WACxBC,IAAI,CAACC,KAAK,CAAC,IAAIC,WAAW,CAAC,CAAC,CAACC,MAAM,CAACV,IAAI,CAAC,CAAC;QAAA;QAAA;UAAA,OAAAG,QAAA,CAAAQ,IAAA;MAAA;IAAA,GAAAZ,OAAA;EAAA,CAClD;EAAA,OAAAP,cAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAKM,IAAMkB,iBAAmC,GAAG;EACjDC,IAAI,EAAE,eAAe;EACrBC,EAAE,EAAE,eAAe;EACnBC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAE3B,OAAO;EAChB4B,SAAS,EAAE,CAAC,kBAAkB,CAAC;EAC/BT,KAAK,EAALA,KAAK;EACLU,UAAU,EAAE,CAAC,MAAM,CAAC;EACpBC,OAAO,EAAE,CAAC;AACZ,CAAC;AAACC,OAAA,CAAAR,iBAAA,GAAAA,iBAAA;AAAA,SAEaJ,KAAKA,CAAAa,GAAA;EAAA,OAAAC,MAAA,CAAA7B,KAAA,OAAAC,SAAA;AAAA;AAAA,SAAA4B,OAAA;EAAAA,MAAA,OAAA3B,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAApB,SAAAyB,SAAqBvB,IAAI;IAAA,OAAAH,YAAA,CAAAD,OAAA,CAAAK,IAAA,UAAAuB,UAAAC,SAAA;MAAA,kBAAAA,SAAA,CAAArB,IAAA,GAAAqB,SAAA,CAAApB,IAAA;QAAA;UACvBL,IAAI,GAAGV,aAAa,CAACU,IAAI,CAAC;UAAC,OAAAyB,SAAA,CAAAnB,MAAA,WACpBN,IAAI;QAAA;QAAA;UAAA,OAAAyB,SAAA,CAAAd,IAAA;MAAA;IAAA,GAAAY,QAAA;EAAA,CACZ;EAAA,OAAAD,MAAA,CAAA7B,KAAA,OAAAC,SAAA;AAAA"}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.SLPKLoader = void 0;
|
|
7
7
|
var _parseSlpk = require("./lib/parsers/parse-slpk/parse-slpk");
|
|
8
|
-
var VERSION = typeof "3.4.
|
|
8
|
+
var VERSION = typeof "3.4.10" !== 'undefined' ? "3.4.10" : 'latest';
|
|
9
9
|
var SLPKLoader = {
|
|
10
10
|
name: 'I3S SLPK (Scene Layer Package)',
|
|
11
11
|
id: 'slpk',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-slpk-loader.js","names":["_parseSlpk","require","VERSION","SLPKLoader","name","id","module","version","mimeTypes","parse","parseSLPK","extensions","options","exports"],"sources":["../../src/i3s-slpk-loader.ts"],"sourcesContent":["import {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {parseSLPK} from './lib/parsers/parse-slpk/parse-slpk';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type SLPKLoaderOptions = LoaderOptions & {\n path?: string;\n mode?: 'http' | 'raw';\n};\n\n/**\n * Loader for SLPK - Scene Layer Package\n */\nexport const SLPKLoader: LoaderWithParser = {\n name: 'I3S SLPK (Scene Layer Package)',\n id: 'slpk',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/octet-stream'],\n parse: parseSLPK,\n extensions: ['slpk'],\n options: {}\n};\n"],"mappings":";;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAIA,IAAMC,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"i3s-slpk-loader.js","names":["_parseSlpk","require","VERSION","SLPKLoader","name","id","module","version","mimeTypes","parse","parseSLPK","extensions","options","exports"],"sources":["../../src/i3s-slpk-loader.ts"],"sourcesContent":["import {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {parseSLPK} from './lib/parsers/parse-slpk/parse-slpk';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type SLPKLoaderOptions = LoaderOptions & {\n path?: string;\n mode?: 'http' | 'raw';\n};\n\n/**\n * Loader for SLPK - Scene Layer Package\n */\nexport const SLPKLoader: LoaderWithParser = {\n name: 'I3S SLPK (Scene Layer Package)',\n id: 'slpk',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/octet-stream'],\n parse: parseSLPK,\n extensions: ['slpk'],\n options: {}\n};\n"],"mappings":";;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAIA,IAAMC,OAAO,GAAG,eAAkB,KAAK,WAAW,cAAiB,QAAQ;AAUpE,IAAMC,UAA4B,GAAG;EAC1CC,IAAI,EAAE,gCAAgC;EACtCC,EAAE,EAAE,MAAM;EACVC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEL,OAAO;EAChBM,SAAS,EAAE,CAAC,0BAA0B,CAAC;EACvCC,KAAK,EAAEC,oBAAS;EAChBC,UAAU,EAAE,CAAC,MAAM,CAAC;EACpBC,OAAO,EAAE,CAAC;AACZ,CAAC;AAACC,OAAA,CAAAV,UAAA,GAAAA,UAAA"}
|
|
@@ -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.10" !== 'undefined' ? "3.4.10" : 'latest';
|
|
3
3
|
export const ArcGisWebSceneLoader = {
|
|
4
4
|
name: 'ArcGIS Web Scene Loader',
|
|
5
5
|
id: 'arcgis-web-scene',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arcgis-webscene-loader.js","names":["parseWebscene","VERSION","ArcGisWebSceneLoader","name","id","module","version","mimeTypes","parse","extensions","options","data"],"sources":["../../src/arcgis-webscene-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {ArcGisWebSceneData} from './types';\n\nimport {parseWebscene} from './lib/parsers/parse-arcgis-webscene';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/**\n * Loader for ArcGis WebScene\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/webscene/\n */\nexport const ArcGisWebSceneLoader: LoaderWithParser = {\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/**\n * Parse ArcGis webscene\n * @param data\n */\nasync function parse(data: ArrayBuffer): Promise<ArcGisWebSceneData> {\n return parseWebscene(data);\n}\n"],"mappings":"AAGA,SAAQA,aAAa,QAAO,qCAAqC;AAIjE,MAAMC,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"arcgis-webscene-loader.js","names":["parseWebscene","VERSION","ArcGisWebSceneLoader","name","id","module","version","mimeTypes","parse","extensions","options","data"],"sources":["../../src/arcgis-webscene-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {ArcGisWebSceneData} from './types';\n\nimport {parseWebscene} from './lib/parsers/parse-arcgis-webscene';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/**\n * Loader for ArcGis WebScene\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/webscene/\n */\nexport const ArcGisWebSceneLoader: LoaderWithParser = {\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/**\n * Parse ArcGis webscene\n * @param data\n */\nasync function parse(data: ArrayBuffer): Promise<ArcGisWebSceneData> {\n return parseWebscene(data);\n}\n"],"mappings":"AAGA,SAAQA,aAAa,QAAO,qCAAqC;AAIjE,MAAMC,OAAO,GAAG,eAAkB,KAAK,WAAW,cAAiB,QAAQ;AAM3E,OAAO,MAAMC,oBAAsC,GAAG;EACpDC,IAAI,EAAE,yBAAyB;EAC/BC,EAAE,EAAE,kBAAkB;EACtBC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEL,OAAO;EAChBM,SAAS,EAAE,CAAC,kBAAkB,CAAC;EAC/BC,KAAK;EACLC,UAAU,EAAE,CAAC,MAAM,CAAC;EACpBC,OAAO,EAAE,CAAC;AACZ,CAAC;AAMD,eAAeF,KAAKA,CAACG,IAAiB,EAA+B;EACnE,OAAOX,aAAa,CAACW,IAAI,CAAC;AAC5B"}
|
|
@@ -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.10" !== 'undefined' ? "3.4.10" : 'latest';
|
|
5
5
|
const EMPTY_VALUE = '';
|
|
6
6
|
const REJECTED_STATUS = 'rejected';
|
|
7
7
|
export const I3SAttributeLoader = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-attribute-loader.js","names":["load","parseI3STileAttribute","getUrlWithToken","VERSION","EMPTY_VALUE","REJECTED_STATUS","I3SAttributeLoader","name","id","module","version","mimeTypes","parse","extensions","options","binary","data","loadFeatureAttributes","tile","featureId","arguments","length","undefined","attributeStorageInfo","attributeUrls","tilesetFields","getAttributesData","attributes","attributeLoadPromises","index","_options$i3s","url","i3s","token","attributeName","attributeType","getAttributeValueType","loadOptions","promise","push","Promise","allSettled","error","generateAttributesByFeatureId","_tile$tileset","_tile$tileset$tileset","_tile$header","_tile$tileset2","_tile$tileset2$tilese","tileset","header","fields","attribute","hasOwnProperty","attributeValues","valueType","getFeatureIdsAttributeName","objectIdsAttribute","find","includes","objectIdsAttributeName","objectIds","value","attributeIndex","indexOf","getFeatureAttributesByIndex","featureIdIndex","attributesObject","codedValues","getAttributeCodedValues","getAttributeByIndexAndAttributeName","formatAttributeValue","_attributeField$domai","attributeField","field","alias","domain","attributesName","attributeObject","status","String","replace","trim","codeValue","codedValue","code","Number"],"sources":["../../src/i3s-attribute-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {load} from '@loaders.gl/core';\nimport {parseI3STileAttribute} from './lib/parsers/parse-i3s-attribute';\nimport {getUrlWithToken} from './lib/utils/url-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\nconst EMPTY_VALUE = '';\nconst REJECTED_STATUS = 'rejected';\n/**\n * Loader for I3S attributes\n */\nexport const I3SAttributeLoader: LoaderWithParser = {\n name: 'I3S Attribute',\n id: 'i3s-attribute',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/binary'],\n parse,\n extensions: ['bin'],\n options: {},\n binary: true\n};\n\nasync function parse(data, options) {\n data = parseI3STileAttribute(data, options);\n return data;\n}\n\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\n if (!attributeStorageInfo || !attributeUrls || featureId < 0) {\n return null;\n }\n\n let attributes: object[] = [];\n const attributeLoadPromises: Promise<object>[] = [];\n\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\n attributeLoadPromises.push(promise);\n }\n try {\n attributes = await Promise.allSettled(attributeLoadPromises);\n } catch (error) {\n // do nothing\n }\n\n if (!attributes.length) {\n return null;\n }\n\n return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);\n}\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\n return {attributeStorageInfo, attributeUrls, tilesetFields};\n}\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 } else if (attribute.hasOwnProperty('attributeValues')) {\n return attribute.attributeValues.valueType;\n }\n return '';\n}\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\n return objectIdsAttribute?.name;\n}\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\n if (!objectIds) {\n return null;\n }\n\n const attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);\n\n if (attributeIndex < 0) {\n return null;\n }\n\n return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);\n}\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\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\n return attributesObject;\n}\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\n return attributeField?.domain?.codedValues || [];\n}\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\n if (attributeObject.status === REJECTED_STATUS) {\n return null;\n }\n\n return attributeObject.value[attributesName];\n}\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\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\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\n return value;\n}\n"],"mappings":"AACA,SAAQA,IAAI,QAAO,kBAAkB;AACrC,SAAQC,qBAAqB,QAAO,mCAAmC;AACvE,SAAQC,eAAe,QAAO,uBAAuB;AAIrD,MAAMC,OAAO,GAAG,cAAkB,KAAK,WAAW,aAAiB,QAAQ;AAC3E,MAAMC,WAAW,GAAG,EAAE;AACtB,MAAMC,eAAe,GAAG,UAAU;AAIlC,OAAO,MAAMC,kBAAoC,GAAG;EAClDC,IAAI,EAAE,eAAe;EACrBC,EAAE,EAAE,eAAe;EACnBC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEP,OAAO;EAChBQ,SAAS,EAAE,CAAC,oBAAoB,CAAC;EACjCC,KAAK;EACLC,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,OAAO,EAAE,CAAC,CAAC;EACXC,MAAM,EAAE;AACV,CAAC;AAED,eAAeH,KAAKA,CAACI,IAAI,EAAEF,OAAO,EAAE;EAClCE,IAAI,GAAGf,qBAAqB,CAACe,IAAI,EAAEF,OAAO,CAAC;EAC3C,OAAOE,IAAI;AACb;AAUA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","EMPTY_VALUE","REJECTED_STATUS","I3SAttributeLoader","name","id","module","version","mimeTypes","parse","extensions","options","binary","data","loadFeatureAttributes","tile","featureId","arguments","length","undefined","attributeStorageInfo","attributeUrls","tilesetFields","getAttributesData","attributes","attributeLoadPromises","index","_options$i3s","url","i3s","token","attributeName","attributeType","getAttributeValueType","loadOptions","promise","push","Promise","allSettled","error","generateAttributesByFeatureId","_tile$tileset","_tile$tileset$tileset","_tile$header","_tile$tileset2","_tile$tileset2$tilese","tileset","header","fields","attribute","hasOwnProperty","attributeValues","valueType","getFeatureIdsAttributeName","objectIdsAttribute","find","includes","objectIdsAttributeName","objectIds","value","attributeIndex","indexOf","getFeatureAttributesByIndex","featureIdIndex","attributesObject","codedValues","getAttributeCodedValues","getAttributeByIndexAndAttributeName","formatAttributeValue","_attributeField$domai","attributeField","field","alias","domain","attributesName","attributeObject","status","String","replace","trim","codeValue","codedValue","code","Number"],"sources":["../../src/i3s-attribute-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {load} from '@loaders.gl/core';\nimport {parseI3STileAttribute} from './lib/parsers/parse-i3s-attribute';\nimport {getUrlWithToken} from './lib/utils/url-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\nconst EMPTY_VALUE = '';\nconst REJECTED_STATUS = 'rejected';\n/**\n * Loader for I3S attributes\n */\nexport const I3SAttributeLoader: LoaderWithParser = {\n name: 'I3S Attribute',\n id: 'i3s-attribute',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/binary'],\n parse,\n extensions: ['bin'],\n options: {},\n binary: true\n};\n\nasync function parse(data, options) {\n data = parseI3STileAttribute(data, options);\n return data;\n}\n\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\n if (!attributeStorageInfo || !attributeUrls || featureId < 0) {\n return null;\n }\n\n let attributes: object[] = [];\n const attributeLoadPromises: Promise<object>[] = [];\n\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\n attributeLoadPromises.push(promise);\n }\n try {\n attributes = await Promise.allSettled(attributeLoadPromises);\n } catch (error) {\n // do nothing\n }\n\n if (!attributes.length) {\n return null;\n }\n\n return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);\n}\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\n return {attributeStorageInfo, attributeUrls, tilesetFields};\n}\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 } else if (attribute.hasOwnProperty('attributeValues')) {\n return attribute.attributeValues.valueType;\n }\n return '';\n}\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\n return objectIdsAttribute?.name;\n}\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\n if (!objectIds) {\n return null;\n }\n\n const attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);\n\n if (attributeIndex < 0) {\n return null;\n }\n\n return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);\n}\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\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\n return attributesObject;\n}\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\n return attributeField?.domain?.codedValues || [];\n}\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\n if (attributeObject.status === REJECTED_STATUS) {\n return null;\n }\n\n return attributeObject.value[attributesName];\n}\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\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\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\n return value;\n}\n"],"mappings":"AACA,SAAQA,IAAI,QAAO,kBAAkB;AACrC,SAAQC,qBAAqB,QAAO,mCAAmC;AACvE,SAAQC,eAAe,QAAO,uBAAuB;AAIrD,MAAMC,OAAO,GAAG,eAAkB,KAAK,WAAW,cAAiB,QAAQ;AAC3E,MAAMC,WAAW,GAAG,EAAE;AACtB,MAAMC,eAAe,GAAG,UAAU;AAIlC,OAAO,MAAMC,kBAAoC,GAAG;EAClDC,IAAI,EAAE,eAAe;EACrBC,EAAE,EAAE,eAAe;EACnBC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEP,OAAO;EAChBQ,SAAS,EAAE,CAAC,oBAAoB,CAAC;EACjCC,KAAK;EACLC,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,OAAO,EAAE,CAAC,CAAC;EACXC,MAAM,EAAE;AACV,CAAC;AAED,eAAeH,KAAKA,CAACI,IAAI,EAAEF,OAAO,EAAE;EAClCE,IAAI,GAAGf,qBAAqB,CAACe,IAAI,EAAEF,OAAO,CAAC;EAC3C,OAAOE,IAAI;AACb;AAUA,OAAO,eAAeC,qBAAqBA,CAACC,IAAI,EAAEC,SAAS,EAAgB;EAAA,IAAdL,OAAO,GAAAM,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EACvE,MAAM;IAACG,oBAAoB;IAAEC,aAAa;IAAEC;EAAa,CAAC,GAAGC,iBAAiB,CAACR,IAAI,CAAC;EAEpF,IAAI,CAACK,oBAAoB,IAAI,CAACC,aAAa,IAAIL,SAAS,GAAG,CAAC,EAAE;IAC5D,OAAO,IAAI;EACb;EAEA,IAAIQ,UAAoB,GAAG,EA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EAAE;EAC9E,MAAMC,eAAe,GAAGnD,UAAU,CAACE,KAAK,CAAC;EAEzC,IAAIiD,eAAe,CAACC,MAAM,KAAK1E,eAAe,EAAE;IAC9C,OAAO,IAAI;EACb;EAEA,OAAOyE,eAAe,CAAChB,KAAK,CAACe,cAAc,CAAC;AAC9C;AAQA,SAASN,oBAAoBA,CAACnB,SAAS,EAAEc,cAAc,EAAEE,WAAW,EAAE;EACpE,IAAIN,KAAK,GAAG1D,WAAW;EAEvB,IAAIgD,SAAS,IAAKc,cAAc,IAAId,SAAU,EAAE;IAE9CU,KAAK,GAAGkB,MAAM,CAAC5B,SAAS,CAACc,cAAc,CAAC,CAAC,CAACe,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAACC,IAAI,CAAC,CAAC;EAC7E;EAGA,IAAId,WAAW,CAAC/C,MAAM,EAAE;IACtB,MAAM8D,SAAS,GAAGf,WAAW,CAACV,IAAI,CAAC0B,UAAU,IAAIA,UAAU,CAACC,IAAI,KAAKC,MAAM,CAACxB,KAAK,CAAC,CAAC;IACnFA,KAAK,GAAG,CAAAqB,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAE5E,IAAI,KAAIH,WAAW;EACxC;EAEA,OAAO0D,KAAK;AACd"}
|
|
@@ -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.10" !== 'undefined' ? "3.4.10" : 'latest';
|
|
3
3
|
export const I3SBuildingSceneLayerLoader = {
|
|
4
4
|
name: 'I3S Building Scene Layer',
|
|
5
5
|
id: 'i3s-building-scene-layer',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-building-scene-layer-loader.js","names":["parseBuildingSceneLayer","VERSION","I3SBuildingSceneLayerLoader","name","id","module","version","mimeTypes","parse","extensions","options","data","context","url","Error"],"sources":["../../src/i3s-building-scene-layer-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions, LoaderContext} from '@loaders.gl/loader-utils';\nimport type {BuildingSceneLayerTileset} from './types';\n\nimport {parseBuildingSceneLayer} from './lib/parsers/parse-i3s-building-scene-layer';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\n\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n/**\n * Loader for I3S - Building Scene Layer\n */\nexport const I3SBuildingSceneLayerLoader: LoaderWithParser = {\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};\n\nasync function parse(\n data: ArrayBuffer,\n options?: LoaderOptions,\n context?: LoaderContext\n): Promise<BuildingSceneLayerTileset> {\n if (!context?.url) {\n throw new Error('Url is not provided');\n }\n\n return parseBuildingSceneLayer(data, context.url);\n}\n"],"mappings":"AAGA,SAAQA,uBAAuB,QAAO,8CAA8C;AAKpF,MAAMC,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"i3s-building-scene-layer-loader.js","names":["parseBuildingSceneLayer","VERSION","I3SBuildingSceneLayerLoader","name","id","module","version","mimeTypes","parse","extensions","options","data","context","url","Error"],"sources":["../../src/i3s-building-scene-layer-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions, LoaderContext} from '@loaders.gl/loader-utils';\nimport type {BuildingSceneLayerTileset} from './types';\n\nimport {parseBuildingSceneLayer} from './lib/parsers/parse-i3s-building-scene-layer';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\n\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n/**\n * Loader for I3S - Building Scene Layer\n */\nexport const I3SBuildingSceneLayerLoader: LoaderWithParser = {\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};\n\nasync function parse(\n data: ArrayBuffer,\n options?: LoaderOptions,\n context?: LoaderContext\n): Promise<BuildingSceneLayerTileset> {\n if (!context?.url) {\n throw new Error('Url is not provided');\n }\n\n return parseBuildingSceneLayer(data, context.url);\n}\n"],"mappings":"AAGA,SAAQA,uBAAuB,QAAO,8CAA8C;AAKpF,MAAMC,OAAO,GAAG,eAAkB,KAAK,WAAW,cAAiB,QAAQ;AAI3E,OAAO,MAAMC,2BAA6C,GAAG;EAC3DC,IAAI,EAAE,0BAA0B;EAChCC,EAAE,EAAE,0BAA0B;EAC9BC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEL,OAAO;EAChBM,SAAS,EAAE,CAAC,kBAAkB,CAAC;EAC/BC,KAAK;EACLC,UAAU,EAAE,CAAC,MAAM,CAAC;EACpBC,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,eAAeF,KAAKA,CAClBG,IAAiB,EACjBD,OAAuB,EACvBE,OAAuB,EACa;EACpC,IAAI,EAACA,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEC,GAAG,GAAE;IACjB,MAAM,IAAIC,KAAK,CAAC,qBAAqB,CAAC;EACxC;EAEA,OAAOd,uBAAuB,CAACW,IAAI,EAAEC,OAAO,CAACC,GAAG,CAAC;AACnD"}
|
|
@@ -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.10" !== 'undefined' ? "3.4.10" : 'latest';
|
|
4
4
|
export const I3SContentLoader = {
|
|
5
5
|
name: 'I3S Content (Indexed Scene Layers)',
|
|
6
6
|
id: isBrowser ? 'i3s-content' : 'i3s-content-nodejs',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-content-loader.js","names":["isBrowser","parseI3STileContent","VERSION","I3SContentLoader","name","id","module","worker","version","mimeTypes","parse","extensions","options","data","context","tile","_tileOptions","tileset","_tilesetOptions","i3s","tileOptions","tilesetOptions"],"sources":["../../src/i3s-content-loader.ts"],"sourcesContent":["import {isBrowser} from '@loaders.gl/worker-utils';\nimport type {LoaderWithParser, LoaderContext} from '@loaders.gl/loader-utils';\nimport type {I3SLoaderOptions} from './i3s-loader';\nimport {parseI3STileContent} from './lib/parsers/parse-i3s-tile-content';\nimport {I3STileOptions, I3STilesetOptions} from './types';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\n\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n/**\n * Loader for I3S - Indexed 3D Scene Layer\n */\nexport const I3SContentLoader: LoaderWithParser = {\n name: 'I3S Content (Indexed Scene Layers)',\n id: isBrowser ? 'i3s-content' : 'i3s-content-nodejs',\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};\n\nasync function parse(data, options?: I3SLoaderOptions, context?: LoaderContext) {\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(\n data,\n tileOptions as I3STileOptions,\n tilesetOptions as I3STilesetOptions,\n options,\n context\n );\n}\n"],"mappings":"AAAA,SAAQA,SAAS,QAAO,0BAA0B;AAGlD,SAAQC,mBAAmB,QAAO,sCAAsC;AAMxE,MAAMC,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"i3s-content-loader.js","names":["isBrowser","parseI3STileContent","VERSION","I3SContentLoader","name","id","module","worker","version","mimeTypes","parse","extensions","options","data","context","tile","_tileOptions","tileset","_tilesetOptions","i3s","tileOptions","tilesetOptions"],"sources":["../../src/i3s-content-loader.ts"],"sourcesContent":["import {isBrowser} from '@loaders.gl/worker-utils';\nimport type {LoaderWithParser, LoaderContext} from '@loaders.gl/loader-utils';\nimport type {I3SLoaderOptions} from './i3s-loader';\nimport {parseI3STileContent} from './lib/parsers/parse-i3s-tile-content';\nimport {I3STileOptions, I3STilesetOptions} from './types';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\n\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n/**\n * Loader for I3S - Indexed 3D Scene Layer\n */\nexport const I3SContentLoader: LoaderWithParser = {\n name: 'I3S Content (Indexed Scene Layers)',\n id: isBrowser ? 'i3s-content' : 'i3s-content-nodejs',\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};\n\nasync function parse(data, options?: I3SLoaderOptions, context?: LoaderContext) {\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(\n data,\n tileOptions as I3STileOptions,\n tilesetOptions as I3STilesetOptions,\n options,\n context\n );\n}\n"],"mappings":"AAAA,SAAQA,SAAS,QAAO,0BAA0B;AAGlD,SAAQC,mBAAmB,QAAO,sCAAsC;AAMxE,MAAMC,OAAO,GAAG,eAAkB,KAAK,WAAW,cAAiB,QAAQ;AAI3E,OAAO,MAAMC,gBAAkC,GAAG;EAChDC,IAAI,EAAE,oCAAoC;EAC1CC,EAAE,EAAEL,SAAS,GAAG,aAAa,GAAG,oBAAoB;EACpDM,MAAM,EAAE,KAAK;EACbC,MAAM,EAAE,IAAI;EACZC,OAAO,EAAEN,OAAO;EAChBO,SAAS,EAAE,CAAC,0BAA0B,CAAC;EACvCC,KAAK;EACLC,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,OAAO,EAAE;IACP,aAAa,EAAE,CAAC;EAClB;AACF,CAAC;AAED,eAAeF,KAAKA,CAACG,IAAI,EAAED,OAA0B,EAAEE,OAAuB,EAAE;EAC9E,MAAM;IAACC,IAAI;IAAEC,YAAY;IAAEC,OAAO;IAAEC;EAAe,CAAC,GAAG,CAAAN,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEO,GAAG,KAAI,CAAC,CAAC;EACzE,MAAMC,WAAW,GAAGJ,YAAY,IAAID,IAAI;EACxC,MAAMM,cAAc,GAAGH,eAAe,IAAID,OAAO;EACjD,IAAI,CAACG,WAAW,IAAI,CAACC,cAAc,EAAE;IACnC,OAAO,IAAI;EACb;EACA,OAAO,MAAMpB,mBAAmB,CAC9BY,IAAI,EACJO,WAAW,EACXC,cAAc,EACdT,OAAO,EACPE,OACF,CAAC;AACH"}
|
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.10" !== 'undefined' ? "3.4.10" : '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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-loader.js","names":["parse","I3SContentLoader","normalizeTileData","normalizeTilesetData","COORDINATE_SYSTEM","VERSION","TILESET_REGEX","TILE_HEADER_REGEX","SLPK_HEX","POINT_CLOUD","I3SLoader","name","id","module","version","mimeTypes","parseI3S","extensions","options","i3s","token","isTileset","isTileHeader","tile","tileset","_tileOptions","_tilesetOptions","useDracoGeometry","useCompressedTextures","decodeTextures","coordinateSystem","METER_OFFSETS","colorsByAttribute","data","arguments","length","undefined","context","url","magicNumber","getMagicNumber","Error","test","parseTileset","parseTile","parseTileContent","arrayBuffer","tilesetJson","JSON","TextDecoder","decode","layerType","loader","ArrayBuffer","Uint8Array","map","value","toString","padStart","join"],"sources":["../../src/i3s-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {parse} from '@loaders.gl/core';\nimport {I3SContentLoader} from './i3s-content-loader';\nimport {normalizeTileData, normalizeTilesetData} from './lib/parsers/parse-i3s';\nimport {COORDINATE_SYSTEM} from './lib/parsers/constants';\nimport {I3SParseOptions} from './types';\nimport {LoaderOptions} from './../../loader-utils/src/types';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nconst TILESET_REGEX = /layers\\/[0-9]+$/;\nconst TILE_HEADER_REGEX = /nodes\\/([0-9-]+|root)$/;\nconst SLPK_HEX = '504b0304';\nconst POINT_CLOUD = 'PointCloud';\n\nexport type I3SLoaderOptions = LoaderOptions & {\n i3s?: I3SParseOptions;\n};\n\n/**\n * Loader for I3S - Indexed 3D Scene Layer\n */\nexport const I3SLoader: LoaderWithParser = {\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 colorsByAttribute: null\n }\n }\n};\n\nasync function parseI3S(data, options: I3SLoaderOptions = {}, context) {\n const url = context.url;\n options.i3s = options.i3s || {};\n const magicNumber = getMagicNumber(data);\n\n // check if file is slpk\n if (magicNumber === SLPK_HEX) {\n throw new Error('Files with .slpk extention currently are not supported by I3SLoader');\n }\n\n // auto detect file type based on url\n let isTileset;\n if (options.i3s.isTileset === 'auto') {\n isTileset = TILESET_REGEX.test(url);\n } else {\n isTileset = options.i3s.isTileset;\n }\n\n let isTileHeader;\n if (options.isTileHeader === 'auto') {\n isTileHeader = TILE_HEADER_REGEX.test(url);\n } else {\n isTileHeader = options.i3s.isTileHeader;\n }\n\n if (isTileset) {\n data = await parseTileset(data, options, context);\n } else if (isTileHeader) {\n data = await parseTile(data, context);\n } else {\n data = await parseTileContent(data, options);\n }\n\n return data;\n}\n\nasync function parseTileContent(arrayBuffer, options: I3SLoaderOptions) {\n return await parse(arrayBuffer, I3SContentLoader, options);\n}\n\nasync function parseTileset(data, options: I3SLoaderOptions, context) {\n const tilesetJson = JSON.parse(new TextDecoder().decode(data));\n\n if (tilesetJson?.layerType === POINT_CLOUD) {\n throw new Error('Point Cloud layers currently are not supported by I3SLoader');\n }\n // eslint-disable-next-line no-use-before-define\n tilesetJson.loader = I3SLoader;\n await normalizeTilesetData(tilesetJson, options, context);\n\n return tilesetJson;\n}\n\nasync function parseTile(data, context) {\n data = JSON.parse(new TextDecoder().decode(data));\n return normalizeTileData(data, context);\n}\n\nfunction getMagicNumber(data) {\n if (data instanceof ArrayBuffer) {\n // slice binary data (4 bytes from the beginning) and transform it to hexadecimal numeral system\n return [...new Uint8Array(data, 0, 4)]\n .map((value) => value.toString(16).padStart(2, '0'))\n .join('');\n }\n return null;\n}\n"],"mappings":"AACA,SAAQA,KAAK,QAAO,kBAAkB;AACtC,SAAQC,gBAAgB,QAAO,sBAAsB;AACrD,SAAQC,iBAAiB,EAAEC,oBAAoB,QAAO,yBAAyB;AAC/E,SAAQC,iBAAiB,QAAO,yBAAyB;AAMzD,MAAMC,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"i3s-loader.js","names":["parse","I3SContentLoader","normalizeTileData","normalizeTilesetData","COORDINATE_SYSTEM","VERSION","TILESET_REGEX","TILE_HEADER_REGEX","SLPK_HEX","POINT_CLOUD","I3SLoader","name","id","module","version","mimeTypes","parseI3S","extensions","options","i3s","token","isTileset","isTileHeader","tile","tileset","_tileOptions","_tilesetOptions","useDracoGeometry","useCompressedTextures","decodeTextures","coordinateSystem","METER_OFFSETS","colorsByAttribute","data","arguments","length","undefined","context","url","magicNumber","getMagicNumber","Error","test","parseTileset","parseTile","parseTileContent","arrayBuffer","tilesetJson","JSON","TextDecoder","decode","layerType","loader","ArrayBuffer","Uint8Array","map","value","toString","padStart","join"],"sources":["../../src/i3s-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {parse} from '@loaders.gl/core';\nimport {I3SContentLoader} from './i3s-content-loader';\nimport {normalizeTileData, normalizeTilesetData} from './lib/parsers/parse-i3s';\nimport {COORDINATE_SYSTEM} from './lib/parsers/constants';\nimport {I3SParseOptions} from './types';\nimport {LoaderOptions} from './../../loader-utils/src/types';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nconst TILESET_REGEX = /layers\\/[0-9]+$/;\nconst TILE_HEADER_REGEX = /nodes\\/([0-9-]+|root)$/;\nconst SLPK_HEX = '504b0304';\nconst POINT_CLOUD = 'PointCloud';\n\nexport type I3SLoaderOptions = LoaderOptions & {\n i3s?: I3SParseOptions;\n};\n\n/**\n * Loader for I3S - Indexed 3D Scene Layer\n */\nexport const I3SLoader: LoaderWithParser = {\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 colorsByAttribute: null\n }\n }\n};\n\nasync function parseI3S(data, options: I3SLoaderOptions = {}, context) {\n const url = context.url;\n options.i3s = options.i3s || {};\n const magicNumber = getMagicNumber(data);\n\n // check if file is slpk\n if (magicNumber === SLPK_HEX) {\n throw new Error('Files with .slpk extention currently are not supported by I3SLoader');\n }\n\n // auto detect file type based on url\n let isTileset;\n if (options.i3s.isTileset === 'auto') {\n isTileset = TILESET_REGEX.test(url);\n } else {\n isTileset = options.i3s.isTileset;\n }\n\n let isTileHeader;\n if (options.isTileHeader === 'auto') {\n isTileHeader = TILE_HEADER_REGEX.test(url);\n } else {\n isTileHeader = options.i3s.isTileHeader;\n }\n\n if (isTileset) {\n data = await parseTileset(data, options, context);\n } else if (isTileHeader) {\n data = await parseTile(data, context);\n } else {\n data = await parseTileContent(data, options);\n }\n\n return data;\n}\n\nasync function parseTileContent(arrayBuffer, options: I3SLoaderOptions) {\n return await parse(arrayBuffer, I3SContentLoader, options);\n}\n\nasync function parseTileset(data, options: I3SLoaderOptions, context) {\n const tilesetJson = JSON.parse(new TextDecoder().decode(data));\n\n if (tilesetJson?.layerType === POINT_CLOUD) {\n throw new Error('Point Cloud layers currently are not supported by I3SLoader');\n }\n // eslint-disable-next-line no-use-before-define\n tilesetJson.loader = I3SLoader;\n await normalizeTilesetData(tilesetJson, options, context);\n\n return tilesetJson;\n}\n\nasync function parseTile(data, context) {\n data = JSON.parse(new TextDecoder().decode(data));\n return normalizeTileData(data, context);\n}\n\nfunction getMagicNumber(data) {\n if (data instanceof ArrayBuffer) {\n // slice binary data (4 bytes from the beginning) and transform it to hexadecimal numeral system\n return [...new Uint8Array(data, 0, 4)]\n .map((value) => value.toString(16).padStart(2, '0'))\n .join('');\n }\n return null;\n}\n"],"mappings":"AACA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AAW,CAAC,CAAC,CAACC,MAAM,CAACjB,IAAI,CAAC,CAAC;EAE9D,IAAI,CAAAc,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAEI,SAAS,MAAK1C,WAAW,EAAE;IAC1C,MAAM,IAAIgC,KAAK,CAAC,6DAA6D,CAAC;EAChF;EAEAM,WAAW,CAACK,MAAM,GAAG1C,SAAS;EAC9B,MAAMP,oBAAoB,CAAC4C,WAAW,EAAE7B,OAAO,EAAEmB,OAAO,CAAC;EAEzD,OAAOU,WAAW;AACpB;AAEA,eAAeH,SAASA,CAACX,IAAI,EAAEI,OAAO,EAAE;EACtCJ,IAAI,GAAGe,IAAI,CAAChD,KAAK,CAAC,IAAIiD,WAAW,CAAC,CAAC,CAACC,MAAM,CAACjB,IAAI,CAAC,CAAC;EACjD,OAAO/B,iBAAiB,CAAC+B,IAAI,EAAEI,OAAO,CAAC;AACzC;AAEA,SAASG,cAAcA,CAACP,IAAI,EAAE;EAC5B,IAAIA,IAAI,YAAYoB,WAAW,EAAE;IAE/B,OAAO,CAAC,GAAG,IAAIC,UAAU,CAACrB,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CACnCsB,GAAG,CAAEC,KAAK,IAAKA,KAAK,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CACnDC,IAAI,CAAC,EAAE,CAAC;EACb;EACA,OAAO,IAAI;AACb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-node-page-loader.js","names":["VERSION","parseNodePage","data","JSON","parse","TextDecoder","decode","I3SNodePageLoader","name","id","module","version","mimeTypes","extensions","options"],"sources":["../../src/i3s-node-page-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nasync function parseNodePage(data) {\n return JSON.parse(new TextDecoder().decode(data));\n}\n\n/**\n * Loader for I3S node pages\n */\nexport const I3SNodePageLoader: LoaderWithParser = {\n name: 'I3S Node Page',\n id: 'i3s-node-page',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/json'],\n parse,\n extensions: ['json'],\n options: {}\n};\n\nasync function parse(data) {\n data = parseNodePage(data);\n return data;\n}\n"],"mappings":"AAIA,MAAMA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"i3s-node-page-loader.js","names":["VERSION","parseNodePage","data","JSON","parse","TextDecoder","decode","I3SNodePageLoader","name","id","module","version","mimeTypes","extensions","options"],"sources":["../../src/i3s-node-page-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nasync function parseNodePage(data) {\n return JSON.parse(new TextDecoder().decode(data));\n}\n\n/**\n * Loader for I3S node pages\n */\nexport const I3SNodePageLoader: LoaderWithParser = {\n name: 'I3S Node Page',\n id: 'i3s-node-page',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/json'],\n parse,\n extensions: ['json'],\n options: {}\n};\n\nasync function parse(data) {\n data = parseNodePage(data);\n return data;\n}\n"],"mappings":"AAIA,MAAMA,OAAO,GAAG,eAAkB,KAAK,WAAW,cAAiB,QAAQ;AAE3E,eAAeC,aAAaA,CAACC,IAAI,EAAE;EACjC,OAAOC,IAAI,CAACC,KAAK,CAAC,IAAIC,WAAW,CAAC,CAAC,CAACC,MAAM,CAACJ,IAAI,CAAC,CAAC;AACnD;AAKA,OAAO,MAAMK,iBAAmC,GAAG;EACjDC,IAAI,EAAE,eAAe;EACrBC,EAAE,EAAE,eAAe;EACnBC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEX,OAAO;EAChBY,SAAS,EAAE,CAAC,kBAAkB,CAAC;EAC/BR,KAAK;EACLS,UAAU,EAAE,CAAC,MAAM,CAAC;EACpBC,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,eAAeV,KAAKA,CAACF,IAAI,EAAE;EACzBA,IAAI,GAAGD,aAAa,CAACC,IAAI,CAAC;EAC1B,OAAOA,IAAI;AACb"}
|
|
@@ -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.10" !== 'undefined' ? "3.4.10" : 'latest';
|
|
3
3
|
export const SLPKLoader = {
|
|
4
4
|
name: 'I3S SLPK (Scene Layer Package)',
|
|
5
5
|
id: 'slpk',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-slpk-loader.js","names":["parseSLPK","VERSION","SLPKLoader","name","id","module","version","mimeTypes","parse","extensions","options"],"sources":["../../src/i3s-slpk-loader.ts"],"sourcesContent":["import {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {parseSLPK} from './lib/parsers/parse-slpk/parse-slpk';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type SLPKLoaderOptions = LoaderOptions & {\n path?: string;\n mode?: 'http' | 'raw';\n};\n\n/**\n * Loader for SLPK - Scene Layer Package\n */\nexport const SLPKLoader: LoaderWithParser = {\n name: 'I3S SLPK (Scene Layer Package)',\n id: 'slpk',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/octet-stream'],\n parse: parseSLPK,\n extensions: ['slpk'],\n options: {}\n};\n"],"mappings":"AACA,SAAQA,SAAS,QAAO,qCAAqC;AAI7D,MAAMC,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"i3s-slpk-loader.js","names":["parseSLPK","VERSION","SLPKLoader","name","id","module","version","mimeTypes","parse","extensions","options"],"sources":["../../src/i3s-slpk-loader.ts"],"sourcesContent":["import {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {parseSLPK} from './lib/parsers/parse-slpk/parse-slpk';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type SLPKLoaderOptions = LoaderOptions & {\n path?: string;\n mode?: 'http' | 'raw';\n};\n\n/**\n * Loader for SLPK - Scene Layer Package\n */\nexport const SLPKLoader: LoaderWithParser = {\n name: 'I3S SLPK (Scene Layer Package)',\n id: 'slpk',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/octet-stream'],\n parse: parseSLPK,\n extensions: ['slpk'],\n options: {}\n};\n"],"mappings":"AACA,SAAQA,SAAS,QAAO,qCAAqC;AAI7D,MAAMC,OAAO,GAAG,eAAkB,KAAK,WAAW,cAAiB,QAAQ;AAU3E,OAAO,MAAMC,UAA4B,GAAG;EAC1CC,IAAI,EAAE,gCAAgC;EACtCC,EAAE,EAAE,MAAM;EACVC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEL,OAAO;EAChBM,SAAS,EAAE,CAAC,0BAA0B,CAAC;EACvCC,KAAK,EAAER,SAAS;EAChBS,UAAU,EAAE,CAAC,MAAM,CAAC;EACpBC,OAAO,EAAE,CAAC;AACZ,CAAC"}
|