@dra2020/baseclient 1.0.16 → 1.0.17
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/baseclient.js +12 -6
- package/dist/baseclient.js.map +1 -1
- package/lib/poly/polybin.ts +5 -4
- package/lib/poly/polypack.ts +4 -2
- package/package.json +1 -1
package/dist/baseclient.js
CHANGED
|
@@ -6364,9 +6364,11 @@ function unpackString(coder, buf8, buf32, offset) {
|
|
|
6364
6364
|
function packCollection(coder, col) {
|
|
6365
6365
|
// Compute size
|
|
6366
6366
|
let pp = PP.featurePack(col);
|
|
6367
|
-
let
|
|
6367
|
+
let f = col.features.find((f) => { return f.geometry.packed ? f.geometry.packed.buffer : null; });
|
|
6368
|
+
let buffer = f ? f.geometry.packed.buffer : null;
|
|
6368
6369
|
let size = 16; // int endiness, offset to coordinates, float endiness
|
|
6369
|
-
col.features.forEach((f) => {
|
|
6370
|
+
col.features.forEach((f) => { if (f.geometry.packed)
|
|
6371
|
+
delete f.geometry.packed.buffer; }); // reconstructed when unpacking
|
|
6370
6372
|
let j = JSON.stringify(col);
|
|
6371
6373
|
size += sizeOfString(coder, j);
|
|
6372
6374
|
size += pad(size, 8);
|
|
@@ -6392,7 +6394,8 @@ function packCollection(coder, col) {
|
|
|
6392
6394
|
for (let i = 0; i < pp.length; i++)
|
|
6393
6395
|
buf64[foff++] = buf[i];
|
|
6394
6396
|
// Now restore
|
|
6395
|
-
col.features.forEach((f) => { f.geometry.packed
|
|
6397
|
+
col.features.forEach((f) => { if (f.geometry.packed)
|
|
6398
|
+
f.geometry.packed.buffer = buffer; });
|
|
6396
6399
|
PP.featureUnpack(col);
|
|
6397
6400
|
return ab;
|
|
6398
6401
|
}
|
|
@@ -6444,7 +6447,8 @@ function unpackCollection(coder, ab) {
|
|
|
6444
6447
|
let offset = 16;
|
|
6445
6448
|
let j = unpackString(coder, buf8, buf32, offset);
|
|
6446
6449
|
col = JSON.parse(j);
|
|
6447
|
-
col.features.forEach((f) => { f.geometry.packed
|
|
6450
|
+
col.features.forEach((f) => { if (f.geometry.packed)
|
|
6451
|
+
f.geometry.packed.buffer = buf64; });
|
|
6448
6452
|
return col;
|
|
6449
6453
|
}
|
|
6450
6454
|
exports.unpackCollection = unpackCollection;
|
|
@@ -7028,14 +7032,16 @@ function polyUnpack(prepack) {
|
|
|
7028
7032
|
}
|
|
7029
7033
|
exports.polyUnpack = polyUnpack;
|
|
7030
7034
|
function featurePackSize(f) {
|
|
7031
|
-
if (f && f.geometry && f.geometry.coordinates)
|
|
7035
|
+
if (f && f.geometry && f.geometry.coordinates && f.geometry.type !== 'Point')
|
|
7032
7036
|
return polyPackSize(f.geometry.coordinates);
|
|
7033
7037
|
return 0;
|
|
7034
7038
|
}
|
|
7035
7039
|
exports.featurePackSize = featurePackSize;
|
|
7036
7040
|
function featurePack(f, prepack) {
|
|
7037
7041
|
if (f && f.type === 'Feature') {
|
|
7038
|
-
if (f.geometry && f.geometry.
|
|
7042
|
+
if (f.geometry && f.geometry.type === 'Point')
|
|
7043
|
+
return prepack ? { offset: prepack.offset, length: 0, buffer: prepack.buffer } : { offset: 0, length: 0, buffer: null };
|
|
7044
|
+
else if (f.geometry && f.geometry.coordinates) {
|
|
7039
7045
|
f.geometry.packed = polyPack(f.geometry.coordinates, prepack);
|
|
7040
7046
|
delete f.geometry.coordinates;
|
|
7041
7047
|
}
|