@maptiler/geocoding-control 2.0.0-rc.5 → 2.0.0-rc.7
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 +1 -18
- package/leaflet-controller.d.ts +2 -3
- package/leaflet-controller.js +450 -453
- package/leaflet-controller.js.map +1 -1
- package/leaflet-controller.umd.js +3 -3
- package/leaflet-controller.umd.js.map +1 -1
- package/leaflet.js +949 -954
- 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 -3
- package/maplibregl-controller.js +140 -143
- package/maplibregl-controller.js.map +1 -1
- package/maplibregl-controller.umd.js +2 -2
- package/maplibregl-controller.umd.js.map +1 -1
- package/maplibregl.d.ts +0 -17
- package/maplibregl.js +1673 -1680
- package/maplibregl.js.map +1 -1
- package/maplibregl.umd.js +3 -3
- package/maplibregl.umd.js.map +1 -1
- package/maptilersdk.d.ts +0 -17
- package/maptilersdk.js +1670 -1677
- 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 -3
- package/openlayers-controller.js +366 -369
- 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 +1075 -1079
- 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 +739 -737
- package/react.js.map +1 -1
- package/react.umd.js +1 -1
- package/react.umd.js.map +1 -1
- package/svelte/GeocodingControl.svelte +7 -5
- package/svelte/MapLibreBasedGeocodingControl.d.ts +1 -18
- package/svelte/MapLibreBasedGeocodingControl.js +2 -7
- package/svelte/leaflet-controller.d.ts +2 -3
- package/svelte/leaflet-controller.js +3 -7
- package/svelte/leaflet.js +2 -7
- package/svelte/maplibregl-controller.d.ts +2 -3
- package/svelte/maplibregl-controller.js +3 -7
- package/svelte/maplibregl.d.ts +0 -17
- package/svelte/maptilersdk.d.ts +0 -17
- package/svelte/openlayers-controller.d.ts +2 -3
- package/svelte/openlayers-controller.js +3 -7
- package/svelte/openlayers.js +2 -5
- package/svelte/types.d.ts +1 -2
- package/types.d.ts +1 -2
- package/vanilla.js +760 -758
- 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,77 +41,77 @@ 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
|
-
|
|
46
|
-
for (var
|
|
47
|
-
var
|
|
48
|
-
if (u = h ?
|
|
49
|
-
|
|
50
|
-
var
|
|
51
|
-
switch (
|
|
44
|
+
for (var n, r, i, u, l, c, f, a = 0, s = 0, h, g = o.type, y = g === "FeatureCollection", p = g === "Feature", d = y ? o.features.length : 1, x = 0; x < d; x++) {
|
|
45
|
+
f = y ? o.features[x].geometry : p ? o.geometry : o, h = f ? f.type === "GeometryCollection" : !1, l = h ? f.geometries.length : 1;
|
|
46
|
+
for (var v = 0; v < l; v++) {
|
|
47
|
+
var w = 0, m = 0;
|
|
48
|
+
if (u = h ? f.geometries[v] : f, u !== null) {
|
|
49
|
+
c = u.coordinates;
|
|
50
|
+
var E = u.type;
|
|
51
|
+
switch (a = 0, E) {
|
|
52
52
|
case null:
|
|
53
53
|
break;
|
|
54
54
|
case "Point":
|
|
55
55
|
if (t(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
c,
|
|
57
|
+
s,
|
|
58
|
+
x,
|
|
59
|
+
w,
|
|
60
|
+
m
|
|
61
61
|
) === !1)
|
|
62
62
|
return !1;
|
|
63
|
-
|
|
63
|
+
s++, w++;
|
|
64
64
|
break;
|
|
65
65
|
case "LineString":
|
|
66
66
|
case "MultiPoint":
|
|
67
|
-
for (n = 0; n <
|
|
67
|
+
for (n = 0; n < c.length; n++) {
|
|
68
68
|
if (t(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
c[n],
|
|
70
|
+
s,
|
|
71
|
+
x,
|
|
72
|
+
w,
|
|
73
|
+
m
|
|
74
74
|
) === !1)
|
|
75
75
|
return !1;
|
|
76
|
-
|
|
76
|
+
s++, E === "MultiPoint" && w++;
|
|
77
77
|
}
|
|
78
|
-
|
|
78
|
+
E === "LineString" && w++;
|
|
79
79
|
break;
|
|
80
80
|
case "Polygon":
|
|
81
81
|
case "MultiLineString":
|
|
82
|
-
for (n = 0; n <
|
|
83
|
-
for (r = 0; r <
|
|
82
|
+
for (n = 0; n < c.length; n++) {
|
|
83
|
+
for (r = 0; r < c[n].length - a; r++) {
|
|
84
84
|
if (t(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
c[n][r],
|
|
86
|
+
s,
|
|
87
|
+
x,
|
|
88
|
+
w,
|
|
89
|
+
m
|
|
90
90
|
) === !1)
|
|
91
91
|
return !1;
|
|
92
|
-
|
|
92
|
+
s++;
|
|
93
93
|
}
|
|
94
|
-
|
|
94
|
+
E === "MultiLineString" && w++, E === "Polygon" && m++;
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
E === "Polygon" && w++;
|
|
97
97
|
break;
|
|
98
98
|
case "MultiPolygon":
|
|
99
|
-
for (n = 0; n <
|
|
100
|
-
for (
|
|
101
|
-
for (i = 0; i <
|
|
99
|
+
for (n = 0; n < c.length; n++) {
|
|
100
|
+
for (m = 0, r = 0; r < c[n].length; r++) {
|
|
101
|
+
for (i = 0; i < c[n][r].length - a; i++) {
|
|
102
102
|
if (t(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
c[n][r][i],
|
|
104
|
+
s,
|
|
105
|
+
x,
|
|
106
|
+
w,
|
|
107
|
+
m
|
|
108
108
|
) === !1)
|
|
109
109
|
return !1;
|
|
110
|
-
|
|
110
|
+
s++;
|
|
111
111
|
}
|
|
112
|
-
|
|
112
|
+
m++;
|
|
113
113
|
}
|
|
114
|
-
|
|
114
|
+
w++;
|
|
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 =
|
|
130
|
+
var e, n, r, i, u, l, c, f, a, s, h = 0, g = o.type === "FeatureCollection", y = o.type === "Feature", p = g ? o.features.length : 1;
|
|
131
|
+
for (e = 0; e < p; e++) {
|
|
132
|
+
for (l = g ? o.features[e].geometry : y ? o.geometry : o, f = g ? o.features[e].properties : y ? o.properties : {}, a = g ? o.features[e].bbox : y ? o.bbox : void 0, s = g ? o.features[e].id : y ? o.id : void 0, c = l ? l.type === "GeometryCollection" : !1, u = c ? l.geometries.length : 1, r = 0; r < u; r++) {
|
|
133
|
+
if (i = c ? l.geometries[r] : l, i === null) {
|
|
134
134
|
if (t(
|
|
135
135
|
null,
|
|
136
136
|
h,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
f,
|
|
138
|
+
a,
|
|
139
|
+
s
|
|
140
140
|
) === !1)
|
|
141
141
|
return !1;
|
|
142
142
|
continue;
|
|
@@ -151,9 +151,9 @@ function st(o, t) {
|
|
|
151
151
|
if (t(
|
|
152
152
|
i,
|
|
153
153
|
h,
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
f,
|
|
155
|
+
a,
|
|
156
|
+
s
|
|
157
157
|
) === !1)
|
|
158
158
|
return !1;
|
|
159
159
|
break;
|
|
@@ -163,9 +163,9 @@ function st(o, t) {
|
|
|
163
163
|
if (t(
|
|
164
164
|
i.geometries[n],
|
|
165
165
|
h,
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
166
|
+
f,
|
|
167
|
+
a,
|
|
168
|
+
s
|
|
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 l = e === null ? null : e.type;
|
|
183
|
+
switch (l) {
|
|
184
184
|
case null:
|
|
185
185
|
case "Point":
|
|
186
186
|
case "LineString":
|
|
@@ -191,24 +191,24 @@ function Dt(o, t) {
|
|
|
191
191
|
0
|
|
192
192
|
) === !1 ? !1 : void 0;
|
|
193
193
|
}
|
|
194
|
-
var
|
|
195
|
-
switch (
|
|
194
|
+
var c;
|
|
195
|
+
switch (l) {
|
|
196
196
|
case "MultiPoint":
|
|
197
|
-
|
|
197
|
+
c = "Point";
|
|
198
198
|
break;
|
|
199
199
|
case "MultiLineString":
|
|
200
|
-
|
|
200
|
+
c = "LineString";
|
|
201
201
|
break;
|
|
202
202
|
case "MultiPolygon":
|
|
203
|
-
|
|
203
|
+
c = "Polygon";
|
|
204
204
|
break;
|
|
205
205
|
}
|
|
206
|
-
for (var
|
|
207
|
-
var
|
|
208
|
-
type:
|
|
209
|
-
coordinates:
|
|
206
|
+
for (var f = 0; f < e.coordinates.length; f++) {
|
|
207
|
+
var a = e.coordinates[f], s = {
|
|
208
|
+
type: c,
|
|
209
|
+
coordinates: a
|
|
210
210
|
};
|
|
211
|
-
if (t(D(
|
|
211
|
+
if (t(D(s, r), n, f) === !1)
|
|
212
212
|
return !1;
|
|
213
213
|
}
|
|
214
214
|
});
|
|
@@ -249,59 +249,59 @@ 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: l(0), throw: l(1), return: l(2) }, typeof Symbol == "function" && (u[Symbol.iterator] = function() {
|
|
253
253
|
return this;
|
|
254
254
|
}), u;
|
|
255
|
-
function
|
|
256
|
-
return function(
|
|
257
|
-
return
|
|
255
|
+
function l(f) {
|
|
256
|
+
return function(a) {
|
|
257
|
+
return c([f, a]);
|
|
258
258
|
};
|
|
259
259
|
}
|
|
260
|
-
function f
|
|
260
|
+
function c(f) {
|
|
261
261
|
if (n) throw new TypeError("Generator is already executing.");
|
|
262
262
|
for (; e; ) try {
|
|
263
|
-
if (n = 1, r && (i =
|
|
264
|
-
switch (r = 0, i && (
|
|
263
|
+
if (n = 1, r && (i = f[0] & 2 ? r.return : f[0] ? r.throw || ((i = r.return) && i.call(r), 0) : r.next) && !(i = i.call(r, f[1])).done) return i;
|
|
264
|
+
switch (r = 0, i && (f = [f[0] & 2, i.value]), f[0]) {
|
|
265
265
|
case 0:
|
|
266
266
|
case 1:
|
|
267
|
-
i =
|
|
267
|
+
i = f;
|
|
268
268
|
break;
|
|
269
269
|
case 4:
|
|
270
|
-
return e.label++, { value:
|
|
270
|
+
return e.label++, { value: f[1], done: !1 };
|
|
271
271
|
case 5:
|
|
272
|
-
e.label++, r =
|
|
272
|
+
e.label++, r = f[1], f = [0];
|
|
273
273
|
continue;
|
|
274
274
|
case 7:
|
|
275
|
-
|
|
275
|
+
f = e.ops.pop(), e.trys.pop();
|
|
276
276
|
continue;
|
|
277
277
|
default:
|
|
278
|
-
if (i = e.trys, !(i = i.length > 0 && i[i.length - 1]) && (
|
|
278
|
+
if (i = e.trys, !(i = i.length > 0 && i[i.length - 1]) && (f[0] === 6 || f[0] === 2)) {
|
|
279
279
|
e = 0;
|
|
280
280
|
continue;
|
|
281
281
|
}
|
|
282
|
-
if (
|
|
283
|
-
e.label =
|
|
282
|
+
if (f[0] === 3 && (!i || f[1] > i[0] && f[1] < i[3])) {
|
|
283
|
+
e.label = f[1];
|
|
284
284
|
break;
|
|
285
285
|
}
|
|
286
|
-
if (
|
|
287
|
-
e.label = i[1], i =
|
|
286
|
+
if (f[0] === 6 && e.label < i[1]) {
|
|
287
|
+
e.label = i[1], i = f;
|
|
288
288
|
break;
|
|
289
289
|
}
|
|
290
290
|
if (i && e.label < i[2]) {
|
|
291
|
-
e.label = i[2], e.ops.push(
|
|
291
|
+
e.label = i[2], e.ops.push(f);
|
|
292
292
|
break;
|
|
293
293
|
}
|
|
294
294
|
i[2] && e.ops.pop(), e.trys.pop();
|
|
295
295
|
continue;
|
|
296
296
|
}
|
|
297
|
-
|
|
298
|
-
} catch (
|
|
299
|
-
|
|
297
|
+
f = t.call(o, e);
|
|
298
|
+
} catch (a) {
|
|
299
|
+
f = [6, a], r = 0;
|
|
300
300
|
} finally {
|
|
301
301
|
n = i = 0;
|
|
302
302
|
}
|
|
303
|
-
if (
|
|
304
|
-
return { value:
|
|
303
|
+
if (f[0] & 5) throw f[1];
|
|
304
|
+
return { value: f[0] ? f[1] : void 0, done: !0 };
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
307
|
var $ = (
|
|
@@ -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 l = t.left;
|
|
327
|
+
if (t.left = l.right, l.right = t, t = l, 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 l = t.right;
|
|
336
|
+
if (t.right = l.left, l.left = t, t = l, 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, l = this._root, c; i.length !== 0 || l; )
|
|
427
|
+
if (l)
|
|
428
|
+
i.push(l), l = l.left;
|
|
429
429
|
else {
|
|
430
|
-
if (
|
|
430
|
+
if (l = i.pop(), c = u(l.key, e), c > 0)
|
|
431
431
|
break;
|
|
432
|
-
if (u(
|
|
432
|
+
if (u(l.key, t) >= 0 && n.call(r, l))
|
|
433
433
|
return this;
|
|
434
|
-
|
|
434
|
+
l = l.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, l = i.right;
|
|
540
|
+
r(t, e) < 0 ? l = J(e, n, l, r) : u = J(e, n, u, r), this._root = Jt(u, l, 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,8 +569,8 @@ 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],
|
|
573
|
-
return
|
|
572
|
+
var i = e + Math.floor(r / 2), u = o[i], l = t[i], c = new $(u, l);
|
|
573
|
+
return c.left = et(o, t, e, i), c.right = et(o, t, i + 1, n), c;
|
|
574
574
|
}
|
|
575
575
|
return null;
|
|
576
576
|
}
|
|
@@ -599,34 +599,34 @@ 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, l = 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
|
+
l--;
|
|
608
|
+
while (r(o[l], i) > 0);
|
|
609
|
+
if (u >= l)
|
|
610
610
|
break;
|
|
611
|
-
var
|
|
612
|
-
o[u] = o[
|
|
611
|
+
var c = o[u];
|
|
612
|
+
o[u] = o[l], o[l] = c, c = t[u], t[u] = t[l], t[l] = c;
|
|
613
613
|
}
|
|
614
|
-
rt(o, t, e,
|
|
614
|
+
rt(o, t, e, l, r), rt(o, t, l + 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
|
-
|
|
621
|
-
let
|
|
622
|
-
if (
|
|
623
|
-
for (
|
|
624
|
-
|
|
625
|
-
for (;
|
|
626
|
-
u = i +
|
|
619
|
+
let i, u, l, c, f = t[0], a = n[0], s = 0, h = 0;
|
|
620
|
+
a > f == a > -f ? (i = f, f = t[++s]) : (i = a, a = n[++h]);
|
|
621
|
+
let g = 0;
|
|
622
|
+
if (s < o && h < e)
|
|
623
|
+
for (a > f == a > -f ? (u = f + i, l = i - (u - f), f = t[++s]) : (u = a + i, l = i - (u - a), a = n[++h]), i = u, l !== 0 && (r[g++] = l); s < o && h < e; )
|
|
624
|
+
a > f == a > -f ? (u = i + f, c = u - i, l = i - (u - c) + (f - c), f = t[++s]) : (u = i + a, c = u - i, l = i - (u - c) + (a - c), a = n[++h]), i = u, l !== 0 && (r[g++] = l);
|
|
625
|
+
for (; s < o; )
|
|
626
|
+
u = i + f, c = u - i, l = i - (u - c) + (f - c), f = t[++s], i = u, l !== 0 && (r[g++] = l);
|
|
627
627
|
for (; h < e; )
|
|
628
|
-
u = i +
|
|
629
|
-
return (i !== 0 ||
|
|
628
|
+
u = i + a, c = u - i, l = i - (u - c) + (a - c), a = n[++h], i = u, l !== 0 && (r[g++] = l);
|
|
629
|
+
return (i !== 0 || g === 0) && (r[g++] = i), g;
|
|
630
630
|
}
|
|
631
631
|
function ne(o, t) {
|
|
632
632
|
let e = t[0];
|
|
@@ -638,22 +638,22 @@ 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 l, c, f, a, s, h, g, y, p, d, x, v, w, m, E, b, M, S;
|
|
642
642
|
const L = o - r, I = e - r, k = t - i, C = n - i;
|
|
643
|
-
|
|
643
|
+
m = L * C, h = _ * L, g = h - (h - L), y = L - g, h = _ * C, p = h - (h - C), d = C - p, E = y * d - (m - g * p - y * p - g * d), b = k * I, h = _ * k, g = h - (h - k), y = k - g, h = _ * I, p = h - (h - I), d = I - p, M = y * d - (b - g * p - y * p - g * d), x = E - M, s = E - x, T[0] = E - (x + s) + (s - M), v = m + x, s = v - m, w = m - (v - s) + (x - s), x = w - b, s = w - x, T[1] = w - (x + s) + (s - b), S = v + x, s = S - v, T[2] = v - (S - s) + (x - s), 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 || (s = o - L, l = o - (L + s) + (s - r), s = e - I, f = e - (I + s) + (s - r), s = t - k, c = t - (k + s) + (s - i), s = n - C, a = n - (C + s) + (s - i), l === 0 && c === 0 && f === 0 && a === 0) || (q = oe * u + ee * Math.abs(O), O += L * a + C * l - (k * f + I * c), O >= q || -O >= q)) return O;
|
|
646
|
+
m = l * C, h = _ * l, g = h - (h - l), y = l - g, h = _ * C, p = h - (h - C), d = C - p, E = y * d - (m - g * p - y * p - g * d), b = c * I, h = _ * c, g = h - (h - c), y = c - g, h = _ * I, p = h - (h - I), d = I - p, M = y * d - (b - g * p - y * p - g * d), x = E - M, s = E - x, P[0] = E - (x + s) + (s - M), v = m + x, s = v - m, w = m - (v - s) + (x - s), x = w - b, s = w - x, P[1] = w - (x + s) + (s - b), S = v + x, s = S - v, P[2] = v - (S - s) + (x - s), P[3] = S;
|
|
647
647
|
const Gt = K(4, T, 4, P, dt);
|
|
648
|
-
|
|
648
|
+
m = L * a, h = _ * L, g = h - (h - L), y = L - g, h = _ * a, p = h - (h - a), d = a - p, E = y * d - (m - g * p - y * p - g * d), b = k * f, h = _ * k, g = h - (h - k), y = k - g, h = _ * f, p = h - (h - f), d = f - p, M = y * d - (b - g * p - y * p - g * d), x = E - M, s = E - x, P[0] = E - (x + s) + (s - M), v = m + x, s = v - m, w = m - (v - s) + (x - s), x = w - b, s = w - x, P[1] = w - (x + s) + (s - b), S = v + x, s = S - v, P[2] = v - (S - s) + (x - s), P[3] = S;
|
|
649
649
|
const Bt = K(Gt, dt, 4, P, vt);
|
|
650
|
-
|
|
650
|
+
m = l * a, h = _ * l, g = h - (h - l), y = l - g, h = _ * a, p = h - (h - a), d = a - p, E = y * d - (m - g * p - y * p - g * d), b = c * f, h = _ * c, g = h - (h - c), y = c - g, h = _ * f, p = h - (h - f), d = f - p, M = y * d - (b - g * p - y * p - g * d), x = E - M, s = E - x, P[0] = E - (x + s) + (s - M), v = m + x, s = v - m, w = m - (v - s) + (x - s), x = w - b, s = w - x, P[1] = w - (x + s) + (s - b), S = v + x, s = S - v, P[2] = v - (S - s) + (x - s), 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),
|
|
656
|
-
return Math.abs(
|
|
655
|
+
const u = (t - i) * (e - r), l = (o - r) * (n - i), c = u - l, f = Math.abs(u + l);
|
|
656
|
+
return Math.abs(c) >= re * f ? c : -se(o, t, e, n, r, i, f);
|
|
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) => {
|
|
659
659
|
if (t.ur.x < o.ll.x || o.ur.x < t.ll.x || t.ur.y < o.ll.y || o.ur.y < t.ll.y) return null;
|
|
@@ -747,10 +747,10 @@ 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, l = j(i, n) / r, c = o.x + l * t.x, f = e.x + u * n.x, a = o.y + l * t.y, s = e.y + u * n.y, h = (c + f) / 2, g = (a + s) / 2;
|
|
751
751
|
return {
|
|
752
752
|
x: h,
|
|
753
|
-
y:
|
|
753
|
+
y: g
|
|
754
754
|
};
|
|
755
755
|
};
|
|
756
756
|
class R {
|
|
@@ -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: l
|
|
824
824
|
} = e.get(r), {
|
|
825
|
-
sine:
|
|
826
|
-
cosine:
|
|
825
|
+
sine: c,
|
|
826
|
+
cosine: f
|
|
827
827
|
} = e.get(i);
|
|
828
|
-
return u >= 0 &&
|
|
828
|
+
return u >= 0 && c >= 0 ? l < f ? 1 : l > f ? -1 : 0 : u < 0 && c < 0 ? l < f ? -1 : l > f ? 1 : 0 : c < u ? -1 : c > u ? 1 : 0;
|
|
829
829
|
};
|
|
830
830
|
}
|
|
831
831
|
}
|
|
@@ -848,41 +848,41 @@ 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 l = t.leftSE.point.y, c = e.leftSE.point.y, f = t.rightSE.point.y, a = e.rightSE.point.y;
|
|
852
852
|
if (n < r) {
|
|
853
|
-
if (
|
|
854
|
-
if (
|
|
855
|
-
const
|
|
856
|
-
if (
|
|
857
|
-
if (
|
|
853
|
+
if (c < l && c < f) return 1;
|
|
854
|
+
if (c > l && c > f) return -1;
|
|
855
|
+
const s = t.comparePoint(e.leftSE.point);
|
|
856
|
+
if (s < 0) return 1;
|
|
857
|
+
if (s > 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 (l < c && l < a) return -1;
|
|
863
|
+
if (l > c && l > a) return 1;
|
|
864
|
+
const s = e.comparePoint(t.leftSE.point);
|
|
865
|
+
if (s !== 0) return s;
|
|
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 (l < c) return -1;
|
|
870
|
+
if (l > c) return 1;
|
|
871
871
|
if (i < u) {
|
|
872
|
-
const
|
|
873
|
-
if (
|
|
872
|
+
const s = e.comparePoint(t.rightSE.point);
|
|
873
|
+
if (s !== 0) return s;
|
|
874
874
|
}
|
|
875
875
|
if (i > u) {
|
|
876
|
-
const
|
|
877
|
-
if (
|
|
878
|
-
if (
|
|
876
|
+
const s = t.comparePoint(e.rightSE.point);
|
|
877
|
+
if (s < 0) return 1;
|
|
878
|
+
if (s > 0) return -1;
|
|
879
879
|
}
|
|
880
880
|
if (i !== u) {
|
|
881
|
-
const
|
|
882
|
-
if (
|
|
883
|
-
if (
|
|
881
|
+
const s = f - l, h = i - n, g = a - c, y = u - r;
|
|
882
|
+
if (s > h && g < y) return 1;
|
|
883
|
+
if (s < h && g > y) return -1;
|
|
884
884
|
}
|
|
885
|
-
return i > u ? 1 : i < u ||
|
|
885
|
+
return i > u ? 1 : i < u || f < a ? -1 : f > a ? 1 : t.id < e.id ? -1 : t.id > e.id ? 1 : 0;
|
|
886
886
|
}
|
|
887
887
|
/* Warning: a reference to ringWindings input will be stored,
|
|
888
888
|
* and possibly will be later modified */
|
|
@@ -891,14 +891,14 @@ class z {
|
|
|
891
891
|
}
|
|
892
892
|
static fromRing(t, e, n) {
|
|
893
893
|
let r, i, u;
|
|
894
|
-
const
|
|
895
|
-
if (
|
|
894
|
+
const l = R.comparePoints(t, e);
|
|
895
|
+
if (l < 0)
|
|
896
896
|
r = t, i = e, u = 1;
|
|
897
|
-
else if (
|
|
897
|
+
else if (l > 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
|
-
const
|
|
901
|
-
return new z(
|
|
900
|
+
const c = new R(r, !0), f = new R(i, !1);
|
|
901
|
+
return new z(c, f, [n], [u]);
|
|
902
902
|
}
|
|
903
903
|
/* When a segment is split, the rightSE is replaced with a new sweep event */
|
|
904
904
|
replaceRightSE(t) {
|
|
@@ -947,8 +947,8 @@ 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
|
|
951
|
-
return t.y ===
|
|
950
|
+
const l = (t.x - e.x) / r.x, c = e.y + l * r.y;
|
|
951
|
+
return t.y === c ? 0 : t.y < c ? -1 : 1;
|
|
952
952
|
}
|
|
953
953
|
/**
|
|
954
954
|
* Given another segment, returns the first non-trivial intersection
|
|
@@ -968,18 +968,18 @@ 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,
|
|
972
|
-
if (
|
|
973
|
-
return h && !
|
|
974
|
-
if (
|
|
975
|
-
return
|
|
976
|
-
if (
|
|
977
|
-
return h && u.x ===
|
|
978
|
-
if (h &&
|
|
971
|
+
const i = this.leftSE.point, u = this.rightSE.point, l = t.leftSE.point, c = t.rightSE.point, f = Q(e, l) && this.comparePoint(l) === 0, a = Q(n, i) && t.comparePoint(i) === 0, s = Q(e, c) && this.comparePoint(c) === 0, h = Q(n, u) && t.comparePoint(u) === 0;
|
|
972
|
+
if (a && f)
|
|
973
|
+
return h && !s ? u : !h && s ? c : null;
|
|
974
|
+
if (a)
|
|
975
|
+
return s && i.x === c.x && i.y === c.y ? null : i;
|
|
976
|
+
if (f)
|
|
977
|
+
return h && u.x === l.x && u.y === l.y ? null : l;
|
|
978
|
+
if (h && s) return null;
|
|
979
979
|
if (h) return u;
|
|
980
|
-
if (
|
|
981
|
-
const
|
|
982
|
-
return
|
|
980
|
+
if (s) return c;
|
|
981
|
+
const g = ae(i, this.vector(), l, t.vector());
|
|
982
|
+
return g === null || !Q(r, g) ? null : U.round(g.x, g.y);
|
|
983
983
|
}
|
|
984
984
|
/**
|
|
985
985
|
* Split the given segment into multiple segments on the given points.
|
|
@@ -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 l = new z(r, u, this.rings.slice(), this.windings.slice());
|
|
1000
|
+
return R.comparePoints(l.leftSE.point, l.rightSE.point) > 0 && l.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
|
-
|
|
1026
|
+
const l = n.rings[i], c = n.windings[i], f = e.rings.indexOf(l);
|
|
1027
|
+
f === -1 ? (e.rings.push(l), e.windings.push(c)) : e.windings[f] += c;
|
|
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,25 +1055,25 @@ 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
|
|
1060
|
-
|
|
1058
|
+
for (let l = 0, c = this.rings.length; l < c; l++) {
|
|
1059
|
+
const f = this.rings[l], a = this.windings[l], s = e.indexOf(f);
|
|
1060
|
+
s === -1 ? (e.push(f), n.push(a)) : n[s] += a;
|
|
1061
1061
|
}
|
|
1062
1062
|
const i = [], u = [];
|
|
1063
|
-
for (let
|
|
1064
|
-
if (n[
|
|
1065
|
-
const
|
|
1066
|
-
if (u.indexOf(
|
|
1067
|
-
if (
|
|
1063
|
+
for (let l = 0, c = e.length; l < c; l++) {
|
|
1064
|
+
if (n[l] === 0) continue;
|
|
1065
|
+
const f = e[l], a = f.poly;
|
|
1066
|
+
if (u.indexOf(a) === -1)
|
|
1067
|
+
if (f.isExterior) i.push(a);
|
|
1068
1068
|
else {
|
|
1069
|
-
u.indexOf(
|
|
1070
|
-
const
|
|
1071
|
-
|
|
1069
|
+
u.indexOf(a) === -1 && u.push(a);
|
|
1070
|
+
const s = i.indexOf(f.poly);
|
|
1071
|
+
s !== -1 && i.splice(s, 1);
|
|
1072
1072
|
}
|
|
1073
1073
|
}
|
|
1074
|
-
for (let
|
|
1075
|
-
const
|
|
1076
|
-
r.indexOf(
|
|
1074
|
+
for (let l = 0, c = i.length; l < c; l++) {
|
|
1075
|
+
const f = i[l].multiPoly;
|
|
1076
|
+
r.indexOf(f) === -1 && r.push(f);
|
|
1077
1077
|
}
|
|
1078
1078
|
return this._afterState;
|
|
1079
1079
|
}
|
|
@@ -1127,11 +1127,11 @@ class Pt {
|
|
|
1127
1127
|
}
|
|
1128
1128
|
};
|
|
1129
1129
|
let i = r;
|
|
1130
|
-
for (let u = 1,
|
|
1130
|
+
for (let u = 1, l = t.length; u < l; 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
|
-
let
|
|
1134
|
-
|
|
1133
|
+
let c = U.round(t[u][0], t[u][1]);
|
|
1134
|
+
c.x === i.x && c.y === i.y || (this.segments.push(z.fromRing(i, c, this)), c.x < this.bbox.ll.x && (this.bbox.ll.x = c.x), c.y < this.bbox.ll.y && (this.bbox.ll.y = c.y), c.x > this.bbox.ur.x && (this.bbox.ur.x = c.x), c.y > this.bbox.ur.y && (this.bbox.ur.y = c.y), i = c);
|
|
1135
1135
|
}
|
|
1136
1136
|
(r.x !== i.x || r.y !== i.y) && this.segments.push(z.fromRing(i, r, this));
|
|
1137
1137
|
}
|
|
@@ -1216,39 +1216,39 @@ 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
|
|
1221
|
-
for (; u =
|
|
1219
|
+
let u = null, l = i.leftSE, c = i.rightSE;
|
|
1220
|
+
const f = [l], a = l.point, s = [];
|
|
1221
|
+
for (; u = l, l = c, f.push(l), l.point !== a; )
|
|
1222
1222
|
for (; ; ) {
|
|
1223
|
-
const h =
|
|
1223
|
+
const h = l.getAvailableLinkedEvents();
|
|
1224
1224
|
if (h.length === 0) {
|
|
1225
|
-
const
|
|
1226
|
-
throw new Error(`Unable to complete output ring starting at [${
|
|
1225
|
+
const p = f[0].point, d = f[f.length - 1].point;
|
|
1226
|
+
throw new Error(`Unable to complete output ring starting at [${p.x}, ${p.y}]. Last matching segment found ends at [${d.x}, ${d.y}].`);
|
|
1227
1227
|
}
|
|
1228
1228
|
if (h.length === 1) {
|
|
1229
|
-
|
|
1229
|
+
c = h[0].otherSE;
|
|
1230
1230
|
break;
|
|
1231
1231
|
}
|
|
1232
|
-
let
|
|
1233
|
-
for (let
|
|
1234
|
-
if (
|
|
1235
|
-
|
|
1232
|
+
let g = null;
|
|
1233
|
+
for (let p = 0, d = s.length; p < d; p++)
|
|
1234
|
+
if (s[p].point === l.point) {
|
|
1235
|
+
g = p;
|
|
1236
1236
|
break;
|
|
1237
1237
|
}
|
|
1238
|
-
if (
|
|
1239
|
-
const
|
|
1240
|
-
|
|
1238
|
+
if (g !== null) {
|
|
1239
|
+
const p = s.splice(g)[0], d = f.splice(p.index);
|
|
1240
|
+
d.unshift(d[0].otherSE), e.push(new W(d.reverse()));
|
|
1241
1241
|
continue;
|
|
1242
1242
|
}
|
|
1243
|
-
|
|
1244
|
-
index:
|
|
1245
|
-
point:
|
|
1243
|
+
s.push({
|
|
1244
|
+
index: f.length,
|
|
1245
|
+
point: l.point
|
|
1246
1246
|
});
|
|
1247
|
-
const
|
|
1248
|
-
|
|
1247
|
+
const y = l.getLeftmostComparator(u);
|
|
1248
|
+
c = h.sort(y)[0].otherSE;
|
|
1249
1249
|
break;
|
|
1250
1250
|
}
|
|
1251
|
-
e.push(new W(
|
|
1251
|
+
e.push(new W(f));
|
|
1252
1252
|
}
|
|
1253
1253
|
return e;
|
|
1254
1254
|
}
|
|
@@ -1261,16 +1261,16 @@ class W {
|
|
|
1261
1261
|
getGeom() {
|
|
1262
1262
|
let t = this.events[0].point;
|
|
1263
1263
|
const e = [t];
|
|
1264
|
-
for (let
|
|
1265
|
-
const
|
|
1266
|
-
bt(
|
|
1264
|
+
for (let f = 1, a = this.events.length - 1; f < a; f++) {
|
|
1265
|
+
const s = this.events[f].point, h = this.events[f + 1].point;
|
|
1266
|
+
bt(s, t, h) !== 0 && (e.push(s), t = s);
|
|
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
|
|
1273
|
-
return
|
|
1271
|
+
const i = this.isExteriorRing() ? 1 : -1, u = this.isExteriorRing() ? 0 : e.length - 1, l = this.isExteriorRing() ? e.length : -1, c = [];
|
|
1272
|
+
for (let f = u; f != l; f += i) c.push([e[f].x, e[f].y]);
|
|
1273
|
+
return c;
|
|
1274
1274
|
}
|
|
1275
1275
|
isExteriorRing() {
|
|
1276
1276
|
if (this._isExteriorRing === void 0) {
|
|
@@ -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 ?
|
|
1359
|
-
for (;
|
|
1360
|
-
u = this.tree.next(u), u === null ?
|
|
1356
|
+
let i = r, u = r, l, c;
|
|
1357
|
+
for (; l === void 0; )
|
|
1358
|
+
i = this.tree.prev(i), i === null ? l = null : i.key.consumedBy === void 0 && (l = i.key);
|
|
1359
|
+
for (; c === void 0; )
|
|
1360
|
+
u = this.tree.next(u), u === null ? c = null : u.key.consumedBy === void 0 && (c = u.key);
|
|
1361
1361
|
if (t.isLeft) {
|
|
1362
|
-
let
|
|
1363
|
-
if (
|
|
1364
|
-
const
|
|
1365
|
-
if (
|
|
1366
|
-
const h = this._splitSafely(
|
|
1367
|
-
for (let
|
|
1368
|
-
n.push(h[
|
|
1362
|
+
let f = null;
|
|
1363
|
+
if (l) {
|
|
1364
|
+
const s = l.getIntersection(e);
|
|
1365
|
+
if (s !== null && (e.isAnEndpoint(s) || (f = s), !l.isAnEndpoint(s))) {
|
|
1366
|
+
const h = this._splitSafely(l, s);
|
|
1367
|
+
for (let g = 0, y = h.length; g < y; g++)
|
|
1368
|
+
n.push(h[g]);
|
|
1369
1369
|
}
|
|
1370
1370
|
}
|
|
1371
|
-
let
|
|
1372
|
-
if (
|
|
1373
|
-
const
|
|
1374
|
-
if (
|
|
1375
|
-
const h = this._splitSafely(
|
|
1376
|
-
for (let
|
|
1377
|
-
n.push(h[
|
|
1371
|
+
let a = null;
|
|
1372
|
+
if (c) {
|
|
1373
|
+
const s = c.getIntersection(e);
|
|
1374
|
+
if (s !== null && (e.isAnEndpoint(s) || (a = s), !c.isAnEndpoint(s))) {
|
|
1375
|
+
const h = this._splitSafely(c, s);
|
|
1376
|
+
for (let g = 0, y = h.length; g < y; g++)
|
|
1377
|
+
n.push(h[g]);
|
|
1378
1378
|
}
|
|
1379
1379
|
}
|
|
1380
|
-
if (
|
|
1381
|
-
let
|
|
1382
|
-
|
|
1383
|
-
const h = e.split(
|
|
1384
|
-
for (let
|
|
1385
|
-
n.push(h[
|
|
1380
|
+
if (f !== null || a !== null) {
|
|
1381
|
+
let s = null;
|
|
1382
|
+
f === null ? s = a : a === null ? s = f : s = R.comparePoints(f, a) <= 0 ? f : a, this.queue.remove(e.rightSE), n.push(e.rightSE);
|
|
1383
|
+
const h = e.split(s);
|
|
1384
|
+
for (let g = 0, y = h.length; g < y; g++)
|
|
1385
|
+
n.push(h[g]);
|
|
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 = l);
|
|
1388
1388
|
} else {
|
|
1389
|
-
if (
|
|
1390
|
-
const
|
|
1391
|
-
if (
|
|
1392
|
-
if (!
|
|
1393
|
-
const
|
|
1394
|
-
for (let
|
|
1395
|
-
n.push(
|
|
1389
|
+
if (l && c) {
|
|
1390
|
+
const f = l.getIntersection(c);
|
|
1391
|
+
if (f !== null) {
|
|
1392
|
+
if (!l.isAnEndpoint(f)) {
|
|
1393
|
+
const a = this._splitSafely(l, f);
|
|
1394
|
+
for (let s = 0, h = a.length; s < h; s++)
|
|
1395
|
+
n.push(a[s]);
|
|
1396
1396
|
}
|
|
1397
|
-
if (!
|
|
1398
|
-
const
|
|
1399
|
-
for (let
|
|
1400
|
-
n.push(
|
|
1397
|
+
if (!c.isAnEndpoint(f)) {
|
|
1398
|
+
const a = this._splitSafely(c, f);
|
|
1399
|
+
for (let s = 0, h = a.length; s < h; s++)
|
|
1400
|
+
n.push(a[s]);
|
|
1401
1401
|
}
|
|
1402
1402
|
}
|
|
1403
1403
|
}
|
|
@@ -1420,49 +1420,49 @@ 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 s = 0, h = n.length; s < h; s++)
|
|
1424
|
+
r.push(new Mt(n[s], !1));
|
|
1425
1425
|
if (A.numMultiPolys = r.length, A.type === "difference") {
|
|
1426
|
-
const
|
|
1426
|
+
const s = r[0];
|
|
1427
1427
|
let h = 1;
|
|
1428
1428
|
for (; h < r.length; )
|
|
1429
|
-
it(r[h].bbox,
|
|
1429
|
+
it(r[h].bbox, s.bbox) !== null ? h++ : r.splice(h, 1);
|
|
1430
1430
|
}
|
|
1431
1431
|
if (A.type === "intersection")
|
|
1432
|
-
for (let
|
|
1433
|
-
const
|
|
1434
|
-
for (let
|
|
1435
|
-
if (it(
|
|
1432
|
+
for (let s = 0, h = r.length; s < h; s++) {
|
|
1433
|
+
const g = r[s];
|
|
1434
|
+
for (let y = s + 1, p = r.length; y < p; y++)
|
|
1435
|
+
if (it(g.bbox, r[y].bbox) === null) return [];
|
|
1436
1436
|
}
|
|
1437
1437
|
const i = new lt(R.compare);
|
|
1438
|
-
for (let
|
|
1439
|
-
const
|
|
1440
|
-
for (let
|
|
1441
|
-
if (i.insert(
|
|
1438
|
+
for (let s = 0, h = r.length; s < h; s++) {
|
|
1439
|
+
const g = r[s].getSweepEvents();
|
|
1440
|
+
for (let y = 0, p = g.length; y < p; y++)
|
|
1441
|
+
if (i.insert(g[y]), 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
|
|
1446
|
-
for (;
|
|
1447
|
-
const
|
|
1448
|
-
if (i.size ===
|
|
1449
|
-
const
|
|
1450
|
-
throw new Error(`Unable to pop() ${
|
|
1445
|
+
let l = i.size, c = i.pop();
|
|
1446
|
+
for (; c; ) {
|
|
1447
|
+
const s = c.key;
|
|
1448
|
+
if (i.size === l) {
|
|
1449
|
+
const g = s.segment;
|
|
1450
|
+
throw new Error(`Unable to pop() ${s.isLeft ? "left" : "right"} SweepEvent [${s.point.x}, ${s.point.y}] from segment #${g.id} [${g.leftSE.point.x}, ${g.leftSE.point.y}] -> [${g.rightSE.point.x}, ${g.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
|
|
1458
|
-
const
|
|
1459
|
-
|
|
1456
|
+
const h = u.process(s);
|
|
1457
|
+
for (let g = 0, y = h.length; g < y; g++) {
|
|
1458
|
+
const p = h[g];
|
|
1459
|
+
p.consumedBy === void 0 && i.insert(p);
|
|
1460
1460
|
}
|
|
1461
|
-
|
|
1461
|
+
l = i.size, c = i.pop();
|
|
1462
1462
|
}
|
|
1463
1463
|
U.reset();
|
|
1464
|
-
const
|
|
1465
|
-
return new ye(
|
|
1464
|
+
const f = W.factory(u.segments);
|
|
1465
|
+
return new ye(f).getGeom();
|
|
1466
1466
|
}
|
|
1467
1467
|
}
|
|
1468
1468
|
const A = new ve(), me = function(o) {
|
|
@@ -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
|
|
1545
|
-
const
|
|
1546
|
-
if (u &&
|
|
1547
|
-
for (const
|
|
1548
|
-
for (const
|
|
1549
|
-
|
|
1550
|
-
if (i &&
|
|
1551
|
-
for (const
|
|
1552
|
-
for (const
|
|
1553
|
-
|
|
1542
|
+
const n = It(yt(o)), r = (n[2] - n[0]) / 360 / 1e3, i = n[0] < -180, u = n[2] > 180, l = Me(o);
|
|
1543
|
+
if (l.features.length > 1 && (i || u))
|
|
1544
|
+
for (const c of l.features) {
|
|
1545
|
+
const f = It(yt(c));
|
|
1546
|
+
if (u && f[0] < -180 + r)
|
|
1547
|
+
for (const a of c.geometry.coordinates)
|
|
1548
|
+
for (const s of a)
|
|
1549
|
+
s[0] += 360 - r;
|
|
1550
|
+
if (i && f[2] > 180 - r)
|
|
1551
|
+
for (const a of c.geometry.coordinates)
|
|
1552
|
+
for (const s of a)
|
|
1553
|
+
s[0] -= 360 - r;
|
|
1554
1554
|
}
|
|
1555
1555
|
t(
|
|
1556
1556
|
H([
|
|
1557
|
-
|
|
1557
|
+
l.features.length < 2 ? o : Le(l) ?? o,
|
|
1558
1558
|
e
|
|
1559
1559
|
])
|
|
1560
1560
|
);
|
|
@@ -1591,57 +1591,57 @@ function Ie(o) {
|
|
|
1591
1591
|
}) : void 0
|
|
1592
1592
|
});
|
|
1593
1593
|
}
|
|
1594
|
-
function Te(o, t = {}, e = {}, n = Ie
|
|
1595
|
-
let
|
|
1596
|
-
const
|
|
1594
|
+
function Te(o, t = {}, e = {}, n = Ie) {
|
|
1595
|
+
let r = -1, i, u, l, c = !1;
|
|
1596
|
+
const f = new Tt({
|
|
1597
1597
|
updateWhileAnimating: !0
|
|
1598
1598
|
});
|
|
1599
|
-
o.addLayer(
|
|
1600
|
-
const
|
|
1601
|
-
|
|
1599
|
+
o.addLayer(f);
|
|
1600
|
+
const a = new Ut({});
|
|
1601
|
+
f.setSource(a), f.setStyle(n), o.on("click", (y) => {
|
|
1602
1602
|
o.forEachFeatureAtPixel(y.pixel, (p) => {
|
|
1603
|
-
const
|
|
1604
|
-
if (
|
|
1605
|
-
return y.stopPropagation(),
|
|
1603
|
+
const d = p.getId();
|
|
1604
|
+
if (d)
|
|
1605
|
+
return y.stopPropagation(), u == null || u({ type: "markerClick", id: d }), p;
|
|
1606
1606
|
});
|
|
1607
1607
|
}), o.on("pointermove", (y) => {
|
|
1608
|
-
const p = o.forEachFeatureAtPixel(y.pixel, (
|
|
1609
|
-
|
|
1608
|
+
const p = o.forEachFeatureAtPixel(y.pixel, (d) => d.getId());
|
|
1609
|
+
i !== p && (i && (u == null || u({
|
|
1610
1610
|
type: "markerMouseLeave",
|
|
1611
|
-
id:
|
|
1612
|
-
})), p && (
|
|
1611
|
+
id: i
|
|
1612
|
+
})), p && (u == null || u({
|
|
1613
1613
|
type: "markerMouseEnter",
|
|
1614
1614
|
id: p
|
|
1615
|
-
})), o.getTargetElement().style.cursor = p ? "pointer" : c ? "crosshair" : "",
|
|
1615
|
+
})), o.getTargetElement().style.cursor = p ? "pointer" : c ? "crosshair" : "", i = p);
|
|
1616
1616
|
});
|
|
1617
|
-
function
|
|
1617
|
+
function s() {
|
|
1618
1618
|
return qt() ?? o.getView().getProjection();
|
|
1619
1619
|
}
|
|
1620
|
-
function
|
|
1621
|
-
return y.transform(Ct,
|
|
1620
|
+
function h(y) {
|
|
1621
|
+
return y.transform(Ct, s());
|
|
1622
1622
|
}
|
|
1623
|
-
const
|
|
1624
|
-
|
|
1623
|
+
const g = (y) => {
|
|
1624
|
+
u == null || u({
|
|
1625
1625
|
type: "mapClick",
|
|
1626
|
-
coordinates: at(y.coordinate,
|
|
1626
|
+
coordinates: at(y.coordinate, s())
|
|
1627
1627
|
});
|
|
1628
1628
|
};
|
|
1629
1629
|
return {
|
|
1630
1630
|
setEventHandler(y) {
|
|
1631
|
-
y ? (
|
|
1631
|
+
y ? (u = y, o.on("click", g)) : (u = void 0, o.un("click", g));
|
|
1632
1632
|
},
|
|
1633
1633
|
flyTo(y, p) {
|
|
1634
1634
|
o.getView().animate({
|
|
1635
|
-
center: V(y,
|
|
1635
|
+
center: V(y, s()),
|
|
1636
1636
|
...p ? { zoom: p } : {},
|
|
1637
1637
|
duration: 2e3,
|
|
1638
1638
|
...t
|
|
1639
1639
|
});
|
|
1640
1640
|
},
|
|
1641
|
-
fitBounds(y, p,
|
|
1642
|
-
o.getView().fit(Qt(y, Ct,
|
|
1641
|
+
fitBounds(y, p, d) {
|
|
1642
|
+
o.getView().fit(Qt(y, Ct, s()), {
|
|
1643
1643
|
padding: [p, p, p, p],
|
|
1644
|
-
...
|
|
1644
|
+
...d ? { maxZoom: d } : {},
|
|
1645
1645
|
duration: 2e3,
|
|
1646
1646
|
...e
|
|
1647
1647
|
});
|
|
@@ -1650,101 +1650,98 @@ function Te(o, t = {}, e = {}, n = Ie, r = !1) {
|
|
|
1650
1650
|
c = y, o.getTargetElement().style.cursor = y ? "crosshair" : "";
|
|
1651
1651
|
},
|
|
1652
1652
|
setReverseMarker(y) {
|
|
1653
|
-
|
|
1654
|
-
V(y,
|
|
1655
|
-
) : (
|
|
1656
|
-
new Z(V(y,
|
|
1657
|
-
),
|
|
1653
|
+
l ? y ? l.getGeometry().setCoordinates(
|
|
1654
|
+
V(y, s())
|
|
1655
|
+
) : (a.removeFeature(l), l.dispose(), l = void 0) : y && (l = new N(
|
|
1656
|
+
new Z(V(y, s()))
|
|
1657
|
+
), l.setProperties({ isReverse: !0 }), a.addFeature(l));
|
|
1658
1658
|
},
|
|
1659
|
-
setMarkers(y, p) {
|
|
1660
|
-
function
|
|
1661
|
-
var
|
|
1659
|
+
setMarkers(y, p, d) {
|
|
1660
|
+
function x(v) {
|
|
1661
|
+
var w;
|
|
1662
1662
|
if (v)
|
|
1663
|
-
for (const
|
|
1664
|
-
const
|
|
1665
|
-
|
|
1663
|
+
for (const m of v.features) {
|
|
1664
|
+
const E = m.geometry.type === "Polygon" ? new ut(m.geometry.coordinates) : m.geometry.type === "MultiPolygon" ? new ft(m.geometry.coordinates) : null;
|
|
1665
|
+
E && a.addFeature(
|
|
1666
1666
|
new N({
|
|
1667
|
-
isMask: !!((
|
|
1668
|
-
geometry:
|
|
1667
|
+
isMask: !!((w = m.properties) != null && w.isMask),
|
|
1668
|
+
geometry: h(E)
|
|
1669
1669
|
})
|
|
1670
1670
|
);
|
|
1671
1671
|
}
|
|
1672
1672
|
}
|
|
1673
|
-
if (
|
|
1673
|
+
if (a.clear(), l && a.addFeature(l), p) {
|
|
1674
1674
|
let v = !1;
|
|
1675
1675
|
if (p.geometry.type === "GeometryCollection") {
|
|
1676
|
-
const
|
|
1677
|
-
(
|
|
1678
|
-
).filter((
|
|
1679
|
-
if (
|
|
1680
|
-
|
|
1681
|
-
new N(
|
|
1676
|
+
const w = p.geometry.geometries.map(
|
|
1677
|
+
(m) => m.type === "Polygon" ? new ut(m.coordinates) : m.type === "MultiPolygon" ? new ft(m.coordinates) : null
|
|
1678
|
+
).filter((m) => !!m);
|
|
1679
|
+
if (w.length > 0)
|
|
1680
|
+
a.addFeature(
|
|
1681
|
+
new N(h(new $t(w)))
|
|
1682
1682
|
), v = !0;
|
|
1683
1683
|
else
|
|
1684
|
-
for (const
|
|
1685
|
-
|
|
1684
|
+
for (const m of p.geometry.geometries)
|
|
1685
|
+
m.type === "LineString" ? (a.addFeature(
|
|
1686
1686
|
new N(
|
|
1687
|
-
|
|
1687
|
+
h(new ct(m.coordinates))
|
|
1688
1688
|
)
|
|
1689
|
-
), v = !0) :
|
|
1689
|
+
), v = !0) : m.type === "MultiLineString" && a.addFeature(
|
|
1690
1690
|
new N(
|
|
1691
|
-
|
|
1691
|
+
h(new ht(m.coordinates))
|
|
1692
1692
|
)
|
|
1693
1693
|
), v = !0;
|
|
1694
1694
|
}
|
|
1695
1695
|
if (!v) {
|
|
1696
1696
|
if (p.geometry.type === "Polygon")
|
|
1697
|
-
kt(p,
|
|
1697
|
+
kt(p, x);
|
|
1698
1698
|
else if (p.geometry.type === "MultiPolygon")
|
|
1699
|
-
kt(p,
|
|
1699
|
+
kt(p, x);
|
|
1700
1700
|
else if (p.geometry.type === "LineString") {
|
|
1701
|
-
|
|
1701
|
+
a.addFeature(
|
|
1702
1702
|
new N(
|
|
1703
|
-
|
|
1703
|
+
h(new ct(p.geometry.coordinates))
|
|
1704
1704
|
)
|
|
1705
1705
|
);
|
|
1706
1706
|
return;
|
|
1707
1707
|
} else if (p.geometry.type === "MultiLineString") {
|
|
1708
|
-
|
|
1708
|
+
a.addFeature(
|
|
1709
1709
|
new N(
|
|
1710
|
-
|
|
1710
|
+
h(new ht(p.geometry.coordinates))
|
|
1711
1711
|
)
|
|
1712
1712
|
);
|
|
1713
1713
|
return;
|
|
1714
1714
|
}
|
|
1715
1715
|
}
|
|
1716
|
-
if (!
|
|
1716
|
+
if (!d && p.geometry.type !== "Point")
|
|
1717
1717
|
return;
|
|
1718
|
-
|
|
1718
|
+
a.addFeature(new N(h(new Z(p.center))));
|
|
1719
1719
|
}
|
|
1720
1720
|
for (const v of y ?? []) {
|
|
1721
1721
|
if (v === p)
|
|
1722
1722
|
continue;
|
|
1723
|
-
const
|
|
1724
|
-
new Z(V(v.center,
|
|
1723
|
+
const w = new N(
|
|
1724
|
+
new Z(V(v.center, s()))
|
|
1725
1725
|
);
|
|
1726
|
-
|
|
1726
|
+
w.setId(v.id), w.setProperties({
|
|
1727
1727
|
fuzzy: !!v.matching_text,
|
|
1728
1728
|
tooltip: v.place_type[0] === "reverse" ? v.place_name : v.place_name.replace(/,.*/, "")
|
|
1729
|
-
}),
|
|
1729
|
+
}), a.addFeature(w);
|
|
1730
1730
|
}
|
|
1731
1731
|
},
|
|
1732
1732
|
setSelectedMarker(y) {
|
|
1733
|
-
var
|
|
1734
|
-
const p =
|
|
1735
|
-
|
|
1733
|
+
var x, v, w;
|
|
1734
|
+
const p = a.getFeatures(), d = (x = p[0]) != null && x.getProperties().isReverse ? 1 : 0;
|
|
1735
|
+
r > -1 && ((v = p[r + d]) == null || v.setProperties({
|
|
1736
1736
|
isSelected: !1
|
|
1737
|
-
})), y > -1 && ((w = p[y +
|
|
1737
|
+
})), y > -1 && ((w = p[y + d]) == null || w.setProperties({
|
|
1738
1738
|
isSelected: !0
|
|
1739
|
-
})),
|
|
1739
|
+
})), r = y;
|
|
1740
1740
|
},
|
|
1741
1741
|
getCenterAndZoom() {
|
|
1742
|
-
const y = o.getView(), p = y.getCenter(),
|
|
1743
|
-
if (!(!p ||
|
|
1744
|
-
return [
|
|
1745
|
-
},
|
|
1746
|
-
setShowPolygonMarker(y) {
|
|
1747
|
-
g = y;
|
|
1742
|
+
const y = o.getView(), p = y.getCenter(), d = y.getZoom();
|
|
1743
|
+
if (!(!p || d === void 0))
|
|
1744
|
+
return [d, ...at(p, s())];
|
|
1748
1745
|
}
|
|
1749
1746
|
};
|
|
1750
1747
|
}
|