gs-maplibre-draw 0.0.4 → 0.0.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/dist/index.js +372 -372
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const { abs: pt, cos: ot, sin: ut, acos: ye, atan2:
|
|
2
|
-
function
|
|
1
|
+
const { abs: pt, cos: ot, sin: ut, acos: ye, atan2: gt, sqrt: lt, pow: W } = Math;
|
|
2
|
+
function mt(n) {
|
|
3
3
|
return n < 0 ? -W(-n, 1 / 3) : W(n, 1 / 3);
|
|
4
4
|
}
|
|
5
|
-
const Wt = Math.PI, Mt = 2 * Wt, ct = Wt / 2, de = 1e-6, Xt = Number.MAX_SAFE_INTEGER || 9007199254740991, Yt = Number.MIN_SAFE_INTEGER || -9007199254740991, pe = { x: 0, y: 0, z: 0 },
|
|
5
|
+
const Wt = Math.PI, Mt = 2 * Wt, ct = Wt / 2, de = 1e-6, Xt = Number.MAX_SAFE_INTEGER || 9007199254740991, Yt = Number.MIN_SAFE_INTEGER || -9007199254740991, pe = { x: 0, y: 0, z: 0 }, _ = {
|
|
6
6
|
// Legendre-Gauss abscissae with n=24 (x_i values, defined at i=n as the roots of the nth order Legendre polynomial Pn(x))
|
|
7
7
|
Tvalues: [
|
|
8
8
|
-0.06405689286260563,
|
|
@@ -81,14 +81,14 @@ const Wt = Math.PI, Mt = 2 * Wt, ct = Wt / 2, de = 1e-6, Xt = Number.MAX_SAFE_IN
|
|
|
81
81
|
return r && (l.z = o * s[0].z + n * s[1].z), l;
|
|
82
82
|
}
|
|
83
83
|
if (i < 4) {
|
|
84
|
-
let l = o * o, c = n * n, f,
|
|
85
|
-
i === 2 ? (s = [s[0], s[1], s[2], pe], f = l,
|
|
84
|
+
let l = o * o, c = n * n, f, g, y, d = 0;
|
|
85
|
+
i === 2 ? (s = [s[0], s[1], s[2], pe], f = l, g = o * n * 2, y = c) : i === 3 && (f = l * o, g = l * n * 3, y = o * c * 3, d = n * c);
|
|
86
86
|
const M = {
|
|
87
|
-
x: f * s[0].x +
|
|
88
|
-
y: f * s[0].y +
|
|
87
|
+
x: f * s[0].x + g * s[1].x + y * s[2].x + d * s[3].x,
|
|
88
|
+
y: f * s[0].y + g * s[1].y + y * s[2].y + d * s[3].y,
|
|
89
89
|
t: n
|
|
90
90
|
};
|
|
91
|
-
return r && (M.z = f * s[0].z +
|
|
91
|
+
return r && (M.z = f * s[0].z + g * s[1].z + y * s[2].z + d * s[3].z), M;
|
|
92
92
|
}
|
|
93
93
|
const a = JSON.parse(JSON.stringify(e));
|
|
94
94
|
for (; a.length > 1; ) {
|
|
@@ -103,7 +103,7 @@ const Wt = Math.PI, Mt = 2 * Wt, ct = Wt / 2, de = 1e-6, Xt = Number.MAX_SAFE_IN
|
|
|
103
103
|
},
|
|
104
104
|
computeWithRatios: function(n, e, r, i) {
|
|
105
105
|
const o = 1 - n, s = r, a = e;
|
|
106
|
-
let l = s[0], c = s[1], f = s[2],
|
|
106
|
+
let l = s[0], c = s[1], f = s[2], g = s[3], y;
|
|
107
107
|
if (l *= o, c *= n, a.length === 2)
|
|
108
108
|
return y = l + c, {
|
|
109
109
|
x: (l * a[0].x + c * a[1].x) / y,
|
|
@@ -118,11 +118,11 @@ const Wt = Math.PI, Mt = 2 * Wt, ct = Wt / 2, de = 1e-6, Xt = Number.MAX_SAFE_IN
|
|
|
118
118
|
z: i ? (l * a[0].z + c * a[1].z + f * a[2].z) / y : !1,
|
|
119
119
|
t: n
|
|
120
120
|
};
|
|
121
|
-
if (l *= o, c *= 1.5 * o, f *= 3 * o,
|
|
122
|
-
return y = l + c + f +
|
|
123
|
-
x: (l * a[0].x + c * a[1].x + f * a[2].x +
|
|
124
|
-
y: (l * a[0].y + c * a[1].y + f * a[2].y +
|
|
125
|
-
z: i ? (l * a[0].z + c * a[1].z + f * a[2].z +
|
|
121
|
+
if (l *= o, c *= 1.5 * o, f *= 3 * o, g *= n * n * n, a.length === 4)
|
|
122
|
+
return y = l + c + f + g, {
|
|
123
|
+
x: (l * a[0].x + c * a[1].x + f * a[2].x + g * a[3].x) / y,
|
|
124
|
+
y: (l * a[0].y + c * a[1].y + f * a[2].y + g * a[3].y) / y,
|
|
125
|
+
z: i ? (l * a[0].z + c * a[1].z + f * a[2].z + g * a[3].z) / y : !1,
|
|
126
126
|
t: n
|
|
127
127
|
};
|
|
128
128
|
},
|
|
@@ -140,16 +140,16 @@ const Wt = Math.PI, Mt = 2 * Wt, ct = Wt / 2, de = 1e-6, Xt = Number.MAX_SAFE_IN
|
|
|
140
140
|
return r;
|
|
141
141
|
},
|
|
142
142
|
between: function(n, e, r) {
|
|
143
|
-
return e <= n && n <= r ||
|
|
143
|
+
return e <= n && n <= r || _.approximately(n, e) || _.approximately(n, r);
|
|
144
144
|
},
|
|
145
145
|
approximately: function(n, e, r) {
|
|
146
146
|
return pt(n - e) <= (r || de);
|
|
147
147
|
},
|
|
148
148
|
length: function(n) {
|
|
149
|
-
const r =
|
|
149
|
+
const r = _.Tvalues.length;
|
|
150
150
|
let i = 0;
|
|
151
151
|
for (let o = 0, s; o < r; o++)
|
|
152
|
-
s = 0.5 *
|
|
152
|
+
s = 0.5 * _.Tvalues[o] + 0.5, i += _.Cvalues[o] * _.arcfn(s, n);
|
|
153
153
|
return 0.5 * i;
|
|
154
154
|
},
|
|
155
155
|
map: function(n, e, r, i, o) {
|
|
@@ -168,14 +168,14 @@ const Wt = Math.PI, Mt = 2 * Wt, ct = Wt / 2, de = 1e-6, Xt = Number.MAX_SAFE_IN
|
|
|
168
168
|
return typeof n.z < "u" && (e += "/" + n.z), e;
|
|
169
169
|
},
|
|
170
170
|
pointsToString: function(n) {
|
|
171
|
-
return "[" + n.map(
|
|
171
|
+
return "[" + n.map(_.pointToString).join(", ") + "]";
|
|
172
172
|
},
|
|
173
173
|
copy: function(n) {
|
|
174
174
|
return JSON.parse(JSON.stringify(n));
|
|
175
175
|
},
|
|
176
176
|
angle: function(n, e, r) {
|
|
177
177
|
const i = e.x - n.x, o = e.y - n.y, s = r.x - n.x, a = r.y - n.y, l = i * a - o * s, c = i * s + o * a;
|
|
178
|
-
return
|
|
178
|
+
return gt(l, c);
|
|
179
179
|
},
|
|
180
180
|
// round as string, to avoid rounding errors
|
|
181
181
|
round: function(n, e) {
|
|
@@ -189,7 +189,7 @@ const Wt = Math.PI, Mt = 2 * Wt, ct = Wt / 2, de = 1e-6, Xt = Number.MAX_SAFE_IN
|
|
|
189
189
|
closest: function(n, e) {
|
|
190
190
|
let r = W(2, 63), i, o;
|
|
191
191
|
return n.forEach(function(s, a) {
|
|
192
|
-
o =
|
|
192
|
+
o = _.dist(e, s), o < r && (r = o, i = a);
|
|
193
193
|
}), { mdist: r, mpos: i };
|
|
194
194
|
},
|
|
195
195
|
abcratio: function(n, e) {
|
|
@@ -213,15 +213,15 @@ const Wt = Math.PI, Mt = 2 * Wt, ct = Wt / 2, de = 1e-6, Xt = Number.MAX_SAFE_IN
|
|
|
213
213
|
return r / i;
|
|
214
214
|
},
|
|
215
215
|
lli8: function(n, e, r, i, o, s, a, l) {
|
|
216
|
-
const c = (n * i - e * r) * (o - a) - (n - r) * (o * l - s * a), f = (n * i - e * r) * (s - l) - (e - i) * (o * l - s * a),
|
|
217
|
-
return
|
|
216
|
+
const c = (n * i - e * r) * (o - a) - (n - r) * (o * l - s * a), f = (n * i - e * r) * (s - l) - (e - i) * (o * l - s * a), g = (n - r) * (s - l) - (e - i) * (o - a);
|
|
217
|
+
return g == 0 ? !1 : { x: c / g, y: f / g };
|
|
218
218
|
},
|
|
219
219
|
lli4: function(n, e, r, i) {
|
|
220
|
-
const o = n.x, s = n.y, a = e.x, l = e.y, c = r.x, f = r.y,
|
|
221
|
-
return
|
|
220
|
+
const o = n.x, s = n.y, a = e.x, l = e.y, c = r.x, f = r.y, g = i.x, y = i.y;
|
|
221
|
+
return _.lli8(o, s, a, l, c, f, g, y);
|
|
222
222
|
},
|
|
223
223
|
lli: function(n, e) {
|
|
224
|
-
return
|
|
224
|
+
return _.lli4(n, n.c, e, e.c);
|
|
225
225
|
},
|
|
226
226
|
makeline: function(n, e) {
|
|
227
227
|
return new U(
|
|
@@ -244,28 +244,28 @@ const Wt = Math.PI, Mt = 2 * Wt, ct = Wt / 2, de = 1e-6, Xt = Number.MAX_SAFE_IN
|
|
|
244
244
|
};
|
|
245
245
|
},
|
|
246
246
|
shapeintersections: function(n, e, r, i, o) {
|
|
247
|
-
if (!
|
|
247
|
+
if (!_.bboxoverlap(e, i))
|
|
248
248
|
return [];
|
|
249
249
|
const s = [], a = [n.startcap, n.forward, n.back, n.endcap], l = [r.startcap, r.forward, r.back, r.endcap];
|
|
250
250
|
return a.forEach(function(c) {
|
|
251
251
|
c.virtual || l.forEach(function(f) {
|
|
252
252
|
if (f.virtual)
|
|
253
253
|
return;
|
|
254
|
-
const
|
|
255
|
-
|
|
254
|
+
const g = c.intersects(f, o);
|
|
255
|
+
g.length > 0 && (g.c1 = c, g.c2 = f, g.s1 = n, g.s2 = r, s.push(g));
|
|
256
256
|
});
|
|
257
257
|
}), s;
|
|
258
258
|
},
|
|
259
259
|
makeshape: function(n, e, r) {
|
|
260
|
-
const i = e.points.length, o = n.points.length, s =
|
|
260
|
+
const i = e.points.length, o = n.points.length, s = _.makeline(e.points[i - 1], n.points[0]), a = _.makeline(n.points[o - 1], e.points[0]), l = {
|
|
261
261
|
startcap: s,
|
|
262
262
|
forward: n,
|
|
263
263
|
back: e,
|
|
264
264
|
endcap: a,
|
|
265
|
-
bbox:
|
|
265
|
+
bbox: _.findbbox([s, n, e, a])
|
|
266
266
|
};
|
|
267
267
|
return l.intersections = function(c) {
|
|
268
|
-
return
|
|
268
|
+
return _.shapeintersections(
|
|
269
269
|
l,
|
|
270
270
|
l.bbox,
|
|
271
271
|
c,
|
|
@@ -284,7 +284,7 @@ const Wt = Math.PI, Mt = 2 * Wt, ct = Wt / 2, de = 1e-6, Xt = Number.MAX_SAFE_IN
|
|
|
284
284
|
return { min: i, mid: (i + o) / 2, max: o, size: o - i };
|
|
285
285
|
},
|
|
286
286
|
align: function(n, e) {
|
|
287
|
-
const r = e.p1.x, i = e.p1.y, o = -
|
|
287
|
+
const r = e.p1.x, i = e.p1.y, o = -gt(e.p2.y - i, e.p2.x - r), s = function(a) {
|
|
288
288
|
return {
|
|
289
289
|
x: (a.x - r) * ot(o) - (a.y - i) * ut(o),
|
|
290
290
|
y: (a.x - r) * ut(o) + (a.y - i) * ot(o)
|
|
@@ -294,38 +294,38 @@ const Wt = Math.PI, Mt = 2 * Wt, ct = Wt / 2, de = 1e-6, Xt = Number.MAX_SAFE_IN
|
|
|
294
294
|
},
|
|
295
295
|
roots: function(n, e) {
|
|
296
296
|
e = e || { p1: { x: 0, y: 0 }, p2: { x: 1, y: 0 } };
|
|
297
|
-
const r = n.length - 1, i =
|
|
297
|
+
const r = n.length - 1, i = _.align(n, e), o = function(x) {
|
|
298
298
|
return 0 <= x && x <= 1;
|
|
299
299
|
};
|
|
300
300
|
if (r === 2) {
|
|
301
301
|
const x = i[0].y, v = i[1].y, S = i[2].y, X = x - 2 * v + S;
|
|
302
302
|
if (X !== 0) {
|
|
303
|
-
const Y = -lt(v * v - x * S), b = -x + v,
|
|
304
|
-
return [
|
|
303
|
+
const Y = -lt(v * v - x * S), b = -x + v, N = -(Y + b) / X, R = -(-Y + b) / X;
|
|
304
|
+
return [N, R].filter(o);
|
|
305
305
|
} else if (v !== S && X === 0)
|
|
306
306
|
return [(2 * v - S) / (2 * v - 2 * S)].filter(o);
|
|
307
307
|
return [];
|
|
308
308
|
}
|
|
309
309
|
const s = i[0].y, a = i[1].y, l = i[2].y, c = i[3].y;
|
|
310
|
-
let f = -s + 3 * a - 3 * l + c,
|
|
311
|
-
if (
|
|
312
|
-
if (
|
|
313
|
-
return
|
|
314
|
-
const x = lt(y * y - 4 *
|
|
310
|
+
let f = -s + 3 * a - 3 * l + c, g = 3 * s - 6 * a + 3 * l, y = -3 * s + 3 * a, d = s;
|
|
311
|
+
if (_.approximately(f, 0)) {
|
|
312
|
+
if (_.approximately(g, 0))
|
|
313
|
+
return _.approximately(y, 0) ? [] : [-d / y].filter(o);
|
|
314
|
+
const x = lt(y * y - 4 * g * d), v = 2 * g;
|
|
315
315
|
return [(x - y) / v, (-y - x) / v].filter(o);
|
|
316
316
|
}
|
|
317
|
-
|
|
318
|
-
const M = (3 * y -
|
|
319
|
-
let u, h,
|
|
317
|
+
g /= f, y /= f, d /= f;
|
|
318
|
+
const M = (3 * y - g * g) / 3, k = M / 3, L = (2 * g * g * g - 9 * g * y + 27 * d) / 27, D = L / 2, O = D * D + k * k * k;
|
|
319
|
+
let u, h, m, p, w;
|
|
320
320
|
if (O < 0) {
|
|
321
|
-
const x = -M / 3, v = x * x * x, S = lt(v), X = -L / (2 * S), Y = X < -1 ? -1 : X > 1 ? 1 : X, b = ye(Y),
|
|
322
|
-
return
|
|
321
|
+
const x = -M / 3, v = x * x * x, S = lt(v), X = -L / (2 * S), Y = X < -1 ? -1 : X > 1 ? 1 : X, b = ye(Y), N = mt(S), R = 2 * N;
|
|
322
|
+
return m = R * ot(b / 3) - g / 3, p = R * ot((b + Mt) / 3) - g / 3, w = R * ot((b + 2 * Mt) / 3) - g / 3, [m, p, w].filter(o);
|
|
323
323
|
} else {
|
|
324
324
|
if (O === 0)
|
|
325
|
-
return u = D < 0 ?
|
|
325
|
+
return u = D < 0 ? mt(-D) : -mt(D), m = 2 * u - g / 3, p = -u - g / 3, [m, p].filter(o);
|
|
326
326
|
{
|
|
327
327
|
const x = lt(O);
|
|
328
|
-
return u =
|
|
328
|
+
return u = mt(-D + x), h = mt(D + x), [u - h - g / 3].filter(o);
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
},
|
|
@@ -346,24 +346,24 @@ const Wt = Math.PI, Mt = 2 * Wt, ct = Wt / 2, de = 1e-6, Xt = Number.MAX_SAFE_IN
|
|
|
346
346
|
return [];
|
|
347
347
|
},
|
|
348
348
|
curvature: function(n, e, r, i, o) {
|
|
349
|
-
let s, a, l, c, f = 0,
|
|
350
|
-
const y =
|
|
349
|
+
let s, a, l, c, f = 0, g = 0;
|
|
350
|
+
const y = _.compute(n, e), d = _.compute(n, r), M = y.x * y.x + y.y * y.y;
|
|
351
351
|
if (i ? (s = lt(
|
|
352
352
|
W(y.y * d.z - d.y * y.z, 2) + W(y.z * d.x - d.z * y.x, 2) + W(y.x * d.y - d.x * y.y, 2)
|
|
353
353
|
), a = W(M + y.z * y.z, 3 / 2)) : (s = y.x * d.y - y.y * d.x, a = W(M, 3 / 2)), s === 0 || a === 0)
|
|
354
354
|
return { k: 0, r: 0 };
|
|
355
|
-
if (f = s / a,
|
|
356
|
-
const k =
|
|
355
|
+
if (f = s / a, g = a / s, !o) {
|
|
356
|
+
const k = _.curvature(n - 1e-3, e, r, i, !0).k, L = _.curvature(n + 1e-3, e, r, i, !0).k;
|
|
357
357
|
c = (L - f + (f - k)) / 2, l = (pt(L - f) + pt(f - k)) / 2;
|
|
358
358
|
}
|
|
359
|
-
return { k: f, r:
|
|
359
|
+
return { k: f, r: g, dk: c, adk: l };
|
|
360
360
|
},
|
|
361
361
|
inflections: function(n) {
|
|
362
362
|
if (n.length < 4)
|
|
363
363
|
return [];
|
|
364
|
-
const e =
|
|
365
|
-
if (
|
|
366
|
-
if (!
|
|
364
|
+
const e = _.align(n, { p1: n[0], p2: n.slice(-1)[0] }), r = e[2].x * e[1].y, i = e[3].x * e[1].y, o = e[1].x * e[2].y, s = e[3].x * e[2].y, a = 18 * (-3 * r + 2 * i + 3 * o - s), l = 18 * (3 * r - i - 3 * o), c = 18 * (o - r);
|
|
365
|
+
if (_.approximately(a, 0)) {
|
|
366
|
+
if (!_.approximately(l, 0)) {
|
|
367
367
|
let d = -c / l;
|
|
368
368
|
if (0 <= d && d <= 1)
|
|
369
369
|
return [d];
|
|
@@ -371,12 +371,12 @@ const Wt = Math.PI, Mt = 2 * Wt, ct = Wt / 2, de = 1e-6, Xt = Number.MAX_SAFE_IN
|
|
|
371
371
|
return [];
|
|
372
372
|
}
|
|
373
373
|
const f = 2 * a;
|
|
374
|
-
if (
|
|
374
|
+
if (_.approximately(f, 0))
|
|
375
375
|
return [];
|
|
376
|
-
const
|
|
377
|
-
if (
|
|
376
|
+
const g = l * l - 4 * a * c;
|
|
377
|
+
if (g < 0)
|
|
378
378
|
return [];
|
|
379
|
-
const y = Math.sqrt(
|
|
379
|
+
const y = Math.sqrt(g);
|
|
380
380
|
return [(y - l) / f, -(l + y) / f].filter(function(d) {
|
|
381
381
|
return 0 <= d && d <= 1;
|
|
382
382
|
});
|
|
@@ -404,21 +404,21 @@ const Wt = Math.PI, Mt = 2 * Wt, ct = Wt / 2, de = 1e-6, Xt = Number.MAX_SAFE_IN
|
|
|
404
404
|
{ left: l.right, right: c.left }
|
|
405
405
|
];
|
|
406
406
|
f = f.filter(function(y) {
|
|
407
|
-
return
|
|
407
|
+
return _.bboxoverlap(y.left.bbox(), y.right.bbox());
|
|
408
408
|
});
|
|
409
|
-
let
|
|
409
|
+
let g = [];
|
|
410
410
|
return f.length === 0 || (f.forEach(function(y) {
|
|
411
|
-
|
|
412
|
-
|
|
411
|
+
g = g.concat(
|
|
412
|
+
_.pairiteration(y.left, y.right, a)
|
|
413
413
|
);
|
|
414
|
-
}),
|
|
415
|
-
return
|
|
416
|
-
})),
|
|
414
|
+
}), g = g.filter(function(y, d) {
|
|
415
|
+
return g.indexOf(y) === d;
|
|
416
|
+
})), g;
|
|
417
417
|
},
|
|
418
418
|
getccenter: function(n, e, r) {
|
|
419
|
-
const i = e.x - n.x, o = e.y - n.y, s = r.x - e.x, a = r.y - e.y, l = i * ot(ct) - o * ut(ct), c = i * ut(ct) + o * ot(ct), f = s * ot(ct) - a * ut(ct),
|
|
420
|
-
let p =
|
|
421
|
-
return p < x ? ((p > w || w > x) && (p += Mt), p > x && (v = x, x = p, p = v)) : x < w && w < p ? (v = x, x = p, p = v) : x += Mt, h.s = p, h.e = x, h.r =
|
|
419
|
+
const i = e.x - n.x, o = e.y - n.y, s = r.x - e.x, a = r.y - e.y, l = i * ot(ct) - o * ut(ct), c = i * ut(ct) + o * ot(ct), f = s * ot(ct) - a * ut(ct), g = s * ut(ct) + a * ot(ct), y = (n.x + e.x) / 2, d = (n.y + e.y) / 2, M = (e.x + r.x) / 2, k = (e.y + r.y) / 2, L = y + l, D = d + c, O = M + f, u = k + g, h = _.lli8(y, d, L, D, M, k, O, u), m = _.dist(h, n);
|
|
420
|
+
let p = gt(n.y - h.y, n.x - h.x), w = gt(e.y - h.y, e.x - h.x), x = gt(r.y - h.y, r.x - h.x), v;
|
|
421
|
+
return p < x ? ((p > w || w > x) && (p += Mt), p > x && (v = x, x = p, p = v)) : x < w && w < p ? (v = x, x = p, p = v) : x += Mt, h.s = p, h.e = x, h.r = m, h;
|
|
422
422
|
},
|
|
423
423
|
numberSort: function(n, e) {
|
|
424
424
|
return n - e;
|
|
@@ -433,7 +433,7 @@ class wt {
|
|
|
433
433
|
}
|
|
434
434
|
toString() {
|
|
435
435
|
return "[" + this.curves.map(function(e) {
|
|
436
|
-
return
|
|
436
|
+
return _.pointsToString(e.points);
|
|
437
437
|
}).join(", ") + "]";
|
|
438
438
|
}
|
|
439
439
|
addCurve(e) {
|
|
@@ -452,7 +452,7 @@ class wt {
|
|
|
452
452
|
bbox() {
|
|
453
453
|
const e = this.curves;
|
|
454
454
|
for (var r = e[0].bbox(), i = 1; i < e.length; i++)
|
|
455
|
-
|
|
455
|
+
_.expandbox(r, e[i].bbox());
|
|
456
456
|
return r;
|
|
457
457
|
}
|
|
458
458
|
offset(e) {
|
|
@@ -462,7 +462,7 @@ class wt {
|
|
|
462
462
|
}), new wt(r);
|
|
463
463
|
}
|
|
464
464
|
}
|
|
465
|
-
const { abs: xt, min: $t, max: Gt, cos:
|
|
465
|
+
const { abs: xt, min: $t, max: Gt, cos: ge, sin: me, acos: xe, sqrt: vt } = Math, ve = Math.PI;
|
|
466
466
|
class U {
|
|
467
467
|
constructor(e) {
|
|
468
468
|
let r = e && e.forEach ? e : Array.from(arguments).slice(), i = !1;
|
|
@@ -497,9 +497,9 @@ class U {
|
|
|
497
497
|
};
|
|
498
498
|
a && (c.z = r[M + 2]), l.push(c);
|
|
499
499
|
}
|
|
500
|
-
const f = this.order = l.length - 1,
|
|
501
|
-
a &&
|
|
502
|
-
const y =
|
|
500
|
+
const f = this.order = l.length - 1, g = this.dims = ["x", "y"];
|
|
501
|
+
a && g.push("z"), this.dimlen = g.length;
|
|
502
|
+
const y = _.align(l, { p1: l[0], p2: l[f] }), d = _.dist(l[0], l[f]);
|
|
503
503
|
this._linear = y.reduce((M, k) => M + xt(k.y), 0) < d / 50, this._lut = [], this._t1 = 0, this._t2 = 1, this.update();
|
|
504
504
|
}
|
|
505
505
|
static quadraticFromPoints(e, r, i, o) {
|
|
@@ -513,15 +513,15 @@ class U {
|
|
|
513
513
|
static cubicFromPoints(e, r, i, o, s) {
|
|
514
514
|
typeof o > "u" && (o = 0.5);
|
|
515
515
|
const a = U.getABC(3, e, r, i, o);
|
|
516
|
-
typeof s > "u" && (s =
|
|
517
|
-
const l = s * (1 - o) / o, c =
|
|
516
|
+
typeof s > "u" && (s = _.dist(r, a.C));
|
|
517
|
+
const l = s * (1 - o) / o, c = _.dist(e, i), f = (i.x - e.x) / c, g = (i.y - e.y) / c, y = s * f, d = s * g, M = l * f, k = l * g, L = { x: r.x - y, y: r.y - d }, D = { x: r.x + M, y: r.y + k }, O = a.A, u = { x: O.x + (L.x - O.x) / (1 - o), y: O.y + (L.y - O.y) / (1 - o) }, h = { x: O.x + (D.x - O.x) / o, y: O.y + (D.y - O.y) / o }, m = { x: e.x + (u.x - e.x) / o, y: e.y + (u.y - e.y) / o }, p = {
|
|
518
518
|
x: i.x + (h.x - i.x) / (1 - o),
|
|
519
519
|
y: i.y + (h.y - i.y) / (1 - o)
|
|
520
520
|
};
|
|
521
|
-
return new U(e,
|
|
521
|
+
return new U(e, m, p, i);
|
|
522
522
|
}
|
|
523
523
|
static getUtils() {
|
|
524
|
-
return
|
|
524
|
+
return _;
|
|
525
525
|
}
|
|
526
526
|
getUtils() {
|
|
527
527
|
return U.getUtils();
|
|
@@ -533,7 +533,7 @@ class U {
|
|
|
533
533
|
return this.toString();
|
|
534
534
|
}
|
|
535
535
|
toString() {
|
|
536
|
-
return
|
|
536
|
+
return _.pointsToString(this.points);
|
|
537
537
|
}
|
|
538
538
|
toSVG() {
|
|
539
539
|
if (this._3d)
|
|
@@ -558,20 +558,20 @@ class U {
|
|
|
558
558
|
}).join("");
|
|
559
559
|
}
|
|
560
560
|
update() {
|
|
561
|
-
this._lut = [], this.dpoints =
|
|
561
|
+
this._lut = [], this.dpoints = _.derive(this.points, this._3d), this.computedirection();
|
|
562
562
|
}
|
|
563
563
|
computedirection() {
|
|
564
|
-
const e = this.points, r =
|
|
564
|
+
const e = this.points, r = _.angle(e[0], e[this.order], e[1]);
|
|
565
565
|
this.clockwise = r > 0;
|
|
566
566
|
}
|
|
567
567
|
length() {
|
|
568
|
-
return
|
|
568
|
+
return _.length(this.derivative.bind(this));
|
|
569
569
|
}
|
|
570
570
|
static getABC(e = 2, r, i, o, s = 0.5) {
|
|
571
|
-
const a =
|
|
571
|
+
const a = _.projectionratio(s, e), l = 1 - a, c = {
|
|
572
572
|
x: a * r.x + l * o.x,
|
|
573
573
|
y: a * r.y + l * o.y
|
|
574
|
-
}, f =
|
|
574
|
+
}, f = _.abcratio(s, e);
|
|
575
575
|
return { A: {
|
|
576
576
|
x: i.x + (i.x - c.x) / f,
|
|
577
577
|
y: i.y + (i.y - c.y) / f
|
|
@@ -594,15 +594,15 @@ class U {
|
|
|
594
594
|
r = r || 5;
|
|
595
595
|
const i = this.getLUT(), o = [];
|
|
596
596
|
for (let s = 0, a, l = 0; s < i.length; s++)
|
|
597
|
-
a = i[s],
|
|
597
|
+
a = i[s], _.dist(a, e) < r && (o.push(a), l += s / i.length);
|
|
598
598
|
return o.length ? t /= o.length : !1;
|
|
599
599
|
}
|
|
600
600
|
project(e) {
|
|
601
|
-
const r = this.getLUT(), i = r.length - 1, o =
|
|
602
|
-
let f = o.mdist,
|
|
601
|
+
const r = this.getLUT(), i = r.length - 1, o = _.closest(r, e), s = o.mpos, a = (s - 1) / i, l = (s + 1) / i, c = 0.1 / i;
|
|
602
|
+
let f = o.mdist, g = a, y = g, d;
|
|
603
603
|
f += 1;
|
|
604
|
-
for (let M;
|
|
605
|
-
d = this.compute(
|
|
604
|
+
for (let M; g < l + c; g += c)
|
|
605
|
+
d = this.compute(g), M = _.dist(e, d), M < f && (f = M, y = g);
|
|
606
606
|
return y = y < 0 ? 0 : y > 1 ? 1 : y, d = this.compute(y), d.t = y, d.d = f, d;
|
|
607
607
|
}
|
|
608
608
|
get(e) {
|
|
@@ -612,7 +612,7 @@ class U {
|
|
|
612
612
|
return this.points[e];
|
|
613
613
|
}
|
|
614
614
|
compute(e) {
|
|
615
|
-
return this.ratios ?
|
|
615
|
+
return this.ratios ? _.computeWithRatios(e, this.points, this.ratios, this._3d) : _.compute(e, this.points, this._3d, this.ratios);
|
|
616
616
|
}
|
|
617
617
|
raise() {
|
|
618
618
|
const e = this.points, r = [e[0]], i = e.length;
|
|
@@ -624,20 +624,20 @@ class U {
|
|
|
624
624
|
return r[i] = e[i - 1], new U(r);
|
|
625
625
|
}
|
|
626
626
|
derivative(e) {
|
|
627
|
-
return
|
|
627
|
+
return _.compute(e, this.dpoints[0], this._3d);
|
|
628
628
|
}
|
|
629
629
|
dderivative(e) {
|
|
630
|
-
return
|
|
630
|
+
return _.compute(e, this.dpoints[1], this._3d);
|
|
631
631
|
}
|
|
632
632
|
align() {
|
|
633
633
|
let e = this.points;
|
|
634
|
-
return new U(
|
|
634
|
+
return new U(_.align(e, { p1: e[0], p2: e[e.length - 1] }));
|
|
635
635
|
}
|
|
636
636
|
curvature(e) {
|
|
637
|
-
return
|
|
637
|
+
return _.curvature(e, this.dpoints[0], this.dpoints[1], this._3d);
|
|
638
638
|
}
|
|
639
639
|
inflections() {
|
|
640
|
-
return
|
|
640
|
+
return _.inflections(this.points);
|
|
641
641
|
}
|
|
642
642
|
normal(e) {
|
|
643
643
|
return this._3d ? this.__normal3(e) : this.__normal2(e);
|
|
@@ -678,7 +678,7 @@ class U {
|
|
|
678
678
|
for (o[s++] = r[0], o[s++] = r[1], o[s++] = r[2], this.order === 3 && (o[s++] = r[3]); r.length > 1; ) {
|
|
679
679
|
i = [];
|
|
680
680
|
for (let a = 0, l, c = r.length - 1; a < c; a++)
|
|
681
|
-
l =
|
|
681
|
+
l = _.lerp(e, r[a], r[a + 1]), o[s++] = l, i.push(l);
|
|
682
682
|
r = i;
|
|
683
683
|
}
|
|
684
684
|
return o;
|
|
@@ -693,7 +693,7 @@ class U {
|
|
|
693
693
|
right: this.order === 2 ? new U([i[5], i[4], i[2]]) : new U([i[9], i[8], i[6], i[3]]),
|
|
694
694
|
span: i
|
|
695
695
|
};
|
|
696
|
-
return o.left._t1 =
|
|
696
|
+
return o.left._t1 = _.map(0, 0, 1, this._t1, this._t2), o.left._t2 = _.map(e, 0, 1, this._t1, this._t2), o.right._t1 = _.map(e, 0, 1, this._t1, this._t2), o.right._t2 = _.map(1, 0, 1, this._t1, this._t2), r ? (r = _.map(r, e, 1, 0, 1), o.right.split(r).left) : o;
|
|
697
697
|
}
|
|
698
698
|
extrema() {
|
|
699
699
|
const e = {};
|
|
@@ -703,11 +703,11 @@ class U {
|
|
|
703
703
|
let o = function(a) {
|
|
704
704
|
return a[i];
|
|
705
705
|
}, s = this.dpoints[0].map(o);
|
|
706
|
-
e[i] =
|
|
706
|
+
e[i] = _.droots(s), this.order === 3 && (s = this.dpoints[1].map(o), e[i] = e[i].concat(_.droots(s))), e[i] = e[i].filter(function(a) {
|
|
707
707
|
return a >= 0 && a <= 1;
|
|
708
|
-
}), r = r.concat(e[i].sort(
|
|
708
|
+
}), r = r.concat(e[i].sort(_.numberSort));
|
|
709
709
|
}).bind(this)
|
|
710
|
-
), e.values = r.sort(
|
|
710
|
+
), e.values = r.sort(_.numberSort).filter(function(i, o) {
|
|
711
711
|
return r.indexOf(i) === o;
|
|
712
712
|
}), e;
|
|
713
713
|
}
|
|
@@ -715,13 +715,13 @@ class U {
|
|
|
715
715
|
const e = this.extrema(), r = {};
|
|
716
716
|
return this.dims.forEach(
|
|
717
717
|
(function(i) {
|
|
718
|
-
r[i] =
|
|
718
|
+
r[i] = _.getminmax(this, i, e[i]);
|
|
719
719
|
}).bind(this)
|
|
720
720
|
), r;
|
|
721
721
|
}
|
|
722
722
|
overlaps(e) {
|
|
723
723
|
const r = this.bbox(), i = e.bbox();
|
|
724
|
-
return
|
|
724
|
+
return _.bboxoverlap(r, i);
|
|
725
725
|
}
|
|
726
726
|
offset(e, r) {
|
|
727
727
|
if (typeof r < "u") {
|
|
@@ -749,7 +749,7 @@ class U {
|
|
|
749
749
|
}
|
|
750
750
|
simple() {
|
|
751
751
|
if (this.order === 3) {
|
|
752
|
-
const o =
|
|
752
|
+
const o = _.angle(this.points[0], this.points[3], this.points[1]), s = _.angle(this.points[0], this.points[3], this.points[2]);
|
|
753
753
|
if (o > 0 && s < 0 || o < 0 && s > 0)
|
|
754
754
|
return !1;
|
|
755
755
|
}
|
|
@@ -767,10 +767,10 @@ class U {
|
|
|
767
767
|
if (s = f.split(r, i), !s.simple()) {
|
|
768
768
|
if (i -= o, xt(r - i) < o)
|
|
769
769
|
return [];
|
|
770
|
-
s = f.split(r, i), s._t1 =
|
|
770
|
+
s = f.split(r, i), s._t1 = _.map(r, 0, 1, f._t1, f._t2), s._t2 = _.map(i, 0, 1, f._t1, f._t2), l.push(s), r = i;
|
|
771
771
|
break;
|
|
772
772
|
}
|
|
773
|
-
r < 1 && (s = f.split(r, 1), s._t1 =
|
|
773
|
+
r < 1 && (s = f.split(r, 1), s._t1 = _.map(r, 0, 1, f._t1, f._t2), s._t2 = f._t2, l.push(s));
|
|
774
774
|
}), l;
|
|
775
775
|
}
|
|
776
776
|
translate(e, r, i) {
|
|
@@ -796,17 +796,17 @@ class U {
|
|
|
796
796
|
i ? i(0) : e,
|
|
797
797
|
i ? i(1) : e
|
|
798
798
|
);
|
|
799
|
-
const a = i ? i(0) : e, l = i ? i(1) : e, c = [this.offset(0, 10), this.offset(1, 10)], f = [],
|
|
800
|
-
if (!
|
|
799
|
+
const a = i ? i(0) : e, l = i ? i(1) : e, c = [this.offset(0, 10), this.offset(1, 10)], f = [], g = _.lli4(c[0], c[0].c, c[1], c[1].c);
|
|
800
|
+
if (!g)
|
|
801
801
|
throw new Error("cannot scale this curve. Try reducing it first.");
|
|
802
802
|
return [0, 1].forEach(function(y) {
|
|
803
|
-
const d = f[y * r] =
|
|
803
|
+
const d = f[y * r] = _.copy(s[y * r]);
|
|
804
804
|
d.x += (y ? l : a) * c[y].n.x, d.y += (y ? l : a) * c[y].n.y;
|
|
805
805
|
}), i ? ([0, 1].forEach(function(y) {
|
|
806
806
|
if (!(r === 2 && y)) {
|
|
807
807
|
var d = s[y + 1], M = {
|
|
808
|
-
x: d.x -
|
|
809
|
-
y: d.y -
|
|
808
|
+
x: d.x - g.x,
|
|
809
|
+
y: d.y - g.y
|
|
810
810
|
}, k = i ? i((y + 1) / r) : e;
|
|
811
811
|
i && !o && (k = -k);
|
|
812
812
|
var L = vt(M.x * M.x + M.y * M.y);
|
|
@@ -819,7 +819,7 @@ class U {
|
|
|
819
819
|
if (r === 2 && y)
|
|
820
820
|
return;
|
|
821
821
|
const d = f[y * r], M = this.derivative(y), k = { x: d.x + M.x, y: d.y + M.y };
|
|
822
|
-
f[y + 1] =
|
|
822
|
+
f[y + 1] = _.lli4(d, k, g, s[y + 1]);
|
|
823
823
|
}), new U(f));
|
|
824
824
|
}
|
|
825
825
|
outline(e, r, i, o) {
|
|
@@ -829,36 +829,36 @@ class U {
|
|
|
829
829
|
i === void 0 && (i = e, o = r), v = { x: w.x + p.x * e, y: w.y + p.y * e }, X = { x: x.x + p.x * i, y: x.y + p.y * i }, S = { x: (v.x + X.x) / 2, y: (v.y + X.y) / 2 };
|
|
830
830
|
const Y = [v, S, X];
|
|
831
831
|
v = { x: w.x - p.x * r, y: w.y - p.y * r }, X = { x: x.x - p.x * o, y: x.y - p.y * o }, S = { x: (v.x + X.x) / 2, y: (v.y + X.y) / 2 };
|
|
832
|
-
const b = [X, S, v],
|
|
832
|
+
const b = [X, S, v], N = _.makeline(b[2], Y[0]), R = _.makeline(Y[2], b[0]), H = [N, new U(Y), R, new U(b)];
|
|
833
833
|
return new wt(H);
|
|
834
834
|
}
|
|
835
835
|
const s = this.reduce(), a = s.length, l = [];
|
|
836
|
-
let c = [], f,
|
|
836
|
+
let c = [], f, g = 0, y = this.length();
|
|
837
837
|
const d = typeof i < "u" && typeof o < "u";
|
|
838
838
|
function M(p, w, x, v, S) {
|
|
839
839
|
return function(X) {
|
|
840
|
-
const Y = v / x, b = (v + S) / x,
|
|
841
|
-
return
|
|
840
|
+
const Y = v / x, b = (v + S) / x, N = w - p;
|
|
841
|
+
return _.map(X, 0, 1, p + Y * N, p + b * N);
|
|
842
842
|
};
|
|
843
843
|
}
|
|
844
844
|
s.forEach(function(p) {
|
|
845
845
|
const w = p.length();
|
|
846
846
|
d ? (l.push(
|
|
847
|
-
p.scale(M(e, i, y,
|
|
847
|
+
p.scale(M(e, i, y, g, w))
|
|
848
848
|
), c.push(
|
|
849
|
-
p.scale(M(-r, -o, y,
|
|
850
|
-
)) : (l.push(p.scale(e)), c.push(p.scale(-r))),
|
|
849
|
+
p.scale(M(-r, -o, y, g, w))
|
|
850
|
+
)) : (l.push(p.scale(e)), c.push(p.scale(-r))), g += w;
|
|
851
851
|
}), c = c.map(function(p) {
|
|
852
852
|
return f = p.points, f[3] ? p.points = [f[3], f[2], f[1], f[0]] : p.points = [f[2], f[1], f[0]], p;
|
|
853
853
|
}).reverse();
|
|
854
|
-
const k = l[0].points[0], L = l[a - 1].points[l[a - 1].points.length - 1], D = c[a - 1].points[c[a - 1].points.length - 1], O = c[0].points[0], u =
|
|
855
|
-
return new wt(
|
|
854
|
+
const k = l[0].points[0], L = l[a - 1].points[l[a - 1].points.length - 1], D = c[a - 1].points[c[a - 1].points.length - 1], O = c[0].points[0], u = _.makeline(D, k), h = _.makeline(L, O), m = [u].concat(l).concat([h]).concat(c);
|
|
855
|
+
return new wt(m);
|
|
856
856
|
}
|
|
857
857
|
outlineshapes(e, r, i) {
|
|
858
858
|
r = r || e;
|
|
859
859
|
const o = this.outline(e, r).curves, s = [];
|
|
860
860
|
for (let a = 1, l = o.length; a < l / 2; a++) {
|
|
861
|
-
const c =
|
|
861
|
+
const c = _.makeshape(
|
|
862
862
|
o[a],
|
|
863
863
|
o[l - a],
|
|
864
864
|
i
|
|
@@ -876,9 +876,9 @@ class U {
|
|
|
876
876
|
}
|
|
877
877
|
lineIntersects(e) {
|
|
878
878
|
const r = $t(e.p1.x, e.p2.x), i = $t(e.p1.y, e.p2.y), o = Gt(e.p1.x, e.p2.x), s = Gt(e.p1.y, e.p2.y);
|
|
879
|
-
return
|
|
879
|
+
return _.roots(this.points, e).filter((a) => {
|
|
880
880
|
var l = this.get(a);
|
|
881
|
-
return
|
|
881
|
+
return _.between(l.x, r, o) && _.between(l.y, i, s);
|
|
882
882
|
});
|
|
883
883
|
}
|
|
884
884
|
selfintersects(e) {
|
|
@@ -896,7 +896,7 @@ class U {
|
|
|
896
896
|
});
|
|
897
897
|
let s = [];
|
|
898
898
|
return o.forEach(function(a) {
|
|
899
|
-
const l =
|
|
899
|
+
const l = _.pairiteration(
|
|
900
900
|
a.left,
|
|
901
901
|
a.right,
|
|
902
902
|
i
|
|
@@ -908,26 +908,26 @@ class U {
|
|
|
908
908
|
return e = e || 0.5, this._iterate(e, []);
|
|
909
909
|
}
|
|
910
910
|
_error(e, r, i, o) {
|
|
911
|
-
const s = (o - i) / 4, a = this.get(i + s), l = this.get(o - s), c =
|
|
912
|
-
return xt(f - c) + xt(
|
|
911
|
+
const s = (o - i) / 4, a = this.get(i + s), l = this.get(o - s), c = _.dist(e, r), f = _.dist(e, a), g = _.dist(e, l);
|
|
912
|
+
return xt(f - c) + xt(g - c);
|
|
913
913
|
}
|
|
914
914
|
_iterate(e, r) {
|
|
915
915
|
let i = 0, o = 1, s;
|
|
916
916
|
do {
|
|
917
917
|
s = 0, o = 1;
|
|
918
|
-
let a = this.get(i), l, c, f,
|
|
918
|
+
let a = this.get(i), l, c, f, g, y = !1, d = !1, M, k = o, L = 1;
|
|
919
919
|
do
|
|
920
|
-
if (d = y,
|
|
920
|
+
if (d = y, g = f, k = (i + o) / 2, l = this.get(k), c = this.get(o), f = _.getccenter(a, l, c), f.interval = {
|
|
921
921
|
start: i,
|
|
922
922
|
end: o
|
|
923
923
|
}, y = this._error(f, a, i, o) <= e, M = d && !y, M || (L = o), y) {
|
|
924
924
|
if (o >= 1) {
|
|
925
|
-
if (f.interval.end = L = 1,
|
|
925
|
+
if (f.interval.end = L = 1, g = f, o > 1) {
|
|
926
926
|
let O = {
|
|
927
|
-
x: f.x + f.r *
|
|
928
|
-
y: f.y + f.r *
|
|
927
|
+
x: f.x + f.r * ge(f.e),
|
|
928
|
+
y: f.y + f.r * me(f.e)
|
|
929
929
|
};
|
|
930
|
-
f.e +=
|
|
930
|
+
f.e += _.angle({ x: f.x, y: f.y }, O, this.get(1));
|
|
931
931
|
}
|
|
932
932
|
break;
|
|
933
933
|
}
|
|
@@ -937,7 +937,7 @@ class U {
|
|
|
937
937
|
while (!M && s++ < 100);
|
|
938
938
|
if (s >= 100)
|
|
939
939
|
break;
|
|
940
|
-
|
|
940
|
+
g = g || f, r.push(g), i = L;
|
|
941
941
|
} while (o < 1);
|
|
942
942
|
return r;
|
|
943
943
|
}
|
|
@@ -1028,14 +1028,14 @@ function Tt(n) {
|
|
|
1028
1028
|
}
|
|
1029
1029
|
function kt(n, e, r) {
|
|
1030
1030
|
if (n !== null)
|
|
1031
|
-
for (var i, o, s, a, l, c, f,
|
|
1031
|
+
for (var i, o, s, a, l, c, f, g = 0, y = 0, d, M = n.type, k = M === "FeatureCollection", L = M === "Feature", D = k ? n.features.length : 1, O = 0; O < D; O++) {
|
|
1032
1032
|
f = k ? n.features[O].geometry : L ? n.geometry : n, d = f ? f.type === "GeometryCollection" : !1, l = d ? f.geometries.length : 1;
|
|
1033
1033
|
for (var u = 0; u < l; u++) {
|
|
1034
|
-
var h = 0,
|
|
1034
|
+
var h = 0, m = 0;
|
|
1035
1035
|
if (a = d ? f.geometries[u] : f, a !== null) {
|
|
1036
1036
|
c = a.coordinates;
|
|
1037
1037
|
var p = a.type;
|
|
1038
|
-
switch (
|
|
1038
|
+
switch (g = r && (p === "Polygon" || p === "MultiPolygon") ? 1 : 0, p) {
|
|
1039
1039
|
case null:
|
|
1040
1040
|
break;
|
|
1041
1041
|
case "Point":
|
|
@@ -1044,7 +1044,7 @@ function kt(n, e, r) {
|
|
|
1044
1044
|
y,
|
|
1045
1045
|
O,
|
|
1046
1046
|
h,
|
|
1047
|
-
|
|
1047
|
+
m
|
|
1048
1048
|
) === !1)
|
|
1049
1049
|
return !1;
|
|
1050
1050
|
y++, h++;
|
|
@@ -1057,7 +1057,7 @@ function kt(n, e, r) {
|
|
|
1057
1057
|
y,
|
|
1058
1058
|
O,
|
|
1059
1059
|
h,
|
|
1060
|
-
|
|
1060
|
+
m
|
|
1061
1061
|
) === !1)
|
|
1062
1062
|
return !1;
|
|
1063
1063
|
y++, p === "MultiPoint" && h++;
|
|
@@ -1067,36 +1067,36 @@ function kt(n, e, r) {
|
|
|
1067
1067
|
case "Polygon":
|
|
1068
1068
|
case "MultiLineString":
|
|
1069
1069
|
for (i = 0; i < c.length; i++) {
|
|
1070
|
-
for (o = 0; o < c[i].length -
|
|
1070
|
+
for (o = 0; o < c[i].length - g; o++) {
|
|
1071
1071
|
if (e(
|
|
1072
1072
|
c[i][o],
|
|
1073
1073
|
y,
|
|
1074
1074
|
O,
|
|
1075
1075
|
h,
|
|
1076
|
-
|
|
1076
|
+
m
|
|
1077
1077
|
) === !1)
|
|
1078
1078
|
return !1;
|
|
1079
1079
|
y++;
|
|
1080
1080
|
}
|
|
1081
|
-
p === "MultiLineString" && h++, p === "Polygon" &&
|
|
1081
|
+
p === "MultiLineString" && h++, p === "Polygon" && m++;
|
|
1082
1082
|
}
|
|
1083
1083
|
p === "Polygon" && h++;
|
|
1084
1084
|
break;
|
|
1085
1085
|
case "MultiPolygon":
|
|
1086
1086
|
for (i = 0; i < c.length; i++) {
|
|
1087
|
-
for (
|
|
1088
|
-
for (s = 0; s < c[i][o].length -
|
|
1087
|
+
for (m = 0, o = 0; o < c[i].length; o++) {
|
|
1088
|
+
for (s = 0; s < c[i][o].length - g; s++) {
|
|
1089
1089
|
if (e(
|
|
1090
1090
|
c[i][o][s],
|
|
1091
1091
|
y,
|
|
1092
1092
|
O,
|
|
1093
1093
|
h,
|
|
1094
|
-
|
|
1094
|
+
m
|
|
1095
1095
|
) === !1)
|
|
1096
1096
|
return !1;
|
|
1097
1097
|
y++;
|
|
1098
1098
|
}
|
|
1099
|
-
|
|
1099
|
+
m++;
|
|
1100
1100
|
}
|
|
1101
1101
|
h++;
|
|
1102
1102
|
}
|
|
@@ -1114,15 +1114,15 @@ function kt(n, e, r) {
|
|
|
1114
1114
|
}
|
|
1115
1115
|
}
|
|
1116
1116
|
function _e(n, e) {
|
|
1117
|
-
var r, i, o, s, a, l, c, f,
|
|
1117
|
+
var r, i, o, s, a, l, c, f, g, y, d = 0, M = n.type === "FeatureCollection", k = n.type === "Feature", L = M ? n.features.length : 1;
|
|
1118
1118
|
for (r = 0; r < L; r++) {
|
|
1119
|
-
for (l = M ? n.features[r].geometry : k ? n.geometry : n, f = M ? n.features[r].properties : k ? n.properties : {},
|
|
1119
|
+
for (l = M ? n.features[r].geometry : k ? n.geometry : n, f = M ? n.features[r].properties : k ? n.properties : {}, g = M ? n.features[r].bbox : k ? n.bbox : void 0, y = M ? n.features[r].id : k ? n.id : void 0, c = l ? l.type === "GeometryCollection" : !1, a = c ? l.geometries.length : 1, o = 0; o < a; o++) {
|
|
1120
1120
|
if (s = c ? l.geometries[o] : l, s === null) {
|
|
1121
1121
|
if (e(
|
|
1122
1122
|
null,
|
|
1123
1123
|
d,
|
|
1124
1124
|
f,
|
|
1125
|
-
|
|
1125
|
+
g,
|
|
1126
1126
|
y
|
|
1127
1127
|
) === !1)
|
|
1128
1128
|
return !1;
|
|
@@ -1139,7 +1139,7 @@ function _e(n, e) {
|
|
|
1139
1139
|
s,
|
|
1140
1140
|
d,
|
|
1141
1141
|
f,
|
|
1142
|
-
|
|
1142
|
+
g,
|
|
1143
1143
|
y
|
|
1144
1144
|
) === !1)
|
|
1145
1145
|
return !1;
|
|
@@ -1151,7 +1151,7 @@ function _e(n, e) {
|
|
|
1151
1151
|
s.geometries[i],
|
|
1152
1152
|
d,
|
|
1153
1153
|
f,
|
|
1154
|
-
|
|
1154
|
+
g,
|
|
1155
1155
|
y
|
|
1156
1156
|
) === !1)
|
|
1157
1157
|
return !1;
|
|
@@ -1226,27 +1226,27 @@ var Jt = { exports: {} }, ne = { exports: {} };
|
|
|
1226
1226
|
(function(r, i) {
|
|
1227
1227
|
n.exports = i();
|
|
1228
1228
|
})(re, function() {
|
|
1229
|
-
function r(u, h,
|
|
1229
|
+
function r(u, h, m, p, w) {
|
|
1230
1230
|
(function x(v, S, X, Y, b) {
|
|
1231
1231
|
for (; Y > X; ) {
|
|
1232
1232
|
if (Y - X > 600) {
|
|
1233
|
-
var
|
|
1234
|
-
x(v, S,
|
|
1233
|
+
var N = Y - X + 1, R = S - X + 1, H = Math.log(N), z = 0.5 * Math.exp(2 * H / 3), E = 0.5 * Math.sqrt(H * z * (N - z) / N) * (R - N / 2 < 0 ? -1 : 1), q = Math.max(X, Math.floor(S - R * z / N + E)), F = Math.min(Y, Math.floor(S + (N - R) * z / N + E));
|
|
1234
|
+
x(v, S, q, F, b);
|
|
1235
1235
|
}
|
|
1236
|
-
var P = v[S], C = X,
|
|
1237
|
-
for (i(v, X, S), b(v[Y], P) > 0 && i(v, X, Y); C <
|
|
1238
|
-
for (i(v, C,
|
|
1236
|
+
var P = v[S], C = X, A = Y;
|
|
1237
|
+
for (i(v, X, S), b(v[Y], P) > 0 && i(v, X, Y); C < A; ) {
|
|
1238
|
+
for (i(v, C, A), C++, A--; b(v[C], P) < 0; )
|
|
1239
1239
|
C++;
|
|
1240
|
-
for (; b(v[
|
|
1241
|
-
|
|
1240
|
+
for (; b(v[A], P) > 0; )
|
|
1241
|
+
A--;
|
|
1242
1242
|
}
|
|
1243
|
-
b(v[X], P) === 0 ? i(v, X,
|
|
1243
|
+
b(v[X], P) === 0 ? i(v, X, A) : i(v, ++A, Y), A <= S && (X = A + 1), S <= A && (Y = A - 1);
|
|
1244
1244
|
}
|
|
1245
|
-
})(u, h,
|
|
1245
|
+
})(u, h, m || 0, p || u.length - 1, w || o);
|
|
1246
1246
|
}
|
|
1247
|
-
function i(u, h,
|
|
1247
|
+
function i(u, h, m) {
|
|
1248
1248
|
var p = u[h];
|
|
1249
|
-
u[h] = u[
|
|
1249
|
+
u[h] = u[m], u[m] = p;
|
|
1250
1250
|
}
|
|
1251
1251
|
function o(u, h) {
|
|
1252
1252
|
return u < h ? -1 : u > h ? 1 : 0;
|
|
@@ -1254,20 +1254,20 @@ var Jt = { exports: {} }, ne = { exports: {} };
|
|
|
1254
1254
|
var s = function(u) {
|
|
1255
1255
|
u === void 0 && (u = 9), this._maxEntries = Math.max(4, u), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), this.clear();
|
|
1256
1256
|
};
|
|
1257
|
-
function a(u, h,
|
|
1258
|
-
if (!
|
|
1257
|
+
function a(u, h, m) {
|
|
1258
|
+
if (!m)
|
|
1259
1259
|
return h.indexOf(u);
|
|
1260
1260
|
for (var p = 0; p < h.length; p++)
|
|
1261
|
-
if (
|
|
1261
|
+
if (m(u, h[p]))
|
|
1262
1262
|
return p;
|
|
1263
1263
|
return -1;
|
|
1264
1264
|
}
|
|
1265
1265
|
function l(u, h) {
|
|
1266
1266
|
c(u, 0, u.children.length, h, u);
|
|
1267
1267
|
}
|
|
1268
|
-
function c(u, h,
|
|
1268
|
+
function c(u, h, m, p, w) {
|
|
1269
1269
|
w || (w = D(null)), w.minX = 1 / 0, w.minY = 1 / 0, w.maxX = -1 / 0, w.maxY = -1 / 0;
|
|
1270
|
-
for (var x = h; x <
|
|
1270
|
+
for (var x = h; x < m; x++) {
|
|
1271
1271
|
var v = u.children[x];
|
|
1272
1272
|
f(w, u.leaf ? p(v) : v);
|
|
1273
1273
|
}
|
|
@@ -1276,7 +1276,7 @@ var Jt = { exports: {} }, ne = { exports: {} };
|
|
|
1276
1276
|
function f(u, h) {
|
|
1277
1277
|
return u.minX = Math.min(u.minX, h.minX), u.minY = Math.min(u.minY, h.minY), u.maxX = Math.max(u.maxX, h.maxX), u.maxY = Math.max(u.maxY, h.maxY), u;
|
|
1278
1278
|
}
|
|
1279
|
-
function
|
|
1279
|
+
function g(u, h) {
|
|
1280
1280
|
return u.minX - h.minX;
|
|
1281
1281
|
}
|
|
1282
1282
|
function y(u, h) {
|
|
@@ -1297,41 +1297,41 @@ var Jt = { exports: {} }, ne = { exports: {} };
|
|
|
1297
1297
|
function D(u) {
|
|
1298
1298
|
return { children: u, height: 1, leaf: !0, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
|
|
1299
1299
|
}
|
|
1300
|
-
function O(u, h,
|
|
1301
|
-
for (var x = [h,
|
|
1302
|
-
if (!((
|
|
1303
|
-
var v = h + Math.ceil((
|
|
1304
|
-
r(u, v, h,
|
|
1300
|
+
function O(u, h, m, p, w) {
|
|
1301
|
+
for (var x = [h, m]; x.length; )
|
|
1302
|
+
if (!((m = x.pop()) - (h = x.pop()) <= p)) {
|
|
1303
|
+
var v = h + Math.ceil((m - h) / p / 2) * p;
|
|
1304
|
+
r(u, v, h, m, w), x.push(h, v, v, m);
|
|
1305
1305
|
}
|
|
1306
1306
|
}
|
|
1307
1307
|
return s.prototype.all = function() {
|
|
1308
1308
|
return this._all(this.data, []);
|
|
1309
1309
|
}, s.prototype.search = function(u) {
|
|
1310
|
-
var h = this.data,
|
|
1310
|
+
var h = this.data, m = [];
|
|
1311
1311
|
if (!L(u, h))
|
|
1312
|
-
return
|
|
1312
|
+
return m;
|
|
1313
1313
|
for (var p = this.toBBox, w = []; h; ) {
|
|
1314
1314
|
for (var x = 0; x < h.children.length; x++) {
|
|
1315
1315
|
var v = h.children[x], S = h.leaf ? p(v) : v;
|
|
1316
|
-
L(u, S) && (h.leaf ?
|
|
1316
|
+
L(u, S) && (h.leaf ? m.push(v) : k(u, S) ? this._all(v, m) : w.push(v));
|
|
1317
1317
|
}
|
|
1318
1318
|
h = w.pop();
|
|
1319
1319
|
}
|
|
1320
|
-
return
|
|
1320
|
+
return m;
|
|
1321
1321
|
}, s.prototype.collides = function(u) {
|
|
1322
1322
|
var h = this.data;
|
|
1323
1323
|
if (!L(u, h))
|
|
1324
1324
|
return !1;
|
|
1325
|
-
for (var
|
|
1325
|
+
for (var m = []; h; ) {
|
|
1326
1326
|
for (var p = 0; p < h.children.length; p++) {
|
|
1327
1327
|
var w = h.children[p], x = h.leaf ? this.toBBox(w) : w;
|
|
1328
1328
|
if (L(u, x)) {
|
|
1329
1329
|
if (h.leaf || k(u, x))
|
|
1330
1330
|
return !0;
|
|
1331
|
-
|
|
1331
|
+
m.push(w);
|
|
1332
1332
|
}
|
|
1333
1333
|
}
|
|
1334
|
-
h =
|
|
1334
|
+
h = m.pop();
|
|
1335
1335
|
}
|
|
1336
1336
|
return !1;
|
|
1337
1337
|
}, s.prototype.load = function(u) {
|
|
@@ -1342,19 +1342,19 @@ var Jt = { exports: {} }, ne = { exports: {} };
|
|
|
1342
1342
|
this.insert(u[h]);
|
|
1343
1343
|
return this;
|
|
1344
1344
|
}
|
|
1345
|
-
var
|
|
1345
|
+
var m = this._build(u.slice(), 0, u.length - 1, 0);
|
|
1346
1346
|
if (this.data.children.length)
|
|
1347
|
-
if (this.data.height ===
|
|
1348
|
-
this._splitRoot(this.data,
|
|
1347
|
+
if (this.data.height === m.height)
|
|
1348
|
+
this._splitRoot(this.data, m);
|
|
1349
1349
|
else {
|
|
1350
|
-
if (this.data.height <
|
|
1350
|
+
if (this.data.height < m.height) {
|
|
1351
1351
|
var p = this.data;
|
|
1352
|
-
this.data =
|
|
1352
|
+
this.data = m, m = p;
|
|
1353
1353
|
}
|
|
1354
|
-
this._insert(
|
|
1354
|
+
this._insert(m, this.data.height - m.height - 1, !0);
|
|
1355
1355
|
}
|
|
1356
1356
|
else
|
|
1357
|
-
this.data =
|
|
1357
|
+
this.data = m;
|
|
1358
1358
|
return this;
|
|
1359
1359
|
}, s.prototype.insert = function(u) {
|
|
1360
1360
|
return u && this._insert(u, this.data.height - 1), this;
|
|
@@ -1363,13 +1363,13 @@ var Jt = { exports: {} }, ne = { exports: {} };
|
|
|
1363
1363
|
}, s.prototype.remove = function(u, h) {
|
|
1364
1364
|
if (!u)
|
|
1365
1365
|
return this;
|
|
1366
|
-
for (var
|
|
1367
|
-
if (x || (x = S.pop(), p = S[S.length - 1],
|
|
1366
|
+
for (var m, p, w, x = this.data, v = this.toBBox(u), S = [], X = []; x || S.length; ) {
|
|
1367
|
+
if (x || (x = S.pop(), p = S[S.length - 1], m = X.pop(), w = !0), x.leaf) {
|
|
1368
1368
|
var Y = a(u, x.children, h);
|
|
1369
1369
|
if (Y !== -1)
|
|
1370
1370
|
return x.children.splice(Y, 1), S.push(x), this._condense(S), this;
|
|
1371
1371
|
}
|
|
1372
|
-
w || x.leaf || !k(x, v) ? p ? (
|
|
1372
|
+
w || x.leaf || !k(x, v) ? p ? (m++, x = p.children[m], w = !1) : x = null : (S.push(x), X.push(m), m = 0, p = x, x = x.children[0]);
|
|
1373
1373
|
}
|
|
1374
1374
|
return this;
|
|
1375
1375
|
}, s.prototype.toBBox = function(u) {
|
|
@@ -1383,73 +1383,73 @@ var Jt = { exports: {} }, ne = { exports: {} };
|
|
|
1383
1383
|
}, s.prototype.fromJSON = function(u) {
|
|
1384
1384
|
return this.data = u, this;
|
|
1385
1385
|
}, s.prototype._all = function(u, h) {
|
|
1386
|
-
for (var
|
|
1387
|
-
u.leaf ? h.push.apply(h, u.children) :
|
|
1386
|
+
for (var m = []; u; )
|
|
1387
|
+
u.leaf ? h.push.apply(h, u.children) : m.push.apply(m, u.children), u = m.pop();
|
|
1388
1388
|
return h;
|
|
1389
|
-
}, s.prototype._build = function(u, h,
|
|
1390
|
-
var w, x =
|
|
1389
|
+
}, s.prototype._build = function(u, h, m, p) {
|
|
1390
|
+
var w, x = m - h + 1, v = this._maxEntries;
|
|
1391
1391
|
if (x <= v)
|
|
1392
|
-
return l(w = D(u.slice(h,
|
|
1392
|
+
return l(w = D(u.slice(h, m + 1)), this.toBBox), w;
|
|
1393
1393
|
p || (p = Math.ceil(Math.log(x) / Math.log(v)), v = Math.ceil(x / Math.pow(v, p - 1))), (w = D([])).leaf = !1, w.height = p;
|
|
1394
1394
|
var S = Math.ceil(x / v), X = S * Math.ceil(Math.sqrt(v));
|
|
1395
|
-
O(u, h,
|
|
1396
|
-
for (var Y = h; Y <=
|
|
1397
|
-
var b = Math.min(Y + X - 1,
|
|
1395
|
+
O(u, h, m, X, this.compareMinX);
|
|
1396
|
+
for (var Y = h; Y <= m; Y += X) {
|
|
1397
|
+
var b = Math.min(Y + X - 1, m);
|
|
1398
1398
|
O(u, Y, b, S, this.compareMinY);
|
|
1399
|
-
for (var
|
|
1400
|
-
var R = Math.min(
|
|
1401
|
-
w.children.push(this._build(u,
|
|
1399
|
+
for (var N = Y; N <= b; N += S) {
|
|
1400
|
+
var R = Math.min(N + S - 1, b);
|
|
1401
|
+
w.children.push(this._build(u, N, R, p - 1));
|
|
1402
1402
|
}
|
|
1403
1403
|
}
|
|
1404
1404
|
return l(w, this.toBBox), w;
|
|
1405
|
-
}, s.prototype._chooseSubtree = function(u, h,
|
|
1406
|
-
for (; p.push(h), !h.leaf && p.length - 1 !==
|
|
1405
|
+
}, s.prototype._chooseSubtree = function(u, h, m, p) {
|
|
1406
|
+
for (; p.push(h), !h.leaf && p.length - 1 !== m; ) {
|
|
1407
1407
|
for (var w = 1 / 0, x = 1 / 0, v = void 0, S = 0; S < h.children.length; S++) {
|
|
1408
|
-
var X = h.children[S], Y = d(X), b = (
|
|
1408
|
+
var X = h.children[S], Y = d(X), b = (N = u, R = X, (Math.max(R.maxX, N.maxX) - Math.min(R.minX, N.minX)) * (Math.max(R.maxY, N.maxY) - Math.min(R.minY, N.minY)) - Y);
|
|
1409
1409
|
b < x ? (x = b, w = Y < w ? Y : w, v = X) : b === x && Y < w && (w = Y, v = X);
|
|
1410
1410
|
}
|
|
1411
1411
|
h = v || h.children[0];
|
|
1412
1412
|
}
|
|
1413
|
-
var
|
|
1413
|
+
var N, R;
|
|
1414
1414
|
return h;
|
|
1415
|
-
}, s.prototype._insert = function(u, h,
|
|
1416
|
-
var p =
|
|
1415
|
+
}, s.prototype._insert = function(u, h, m) {
|
|
1416
|
+
var p = m ? u : this.toBBox(u), w = [], x = this._chooseSubtree(p, this.data, h, w);
|
|
1417
1417
|
for (x.children.push(u), f(x, p); h >= 0 && w[h].children.length > this._maxEntries; )
|
|
1418
1418
|
this._split(w, h), h--;
|
|
1419
1419
|
this._adjustParentBBoxes(p, w, h);
|
|
1420
1420
|
}, s.prototype._split = function(u, h) {
|
|
1421
|
-
var
|
|
1422
|
-
this._chooseSplitAxis(
|
|
1423
|
-
var x = this._chooseSplitIndex(
|
|
1424
|
-
v.height =
|
|
1421
|
+
var m = u[h], p = m.children.length, w = this._minEntries;
|
|
1422
|
+
this._chooseSplitAxis(m, w, p);
|
|
1423
|
+
var x = this._chooseSplitIndex(m, w, p), v = D(m.children.splice(x, m.children.length - x));
|
|
1424
|
+
v.height = m.height, v.leaf = m.leaf, l(m, this.toBBox), l(v, this.toBBox), h ? u[h - 1].children.push(v) : this._splitRoot(m, v);
|
|
1425
1425
|
}, s.prototype._splitRoot = function(u, h) {
|
|
1426
1426
|
this.data = D([u, h]), this.data.height = u.height + 1, this.data.leaf = !1, l(this.data, this.toBBox);
|
|
1427
|
-
}, s.prototype._chooseSplitIndex = function(u, h,
|
|
1428
|
-
for (var p, w, x, v, S, X, Y, b = 1 / 0,
|
|
1429
|
-
var H = c(u, 0, R, this.toBBox),
|
|
1430
|
-
|
|
1427
|
+
}, s.prototype._chooseSplitIndex = function(u, h, m) {
|
|
1428
|
+
for (var p, w, x, v, S, X, Y, b = 1 / 0, N = 1 / 0, R = h; R <= m - h; R++) {
|
|
1429
|
+
var H = c(u, 0, R, this.toBBox), z = c(u, R, m, this.toBBox), E = (w = H, x = z, v = void 0, S = void 0, X = void 0, Y = void 0, v = Math.max(w.minX, x.minX), S = Math.max(w.minY, x.minY), X = Math.min(w.maxX, x.maxX), Y = Math.min(w.maxY, x.maxY), Math.max(0, X - v) * Math.max(0, Y - S)), q = d(H) + d(z);
|
|
1430
|
+
E < b ? (b = E, p = R, N = q < N ? q : N) : E === b && q < N && (N = q, p = R);
|
|
1431
1431
|
}
|
|
1432
|
-
return p ||
|
|
1433
|
-
}, s.prototype._chooseSplitAxis = function(u, h,
|
|
1434
|
-
var p = u.leaf ? this.compareMinX :
|
|
1435
|
-
this._allDistMargin(u, h,
|
|
1436
|
-
}, s.prototype._allDistMargin = function(u, h,
|
|
1432
|
+
return p || m - h;
|
|
1433
|
+
}, s.prototype._chooseSplitAxis = function(u, h, m) {
|
|
1434
|
+
var p = u.leaf ? this.compareMinX : g, w = u.leaf ? this.compareMinY : y;
|
|
1435
|
+
this._allDistMargin(u, h, m, p) < this._allDistMargin(u, h, m, w) && u.children.sort(p);
|
|
1436
|
+
}, s.prototype._allDistMargin = function(u, h, m, p) {
|
|
1437
1437
|
u.children.sort(p);
|
|
1438
|
-
for (var w = this.toBBox, x = c(u, 0, h, w), v = c(u,
|
|
1438
|
+
for (var w = this.toBBox, x = c(u, 0, h, w), v = c(u, m - h, m, w), S = M(x) + M(v), X = h; X < m - h; X++) {
|
|
1439
1439
|
var Y = u.children[X];
|
|
1440
1440
|
f(x, u.leaf ? w(Y) : Y), S += M(x);
|
|
1441
1441
|
}
|
|
1442
|
-
for (var b =
|
|
1443
|
-
var
|
|
1444
|
-
f(v, u.leaf ? w(
|
|
1442
|
+
for (var b = m - h - 1; b >= h; b--) {
|
|
1443
|
+
var N = u.children[b];
|
|
1444
|
+
f(v, u.leaf ? w(N) : N), S += M(v);
|
|
1445
1445
|
}
|
|
1446
1446
|
return S;
|
|
1447
|
-
}, s.prototype._adjustParentBBoxes = function(u, h,
|
|
1448
|
-
for (var p =
|
|
1447
|
+
}, s.prototype._adjustParentBBoxes = function(u, h, m) {
|
|
1448
|
+
for (var p = m; p >= 0; p--)
|
|
1449
1449
|
f(h[p], u);
|
|
1450
1450
|
}, s.prototype._condense = function(u) {
|
|
1451
|
-
for (var h = u.length - 1,
|
|
1452
|
-
u[h].children.length === 0 ? h > 0 ? (
|
|
1451
|
+
for (var h = u.length - 1, m = void 0; h >= 0; h--)
|
|
1452
|
+
u[h].children.length === 0 ? h > 0 ? (m = u[h - 1].children).splice(m.indexOf(u[h]), 1) : this.clear() : l(u[h], this.toBBox);
|
|
1453
1453
|
}, s;
|
|
1454
1454
|
});
|
|
1455
1455
|
})(ne);
|
|
@@ -1504,16 +1504,16 @@ const Ee = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1504
1504
|
var Pt = { exports: {} }, Oe = function(e, r, i, o) {
|
|
1505
1505
|
var s = e[0], a = e[1], l = !1;
|
|
1506
1506
|
i === void 0 && (i = 0), o === void 0 && (o = r.length);
|
|
1507
|
-
for (var c = (o - i) / 2, f = 0,
|
|
1508
|
-
var y = r[i + f * 2 + 0], d = r[i + f * 2 + 1], M = r[i +
|
|
1507
|
+
for (var c = (o - i) / 2, f = 0, g = c - 1; f < c; g = f++) {
|
|
1508
|
+
var y = r[i + f * 2 + 0], d = r[i + f * 2 + 1], M = r[i + g * 2 + 0], k = r[i + g * 2 + 1], L = d > a != k > a && s < (M - y) * (a - d) / (k - d) + y;
|
|
1509
1509
|
L && (l = !l);
|
|
1510
1510
|
}
|
|
1511
1511
|
return l;
|
|
1512
1512
|
}, Ce = function(e, r, i, o) {
|
|
1513
1513
|
var s = e[0], a = e[1], l = !1;
|
|
1514
1514
|
i === void 0 && (i = 0), o === void 0 && (o = r.length);
|
|
1515
|
-
for (var c = o - i, f = 0,
|
|
1516
|
-
var y = r[f + i][0], d = r[f + i][1], M = r[
|
|
1515
|
+
for (var c = o - i, f = 0, g = c - 1; f < c; g = f++) {
|
|
1516
|
+
var y = r[f + i][0], d = r[f + i][1], M = r[g + i][0], k = r[g + i][1], L = d > a != k > a && s < (M - y) * (a - d) / (k - d) + y;
|
|
1517
1517
|
L && (l = !l);
|
|
1518
1518
|
}
|
|
1519
1519
|
return l;
|
|
@@ -1530,49 +1530,49 @@ var be = Pt.exports, qt = { exports: {} };
|
|
|
1530
1530
|
})(re, function(r) {
|
|
1531
1531
|
const o = 33306690738754706e-32;
|
|
1532
1532
|
function s(L, D, O, u, h) {
|
|
1533
|
-
let
|
|
1534
|
-
S > v == S > -v ? (
|
|
1533
|
+
let m, p, w, x, v = D[0], S = u[0], X = 0, Y = 0;
|
|
1534
|
+
S > v == S > -v ? (m = v, v = D[++X]) : (m = S, S = u[++Y]);
|
|
1535
1535
|
let b = 0;
|
|
1536
1536
|
if (X < L && Y < O)
|
|
1537
|
-
for (S > v == S > -v ? (w =
|
|
1538
|
-
S > v == S > -v ? (w =
|
|
1537
|
+
for (S > v == S > -v ? (w = m - ((p = v + m) - v), v = D[++X]) : (w = m - ((p = S + m) - S), S = u[++Y]), m = p, w !== 0 && (h[b++] = w); X < L && Y < O; )
|
|
1538
|
+
S > v == S > -v ? (w = m - ((p = m + v) - (x = p - m)) + (v - x), v = D[++X]) : (w = m - ((p = m + S) - (x = p - m)) + (S - x), S = u[++Y]), m = p, w !== 0 && (h[b++] = w);
|
|
1539
1539
|
for (; X < L; )
|
|
1540
|
-
w =
|
|
1540
|
+
w = m - ((p = m + v) - (x = p - m)) + (v - x), v = D[++X], m = p, w !== 0 && (h[b++] = w);
|
|
1541
1541
|
for (; Y < O; )
|
|
1542
|
-
w =
|
|
1543
|
-
return
|
|
1542
|
+
w = m - ((p = m + S) - (x = p - m)) + (S - x), S = u[++Y], m = p, w !== 0 && (h[b++] = w);
|
|
1543
|
+
return m === 0 && b !== 0 || (h[b++] = m), b;
|
|
1544
1544
|
}
|
|
1545
1545
|
function a(L) {
|
|
1546
1546
|
return new Float64Array(L);
|
|
1547
1547
|
}
|
|
1548
|
-
const l = 33306690738754716e-32, c = 22204460492503146e-32, f = 11093356479670487e-47,
|
|
1549
|
-
r.orient2d = function(L, D, O, u, h,
|
|
1550
|
-
const p = (D -
|
|
1548
|
+
const l = 33306690738754716e-32, c = 22204460492503146e-32, f = 11093356479670487e-47, g = a(4), y = a(8), d = a(12), M = a(16), k = a(4);
|
|
1549
|
+
r.orient2d = function(L, D, O, u, h, m) {
|
|
1550
|
+
const p = (D - m) * (O - h), w = (L - h) * (u - m), x = p - w;
|
|
1551
1551
|
if (p === 0 || w === 0 || p > 0 != w > 0)
|
|
1552
1552
|
return x;
|
|
1553
1553
|
const v = Math.abs(p + w);
|
|
1554
|
-
return Math.abs(x) >= l * v ? x : -function(S, X, Y, b,
|
|
1555
|
-
let
|
|
1556
|
-
const tt = S -
|
|
1557
|
-
P = (j = ($ = tt - (
|
|
1554
|
+
return Math.abs(x) >= l * v ? x : -function(S, X, Y, b, N, R, H) {
|
|
1555
|
+
let z, E, q, F, P, C, A, $, J, T, B, G, I, Z, j, K, st, V;
|
|
1556
|
+
const tt = S - N, et = Y - N, rt = X - R, nt = b - R;
|
|
1557
|
+
P = (j = ($ = tt - (A = (C = 134217729 * tt) - (C - tt))) * (T = nt - (J = (C = 134217729 * nt) - (C - nt))) - ((Z = tt * nt) - A * J - $ * J - A * T)) - (B = j - (st = ($ = rt - (A = (C = 134217729 * rt) - (C - rt))) * (T = et - (J = (C = 134217729 * et) - (C - et))) - ((K = rt * et) - A * J - $ * J - A * T))), g[0] = j - (B + P) + (P - st), P = (I = Z - ((G = Z + B) - (P = G - Z)) + (B - P)) - (B = I - K), g[1] = I - (B + P) + (P - K), P = (V = G + B) - G, g[2] = G - (V - P) + (B - P), g[3] = V;
|
|
1558
1558
|
let at = function(he, Bt) {
|
|
1559
1559
|
let Rt = Bt[0];
|
|
1560
1560
|
for (let Lt = 1; Lt < he; Lt++)
|
|
1561
1561
|
Rt += Bt[Lt];
|
|
1562
1562
|
return Rt;
|
|
1563
|
-
}(4,
|
|
1564
|
-
if (at >= dt || -at >= dt || (
|
|
1563
|
+
}(4, g), dt = c * H;
|
|
1564
|
+
if (at >= dt || -at >= dt || (z = S - (tt + (P = S - tt)) + (P - N), q = Y - (et + (P = Y - et)) + (P - N), E = X - (rt + (P = X - rt)) + (P - R), F = b - (nt + (P = b - nt)) + (P - R), z === 0 && E === 0 && q === 0 && F === 0) || (dt = f * H + o * Math.abs(at), (at += tt * F + nt * z - (rt * q + et * E)) >= dt || -at >= dt))
|
|
1565
1565
|
return at;
|
|
1566
|
-
P = (j = ($ =
|
|
1567
|
-
const ce = s(4,
|
|
1568
|
-
P = (j = ($ = tt - (
|
|
1566
|
+
P = (j = ($ = z - (A = (C = 134217729 * z) - (C - z))) * (T = nt - (J = (C = 134217729 * nt) - (C - nt))) - ((Z = z * nt) - A * J - $ * J - A * T)) - (B = j - (st = ($ = E - (A = (C = 134217729 * E) - (C - E))) * (T = et - (J = (C = 134217729 * et) - (C - et))) - ((K = E * et) - A * J - $ * J - A * T))), k[0] = j - (B + P) + (P - st), P = (I = Z - ((G = Z + B) - (P = G - Z)) + (B - P)) - (B = I - K), k[1] = I - (B + P) + (P - K), P = (V = G + B) - G, k[2] = G - (V - P) + (B - P), k[3] = V;
|
|
1567
|
+
const ce = s(4, g, 4, k, y);
|
|
1568
|
+
P = (j = ($ = tt - (A = (C = 134217729 * tt) - (C - tt))) * (T = F - (J = (C = 134217729 * F) - (C - F))) - ((Z = tt * F) - A * J - $ * J - A * T)) - (B = j - (st = ($ = rt - (A = (C = 134217729 * rt) - (C - rt))) * (T = q - (J = (C = 134217729 * q) - (C - q))) - ((K = rt * q) - A * J - $ * J - A * T))), k[0] = j - (B + P) + (P - st), P = (I = Z - ((G = Z + B) - (P = G - Z)) + (B - P)) - (B = I - K), k[1] = I - (B + P) + (P - K), P = (V = G + B) - G, k[2] = G - (V - P) + (B - P), k[3] = V;
|
|
1569
1569
|
const ue = s(ce, y, 4, k, d);
|
|
1570
|
-
P = (j = ($ =
|
|
1570
|
+
P = (j = ($ = z - (A = (C = 134217729 * z) - (C - z))) * (T = F - (J = (C = 134217729 * F) - (C - F))) - ((Z = z * F) - A * J - $ * J - A * T)) - (B = j - (st = ($ = E - (A = (C = 134217729 * E) - (C - E))) * (T = q - (J = (C = 134217729 * q) - (C - q))) - ((K = E * q) - A * J - $ * J - A * T))), k[0] = j - (B + P) + (P - st), P = (I = Z - ((G = Z + B) - (P = G - Z)) + (B - P)) - (B = I - K), k[1] = I - (B + P) + (P - K), P = (V = G + B) - G, k[2] = G - (V - P) + (B - P), k[3] = V;
|
|
1571
1571
|
const fe = s(ue, d, 4, k, M);
|
|
1572
1572
|
return M[fe - 1];
|
|
1573
|
-
}(L, D, O, u, h,
|
|
1574
|
-
}, r.orient2dfast = function(L, D, O, u, h,
|
|
1575
|
-
return (D -
|
|
1573
|
+
}(L, D, O, u, h, m, v);
|
|
1574
|
+
}, r.orient2dfast = function(L, D, O, u, h, m) {
|
|
1575
|
+
return (D - m) * (O - h) - (L - h) * (u - m);
|
|
1576
1576
|
}, Object.defineProperty(r, "__esModule", { value: !0 });
|
|
1577
1577
|
});
|
|
1578
1578
|
})(qt, qt.exports);
|
|
@@ -1602,10 +1602,10 @@ function se(n, e, r) {
|
|
|
1602
1602
|
var f = new Ut(16);
|
|
1603
1603
|
for (a = 0; a < s.length; a++)
|
|
1604
1604
|
f.insert(Et(s[a]));
|
|
1605
|
-
for (var
|
|
1605
|
+
for (var g = e * e, y = r * r; s.length; ) {
|
|
1606
1606
|
var d = s.shift(), M = d.p, k = d.next.p, L = At(M, k);
|
|
1607
1607
|
if (!(L < y)) {
|
|
1608
|
-
var D = L /
|
|
1608
|
+
var D = L / g;
|
|
1609
1609
|
c = Fe(o, d.prev.p, M, k, d.next.next.p, D, f), c && Math.min(At(c, M), At(c, k)) <= D && (s.push(d), s.push(Ht(c, d)), o.remove(c), f.remove(d), f.insert(Et(d)), f.insert(Et(d.next)));
|
|
1610
1610
|
}
|
|
1611
1611
|
}
|
|
@@ -1619,9 +1619,9 @@ function se(n, e, r) {
|
|
|
1619
1619
|
function Fe(n, e, r, i, o, s, a) {
|
|
1620
1620
|
for (var l = new St([], Je), c = n.data; c; ) {
|
|
1621
1621
|
for (var f = 0; f < c.children.length; f++) {
|
|
1622
|
-
var
|
|
1622
|
+
var g = c.children[f], y = c.leaf ? Ot(g, r, i) : Be(r, i, g);
|
|
1623
1623
|
y > s || l.push({
|
|
1624
|
-
node:
|
|
1624
|
+
node: g,
|
|
1625
1625
|
dist: y
|
|
1626
1626
|
});
|
|
1627
1627
|
}
|
|
@@ -1706,9 +1706,9 @@ function Ot(n, e, r) {
|
|
|
1706
1706
|
return s = n[0] - i, a = n[1] - o, s * s + a * a;
|
|
1707
1707
|
}
|
|
1708
1708
|
function zt(n, e, r, i, o, s, a, l) {
|
|
1709
|
-
var c = r - n, f = i - e,
|
|
1710
|
-
h === 0 ? (p = 0, v = 1, x = u, S = D) : (p = L * u - D * O, x = k * u - L * O, p < 0 ? (p = 0, x = u, S = D) : p > v && (p = v, x = u + L, S = D)), x < 0 ? (x = 0, -O < 0 ? p = 0 : -O > k ? p = v : (p = -O, v = k)) : x > S && (x = S, -O + L < 0 ? p = 0 : -O + L > k ? p = v : (p = -O + L, v = k)),
|
|
1711
|
-
var X = (1 -
|
|
1709
|
+
var c = r - n, f = i - e, g = a - o, y = l - s, d = n - o, M = e - s, k = c * c + f * f, L = c * g + f * y, D = g * g + y * y, O = c * d + f * M, u = g * d + y * M, h = k * D - L * L, m, p, w, x, v = h, S = h;
|
|
1710
|
+
h === 0 ? (p = 0, v = 1, x = u, S = D) : (p = L * u - D * O, x = k * u - L * O, p < 0 ? (p = 0, x = u, S = D) : p > v && (p = v, x = u + L, S = D)), x < 0 ? (x = 0, -O < 0 ? p = 0 : -O > k ? p = v : (p = -O, v = k)) : x > S && (x = S, -O + L < 0 ? p = 0 : -O + L > k ? p = v : (p = -O + L, v = k)), m = p === 0 ? 0 : p / v, w = x === 0 ? 0 : x / S;
|
|
1711
|
+
var X = (1 - m) * n + m * r, Y = (1 - m) * e + m * i, b = (1 - w) * o + w * a, N = (1 - w) * s + w * l, R = b - X, H = N - Y;
|
|
1712
1712
|
return R * R + H * H;
|
|
1713
1713
|
}
|
|
1714
1714
|
function Ge(n, e) {
|
|
@@ -1747,14 +1747,14 @@ function ae(n, e, r) {
|
|
|
1747
1747
|
}
|
|
1748
1748
|
function He(n, e, r, i) {
|
|
1749
1749
|
i === void 0 && (i = {});
|
|
1750
|
-
var o = yt(n), s = it(o[0]), a = it(o[1]), l = it(r), c = Me(e, i.units), f = Math.asin(Math.sin(a) * Math.cos(c) + Math.cos(a) * Math.sin(c) * Math.cos(l)),
|
|
1750
|
+
var o = yt(n), s = it(o[0]), a = it(o[1]), l = it(r), c = Me(e, i.units), f = Math.asin(Math.sin(a) * Math.cos(c) + Math.cos(a) * Math.sin(c) * Math.cos(l)), g = s + Math.atan2(Math.sin(l) * Math.sin(c) * Math.cos(a), Math.cos(c) - Math.sin(a) * Math.sin(f)), y = Nt(g), d = Nt(f);
|
|
1751
1751
|
return ht([y, d], i.properties);
|
|
1752
1752
|
}
|
|
1753
1753
|
function le(n, e, r) {
|
|
1754
1754
|
if (r === void 0 && (r = {}), r.final === !0)
|
|
1755
1755
|
return Qe(n, e);
|
|
1756
|
-
var i = yt(n), o = yt(e), s = it(i[0]), a = it(o[0]), l = it(i[1]), c = it(o[1]), f = Math.sin(a - s) * Math.cos(c),
|
|
1757
|
-
return Nt(Math.atan2(f,
|
|
1756
|
+
var i = yt(n), o = yt(e), s = it(i[0]), a = it(o[0]), l = it(i[1]), c = it(o[1]), f = Math.sin(a - s) * Math.cos(c), g = Math.cos(l) * Math.sin(c) - Math.sin(l) * Math.cos(c) * Math.cos(a - s);
|
|
1757
|
+
return Nt(Math.atan2(f, g));
|
|
1758
1758
|
}
|
|
1759
1759
|
function Qe(n, e) {
|
|
1760
1760
|
var r = le(e, n);
|
|
@@ -1777,14 +1777,14 @@ function Ft(n, e) {
|
|
|
1777
1777
|
return ht(yt(n), e.properties);
|
|
1778
1778
|
case "Polygon":
|
|
1779
1779
|
var r = [];
|
|
1780
|
-
kt(n, function(
|
|
1781
|
-
r.push(
|
|
1780
|
+
kt(n, function(m) {
|
|
1781
|
+
r.push(m);
|
|
1782
1782
|
});
|
|
1783
|
-
var i = Qt(n, { properties: e.properties }), o = i.geometry.coordinates, s = 0, a = 0, l = 0, c, f,
|
|
1784
|
-
return [
|
|
1783
|
+
var i = Qt(n, { properties: e.properties }), o = i.geometry.coordinates, s = 0, a = 0, l = 0, c, f, g, y, d, M, k, L, D = r.map(function(m) {
|
|
1784
|
+
return [m[0] - o[0], m[1] - o[1]];
|
|
1785
1785
|
});
|
|
1786
1786
|
for (c = 0; c < r.length - 1; c++)
|
|
1787
|
-
f = D[c], y = f[0], M = f[1],
|
|
1787
|
+
f = D[c], y = f[0], M = f[1], g = D[c + 1], d = g[0], k = g[1], L = y * k - d * M, l += L, s += (y + d) * L, a += (M + k) * L;
|
|
1788
1788
|
if (l === 0)
|
|
1789
1789
|
return i;
|
|
1790
1790
|
var O = l * 0.5, u = 1 / (6 * O);
|
|
@@ -1839,7 +1839,7 @@ function bt(n) {
|
|
|
1839
1839
|
return n * Math.PI / 180;
|
|
1840
1840
|
}
|
|
1841
1841
|
function Ve(n) {
|
|
1842
|
-
let e = "free", r = "", i = [], o = [], s = {}, a = !1, l = !0, c = !1, f = [],
|
|
1842
|
+
let e = "free", r = "", i = [], o = [], s = {}, a = !1, l = !0, c = !1, f = [], g = { type: "FeatureCollection", features: [] }, y = {
|
|
1843
1843
|
type: "Feature",
|
|
1844
1844
|
properties: {},
|
|
1845
1845
|
geometry: {
|
|
@@ -1861,10 +1861,10 @@ function Ve(n) {
|
|
|
1861
1861
|
coordinates: []
|
|
1862
1862
|
}
|
|
1863
1863
|
};
|
|
1864
|
-
const k = (
|
|
1865
|
-
switch (n.off("click", h), n.off("mousemove", Y), n.off("contextmenu", p), v(), a &&
|
|
1864
|
+
const k = (z) => {
|
|
1865
|
+
switch (n.off("click", h), n.off("mousemove", Y), n.off("contextmenu", p), v(), a && (l = !0, n.scrollZoom.enable(), n.dragPan.enable(), n.doubleClickZoom.enable()), a = !0, e = z.type || "point", c = z.compute || !1, s = z, s.compute = c, y.properties = s, d.properties = s, M.properties = s, e) {
|
|
1866
1866
|
case "point":
|
|
1867
|
-
r = S(), i.push(r), o.push(r),
|
|
1867
|
+
r = S(), i.push(r), o.push(r), g.features.length = 0, n.addSource(r, { type: "geojson", data: g }), n.addLayer({
|
|
1868
1868
|
id: r,
|
|
1869
1869
|
type: "circle",
|
|
1870
1870
|
source: r,
|
|
@@ -1878,14 +1878,14 @@ function Ve(n) {
|
|
|
1878
1878
|
break;
|
|
1879
1879
|
}
|
|
1880
1880
|
n.on("click", h), n.getCanvas().style.cursor = "crosshair";
|
|
1881
|
-
}, L = (
|
|
1882
|
-
|
|
1881
|
+
}, L = (z) => {
|
|
1882
|
+
g.features.push({
|
|
1883
1883
|
type: "Feature",
|
|
1884
1884
|
properties: s,
|
|
1885
|
-
geometry: { type: "Point", coordinates:
|
|
1886
|
-
}), n.getSource(r).setData(JSON.parse(JSON.stringify(
|
|
1887
|
-
}, D = (
|
|
1888
|
-
l && (r = S(), i.push(r), o.push(r), y.geometry.coordinates.length = 0,
|
|
1885
|
+
geometry: { type: "Point", coordinates: z.lngLat.toArray() }
|
|
1886
|
+
}), n.getSource(r).setData(JSON.parse(JSON.stringify(g)));
|
|
1887
|
+
}, D = (z) => {
|
|
1888
|
+
l && (r = S(), i.push(r), o.push(r), y.geometry.coordinates.length = 0, g.features.length = 0, n.addSource(r, { type: "geojson", data: y }), n.addSource(r + "text", { type: "geojson", data: g }), n.addLayer({
|
|
1889
1889
|
id: r,
|
|
1890
1890
|
type: "line",
|
|
1891
1891
|
source: r,
|
|
@@ -1919,12 +1919,12 @@ function Ve(n) {
|
|
|
1919
1919
|
"text-overlap": "always",
|
|
1920
1920
|
visibility: c ? "visible" : "none"
|
|
1921
1921
|
}
|
|
1922
|
-
}), l = !1, n.on("mousemove", Y), n.on("contextmenu", p)), y.geometry.coordinates.push(
|
|
1922
|
+
}), l = !1, n.on("mousemove", Y), n.on("contextmenu", p)), y.geometry.coordinates.push(z.lngLat.toArray()), n.getSource(r).setData(y), g.features.push({
|
|
1923
1923
|
type: "Feature",
|
|
1924
1924
|
properties: { name: 0 },
|
|
1925
|
-
geometry: { type: "Point", coordinates:
|
|
1926
|
-
}), n.getSource(r + "text").setData(
|
|
1927
|
-
}, O = (
|
|
1925
|
+
geometry: { type: "Point", coordinates: z.lngLat.toArray() }
|
|
1926
|
+
}), n.getSource(r + "text").setData(g);
|
|
1927
|
+
}, O = (z) => {
|
|
1928
1928
|
l && (r = S(), i.push(r), o.push(r), d.geometry.coordinates.length = 0, d.geometry.coordinates[0] = [], n.addSource(r, { type: "geojson", data: d }), n.addSource(r + "area", { type: "geojson", data: M }), n.addLayer({
|
|
1929
1929
|
id: r,
|
|
1930
1930
|
type: "fill",
|
|
@@ -1970,8 +1970,8 @@ function Ve(n) {
|
|
|
1970
1970
|
"text-overlap": "always",
|
|
1971
1971
|
visibility: c ? "visible" : "none"
|
|
1972
1972
|
}
|
|
1973
|
-
}), l = !1, n.on("mousemove", Y), n.on("contextmenu", p)), d.geometry.coordinates[0].length >= 3 && d.geometry.coordinates[0].pop(), d.geometry.coordinates[0].push(
|
|
1974
|
-
}, u = (
|
|
1973
|
+
}), l = !1, n.on("mousemove", Y), n.on("contextmenu", p)), d.geometry.coordinates[0].length >= 3 && d.geometry.coordinates[0].pop(), d.geometry.coordinates[0].push(z.lngLat.toArray()), d.geometry.coordinates[0].push(d.geometry.coordinates[0][0]), n.getSource(r).setData(d);
|
|
1974
|
+
}, u = (z) => {
|
|
1975
1975
|
l && (r = S(), i.push(r), o.push(r), d.geometry.coordinates.length = 0, d.geometry.coordinates[0] = [], f.length = 0, n.addSource(r, { type: "geojson", data: d }), n.addSource(r + "area", { type: "geojson", data: M }), n.addLayer({
|
|
1976
1976
|
id: r,
|
|
1977
1977
|
type: "fill",
|
|
@@ -2006,39 +2006,39 @@ function Ve(n) {
|
|
|
2006
2006
|
"text-overlap": "always",
|
|
2007
2007
|
visibility: c ? "visible" : "none"
|
|
2008
2008
|
}
|
|
2009
|
-
}), l = !1, d.geometry.coordinates[0].push(
|
|
2010
|
-
}, h = (
|
|
2009
|
+
}), l = !1, d.geometry.coordinates[0].push(z.lngLat.toArray()), n.getSource(r).setData(d), n.on("mousemove", Y), n.on("contextmenu", p), n.scrollZoom.disable(), n.dragPan.disable(), n.doubleClickZoom.disable());
|
|
2010
|
+
}, h = (z) => {
|
|
2011
2011
|
switch (e) {
|
|
2012
2012
|
case "point":
|
|
2013
|
-
L(
|
|
2013
|
+
L(z);
|
|
2014
2014
|
break;
|
|
2015
2015
|
case "line":
|
|
2016
|
-
D(
|
|
2016
|
+
D(z);
|
|
2017
2017
|
break;
|
|
2018
2018
|
case "polygon":
|
|
2019
|
-
O(
|
|
2019
|
+
O(z);
|
|
2020
2020
|
break;
|
|
2021
2021
|
case "free":
|
|
2022
|
-
u(
|
|
2022
|
+
u(z);
|
|
2023
2023
|
break;
|
|
2024
2024
|
}
|
|
2025
|
-
},
|
|
2025
|
+
}, m = (z) => {
|
|
2026
2026
|
switch (e) {
|
|
2027
2027
|
case "line":
|
|
2028
2028
|
if (y.geometry.coordinates.length) {
|
|
2029
|
-
y.geometry.coordinates.length == 1 && y.geometry.coordinates.push(
|
|
2030
|
-
const
|
|
2031
|
-
|
|
2029
|
+
y.geometry.coordinates.length == 1 && y.geometry.coordinates.push(z.lngLat.toArray()), y.geometry.coordinates[y.geometry.coordinates.length - 1] = z.lngLat.toArray(), n.getSource(r).setData(y);
|
|
2030
|
+
const A = y.geometry.coordinates[y.geometry.coordinates.length - 2], $ = y.geometry.coordinates[y.geometry.coordinates.length - 1], J = ae(A, $, { units: "kilometers" }), T = je(ht(A), ht($)), B = g.features[g.features.length - 1];
|
|
2031
|
+
B.properties.distance = _t(J, 4) + "km", B.geometry.coordinates = T.geometry.coordinates, n.getSource(r + "text").setData(JSON.parse(JSON.stringify(g)));
|
|
2032
2032
|
}
|
|
2033
2033
|
break;
|
|
2034
2034
|
case "polygon":
|
|
2035
|
-
const
|
|
2036
|
-
if (
|
|
2037
|
-
|
|
2035
|
+
const F = d.geometry.coordinates[0].length;
|
|
2036
|
+
if (F) {
|
|
2037
|
+
F == 2 ? d.geometry.coordinates[0][F - 1] = z.lngLat.toArray() : d.geometry.coordinates[0][F - 2] = z.lngLat.toArray();
|
|
2038
2038
|
const C = Ct(d) / 1e6;
|
|
2039
|
-
if (
|
|
2040
|
-
var
|
|
2041
|
-
M.geometry.coordinates =
|
|
2039
|
+
if (F >= 4) {
|
|
2040
|
+
var E = Dt(d.geometry.coordinates), q = Ft(E);
|
|
2041
|
+
M.geometry.coordinates = q.geometry.coordinates, M.properties.area = _t(C, 2) + "km²";
|
|
2042
2042
|
}
|
|
2043
2043
|
n.getSource(r).setData(d), n.getSource(r + "area").setData(M);
|
|
2044
2044
|
}
|
|
@@ -2046,98 +2046,98 @@ function Ve(n) {
|
|
|
2046
2046
|
case "free":
|
|
2047
2047
|
const P = d.geometry.coordinates[0].length;
|
|
2048
2048
|
if (P) {
|
|
2049
|
-
f.push(
|
|
2049
|
+
f.push(z.point), d.geometry.coordinates[0].length != 1 && d.geometry.coordinates[0].pop(), d.geometry.coordinates[0].push(z.lngLat.toArray()), d.geometry.coordinates[0].push(d.geometry.coordinates[0][0]);
|
|
2050
2050
|
const C = Ct(d) / 1e6;
|
|
2051
2051
|
if (P >= 4) {
|
|
2052
|
-
var
|
|
2053
|
-
M.geometry.coordinates =
|
|
2052
|
+
var E = Dt(d.geometry.coordinates), q = Ft(E);
|
|
2053
|
+
M.geometry.coordinates = q.geometry.coordinates, M.properties.area = _t(C, 2) + "km²";
|
|
2054
2054
|
}
|
|
2055
2055
|
n.getSource(r).setData(d), n.getSource(r + "area").setData(M);
|
|
2056
2056
|
}
|
|
2057
2057
|
break;
|
|
2058
2058
|
}
|
|
2059
|
-
}, p = () => {
|
|
2060
|
-
n.off("mousemove", Y), n.off("contextmenu", p), l = !0, n.scrollZoom.enable(), n.dragPan.enable(), n.doubleClickZoom.enable();
|
|
2061
|
-
const
|
|
2059
|
+
}, p = (z) => {
|
|
2060
|
+
z.preventDefault(), n.off("mousemove", Y), n.off("contextmenu", p), l = !0, n.scrollZoom.enable(), n.dragPan.enable(), n.doubleClickZoom.enable();
|
|
2061
|
+
const E = n.getSource(r);
|
|
2062
2062
|
switch (e) {
|
|
2063
2063
|
case "line":
|
|
2064
|
-
y.geometry.coordinates.length &&
|
|
2064
|
+
y.geometry.coordinates.length && E.setData(JSON.parse(JSON.stringify(y)));
|
|
2065
2065
|
break;
|
|
2066
2066
|
case "polygon":
|
|
2067
|
-
d.geometry.coordinates[0].length &&
|
|
2067
|
+
d.geometry.coordinates[0].length && E.setData(JSON.parse(JSON.stringify(d)));
|
|
2068
2068
|
break;
|
|
2069
2069
|
case "free":
|
|
2070
2070
|
if (d.geometry.coordinates[0].length) {
|
|
2071
|
-
if (
|
|
2071
|
+
if (E.setData(JSON.parse(JSON.stringify(d))), R(f)) {
|
|
2072
2072
|
alert("落区自相交,请重画"), i.pop(), o.pop(), n.removeLayer(r), n.removeLayer(r + "outline"), n.removeLayer(r + "area"), n.removeSource(r), n.removeSource(r + "area");
|
|
2073
2073
|
return;
|
|
2074
2074
|
}
|
|
2075
|
-
const
|
|
2076
|
-
|
|
2077
|
-
for (let
|
|
2078
|
-
const
|
|
2079
|
-
d.geometry.coordinates[0].push(
|
|
2075
|
+
const q = [...f.slice(f.length / 5), ...f.slice(0, f.length / 5)], P = new U(q).getLUT();
|
|
2076
|
+
P.push(P[0]), d.geometry.coordinates[0].length = 0;
|
|
2077
|
+
for (let $ = 0; $ < P.length; $++) {
|
|
2078
|
+
const J = n.unproject(P[$]);
|
|
2079
|
+
d.geometry.coordinates[0].push(J.toArray());
|
|
2080
2080
|
}
|
|
2081
|
-
|
|
2082
|
-
const
|
|
2083
|
-
M.properties.area = _t(
|
|
2081
|
+
E.setData(JSON.parse(JSON.stringify(d)));
|
|
2082
|
+
const C = Ct(d) / 1e6;
|
|
2083
|
+
M.properties.area = _t(C, 2) + "km²", n.getSource(r + "area").setData(JSON.parse(JSON.stringify(M)));
|
|
2084
2084
|
}
|
|
2085
2085
|
break;
|
|
2086
2086
|
}
|
|
2087
2087
|
}, w = () => {
|
|
2088
|
-
const
|
|
2089
|
-
return
|
|
2090
|
-
const
|
|
2091
|
-
|
|
2092
|
-
}),
|
|
2088
|
+
const z = o.slice(0, i.length), E = [];
|
|
2089
|
+
return z.forEach((q) => {
|
|
2090
|
+
const F = n.getSource(q);
|
|
2091
|
+
E.push(F.serialize().data);
|
|
2092
|
+
}), E;
|
|
2093
2093
|
}, x = () => {
|
|
2094
|
-
i.forEach((
|
|
2095
|
-
n.removeLayer(
|
|
2096
|
-
}), o.forEach((
|
|
2097
|
-
n.removeSource(
|
|
2094
|
+
i.forEach((z) => {
|
|
2095
|
+
n.removeLayer(z), n.getLayer(z + "outline") && n.removeLayer(z + "outline"), n.getLayer(z + "point") && n.removeLayer(z + "point"), n.getLayer(z + "area") && n.removeLayer(z + "area"), n.getLayer(z + "text") && n.removeLayer(z + "text");
|
|
2096
|
+
}), o.forEach((z) => {
|
|
2097
|
+
n.removeSource(z), n.getSource(z + "text") && n.removeSource(z + "text"), n.getSource(z + "area") && n.removeSource(z + "area");
|
|
2098
2098
|
}), i.length = 0, o.length = 0, n.off("click", h), n.off("mousemove", Y), n.off("contextmenu", p), n.getCanvas().style.cursor = "pointer", a = !1, v();
|
|
2099
2099
|
}, v = () => {
|
|
2100
|
-
|
|
2100
|
+
g.features.length = 0, y.geometry.coordinates.length = 0, d.geometry.coordinates.length = 0, d.geometry.coordinates[0] = [], M.geometry.coordinates.length = 0;
|
|
2101
2101
|
}, S = () => {
|
|
2102
|
-
let
|
|
2103
|
-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(
|
|
2104
|
-
const
|
|
2105
|
-
return
|
|
2102
|
+
let z = (/* @__PURE__ */ new Date()).getTime();
|
|
2103
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(q) {
|
|
2104
|
+
const F = (z + Math.random() * 16) % 16 | 0;
|
|
2105
|
+
return z = Math.floor(z / 16), (q === "x" ? F : F & 3 | 8).toString(16);
|
|
2106
2106
|
});
|
|
2107
|
-
}, Y = ((
|
|
2108
|
-
let
|
|
2109
|
-
return function(...
|
|
2107
|
+
}, Y = ((z, E) => {
|
|
2108
|
+
let q = 0;
|
|
2109
|
+
return function(...F) {
|
|
2110
2110
|
const P = (/* @__PURE__ */ new Date()).getTime();
|
|
2111
|
-
P -
|
|
2111
|
+
P - q < E || (q = P, z(...F));
|
|
2112
2112
|
};
|
|
2113
|
-
})(
|
|
2113
|
+
})(m, 20), b = () => {
|
|
2114
2114
|
e == "free" && i.length && (n.removeLayer(i[i.length - 1]), n.removeLayer(i[i.length - 1] + "outline"), n.getLayer(i[i.length - 1] + "area") && n.removeLayer(i[i.length - 1] + "area"), i.pop());
|
|
2115
|
-
},
|
|
2115
|
+
}, N = () => {
|
|
2116
2116
|
if (e == "free" && o.length) {
|
|
2117
|
-
const
|
|
2118
|
-
if (
|
|
2119
|
-
const P = n.getSource(
|
|
2120
|
-
n.getLayer(
|
|
2121
|
-
id:
|
|
2117
|
+
const z = i.length - o.length, E = o.slice(z);
|
|
2118
|
+
if (z !== 0 && E.length) {
|
|
2119
|
+
const P = n.getSource(E[0]).serialize().data.valueOf();
|
|
2120
|
+
n.getLayer(E[0]) || (i.push(E[0]), n.addLayer({
|
|
2121
|
+
id: E[0],
|
|
2122
2122
|
type: "fill",
|
|
2123
|
-
source:
|
|
2123
|
+
source: E[0],
|
|
2124
2124
|
paint: {
|
|
2125
2125
|
"fill-color": P.properties.fillColor || "#ff0",
|
|
2126
2126
|
"fill-opacity": 0.8,
|
|
2127
2127
|
"fill-outline-color": "black"
|
|
2128
2128
|
}
|
|
2129
2129
|
}), n.addLayer({
|
|
2130
|
-
id:
|
|
2130
|
+
id: E[0] + "outline",
|
|
2131
2131
|
type: "line",
|
|
2132
|
-
source:
|
|
2132
|
+
source: E[0],
|
|
2133
2133
|
paint: {
|
|
2134
2134
|
"line-width": 2,
|
|
2135
2135
|
"line-color": "black"
|
|
2136
2136
|
}
|
|
2137
2137
|
}), n.addLayer({
|
|
2138
|
-
id:
|
|
2138
|
+
id: E[0] + "area",
|
|
2139
2139
|
type: "symbol",
|
|
2140
|
-
source:
|
|
2140
|
+
source: E[0] + "area",
|
|
2141
2141
|
layout: {
|
|
2142
2142
|
"text-field": ["get", "area"],
|
|
2143
2143
|
// 'text-field': '456',
|
|
@@ -2149,37 +2149,37 @@ function Ve(n) {
|
|
|
2149
2149
|
}));
|
|
2150
2150
|
}
|
|
2151
2151
|
}
|
|
2152
|
-
}, R = (
|
|
2153
|
-
let
|
|
2154
|
-
for (let
|
|
2155
|
-
let $ =
|
|
2156
|
-
($.x !=
|
|
2152
|
+
}, R = (z) => {
|
|
2153
|
+
let E = !1, q = z, F = [], P = q.length - 1;
|
|
2154
|
+
for (let A = 0; A < P; A++) {
|
|
2155
|
+
let $ = q[A], J = q[A + 1];
|
|
2156
|
+
($.x != J.x || $.y != J.y) && F.push($);
|
|
2157
2157
|
}
|
|
2158
|
-
let C =
|
|
2159
|
-
for (let
|
|
2160
|
-
let $ =
|
|
2161
|
-
for (let T =
|
|
2162
|
-
let
|
|
2163
|
-
if (I == null &&
|
|
2164
|
-
|
|
2158
|
+
let C = F.length - 1;
|
|
2159
|
+
for (let A = 0; A < C; A++) {
|
|
2160
|
+
let $ = F[A], J = F[A + 1];
|
|
2161
|
+
for (let T = A + 2; T < C; T++) {
|
|
2162
|
+
let B = F[T], G = F[T + 1], I = H($, J, B, G);
|
|
2163
|
+
if (I == null && J.x == G.x && J.y == G.y && (I = { x: J.x, y: J.y }), I != null) {
|
|
2164
|
+
E = !0;
|
|
2165
2165
|
break;
|
|
2166
2166
|
}
|
|
2167
2167
|
}
|
|
2168
|
-
if (
|
|
2168
|
+
if (E)
|
|
2169
2169
|
break;
|
|
2170
2170
|
}
|
|
2171
|
-
return
|
|
2172
|
-
}, H = (
|
|
2173
|
-
var P = null, C = (
|
|
2174
|
-
if (C *
|
|
2171
|
+
return E;
|
|
2172
|
+
}, H = (z, E, q, F) => {
|
|
2173
|
+
var P = null, C = (z.x - q.x) * (E.y - q.y) - (z.y - q.y) * (E.x - q.x), A = (z.x - F.x) * (E.y - F.y) - (z.y - F.y) * (E.x - F.x);
|
|
2174
|
+
if (C * A >= 0)
|
|
2175
2175
|
return P;
|
|
2176
|
-
var $ = (
|
|
2177
|
-
if ($ *
|
|
2176
|
+
var $ = (q.x - z.x) * (F.y - z.y) - (q.y - z.y) * (F.x - z.x), J = $ + C - A;
|
|
2177
|
+
if ($ * J >= 0)
|
|
2178
2178
|
return P;
|
|
2179
|
-
var T = $ / (
|
|
2180
|
-
return P = { x:
|
|
2179
|
+
var T = $ / (A - C), B = T * (E.x - z.x), G = T * (E.y - z.y);
|
|
2180
|
+
return P = { x: z.x + B, y: z.y + G }, P;
|
|
2181
2181
|
};
|
|
2182
|
-
return { isDraw: a, start: k, getFeatures: w, clear: x, revoke: b, redo:
|
|
2182
|
+
return { isDraw: a, start: k, getFeatures: w, clear: x, revoke: b, redo: N };
|
|
2183
2183
|
}
|
|
2184
2184
|
export {
|
|
2185
2185
|
Ve as draw
|