gis-leaflet-helper 3.2.21 → 3.2.23
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.
|
@@ -19350,7 +19350,7 @@ function parse(code) {
|
|
|
19350
19350
|
return code;
|
|
19351
19351
|
}
|
|
19352
19352
|
}
|
|
19353
|
-
function extend
|
|
19353
|
+
function extend(destination, source) {
|
|
19354
19354
|
destination = destination || {};
|
|
19355
19355
|
var value, property;
|
|
19356
19356
|
if (!source) {
|
|
@@ -21325,8 +21325,8 @@ function Projection(srsCode, callback) {
|
|
|
21325
21325
|
ecc.ep2,
|
|
21326
21326
|
nadgrids
|
|
21327
21327
|
);
|
|
21328
|
-
extend
|
|
21329
|
-
extend
|
|
21328
|
+
extend(this, json);
|
|
21329
|
+
extend(this, ourProj);
|
|
21330
21330
|
this.a = sphere_.a;
|
|
21331
21331
|
this.b = sphere_.b;
|
|
21332
21332
|
this.rf = sphere_.rf;
|
|
@@ -26560,582 +26560,6 @@ const CanvasMarker = leafletSrcExports.Layer.extend({
|
|
|
26560
26560
|
}
|
|
26561
26561
|
}
|
|
26562
26562
|
});
|
|
26563
|
-
function quickselect(arr, k, left, right, compare) {
|
|
26564
|
-
quickselectStep(arr, k, left || 0, right || arr.length - 1, compare || defaultCompare);
|
|
26565
|
-
}
|
|
26566
|
-
function quickselectStep(arr, k, left, right, compare) {
|
|
26567
|
-
while (right > left) {
|
|
26568
|
-
if (right - left > 600) {
|
|
26569
|
-
var n = right - left + 1;
|
|
26570
|
-
var m = k - left + 1;
|
|
26571
|
-
var z = Math.log(n);
|
|
26572
|
-
var s = 0.5 * Math.exp(2 * z / 3);
|
|
26573
|
-
var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
|
|
26574
|
-
var newLeft = Math.max(left, Math.floor(k - m * s / n + sd));
|
|
26575
|
-
var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));
|
|
26576
|
-
quickselectStep(arr, k, newLeft, newRight, compare);
|
|
26577
|
-
}
|
|
26578
|
-
var t = arr[k];
|
|
26579
|
-
var i = left;
|
|
26580
|
-
var j = right;
|
|
26581
|
-
swap(arr, left, k);
|
|
26582
|
-
if (compare(arr[right], t) > 0) swap(arr, left, right);
|
|
26583
|
-
while (i < j) {
|
|
26584
|
-
swap(arr, i, j);
|
|
26585
|
-
i++;
|
|
26586
|
-
j--;
|
|
26587
|
-
while (compare(arr[i], t) < 0) i++;
|
|
26588
|
-
while (compare(arr[j], t) > 0) j--;
|
|
26589
|
-
}
|
|
26590
|
-
if (compare(arr[left], t) === 0) swap(arr, left, j);
|
|
26591
|
-
else {
|
|
26592
|
-
j++;
|
|
26593
|
-
swap(arr, j, right);
|
|
26594
|
-
}
|
|
26595
|
-
if (j <= k) left = j + 1;
|
|
26596
|
-
if (k <= j) right = j - 1;
|
|
26597
|
-
}
|
|
26598
|
-
}
|
|
26599
|
-
function swap(arr, i, j) {
|
|
26600
|
-
var tmp = arr[i];
|
|
26601
|
-
arr[i] = arr[j];
|
|
26602
|
-
arr[j] = tmp;
|
|
26603
|
-
}
|
|
26604
|
-
function defaultCompare(a, b) {
|
|
26605
|
-
return a < b ? -1 : a > b ? 1 : 0;
|
|
26606
|
-
}
|
|
26607
|
-
class RBush {
|
|
26608
|
-
constructor(maxEntries = 9) {
|
|
26609
|
-
this._maxEntries = Math.max(4, maxEntries);
|
|
26610
|
-
this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
|
|
26611
|
-
this.clear();
|
|
26612
|
-
}
|
|
26613
|
-
all() {
|
|
26614
|
-
return this._all(this.data, []);
|
|
26615
|
-
}
|
|
26616
|
-
search(bbox) {
|
|
26617
|
-
let node = this.data;
|
|
26618
|
-
const result = [];
|
|
26619
|
-
if (!intersects(bbox, node)) return result;
|
|
26620
|
-
const toBBox = this.toBBox;
|
|
26621
|
-
const nodesToSearch = [];
|
|
26622
|
-
while (node) {
|
|
26623
|
-
for (let i = 0; i < node.children.length; i++) {
|
|
26624
|
-
const child = node.children[i];
|
|
26625
|
-
const childBBox = node.leaf ? toBBox(child) : child;
|
|
26626
|
-
if (intersects(bbox, childBBox)) {
|
|
26627
|
-
if (node.leaf) result.push(child);
|
|
26628
|
-
else if (contains(bbox, childBBox)) this._all(child, result);
|
|
26629
|
-
else nodesToSearch.push(child);
|
|
26630
|
-
}
|
|
26631
|
-
}
|
|
26632
|
-
node = nodesToSearch.pop();
|
|
26633
|
-
}
|
|
26634
|
-
return result;
|
|
26635
|
-
}
|
|
26636
|
-
collides(bbox) {
|
|
26637
|
-
let node = this.data;
|
|
26638
|
-
if (!intersects(bbox, node)) return false;
|
|
26639
|
-
const nodesToSearch = [];
|
|
26640
|
-
while (node) {
|
|
26641
|
-
for (let i = 0; i < node.children.length; i++) {
|
|
26642
|
-
const child = node.children[i];
|
|
26643
|
-
const childBBox = node.leaf ? this.toBBox(child) : child;
|
|
26644
|
-
if (intersects(bbox, childBBox)) {
|
|
26645
|
-
if (node.leaf || contains(bbox, childBBox)) return true;
|
|
26646
|
-
nodesToSearch.push(child);
|
|
26647
|
-
}
|
|
26648
|
-
}
|
|
26649
|
-
node = nodesToSearch.pop();
|
|
26650
|
-
}
|
|
26651
|
-
return false;
|
|
26652
|
-
}
|
|
26653
|
-
load(data) {
|
|
26654
|
-
if (!(data && data.length)) return this;
|
|
26655
|
-
if (data.length < this._minEntries) {
|
|
26656
|
-
for (let i = 0; i < data.length; i++) {
|
|
26657
|
-
this.insert(data[i]);
|
|
26658
|
-
}
|
|
26659
|
-
return this;
|
|
26660
|
-
}
|
|
26661
|
-
let node = this._build(data.slice(), 0, data.length - 1, 0);
|
|
26662
|
-
if (!this.data.children.length) {
|
|
26663
|
-
this.data = node;
|
|
26664
|
-
} else if (this.data.height === node.height) {
|
|
26665
|
-
this._splitRoot(this.data, node);
|
|
26666
|
-
} else {
|
|
26667
|
-
if (this.data.height < node.height) {
|
|
26668
|
-
const tmpNode = this.data;
|
|
26669
|
-
this.data = node;
|
|
26670
|
-
node = tmpNode;
|
|
26671
|
-
}
|
|
26672
|
-
this._insert(node, this.data.height - node.height - 1, true);
|
|
26673
|
-
}
|
|
26674
|
-
return this;
|
|
26675
|
-
}
|
|
26676
|
-
insert(item) {
|
|
26677
|
-
if (item) this._insert(item, this.data.height - 1);
|
|
26678
|
-
return this;
|
|
26679
|
-
}
|
|
26680
|
-
clear() {
|
|
26681
|
-
this.data = createNode([]);
|
|
26682
|
-
return this;
|
|
26683
|
-
}
|
|
26684
|
-
remove(item, equalsFn) {
|
|
26685
|
-
if (!item) return this;
|
|
26686
|
-
let node = this.data;
|
|
26687
|
-
const bbox = this.toBBox(item);
|
|
26688
|
-
const path = [];
|
|
26689
|
-
const indexes = [];
|
|
26690
|
-
let i, parent, goingUp;
|
|
26691
|
-
while (node || path.length) {
|
|
26692
|
-
if (!node) {
|
|
26693
|
-
node = path.pop();
|
|
26694
|
-
parent = path[path.length - 1];
|
|
26695
|
-
i = indexes.pop();
|
|
26696
|
-
goingUp = true;
|
|
26697
|
-
}
|
|
26698
|
-
if (node.leaf) {
|
|
26699
|
-
const index = findItem(item, node.children, equalsFn);
|
|
26700
|
-
if (index !== -1) {
|
|
26701
|
-
node.children.splice(index, 1);
|
|
26702
|
-
path.push(node);
|
|
26703
|
-
this._condense(path);
|
|
26704
|
-
return this;
|
|
26705
|
-
}
|
|
26706
|
-
}
|
|
26707
|
-
if (!goingUp && !node.leaf && contains(node, bbox)) {
|
|
26708
|
-
path.push(node);
|
|
26709
|
-
indexes.push(i);
|
|
26710
|
-
i = 0;
|
|
26711
|
-
parent = node;
|
|
26712
|
-
node = node.children[0];
|
|
26713
|
-
} else if (parent) {
|
|
26714
|
-
i++;
|
|
26715
|
-
node = parent.children[i];
|
|
26716
|
-
goingUp = false;
|
|
26717
|
-
} else node = null;
|
|
26718
|
-
}
|
|
26719
|
-
return this;
|
|
26720
|
-
}
|
|
26721
|
-
toBBox(item) {
|
|
26722
|
-
return item;
|
|
26723
|
-
}
|
|
26724
|
-
compareMinX(a, b) {
|
|
26725
|
-
return a.minX - b.minX;
|
|
26726
|
-
}
|
|
26727
|
-
compareMinY(a, b) {
|
|
26728
|
-
return a.minY - b.minY;
|
|
26729
|
-
}
|
|
26730
|
-
toJSON() {
|
|
26731
|
-
return this.data;
|
|
26732
|
-
}
|
|
26733
|
-
fromJSON(data) {
|
|
26734
|
-
this.data = data;
|
|
26735
|
-
return this;
|
|
26736
|
-
}
|
|
26737
|
-
_all(node, result) {
|
|
26738
|
-
const nodesToSearch = [];
|
|
26739
|
-
while (node) {
|
|
26740
|
-
if (node.leaf) result.push(...node.children);
|
|
26741
|
-
else nodesToSearch.push(...node.children);
|
|
26742
|
-
node = nodesToSearch.pop();
|
|
26743
|
-
}
|
|
26744
|
-
return result;
|
|
26745
|
-
}
|
|
26746
|
-
_build(items, left, right, height) {
|
|
26747
|
-
const N = right - left + 1;
|
|
26748
|
-
let M2 = this._maxEntries;
|
|
26749
|
-
let node;
|
|
26750
|
-
if (N <= M2) {
|
|
26751
|
-
node = createNode(items.slice(left, right + 1));
|
|
26752
|
-
calcBBox(node, this.toBBox);
|
|
26753
|
-
return node;
|
|
26754
|
-
}
|
|
26755
|
-
if (!height) {
|
|
26756
|
-
height = Math.ceil(Math.log(N) / Math.log(M2));
|
|
26757
|
-
M2 = Math.ceil(N / Math.pow(M2, height - 1));
|
|
26758
|
-
}
|
|
26759
|
-
node = createNode([]);
|
|
26760
|
-
node.leaf = false;
|
|
26761
|
-
node.height = height;
|
|
26762
|
-
const N2 = Math.ceil(N / M2);
|
|
26763
|
-
const N1 = N2 * Math.ceil(Math.sqrt(M2));
|
|
26764
|
-
multiSelect(items, left, right, N1, this.compareMinX);
|
|
26765
|
-
for (let i = left; i <= right; i += N1) {
|
|
26766
|
-
const right2 = Math.min(i + N1 - 1, right);
|
|
26767
|
-
multiSelect(items, i, right2, N2, this.compareMinY);
|
|
26768
|
-
for (let j = i; j <= right2; j += N2) {
|
|
26769
|
-
const right3 = Math.min(j + N2 - 1, right2);
|
|
26770
|
-
node.children.push(this._build(items, j, right3, height - 1));
|
|
26771
|
-
}
|
|
26772
|
-
}
|
|
26773
|
-
calcBBox(node, this.toBBox);
|
|
26774
|
-
return node;
|
|
26775
|
-
}
|
|
26776
|
-
_chooseSubtree(bbox, node, level, path) {
|
|
26777
|
-
while (true) {
|
|
26778
|
-
path.push(node);
|
|
26779
|
-
if (node.leaf || path.length - 1 === level) break;
|
|
26780
|
-
let minArea = Infinity;
|
|
26781
|
-
let minEnlargement = Infinity;
|
|
26782
|
-
let targetNode;
|
|
26783
|
-
for (let i = 0; i < node.children.length; i++) {
|
|
26784
|
-
const child = node.children[i];
|
|
26785
|
-
const area = bboxArea(child);
|
|
26786
|
-
const enlargement = enlargedArea(bbox, child) - area;
|
|
26787
|
-
if (enlargement < minEnlargement) {
|
|
26788
|
-
minEnlargement = enlargement;
|
|
26789
|
-
minArea = area < minArea ? area : minArea;
|
|
26790
|
-
targetNode = child;
|
|
26791
|
-
} else if (enlargement === minEnlargement) {
|
|
26792
|
-
if (area < minArea) {
|
|
26793
|
-
minArea = area;
|
|
26794
|
-
targetNode = child;
|
|
26795
|
-
}
|
|
26796
|
-
}
|
|
26797
|
-
}
|
|
26798
|
-
node = targetNode || node.children[0];
|
|
26799
|
-
}
|
|
26800
|
-
return node;
|
|
26801
|
-
}
|
|
26802
|
-
_insert(item, level, isNode) {
|
|
26803
|
-
const bbox = isNode ? item : this.toBBox(item);
|
|
26804
|
-
const insertPath = [];
|
|
26805
|
-
const node = this._chooseSubtree(bbox, this.data, level, insertPath);
|
|
26806
|
-
node.children.push(item);
|
|
26807
|
-
extend(node, bbox);
|
|
26808
|
-
while (level >= 0) {
|
|
26809
|
-
if (insertPath[level].children.length > this._maxEntries) {
|
|
26810
|
-
this._split(insertPath, level);
|
|
26811
|
-
level--;
|
|
26812
|
-
} else break;
|
|
26813
|
-
}
|
|
26814
|
-
this._adjustParentBBoxes(bbox, insertPath, level);
|
|
26815
|
-
}
|
|
26816
|
-
// split overflowed node into two
|
|
26817
|
-
_split(insertPath, level) {
|
|
26818
|
-
const node = insertPath[level];
|
|
26819
|
-
const M2 = node.children.length;
|
|
26820
|
-
const m = this._minEntries;
|
|
26821
|
-
this._chooseSplitAxis(node, m, M2);
|
|
26822
|
-
const splitIndex = this._chooseSplitIndex(node, m, M2);
|
|
26823
|
-
const newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
|
|
26824
|
-
newNode.height = node.height;
|
|
26825
|
-
newNode.leaf = node.leaf;
|
|
26826
|
-
calcBBox(node, this.toBBox);
|
|
26827
|
-
calcBBox(newNode, this.toBBox);
|
|
26828
|
-
if (level) insertPath[level - 1].children.push(newNode);
|
|
26829
|
-
else this._splitRoot(node, newNode);
|
|
26830
|
-
}
|
|
26831
|
-
_splitRoot(node, newNode) {
|
|
26832
|
-
this.data = createNode([node, newNode]);
|
|
26833
|
-
this.data.height = node.height + 1;
|
|
26834
|
-
this.data.leaf = false;
|
|
26835
|
-
calcBBox(this.data, this.toBBox);
|
|
26836
|
-
}
|
|
26837
|
-
_chooseSplitIndex(node, m, M2) {
|
|
26838
|
-
let index;
|
|
26839
|
-
let minOverlap = Infinity;
|
|
26840
|
-
let minArea = Infinity;
|
|
26841
|
-
for (let i = m; i <= M2 - m; i++) {
|
|
26842
|
-
const bbox1 = distBBox(node, 0, i, this.toBBox);
|
|
26843
|
-
const bbox2 = distBBox(node, i, M2, this.toBBox);
|
|
26844
|
-
const overlap = intersectionArea(bbox1, bbox2);
|
|
26845
|
-
const area = bboxArea(bbox1) + bboxArea(bbox2);
|
|
26846
|
-
if (overlap < minOverlap) {
|
|
26847
|
-
minOverlap = overlap;
|
|
26848
|
-
index = i;
|
|
26849
|
-
minArea = area < minArea ? area : minArea;
|
|
26850
|
-
} else if (overlap === minOverlap) {
|
|
26851
|
-
if (area < minArea) {
|
|
26852
|
-
minArea = area;
|
|
26853
|
-
index = i;
|
|
26854
|
-
}
|
|
26855
|
-
}
|
|
26856
|
-
}
|
|
26857
|
-
return index || M2 - m;
|
|
26858
|
-
}
|
|
26859
|
-
// sorts node children by the best axis for split
|
|
26860
|
-
_chooseSplitAxis(node, m, M2) {
|
|
26861
|
-
const compareMinX = node.leaf ? this.compareMinX : compareNodeMinX;
|
|
26862
|
-
const compareMinY = node.leaf ? this.compareMinY : compareNodeMinY;
|
|
26863
|
-
const xMargin = this._allDistMargin(node, m, M2, compareMinX);
|
|
26864
|
-
const yMargin = this._allDistMargin(node, m, M2, compareMinY);
|
|
26865
|
-
if (xMargin < yMargin) node.children.sort(compareMinX);
|
|
26866
|
-
}
|
|
26867
|
-
// total margin of all possible split distributions where each node is at least m full
|
|
26868
|
-
_allDistMargin(node, m, M2, compare) {
|
|
26869
|
-
node.children.sort(compare);
|
|
26870
|
-
const toBBox = this.toBBox;
|
|
26871
|
-
const leftBBox = distBBox(node, 0, m, toBBox);
|
|
26872
|
-
const rightBBox = distBBox(node, M2 - m, M2, toBBox);
|
|
26873
|
-
let margin = bboxMargin(leftBBox) + bboxMargin(rightBBox);
|
|
26874
|
-
for (let i = m; i < M2 - m; i++) {
|
|
26875
|
-
const child = node.children[i];
|
|
26876
|
-
extend(leftBBox, node.leaf ? toBBox(child) : child);
|
|
26877
|
-
margin += bboxMargin(leftBBox);
|
|
26878
|
-
}
|
|
26879
|
-
for (let i = M2 - m - 1; i >= m; i--) {
|
|
26880
|
-
const child = node.children[i];
|
|
26881
|
-
extend(rightBBox, node.leaf ? toBBox(child) : child);
|
|
26882
|
-
margin += bboxMargin(rightBBox);
|
|
26883
|
-
}
|
|
26884
|
-
return margin;
|
|
26885
|
-
}
|
|
26886
|
-
_adjustParentBBoxes(bbox, path, level) {
|
|
26887
|
-
for (let i = level; i >= 0; i--) {
|
|
26888
|
-
extend(path[i], bbox);
|
|
26889
|
-
}
|
|
26890
|
-
}
|
|
26891
|
-
_condense(path) {
|
|
26892
|
-
for (let i = path.length - 1, siblings; i >= 0; i--) {
|
|
26893
|
-
if (path[i].children.length === 0) {
|
|
26894
|
-
if (i > 0) {
|
|
26895
|
-
siblings = path[i - 1].children;
|
|
26896
|
-
siblings.splice(siblings.indexOf(path[i]), 1);
|
|
26897
|
-
} else this.clear();
|
|
26898
|
-
} else calcBBox(path[i], this.toBBox);
|
|
26899
|
-
}
|
|
26900
|
-
}
|
|
26901
|
-
}
|
|
26902
|
-
function findItem(item, items, equalsFn) {
|
|
26903
|
-
if (!equalsFn) return items.indexOf(item);
|
|
26904
|
-
for (let i = 0; i < items.length; i++) {
|
|
26905
|
-
if (equalsFn(item, items[i])) return i;
|
|
26906
|
-
}
|
|
26907
|
-
return -1;
|
|
26908
|
-
}
|
|
26909
|
-
function calcBBox(node, toBBox) {
|
|
26910
|
-
distBBox(node, 0, node.children.length, toBBox, node);
|
|
26911
|
-
}
|
|
26912
|
-
function distBBox(node, k, p, toBBox, destNode) {
|
|
26913
|
-
if (!destNode) destNode = createNode(null);
|
|
26914
|
-
destNode.minX = Infinity;
|
|
26915
|
-
destNode.minY = Infinity;
|
|
26916
|
-
destNode.maxX = -Infinity;
|
|
26917
|
-
destNode.maxY = -Infinity;
|
|
26918
|
-
for (let i = k; i < p; i++) {
|
|
26919
|
-
const child = node.children[i];
|
|
26920
|
-
extend(destNode, node.leaf ? toBBox(child) : child);
|
|
26921
|
-
}
|
|
26922
|
-
return destNode;
|
|
26923
|
-
}
|
|
26924
|
-
function extend(a, b) {
|
|
26925
|
-
a.minX = Math.min(a.minX, b.minX);
|
|
26926
|
-
a.minY = Math.min(a.minY, b.minY);
|
|
26927
|
-
a.maxX = Math.max(a.maxX, b.maxX);
|
|
26928
|
-
a.maxY = Math.max(a.maxY, b.maxY);
|
|
26929
|
-
return a;
|
|
26930
|
-
}
|
|
26931
|
-
function compareNodeMinX(a, b) {
|
|
26932
|
-
return a.minX - b.minX;
|
|
26933
|
-
}
|
|
26934
|
-
function compareNodeMinY(a, b) {
|
|
26935
|
-
return a.minY - b.minY;
|
|
26936
|
-
}
|
|
26937
|
-
function bboxArea(a) {
|
|
26938
|
-
return (a.maxX - a.minX) * (a.maxY - a.minY);
|
|
26939
|
-
}
|
|
26940
|
-
function bboxMargin(a) {
|
|
26941
|
-
return a.maxX - a.minX + (a.maxY - a.minY);
|
|
26942
|
-
}
|
|
26943
|
-
function enlargedArea(a, b) {
|
|
26944
|
-
return (Math.max(b.maxX, a.maxX) - Math.min(b.minX, a.minX)) * (Math.max(b.maxY, a.maxY) - Math.min(b.minY, a.minY));
|
|
26945
|
-
}
|
|
26946
|
-
function intersectionArea(a, b) {
|
|
26947
|
-
const minX = Math.max(a.minX, b.minX);
|
|
26948
|
-
const minY = Math.max(a.minY, b.minY);
|
|
26949
|
-
const maxX = Math.min(a.maxX, b.maxX);
|
|
26950
|
-
const maxY = Math.min(a.maxY, b.maxY);
|
|
26951
|
-
return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
|
|
26952
|
-
}
|
|
26953
|
-
function contains(a, b) {
|
|
26954
|
-
return a.minX <= b.minX && a.minY <= b.minY && b.maxX <= a.maxX && b.maxY <= a.maxY;
|
|
26955
|
-
}
|
|
26956
|
-
function intersects(a, b) {
|
|
26957
|
-
return b.minX <= a.maxX && b.minY <= a.maxY && b.maxX >= a.minX && b.maxY >= a.minY;
|
|
26958
|
-
}
|
|
26959
|
-
function createNode(children) {
|
|
26960
|
-
return {
|
|
26961
|
-
children,
|
|
26962
|
-
height: 1,
|
|
26963
|
-
leaf: true,
|
|
26964
|
-
minX: Infinity,
|
|
26965
|
-
minY: Infinity,
|
|
26966
|
-
maxX: -Infinity,
|
|
26967
|
-
maxY: -Infinity
|
|
26968
|
-
};
|
|
26969
|
-
}
|
|
26970
|
-
function multiSelect(arr, left, right, n, compare) {
|
|
26971
|
-
const stack = [left, right];
|
|
26972
|
-
while (stack.length) {
|
|
26973
|
-
right = stack.pop();
|
|
26974
|
-
left = stack.pop();
|
|
26975
|
-
if (right - left <= n) continue;
|
|
26976
|
-
const mid = left + Math.ceil((right - left) / n / 2) * n;
|
|
26977
|
-
quickselect(arr, mid, left, right, compare);
|
|
26978
|
-
stack.push(left, mid, mid, right);
|
|
26979
|
-
}
|
|
26980
|
-
}
|
|
26981
|
-
var isMSIE8 = !("getComputedStyle" in window && typeof window.getComputedStyle === "function");
|
|
26982
|
-
function extensions(parentClass) {
|
|
26983
|
-
return {
|
|
26984
|
-
initialize: function(options) {
|
|
26985
|
-
parentClass.prototype.initialize.call(this, options);
|
|
26986
|
-
this._originalLayers = [];
|
|
26987
|
-
this._visibleLayers = [];
|
|
26988
|
-
this._staticLayers = [];
|
|
26989
|
-
this._rbush = [];
|
|
26990
|
-
this._cachedRelativeBoxes = [];
|
|
26991
|
-
this._margin = options.margin || 0;
|
|
26992
|
-
this._rbush = null;
|
|
26993
|
-
},
|
|
26994
|
-
addLayer: function(layer) {
|
|
26995
|
-
if (!("options" in layer) || !("icon" in layer.options)) {
|
|
26996
|
-
this._staticLayers.push(layer);
|
|
26997
|
-
parentClass.prototype.addLayer.call(this, layer);
|
|
26998
|
-
return;
|
|
26999
|
-
}
|
|
27000
|
-
this._originalLayers.push(layer);
|
|
27001
|
-
if (this._map) {
|
|
27002
|
-
this._maybeAddLayerToRBush(layer);
|
|
27003
|
-
}
|
|
27004
|
-
},
|
|
27005
|
-
removeLayer: function(layer) {
|
|
27006
|
-
this._rbush.remove(this._cachedRelativeBoxes[layer._leaflet_id]);
|
|
27007
|
-
delete this._cachedRelativeBoxes[layer._leaflet_id];
|
|
27008
|
-
parentClass.prototype.removeLayer.call(this, layer);
|
|
27009
|
-
var i;
|
|
27010
|
-
i = this._originalLayers.indexOf(layer);
|
|
27011
|
-
if (i !== -1) {
|
|
27012
|
-
this._originalLayers.splice(i, 1);
|
|
27013
|
-
}
|
|
27014
|
-
i = this._visibleLayers.indexOf(layer);
|
|
27015
|
-
if (i !== -1) {
|
|
27016
|
-
this._visibleLayers.splice(i, 1);
|
|
27017
|
-
}
|
|
27018
|
-
i = this._staticLayers.indexOf(layer);
|
|
27019
|
-
if (i !== -1) {
|
|
27020
|
-
this._staticLayers.splice(i, 1);
|
|
27021
|
-
}
|
|
27022
|
-
},
|
|
27023
|
-
clearLayers: function() {
|
|
27024
|
-
this._rbush = RBush();
|
|
27025
|
-
this._originalLayers = [];
|
|
27026
|
-
this._visibleLayers = [];
|
|
27027
|
-
this._staticLayers = [];
|
|
27028
|
-
this._cachedRelativeBoxes = [];
|
|
27029
|
-
parentClass.prototype.clearLayers.call(this);
|
|
27030
|
-
},
|
|
27031
|
-
onAdd: function(map) {
|
|
27032
|
-
this._map = map;
|
|
27033
|
-
for (let i = 0, l = this._staticLayers.length; i < l; i++) {
|
|
27034
|
-
map.addLayer(this._staticLayers[i]);
|
|
27035
|
-
}
|
|
27036
|
-
this._onZoomEnd();
|
|
27037
|
-
map.on("zoomend", this._onZoomEnd, this);
|
|
27038
|
-
},
|
|
27039
|
-
onRemove: function(map) {
|
|
27040
|
-
for (let i = 0, l = this._staticLayers.length; i < l; i++) {
|
|
27041
|
-
map.removeLayer(this._staticLayers[i]);
|
|
27042
|
-
}
|
|
27043
|
-
map.off("zoomend", this._onZoomEnd, this);
|
|
27044
|
-
parentClass.prototype.onRemove.call(this, map);
|
|
27045
|
-
},
|
|
27046
|
-
_maybeAddLayerToRBush: function(layer) {
|
|
27047
|
-
this._map.getZoom();
|
|
27048
|
-
var bush = this._rbush;
|
|
27049
|
-
var boxes = this._cachedRelativeBoxes[layer._leaflet_id];
|
|
27050
|
-
var visible = false;
|
|
27051
|
-
if (!boxes) {
|
|
27052
|
-
parentClass.prototype.addLayer.call(this, layer);
|
|
27053
|
-
var visible = true;
|
|
27054
|
-
var box = this._getIconBox(layer._icon);
|
|
27055
|
-
boxes = this._getRelativeBoxes(layer._icon.children, box);
|
|
27056
|
-
boxes.push(box);
|
|
27057
|
-
this._cachedRelativeBoxes[layer._leaflet_id] = boxes;
|
|
27058
|
-
}
|
|
27059
|
-
boxes = this._positionBoxes(this._map.latLngToLayerPoint(layer.getLatLng()), boxes);
|
|
27060
|
-
var collision = false;
|
|
27061
|
-
for (var i = 0; i < boxes.length && !collision; i++) {
|
|
27062
|
-
collision = bush.search(boxes[i]).length > 0;
|
|
27063
|
-
}
|
|
27064
|
-
if (!collision) {
|
|
27065
|
-
if (!visible) {
|
|
27066
|
-
parentClass.prototype.addLayer.call(this, layer);
|
|
27067
|
-
}
|
|
27068
|
-
this._visibleLayers.push(layer);
|
|
27069
|
-
bush.load(boxes);
|
|
27070
|
-
} else {
|
|
27071
|
-
parentClass.prototype.removeLayer.call(this, layer);
|
|
27072
|
-
}
|
|
27073
|
-
},
|
|
27074
|
-
// Returns a plain array with the relative dimensions of a L.Icon, based
|
|
27075
|
-
// on the computed values from iconSize and iconAnchor.
|
|
27076
|
-
_getIconBox: function(el) {
|
|
27077
|
-
if (isMSIE8) {
|
|
27078
|
-
return [0, 0, el.offsetWidth, el.offsetHeight];
|
|
27079
|
-
}
|
|
27080
|
-
var styles = window.getComputedStyle(el);
|
|
27081
|
-
return [
|
|
27082
|
-
parseInt(styles.marginLeft),
|
|
27083
|
-
parseInt(styles.marginTop),
|
|
27084
|
-
parseInt(styles.marginLeft) + parseInt(styles.width),
|
|
27085
|
-
parseInt(styles.marginTop) + parseInt(styles.height)
|
|
27086
|
-
];
|
|
27087
|
-
},
|
|
27088
|
-
// Much like _getIconBox, but works for positioned HTML elements, based on offsetWidth/offsetHeight.
|
|
27089
|
-
_getRelativeBoxes: function(els, baseBox) {
|
|
27090
|
-
var boxes = [];
|
|
27091
|
-
for (var i = 0; i < els.length; i++) {
|
|
27092
|
-
var el = els[i];
|
|
27093
|
-
var box = [el.offsetLeft, el.offsetTop, el.offsetLeft + el.offsetWidth, el.offsetTop + el.offsetHeight];
|
|
27094
|
-
box = this._offsetBoxes(box, baseBox);
|
|
27095
|
-
boxes.push(box);
|
|
27096
|
-
if (el.children.length) {
|
|
27097
|
-
var parentBox = baseBox;
|
|
27098
|
-
if (!isMSIE8) {
|
|
27099
|
-
var positionStyle = window.getComputedStyle(el).position;
|
|
27100
|
-
if (positionStyle === "absolute" || positionStyle === "relative") {
|
|
27101
|
-
parentBox = box;
|
|
27102
|
-
}
|
|
27103
|
-
}
|
|
27104
|
-
boxes = boxes.concat(this._getRelativeBoxes(el.children, parentBox));
|
|
27105
|
-
}
|
|
27106
|
-
}
|
|
27107
|
-
return boxes;
|
|
27108
|
-
},
|
|
27109
|
-
_offsetBoxes: function(a, b) {
|
|
27110
|
-
return [a[0] + b[0], a[1] + b[1], a[2] + b[0], a[3] + b[1]];
|
|
27111
|
-
},
|
|
27112
|
-
// Adds the coordinate of the layer (in pixels / map canvas units) to each box coordinate.
|
|
27113
|
-
_positionBoxes: function(offset, boxes) {
|
|
27114
|
-
var newBoxes = [];
|
|
27115
|
-
for (var i = 0; i < boxes.length; i++) {
|
|
27116
|
-
newBoxes.push(this._positionBox(offset, boxes[i]));
|
|
27117
|
-
}
|
|
27118
|
-
return newBoxes;
|
|
27119
|
-
},
|
|
27120
|
-
_positionBox: function(offset, box) {
|
|
27121
|
-
return [box[0] + offset.x - this._margin, box[1] + offset.y - this._margin, box[2] + offset.x + this._margin, box[3] + offset.y + this._margin];
|
|
27122
|
-
},
|
|
27123
|
-
_onZoomEnd: function() {
|
|
27124
|
-
for (var i = 0; i < this._visibleLayers.length; i++) {
|
|
27125
|
-
parentClass.prototype.removeLayer.call(this, this._visibleLayers[i]);
|
|
27126
|
-
}
|
|
27127
|
-
this._rbush = RBush();
|
|
27128
|
-
for (var i = 0; i < this._originalLayers.length; i++) {
|
|
27129
|
-
this._maybeAddLayerToRBush(this._originalLayers[i]);
|
|
27130
|
-
}
|
|
27131
|
-
}
|
|
27132
|
-
};
|
|
27133
|
-
}
|
|
27134
|
-
const Collision = {
|
|
27135
|
-
LayerGroup: leafletSrcExports.LayerGroup.extend(extensions(leafletSrcExports.LayerGroup)),
|
|
27136
|
-
FeatureGroup: leafletSrcExports.FeatureGroup.extend(extensions(leafletSrcExports.FeatureGroup)),
|
|
27137
|
-
GeoJSON: leafletSrcExports.GeoJSON.extend(extensions(leafletSrcExports.GeoJSON))
|
|
27138
|
-
};
|
|
27139
26563
|
const WebMercatorTiledLayer = leafletSrcExports.Layer.extend({
|
|
27140
26564
|
provide: {
|
|
27141
26565
|
TDT: "tdt",
|
|
@@ -27541,17 +26965,17 @@ var heatmap = { exports: {} };
|
|
|
27541
26965
|
plugins: {}
|
|
27542
26966
|
};
|
|
27543
26967
|
var Store = function StoreClosure() {
|
|
27544
|
-
var Store2 = function Store3(
|
|
26968
|
+
var Store2 = function Store3(config) {
|
|
27545
26969
|
this._coordinator = {};
|
|
27546
26970
|
this._data = [];
|
|
27547
26971
|
this._radi = [];
|
|
27548
26972
|
this._min = 10;
|
|
27549
26973
|
this._max = 1;
|
|
27550
|
-
this._xField =
|
|
27551
|
-
this._yField =
|
|
27552
|
-
this._valueField =
|
|
27553
|
-
if (
|
|
27554
|
-
this._cfgRadius =
|
|
26974
|
+
this._xField = config["xField"] || config.defaultXField;
|
|
26975
|
+
this._yField = config["yField"] || config.defaultYField;
|
|
26976
|
+
this._valueField = config["valueField"] || config.defaultValueField;
|
|
26977
|
+
if (config["radius"]) {
|
|
26978
|
+
this._cfgRadius = config["radius"];
|
|
27555
26979
|
}
|
|
27556
26980
|
};
|
|
27557
26981
|
var defaultRadius = HeatmapConfig.defaultRadius;
|
|
@@ -27735,8 +27159,8 @@ var heatmap = { exports: {} };
|
|
|
27735
27159
|
return Store2;
|
|
27736
27160
|
}();
|
|
27737
27161
|
var Canvas2dRenderer = function Canvas2dRendererClosure() {
|
|
27738
|
-
var _getColorPalette = function(
|
|
27739
|
-
var gradientConfig =
|
|
27162
|
+
var _getColorPalette = function(config) {
|
|
27163
|
+
var gradientConfig = config.gradient || config.defaultGradient;
|
|
27740
27164
|
var paletteCanvas = document.createElement("canvas");
|
|
27741
27165
|
var paletteCtx = paletteCanvas.getContext("2d");
|
|
27742
27166
|
paletteCanvas.width = 256;
|
|
@@ -27799,23 +27223,23 @@ var heatmap = { exports: {} };
|
|
|
27799
27223
|
data: renderData
|
|
27800
27224
|
};
|
|
27801
27225
|
};
|
|
27802
|
-
function Canvas2dRenderer2(
|
|
27803
|
-
var container =
|
|
27226
|
+
function Canvas2dRenderer2(config) {
|
|
27227
|
+
var container = config.container;
|
|
27804
27228
|
var shadowCanvas = this.shadowCanvas = document.createElement("canvas");
|
|
27805
|
-
var canvas = this.canvas =
|
|
27229
|
+
var canvas = this.canvas = config.canvas || document.createElement("canvas");
|
|
27806
27230
|
this._renderBoundaries = [1e4, 1e4, 0, 0];
|
|
27807
|
-
var computed = getComputedStyle(
|
|
27231
|
+
var computed = getComputedStyle(config.container) || {};
|
|
27808
27232
|
canvas.className = "heatmap-canvas";
|
|
27809
|
-
this._width = canvas.width = shadowCanvas.width =
|
|
27810
|
-
this._height = canvas.height = shadowCanvas.height =
|
|
27233
|
+
this._width = canvas.width = shadowCanvas.width = config.width || +computed.width.replace(/px/, "");
|
|
27234
|
+
this._height = canvas.height = shadowCanvas.height = config.height || +computed.height.replace(/px/, "");
|
|
27811
27235
|
this.shadowCtx = shadowCanvas.getContext("2d");
|
|
27812
27236
|
this.ctx = canvas.getContext("2d");
|
|
27813
27237
|
canvas.style.cssText = shadowCanvas.style.cssText = "position:absolute;left:0;top:0;";
|
|
27814
27238
|
container.style.position = "relative";
|
|
27815
27239
|
container.appendChild(canvas);
|
|
27816
|
-
this._palette = _getColorPalette(
|
|
27240
|
+
this._palette = _getColorPalette(config);
|
|
27817
27241
|
this._templates = {};
|
|
27818
|
-
this._setStyles(
|
|
27242
|
+
this._setStyles(config);
|
|
27819
27243
|
}
|
|
27820
27244
|
Canvas2dRenderer2.prototype = {
|
|
27821
27245
|
renderPartial: function(data) {
|
|
@@ -27831,14 +27255,14 @@ var heatmap = { exports: {} };
|
|
|
27831
27255
|
this._colorize();
|
|
27832
27256
|
}
|
|
27833
27257
|
},
|
|
27834
|
-
_updateGradient: function(
|
|
27835
|
-
this._palette = _getColorPalette(
|
|
27258
|
+
_updateGradient: function(config) {
|
|
27259
|
+
this._palette = _getColorPalette(config);
|
|
27836
27260
|
},
|
|
27837
|
-
updateConfig: function(
|
|
27838
|
-
if (
|
|
27839
|
-
this._updateGradient(
|
|
27261
|
+
updateConfig: function(config) {
|
|
27262
|
+
if (config["gradient"]) {
|
|
27263
|
+
this._updateGradient(config);
|
|
27840
27264
|
}
|
|
27841
|
-
this._setStyles(
|
|
27265
|
+
this._setStyles(config);
|
|
27842
27266
|
},
|
|
27843
27267
|
setDimensions: function(width, height) {
|
|
27844
27268
|
this._width = width;
|
|
@@ -27850,17 +27274,17 @@ var heatmap = { exports: {} };
|
|
|
27850
27274
|
this.shadowCtx.clearRect(0, 0, this._width, this._height);
|
|
27851
27275
|
this.ctx.clearRect(0, 0, this._width, this._height);
|
|
27852
27276
|
},
|
|
27853
|
-
_setStyles: function(
|
|
27854
|
-
this._blur =
|
|
27855
|
-
if (
|
|
27856
|
-
this.canvas.style.backgroundColor =
|
|
27277
|
+
_setStyles: function(config) {
|
|
27278
|
+
this._blur = config.blur == 0 ? 0 : config.blur || config.defaultBlur;
|
|
27279
|
+
if (config.backgroundColor) {
|
|
27280
|
+
this.canvas.style.backgroundColor = config.backgroundColor;
|
|
27857
27281
|
}
|
|
27858
|
-
this._width = this.canvas.width = this.shadowCanvas.width =
|
|
27859
|
-
this._height = this.canvas.height = this.shadowCanvas.height =
|
|
27860
|
-
this._opacity = (
|
|
27861
|
-
this._maxOpacity = (
|
|
27862
|
-
this._minOpacity = (
|
|
27863
|
-
this._useGradientOpacity = !!
|
|
27282
|
+
this._width = this.canvas.width = this.shadowCanvas.width = config.width || this._width;
|
|
27283
|
+
this._height = this.canvas.height = this.shadowCanvas.height = config.height || this._height;
|
|
27284
|
+
this._opacity = (config.opacity || 0) * 255;
|
|
27285
|
+
this._maxOpacity = (config.maxOpacity || config.defaultMaxOpacity) * 255;
|
|
27286
|
+
this._minOpacity = (config.minOpacity || config.defaultMinOpacity) * 255;
|
|
27287
|
+
this._useGradientOpacity = !!config.useGradientOpacity;
|
|
27864
27288
|
},
|
|
27865
27289
|
_drawAlpha: function(data) {
|
|
27866
27290
|
var min = this._min = data.min;
|
|
@@ -28036,20 +27460,20 @@ var heatmap = { exports: {} };
|
|
|
28036
27460
|
store.setCoordinator(coordinator);
|
|
28037
27461
|
};
|
|
28038
27462
|
function Heatmap2() {
|
|
28039
|
-
var
|
|
27463
|
+
var config = this._config = Util2.merge(HeatmapConfig, arguments[0] || {});
|
|
28040
27464
|
this._coordinator = new Coordinator();
|
|
28041
|
-
if (
|
|
28042
|
-
var pluginToLoad =
|
|
27465
|
+
if (config["plugin"]) {
|
|
27466
|
+
var pluginToLoad = config["plugin"];
|
|
28043
27467
|
if (!HeatmapConfig.plugins[pluginToLoad]) {
|
|
28044
27468
|
throw new Error("Plugin '" + pluginToLoad + "' not found. Maybe it was not registered.");
|
|
28045
27469
|
} else {
|
|
28046
27470
|
var plugin = HeatmapConfig.plugins[pluginToLoad];
|
|
28047
|
-
this._renderer = new plugin.renderer(
|
|
28048
|
-
this._store = new plugin.store(
|
|
27471
|
+
this._renderer = new plugin.renderer(config);
|
|
27472
|
+
this._store = new plugin.store(config);
|
|
28049
27473
|
}
|
|
28050
27474
|
} else {
|
|
28051
|
-
this._renderer = new Renderer(
|
|
28052
|
-
this._store = new Store(
|
|
27475
|
+
this._renderer = new Renderer(config);
|
|
27476
|
+
this._store = new Store(config);
|
|
28053
27477
|
}
|
|
28054
27478
|
_connect(this);
|
|
28055
27479
|
}
|
|
@@ -28074,8 +27498,8 @@ var heatmap = { exports: {} };
|
|
|
28074
27498
|
this._store.setDataMin.apply(this._store, arguments);
|
|
28075
27499
|
return this;
|
|
28076
27500
|
},
|
|
28077
|
-
configure: function(
|
|
28078
|
-
this._config = Util2.merge(this._config,
|
|
27501
|
+
configure: function(config) {
|
|
27502
|
+
this._config = Util2.merge(this._config, config);
|
|
28079
27503
|
this._renderer.updateConfig(this._config);
|
|
28080
27504
|
this._coordinator.emit("renderall", this._store._getInternalData());
|
|
28081
27505
|
return this;
|
|
@@ -28103,8 +27527,8 @@ var heatmap = { exports: {} };
|
|
|
28103
27527
|
return Heatmap2;
|
|
28104
27528
|
}();
|
|
28105
27529
|
var heatmapFactory = {
|
|
28106
|
-
create: function(
|
|
28107
|
-
return new Heatmap(
|
|
27530
|
+
create: function(config) {
|
|
27531
|
+
return new Heatmap(config);
|
|
28108
27532
|
},
|
|
28109
27533
|
register: function(pluginKey, plugin) {
|
|
28110
27534
|
HeatmapConfig.plugins[pluginKey] = plugin;
|
|
@@ -28116,8 +27540,8 @@ var heatmap = { exports: {} };
|
|
|
28116
27540
|
var heatmapExports = heatmap.exports;
|
|
28117
27541
|
const h337 = /* @__PURE__ */ getDefaultExportFromCjs(heatmapExports);
|
|
28118
27542
|
var HeatLayer = L.Layer.extend({
|
|
28119
|
-
initialize: function(
|
|
28120
|
-
this.cfg =
|
|
27543
|
+
initialize: function(config) {
|
|
27544
|
+
this.cfg = config;
|
|
28121
27545
|
this._el = L.DomUtil.create("div", "leaflet-zoom-hide");
|
|
28122
27546
|
this._data = [];
|
|
28123
27547
|
this._max = 1;
|
|
@@ -30044,7 +29468,7 @@ function injectCss(cls) {
|
|
|
30044
29468
|
getLayers() {
|
|
30045
29469
|
return Object.values(this._layers);
|
|
30046
29470
|
},
|
|
30047
|
-
openWidget(name, options = {}, events = {}) {
|
|
29471
|
+
openWidget(name, options = {}, events = {}, config = {}) {
|
|
30048
29472
|
this.fire("widget-mount", {
|
|
30049
29473
|
name,
|
|
30050
29474
|
options,
|
|
@@ -30077,7 +29501,6 @@ function injectCss(cls) {
|
|
|
30077
29501
|
_L.Text = TextMarker;
|
|
30078
29502
|
_L.VertexMarkers = VertexMarker;
|
|
30079
29503
|
_L.Measurement = MeasureMent;
|
|
30080
|
-
_L.Collision = Collision;
|
|
30081
29504
|
_L.Symbol = Symbol$1;
|
|
30082
29505
|
_L.PolylineDecorator = PolylineDecorator;
|
|
30083
29506
|
return _this.L = _L;
|