@maptiler/geocoding-control 2.0.0-rc.3 → 2.0.0-rc.5
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/MapLibreBasedGeocodingControl.d.ts +18 -1
- package/leaflet-controller.d.ts +2 -1
- package/leaflet-controller.js +222 -219
- package/leaflet-controller.js.map +1 -1
- package/leaflet-controller.umd.js +2 -2
- package/leaflet-controller.umd.js.map +1 -1
- package/leaflet.js +1016 -1025
- package/leaflet.js.map +1 -1
- package/leaflet.umd.js +3 -3
- package/leaflet.umd.js.map +1 -1
- package/maplibregl-controller.d.ts +2 -1
- package/maplibregl-controller.js +213 -210
- package/maplibregl-controller.js.map +1 -1
- package/maplibregl-controller.umd.js +3 -3
- package/maplibregl-controller.umd.js.map +1 -1
- package/maplibregl.d.ts +17 -0
- package/maplibregl.js +1456 -1463
- package/maplibregl.js.map +1 -1
- package/maplibregl.umd.js +3 -3
- package/maplibregl.umd.js.map +1 -1
- package/maptilersdk.d.ts +17 -0
- package/maptilersdk.js +1458 -1465
- package/maptilersdk.js.map +1 -1
- package/maptilersdk.umd.js +3 -3
- package/maptilersdk.umd.js.map +1 -1
- package/openlayers-controller.d.ts +2 -1
- package/openlayers-controller.js +298 -295
- package/openlayers-controller.js.map +1 -1
- package/openlayers-controller.umd.js +3 -3
- package/openlayers-controller.umd.js.map +1 -1
- package/openlayers.js +1267 -1276
- package/openlayers.js.map +1 -1
- package/openlayers.umd.js +3 -3
- package/openlayers.umd.js.map +1 -1
- package/package.json +1 -1
- package/react.js +845 -860
- package/react.js.map +1 -1
- package/react.umd.js +1 -1
- package/react.umd.js.map +1 -1
- package/svelte/GeocodingControl.svelte +26 -51
- package/svelte/GeocodingControl.svelte.d.ts +1 -2
- package/svelte/MapLibreBasedGeocodingControl.d.ts +18 -1
- package/svelte/MapLibreBasedGeocodingControl.js +4 -0
- package/svelte/leaflet-controller.d.ts +2 -1
- package/svelte/leaflet-controller.js +6 -2
- package/svelte/leaflet.js +4 -0
- package/svelte/maplibregl-controller.d.ts +2 -1
- package/svelte/maplibregl-controller.js +6 -2
- package/svelte/maplibregl.d.ts +17 -0
- package/svelte/maptilersdk.d.ts +17 -0
- package/svelte/openlayers-controller.d.ts +2 -1
- package/svelte/openlayers-controller.js +6 -2
- package/svelte/openlayers.js +5 -2
- package/svelte/types.d.ts +1 -1
- package/types.d.ts +1 -1
- package/vanilla.js +623 -638
- package/vanilla.js.map +1 -1
- package/vanilla.umd.js +1 -1
- package/vanilla.umd.js.map +1 -1
package/openlayers-controller.js
CHANGED
|
@@ -41,41 +41,41 @@ function At(o, t, e = {}) {
|
|
|
41
41
|
}
|
|
42
42
|
function Ot(o, t, e) {
|
|
43
43
|
if (o !== null)
|
|
44
|
-
for (var n, r, i, u,
|
|
45
|
-
c =
|
|
46
|
-
for (var m = 0; m <
|
|
47
|
-
var
|
|
44
|
+
for (var n, r, i, u, s, f, c, g = 0, l = 0, h, a = o.type, x = a === "FeatureCollection", d = a === "Feature", y = x ? o.features.length : 1, p = 0; p < y; p++) {
|
|
45
|
+
c = x ? o.features[p].geometry : d ? o.geometry : o, h = c ? c.type === "GeometryCollection" : !1, s = h ? c.geometries.length : 1;
|
|
46
|
+
for (var m = 0; m < s; m++) {
|
|
47
|
+
var v = 0, E = 0;
|
|
48
48
|
if (u = h ? c.geometries[m] : c, u !== null) {
|
|
49
49
|
f = u.coordinates;
|
|
50
|
-
var
|
|
51
|
-
switch (g = 0,
|
|
50
|
+
var w = u.type;
|
|
51
|
+
switch (g = 0, w) {
|
|
52
52
|
case null:
|
|
53
53
|
break;
|
|
54
54
|
case "Point":
|
|
55
55
|
if (t(
|
|
56
56
|
f,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
l,
|
|
58
|
+
p,
|
|
59
|
+
v,
|
|
60
|
+
E
|
|
61
61
|
) === !1)
|
|
62
62
|
return !1;
|
|
63
|
-
|
|
63
|
+
l++, v++;
|
|
64
64
|
break;
|
|
65
65
|
case "LineString":
|
|
66
66
|
case "MultiPoint":
|
|
67
67
|
for (n = 0; n < f.length; n++) {
|
|
68
68
|
if (t(
|
|
69
69
|
f[n],
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
l,
|
|
71
|
+
p,
|
|
72
|
+
v,
|
|
73
|
+
E
|
|
74
74
|
) === !1)
|
|
75
75
|
return !1;
|
|
76
|
-
|
|
76
|
+
l++, w === "MultiPoint" && v++;
|
|
77
77
|
}
|
|
78
|
-
|
|
78
|
+
w === "LineString" && v++;
|
|
79
79
|
break;
|
|
80
80
|
case "Polygon":
|
|
81
81
|
case "MultiLineString":
|
|
@@ -83,35 +83,35 @@ function Ot(o, t, e) {
|
|
|
83
83
|
for (r = 0; r < f[n].length - g; r++) {
|
|
84
84
|
if (t(
|
|
85
85
|
f[n][r],
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
l,
|
|
87
|
+
p,
|
|
88
|
+
v,
|
|
89
|
+
E
|
|
90
90
|
) === !1)
|
|
91
91
|
return !1;
|
|
92
|
-
|
|
92
|
+
l++;
|
|
93
93
|
}
|
|
94
|
-
|
|
94
|
+
w === "MultiLineString" && v++, w === "Polygon" && E++;
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
w === "Polygon" && v++;
|
|
97
97
|
break;
|
|
98
98
|
case "MultiPolygon":
|
|
99
99
|
for (n = 0; n < f.length; n++) {
|
|
100
|
-
for (
|
|
100
|
+
for (E = 0, r = 0; r < f[n].length; r++) {
|
|
101
101
|
for (i = 0; i < f[n][r].length - g; i++) {
|
|
102
102
|
if (t(
|
|
103
103
|
f[n][r][i],
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
l,
|
|
105
|
+
p,
|
|
106
|
+
v,
|
|
107
|
+
E
|
|
108
108
|
) === !1)
|
|
109
109
|
return !1;
|
|
110
|
-
|
|
110
|
+
l++;
|
|
111
111
|
}
|
|
112
|
-
|
|
112
|
+
E++;
|
|
113
113
|
}
|
|
114
|
-
|
|
114
|
+
v++;
|
|
115
115
|
}
|
|
116
116
|
break;
|
|
117
117
|
case "GeometryCollection":
|
|
@@ -127,16 +127,16 @@ function Ot(o, t, e) {
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
function st(o, t) {
|
|
130
|
-
var e, n, r, i, u,
|
|
131
|
-
for (e = 0; e <
|
|
132
|
-
for (
|
|
133
|
-
if (i = f ?
|
|
130
|
+
var e, n, r, i, u, s, f, c, g, l, h = 0, a = o.type === "FeatureCollection", x = o.type === "Feature", d = a ? o.features.length : 1;
|
|
131
|
+
for (e = 0; e < d; e++) {
|
|
132
|
+
for (s = a ? o.features[e].geometry : x ? o.geometry : o, c = a ? o.features[e].properties : x ? o.properties : {}, g = a ? o.features[e].bbox : x ? o.bbox : void 0, l = a ? o.features[e].id : x ? o.id : void 0, f = s ? s.type === "GeometryCollection" : !1, u = f ? s.geometries.length : 1, r = 0; r < u; r++) {
|
|
133
|
+
if (i = f ? s.geometries[r] : s, i === null) {
|
|
134
134
|
if (t(
|
|
135
135
|
null,
|
|
136
136
|
h,
|
|
137
137
|
c,
|
|
138
138
|
g,
|
|
139
|
-
|
|
139
|
+
l
|
|
140
140
|
) === !1)
|
|
141
141
|
return !1;
|
|
142
142
|
continue;
|
|
@@ -153,7 +153,7 @@ function st(o, t) {
|
|
|
153
153
|
h,
|
|
154
154
|
c,
|
|
155
155
|
g,
|
|
156
|
-
|
|
156
|
+
l
|
|
157
157
|
) === !1)
|
|
158
158
|
return !1;
|
|
159
159
|
break;
|
|
@@ -165,7 +165,7 @@ function st(o, t) {
|
|
|
165
165
|
h,
|
|
166
166
|
c,
|
|
167
167
|
g,
|
|
168
|
-
|
|
168
|
+
l
|
|
169
169
|
) === !1)
|
|
170
170
|
return !1;
|
|
171
171
|
break;
|
|
@@ -179,8 +179,8 @@ function st(o, t) {
|
|
|
179
179
|
}
|
|
180
180
|
function Dt(o, t) {
|
|
181
181
|
st(o, function(e, n, r, i, u) {
|
|
182
|
-
var
|
|
183
|
-
switch (
|
|
182
|
+
var s = e === null ? null : e.type;
|
|
183
|
+
switch (s) {
|
|
184
184
|
case null:
|
|
185
185
|
case "Point":
|
|
186
186
|
case "LineString":
|
|
@@ -192,7 +192,7 @@ function Dt(o, t) {
|
|
|
192
192
|
) === !1 ? !1 : void 0;
|
|
193
193
|
}
|
|
194
194
|
var f;
|
|
195
|
-
switch (
|
|
195
|
+
switch (s) {
|
|
196
196
|
case "MultiPoint":
|
|
197
197
|
f = "Point";
|
|
198
198
|
break;
|
|
@@ -204,11 +204,11 @@ function Dt(o, t) {
|
|
|
204
204
|
break;
|
|
205
205
|
}
|
|
206
206
|
for (var c = 0; c < e.coordinates.length; c++) {
|
|
207
|
-
var g = e.coordinates[c],
|
|
207
|
+
var g = e.coordinates[c], l = {
|
|
208
208
|
type: f,
|
|
209
209
|
coordinates: g
|
|
210
210
|
};
|
|
211
|
-
if (t(D(
|
|
211
|
+
if (t(D(l, r), n, c) === !1)
|
|
212
212
|
return !1;
|
|
213
213
|
}
|
|
214
214
|
});
|
|
@@ -249,10 +249,10 @@ function Wt(o, t) {
|
|
|
249
249
|
if (i[0] & 1) throw i[1];
|
|
250
250
|
return i[1];
|
|
251
251
|
}, trys: [], ops: [] }, n, r, i, u;
|
|
252
|
-
return u = { next:
|
|
252
|
+
return u = { next: s(0), throw: s(1), return: s(2) }, typeof Symbol == "function" && (u[Symbol.iterator] = function() {
|
|
253
253
|
return this;
|
|
254
254
|
}), u;
|
|
255
|
-
function
|
|
255
|
+
function s(c) {
|
|
256
256
|
return function(g) {
|
|
257
257
|
return f([c, g]);
|
|
258
258
|
};
|
|
@@ -323,8 +323,8 @@ function G(o, t, e) {
|
|
|
323
323
|
if (t.left === null)
|
|
324
324
|
break;
|
|
325
325
|
if (e(o, t.left.key) < 0) {
|
|
326
|
-
var
|
|
327
|
-
if (t.left =
|
|
326
|
+
var s = t.left;
|
|
327
|
+
if (t.left = s.right, s.right = t, t = s, t.left === null)
|
|
328
328
|
break;
|
|
329
329
|
}
|
|
330
330
|
i.left = t, i = t, t = t.left;
|
|
@@ -332,8 +332,8 @@ function G(o, t, e) {
|
|
|
332
332
|
if (t.right === null)
|
|
333
333
|
break;
|
|
334
334
|
if (e(o, t.right.key) > 0) {
|
|
335
|
-
var
|
|
336
|
-
if (t.right =
|
|
335
|
+
var s = t.right;
|
|
336
|
+
if (t.right = s.left, s.left = t, t = s, t.right === null)
|
|
337
337
|
break;
|
|
338
338
|
}
|
|
339
339
|
r.right = t, r = t, t = t.right;
|
|
@@ -423,15 +423,15 @@ var lt = (
|
|
|
423
423
|
n !== null ? (r.push(n), n = n.left) : r.length !== 0 ? (n = r.pop(), t.call(e, n), n = n.right) : i = !0;
|
|
424
424
|
return this;
|
|
425
425
|
}, o.prototype.range = function(t, e, n, r) {
|
|
426
|
-
for (var i = [], u = this._comparator,
|
|
427
|
-
if (
|
|
428
|
-
i.push(
|
|
426
|
+
for (var i = [], u = this._comparator, s = this._root, f; i.length !== 0 || s; )
|
|
427
|
+
if (s)
|
|
428
|
+
i.push(s), s = s.left;
|
|
429
429
|
else {
|
|
430
|
-
if (
|
|
430
|
+
if (s = i.pop(), f = u(s.key, e), f > 0)
|
|
431
431
|
break;
|
|
432
|
-
if (u(
|
|
432
|
+
if (u(s.key, t) >= 0 && n.call(r, s))
|
|
433
433
|
return this;
|
|
434
|
-
|
|
434
|
+
s = s.right;
|
|
435
435
|
}
|
|
436
436
|
return this;
|
|
437
437
|
}, o.prototype.keys = function() {
|
|
@@ -536,8 +536,8 @@ var lt = (
|
|
|
536
536
|
return e.push(n);
|
|
537
537
|
}, t), e.join("");
|
|
538
538
|
}, o.prototype.update = function(t, e, n) {
|
|
539
|
-
var r = this._comparator, i = xt(t, this._root, r), u = i.left,
|
|
540
|
-
r(t, e) < 0 ?
|
|
539
|
+
var r = this._comparator, i = xt(t, this._root, r), u = i.left, s = i.right;
|
|
540
|
+
r(t, e) < 0 ? s = J(e, n, s, r) : u = J(e, n, u, r), this._root = Jt(u, s, r);
|
|
541
541
|
}, o.prototype.split = function(t) {
|
|
542
542
|
return xt(t, this._root, this._comparator);
|
|
543
543
|
}, o.prototype[Symbol.iterator] = function() {
|
|
@@ -569,7 +569,7 @@ var lt = (
|
|
|
569
569
|
function et(o, t, e, n) {
|
|
570
570
|
var r = n - e;
|
|
571
571
|
if (r > 0) {
|
|
572
|
-
var i = e + Math.floor(r / 2), u = o[i],
|
|
572
|
+
var i = e + Math.floor(r / 2), u = o[i], s = t[i], f = new $(u, s);
|
|
573
573
|
return f.left = et(o, t, e, i), f.right = et(o, t, i + 1, n), f;
|
|
574
574
|
}
|
|
575
575
|
return null;
|
|
@@ -599,33 +599,33 @@ function te(o, t, e) {
|
|
|
599
599
|
}
|
|
600
600
|
function rt(o, t, e, n, r) {
|
|
601
601
|
if (!(e >= n)) {
|
|
602
|
-
for (var i = o[e + n >> 1], u = e - 1,
|
|
602
|
+
for (var i = o[e + n >> 1], u = e - 1, s = n + 1; ; ) {
|
|
603
603
|
do
|
|
604
604
|
u++;
|
|
605
605
|
while (r(o[u], i) < 0);
|
|
606
606
|
do
|
|
607
|
-
|
|
608
|
-
while (r(o[
|
|
609
|
-
if (u >=
|
|
607
|
+
s--;
|
|
608
|
+
while (r(o[s], i) > 0);
|
|
609
|
+
if (u >= s)
|
|
610
610
|
break;
|
|
611
611
|
var f = o[u];
|
|
612
|
-
o[u] = o[
|
|
612
|
+
o[u] = o[s], o[s] = f, f = t[u], t[u] = t[s], t[s] = f;
|
|
613
613
|
}
|
|
614
|
-
rt(o, t, e,
|
|
614
|
+
rt(o, t, e, s, r), rt(o, t, s + 1, n, r);
|
|
615
615
|
}
|
|
616
616
|
}
|
|
617
617
|
const F = 11102230246251565e-32, _ = 134217729, ee = (3 + 8 * F) * F;
|
|
618
618
|
function K(o, t, e, n, r) {
|
|
619
|
-
let i, u,
|
|
620
|
-
g > c == g > -c ? (i = c, c = t[++
|
|
619
|
+
let i, u, s, f, c = t[0], g = n[0], l = 0, h = 0;
|
|
620
|
+
g > c == g > -c ? (i = c, c = t[++l]) : (i = g, g = n[++h]);
|
|
621
621
|
let a = 0;
|
|
622
|
-
if (
|
|
623
|
-
for (g > c == g > -c ? (u = c + i,
|
|
624
|
-
g > c == g > -c ? (u = i + c, f = u - i,
|
|
625
|
-
for (;
|
|
626
|
-
u = i + c, f = u - i,
|
|
622
|
+
if (l < o && h < e)
|
|
623
|
+
for (g > c == g > -c ? (u = c + i, s = i - (u - c), c = t[++l]) : (u = g + i, s = i - (u - g), g = n[++h]), i = u, s !== 0 && (r[a++] = s); l < o && h < e; )
|
|
624
|
+
g > c == g > -c ? (u = i + c, f = u - i, s = i - (u - f) + (c - f), c = t[++l]) : (u = i + g, f = u - i, s = i - (u - f) + (g - f), g = n[++h]), i = u, s !== 0 && (r[a++] = s);
|
|
625
|
+
for (; l < o; )
|
|
626
|
+
u = i + c, f = u - i, s = i - (u - f) + (c - f), c = t[++l], i = u, s !== 0 && (r[a++] = s);
|
|
627
627
|
for (; h < e; )
|
|
628
|
-
u = i + g, f = u - i,
|
|
628
|
+
u = i + g, f = u - i, s = i - (u - f) + (g - f), g = n[++h], i = u, s !== 0 && (r[a++] = s);
|
|
629
629
|
return (i !== 0 || a === 0) && (r[a++] = i), a;
|
|
630
630
|
}
|
|
631
631
|
function ne(o, t) {
|
|
@@ -638,21 +638,21 @@ function Y(o) {
|
|
|
638
638
|
}
|
|
639
639
|
const re = (3 + 16 * F) * F, ie = (2 + 12 * F) * F, oe = (9 + 64 * F) * F * F, T = Y(4), dt = Y(8), vt = Y(12), mt = Y(16), P = Y(4);
|
|
640
640
|
function se(o, t, e, n, r, i, u) {
|
|
641
|
-
let
|
|
641
|
+
let s, f, c, g, l, h, a, x, d, y, p, m, v, E, w, b, M, S;
|
|
642
642
|
const L = o - r, I = e - r, k = t - i, C = n - i;
|
|
643
|
-
|
|
643
|
+
E = L * C, h = _ * L, a = h - (h - L), x = L - a, h = _ * C, d = h - (h - C), y = C - d, w = x * y - (E - a * d - x * d - a * y), b = k * I, h = _ * k, a = h - (h - k), x = k - a, h = _ * I, d = h - (h - I), y = I - d, M = x * y - (b - a * d - x * d - a * y), p = w - M, l = w - p, T[0] = w - (p + l) + (l - M), m = E + p, l = m - E, v = E - (m - l) + (p - l), p = v - b, l = v - p, T[1] = v - (p + l) + (l - b), S = m + p, l = S - m, T[2] = m - (S - l) + (p - l), T[3] = S;
|
|
644
644
|
let O = ne(4, T), q = ie * u;
|
|
645
|
-
if (O >= q || -O >= q || (
|
|
646
|
-
|
|
645
|
+
if (O >= q || -O >= q || (l = o - L, s = o - (L + l) + (l - r), l = e - I, c = e - (I + l) + (l - r), l = t - k, f = t - (k + l) + (l - i), l = n - C, g = n - (C + l) + (l - i), s === 0 && f === 0 && c === 0 && g === 0) || (q = oe * u + ee * Math.abs(O), O += L * g + C * s - (k * c + I * f), O >= q || -O >= q)) return O;
|
|
646
|
+
E = s * C, h = _ * s, a = h - (h - s), x = s - a, h = _ * C, d = h - (h - C), y = C - d, w = x * y - (E - a * d - x * d - a * y), b = f * I, h = _ * f, a = h - (h - f), x = f - a, h = _ * I, d = h - (h - I), y = I - d, M = x * y - (b - a * d - x * d - a * y), p = w - M, l = w - p, P[0] = w - (p + l) + (l - M), m = E + p, l = m - E, v = E - (m - l) + (p - l), p = v - b, l = v - p, P[1] = v - (p + l) + (l - b), S = m + p, l = S - m, P[2] = m - (S - l) + (p - l), P[3] = S;
|
|
647
647
|
const Gt = K(4, T, 4, P, dt);
|
|
648
|
-
|
|
648
|
+
E = L * g, h = _ * L, a = h - (h - L), x = L - a, h = _ * g, d = h - (h - g), y = g - d, w = x * y - (E - a * d - x * d - a * y), b = k * c, h = _ * k, a = h - (h - k), x = k - a, h = _ * c, d = h - (h - c), y = c - d, M = x * y - (b - a * d - x * d - a * y), p = w - M, l = w - p, P[0] = w - (p + l) + (l - M), m = E + p, l = m - E, v = E - (m - l) + (p - l), p = v - b, l = v - p, P[1] = v - (p + l) + (l - b), S = m + p, l = S - m, P[2] = m - (S - l) + (p - l), P[3] = S;
|
|
649
649
|
const Bt = K(Gt, dt, 4, P, vt);
|
|
650
|
-
|
|
650
|
+
E = s * g, h = _ * s, a = h - (h - s), x = s - a, h = _ * g, d = h - (h - g), y = g - d, w = x * y - (E - a * d - x * d - a * y), b = f * c, h = _ * f, a = h - (h - f), x = f - a, h = _ * c, d = h - (h - c), y = c - d, M = x * y - (b - a * d - x * d - a * y), p = w - M, l = w - p, P[0] = w - (p + l) + (l - M), m = E + p, l = m - E, v = E - (m - l) + (p - l), p = v - b, l = v - p, P[1] = v - (p + l) + (l - b), S = m + p, l = S - m, P[2] = m - (S - l) + (p - l), P[3] = S;
|
|
651
651
|
const zt = K(Bt, vt, 4, P, mt);
|
|
652
652
|
return mt[zt - 1];
|
|
653
653
|
}
|
|
654
654
|
function le(o, t, e, n, r, i) {
|
|
655
|
-
const u = (t - i) * (e - r),
|
|
655
|
+
const u = (t - i) * (e - r), s = (o - r) * (n - i), f = u - s, c = Math.abs(u + s);
|
|
656
656
|
return Math.abs(f) >= re * c ? f : -se(o, t, e, n, r, i, c);
|
|
657
657
|
}
|
|
658
658
|
const Q = (o, t) => o.ll.x <= t.x && t.x <= o.ur.x && o.ll.y <= t.y && t.y <= o.ur.y, it = (o, t) => {
|
|
@@ -747,7 +747,7 @@ const U = new fe(), j = (o, t) => o.x * t.y - o.y * t.x, Nt = (o, t) => o.x * t.
|
|
|
747
747
|
const i = {
|
|
748
748
|
x: e.x - o.x,
|
|
749
749
|
y: e.y - o.y
|
|
750
|
-
}, u = j(i, t) / r,
|
|
750
|
+
}, u = j(i, t) / r, s = j(i, n) / r, f = o.x + s * t.x, c = e.x + u * n.x, g = o.y + s * t.y, l = e.y + u * n.y, h = (f + c) / 2, a = (g + l) / 2;
|
|
751
751
|
return {
|
|
752
752
|
x: h,
|
|
753
753
|
y: a
|
|
@@ -820,12 +820,12 @@ class R {
|
|
|
820
820
|
e.has(r) || n(r), e.has(i) || n(i);
|
|
821
821
|
const {
|
|
822
822
|
sine: u,
|
|
823
|
-
cosine:
|
|
823
|
+
cosine: s
|
|
824
824
|
} = e.get(r), {
|
|
825
825
|
sine: f,
|
|
826
826
|
cosine: c
|
|
827
827
|
} = e.get(i);
|
|
828
|
-
return u >= 0 && f >= 0 ?
|
|
828
|
+
return u >= 0 && f >= 0 ? s < c ? 1 : s > c ? -1 : 0 : u < 0 && f < 0 ? s < c ? -1 : s > c ? 1 : 0 : f < u ? -1 : f > u ? 1 : 0;
|
|
829
829
|
};
|
|
830
830
|
}
|
|
831
831
|
}
|
|
@@ -848,39 +848,39 @@ class z {
|
|
|
848
848
|
const n = t.leftSE.point.x, r = e.leftSE.point.x, i = t.rightSE.point.x, u = e.rightSE.point.x;
|
|
849
849
|
if (u < n) return 1;
|
|
850
850
|
if (i < r) return -1;
|
|
851
|
-
const
|
|
851
|
+
const s = t.leftSE.point.y, f = e.leftSE.point.y, c = t.rightSE.point.y, g = e.rightSE.point.y;
|
|
852
852
|
if (n < r) {
|
|
853
|
-
if (f <
|
|
854
|
-
if (f >
|
|
855
|
-
const
|
|
856
|
-
if (
|
|
857
|
-
if (
|
|
853
|
+
if (f < s && f < c) return 1;
|
|
854
|
+
if (f > s && f > c) return -1;
|
|
855
|
+
const l = t.comparePoint(e.leftSE.point);
|
|
856
|
+
if (l < 0) return 1;
|
|
857
|
+
if (l > 0) return -1;
|
|
858
858
|
const h = e.comparePoint(t.rightSE.point);
|
|
859
859
|
return h !== 0 ? h : -1;
|
|
860
860
|
}
|
|
861
861
|
if (n > r) {
|
|
862
|
-
if (
|
|
863
|
-
if (
|
|
864
|
-
const
|
|
865
|
-
if (
|
|
862
|
+
if (s < f && s < g) return -1;
|
|
863
|
+
if (s > f && s > g) return 1;
|
|
864
|
+
const l = e.comparePoint(t.leftSE.point);
|
|
865
|
+
if (l !== 0) return l;
|
|
866
866
|
const h = t.comparePoint(e.rightSE.point);
|
|
867
867
|
return h < 0 ? 1 : h > 0 ? -1 : 1;
|
|
868
868
|
}
|
|
869
|
-
if (
|
|
870
|
-
if (
|
|
869
|
+
if (s < f) return -1;
|
|
870
|
+
if (s > f) return 1;
|
|
871
871
|
if (i < u) {
|
|
872
|
-
const
|
|
873
|
-
if (
|
|
872
|
+
const l = e.comparePoint(t.rightSE.point);
|
|
873
|
+
if (l !== 0) return l;
|
|
874
874
|
}
|
|
875
875
|
if (i > u) {
|
|
876
|
-
const
|
|
877
|
-
if (
|
|
878
|
-
if (
|
|
876
|
+
const l = t.comparePoint(e.rightSE.point);
|
|
877
|
+
if (l < 0) return 1;
|
|
878
|
+
if (l > 0) return -1;
|
|
879
879
|
}
|
|
880
880
|
if (i !== u) {
|
|
881
|
-
const
|
|
882
|
-
if (
|
|
883
|
-
if (
|
|
881
|
+
const l = c - s, h = i - n, a = g - f, x = u - r;
|
|
882
|
+
if (l > h && a < x) return 1;
|
|
883
|
+
if (l < h && a > x) return -1;
|
|
884
884
|
}
|
|
885
885
|
return i > u ? 1 : i < u || c < g ? -1 : c > g ? 1 : t.id < e.id ? -1 : t.id > e.id ? 1 : 0;
|
|
886
886
|
}
|
|
@@ -891,10 +891,10 @@ class z {
|
|
|
891
891
|
}
|
|
892
892
|
static fromRing(t, e, n) {
|
|
893
893
|
let r, i, u;
|
|
894
|
-
const
|
|
895
|
-
if (
|
|
894
|
+
const s = R.comparePoints(t, e);
|
|
895
|
+
if (s < 0)
|
|
896
896
|
r = t, i = e, u = 1;
|
|
897
|
-
else if (
|
|
897
|
+
else if (s > 0)
|
|
898
898
|
r = e, i = t, u = -1;
|
|
899
899
|
else throw new Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);
|
|
900
900
|
const f = new R(r, !0), c = new R(i, !1);
|
|
@@ -947,7 +947,7 @@ class z {
|
|
|
947
947
|
return t.x === e.x ? 0 : t.x < e.x ? 1 : -1;
|
|
948
948
|
const i = (t.y - e.y) / r.y, u = e.x + i * r.x;
|
|
949
949
|
if (t.x === u) return 0;
|
|
950
|
-
const
|
|
950
|
+
const s = (t.x - e.x) / r.x, f = e.y + s * r.y;
|
|
951
951
|
return t.y === f ? 0 : t.y < f ? -1 : 1;
|
|
952
952
|
}
|
|
953
953
|
/**
|
|
@@ -968,17 +968,17 @@ class z {
|
|
|
968
968
|
getIntersection(t) {
|
|
969
969
|
const e = this.bbox(), n = t.bbox(), r = it(e, n);
|
|
970
970
|
if (r === null) return null;
|
|
971
|
-
const i = this.leftSE.point, u = this.rightSE.point,
|
|
971
|
+
const i = this.leftSE.point, u = this.rightSE.point, s = t.leftSE.point, f = t.rightSE.point, c = Q(e, s) && this.comparePoint(s) === 0, g = Q(n, i) && t.comparePoint(i) === 0, l = Q(e, f) && this.comparePoint(f) === 0, h = Q(n, u) && t.comparePoint(u) === 0;
|
|
972
972
|
if (g && c)
|
|
973
|
-
return h && !
|
|
973
|
+
return h && !l ? u : !h && l ? f : null;
|
|
974
974
|
if (g)
|
|
975
|
-
return
|
|
975
|
+
return l && i.x === f.x && i.y === f.y ? null : i;
|
|
976
976
|
if (c)
|
|
977
|
-
return h && u.x ===
|
|
978
|
-
if (h &&
|
|
977
|
+
return h && u.x === s.x && u.y === s.y ? null : s;
|
|
978
|
+
if (h && l) return null;
|
|
979
979
|
if (h) return u;
|
|
980
|
-
if (
|
|
981
|
-
const a = ae(i, this.vector(),
|
|
980
|
+
if (l) return f;
|
|
981
|
+
const a = ae(i, this.vector(), s, t.vector());
|
|
982
982
|
return a === null || !Q(r, a) ? null : U.round(a.x, a.y);
|
|
983
983
|
}
|
|
984
984
|
/**
|
|
@@ -996,8 +996,8 @@ class z {
|
|
|
996
996
|
split(t) {
|
|
997
997
|
const e = [], n = t.events !== void 0, r = new R(t, !0), i = new R(t, !1), u = this.rightSE;
|
|
998
998
|
this.replaceRightSE(i), e.push(i), e.push(r);
|
|
999
|
-
const
|
|
1000
|
-
return R.comparePoints(
|
|
999
|
+
const s = new z(r, u, this.rings.slice(), this.windings.slice());
|
|
1000
|
+
return R.comparePoints(s.leftSE.point, s.rightSE.point) > 0 && s.swapEvents(), R.comparePoints(this.leftSE.point, this.rightSE.point) > 0 && this.swapEvents(), n && (r.checkForConsuming(), i.checkForConsuming()), e;
|
|
1001
1001
|
}
|
|
1002
1002
|
/* Swap which event is left and right */
|
|
1003
1003
|
swapEvents() {
|
|
@@ -1023,8 +1023,8 @@ class z {
|
|
|
1023
1023
|
e = n, n = i;
|
|
1024
1024
|
}
|
|
1025
1025
|
for (let i = 0, u = n.rings.length; i < u; i++) {
|
|
1026
|
-
const
|
|
1027
|
-
c === -1 ? (e.rings.push(
|
|
1026
|
+
const s = n.rings[i], f = n.windings[i], c = e.rings.indexOf(s);
|
|
1027
|
+
c === -1 ? (e.rings.push(s), e.windings.push(f)) : e.windings[c] += f;
|
|
1028
1028
|
}
|
|
1029
1029
|
n.rings = null, n.windings = null, n.consumedBy = e, n.leftSE.consumedBy = e.leftSE, n.rightSE.consumedBy = e.rightSE;
|
|
1030
1030
|
}
|
|
@@ -1055,24 +1055,24 @@ class z {
|
|
|
1055
1055
|
multiPolys: []
|
|
1056
1056
|
};
|
|
1057
1057
|
const e = this._afterState.rings, n = this._afterState.windings, r = this._afterState.multiPolys;
|
|
1058
|
-
for (let
|
|
1059
|
-
const c = this.rings[
|
|
1060
|
-
|
|
1058
|
+
for (let s = 0, f = this.rings.length; s < f; s++) {
|
|
1059
|
+
const c = this.rings[s], g = this.windings[s], l = e.indexOf(c);
|
|
1060
|
+
l === -1 ? (e.push(c), n.push(g)) : n[l] += g;
|
|
1061
1061
|
}
|
|
1062
1062
|
const i = [], u = [];
|
|
1063
|
-
for (let
|
|
1064
|
-
if (n[
|
|
1065
|
-
const c = e[
|
|
1063
|
+
for (let s = 0, f = e.length; s < f; s++) {
|
|
1064
|
+
if (n[s] === 0) continue;
|
|
1065
|
+
const c = e[s], g = c.poly;
|
|
1066
1066
|
if (u.indexOf(g) === -1)
|
|
1067
1067
|
if (c.isExterior) i.push(g);
|
|
1068
1068
|
else {
|
|
1069
1069
|
u.indexOf(g) === -1 && u.push(g);
|
|
1070
|
-
const
|
|
1071
|
-
|
|
1070
|
+
const l = i.indexOf(c.poly);
|
|
1071
|
+
l !== -1 && i.splice(l, 1);
|
|
1072
1072
|
}
|
|
1073
1073
|
}
|
|
1074
|
-
for (let
|
|
1075
|
-
const c = i[
|
|
1074
|
+
for (let s = 0, f = i.length; s < f; s++) {
|
|
1075
|
+
const c = i[s].multiPoly;
|
|
1076
1076
|
r.indexOf(c) === -1 && r.push(c);
|
|
1077
1077
|
}
|
|
1078
1078
|
return this._afterState;
|
|
@@ -1127,7 +1127,7 @@ class Pt {
|
|
|
1127
1127
|
}
|
|
1128
1128
|
};
|
|
1129
1129
|
let i = r;
|
|
1130
|
-
for (let u = 1,
|
|
1130
|
+
for (let u = 1, s = t.length; u < s; u++) {
|
|
1131
1131
|
if (typeof t[u][0] != "number" || typeof t[u][1] != "number")
|
|
1132
1132
|
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
1133
1133
|
let f = U.round(t[u][0], t[u][1]);
|
|
@@ -1216,36 +1216,36 @@ class W {
|
|
|
1216
1216
|
for (let n = 0, r = t.length; n < r; n++) {
|
|
1217
1217
|
const i = t[n];
|
|
1218
1218
|
if (!i.isInResult() || i.ringOut) continue;
|
|
1219
|
-
let u = null,
|
|
1220
|
-
const c = [
|
|
1221
|
-
for (; u =
|
|
1219
|
+
let u = null, s = i.leftSE, f = i.rightSE;
|
|
1220
|
+
const c = [s], g = s.point, l = [];
|
|
1221
|
+
for (; u = s, s = f, c.push(s), s.point !== g; )
|
|
1222
1222
|
for (; ; ) {
|
|
1223
|
-
const h =
|
|
1223
|
+
const h = s.getAvailableLinkedEvents();
|
|
1224
1224
|
if (h.length === 0) {
|
|
1225
|
-
const
|
|
1226
|
-
throw new Error(`Unable to complete output ring starting at [${
|
|
1225
|
+
const d = c[0].point, y = c[c.length - 1].point;
|
|
1226
|
+
throw new Error(`Unable to complete output ring starting at [${d.x}, ${d.y}]. Last matching segment found ends at [${y.x}, ${y.y}].`);
|
|
1227
1227
|
}
|
|
1228
1228
|
if (h.length === 1) {
|
|
1229
1229
|
f = h[0].otherSE;
|
|
1230
1230
|
break;
|
|
1231
1231
|
}
|
|
1232
1232
|
let a = null;
|
|
1233
|
-
for (let
|
|
1234
|
-
if (
|
|
1235
|
-
a =
|
|
1233
|
+
for (let d = 0, y = l.length; d < y; d++)
|
|
1234
|
+
if (l[d].point === s.point) {
|
|
1235
|
+
a = d;
|
|
1236
1236
|
break;
|
|
1237
1237
|
}
|
|
1238
1238
|
if (a !== null) {
|
|
1239
|
-
const
|
|
1239
|
+
const d = l.splice(a)[0], y = c.splice(d.index);
|
|
1240
1240
|
y.unshift(y[0].otherSE), e.push(new W(y.reverse()));
|
|
1241
1241
|
continue;
|
|
1242
1242
|
}
|
|
1243
|
-
|
|
1243
|
+
l.push({
|
|
1244
1244
|
index: c.length,
|
|
1245
|
-
point:
|
|
1245
|
+
point: s.point
|
|
1246
1246
|
});
|
|
1247
|
-
const
|
|
1248
|
-
f = h.sort(
|
|
1247
|
+
const x = s.getLeftmostComparator(u);
|
|
1248
|
+
f = h.sort(x)[0].otherSE;
|
|
1249
1249
|
break;
|
|
1250
1250
|
}
|
|
1251
1251
|
e.push(new W(c));
|
|
@@ -1262,14 +1262,14 @@ class W {
|
|
|
1262
1262
|
let t = this.events[0].point;
|
|
1263
1263
|
const e = [t];
|
|
1264
1264
|
for (let c = 1, g = this.events.length - 1; c < g; c++) {
|
|
1265
|
-
const
|
|
1266
|
-
bt(
|
|
1265
|
+
const l = this.events[c].point, h = this.events[c + 1].point;
|
|
1266
|
+
bt(l, t, h) !== 0 && (e.push(l), t = l);
|
|
1267
1267
|
}
|
|
1268
1268
|
if (e.length === 1) return null;
|
|
1269
1269
|
const n = e[0], r = e[1];
|
|
1270
1270
|
bt(n, t, r) === 0 && e.shift(), e.push(e[0]);
|
|
1271
|
-
const i = this.isExteriorRing() ? 1 : -1, u = this.isExteriorRing() ? 0 : e.length - 1,
|
|
1272
|
-
for (let c = u; c !=
|
|
1271
|
+
const i = this.isExteriorRing() ? 1 : -1, u = this.isExteriorRing() ? 0 : e.length - 1, s = this.isExteriorRing() ? e.length : -1, f = [];
|
|
1272
|
+
for (let c = u; c != s; c += i) f.push([e[c].x, e[c].y]);
|
|
1273
1273
|
return f;
|
|
1274
1274
|
}
|
|
1275
1275
|
isExteriorRing() {
|
|
@@ -1353,51 +1353,51 @@ class xe {
|
|
|
1353
1353
|
return t.isLeft ? this.queue.remove(t.otherSE) : this.tree.remove(e), n;
|
|
1354
1354
|
const r = t.isLeft ? this.tree.add(e) : this.tree.find(e);
|
|
1355
1355
|
if (!r) throw new Error(`Unable to find segment #${e.id} [${e.leftSE.point.x}, ${e.leftSE.point.y}] -> [${e.rightSE.point.x}, ${e.rightSE.point.y}] in SweepLine tree.`);
|
|
1356
|
-
let i = r, u = r,
|
|
1357
|
-
for (;
|
|
1358
|
-
i = this.tree.prev(i), i === null ?
|
|
1356
|
+
let i = r, u = r, s, f;
|
|
1357
|
+
for (; s === void 0; )
|
|
1358
|
+
i = this.tree.prev(i), i === null ? s = null : i.key.consumedBy === void 0 && (s = i.key);
|
|
1359
1359
|
for (; f === void 0; )
|
|
1360
1360
|
u = this.tree.next(u), u === null ? f = null : u.key.consumedBy === void 0 && (f = u.key);
|
|
1361
1361
|
if (t.isLeft) {
|
|
1362
1362
|
let c = null;
|
|
1363
|
-
if (
|
|
1364
|
-
const
|
|
1365
|
-
if (
|
|
1366
|
-
const h = this._splitSafely(
|
|
1367
|
-
for (let a = 0,
|
|
1363
|
+
if (s) {
|
|
1364
|
+
const l = s.getIntersection(e);
|
|
1365
|
+
if (l !== null && (e.isAnEndpoint(l) || (c = l), !s.isAnEndpoint(l))) {
|
|
1366
|
+
const h = this._splitSafely(s, l);
|
|
1367
|
+
for (let a = 0, x = h.length; a < x; a++)
|
|
1368
1368
|
n.push(h[a]);
|
|
1369
1369
|
}
|
|
1370
1370
|
}
|
|
1371
1371
|
let g = null;
|
|
1372
1372
|
if (f) {
|
|
1373
|
-
const
|
|
1374
|
-
if (
|
|
1375
|
-
const h = this._splitSafely(f,
|
|
1376
|
-
for (let a = 0,
|
|
1373
|
+
const l = f.getIntersection(e);
|
|
1374
|
+
if (l !== null && (e.isAnEndpoint(l) || (g = l), !f.isAnEndpoint(l))) {
|
|
1375
|
+
const h = this._splitSafely(f, l);
|
|
1376
|
+
for (let a = 0, x = h.length; a < x; a++)
|
|
1377
1377
|
n.push(h[a]);
|
|
1378
1378
|
}
|
|
1379
1379
|
}
|
|
1380
1380
|
if (c !== null || g !== null) {
|
|
1381
|
-
let
|
|
1382
|
-
c === null ?
|
|
1383
|
-
const h = e.split(
|
|
1384
|
-
for (let a = 0,
|
|
1381
|
+
let l = null;
|
|
1382
|
+
c === null ? l = g : g === null ? l = c : l = R.comparePoints(c, g) <= 0 ? c : g, this.queue.remove(e.rightSE), n.push(e.rightSE);
|
|
1383
|
+
const h = e.split(l);
|
|
1384
|
+
for (let a = 0, x = h.length; a < x; a++)
|
|
1385
1385
|
n.push(h[a]);
|
|
1386
1386
|
}
|
|
1387
|
-
n.length > 0 ? (this.tree.remove(e), n.push(t)) : (this.segments.push(e), e.prev =
|
|
1387
|
+
n.length > 0 ? (this.tree.remove(e), n.push(t)) : (this.segments.push(e), e.prev = s);
|
|
1388
1388
|
} else {
|
|
1389
|
-
if (
|
|
1390
|
-
const c =
|
|
1389
|
+
if (s && f) {
|
|
1390
|
+
const c = s.getIntersection(f);
|
|
1391
1391
|
if (c !== null) {
|
|
1392
|
-
if (!
|
|
1393
|
-
const g = this._splitSafely(
|
|
1394
|
-
for (let
|
|
1395
|
-
n.push(g[
|
|
1392
|
+
if (!s.isAnEndpoint(c)) {
|
|
1393
|
+
const g = this._splitSafely(s, c);
|
|
1394
|
+
for (let l = 0, h = g.length; l < h; l++)
|
|
1395
|
+
n.push(g[l]);
|
|
1396
1396
|
}
|
|
1397
1397
|
if (!f.isAnEndpoint(c)) {
|
|
1398
1398
|
const g = this._splitSafely(f, c);
|
|
1399
|
-
for (let
|
|
1400
|
-
n.push(g[
|
|
1399
|
+
for (let l = 0, h = g.length; l < h; l++)
|
|
1400
|
+
n.push(g[l]);
|
|
1401
1401
|
}
|
|
1402
1402
|
}
|
|
1403
1403
|
}
|
|
@@ -1420,45 +1420,45 @@ class ve {
|
|
|
1420
1420
|
run(t, e, n) {
|
|
1421
1421
|
A.type = t, U.reset();
|
|
1422
1422
|
const r = [new Mt(e, !0)];
|
|
1423
|
-
for (let
|
|
1424
|
-
r.push(new Mt(n[
|
|
1423
|
+
for (let l = 0, h = n.length; l < h; l++)
|
|
1424
|
+
r.push(new Mt(n[l], !1));
|
|
1425
1425
|
if (A.numMultiPolys = r.length, A.type === "difference") {
|
|
1426
|
-
const
|
|
1426
|
+
const l = r[0];
|
|
1427
1427
|
let h = 1;
|
|
1428
1428
|
for (; h < r.length; )
|
|
1429
|
-
it(r[h].bbox,
|
|
1429
|
+
it(r[h].bbox, l.bbox) !== null ? h++ : r.splice(h, 1);
|
|
1430
1430
|
}
|
|
1431
1431
|
if (A.type === "intersection")
|
|
1432
|
-
for (let
|
|
1433
|
-
const a = r[
|
|
1434
|
-
for (let
|
|
1435
|
-
if (it(a.bbox, r[
|
|
1432
|
+
for (let l = 0, h = r.length; l < h; l++) {
|
|
1433
|
+
const a = r[l];
|
|
1434
|
+
for (let x = l + 1, d = r.length; x < d; x++)
|
|
1435
|
+
if (it(a.bbox, r[x].bbox) === null) return [];
|
|
1436
1436
|
}
|
|
1437
1437
|
const i = new lt(R.compare);
|
|
1438
|
-
for (let
|
|
1439
|
-
const a = r[
|
|
1440
|
-
for (let
|
|
1441
|
-
if (i.insert(a[
|
|
1438
|
+
for (let l = 0, h = r.length; l < h; l++) {
|
|
1439
|
+
const a = r[l].getSweepEvents();
|
|
1440
|
+
for (let x = 0, d = a.length; x < d; x++)
|
|
1441
|
+
if (i.insert(a[x]), i.size > Lt)
|
|
1442
1442
|
throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).");
|
|
1443
1443
|
}
|
|
1444
1444
|
const u = new xe(i);
|
|
1445
|
-
let
|
|
1445
|
+
let s = i.size, f = i.pop();
|
|
1446
1446
|
for (; f; ) {
|
|
1447
|
-
const
|
|
1448
|
-
if (i.size ===
|
|
1449
|
-
const a =
|
|
1450
|
-
throw new Error(`Unable to pop() ${
|
|
1447
|
+
const l = f.key;
|
|
1448
|
+
if (i.size === s) {
|
|
1449
|
+
const a = l.segment;
|
|
1450
|
+
throw new Error(`Unable to pop() ${l.isLeft ? "left" : "right"} SweepEvent [${l.point.x}, ${l.point.y}] from segment #${a.id} [${a.leftSE.point.x}, ${a.leftSE.point.y}] -> [${a.rightSE.point.x}, ${a.rightSE.point.y}] from queue.`);
|
|
1451
1451
|
}
|
|
1452
1452
|
if (i.size > Lt)
|
|
1453
1453
|
throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");
|
|
1454
1454
|
if (u.segments.length > de)
|
|
1455
1455
|
throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");
|
|
1456
|
-
const h = u.process(
|
|
1457
|
-
for (let a = 0,
|
|
1458
|
-
const
|
|
1459
|
-
|
|
1456
|
+
const h = u.process(l);
|
|
1457
|
+
for (let a = 0, x = h.length; a < x; a++) {
|
|
1458
|
+
const d = h[a];
|
|
1459
|
+
d.consumedBy === void 0 && i.insert(d);
|
|
1460
1460
|
}
|
|
1461
|
-
|
|
1461
|
+
s = i.size, f = i.pop();
|
|
1462
1462
|
}
|
|
1463
1463
|
U.reset();
|
|
1464
1464
|
const c = W.factory(u.segments);
|
|
@@ -1539,22 +1539,22 @@ function kt(o, t) {
|
|
|
1539
1539
|
if (!e)
|
|
1540
1540
|
return;
|
|
1541
1541
|
e.properties = { isMask: !0 };
|
|
1542
|
-
const n = It(yt(o)), r = (n[2] - n[0]) / 360 / 1e3, i = n[0] < -180, u = n[2] > 180,
|
|
1543
|
-
if (
|
|
1544
|
-
for (const f of
|
|
1542
|
+
const n = It(yt(o)), r = (n[2] - n[0]) / 360 / 1e3, i = n[0] < -180, u = n[2] > 180, s = Me(o);
|
|
1543
|
+
if (s.features.length > 1 && (i || u))
|
|
1544
|
+
for (const f of s.features) {
|
|
1545
1545
|
const c = It(yt(f));
|
|
1546
1546
|
if (u && c[0] < -180 + r)
|
|
1547
1547
|
for (const g of f.geometry.coordinates)
|
|
1548
|
-
for (const
|
|
1549
|
-
|
|
1548
|
+
for (const l of g)
|
|
1549
|
+
l[0] += 360 - r;
|
|
1550
1550
|
if (i && c[2] > 180 - r)
|
|
1551
1551
|
for (const g of f.geometry.coordinates)
|
|
1552
|
-
for (const
|
|
1553
|
-
|
|
1552
|
+
for (const l of g)
|
|
1553
|
+
l[0] -= 360 - r;
|
|
1554
1554
|
}
|
|
1555
1555
|
t(
|
|
1556
1556
|
H([
|
|
1557
|
-
|
|
1557
|
+
s.features.length < 2 ? o : Le(s) ?? o,
|
|
1558
1558
|
e
|
|
1559
1559
|
])
|
|
1560
1560
|
);
|
|
@@ -1592,156 +1592,159 @@ function Ie(o) {
|
|
|
1592
1592
|
});
|
|
1593
1593
|
}
|
|
1594
1594
|
function Te(o, t = {}, e = {}, n = Ie, r = !1) {
|
|
1595
|
-
let i = -1, u,
|
|
1596
|
-
const
|
|
1595
|
+
let i = -1, u, s, f, c = !1, g = r;
|
|
1596
|
+
const l = new Tt({
|
|
1597
1597
|
updateWhileAnimating: !0
|
|
1598
1598
|
});
|
|
1599
|
-
o.addLayer(
|
|
1600
|
-
const
|
|
1601
|
-
|
|
1602
|
-
o.forEachFeatureAtPixel(
|
|
1603
|
-
const
|
|
1604
|
-
if (
|
|
1605
|
-
return
|
|
1599
|
+
o.addLayer(l);
|
|
1600
|
+
const h = new Ut({});
|
|
1601
|
+
l.setSource(h), l.setStyle(n), o.on("click", (y) => {
|
|
1602
|
+
o.forEachFeatureAtPixel(y.pixel, (p) => {
|
|
1603
|
+
const m = p.getId();
|
|
1604
|
+
if (m)
|
|
1605
|
+
return y.stopPropagation(), s == null || s({ type: "markerClick", id: m }), p;
|
|
1606
1606
|
});
|
|
1607
|
-
}), o.on("pointermove", (
|
|
1608
|
-
const
|
|
1609
|
-
u !==
|
|
1607
|
+
}), o.on("pointermove", (y) => {
|
|
1608
|
+
const p = o.forEachFeatureAtPixel(y.pixel, (m) => m.getId());
|
|
1609
|
+
u !== p && (u && (s == null || s({
|
|
1610
1610
|
type: "markerMouseLeave",
|
|
1611
1611
|
id: u
|
|
1612
|
-
})),
|
|
1612
|
+
})), p && (s == null || s({
|
|
1613
1613
|
type: "markerMouseEnter",
|
|
1614
|
-
id:
|
|
1615
|
-
})), o.getTargetElement().style.cursor =
|
|
1614
|
+
id: p
|
|
1615
|
+
})), o.getTargetElement().style.cursor = p ? "pointer" : c ? "crosshair" : "", u = p);
|
|
1616
1616
|
});
|
|
1617
|
-
function
|
|
1617
|
+
function a() {
|
|
1618
1618
|
return qt() ?? o.getView().getProjection();
|
|
1619
1619
|
}
|
|
1620
|
-
function
|
|
1621
|
-
return
|
|
1620
|
+
function x(y) {
|
|
1621
|
+
return y.transform(Ct, a());
|
|
1622
1622
|
}
|
|
1623
|
-
const d = (
|
|
1624
|
-
|
|
1623
|
+
const d = (y) => {
|
|
1624
|
+
s == null || s({
|
|
1625
1625
|
type: "mapClick",
|
|
1626
|
-
coordinates: at(
|
|
1626
|
+
coordinates: at(y.coordinate, a())
|
|
1627
1627
|
});
|
|
1628
1628
|
};
|
|
1629
1629
|
return {
|
|
1630
|
-
setEventHandler(
|
|
1631
|
-
|
|
1630
|
+
setEventHandler(y) {
|
|
1631
|
+
y ? (s = y, o.on("click", d)) : (s = void 0, o.un("click", d));
|
|
1632
1632
|
},
|
|
1633
|
-
flyTo(
|
|
1633
|
+
flyTo(y, p) {
|
|
1634
1634
|
o.getView().animate({
|
|
1635
|
-
center: V(
|
|
1636
|
-
...
|
|
1635
|
+
center: V(y, a()),
|
|
1636
|
+
...p ? { zoom: p } : {},
|
|
1637
1637
|
duration: 2e3,
|
|
1638
1638
|
...t
|
|
1639
1639
|
});
|
|
1640
1640
|
},
|
|
1641
|
-
fitBounds(
|
|
1642
|
-
o.getView().fit(Qt(
|
|
1643
|
-
padding: [
|
|
1644
|
-
...
|
|
1641
|
+
fitBounds(y, p, m) {
|
|
1642
|
+
o.getView().fit(Qt(y, Ct, a()), {
|
|
1643
|
+
padding: [p, p, p, p],
|
|
1644
|
+
...m ? { maxZoom: m } : {},
|
|
1645
1645
|
duration: 2e3,
|
|
1646
1646
|
...e
|
|
1647
1647
|
});
|
|
1648
1648
|
},
|
|
1649
|
-
indicateReverse(
|
|
1650
|
-
c =
|
|
1649
|
+
indicateReverse(y) {
|
|
1650
|
+
c = y, o.getTargetElement().style.cursor = y ? "crosshair" : "";
|
|
1651
1651
|
},
|
|
1652
|
-
setReverseMarker(
|
|
1653
|
-
f ?
|
|
1654
|
-
V(
|
|
1655
|
-
) : (
|
|
1656
|
-
new Z(V(
|
|
1657
|
-
), f.setProperties({ isReverse: !0 }),
|
|
1652
|
+
setReverseMarker(y) {
|
|
1653
|
+
f ? y ? f.getGeometry().setCoordinates(
|
|
1654
|
+
V(y, a())
|
|
1655
|
+
) : (h.removeFeature(f), f.dispose(), f = void 0) : y && (f = new N(
|
|
1656
|
+
new Z(V(y, a()))
|
|
1657
|
+
), f.setProperties({ isReverse: !0 }), h.addFeature(f));
|
|
1658
1658
|
},
|
|
1659
|
-
setMarkers(
|
|
1660
|
-
function
|
|
1661
|
-
var
|
|
1662
|
-
if (
|
|
1663
|
-
for (const
|
|
1664
|
-
const
|
|
1665
|
-
|
|
1659
|
+
setMarkers(y, p) {
|
|
1660
|
+
function m(v) {
|
|
1661
|
+
var E;
|
|
1662
|
+
if (v)
|
|
1663
|
+
for (const w of v.features) {
|
|
1664
|
+
const b = w.geometry.type === "Polygon" ? new ut(w.geometry.coordinates) : w.geometry.type === "MultiPolygon" ? new ft(w.geometry.coordinates) : null;
|
|
1665
|
+
b && h.addFeature(
|
|
1666
1666
|
new N({
|
|
1667
|
-
isMask: !!((
|
|
1668
|
-
geometry:
|
|
1667
|
+
isMask: !!((E = w.properties) != null && E.isMask),
|
|
1668
|
+
geometry: x(b)
|
|
1669
1669
|
})
|
|
1670
1670
|
);
|
|
1671
1671
|
}
|
|
1672
1672
|
}
|
|
1673
|
-
if (
|
|
1674
|
-
let
|
|
1675
|
-
if (
|
|
1676
|
-
const
|
|
1677
|
-
(
|
|
1678
|
-
).filter((
|
|
1679
|
-
if (
|
|
1680
|
-
|
|
1681
|
-
new N(
|
|
1682
|
-
),
|
|
1673
|
+
if (h.clear(), f && h.addFeature(f), p) {
|
|
1674
|
+
let v = !1;
|
|
1675
|
+
if (p.geometry.type === "GeometryCollection") {
|
|
1676
|
+
const E = p.geometry.geometries.map(
|
|
1677
|
+
(w) => w.type === "Polygon" ? new ut(w.coordinates) : w.type === "MultiPolygon" ? new ft(w.coordinates) : null
|
|
1678
|
+
).filter((w) => !!w);
|
|
1679
|
+
if (E.length > 0)
|
|
1680
|
+
h.addFeature(
|
|
1681
|
+
new N(x(new $t(E)))
|
|
1682
|
+
), v = !0;
|
|
1683
1683
|
else
|
|
1684
|
-
for (const
|
|
1685
|
-
|
|
1684
|
+
for (const w of p.geometry.geometries)
|
|
1685
|
+
w.type === "LineString" ? (h.addFeature(
|
|
1686
1686
|
new N(
|
|
1687
|
-
|
|
1687
|
+
x(new ct(w.coordinates))
|
|
1688
1688
|
)
|
|
1689
|
-
),
|
|
1689
|
+
), v = !0) : w.type === "MultiLineString" && h.addFeature(
|
|
1690
1690
|
new N(
|
|
1691
|
-
|
|
1691
|
+
x(new ht(w.coordinates))
|
|
1692
1692
|
)
|
|
1693
|
-
),
|
|
1693
|
+
), v = !0;
|
|
1694
1694
|
}
|
|
1695
|
-
if (!
|
|
1696
|
-
if (
|
|
1697
|
-
kt(
|
|
1698
|
-
else if (
|
|
1699
|
-
kt(
|
|
1700
|
-
else if (
|
|
1701
|
-
|
|
1695
|
+
if (!v) {
|
|
1696
|
+
if (p.geometry.type === "Polygon")
|
|
1697
|
+
kt(p, m);
|
|
1698
|
+
else if (p.geometry.type === "MultiPolygon")
|
|
1699
|
+
kt(p, m);
|
|
1700
|
+
else if (p.geometry.type === "LineString") {
|
|
1701
|
+
h.addFeature(
|
|
1702
1702
|
new N(
|
|
1703
|
-
|
|
1703
|
+
x(new ct(p.geometry.coordinates))
|
|
1704
1704
|
)
|
|
1705
1705
|
);
|
|
1706
1706
|
return;
|
|
1707
|
-
} else if (
|
|
1708
|
-
|
|
1707
|
+
} else if (p.geometry.type === "MultiLineString") {
|
|
1708
|
+
h.addFeature(
|
|
1709
1709
|
new N(
|
|
1710
|
-
|
|
1710
|
+
x(new ht(p.geometry.coordinates))
|
|
1711
1711
|
)
|
|
1712
1712
|
);
|
|
1713
1713
|
return;
|
|
1714
1714
|
}
|
|
1715
1715
|
}
|
|
1716
|
-
if (!
|
|
1716
|
+
if (!g && p.geometry.type !== "Point")
|
|
1717
1717
|
return;
|
|
1718
|
-
|
|
1718
|
+
h.addFeature(new N(x(new Z(p.center))));
|
|
1719
1719
|
}
|
|
1720
|
-
for (const
|
|
1721
|
-
if (
|
|
1720
|
+
for (const v of y ?? []) {
|
|
1721
|
+
if (v === p)
|
|
1722
1722
|
continue;
|
|
1723
|
-
const
|
|
1724
|
-
new Z(V(
|
|
1723
|
+
const E = new N(
|
|
1724
|
+
new Z(V(v.center, a()))
|
|
1725
1725
|
);
|
|
1726
|
-
|
|
1727
|
-
fuzzy: !!
|
|
1728
|
-
tooltip:
|
|
1729
|
-
}),
|
|
1726
|
+
E.setId(v.id), E.setProperties({
|
|
1727
|
+
fuzzy: !!v.matching_text,
|
|
1728
|
+
tooltip: v.place_type[0] === "reverse" ? v.place_name : v.place_name.replace(/,.*/, "")
|
|
1729
|
+
}), h.addFeature(E);
|
|
1730
1730
|
}
|
|
1731
1731
|
},
|
|
1732
|
-
setSelectedMarker(
|
|
1733
|
-
var
|
|
1734
|
-
const
|
|
1735
|
-
i > -1 && ((
|
|
1732
|
+
setSelectedMarker(y) {
|
|
1733
|
+
var v, E, w;
|
|
1734
|
+
const p = h.getFeatures(), m = (v = p[0]) != null && v.getProperties().isReverse ? 1 : 0;
|
|
1735
|
+
i > -1 && ((E = p[i + m]) == null || E.setProperties({
|
|
1736
1736
|
isSelected: !1
|
|
1737
|
-
})),
|
|
1737
|
+
})), y > -1 && ((w = p[y + m]) == null || w.setProperties({
|
|
1738
1738
|
isSelected: !0
|
|
1739
|
-
})), i =
|
|
1739
|
+
})), i = y;
|
|
1740
1740
|
},
|
|
1741
1741
|
getCenterAndZoom() {
|
|
1742
|
-
const
|
|
1743
|
-
if (!(!
|
|
1744
|
-
return [
|
|
1742
|
+
const y = o.getView(), p = y.getCenter(), m = y.getZoom();
|
|
1743
|
+
if (!(!p || m === void 0))
|
|
1744
|
+
return [m, ...at(p, a())];
|
|
1745
|
+
},
|
|
1746
|
+
setShowPolygonMarker(y) {
|
|
1747
|
+
g = y;
|
|
1745
1748
|
}
|
|
1746
1749
|
};
|
|
1747
1750
|
}
|