@dra2020/baseclient 1.0.92 → 1.0.94
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 +30 -1
- package/dist/baseclient.js.map +1 -1
- package/dist/geo/geo.d.ts +1 -0
- package/dist/geo/multiblockmapping.d.ts +2 -0
- package/lib/geo/geo.ts +24 -0
- package/lib/geo/multiblockmapping.ts +13 -0
- package/package.json +1 -1
package/dist/baseclient.js
CHANGED
|
@@ -2573,6 +2573,25 @@ class GeoMultiCollection {
|
|
|
2573
2573
|
this._onChange();
|
|
2574
2574
|
}
|
|
2575
2575
|
}
|
|
2576
|
+
// Add the "all" collection from the passed in multi, but do not force compute of any things not computed yet.
|
|
2577
|
+
addAll(tag, multi) {
|
|
2578
|
+
let nEntries = Util.countKeys(multi.entries);
|
|
2579
|
+
if (nEntries) {
|
|
2580
|
+
// Make sure all collection is created
|
|
2581
|
+
if (!multi.all.topo && !multi.all.col && !multi.all.map) {
|
|
2582
|
+
// Create cheapest one (collection if I need to create, otherwise copy from single entry)
|
|
2583
|
+
if (nEntries > 1)
|
|
2584
|
+
multi.allCol();
|
|
2585
|
+
else {
|
|
2586
|
+
let e = multi.nthEntry(0);
|
|
2587
|
+
multi.all.topo = e.topo;
|
|
2588
|
+
multi.all.col = e.col;
|
|
2589
|
+
multi.all.map = e.map;
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2592
|
+
this.add(tag, multi.all.topo, multi.all.col, multi.all.map);
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2576
2595
|
remove(tag) {
|
|
2577
2596
|
let entry = this.entries[tag];
|
|
2578
2597
|
if (entry) {
|
|
@@ -2882,6 +2901,7 @@ exports.reverseBlockMapping = reverseBlockMapping;
|
|
|
2882
2901
|
class MultiBlockMapping {
|
|
2883
2902
|
constructor(tag, bm) {
|
|
2884
2903
|
this.entries = [];
|
|
2904
|
+
this.stamp = Math.trunc(Math.random() * Number.MAX_SAFE_INTEGER / 2);
|
|
2885
2905
|
if (tag && bm)
|
|
2886
2906
|
this.entries.push({ tag, bm });
|
|
2887
2907
|
}
|
|
@@ -2893,11 +2913,14 @@ class MultiBlockMapping {
|
|
|
2893
2913
|
} });
|
|
2894
2914
|
if (bm)
|
|
2895
2915
|
this.entries.push({ tag, bm });
|
|
2916
|
+
this.stamp++;
|
|
2896
2917
|
}
|
|
2897
2918
|
remove(tag) {
|
|
2898
2919
|
for (let i = this.entries.length - 1; i >= 0; i--)
|
|
2899
|
-
if (this.entries[i].tag === tag)
|
|
2920
|
+
if (this.entries[i].tag === tag) {
|
|
2921
|
+
this.stamp++;
|
|
2900
2922
|
this.entries.splice(i, 1);
|
|
2923
|
+
}
|
|
2901
2924
|
}
|
|
2902
2925
|
map(blockid) {
|
|
2903
2926
|
// Walk backwards to pick up overrides first
|
|
@@ -2908,6 +2931,12 @@ class MultiBlockMapping {
|
|
|
2908
2931
|
}
|
|
2909
2932
|
return undefined;
|
|
2910
2933
|
}
|
|
2934
|
+
multimap(blockid) {
|
|
2935
|
+
let a = [];
|
|
2936
|
+
this.entries.forEach(e => { if (e.bm[blockid])
|
|
2937
|
+
a.push(e.bm[blockid]); });
|
|
2938
|
+
return a;
|
|
2939
|
+
}
|
|
2911
2940
|
bmOf(tag) {
|
|
2912
2941
|
let e = this.entries.find(e => e.tag === tag);
|
|
2913
2942
|
return e ? e.bm : null;
|