@loaders.gl/i3s 3.4.0-alpha.2 → 3.4.0-alpha.3

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 (76) hide show
  1. package/dist/dist.min.js +180 -15
  2. package/dist/es5/arcgis-webscene-loader.js +7 -11
  3. package/dist/es5/arcgis-webscene-loader.js.map +1 -1
  4. package/dist/es5/i3s-attribute-loader.js +51 -63
  5. package/dist/es5/i3s-attribute-loader.js.map +1 -1
  6. package/dist/es5/i3s-building-scene-layer-loader.js +13 -16
  7. package/dist/es5/i3s-building-scene-layer-loader.js.map +1 -1
  8. package/dist/es5/i3s-content-loader.js +19 -22
  9. package/dist/es5/i3s-content-loader.js.map +1 -1
  10. package/dist/es5/i3s-loader.js +86 -94
  11. package/dist/es5/i3s-loader.js.map +1 -1
  12. package/dist/es5/i3s-node-page-loader.js +14 -18
  13. package/dist/es5/i3s-node-page-loader.js.map +1 -1
  14. package/dist/es5/index.js.map +1 -1
  15. package/dist/es5/lib/helpers/i3s-nodepages-tiles.js +109 -124
  16. package/dist/es5/lib/helpers/i3s-nodepages-tiles.js.map +1 -1
  17. package/dist/es5/lib/parsers/constants.js +4 -5
  18. package/dist/es5/lib/parsers/constants.js.map +1 -1
  19. package/dist/es5/lib/parsers/parse-arcgis-webscene.js +99 -107
  20. package/dist/es5/lib/parsers/parse-arcgis-webscene.js.map +1 -1
  21. package/dist/es5/lib/parsers/parse-i3s-attribute.js +14 -21
  22. package/dist/es5/lib/parsers/parse-i3s-attribute.js.map +1 -1
  23. package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js +13 -17
  24. package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -1
  25. package/dist/es5/lib/parsers/parse-i3s-tile-content.js +166 -187
  26. package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -1
  27. package/dist/es5/lib/parsers/parse-i3s.js +31 -35
  28. package/dist/es5/lib/parsers/parse-i3s.js.map +1 -1
  29. package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -1
  30. package/dist/es5/lib/utils/customizeColors.js +102 -107
  31. package/dist/es5/lib/utils/customizeColors.js.map +1 -1
  32. package/dist/es5/lib/utils/url-utils.js +0 -2
  33. package/dist/es5/lib/utils/url-utils.js.map +1 -1
  34. package/dist/es5/types.js +8 -8
  35. package/dist/es5/types.js.map +1 -1
  36. package/dist/es5/workers/i3s-content-nodejs-worker.js.map +1 -1
  37. package/dist/es5/workers/i3s-content-worker.js.map +1 -1
  38. package/dist/esm/arcgis-webscene-loader.js +1 -4
  39. package/dist/esm/arcgis-webscene-loader.js.map +1 -1
  40. package/dist/esm/bundle.js +0 -1
  41. package/dist/esm/bundle.js.map +1 -1
  42. package/dist/esm/i3s-attribute-loader.js +2 -14
  43. package/dist/esm/i3s-attribute-loader.js.map +1 -1
  44. package/dist/esm/i3s-building-scene-layer-loader.js +1 -2
  45. package/dist/esm/i3s-building-scene-layer-loader.js.map +1 -1
  46. package/dist/esm/i3s-content-loader.js +1 -2
  47. package/dist/esm/i3s-content-loader.js.map +1 -1
  48. package/dist/esm/i3s-loader.js +1 -3
  49. package/dist/esm/i3s-loader.js.map +1 -1
  50. package/dist/esm/i3s-node-page-loader.js +1 -3
  51. package/dist/esm/i3s-node-page-loader.js.map +1 -1
  52. package/dist/esm/lib/helpers/i3s-nodepages-tiles.js +0 -8
  53. package/dist/esm/lib/helpers/i3s-nodepages-tiles.js.map +1 -1
  54. package/dist/esm/lib/parsers/constants.js +3 -4
  55. package/dist/esm/lib/parsers/constants.js.map +1 -1
  56. package/dist/esm/lib/parsers/parse-arcgis-webscene.js +0 -4
  57. package/dist/esm/lib/parsers/parse-arcgis-webscene.js.map +1 -1
  58. package/dist/esm/lib/parsers/parse-i3s-attribute.js +0 -7
  59. package/dist/esm/lib/parsers/parse-i3s-attribute.js.map +1 -1
  60. package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js +0 -3
  61. package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -1
  62. package/dist/esm/lib/parsers/parse-i3s-tile-content.js +0 -21
  63. package/dist/esm/lib/parsers/parse-i3s-tile-content.js.map +1 -1
  64. package/dist/esm/lib/parsers/parse-i3s.js +2 -8
  65. package/dist/esm/lib/parsers/parse-i3s.js.map +1 -1
  66. package/dist/esm/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -1
  67. package/dist/esm/lib/utils/customizeColors.js +0 -4
  68. package/dist/esm/lib/utils/customizeColors.js.map +1 -1
  69. package/dist/esm/lib/utils/url-utils.js +0 -3
  70. package/dist/esm/lib/utils/url-utils.js.map +1 -1
  71. package/dist/esm/types.js +6 -6
  72. package/dist/esm/types.js.map +1 -1
  73. package/dist/i3s-content-nodejs-worker.js +57 -57
  74. package/dist/i3s-content-nodejs-worker.js.map +3 -3
  75. package/dist/i3s-content-worker.js +170 -25
  76. package/package.json +8 -8
package/dist/dist.min.js CHANGED
@@ -119,8 +119,8 @@
119
119
  };
120
120
  this.name = jobName;
121
121
  this.workerThread = workerThread;
122
- this.result = new Promise((resolve, reject) => {
123
- this._resolve = resolve;
122
+ this.result = new Promise((resolve2, reject) => {
123
+ this._resolve = resolve2;
124
124
  this._reject = reject;
125
125
  });
126
126
  }
@@ -754,8 +754,54 @@
754
754
  }
755
755
  });
756
756
 
757
+ // ../../node_modules/@babel/runtime/helpers/esm/typeof.js
758
+ function _typeof(obj) {
759
+ "@babel/helpers - typeof";
760
+ return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) {
761
+ return typeof obj2;
762
+ } : function(obj2) {
763
+ return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
764
+ }, _typeof(obj);
765
+ }
766
+ var init_typeof = __esm({
767
+ "../../node_modules/@babel/runtime/helpers/esm/typeof.js"() {
768
+ }
769
+ });
770
+
771
+ // ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
772
+ function _toPrimitive(input, hint) {
773
+ if (_typeof(input) !== "object" || input === null)
774
+ return input;
775
+ var prim = input[Symbol.toPrimitive];
776
+ if (prim !== void 0) {
777
+ var res = prim.call(input, hint || "default");
778
+ if (_typeof(res) !== "object")
779
+ return res;
780
+ throw new TypeError("@@toPrimitive must return a primitive value.");
781
+ }
782
+ return (hint === "string" ? String : Number)(input);
783
+ }
784
+ var init_toPrimitive = __esm({
785
+ "../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js"() {
786
+ init_typeof();
787
+ }
788
+ });
789
+
790
+ // ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
791
+ function _toPropertyKey(arg) {
792
+ var key = _toPrimitive(arg, "string");
793
+ return _typeof(key) === "symbol" ? key : String(key);
794
+ }
795
+ var init_toPropertyKey = __esm({
796
+ "../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js"() {
797
+ init_typeof();
798
+ init_toPrimitive();
799
+ }
800
+ });
801
+
757
802
  // ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
758
803
  function _defineProperty(obj, key, value) {
804
+ key = _toPropertyKey(key);
759
805
  if (key in obj) {
760
806
  Object.defineProperty(obj, key, {
761
807
  value,
@@ -770,6 +816,7 @@
770
816
  }
771
817
  var init_defineProperty = __esm({
772
818
  "../../node_modules/@babel/runtime/helpers/esm/defineProperty.js"() {
819
+ init_toPropertyKey();
773
820
  }
774
821
  });
775
822
 
@@ -860,19 +907,33 @@
860
907
  }
861
908
  });
862
909
 
910
+ // ../loader-utils/src/lib/path-utils/get-cwd.ts
911
+ function getCWD() {
912
+ if (typeof process !== "undefined" && typeof process.cwd !== "undefined") {
913
+ return process.cwd();
914
+ }
915
+ const pathname = window.location?.pathname;
916
+ return pathname?.slice(0, pathname.lastIndexOf("/") + 1) || "";
917
+ }
918
+ var init_get_cwd = __esm({
919
+ "../loader-utils/src/lib/path-utils/get-cwd.ts"() {
920
+ }
921
+ });
922
+
863
923
  // ../loader-utils/src/lib/path-utils/path.ts
864
924
  var path_exports = {};
865
925
  __export(path_exports, {
866
926
  dirname: () => dirname,
867
927
  filename: () => filename,
868
- join: () => join
928
+ join: () => join,
929
+ resolve: () => resolve
869
930
  });
870
931
  function filename(url) {
871
- const slashIndex = url && url.lastIndexOf("/");
932
+ const slashIndex = url ? url.lastIndexOf("/") : -1;
872
933
  return slashIndex >= 0 ? url.substr(slashIndex + 1) : "";
873
934
  }
874
935
  function dirname(url) {
875
- const slashIndex = url && url.lastIndexOf("/");
936
+ const slashIndex = url ? url.lastIndexOf("/") : -1;
876
937
  return slashIndex >= 0 ? url.substr(0, slashIndex) : "";
877
938
  }
878
939
  function join(...parts) {
@@ -888,8 +949,112 @@
888
949
  });
889
950
  return parts.join(separator);
890
951
  }
952
+ function resolve(...components) {
953
+ const paths = [];
954
+ for (let _i = 0; _i < components.length; _i++) {
955
+ paths[_i] = components[_i];
956
+ }
957
+ let resolvedPath = "";
958
+ let resolvedAbsolute = false;
959
+ let cwd;
960
+ for (let i2 = paths.length - 1; i2 >= -1 && !resolvedAbsolute; i2--) {
961
+ let path;
962
+ if (i2 >= 0) {
963
+ path = paths[i2];
964
+ } else {
965
+ if (cwd === void 0) {
966
+ cwd = getCWD();
967
+ }
968
+ path = cwd;
969
+ }
970
+ if (path.length === 0) {
971
+ continue;
972
+ }
973
+ resolvedPath = `${path}/${resolvedPath}`;
974
+ resolvedAbsolute = path.charCodeAt(0) === SLASH;
975
+ }
976
+ resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);
977
+ if (resolvedAbsolute) {
978
+ return `/${resolvedPath}`;
979
+ } else if (resolvedPath.length > 0) {
980
+ return resolvedPath;
981
+ }
982
+ return ".";
983
+ }
984
+ function normalizeStringPosix(path, allowAboveRoot) {
985
+ let res = "";
986
+ let lastSlash = -1;
987
+ let dots = 0;
988
+ let code;
989
+ let isAboveRoot = false;
990
+ for (let i2 = 0; i2 <= path.length; ++i2) {
991
+ if (i2 < path.length) {
992
+ code = path.charCodeAt(i2);
993
+ } else if (code === SLASH) {
994
+ break;
995
+ } else {
996
+ code = SLASH;
997
+ }
998
+ if (code === SLASH) {
999
+ if (lastSlash === i2 - 1 || dots === 1) {
1000
+ } else if (lastSlash !== i2 - 1 && dots === 2) {
1001
+ if (res.length < 2 || !isAboveRoot || res.charCodeAt(res.length - 1) !== DOT || res.charCodeAt(res.length - 2) !== DOT) {
1002
+ if (res.length > 2) {
1003
+ const start = res.length - 1;
1004
+ let j = start;
1005
+ for (; j >= 0; --j) {
1006
+ if (res.charCodeAt(j) === SLASH) {
1007
+ break;
1008
+ }
1009
+ }
1010
+ if (j !== start) {
1011
+ res = j === -1 ? "" : res.slice(0, j);
1012
+ lastSlash = i2;
1013
+ dots = 0;
1014
+ isAboveRoot = false;
1015
+ continue;
1016
+ }
1017
+ } else if (res.length === 2 || res.length === 1) {
1018
+ res = "";
1019
+ lastSlash = i2;
1020
+ dots = 0;
1021
+ isAboveRoot = false;
1022
+ continue;
1023
+ }
1024
+ }
1025
+ if (allowAboveRoot) {
1026
+ if (res.length > 0) {
1027
+ res += "/..";
1028
+ } else {
1029
+ res = "..";
1030
+ }
1031
+ isAboveRoot = true;
1032
+ }
1033
+ } else {
1034
+ const slice = path.slice(lastSlash + 1, i2);
1035
+ if (res.length > 0) {
1036
+ res += `/${slice}`;
1037
+ } else {
1038
+ res = slice;
1039
+ }
1040
+ isAboveRoot = false;
1041
+ }
1042
+ lastSlash = i2;
1043
+ dots = 0;
1044
+ } else if (code === DOT && dots !== -1) {
1045
+ ++dots;
1046
+ } else {
1047
+ dots = -1;
1048
+ }
1049
+ }
1050
+ return res;
1051
+ }
1052
+ var SLASH, DOT;
891
1053
  var init_path = __esm({
892
1054
  "../loader-utils/src/lib/path-utils/path.ts"() {
1055
+ init_get_cwd();
1056
+ SLASH = 47;
1057
+ DOT = 46;
893
1058
  }
894
1059
  });
895
1060
 
@@ -1059,9 +1224,9 @@
1059
1224
  }
1060
1225
  if (resource instanceof Blob) {
1061
1226
  const blobSlice = resource.slice(0, 5);
1062
- return await new Promise((resolve) => {
1227
+ return await new Promise((resolve2) => {
1063
1228
  const reader = new FileReader();
1064
- reader.onload = (event) => resolve(event?.target?.result);
1229
+ reader.onload = (event) => resolve2(event?.target?.result);
1065
1230
  reader.readAsDataURL(blobSlice);
1066
1231
  });
1067
1232
  }
@@ -5952,9 +6117,9 @@
5952
6117
  await image.decode();
5953
6118
  return image;
5954
6119
  }
5955
- return await new Promise((resolve, reject) => {
6120
+ return await new Promise((resolve2, reject) => {
5956
6121
  try {
5957
- image.onload = () => resolve(image);
6122
+ image.onload = () => resolve2(image);
5958
6123
  image.onerror = (err) => reject(new Error(`Could not load image ${url}: ${err}`));
5959
6124
  } catch (error) {
5960
6125
  reject(error);
@@ -7315,10 +7480,10 @@
7315
7480
  if (wasmBinary) {
7316
7481
  options.wasmBinary = wasmBinary;
7317
7482
  }
7318
- return new Promise((resolve) => {
7483
+ return new Promise((resolve2) => {
7319
7484
  DracoDecoderModule({
7320
7485
  ...options,
7321
- onModuleLoaded: (draco) => resolve({ draco })
7486
+ onModuleLoaded: (draco) => resolve2({ draco })
7322
7487
  });
7323
7488
  });
7324
7489
  }
@@ -7391,11 +7556,11 @@
7391
7556
  if (wasmBinary) {
7392
7557
  options.wasmBinary = wasmBinary;
7393
7558
  }
7394
- return new Promise((resolve) => {
7559
+ return new Promise((resolve2) => {
7395
7560
  BasisModule(options).then((module) => {
7396
7561
  const { BasisFile, initializeBasis } = module;
7397
7562
  initializeBasis();
7398
- resolve({ BasisFile });
7563
+ resolve2({ BasisFile });
7399
7564
  });
7400
7565
  });
7401
7566
  }
@@ -7422,11 +7587,11 @@
7422
7587
  if (wasmBinary) {
7423
7588
  options.wasmBinary = wasmBinary;
7424
7589
  }
7425
- return new Promise((resolve) => {
7590
+ return new Promise((resolve2) => {
7426
7591
  BasisEncoderModule(options).then((module) => {
7427
7592
  const { BasisFile, KTX2File, initializeBasis, BasisEncoder } = module;
7428
7593
  initializeBasis();
7429
- resolve({ BasisFile, KTX2File, BasisEncoder });
7594
+ resolve2({ BasisFile, KTX2File, BasisEncoder });
7430
7595
  });
7431
7596
  });
7432
7597
  }
@@ -8,8 +8,7 @@ exports.ArcGisWebSceneLoader = void 0;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
10
  var _parseArcgisWebscene = require("./lib/parsers/parse-arcgis-webscene");
11
- var VERSION = typeof "3.4.0-alpha.2" !== 'undefined' ? "3.4.0-alpha.2" : 'beta';
12
-
11
+ var VERSION = typeof "3.4.0-alpha.3" !== 'undefined' ? "3.4.0-alpha.3" : 'beta';
13
12
  var ArcGisWebSceneLoader = {
14
13
  name: 'ArcGIS Web Scene Loader',
15
14
  id: 'arcgis-web-scene',
@@ -20,7 +19,6 @@ var ArcGisWebSceneLoader = {
20
19
  extensions: ['json'],
21
20
  options: {}
22
21
  };
23
-
24
22
  exports.ArcGisWebSceneLoader = ArcGisWebSceneLoader;
25
23
  function parse(_x) {
26
24
  return _parse.apply(this, arguments);
@@ -28,14 +26,12 @@ function parse(_x) {
28
26
  function _parse() {
29
27
  _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(data) {
30
28
  return _regenerator.default.wrap(function _callee$(_context) {
31
- while (1) {
32
- switch (_context.prev = _context.next) {
33
- case 0:
34
- return _context.abrupt("return", (0, _parseArcgisWebscene.parseWebscene)(data));
35
- case 1:
36
- case "end":
37
- return _context.stop();
38
- }
29
+ while (1) switch (_context.prev = _context.next) {
30
+ case 0:
31
+ return _context.abrupt("return", (0, _parseArcgisWebscene.parseWebscene)(data));
32
+ case 1:
33
+ case "end":
34
+ return _context.stop();
39
35
  }
40
36
  }, _callee);
41
37
  }));
@@ -1 +1 @@
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
+ {"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,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;AAACC,OAAA,CAAAT,oBAAA,GAAAA,oBAAA;AAAA,SAMaM,KAAKA,CAAAI,EAAA;EAAA,OAAAC,MAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAAA,SAAAF,OAAA;EAAAA,MAAA,OAAAG,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAApB,SAAAC,QAAqBC,IAAiB;IAAA,OAAAH,YAAA,CAAAD,OAAA,CAAAK,IAAA,UAAAC,SAAAC,QAAA;MAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;QAAA;UAAA,OAAAF,QAAA,CAAAG,MAAA,WAC7B,IAAAC,kCAAa,EAACP,IAAI,CAAC;QAAA;QAAA;UAAA,OAAAG,QAAA,CAAAK,IAAA;MAAA;IAAA,GAAAT,OAAA;EAAA,CAC3B;EAAA,OAAAP,MAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA"}
@@ -15,7 +15,7 @@ var _parseI3sAttribute = require("./lib/parsers/parse-i3s-attribute");
15
15
  var _urlUtils = require("./lib/utils/url-utils");
16
16
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
17
17
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
18
- var VERSION = typeof "3.4.0-alpha.2" !== 'undefined' ? "3.4.0-alpha.2" : 'latest';
18
+ var VERSION = typeof "3.4.0-alpha.3" !== 'undefined' ? "3.4.0-alpha.3" : 'latest';
19
19
  var EMPTY_VALUE = '';
20
20
  var REJECTED_STATUS = 'rejected';
21
21
  var I3SAttributeLoader = {
@@ -36,15 +36,13 @@ function parse(_x, _x2) {
36
36
  function _parse() {
37
37
  _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(data, options) {
38
38
  return _regenerator.default.wrap(function _callee$(_context) {
39
- while (1) {
40
- switch (_context.prev = _context.next) {
41
- case 0:
42
- data = (0, _parseI3sAttribute.parseI3STileAttribute)(data, options);
43
- return _context.abrupt("return", data);
44
- case 2:
45
- case "end":
46
- return _context.stop();
47
- }
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();
48
46
  }
49
47
  }, _callee);
50
48
  }));
@@ -71,52 +69,50 @@ function _loadFeatureAttributes() {
71
69
  promise,
72
70
  _args2 = arguments;
73
71
  return _regenerator.default.wrap(function _callee2$(_context2) {
74
- while (1) {
75
- switch (_context2.prev = _context2.next) {
76
- case 0:
77
- options = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
78
- _getAttributesData = getAttributesData(tile), attributeStorageInfo = _getAttributesData.attributeStorageInfo, attributeUrls = _getAttributesData.attributeUrls, tilesetFields = _getAttributesData.tilesetFields;
79
- if (!(!attributeStorageInfo || !attributeUrls || featureId < 0)) {
80
- _context2.next = 4;
81
- break;
82
- }
83
- return _context2.abrupt("return", null);
84
- case 4:
85
- attributes = [];
86
- attributeLoadPromises = [];
87
- for (index = 0; index < attributeStorageInfo.length; index++) {
88
- url = (0, _urlUtils.getUrlWithToken)(attributeUrls[index], (_options$i3s = options.i3s) === null || _options$i3s === void 0 ? void 0 : _options$i3s.token);
89
- attributeName = attributeStorageInfo[index].name;
90
- attributeType = getAttributeValueType(attributeStorageInfo[index]);
91
- loadOptions = _objectSpread(_objectSpread({}, options), {}, {
92
- attributeName: attributeName,
93
- attributeType: attributeType
94
- });
95
- promise = (0, _core.load)(url, I3SAttributeLoader, loadOptions);
96
- attributeLoadPromises.push(promise);
97
- }
98
- _context2.prev = 7;
99
- _context2.next = 10;
100
- return Promise.allSettled(attributeLoadPromises);
101
- case 10:
102
- attributes = _context2.sent;
103
- _context2.next = 15;
72
+ while (1) switch (_context2.prev = _context2.next) {
73
+ case 0:
74
+ options = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
75
+ _getAttributesData = getAttributesData(tile), attributeStorageInfo = _getAttributesData.attributeStorageInfo, attributeUrls = _getAttributesData.attributeUrls, tilesetFields = _getAttributesData.tilesetFields;
76
+ if (!(!attributeStorageInfo || !attributeUrls || featureId < 0)) {
77
+ _context2.next = 4;
104
78
  break;
105
- case 13:
106
- _context2.prev = 13;
107
- _context2.t0 = _context2["catch"](7);
108
- case 15:
109
- if (attributes.length) {
110
- _context2.next = 17;
111
- break;
112
- }
113
- return _context2.abrupt("return", null);
114
- case 17:
115
- return _context2.abrupt("return", generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields));
116
- case 18:
117
- case "end":
118
- return _context2.stop();
119
- }
79
+ }
80
+ return _context2.abrupt("return", null);
81
+ case 4:
82
+ attributes = [];
83
+ attributeLoadPromises = [];
84
+ for (index = 0; index < attributeStorageInfo.length; index++) {
85
+ url = (0, _urlUtils.getUrlWithToken)(attributeUrls[index], (_options$i3s = options.i3s) === null || _options$i3s === void 0 ? void 0 : _options$i3s.token);
86
+ attributeName = attributeStorageInfo[index].name;
87
+ attributeType = getAttributeValueType(attributeStorageInfo[index]);
88
+ loadOptions = _objectSpread(_objectSpread({}, options), {}, {
89
+ attributeName: attributeName,
90
+ attributeType: attributeType
91
+ });
92
+ promise = (0, _core.load)(url, I3SAttributeLoader, loadOptions);
93
+ attributeLoadPromises.push(promise);
94
+ }
95
+ _context2.prev = 7;
96
+ _context2.next = 10;
97
+ return Promise.allSettled(attributeLoadPromises);
98
+ case 10:
99
+ attributes = _context2.sent;
100
+ _context2.next = 15;
101
+ break;
102
+ case 13:
103
+ _context2.prev = 13;
104
+ _context2.t0 = _context2["catch"](7);
105
+ case 15:
106
+ if (attributes.length) {
107
+ _context2.next = 17;
108
+ break;
109
+ }
110
+ return _context2.abrupt("return", null);
111
+ case 17:
112
+ return _context2.abrupt("return", generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields));
113
+ case 18:
114
+ case "end":
115
+ return _context2.stop();
120
116
  }
121
117
  }, _callee2, null, [[7, 13]]);
122
118
  }));
@@ -133,7 +129,6 @@ function getAttributesData(tile) {
133
129
  tilesetFields: tilesetFields
134
130
  };
135
131
  }
136
-
137
132
  function getAttributeValueType(attribute) {
138
133
  if (attribute.hasOwnProperty('objectIds')) {
139
134
  return 'Oid32';
@@ -142,14 +137,12 @@ function getAttributeValueType(attribute) {
142
137
  }
143
138
  return '';
144
139
  }
145
-
146
140
  function getFeatureIdsAttributeName(attributeStorageInfo) {
147
141
  var objectIdsAttribute = attributeStorageInfo.find(function (attribute) {
148
142
  return attribute.name.includes('OBJECTID');
149
143
  });
150
144
  return objectIdsAttribute === null || objectIdsAttribute === void 0 ? void 0 : objectIdsAttribute.name;
151
145
  }
152
-
153
146
  function generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields) {
154
147
  var objectIdsAttributeName = getFeatureIdsAttributeName(attributeStorageInfo);
155
148
  var objectIds = attributes.find(function (attribute) {
@@ -164,7 +157,6 @@ function generateAttributesByFeatureId(attributes, attributeStorageInfo, feature
164
157
  }
165
158
  return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);
166
159
  }
167
-
168
160
  function getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo, tilesetFields) {
169
161
  var attributesObject = {};
170
162
  for (var index = 0; index < attributeStorageInfo.length; index++) {
@@ -175,7 +167,6 @@ function getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorag
175
167
  }
176
168
  return attributesObject;
177
169
  }
178
-
179
170
  function getAttributeCodedValues(attributeName, tilesetFields) {
180
171
  var _attributeField$domai;
181
172
  var attributeField = tilesetFields.find(function (field) {
@@ -183,7 +174,6 @@ function getAttributeCodedValues(attributeName, tilesetFields) {
183
174
  });
184
175
  return (attributeField === null || attributeField === void 0 ? void 0 : (_attributeField$domai = attributeField.domain) === null || _attributeField$domai === void 0 ? void 0 : _attributeField$domai.codedValues) || [];
185
176
  }
186
-
187
177
  function getAttributeByIndexAndAttributeName(attributes, index, attributesName) {
188
178
  var attributeObject = attributes[index];
189
179
  if (attributeObject.status === REJECTED_STATUS) {
@@ -191,13 +181,11 @@ function getAttributeByIndexAndAttributeName(attributes, index, attributesName)
191
181
  }
192
182
  return attributeObject.value[attributesName];
193
183
  }
194
-
195
184
  function formatAttributeValue(attribute, featureIdIndex, codedValues) {
196
185
  var value = EMPTY_VALUE;
197
186
  if (attribute && featureIdIndex in attribute) {
198
187
  value = String(attribute[featureIdIndex]).replace(/\u0000|NaN/g, '').trim();
199
188
  }
200
-
201
189
  if (codedValues.length) {
202
190
  var codeValue = codedValues.find(function (codedValue) {
203
191
  return codedValue.code === Number(value);
@@ -1 +1 @@
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,CA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G,CAAAoB,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAErE,IAAI,KAAIH,WAAW;EACxC;EAEA,OAAOoD,KAAK;AACd"}
1
+ {"version":3,"file":"i3s-attribute-loader.js","names":["_core","require","_parseI3sAttribute","_urlUtils","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","VERSION","EMPTY_VALUE","REJECTED_STATUS","I3SAttributeLoader","name","id","module","version","mimeTypes","parse","extensions","options","binary","exports","_x","_x2","_parse","_asyncToGenerator2","_regenerator","mark","_callee","data","wrap","_callee$","_context","prev","next","parseI3STileAttribute","abrupt","stop","loadFeatureAttributes","_x3","_x4","_loadFeatureAttributes","_callee2","tile","featureId","_getAttributesData","attributeStorageInfo","attributeUrls","tilesetFields","attributes","attributeLoadPromises","index","_options$i3s","url","attributeName","attributeType","loadOptions","promise","_args2","_callee2$","_context2","undefined","getAttributesData","getUrlWithToken","i3s","token","getAttributeValueType","load","Promise","allSettled","sent","t0","generateAttributesByFeatureId","_tile$tileset","_tile$tileset$tileset","_tile$header","_tile$tileset2","_tile$tileset2$tilese","tileset","header","fields","attribute","hasOwnProperty","attributeValues","valueType","getFeatureIdsAttributeName","objectIdsAttribute","find","includes","objectIdsAttributeName","objectIds","value","attributeIndex","indexOf","getFeatureAttributesByIndex","featureIdIndex","attributesObject","codedValues","getAttributeCodedValues","getAttributeByIndexAndAttributeName","formatAttributeValue","_attributeField$domai","attributeField","field","alias","domain","attributesName","attributeObject","status","String","replace","trim","codeValue","codedValue","code","Number"],"sources":["../../src/i3s-attribute-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {load} from '@loaders.gl/core';\nimport {parseI3STileAttribute} from './lib/parsers/parse-i3s-attribute';\nimport {getUrlWithToken} from './lib/utils/url-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\nconst EMPTY_VALUE = '';\nconst REJECTED_STATUS = 'rejected';\n/**\n * Loader for I3S attributes\n */\nexport const I3SAttributeLoader: LoaderWithParser = {\n name: 'I3S Attribute',\n id: 'i3s-attribute',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/binary'],\n parse,\n extensions: ['bin'],\n options: {},\n binary: true\n};\n\nasync function parse(data, options) {\n data = parseI3STileAttribute(data, options);\n return data;\n}\n\n/**\n * Load attributes based on feature id\n * @param {Object} tile\n * @param {number} featureId\n * @param {Object} options\n * @returns {Promise}\n */\n// eslint-disable-next-line complexity\nexport async function loadFeatureAttributes(tile, featureId, options = {}) {\n const {attributeStorageInfo, attributeUrls, tilesetFields} = getAttributesData(tile);\n\n if (!attributeStorageInfo || !attributeUrls || featureId < 0) {\n return null;\n }\n\n let attributes: object[] = [];\n const attributeLoadPromises: Promise<object>[] = [];\n\n for (let index = 0; index < attributeStorageInfo.length; index++) {\n // @ts-ignore\n const url = getUrlWithToken(attributeUrls[index], options.i3s?.token);\n const attributeName = attributeStorageInfo[index].name;\n const attributeType = getAttributeValueType(attributeStorageInfo[index]);\n const loadOptions = {...options, attributeName, attributeType};\n const promise = load(url, I3SAttributeLoader, loadOptions);\n\n attributeLoadPromises.push(promise);\n }\n try {\n attributes = await Promise.allSettled(attributeLoadPromises);\n } catch (error) {\n // do nothing\n }\n\n if (!attributes.length) {\n return null;\n }\n\n return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);\n}\n\n/**\n * Gets attributes data from tile.\n * @param tile \n * @returns \n */\nfunction getAttributesData(tile) {\n const attributeStorageInfo = tile.tileset?.tileset?.attributeStorageInfo;\n const attributeUrls = tile.header?.attributeUrls;\n const tilesetFields = tile.tileset?.tileset?.fields || [];\n\n return {attributeStorageInfo, attributeUrls, tilesetFields};\n}\n\n/**\n * Get attribute value type based on property names\n * @param {Object} attribute\n * @returns {String}\n */\nexport function getAttributeValueType(attribute) {\n if (attribute.hasOwnProperty('objectIds')) {\n return 'Oid32';\n } else if (attribute.hasOwnProperty('attributeValues')) {\n return attribute.attributeValues.valueType;\n }\n return '';\n}\n\n/**\n * Find in attributeStorageInfo attribute name responsible for feature ids list.\n * @param attributeStorageInfo \n * @returns Feature ids attribute name\n */\nfunction getFeatureIdsAttributeName(attributeStorageInfo) {\n const objectIdsAttribute = attributeStorageInfo.find(attribute => attribute.name.includes('OBJECTID'));\n\n return objectIdsAttribute?.name;\n}\n\n/**\n * Generates mapping featureId to feature attributes\n * @param {Array} attributes\n * @param {Object} attributeStorageInfo\n * @param {number} featureId\n * @returns {Object}\n */\nfunction generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields) {\n const objectIdsAttributeName = getFeatureIdsAttributeName(attributeStorageInfo);\n const objectIds = attributes.find((attribute) => attribute.value[objectIdsAttributeName]);\n\n if (!objectIds) {\n return null;\n }\n\n const attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);\n\n if (attributeIndex < 0) {\n return null;\n }\n\n return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);\n}\n\n/**\n * Generates attribute object for feature mapping by feature id\n * @param {Array} attributes\n * @param {Number} featureIdIndex\n * @param {Object} attributeStorageInfo\n * @returns {Object}\n */\nfunction getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo, tilesetFields) {\n const attributesObject = {};\n\n for (let index = 0; index < attributeStorageInfo.length; index++) {\n const attributeName = attributeStorageInfo[index].name;\n const codedValues = getAttributeCodedValues(attributeName, tilesetFields);\n const attribute = getAttributeByIndexAndAttributeName(attributes, index, attributeName);\n attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex, codedValues);\n }\n\n return attributesObject;\n}\n\n/**\n * Get coded values list from tileset.\n * @param attributeName \n * @param tilesetFields \n */\nfunction getAttributeCodedValues(attributeName, tilesetFields) {\n const attributeField = tilesetFields\n .find(field => field.name === attributeName || field.alias === attributeName);\n\n return attributeField?.domain?.codedValues || [];\n}\n\n/**\n * Return attribute value if it presents in atrributes list\n * @param {array} attributes\n * @param {number} index\n * @param {string} attributesName\n */\nfunction getAttributeByIndexAndAttributeName(attributes, index, attributesName) {\n const attributeObject = attributes[index];\n\n if (attributeObject.status === REJECTED_STATUS) {\n return null;\n }\n\n return attributeObject.value[attributesName];\n}\n\n/**\n * Do formatting of attribute values or return empty string.\n * @param {Array} attribute\n * @param {Number} featureIdIndex\n * @returns {String}\n */\nfunction formatAttributeValue(attribute, featureIdIndex, codedValues) {\n let value = EMPTY_VALUE;\n\n if (attribute && (featureIdIndex in attribute)) {\n // eslint-disable-next-line no-control-regex\n value = String(attribute[featureIdIndex]).replace(/\\u0000|NaN/g, '').trim();\n }\n\n // Check if coded values are existed. If so we use them.\n if (codedValues.length) {\n const codeValue = codedValues.find(codedValue => codedValue.code === Number(value));\n value = codeValue?.name || EMPTY_VALUE;\n }\n\n return value;\n}\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAAsD,SAAAG,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,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,GAA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AId,WAAW,CAAClG,MAAM,EAAE;IACtB,IAAMiH,SAAS,GAAGf,WAAW,CAACV,IAAI,CAAC,UAAA0B,UAAU;MAAA,OAAIA,UAAU,CAACC,IAAI,KAAKC,MAAM,CAACxB,KAAK,CAAC;IAAA,EAAC;IACnFA,KAAK,GAAG,CAAAqB,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEpG,IAAI,KAAIH,WAAW;EACxC;EAEA,OAAOkF,KAAK;AACd"}
@@ -8,8 +8,7 @@ exports.I3SBuildingSceneLayerLoader = void 0;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
10
  var _parseI3sBuildingSceneLayer = require("./lib/parsers/parse-i3s-building-scene-layer");
11
-
12
- var VERSION = typeof "3.4.0-alpha.2" !== 'undefined' ? "3.4.0-alpha.2" : 'beta';
11
+ var VERSION = typeof "3.4.0-alpha.3" !== 'undefined' ? "3.4.0-alpha.3" : 'beta';
13
12
  var I3SBuildingSceneLayerLoader = {
14
13
  name: 'I3S Building Scene Layer',
15
14
  id: 'i3s-building-scene-layer',
@@ -27,20 +26,18 @@ function parse(_x, _x2, _x3) {
27
26
  function _parse() {
28
27
  _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(data, options, context) {
29
28
  return _regenerator.default.wrap(function _callee$(_context) {
30
- while (1) {
31
- switch (_context.prev = _context.next) {
32
- case 0:
33
- if (context !== null && context !== void 0 && context.url) {
34
- _context.next = 2;
35
- break;
36
- }
37
- throw new Error('Url is not provided');
38
- case 2:
39
- return _context.abrupt("return", (0, _parseI3sBuildingSceneLayer.parseBuildingSceneLayer)(data, context.url));
40
- case 3:
41
- case "end":
42
- return _context.stop();
43
- }
29
+ while (1) switch (_context.prev = _context.next) {
30
+ case 0:
31
+ if (context !== null && context !== void 0 && context.url) {
32
+ _context.next = 2;
33
+ break;
34
+ }
35
+ throw new Error('Url is not provided');
36
+ case 2:
37
+ return _context.abrupt("return", (0, _parseI3sBuildingSceneLayer.parseBuildingSceneLayer)(data, context.url));
38
+ case 3:
39
+ case "end":
40
+ return _context.stop();
44
41
  }
45
42
  }, _callee);
46
43
  }));
@@ -1 +1 @@
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
+ {"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,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;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,GAAA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