@loaders.gl/i3s 4.0.0-alpha.5 → 4.0.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 (169) hide show
  1. package/dist/arcgis-webscene-loader.d.ts +7 -0
  2. package/dist/arcgis-webscene-loader.d.ts.map +1 -0
  3. package/dist/arcgis-webscene-loader.js +28 -0
  4. package/dist/bundle.js +2 -2
  5. package/dist/dist.min.js +8804 -8547
  6. package/dist/es5/arcgis-webscene-loader.js +40 -0
  7. package/dist/es5/arcgis-webscene-loader.js.map +1 -0
  8. package/dist/es5/bundle.js +6 -0
  9. package/dist/es5/bundle.js.map +1 -0
  10. package/dist/es5/i3s-attribute-loader.js +195 -0
  11. package/dist/es5/i3s-attribute-loader.js.map +1 -0
  12. package/dist/es5/i3s-building-scene-layer-loader.js +46 -0
  13. package/dist/es5/i3s-building-scene-layer-loader.js.map +1 -0
  14. package/dist/es5/i3s-content-loader.js +57 -0
  15. package/dist/es5/i3s-content-loader.js.map +1 -0
  16. package/dist/es5/i3s-loader.js +193 -0
  17. package/dist/es5/i3s-loader.js.map +1 -0
  18. package/dist/es5/i3s-node-page-loader.js +39 -0
  19. package/dist/es5/i3s-node-page-loader.js.map +1 -0
  20. package/dist/es5/index.js +61 -0
  21. package/dist/es5/index.js.map +1 -0
  22. package/dist/es5/lib/helpers/i3s-nodepages-tiles.js +312 -0
  23. package/dist/es5/lib/helpers/i3s-nodepages-tiles.js.map +1 -0
  24. package/dist/es5/lib/parsers/constants.js +72 -0
  25. package/dist/es5/lib/parsers/constants.js.map +1 -0
  26. package/dist/es5/lib/parsers/parse-arcgis-webscene.js +158 -0
  27. package/dist/es5/lib/parsers/parse-arcgis-webscene.js.map +1 -0
  28. package/dist/es5/lib/parsers/parse-i3s-attribute.js +76 -0
  29. package/dist/es5/lib/parsers/parse-i3s-attribute.js.map +1 -0
  30. package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js +65 -0
  31. package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -0
  32. package/dist/es5/lib/parsers/parse-i3s-tile-content.js +510 -0
  33. package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -0
  34. package/dist/es5/lib/parsers/parse-i3s.js +116 -0
  35. package/dist/es5/lib/parsers/parse-i3s.js.map +1 -0
  36. package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js +17 -0
  37. package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -0
  38. package/dist/es5/lib/utils/customizeColors.js +159 -0
  39. package/dist/es5/lib/utils/customizeColors.js.map +1 -0
  40. package/dist/es5/lib/utils/url-utils.js +33 -0
  41. package/dist/es5/lib/utils/url-utils.js.map +1 -0
  42. package/dist/es5/types.js +26 -0
  43. package/dist/es5/types.js.map +1 -0
  44. package/dist/es5/workers/i3s-content-nodejs-worker.js +7 -0
  45. package/dist/es5/workers/i3s-content-nodejs-worker.js.map +1 -0
  46. package/dist/es5/workers/i3s-content-worker.js +6 -0
  47. package/dist/es5/workers/i3s-content-worker.js.map +1 -0
  48. package/dist/esm/arcgis-webscene-loader.js +16 -0
  49. package/dist/esm/arcgis-webscene-loader.js.map +1 -0
  50. package/dist/esm/bundle.js +4 -0
  51. package/dist/esm/bundle.js.map +1 -0
  52. package/dist/esm/i3s-attribute-loader.js +119 -0
  53. package/dist/esm/i3s-attribute-loader.js.map +1 -0
  54. package/dist/esm/i3s-building-scene-layer-loader.js +19 -0
  55. package/dist/esm/i3s-building-scene-layer-loader.js.map +1 -0
  56. package/dist/esm/i3s-content-loader.js +31 -0
  57. package/dist/esm/i3s-content-loader.js.map +1 -0
  58. package/dist/esm/i3s-loader.js +87 -0
  59. package/dist/esm/i3s-loader.js.map +1 -0
  60. package/dist/esm/i3s-node-page-loader.js +15 -0
  61. package/dist/esm/i3s-node-page-loader.js.map +1 -0
  62. package/dist/esm/index.js +8 -0
  63. package/dist/esm/index.js.map +1 -0
  64. package/dist/esm/lib/helpers/i3s-nodepages-tiles.js +198 -0
  65. package/dist/esm/lib/helpers/i3s-nodepages-tiles.js.map +1 -0
  66. package/dist/esm/lib/parsers/constants.js +57 -0
  67. package/dist/esm/lib/parsers/constants.js.map +1 -0
  68. package/dist/esm/lib/parsers/parse-arcgis-webscene.js +70 -0
  69. package/dist/esm/lib/parsers/parse-arcgis-webscene.js.map +1 -0
  70. package/dist/esm/lib/parsers/parse-i3s-attribute.js +60 -0
  71. package/dist/esm/lib/parsers/parse-i3s-attribute.js.map +1 -0
  72. package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js +39 -0
  73. package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -0
  74. package/dist/esm/lib/parsers/parse-i3s-tile-content.js +435 -0
  75. package/dist/esm/lib/parsers/parse-i3s-tile-content.js.map +1 -0
  76. package/dist/esm/lib/parsers/parse-i3s.js +83 -0
  77. package/dist/esm/lib/parsers/parse-i3s.js.map +1 -0
  78. package/dist/esm/lib/utils/convert-i3s-obb-to-mbs.js +9 -0
  79. package/dist/esm/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -0
  80. package/dist/esm/lib/utils/customizeColors.js +92 -0
  81. package/dist/esm/lib/utils/customizeColors.js.map +1 -0
  82. package/dist/esm/lib/utils/url-utils.js +28 -0
  83. package/dist/esm/lib/utils/url-utils.js.map +1 -0
  84. package/dist/esm/types.js +18 -0
  85. package/dist/esm/types.js.map +1 -0
  86. package/dist/esm/workers/i3s-content-nodejs-worker.js +5 -0
  87. package/dist/esm/workers/i3s-content-nodejs-worker.js.map +1 -0
  88. package/dist/esm/workers/i3s-content-worker.js +4 -0
  89. package/dist/esm/workers/i3s-content-worker.js.map +1 -0
  90. package/dist/i3s-attribute-loader.d.ts +9 -2
  91. package/dist/i3s-attribute-loader.d.ts.map +1 -1
  92. package/dist/i3s-attribute-loader.js +155 -132
  93. package/dist/i3s-building-scene-layer-loader.js +23 -18
  94. package/dist/i3s-content-loader.d.ts.map +1 -1
  95. package/dist/i3s-content-loader.js +30 -22
  96. package/dist/i3s-content-nodejs-worker.js +198 -0
  97. package/dist/i3s-content-nodejs-worker.js.map +7 -0
  98. package/dist/i3s-content-worker.js +1119 -1100
  99. package/dist/i3s-loader.d.ts +5 -0
  100. package/dist/i3s-loader.d.ts.map +1 -1
  101. package/dist/i3s-loader.js +88 -83
  102. package/dist/i3s-node-page-loader.d.ts +3 -2
  103. package/dist/i3s-node-page-loader.d.ts.map +1 -1
  104. package/dist/i3s-node-page-loader.js +20 -20
  105. package/dist/index.d.ts +4 -2
  106. package/dist/index.d.ts.map +1 -1
  107. package/dist/index.js +19 -6
  108. package/dist/lib/helpers/i3s-nodepages-tiles.d.ts +1 -0
  109. package/dist/lib/helpers/i3s-nodepages-tiles.d.ts.map +1 -1
  110. package/dist/lib/helpers/i3s-nodepages-tiles.js +231 -228
  111. package/dist/lib/parsers/constants.js +85 -63
  112. package/dist/lib/parsers/parse-arcgis-webscene.d.ts +7 -0
  113. package/dist/lib/parsers/parse-arcgis-webscene.d.ts.map +1 -0
  114. package/dist/lib/parsers/parse-arcgis-webscene.js +88 -0
  115. package/dist/lib/parsers/parse-i3s-attribute.d.ts +6 -4
  116. package/dist/lib/parsers/parse-i3s-attribute.d.ts.map +1 -1
  117. package/dist/lib/parsers/parse-i3s-attribute.js +87 -62
  118. package/dist/lib/parsers/parse-i3s-building-scene-layer.js +41 -40
  119. package/dist/lib/parsers/parse-i3s-tile-content.d.ts +2 -2
  120. package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -1
  121. package/dist/lib/parsers/parse-i3s-tile-content.js +454 -454
  122. package/dist/lib/parsers/parse-i3s.d.ts +1 -1
  123. package/dist/lib/parsers/parse-i3s.d.ts.map +1 -1
  124. package/dist/lib/parsers/parse-i3s.js +92 -88
  125. package/dist/lib/utils/convert-i3s-obb-to-mbs.js +19 -8
  126. package/dist/lib/utils/customizeColors.d.ts +14 -0
  127. package/dist/lib/utils/customizeColors.d.ts.map +1 -0
  128. package/dist/lib/utils/customizeColors.js +94 -0
  129. package/dist/lib/utils/url-utils.js +41 -28
  130. package/dist/types.d.ts +518 -97
  131. package/dist/types.d.ts.map +1 -1
  132. package/dist/types.js +18 -19
  133. package/dist/workers/i3s-content-nodejs-worker.d.ts +2 -0
  134. package/dist/workers/i3s-content-nodejs-worker.d.ts.map +1 -0
  135. package/dist/workers/i3s-content-nodejs-worker.js +6 -0
  136. package/dist/workers/i3s-content-worker.js +5 -4
  137. package/package.json +15 -15
  138. package/src/arcgis-webscene-loader.ts +31 -0
  139. package/src/i3s-attribute-loader.ts +9 -9
  140. package/src/i3s-content-loader.ts +19 -6
  141. package/src/i3s-loader.ts +22 -13
  142. package/src/i3s-node-page-loader.ts +6 -10
  143. package/src/index.ts +22 -5
  144. package/src/lib/helpers/i3s-nodepages-tiles.ts +14 -3
  145. package/src/lib/parsers/constants.ts +1 -1
  146. package/src/lib/parsers/parse-arcgis-webscene.ts +102 -0
  147. package/src/lib/parsers/parse-i3s-attribute.ts +21 -14
  148. package/src/lib/parsers/parse-i3s-tile-content.ts +99 -76
  149. package/src/lib/parsers/parse-i3s.ts +8 -3
  150. package/src/lib/utils/customizeColors.ts +134 -0
  151. package/src/types.ts +482 -33
  152. package/src/workers/i3s-content-nodejs-worker.ts +5 -0
  153. package/dist/bundle.js.map +0 -1
  154. package/dist/i3s-attribute-loader.js.map +0 -1
  155. package/dist/i3s-building-scene-layer-loader.js.map +0 -1
  156. package/dist/i3s-content-loader.js.map +0 -1
  157. package/dist/i3s-loader.js.map +0 -1
  158. package/dist/i3s-node-page-loader.js.map +0 -1
  159. package/dist/index.js.map +0 -1
  160. package/dist/lib/helpers/i3s-nodepages-tiles.js.map +0 -1
  161. package/dist/lib/parsers/constants.js.map +0 -1
  162. package/dist/lib/parsers/parse-i3s-attribute.js.map +0 -1
  163. package/dist/lib/parsers/parse-i3s-building-scene-layer.js.map +0 -1
  164. package/dist/lib/parsers/parse-i3s-tile-content.js.map +0 -1
  165. package/dist/lib/parsers/parse-i3s.js.map +0 -1
  166. package/dist/lib/utils/convert-i3s-obb-to-mbs.js.map +0 -1
  167. package/dist/lib/utils/url-utils.js.map +0 -1
  168. package/dist/types.js.map +0 -1
  169. package/dist/workers/i3s-content-worker.js.map +0 -1
@@ -0,0 +1,92 @@
1
+ import { load } from '@loaders.gl/core';
2
+ import { getAttributeValueType, I3SAttributeLoader } from '../../i3s-attribute-loader';
3
+ import { getUrlWithToken } from '../utils/url-utils';
4
+ export async function customizeColors(colors, featureIds, tileOptions, tilesetOptions, options) {
5
+ var _options$i3s;
6
+ if (!(options !== null && options !== void 0 && (_options$i3s = options.i3s) !== null && _options$i3s !== void 0 && _options$i3s.colorsByAttribute)) {
7
+ return colors;
8
+ }
9
+ const colorizeAttributeField = tilesetOptions.fields.find(_ref => {
10
+ var _options$i3s2, _options$i3s2$colorsB;
11
+ let {
12
+ name
13
+ } = _ref;
14
+ return name === (options === null || options === void 0 ? void 0 : (_options$i3s2 = options.i3s) === null || _options$i3s2 === void 0 ? void 0 : (_options$i3s2$colorsB = _options$i3s2.colorsByAttribute) === null || _options$i3s2$colorsB === void 0 ? void 0 : _options$i3s2$colorsB.attributeName);
15
+ });
16
+ if (!colorizeAttributeField || !['esriFieldTypeDouble', 'esriFieldTypeInteger', 'esriFieldTypeSmallInteger'].includes(colorizeAttributeField.type)) {
17
+ return colors;
18
+ }
19
+ const colorizeAttributeData = await loadFeatureAttributeData(colorizeAttributeField.name, tileOptions, tilesetOptions, options);
20
+ if (!colorizeAttributeData) {
21
+ return colors;
22
+ }
23
+ const objectIdField = tilesetOptions.fields.find(_ref2 => {
24
+ let {
25
+ type
26
+ } = _ref2;
27
+ return type === 'esriFieldTypeOID';
28
+ });
29
+ if (!objectIdField) {
30
+ return colors;
31
+ }
32
+ const objectIdAttributeData = await loadFeatureAttributeData(objectIdField.name, tileOptions, tilesetOptions, options);
33
+ if (!objectIdAttributeData) {
34
+ return colors;
35
+ }
36
+ const attributeValuesMap = {};
37
+ for (let i = 0; i < objectIdAttributeData[objectIdField.name].length; i++) {
38
+ attributeValuesMap[objectIdAttributeData[objectIdField.name][i]] = calculateColorForAttribute(colorizeAttributeData[colorizeAttributeField.name][i], options);
39
+ }
40
+ for (let i = 0; i < featureIds.value.length; i++) {
41
+ const color = attributeValuesMap[featureIds.value[i]];
42
+ if (!color) {
43
+ continue;
44
+ }
45
+ colors.value.set(color, i * 4);
46
+ }
47
+ return colors;
48
+ }
49
+ function calculateColorForAttribute(attributeValue, options) {
50
+ var _options$i3s3;
51
+ if (!(options !== null && options !== void 0 && (_options$i3s3 = options.i3s) !== null && _options$i3s3 !== void 0 && _options$i3s3.colorsByAttribute)) {
52
+ return [255, 255, 255, 255];
53
+ }
54
+ const {
55
+ minValue,
56
+ maxValue,
57
+ minColor,
58
+ maxColor
59
+ } = options.i3s.colorsByAttribute;
60
+ const rate = (attributeValue - minValue) / (maxValue - minValue);
61
+ const color = [255, 255, 255, 255];
62
+ for (let i = 0; i < minColor.length; i++) {
63
+ color[i] = Math.round((maxColor[i] - minColor[i]) * rate + minColor[i]);
64
+ }
65
+ return color;
66
+ }
67
+ async function loadFeatureAttributeData(attributeName, _ref3, _ref4, options) {
68
+ var _options$i3s4;
69
+ let {
70
+ attributeUrls
71
+ } = _ref3;
72
+ let {
73
+ attributeStorageInfo
74
+ } = _ref4;
75
+ const attributeIndex = attributeStorageInfo.findIndex(_ref5 => {
76
+ let {
77
+ name
78
+ } = _ref5;
79
+ return attributeName === name;
80
+ });
81
+ if (attributeIndex === -1) {
82
+ return null;
83
+ }
84
+ const objectIdAttributeUrl = getUrlWithToken(attributeUrls[attributeIndex], options === null || options === void 0 ? void 0 : (_options$i3s4 = options.i3s) === null || _options$i3s4 === void 0 ? void 0 : _options$i3s4.token);
85
+ const attributeType = getAttributeValueType(attributeStorageInfo[attributeIndex]);
86
+ const objectIdAttributeData = await load(objectIdAttributeUrl, I3SAttributeLoader, {
87
+ attributeName,
88
+ attributeType
89
+ });
90
+ return objectIdAttributeData;
91
+ }
92
+ //# sourceMappingURL=customizeColors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customizeColors.js","names":["load","getAttributeValueType","I3SAttributeLoader","getUrlWithToken","customizeColors","colors","featureIds","tileOptions","tilesetOptions","options","_options$i3s","i3s","colorsByAttribute","colorizeAttributeField","fields","find","_ref","_options$i3s2","_options$i3s2$colorsB","name","attributeName","includes","type","colorizeAttributeData","loadFeatureAttributeData","objectIdField","_ref2","objectIdAttributeData","attributeValuesMap","i","length","calculateColorForAttribute","value","color","set","attributeValue","_options$i3s3","minValue","maxValue","minColor","maxColor","rate","Math","round","_ref3","_ref4","_options$i3s4","attributeUrls","attributeStorageInfo","attributeIndex","findIndex","_ref5","objectIdAttributeUrl","token","attributeType"],"sources":["../../../../src/lib/utils/customizeColors.ts"],"sourcesContent":["import type {MeshAttribute} from '@loaders.gl/schema';\nimport type {COLOR, I3STileOptions, I3STilesetOptions} from '../../types';\n\nimport {load} from '@loaders.gl/core';\nimport {getAttributeValueType, I3SAttributeLoader} from '../../i3s-attribute-loader';\nimport {I3SLoaderOptions} from '../../i3s-loader';\nimport {getUrlWithToken} from '../utils/url-utils';\n\n/**\n * Modify vertex colors array to visualize 3D objects in a attribute driven way\n * @param colors - vertex colors attribute\n * @param featureIds - feature Ids attribute\n * @param tileOptions - tile - related options\n * @param tilesetOptions - tileset-related options\n * @param options - loader options\n * @returns midified colors attribute\n */\nexport async function customizeColors(\n colors: MeshAttribute,\n featureIds: MeshAttribute,\n tileOptions: I3STileOptions,\n tilesetOptions: I3STilesetOptions,\n options?: I3SLoaderOptions\n): Promise<MeshAttribute> {\n if (!options?.i3s?.colorsByAttribute) {\n return colors;\n }\n\n const colorizeAttributeField = tilesetOptions.fields.find(\n ({name}) => name === options?.i3s?.colorsByAttribute?.attributeName\n );\n if (\n !colorizeAttributeField ||\n !['esriFieldTypeDouble', 'esriFieldTypeInteger', 'esriFieldTypeSmallInteger'].includes(\n colorizeAttributeField.type\n )\n ) {\n return colors;\n }\n\n const colorizeAttributeData = await loadFeatureAttributeData(\n colorizeAttributeField.name,\n tileOptions,\n tilesetOptions,\n options\n );\n if (!colorizeAttributeData) {\n return colors;\n }\n\n const objectIdField = tilesetOptions.fields.find(({type}) => type === 'esriFieldTypeOID');\n if (!objectIdField) {\n return colors;\n }\n\n const objectIdAttributeData = await loadFeatureAttributeData(\n objectIdField.name,\n tileOptions,\n tilesetOptions,\n options\n );\n if (!objectIdAttributeData) {\n return colors;\n }\n\n const attributeValuesMap: {[key: number]: COLOR} = {};\n // @ts-expect-error\n for (let i = 0; i < objectIdAttributeData[objectIdField.name].length; i++) {\n // @ts-expect-error\n attributeValuesMap[objectIdAttributeData[objectIdField.name][i]] = calculateColorForAttribute(\n // @ts-expect-error\n colorizeAttributeData[colorizeAttributeField.name][i] as number,\n options\n );\n }\n\n for (let i = 0; i < featureIds.value.length; i++) {\n const color = attributeValuesMap[featureIds.value[i]];\n if (!color) {\n continue; // eslint-disable-line no-continue\n }\n colors.value.set(color, i * 4);\n }\n\n return colors;\n}\n\n/**\n * Calculate rgba color from the attribute value\n * @param attributeValue - value of the attribute\n * @param options - loader options\n * @returns - color array for a specific attribute value\n */\nfunction calculateColorForAttribute(attributeValue: number, options?: I3SLoaderOptions): COLOR {\n if (!options?.i3s?.colorsByAttribute) {\n return [255, 255, 255, 255];\n }\n const {minValue, maxValue, minColor, maxColor} = options.i3s.colorsByAttribute;\n const rate = (attributeValue - minValue) / (maxValue - minValue);\n const color: COLOR = [255, 255, 255, 255];\n for (let i = 0; i < minColor.length; i++) {\n color[i] = Math.round((maxColor[i] - minColor[i]) * rate + minColor[i]);\n }\n return color;\n}\n\n/**\n * Load feature attribute data from the ArcGIS rest service\n * @param attributeName - attribute name\n * @param tileOptions - tile-related options\n * @param tilesetOptions - tileset-related options\n * @param options - loader options\n * @returns - Array-like list of the attribute values\n */\nasync function loadFeatureAttributeData(\n attributeName: string,\n {attributeUrls}: I3STileOptions,\n {attributeStorageInfo}: I3STilesetOptions,\n options?: I3SLoaderOptions\n): Promise<{[key: string]: string[] | Uint32Array | Uint16Array | Float64Array | null} | null> {\n const attributeIndex = attributeStorageInfo.findIndex(({name}) => attributeName === name);\n if (attributeIndex === -1) {\n return null;\n }\n const objectIdAttributeUrl = getUrlWithToken(attributeUrls[attributeIndex], options?.i3s?.token);\n const attributeType = getAttributeValueType(attributeStorageInfo[attributeIndex]);\n const objectIdAttributeData = await load(objectIdAttributeUrl, I3SAttributeLoader, {\n attributeName,\n attributeType\n });\n\n // @ts-expect-error TODO action engine\n return objectIdAttributeData;\n}\n"],"mappings":"AAGA,SAAQA,IAAI,QAAO,kBAAkB;AACrC,SAAQC,qBAAqB,EAAEC,kBAAkB,QAAO,4BAA4B;AAEpF,SAAQC,eAAe,QAAO,oBAAoB;AAWlD,OAAO,eAAeC,eAAeA,CACnCC,MAAqB,EACrBC,UAAyB,EACzBC,WAA2B,EAC3BC,cAAiC,EACjCC,OAA0B,EACF;EAAA,IAAAC,YAAA;EACxB,IAAI,EAACD,OAAO,aAAPA,OAAO,gBAAAC,YAAA,GAAPD,OAAO,CAAEE,GAAG,cAAAD,YAAA,eAAZA,YAAA,CAAcE,iBAAiB,GAAE;IACpC,OAAOP,MAAM;EACf;EAEA,MAAMQ,sBAAsB,GAAGL,cAAc,CAACM,MAAM,CAACC,IAAI,CACvDC,IAAA;IAAA,IAAAC,aAAA,EAAAC,qBAAA;IAAA,IAAC;MAACC;IAAI,CAAC,GAAAH,IAAA;IAAA,OAAKG,IAAI,MAAKV,OAAO,aAAPA,OAAO,wBAAAQ,aAAA,GAAPR,OAAO,CAAEE,GAAG,cAAAM,aAAA,wBAAAC,qBAAA,GAAZD,aAAA,CAAcL,iBAAiB,cAAAM,qBAAA,uBAA/BA,qBAAA,CAAiCE,aAAa;EAAA,CACrE,CAAC;EACD,IACE,CAACP,sBAAsB,IACvB,CAAC,CAAC,qBAAqB,EAAE,sBAAsB,EAAE,2BAA2B,CAAC,CAACQ,QAAQ,CACpFR,sBAAsB,CAACS,IACzB,CAAC,EACD;IACA,OAAOjB,MAAM;EACf;EAEA,MAAMkB,qBAAqB,GAAG,MAAMC,wBAAwB,CAC1DX,sBAAsB,CAACM,IAAI,EAC3BZ,WAAW,EACXC,cAAc,EACdC,OACF,CAAC;EACD,IAAI,CAACc,qBAAqB,EAAE;IAC1B,OAAOlB,MAAM;EACf;EAEA,MAAMoB,aAAa,GAAGjB,cAAc,CAACM,MAAM,CAACC,IAAI,CAACW,KAAA;IAAA,IAAC;MAACJ;IAAI,CAAC,GAAAI,KAAA;IAAA,OAAKJ,IAAI,KAAK,kBAAkB;EAAA,EAAC;EACzF,IAAI,CAACG,aAAa,EAAE;IAClB,OAAOpB,MAAM;EACf;EAEA,MAAMsB,qBAAqB,GAAG,MAAMH,wBAAwB,CAC1DC,aAAa,CAACN,IAAI,EAClBZ,WAAW,EACXC,cAAc,EACdC,OACF,CAAC;EACD,IAAI,CAACkB,qBAAqB,EAAE;IAC1B,OAAOtB,MAAM;EACf;EAEA,MAAMuB,kBAA0C,GAAG,CAAC,CAAC;EAErD,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,qBAAqB,CAACF,aAAa,CAACN,IAAI,CAAC,CAACW,MAAM,EAAED,CAAC,EAAE,EAAE;IAEzED,kBAAkB,CAACD,qBAAqB,CAACF,aAAa,CAACN,IAAI,CAAC,CAACU,CAAC,CAAC,CAAC,GAAGE,0BAA0B,CAE3FR,qBAAqB,CAACV,sBAAsB,CAACM,IAAI,CAAC,CAACU,CAAC,CAAC,EACrDpB,OACF,CAAC;EACH;EAEA,KAAK,IAAIoB,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGvB,UAAU,CAAC0B,KAAK,CAACF,MAAM,EAAED,CAAC,EAAE,EAAE;IAChD,MAAMI,KAAK,GAAGL,kBAAkB,CAACtB,UAAU,CAAC0B,KAAK,CAACH,CAAC,CAAC,CAAC;IACrD,IAAI,CAACI,KAAK,EAAE;MACV;IACF;IACA5B,MAAM,CAAC2B,KAAK,CAACE,GAAG,CAACD,KAAK,EAAEJ,CAAC,GAAG,CAAC,CAAC;EAChC;EAEA,OAAOxB,MAAM;AACf;AAQA,SAAS0B,0BAA0BA,CAACI,cAAsB,EAAE1B,OAA0B,EAAS;EAAA,IAAA2B,aAAA;EAC7F,IAAI,EAAC3B,OAAO,aAAPA,OAAO,gBAAA2B,aAAA,GAAP3B,OAAO,CAAEE,GAAG,cAAAyB,aAAA,eAAZA,aAAA,CAAcxB,iBAAiB,GAAE;IACpC,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;EAC7B;EACA,MAAM;IAACyB,QAAQ;IAAEC,QAAQ;IAAEC,QAAQ;IAAEC;EAAQ,CAAC,GAAG/B,OAAO,CAACE,GAAG,CAACC,iBAAiB;EAC9E,MAAM6B,IAAI,GAAG,CAACN,cAAc,GAAGE,QAAQ,KAAKC,QAAQ,GAAGD,QAAQ,CAAC;EAChE,MAAMJ,KAAY,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;EACzC,KAAK,IAAIJ,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGU,QAAQ,CAACT,MAAM,EAAED,CAAC,EAAE,EAAE;IACxCI,KAAK,CAACJ,CAAC,CAAC,GAAGa,IAAI,CAACC,KAAK,CAAC,CAACH,QAAQ,CAACX,CAAC,CAAC,GAAGU,QAAQ,CAACV,CAAC,CAAC,IAAIY,IAAI,GAAGF,QAAQ,CAACV,CAAC,CAAC,CAAC;EACzE;EACA,OAAOI,KAAK;AACd;AAUA,eAAeT,wBAAwBA,CACrCJ,aAAqB,EAAAwB,KAAA,EAAAC,KAAA,EAGrBpC,OAA0B,EACmE;EAAA,IAAAqC,aAAA;EAAA,IAH7F;IAACC;EAA6B,CAAC,GAAAH,KAAA;EAAA,IAC/B;IAACI;EAAuC,CAAC,GAAAH,KAAA;EAGzC,MAAMI,cAAc,GAAGD,oBAAoB,CAACE,SAAS,CAACC,KAAA;IAAA,IAAC;MAAChC;IAAI,CAAC,GAAAgC,KAAA;IAAA,OAAK/B,aAAa,KAAKD,IAAI;EAAA,EAAC;EACzF,IAAI8B,cAAc,KAAK,CAAC,CAAC,EAAE;IACzB,OAAO,IAAI;EACb;EACA,MAAMG,oBAAoB,GAAGjD,eAAe,CAAC4C,aAAa,CAACE,cAAc,CAAC,EAAExC,OAAO,aAAPA,OAAO,wBAAAqC,aAAA,GAAPrC,OAAO,CAAEE,GAAG,cAAAmC,aAAA,uBAAZA,aAAA,CAAcO,KAAK,CAAC;EAChG,MAAMC,aAAa,GAAGrD,qBAAqB,CAAC+C,oBAAoB,CAACC,cAAc,CAAC,CAAC;EACjF,MAAMtB,qBAAqB,GAAG,MAAM3B,IAAI,CAACoD,oBAAoB,EAAElD,kBAAkB,EAAE;IACjFkB,aAAa;IACbkC;EACF,CAAC,CAAC;EAGF,OAAO3B,qBAAqB;AAC9B"}
@@ -0,0 +1,28 @@
1
+ export function getUrlWithToken(url) {
2
+ let token = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
3
+ return token ? "".concat(url, "?token=").concat(token) : url;
4
+ }
5
+ export function generateTileAttributeUrls(url, tile) {
6
+ const {
7
+ attributeData = []
8
+ } = tile;
9
+ const attributeUrls = [];
10
+ for (let index = 0; index < attributeData.length; index++) {
11
+ const attributeUrl = attributeData[index].href.replace('./', '');
12
+ attributeUrls.push("".concat(url, "/").concat(attributeUrl));
13
+ }
14
+ return attributeUrls;
15
+ }
16
+ export function generateTilesetAttributeUrls(tileset, resource) {
17
+ const attributeUrls = [];
18
+ const {
19
+ attributeStorageInfo,
20
+ url
21
+ } = tileset;
22
+ for (let index = 0; index < attributeStorageInfo.length; index++) {
23
+ const fileName = attributeStorageInfo[index].key;
24
+ attributeUrls.push("".concat(url, "/nodes/").concat(resource, "/attributes/").concat(fileName, "/0"));
25
+ }
26
+ return attributeUrls;
27
+ }
28
+ //# sourceMappingURL=url-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url-utils.js","names":["getUrlWithToken","url","token","arguments","length","undefined","concat","generateTileAttributeUrls","tile","attributeData","attributeUrls","index","attributeUrl","href","replace","push","generateTilesetAttributeUrls","tileset","resource","attributeStorageInfo","fileName","key"],"sources":["../../../../src/lib/utils/url-utils.ts"],"sourcesContent":["import {Node3DIndexDocument} from '../../types';\n\n/**\n * Generates url with token if it is exists.\n * @param url\n * @param token\n * @returns\n */\nexport function getUrlWithToken(url: string, token: string | null = null): string {\n return token ? `${url}?token=${token}` : url;\n}\n\n/**\n * Generates attribute urls for tile.\n * @param tile\n * @returns list of attribute urls\n */\nexport function generateTileAttributeUrls(url: string, tile: Node3DIndexDocument): string[] {\n const {attributeData = []} = tile;\n const attributeUrls: string[] = [];\n\n for (let index = 0; index < attributeData.length; index++) {\n const attributeUrl = attributeData[index].href.replace('./', '');\n attributeUrls.push(`${url}/${attributeUrl}`);\n }\n\n return attributeUrls;\n}\n\n/**\n * Generates attribute urls for tileset based on tileset and resource\n * @param {Object} tileset\n * @param {number} resource\n * @returns {Array}\n */\nexport function generateTilesetAttributeUrls(tileset, resource) {\n const attributeUrls: string[] = [];\n const {attributeStorageInfo, url} = tileset;\n\n for (let index = 0; index < attributeStorageInfo.length; index++) {\n const fileName = attributeStorageInfo[index].key;\n attributeUrls.push(`${url}/nodes/${resource}/attributes/${fileName}/0`);\n }\n\n return attributeUrls;\n}\n"],"mappings":"AAQA,OAAO,SAASA,eAAeA,CAACC,GAAW,EAAuC;EAAA,IAArCC,KAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;EACtE,OAAOD,KAAK,MAAAI,MAAA,CAAML,GAAG,aAAAK,MAAA,CAAUJ,KAAK,IAAKD,GAAG;AAC9C;AAOA,OAAO,SAASM,yBAAyBA,CAACN,GAAW,EAAEO,IAAyB,EAAY;EAC1F,MAAM;IAACC,aAAa,GAAG;EAAE,CAAC,GAAGD,IAAI;EACjC,MAAME,aAAuB,GAAG,EAAE;EAElC,KAAK,IAAIC,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGF,aAAa,CAACL,MAAM,EAAEO,KAAK,EAAE,EAAE;IACzD,MAAMC,YAAY,GAAGH,aAAa,CAACE,KAAK,CAAC,CAACE,IAAI,CAACC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;IAChEJ,aAAa,CAACK,IAAI,IAAAT,MAAA,CAAIL,GAAG,OAAAK,MAAA,CAAIM,YAAY,CAAE,CAAC;EAC9C;EAEA,OAAOF,aAAa;AACtB;AAQA,OAAO,SAASM,4BAA4BA,CAACC,OAAO,EAAEC,QAAQ,EAAE;EAC9D,MAAMR,aAAuB,GAAG,EAAE;EAClC,MAAM;IAACS,oBAAoB;IAAElB;EAAG,CAAC,GAAGgB,OAAO;EAE3C,KAAK,IAAIN,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGQ,oBAAoB,CAACf,MAAM,EAAEO,KAAK,EAAE,EAAE;IAChE,MAAMS,QAAQ,GAAGD,oBAAoB,CAACR,KAAK,CAAC,CAACU,GAAG;IAChDX,aAAa,CAACK,IAAI,IAAAT,MAAA,CAAIL,GAAG,aAAAK,MAAA,CAAUY,QAAQ,kBAAAZ,MAAA,CAAec,QAAQ,OAAI,CAAC;EACzE;EAEA,OAAOV,aAAa;AACtB"}
@@ -0,0 +1,18 @@
1
+ export let DATA_TYPE = function (DATA_TYPE) {
2
+ DATA_TYPE["UInt8"] = "UInt8";
3
+ DATA_TYPE["UInt16"] = "UInt16";
4
+ DATA_TYPE["UInt32"] = "UInt32";
5
+ DATA_TYPE["UInt64"] = "UInt64";
6
+ DATA_TYPE["Int16"] = "Int16";
7
+ DATA_TYPE["Int32"] = "Int32";
8
+ DATA_TYPE["Int64"] = "Int64";
9
+ DATA_TYPE["Float32"] = "Float32";
10
+ DATA_TYPE["Float64"] = "Float64";
11
+ return DATA_TYPE;
12
+ }({});
13
+ export let HeaderAttributeProperty = function (HeaderAttributeProperty) {
14
+ HeaderAttributeProperty["vertexCount"] = "vertexCount";
15
+ HeaderAttributeProperty["featureCount"] = "featureCount";
16
+ return HeaderAttributeProperty;
17
+ }({});
18
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","names":["DATA_TYPE","HeaderAttributeProperty"],"sources":["../../src/types.ts"],"sourcesContent":["import type {Matrix4, Quaternion, Vector3} from '@math.gl/core';\nimport type {TypedArray, MeshAttribute, TextureLevel} from '@loaders.gl/schema';\nimport {Tile3D, Tileset3D} from '@loaders.gl/tiles';\n\nexport enum DATA_TYPE {\n UInt8 = 'UInt8',\n UInt16 = 'UInt16',\n UInt32 = 'UInt32',\n UInt64 = 'UInt64',\n Int16 = 'Int16',\n Int32 = 'Int32',\n Int64 = 'Int64',\n Float32 = 'Float32',\n Float64 = 'Float64'\n}\n\nexport type COLOR = [number, number, number, number];\n\n/**\n * spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/3DSceneLayer.cmn.md\n */\n// TODO Replace \"[key: string]: any\" with actual defenition\nexport interface I3STilesetHeader extends SceneLayer3D {\n /** Not in spec, but is necessary for woking */\n url?: string;\n [key: string]: any;\n}\n/** https://github.com/Esri/i3s-spec/blob/master/docs/1.8/nodePage.cmn.md */\nexport type NodePage = {\n /** Array of nodes. */\n nodes: NodeInPage[];\n};\n/**\n * Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/mesh.cmn.md\n */\ntype NodeMesh = {\n /**\n * The material definition.\n */\n material: MeshMaterial;\n /** The geometry definition. */\n geometry: MeshGeometry;\n /** The attribute set definition. */\n attribute: meshAttribute;\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/meshMaterial.cmn.md */\nexport type MeshMaterial = {\n /** The index in layer.materialDefinitions array. */\n definition: number;\n /** Resource id for the material textures. i.e: layers/0/nodes/{material.resource}/textures/{tex_name}. Is required if material declares any textures. */\n resource?: number;\n /** Estimated number of texel for the highest resolution base color texture. */\n texelCountHint?: number;\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/meshGeometry.cmn.md */\nexport type MeshGeometry = {\n /** The index in layer.geometryDefinitions array */\n definition: number;\n /** The resource locator to be used to query geometry resources: layers/0/nodes/{this.resource}/geometries/{layer.geometryDefinitions[this.definition].geometryBuffers[0 or 1]}. */\n resource: number;\n /** Number of vertices in the geometry buffer of this mesh for the umcompressed mesh buffer. Please note that Draco compressed meshes may have less vertices due to de-duplication (actual number of vertices is part of the Draco binary blob). Default=0 */\n vertexCount?: number;\n /** Number of features for this mesh. Default=0. (Must omit or set to 0 if mesh doesn't use features.) */\n featureCount?: number;\n};\n/** https://github.com/Esri/i3s-spec/blob/master/docs/1.8/meshAttribute.cmn.md */\ntype meshAttribute = {\n /** The resource identifier to be used to locate attribute resources of this mesh. i.e. layers/0/nodes/<resource id>/attributes/... */\n resource: number;\n};\n\nexport type I3STextureFormat = 'jpg' | 'png' | 'ktx-etc2' | 'dds' | 'ktx2';\n\n// TODO Replace \"[key: string]: any\" with actual defenition\nexport type I3STileHeader = {\n isDracoGeometry: boolean;\n textureUrl?: string;\n url?: string;\n textureFormat?: I3STextureFormat;\n textureLoaderOptions?: any;\n materialDefinition?: I3SMaterialDefinition;\n mbs: Mbs;\n obb?: Obb;\n lodSelection?: LodSelection[];\n [key: string]: any;\n};\n\nexport type I3SParseOptions = {\n /** ArcGIS access token */\n token?: string;\n /** Is 3DSceneLayer json expected in response */\n isTileset?: string;\n /** Is 3DNodeIndexDocument json expected in response */\n isTileHeader?: string;\n /** Tile3D instance. This property used only to load tile content */\n /** Tile-specific options */\n _tileOptions?: I3STileOptions;\n /** Tileset-specific options */\n _tilesetOptions?: I3STilesetOptions;\n /** Load Draco Compressed geometry if available */\n useDracoGeometry?: boolean;\n /** Load compressed textures if available */\n useCompressedTextures?: boolean;\n /** Set false if don't need to parse textures */\n decodeTextures?: boolean;\n /** deck.gl compatible coordinate system.\n * https://github.com/visgl/deck.gl/blob/master/docs/developer-guide/coordinate-systems.md\n * Supported coordinate systems: METER_OFFSETS, LNGLAT_OFFSETS\n */\n coordinateSystem?: number;\n colorsByAttribute?: {\n attributeName: string;\n minValue: number;\n maxValue: number;\n minColor: COLOR;\n maxColor: COLOR;\n };\n\n /** @deprecated */\n tile?: Tile3D | I3STileOptions;\n /** Tileset3D instance. This property used only to load tile content */\n /** @deprecated */\n tileset?: Tileset3D | I3STilesetOptions;\n};\n\nexport type I3STileOptions = {\n isDracoGeometry: boolean;\n textureUrl?: string;\n textureFormat?: I3STextureFormat;\n textureLoaderOptions?: any;\n materialDefinition?: I3SMaterialDefinition;\n attributeUrls: string[];\n mbs: Mbs;\n};\n\nexport type I3STilesetOptions = {\n store: Store;\n attributeStorageInfo: AttributeStorageInfo[];\n fields: Field[];\n};\n\n// TODO Replace \"[key: string]: any\" with actual defenition\nexport type I3STileContent = {\n attributes: I3SMeshAttributes;\n indices: TypedArray | null;\n featureIds: number[] | TypedArray;\n vertexCount: number;\n modelMatrix: Matrix4;\n coordinateSystem: number;\n byteLength: number;\n texture: TileContentTexture;\n [key: string]: any;\n};\n\nexport type TileContentTexture =\n | ArrayBuffer\n | {\n compressed: boolean;\n mipmaps: boolean;\n width: number;\n height: number;\n data: TextureLevel[];\n }\n | null;\n\nexport type BoundingVolumes = {\n mbs: Mbs;\n obb: Obb;\n};\n\nexport type Obb = {\n center: number[] | Vector3;\n halfSize: number[] | Vector3;\n quaternion: number[] | Quaternion;\n};\n\nexport type Mbs = [number, number, number, number];\n\n/** SceneLayer3D based on I3S specification - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/3DSceneLayer.cmn.md */\nexport type SceneLayer3D = {\n /** Unique numeric ID of the layer. */\n id: number;\n /** The relative URL to the 3DSceneLayerResource. Only present as part of the SceneServiceInfo resource. */\n href?: string;\n /** The user-visible layer type */\n layerType: '3DObject' | 'IntegratedMesh';\n /** The spatialReference of the layer including the vertical coordinate reference system (CRS). Well Known Text (WKT) for CRS is included to support custom CRS. */\n spatialReference?: SpatialReference;\n /** Enables consuming clients to quickly determine whether this layer is compatible (with respect to its horizontal and vertical coordinate system) with existing content. */\n heightModelInfo?: HeightModelInfo;\n /** The ID of the last update session in which any resource belonging to this layer has been updated. */\n version: string;\n /** The name of this layer. */\n name?: string;\n /** The time of the last update. */\n serviceUpdateTimeStamp?: {lastUpdate: number};\n /** The display alias to be used for this layer. */\n alias?: string;\n /** Description string for this layer. */\n description?: string;\n /** Copyright and usage information for the data in this layer. */\n copyrightText?: string;\n /** Capabilities supported by this layer. */\n capabilities: string[];\n /** ZFactor to define conversion factor for elevation unit. */\n ZFactor?: number;\n /** Indicates if any styling information represented as drawingInfo is captured as part of the binary mesh representation. */\n cachedDrawingInfo?: CachedDrawingInfo;\n /** An object containing drawing information. */\n drawingInfo?: DrawingInfo;\n /** An object containing elevation drawing information. If absent, any content of the scene layer is drawn at its z coordinate. */\n elevationInfo?: ElevationInfo;\n /** PopupInfo of the scene layer. */\n popupInfo?: PopupInfo;\n /** Indicates if client application will show the popup information. Default is FALSE. */\n disablePopup: boolean;\n /**\n * The store object describes the exact physical storage of a layer and\n * enables the client to detect when multiple layers are served from\n * the same store.\n */\n store: Store;\n /** A collection of objects that describe each attribute field regarding its field name, datatype, and a user friendly name {name,type,alias}. */\n fields?: Field[];\n /** Provides the schema and layout used for storing attribute content in binary format in I3S. */\n attributeStorageInfo?: AttributeStorageInfo[];\n /** Contains the statistical information for a layer. */\n statisticsInfo?: StatisticsInfo[];\n /** The paged-access index description. */\n nodePages?: NodePageDefinition;\n /** List of materials classes used in this layer. */\n materialDefinitions?: I3SMaterialDefinition[];\n /** Defines the set of textures that can be referenced by meshes. */\n textureSetDefinitions?: TextureSetDefinition[];\n /** Define the layouts of mesh geometry and its attributes */\n geometryDefinitions?: GeometryDefinition[];\n /** 3D extent. */\n fullExtent?: FullExtent;\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/cachedDrawingInfo.cmn.md */\nexport type CachedDrawingInfo = {\n /** If true, the drawingInfo is captured as part of the binary scene layer representation. */\n color: boolean;\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/drawingInfo.cmn.md */\nexport type DrawingInfo = {\n /** An object defining the symbology for the layer. See more information about supported renderer types in ArcGIS clients. */\n renderer: any;\n /** Scale symbols for the layer. */\n scaleSymbols: boolean;\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/elevationInfo.cmn.md */\nexport type ElevationInfo = {\n mode: 'relativeToGround' | 'absoluteHeight' | 'onTheGround' | 'relativeToScene';\n /** Offset is always added to the result of the above logic except for onTheGround where offset is ignored. */\n offset: number;\n /** A string value indicating the unit for the values in elevationInfo */\n unit: string;\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/statisticsInfo.cmn.md */\nexport type StatisticsInfo = {\n /** Key indicating the resource of the statistics. */\n key: string;\n /** Name of the field of the statistical information. */\n name: string;\n /** The URL to the statistics information. */\n href: string;\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/nodePageDefinition.cmn.md */\nexport type NodePageDefinition = {\n /** Number of nodes per page for this layer. Must be a power-of-two less than 4096 */\n nodesPerPage: number;\n /** Index of the root node. Default = 0. */\n rootIndex?: number;\n /** Defines the meaning of nodes[].lodThreshold for this layer. */\n lodSelectionMetricType: 'maxScreenThresholdSQ';\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/materialDefinitions.cmn.md */\nexport type I3SMaterialDefinition = {\n /** A set of parameter values that are used to define the metallic-roughness material model from Physically-Based Rendering (PBR) methodology. When not specified, all the default values of pbrMetallicRoughness apply. */\n pbrMetallicRoughness: I3SPbrMetallicRoughness;\n /** The normal texture map. */\n normalTexture?: I3SMaterialTexture;\n /** The occlusion texture map. */\n occlusionTexture?: I3SMaterialTexture;\n /** The emissive texture map. */\n emissiveTexture?: I3SMaterialTexture;\n /** The emissive color of the material. */\n emissiveFactor?: [number, number, number];\n /** Defines the meaning of the alpha-channel/alpha-mask. */\n alphaMode: 'opaque' | 'mask' | 'blend';\n /** The alpha cutoff value of the material. */\n alphaCutoff?: number;\n /** Specifies whether the material is double sided. */\n doubleSided?: boolean;\n /** Winding order is counterclockwise. */\n cullFace?: 'none' | 'front' | 'back';\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/pbrMetallicRoughness.cmn.md */\nexport type I3SPbrMetallicRoughness = {\n /** The material's base color factor. default=[1,1,1,1] */\n baseColorFactor?: [number, number, number, number];\n /** The base color texture. */\n baseColorTexture?: I3SMaterialTexture;\n /** the metalness of the material. default=1.0 */\n metallicFactor: number;\n /** the roughness of the material. default=1.0 */\n roughnessFactor: number;\n /** the metallic-roughness texture. */\n metallicRoughnessTexture?: I3SMaterialTexture;\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/materialTexture.cmn.md */\nexport type I3SMaterialTexture = {\n /** The index in layer.textureSetDefinitions. */\n textureSetDefinitionId: number;\n /** The set index of texture's TEXCOORD attribute used for texture coordinate mapping. Default is 0. Deprecated. */\n texCoord?: number;\n /** The normal texture: scalar multiplier applied to each normal vector of the normal texture. For occlusion texture,scalar multiplier controlling the amount of occlusion applied. Default=1 */\n factor?: number;\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/attributeStorageInfo.cmn.md */\nexport type AttributeStorageInfo = {\n key: string;\n name: string;\n header: {property: string; valueType: string}[];\n ordering?: string[];\n attributeValues?: AttributeValue;\n attributeByteCounts?: AttributeValue;\n objectIds?: AttributeValue;\n};\n\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/field.cmn.md */\nexport type Field = {\n name: string;\n type: ESRIField;\n alias?: string;\n domain?: Domain;\n};\n\nexport type ESRIField =\n | 'esriFieldTypeDate'\n | 'esriFieldTypeSingle'\n | 'esriFieldTypeDouble'\n | 'esriFieldTypeGUID'\n | 'esriFieldTypeGlobalID'\n | 'esriFieldTypeInteger'\n | 'esriFieldTypeOID'\n | 'esriFieldTypeSmallInteger'\n | 'esriFieldTypeString';\n\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/popupInfo.cmn.md */\nexport type PopupInfo = {\n title?: string;\n description?: string;\n expressionInfos?: any[];\n fieldInfos?: FieldInfo[];\n mediaInfos?: any[];\n popupElements?: {text?: string; type?: string; fieldInfos?: FieldInfo[]}[];\n};\n\n/**\n * Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md\n */\nexport type Node3DIndexDocument = {\n id: string;\n version?: string;\n level?: number;\n mbs?: Mbs;\n obb?: Obb;\n lodSelection?: LodSelection[];\n children?: NodeReference[];\n neighbors?: NodeReference[];\n parentNode?: NodeReference;\n sharedResource?: Resource;\n featureData?: Resource[];\n geometryData?: Resource[];\n textureData?: Resource[];\n attributeData?: Resource[];\n created?: string;\n expires?: string;\n};\n\n/**\n * Minimal I3S node data is needed for loading\n */\nexport type I3SMinimalNodeData = {\n id: string;\n url?: string;\n transform?: number[];\n lodSelection?: LodSelection[];\n obb?: Obb;\n mbs?: Mbs;\n contentUrl?: string;\n textureUrl?: string;\n attributeUrls?: string[];\n materialDefinition?: I3SMaterialDefinition;\n textureFormat?: I3STextureFormat;\n textureLoaderOptions?: {[key: string]: any};\n children?: NodeReference[];\n isDracoGeometry: boolean;\n};\n\nexport type LodSelection = {\n metricType?: string;\n maxError: number;\n};\n\nexport type NodeReference = {\n id: string;\n version?: string;\n mbs?: Mbs;\n obb?: Obb;\n href?: string;\n};\n\nexport type Resource = {\n href: string;\n layerContent?: string[];\n featureRange?: number[];\n multiTextureBundle?: string;\n vertexElements?: number[];\n faceElements?: number[];\n nodePath?: string;\n};\n\nexport type MaxScreenThresholdSQ = {\n maxError: number;\n};\n\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/node.cmn.md */\nexport type NodeInPage = {\n /**\n * The index in the node array. May be different than material, geometry and attribute resource id. See mesh for more information.\n */\n index: number;\n /**\n * The index of the parent node in the node array.\n */\n parentIndex?: number;\n /**\n * When to switch LoD. See https://github.com/Esri/i3s-spec/blob/master/docs/1.8/nodePageDefinition.cmn.md for more information.\n */\n lodThreshold?: number;\n /**\n * Oriented bounding box for this node.\n */\n obb: Obb;\n /**\n * index of the children nodes indices.\n */\n children?: number[];\n /**\n * The mesh for this node. WARNING: only SINGLE mesh is supported at version 1.7 (i.e. length must be 0 or 1).\n */\n mesh?: NodeMesh;\n};\n\n/**\n * https://github.com/Esri/i3s-spec/blob/master/docs/1.8/materialDefinitionInfo.cmn.md\n */\nexport type MaterialDefinitionInfo = {\n /** A name for the material as assigned in the creating application. */\n name?: string;\n /** Indicates the material type, chosen from the supported values. */\n type?: 'standard' | 'water' | 'billboard' | 'leafcard' | 'reference';\n /** The href that resolves to the shared resource bundle in which the material definition is contained. */\n $ref?: string;\n /** Parameter defined for the material.\n * https://github.com/Esri/i3s-spec/blob/master/docs/1.8/materialParams.cmn.md\n */\n params: {\n /** Indicates transparency of this material; 0 = opaque, 1 = fully transparent. */\n transparency?: number;\n /** Indicates reflectivity of this material. */\n reflectivity?: number;\n /** Indicates shininess of this material. */\n shininess?: number;\n /** Ambient color of this material. Ambient color is the color of an object where it is in shadow.\n * This color is what the object reflects when illuminated by ambient light rather than direct light. */\n ambient?: number[];\n /** Diffuse color of this material. Diffuse color is the most instinctive meaning of the color of an object.\n * It is that essential color that the object reveals under pure white light. It is perceived as the color\n * of the object itself rather than a reflection of the light. */\n diffuse?: number[];\n /** Specular color of this material. Specular color is the color of the light of a specular reflection\n * (specular reflection is the type of reflection that is characteristic of light reflected from a shiny\n * surface). */\n specular?: number[];\n /** Rendering mode. */\n renderMode: 'textured' | 'solid' | 'untextured' | 'wireframe';\n /** TRUE if features with this material should cast shadows. */\n castShadows?: boolean;\n /** TRUE if features with this material should receive shadows */\n receiveShadows?: boolean;\n /** Indicates the material culling options {back, front, none}. */\n cullFace?: string;\n /** This flag indicates that the vertex color attribute of the geometry should be used to color the geometry\n * for rendering. If texture is present, the vertex colors are multiplied by this color.\n * e.g. pixel_color = [interpolated]vertex_color * texel_color. Default is false. */\n vertexColors?: boolean;\n /** This flag indicates that the geometry has uv region vertex attributes. These are used for adressing\n * subtextures in a texture atlas. The uv coordinates are relative to this subtexture in this case.\n * This is mostly useful for repeated textures in a texture atlas. Default is false. */\n vertexRegions?: boolean;\n /** Indicates whether Vertex Colors also contain a transparency channel. Default is false. */\n useVertexColorAlpha?: boolean;\n };\n};\n\n/** https://github.com/Esri/i3s-spec/blob/master/docs/1.8/sharedResource.cmn.md */\nexport type SharedResources = {\n /** Materials describe how a Feature or a set of Features is to be rendered. */\n materialDefinitions?: {[key: string]: MaterialDefinitionInfo};\n /** A Texture is a set of images, with some parameters specific to the texture/uv mapping to geometries. */\n textureDefinitions?: {[key: string]: TextureDefinitionInfo};\n};\n\n/** https://github.com/Esri/i3s-spec/blob/master/docs/1.8/image.cmn.md */\ntype TextureImage = {\n /** A unique ID for each image. Generated using the BuildID function. */\n id: string;\n /** width of this image, in pixels. */\n size?: number;\n /** The maximum size of a single pixel in world units.\n * This property is used by the client to pick the image to load and render. */\n pixelInWorldUnits?: number;\n /** The href to the image(s), one per encoding, in the same order as the encodings. */\n href?: string[];\n /** The byte offset of this image's encodings. There is one per encoding,\n * in the same order as the encodings, in the block in which this texture image resides. */\n byteOffset?: string[];\n /** The length in bytes of this image's encodings. There is one per encoding,\n * in the same order as the encodings. */\n length?: number[];\n};\n\nexport type Attribute = 'OBJECTID' | 'string' | 'double' | 'Int32' | string;\n\nexport type Extent = [number, number, number, number];\n\nexport type FeatureAttribute = {\n id: AttributeValue;\n faceRange: AttributeValue;\n};\n\nexport type BuildingSceneLayerTileset = {\n header: BuildingSceneLayer;\n sublayers: BuildingSceneSublayer[];\n};\n\nexport type BuildingSceneLayer = {\n id: number;\n name: string;\n version: string;\n alias?: string;\n layerType: 'Building';\n description?: string;\n copyrightText?: string;\n fullExtent: FullExtent;\n spatialReference: SpatialReference;\n heightModelInfo?: HeightModelInfo;\n sublayers: BuildingSceneSublayer[];\n filters?: Filter[];\n activeFilterID?: string;\n statisticsHRef?: string;\n};\n\nexport type BuildingSceneSublayer = {\n id: number;\n name: string;\n alias?: string;\n discipline?: 'Mechanical' | 'Architectural' | 'Piping' | 'Electrical' | 'Structural';\n modelName?: string;\n layerType: 'group' | '3DObject' | 'Point';\n visibility?: boolean;\n sublayers?: BuildingSceneSublayer[];\n isEmpty?: boolean;\n url?: string;\n};\n\ntype Filter = {\n id: string;\n name: string;\n description: string;\n isDefaultFilter?: boolean;\n isVisible?: boolean;\n filterBlocks: FilterBlock[];\n filterAuthoringInfo?: FilterAuthoringInfo;\n};\n\ntype FilterAuthoringInfo = {\n type: string;\n filterBlocks: FilterBlockAuthoringInfo[];\n};\n\ntype FilterBlockAuthoringInfo = {\n filterTypes: FilterType[];\n};\n\ntype FilterType = {\n filterType: string;\n filterValues: string[];\n};\n\ntype FilterBlock = {\n title: string;\n filterMode: FilterModeSolid | FilterModeWireFrame;\n filterExpression: string;\n};\n\ntype Edges = {\n type: string;\n color: number[];\n size: number;\n transparency: number;\n extensionLength: number;\n};\n\ntype FilterModeSolid = {\n type: 'solid';\n};\n\ntype FilterModeWireFrame = {\n type: 'wireFrame';\n edges: Edges;\n};\n\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/spatialReference.cmn.md */\nexport type SpatialReference = {\n /** The current WKID value of the vertical coordinate system. */\n latestVcsWkid: number;\n /** dentifies the current WKID value associated with the same spatial reference. */\n latestWkid: number;\n /** The WKID value of the vertical coordinate system. */\n vcsWkid: number;\n /** WKID, or Well-Known ID, of the CRS. Specify either WKID or WKT of the CRS. */\n wkid: number;\n /** WKT, or Well-Known Text, of the CRS. Specify either WKT or WKID of the CRS but not both. */\n wkt?: string;\n};\n\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/fullExtent.cmn.md */\nexport type FullExtent = {\n /** left longitude in decimal degrees */\n xmin: number;\n /** right longitude in decimal degrees */\n xmax: number;\n /** bottom latitude in decimal degrees*/\n ymin: number;\n /** top latitude in decimal degrees*/\n ymax: number;\n /** lowest elevation in meters */\n zmin: number;\n /** highest elevation in meters */\n zmax: number;\n spatialReference?: SpatialReference;\n};\n\n/**\n * https://github.com/Esri/i3s-spec/blob/master/docs/1.8/textureDefinitionInfo.cmn.md\n */\nexport type TextureDefinitionInfo = {\n /** MIMEtype - The encoding/content type that is used by all images in this map */\n encoding?: string[];\n /** UV wrapping modes, from {none, repeat, mirror}. */\n wrap?: string[];\n /** TRUE if the Map represents a texture atlas. */\n atlas?: boolean;\n /** The name of the UV set to be used as texture coordinates. */\n uvSet?: string;\n /** Indicates channels description. */\n channels?: 'rbg' | 'rgba' | string;\n /** An image is a binary resource, containing a single raster that can be used to texture a feature or symbol. */\n images: TextureImage[];\n};\n\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/domain.cmn.md */\ntype Domain = {\n type: string;\n name: string;\n description?: string;\n fieldType?: string;\n range?: [number, number];\n codedValues?: {name: string; code: string | number}[];\n mergePolicy?: string;\n splitPolicy?: string;\n};\n/**\n * spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/store.cmn.md\n */\ntype Store = {\n id: string | number;\n profile: string;\n version: number | string;\n resourcePattern: string[];\n rootNode: string;\n extent: number[];\n indexCRS: string;\n vertexCRS: string;\n normalReferenceFrame: string;\n attributeEncoding: string;\n textureEncoding: string[];\n lodType: string;\n lodModel: string;\n defaultGeometrySchema: DefaultGeometrySchema;\n};\n/**\n * Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/defaultGeometrySchema.cmn.md\n */\ntype DefaultGeometrySchema = {\n geometryType?: 'triangles';\n topology: 'PerAttributeArray' | 'Indexed';\n header: HeaderAttribute[];\n ordering: string[];\n vertexAttributes: VertexAttribute;\n faces?: VertexAttribute;\n featureAttributeOrder: string[];\n featureAttributes: FeatureAttribute;\n // TODO Do we realy need this Property?\n attributesOrder?: string[];\n};\n/**\n * spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/headerAttribute.cmn.md\n */\nexport type HeaderAttribute = {\n property: HeaderAttributeProperty.vertexCount | HeaderAttributeProperty.featureCount | string;\n type:\n | DATA_TYPE.UInt8\n | DATA_TYPE.UInt16\n | DATA_TYPE.UInt32\n | DATA_TYPE.UInt64\n | DATA_TYPE.Int16\n | DATA_TYPE.Int32\n | DATA_TYPE.Int64\n | DATA_TYPE.Float32\n | DATA_TYPE.Float64;\n};\nexport enum HeaderAttributeProperty {\n vertexCount = 'vertexCount',\n featureCount = 'featureCount'\n}\nexport type VertexAttribute = {\n position: GeometryAttribute;\n normal: GeometryAttribute;\n uv0: GeometryAttribute;\n color: GeometryAttribute;\n region?: GeometryAttribute;\n};\nexport type GeometryAttribute = {\n byteOffset?: number;\n valueType:\n | DATA_TYPE.UInt8\n | DATA_TYPE.UInt16\n | DATA_TYPE.Int16\n | DATA_TYPE.Int32\n | DATA_TYPE.Int64\n | DATA_TYPE.Float32\n | DATA_TYPE.Float64;\n valuesPerElement: number;\n};\nexport type I3SMeshAttributes = {\n [key: string]: I3SMeshAttribute;\n};\nexport interface I3SMeshAttribute extends MeshAttribute {\n type?: number;\n metadata?: any;\n}\n/** https://github.com/Esri/i3s-spec/blob/master/docs/1.8/heightModelInfo.cmn.md */\ntype HeightModelInfo = {\n heightModel: 'gravity_related_height' | 'ellipsoidal';\n vertCRS: string;\n heightUnit:\n | 'meter'\n | 'us-foot'\n | 'foot'\n | 'clarke-foot'\n | 'clarke-yard'\n | 'clarke-link'\n | 'sears-yard'\n | 'sears-foot'\n | 'sears-chain'\n | 'benoit-1895-b-chain'\n | 'indian-yard'\n | 'indian-1937-yard'\n | 'gold-coast-foot'\n | 'sears-1922-truncated-chain'\n | 'us-inch'\n | 'us-mile'\n | 'us-yard'\n | 'millimeter'\n | 'decimeter'\n | 'centimeter'\n | 'kilometer';\n};\n\nexport type TextureSetDefinitionFormats = {name: string; format: I3STextureFormat}[];\n\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/textureSetDefinition.cmn.md */\ntype TextureSetDefinition = {\n formats: TextureSetDefinitionFormats;\n atlas?: boolean;\n};\n\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/geometryDefinition.cmn.md */\ntype GeometryDefinition = {\n topology: 'triangle' | string;\n geometryBuffers: GeometryBuffer[];\n};\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/geometryBuffer.cmn.md */\ntype GeometryBuffer = {\n offset?: number;\n position?: GeometryBufferItem;\n normal?: GeometryBufferItem;\n uv0?: GeometryBufferItem;\n color?: GeometryBufferItem;\n uvRegion?: GeometryBufferItem;\n featureId?: GeometryBufferItem;\n faceRange?: GeometryBufferItem;\n compressedAttributes?: {encoding: string; attributes: string[]};\n};\n\ntype GeometryBufferItem = {type: string; component: number; encoding?: string; binding: string};\n\ntype AttributeValue = {valueType: string; encoding?: string; valuesPerElement?: number};\n\nexport type FieldInfo = {\n fieldName: string;\n visible: boolean;\n isEditable: boolean;\n label: string;\n};\n\nexport type ArcGisWebSceneData = {\n header: ArcGisWebScene;\n layers: OperationalLayer[];\n unsupportedLayers: OperationalLayer[];\n};\n\n/**\n * ArcGis WebScene spec - https://developers.arcgis.com/web-scene-specification/objects/webscene/\n */\nexport type ArcGisWebScene = {\n /**\n * @todo add type.\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/applicationProperties/\n * Configuration of application and UI elements.\n */\n applicationProperties?: any;\n /**\n * Operational layers contain business data which are used to make thematic scenes.\n */\n operationalLayers: OperationalLayer[];\n /**\n * Basemaps give the web scene a geographic context.\n */\n baseMap: BaseMap;\n /**\n * Ground defines the main surface of the web scene, based on elevation layers.\n */\n ground: Ground;\n /**\n * An object that defines the characteristics of the vertical coordinate system used by the web scene.\n */\n heightModelInfo: HeightModelInfo;\n /**\n * Root element in the web scene specifying a string value indicating the web scene version.\n * Valid values: 1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20, 1.21, 1.22, 1.23, 1.24, 1.25, 1.26, 1.27\n */\n version: string;\n /**\n * String value indicating the application which authored the webmap\n */\n authoringApp: string;\n /**\n * String value indicating the authoring App's version number.\n */\n authoringAppVersion: string;\n /**\n * A presentation consists of multiple slides, where each slide is a specific view into the web scene.\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/presentation/\n * @todo Add presentation type.\n */\n presentation: ArcGisPresentation;\n /**\n * An object that provides information about the initial environment settings and viewpoint of the web scene.\n */\n initialState: InitialState;\n /**\n * An object used to specify the spatial reference of the given geometry.\n */\n spatialReference: SpatialReference;\n viewingMode: 'global' | 'local';\n /**\n * @todo add type.\n * Defines area to be clipped for display.\n */\n clippingArea?: any;\n /**\n * @todo add type.\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/mapFloorInfo/\n * Contains floor-awareness information for the web scene.\n */\n mapFloorInfo?: any;\n /**\n * @todo add type.\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/mapRangeInfo/\n * Map Range Information\n */\n mapRangeInfo?: any;\n /**\n * @todo add type.\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/table/\n * An array of table objects.\n */\n tables?: any;\n /**\n * @todo add type.\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/transportationNetwork/\n * Used to specify the transportation networks of the scene.\n */\n transportationNetworks?: any;\n /**\n * @todo add type.\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/widgets/\n * The widgets object contains widgets that should be exposed to the user.\n */\n widgets?: any;\n};\n\n/**\n * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-webscene-Presentation.html\n */\ntype ArcGisPresentation = {\n slides: Slide[];\n};\n\n/**\n * A slide stores a snapshot of several pre-set properties of the WebScene and SceneView,\n * such as the basemap, viewpoint and visible layers.\n * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-webscene-Slide.html\n */\ntype Slide = {\n id: string;\n title: {\n text: string;\n };\n thumbnail: {\n url: string;\n };\n description: {\n text: string;\n };\n ground: {\n transparency: number;\n };\n baseMap: ArcGisBaseMap;\n visibleLayers: ArcGisVisibleLayer[];\n viewpoint: ArcGisViewPoint;\n};\n\n/**\n * The basemap of the scene. Only the base and reference layers of the basemap are stored in a slide.\n * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-Basemap.html\n */\ntype ArcGisBaseMap = {\n id: string;\n title: string;\n baseMapLayers: ArcGisBaseMapLayer[];\n};\n\n/**\n * The visible layers of the scene.\n * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-webscene-Slide.html#visibleLayers\n */\ntype ArcGisVisibleLayer = {\n id: string;\n sublayerIds: number[];\n};\n/**\n * The basemap of the scene.\n * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-Basemap.html\n */\ntype ArcGisBaseMapLayer = {\n id: string;\n title: string;\n url: string;\n layerType: string;\n visibility: boolean;\n};\n\n/**\n * The viewpoint of the slide. This acts like a bookmark, saving a predefined location or point of view from which to view the scene.\n * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-Viewpoint.html\n */\ntype ArcGisViewPoint = {\n scale: number;\n rotation?: number;\n /**\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/viewpoint/\n */\n targetGeometry: any;\n camera: ArcGisCamera;\n};\n\n/**\n * The camera defines the position, tilt, and heading of the point from which the SceneView's visible extent is observed.\n * It is not associated with device hardware. This class only applies to 3D SceneViews.\n * Spec - https://developers.arcgis.com/javascript/latest/api-reference/esri-Camera.html\n */\nexport type ArcGisCamera = {\n position: {\n x: number;\n y: number;\n z: number;\n };\n spatialReference: {\n wkid: number;\n latestWkid: number;\n };\n heading: number;\n tilt: number;\n};\n\n/**\n * Operational layers contain your data. Usually, a basemap sits beneath your operational layers to give them geographic context.\n * Spec- https://developers.arcgis.com/web-scene-specification/objects/operationalLayers/\n */\nexport type OperationalLayer = {\n id: string;\n opacity: number;\n title: string;\n url: string;\n visibility: boolean;\n itemId: string;\n layerType: string;\n LayerDefinition: LayerDefinition;\n screenSizePerspective: boolean;\n showLabels?: boolean;\n disablePopup?: boolean;\n showLegend?: boolean;\n layers?: OperationalLayer[];\n};\n\ntype LayerDefinition = {\n elevationInfo: ElevationInfo;\n drawingInfo: DrawingInfo;\n};\n\ntype BaseMap = {\n id: string;\n title: string;\n baseMapLayers: BaseMapLayer[];\n elevationLayers: ElevationLayer[];\n};\n\ntype BaseMapLayer = {\n id: string;\n opacity: number;\n title: string;\n url: string;\n visibility: boolean;\n layerType: string;\n};\n\ntype ElevationLayer = {\n id: string;\n listMode: string;\n title: string;\n url: string;\n visibility: boolean;\n layerType: string;\n};\n\ntype Ground = {\n layers: ElevationLayer[];\n transparency: number;\n navigationConstraint: NavigationConstraint;\n};\n\ntype NavigationConstraint = {\n type: string;\n};\n\ntype InitialState = {\n environment: Enviroment;\n viewpoint: ViewPoint;\n};\n\ntype Enviroment = {\n lighting: Lighting;\n atmosphereEnabled?: string;\n starsEnabled?: string;\n};\n\ntype Lighting = {\n datetime?: number;\n displayUTCOffset?: number;\n};\n\ntype ViewPoint = {\n camera: Camera;\n};\n\ntype Camera = {\n position: CameraPosition;\n heading: number;\n tilt: number;\n};\n\ntype CameraPosition = {\n spatialReference: SpatialReference;\n x: number;\n y: number;\n z: number;\n};\n\n/**\n * Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/statsInfo.cmn.md\n */\nexport type StatsInfo = {\n /** Represents the count of the value. */\n totalValuesCount?: number;\n /** Minimum attribute value for the entire layer. */\n min?: number;\n /** Maximum attribute value for the entire layer. */\n max?: number;\n /** Count for the entire layer. */\n count?: number;\n /** Sum of the attribute values over the entire layer. */\n sum?: number;\n /** Representing average or mean value. For example, sum/count. */\n avg?: number;\n /** Representing the standard deviation. */\n stddev?: number;\n /**\tRepresenting variance. For example, stats.stddev *stats.stddev. */\n variance?: number;\n /** Represents the histogram. */\n histogram?: Histogram;\n /** An array of most frequently used values within the point cloud scene layer. */\n mostFrequentValues?: ValueCount[];\n};\n\n/** Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/histogram.cmn.md */\nexport type Histogram = {\n /** Minimum attribute value for the entire layer. */\n minimum: number;\n /** Maximum attribute value for the entire layer. Maximum array size for stats.histo.counts is 256. */\n maximum: number;\n /** Count for the entire layer. */\n counts: number[];\n};\n\nexport type ValueCount = {\n /** Type of the attribute values after decompression, if applicable. Please note that string is not supported for point cloud scene layer attributes. */\n value: number | string;\n /** Count of the number of values. May exceed 32 bits. */\n count: number;\n};\n"],"mappings":"AAIA,WAAYA,SAAS,aAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAAA,OAATA,SAAS;AAAA;AA6tBrB,WAAYC,uBAAuB,aAAvBA,uBAAuB;EAAvBA,uBAAuB;EAAvBA,uBAAuB;EAAA,OAAvBA,uBAAuB;AAAA"}
@@ -0,0 +1,5 @@
1
+ import { createLoaderWorker } from '@loaders.gl/loader-utils';
2
+ import '@loaders.gl/polyfills';
3
+ import { I3SContentLoader } from '../i3s-content-loader';
4
+ createLoaderWorker(I3SContentLoader);
5
+ //# sourceMappingURL=i3s-content-nodejs-worker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i3s-content-nodejs-worker.js","names":["createLoaderWorker","I3SContentLoader"],"sources":["../../../src/workers/i3s-content-nodejs-worker.ts"],"sourcesContent":["import {createLoaderWorker} from '@loaders.gl/loader-utils';\nimport '@loaders.gl/polyfills';\nimport {I3SContentLoader} from '../i3s-content-loader';\n\ncreateLoaderWorker(I3SContentLoader);\n"],"mappings":"AAAA,SAAQA,kBAAkB,QAAO,0BAA0B;AAC3D,OAAO,uBAAuB;AAC9B,SAAQC,gBAAgB,QAAO,uBAAuB;AAEtDD,kBAAkB,CAACC,gBAAgB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { createLoaderWorker } from '@loaders.gl/loader-utils';
2
+ import { I3SContentLoader } from '../i3s-content-loader';
3
+ createLoaderWorker(I3SContentLoader);
4
+ //# sourceMappingURL=i3s-content-worker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i3s-content-worker.js","names":["createLoaderWorker","I3SContentLoader"],"sources":["../../../src/workers/i3s-content-worker.ts"],"sourcesContent":["import {createLoaderWorker} from '@loaders.gl/loader-utils';\nimport {I3SContentLoader} from '../i3s-content-loader';\n\ncreateLoaderWorker(I3SContentLoader);\n"],"mappings":"AAAA,SAAQA,kBAAkB,QAAO,0BAA0B;AAC3D,SAAQC,gBAAgB,QAAO,uBAAuB;AAEtDD,kBAAkB,CAACC,gBAAgB,CAAC"}
@@ -1,8 +1,9 @@
1
- import type { LoaderWithParser } from '@loaders.gl/loader-utils';
1
+ import type { LoaderOptions, LoaderWithParser } from '@loaders.gl/loader-utils';
2
+ import type { I3STileAttributes } from './lib/parsers/parse-i3s-attribute';
2
3
  /**
3
4
  * Loader for I3S attributes
4
5
  */
5
- export declare const I3SAttributeLoader: LoaderWithParser;
6
+ export declare const I3SAttributeLoader: LoaderWithParser<I3STileAttributes, never, LoaderOptions>;
6
7
  /**
7
8
  * Load attributes based on feature id
8
9
  * @param {Object} tile
@@ -11,4 +12,10 @@ export declare const I3SAttributeLoader: LoaderWithParser;
11
12
  * @returns {Promise}
12
13
  */
13
14
  export declare function loadFeatureAttributes(tile: any, featureId: any, options?: {}): Promise<{} | null>;
15
+ /**
16
+ * Get attribute value type based on property names
17
+ * @param {Object} attribute
18
+ * @returns {String}
19
+ */
20
+ export declare function getAttributeValueType(attribute: any): any;
14
21
  //# sourceMappingURL=i3s-attribute-loader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"i3s-attribute-loader.d.ts","sourceRoot":"","sources":["../src/i3s-attribute-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAU/D;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,gBAUhC,CAAC;AAOF;;;;;;GAMG;AAEH,wBAAsB,qBAAqB,CAAC,IAAI,KAAA,EAAE,SAAS,KAAA,EAAE,OAAO,KAAK,sBA+BxE"}
1
+ {"version":3,"file":"i3s-attribute-loader.d.ts","sourceRoot":"","sources":["../src/i3s-attribute-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAE,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAE9E,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,mCAAmC,CAAC;AAUzE;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,gBAAgB,CAAC,iBAAiB,EAAE,KAAK,EAAE,aAAa,CAUxF,CAAC;AAKF;;;;;;GAMG;AAEH,wBAAsB,qBAAqB,CAAC,IAAI,KAAA,EAAE,SAAS,KAAA,EAAE,OAAO,KAAK,sBA+BxE;AAeD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,KAAA,OAO9C"}
@@ -1,152 +1,175 @@
1
- import { load } from '@loaders.gl/core';
2
- import { parseI3STileAttribute } from './lib/parsers/parse-i3s-attribute';
3
- import { getUrlWithToken } from './lib/utils/url-utils';
4
- const VERSION = typeof "4.0.0-alpha.5" !== 'undefined' ? "4.0.0-alpha.5" : 'latest';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAttributeValueType = exports.loadFeatureAttributes = exports.I3SAttributeLoader = void 0;
4
+ const core_1 = require("@loaders.gl/core");
5
+ const parse_i3s_attribute_1 = require("./lib/parsers/parse-i3s-attribute");
6
+ const url_utils_1 = require("./lib/utils/url-utils");
7
+ // __VERSION__ is injected by babel-plugin-version-inline
8
+ // @ts-ignore TS2304: Cannot find name '__VERSION__'.
9
+ const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
5
10
  const EMPTY_VALUE = '';
6
11
  const REJECTED_STATUS = 'rejected';
7
- export const I3SAttributeLoader = {
8
- name: 'I3S Attribute',
9
- id: 'i3s-attribute',
10
- module: 'i3s',
11
- version: VERSION,
12
- mimeTypes: ['application/binary'],
13
- parse,
14
- extensions: ['bin'],
15
- options: {},
16
- binary: true
12
+ /**
13
+ * Loader for I3S attributes
14
+ */
15
+ exports.I3SAttributeLoader = {
16
+ name: 'I3S Attribute',
17
+ id: 'i3s-attribute',
18
+ module: 'i3s',
19
+ version: VERSION,
20
+ mimeTypes: ['application/binary'],
21
+ parse: async (arrayBuffer, options) => (0, parse_i3s_attribute_1.parseI3STileAttribute)(arrayBuffer, options),
22
+ extensions: ['bin'],
23
+ options: {},
24
+ binary: true
17
25
  };
18
-
19
- async function parse(data, options) {
20
- data = parseI3STileAttribute(data, options);
21
- return data;
26
+ // TODO - these seem to use the loader rather than being part of the loader. Move to different file...
27
+ /**
28
+ * Load attributes based on feature id
29
+ * @param {Object} tile
30
+ * @param {number} featureId
31
+ * @param {Object} options
32
+ * @returns {Promise}
33
+ */
34
+ // eslint-disable-next-line complexity
35
+ async function loadFeatureAttributes(tile, featureId, options = {}) {
36
+ const { attributeStorageInfo, attributeUrls, tilesetFields } = getAttributesData(tile);
37
+ if (!attributeStorageInfo || !attributeUrls || featureId < 0) {
38
+ return null;
39
+ }
40
+ let attributes = [];
41
+ const attributeLoadPromises = [];
42
+ for (let index = 0; index < attributeStorageInfo.length; index++) {
43
+ // @ts-ignore
44
+ const url = (0, url_utils_1.getUrlWithToken)(attributeUrls[index], options.i3s?.token);
45
+ const attributeName = attributeStorageInfo[index].name;
46
+ const attributeType = getAttributeValueType(attributeStorageInfo[index]);
47
+ const loadOptions = { ...options, attributeName, attributeType };
48
+ const promise = (0, core_1.load)(url, exports.I3SAttributeLoader, loadOptions);
49
+ attributeLoadPromises.push(promise);
50
+ }
51
+ try {
52
+ attributes = await Promise.allSettled(attributeLoadPromises);
53
+ }
54
+ catch (error) {
55
+ // do nothing
56
+ }
57
+ if (!attributes.length) {
58
+ return null;
59
+ }
60
+ return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);
22
61
  }
23
-
24
- export async function loadFeatureAttributes(tile, featureId, options = {}) {
25
- const {
26
- attributeStorageInfo,
27
- attributeUrls,
28
- tilesetFields
29
- } = getAttributesData(tile);
30
-
31
- if (!attributeStorageInfo || !attributeUrls || !featureId) {
32
- return null;
33
- }
34
-
35
- let attributes = [];
36
- const attributeLoadPromises = [];
37
-
38
- for (let index = 0; index < attributeStorageInfo.length; index++) {
39
- var _options$i3s;
40
-
41
- const url = getUrlWithToken(attributeUrls[index], (_options$i3s = options.i3s) === null || _options$i3s === void 0 ? void 0 : _options$i3s.token);
42
- const attributeName = attributeStorageInfo[index].name;
43
- const attributeType = getAttributeValueType(attributeStorageInfo[index]);
44
- const loadOptions = { ...options,
45
- attributeName,
46
- attributeType
47
- };
48
- const promise = load(url, I3SAttributeLoader, loadOptions);
49
- attributeLoadPromises.push(promise);
50
- }
51
-
52
- try {
53
- attributes = await Promise.allSettled(attributeLoadPromises);
54
- } catch (error) {}
55
-
56
- if (!attributes.length) {
57
- return null;
58
- }
59
-
60
- return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);
61
- }
62
-
62
+ exports.loadFeatureAttributes = loadFeatureAttributes;
63
+ /**
64
+ * Gets attributes data from tile.
65
+ * @param tile
66
+ * @returns
67
+ */
63
68
  function getAttributesData(tile) {
64
- var _tile$tileset, _tile$tileset$tileset, _tile$header, _tile$tileset2, _tile$tileset2$tilese;
65
-
66
- const 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;
67
- const attributeUrls = (_tile$header = tile.header) === null || _tile$header === void 0 ? void 0 : _tile$header.attributeUrls;
68
- const 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) || [];
69
- return {
70
- attributeStorageInfo,
71
- attributeUrls,
72
- tilesetFields
73
- };
69
+ const attributeStorageInfo = tile.tileset?.tileset?.attributeStorageInfo;
70
+ const attributeUrls = tile.header?.attributeUrls;
71
+ const tilesetFields = tile.tileset?.tileset?.fields || [];
72
+ return { attributeStorageInfo, attributeUrls, tilesetFields };
74
73
  }
75
-
74
+ /**
75
+ * Get attribute value type based on property names
76
+ * @param {Object} attribute
77
+ * @returns {String}
78
+ */
76
79
  function getAttributeValueType(attribute) {
77
- if (attribute.hasOwnProperty('objectIds')) {
78
- return 'Oid32';
79
- } else if (attribute.hasOwnProperty('attributeValues')) {
80
- return attribute.attributeValues.valueType;
81
- }
82
-
83
- return '';
80
+ if (attribute.hasOwnProperty('objectIds')) {
81
+ return 'Oid32';
82
+ }
83
+ else if (attribute.hasOwnProperty('attributeValues')) {
84
+ return attribute.attributeValues.valueType;
85
+ }
86
+ return '';
84
87
  }
85
-
88
+ exports.getAttributeValueType = getAttributeValueType;
89
+ /**
90
+ * Find in attributeStorageInfo attribute name responsible for feature ids list.
91
+ * @param attributeStorageInfo
92
+ * @returns Feature ids attribute name
93
+ */
86
94
  function getFeatureIdsAttributeName(attributeStorageInfo) {
87
- const objectIdsAttribute = attributeStorageInfo.find(attribute => attribute.name.includes('OBJECTID'));
88
- return objectIdsAttribute === null || objectIdsAttribute === void 0 ? void 0 : objectIdsAttribute.name;
95
+ const objectIdsAttribute = attributeStorageInfo.find(attribute => attribute.name.includes('OBJECTID'));
96
+ return objectIdsAttribute?.name;
89
97
  }
90
-
98
+ /**
99
+ * Generates mapping featureId to feature attributes
100
+ * @param {Array} attributes
101
+ * @param {Object} attributeStorageInfo
102
+ * @param {number} featureId
103
+ * @returns {Object}
104
+ */
91
105
  function generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields) {
92
- const objectIdsAttributeName = getFeatureIdsAttributeName(attributeStorageInfo);
93
- const objectIds = attributes.find(attribute => attribute.value[objectIdsAttributeName]);
94
-
95
- if (!objectIds) {
96
- return null;
97
- }
98
-
99
- const attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);
100
-
101
- if (attributeIndex < 0) {
102
- return null;
103
- }
104
-
105
- return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);
106
+ const objectIdsAttributeName = getFeatureIdsAttributeName(attributeStorageInfo);
107
+ const objectIds = attributes.find((attribute) => attribute.value[objectIdsAttributeName]);
108
+ if (!objectIds) {
109
+ return null;
110
+ }
111
+ const attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);
112
+ if (attributeIndex < 0) {
113
+ return null;
114
+ }
115
+ return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);
106
116
  }
107
-
117
+ /**
118
+ * Generates attribute object for feature mapping by feature id
119
+ * @param {Array} attributes
120
+ * @param {Number} featureIdIndex
121
+ * @param {Object} attributeStorageInfo
122
+ * @returns {Object}
123
+ */
108
124
  function getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo, tilesetFields) {
109
- const attributesObject = {};
110
-
111
- for (let index = 0; index < attributeStorageInfo.length; index++) {
112
- const attributeName = attributeStorageInfo[index].name;
113
- const codedValues = getAttributeCodedValues(attributeName, tilesetFields);
114
- const attribute = getAttributeByIndexAndAttributeName(attributes, index, attributeName);
115
- attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex, codedValues);
116
- }
117
-
118
- return attributesObject;
125
+ const attributesObject = {};
126
+ for (let index = 0; index < attributeStorageInfo.length; index++) {
127
+ const attributeName = attributeStorageInfo[index].name;
128
+ const codedValues = getAttributeCodedValues(attributeName, tilesetFields);
129
+ const attribute = getAttributeByIndexAndAttributeName(attributes, index, attributeName);
130
+ attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex, codedValues);
131
+ }
132
+ return attributesObject;
119
133
  }
120
-
134
+ /**
135
+ * Get coded values list from tileset.
136
+ * @param attributeName
137
+ * @param tilesetFields
138
+ */
121
139
  function getAttributeCodedValues(attributeName, tilesetFields) {
122
- var _attributeField$domai;
123
-
124
- const attributeField = tilesetFields.find(field => field.name === attributeName || field.alias === attributeName);
125
- return (attributeField === null || attributeField === void 0 ? void 0 : (_attributeField$domai = attributeField.domain) === null || _attributeField$domai === void 0 ? void 0 : _attributeField$domai.codedValues) || [];
140
+ const attributeField = tilesetFields
141
+ .find(field => field.name === attributeName || field.alias === attributeName);
142
+ return attributeField?.domain?.codedValues || [];
126
143
  }
127
-
144
+ /**
145
+ * Return attribute value if it presents in atrributes list
146
+ * @param {array} attributes
147
+ * @param {number} index
148
+ * @param {string} attributesName
149
+ */
128
150
  function getAttributeByIndexAndAttributeName(attributes, index, attributesName) {
129
- const attributeObject = attributes[index];
130
-
131
- if (attributeObject.status === REJECTED_STATUS) {
132
- return null;
133
- }
134
-
135
- return attributeObject.value[attributesName];
151
+ const attributeObject = attributes[index];
152
+ if (attributeObject.status === REJECTED_STATUS) {
153
+ return null;
154
+ }
155
+ return attributeObject.value[attributesName];
136
156
  }
137
-
157
+ /**
158
+ * Do formatting of attribute values or return empty string.
159
+ * @param {Array} attribute
160
+ * @param {Number} featureIdIndex
161
+ * @returns {String}
162
+ */
138
163
  function formatAttributeValue(attribute, featureIdIndex, codedValues) {
139
- let value = EMPTY_VALUE;
140
-
141
- if (attribute && featureIdIndex in attribute) {
142
- value = String(attribute[featureIdIndex]).replace(/\u0000|NaN/g, '').trim();
143
- }
144
-
145
- if (codedValues.length) {
146
- const codeValue = codedValues.find(codedValue => codedValue.code === Number(value));
147
- value = (codeValue === null || codeValue === void 0 ? void 0 : codeValue.name) || EMPTY_VALUE;
148
- }
149
-
150
- return value;
164
+ let value = EMPTY_VALUE;
165
+ if (attribute && (featureIdIndex in attribute)) {
166
+ // eslint-disable-next-line no-control-regex
167
+ value = String(attribute[featureIdIndex]).replace(/\u0000|NaN/g, '').trim();
168
+ }
169
+ // Check if coded values are existed. If so we use them.
170
+ if (codedValues.length) {
171
+ const codeValue = codedValues.find(codedValue => codedValue.code === Number(value));
172
+ value = codeValue?.name || EMPTY_VALUE;
173
+ }
174
+ return value;
151
175
  }
152
- //# sourceMappingURL=i3s-attribute-loader.js.map