maplibre-gl 6.4.1 → 6.5.0
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.
- package/dist/maplibre-gl-dev.mjs +254 -201
- package/dist/maplibre-gl-dev.mjs.map +1 -1
- package/dist/maplibre-gl-shared-dev.mjs +696 -335
- package/dist/maplibre-gl-shared-dev.mjs.map +1 -1
- package/dist/maplibre-gl-shared.mjs +2 -2
- package/dist/maplibre-gl-shared.mjs.map +1 -1
- package/dist/maplibre-gl-worker-dev.mjs +1 -1
- package/dist/maplibre-gl-worker.mjs +1 -1
- package/dist/maplibre-gl.d.ts +72 -3
- package/dist/maplibre-gl.mjs +15 -15
- package/dist/maplibre-gl.mjs.map +1 -1
- package/package.json +5 -5
- package/src/geo/projection/globe_utils.ts +2 -1
- package/src/geo/projection/vertical_perspective_camera_helper.test.ts +52 -0
- package/src/geo/projection/vertical_perspective_camera_helper.ts +2 -1
- package/src/index.ts +2 -1
- package/src/shaders/glsl/raster.vertex.glsl +20 -3
- package/src/shaders/glsl/raster.vertex.glsl.g.ts +1 -1
- package/src/source/image_source.test.ts +160 -30
- package/src/source/image_source.ts +170 -74
- package/src/webgl/draw/draw_raster.ts +12 -10
- package/src/webgl/program/raster_program.ts +11 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MapLibre GL JS
|
|
3
|
-
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.
|
|
3
|
+
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.5.0/LICENSE.txt
|
|
4
4
|
*/
|
|
5
5
|
//#region \0rolldown/runtime.js
|
|
6
6
|
var __create = Object.create;
|
|
@@ -25996,8 +25996,8 @@ var SequenceVector = class extends Vector {
|
|
|
25996
25996
|
//#endregion
|
|
25997
25997
|
//#region node_modules/@maplibre/mlt/dist/vector/sequence/int32SequenceVector.js
|
|
25998
25998
|
var Int32SequenceVector = class extends SequenceVector {
|
|
25999
|
-
constructor(name, baseValue, delta, size) {
|
|
26000
|
-
super(name, Int32Array.of(baseValue), delta, size);
|
|
25999
|
+
constructor(name, baseValue, delta, size, isSigned) {
|
|
26000
|
+
super(name, isSigned ? Int32Array.of(baseValue) : Uint32Array.of(baseValue), delta, size);
|
|
26001
26001
|
}
|
|
26002
26002
|
getValueFromBuffer(index) {
|
|
26003
26003
|
return this.dataBuffer[0] + index * this.delta;
|
|
@@ -26034,10 +26034,10 @@ var FeatureTable = class {
|
|
|
26034
26034
|
return this._geometryVector;
|
|
26035
26035
|
}
|
|
26036
26036
|
get propertyVectors() {
|
|
26037
|
-
return this._propertyVectors;
|
|
26037
|
+
return this._propertyVectors ?? [];
|
|
26038
26038
|
}
|
|
26039
26039
|
getPropertyVector(name) {
|
|
26040
|
-
if (!this.propertyVectorsMap) this.propertyVectorsMap = new Map(this.
|
|
26040
|
+
if (!this.propertyVectorsMap) this.propertyVectorsMap = new Map(this.propertyVectors.map((vector) => [vector.name, vector]));
|
|
26041
26041
|
return this.propertyVectorsMap.get(name);
|
|
26042
26042
|
}
|
|
26043
26043
|
get numFeatures() {
|
|
@@ -26056,7 +26056,7 @@ var FeatureTable = class {
|
|
|
26056
26056
|
let id;
|
|
26057
26057
|
if (this.idVector) {
|
|
26058
26058
|
const idValue = this.idVector.getValue(i);
|
|
26059
|
-
id = this.containsMaxSafeIntegerValues(this.idVector)
|
|
26059
|
+
if (idValue !== null) id = this.containsMaxSafeIntegerValues(this.idVector) ? Number(idValue) : idValue;
|
|
26060
26060
|
}
|
|
26061
26061
|
const geometry = {
|
|
26062
26062
|
coordinates: geometries[i],
|
|
@@ -26101,7 +26101,8 @@ const ScalarType = {
|
|
|
26101
26101
|
};
|
|
26102
26102
|
const ComplexType = {
|
|
26103
26103
|
GEOMETRY: 0,
|
|
26104
|
-
STRUCT: 1
|
|
26104
|
+
STRUCT: 1,
|
|
26105
|
+
MAP: 2
|
|
26105
26106
|
};
|
|
26106
26107
|
const LogicalScalarType = { ID: 0 };
|
|
26107
26108
|
//#endregion
|
|
@@ -28264,6 +28265,130 @@ function unpackNullableBoolean(dataStream, dataStreamSize, presentBits) {
|
|
|
28264
28265
|
return result.getBuffer();
|
|
28265
28266
|
}
|
|
28266
28267
|
//#endregion
|
|
28268
|
+
//#region node_modules/@maplibre/mlt/dist/decoding/decodingUtils.js
|
|
28269
|
+
function skipColumn(numStreams, tile, offset) {
|
|
28270
|
+
for (let i = 0; i < numStreams; i++) {
|
|
28271
|
+
const streamMetadata = decodeStreamMetadata(tile, offset);
|
|
28272
|
+
offset.add(streamMetadata.byteLength);
|
|
28273
|
+
}
|
|
28274
|
+
}
|
|
28275
|
+
function decodeBooleanRle(buffer, numBooleans, byteLength, pos, nullabilityBuffer) {
|
|
28276
|
+
const values = decodeByteRle(buffer, Math.ceil(numBooleans / 8), byteLength, pos);
|
|
28277
|
+
if (nullabilityBuffer) return unpackNullableBoolean(values, numBooleans, nullabilityBuffer);
|
|
28278
|
+
return values;
|
|
28279
|
+
}
|
|
28280
|
+
function decodeByteRle(buffer, numBytes, byteLength, pos) {
|
|
28281
|
+
const values = new Uint8Array(numBytes);
|
|
28282
|
+
let valueOffset = 0;
|
|
28283
|
+
const streamEndPos = pos.get() + byteLength;
|
|
28284
|
+
while (valueOffset < numBytes) {
|
|
28285
|
+
if (pos.get() >= streamEndPos) break;
|
|
28286
|
+
const header = buffer[pos.increment()];
|
|
28287
|
+
if (header <= 127) {
|
|
28288
|
+
const numRuns = header + 3;
|
|
28289
|
+
const value = buffer[pos.increment()];
|
|
28290
|
+
const endValueOffset = Math.min(valueOffset + numRuns, numBytes);
|
|
28291
|
+
values.fill(value, valueOffset, endValueOffset);
|
|
28292
|
+
valueOffset = endValueOffset;
|
|
28293
|
+
} else {
|
|
28294
|
+
const numLiterals = 256 - header;
|
|
28295
|
+
for (let i = 0; i < numLiterals && valueOffset < numBytes; i++) values[valueOffset++] = buffer[pos.increment()];
|
|
28296
|
+
}
|
|
28297
|
+
}
|
|
28298
|
+
pos.set(streamEndPos);
|
|
28299
|
+
return values;
|
|
28300
|
+
}
|
|
28301
|
+
function decodeFloatsLE(encodedValues, pos, numValues, nullabilityBuffer) {
|
|
28302
|
+
const currentPos = pos.get();
|
|
28303
|
+
const newOffset = currentPos + numValues * Float32Array.BYTES_PER_ELEMENT;
|
|
28304
|
+
const newBuf = new Uint8Array(encodedValues.subarray(currentPos, newOffset)).buffer;
|
|
28305
|
+
const fb = new Float32Array(newBuf);
|
|
28306
|
+
pos.set(newOffset);
|
|
28307
|
+
if (nullabilityBuffer) return unpackNullable(fb, nullabilityBuffer, 0);
|
|
28308
|
+
return fb;
|
|
28309
|
+
}
|
|
28310
|
+
function decodeDoublesLE(encodedValues, pos, numValues, nullabilityBuffer) {
|
|
28311
|
+
const currentPos = pos.get();
|
|
28312
|
+
const newOffset = currentPos + numValues * Float64Array.BYTES_PER_ELEMENT;
|
|
28313
|
+
const newBuf = new Uint8Array(encodedValues.subarray(currentPos, newOffset)).buffer;
|
|
28314
|
+
const fb = new Float64Array(newBuf);
|
|
28315
|
+
pos.set(newOffset);
|
|
28316
|
+
if (nullabilityBuffer) return unpackNullable(fb, nullabilityBuffer, 0);
|
|
28317
|
+
return fb;
|
|
28318
|
+
}
|
|
28319
|
+
function decodeUint32sLE(encodedValues, pos, numValues) {
|
|
28320
|
+
const currentPos = pos.get();
|
|
28321
|
+
const byteLength = numValues * Uint32Array.BYTES_PER_ELEMENT;
|
|
28322
|
+
const view = new DataView(encodedValues.buffer, encodedValues.byteOffset, encodedValues.byteLength);
|
|
28323
|
+
const values = new Uint32Array(numValues);
|
|
28324
|
+
for (let i = 0; i < numValues; i++) values[i] = view.getUint32(currentPos + i * Uint32Array.BYTES_PER_ELEMENT, true);
|
|
28325
|
+
pos.add(byteLength);
|
|
28326
|
+
return values;
|
|
28327
|
+
}
|
|
28328
|
+
function decodeUint64sLE(encodedValues, pos, numValues) {
|
|
28329
|
+
const currentPos = pos.get();
|
|
28330
|
+
const byteLength = numValues * BigUint64Array.BYTES_PER_ELEMENT;
|
|
28331
|
+
const view = new DataView(encodedValues.buffer, encodedValues.byteOffset, encodedValues.byteLength);
|
|
28332
|
+
const values = new BigUint64Array(numValues);
|
|
28333
|
+
for (let i = 0; i < numValues; i++) values[i] = view.getBigUint64(currentPos + i * BigUint64Array.BYTES_PER_ELEMENT, true);
|
|
28334
|
+
pos.add(byteLength);
|
|
28335
|
+
return values;
|
|
28336
|
+
}
|
|
28337
|
+
const TEXT_DECODER_MIN_LENGTH = 12;
|
|
28338
|
+
const utf8TextDecoder = new TextDecoder();
|
|
28339
|
+
function decodeString$2(buf, pos, end) {
|
|
28340
|
+
if (end - pos >= TEXT_DECODER_MIN_LENGTH) return utf8TextDecoder.decode(buf.subarray(pos, end));
|
|
28341
|
+
return readUtf8(buf, pos, end);
|
|
28342
|
+
}
|
|
28343
|
+
function readUtf8(buf, pos, end) {
|
|
28344
|
+
let str = "";
|
|
28345
|
+
let i = pos;
|
|
28346
|
+
while (i < end) {
|
|
28347
|
+
const b0 = buf[i];
|
|
28348
|
+
let c = null;
|
|
28349
|
+
let bytesPerSequence = b0 > 239 ? 4 : b0 > 223 ? 3 : b0 > 191 ? 2 : 1;
|
|
28350
|
+
if (i + bytesPerSequence > end) break;
|
|
28351
|
+
let b1;
|
|
28352
|
+
let b2;
|
|
28353
|
+
let b3;
|
|
28354
|
+
if (bytesPerSequence === 1) {
|
|
28355
|
+
if (b0 < 128) c = b0;
|
|
28356
|
+
} else if (bytesPerSequence === 2) {
|
|
28357
|
+
b1 = buf[i + 1];
|
|
28358
|
+
if ((b1 & 192) === 128) {
|
|
28359
|
+
c = (b0 & 31) << 6 | b1 & 63;
|
|
28360
|
+
if (c <= 127) c = null;
|
|
28361
|
+
}
|
|
28362
|
+
} else if (bytesPerSequence === 3) {
|
|
28363
|
+
b1 = buf[i + 1];
|
|
28364
|
+
b2 = buf[i + 2];
|
|
28365
|
+
if ((b1 & 192) === 128 && (b2 & 192) === 128) {
|
|
28366
|
+
c = (b0 & 15) << 12 | (b1 & 63) << 6 | b2 & 63;
|
|
28367
|
+
if (c <= 2047 || c >= 55296 && c <= 57343) c = null;
|
|
28368
|
+
}
|
|
28369
|
+
} else if (bytesPerSequence === 4) {
|
|
28370
|
+
b1 = buf[i + 1];
|
|
28371
|
+
b2 = buf[i + 2];
|
|
28372
|
+
b3 = buf[i + 3];
|
|
28373
|
+
if ((b1 & 192) === 128 && (b2 & 192) === 128 && (b3 & 192) === 128) {
|
|
28374
|
+
c = (b0 & 15) << 18 | (b1 & 63) << 12 | (b2 & 63) << 6 | b3 & 63;
|
|
28375
|
+
if (c <= 65535 || c >= 1114112) c = null;
|
|
28376
|
+
}
|
|
28377
|
+
}
|
|
28378
|
+
if (c === null) {
|
|
28379
|
+
c = 65533;
|
|
28380
|
+
bytesPerSequence = 1;
|
|
28381
|
+
} else if (c > 65535) {
|
|
28382
|
+
c -= 65536;
|
|
28383
|
+
str += String.fromCharCode(c >>> 10 & 1023 | 55296);
|
|
28384
|
+
c = 56320 | c & 1023;
|
|
28385
|
+
}
|
|
28386
|
+
str += String.fromCharCode(c);
|
|
28387
|
+
i += bytesPerSequence;
|
|
28388
|
+
}
|
|
28389
|
+
return str;
|
|
28390
|
+
}
|
|
28391
|
+
//#endregion
|
|
28267
28392
|
//#region node_modules/@maplibre/mlt/dist/decoding/integerStreamDecoder.js
|
|
28268
28393
|
function decodeSignedInt32Stream(data, offset, streamMetadata, scalingData, nullabilityBuffer) {
|
|
28269
28394
|
return decodeSignedInt32(decodePhysicalLevelTechnique(data, offset, streamMetadata), streamMetadata, scalingData, nullabilityBuffer);
|
|
@@ -28279,13 +28404,15 @@ function decodePhysicalLevelTechnique(data, offset, streamMetadata) {
|
|
|
28279
28404
|
switch (physicalLevelTechnique) {
|
|
28280
28405
|
case PhysicalLevelTechnique.FAST_PFOR: return decodeFastPfor(data, streamMetadata.numValues, streamMetadata.byteLength, offset);
|
|
28281
28406
|
case PhysicalLevelTechnique.VARINT: return decodeVarintInt32(data, offset, streamMetadata.numValues);
|
|
28282
|
-
case PhysicalLevelTechnique.NONE:
|
|
28283
|
-
|
|
28284
|
-
|
|
28285
|
-
|
|
28286
|
-
|
|
28287
|
-
|
|
28288
|
-
|
|
28407
|
+
case PhysicalLevelTechnique.NONE: return decodeUint32sLE(data, offset, streamMetadata.numValues);
|
|
28408
|
+
default: throw new Error(`Specified physicalLevelTechnique ${physicalLevelTechnique} is not supported (yet).`);
|
|
28409
|
+
}
|
|
28410
|
+
}
|
|
28411
|
+
function decodePhysicalLevelTechniqueInt64(data, offset, streamMetadata) {
|
|
28412
|
+
const physicalLevelTechnique = streamMetadata.physicalLevelTechnique;
|
|
28413
|
+
switch (physicalLevelTechnique) {
|
|
28414
|
+
case PhysicalLevelTechnique.VARINT: return decodeVarintInt64(data, offset, streamMetadata.numValues);
|
|
28415
|
+
case PhysicalLevelTechnique.NONE: return decodeUint64sLE(data, offset, streamMetadata.numValues);
|
|
28289
28416
|
default: throw new Error(`Specified physicalLevelTechnique ${physicalLevelTechnique} is not supported (yet).`);
|
|
28290
28417
|
}
|
|
28291
28418
|
}
|
|
@@ -28309,21 +28436,28 @@ function decodeSequenceInt64Stream(data, offset, streamMetadata) {
|
|
|
28309
28436
|
return decodeZigZagSequenceRleInt64(decodeVarintInt64(data, offset, streamMetadata.numValues));
|
|
28310
28437
|
}
|
|
28311
28438
|
function decodeSignedInt64Stream(data, offset, streamMetadata, nullabilityBuffer) {
|
|
28312
|
-
return decodeSignedInt64(
|
|
28439
|
+
return decodeSignedInt64(decodePhysicalLevelTechniqueInt64(data, offset, streamMetadata), streamMetadata, nullabilityBuffer);
|
|
28313
28440
|
}
|
|
28314
28441
|
function decodeUnsignedInt64Stream(data, offset, streamMetadata, nullabilityBuffer) {
|
|
28315
|
-
return decodeUnsignedInt64(
|
|
28442
|
+
return decodeUnsignedInt64(decodePhysicalLevelTechniqueInt64(data, offset, streamMetadata), streamMetadata, nullabilityBuffer);
|
|
28316
28443
|
}
|
|
28317
|
-
function decodeUnsignedInt64AsFloat64Stream(data, offset, streamMetadata) {
|
|
28318
|
-
|
|
28444
|
+
function decodeUnsignedInt64AsFloat64Stream(data, offset, streamMetadata, nullabilityBuffer) {
|
|
28445
|
+
const values = decodeInt64AsFloat64(data, offset, streamMetadata, false);
|
|
28446
|
+
return nullabilityBuffer ? unpackNullable(values, nullabilityBuffer, 0) : values;
|
|
28447
|
+
}
|
|
28448
|
+
function decodeInt64AsFloat64(data, offset, streamMetadata, isSigned) {
|
|
28449
|
+
if (streamMetadata.physicalLevelTechnique === PhysicalLevelTechnique.VARINT) return decodeFloat64Values(decodeVarintFloat64(data, offset, streamMetadata.numValues), streamMetadata, isSigned);
|
|
28450
|
+
const values = decodePhysicalLevelTechniqueInt64(data, offset, streamMetadata);
|
|
28451
|
+
const decodedValues = isSigned ? decodeSignedInt64(values, streamMetadata) : decodeUnsignedInt64(values, streamMetadata);
|
|
28452
|
+
return Float64Array.from(decodedValues, Number);
|
|
28319
28453
|
}
|
|
28320
28454
|
function decodeSignedConstInt64Stream(data, offset, streamMetadata) {
|
|
28321
|
-
const values =
|
|
28455
|
+
const values = decodePhysicalLevelTechniqueInt64(data, offset, streamMetadata);
|
|
28322
28456
|
if (values.length === 1) return decodeZigZagInt64Value(values[0]);
|
|
28323
28457
|
return decodeZigZagConstRleInt64(values);
|
|
28324
28458
|
}
|
|
28325
28459
|
function decodeUnsignedConstInt64Stream(data, offset, streamMetadata) {
|
|
28326
|
-
const values =
|
|
28460
|
+
const values = decodePhysicalLevelTechniqueInt64(data, offset, streamMetadata);
|
|
28327
28461
|
if (values.length === 1) {
|
|
28328
28462
|
if (streamMetadata.logicalLevelTechnique1 === LogicalLevelTechnique.DELTA) return decodeZigZagInt64Value(values[0]);
|
|
28329
28463
|
return values[0];
|
|
@@ -28521,8 +28655,8 @@ var Int64FlatVector = class extends FixedSizeVector {
|
|
|
28521
28655
|
//#endregion
|
|
28522
28656
|
//#region node_modules/@maplibre/mlt/dist/vector/sequence/int64SequenceVector.js
|
|
28523
28657
|
var Int64SequenceVector = class extends SequenceVector {
|
|
28524
|
-
constructor(name, baseValue, delta, size) {
|
|
28525
|
-
super(name, BigInt64Array.of(baseValue), delta, size);
|
|
28658
|
+
constructor(name, baseValue, delta, size, isSigned) {
|
|
28659
|
+
super(name, isSigned ? BigInt64Array.of(baseValue) : BigUint64Array.of(baseValue), delta, size);
|
|
28526
28660
|
}
|
|
28527
28661
|
getValueFromBuffer(index) {
|
|
28528
28662
|
return this.dataBuffer[0] + BigInt(index) * this.delta;
|
|
@@ -28615,17 +28749,17 @@ function convertGeometryVector(geometryVector) {
|
|
|
28615
28749
|
{
|
|
28616
28750
|
const numPoints = geometryOffsets[geometryOffsetsCounter] - geometryOffsets[geometryOffsetsCounter - 1];
|
|
28617
28751
|
geometryOffsetsCounter++;
|
|
28618
|
-
|
|
28619
|
-
if (nonOffset)
|
|
28620
|
-
|
|
28621
|
-
|
|
28622
|
-
|
|
28623
|
-
|
|
28624
|
-
|
|
28625
|
-
|
|
28626
|
-
|
|
28627
|
-
|
|
28628
|
-
|
|
28752
|
+
let points;
|
|
28753
|
+
if (nonOffset) {
|
|
28754
|
+
points = new Array(numPoints);
|
|
28755
|
+
for (let j = 0; j < numPoints; j++) {
|
|
28756
|
+
const x = vertexBuffer[vertexBufferOffset++];
|
|
28757
|
+
const y = vertexBuffer[vertexBufferOffset++];
|
|
28758
|
+
points[j] = new Point(x, y);
|
|
28759
|
+
}
|
|
28760
|
+
} else {
|
|
28761
|
+
points = decodeDictionaryEncodedVertices(geometryVector.vertexBufferType, vertexBuffer, vertexOffsets, vertexOffsetsOffset, numPoints, false, mortonSettings);
|
|
28762
|
+
vertexOffsetsOffset += numPoints;
|
|
28629
28763
|
}
|
|
28630
28764
|
geometries[geometryCounter++] = points.map((point) => [point]);
|
|
28631
28765
|
partOffsetCounter += numPoints;
|
|
@@ -28645,7 +28779,7 @@ function convertGeometryVector(geometryVector) {
|
|
|
28645
28779
|
vertices = getLineStringOrRing(vertexBuffer, vertexBufferOffset, numVertices, false);
|
|
28646
28780
|
vertexBufferOffset += numVertices * 2;
|
|
28647
28781
|
} else {
|
|
28648
|
-
vertices =
|
|
28782
|
+
vertices = decodeDictionaryEncodedVertices(geometryVector.vertexBufferType, vertexBuffer, vertexOffsets, vertexOffsetsOffset, numVertices, false, mortonSettings);
|
|
28649
28783
|
vertexOffsetsOffset += numVertices;
|
|
28650
28784
|
}
|
|
28651
28785
|
geometries[geometryCounter++] = [vertices];
|
|
@@ -28670,12 +28804,12 @@ function convertGeometryVector(geometryVector) {
|
|
|
28670
28804
|
vertexBufferOffset += numVertices * 2;
|
|
28671
28805
|
}
|
|
28672
28806
|
} else {
|
|
28673
|
-
shell =
|
|
28807
|
+
shell = decodeDictionaryEncodedVertices(geometryVector.vertexBufferType, vertexBuffer, vertexOffsets, vertexOffsetsOffset, numVertices, true, mortonSettings);
|
|
28674
28808
|
vertexOffsetsOffset += numVertices;
|
|
28675
28809
|
for (let j = 0; j < rings.length; j++) {
|
|
28676
28810
|
numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];
|
|
28677
28811
|
ringOffsetsCounter++;
|
|
28678
|
-
rings[j] =
|
|
28812
|
+
rings[j] = decodeDictionaryEncodedVertices(geometryVector.vertexBufferType, vertexBuffer, vertexOffsets, vertexOffsetsOffset, numVertices, true, mortonSettings);
|
|
28679
28813
|
vertexOffsetsOffset += numVertices;
|
|
28680
28814
|
}
|
|
28681
28815
|
}
|
|
@@ -28699,7 +28833,7 @@ function convertGeometryVector(geometryVector) {
|
|
|
28699
28833
|
lineStrings[j] = getLineStringOrRing(vertexBuffer, vertexBufferOffset, numVertices, false);
|
|
28700
28834
|
vertexBufferOffset += numVertices * 2;
|
|
28701
28835
|
} else {
|
|
28702
|
-
const vertices =
|
|
28836
|
+
const vertices = decodeDictionaryEncodedVertices(geometryVector.vertexBufferType, vertexBuffer, vertexOffsets, vertexOffsetsOffset, numVertices, false, mortonSettings);
|
|
28703
28837
|
lineStrings[j] = vertices;
|
|
28704
28838
|
vertexOffsetsOffset += numVertices;
|
|
28705
28839
|
}
|
|
@@ -28723,7 +28857,7 @@ function convertGeometryVector(geometryVector) {
|
|
|
28723
28857
|
shell = getLineStringOrRing(vertexBuffer, vertexBufferOffset, numVertices, true);
|
|
28724
28858
|
vertexBufferOffset += numVertices * 2;
|
|
28725
28859
|
} else {
|
|
28726
|
-
shell =
|
|
28860
|
+
shell = decodeDictionaryEncodedVertices(geometryVector.vertexBufferType, vertexBuffer, vertexOffsets, vertexOffsetsOffset, numVertices, true, mortonSettings);
|
|
28727
28861
|
vertexOffsetsOffset += numVertices;
|
|
28728
28862
|
}
|
|
28729
28863
|
for (let k = 0; k < rings.length; k++) {
|
|
@@ -28733,7 +28867,7 @@ function convertGeometryVector(geometryVector) {
|
|
|
28733
28867
|
rings[k] = getLineStringOrRing(vertexBuffer, vertexBufferOffset, numRingVertices, true);
|
|
28734
28868
|
vertexBufferOffset += numRingVertices * 2;
|
|
28735
28869
|
} else {
|
|
28736
|
-
rings[k] =
|
|
28870
|
+
rings[k] = decodeDictionaryEncodedVertices(geometryVector.vertexBufferType, vertexBuffer, vertexOffsets, vertexOffsetsOffset, numRingVertices, true, mortonSettings);
|
|
28737
28871
|
vertexOffsetsOffset += numRingVertices;
|
|
28738
28872
|
}
|
|
28739
28873
|
}
|
|
@@ -28747,39 +28881,39 @@ function convertGeometryVector(geometryVector) {
|
|
|
28747
28881
|
}
|
|
28748
28882
|
return geometries;
|
|
28749
28883
|
}
|
|
28750
|
-
function
|
|
28751
|
-
if (vertexBufferType === VertexBufferType.MORTON) return
|
|
28752
|
-
else return
|
|
28884
|
+
function decodeDictionaryEncodedVertices(vertexBufferType, vertexBuffer, vertexOffsets, vertexOffset, numVertices, isRing, mortonSettings) {
|
|
28885
|
+
if (vertexBufferType === VertexBufferType.MORTON) return decodeMortonDictionaryEncodedVertices(vertexBuffer, vertexOffsets, vertexOffset, numVertices, isRing, mortonSettings);
|
|
28886
|
+
else return decodeVec2DictionaryEncodedVertices(vertexBuffer, vertexOffsets, vertexOffset, numVertices, isRing);
|
|
28753
28887
|
}
|
|
28754
|
-
function getLineStringOrRing(vertexBuffer, startIndex, numVertices,
|
|
28755
|
-
const vertices = new Array(
|
|
28888
|
+
function getLineStringOrRing(vertexBuffer, startIndex, numVertices, isRing) {
|
|
28889
|
+
const vertices = new Array(isRing ? numVertices + 1 : numVertices);
|
|
28756
28890
|
for (let i = 0; i < numVertices * 2; i += 2) {
|
|
28757
28891
|
const x = vertexBuffer[startIndex + i];
|
|
28758
28892
|
const y = vertexBuffer[startIndex + i + 1];
|
|
28759
28893
|
vertices[i / 2] = new Point(x, y);
|
|
28760
28894
|
}
|
|
28761
|
-
if (
|
|
28895
|
+
if (isRing) vertices[vertices.length - 1] = vertices[0];
|
|
28762
28896
|
return vertices;
|
|
28763
28897
|
}
|
|
28764
|
-
function
|
|
28765
|
-
const vertices = new Array(
|
|
28898
|
+
function decodeVec2DictionaryEncodedVertices(vertexBuffer, vertexOffsets, vertexOffset, numVertices, isRing) {
|
|
28899
|
+
const vertices = new Array(isRing ? numVertices + 1 : numVertices);
|
|
28766
28900
|
for (let i = 0; i < numVertices * 2; i += 2) {
|
|
28767
28901
|
const offset = vertexOffsets[vertexOffset + i / 2] * 2;
|
|
28768
28902
|
const x = vertexBuffer[offset];
|
|
28769
28903
|
const y = vertexBuffer[offset + 1];
|
|
28770
28904
|
vertices[i / 2] = new Point(x, y);
|
|
28771
28905
|
}
|
|
28772
|
-
if (
|
|
28906
|
+
if (isRing) vertices[vertices.length - 1] = vertices[0];
|
|
28773
28907
|
return vertices;
|
|
28774
28908
|
}
|
|
28775
|
-
function
|
|
28776
|
-
const vertices = new Array(
|
|
28909
|
+
function decodeMortonDictionaryEncodedVertices(vertexBuffer, vertexOffsets, vertexOffset, numVertices, isRing, mortonSettings) {
|
|
28910
|
+
const vertices = new Array(isRing ? numVertices + 1 : numVertices);
|
|
28777
28911
|
for (let i = 0; i < numVertices; i++) {
|
|
28778
28912
|
const mortonEncodedVertex = vertexBuffer[vertexOffsets[vertexOffset + i]];
|
|
28779
28913
|
const vertex = decodeZOrderCurve(mortonEncodedVertex, mortonSettings.numBits, mortonSettings.coordinateShift);
|
|
28780
28914
|
vertices[i] = new Point(vertex.x, vertex.y);
|
|
28781
28915
|
}
|
|
28782
|
-
if (
|
|
28916
|
+
if (isRing) vertices[vertices.length - 1] = vertices[0];
|
|
28783
28917
|
return vertices;
|
|
28784
28918
|
}
|
|
28785
28919
|
//#endregion
|
|
@@ -28900,67 +29034,11 @@ var GpuVector = class {
|
|
|
28900
29034
|
get topologyVector() {
|
|
28901
29035
|
return this._topologyVector;
|
|
28902
29036
|
}
|
|
28903
|
-
/**
|
|
28904
|
-
* Returns geometries as coordinate arrays by extracting polygon outlines from topology.
|
|
28905
|
-
* The vertexBuffer contains the outline vertices, separate from the tessellated triangles.
|
|
28906
|
-
*/
|
|
28907
29037
|
getGeometries() {
|
|
28908
29038
|
if (!this._topologyVector) throw new Error("Cannot convert GpuVector to coordinates without topology information");
|
|
28909
|
-
const
|
|
28910
|
-
|
|
28911
|
-
|
|
28912
|
-
const ringOffsets = topology.ringOffsets;
|
|
28913
|
-
const geometryOffsets = topology.geometryOffsets;
|
|
28914
|
-
let vertexBufferOffset = 0;
|
|
28915
|
-
let partOffsetCounter = 1;
|
|
28916
|
-
let ringOffsetsCounter = 1;
|
|
28917
|
-
let geometryOffsetsCounter = 1;
|
|
28918
|
-
for (let i = 0; i < this.numGeometries; i++) switch (this.geometryType(i)) {
|
|
28919
|
-
case GEOMETRY_TYPE.POLYGON:
|
|
28920
|
-
{
|
|
28921
|
-
const numRings = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];
|
|
28922
|
-
partOffsetCounter++;
|
|
28923
|
-
const rings = [];
|
|
28924
|
-
for (let j = 0; j < numRings; j++) {
|
|
28925
|
-
const numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];
|
|
28926
|
-
ringOffsetsCounter++;
|
|
28927
|
-
const ring = [];
|
|
28928
|
-
for (let k = 0; k < numVertices; k++) {
|
|
28929
|
-
const x = this._vertexBuffer[vertexBufferOffset++];
|
|
28930
|
-
const y = this._vertexBuffer[vertexBufferOffset++];
|
|
28931
|
-
ring.push(new Point(x, y));
|
|
28932
|
-
}
|
|
28933
|
-
if (ring.length > 0) ring.push(ring[0]);
|
|
28934
|
-
rings.push(ring);
|
|
28935
|
-
}
|
|
28936
|
-
geometries[i] = rings;
|
|
28937
|
-
if (geometryOffsets) geometryOffsetsCounter++;
|
|
28938
|
-
}
|
|
28939
|
-
break;
|
|
28940
|
-
case GEOMETRY_TYPE.MULTIPOLYGON: {
|
|
28941
|
-
const numPolygons = geometryOffsets[geometryOffsetsCounter] - geometryOffsets[geometryOffsetsCounter - 1];
|
|
28942
|
-
geometryOffsetsCounter++;
|
|
28943
|
-
const allRings = [];
|
|
28944
|
-
for (let p = 0; p < numPolygons; p++) {
|
|
28945
|
-
const numRings = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];
|
|
28946
|
-
partOffsetCounter++;
|
|
28947
|
-
for (let j = 0; j < numRings; j++) {
|
|
28948
|
-
const numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];
|
|
28949
|
-
ringOffsetsCounter++;
|
|
28950
|
-
const ring = [];
|
|
28951
|
-
for (let k = 0; k < numVertices; k++) {
|
|
28952
|
-
const x = this._vertexBuffer[vertexBufferOffset++];
|
|
28953
|
-
const y = this._vertexBuffer[vertexBufferOffset++];
|
|
28954
|
-
ring.push(new Point(x, y));
|
|
28955
|
-
}
|
|
28956
|
-
if (ring.length > 0) ring.push(ring[0]);
|
|
28957
|
-
allRings.push(ring);
|
|
28958
|
-
}
|
|
28959
|
-
}
|
|
28960
|
-
geometries[i] = allRings;
|
|
28961
|
-
}
|
|
28962
|
-
}
|
|
28963
|
-
return geometries;
|
|
29039
|
+
const types = new Uint32Array(this.numGeometries);
|
|
29040
|
+
for (let i = 0; i < this.numGeometries; i++) types[i] = this.geometryType(i);
|
|
29041
|
+
return createFlatGeometryVector(types, this._topologyVector, void 0, this._vertexBuffer).getGeometries();
|
|
28964
29042
|
}
|
|
28965
29043
|
[Symbol.iterator]() {
|
|
28966
29044
|
return null;
|
|
@@ -29233,112 +29311,6 @@ var Int64ConstVector = class extends Vector {
|
|
|
29233
29311
|
}
|
|
29234
29312
|
};
|
|
29235
29313
|
//#endregion
|
|
29236
|
-
//#region node_modules/@maplibre/mlt/dist/decoding/decodingUtils.js
|
|
29237
|
-
function skipColumn(numStreams, tile, offset) {
|
|
29238
|
-
for (let i = 0; i < numStreams; i++) {
|
|
29239
|
-
const streamMetadata = decodeStreamMetadata(tile, offset);
|
|
29240
|
-
offset.add(streamMetadata.byteLength);
|
|
29241
|
-
}
|
|
29242
|
-
}
|
|
29243
|
-
function decodeBooleanRle(buffer, numBooleans, byteLength, pos, nullabilityBuffer) {
|
|
29244
|
-
const values = decodeByteRle(buffer, Math.ceil(numBooleans / 8), byteLength, pos);
|
|
29245
|
-
if (nullabilityBuffer) return unpackNullableBoolean(values, numBooleans, nullabilityBuffer);
|
|
29246
|
-
return values;
|
|
29247
|
-
}
|
|
29248
|
-
function decodeByteRle(buffer, numBytes, byteLength, pos) {
|
|
29249
|
-
const values = new Uint8Array(numBytes);
|
|
29250
|
-
let valueOffset = 0;
|
|
29251
|
-
const streamEndPos = pos.get() + byteLength;
|
|
29252
|
-
while (valueOffset < numBytes) {
|
|
29253
|
-
if (pos.get() >= streamEndPos) break;
|
|
29254
|
-
const header = buffer[pos.increment()];
|
|
29255
|
-
if (header <= 127) {
|
|
29256
|
-
const numRuns = header + 3;
|
|
29257
|
-
const value = buffer[pos.increment()];
|
|
29258
|
-
const endValueOffset = Math.min(valueOffset + numRuns, numBytes);
|
|
29259
|
-
values.fill(value, valueOffset, endValueOffset);
|
|
29260
|
-
valueOffset = endValueOffset;
|
|
29261
|
-
} else {
|
|
29262
|
-
const numLiterals = 256 - header;
|
|
29263
|
-
for (let i = 0; i < numLiterals && valueOffset < numBytes; i++) values[valueOffset++] = buffer[pos.increment()];
|
|
29264
|
-
}
|
|
29265
|
-
}
|
|
29266
|
-
pos.set(streamEndPos);
|
|
29267
|
-
return values;
|
|
29268
|
-
}
|
|
29269
|
-
function decodeFloatsLE(encodedValues, pos, numValues, nullabilityBuffer) {
|
|
29270
|
-
const currentPos = pos.get();
|
|
29271
|
-
const newOffset = currentPos + numValues * Float32Array.BYTES_PER_ELEMENT;
|
|
29272
|
-
const newBuf = new Uint8Array(encodedValues.subarray(currentPos, newOffset)).buffer;
|
|
29273
|
-
const fb = new Float32Array(newBuf);
|
|
29274
|
-
pos.set(newOffset);
|
|
29275
|
-
if (nullabilityBuffer) return unpackNullable(fb, nullabilityBuffer, 0);
|
|
29276
|
-
return fb;
|
|
29277
|
-
}
|
|
29278
|
-
function decodeDoublesLE(encodedValues, pos, numValues, nullabilityBuffer) {
|
|
29279
|
-
const currentPos = pos.get();
|
|
29280
|
-
const newOffset = currentPos + numValues * Float64Array.BYTES_PER_ELEMENT;
|
|
29281
|
-
const newBuf = new Uint8Array(encodedValues.subarray(currentPos, newOffset)).buffer;
|
|
29282
|
-
const fb = new Float64Array(newBuf);
|
|
29283
|
-
pos.set(newOffset);
|
|
29284
|
-
if (nullabilityBuffer) return unpackNullable(fb, nullabilityBuffer, 0);
|
|
29285
|
-
return fb;
|
|
29286
|
-
}
|
|
29287
|
-
const TEXT_DECODER_MIN_LENGTH = 12;
|
|
29288
|
-
const utf8TextDecoder = new TextDecoder();
|
|
29289
|
-
function decodeString$2(buf, pos, end) {
|
|
29290
|
-
if (end - pos >= TEXT_DECODER_MIN_LENGTH) return utf8TextDecoder.decode(buf.subarray(pos, end));
|
|
29291
|
-
return readUtf8(buf, pos, end);
|
|
29292
|
-
}
|
|
29293
|
-
function readUtf8(buf, pos, end) {
|
|
29294
|
-
let str = "";
|
|
29295
|
-
let i = pos;
|
|
29296
|
-
while (i < end) {
|
|
29297
|
-
const b0 = buf[i];
|
|
29298
|
-
let c = null;
|
|
29299
|
-
let bytesPerSequence = b0 > 239 ? 4 : b0 > 223 ? 3 : b0 > 191 ? 2 : 1;
|
|
29300
|
-
if (i + bytesPerSequence > end) break;
|
|
29301
|
-
let b1;
|
|
29302
|
-
let b2;
|
|
29303
|
-
let b3;
|
|
29304
|
-
if (bytesPerSequence === 1) {
|
|
29305
|
-
if (b0 < 128) c = b0;
|
|
29306
|
-
} else if (bytesPerSequence === 2) {
|
|
29307
|
-
b1 = buf[i + 1];
|
|
29308
|
-
if ((b1 & 192) === 128) {
|
|
29309
|
-
c = (b0 & 31) << 6 | b1 & 63;
|
|
29310
|
-
if (c <= 127) c = null;
|
|
29311
|
-
}
|
|
29312
|
-
} else if (bytesPerSequence === 3) {
|
|
29313
|
-
b1 = buf[i + 1];
|
|
29314
|
-
b2 = buf[i + 2];
|
|
29315
|
-
if ((b1 & 192) === 128 && (b2 & 192) === 128) {
|
|
29316
|
-
c = (b0 & 15) << 12 | (b1 & 63) << 6 | b2 & 63;
|
|
29317
|
-
if (c <= 2047 || c >= 55296 && c <= 57343) c = null;
|
|
29318
|
-
}
|
|
29319
|
-
} else if (bytesPerSequence === 4) {
|
|
29320
|
-
b1 = buf[i + 1];
|
|
29321
|
-
b2 = buf[i + 2];
|
|
29322
|
-
b3 = buf[i + 3];
|
|
29323
|
-
if ((b1 & 192) === 128 && (b2 & 192) === 128 && (b3 & 192) === 128) {
|
|
29324
|
-
c = (b0 & 15) << 18 | (b1 & 63) << 12 | (b2 & 63) << 6 | b3 & 63;
|
|
29325
|
-
if (c <= 65535 || c >= 1114112) c = null;
|
|
29326
|
-
}
|
|
29327
|
-
}
|
|
29328
|
-
if (c === null) {
|
|
29329
|
-
c = 65533;
|
|
29330
|
-
bytesPerSequence = 1;
|
|
29331
|
-
} else if (c > 65535) {
|
|
29332
|
-
c -= 65536;
|
|
29333
|
-
str += String.fromCharCode(c >>> 10 & 1023 | 55296);
|
|
29334
|
-
c = 56320 | c & 1023;
|
|
29335
|
-
}
|
|
29336
|
-
str += String.fromCharCode(c);
|
|
29337
|
-
i += bytesPerSequence;
|
|
29338
|
-
}
|
|
29339
|
-
return str;
|
|
29340
|
-
}
|
|
29341
|
-
//#endregion
|
|
29342
29314
|
//#region node_modules/@maplibre/mlt/dist/vector/variableSizeVector.js
|
|
29343
29315
|
var VariableSizeVector = class extends Vector {
|
|
29344
29316
|
constructor(name, offsetBuffer, dataBuffer, sizeOrNullabilityBuffer) {
|
|
@@ -29376,6 +29348,24 @@ var StringDictionaryVector = class extends VariableSizeVector {
|
|
|
29376
29348
|
//#endregion
|
|
29377
29349
|
//#region node_modules/@maplibre/mlt/dist/decoding/fsstDecoder.js
|
|
29378
29350
|
/**
|
|
29351
|
+
* Calculates the exact output size before decoding. This allows one final
|
|
29352
|
+
* `Uint8Array` allocation and avoids growing a JavaScript number array and
|
|
29353
|
+
* copying it into a typed array afterward. Traversing the compressed data
|
|
29354
|
+
* twice is always worthwhile here because it avoids those larger temporary
|
|
29355
|
+
* allocations.
|
|
29356
|
+
*/
|
|
29357
|
+
function getDecodedLength(symbolLengths, compressedData) {
|
|
29358
|
+
let decodedLength = 0;
|
|
29359
|
+
for (let i = 0; i < compressedData.length; i++) {
|
|
29360
|
+
const symbolIndex = compressedData[i];
|
|
29361
|
+
if (symbolIndex === 255) {
|
|
29362
|
+
decodedLength++;
|
|
29363
|
+
i++;
|
|
29364
|
+
} else decodedLength += symbolLengths[symbolIndex];
|
|
29365
|
+
}
|
|
29366
|
+
return decodedLength;
|
|
29367
|
+
}
|
|
29368
|
+
/**
|
|
29379
29369
|
* Decode FSST compressed data
|
|
29380
29370
|
*
|
|
29381
29371
|
* @param symbols Array of symbols, where each symbol can be between 1 and 8 bytes
|
|
@@ -29384,36 +29374,50 @@ var StringDictionaryVector = class extends VariableSizeVector {
|
|
|
29384
29374
|
* @returns Decoded data as Uint8Array
|
|
29385
29375
|
*/
|
|
29386
29376
|
function decodeFsst(symbols, symbolLengths, compressedData) {
|
|
29387
|
-
const
|
|
29388
|
-
const symbolOffsets = new Array(symbolLengths.length).fill(0);
|
|
29377
|
+
const symbolOffsets = new Uint32Array(symbolLengths.length);
|
|
29389
29378
|
for (let i = 1; i < symbolLengths.length; i++) symbolOffsets[i] = symbolOffsets[i - 1] + symbolLengths[i - 1];
|
|
29390
|
-
|
|
29391
|
-
|
|
29392
|
-
|
|
29393
|
-
const
|
|
29394
|
-
|
|
29379
|
+
const decodedData = new Uint8Array(getDecodedLength(symbolLengths, compressedData));
|
|
29380
|
+
let decodedOffset = 0;
|
|
29381
|
+
for (let i = 0; i < compressedData.length; i++) {
|
|
29382
|
+
const symbolIndex = compressedData[i];
|
|
29383
|
+
if (symbolIndex === 255) {
|
|
29384
|
+
i++;
|
|
29385
|
+
decodedData[decodedOffset++] = compressedData[i];
|
|
29386
|
+
} else {
|
|
29387
|
+
let symbolLength = symbolLengths[symbolIndex];
|
|
29388
|
+
let symbolOffset = symbolOffsets[symbolIndex];
|
|
29389
|
+
while (symbolLength-- > 0) decodedData[decodedOffset++] = symbols[symbolOffset++];
|
|
29390
|
+
}
|
|
29395
29391
|
}
|
|
29396
|
-
return
|
|
29392
|
+
return decodedData;
|
|
29397
29393
|
}
|
|
29398
29394
|
//#endregion
|
|
29399
29395
|
//#region node_modules/@maplibre/mlt/dist/vector/fsst-dictionary/stringFsstDictionaryVector.js
|
|
29400
29396
|
var StringFsstDictionaryVector = class extends VariableSizeVector {
|
|
29401
|
-
constructor(name, indexBuffer, offsetBuffer, dictionaryBuffer, symbolOffsetBuffer, symbolTableBuffer, nullabilityBuffer) {
|
|
29397
|
+
constructor(name, indexBuffer, offsetBuffer, dictionaryBuffer, symbolOffsetBuffer, symbolTableBuffer, nullabilityBuffer, sharedDictionaryCache) {
|
|
29402
29398
|
super(name, offsetBuffer, dictionaryBuffer, nullabilityBuffer ?? indexBuffer.length);
|
|
29403
29399
|
this.indexBuffer = indexBuffer;
|
|
29404
29400
|
this.symbolOffsetBuffer = symbolOffsetBuffer;
|
|
29405
29401
|
this.symbolTableBuffer = symbolTableBuffer;
|
|
29402
|
+
this.sharedDictionaryCache = sharedDictionaryCache;
|
|
29406
29403
|
}
|
|
29407
29404
|
getValueFromBuffer(index) {
|
|
29408
29405
|
if (this.decodedDictionary == null) {
|
|
29409
|
-
|
|
29410
|
-
|
|
29406
|
+
this.decodedDictionary = this.sharedDictionaryCache?.decodedDictionary;
|
|
29407
|
+
if (this.decodedDictionary == null) {
|
|
29408
|
+
this.decodedDictionary = this.decodeDictionary();
|
|
29409
|
+
if (this.sharedDictionaryCache) this.sharedDictionaryCache.decodedDictionary = this.decodedDictionary;
|
|
29410
|
+
}
|
|
29411
29411
|
}
|
|
29412
29412
|
const offset = this.indexBuffer[index];
|
|
29413
29413
|
const start = this.offsetBuffer[offset];
|
|
29414
29414
|
const end = this.offsetBuffer[offset + 1];
|
|
29415
29415
|
return decodeString$2(this.decodedDictionary, start, end);
|
|
29416
29416
|
}
|
|
29417
|
+
decodeDictionary() {
|
|
29418
|
+
if (this.symbolLengthBuffer == null) this.symbolLengthBuffer = this.offsetToLengthBuffer(this.symbolOffsetBuffer);
|
|
29419
|
+
return decodeFsst(this.symbolTableBuffer, this.symbolLengthBuffer, this.dataBuffer);
|
|
29420
|
+
}
|
|
29417
29421
|
offsetToLengthBuffer(offsetBuffer) {
|
|
29418
29422
|
const lengthBuffer = new Uint32Array(offsetBuffer.length - 1);
|
|
29419
29423
|
let previousOffset = offsetBuffer[0];
|
|
@@ -29428,14 +29432,14 @@ var StringFsstDictionaryVector = class extends VariableSizeVector {
|
|
|
29428
29432
|
//#endregion
|
|
29429
29433
|
//#region node_modules/@maplibre/mlt/dist/decoding/stringDecoder.js
|
|
29430
29434
|
function decodeString$1(name, data, offset, numStreams, bitVector) {
|
|
29431
|
-
let dictionaryLengthStream
|
|
29432
|
-
let offsetStream
|
|
29433
|
-
let dictionaryStream
|
|
29434
|
-
let symbolLengthStream
|
|
29435
|
-
let symbolTableStream
|
|
29436
|
-
let nullabilityBuffer = bitVector
|
|
29437
|
-
let plainLengthStream
|
|
29438
|
-
let plainDataStream
|
|
29435
|
+
let dictionaryLengthStream;
|
|
29436
|
+
let offsetStream;
|
|
29437
|
+
let dictionaryStream;
|
|
29438
|
+
let symbolLengthStream;
|
|
29439
|
+
let symbolTableStream;
|
|
29440
|
+
let nullabilityBuffer = bitVector;
|
|
29441
|
+
let plainLengthStream;
|
|
29442
|
+
let plainDataStream;
|
|
29439
29443
|
for (let i = 0; i < numStreams; i++) {
|
|
29440
29444
|
const streamMetadata = decodeStreamMetadata(data, offset);
|
|
29441
29445
|
switch (streamMetadata.physicalStreamType) {
|
|
@@ -29468,15 +29472,17 @@ function decodeString$1(name, data, offset, numStreams, bitVector) {
|
|
|
29468
29472
|
return decodeFsstDictionaryVector(name, symbolTableStream, offsetStream, dictionaryLengthStream, dictionaryStream, symbolLengthStream, nullabilityBuffer) ?? decodeDictionaryVector(name, dictionaryStream, offsetStream, dictionaryLengthStream, nullabilityBuffer) ?? decodePlainStringVector(name, plainLengthStream, plainDataStream, offsetStream, nullabilityBuffer);
|
|
29469
29473
|
}
|
|
29470
29474
|
function decodeFsstDictionaryVector(name, symbolTableStream, offsetStream, dictionaryLengthStream, dictionaryStream, symbolLengthStream, nullabilityBuffer) {
|
|
29471
|
-
if (!symbolTableStream) return
|
|
29475
|
+
if (!symbolTableStream) return;
|
|
29476
|
+
if (!offsetStream || !dictionaryLengthStream || !dictionaryStream || !symbolLengthStream) throw new Error(`Incomplete FSST dictionary string column "${name}"`);
|
|
29472
29477
|
return new StringFsstDictionaryVector(name, offsetStream, dictionaryLengthStream, dictionaryStream, symbolLengthStream, symbolTableStream, nullabilityBuffer);
|
|
29473
29478
|
}
|
|
29474
29479
|
function decodeDictionaryVector(name, dictionaryStream, offsetStream, dictionaryLengthStream, nullabilityBuffer) {
|
|
29475
|
-
if (!dictionaryStream) return
|
|
29480
|
+
if (!dictionaryStream) return;
|
|
29481
|
+
if (!offsetStream || !dictionaryLengthStream) throw new Error(`Incomplete dictionary string column "${name}"`);
|
|
29476
29482
|
return nullabilityBuffer ? new StringDictionaryVector(name, offsetStream, dictionaryLengthStream, dictionaryStream, nullabilityBuffer) : new StringDictionaryVector(name, offsetStream, dictionaryLengthStream, dictionaryStream);
|
|
29477
29483
|
}
|
|
29478
29484
|
function decodePlainStringVector(name, plainLengthStream, plainDataStream, offsetStream, nullabilityBuffer) {
|
|
29479
|
-
if (!plainLengthStream || !plainDataStream) return
|
|
29485
|
+
if (!plainLengthStream || !plainDataStream) return;
|
|
29480
29486
|
if (offsetStream) return nullabilityBuffer ? new StringDictionaryVector(name, offsetStream, plainLengthStream, plainDataStream, nullabilityBuffer) : new StringDictionaryVector(name, offsetStream, plainLengthStream, plainDataStream);
|
|
29481
29487
|
if (nullabilityBuffer && nullabilityBuffer.size() !== plainLengthStream.length - 1) {
|
|
29482
29488
|
const sparseOffsetStream = new Uint32Array(nullabilityBuffer.size());
|
|
@@ -29488,10 +29494,10 @@ function decodePlainStringVector(name, plainLengthStream, plainDataStream, offse
|
|
|
29488
29494
|
return nullabilityBuffer ? new StringFlatVector(name, plainLengthStream, plainDataStream, nullabilityBuffer) : new StringFlatVector(name, plainLengthStream, plainDataStream);
|
|
29489
29495
|
}
|
|
29490
29496
|
function decodeSharedDictionary(data, offset, column, propertyColumnNames) {
|
|
29491
|
-
let dictionaryOffsetBuffer
|
|
29492
|
-
let dictionaryBuffer
|
|
29493
|
-
let symbolOffsetBuffer
|
|
29494
|
-
let symbolTableBuffer
|
|
29497
|
+
let dictionaryOffsetBuffer;
|
|
29498
|
+
let dictionaryBuffer;
|
|
29499
|
+
let symbolOffsetBuffer;
|
|
29500
|
+
let symbolTableBuffer;
|
|
29495
29501
|
let dictionaryStreamDecoded = false;
|
|
29496
29502
|
while (!dictionaryStreamDecoded) {
|
|
29497
29503
|
const streamMetadata = decodeStreamMetadata(data, offset);
|
|
@@ -29508,8 +29514,12 @@ function decodeSharedDictionary(data, offset, column, propertyColumnNames) {
|
|
|
29508
29514
|
offset.add(streamMetadata.byteLength);
|
|
29509
29515
|
}
|
|
29510
29516
|
}
|
|
29517
|
+
if (column.type !== "complexType") throw new Error(`Shared dictionary column ${column.name} must be a complex (struct) column.`);
|
|
29518
|
+
if (!dictionaryOffsetBuffer || !dictionaryBuffer) throw new Error(`Incomplete shared dictionary for column "${column.name}"`);
|
|
29511
29519
|
const childFields = column.complexType.children;
|
|
29512
29520
|
const stringDictionaryVectors = [];
|
|
29521
|
+
/** Shared by every FSST child-column vector in this SharedDict and populated on first access. */
|
|
29522
|
+
const sharedDictionaryCache = symbolTableBuffer ? {} : void 0;
|
|
29513
29523
|
let i = 0;
|
|
29514
29524
|
for (const childField of childFields) {
|
|
29515
29525
|
const numStreams = decodeVarintInt32(data, offset, 1)[0];
|
|
@@ -29529,11 +29539,320 @@ function decodeSharedDictionary(data, offset, column, propertyColumnNames) {
|
|
|
29529
29539
|
presentStreamBitVector = new BitVector(decodeBooleanRle(data, presentStreamMetadata.numValues, presentStreamMetadata.byteLength, offset), presentStreamMetadata.numValues);
|
|
29530
29540
|
}
|
|
29531
29541
|
const offsetStream = decodeUnsignedInt32Stream(data, offset, decodeStreamMetadata(data, offset), void 0, presentStreamBitVector);
|
|
29532
|
-
|
|
29542
|
+
if (symbolTableBuffer) {
|
|
29543
|
+
if (!symbolOffsetBuffer) throw new Error(`Incomplete shared FSST dictionary for column "${columnName}"`);
|
|
29544
|
+
stringDictionaryVectors[i++] = new StringFsstDictionaryVector(columnName, offsetStream, dictionaryOffsetBuffer, dictionaryBuffer, symbolOffsetBuffer, symbolTableBuffer, presentStreamBitVector, sharedDictionaryCache);
|
|
29545
|
+
} else stringDictionaryVectors[i++] = new StringDictionaryVector(columnName, offsetStream, dictionaryOffsetBuffer, dictionaryBuffer, presentStreamBitVector);
|
|
29533
29546
|
}
|
|
29534
29547
|
return stringDictionaryVectors;
|
|
29535
29548
|
}
|
|
29536
29549
|
//#endregion
|
|
29550
|
+
//#region node_modules/@maplibre/mlt/dist/vector/flat/objectFlatVector.js
|
|
29551
|
+
/**
|
|
29552
|
+
* Holds already-decoded values of arbitrary shape, one per feature.
|
|
29553
|
+
*
|
|
29554
|
+
* Unlike the other vectors there is no packed buffer to index into: nested property (MAP) columns
|
|
29555
|
+
* decode to plain JavaScript maps, arrays and scalars, so the values are kept as-is. Features
|
|
29556
|
+
* without a value are marked absent in the nullability buffer, so `has` reports them as missing and
|
|
29557
|
+
* `getValue` returns `null`.
|
|
29558
|
+
*/
|
|
29559
|
+
var ObjectFlatVector = class extends Vector {
|
|
29560
|
+
constructor(name, values, nullabilityBuffer) {
|
|
29561
|
+
super(name, /* @__PURE__ */ new Uint8Array(0), nullabilityBuffer ?? values.length);
|
|
29562
|
+
this.values = values;
|
|
29563
|
+
}
|
|
29564
|
+
getValueFromBuffer(index) {
|
|
29565
|
+
return this.values[index];
|
|
29566
|
+
}
|
|
29567
|
+
};
|
|
29568
|
+
//#endregion
|
|
29569
|
+
//#region node_modules/@maplibre/mlt/dist/metadata/tile/mapMask.js
|
|
29570
|
+
/**
|
|
29571
|
+
* Bitmask written ahead of a nested property (MAP) column, marking which optional streams follow
|
|
29572
|
+
* the mandatory length stream. Only one of INT32/INT64 and one of UINT32/UINT64 is ever set: the
|
|
29573
|
+
* encoder picks the narrower width that fits every value.
|
|
29574
|
+
*/
|
|
29575
|
+
var MapMask;
|
|
29576
|
+
(function(MapMask) {
|
|
29577
|
+
MapMask[MapMask["STRING"] = 1] = "STRING";
|
|
29578
|
+
MapMask[MapMask["INT32"] = 2] = "INT32";
|
|
29579
|
+
MapMask[MapMask["UINT32"] = 4] = "UINT32";
|
|
29580
|
+
MapMask[MapMask["INT64"] = 8] = "INT64";
|
|
29581
|
+
MapMask[MapMask["UINT64"] = 16] = "UINT64";
|
|
29582
|
+
MapMask[MapMask["FLOAT"] = 32] = "FLOAT";
|
|
29583
|
+
MapMask[MapMask["DOUBLE"] = 64] = "DOUBLE";
|
|
29584
|
+
MapMask[MapMask["PRESENCE"] = 128] = "PRESENCE";
|
|
29585
|
+
})(MapMask || (MapMask = {}));
|
|
29586
|
+
//#endregion
|
|
29587
|
+
//#region node_modules/@maplibre/mlt/dist/metadata/tile/mapControlValue.js
|
|
29588
|
+
/**
|
|
29589
|
+
* Tokens in the data stream of a nested property (MAP) column. Values below `COUNT` describe the
|
|
29590
|
+
* structure; anything else is an index into the combined dictionary, offset by `COUNT`. Booleans are
|
|
29591
|
+
* encoded directly as tokens rather than being added to a dictionary.
|
|
29592
|
+
*/
|
|
29593
|
+
var MapControlValue;
|
|
29594
|
+
(function(MapControlValue) {
|
|
29595
|
+
MapControlValue[MapControlValue["FALSE"] = 0] = "FALSE";
|
|
29596
|
+
MapControlValue[MapControlValue["TRUE"] = 1] = "TRUE";
|
|
29597
|
+
/** A nested map follows: this token, the payload length including these two tokens, the payload. */
|
|
29598
|
+
MapControlValue[MapControlValue["START_MAP"] = 2] = "START_MAP";
|
|
29599
|
+
/** A list follows, laid out the same way as START_MAP. */
|
|
29600
|
+
MapControlValue[MapControlValue["START_LIST"] = 3] = "START_LIST";
|
|
29601
|
+
/** Number of reserved tokens, i.e. the first dictionary index. */
|
|
29602
|
+
MapControlValue[MapControlValue["COUNT"] = 4] = "COUNT";
|
|
29603
|
+
})(MapControlValue || (MapControlValue = {}));
|
|
29604
|
+
//#endregion
|
|
29605
|
+
//#region node_modules/@maplibre/mlt/dist/decoding/mapPropertyDecoder.js
|
|
29606
|
+
/**
|
|
29607
|
+
* Decodes a nested property (MAP) column into one vector per child column.
|
|
29608
|
+
*
|
|
29609
|
+
* The column is stored as a length stream (values per feature), a dictionary stream per value type
|
|
29610
|
+
* present, an optional presence stream, and a data stream of dictionary indices interleaved with
|
|
29611
|
+
* the control tokens that describe the map/list structure.
|
|
29612
|
+
*
|
|
29613
|
+
* Ported from the Java reference implementation (`MapPropertyDecoder`).
|
|
29614
|
+
*/
|
|
29615
|
+
function decodeMapPropertyColumn(data, offset, columnMetadata, numStreams) {
|
|
29616
|
+
const columnNames = getMapColumnNames(columnMetadata);
|
|
29617
|
+
if (numStreams === 0) return columnNames.map((name) => new ObjectFlatVector(name, []));
|
|
29618
|
+
const streams = decodeMapStreams(data, offset, numStreams);
|
|
29619
|
+
const featureCount = (streams.presentStream ? streams.presentCount : streams.lengthStream.length) / columnNames.length;
|
|
29620
|
+
const vectors = [];
|
|
29621
|
+
let countsCursor = 0;
|
|
29622
|
+
let valuesCursor = 0;
|
|
29623
|
+
for (let childIndex = 0; childIndex < columnNames.length; childIndex++) {
|
|
29624
|
+
const child = decodeChildColumn(streams, childIndex, featureCount, countsCursor, valuesCursor);
|
|
29625
|
+
vectors.push(new ObjectFlatVector(columnNames[childIndex], child.value, child.nullabilityBuffer));
|
|
29626
|
+
countsCursor = child.countsEnd;
|
|
29627
|
+
valuesCursor = child.valuesEnd;
|
|
29628
|
+
}
|
|
29629
|
+
return vectors;
|
|
29630
|
+
}
|
|
29631
|
+
/**
|
|
29632
|
+
* A single map column carries its own name. A shared column carries one child per sibling, whose
|
|
29633
|
+
* full name is the parent name followed by the child name.
|
|
29634
|
+
*/
|
|
29635
|
+
function getMapColumnNames(columnMetadata) {
|
|
29636
|
+
const children = columnMetadata.type === "complexType" ? columnMetadata.complexType.children : void 0;
|
|
29637
|
+
if (!children || children.length === 0) return [columnMetadata.name];
|
|
29638
|
+
return children.map((child) => columnMetadata.name + (child.name ?? ""));
|
|
29639
|
+
}
|
|
29640
|
+
/** Reads the stream mask and every stream it announces, in the order the encoder wrote them. */
|
|
29641
|
+
function decodeMapStreams(data, offset, numStreams) {
|
|
29642
|
+
const dictionaryMask = data[offset.get()];
|
|
29643
|
+
offset.add(1);
|
|
29644
|
+
const lengthStream = decodeUnsignedInt32Stream(data, offset, decodeStreamMetadata(data, offset));
|
|
29645
|
+
let remainingStreams = numStreams - 1;
|
|
29646
|
+
const dictionary = [];
|
|
29647
|
+
if (dictionaryMask & MapMask.STRING) remainingStreams -= decodeStringDictionary(data, offset, dictionary);
|
|
29648
|
+
remainingStreams -= decodeIntegerDictionaries(data, offset, dictionaryMask, dictionary);
|
|
29649
|
+
remainingStreams -= decodeFloatingPointDictionaries(data, offset, dictionaryMask, dictionary);
|
|
29650
|
+
let presentStream;
|
|
29651
|
+
let presentCount = 0;
|
|
29652
|
+
if (dictionaryMask & MapMask.PRESENCE) {
|
|
29653
|
+
const presence = decodePresenceStream(data, offset);
|
|
29654
|
+
presentStream = presence.value;
|
|
29655
|
+
presentCount = presence.count;
|
|
29656
|
+
remainingStreams--;
|
|
29657
|
+
}
|
|
29658
|
+
let flattenedValues = /* @__PURE__ */ new Uint32Array(0);
|
|
29659
|
+
if (remainingStreams > 0) {
|
|
29660
|
+
flattenedValues = decodeUnsignedInt32Stream(data, offset, decodeStreamMetadata(data, offset));
|
|
29661
|
+
remainingStreams--;
|
|
29662
|
+
}
|
|
29663
|
+
if (remainingStreams !== 0) throw new Error(`Unexpected number of remaining streams while decoding map column: ${remainingStreams}`);
|
|
29664
|
+
return {
|
|
29665
|
+
lengthStream,
|
|
29666
|
+
dictionary,
|
|
29667
|
+
presentStream,
|
|
29668
|
+
presentCount,
|
|
29669
|
+
flattenedValues
|
|
29670
|
+
};
|
|
29671
|
+
}
|
|
29672
|
+
/** @returns the number of streams consumed, which the string encoding decides for itself. */
|
|
29673
|
+
function decodeStringDictionary(data, offset, dictionary) {
|
|
29674
|
+
const stringStreamCount = data[offset.get()];
|
|
29675
|
+
offset.add(1);
|
|
29676
|
+
const strings = decodeString$1("", data, offset, stringStreamCount);
|
|
29677
|
+
if (strings) for (let i = 0; i < strings.size; i++) dictionary.push(strings.getValue(i));
|
|
29678
|
+
return stringStreamCount;
|
|
29679
|
+
}
|
|
29680
|
+
/**
|
|
29681
|
+
* Signed and unsigned integers each get at most one stream, whose width the encoder chose to fit
|
|
29682
|
+
* the widest value.
|
|
29683
|
+
*
|
|
29684
|
+
* @returns the number of streams consumed.
|
|
29685
|
+
*/
|
|
29686
|
+
function decodeIntegerDictionaries(data, offset, dictionaryMask, dictionary) {
|
|
29687
|
+
let consumed = 0;
|
|
29688
|
+
if (dictionaryMask & MapMask.INT32) {
|
|
29689
|
+
pushAll(dictionary, decodeSignedInt32Stream(data, offset, decodeStreamMetadata(data, offset)));
|
|
29690
|
+
consumed++;
|
|
29691
|
+
} else if (dictionaryMask & MapMask.INT64) {
|
|
29692
|
+
pushAll(dictionary, decodeSignedInt64Stream(data, offset, decodeStreamMetadata(data, offset)));
|
|
29693
|
+
consumed++;
|
|
29694
|
+
}
|
|
29695
|
+
if (dictionaryMask & MapMask.UINT32) {
|
|
29696
|
+
pushAll(dictionary, decodeUnsignedInt32Stream(data, offset, decodeStreamMetadata(data, offset)));
|
|
29697
|
+
consumed++;
|
|
29698
|
+
} else if (dictionaryMask & MapMask.UINT64) {
|
|
29699
|
+
pushAll(dictionary, decodeUnsignedInt64Stream(data, offset, decodeStreamMetadata(data, offset)));
|
|
29700
|
+
consumed++;
|
|
29701
|
+
}
|
|
29702
|
+
return consumed;
|
|
29703
|
+
}
|
|
29704
|
+
/** @returns the number of streams consumed. */
|
|
29705
|
+
function decodeFloatingPointDictionaries(data, offset, dictionaryMask, dictionary) {
|
|
29706
|
+
let consumed = 0;
|
|
29707
|
+
if (dictionaryMask & MapMask.FLOAT) {
|
|
29708
|
+
pushAll(dictionary, decodeFloatsLE(data, offset, decodeStreamMetadata(data, offset).numValues));
|
|
29709
|
+
consumed++;
|
|
29710
|
+
}
|
|
29711
|
+
if (dictionaryMask & MapMask.DOUBLE) {
|
|
29712
|
+
pushAll(dictionary, decodeDoublesLE(data, offset, decodeStreamMetadata(data, offset).numValues));
|
|
29713
|
+
consumed++;
|
|
29714
|
+
}
|
|
29715
|
+
return consumed;
|
|
29716
|
+
}
|
|
29717
|
+
function decodePresenceStream(data, offset) {
|
|
29718
|
+
const streamMetadata = decodeStreamMetadata(data, offset);
|
|
29719
|
+
if (streamMetadata.physicalStreamType !== PhysicalStreamType.PRESENT) throw new Error(`Expected PRESENT stream for map column but found: ${streamMetadata.physicalStreamType}`);
|
|
29720
|
+
const count = streamMetadata.numValues;
|
|
29721
|
+
const streamDataStart = offset.get();
|
|
29722
|
+
const value = new BitVector(decodeBooleanRle(data, count, streamMetadata.byteLength, offset), count);
|
|
29723
|
+
offset.set(streamDataStart + streamMetadata.byteLength);
|
|
29724
|
+
return {
|
|
29725
|
+
value,
|
|
29726
|
+
count
|
|
29727
|
+
};
|
|
29728
|
+
}
|
|
29729
|
+
/**
|
|
29730
|
+
* Decodes one child column's per-feature values.
|
|
29731
|
+
*
|
|
29732
|
+
* Lengths, presence bits and tokens are all laid out child-major, so each child picks up where the
|
|
29733
|
+
* previous one left off.
|
|
29734
|
+
*/
|
|
29735
|
+
function decodeChildColumn(streams, childIndex, featureCount, countsCursor, valuesCursor) {
|
|
29736
|
+
const { lengthStream, flattenedValues, presentStream, dictionary } = streams;
|
|
29737
|
+
const presentOffset = childIndex * featureCount;
|
|
29738
|
+
let presentInChild = featureCount;
|
|
29739
|
+
let nullabilityBuffer;
|
|
29740
|
+
if (presentStream) {
|
|
29741
|
+
nullabilityBuffer = new BitVector(new Uint8Array(Math.ceil(featureCount / 8)), featureCount);
|
|
29742
|
+
presentInChild = 0;
|
|
29743
|
+
for (let i = 0; i < featureCount; i++) if (presentStream.get(presentOffset + i)) {
|
|
29744
|
+
nullabilityBuffer.set(i, true);
|
|
29745
|
+
presentInChild++;
|
|
29746
|
+
}
|
|
29747
|
+
}
|
|
29748
|
+
const countsEnd = countsCursor + presentInChild;
|
|
29749
|
+
if (countsEnd > lengthStream.length) throw new Error("Merged map counts underflow while decoding child streams");
|
|
29750
|
+
const value = new Array(featureCount);
|
|
29751
|
+
let countCursor = countsCursor;
|
|
29752
|
+
let flattenedIndex = valuesCursor;
|
|
29753
|
+
for (let featureIndex = 0; featureIndex < featureCount; featureIndex++) {
|
|
29754
|
+
if (presentStream && !presentStream.get(presentOffset + featureIndex)) {
|
|
29755
|
+
value[featureIndex] = null;
|
|
29756
|
+
continue;
|
|
29757
|
+
}
|
|
29758
|
+
const endIndex = flattenedIndex + lengthStream[countCursor++];
|
|
29759
|
+
if (endIndex > flattenedValues.length) throw new Error("Map value stream underflow while decoding feature payload");
|
|
29760
|
+
const decoded = decodeFeatureValue(flattenedValues, flattenedIndex, endIndex, dictionary);
|
|
29761
|
+
value[featureIndex] = decoded.value;
|
|
29762
|
+
flattenedIndex = decoded.nextIndex;
|
|
29763
|
+
}
|
|
29764
|
+
let childValueCount = 0;
|
|
29765
|
+
for (let i = countsCursor; i < countsEnd; i++) childValueCount += lengthStream[i];
|
|
29766
|
+
const valuesEnd = valuesCursor + childValueCount;
|
|
29767
|
+
if (flattenedIndex !== valuesEnd) throw new Error("Unused flattened map values remain after decode");
|
|
29768
|
+
return {
|
|
29769
|
+
value,
|
|
29770
|
+
nullabilityBuffer,
|
|
29771
|
+
countsEnd,
|
|
29772
|
+
valuesEnd
|
|
29773
|
+
};
|
|
29774
|
+
}
|
|
29775
|
+
/**
|
|
29776
|
+
* A feature's payload is a bare sequence of map entries, unless it is a single token — a root-level
|
|
29777
|
+
* scalar — or opens with a list token. Those two shapes are what distinguish it from map entries.
|
|
29778
|
+
*/
|
|
29779
|
+
function decodeFeatureValue(flattenedValues, startIndex, endIndex, dictionary) {
|
|
29780
|
+
if (endIndex - startIndex === 1 || flattenedValues[startIndex] === MapControlValue.START_LIST) return decodeValue(flattenedValues, startIndex, endIndex, dictionary);
|
|
29781
|
+
return decodeMapEntries(flattenedValues, startIndex, endIndex, dictionary);
|
|
29782
|
+
}
|
|
29783
|
+
function decodeMapEntries(flattenedValues, startIndex, endIndex, dictionary) {
|
|
29784
|
+
const value = Object.create(null);
|
|
29785
|
+
let index = startIndex;
|
|
29786
|
+
while (index < endIndex) {
|
|
29787
|
+
const key = decodeScalarByIndex(flattenedValues[index++], dictionary);
|
|
29788
|
+
if (typeof key !== "string") throw new Error(`Map key dictionary index does not resolve to a string: ${key}`);
|
|
29789
|
+
const decoded = decodeValue(flattenedValues, index, endIndex, dictionary);
|
|
29790
|
+
value[key] = decoded.value;
|
|
29791
|
+
index = decoded.nextIndex;
|
|
29792
|
+
}
|
|
29793
|
+
return {
|
|
29794
|
+
value,
|
|
29795
|
+
nextIndex: index
|
|
29796
|
+
};
|
|
29797
|
+
}
|
|
29798
|
+
function decodeValue(flattenedValues, startIndex, endIndex, dictionary) {
|
|
29799
|
+
if (startIndex >= endIndex) throw new Error("Unexpected end of map value stream");
|
|
29800
|
+
const token = flattenedValues[startIndex];
|
|
29801
|
+
if (token === MapControlValue.FALSE) return {
|
|
29802
|
+
value: false,
|
|
29803
|
+
nextIndex: startIndex + 1
|
|
29804
|
+
};
|
|
29805
|
+
if (token === MapControlValue.TRUE) return {
|
|
29806
|
+
value: true,
|
|
29807
|
+
nextIndex: startIndex + 1
|
|
29808
|
+
};
|
|
29809
|
+
if (token === MapControlValue.START_MAP) {
|
|
29810
|
+
const valueEndIndex = decodeNestedPayloadEnd(flattenedValues, startIndex, endIndex);
|
|
29811
|
+
return {
|
|
29812
|
+
value: decodeMapEntries(flattenedValues, startIndex + 2, valueEndIndex, dictionary).value,
|
|
29813
|
+
nextIndex: valueEndIndex
|
|
29814
|
+
};
|
|
29815
|
+
}
|
|
29816
|
+
if (token === MapControlValue.START_LIST) {
|
|
29817
|
+
const valueEndIndex = decodeNestedPayloadEnd(flattenedValues, startIndex, endIndex);
|
|
29818
|
+
const value = [];
|
|
29819
|
+
let index = startIndex + 2;
|
|
29820
|
+
while (index < valueEndIndex) {
|
|
29821
|
+
const nested = decodeValue(flattenedValues, index, valueEndIndex, dictionary);
|
|
29822
|
+
value.push(nested.value);
|
|
29823
|
+
index = nested.nextIndex;
|
|
29824
|
+
}
|
|
29825
|
+
return {
|
|
29826
|
+
value,
|
|
29827
|
+
nextIndex: valueEndIndex
|
|
29828
|
+
};
|
|
29829
|
+
}
|
|
29830
|
+
return {
|
|
29831
|
+
value: decodeScalarByIndex(token, dictionary),
|
|
29832
|
+
nextIndex: startIndex + 1
|
|
29833
|
+
};
|
|
29834
|
+
}
|
|
29835
|
+
/**
|
|
29836
|
+
* Reads the length prefix of a nested payload and returns where it ends, the counterpart of
|
|
29837
|
+
* `encodeNestedPayloadLength`. The length covers the two header tokens as well.
|
|
29838
|
+
*/
|
|
29839
|
+
function decodeNestedPayloadEnd(flattenedValues, startIndex, endIndex) {
|
|
29840
|
+
if (startIndex + 1 >= endIndex) throw new Error("Missing length for nested map/list payload");
|
|
29841
|
+
const encodedLength = flattenedValues[startIndex + 1];
|
|
29842
|
+
if (encodedLength < 2) throw new Error(`Invalid nested payload length: ${encodedLength}`);
|
|
29843
|
+
const valueEndIndex = startIndex + encodedLength;
|
|
29844
|
+
if (valueEndIndex > endIndex) throw new Error("Nested payload exceeds containing payload bounds");
|
|
29845
|
+
return valueEndIndex;
|
|
29846
|
+
}
|
|
29847
|
+
function decodeScalarByIndex(token, dictionary) {
|
|
29848
|
+
const dictionaryIndex = token - MapControlValue.COUNT;
|
|
29849
|
+
if (dictionaryIndex < 0 || dictionaryIndex >= dictionary.length) throw new Error(`Scalar dictionary index out of range: ${token}`);
|
|
29850
|
+
return dictionary[dictionaryIndex];
|
|
29851
|
+
}
|
|
29852
|
+
function pushAll(dictionary, values) {
|
|
29853
|
+
for (const value of values) dictionary.push(value);
|
|
29854
|
+
}
|
|
29855
|
+
//#endregion
|
|
29537
29856
|
//#region node_modules/@maplibre/mlt/dist/decoding/propertyDecoder.js
|
|
29538
29857
|
function decodePropertyColumn(data, offset, columnMetadata, numStreams, numFeatures, propertyColumnNames) {
|
|
29539
29858
|
if (columnMetadata.type === "scalarType") {
|
|
@@ -29543,11 +29862,12 @@ function decodePropertyColumn(data, offset, columnMetadata, numStreams, numFeatu
|
|
|
29543
29862
|
}
|
|
29544
29863
|
return decodeScalarPropertyColumn(numStreams, data, offset, numFeatures, columnMetadata.scalarType, columnMetadata);
|
|
29545
29864
|
}
|
|
29865
|
+
if (columnMetadata.complexType?.physicalType === ComplexType.MAP) return decodeMapPropertyColumn(data, offset, columnMetadata, numStreams);
|
|
29546
29866
|
if (numStreams === 0) return null;
|
|
29547
29867
|
return decodeSharedDictionary(data, offset, columnMetadata, propertyColumnNames);
|
|
29548
29868
|
}
|
|
29549
29869
|
function decodeScalarPropertyColumn(numStreams, data, offset, numFeatures, column, columnMetadata) {
|
|
29550
|
-
let nullabilityBuffer
|
|
29870
|
+
let nullabilityBuffer;
|
|
29551
29871
|
if (numStreams === 0) return null;
|
|
29552
29872
|
if (columnMetadata.nullable) {
|
|
29553
29873
|
const presentStreamMetadata = decodeStreamMetadata(data, offset);
|
|
@@ -29563,7 +29883,7 @@ function decodeScalarPropertyColumn(numStreams, data, offset, numFeatures, colum
|
|
|
29563
29883
|
case ScalarType.INT_32: return decodeInt32Column(data, offset, columnMetadata, column, sizeOrNullabilityBuffer);
|
|
29564
29884
|
case ScalarType.STRING: {
|
|
29565
29885
|
const stringDataStreams = columnMetadata.nullable ? numStreams - 1 : numStreams;
|
|
29566
|
-
return decodeString$1(columnMetadata.name, data, offset, stringDataStreams, nullabilityBuffer);
|
|
29886
|
+
return decodeString$1(columnMetadata.name, data, offset, stringDataStreams, nullabilityBuffer) ?? null;
|
|
29567
29887
|
}
|
|
29568
29888
|
case ScalarType.BOOLEAN: return decodeBooleanColumn(data, offset, columnMetadata, numFeatures, sizeOrNullabilityBuffer);
|
|
29569
29889
|
case ScalarType.UINT_64:
|
|
@@ -29606,7 +29926,7 @@ function decodeInt64Column(data, offset, column, sizeOrNullabilityBuffer, scalar
|
|
|
29606
29926
|
}
|
|
29607
29927
|
if (vectorType === VectorType.SEQUENCE) {
|
|
29608
29928
|
const id = decodeSequenceInt64Stream(data, offset, dataStreamMetadata);
|
|
29609
|
-
return new Int64SequenceVector(column.name, id[0], id[1], dataStreamMetadata.numRleValues);
|
|
29929
|
+
return new Int64SequenceVector(column.name, id[0], id[1], dataStreamMetadata.numRleValues, isSigned);
|
|
29610
29930
|
}
|
|
29611
29931
|
const constValue = isSigned ? decodeSignedConstInt64Stream(data, offset, dataStreamMetadata) : decodeUnsignedConstInt64Stream(data, offset, dataStreamMetadata);
|
|
29612
29932
|
return new Int64ConstVector(column.name, constValue, sizeOrNullabilityBuffer, isSigned);
|
|
@@ -29622,7 +29942,7 @@ function decodeInt32Column(data, offset, column, scalarColumn, sizeOrNullability
|
|
|
29622
29942
|
}
|
|
29623
29943
|
if (vectorType === VectorType.SEQUENCE) {
|
|
29624
29944
|
const id = decodeSequenceInt32Stream(data, offset, dataStreamMetadata);
|
|
29625
|
-
return new Int32SequenceVector(column.name, id[0], id[1], dataStreamMetadata.numRleValues);
|
|
29945
|
+
return new Int32SequenceVector(column.name, id[0], id[1], dataStreamMetadata.numRleValues, isSigned);
|
|
29626
29946
|
}
|
|
29627
29947
|
const constValue = isSigned ? decodeSignedConstInt32Stream(data, offset, dataStreamMetadata) : decodeUnsignedConstInt32Stream(data, offset, dataStreamMetadata);
|
|
29628
29948
|
return new Int32ConstVector(column.name, constValue, sizeOrNullabilityBuffer, isSigned);
|
|
@@ -29633,10 +29953,28 @@ function isNullabilityBuffer(sizeOrNullabilityBuffer) {
|
|
|
29633
29953
|
//#endregion
|
|
29634
29954
|
//#region node_modules/@maplibre/mlt/dist/metadata/tileset/typeMap.js
|
|
29635
29955
|
/**
|
|
29956
|
+
* The single varint32 that introduces every column in the tile metadata, identifying what kind of
|
|
29957
|
+
* column follows. Ids occupy a small range of flagged codes, geometry has one code of its own, and
|
|
29958
|
+
* scalar properties are laid out from `SCALAR_BASE` upwards, two codes per type.
|
|
29959
|
+
*/
|
|
29960
|
+
const ColumnTypeCode = {
|
|
29961
|
+
/** Id columns occupy 0..3. */
|
|
29962
|
+
ID: 0,
|
|
29963
|
+
/** Set on an id column whose values can be null. */
|
|
29964
|
+
ID_NULLABLE: 1,
|
|
29965
|
+
/** Set on an id column holding 64-bit rather than 32-bit ids. */
|
|
29966
|
+
ID_LONG: 2,
|
|
29967
|
+
GEOMETRY: 4,
|
|
29968
|
+
/** Scalar properties are `SCALAR_BASE + scalarType * 2 + (nullable ? 1 : 0)`. */
|
|
29969
|
+
SCALAR_BASE: 10,
|
|
29970
|
+
STRUCT: 30,
|
|
29971
|
+
MAP: 31
|
|
29972
|
+
};
|
|
29973
|
+
/**
|
|
29636
29974
|
* The type code is a single varint32 that encodes:
|
|
29637
29975
|
* - Physical or logical type
|
|
29638
29976
|
* - Nullable flag
|
|
29639
|
-
* - Whether the column has a name (typeCode >=
|
|
29977
|
+
* - Whether the column has a name (typeCode >= ColumnTypeCode.SCALAR_BASE)
|
|
29640
29978
|
* - Whether the column has children (typeCode == 30 for STRUCT)
|
|
29641
29979
|
* - For ID types: whether it uses long (64-bit) IDs
|
|
29642
29980
|
*/
|
|
@@ -29652,60 +29990,66 @@ function isNullabilityBuffer(sizeOrNullabilityBuffer) {
|
|
|
29652
29990
|
*/
|
|
29653
29991
|
function decodeColumnType(typeCode) {
|
|
29654
29992
|
switch (typeCode) {
|
|
29655
|
-
case
|
|
29656
|
-
case
|
|
29657
|
-
case
|
|
29658
|
-
case
|
|
29659
|
-
|
|
29660
|
-
|
|
29661
|
-
|
|
29662
|
-
|
|
29663
|
-
|
|
29664
|
-
|
|
29665
|
-
|
|
29666
|
-
|
|
29667
|
-
|
|
29668
|
-
|
|
29669
|
-
|
|
29670
|
-
|
|
29671
|
-
|
|
29672
|
-
|
|
29673
|
-
|
|
29674
|
-
|
|
29675
|
-
|
|
29676
|
-
|
|
29677
|
-
|
|
29678
|
-
|
|
29679
|
-
|
|
29680
|
-
|
|
29681
|
-
|
|
29682
|
-
|
|
29683
|
-
|
|
29684
|
-
|
|
29685
|
-
|
|
29686
|
-
|
|
29687
|
-
|
|
29688
|
-
|
|
29689
|
-
|
|
29690
|
-
|
|
29691
|
-
|
|
29993
|
+
case ColumnTypeCode.ID:
|
|
29994
|
+
case ColumnTypeCode.ID | ColumnTypeCode.ID_NULLABLE:
|
|
29995
|
+
case ColumnTypeCode.ID | ColumnTypeCode.ID_LONG:
|
|
29996
|
+
case ColumnTypeCode.ID | ColumnTypeCode.ID_LONG | ColumnTypeCode.ID_NULLABLE: return {
|
|
29997
|
+
nullable: (typeCode & ColumnTypeCode.ID_NULLABLE) !== 0,
|
|
29998
|
+
columnScope: ColumnScope.FEATURE,
|
|
29999
|
+
type: "scalarType",
|
|
30000
|
+
scalarType: {
|
|
30001
|
+
longID: (typeCode & ColumnTypeCode.ID_LONG) !== 0,
|
|
30002
|
+
type: "logicalType",
|
|
30003
|
+
logicalType: LogicalScalarType.ID
|
|
30004
|
+
}
|
|
30005
|
+
};
|
|
30006
|
+
case ColumnTypeCode.GEOMETRY: return {
|
|
30007
|
+
nullable: false,
|
|
30008
|
+
columnScope: ColumnScope.FEATURE,
|
|
30009
|
+
type: "complexType",
|
|
30010
|
+
complexType: {
|
|
30011
|
+
type: "physicalType",
|
|
30012
|
+
physicalType: ComplexType.GEOMETRY,
|
|
30013
|
+
children: []
|
|
30014
|
+
}
|
|
30015
|
+
};
|
|
30016
|
+
case ColumnTypeCode.STRUCT: return {
|
|
30017
|
+
nullable: false,
|
|
30018
|
+
columnScope: ColumnScope.FEATURE,
|
|
30019
|
+
type: "complexType",
|
|
30020
|
+
complexType: {
|
|
30021
|
+
type: "physicalType",
|
|
30022
|
+
physicalType: ComplexType.STRUCT,
|
|
30023
|
+
children: []
|
|
30024
|
+
}
|
|
30025
|
+
};
|
|
30026
|
+
case ColumnTypeCode.MAP: return {
|
|
30027
|
+
nullable: true,
|
|
30028
|
+
columnScope: ColumnScope.FEATURE,
|
|
30029
|
+
type: "complexType",
|
|
30030
|
+
complexType: {
|
|
30031
|
+
type: "physicalType",
|
|
30032
|
+
physicalType: ComplexType.MAP,
|
|
30033
|
+
children: []
|
|
30034
|
+
}
|
|
30035
|
+
};
|
|
29692
30036
|
default: return mapScalarType(typeCode);
|
|
29693
30037
|
}
|
|
29694
30038
|
}
|
|
29695
30039
|
/**
|
|
29696
30040
|
* Returns true if this type code requires a name to be stored.
|
|
29697
30041
|
* ID (0-3) and GEOMETRY (4) columns have implicit names.
|
|
29698
|
-
* All other types (>=
|
|
30042
|
+
* All other types (>= ColumnTypeCode.SCALAR_BASE) require explicit names.
|
|
29699
30043
|
*/
|
|
29700
30044
|
function columnTypeHasName(typeCode) {
|
|
29701
|
-
return typeCode >=
|
|
30045
|
+
return typeCode >= ColumnTypeCode.SCALAR_BASE;
|
|
29702
30046
|
}
|
|
29703
30047
|
/**
|
|
29704
30048
|
* Returns true if this type code has child fields.
|
|
29705
|
-
*
|
|
30049
|
+
* STRUCT (typeCode 30) and MAP (typeCode 31) have children.
|
|
29706
30050
|
*/
|
|
29707
30051
|
function columnTypeHasChildren(typeCode) {
|
|
29708
|
-
return typeCode ===
|
|
30052
|
+
return typeCode === ColumnTypeCode.STRUCT || typeCode === ColumnTypeCode.MAP;
|
|
29709
30053
|
}
|
|
29710
30054
|
/**
|
|
29711
30055
|
* Determines if a stream count needs to be read for this column.
|
|
@@ -29732,7 +30076,8 @@ function hasStreamCount(column) {
|
|
|
29732
30076
|
const complexCol = column.complexType;
|
|
29733
30077
|
if (complexCol.type === "physicalType") switch (complexCol.physicalType) {
|
|
29734
30078
|
case ComplexType.GEOMETRY:
|
|
29735
|
-
case ComplexType.STRUCT:
|
|
30079
|
+
case ComplexType.STRUCT:
|
|
30080
|
+
case ComplexType.MAP: return true;
|
|
29736
30081
|
default: return false;
|
|
29737
30082
|
}
|
|
29738
30083
|
}
|
|
@@ -29751,65 +30096,66 @@ function isGeometryColumn(column) {
|
|
|
29751
30096
|
* Even codes are non-nullable, odd codes are nullable.
|
|
29752
30097
|
*/
|
|
29753
30098
|
function mapScalarType(typeCode) {
|
|
29754
|
-
let
|
|
30099
|
+
let physicalType;
|
|
29755
30100
|
switch (typeCode) {
|
|
29756
30101
|
case 10:
|
|
29757
30102
|
case 11:
|
|
29758
|
-
|
|
30103
|
+
physicalType = ScalarType.BOOLEAN;
|
|
29759
30104
|
break;
|
|
29760
30105
|
case 12:
|
|
29761
30106
|
case 13:
|
|
29762
|
-
|
|
30107
|
+
physicalType = ScalarType.INT_8;
|
|
29763
30108
|
break;
|
|
29764
30109
|
case 14:
|
|
29765
30110
|
case 15:
|
|
29766
|
-
|
|
30111
|
+
physicalType = ScalarType.UINT_8;
|
|
29767
30112
|
break;
|
|
29768
30113
|
case 16:
|
|
29769
30114
|
case 17:
|
|
29770
|
-
|
|
30115
|
+
physicalType = ScalarType.INT_32;
|
|
29771
30116
|
break;
|
|
29772
30117
|
case 18:
|
|
29773
30118
|
case 19:
|
|
29774
|
-
|
|
30119
|
+
physicalType = ScalarType.UINT_32;
|
|
29775
30120
|
break;
|
|
29776
30121
|
case 20:
|
|
29777
30122
|
case 21:
|
|
29778
|
-
|
|
30123
|
+
physicalType = ScalarType.INT_64;
|
|
29779
30124
|
break;
|
|
29780
30125
|
case 22:
|
|
29781
30126
|
case 23:
|
|
29782
|
-
|
|
30127
|
+
physicalType = ScalarType.UINT_64;
|
|
29783
30128
|
break;
|
|
29784
30129
|
case 24:
|
|
29785
30130
|
case 25:
|
|
29786
|
-
|
|
30131
|
+
physicalType = ScalarType.FLOAT;
|
|
29787
30132
|
break;
|
|
29788
30133
|
case 26:
|
|
29789
30134
|
case 27:
|
|
29790
|
-
|
|
30135
|
+
physicalType = ScalarType.DOUBLE;
|
|
29791
30136
|
break;
|
|
29792
30137
|
case 28:
|
|
29793
30138
|
case 29:
|
|
29794
|
-
|
|
30139
|
+
physicalType = ScalarType.STRING;
|
|
29795
30140
|
break;
|
|
29796
30141
|
default: return null;
|
|
29797
30142
|
}
|
|
29798
|
-
|
|
29799
|
-
|
|
29800
|
-
|
|
29801
|
-
|
|
29802
|
-
|
|
29803
|
-
|
|
29804
|
-
|
|
29805
|
-
|
|
29806
|
-
|
|
30143
|
+
return {
|
|
30144
|
+
nullable: (typeCode & 1) !== 0,
|
|
30145
|
+
columnScope: ColumnScope.FEATURE,
|
|
30146
|
+
type: "scalarType",
|
|
30147
|
+
scalarType: {
|
|
30148
|
+
longID: false,
|
|
30149
|
+
type: "physicalType",
|
|
30150
|
+
physicalType
|
|
30151
|
+
}
|
|
30152
|
+
};
|
|
29807
30153
|
}
|
|
29808
30154
|
//#endregion
|
|
29809
30155
|
//#region node_modules/@maplibre/mlt/dist/metadata/tileset/embeddedTilesetMetadataDecoder.js
|
|
29810
30156
|
const textDecoder = new TextDecoder();
|
|
29811
|
-
const SUPPORTED_COLUMN_TYPES = "0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT)";
|
|
29812
|
-
const SUPPORTED_FIELD_TYPES = "10-29(scalars), 30(STRUCT)";
|
|
30157
|
+
const SUPPORTED_COLUMN_TYPES = "0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT), 31(MAP)";
|
|
30158
|
+
const SUPPORTED_FIELD_TYPES = "10-29(scalars), 30(STRUCT), 31(MAP)";
|
|
29813
30159
|
/**
|
|
29814
30160
|
* Decodes a length-prefixed UTF-8 string.
|
|
29815
30161
|
* Layout: [len: varint32][bytes: len]
|
|
@@ -29828,12 +30174,18 @@ function decodeString(src, offset) {
|
|
|
29828
30174
|
* Used when decoding Field metadata which has the same format as Column.
|
|
29829
30175
|
*/
|
|
29830
30176
|
function columnToField(column) {
|
|
29831
|
-
|
|
29832
|
-
|
|
29833
|
-
|
|
30177
|
+
const name = column.name;
|
|
30178
|
+
const nullable = column.nullable;
|
|
30179
|
+
return column.type === "scalarType" ? {
|
|
30180
|
+
type: "scalarField",
|
|
29834
30181
|
scalarField: column.scalarType,
|
|
30182
|
+
name,
|
|
30183
|
+
nullable
|
|
30184
|
+
} : {
|
|
30185
|
+
type: "complexField",
|
|
29835
30186
|
complexField: column.complexType,
|
|
29836
|
-
|
|
30187
|
+
name,
|
|
30188
|
+
nullable
|
|
29837
30189
|
};
|
|
29838
30190
|
}
|
|
29839
30191
|
/**
|
|
@@ -29841,13 +30193,17 @@ function columnToField(column) {
|
|
|
29841
30193
|
*/
|
|
29842
30194
|
function decodeField(src, offset) {
|
|
29843
30195
|
const typeCode = decodeVarintInt32(src, offset, 1)[0] >>> 0;
|
|
29844
|
-
|
|
29845
|
-
|
|
29846
|
-
|
|
29847
|
-
|
|
30196
|
+
const base = typeCode >= ColumnTypeCode.SCALAR_BASE ? decodeColumnType(typeCode) : null;
|
|
30197
|
+
if (!base) throw new Error(`Unsupported field type code ${typeCode}. Supported: ${SUPPORTED_FIELD_TYPES}`);
|
|
30198
|
+
const column = {
|
|
30199
|
+
...base,
|
|
30200
|
+
name: decodeString(src, offset)
|
|
30201
|
+
};
|
|
30202
|
+
if (column.type === "complexType" && columnTypeHasChildren(typeCode)) {
|
|
30203
|
+
const complexCol = column.complexType;
|
|
29848
30204
|
const childCount = decodeVarintInt32(src, offset, 1)[0] >>> 0;
|
|
29849
|
-
|
|
29850
|
-
for (let i = 0; i < childCount; i++)
|
|
30205
|
+
complexCol.children = new Array(childCount);
|
|
30206
|
+
for (let i = 0; i < childCount; i++) complexCol.children[i] = decodeField(src, offset);
|
|
29851
30207
|
}
|
|
29852
30208
|
return columnToField(column);
|
|
29853
30209
|
}
|
|
@@ -29856,12 +30212,18 @@ function decodeField(src, offset) {
|
|
|
29856
30212
|
*/
|
|
29857
30213
|
function decodeColumn(src, offset) {
|
|
29858
30214
|
const typeCode = decodeVarintInt32(src, offset, 1)[0] >>> 0;
|
|
29859
|
-
const
|
|
29860
|
-
if (!
|
|
29861
|
-
|
|
29862
|
-
|
|
29863
|
-
else if (typeCode
|
|
29864
|
-
if (
|
|
30215
|
+
const base = decodeColumnType(typeCode);
|
|
30216
|
+
if (!base) throw new Error(`Unsupported column type code ${typeCode}. Supported: ${SUPPORTED_COLUMN_TYPES}`);
|
|
30217
|
+
let name;
|
|
30218
|
+
if (columnTypeHasName(typeCode)) name = decodeString(src, offset);
|
|
30219
|
+
else if (typeCode < ColumnTypeCode.GEOMETRY) name = "id";
|
|
30220
|
+
else if (typeCode === ColumnTypeCode.GEOMETRY) name = "geometry";
|
|
30221
|
+
else throw new Error(`Unsupported column type code ${typeCode}. Supported: ${SUPPORTED_COLUMN_TYPES}`);
|
|
30222
|
+
const column = {
|
|
30223
|
+
...base,
|
|
30224
|
+
name
|
|
30225
|
+
};
|
|
30226
|
+
if (column.type === "complexType" && columnTypeHasChildren(typeCode)) {
|
|
29865
30227
|
const childCount = decodeVarintInt32(src, offset, 1)[0] >>> 0;
|
|
29866
30228
|
const complexCol = column.complexType;
|
|
29867
30229
|
complexCol.children = new Array(childCount);
|
|
@@ -29906,7 +30268,8 @@ function decodeTile(tile, geometryScaling, idWithinMaxSafeInteger = true) {
|
|
|
29906
30268
|
const blockLength = decodeVarintInt32(tile, offset, 1)[0] >>> 0;
|
|
29907
30269
|
const blockEnd = offset.get() + blockLength;
|
|
29908
30270
|
if (blockEnd > tile.length) throw new Error(`Block overruns tile: ${blockEnd} > ${tile.length}`);
|
|
29909
|
-
|
|
30271
|
+
const tag = decodeVarintInt32(tile, offset, 1)[0] >>> 0;
|
|
30272
|
+
if (tag !== 1 && tag !== 2) {
|
|
29910
30273
|
offset.set(blockEnd);
|
|
29911
30274
|
continue;
|
|
29912
30275
|
}
|
|
@@ -29956,26 +30319,24 @@ function decodeTile(tile, geometryScaling, idWithinMaxSafeInteger = true) {
|
|
|
29956
30319
|
return featureTables;
|
|
29957
30320
|
}
|
|
29958
30321
|
function decodeIdColumn(tile, columnMetadata, offset, columnName, idDataStreamMetadata, sizeOrNullabilityBuffer, idWithinMaxSafeInteger = false) {
|
|
29959
|
-
const
|
|
29960
|
-
if (scalarTypeMetadata?.type !== "logicalType" || scalarTypeMetadata.logicalType !== LogicalScalarType.ID) throw new Error(`ID column must be a logical ID scalar type: ${columnName}`);
|
|
29961
|
-
const idDataType = scalarTypeMetadata.longID ? ScalarType.UINT_64 : ScalarType.UINT_32;
|
|
30322
|
+
const idDataType = columnMetadata.scalarType?.longID ? ScalarType.UINT_64 : ScalarType.UINT_32;
|
|
29962
30323
|
const nullabilityBuffer = typeof sizeOrNullabilityBuffer === "number" ? void 0 : sizeOrNullabilityBuffer;
|
|
29963
30324
|
const vectorType = getVectorType(idDataStreamMetadata, sizeOrNullabilityBuffer, tile, offset, idDataType === ScalarType.UINT_64 ? "int64" : "int32");
|
|
29964
30325
|
if (idDataType === ScalarType.UINT_32) switch (vectorType) {
|
|
29965
30326
|
case VectorType.FLAT: return new Int32FlatVector(columnName, decodeUnsignedInt32Stream(tile, offset, idDataStreamMetadata, void 0, nullabilityBuffer), sizeOrNullabilityBuffer);
|
|
29966
30327
|
case VectorType.SEQUENCE: {
|
|
29967
30328
|
const id = decodeSequenceInt32Stream(tile, offset, idDataStreamMetadata);
|
|
29968
|
-
return new Int32SequenceVector(columnName, id[0], id[1], idDataStreamMetadata.numRleValues);
|
|
30329
|
+
return new Int32SequenceVector(columnName, id[0], id[1], idDataStreamMetadata.numRleValues, false);
|
|
29969
30330
|
}
|
|
29970
30331
|
case VectorType.CONST: return new Int32ConstVector(columnName, decodeUnsignedConstInt32Stream(tile, offset, idDataStreamMetadata), sizeOrNullabilityBuffer, false);
|
|
29971
30332
|
}
|
|
29972
30333
|
switch (vectorType) {
|
|
29973
30334
|
case VectorType.FLAT:
|
|
29974
|
-
if (idWithinMaxSafeInteger) return new DoubleFlatVector(columnName, decodeUnsignedInt64AsFloat64Stream(tile, offset, idDataStreamMetadata), sizeOrNullabilityBuffer);
|
|
30335
|
+
if (idWithinMaxSafeInteger) return new DoubleFlatVector(columnName, decodeUnsignedInt64AsFloat64Stream(tile, offset, idDataStreamMetadata, nullabilityBuffer), sizeOrNullabilityBuffer);
|
|
29975
30336
|
return new Int64FlatVector(columnName, decodeUnsignedInt64Stream(tile, offset, idDataStreamMetadata, nullabilityBuffer), sizeOrNullabilityBuffer);
|
|
29976
30337
|
case VectorType.SEQUENCE: {
|
|
29977
30338
|
const id = decodeSequenceInt64Stream(tile, offset, idDataStreamMetadata);
|
|
29978
|
-
return new Int64SequenceVector(columnName, id[0], id[1], idDataStreamMetadata.numRleValues);
|
|
30339
|
+
return new Int64SequenceVector(columnName, id[0], id[1], idDataStreamMetadata.numRleValues, false);
|
|
29979
30340
|
}
|
|
29980
30341
|
case VectorType.CONST: return new Int64ConstVector(columnName, decodeUnsignedConstInt64Stream(tile, offset, idDataStreamMetadata), sizeOrNullabilityBuffer, false);
|
|
29981
30342
|
}
|