@loaders.gl/i3s 3.4.6 → 4.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arcgis-webscene-loader.js +1 -1
- package/dist/dist.min.js +8452 -8866
- 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 +18 -20
- 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 +2 -3
- 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 +4 -22
- 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/es5/index.js +8 -1
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/parsers/parse-arcgis-webscene.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-attribute.js +7 -26
- package/dist/es5/lib/parsers/parse-i3s-attribute.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js +2 -2
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -1
- package/dist/es5/lib/parsers/parse-slpk/parse-slpk.js +2 -2
- package/dist/es5/lib/parsers/parse-slpk/parse-slpk.js.map +1 -1
- package/dist/es5/lib/parsers/parse-slpk/slpk-archieve.js +140 -23
- package/dist/es5/lib/parsers/parse-slpk/slpk-archieve.js.map +1 -1
- package/dist/es5/lib/utils/{customizeColors.js → customize-/321/201olors.js} +65 -40
- package/dist/es5/lib/utils/customize-/321/201olors.js.map +1 -0
- package/dist/es5/types.js.map +1 -1
- package/dist/es5/workers/{i3s-content-nodejs-worker.js → i3s-content-worker-node.js} +2 -2
- package/dist/es5/workers/i3s-content-worker-node.js.map +1 -0
- 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 +2 -6
- 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 +2 -3
- 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 +3 -7
- 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/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/parsers/parse-arcgis-webscene.js.map +1 -1
- package/dist/esm/lib/parsers/parse-i3s-attribute.js +1 -1
- package/dist/esm/lib/parsers/parse-i3s-attribute.js.map +1 -1
- package/dist/esm/lib/parsers/parse-i3s-tile-content.js +1 -1
- package/dist/esm/lib/parsers/parse-i3s-tile-content.js.map +1 -1
- package/dist/esm/lib/parsers/parse-slpk/parse-slpk.js +2 -2
- package/dist/esm/lib/parsers/parse-slpk/parse-slpk.js.map +1 -1
- package/dist/esm/lib/parsers/parse-slpk/slpk-archieve.js +59 -9
- package/dist/esm/lib/parsers/parse-slpk/slpk-archieve.js.map +1 -1
- package/dist/esm/lib/utils/{customizeColors.js → customize-/321/201olors.js} +9 -3
- package/dist/esm/lib/utils/customize-/321/201olors.js.map +1 -0
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/workers/{i3s-content-nodejs-worker.js → i3s-content-worker-node.js} +2 -2
- package/dist/esm/workers/i3s-content-worker-node.js.map +1 -0
- package/dist/i3s-attribute-loader.d.ts +3 -2
- package/dist/i3s-attribute-loader.d.ts.map +1 -1
- package/dist/i3s-attribute-loader.js +2 -5
- package/dist/i3s-building-scene-layer-loader.js +1 -1
- package/dist/i3s-content-loader.d.ts.map +1 -1
- package/dist/i3s-content-loader.js +2 -3
- package/dist/i3s-content-worker-node.js +197 -0
- package/dist/{i3s-content-nodejs-worker.js.map → i3s-content-worker-node.js.map} +3 -3
- package/dist/i3s-content-worker.js +93 -527
- package/dist/i3s-node-page-loader.d.ts +3 -2
- package/dist/i3s-node-page-loader.d.ts.map +1 -1
- package/dist/i3s-node-page-loader.js +2 -6
- package/dist/i3s-slpk-loader.d.ts +6 -3
- package/dist/i3s-slpk-loader.d.ts.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/lib/parsers/parse-arcgis-webscene.js +1 -0
- package/dist/lib/parsers/parse-i3s-attribute.d.ts +6 -4
- package/dist/lib/parsers/parse-i3s-attribute.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s-attribute.js +11 -10
- package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s-tile-content.js +7 -2
- package/dist/lib/parsers/parse-slpk/parse-slpk.d.ts.map +1 -1
- package/dist/lib/parsers/parse-slpk/parse-slpk.js +1 -1
- package/dist/lib/parsers/parse-slpk/slpk-archieve.d.ts +6 -0
- package/dist/lib/parsers/parse-slpk/slpk-archieve.d.ts.map +1 -1
- package/dist/lib/parsers/parse-slpk/slpk-archieve.js +72 -9
- package/dist/lib/utils/{customizeColors.d.ts → customize-/321/201olors.d.ts} +1 -1
- package/dist/lib/utils/customize-/321/201olors.d.ts.map +1 -0
- package/dist/lib/utils/{customizeColors.js → customize-/321/201olors.js} +18 -3
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/workers/i3s-content-worker-node.d.ts +2 -0
- package/dist/workers/i3s-content-worker-node.d.ts.map +1 -0
- package/dist/workers/{i3s-content-nodejs-worker.js → i3s-content-worker-node.js} +2 -1
- package/package.json +13 -13
- package/src/arcgis-webscene-loader.ts +1 -1
- package/src/i3s-attribute-loader.ts +7 -7
- package/src/i3s-building-scene-layer-loader.ts +1 -1
- package/src/i3s-content-loader.ts +2 -3
- package/src/i3s-node-page-loader.ts +6 -10
- package/src/i3s-slpk-loader.ts +5 -3
- package/src/index.ts +13 -7
- package/src/lib/parsers/parse-arcgis-webscene.ts +1 -0
- package/src/lib/parsers/parse-i3s-attribute.ts +21 -14
- package/src/lib/parsers/parse-i3s-tile-content.ts +6 -1
- package/src/lib/parsers/parse-slpk/parse-slpk.ts +4 -1
- package/src/lib/parsers/parse-slpk/slpk-archieve.ts +73 -9
- package/src/lib/utils/{customizeColors.ts → customize-/321/201olors.ts} +18 -3
- package/src/types.ts +1 -0
- package/src/workers/{i3s-content-nodejs-worker.ts → i3s-content-worker-node.ts} +2 -1
- package/dist/es5/lib/utils/customizeColors.js.map +0 -1
- package/dist/es5/workers/i3s-content-nodejs-worker.js.map +0 -1
- package/dist/esm/lib/utils/customizeColors.js.map +0 -1
- package/dist/esm/workers/i3s-content-nodejs-worker.js.map +0 -1
- package/dist/i3s-content-nodejs-worker.js +0 -198
- package/dist/lib/utils/customizeColors.d.ts.map +0 -1
- package/dist/workers/i3s-content-nodejs-worker.d.ts +0 -2
- package/dist/workers/i3s-content-nodejs-worker.d.ts.map +0 -1
|
@@ -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 "
|
|
11
|
+
var VERSION = typeof "4.0.0-alpha.10" !== 'undefined' ? "4.0.0-alpha.10" : 'beta';
|
|
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__ : '
|
|
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__ : 'beta';\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,uBAAkB,KAAK,WAAW,sBAAiB,MAAM;AAMlE,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 "
|
|
18
|
+
var VERSION = typeof "4.0.0-alpha.10" !== 'undefined' ? "4.0.0-alpha.10" : 'latest';
|
|
19
19
|
var EMPTY_VALUE = '';
|
|
20
20
|
var REJECTED_STATUS = 'rejected';
|
|
21
21
|
var I3SAttributeLoader = {
|
|
@@ -24,30 +24,28 @@ var I3SAttributeLoader = {
|
|
|
24
24
|
module: 'i3s',
|
|
25
25
|
version: VERSION,
|
|
26
26
|
mimeTypes: ['application/binary'],
|
|
27
|
-
parse:
|
|
27
|
+
parse: function () {
|
|
28
|
+
var _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer, options) {
|
|
29
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
30
|
+
while (1) switch (_context.prev = _context.next) {
|
|
31
|
+
case 0:
|
|
32
|
+
return _context.abrupt("return", (0, _parseI3sAttribute.parseI3STileAttribute)(arrayBuffer, options));
|
|
33
|
+
case 1:
|
|
34
|
+
case "end":
|
|
35
|
+
return _context.stop();
|
|
36
|
+
}
|
|
37
|
+
}, _callee);
|
|
38
|
+
}));
|
|
39
|
+
function parse(_x, _x2) {
|
|
40
|
+
return _parse.apply(this, arguments);
|
|
41
|
+
}
|
|
42
|
+
return parse;
|
|
43
|
+
}(),
|
|
28
44
|
extensions: ['bin'],
|
|
29
45
|
options: {},
|
|
30
46
|
binary: true
|
|
31
47
|
};
|
|
32
48
|
exports.I3SAttributeLoader = I3SAttributeLoader;
|
|
33
|
-
function parse(_x, _x2) {
|
|
34
|
-
return _parse.apply(this, arguments);
|
|
35
|
-
}
|
|
36
|
-
function _parse() {
|
|
37
|
-
_parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(data, options) {
|
|
38
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
39
|
-
while (1) switch (_context.prev = _context.next) {
|
|
40
|
-
case 0:
|
|
41
|
-
data = (0, _parseI3sAttribute.parseI3STileAttribute)(data, options);
|
|
42
|
-
return _context.abrupt("return", data);
|
|
43
|
-
case 2:
|
|
44
|
-
case "end":
|
|
45
|
-
return _context.stop();
|
|
46
|
-
}
|
|
47
|
-
}, _callee);
|
|
48
|
-
}));
|
|
49
|
-
return _parse.apply(this, arguments);
|
|
50
|
-
}
|
|
51
49
|
function loadFeatureAttributes(_x3, _x4) {
|
|
52
50
|
return _loadFeatureAttributes.apply(this, arguments);
|
|
53
51
|
}
|
|
@@ -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 cod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C,cAAc,CAAEG,MAAM,cAAAJ,qBAAA,uBAAtBA,qBAAA,CAAwBJ,WAAW,KAAI,EAAE;AAClD;AAQA,SAASE,mCAAmCA,CAAClD,UAAU,EAAEE,KAAK,EAAEuD,cAAc,EAAE;EAC9E,IAAMC,eAAe,GAAG1D,UAAU,CAACE,KAAK,CAAC;EAEzC,IAAIwD,eAAe,CAACC,MAAM,KAAKlG,eAAe,EAAE;IAC9C,OAAO,IAAI;EACb;EAEA,OAAOiG,eAAe,CAAChB,KAAK,CAACe,cAAc,CAAC;AAC9C;AAQA,SAASN,oBAAoBA,CAACnB,SAAS,EAAEc,cAAc,EAAEE,WAAW,EAAE;EACpE,IAAIN,KAAK,GAAGlF,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"}
|
|
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","_parse","_asyncToGenerator2","_regenerator","mark","_callee","arrayBuffer","options","wrap","_callee$","_context","prev","next","abrupt","parseI3STileAttribute","stop","_x","_x2","extensions","binary","exports","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 {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {load} from '@loaders.gl/core';\nimport type {I3STileAttributes} from './lib/parsers/parse-i3s-attribute';\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/**\n * Loader for I3S attributes\n */\nexport const I3SAttributeLoader: LoaderWithParser<I3STileAttributes, never, LoaderOptions> = {\n name: 'I3S Attribute',\n id: 'i3s-attribute',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/binary'],\n parse: async (arrayBuffer: ArrayBuffer, options?: LoaderOptions) => parseI3STileAttribute(arrayBuffer, options),\n extensions: ['bin'],\n options: {},\n binary: true\n};\n\n\n// TODO - these seem to use the loader rather than being part of the loader. Move to different file...\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;AAEA,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,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA,IAAAC,SAAA,CAAAD,CAAA,QAAAA,CAAA,OAAAf,OAAA,CAAAI,MAAA,CAAAc,MAAA,OAAAC,OAAA,WAAAC,GAAA,QAAAC,gBAAA,CAAAC,OAAA,EAAAR,MAAA,EAAAM,GAAA,EAAAF,MA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BuildingSceneLayerLoader = 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 "
|
|
11
|
+
var VERSION = typeof "4.0.0-alpha.10" !== 'undefined' ? "4.0.0-alpha.10" : 'beta';
|
|
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__ : '
|
|
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__ : 'beta';\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,uBAAkB,KAAK,WAAW,sBAAiB,MAAM;AAIlE,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"}
|
|
@@ -7,12 +7,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.I3SContentLoader = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
-
var _workerUtils = require("@loaders.gl/worker-utils");
|
|
11
10
|
var _parseI3sTileContent = require("./lib/parsers/parse-i3s-tile-content");
|
|
12
|
-
var VERSION = typeof "
|
|
11
|
+
var VERSION = typeof "4.0.0-alpha.10" !== 'undefined' ? "4.0.0-alpha.10" : 'beta';
|
|
13
12
|
var I3SContentLoader = {
|
|
14
13
|
name: 'I3S Content (Indexed Scene Layers)',
|
|
15
|
-
id:
|
|
14
|
+
id: 'i3s-content',
|
|
16
15
|
module: 'i3s',
|
|
17
16
|
worker: true,
|
|
18
17
|
version: VERSION,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-content-loader.js","names":["
|
|
1
|
+
{"version":3,"file":"i3s-content-loader.js","names":["_parseI3sTileContent","require","VERSION","I3SContentLoader","name","id","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 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__ : 'beta';\n/**\n * Loader for I3S - Indexed 3D Scene Layer\n */\nexport const I3SContentLoader: LoaderWithParser = {\n name: 'I3S Content (Indexed Scene Layers)',\n id: 'i3s-content',\n module: 'i3s',\n worker: true,\n version: VERSION,\n mimeTypes: ['application/octet-stream'],\n parse,\n extensions: ['bin'],\n options: {\n 'i3s-content': {}\n }\n};\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":";;;;;;;;;AAEA,IAAAA,oBAAA,GAAAC,OAAA;AAMA,IAAMC,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,MAAM;AAIlE,IAAMC,gBAAkC,GAAG;EAChDC,IAAI,EAAE,oCAA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QAAA,CAAAI,MAAA,WAC1B,IAAI;QAAA;UAAAJ,QAAA,CAAAE,IAAA;UAAA,OAEA,IAAAG,wCAAmB,EAC9BhB,IAAI,EACJO,WAAW,EACXC,cAAc,EACdrB,OAAO,EACPc,OACF,CAAC;QAAA;UAAA,OAAAU,QAAA,CAAAI,MAAA,WAAAJ,QAAA,CAAAM,IAAA;QAAA;QAAA;UAAA,OAAAN,QAAA,CAAAO,IAAA;MAAA;IAAA,GAAAnB,OAAA;EAAA,CACF;EAAA,OAAAP,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 "
|
|
15
|
+
var VERSION = typeof "4.0.0-alpha.10" !== 'undefined' ? "4.0.0-alpha.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,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAMA,IAAMI,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAE3E,IAAMC,aAAa,GAAG,iBAAiB;AACvC,IAAMC,iBAAiB,GAAG,wBAAwB;AAClD,IAAMC,QAAQ,GAAG,UAAU;AAC3B,IAAMC,WAAW,GAAG,YAAY;AASzB,IAAMC,SAA2B,GAAG;EACzCC,IAAI,EAAE,4BAA4B;EAClCC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAET,OAAO;EAChBU,SAAS,EAAE,CAAC,0BAA0B,CAAC;EACvCC,KAAK,EAAEC,QAAQ;EACfC,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,OAAO,EAAE;IACPC,GAAG,EAAE;MACHC,KAAK,EAAE,IAAI;MACXC,SAAS,EAAE,MAAM;MACjBC,YAAY,EAAE,MAAM;MACpBC,IAAI,EAAE,IAAI;MACVC,OAAO,EAAE,IAAI;MACbC,YAAY,EAAE,IAAI;MAClBC,eAAe,EAAE,IAAI;MACrBC,gBAAgB,EAAE,IAAI;MACtBC,qBAAqB,EAAE,IAAI;MAC3BC,cAAc,EAAE,IAAI;MACpBC,gBAAgB,EAAEC,4BAAiB,CAACC,aAAa;MACjDC,iBAAiB,EAAE;IACrB;EACF;AACF,CAAC;AAACC,OAAA,CAAAzB,SAAA,GAAAA,SAAA;AAAA,SAEaO,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|
@@ -7,12 +7,12 @@ 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 "
|
|
11
|
-
function parseNodePage(_x) {
|
|
10
|
+
var VERSION = typeof "4.0.0-alpha.10" !== 'undefined' ? "4.0.0-alpha.10" : 'latest';
|
|
11
|
+
function parseNodePage(_x, _x2) {
|
|
12
12
|
return _parseNodePage.apply(this, arguments);
|
|
13
13
|
}
|
|
14
14
|
function _parseNodePage() {
|
|
15
|
-
_parseNodePage = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(data) {
|
|
15
|
+
_parseNodePage = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(data, options) {
|
|
16
16
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
17
17
|
while (1) switch (_context.prev = _context.next) {
|
|
18
18
|
case 0:
|
|
@@ -31,27 +31,9 @@ var I3SNodePageLoader = {
|
|
|
31
31
|
module: 'i3s',
|
|
32
32
|
version: VERSION,
|
|
33
33
|
mimeTypes: ['application/json'],
|
|
34
|
-
parse:
|
|
34
|
+
parse: parseNodePage,
|
|
35
35
|
extensions: ['json'],
|
|
36
36
|
options: {}
|
|
37
37
|
};
|
|
38
38
|
exports.I3SNodePageLoader = I3SNodePageLoader;
|
|
39
|
-
function parse(_x2) {
|
|
40
|
-
return _parse.apply(this, arguments);
|
|
41
|
-
}
|
|
42
|
-
function _parse() {
|
|
43
|
-
_parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(data) {
|
|
44
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
45
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
46
|
-
case 0:
|
|
47
|
-
data = parseNodePage(data);
|
|
48
|
-
return _context2.abrupt("return", data);
|
|
49
|
-
case 2:
|
|
50
|
-
case "end":
|
|
51
|
-
return _context2.stop();
|
|
52
|
-
}
|
|
53
|
-
}, _callee2);
|
|
54
|
-
}));
|
|
55
|
-
return _parse.apply(this, arguments);
|
|
56
|
-
}
|
|
57
39
|
//# sourceMappingURL=i3s-node-page-loader.js.map
|
|
@@ -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","
|
|
1
|
+
{"version":3,"file":"i3s-node-page-loader.js","names":["VERSION","parseNodePage","_x","_x2","_parseNodePage","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","data","options","wrap","_callee$","_context","prev","next","abrupt","JSON","parse","TextDecoder","decode","stop","I3SNodePageLoader","name","id","module","version","mimeTypes","extensions","exports"],"sources":["../../src/i3s-node-page-loader.ts"],"sourcesContent":["import type {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {NodePage} from './types';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nasync function parseNodePage(data: ArrayBuffer, options?: LoaderOptions): Promise<NodePage> {\n return JSON.parse(new TextDecoder().decode(data)) as NodePage;\n}\n\n/**\n * Loader for I3S node pages\n */\nexport const I3SNodePageLoader: LoaderWithParser<NodePage, never, LoaderOptions> = {\n name: 'I3S Node Page',\n id: 'i3s-node-page',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/json'],\n parse: parseNodePage,\n extensions: ['json'],\n options: {}\n};\n"],"mappings":";;;;;;;;;AAKA,IAAMA,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAAC,SAE7DC,aAAaA,CAAAC,EAAA,EAAAC,GAAA;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,IAAiB,EAAEC,OAAuB;IAAA,OAAAJ,YAAA,CAAAD,OAAA,CAAAM,IAAA,UAAAC,SAAAC,QAAA;MAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;QAAA;UAAA,OAAAF,QAAA,CAAAG,MAAA,WAC9DC,IAAI,CAACC,KAAK,CAAC,IAAIC,WAAW,CAAC,CAAC,CAACC,MAAM,CAACX,IAAI,CAAC,CAAC;QAAA;QAAA;UAAA,OAAAI,QAAA,CAAAQ,IAAA;MAAA;IAAA,GAAAb,OAAA;EAAA,CAClD;EAAA,OAAAP,cAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAKM,IAAMmB,iBAAmE,GAAG;EACjFC,IAAI,EAAE,eAAe;EACrBC,EAAE,EAAE,eAAe;EACnBC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAE7B,OAAO;EAChB8B,SAAS,EAAE,CAAC,kBAAkB,CAAC;EAC/BT,KAAK,EAAEpB,aAAa;EACpB8B,UAAU,EAAE,CAAC,MAAM,CAAC;EACpBlB,OAAO,EAAE,CAAC;AACZ,CAAC;AAACmB,OAAA,CAAAP,iBAAA,GAAAA,iBAAA"}
|
|
@@ -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 "
|
|
8
|
+
var VERSION = typeof "4.0.0-alpha.10" !== 'undefined' ? "4.0.0-alpha.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
|
|
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 slpk?: {\n path?: string;\n pathMode?: 'http' | 'raw';\n };\n};\n\n/**\n * Loader for SLPK - Scene Layer Package\n */\nexport const SLPKLoader: LoaderWithParser<Buffer, never, SLPKLoaderOptions> = {\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,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAYpE,IAAMC,UAA8D,GAAG;EAC5EC,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"}
|
package/dist/es5/index.js
CHANGED
|
@@ -39,6 +39,12 @@ Object.defineProperty(exports, "I3SLoader", {
|
|
|
39
39
|
return _i3sLoader.I3SLoader;
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
|
+
Object.defineProperty(exports, "I3SNodePageLoader", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function get() {
|
|
45
|
+
return _i3sNodePageLoader.I3SNodePageLoader;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
42
48
|
Object.defineProperty(exports, "SLPKLoader", {
|
|
43
49
|
enumerable: true,
|
|
44
50
|
get: function get() {
|
|
@@ -51,11 +57,12 @@ Object.defineProperty(exports, "loadFeatureAttributes", {
|
|
|
51
57
|
return _i3sAttributeLoader.loadFeatureAttributes;
|
|
52
58
|
}
|
|
53
59
|
});
|
|
60
|
+
var _constants = require("./lib/parsers/constants");
|
|
54
61
|
var _i3sLoader = require("./i3s-loader");
|
|
55
62
|
var _i3sSlpkLoader = require("./i3s-slpk-loader");
|
|
56
63
|
var _i3sContentLoader = require("./i3s-content-loader");
|
|
57
64
|
var _i3sAttributeLoader = require("./i3s-attribute-loader");
|
|
58
65
|
var _i3sBuildingSceneLayerLoader = require("./i3s-building-scene-layer-loader");
|
|
66
|
+
var _i3sNodePageLoader = require("./i3s-node-page-loader");
|
|
59
67
|
var _arcgisWebsceneLoader = require("./arcgis-webscene-loader");
|
|
60
|
-
var _constants = require("./lib/parsers/constants");
|
|
61
68
|
//# sourceMappingURL=index.js.map
|
package/dist/es5/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["_constants","require","_i3sLoader","_i3sSlpkLoader","_i3sContentLoader","_i3sAttributeLoader","_i3sBuildingSceneLayerLoader","_i3sNodePageLoader","_arcgisWebsceneLoader"],"sources":["../../src/index.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nexport type {\n BoundingVolumes,\n Mbs,\n Obb,\n SceneLayer3D,\n AttributeStorageInfo,\n Field,\n ESRIField,\n PopupInfo,\n Node3DIndexDocument,\n LodSelection,\n NodeReference,\n Resource,\n MaxScreenThresholdSQ,\n NodeInPage,\n SharedResources,\n Attribute,\n Extent,\n FeatureAttribute,\n FieldInfo,\n I3SMaterialDefinition,\n TextureDefinitionInfo,\n MaterialDefinitionInfo,\n FullExtent,\n StatisticsInfo,\n StatsInfo,\n Histogram,\n ValueCount,\n BuildingSceneSublayer,\n DATA_TYPE,\n OperationalLayer,\n TextureSetDefinitionFormats\n} from './types';\n\nexport {COORDINATE_SYSTEM} from './lib/parsers/constants';\n\nexport {I3SLoader} from './i3s-loader';\nexport {SLPKLoader} from './i3s-slpk-loader';\nexport {I3SContentLoader} from './i3s-content-loader';\nexport {I3SAttributeLoader, loadFeatureAttributes} from './i3s-attribute-loader';\nexport {I3SBuildingSceneLayerLoader} from './i3s-building-scene-layer-loader';\nexport {I3SNodePageLoader} from './i3s-node-page-loader';\nexport {ArcGisWebSceneLoader} from './arcgis-webscene-loader';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AACA,IAAAI,mBAAA,GAAAJ,OAAA;AACA,IAAAK,4BAAA,GAAAL,OAAA;AACA,IAAAM,kBAAA,GAAAN,OAAA;AACA,IAAAO,qBAAA,GAAAP,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-arcgis-webscene.js","names":["_core","require","SUPPORTED_WKID","ARCGIS_SCENE_SERVER_LAYER_TYPE","BUILDING_SCENE_LAYER","INTEGRATED_MESH_LAYER","GROUP_LAYER","SUPPORTED_LAYERS_TYPES","NO_AVAILABLE_SUPPORTED_LAYERS_ERROR","NOT_SUPPORTED_CRS_ERROR","parseWebscene","_x","_parseWebscene","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","data","layer0","operationalLayers","_yield$parseOperation","layers","unsupportedLayers","wrap","_callee$","_context","prev","next","JSON","parse","TextDecoder","decode","parseOperationalLayers","sent","length","Error","abrupt","header","stop","_x2","_x3","_parseOperationalLayers","_callee2","layersList","needToCheckCRS","index","_layer$layers","layer","isLayerSupported","_yield$parseOperation2","childLayers","childUnsupportedLayers","_callee2$","_context2","includes","layerType","checkSupportedIndexCRS","push","concat","_toConsumableArray2","_x4","_checkSupportedIndexCRS","_callee3","_layerJson$spatialRef","layerJson","wkid","_callee3$","_context3","load","url","JSONLoader","spatialReference","t0"],"sources":["../../../../src/lib/parsers/parse-arcgis-webscene.ts"],"sourcesContent":["import {JSONLoader, load} from '@loaders.gl/core';\nimport type {ArcGisWebSceneData, OperationalLayer} from '../../types';\n\n/**\n * WKID, or Well-Known ID, of the CRS. Specify either WKID or WKT of the CRS.\n * Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/spatialReference.cmn.md\n */\nconst SUPPORTED_WKID = 4326;\n\nconst ARCGIS_SCENE_SERVER_LAYER_TYPE = 'ArcGISSceneServiceLayer';\nconst BUILDING_SCENE_LAYER = 'BuildingSceneLayer';\nconst INTEGRATED_MESH_LAYER = 'IntegratedMeshLayer';\nconst GROUP_LAYER = 'GroupLayer';\n\n/**\n * Supported layers list\n * Possible operational layers in WebScene: https://developers.arcgis.com/web-scene-specification/objects/operationalLayers/\n */\nconst SUPPORTED_LAYERS_TYPES = [\n ARCGIS_SCENE_SERVER_LAYER_TYPE,\n INTEGRATED_MESH_LAYER,\n BUILDING_SCENE_LAYER,\n GROUP_LAYER\n];\n\nconst NO_AVAILABLE_SUPPORTED_LAYERS_ERROR = 'NO_AVAILABLE_SUPPORTED_LAYERS_ERROR';\nconst NOT_SUPPORTED_CRS_ERROR = 'NOT_SUPPORTED_CRS_ERROR';\n\n/**\n * Parses ArcGIS WebScene\n * @param data\n */\nexport async function parseWebscene(data: ArrayBuffer): Promise<ArcGisWebSceneData> {\n const layer0 = JSON.parse(new TextDecoder().decode(data));\n const {operationalLayers} = layer0;\n const {layers, unsupportedLayers} = await parseOperationalLayers(operationalLayers, true);\n\n if (!layers.length) {\n throw new Error(NO_AVAILABLE_SUPPORTED_LAYERS_ERROR);\n }\n\n return {\n header: layer0,\n layers,\n unsupportedLayers\n };\n}\n\n/**\n * Recursively parses WebScene operational layers.\n * @param layersList\n */\nasync function parseOperationalLayers(\n layersList: OperationalLayer[],\n needToCheckCRS: boolean\n): Promise<{layers: OperationalLayer[]; unsupportedLayers: OperationalLayer[]}> {\n const layers: OperationalLayer[] = [];\n let unsupportedLayers: OperationalLayer[] = [];\n\n for (let index = 0; index < layersList.length; index++) {\n const layer = layersList[index];\n const isLayerSupported = SUPPORTED_LAYERS_TYPES.includes(layer.layerType);\n\n if (isLayerSupported) {\n if (needToCheckCRS && layer.layerType !== GROUP_LAYER) {\n await checkSupportedIndexCRS(layer);\n needToCheckCRS = false;\n }\n\n layers.push(layer);\n } else {\n unsupportedLayers.push(layer);\n }\n\n if (layer.layers?.length) {\n const {layers: childLayers, unsupportedLayers: childUnsupportedLayers} =\n await parseOperationalLayers(layer.layers, needToCheckCRS);\n layer.layers = childLayers;\n unsupportedLayers = [...unsupportedLayers, ...childUnsupportedLayers];\n }\n }\n\n return {layers, unsupportedLayers};\n}\n\n/**\n * Check if layer has supported CRS\n * @param layer\n */\nasync function checkSupportedIndexCRS(layer: OperationalLayer) {\n try {\n const layerJson = await load(layer.url, JSONLoader);\n const wkid = layerJson?.spatialReference?.wkid;\n\n if (wkid !== SUPPORTED_WKID) {\n throw new Error(NOT_SUPPORTED_CRS_ERROR);\n }\n } catch (error) {\n throw error;\n }\n}\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAOA,IAAMC,cAAc,GAAG,IAAI;AAE3B,IAAMC,8BAA8B,GAAG,yBAAyB;AAChE,IAAMC,oBAAoB,GAAG,oBAAoB;AACjD,IAAMC,qBAAqB,GAAG,qBAAqB;AACnD,IAAMC,WAAW,GAAG,YAAY;AAMhC,IAAMC,sBAAsB,GAAG,CAC7BJ,8BAA8B,EAC9BE,qBAAqB,EACrBD,oBAAoB,EACpBE,WAAW,CACZ;AAED,IAAME,mCAAmC,GAAG,qCAAqC;AACjF,IAAMC,uBAAuB,GAAG,yBAAyB;AAAC,SAMpCC,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,IAAiB;IAAA,IAAAC,MAAA,EAAAC,iBAAA,EAAAC,qBAAA,EAAAC,MAAA,EAAAC,iBAAA;IAAA,OAAAR,YAAA,CAAAD,OAAA,CAAAU,IAAA,UAAAC,SAAAC,QAAA;MAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;QAAA;UAC7CT,MAAM,GAAGU,IAAI,CAACC,KAAK,CAAC,IAAIC,WAAW,CAAC,CAAC,CAACC,MAAM,CAACd,IAAI,CAAC,CAAC;UAClDE,iBAAiB,GAAID,MAAM,CAA3BC,iBAAiB;UAAAM,QAAA,CAAAE,IAAA;UAAA,OACkBK,sBAAsB,CAACb,iB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,iBAAiB,EAAjBA;UAAiB,CAAC;QAAA;QAAA;UAAA,OAAA+B,SAAA,CAAAf,IAAA;MAAA;IAAA,GAAAI,QAAA;EAAA,CACnC;EAAA,OAAAD,uBAAA,CAAA/B,KAAA,OAAAC,SAAA;AAAA;AAAA,SAMc6C,sBAAsBA,CAAAI,GAAA;EAAA,OAAAC,uBAAA,CAAAnD,KAAA,OAAAC,SAAA;AAAA;AAAA,SAAAkD,wBAAA;EAAAA,uBAAA,OAAAjD,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAArC,SAAA+C,SAAsCf,KAAuB;IAAA,IAAAgB,qBAAA,EAAAC,SAAA,EAAAC,IAAA;IAAA,OAAAnD,YAAA,CAAAD,OAAA,CAAAU,IAAA,UAAA2C,UAAAC,SAAA;MAAA,kBAAAA,SAAA,CAAAzC,IAAA,GAAAyC,SAAA,CAAAxC,IAAA;QAAA;UAAAwC,SAAA,CAAAzC,IAAA;UAAAyC,SAAA,CAAAxC,IAAA;UAAA,OAEjC,IAAAyC,UAAI,EAACrB,KAAK,CAACsB,GAAG,EAAEC,gBAAU,CAAC;QAAA;UAA7CN,SAAS,GAAAG,SAAA,CAAAlC,IAAA;
|
|
1
|
+
{"version":3,"file":"parse-arcgis-webscene.js","names":["_core","require","SUPPORTED_WKID","ARCGIS_SCENE_SERVER_LAYER_TYPE","BUILDING_SCENE_LAYER","INTEGRATED_MESH_LAYER","GROUP_LAYER","SUPPORTED_LAYERS_TYPES","NO_AVAILABLE_SUPPORTED_LAYERS_ERROR","NOT_SUPPORTED_CRS_ERROR","parseWebscene","_x","_parseWebscene","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","data","layer0","operationalLayers","_yield$parseOperation","layers","unsupportedLayers","wrap","_callee$","_context","prev","next","JSON","parse","TextDecoder","decode","parseOperationalLayers","sent","length","Error","abrupt","header","stop","_x2","_x3","_parseOperationalLayers","_callee2","layersList","needToCheckCRS","index","_layer$layers","layer","isLayerSupported","_yield$parseOperation2","childLayers","childUnsupportedLayers","_callee2$","_context2","includes","layerType","checkSupportedIndexCRS","push","concat","_toConsumableArray2","_x4","_checkSupportedIndexCRS","_callee3","_layerJson$spatialRef","layerJson","wkid","_callee3$","_context3","load","url","JSONLoader","spatialReference","t0"],"sources":["../../../../src/lib/parsers/parse-arcgis-webscene.ts"],"sourcesContent":["import {JSONLoader, load} from '@loaders.gl/core';\nimport type {ArcGisWebSceneData, OperationalLayer} from '../../types';\n\n/**\n * WKID, or Well-Known ID, of the CRS. Specify either WKID or WKT of the CRS.\n * Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/spatialReference.cmn.md\n */\nconst SUPPORTED_WKID = 4326;\n\nconst ARCGIS_SCENE_SERVER_LAYER_TYPE = 'ArcGISSceneServiceLayer';\nconst BUILDING_SCENE_LAYER = 'BuildingSceneLayer';\nconst INTEGRATED_MESH_LAYER = 'IntegratedMeshLayer';\nconst GROUP_LAYER = 'GroupLayer';\n\n/**\n * Supported layers list\n * Possible operational layers in WebScene: https://developers.arcgis.com/web-scene-specification/objects/operationalLayers/\n */\nconst SUPPORTED_LAYERS_TYPES = [\n ARCGIS_SCENE_SERVER_LAYER_TYPE,\n INTEGRATED_MESH_LAYER,\n BUILDING_SCENE_LAYER,\n GROUP_LAYER\n];\n\nconst NO_AVAILABLE_SUPPORTED_LAYERS_ERROR = 'NO_AVAILABLE_SUPPORTED_LAYERS_ERROR';\nconst NOT_SUPPORTED_CRS_ERROR = 'NOT_SUPPORTED_CRS_ERROR';\n\n/**\n * Parses ArcGIS WebScene\n * @param data\n */\nexport async function parseWebscene(data: ArrayBuffer): Promise<ArcGisWebSceneData> {\n const layer0 = JSON.parse(new TextDecoder().decode(data));\n const {operationalLayers} = layer0;\n const {layers, unsupportedLayers} = await parseOperationalLayers(operationalLayers, true);\n\n if (!layers.length) {\n throw new Error(NO_AVAILABLE_SUPPORTED_LAYERS_ERROR);\n }\n\n return {\n header: layer0,\n layers,\n unsupportedLayers\n };\n}\n\n/**\n * Recursively parses WebScene operational layers.\n * @param layersList\n */\nasync function parseOperationalLayers(\n layersList: OperationalLayer[],\n needToCheckCRS: boolean\n): Promise<{layers: OperationalLayer[]; unsupportedLayers: OperationalLayer[]}> {\n const layers: OperationalLayer[] = [];\n let unsupportedLayers: OperationalLayer[] = [];\n\n for (let index = 0; index < layersList.length; index++) {\n const layer = layersList[index];\n const isLayerSupported = SUPPORTED_LAYERS_TYPES.includes(layer.layerType);\n\n if (isLayerSupported) {\n if (needToCheckCRS && layer.layerType !== GROUP_LAYER) {\n await checkSupportedIndexCRS(layer);\n needToCheckCRS = false;\n }\n\n layers.push(layer);\n } else {\n unsupportedLayers.push(layer);\n }\n\n if (layer.layers?.length) {\n const {layers: childLayers, unsupportedLayers: childUnsupportedLayers} =\n await parseOperationalLayers(layer.layers, needToCheckCRS);\n layer.layers = childLayers;\n unsupportedLayers = [...unsupportedLayers, ...childUnsupportedLayers];\n }\n }\n\n return {layers, unsupportedLayers};\n}\n\n/**\n * Check if layer has supported CRS\n * @param layer\n */\nasync function checkSupportedIndexCRS(layer: OperationalLayer) {\n try {\n const layerJson = await load(layer.url, JSONLoader);\n // @ts-expect-error\n const wkid = layerJson?.spatialReference?.wkid;\n\n if (wkid !== SUPPORTED_WKID) {\n throw new Error(NOT_SUPPORTED_CRS_ERROR);\n }\n } catch (error) {\n throw error;\n }\n}\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAOA,IAAMC,cAAc,GAAG,IAAI;AAE3B,IAAMC,8BAA8B,GAAG,yBAAyB;AAChE,IAAMC,oBAAoB,GAAG,oBAAoB;AACjD,IAAMC,qBAAqB,GAAG,qBAAqB;AACnD,IAAMC,WAAW,GAAG,YAAY;AAMhC,IAAMC,sBAAsB,GAAG,CAC7BJ,8BAA8B,EAC9BE,qBAAqB,EACrBD,oBAAoB,EACpBE,WAAW,CACZ;AAED,IAAME,mCAAmC,GAAG,qCAAqC;AACjF,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IAAA;QAAA;UAAAwC,SAAA,CAAAzC,IAAA;UAAAyC,SAAA,CAAAxC,IAAA;UAAA,OAEjC,IAAAyC,UAAI,EAACrB,KAAK,CAACsB,GAAG,EAAEC,gBAAU,CAAC;QAAA;UAA7CN,SAAS,GAAAG,SAAA,CAAAlC,IAAA;UAETgC,IAAI,GAAGD,SAAS,aAATA,SAAS,wBAAAD,qBAAA,GAATC,SAAS,CAAEO,gBAAgB,cAAAR,qBAAA,uBAA3BA,qBAAA,CAA6BE,IAAI;UAAA,MAE1CA,IAAI,KAAKlE,cAAc;YAAAoE,SAAA,CAAAxC,IAAA;YAAA;UAAA;UAAA,MACnB,IAAIQ,KAAK,CAAC7B,uBAAuB,CAAC;QAAA;UAAA6D,SAAA,CAAAxC,IAAA;UAAA;QAAA;UAAAwC,SAAA,CAAAzC,IAAA;UAAAyC,SAAA,CAAAK,EAAA,GAAAL,SAAA;UAAA,MAAAA,SAAA,CAAAK,EAAA;QAAA;QAAA;UAAA,OAAAL,SAAA,CAAA7B,IAAA;MAAA;IAAA,GAAAwB,QAAA;EAAA,CAK7C;EAAA,OAAAD,uBAAA,CAAAnD,KAAA,OAAAC,SAAA;AAAA"}
|
|
@@ -5,37 +5,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.parseI3STileAttribute = parseI3STileAttribute;
|
|
8
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
9
|
var _constants = require("./constants");
|
|
12
10
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
13
11
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14
12
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
15
|
-
function parseI3STileAttribute(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
while (1) switch (_context.prev = _context.next) {
|
|
23
|
-
case 0:
|
|
24
|
-
attributeName = options.attributeName, attributeType = options.attributeType;
|
|
25
|
-
if (attributeName) {
|
|
26
|
-
_context.next = 3;
|
|
27
|
-
break;
|
|
28
|
-
}
|
|
29
|
-
return _context.abrupt("return", {});
|
|
30
|
-
case 3:
|
|
31
|
-
return _context.abrupt("return", (0, _defineProperty2.default)({}, attributeName, attributeType ? parseAttribute(attributeType, arrayBuffer) : null));
|
|
32
|
-
case 4:
|
|
33
|
-
case "end":
|
|
34
|
-
return _context.stop();
|
|
35
|
-
}
|
|
36
|
-
}, _callee);
|
|
37
|
-
}));
|
|
38
|
-
return _parseI3STileAttribute.apply(this, arguments);
|
|
13
|
+
function parseI3STileAttribute(arrayBuffer, options) {
|
|
14
|
+
var attributeName = options.attributeName,
|
|
15
|
+
attributeType = options.attributeType;
|
|
16
|
+
if (!attributeName) {
|
|
17
|
+
return {};
|
|
18
|
+
}
|
|
19
|
+
return (0, _defineProperty2.default)({}, attributeName, attributeType ? parseAttribute(attributeType, arrayBuffer) : null);
|
|
39
20
|
}
|
|
40
21
|
function parseAttribute(attributeType, arrayBuffer) {
|
|
41
22
|
switch (attributeType) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-i3s-attribute.js","names":["_constants","require","_createForOfIteratorHelper","o","allowArrayLike","it","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","i","F","s","n","done","value","e","_e","f","TypeError","normalCompletion","didErr","err","call","step","next","_e2","return","minLen","_arrayLikeToArray","Object","prototype","toString","slice","constructor","name","from","test","arr","len","arr2","parseI3STileAttribute","
|
|
1
|
+
{"version":3,"file":"parse-i3s-attribute.js","names":["_constants","require","_createForOfIteratorHelper","o","allowArrayLike","it","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","i","F","s","n","done","value","e","_e","f","TypeError","normalCompletion","didErr","err","call","step","next","_e2","return","minLen","_arrayLikeToArray","Object","prototype","toString","slice","constructor","name","from","test","arr","len","arr2","parseI3STileAttribute","arrayBuffer","options","attributeName","attributeType","_defineProperty2","default","parseAttribute","STRING_ATTRIBUTE_TYPE","parseStringsAttribute","OBJECT_ID_ATTRIBUTE_TYPE","parseShortNumberAttribute","FLOAT_64_TYPE","parseFloatAttribute","INT_16_ATTRIBUTE_TYPE","parseInt16ShortNumberAttribute","countOffset","Uint32Array","Int16Array","Float64Array","stringsCountOffset","dataOffset","bytesPerStringSize","stringsArray","stringsCount","DataView","getUint32","stringSizes","stringOffset","_iterator","_step","stringByteSize","textDecoder","TextDecoder","stringAttribute","Uint8Array","push","decode","error","console","message"],"sources":["../../../../src/lib/parsers/parse-i3s-attribute.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {TypedArray} from '@loaders.gl/schema';\n\nimport {\n STRING_ATTRIBUTE_TYPE,\n OBJECT_ID_ATTRIBUTE_TYPE,\n FLOAT_64_TYPE,\n INT_16_ATTRIBUTE_TYPE\n} from './constants';\n\ntype Attribute = string[] | TypedArray | null;\nexport type I3STileAttributes = Record<string, Attribute>;\n\n/**\n * Get particular tile and creates attribute object inside.\n * @param arrayBuffer\n * @param {Object} options\n * @returns {Promise<object>}\n */\nexport function parseI3STileAttribute(arrayBuffer: ArrayBuffer, options): I3STileAttributes {\n const {attributeName, attributeType} = options;\n\n if (!attributeName) {\n return {};\n }\n return {\n [attributeName]: attributeType ? parseAttribute(attributeType, arrayBuffer) : null\n };\n}\n\n/**\n * Parse attributes based on attribute type.\n * @param {String} attributeType\n * @param arrayBuffer\n * @returns\n */\nfunction parseAttribute(attributeType, arrayBuffer: ArrayBuffer): Attribute {\n switch (attributeType) {\n case STRING_ATTRIBUTE_TYPE:\n return parseStringsAttribute(arrayBuffer);\n case OBJECT_ID_ATTRIBUTE_TYPE:\n return parseShortNumberAttribute(arrayBuffer);\n case FLOAT_64_TYPE:\n return parseFloatAttribute(arrayBuffer);\n case INT_16_ATTRIBUTE_TYPE:\n return parseInt16ShortNumberAttribute(arrayBuffer);\n default:\n return parseShortNumberAttribute(arrayBuffer);\n }\n}\n\n/**\n * Parse short number attribute.\n * Short Integer spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.7/attributeStorageInfo.cmn.md\n * @param arrayBuffer\n * @returns\n */\nfunction parseShortNumberAttribute(arrayBuffer: ArrayBuffer): Uint32Array {\n const countOffset = 4;\n return new Uint32Array(arrayBuffer, countOffset);\n}\n\n/**\n * Parse Int16 short number attribute.\n * Parsing of such data is not documented. Added to handle Building Scene Layer Tileset attributes data.\n * @param arrayBuffer\n * @returns\n */\nfunction parseInt16ShortNumberAttribute(arrayBuffer: ArrayBuffer): Int16Array {\n const countOffset = 4;\n return new Int16Array(arrayBuffer, countOffset);\n}\n\n/**\n * Parse float attribute.\n * Double Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.7/attributeStorageInfo.cmn.md\n * @param arrayBuffer\n * @returns\n */\nfunction parseFloatAttribute(arrayBuffer: ArrayBuffer): Float64Array {\n const countOffset = 8;\n return new Float64Array(arrayBuffer, countOffset);\n}\n\n/**\n * Parse string attribute.\n * String spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.7/attributeStorageInfo.cmn.md\n * @param arrayBuffer\n * @returns list of strings\n */\nfunction parseStringsAttribute(arrayBuffer: ArrayBuffer): string[] {\n const stringsCountOffset = 0;\n const dataOffset = 8;\n const bytesPerStringSize = 4;\n const stringsArray: string[] = [];\n\n try {\n // Use DataView to avoid multiple of 4 error on Uint32Array constructor\n const stringsCount = new DataView(\n arrayBuffer,\n stringsCountOffset,\n bytesPerStringSize\n ).getUint32(stringsCountOffset, true);\n const stringSizes = new Uint32Array(arrayBuffer, dataOffset, stringsCount);\n let stringOffset = dataOffset + stringsCount * bytesPerStringSize;\n\n for (const stringByteSize of stringSizes) {\n const textDecoder = new TextDecoder('utf-8');\n const stringAttribute = new Uint8Array(arrayBuffer, stringOffset, stringByteSize);\n stringsArray.push(textDecoder.decode(stringAttribute));\n stringOffset += stringByteSize;\n }\n } catch (error) {\n console.error('Parse string attribute error: ', (error as Error).message); // eslint-disable-line\n }\n\n return stringsArray;\n}\n"],"mappings":";;;;;;;;AAIA,IAAAA,UAAA,GAAAC,OAAA;AAKqB,SAAAC,2BAAAC,CAAA,EAAAC,cAAA,QAAAC,EAAA,UAAAC,MAAA,oBAAAH,CAAA,CAAAG,MAAA,CAAAC,QAAA,KAAAJ,CAAA,qBAAAE,EAAA,QAAAG,KAAA,CAAAC,OAAA,CAAAN,CAAA,MAAAE,EAAA,GAAAK,2BAAA,CAAAP,CAAA,MAAAC,cAAA,IAAAD,CAAA,WAAAA,CAAA,CAAAQ,MAAA,qBAAAN,E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AAA;EACH,CAAC,CAAC,OAAO6D,KAAK,EAAE;IACdC,OAAO,CAACD,KAAK,CAAC,gCAAgC,EAAGA,KAAK,CAAWE,OAAO,CAAC;EAC3E;EAEA,OAAOjB,YAAY;AACrB"}
|
|
@@ -18,7 +18,7 @@ var _textures = require("@loaders.gl/textures");
|
|
|
18
18
|
var _types = require("../../types");
|
|
19
19
|
var _urlUtils = require("../utils/url-utils");
|
|
20
20
|
var _constants = require("./constants");
|
|
21
|
-
var
|
|
21
|
+
var _customizeСolors = require("../utils/customize-\u0441olors");
|
|
22
22
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
23
23
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
24
24
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
@@ -206,7 +206,7 @@ function _parseI3SNodeGeometry() {
|
|
|
206
206
|
content.coordinateSystem = _constants.COORDINATE_SYSTEM.LNGLAT_OFFSETS;
|
|
207
207
|
}
|
|
208
208
|
_context2.next = 28;
|
|
209
|
-
return (0,
|
|
209
|
+
return (0, _customizeСolors.customizeColors)(attributes.color, attributes.id, tileOptions, tilesetOptions, options);
|
|
210
210
|
case 28:
|
|
211
211
|
attributes.color = _context2.sent;
|
|
212
212
|
content.attributes = {
|