@loaders.gl/i3s 3.3.0-alpha.5 → 3.3.0-alpha.6

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.
Files changed (94) hide show
  1. package/dist/dist.min.js +984 -1291
  2. package/dist/es5/arcgis-webscene-loader.js +2 -8
  3. package/dist/es5/arcgis-webscene-loader.js.map +1 -1
  4. package/dist/es5/bundle.js +0 -1
  5. package/dist/es5/bundle.js.map +1 -1
  6. package/dist/es5/i3s-attribute-loader.js +19 -60
  7. package/dist/es5/i3s-attribute-loader.js.map +1 -1
  8. package/dist/es5/i3s-building-scene-layer-loader.js +1 -10
  9. package/dist/es5/i3s-building-scene-layer-loader.js.map +1 -1
  10. package/dist/es5/i3s-content-loader.js +1 -14
  11. package/dist/es5/i3s-content-loader.js.map +1 -1
  12. package/dist/es5/i3s-loader.js +7 -45
  13. package/dist/es5/i3s-loader.js.map +1 -1
  14. package/dist/es5/i3s-node-page-loader.js +1 -12
  15. package/dist/es5/i3s-node-page-loader.js.map +1 -1
  16. package/dist/es5/index.js +12 -18
  17. package/dist/es5/index.js.map +1 -1
  18. package/dist/es5/lib/helpers/i3s-nodepages-tiles.js +18 -78
  19. package/dist/es5/lib/helpers/i3s-nodepages-tiles.js.map +1 -1
  20. package/dist/es5/lib/parsers/constants.js +2 -18
  21. package/dist/es5/lib/parsers/constants.js.map +1 -1
  22. package/dist/es5/lib/parsers/parse-arcgis-webscene.js +128 -30
  23. package/dist/es5/lib/parsers/parse-arcgis-webscene.js.map +1 -1
  24. package/dist/es5/lib/parsers/parse-i3s-attribute.js +1 -23
  25. package/dist/es5/lib/parsers/parse-i3s-attribute.js.map +1 -1
  26. package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js +8 -25
  27. package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -1
  28. package/dist/es5/lib/parsers/parse-i3s-tile-content.js +10 -124
  29. package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -1
  30. package/dist/es5/lib/parsers/parse-i3s.js +5 -36
  31. package/dist/es5/lib/parsers/parse-i3s.js.map +1 -1
  32. package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js +0 -7
  33. package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -1
  34. package/dist/es5/lib/utils/customizeColors.js +4 -53
  35. package/dist/es5/lib/utils/customizeColors.js.map +1 -1
  36. package/dist/es5/lib/utils/url-utils.js +3 -8
  37. package/dist/es5/lib/utils/url-utils.js.map +1 -1
  38. package/dist/es5/types.js +0 -3
  39. package/dist/es5/types.js.map +1 -1
  40. package/dist/es5/workers/i3s-content-nodejs-worker.js +0 -3
  41. package/dist/es5/workers/i3s-content-nodejs-worker.js.map +1 -1
  42. package/dist/es5/workers/i3s-content-worker.js +0 -2
  43. package/dist/es5/workers/i3s-content-worker.js.map +1 -1
  44. package/dist/esm/arcgis-webscene-loader.js +3 -1
  45. package/dist/esm/arcgis-webscene-loader.js.map +1 -1
  46. package/dist/esm/bundle.js +1 -1
  47. package/dist/esm/bundle.js.map +1 -1
  48. package/dist/esm/i3s-attribute-loader.js +8 -25
  49. package/dist/esm/i3s-attribute-loader.js.map +1 -1
  50. package/dist/esm/i3s-building-scene-layer-loader.js +2 -3
  51. package/dist/esm/i3s-building-scene-layer-loader.js.map +1 -1
  52. package/dist/esm/i3s-content-loader.js +2 -4
  53. package/dist/esm/i3s-content-loader.js.map +1 -1
  54. package/dist/esm/i3s-loader.js +4 -13
  55. package/dist/esm/i3s-loader.js.map +1 -1
  56. package/dist/esm/i3s-node-page-loader.js +1 -2
  57. package/dist/esm/i3s-node-page-loader.js.map +1 -1
  58. package/dist/esm/index.js.map +1 -1
  59. package/dist/esm/lib/helpers/i3s-nodepages-tiles.js +2 -45
  60. package/dist/esm/lib/helpers/i3s-nodepages-tiles.js.map +1 -1
  61. package/dist/esm/lib/parsers/constants.js +1 -10
  62. package/dist/esm/lib/parsers/constants.js.map +1 -1
  63. package/dist/esm/lib/parsers/parse-arcgis-webscene.js +50 -11
  64. package/dist/esm/lib/parsers/parse-arcgis-webscene.js.map +1 -1
  65. package/dist/esm/lib/parsers/parse-i3s-attribute.js +1 -8
  66. package/dist/esm/lib/parsers/parse-i3s-attribute.js.map +1 -1
  67. package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js +1 -4
  68. package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -1
  69. package/dist/esm/lib/parsers/parse-i3s-tile-content.js +23 -71
  70. package/dist/esm/lib/parsers/parse-i3s-tile-content.js.map +1 -1
  71. package/dist/esm/lib/parsers/parse-i3s.js +15 -17
  72. package/dist/esm/lib/parsers/parse-i3s.js.map +1 -1
  73. package/dist/esm/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -1
  74. package/dist/esm/lib/utils/customizeColors.js +24 -36
  75. package/dist/esm/lib/utils/customizeColors.js.map +1 -1
  76. package/dist/esm/lib/utils/url-utils.js +5 -5
  77. package/dist/esm/lib/utils/url-utils.js.map +1 -1
  78. package/dist/esm/types.js +0 -3
  79. package/dist/esm/types.js.map +1 -1
  80. package/dist/esm/workers/i3s-content-nodejs-worker.js.map +1 -1
  81. package/dist/esm/workers/i3s-content-worker.js.map +1 -1
  82. package/dist/i3s-content-nodejs-worker.js +61 -60
  83. package/dist/i3s-content-nodejs-worker.js.map +3 -3
  84. package/dist/i3s-content-worker.js +490 -1020
  85. package/dist/index.d.ts +1 -1
  86. package/dist/index.d.ts.map +1 -1
  87. package/dist/lib/parsers/parse-arcgis-webscene.d.ts.map +1 -1
  88. package/dist/lib/parsers/parse-arcgis-webscene.js +49 -7
  89. package/dist/types.d.ts +1 -0
  90. package/dist/types.d.ts.map +1 -1
  91. package/package.json +8 -8
  92. package/src/index.ts +2 -1
  93. package/src/lib/parsers/parse-arcgis-webscene.ts +57 -7
  94. package/src/types.ts +1 -0
@@ -1,19 +1,15 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.ArcGisWebSceneLoader = void 0;
9
-
10
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
-
12
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
-
14
10
  var _parseArcgisWebscene = require("./lib/parsers/parse-arcgis-webscene");
11
+ var VERSION = typeof "3.3.0-alpha.6" !== 'undefined' ? "3.3.0-alpha.6" : 'beta';
15
12
 
16
- var VERSION = typeof "3.3.0-alpha.5" !== 'undefined' ? "3.3.0-alpha.5" : 'beta';
17
13
  var ArcGisWebSceneLoader = {
18
14
  name: 'ArcGIS Web Scene Loader',
19
15
  id: 'arcgis-web-scene',
@@ -24,12 +20,11 @@ var ArcGisWebSceneLoader = {
24
20
  extensions: ['json'],
25
21
  options: {}
26
22
  };
27
- exports.ArcGisWebSceneLoader = ArcGisWebSceneLoader;
28
23
 
24
+ exports.ArcGisWebSceneLoader = ArcGisWebSceneLoader;
29
25
  function parse(_x) {
30
26
  return _parse.apply(this, arguments);
31
27
  }
32
-
33
28
  function _parse() {
34
29
  _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(data) {
35
30
  return _regenerator.default.wrap(function _callee$(_context) {
@@ -37,7 +32,6 @@ function _parse() {
37
32
  switch (_context.prev = _context.next) {
38
33
  case 0:
39
34
  return _context.abrupt("return", (0, _parseArcgisWebscene.parseWebscene)(data));
40
-
41
35
  case 1:
42
36
  case "end":
43
37
  return _context.stop();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/arcgis-webscene-loader.ts"],"names":["VERSION","ArcGisWebSceneLoader","name","id","module","version","mimeTypes","parse","extensions","options","data"],"mappings":";;;;;;;;;;;;;AAGA;;AAIA,IAAMA,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,MAAnE;AAMO,IAAMC,oBAAsC,GAAG;AACpDC,EAAAA,IAAI,EAAE,yBAD8C;AAEpDC,EAAAA,EAAE,EAAE,kBAFgD;AAGpDC,EAAAA,MAAM,EAAE,KAH4C;AAIpDC,EAAAA,OAAO,EAAEL,OAJ2C;AAKpDM,EAAAA,SAAS,EAAE,CAAC,kBAAD,CALyC;AAMpDC,EAAAA,KAAK,EAALA,KANoD;AAOpDC,EAAAA,UAAU,EAAE,CAAC,MAAD,CAPwC;AAQpDC,EAAAA,OAAO,EAAE;AAR2C,CAA/C;;;SAeQF,K;;;;;qEAAf,iBAAqBG,IAArB;AAAA;AAAA;AAAA;AAAA;AAAA,6CACS,wCAAcA,IAAd,CADT;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G","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"],"file":"arcgis-webscene-loader.js"}
1
+ {"version":3,"file":"arcgis-webscene-loader.js","names":["VERSION","ArcGisWebSceneLoader","name","id","module","version","mimeTypes","parse","extensions","options","data","parseWebscene"],"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;AAIA,IAAMA,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,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;;AAAC;AAAA,SAMaF,KAAK;EAAA;AAAA;AAAA;EAAA,mEAApB,iBAAqBG,IAAiB;IAAA;MAAA;QAAA;UAAA;YAAA,iCAC7B,IAAAC,kCAAa,EAACD,IAAI,CAAC;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CAC3B;EAAA;AAAA"}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var moduleExports = require('./index');
4
-
5
4
  globalThis.loaders = globalThis.loaders || {};
6
5
  module.exports = Object.assign(globalThis.loaders, moduleExports);
7
6
  //# sourceMappingURL=bundle.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/bundle.ts"],"names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"mappings":";;AACA,IAAMA,aAAa,GAAGC,OAAO,CAAC,SAAD,CAA7B;;AACAC,UAAU,CAACC,OAAX,GAAqBD,UAAU,CAACC,OAAX,IAAsB,EAA3C;AACAC,MAAM,CAACC,OAAP,GAAiBC,MAAM,CAACC,MAAP,CAAcL,UAAU,CAACC,OAAzB,EAAkCH,aAAlC,CAAjB","sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"file":"bundle.js"}
1
+ {"version":3,"file":"bundle.js","names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"sources":["../../src/bundle.ts"],"sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"mappings":";;AACA,IAAMA,aAAa,GAAGC,OAAO,CAAC,SAAS,CAAC;AACxCC,UAAU,CAACC,OAAO,GAAGD,UAAU,CAACC,OAAO,IAAI,CAAC,CAAC;AAC7CC,MAAM,CAACC,OAAO,GAAGC,MAAM,CAACC,MAAM,CAACL,UAAU,CAACC,OAAO,EAAEH,aAAa,CAAC"}
@@ -1,31 +1,21 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
- exports.loadFeatureAttributes = loadFeatureAttributes;
9
- exports.getAttributeValueType = getAttributeValueType;
10
7
  exports.I3SAttributeLoader = void 0;
11
-
8
+ exports.getAttributeValueType = getAttributeValueType;
9
+ exports.loadFeatureAttributes = loadFeatureAttributes;
12
10
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
13
-
14
11
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
-
16
12
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
17
-
18
13
  var _core = require("@loaders.gl/core");
19
-
20
14
  var _parseI3sAttribute = require("./lib/parsers/parse-i3s-attribute");
21
-
22
15
  var _urlUtils = require("./lib/utils/url-utils");
23
-
24
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
25
-
26
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
27
-
28
- var VERSION = typeof "3.3.0-alpha.5" !== 'undefined' ? "3.3.0-alpha.5" : 'latest';
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
+ 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.3.0-alpha.6" !== 'undefined' ? "3.3.0-alpha.6" : 'latest';
29
19
  var EMPTY_VALUE = '';
30
20
  var REJECTED_STATUS = 'rejected';
31
21
  var I3SAttributeLoader = {
@@ -40,11 +30,9 @@ var I3SAttributeLoader = {
40
30
  binary: true
41
31
  };
42
32
  exports.I3SAttributeLoader = I3SAttributeLoader;
43
-
44
33
  function parse(_x, _x2) {
45
34
  return _parse.apply(this, arguments);
46
35
  }
47
-
48
36
  function _parse() {
49
37
  _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(data, options) {
50
38
  return _regenerator.default.wrap(function _callee$(_context) {
@@ -53,7 +41,6 @@ function _parse() {
53
41
  case 0:
54
42
  data = (0, _parseI3sAttribute.parseI3STileAttribute)(data, options);
55
43
  return _context.abrupt("return", data);
56
-
57
44
  case 2:
58
45
  case "end":
59
46
  return _context.stop();
@@ -63,47 +50,40 @@ function _parse() {
63
50
  }));
64
51
  return _parse.apply(this, arguments);
65
52
  }
66
-
67
53
  function loadFeatureAttributes(_x3, _x4) {
68
54
  return _loadFeatureAttributes.apply(this, arguments);
69
55
  }
70
-
71
56
  function _loadFeatureAttributes() {
72
57
  _loadFeatureAttributes = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(tile, featureId) {
73
58
  var options,
74
- _getAttributesData,
75
- attributeStorageInfo,
76
- attributeUrls,
77
- tilesetFields,
78
- attributes,
79
- attributeLoadPromises,
80
- index,
81
- _options$i3s,
82
- url,
83
- attributeName,
84
- attributeType,
85
- loadOptions,
86
- promise,
87
- _args2 = arguments;
88
-
59
+ _getAttributesData,
60
+ attributeStorageInfo,
61
+ attributeUrls,
62
+ tilesetFields,
63
+ attributes,
64
+ attributeLoadPromises,
65
+ index,
66
+ _options$i3s,
67
+ url,
68
+ attributeName,
69
+ attributeType,
70
+ loadOptions,
71
+ promise,
72
+ _args2 = arguments;
89
73
  return _regenerator.default.wrap(function _callee2$(_context2) {
90
74
  while (1) {
91
75
  switch (_context2.prev = _context2.next) {
92
76
  case 0:
93
77
  options = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
94
78
  _getAttributesData = getAttributesData(tile), attributeStorageInfo = _getAttributesData.attributeStorageInfo, attributeUrls = _getAttributesData.attributeUrls, tilesetFields = _getAttributesData.tilesetFields;
95
-
96
79
  if (!(!attributeStorageInfo || !attributeUrls || featureId < 0)) {
97
80
  _context2.next = 4;
98
81
  break;
99
82
  }
100
-
101
83
  return _context2.abrupt("return", null);
102
-
103
84
  case 4:
104
85
  attributes = [];
105
86
  attributeLoadPromises = [];
106
-
107
87
  for (index = 0; index < attributeStorageInfo.length; index++) {
108
88
  url = (0, _urlUtils.getUrlWithToken)(attributeUrls[index], (_options$i3s = options.i3s) === null || _options$i3s === void 0 ? void 0 : _options$i3s.token);
109
89
  attributeName = attributeStorageInfo[index].name;
@@ -115,31 +95,24 @@ function _loadFeatureAttributes() {
115
95
  promise = (0, _core.load)(url, I3SAttributeLoader, loadOptions);
116
96
  attributeLoadPromises.push(promise);
117
97
  }
118
-
119
98
  _context2.prev = 7;
120
99
  _context2.next = 10;
121
100
  return Promise.allSettled(attributeLoadPromises);
122
-
123
101
  case 10:
124
102
  attributes = _context2.sent;
125
103
  _context2.next = 15;
126
104
  break;
127
-
128
105
  case 13:
129
106
  _context2.prev = 13;
130
107
  _context2.t0 = _context2["catch"](7);
131
-
132
108
  case 15:
133
109
  if (attributes.length) {
134
110
  _context2.next = 17;
135
111
  break;
136
112
  }
137
-
138
113
  return _context2.abrupt("return", null);
139
-
140
114
  case 17:
141
115
  return _context2.abrupt("return", generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields));
142
-
143
116
  case 18:
144
117
  case "end":
145
118
  return _context2.stop();
@@ -149,10 +122,8 @@ function _loadFeatureAttributes() {
149
122
  }));
150
123
  return _loadFeatureAttributes.apply(this, arguments);
151
124
  }
152
-
153
125
  function getAttributesData(tile) {
154
126
  var _tile$tileset, _tile$tileset$tileset, _tile$header, _tile$tileset2, _tile$tileset2$tilese;
155
-
156
127
  var attributeStorageInfo = (_tile$tileset = tile.tileset) === null || _tile$tileset === void 0 ? void 0 : (_tile$tileset$tileset = _tile$tileset.tileset) === null || _tile$tileset$tileset === void 0 ? void 0 : _tile$tileset$tileset.attributeStorageInfo;
157
128
  var attributeUrls = (_tile$header = tile.header) === null || _tile$header === void 0 ? void 0 : _tile$header.attributeUrls;
158
129
  var tilesetFields = ((_tile$tileset2 = tile.tileset) === null || _tile$tileset2 === void 0 ? void 0 : (_tile$tileset2$tilese = _tile$tileset2.tileset) === null || _tile$tileset2$tilese === void 0 ? void 0 : _tile$tileset2$tilese.fields) || [];
@@ -169,7 +140,6 @@ function getAttributeValueType(attribute) {
169
140
  } else if (attribute.hasOwnProperty('attributeValues')) {
170
141
  return attribute.attributeValues.valueType;
171
142
  }
172
-
173
143
  return '';
174
144
  }
175
145
 
@@ -185,36 +155,29 @@ function generateAttributesByFeatureId(attributes, attributeStorageInfo, feature
185
155
  var objectIds = attributes.find(function (attribute) {
186
156
  return attribute.value[objectIdsAttributeName];
187
157
  });
188
-
189
158
  if (!objectIds) {
190
159
  return null;
191
160
  }
192
-
193
161
  var attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);
194
-
195
162
  if (attributeIndex < 0) {
196
163
  return null;
197
164
  }
198
-
199
165
  return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);
200
166
  }
201
167
 
202
168
  function getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo, tilesetFields) {
203
169
  var attributesObject = {};
204
-
205
170
  for (var index = 0; index < attributeStorageInfo.length; index++) {
206
171
  var attributeName = attributeStorageInfo[index].name;
207
172
  var codedValues = getAttributeCodedValues(attributeName, tilesetFields);
208
173
  var attribute = getAttributeByIndexAndAttributeName(attributes, index, attributeName);
209
174
  attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex, codedValues);
210
175
  }
211
-
212
176
  return attributesObject;
213
177
  }
214
178
 
215
179
  function getAttributeCodedValues(attributeName, tilesetFields) {
216
180
  var _attributeField$domai;
217
-
218
181
  var attributeField = tilesetFields.find(function (field) {
219
182
  return field.name === attributeName || field.alias === attributeName;
220
183
  });
@@ -223,17 +186,14 @@ function getAttributeCodedValues(attributeName, tilesetFields) {
223
186
 
224
187
  function getAttributeByIndexAndAttributeName(attributes, index, attributesName) {
225
188
  var attributeObject = attributes[index];
226
-
227
189
  if (attributeObject.status === REJECTED_STATUS) {
228
190
  return null;
229
191
  }
230
-
231
192
  return attributeObject.value[attributesName];
232
193
  }
233
194
 
234
195
  function formatAttributeValue(attribute, featureIdIndex, codedValues) {
235
196
  var value = EMPTY_VALUE;
236
-
237
197
  if (attribute && featureIdIndex in attribute) {
238
198
  value = String(attribute[featureIdIndex]).replace(/\u0000|NaN/g, '').trim();
239
199
  }
@@ -244,7 +204,6 @@ function formatAttributeValue(attribute, featureIdIndex, codedValues) {
244
204
  });
245
205
  value = (codeValue === null || codeValue === void 0 ? void 0 : codeValue.name) || EMPTY_VALUE;
246
206
  }
247
-
248
207
  return value;
249
208
  }
250
209
  //# sourceMappingURL=i3s-attribute-loader.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/i3s-attribute-loader.ts"],"names":["VERSION","EMPTY_VALUE","REJECTED_STATUS","I3SAttributeLoader","name","id","module","version","mimeTypes","parse","extensions","options","binary","data","loadFeatureAttributes","tile","featureId","getAttributesData","attributeStorageInfo","attributeUrls","tilesetFields","attributes","attributeLoadPromises","index","length","url","i3s","token","attributeName","attributeType","getAttributeValueType","loadOptions","promise","push","Promise","allSettled","generateAttributesByFeatureId","tileset","header","fields","attribute","hasOwnProperty","attributeValues","valueType","getFeatureIdsAttributeName","objectIdsAttribute","find","includes","objectIdsAttributeName","objectIds","value","attributeIndex","indexOf","getFeatureAttributesByIndex","featureIdIndex","attributesObject","codedValues","getAttributeCodedValues","getAttributeByIndexAndAttributeName","formatAttributeValue","attributeField","field","alias","domain","attributesName","attributeObject","status","String","replace","trim","codeValue","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,EAAgF;AAC9E,MAAMC,eAAe,GAAG5C,UAAU,CAACE,KAAD,CAAlC;;AAEA,MAAI0C,eAAe,CAACC,MAAhB,KAA2BhE,eAA/B,EAAgD;AAC9C,WAAO,IAAP;AACD;;AAED,SAAO+D,eAAe,CAACf,KAAhB,CAAsBc,cAAtB,CAAP;AACD;;AAQD,SAASL,oBAAT,CAA8BnB,SAA9B,EAAyCc,cAAzC,EAAyDE,WAAzD,EAAsE;AACpE,MAAIN,KAAK,GAAGjD,WAAZ;;AAEA,MAAIuC,SAAS,IAAKc,cAAc,IAAId,SAApC,EAAgD;AAE9CU,IAAAA,KAAK,GAAGiB,MAAM,CAAC3B,SAAS,CAACc,cAAD,CAAV,CAAN,CAAkCc,OAAlC,CAA0C,aAA1C,EAAyD,EAAzD,EAA6DC,IAA7D,EAAR;AACD;;AAGD,MAAIb,WAAW,CAAChC,MAAhB,EAAwB;AACtB,QAAM8C,SAAS,GAAGd,WAAW,CAACV,IAAZ,CAAiB,UAAAyB,UAAU;AAAA,aAAIA,UAAU,CAACC,IAAX,KAAoBC,MAAM,CAACvB,KAAD,CAA9B;AAAA,KAA3B,CAAlB;AACAA,IAAAA,KAAK,GAAG,CAAAoB,SAAS,SAAT,IAAAA,SAAS,WAAT,YAAAA,SAAS,CAAElE,IAAX,KAAmBH,WAA3B;AACD;;AAED,SAAOiD,KAAP;AACD","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"],"file":"i3s-attribute-loader.js"}
1
+ {"version":3,"file":"i3s-attribute-loader.js","names":["VERSION","EMPTY_VALUE","REJECTED_STATUS","I3SAttributeLoader","name","id","module","version","mimeTypes","parse","extensions","options","binary","data","parseI3STileAttribute","loadFeatureAttributes","tile","featureId","getAttributesData","attributeStorageInfo","attributeUrls","tilesetFields","attributes","attributeLoadPromises","index","length","url","getUrlWithToken","i3s","token","attributeName","attributeType","getAttributeValueType","loadOptions","promise","load","push","Promise","allSettled","generateAttributesByFeatureId","tileset","header","fields","attribute","hasOwnProperty","attributeValues","valueType","getFeatureIdsAttributeName","objectIdsAttribute","find","includes","objectIdsAttributeName","objectIds","value","attributeIndex","indexOf","getFeatureAttributesByIndex","featureIdIndex","attributesObject","codedValues","getAttributeCodedValues","getAttributeByIndexAndAttributeName","formatAttributeValue","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;AACA;AACA;AAAsD;AAAA;AAItD,IAAMA,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAAQ;AAC3E,IAAMC,WAAW,GAAG,EAAE;AACtB,IAAMC,eAAe,GAAG,UAAU;AAI3B,IAAMC,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,EAALA,KAAK;EACLC,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,OAAO,EAAE,CAAC,CAAC;EACXC,MAAM,EAAE;AACV,CAAC;AAAC;AAAA,SAEaH,KAAK;EAAA;AAAA;AAAA;EAAA,mEAApB,iBAAqBI,IAAI,EAAEF,OAAO;IAAA;MAAA;QAAA;UAAA;YAChCE,IAAI,GAAG,IAAAC,wCAA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helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.I3SBuildingSceneLayerLoader = void 0;
9
-
10
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
-
12
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
-
14
10
  var _parseI3sBuildingSceneLayer = require("./lib/parsers/parse-i3s-building-scene-layer");
15
11
 
16
- var VERSION = typeof "3.3.0-alpha.5" !== 'undefined' ? "3.3.0-alpha.5" : 'beta';
12
+ var VERSION = typeof "3.3.0-alpha.6" !== 'undefined' ? "3.3.0-alpha.6" : 'beta';
17
13
  var I3SBuildingSceneLayerLoader = {
18
14
  name: 'I3S Building Scene Layer',
19
15
  id: 'i3s-building-scene-layer',
@@ -25,11 +21,9 @@ var I3SBuildingSceneLayerLoader = {
25
21
  options: {}
26
22
  };
27
23
  exports.I3SBuildingSceneLayerLoader = I3SBuildingSceneLayerLoader;
28
-
29
24
  function parse(_x, _x2, _x3) {
30
25
  return _parse.apply(this, arguments);
31
26
  }
32
-
33
27
  function _parse() {
34
28
  _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(data, options, context) {
35
29
  return _regenerator.default.wrap(function _callee$(_context) {
@@ -40,12 +34,9 @@ function _parse() {
40
34
  _context.next = 2;
41
35
  break;
42
36
  }
43
-
44
37
  throw new Error('Url is not provided');
45
-
46
38
  case 2:
47
39
  return _context.abrupt("return", (0, _parseI3sBuildingSceneLayer.parseBuildingSceneLayer)(data, context.url));
48
-
49
40
  case 3:
50
41
  case "end":
51
42
  return _context.stop();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/i3s-building-scene-layer-loader.ts"],"names":["VERSION","I3SBuildingSceneLayerLoader","name","id","module","version","mimeTypes","parse","extensions","options","data","context","url","Error"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA,IAAMA,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,MAAnE;AAIO,IAAMC,2BAA6C,GAAG;AAC3DC,EAAAA,IAAI,EAAE,0BADqD;AAE3DC,EAAAA,EAAE,EAAE,0BAFuD;AAG3DC,EAAAA,MAAM,EAAE,KAHmD;AAI3DC,EAAAA,OAAO,EAAEL,OAJkD;AAK3DM,EAAAA,SAAS,EAAE,CAAC,kBAAD,CALgD;AAM3DC,EAAAA,KAAK,EAALA,KAN2D;AAO3DC,EAAAA,UAAU,EAAE,CAAC,MAAD,CAP+C;AAQ3DC,EAAAA,OAAO,EAAE;AARkD,CAAtD;;;SAWQF,K;;;;;qEAAf,iBACEG,IADF,EAEED,OAFF,EAGEE,OAHF;AAAA;AAAA;AAAA;AAAA;AAAA,gBAKOA,OALP,aAKOA,OALP,eAKOA,OAAO,CAAEC,GALhB;AAAA;AAAA;AAAA;;AAAA,kBAMU,IAAIC,KAAJ,CAAU,qBAAV,CANV;;AAAA;AAAA,6CASS,yDAAwBH,IAAxB,EAA8BC,OAAO,CAACC,GAAtC,CATT;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G","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"],"file":"i3s-building-scene-layer-loader.js"}
1
+ {"version":3,"file":"i3s-building-scene-layer-loader.js","names":["VERSION","I3SBuildingSceneLayerLoader","name","id","module","version","mimeTypes","parse","extensions","options","data","context","url","Error","parseBuildingSceneLayer"],"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;;AAKA,IAAMA,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,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;AAAC;AAAA,SAEaF,KAAK;EAAA;AAAA;AAAA;EAAA,mEAApB,iBACEG,IAAiB,EACjBD,OAAuB,EACvBE,OAAuB;IAAA;MAAA;QAAA;UAAA;YAAA,IAElBA,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEC,GAAG;cAAA;cAAA;YAAA;YAAA,MACT,IAAIC,KAAK,CAAC,qBAAqB,CAAC;UAAA;YAAA,iCAGjC,IAAAC,mDAAuB,EAACJ,IAAI,EAAEC,OAAO,CAACC,GAAG,CAAC;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CAClD;EAAA;AAAA"}
@@ -1,21 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.I3SContentLoader = void 0;
9
-
10
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
-
12
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
-
14
10
  var _workerUtils = require("@loaders.gl/worker-utils");
15
-
16
11
  var _parseI3sTileContent = require("./lib/parsers/parse-i3s-tile-content");
17
12
 
18
- var VERSION = typeof "3.3.0-alpha.5" !== 'undefined' ? "3.3.0-alpha.5" : 'beta';
13
+ var VERSION = typeof "3.3.0-alpha.6" !== 'undefined' ? "3.3.0-alpha.6" : 'beta';
19
14
  var I3SContentLoader = {
20
15
  name: 'I3S Content (Indexed Scene Layers)',
21
16
  id: _workerUtils.isBrowser ? 'i3s-content' : 'i3s-content-nodejs',
@@ -30,15 +25,12 @@ var I3SContentLoader = {
30
25
  }
31
26
  };
32
27
  exports.I3SContentLoader = I3SContentLoader;
33
-
34
28
  function parse(_x, _x2, _x3) {
35
29
  return _parse.apply(this, arguments);
36
30
  }
37
-
38
31
  function _parse() {
39
32
  _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(data, options, context) {
40
33
  var _ref, tile, _tileOptions, tileset, _tilesetOptions, tileOptions, tilesetOptions;
41
-
42
34
  return _regenerator.default.wrap(function _callee$(_context) {
43
35
  while (1) {
44
36
  switch (_context.prev = _context.next) {
@@ -46,21 +38,16 @@ function _parse() {
46
38
  _ref = (options === null || options === void 0 ? void 0 : options.i3s) || {}, tile = _ref.tile, _tileOptions = _ref._tileOptions, tileset = _ref.tileset, _tilesetOptions = _ref._tilesetOptions;
47
39
  tileOptions = _tileOptions || tile;
48
40
  tilesetOptions = _tilesetOptions || tileset;
49
-
50
41
  if (!(!tileOptions || !tilesetOptions)) {
51
42
  _context.next = 5;
52
43
  break;
53
44
  }
54
-
55
45
  return _context.abrupt("return", null);
56
-
57
46
  case 5:
58
47
  _context.next = 7;
59
48
  return (0, _parseI3sTileContent.parseI3STileContent)(data, tileOptions, tilesetOptions, options, context);
60
-
61
49
  case 7:
62
50
  return _context.abrupt("return", _context.sent);
63
-
64
51
  case 8:
65
52
  case "end":
66
53
  return _context.stop();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/i3s-content-loader.ts"],"names":["VERSION","I3SContentLoader","name","id","isBrowser","module","worker","version","mimeTypes","parse","extensions","options","data","context","i3s","tile","_tileOptions","tileset","_tilesetOptions","tileOptions","tilesetOptions"],"mappings":";;;;;;;;;;;;;AAAA;;AAGA;;AAMA,IAAMA,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,MAAnE;AAIO,IAAMC,gBAAkC,GAAG;AAChDC,EAAAA,IAAI,EAAE,oCAD0C;AAEhDC,EAAAA,EAAE,EAAEC,yBAAY,aAAZ,GAA4B,oBAFgB;AAGhDC,EAAAA,MAAM,EAAE,KAHwC;AAIhDC,EAAAA,MAAM,EAAE,IAJwC;AAKhDC,EAAAA,OAAO,EAAEP,OALuC;AAMhDQ,EAAAA,SAAS,EAAE,CAAC,0BAAD,CANqC;AAOhDC,EAAAA,KAAK,EAALA,KAPgD;AAQhDC,EAAAA,UAAU,EAAE,CAAC,KAAD,CARoC;AAShDC,EAAAA,OAAO,EAAE;AACP,mBAAe;AADR;AATuC,CAA3C;;;SAcQF,K;;;;;qEAAf,iBAAqBG,IAArB,EAA2BD,OAA3B,EAAuDE,OAAvD;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA,mBACyD,CAAAF,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAEG,GAAT,KAAgB,EADzE,EACSC,IADT,QACSA,IADT,EACeC,YADf,QACeA,YADf,EAC6BC,OAD7B,QAC6BA,OAD7B,EACsCC,eADtC,QACsCA,eADtC;AAEQC,YAAAA,WAFR,GAEsBH,YAAY,IAAID,IAFtC;AAGQK,YAAAA,cAHR,GAGyBF,eAAe,IAAID,OAH5C;;AAAA,kBAIM,CAACE,WAAD,IAAgB,CAACC,cAJvB;AAAA;AAAA;AAAA;;AAAA,6CAKW,IALX;;AAAA;AAAA;AAAA,mBAOe,8CACXR,IADW,EAEXO,WAFW,EAGXC,cAHW,EAIXT,OAJW,EAKXE,OALW,CAPf;;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G","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__ : 'beta';\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"],"file":"i3s-content-loader.js"}
1
+ {"version":3,"file":"i3s-content-loader.js","names":["VERSION","I3SContentLoader","name","id","isBrowser","module","worker","version","mimeTypes","parse","extensions","options","data","context","i3s","tile","_tileOptions","tileset","_tilesetOptions","tileOptions","tilesetOptions","parseI3STileContent"],"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__ : 'beta';\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;AAGA;;AAMA,IAAMA,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,MAAM;AAIlE,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;AAAC;AAAA,SAEaF,KAAK;EAAA;AAAA;AAAA;EAAA,mEAApB,iBAAqBG,IAAI,EAAED,OAA0B,EAAEE,OAAuB;IAAA;IAAA;MAAA;QAAA;UAAA;YAAA,OACrB,CAAAF,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEG,GAAG,KAAI,CAAC,CAAC,EAAlEC,IAAI,QAAJA,IAAI,EAAEC,YAAY,QAAZA,YAAY,EAAEC,OAAO,QAAPA,OAAO,EAAEC,eAAe,QAAfA,eAAe;YAC7CC,WAAW,GAAGH,YAAY,IAAID,IAAI;YAClCK,cAAc,GAAGF,eAAe,IAAID,OAAO;YAAA,MAC7C,CAACE,WAAW,IAAI,CAACC,cAAc;cAAA;cAAA;YAAA;YAAA,iCAC1B,IAAI;UAAA;YAAA;YAAA,OAEA,IAAAC,wCAAmB,EAC9BT,IAAI,EACJO,WAAW,EACXC,cAAc,EACdT,OAAO,EACPE,OAAO,CACR;UAAA;YAAA;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CACF;EAAA;AAAA"}