@loaders.gl/i3s 3.1.0-alpha.4 → 3.1.0-beta.5

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 (125) hide show
  1. package/dist/bundle.d.ts +2 -0
  2. package/dist/bundle.d.ts.map +1 -0
  3. package/dist/bundle.js +10364 -0
  4. package/dist/es5/bundle.js +1 -1
  5. package/dist/es5/bundle.js.map +1 -1
  6. package/dist/es5/i3s-attribute-loader.js +89 -138
  7. package/dist/es5/i3s-attribute-loader.js.map +1 -1
  8. package/dist/es5/i3s-building-scene-layer-loader.js +8 -36
  9. package/dist/es5/i3s-building-scene-layer-loader.js.map +1 -1
  10. package/dist/es5/i3s-content-loader.js +10 -36
  11. package/dist/es5/i3s-content-loader.js.map +1 -1
  12. package/dist/es5/i3s-loader.js +56 -176
  13. package/dist/es5/i3s-loader.js.map +1 -1
  14. package/dist/es5/i3s-node-page-loader.js +8 -51
  15. package/dist/es5/i3s-node-page-loader.js.map +1 -1
  16. package/dist/es5/index.js +13 -5
  17. package/dist/es5/index.js.map +1 -1
  18. package/dist/es5/lib/helpers/i3s-nodepages-tiles.js +172 -325
  19. package/dist/es5/lib/helpers/i3s-nodepages-tiles.js.map +1 -1
  20. package/dist/es5/lib/parsers/constants.js +71 -25
  21. package/dist/es5/lib/parsers/constants.js.map +1 -1
  22. package/dist/es5/lib/parsers/parse-i3s-attribute.js +34 -68
  23. package/dist/es5/lib/parsers/parse-i3s-attribute.js.map +1 -1
  24. package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js +28 -59
  25. package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -1
  26. package/dist/es5/lib/parsers/parse-i3s-tile-content.js +314 -415
  27. package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -1
  28. package/dist/es5/lib/parsers/parse-i3s.js +31 -70
  29. package/dist/es5/lib/parsers/parse-i3s.js.map +1 -1
  30. package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js +4 -8
  31. package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -1
  32. package/dist/es5/lib/utils/url-utils.js +17 -14
  33. package/dist/es5/lib/utils/url-utils.js.map +1 -1
  34. package/dist/es5/types.js +19 -0
  35. package/dist/es5/types.js.map +1 -1
  36. package/dist/esm/i3s-attribute-loader.js +44 -14
  37. package/dist/esm/i3s-attribute-loader.js.map +1 -1
  38. package/dist/esm/i3s-building-scene-layer-loader.js +1 -1
  39. package/dist/esm/i3s-building-scene-layer-loader.js.map +1 -1
  40. package/dist/esm/i3s-content-loader.js +1 -1
  41. package/dist/esm/i3s-content-loader.js.map +1 -1
  42. package/dist/esm/i3s-loader.js +5 -2
  43. package/dist/esm/i3s-loader.js.map +1 -1
  44. package/dist/esm/i3s-node-page-loader.js +1 -1
  45. package/dist/esm/i3s-node-page-loader.js.map +1 -1
  46. package/dist/esm/index.js +1 -0
  47. package/dist/esm/index.js.map +1 -1
  48. package/dist/esm/lib/helpers/i3s-nodepages-tiles.js +3 -3
  49. package/dist/esm/lib/helpers/i3s-nodepages-tiles.js.map +1 -1
  50. package/dist/esm/lib/parsers/constants.js +55 -15
  51. package/dist/esm/lib/parsers/constants.js.map +1 -1
  52. package/dist/esm/lib/parsers/parse-i3s-attribute.js +9 -1
  53. package/dist/esm/lib/parsers/parse-i3s-attribute.js.map +1 -1
  54. package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js +3 -1
  55. package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -1
  56. package/dist/esm/lib/parsers/parse-i3s-tile-content.js +87 -61
  57. package/dist/esm/lib/parsers/parse-i3s-tile-content.js.map +1 -1
  58. package/dist/esm/lib/parsers/parse-i3s.js +4 -4
  59. package/dist/esm/lib/parsers/parse-i3s.js.map +1 -1
  60. package/dist/esm/lib/utils/url-utils.js +3 -3
  61. package/dist/esm/lib/utils/url-utils.js.map +1 -1
  62. package/dist/esm/types.js +13 -1
  63. package/dist/esm/types.js.map +1 -1
  64. package/dist/i3s-attribute-loader.d.ts +14 -0
  65. package/dist/i3s-attribute-loader.d.ts.map +1 -0
  66. package/dist/i3s-attribute-loader.js +177 -0
  67. package/dist/i3s-building-scene-layer-loader.d.ts +6 -0
  68. package/dist/i3s-building-scene-layer-loader.d.ts.map +1 -0
  69. package/dist/i3s-building-scene-layer-loader.js +26 -0
  70. package/dist/i3s-content-loader.d.ts +6 -0
  71. package/dist/i3s-content-loader.d.ts.map +1 -0
  72. package/dist/i3s-content-loader.js +28 -0
  73. package/dist/i3s-content-worker.js +7657 -2
  74. package/dist/i3s-loader.d.ts +6 -0
  75. package/dist/i3s-loader.d.ts.map +1 -0
  76. package/dist/i3s-loader.js +100 -0
  77. package/dist/i3s-node-page-loader.d.ts +6 -0
  78. package/dist/i3s-node-page-loader.d.ts.map +1 -0
  79. package/dist/i3s-node-page-loader.js +26 -0
  80. package/dist/index.d.ts +7 -0
  81. package/dist/index.d.ts.map +1 -0
  82. package/dist/index.js +14 -0
  83. package/dist/lib/helpers/i3s-nodepages-tiles.d.ts +73 -0
  84. package/dist/lib/helpers/i3s-nodepages-tiles.d.ts.map +1 -0
  85. package/dist/lib/helpers/i3s-nodepages-tiles.js +231 -0
  86. package/dist/lib/parsers/constants.d.ts +56 -0
  87. package/dist/lib/parsers/constants.d.ts.map +1 -0
  88. package/dist/lib/parsers/constants.js +107 -0
  89. package/dist/lib/parsers/parse-i3s-attribute.d.ts +10 -0
  90. package/dist/lib/parsers/parse-i3s-attribute.d.ts.map +1 -0
  91. package/dist/lib/parsers/parse-i3s-attribute.js +98 -0
  92. package/dist/lib/parsers/parse-i3s-building-scene-layer.d.ts +9 -0
  93. package/dist/lib/parsers/parse-i3s-building-scene-layer.d.ts.map +1 -0
  94. package/dist/lib/parsers/parse-i3s-building-scene-layer.js +46 -0
  95. package/dist/lib/parsers/parse-i3s-tile-content.d.ts +4 -0
  96. package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -0
  97. package/dist/lib/parsers/parse-i3s-tile-content.js +508 -0
  98. package/dist/lib/parsers/parse-i3s.d.ts +4 -0
  99. package/dist/lib/parsers/parse-i3s.d.ts.map +1 -0
  100. package/dist/lib/parsers/parse-i3s.js +84 -0
  101. package/dist/lib/utils/convert-i3s-obb-to-mbs.d.ts +2 -0
  102. package/dist/lib/utils/convert-i3s-obb-to-mbs.d.ts.map +1 -0
  103. package/dist/lib/utils/convert-i3s-obb-to-mbs.js +20 -0
  104. package/dist/lib/utils/url-utils.d.ts +22 -0
  105. package/dist/lib/utils/url-utils.d.ts.map +1 -0
  106. package/dist/lib/utils/url-utils.js +44 -0
  107. package/dist/types.d.ts +429 -0
  108. package/dist/types.d.ts.map +1 -0
  109. package/dist/types.js +15 -0
  110. package/dist/workers/i3s-content-worker.d.ts +2 -0
  111. package/dist/workers/i3s-content-worker.d.ts.map +1 -0
  112. package/dist/workers/i3s-content-worker.js +5 -0
  113. package/package.json +14 -12
  114. package/src/i3s-attribute-loader.ts +56 -19
  115. package/src/i3s-loader.ts +4 -1
  116. package/src/index.ts +1 -0
  117. package/src/lib/parsers/constants.ts +73 -18
  118. package/src/lib/parsers/parse-i3s-attribute.ts +19 -1
  119. package/src/lib/parsers/parse-i3s-building-scene-layer.ts +2 -1
  120. package/src/lib/parsers/parse-i3s-tile-content.ts +159 -109
  121. package/src/lib/utils/url-utils.ts +1 -1
  122. package/src/types.ts +153 -22
  123. package/dist/dist.min.js +0 -2
  124. package/dist/dist.min.js.map +0 -1
  125. package/dist/i3s-content-worker.js.map +0 -1
@@ -1,20 +1,10 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.parseI3STileContent = parseI3STileContent;
9
7
 
10
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
-
12
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
-
14
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
-
16
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
17
-
18
8
  var _core = require("@loaders.gl/core");
19
9
 
20
10
  var _core2 = require("@math.gl/core");
@@ -31,271 +21,183 @@ var _urlUtils = require("../utils/url-utils");
31
21
 
32
22
  var _constants = require("./constants");
33
23
 
34
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
24
+ const scratchVector = new _core2.Vector3([0, 0, 0]);
35
25
 
36
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
26
+ function getLoaderForTextureFormat(textureFormat) {
27
+ switch (textureFormat) {
28
+ case 'jpeg':
29
+ case 'png':
30
+ return _images.ImageLoader;
37
31
 
38
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
32
+ case 'ktx-etc2':
33
+ case 'dds':
34
+ return _textures.CompressedTextureLoader;
39
35
 
40
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
36
+ case 'ktx2':
37
+ return _textures.BasisLoader;
41
38
 
42
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
39
+ default:
40
+ return null;
41
+ }
42
+ }
43
43
 
44
- var scratchVector = new _core2.Vector3([0, 0, 0]);
45
- var FORMAT_LOADER_MAP = {
46
- jpeg: _images.ImageLoader,
47
- png: _images.ImageLoader,
48
- 'ktx-etc2': _textures.CompressedTextureLoader,
49
- dds: _textures.CompressedTextureLoader,
50
- ktx2: _textures.BasisLoader
51
- };
52
- var I3S_ATTRIBUTE_TYPE = 'i3s-attribute-type';
44
+ const I3S_ATTRIBUTE_TYPE = 'i3s-attribute-type';
53
45
 
54
- function parseI3STileContent(_x, _x2, _x3, _x4, _x5) {
55
- return _parseI3STileContent.apply(this, arguments);
56
- }
46
+ async function parseI3STileContent(arrayBuffer, tile, tileset, options, context) {
47
+ tile.content = tile.content || {};
48
+ tile.content.featureIds = tile.content.featureIds || null;
49
+ tile.content.featureData = constructFeatureDataStruct(tileset);
50
+ tile.content.attributes = {};
51
+
52
+ if (tile.textureUrl) {
53
+ var _options$i3s;
54
+
55
+ const url = (0, _urlUtils.getUrlWithToken)(tile.textureUrl, options === null || options === void 0 ? void 0 : (_options$i3s = options.i3s) === null || _options$i3s === void 0 ? void 0 : _options$i3s.token);
57
56
 
58
- function _parseI3STileContent() {
59
- _parseI3STileContent = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer, tile, tileset, options, context) {
60
- var _options$i3s, url, loader, response, _arrayBuffer, _options, texture;
61
-
62
- return _regenerator.default.wrap(function _callee$(_context) {
63
- while (1) {
64
- switch (_context.prev = _context.next) {
65
- case 0:
66
- tile.content = tile.content || {};
67
- tile.content.featureIds = tile.content.featureIds || null;
68
- tile.content.featureData = constructFeatureDataStruct(tile, tileset);
69
- tile.content.attributes = {};
70
-
71
- if (!tile.textureUrl) {
72
- _context.next = 25;
73
- break;
74
- }
75
-
76
- url = (0, _urlUtils.getUrlWithToken)(tile.textureUrl, options === null || options === void 0 ? void 0 : (_options$i3s = options.i3s) === null || _options$i3s === void 0 ? void 0 : _options$i3s.token);
77
- loader = FORMAT_LOADER_MAP[tile.textureFormat] || _images.ImageLoader;
78
- _context.next = 9;
79
- return fetch(url);
80
-
81
- case 9:
82
- response = _context.sent;
83
- _context.next = 12;
84
- return response.arrayBuffer();
85
-
86
- case 12:
87
- _arrayBuffer = _context.sent;
88
-
89
- if (!(loader === _images.ImageLoader)) {
90
- _context.next = 20;
91
- break;
92
- }
93
-
94
- _options = _objectSpread(_objectSpread({}, tile.textureLoaderOptions), {}, {
95
- image: {
96
- type: 'data'
97
- }
98
- });
99
- _context.next = 17;
100
- return context.parse(_arrayBuffer, _options);
101
-
102
- case 17:
103
- tile.content.texture = _context.sent;
104
- _context.next = 25;
105
- break;
106
-
107
- case 20:
108
- if (!(loader === _textures.CompressedTextureLoader || loader === _textures.BasisLoader)) {
109
- _context.next = 25;
110
- break;
111
- }
112
-
113
- _context.next = 23;
114
- return (0, _core.load)(_arrayBuffer, loader, tile.textureLoaderOptions);
115
-
116
- case 23:
117
- texture = _context.sent;
118
- tile.content.texture = {
119
- compressed: true,
120
- mipmaps: false,
121
- width: texture[0].width,
122
- height: texture[0].height,
123
- data: texture
124
- };
125
-
126
- case 25:
127
- tile.content.material = makePbrMaterial(tile.materialDefinition, tile.content.texture);
128
-
129
- if (tile.content.material) {
130
- tile.content.texture = null;
131
- }
132
-
133
- _context.next = 29;
134
- return parseI3SNodeGeometry(arrayBuffer, tile, context);
135
-
136
- case 29:
137
- return _context.abrupt("return", _context.sent);
138
-
139
- case 30:
140
- case "end":
141
- return _context.stop();
57
+ const loader = getLoaderForTextureFormat(tile.textureFormat) || _images.ImageLoader;
58
+
59
+ const response = await fetch(url);
60
+ const arrayBuffer = await response.arrayBuffer();
61
+
62
+ if (options !== null && options !== void 0 && options.i3s.decodeTextures) {
63
+ if (loader === _images.ImageLoader) {
64
+ const options = { ...tile.textureLoaderOptions,
65
+ image: {
66
+ type: 'data'
67
+ }
68
+ };
69
+
70
+ try {
71
+ tile.content.texture = await context.parse(arrayBuffer, options);
72
+ } catch (e) {
73
+ tile.content.texture = await (0, _core.parse)(arrayBuffer, loader, options);
142
74
  }
75
+ } else if (loader === _textures.CompressedTextureLoader || loader === _textures.BasisLoader) {
76
+ const texture = await (0, _core.load)(arrayBuffer, loader, tile.textureLoaderOptions);
77
+ tile.content.texture = {
78
+ compressed: true,
79
+ mipmaps: false,
80
+ width: texture[0].width,
81
+ height: texture[0].height,
82
+ data: texture
83
+ };
143
84
  }
144
- }, _callee);
145
- }));
146
- return _parseI3STileContent.apply(this, arguments);
147
- }
85
+ } else {
86
+ tile.content.texture = arrayBuffer;
87
+ }
88
+ }
89
+
90
+ tile.content.material = makePbrMaterial(tile.materialDefinition, tile.content.texture);
148
91
 
149
- function parseI3SNodeGeometry(_x6) {
150
- return _parseI3SNodeGeometry.apply(this, arguments);
92
+ if (tile.content.material) {
93
+ tile.content.texture = null;
94
+ }
95
+
96
+ return await parseI3SNodeGeometry(arrayBuffer, tile, options);
151
97
  }
152
98
 
153
- function _parseI3SNodeGeometry() {
154
- _parseI3SNodeGeometry = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(arrayBuffer) {
155
- var tile,
156
- context,
157
- content,
158
- attributes,
159
- vertexCount,
160
- byteOffset,
161
- featureCount,
162
- decompressedGeometry,
163
- indices,
164
- _decompressedGeometry,
165
- POSITION,
166
- NORMAL,
167
- COLOR_0,
168
- TEXCOORD_0,
169
- featureIndex,
170
- uvRegion,
171
- featureIds,
172
- _content$featureData,
173
- vertexAttributes,
174
- attributesOrder,
175
- featureAttributes,
176
- featureAttributeOrder,
177
- headers,
178
- _normalizeAttributes,
179
- normalizedVertexAttributes,
180
- offset,
181
- _normalizeAttributes2,
182
- normalizedFeatureAttributes,
183
- _parsePositions,
184
- enuMatrix,
185
- cartographicOrigin,
186
- cartesianOrigin,
187
- matrix,
188
- attributeIndex,
189
- _args2 = arguments;
190
-
191
- return _regenerator.default.wrap(function _callee2$(_context2) {
192
- while (1) {
193
- switch (_context2.prev = _context2.next) {
194
- case 0:
195
- tile = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
196
- context = _args2.length > 2 ? _args2[2] : undefined;
197
-
198
- if (tile.content) {
199
- _context2.next = 4;
200
- break;
201
- }
202
-
203
- return _context2.abrupt("return", tile);
204
-
205
- case 4:
206
- content = tile.content;
207
- byteOffset = 0;
208
- featureCount = 0;
209
-
210
- if (!tile.isDracoGeometry) {
211
- _context2.next = 20;
212
- break;
213
- }
214
-
215
- _context2.next = 10;
216
- return (0, _core.parse)(arrayBuffer, _draco.DracoLoader, {
217
- draco: {
218
- attributeNameEntry: I3S_ATTRIBUTE_TYPE
219
- }
220
- });
221
-
222
- case 10:
223
- decompressedGeometry = _context2.sent;
224
- vertexCount = decompressedGeometry.header.vertexCount;
225
- indices = decompressedGeometry.indices.value;
226
- _decompressedGeometry = decompressedGeometry.attributes, POSITION = _decompressedGeometry.POSITION, NORMAL = _decompressedGeometry.NORMAL, COLOR_0 = _decompressedGeometry.COLOR_0, TEXCOORD_0 = _decompressedGeometry.TEXCOORD_0, featureIndex = _decompressedGeometry['feature-index'], uvRegion = _decompressedGeometry['uv-region'];
227
- attributes = {
228
- position: POSITION,
229
- normal: NORMAL,
230
- color: COLOR_0,
231
- uv0: TEXCOORD_0,
232
- uvRegion: uvRegion,
233
- id: featureIndex,
234
- indices: indices
235
- };
236
- updateAttributesMetadata(attributes, decompressedGeometry);
237
- featureIds = getFeatureIdsFromFeatureIndexMetadata(featureIndex);
238
-
239
- if (featureIds) {
240
- flattenFeatureIdsByFeatureIndices(attributes, featureIds);
241
- }
242
-
243
- _context2.next = 29;
244
- break;
245
-
246
- case 20:
247
- _content$featureData = content.featureData, vertexAttributes = _content$featureData.vertexAttributes, attributesOrder = _content$featureData.attributesOrder, featureAttributes = _content$featureData.featureAttributes, featureAttributeOrder = _content$featureData.featureAttributeOrder;
248
- headers = parseHeaders(content, arrayBuffer);
249
- byteOffset = headers.byteOffset;
250
- vertexCount = headers.vertexCount;
251
- featureCount = headers.featureCount;
252
- _normalizeAttributes = normalizeAttributes(arrayBuffer, byteOffset, vertexAttributes, vertexCount, attributesOrder), normalizedVertexAttributes = _normalizeAttributes.attributes, offset = _normalizeAttributes.byteOffset;
253
- _normalizeAttributes2 = normalizeAttributes(arrayBuffer, offset, featureAttributes, featureCount, featureAttributeOrder), normalizedFeatureAttributes = _normalizeAttributes2.attributes;
254
- flattenFeatureIdsByFaceRanges(normalizedFeatureAttributes);
255
- attributes = concatAttributes(normalizedVertexAttributes, normalizedFeatureAttributes);
256
-
257
- case 29:
258
- _parsePositions = parsePositions(attributes.position, tile), enuMatrix = _parsePositions.enuMatrix, cartographicOrigin = _parsePositions.cartographicOrigin, cartesianOrigin = _parsePositions.cartesianOrigin;
259
- matrix = new _core2.Matrix4().multiplyRight(enuMatrix);
260
- content.attributes = {
261
- positions: attributes.position,
262
- normals: attributes.normal,
263
- colors: normalizeAttribute(attributes.color),
264
- texCoords: attributes.uv0,
265
- uvRegions: normalizeAttribute(attributes.uvRegion)
266
- };
267
- content.indices = attributes.indices || null;
268
-
269
- if (attributes.id && attributes.id.value) {
270
- tile.content.featureIds = attributes.id.value;
271
- }
272
-
273
- for (attributeIndex in content.attributes) {
274
- if (!content.attributes[attributeIndex]) {
275
- delete content.attributes[attributeIndex];
276
- }
277
- }
278
-
279
- content.vertexCount = vertexCount;
280
- content.cartographicCenter = cartographicOrigin;
281
- content.cartesianOrigin = cartesianOrigin;
282
- content.modelMatrix = matrix.invert();
283
- content.byteLength = arrayBuffer.byteLength;
284
- return _context2.abrupt("return", tile);
285
-
286
- case 41:
287
- case "end":
288
- return _context2.stop();
289
- }
99
+ async function parseI3SNodeGeometry(arrayBuffer, tile, options) {
100
+ var _options$i3s2;
101
+
102
+ if (!tile.content) {
103
+ return tile;
104
+ }
105
+
106
+ const content = tile.content;
107
+ let attributes;
108
+ let vertexCount;
109
+ let byteOffset = 0;
110
+ let featureCount = 0;
111
+
112
+ if (tile.isDracoGeometry) {
113
+ const decompressedGeometry = await (0, _core.parse)(arrayBuffer, _draco.DracoLoader, {
114
+ draco: {
115
+ attributeNameEntry: I3S_ATTRIBUTE_TYPE
290
116
  }
291
- }, _callee2);
292
- }));
293
- return _parseI3SNodeGeometry.apply(this, arguments);
117
+ });
118
+ vertexCount = decompressedGeometry.header.vertexCount;
119
+ const indices = decompressedGeometry.indices.value;
120
+ const {
121
+ POSITION,
122
+ NORMAL,
123
+ COLOR_0,
124
+ TEXCOORD_0,
125
+ ['feature-index']: featureIndex,
126
+ ['uv-region']: uvRegion
127
+ } = decompressedGeometry.attributes;
128
+ attributes = {
129
+ position: POSITION,
130
+ normal: NORMAL,
131
+ color: COLOR_0,
132
+ uv0: TEXCOORD_0,
133
+ uvRegion,
134
+ id: featureIndex,
135
+ indices
136
+ };
137
+ updateAttributesMetadata(attributes, decompressedGeometry);
138
+ const featureIds = getFeatureIdsFromFeatureIndexMetadata(featureIndex);
139
+
140
+ if (featureIds) {
141
+ flattenFeatureIdsByFeatureIndices(attributes, featureIds);
142
+ }
143
+ } else {
144
+ const {
145
+ vertexAttributes,
146
+ attributesOrder,
147
+ featureAttributes,
148
+ featureAttributeOrder
149
+ } = content.featureData;
150
+ const headers = parseHeaders(content, arrayBuffer);
151
+ byteOffset = headers.byteOffset;
152
+ vertexCount = headers.vertexCount;
153
+ featureCount = headers.featureCount;
154
+ const {
155
+ attributes: normalizedVertexAttributes,
156
+ byteOffset: offset
157
+ } = normalizeAttributes(arrayBuffer, byteOffset, vertexAttributes, vertexCount, attributesOrder);
158
+ const {
159
+ attributes: normalizedFeatureAttributes
160
+ } = normalizeAttributes(arrayBuffer, offset, featureAttributes, featureCount, featureAttributeOrder);
161
+ flattenFeatureIdsByFaceRanges(normalizedFeatureAttributes);
162
+ attributes = concatAttributes(normalizedVertexAttributes, normalizedFeatureAttributes);
163
+ }
164
+
165
+ if (!(options !== null && options !== void 0 && (_options$i3s2 = options.i3s) !== null && _options$i3s2 !== void 0 && _options$i3s2.coordinateSystem) || options.i3s.coordinateSystem === _constants.COORDINATE_SYSTEM.METER_OFFSETS) {
166
+ const enuMatrix = parsePositions(attributes.position, tile);
167
+ content.modelMatrix = enuMatrix.invert();
168
+ content.coordinateSystem = _constants.COORDINATE_SYSTEM.METER_OFFSETS;
169
+ } else {
170
+ content.modelMatrix = getModelMatrix(attributes.position);
171
+ content.coordinateSystem = _constants.COORDINATE_SYSTEM.LNGLAT_OFFSETS;
172
+ }
173
+
174
+ content.attributes = {
175
+ positions: attributes.position,
176
+ normals: attributes.normal,
177
+ colors: normalizeAttribute(attributes.color),
178
+ texCoords: attributes.uv0,
179
+ uvRegions: normalizeAttribute(attributes.uvRegion)
180
+ };
181
+ content.indices = attributes.indices || null;
182
+
183
+ if (attributes.id && attributes.id.value) {
184
+ tile.content.featureIds = attributes.id.value;
185
+ }
186
+
187
+ for (const attributeIndex in content.attributes) {
188
+ if (!content.attributes[attributeIndex]) {
189
+ delete content.attributes[attributeIndex];
190
+ }
191
+ }
192
+
193
+ content.vertexCount = vertexCount;
194
+ content.byteLength = arrayBuffer.byteLength;
195
+ return tile;
294
196
  }
295
197
 
296
198
  function updateAttributesMetadata(attributes, decompressedGeometry) {
297
- for (var key in decompressedGeometry.loaderData.attributes) {
298
- var dracoAttribute = decompressedGeometry.loaderData.attributes[key];
199
+ for (const key in decompressedGeometry.loaderData.attributes) {
200
+ const dracoAttribute = decompressedGeometry.loaderData.attributes[key];
299
201
 
300
202
  switch (dracoAttribute.name) {
301
203
  case 'POSITION':
@@ -313,7 +215,9 @@ function updateAttributesMetadata(attributes, decompressedGeometry) {
313
215
  }
314
216
 
315
217
  function concatAttributes(normalizedVertexAttributes, normalizedFeatureAttributes) {
316
- return _objectSpread(_objectSpread({}, normalizedVertexAttributes), normalizedFeatureAttributes);
218
+ return { ...normalizedVertexAttributes,
219
+ ...normalizedFeatureAttributes
220
+ };
317
221
  }
318
222
 
319
223
  function normalizeAttribute(attribute) {
@@ -325,26 +229,26 @@ function normalizeAttribute(attribute) {
325
229
  return attribute;
326
230
  }
327
231
 
328
- function constructFeatureDataStruct(tile, tileset) {
329
- var defaultGeometrySchema = tileset.store.defaultGeometrySchema;
330
- var featureData = defaultGeometrySchema;
232
+ function constructFeatureDataStruct(tileset) {
233
+ const defaultGeometrySchema = tileset.store.defaultGeometrySchema;
234
+ const featureData = defaultGeometrySchema;
331
235
 
332
- for (var geometryAttribute in _constants.I3S_NAMED_GEOMETRY_ATTRIBUTES) {
333
- for (var namedAttribute in _constants.I3S_NAMED_VERTEX_ATTRIBUTES) {
334
- var attribute = defaultGeometrySchema[geometryAttribute][namedAttribute];
236
+ for (const geometryAttribute in _constants.I3S_NAMED_GEOMETRY_ATTRIBUTES) {
237
+ for (const namedAttribute in _constants.I3S_NAMED_VERTEX_ATTRIBUTES) {
238
+ const attribute = defaultGeometrySchema[geometryAttribute][namedAttribute];
335
239
 
336
240
  if (attribute) {
337
- var _attribute$byteOffset = attribute.byteOffset,
338
- byteOffset = _attribute$byteOffset === void 0 ? 0 : _attribute$byteOffset,
339
- _attribute$count = attribute.count,
340
- count = _attribute$count === void 0 ? 0 : _attribute$count,
341
- valueType = attribute.valueType,
342
- valuesPerElement = attribute.valuesPerElement;
241
+ const {
242
+ byteOffset = 0,
243
+ count = 0,
244
+ valueType,
245
+ valuesPerElement
246
+ } = attribute;
343
247
  featureData[geometryAttribute][namedAttribute] = {
344
- valueType: valueType,
345
- valuesPerElement: valuesPerElement,
346
- byteOffset: byteOffset,
347
- count: count
248
+ valueType,
249
+ valuesPerElement,
250
+ byteOffset,
251
+ count
348
252
  };
349
253
  }
350
254
  }
@@ -354,107 +258,94 @@ function constructFeatureDataStruct(tile, tileset) {
354
258
  return featureData;
355
259
  }
356
260
 
357
- function parseHeaders(content, buffer) {
358
- var byteOffset = 0;
359
- var vertexCount = 0;
360
- var featureCount = 0;
361
- var headers = content.featureData[_constants.I3S_NAMED_HEADER_ATTRIBUTES.header];
362
-
363
- for (var header in headers) {
364
- var _headers$header = headers[header],
365
- property = _headers$header.property,
366
- type = _headers$header.type;
367
- var TypedArrayTypeHeader = _constants.TYPE_ARRAY_MAP[type];
261
+ function parseHeaders(content, arrayBuffer) {
262
+ let byteOffset = 0;
263
+ let vertexCount = 0;
264
+ let featureCount = 0;
265
+ content.featureData.header.forEach(({
266
+ property,
267
+ type
268
+ }) => {
269
+ const TypedArrayTypeHeader = (0, _constants.getConstructorForDataFormat)(type);
368
270
 
369
271
  if (property === _constants.I3S_NAMED_HEADER_ATTRIBUTES.vertexCount) {
370
- vertexCount = new TypedArrayTypeHeader(buffer, 0, 4)[0];
371
- byteOffset += _constants.SIZEOF[type];
272
+ vertexCount = new TypedArrayTypeHeader(arrayBuffer, 0, 4)[0];
273
+ byteOffset += (0, _constants.sizeOf)(type);
372
274
  }
373
275
 
374
276
  if (property === _constants.I3S_NAMED_HEADER_ATTRIBUTES.featureCount) {
375
- featureCount = new TypedArrayTypeHeader(buffer, 4, 4)[0];
376
- byteOffset += _constants.SIZEOF[type];
277
+ featureCount = new TypedArrayTypeHeader(arrayBuffer, 4, 4)[0];
278
+ byteOffset += (0, _constants.sizeOf)(type);
377
279
  }
378
- }
379
-
280
+ });
380
281
  return {
381
- vertexCount: vertexCount,
382
- featureCount: featureCount,
383
- byteOffset: byteOffset
282
+ vertexCount,
283
+ featureCount,
284
+ byteOffset
384
285
  };
385
286
  }
386
287
 
387
288
  function normalizeAttributes(arrayBuffer, byteOffset, vertexAttributes, vertexCount, attributesOrder) {
388
- var attributes = {};
389
-
390
- var _iterator = _createForOfIteratorHelper(attributesOrder),
391
- _step;
392
-
393
- try {
394
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
395
- var attribute = _step.value;
289
+ const attributes = {};
396
290
 
397
- if (vertexAttributes[attribute]) {
398
- var _vertexAttributes$att = vertexAttributes[attribute],
399
- valueType = _vertexAttributes$att.valueType,
400
- valuesPerElement = _vertexAttributes$att.valuesPerElement;
401
- var count = vertexCount;
291
+ for (const attribute of attributesOrder) {
292
+ if (vertexAttributes[attribute]) {
293
+ const {
294
+ valueType,
295
+ valuesPerElement
296
+ } = vertexAttributes[attribute];
297
+ const count = vertexCount;
402
298
 
403
- if (byteOffset + count * valuesPerElement > arrayBuffer.byteLength) {
404
- break;
405
- }
406
-
407
- var buffer = arrayBuffer.slice(byteOffset);
408
- var value = [];
299
+ if (byteOffset + count * valuesPerElement > arrayBuffer.byteLength) {
300
+ break;
301
+ }
409
302
 
410
- if (valueType === 'UInt64') {
411
- value = parseUint64Values(buffer, count * valuesPerElement, _constants.SIZEOF[valueType]);
412
- } else {
413
- var TypedArrayType = _constants.TYPE_ARRAY_MAP[valueType];
414
- value = new TypedArrayType(buffer, 0, count * valuesPerElement);
415
- }
303
+ const buffer = arrayBuffer.slice(byteOffset);
304
+ let value = [];
416
305
 
417
- attributes[attribute] = {
418
- value: value,
419
- type: _constants.GL_TYPE_MAP[valueType],
420
- size: valuesPerElement
421
- };
306
+ if (valueType === 'UInt64') {
307
+ value = parseUint64Values(buffer, count * valuesPerElement, (0, _constants.sizeOf)(valueType));
308
+ } else {
309
+ const TypedArrayType = (0, _constants.getConstructorForDataFormat)(valueType);
310
+ value = new TypedArrayType(buffer, 0, count * valuesPerElement);
311
+ }
422
312
 
423
- switch (attribute) {
424
- case 'color':
425
- attributes.color.normalized = true;
426
- break;
313
+ attributes[attribute] = {
314
+ value,
315
+ type: _constants.GL_TYPE_MAP[valueType],
316
+ size: valuesPerElement
317
+ };
427
318
 
428
- case 'position':
429
- case 'region':
430
- case 'normal':
431
- default:
432
- }
319
+ switch (attribute) {
320
+ case 'color':
321
+ attributes.color.normalized = true;
322
+ break;
433
323
 
434
- byteOffset = byteOffset + count * valuesPerElement * _constants.SIZEOF[valueType];
324
+ case 'position':
325
+ case 'region':
326
+ case 'normal':
327
+ default:
435
328
  }
329
+
330
+ byteOffset = byteOffset + count * valuesPerElement * (0, _constants.sizeOf)(valueType);
436
331
  }
437
- } catch (err) {
438
- _iterator.e(err);
439
- } finally {
440
- _iterator.f();
441
332
  }
442
333
 
443
334
  return {
444
- attributes: attributes,
445
- byteOffset: byteOffset
335
+ attributes,
336
+ byteOffset
446
337
  };
447
338
  }
448
339
 
449
340
  function parseUint64Values(buffer, elementsCount, attributeSize) {
450
- var values = [];
451
- var dataView = new DataView(buffer);
452
- var offset = 0;
453
-
454
- for (var index = 0; index < elementsCount; index++) {
455
- var left = dataView.getUint32(offset, true);
456
- var right = dataView.getUint32(offset + 4, true);
457
- var value = left + Math.pow(2, 32) * right;
341
+ const values = [];
342
+ const dataView = new DataView(buffer);
343
+ let offset = 0;
344
+
345
+ for (let index = 0; index < elementsCount; index++) {
346
+ const left = dataView.getUint32(offset, true);
347
+ const right = dataView.getUint32(offset + 4, true);
348
+ const value = left + 2 ** 32 * right;
458
349
  values.push(value);
459
350
  offset += attributeSize;
460
351
  }
@@ -463,59 +354,65 @@ function parseUint64Values(buffer, elementsCount, attributeSize) {
463
354
  }
464
355
 
465
356
  function parsePositions(attribute, tile) {
466
- var mbs = tile.mbs;
467
- var value = attribute.value;
468
- var metadata = attribute.metadata;
469
- var enuMatrix = new _core2.Matrix4();
470
- var cartographicOrigin = new _core2.Vector3(mbs[0], mbs[1], mbs[2]);
471
- var cartesianOrigin = new _core2.Vector3();
357
+ const mbs = tile.mbs;
358
+ const value = attribute.value;
359
+ const metadata = attribute.metadata;
360
+ const enuMatrix = new _core2.Matrix4();
361
+ const cartographicOrigin = new _core2.Vector3(mbs[0], mbs[1], mbs[2]);
362
+ const cartesianOrigin = new _core2.Vector3();
472
363
 
473
364
  _geospatial.Ellipsoid.WGS84.cartographicToCartesian(cartographicOrigin, cartesianOrigin);
474
365
 
475
366
  _geospatial.Ellipsoid.WGS84.eastNorthUpToFixedFrame(cartesianOrigin, enuMatrix);
476
367
 
477
368
  attribute.value = offsetsToCartesians(value, metadata, cartographicOrigin);
478
- return {
479
- enuMatrix: enuMatrix,
480
- fixedFrameToENUMatrix: enuMatrix.invert(),
481
- cartographicOrigin: cartographicOrigin,
482
- cartesianOrigin: cartesianOrigin
483
- };
369
+ return enuMatrix;
484
370
  }
485
371
 
486
- function offsetsToCartesians(vertices) {
487
- var metadata = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
488
- var cartographicOrigin = arguments.length > 2 ? arguments[2] : undefined;
489
- var positions = new Float64Array(vertices.length);
490
- var scaleX = metadata['i3s-scale_x'] && metadata['i3s-scale_x'].double || 1;
491
- var scaleY = metadata['i3s-scale_y'] && metadata['i3s-scale_y'].double || 1;
372
+ function offsetsToCartesians(vertices, metadata = {}, cartographicOrigin) {
373
+ const positions = new Float64Array(vertices.length);
374
+ const scaleX = metadata['i3s-scale_x'] && metadata['i3s-scale_x'].double || 1;
375
+ const scaleY = metadata['i3s-scale_y'] && metadata['i3s-scale_y'].double || 1;
492
376
 
493
- for (var i = 0; i < positions.length; i += 3) {
377
+ for (let i = 0; i < positions.length; i += 3) {
494
378
  positions[i] = vertices[i] * scaleX + cartographicOrigin.x;
495
379
  positions[i + 1] = vertices[i + 1] * scaleY + cartographicOrigin.y;
496
380
  positions[i + 2] = vertices[i + 2] + cartographicOrigin.z;
497
381
  }
498
382
 
499
- for (var _i = 0; _i < positions.length; _i += 3) {
500
- _geospatial.Ellipsoid.WGS84.cartographicToCartesian(positions.subarray(_i, _i + 3), scratchVector);
383
+ for (let i = 0; i < positions.length; i += 3) {
384
+ _geospatial.Ellipsoid.WGS84.cartographicToCartesian(positions.subarray(i, i + 3), scratchVector);
501
385
 
502
- positions[_i] = scratchVector.x;
503
- positions[_i + 1] = scratchVector.y;
504
- positions[_i + 2] = scratchVector.z;
386
+ positions[i] = scratchVector.x;
387
+ positions[i + 1] = scratchVector.y;
388
+ positions[i + 2] = scratchVector.z;
505
389
  }
506
390
 
507
391
  return positions;
508
392
  }
509
393
 
394
+ function getModelMatrix(positions) {
395
+ var _metadata$i3sScale_x, _metadata$i3sScale_y;
396
+
397
+ const metadata = positions.metadata;
398
+ const scaleX = (metadata === null || metadata === void 0 ? void 0 : (_metadata$i3sScale_x = metadata['i3s-scale_x']) === null || _metadata$i3sScale_x === void 0 ? void 0 : _metadata$i3sScale_x.double) || 1;
399
+ const scaleY = (metadata === null || metadata === void 0 ? void 0 : (_metadata$i3sScale_y = metadata['i3s-scale_y']) === null || _metadata$i3sScale_y === void 0 ? void 0 : _metadata$i3sScale_y.double) || 1;
400
+ const modelMatrix = new _core2.Matrix4();
401
+ modelMatrix[0] = scaleX;
402
+ modelMatrix[5] = scaleY;
403
+ return modelMatrix;
404
+ }
405
+
510
406
  function makePbrMaterial(materialDefinition, texture) {
511
- var pbrMaterial;
407
+ let pbrMaterial;
512
408
 
513
409
  if (materialDefinition) {
514
- pbrMaterial = _objectSpread(_objectSpread({}, materialDefinition), {}, {
515
- pbrMetallicRoughness: materialDefinition.pbrMetallicRoughness ? _objectSpread({}, materialDefinition.pbrMetallicRoughness) : {
410
+ pbrMaterial = { ...materialDefinition,
411
+ pbrMetallicRoughness: materialDefinition.pbrMetallicRoughness ? { ...materialDefinition.pbrMetallicRoughness
412
+ } : {
516
413
  baseColorFactor: [255, 255, 255, 255]
517
414
  }
518
- });
415
+ };
519
416
  } else {
520
417
  pbrMaterial = {
521
418
  pbrMetallicRoughness: {}
@@ -549,9 +446,9 @@ function makePbrMaterial(materialDefinition, texture) {
549
446
  }
550
447
 
551
448
  function convertColorFormat(colorFactor) {
552
- var normalizedColor = (0, _toConsumableArray2.default)(colorFactor);
449
+ const normalizedColor = [...colorFactor];
553
450
 
554
- for (var index = 0; index < colorFactor.length; index++) {
451
+ for (let index = 0; index < colorFactor.length; index++) {
555
452
  normalizedColor[index] = colorFactor[index] / 255;
556
453
  }
557
454
 
@@ -559,56 +456,58 @@ function convertColorFormat(colorFactor) {
559
456
  }
560
457
 
561
458
  function setMaterialTexture(material, image) {
562
- var texture = {
459
+ const texture = {
563
460
  source: {
564
- image: image
461
+ image
565
462
  }
566
463
  };
567
464
 
568
465
  if (material.pbrMetallicRoughness && material.pbrMetallicRoughness.baseColorTexture) {
569
- material.pbrMetallicRoughness.baseColorTexture = _objectSpread(_objectSpread({}, material.pbrMetallicRoughness.baseColorTexture), {}, {
570
- texture: texture
571
- });
466
+ material.pbrMetallicRoughness.baseColorTexture = { ...material.pbrMetallicRoughness.baseColorTexture,
467
+ texture
468
+ };
572
469
  } else if (material.emissiveTexture) {
573
- material.emissiveTexture = _objectSpread(_objectSpread({}, material.emissiveTexture), {}, {
574
- texture: texture
575
- });
470
+ material.emissiveTexture = { ...material.emissiveTexture,
471
+ texture
472
+ };
576
473
  } else if (material.pbrMetallicRoughness && material.pbrMetallicRoughness.metallicRoughnessTexture) {
577
- material.pbrMetallicRoughness.metallicRoughnessTexture = _objectSpread(_objectSpread({}, material.pbrMetallicRoughness.metallicRoughnessTexture), {}, {
578
- texture: texture
579
- });
474
+ material.pbrMetallicRoughness.metallicRoughnessTexture = { ...material.pbrMetallicRoughness.metallicRoughnessTexture,
475
+ texture
476
+ };
580
477
  } else if (material.normalTexture) {
581
- material.normalTexture = _objectSpread(_objectSpread({}, material.normalTexture), {}, {
582
- texture: texture
583
- });
478
+ material.normalTexture = { ...material.normalTexture,
479
+ texture
480
+ };
584
481
  } else if (material.occlusionTexture) {
585
- material.occlusionTexture = _objectSpread(_objectSpread({}, material.occlusionTexture), {}, {
586
- texture: texture
587
- });
482
+ material.occlusionTexture = { ...material.occlusionTexture,
483
+ texture
484
+ };
588
485
  }
589
486
  }
590
487
 
591
488
  function flattenFeatureIdsByFaceRanges(normalizedFeatureAttributes) {
592
- var id = normalizedFeatureAttributes.id,
593
- faceRange = normalizedFeatureAttributes.faceRange;
489
+ const {
490
+ id,
491
+ faceRange
492
+ } = normalizedFeatureAttributes;
594
493
 
595
494
  if (!id || !faceRange) {
596
495
  return;
597
496
  }
598
497
 
599
- var featureIds = id.value;
600
- var range = faceRange.value;
601
- var featureIdsLength = range[range.length - 1] + 1;
602
- var orderedFeatureIndices = new Uint32Array(featureIdsLength * 3);
603
- var featureIndex = 0;
604
- var startIndex = 0;
605
-
606
- for (var index = 1; index < range.length; index += 2) {
607
- var fillId = Number(featureIds[featureIndex]);
608
- var endValue = range[index];
609
- var prevValue = range[index - 1];
610
- var trianglesCount = endValue - prevValue + 1;
611
- var endIndex = startIndex + trianglesCount * 3;
498
+ const featureIds = id.value;
499
+ const range = faceRange.value;
500
+ const featureIdsLength = range[range.length - 1] + 1;
501
+ const orderedFeatureIndices = new Uint32Array(featureIdsLength * 3);
502
+ let featureIndex = 0;
503
+ let startIndex = 0;
504
+
505
+ for (let index = 1; index < range.length; index += 2) {
506
+ const fillId = Number(featureIds[featureIndex]);
507
+ const endValue = range[index];
508
+ const prevValue = range[index - 1];
509
+ const trianglesCount = endValue - prevValue + 1;
510
+ const endIndex = startIndex + trianglesCount * 3;
612
511
  orderedFeatureIndices.fill(fillId, startIndex, endIndex);
613
512
  featureIndex++;
614
513
  startIndex = endIndex;
@@ -618,10 +517,10 @@ function flattenFeatureIdsByFaceRanges(normalizedFeatureAttributes) {
618
517
  }
619
518
 
620
519
  function flattenFeatureIdsByFeatureIndices(attributes, featureIds) {
621
- var featureIndices = attributes.id.value;
622
- var result = new Float32Array(featureIndices.length);
520
+ const featureIndices = attributes.id.value;
521
+ const result = new Float32Array(featureIndices.length);
623
522
 
624
- for (var index = 0; index < featureIndices.length; index++) {
523
+ for (let index = 0; index < featureIndices.length; index++) {
625
524
  result[index] = featureIds[featureIndices[index]];
626
525
  }
627
526