@maplibre/mlt 1.1.5 → 1.1.7

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 (173) hide show
  1. package/dist/decoding/bigEndianDecode.d.ts +13 -0
  2. package/dist/decoding/bigEndianDecode.js +50 -0
  3. package/dist/decoding/bigEndianDecode.js.map +1 -0
  4. package/dist/decoding/decodingTestUtils.d.ts +1 -1
  5. package/dist/decoding/decodingTestUtils.js.map +1 -1
  6. package/dist/decoding/decodingUtils.js +4 -2
  7. package/dist/decoding/decodingUtils.js.map +1 -1
  8. package/dist/decoding/fastPforDecoder.d.ts +48 -0
  9. package/dist/decoding/fastPforDecoder.js +482 -0
  10. package/dist/decoding/fastPforDecoder.js.map +1 -0
  11. package/dist/decoding/fastPforShared.d.ts +9 -0
  12. package/dist/decoding/fastPforShared.js +29 -0
  13. package/dist/decoding/fastPforShared.js.map +1 -0
  14. package/dist/decoding/fastPforUnpack.d.ts +23 -0
  15. package/dist/decoding/fastPforUnpack.js +910 -0
  16. package/dist/decoding/fastPforUnpack.js.map +1 -0
  17. package/dist/decoding/geometryDecoder.d.ts +2 -2
  18. package/dist/decoding/geometryDecoder.js +11 -8
  19. package/dist/decoding/geometryDecoder.js.map +1 -1
  20. package/dist/decoding/integerDecodingUtils.d.ts +14 -10
  21. package/dist/decoding/integerDecodingUtils.js +44 -22
  22. package/dist/decoding/integerDecodingUtils.js.map +1 -1
  23. package/dist/decoding/integerStreamDecoder.d.ts +1 -1
  24. package/dist/decoding/integerStreamDecoder.js +13 -6
  25. package/dist/decoding/integerStreamDecoder.js.map +1 -1
  26. package/dist/decoding/propertyDecoder.js +10 -14
  27. package/dist/decoding/propertyDecoder.js.map +1 -1
  28. package/dist/decoding/stringDecoder.js +2 -11
  29. package/dist/decoding/stringDecoder.js.map +1 -1
  30. package/dist/encoding/bigEndianEncode.d.ts +7 -0
  31. package/dist/encoding/bigEndianEncode.js +16 -0
  32. package/dist/encoding/bigEndianEncode.js.map +1 -0
  33. package/dist/encoding/constGeometryVectorEncoder.d.ts +19 -0
  34. package/dist/encoding/constGeometryVectorEncoder.js +248 -0
  35. package/dist/encoding/constGeometryVectorEncoder.js.map +1 -0
  36. package/dist/encoding/encodingUtils.d.ts +1 -1
  37. package/dist/encoding/encodingUtils.js +2 -2
  38. package/dist/encoding/encodingUtils.js.map +1 -1
  39. package/dist/encoding/fastPforEncoder.d.ts +19 -0
  40. package/dist/encoding/fastPforEncoder.js +310 -0
  41. package/dist/encoding/fastPforEncoder.js.map +1 -0
  42. package/dist/encoding/integerEncodingUtils.d.ts +7 -7
  43. package/dist/encoding/integerEncodingUtils.js +25 -17
  44. package/dist/encoding/integerEncodingUtils.js.map +1 -1
  45. package/dist/encoding/integerStreamEncoder.d.ts +1 -1
  46. package/dist/encoding/integerStreamEncoder.js +5 -5
  47. package/dist/encoding/integerStreamEncoder.js.map +1 -1
  48. package/dist/encoding/packNullableUtils.d.ts +1 -1
  49. package/dist/encoding/packNullableUtils.js.map +1 -1
  50. package/dist/encoding/propertyEncoder.d.ts +1 -1
  51. package/dist/encoding/propertyEncoder.js +8 -8
  52. package/dist/encoding/propertyEncoder.js.map +1 -1
  53. package/dist/encoding/stringEncoder.js +3 -3
  54. package/dist/encoding/stringEncoder.js.map +1 -1
  55. package/dist/encoding/zOrderCurveEncoder.js +1 -1
  56. package/dist/encoding/zOrderCurveEncoder.js.map +1 -1
  57. package/dist/metadata/tile/logicalStreamType.d.ts +3 -3
  58. package/dist/metadata/tile/logicalStreamType.js.map +1 -1
  59. package/dist/metadata/tileset/embeddedTilesetMetadataDecoder.d.ts +1 -1
  60. package/dist/metadata/tileset/embeddedTilesetMetadataDecoder.js.map +1 -1
  61. package/dist/metadata/tileset/typeMap.d.ts +10 -2
  62. package/dist/metadata/tileset/typeMap.js +25 -15
  63. package/dist/metadata/tileset/typeMap.js.map +1 -1
  64. package/dist/mltDecoder.js +29 -26
  65. package/dist/mltDecoder.js.map +1 -1
  66. package/dist/mltMetadata.js.map +1 -1
  67. package/dist/vector/constant/intConstVector.d.ts +1 -1
  68. package/dist/vector/constant/intConstVector.js +1 -1
  69. package/dist/vector/constant/intConstVector.js.map +1 -1
  70. package/dist/vector/constant/longConstVector.d.ts +1 -1
  71. package/dist/vector/constant/longConstVector.js +1 -1
  72. package/dist/vector/constant/longConstVector.js.map +1 -1
  73. package/dist/vector/dictionary/stringDictionaryVector.d.ts +0 -1
  74. package/dist/vector/dictionary/stringDictionaryVector.js +0 -2
  75. package/dist/vector/dictionary/stringDictionaryVector.js.map +1 -1
  76. package/dist/vector/featureTable.d.ts +4 -5
  77. package/dist/vector/featureTable.js +2 -29
  78. package/dist/vector/featureTable.js.map +1 -1
  79. package/dist/vector/filter/flatSelectionVector.d.ts +1 -1
  80. package/dist/vector/filter/flatSelectionVector.js.map +1 -1
  81. package/dist/vector/filter/selectionVectorUtils.d.ts +1 -1
  82. package/dist/vector/filter/selectionVectorUtils.js.map +1 -1
  83. package/dist/vector/filter/sequenceSelectionVector.d.ts +1 -1
  84. package/dist/vector/filter/sequenceSelectionVector.js.map +1 -1
  85. package/dist/vector/flat/stringFlatVector.d.ts +0 -1
  86. package/dist/vector/flat/stringFlatVector.js +0 -2
  87. package/dist/vector/flat/stringFlatVector.js.map +1 -1
  88. package/dist/vector/fsst-dictionary/stringFsstDictionaryVector.d.ts +0 -2
  89. package/dist/vector/fsst-dictionary/stringFsstDictionaryVector.js +0 -36
  90. package/dist/vector/fsst-dictionary/stringFsstDictionaryVector.js.map +1 -1
  91. package/dist/vector/geometry/constGeometryVector.d.ts +2 -2
  92. package/dist/vector/geometry/constGeometryVector.js +1 -1
  93. package/dist/vector/geometry/constGeometryVector.js.map +1 -1
  94. package/dist/vector/geometry/constGpuVector.d.ts +2 -2
  95. package/dist/vector/geometry/constGpuVector.js +1 -1
  96. package/dist/vector/geometry/constGpuVector.js.map +1 -1
  97. package/dist/vector/geometry/flatGeometryVector.d.ts +1 -1
  98. package/dist/vector/geometry/flatGeometryVector.js.map +1 -1
  99. package/dist/vector/geometry/flatGpuVector.d.ts +1 -1
  100. package/dist/vector/geometry/flatGpuVector.js.map +1 -1
  101. package/dist/vector/geometry/geometryType.js.map +1 -1
  102. package/dist/vector/geometry/geometryVector.d.ts +4 -5
  103. package/dist/vector/geometry/geometryVector.js +0 -8
  104. package/dist/vector/geometry/geometryVector.js.map +1 -1
  105. package/dist/vector/geometry/geometryVectorConverter.d.ts +1 -1
  106. package/dist/vector/geometry/geometryVectorConverter.js +167 -211
  107. package/dist/vector/geometry/geometryVectorConverter.js.map +1 -1
  108. package/dist/vector/geometry/gpuVector.d.ts +2 -2
  109. package/dist/vector/geometry/gpuVector.js.map +1 -1
  110. package/dist/vector/geometry/topologyVector.d.ts +5 -9
  111. package/dist/vector/geometry/topologyVector.js +1 -19
  112. package/dist/vector/geometry/topologyVector.js.map +1 -1
  113. package/dist/vector/geometry/vertexBufferType.js.map +1 -1
  114. package/dist/vector/intVector.d.ts +7 -7
  115. package/dist/vector/intVector.js.map +1 -1
  116. package/dist/vector/vector.js +1 -1
  117. package/dist/vector/vector.js.map +1 -1
  118. package/dist/vector/vectorType.js.map +1 -1
  119. package/package.json +9 -10
  120. package/dist/decoding/decodingUtils.spec.d.ts +0 -1
  121. package/dist/decoding/decodingUtils.spec.js +0 -141
  122. package/dist/decoding/decodingUtils.spec.js.map +0 -1
  123. package/dist/decoding/fsstDecoder.spec.d.ts +0 -1
  124. package/dist/decoding/fsstDecoder.spec.js +0 -57
  125. package/dist/decoding/fsstDecoder.spec.js.map +0 -1
  126. package/dist/decoding/integerDecodingUtils.spec.d.ts +0 -1
  127. package/dist/decoding/integerDecodingUtils.spec.js +0 -300
  128. package/dist/decoding/integerDecodingUtils.spec.js.map +0 -1
  129. package/dist/decoding/integerStreamDecoder.spec.d.ts +0 -1
  130. package/dist/decoding/integerStreamDecoder.spec.js +0 -402
  131. package/dist/decoding/integerStreamDecoder.spec.js.map +0 -1
  132. package/dist/decoding/propertyDecoder.spec.d.ts +0 -1
  133. package/dist/decoding/propertyDecoder.spec.js +0 -448
  134. package/dist/decoding/propertyDecoder.spec.js.map +0 -1
  135. package/dist/decoding/stringDecoder.spec.d.ts +0 -1
  136. package/dist/decoding/stringDecoder.spec.js +0 -387
  137. package/dist/decoding/stringDecoder.spec.js.map +0 -1
  138. package/dist/decoding/unpackNullableUtils.spec.d.ts +0 -1
  139. package/dist/decoding/unpackNullableUtils.spec.js +0 -71
  140. package/dist/decoding/unpackNullableUtils.spec.js.map +0 -1
  141. package/dist/metadata/tileset/embeddedTilesetMetadataDecoder.spec.d.ts +0 -1
  142. package/dist/metadata/tileset/embeddedTilesetMetadataDecoder.spec.js +0 -142
  143. package/dist/metadata/tileset/embeddedTilesetMetadataDecoder.spec.js.map +0 -1
  144. package/dist/mltDecoder.spec.d.ts +0 -1
  145. package/dist/mltDecoder.spec.js +0 -152
  146. package/dist/mltDecoder.spec.js.map +0 -1
  147. package/dist/vector/filter/flatSelectionVector.spec.d.ts +0 -1
  148. package/dist/vector/filter/flatSelectionVector.spec.js +0 -51
  149. package/dist/vector/filter/flatSelectionVector.spec.js.map +0 -1
  150. package/dist/vector/filter/selectionVectorUtil.spec.d.ts +0 -1
  151. package/dist/vector/filter/selectionVectorUtil.spec.js +0 -154
  152. package/dist/vector/filter/selectionVectorUtil.spec.js.map +0 -1
  153. package/dist/vector/filter/sequenceSelectionVector.spec.d.ts +0 -1
  154. package/dist/vector/filter/sequenceSelectionVector.spec.js +0 -115
  155. package/dist/vector/filter/sequenceSelectionVector.spec.js.map +0 -1
  156. package/dist/vector/flat/floatFlatVector.spec.d.ts +0 -1
  157. package/dist/vector/flat/floatFlatVector.spec.js +0 -14
  158. package/dist/vector/flat/floatFlatVector.spec.js.map +0 -1
  159. package/dist/vector/flat/intFlatVector.spec.d.ts +0 -1
  160. package/dist/vector/flat/intFlatVector.spec.js +0 -15
  161. package/dist/vector/flat/intFlatVector.spec.js.map +0 -1
  162. package/dist/vector/flat/longFlatVector.spec.d.ts +0 -1
  163. package/dist/vector/flat/longFlatVector.spec.js +0 -14
  164. package/dist/vector/flat/longFlatVector.spec.js.map +0 -1
  165. package/dist/vector/fsst-dictionary/stringFsstDictionaryVector.spec.d.ts +0 -1
  166. package/dist/vector/fsst-dictionary/stringFsstDictionaryVector.spec.js +0 -28
  167. package/dist/vector/fsst-dictionary/stringFsstDictionaryVector.spec.js.map +0 -1
  168. package/dist/vector/geometry/zOrderCurve.spec.d.ts +0 -1
  169. package/dist/vector/geometry/zOrderCurve.spec.js +0 -25
  170. package/dist/vector/geometry/zOrderCurve.spec.js.map +0 -1
  171. package/dist/vector/sequence/longSequenceVektor.spec.d.ts +0 -1
  172. package/dist/vector/sequence/longSequenceVektor.spec.js +0 -11
  173. package/dist/vector/sequence/longSequenceVektor.spec.js.map +0 -1
@@ -2,34 +2,12 @@ import { decodeZOrderCurve } from "./zOrderCurve";
2
2
  import { GEOMETRY_TYPE } from "./geometryType";
3
3
  import { VertexBufferType } from "./vertexBufferType";
4
4
  import Point from "@mapbox/point-geometry";
5
- class MvtGeometryFactory {
6
- createPoint(coordinate) {
7
- return [[coordinate]];
8
- }
9
- createMultiPoint(points) {
10
- return points.map((point) => [point]);
11
- }
12
- createLineString(vertices) {
13
- return [vertices];
14
- }
15
- createMultiLineString(lineStrings) {
16
- return lineStrings;
17
- }
18
- createPolygon(shell, rings) {
19
- return [shell].concat(rings);
20
- }
21
- createMultiPolygon(polygons) {
22
- //TODO: check winding order of shell and holes
23
- return polygons.flat();
24
- }
25
- }
26
5
  export function convertGeometryVector(geometryVector) {
27
6
  const geometries = new Array(geometryVector.numGeometries);
28
7
  let partOffsetCounter = 1;
29
8
  let ringOffsetsCounter = 1;
30
9
  let geometryOffsetsCounter = 1;
31
10
  let geometryCounter = 0;
32
- const geometryFactory = new MvtGeometryFactory();
33
11
  let vertexBufferOffset = 0;
34
12
  let vertexOffsetsOffset = 0;
35
13
  const mortonSettings = geometryVector.mortonSettings;
@@ -38,145 +16,70 @@ export function convertGeometryVector(geometryVector) {
38
16
  const partOffsets = topologyVector.partOffsets;
39
17
  const ringOffsets = topologyVector.ringOffsets;
40
18
  const vertexOffsets = geometryVector.vertexOffsets;
19
+ const nonOffset = !vertexOffsets || vertexOffsets.length === 0;
41
20
  const containsPolygon = geometryVector.containsPolygonGeometry();
42
21
  const vertexBuffer = geometryVector.vertexBuffer;
43
22
  for (let i = 0; i < geometryVector.numGeometries; i++) {
44
23
  const geometryType = geometryVector.geometryType(i);
45
- if (geometryType === GEOMETRY_TYPE.POINT) {
46
- if (!vertexOffsets || vertexOffsets.length === 0) {
47
- const x = vertexBuffer[vertexBufferOffset++];
48
- const y = vertexBuffer[vertexBufferOffset++];
49
- const coordinate = new Point(x, y);
50
- geometries[geometryCounter++] = geometryFactory.createPoint(coordinate);
51
- }
52
- else if (geometryVector.vertexBufferType === VertexBufferType.VEC_2) {
53
- const offset = vertexOffsets[vertexOffsetsOffset++] * 2;
54
- const x = vertexBuffer[offset];
55
- const y = vertexBuffer[offset + 1];
56
- const coordinate = new Point(x, y);
57
- geometries[geometryCounter++] = geometryFactory.createPoint(coordinate);
58
- }
59
- else {
60
- const offset = vertexOffsets[vertexOffsetsOffset++];
61
- const mortonCode = vertexBuffer[offset];
62
- const vertex = decodeZOrderCurve(mortonCode, mortonSettings.numBits, mortonSettings.coordinateShift);
63
- const coordinate = new Point(vertex.x, vertex.y);
64
- geometries[geometryCounter++] = geometryFactory.createPoint(coordinate);
65
- }
66
- if (geometryOffsets)
67
- geometryOffsetsCounter++;
68
- if (partOffsets)
69
- partOffsetCounter++;
70
- if (ringOffsets)
71
- ringOffsetsCounter++;
72
- }
73
- else if (geometryType === GEOMETRY_TYPE.MULTIPOINT) {
74
- const numPoints = geometryOffsets[geometryOffsetsCounter] - geometryOffsets[geometryOffsetsCounter - 1];
75
- geometryOffsetsCounter++;
76
- const points = new Array(numPoints);
77
- if (!vertexOffsets || vertexOffsets.length === 0) {
78
- for (let j = 0; j < numPoints; j++) {
79
- const x = vertexBuffer[vertexBufferOffset++];
80
- const y = vertexBuffer[vertexBufferOffset++];
81
- points[j] = new Point(x, y);
82
- }
83
- geometries[geometryCounter++] = geometryFactory.createMultiPoint(points);
84
- }
85
- else {
86
- for (let j = 0; j < numPoints; j++) {
87
- const offset = vertexOffsets[vertexOffsetsOffset++] * 2;
88
- const x = vertexBuffer[offset];
89
- const y = vertexBuffer[offset + 1];
90
- points[j] = new Point(x, y);
91
- }
92
- geometries[geometryCounter++] = geometryFactory.createMultiPoint(points);
93
- }
94
- }
95
- else if (geometryType === GEOMETRY_TYPE.LINESTRING) {
96
- let numVertices = 0;
97
- if (containsPolygon) {
98
- numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];
99
- ringOffsetsCounter++;
100
- }
101
- else {
102
- numVertices = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];
103
- }
104
- partOffsetCounter++;
105
- let vertices;
106
- if (!vertexOffsets || vertexOffsets.length === 0) {
107
- vertices = getLineString(vertexBuffer, vertexBufferOffset, numVertices, false);
108
- vertexBufferOffset += numVertices * 2;
109
- }
110
- else {
111
- vertices =
112
- geometryVector.vertexBufferType === VertexBufferType.VEC_2
113
- ? decodeDictionaryEncodedLineString(vertexBuffer, vertexOffsets, vertexOffsetsOffset, numVertices, false)
114
- : decodeMortonDictionaryEncodedLineString(vertexBuffer, vertexOffsets, vertexOffsetsOffset, numVertices, false, mortonSettings);
115
- vertexOffsetsOffset += numVertices;
116
- }
117
- geometries[geometryCounter++] = geometryFactory.createLineString(vertices);
118
- if (geometryOffsets)
119
- geometryOffsetsCounter++;
120
- }
121
- else if (geometryType === GEOMETRY_TYPE.POLYGON) {
122
- const numRings = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];
123
- partOffsetCounter++;
124
- const rings = new Array(numRings - 1);
125
- let numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];
126
- ringOffsetsCounter++;
127
- if (!vertexOffsets || vertexOffsets.length === 0) {
128
- const shell = getLinearRing(vertexBuffer, vertexBufferOffset, numVertices);
129
- vertexBufferOffset += numVertices * 2;
130
- for (let j = 0; j < rings.length; j++) {
131
- numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];
132
- ringOffsetsCounter++;
133
- rings[j] = getLinearRing(vertexBuffer, vertexBufferOffset, numVertices);
134
- vertexBufferOffset += numVertices * 2;
135
- }
136
- geometries[geometryCounter++] = geometryFactory.createPolygon(shell, rings);
137
- }
138
- else {
139
- const shell = geometryVector.vertexBufferType === VertexBufferType.VEC_2
140
- ? decodeDictionaryEncodedLinearRing(vertexBuffer, vertexOffsets, vertexOffsetsOffset, numVertices)
141
- : decodeMortonDictionaryEncodedLinearRing(vertexBuffer, vertexOffsets, vertexOffsetsOffset, numVertices, geometryFactory, mortonSettings);
142
- vertexOffsetsOffset += numVertices;
143
- for (let j = 0; j < rings.length; j++) {
144
- numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];
145
- ringOffsetsCounter++;
146
- rings[j] =
147
- geometryVector.vertexBufferType === VertexBufferType.VEC_2
148
- ? decodeDictionaryEncodedLinearRing(vertexBuffer, vertexOffsets, vertexOffsetsOffset, numVertices)
149
- : decodeMortonDictionaryEncodedLinearRing(vertexBuffer, vertexOffsets, vertexOffsetsOffset, numVertices, geometryFactory, mortonSettings);
150
- vertexOffsetsOffset += numVertices;
151
- }
152
- geometries[geometryCounter++] = geometryFactory.createPolygon(shell, rings);
153
- }
154
- if (geometryOffsets)
155
- geometryOffsetsCounter++;
156
- }
157
- else if (geometryType === GEOMETRY_TYPE.MULTILINESTRING) {
158
- const numLineStrings = geometryOffsets[geometryOffsetsCounter] - geometryOffsets[geometryOffsetsCounter - 1];
159
- geometryOffsetsCounter++;
160
- const lineStrings = new Array(numLineStrings);
161
- if (!vertexOffsets || vertexOffsets.length === 0) {
162
- for (let j = 0; j < numLineStrings; j++) {
163
- let numVertices = 0;
164
- if (containsPolygon) {
165
- numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];
24
+ switch (geometryType) {
25
+ case GEOMETRY_TYPE.POINT:
26
+ {
27
+ let x;
28
+ let y;
29
+ if (nonOffset) {
30
+ x = vertexBuffer[vertexBufferOffset++];
31
+ y = vertexBuffer[vertexBufferOffset++];
32
+ }
33
+ else if (geometryVector.vertexBufferType === VertexBufferType.MORTON) {
34
+ const offset = vertexOffsets[vertexOffsetsOffset++];
35
+ const mortonCode = vertexBuffer[offset];
36
+ const vertex = decodeZOrderCurve(mortonCode, mortonSettings.numBits, mortonSettings.coordinateShift);
37
+ x = vertex.x;
38
+ y = vertex.y;
39
+ }
40
+ else {
41
+ const offset = vertexOffsets[vertexOffsetsOffset++] * 2;
42
+ x = vertexBuffer[offset];
43
+ y = vertexBuffer[offset + 1];
44
+ }
45
+ geometries[geometryCounter++] = [[new Point(x, y)]];
46
+ if (geometryOffsets)
47
+ geometryOffsetsCounter++;
48
+ if (partOffsets)
49
+ partOffsetCounter++;
50
+ if (ringOffsets)
166
51
  ringOffsetsCounter++;
52
+ }
53
+ break;
54
+ case GEOMETRY_TYPE.MULTIPOINT:
55
+ {
56
+ const numPoints = geometryOffsets[geometryOffsetsCounter] - geometryOffsets[geometryOffsetsCounter - 1];
57
+ geometryOffsetsCounter++;
58
+ const points = new Array(numPoints);
59
+ if (nonOffset) {
60
+ for (let j = 0; j < numPoints; j++) {
61
+ const x = vertexBuffer[vertexBufferOffset++];
62
+ const y = vertexBuffer[vertexBufferOffset++];
63
+ points[j] = new Point(x, y);
64
+ }
167
65
  }
168
66
  else {
169
- numVertices = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];
67
+ for (let j = 0; j < numPoints; j++) {
68
+ const offset = vertexOffsets[vertexOffsetsOffset++] * 2;
69
+ const x = vertexBuffer[offset];
70
+ const y = vertexBuffer[offset + 1];
71
+ points[j] = new Point(x, y);
72
+ }
170
73
  }
171
- partOffsetCounter++;
172
- lineStrings[j] = getLineString(vertexBuffer, vertexBufferOffset, numVertices, false);
173
- vertexBufferOffset += numVertices * 2;
74
+ geometries[geometryCounter++] = points.map((point) => [point]);
75
+ // MULTIPOINT must increment offset counters like POINT does
76
+ partOffsetCounter += numPoints;
77
+ ringOffsetsCounter += numPoints;
174
78
  }
175
- geometries[geometryCounter++] = geometryFactory.createMultiLineString(lineStrings);
176
- }
177
- else {
178
- for (let j = 0; j < numLineStrings; j++) {
179
- let numVertices = 0;
79
+ break;
80
+ case GEOMETRY_TYPE.LINESTRING:
81
+ {
82
+ let numVertices;
180
83
  if (containsPolygon) {
181
84
  numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];
182
85
  ringOffsetsCounter++;
@@ -185,80 +88,133 @@ export function convertGeometryVector(geometryVector) {
185
88
  numVertices = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];
186
89
  }
187
90
  partOffsetCounter++;
188
- const vertices = geometryVector.vertexBufferType === VertexBufferType.VEC_2
189
- ? decodeDictionaryEncodedLineString(vertexBuffer, vertexOffsets, vertexOffsetsOffset, numVertices, false)
190
- : decodeMortonDictionaryEncodedLineString(vertexBuffer, vertexOffsets, vertexOffsetsOffset, numVertices, false, mortonSettings);
191
- lineStrings[j] = vertices;
192
- vertexOffsetsOffset += numVertices;
91
+ let vertices;
92
+ if (nonOffset) {
93
+ vertices = getLineStringOrRing(vertexBuffer, vertexBufferOffset, numVertices, false);
94
+ vertexBufferOffset += numVertices * 2;
95
+ }
96
+ else {
97
+ vertices = decodeDictionaryEncodedLineStringOrRing(geometryVector.vertexBufferType, vertexBuffer, vertexOffsets, vertexOffsetsOffset, numVertices, false, mortonSettings);
98
+ vertexOffsetsOffset += numVertices;
99
+ }
100
+ geometries[geometryCounter++] = [vertices];
101
+ if (geometryOffsets)
102
+ geometryOffsetsCounter++;
193
103
  }
194
- geometries[geometryCounter++] = geometryFactory.createMultiLineString(lineStrings);
195
- }
196
- }
197
- else if (geometryType === GEOMETRY_TYPE.MULTIPOLYGON) {
198
- const numPolygons = geometryOffsets[geometryOffsetsCounter] - geometryOffsets[geometryOffsetsCounter - 1];
199
- geometryOffsetsCounter++;
200
- const polygons = new Array(numPolygons);
201
- let numVertices = 0;
202
- if (!vertexOffsets || vertexOffsets.length === 0) {
203
- for (let j = 0; j < numPolygons; j++) {
104
+ break;
105
+ case GEOMETRY_TYPE.POLYGON:
106
+ {
204
107
  const numRings = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];
205
108
  partOffsetCounter++;
206
109
  const rings = new Array(numRings - 1);
207
- numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];
110
+ let shell;
111
+ let numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];
208
112
  ringOffsetsCounter++;
209
- const shell = getLinearRing(vertexBuffer, vertexBufferOffset, numVertices);
210
- vertexBufferOffset += numVertices * 2;
211
- for (let k = 0; k < rings.length; k++) {
212
- const numRingVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];
213
- ringOffsetsCounter++;
214
- rings[k] = getLinearRing(vertexBuffer, vertexBufferOffset, numRingVertices);
215
- vertexBufferOffset += numRingVertices * 2;
113
+ if (nonOffset) {
114
+ shell = getLineStringOrRing(vertexBuffer, vertexBufferOffset, numVertices, true);
115
+ vertexBufferOffset += numVertices * 2;
116
+ for (let j = 0; j < rings.length; j++) {
117
+ numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];
118
+ ringOffsetsCounter++;
119
+ rings[j] = getLineStringOrRing(vertexBuffer, vertexBufferOffset, numVertices, true);
120
+ vertexBufferOffset += numVertices * 2;
121
+ }
122
+ }
123
+ else {
124
+ shell = decodeDictionaryEncodedLineStringOrRing(geometryVector.vertexBufferType, vertexBuffer, vertexOffsets, vertexOffsetsOffset, numVertices, true, mortonSettings);
125
+ vertexOffsetsOffset += numVertices;
126
+ for (let j = 0; j < rings.length; j++) {
127
+ numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];
128
+ ringOffsetsCounter++;
129
+ rings[j] = decodeDictionaryEncodedLineStringOrRing(geometryVector.vertexBufferType, vertexBuffer, vertexOffsets, vertexOffsetsOffset, numVertices, true, mortonSettings);
130
+ vertexOffsetsOffset += numVertices;
131
+ }
216
132
  }
217
- polygons[j] = geometryFactory.createPolygon(shell, rings);
133
+ geometries[geometryCounter++] = [shell].concat(rings);
134
+ if (geometryOffsets)
135
+ geometryOffsetsCounter++;
218
136
  }
219
- geometries[geometryCounter++] = geometryFactory.createMultiPolygon(polygons);
220
- }
221
- else {
222
- for (let j = 0; j < numPolygons; j++) {
223
- const numRings = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];
224
- partOffsetCounter++;
225
- const rings = new Array(numRings - 1);
226
- numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];
227
- ringOffsetsCounter++;
228
- const shell = geometryVector.vertexBufferType === VertexBufferType.VEC_2
229
- ? decodeDictionaryEncodedLinearRing(vertexBuffer, vertexOffsets, vertexOffsetsOffset, numVertices)
230
- : decodeMortonDictionaryEncodedLinearRing(vertexBuffer, vertexOffsets, vertexOffsetsOffset, numVertices, geometryFactory, mortonSettings);
231
- vertexOffsetsOffset += numVertices;
232
- for (let k = 0; k < rings.length; k++) {
233
- numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];
137
+ break;
138
+ case GEOMETRY_TYPE.MULTILINESTRING:
139
+ {
140
+ const numLineStrings = geometryOffsets[geometryOffsetsCounter] - geometryOffsets[geometryOffsetsCounter - 1];
141
+ geometryOffsetsCounter++;
142
+ const lineStrings = new Array(numLineStrings);
143
+ for (let j = 0; j < numLineStrings; j++) {
144
+ let numVertices;
145
+ if (containsPolygon) {
146
+ numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];
147
+ ringOffsetsCounter++;
148
+ }
149
+ else {
150
+ numVertices = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];
151
+ }
152
+ partOffsetCounter++;
153
+ if (nonOffset) {
154
+ lineStrings[j] = getLineStringOrRing(vertexBuffer, vertexBufferOffset, numVertices, false);
155
+ vertexBufferOffset += numVertices * 2;
156
+ }
157
+ else {
158
+ const vertices = decodeDictionaryEncodedLineStringOrRing(geometryVector.vertexBufferType, vertexBuffer, vertexOffsets, vertexOffsetsOffset, numVertices, false, mortonSettings);
159
+ lineStrings[j] = vertices;
160
+ vertexOffsetsOffset += numVertices;
161
+ }
162
+ }
163
+ geometries[geometryCounter++] = lineStrings;
164
+ }
165
+ break;
166
+ case GEOMETRY_TYPE.MULTIPOLYGON:
167
+ {
168
+ const numPolygons = geometryOffsets[geometryOffsetsCounter] - geometryOffsets[geometryOffsetsCounter - 1];
169
+ geometryOffsetsCounter++;
170
+ const polygons = new Array(numPolygons);
171
+ for (let j = 0; j < numPolygons; j++) {
172
+ const numRings = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];
173
+ partOffsetCounter++;
174
+ let shell;
175
+ const rings = new Array(numRings - 1);
176
+ const numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];
234
177
  ringOffsetsCounter++;
235
- rings[k] =
236
- geometryVector.vertexBufferType === VertexBufferType.VEC_2
237
- ? decodeDictionaryEncodedLinearRing(vertexBuffer, vertexOffsets, vertexOffsetsOffset, numVertices)
238
- : decodeMortonDictionaryEncodedLinearRing(vertexBuffer, vertexOffsets, vertexOffsetsOffset, numVertices, geometryFactory, mortonSettings);
239
- vertexOffsetsOffset += numVertices;
178
+ if (nonOffset) {
179
+ shell = getLineStringOrRing(vertexBuffer, vertexBufferOffset, numVertices, true);
180
+ vertexBufferOffset += numVertices * 2;
181
+ }
182
+ else {
183
+ shell = decodeDictionaryEncodedLineStringOrRing(geometryVector.vertexBufferType, vertexBuffer, vertexOffsets, vertexOffsetsOffset, numVertices, true, mortonSettings);
184
+ vertexOffsetsOffset += numVertices;
185
+ }
186
+ for (let k = 0; k < rings.length; k++) {
187
+ const numRingVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];
188
+ ringOffsetsCounter++;
189
+ if (nonOffset) {
190
+ rings[k] = getLineStringOrRing(vertexBuffer, vertexBufferOffset, numRingVertices, true);
191
+ vertexBufferOffset += numRingVertices * 2;
192
+ }
193
+ else {
194
+ rings[k] = decodeDictionaryEncodedLineStringOrRing(geometryVector.vertexBufferType, vertexBuffer, vertexOffsets, vertexOffsetsOffset, numRingVertices, true, mortonSettings);
195
+ vertexOffsetsOffset += numRingVertices;
196
+ }
197
+ }
198
+ polygons[j] = [shell].concat(rings);
240
199
  }
241
- polygons[j] = geometryFactory.createPolygon(shell, rings);
200
+ geometries[geometryCounter++] = polygons.flat();
242
201
  }
243
- geometries[geometryCounter++] = geometryFactory.createMultiPolygon(polygons);
244
- }
245
- }
246
- else {
247
- throw new Error("The specified geometry type is currently not supported.");
202
+ break;
203
+ default:
204
+ throw new Error("The specified geometry type is currently not supported.");
248
205
  }
249
206
  }
250
207
  return geometries;
251
208
  }
252
- function getLinearRing(vertexBuffer, startIndex, numVertices) {
253
- return getLineString(vertexBuffer, startIndex, numVertices, true);
254
- }
255
- function decodeDictionaryEncodedLinearRing(vertexBuffer, vertexOffsets, vertexOffset, numVertices) {
256
- return decodeDictionaryEncodedLineString(vertexBuffer, vertexOffsets, vertexOffset, numVertices, true);
257
- }
258
- function decodeMortonDictionaryEncodedLinearRing(vertexBuffer, vertexOffsets, vertexOffset, numVertices, geometryFactory, mortonSettings) {
259
- return decodeMortonDictionaryEncodedLineString(vertexBuffer, vertexOffsets, vertexOffset, numVertices, true, mortonSettings);
209
+ function decodeDictionaryEncodedLineStringOrRing(vertexBufferType, vertexBuffer, vertexOffsets, vertexOffset, numVertices, closeLineString, mortonSettings) {
210
+ if (vertexBufferType === VertexBufferType.MORTON) {
211
+ return decodeMortonDictionaryEncodedLineString(vertexBuffer, vertexOffsets, vertexOffset, numVertices, closeLineString, mortonSettings);
212
+ }
213
+ else {
214
+ return decodeDictionaryEncodedLineString(vertexBuffer, vertexOffsets, vertexOffset, numVertices, closeLineString);
215
+ }
260
216
  }
261
- function getLineString(vertexBuffer, startIndex, numVertices, closeLineString) {
217
+ function getLineStringOrRing(vertexBuffer, startIndex, numVertices, closeLineString) {
262
218
  const vertices = new Array(closeLineString ? numVertices + 1 : numVertices);
263
219
  for (let i = 0; i < numVertices * 2; i += 2) {
264
220
  const x = vertexBuffer[startIndex + i];
@@ -1 +1 @@
1
- {"version":3,"file":"geometryVectorConverter.js","sourceRoot":"","sources":["../../../src/vector/geometry/geometryVectorConverter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,MAAM,wBAAwB,CAAC;AAE3C,MAAM,kBAAkB;IACpB,WAAW,CAAC,UAAiB;QACzB,OAAO,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;IAC1B,CAAC;IAED,gBAAgB,CAAC,MAAe;QAC5B,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1C,CAAC;IAED,gBAAgB,CAAC,QAAiB;QAC9B,OAAO,CAAC,QAAQ,CAAC,CAAC;IACtB,CAAC;IAED,qBAAqB,CAAC,WAAgC;QAClD,OAAO,WAAW,CAAC;IACvB,CAAC;IAED,aAAa,CAAC,KAAc,EAAE,KAA0B;QACpD,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAED,kBAAkB,CAAC,QAA+B;QAC9C,8CAA8C;QAC9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CAAC,CAAC;IAChD,CAAC;IACD,IAAI,eAAe,EAAE,CAAC;QAClB,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC","sourcesContent":["import { type GeometryVector, type MortonSettings, type CoordinatesArray } from \"./geometryVector\";\nimport { decodeZOrderCurve } from \"./zOrderCurve\";\nimport { GEOMETRY_TYPE } from \"./geometryType\";\nimport { VertexBufferType } from \"./vertexBufferType\";\nimport Point from \"@mapbox/point-geometry\";\n\nclass MvtGeometryFactory {\n createPoint(coordinate: Point): CoordinatesArray {\n return [[coordinate]];\n }\n\n createMultiPoint(points: Point[]): CoordinatesArray {\n return points.map((point) => [point]);\n }\n\n createLineString(vertices: Point[]): CoordinatesArray {\n return [vertices];\n }\n\n createMultiLineString(lineStrings: Array<Array<Point>>): CoordinatesArray {\n return lineStrings;\n }\n\n createPolygon(shell: Point[], rings: Array<Array<Point>>): CoordinatesArray {\n return [shell].concat(rings);\n }\n\n createMultiPolygon(polygons: Array<Array<Point>>[]): CoordinatesArray {\n //TODO: check winding order of shell and holes\n return polygons.flat();\n }\n}\n\nexport function convertGeometryVector(geometryVector: GeometryVector): CoordinatesArray[] {\n const geometries: CoordinatesArray[] = new Array(geometryVector.numGeometries);\n let partOffsetCounter = 1;\n let ringOffsetsCounter = 1;\n let geometryOffsetsCounter = 1;\n let geometryCounter = 0;\n const geometryFactory = new MvtGeometryFactory();\n let vertexBufferOffset = 0;\n let vertexOffsetsOffset = 0;\n\n const mortonSettings = geometryVector.mortonSettings;\n const topologyVector = geometryVector.topologyVector;\n const geometryOffsets = topologyVector.geometryOffsets;\n const partOffsets = topologyVector.partOffsets;\n const ringOffsets = topologyVector.ringOffsets;\n const vertexOffsets = geometryVector.vertexOffsets;\n\n const containsPolygon = geometryVector.containsPolygonGeometry();\n const vertexBuffer = geometryVector.vertexBuffer;\n\n for (let i = 0; i < geometryVector.numGeometries; i++) {\n const geometryType = geometryVector.geometryType(i);\n if (geometryType === GEOMETRY_TYPE.POINT) {\n if (!vertexOffsets || vertexOffsets.length === 0) {\n const x = vertexBuffer[vertexBufferOffset++];\n const y = vertexBuffer[vertexBufferOffset++];\n const coordinate = new Point(x, y);\n geometries[geometryCounter++] = geometryFactory.createPoint(coordinate);\n } else if (geometryVector.vertexBufferType === VertexBufferType.VEC_2) {\n const offset = vertexOffsets[vertexOffsetsOffset++] * 2;\n const x = vertexBuffer[offset];\n const y = vertexBuffer[offset + 1];\n const coordinate = new Point(x, y);\n geometries[geometryCounter++] = geometryFactory.createPoint(coordinate);\n } else {\n const offset = vertexOffsets[vertexOffsetsOffset++];\n const mortonCode = vertexBuffer[offset];\n const vertex = decodeZOrderCurve(mortonCode, mortonSettings.numBits, mortonSettings.coordinateShift);\n const coordinate = new Point(vertex.x, vertex.y);\n geometries[geometryCounter++] = geometryFactory.createPoint(coordinate);\n }\n\n if (geometryOffsets) geometryOffsetsCounter++;\n if (partOffsets) partOffsetCounter++;\n if (ringOffsets) ringOffsetsCounter++;\n } else if (geometryType === GEOMETRY_TYPE.MULTIPOINT) {\n const numPoints = geometryOffsets[geometryOffsetsCounter] - geometryOffsets[geometryOffsetsCounter - 1];\n geometryOffsetsCounter++;\n const points: Point[] = new Array(numPoints);\n if (!vertexOffsets || vertexOffsets.length === 0) {\n for (let j = 0; j < numPoints; j++) {\n const x = vertexBuffer[vertexBufferOffset++];\n const y = vertexBuffer[vertexBufferOffset++];\n points[j] = new Point(x, y);\n }\n geometries[geometryCounter++] = geometryFactory.createMultiPoint(points);\n } else {\n for (let j = 0; j < numPoints; j++) {\n const offset = vertexOffsets[vertexOffsetsOffset++] * 2;\n const x = vertexBuffer[offset];\n const y = vertexBuffer[offset + 1];\n points[j] = new Point(x, y);\n }\n geometries[geometryCounter++] = geometryFactory.createMultiPoint(points);\n }\n } else if (geometryType === GEOMETRY_TYPE.LINESTRING) {\n let numVertices = 0;\n if (containsPolygon) {\n numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n } else {\n numVertices = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];\n }\n partOffsetCounter++;\n\n let vertices: Point[];\n if (!vertexOffsets || vertexOffsets.length === 0) {\n vertices = getLineString(vertexBuffer, vertexBufferOffset, numVertices, false);\n vertexBufferOffset += numVertices * 2;\n } else {\n vertices =\n geometryVector.vertexBufferType === VertexBufferType.VEC_2\n ? decodeDictionaryEncodedLineString(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n false,\n )\n : decodeMortonDictionaryEncodedLineString(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n false,\n mortonSettings,\n );\n vertexOffsetsOffset += numVertices;\n }\n\n geometries[geometryCounter++] = geometryFactory.createLineString(vertices);\n\n if (geometryOffsets) geometryOffsetsCounter++;\n } else if (geometryType === GEOMETRY_TYPE.POLYGON) {\n const numRings = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];\n partOffsetCounter++;\n const rings: CoordinatesArray = new Array(numRings - 1);\n let numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n\n if (!vertexOffsets || vertexOffsets.length === 0) {\n const shell = getLinearRing(vertexBuffer, vertexBufferOffset, numVertices);\n vertexBufferOffset += numVertices * 2;\n for (let j = 0; j < rings.length; j++) {\n numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n rings[j] = getLinearRing(vertexBuffer, vertexBufferOffset, numVertices);\n vertexBufferOffset += numVertices * 2;\n }\n geometries[geometryCounter++] = geometryFactory.createPolygon(shell, rings);\n } else {\n const shell =\n geometryVector.vertexBufferType === VertexBufferType.VEC_2\n ? decodeDictionaryEncodedLinearRing(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n )\n : decodeMortonDictionaryEncodedLinearRing(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n geometryFactory,\n mortonSettings,\n );\n vertexOffsetsOffset += numVertices;\n for (let j = 0; j < rings.length; j++) {\n numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n rings[j] =\n geometryVector.vertexBufferType === VertexBufferType.VEC_2\n ? decodeDictionaryEncodedLinearRing(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n )\n : decodeMortonDictionaryEncodedLinearRing(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n geometryFactory,\n mortonSettings,\n );\n vertexOffsetsOffset += numVertices;\n }\n geometries[geometryCounter++] = geometryFactory.createPolygon(shell, rings);\n }\n\n if (geometryOffsets) geometryOffsetsCounter++;\n } else if (geometryType === GEOMETRY_TYPE.MULTILINESTRING) {\n const numLineStrings =\n geometryOffsets[geometryOffsetsCounter] - geometryOffsets[geometryOffsetsCounter - 1];\n geometryOffsetsCounter++;\n const lineStrings: CoordinatesArray = new Array(numLineStrings);\n if (!vertexOffsets || vertexOffsets.length === 0) {\n for (let j = 0; j < numLineStrings; j++) {\n let numVertices = 0;\n if (containsPolygon) {\n numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n } else {\n numVertices = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];\n }\n partOffsetCounter++;\n\n lineStrings[j] = getLineString(vertexBuffer, vertexBufferOffset, numVertices, false);\n vertexBufferOffset += numVertices * 2;\n }\n geometries[geometryCounter++] = geometryFactory.createMultiLineString(lineStrings);\n } else {\n for (let j = 0; j < numLineStrings; j++) {\n let numVertices = 0;\n if (containsPolygon) {\n numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n } else {\n numVertices = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];\n }\n partOffsetCounter++;\n\n const vertices =\n geometryVector.vertexBufferType === VertexBufferType.VEC_2\n ? decodeDictionaryEncodedLineString(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n false,\n )\n : decodeMortonDictionaryEncodedLineString(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n false,\n mortonSettings,\n );\n lineStrings[j] = vertices;\n vertexOffsetsOffset += numVertices;\n }\n geometries[geometryCounter++] = geometryFactory.createMultiLineString(lineStrings);\n }\n } else if (geometryType === GEOMETRY_TYPE.MULTIPOLYGON) {\n const numPolygons = geometryOffsets[geometryOffsetsCounter] - geometryOffsets[geometryOffsetsCounter - 1];\n geometryOffsetsCounter++;\n const polygons: CoordinatesArray[] = new Array(numPolygons);\n let numVertices = 0;\n if (!vertexOffsets || vertexOffsets.length === 0) {\n for (let j = 0; j < numPolygons; j++) {\n const numRings = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];\n partOffsetCounter++;\n const rings: CoordinatesArray = new Array(numRings - 1);\n numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n const shell = getLinearRing(vertexBuffer, vertexBufferOffset, numVertices);\n vertexBufferOffset += numVertices * 2;\n for (let k = 0; k < rings.length; k++) {\n const numRingVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n rings[k] = getLinearRing(vertexBuffer, vertexBufferOffset, numRingVertices);\n vertexBufferOffset += numRingVertices * 2;\n }\n\n polygons[j] = geometryFactory.createPolygon(shell, rings);\n }\n geometries[geometryCounter++] = geometryFactory.createMultiPolygon(polygons);\n } else {\n for (let j = 0; j < numPolygons; j++) {\n const numRings = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];\n partOffsetCounter++;\n const rings: CoordinatesArray = new Array(numRings - 1);\n numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n const shell =\n geometryVector.vertexBufferType === VertexBufferType.VEC_2\n ? decodeDictionaryEncodedLinearRing(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n )\n : decodeMortonDictionaryEncodedLinearRing(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n geometryFactory,\n mortonSettings,\n );\n vertexOffsetsOffset += numVertices;\n for (let k = 0; k < rings.length; k++) {\n numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n rings[k] =\n geometryVector.vertexBufferType === VertexBufferType.VEC_2\n ? decodeDictionaryEncodedLinearRing(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n )\n : decodeMortonDictionaryEncodedLinearRing(\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n geometryFactory,\n mortonSettings,\n );\n vertexOffsetsOffset += numVertices;\n }\n\n polygons[j] = geometryFactory.createPolygon(shell, rings);\n }\n geometries[geometryCounter++] = geometryFactory.createMultiPolygon(polygons);\n }\n } else {\n throw new Error(\"The specified geometry type is currently not supported.\");\n }\n }\n\n return geometries;\n}\n\nfunction getLinearRing(vertexBuffer: Int32Array, startIndex: number, numVertices: number): Point[] {\n return getLineString(vertexBuffer, startIndex, numVertices, true);\n}\n\nfunction decodeDictionaryEncodedLinearRing(\n vertexBuffer: Int32Array,\n vertexOffsets: Int32Array,\n vertexOffset: number,\n numVertices: number,\n): Point[] {\n return decodeDictionaryEncodedLineString(vertexBuffer, vertexOffsets, vertexOffset, numVertices, true);\n}\n\nfunction decodeMortonDictionaryEncodedLinearRing(\n vertexBuffer: Int32Array,\n vertexOffsets: Int32Array,\n vertexOffset: number,\n numVertices: number,\n geometryFactory: MvtGeometryFactory,\n mortonSettings: MortonSettings,\n): Point[] {\n return decodeMortonDictionaryEncodedLineString(\n vertexBuffer,\n vertexOffsets,\n vertexOffset,\n numVertices,\n true,\n mortonSettings,\n );\n}\n\nfunction getLineString(\n vertexBuffer: Int32Array,\n startIndex: number,\n numVertices: number,\n closeLineString: boolean,\n): Point[] {\n const vertices: Point[] = new Array(closeLineString ? numVertices + 1 : numVertices);\n for (let i = 0; i < numVertices * 2; i += 2) {\n const x = vertexBuffer[startIndex + i];\n const y = vertexBuffer[startIndex + i + 1];\n vertices[i / 2] = new Point(x, y);\n }\n\n if (closeLineString) {\n vertices[vertices.length - 1] = vertices[0];\n }\n return vertices;\n}\n\nfunction decodeDictionaryEncodedLineString(\n vertexBuffer: Int32Array,\n vertexOffsets: Int32Array,\n vertexOffset: number,\n numVertices: number,\n closeLineString: boolean,\n): Point[] {\n const vertices: Point[] = new Array(closeLineString ? numVertices + 1 : numVertices);\n for (let i = 0; i < numVertices * 2; i += 2) {\n const offset = vertexOffsets[vertexOffset + i / 2] * 2;\n const x = vertexBuffer[offset];\n const y = vertexBuffer[offset + 1];\n vertices[i / 2] = new Point(x, y);\n }\n\n if (closeLineString) {\n vertices[vertices.length - 1] = vertices[0];\n }\n return vertices;\n}\n\nfunction decodeMortonDictionaryEncodedLineString(\n vertexBuffer: Int32Array,\n vertexOffsets: Int32Array,\n vertexOffset: number,\n numVertices: number,\n closeLineString: boolean,\n mortonSettings: MortonSettings,\n): Point[] {\n const vertices: Point[] = new Array(closeLineString ? numVertices + 1 : numVertices);\n for (let i = 0; i < numVertices; i++) {\n const offset = vertexOffsets[vertexOffset + i];\n const mortonEncodedVertex = vertexBuffer[offset];\n const vertex = decodeZOrderCurve(mortonEncodedVertex, mortonSettings.numBits, mortonSettings.coordinateShift);\n vertices[i] = new Point(vertex.x, vertex.y);\n }\n if (closeLineString) {\n vertices[vertices.length - 1] = vertices[0];\n }\n\n return vertices;\n}\n"]}
1
+ {"version":3,"file":"geometryVectorConverter.js","sourceRoot":"","sources":["../../../src/vector/geomet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CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC","sourcesContent":["import type { GeometryVector, MortonSettings, CoordinatesArray } from \"./geometryVector\";\nimport { decodeZOrderCurve } from \"./zOrderCurve\";\nimport { GEOMETRY_TYPE } from \"./geometryType\";\nimport { VertexBufferType } from \"./vertexBufferType\";\nimport Point from \"@mapbox/point-geometry\";\n\nexport function convertGeometryVector(geometryVector: GeometryVector): CoordinatesArray[] {\n const geometries: CoordinatesArray[] = new Array(geometryVector.numGeometries);\n let partOffsetCounter = 1;\n let ringOffsetsCounter = 1;\n let geometryOffsetsCounter = 1;\n let geometryCounter = 0;\n let vertexBufferOffset = 0;\n let vertexOffsetsOffset = 0;\n\n const mortonSettings = geometryVector.mortonSettings;\n const topologyVector = geometryVector.topologyVector;\n const geometryOffsets = topologyVector.geometryOffsets;\n const partOffsets = topologyVector.partOffsets;\n const ringOffsets = topologyVector.ringOffsets;\n const vertexOffsets = geometryVector.vertexOffsets;\n const nonOffset = !vertexOffsets || vertexOffsets.length === 0;\n\n const containsPolygon = geometryVector.containsPolygonGeometry();\n const vertexBuffer = geometryVector.vertexBuffer;\n\n for (let i = 0; i < geometryVector.numGeometries; i++) {\n const geometryType = geometryVector.geometryType(i);\n switch (geometryType) {\n case GEOMETRY_TYPE.POINT:\n {\n let x: number;\n let y: number;\n if (nonOffset) {\n x = vertexBuffer[vertexBufferOffset++];\n y = vertexBuffer[vertexBufferOffset++];\n } else if (geometryVector.vertexBufferType === VertexBufferType.MORTON) {\n const offset = vertexOffsets[vertexOffsetsOffset++];\n const mortonCode = vertexBuffer[offset];\n const vertex = decodeZOrderCurve(\n mortonCode,\n mortonSettings.numBits,\n mortonSettings.coordinateShift,\n );\n x = vertex.x;\n y = vertex.y;\n } else {\n const offset = vertexOffsets[vertexOffsetsOffset++] * 2;\n x = vertexBuffer[offset];\n y = vertexBuffer[offset + 1];\n }\n geometries[geometryCounter++] = [[new Point(x, y)]];\n if (geometryOffsets) geometryOffsetsCounter++;\n if (partOffsets) partOffsetCounter++;\n if (ringOffsets) ringOffsetsCounter++;\n }\n break;\n case GEOMETRY_TYPE.MULTIPOINT:\n {\n const numPoints =\n geometryOffsets[geometryOffsetsCounter] - geometryOffsets[geometryOffsetsCounter - 1];\n geometryOffsetsCounter++;\n const points: Point[] = new Array(numPoints);\n if (nonOffset) {\n for (let j = 0; j < numPoints; j++) {\n const x = vertexBuffer[vertexBufferOffset++];\n const y = vertexBuffer[vertexBufferOffset++];\n points[j] = new Point(x, y);\n }\n } else {\n for (let j = 0; j < numPoints; j++) {\n const offset = vertexOffsets[vertexOffsetsOffset++] * 2;\n const x = vertexBuffer[offset];\n const y = vertexBuffer[offset + 1];\n points[j] = new Point(x, y);\n }\n }\n geometries[geometryCounter++] = points.map((point) => [point]);\n // MULTIPOINT must increment offset counters like POINT does\n partOffsetCounter += numPoints;\n ringOffsetsCounter += numPoints;\n }\n break;\n case GEOMETRY_TYPE.LINESTRING:\n {\n let numVertices: number;\n if (containsPolygon) {\n numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n } else {\n numVertices = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];\n }\n partOffsetCounter++;\n\n let vertices: Point[];\n if (nonOffset) {\n vertices = getLineStringOrRing(vertexBuffer, vertexBufferOffset, numVertices, false);\n vertexBufferOffset += numVertices * 2;\n } else {\n vertices = decodeDictionaryEncodedLineStringOrRing(\n geometryVector.vertexBufferType,\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n false,\n mortonSettings,\n );\n vertexOffsetsOffset += numVertices;\n }\n\n geometries[geometryCounter++] = [vertices];\n\n if (geometryOffsets) geometryOffsetsCounter++;\n }\n break;\n case GEOMETRY_TYPE.POLYGON:\n {\n const numRings = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];\n partOffsetCounter++;\n const rings: CoordinatesArray = new Array(numRings - 1);\n let shell: Point[];\n let numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n\n if (nonOffset) {\n shell = getLineStringOrRing(vertexBuffer, vertexBufferOffset, numVertices, true);\n vertexBufferOffset += numVertices * 2;\n for (let j = 0; j < rings.length; j++) {\n numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n rings[j] = getLineStringOrRing(vertexBuffer, vertexBufferOffset, numVertices, true);\n vertexBufferOffset += numVertices * 2;\n }\n } else {\n shell = decodeDictionaryEncodedLineStringOrRing(\n geometryVector.vertexBufferType,\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n true,\n mortonSettings,\n );\n vertexOffsetsOffset += numVertices;\n for (let j = 0; j < rings.length; j++) {\n numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n rings[j] = decodeDictionaryEncodedLineStringOrRing(\n geometryVector.vertexBufferType,\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n true,\n mortonSettings,\n );\n vertexOffsetsOffset += numVertices;\n }\n }\n geometries[geometryCounter++] = [shell].concat(rings);\n if (geometryOffsets) geometryOffsetsCounter++;\n }\n break;\n case GEOMETRY_TYPE.MULTILINESTRING:\n {\n const numLineStrings =\n geometryOffsets[geometryOffsetsCounter] - geometryOffsets[geometryOffsetsCounter - 1];\n geometryOffsetsCounter++;\n const lineStrings: CoordinatesArray = new Array(numLineStrings);\n for (let j = 0; j < numLineStrings; j++) {\n let numVertices: number;\n if (containsPolygon) {\n numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n } else {\n numVertices = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];\n }\n partOffsetCounter++;\n if (nonOffset) {\n lineStrings[j] = getLineStringOrRing(vertexBuffer, vertexBufferOffset, numVertices, false);\n vertexBufferOffset += numVertices * 2;\n } else {\n const vertices = decodeDictionaryEncodedLineStringOrRing(\n geometryVector.vertexBufferType,\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n false,\n mortonSettings,\n );\n lineStrings[j] = vertices;\n vertexOffsetsOffset += numVertices;\n }\n }\n geometries[geometryCounter++] = lineStrings;\n }\n break;\n case GEOMETRY_TYPE.MULTIPOLYGON:\n {\n const numPolygons =\n geometryOffsets[geometryOffsetsCounter] - geometryOffsets[geometryOffsetsCounter - 1];\n geometryOffsetsCounter++;\n const polygons: CoordinatesArray[] = new Array(numPolygons);\n for (let j = 0; j < numPolygons; j++) {\n const numRings = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];\n partOffsetCounter++;\n let shell: Point[];\n const rings: CoordinatesArray = new Array(numRings - 1);\n const numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n if (nonOffset) {\n shell = getLineStringOrRing(vertexBuffer, vertexBufferOffset, numVertices, true);\n vertexBufferOffset += numVertices * 2;\n } else {\n shell = decodeDictionaryEncodedLineStringOrRing(\n geometryVector.vertexBufferType,\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numVertices,\n true,\n mortonSettings,\n );\n vertexOffsetsOffset += numVertices;\n }\n for (let k = 0; k < rings.length; k++) {\n const numRingVertices =\n ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];\n ringOffsetsCounter++;\n if (nonOffset) {\n rings[k] = getLineStringOrRing(vertexBuffer, vertexBufferOffset, numRingVertices, true);\n vertexBufferOffset += numRingVertices * 2;\n } else {\n rings[k] = decodeDictionaryEncodedLineStringOrRing(\n geometryVector.vertexBufferType,\n vertexBuffer,\n vertexOffsets,\n vertexOffsetsOffset,\n numRingVertices,\n true,\n mortonSettings,\n );\n vertexOffsetsOffset += numRingVertices;\n }\n }\n polygons[j] = [shell].concat(rings);\n }\n geometries[geometryCounter++] = polygons.flat();\n }\n break;\n default:\n throw new Error(\"The specified geometry type is currently not supported.\");\n }\n }\n\n return geometries;\n}\n\nfunction decodeDictionaryEncodedLineStringOrRing(\n vertexBufferType: VertexBufferType,\n vertexBuffer: Int32Array,\n vertexOffsets: Int32Array,\n vertexOffset: number,\n numVertices: number,\n closeLineString: boolean,\n mortonSettings: MortonSettings,\n): Point[] {\n if (vertexBufferType === VertexBufferType.MORTON) {\n return decodeMortonDictionaryEncodedLineString(\n vertexBuffer,\n vertexOffsets,\n vertexOffset,\n numVertices,\n closeLineString,\n mortonSettings,\n );\n } else {\n return decodeDictionaryEncodedLineString(\n vertexBuffer,\n vertexOffsets,\n vertexOffset,\n numVertices,\n closeLineString,\n );\n }\n}\n\nfunction getLineStringOrRing(\n vertexBuffer: Int32Array,\n startIndex: number,\n numVertices: number,\n closeLineString: boolean,\n): Point[] {\n const vertices: Point[] = new Array(closeLineString ? numVertices + 1 : numVertices);\n for (let i = 0; i < numVertices * 2; i += 2) {\n const x = vertexBuffer[startIndex + i];\n const y = vertexBuffer[startIndex + i + 1];\n vertices[i / 2] = new Point(x, y);\n }\n\n if (closeLineString) {\n vertices[vertices.length - 1] = vertices[0];\n }\n return vertices;\n}\n\nfunction decodeDictionaryEncodedLineString(\n vertexBuffer: Int32Array,\n vertexOffsets: Int32Array,\n vertexOffset: number,\n numVertices: number,\n closeLineString: boolean,\n): Point[] {\n const vertices: Point[] = new Array(closeLineString ? numVertices + 1 : numVertices);\n for (let i = 0; i < numVertices * 2; i += 2) {\n const offset = vertexOffsets[vertexOffset + i / 2] * 2;\n const x = vertexBuffer[offset];\n const y = vertexBuffer[offset + 1];\n vertices[i / 2] = new Point(x, y);\n }\n\n if (closeLineString) {\n vertices[vertices.length - 1] = vertices[0];\n }\n return vertices;\n}\n\nfunction decodeMortonDictionaryEncodedLineString(\n vertexBuffer: Int32Array,\n vertexOffsets: Int32Array,\n vertexOffset: number,\n numVertices: number,\n closeLineString: boolean,\n mortonSettings: MortonSettings,\n): Point[] {\n const vertices: Point[] = new Array(closeLineString ? numVertices + 1 : numVertices);\n for (let i = 0; i < numVertices; i++) {\n const offset = vertexOffsets[vertexOffset + i];\n const mortonEncodedVertex = vertexBuffer[offset];\n const vertex = decodeZOrderCurve(mortonEncodedVertex, mortonSettings.numBits, mortonSettings.coordinateShift);\n vertices[i] = new Point(vertex.x, vertex.y);\n }\n if (closeLineString) {\n vertices[vertices.length - 1] = vertices[0];\n }\n\n return vertices;\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { type CoordinatesArray } from "./geometryVector";
2
- import type TopologyVector from "./topologyVector";
1
+ import type { CoordinatesArray } from "./geometryVector";
2
+ import type { TopologyVector } from "./topologyVector";
3
3
  export declare abstract class GpuVector implements Iterable<CoordinatesArray> {
4
4
  private readonly _triangleOffsets;
5
5
  private readonly _indexBuffer;