@loaders.gl/wkt 4.2.0-alpha.4 → 4.2.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 (75) hide show
  1. package/dist/dist.dev.js +137 -218
  2. package/dist/dist.min.js +10 -0
  3. package/dist/hex-wkb-loader.d.ts +1 -1
  4. package/dist/hex-wkb-loader.d.ts.map +1 -1
  5. package/dist/hex-wkb-loader.js +44 -28
  6. package/dist/index.cjs +87 -62
  7. package/dist/index.cjs.map +7 -0
  8. package/dist/index.d.ts +14 -14
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +4 -1
  11. package/dist/lib/encode-twkb.js +158 -143
  12. package/dist/lib/encode-wkb.js +247 -211
  13. package/dist/lib/encode-wkt-crs.d.ts +1 -1
  14. package/dist/lib/encode-wkt-crs.d.ts.map +1 -1
  15. package/dist/lib/encode-wkt-crs.js +32 -18
  16. package/dist/lib/encode-wkt.js +35 -27
  17. package/dist/lib/parse-hex-wkb.js +1 -2
  18. package/dist/lib/parse-twkb.js +215 -218
  19. package/dist/lib/parse-wkb-header.js +124 -95
  20. package/dist/lib/parse-wkb.d.ts +1 -1
  21. package/dist/lib/parse-wkb.d.ts.map +1 -1
  22. package/dist/lib/parse-wkb.js +210 -235
  23. package/dist/lib/parse-wkt-crs.js +110 -86
  24. package/dist/lib/parse-wkt.js +251 -185
  25. package/dist/lib/utils/base64-encoder.js +151 -5
  26. package/dist/lib/utils/binary-reader.js +67 -64
  27. package/dist/lib/utils/binary-writer.js +117 -109
  28. package/dist/lib/utils/hex-encoder.js +46 -32
  29. package/dist/lib/utils/hex-transcoder.js +40 -24
  30. package/dist/lib/utils/version.js +7 -2
  31. package/dist/twkb-loader.js +26 -17
  32. package/dist/twkb-writer.js +18 -13
  33. package/dist/wkb-loader.js +26 -17
  34. package/dist/wkb-writer.js +22 -17
  35. package/dist/wkt-crs-loader.d.ts +1 -1
  36. package/dist/wkt-crs-loader.d.ts.map +1 -1
  37. package/dist/wkt-crs-loader.js +22 -15
  38. package/dist/wkt-crs-writer.d.ts +2 -2
  39. package/dist/wkt-crs-writer.d.ts.map +1 -1
  40. package/dist/wkt-crs-writer.js +23 -15
  41. package/dist/wkt-loader.js +28 -20
  42. package/dist/wkt-worker.js +4 -2
  43. package/dist/wkt-writer.js +19 -14
  44. package/dist/workers/wkb-worker.js +3 -1
  45. package/dist/workers/wkt-worker.js +3 -1
  46. package/package.json +11 -6
  47. package/src/lib/parse-wkb.ts +2 -2
  48. package/dist/hex-wkb-loader.js.map +0 -1
  49. package/dist/index.js.map +0 -1
  50. package/dist/lib/encode-twkb.js.map +0 -1
  51. package/dist/lib/encode-wkb.js.map +0 -1
  52. package/dist/lib/encode-wkt-crs.js.map +0 -1
  53. package/dist/lib/encode-wkt.js.map +0 -1
  54. package/dist/lib/parse-hex-wkb.js.map +0 -1
  55. package/dist/lib/parse-twkb.js.map +0 -1
  56. package/dist/lib/parse-wkb-header.js.map +0 -1
  57. package/dist/lib/parse-wkb.js.map +0 -1
  58. package/dist/lib/parse-wkt-crs.js.map +0 -1
  59. package/dist/lib/parse-wkt.js.map +0 -1
  60. package/dist/lib/utils/base64-encoder.js.map +0 -1
  61. package/dist/lib/utils/binary-reader.js.map +0 -1
  62. package/dist/lib/utils/binary-writer.js.map +0 -1
  63. package/dist/lib/utils/hex-encoder.js.map +0 -1
  64. package/dist/lib/utils/hex-transcoder.js.map +0 -1
  65. package/dist/lib/utils/version.js.map +0 -1
  66. package/dist/twkb-loader.js.map +0 -1
  67. package/dist/twkb-writer.js.map +0 -1
  68. package/dist/wkb-loader.js.map +0 -1
  69. package/dist/wkb-writer.js.map +0 -1
  70. package/dist/wkt-crs-loader.js.map +0 -1
  71. package/dist/wkt-crs-writer.js.map +0 -1
  72. package/dist/wkt-loader.js.map +0 -1
  73. package/dist/wkt-writer.js.map +0 -1
  74. package/dist/workers/wkb-worker.js.map +0 -1
  75. package/dist/workers/wkt-worker.js.map +0 -1
@@ -1,266 +1,241 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  import { binaryToGeometry } from '@loaders.gl/gis';
2
5
  import { parseWKBHeader, WKBGeometryType } from "./parse-wkb-header.js";
3
6
  export function parseWKB(arrayBuffer, options) {
4
- var _options$wkb;
5
- const binaryGeometry = parseWKBToBinary(arrayBuffer, options);
6
- const shape = (options === null || options === void 0 ? void 0 : (_options$wkb = options.wkb) === null || _options$wkb === void 0 ? void 0 : _options$wkb.shape) || 'binary-geometry';
7
- switch (shape) {
8
- case 'binary-geometry':
9
- return binaryGeometry;
10
- case 'geojson-geometry':
11
- return binaryToGeometry(binaryGeometry);
12
- case 'geometry':
13
- console.error('WKBLoader: "geometry" shape is deprecated, use "binary-geometry" instead');
14
- return binaryToGeometry(binaryGeometry);
15
- default:
16
- throw new Error(shape);
17
- }
7
+ const binaryGeometry = parseWKBToBinary(arrayBuffer, options);
8
+ const shape = options?.wkb?.shape || 'binary-geometry';
9
+ switch (shape) {
10
+ case 'binary-geometry':
11
+ return binaryGeometry;
12
+ case 'geojson-geometry':
13
+ return binaryToGeometry(binaryGeometry);
14
+ case 'geometry':
15
+ // eslint-disable-next-line no-console
16
+ console.error('WKBLoader: "geometry" shape is deprecated, use "binary-geometry" instead');
17
+ return binaryToGeometry(binaryGeometry);
18
+ default:
19
+ throw new Error(shape);
20
+ }
18
21
  }
19
22
  export function parseWKBToBinary(arrayBuffer, options) {
20
- const dataView = new DataView(arrayBuffer);
21
- const wkbHeader = parseWKBHeader(dataView);
22
- const {
23
- geometryType,
24
- dimensions,
25
- littleEndian
26
- } = wkbHeader;
27
- const offset = wkbHeader.byteOffset;
28
- switch (geometryType) {
29
- case WKBGeometryType.Point:
30
- const point = parsePoint(dataView, offset, dimensions, littleEndian);
31
- return point.geometry;
32
- case WKBGeometryType.LineString:
33
- const line = parseLineString(dataView, offset, dimensions, littleEndian);
34
- return line.geometry;
35
- case WKBGeometryType.Polygon:
36
- const polygon = parsePolygon(dataView, offset, dimensions, littleEndian);
37
- return polygon.geometry;
38
- case WKBGeometryType.MultiPoint:
39
- const multiPoint = parseMultiPoint(dataView, offset, dimensions, littleEndian);
40
- multiPoint.type = 'Point';
41
- return multiPoint;
42
- case WKBGeometryType.MultiLineString:
43
- const multiLine = parseMultiLineString(dataView, offset, dimensions, littleEndian);
44
- multiLine.type = 'LineString';
45
- return multiLine;
46
- case WKBGeometryType.MultiPolygon:
47
- const multiPolygon = parseMultiPolygon(dataView, offset, dimensions, littleEndian);
48
- multiPolygon.type = 'Polygon';
49
- return multiPolygon;
50
- default:
51
- throw new Error(`WKB: Unsupported geometry type: ${geometryType}`);
52
- }
23
+ const dataView = new DataView(arrayBuffer);
24
+ const wkbHeader = parseWKBHeader(dataView);
25
+ const { geometryType, dimensions, littleEndian } = wkbHeader;
26
+ const offset = wkbHeader.byteOffset;
27
+ switch (geometryType) {
28
+ case WKBGeometryType.Point:
29
+ const point = parsePoint(dataView, offset, dimensions, littleEndian);
30
+ return point.geometry;
31
+ case WKBGeometryType.LineString:
32
+ const line = parseLineString(dataView, offset, dimensions, littleEndian);
33
+ return line.geometry;
34
+ case WKBGeometryType.Polygon:
35
+ const polygon = parsePolygon(dataView, offset, dimensions, littleEndian);
36
+ return polygon.geometry;
37
+ case WKBGeometryType.MultiPoint:
38
+ const multiPoint = parseMultiPoint(dataView, offset, dimensions, littleEndian);
39
+ multiPoint.type = 'Point';
40
+ return multiPoint;
41
+ case WKBGeometryType.MultiLineString:
42
+ const multiLine = parseMultiLineString(dataView, offset, dimensions, littleEndian);
43
+ multiLine.type = 'LineString';
44
+ return multiLine;
45
+ case WKBGeometryType.MultiPolygon:
46
+ const multiPolygon = parseMultiPolygon(dataView, offset, dimensions, littleEndian);
47
+ multiPolygon.type = 'Polygon';
48
+ return multiPolygon;
49
+ // case WKBGeometryType.GeometryCollection:
50
+ // TODO: handle GeometryCollections
51
+ // return parseGeometryCollection(dataView, offset, dimensions, littleEndian);
52
+ default:
53
+ throw new Error(`WKB: Unsupported geometry type: ${geometryType}`);
54
+ }
53
55
  }
56
+ // Primitives; parse point and linear ring
54
57
  function parsePoint(dataView, offset, dimension, littleEndian) {
55
- const positions = new Float64Array(dimension);
56
- for (let i = 0; i < dimension; i++) {
57
- positions[i] = dataView.getFloat64(offset, littleEndian);
58
- offset += 8;
59
- }
60
- return {
61
- geometry: {
62
- type: 'Point',
63
- positions: {
64
- value: positions,
65
- size: dimension
66
- }
67
- },
68
- offset
69
- };
58
+ const positions = new Float64Array(dimension);
59
+ for (let i = 0; i < dimension; i++) {
60
+ positions[i] = dataView.getFloat64(offset, littleEndian);
61
+ offset += 8;
62
+ }
63
+ return {
64
+ geometry: { type: 'Point', positions: { value: positions, size: dimension } },
65
+ offset
66
+ };
70
67
  }
71
68
  function parseLineString(dataView, offset, dimension, littleEndian) {
72
- const nPoints = dataView.getUint32(offset, littleEndian);
73
- offset += 4;
74
- const positions = new Float64Array(nPoints * dimension);
75
- for (let i = 0; i < nPoints * dimension; i++) {
76
- positions[i] = dataView.getFloat64(offset, littleEndian);
77
- offset += 8;
78
- }
79
- const pathIndices = [0];
80
- if (nPoints > 0) {
81
- pathIndices.push(nPoints);
82
- }
83
- return {
84
- geometry: {
85
- type: 'LineString',
86
- positions: {
87
- value: positions,
88
- size: dimension
89
- },
90
- pathIndices: {
91
- value: new Uint16Array(pathIndices),
92
- size: 1
93
- }
94
- },
95
- offset
96
- };
69
+ const nPoints = dataView.getUint32(offset, littleEndian);
70
+ offset += 4;
71
+ // Instantiate array
72
+ const positions = new Float64Array(nPoints * dimension);
73
+ for (let i = 0; i < nPoints * dimension; i++) {
74
+ positions[i] = dataView.getFloat64(offset, littleEndian);
75
+ offset += 8;
76
+ }
77
+ const pathIndices = [0];
78
+ if (nPoints > 0) {
79
+ pathIndices.push(nPoints);
80
+ }
81
+ return {
82
+ geometry: {
83
+ type: 'LineString',
84
+ positions: { value: positions, size: dimension },
85
+ pathIndices: { value: new Uint16Array(pathIndices), size: 1 }
86
+ },
87
+ offset
88
+ };
97
89
  }
98
- const cumulativeSum = sum => value => sum += value;
90
+ // https://stackoverflow.com/a/55261098
91
+ const cumulativeSum = (sum) => (value) => (sum += value);
99
92
  function parsePolygon(dataView, offset, dimension, littleEndian) {
100
- const nRings = dataView.getUint32(offset, littleEndian);
101
- offset += 4;
102
- const rings = [];
103
- for (let i = 0; i < nRings; i++) {
104
- const parsed = parseLineString(dataView, offset, dimension, littleEndian);
105
- const {
106
- positions
107
- } = parsed.geometry;
108
- offset = parsed.offset;
109
- rings.push(positions.value);
110
- }
111
- const concatenatedPositions = new Float64Array(concatTypedArrays(rings).buffer);
112
- const polygonIndices = [0];
113
- if (concatenatedPositions.length > 0) {
114
- polygonIndices.push(concatenatedPositions.length / dimension);
115
- }
116
- const primitivePolygonIndices = rings.map(l => l.length / dimension).map(cumulativeSum(0));
117
- primitivePolygonIndices.unshift(0);
118
- return {
119
- geometry: {
120
- type: 'Polygon',
121
- positions: {
122
- value: concatenatedPositions,
123
- size: dimension
124
- },
125
- polygonIndices: {
126
- value: new Uint16Array(polygonIndices),
127
- size: 1
128
- },
129
- primitivePolygonIndices: {
130
- value: new Uint16Array(primitivePolygonIndices),
131
- size: 1
132
- }
133
- },
134
- offset
135
- };
93
+ const nRings = dataView.getUint32(offset, littleEndian);
94
+ offset += 4;
95
+ const rings = [];
96
+ for (let i = 0; i < nRings; i++) {
97
+ const parsed = parseLineString(dataView, offset, dimension, littleEndian);
98
+ const { positions } = parsed.geometry;
99
+ offset = parsed.offset;
100
+ rings.push(positions.value);
101
+ }
102
+ const concatenatedPositions = new Float64Array(concatTypedArrays(rings).buffer);
103
+ const polygonIndices = [0];
104
+ if (concatenatedPositions.length > 0) {
105
+ polygonIndices.push(concatenatedPositions.length / dimension);
106
+ }
107
+ const primitivePolygonIndices = rings.map((l) => l.length / dimension).map(cumulativeSum(0));
108
+ primitivePolygonIndices.unshift(0);
109
+ return {
110
+ geometry: {
111
+ type: 'Polygon',
112
+ positions: { value: concatenatedPositions, size: dimension },
113
+ polygonIndices: {
114
+ value: new Uint16Array(polygonIndices),
115
+ size: 1
116
+ },
117
+ primitivePolygonIndices: { value: new Uint16Array(primitivePolygonIndices), size: 1 }
118
+ },
119
+ offset
120
+ };
136
121
  }
137
122
  function parseMultiPoint(dataView, offset, dimension, littleEndian) {
138
- const nPoints = dataView.getUint32(offset, littleEndian);
139
- offset += 4;
140
- const binaryPointGeometries = [];
141
- for (let i = 0; i < nPoints; i++) {
142
- const littleEndianPoint = dataView.getUint8(offset) === 1;
143
- offset++;
144
- if (dataView.getUint32(offset, littleEndianPoint) % 1000 !== 1) {
145
- throw new Error('WKB: Inner geometries of MultiPoint not of type Point');
146
- }
123
+ const nPoints = dataView.getUint32(offset, littleEndian);
147
124
  offset += 4;
148
- const parsed = parsePoint(dataView, offset, dimension, littleEndianPoint);
149
- offset = parsed.offset;
150
- binaryPointGeometries.push(parsed.geometry);
151
- }
152
- return concatenateBinaryPointGeometries(binaryPointGeometries, dimension);
125
+ const binaryPointGeometries = [];
126
+ for (let i = 0; i < nPoints; i++) {
127
+ // Byte order for point
128
+ const littleEndianPoint = dataView.getUint8(offset) === 1;
129
+ offset++;
130
+ // Assert point type
131
+ if (dataView.getUint32(offset, littleEndianPoint) % 1000 !== 1) {
132
+ throw new Error('WKB: Inner geometries of MultiPoint not of type Point');
133
+ }
134
+ offset += 4;
135
+ const parsed = parsePoint(dataView, offset, dimension, littleEndianPoint);
136
+ offset = parsed.offset;
137
+ binaryPointGeometries.push(parsed.geometry);
138
+ }
139
+ return concatenateBinaryPointGeometries(binaryPointGeometries, dimension);
153
140
  }
154
141
  function parseMultiLineString(dataView, offset, dimension, littleEndian) {
155
- const nLines = dataView.getUint32(offset, littleEndian);
156
- offset += 4;
157
- const binaryLineGeometries = [];
158
- for (let i = 0; i < nLines; i++) {
159
- const littleEndianLine = dataView.getUint8(offset) === 1;
160
- offset++;
161
- if (dataView.getUint32(offset, littleEndianLine) % 1000 !== 2) {
162
- throw new Error('WKB: Inner geometries of MultiLineString not of type LineString');
163
- }
142
+ const nLines = dataView.getUint32(offset, littleEndian);
164
143
  offset += 4;
165
- const parsed = parseLineString(dataView, offset, dimension, littleEndianLine);
166
- offset = parsed.offset;
167
- binaryLineGeometries.push(parsed.geometry);
168
- }
169
- return concatenateBinaryLineGeometries(binaryLineGeometries, dimension);
144
+ const binaryLineGeometries = [];
145
+ for (let i = 0; i < nLines; i++) {
146
+ // Byte order for line
147
+ const littleEndianLine = dataView.getUint8(offset) === 1;
148
+ offset++;
149
+ // Assert type LineString
150
+ if (dataView.getUint32(offset, littleEndianLine) % 1000 !== 2) {
151
+ throw new Error('WKB: Inner geometries of MultiLineString not of type LineString');
152
+ }
153
+ offset += 4;
154
+ const parsed = parseLineString(dataView, offset, dimension, littleEndianLine);
155
+ offset = parsed.offset;
156
+ binaryLineGeometries.push(parsed.geometry);
157
+ }
158
+ return concatenateBinaryLineGeometries(binaryLineGeometries, dimension);
170
159
  }
171
160
  function parseMultiPolygon(dataView, offset, dimension, littleEndian) {
172
- const nPolygons = dataView.getUint32(offset, littleEndian);
173
- offset += 4;
174
- const binaryPolygonGeometries = [];
175
- for (let i = 0; i < nPolygons; i++) {
176
- const littleEndianPolygon = dataView.getUint8(offset) === 1;
177
- offset++;
178
- if (dataView.getUint32(offset, littleEndianPolygon) % 1000 !== 3) {
179
- throw new Error('WKB: Inner geometries of MultiPolygon not of type Polygon');
180
- }
161
+ const nPolygons = dataView.getUint32(offset, littleEndian);
181
162
  offset += 4;
182
- const parsed = parsePolygon(dataView, offset, dimension, littleEndianPolygon);
183
- offset = parsed.offset;
184
- binaryPolygonGeometries.push(parsed.geometry);
185
- }
186
- return concatenateBinaryPolygonGeometries(binaryPolygonGeometries, dimension);
163
+ const binaryPolygonGeometries = [];
164
+ for (let i = 0; i < nPolygons; i++) {
165
+ // Byte order for polygon
166
+ const littleEndianPolygon = dataView.getUint8(offset) === 1;
167
+ offset++;
168
+ // Assert type Polygon
169
+ if (dataView.getUint32(offset, littleEndianPolygon) % 1000 !== 3) {
170
+ throw new Error('WKB: Inner geometries of MultiPolygon not of type Polygon');
171
+ }
172
+ offset += 4;
173
+ const parsed = parsePolygon(dataView, offset, dimension, littleEndianPolygon);
174
+ offset = parsed.offset;
175
+ binaryPolygonGeometries.push(parsed.geometry);
176
+ }
177
+ return concatenateBinaryPolygonGeometries(binaryPolygonGeometries, dimension);
187
178
  }
179
+ // TODO - move to loaders.gl/schema/gis
188
180
  function concatenateBinaryPointGeometries(binaryPointGeometries, dimension) {
189
- const positions = binaryPointGeometries.map(geometry => geometry.positions.value);
190
- const concatenatedPositions = new Float64Array(concatTypedArrays(positions).buffer);
191
- return {
192
- type: 'Point',
193
- positions: {
194
- value: concatenatedPositions,
195
- size: dimension
196
- }
197
- };
181
+ const positions = binaryPointGeometries.map((geometry) => geometry.positions.value);
182
+ const concatenatedPositions = new Float64Array(concatTypedArrays(positions).buffer);
183
+ return {
184
+ type: 'Point',
185
+ positions: { value: concatenatedPositions, size: dimension }
186
+ };
198
187
  }
199
188
  function concatenateBinaryLineGeometries(binaryLineGeometries, dimension) {
200
- const lines = binaryLineGeometries.map(geometry => geometry.positions.value);
201
- const concatenatedPositions = new Float64Array(concatTypedArrays(lines).buffer);
202
- const pathIndices = lines.map(line => line.length / dimension).map(cumulativeSum(0));
203
- pathIndices.unshift(0);
204
- return {
205
- type: 'LineString',
206
- positions: {
207
- value: concatenatedPositions,
208
- size: dimension
209
- },
210
- pathIndices: {
211
- value: new Uint16Array(pathIndices),
212
- size: 1
213
- }
214
- };
189
+ const lines = binaryLineGeometries.map((geometry) => geometry.positions.value);
190
+ const concatenatedPositions = new Float64Array(concatTypedArrays(lines).buffer);
191
+ const pathIndices = lines.map((line) => line.length / dimension).map(cumulativeSum(0));
192
+ pathIndices.unshift(0);
193
+ return {
194
+ type: 'LineString',
195
+ positions: { value: concatenatedPositions, size: dimension },
196
+ pathIndices: { value: new Uint16Array(pathIndices), size: 1 }
197
+ };
215
198
  }
216
199
  function concatenateBinaryPolygonGeometries(binaryPolygonGeometries, dimension) {
217
- const polygons = [];
218
- const primitivePolygons = [];
219
- for (const binaryPolygon of binaryPolygonGeometries) {
220
- const {
221
- positions,
222
- primitivePolygonIndices
223
- } = binaryPolygon;
224
- polygons.push(positions.value);
225
- primitivePolygons.push(primitivePolygonIndices.value);
226
- }
227
- const concatenatedPositions = new Float64Array(concatTypedArrays(polygons).buffer);
228
- const polygonIndices = polygons.map(p => p.length / dimension).map(cumulativeSum(0));
229
- polygonIndices.unshift(0);
230
- const primitivePolygonIndices = [0];
231
- for (const primitivePolygon of primitivePolygons) {
232
- primitivePolygonIndices.push(...primitivePolygon.filter(x => x > 0).map(x => x + primitivePolygonIndices[primitivePolygonIndices.length - 1]));
233
- }
234
- return {
235
- type: 'Polygon',
236
- positions: {
237
- value: concatenatedPositions,
238
- size: dimension
239
- },
240
- polygonIndices: {
241
- value: new Uint16Array(polygonIndices),
242
- size: 1
243
- },
244
- primitivePolygonIndices: {
245
- value: new Uint16Array(primitivePolygonIndices),
246
- size: 1
200
+ const polygons = [];
201
+ const primitivePolygons = [];
202
+ for (const binaryPolygon of binaryPolygonGeometries) {
203
+ const { positions, primitivePolygonIndices } = binaryPolygon;
204
+ polygons.push(positions.value);
205
+ primitivePolygons.push(primitivePolygonIndices.value);
247
206
  }
248
- };
207
+ const concatenatedPositions = new Float64Array(concatTypedArrays(polygons).buffer);
208
+ const polygonIndices = polygons.map((p) => p.length / dimension).map(cumulativeSum(0));
209
+ polygonIndices.unshift(0);
210
+ // Combine primitivePolygonIndices from each individual polygon
211
+ const primitivePolygonIndices = [0];
212
+ for (const primitivePolygon of primitivePolygons) {
213
+ primitivePolygonIndices.push(...primitivePolygon
214
+ .filter((x) => x > 0)
215
+ .map((x) => x + primitivePolygonIndices[primitivePolygonIndices.length - 1]));
216
+ }
217
+ return {
218
+ type: 'Polygon',
219
+ positions: { value: concatenatedPositions, size: dimension },
220
+ polygonIndices: { value: new Uint32Array(polygonIndices), size: 1 },
221
+ primitivePolygonIndices: { value: new Uint32Array(primitivePolygonIndices), size: 1 }
222
+ };
249
223
  }
224
+ // TODO: remove copy; import from typed-array-utils
225
+ // modules/math/src/geometry/typed-arrays/typed-array-utils.js
250
226
  function concatTypedArrays(arrays) {
251
- let byteLength = 0;
252
- for (let i = 0; i < arrays.length; ++i) {
253
- byteLength += arrays[i].byteLength;
254
- }
255
- const buffer = new Uint8Array(byteLength);
256
- let byteOffset = 0;
257
- for (let i = 0; i < arrays.length; ++i) {
258
- const data = new Uint8Array(arrays[i].buffer);
259
- byteLength = data.length;
260
- for (let j = 0; j < byteLength; ++j) {
261
- buffer[byteOffset++] = data[j];
227
+ let byteLength = 0;
228
+ for (let i = 0; i < arrays.length; ++i) {
229
+ byteLength += arrays[i].byteLength;
230
+ }
231
+ const buffer = new Uint8Array(byteLength);
232
+ let byteOffset = 0;
233
+ for (let i = 0; i < arrays.length; ++i) {
234
+ const data = new Uint8Array(arrays[i].buffer);
235
+ byteLength = data.length;
236
+ for (let j = 0; j < byteLength; ++j) {
237
+ buffer[byteOffset++] = data[j];
238
+ }
262
239
  }
263
- }
264
- return buffer;
240
+ return buffer;
265
241
  }
266
- //# sourceMappingURL=parse-wkb.js.map