@maplat/tin 1.1.1 → 1.1.2-rc.2
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/README.ja.md +6 -6
- package/README.md +6 -6
- package/dist/boundary-vertices.d.ts +1 -1
- package/dist/edge-nodes.d.ts +27 -0
- package/dist/edgebound/constrain.d.ts +23 -2
- package/dist/edgebound/index.d.ts +4 -4
- package/dist/index.d.ts +11 -11
- package/dist/kinks.d.ts +20 -0
- package/dist/maplat_tin.js +1533 -1420
- package/dist/maplat_tin.umd.js +3 -3
- package/dist/strict-overlap.d.ts +1 -1
- package/dist/tin.d.ts +5 -2
- package/dist/types/kinks.d.ts +12 -0
- package/dist/types/tin.d.ts +49 -0
- package/package.json +6 -7
- package/src/boundary-vertices.ts +1 -1
- package/src/constrained-tin.ts +1 -1
- package/src/edge-nodes.ts +126 -0
- package/src/edgebound/constrain.ts +74 -0
- package/src/index.ts +2 -2
- package/src/kinks.ts +76 -42
- package/src/tin.ts +45 -91
- package/src/types/kinks.ts +24 -0
- package/src/types/kinks.d.ts +0 -51
- /package/src/types/{tin.d.ts → tin.ts} +0 -0
package/dist/maplat_tin.js
CHANGED
|
@@ -2,7 +2,7 @@ function oe(e, t, n = {}) {
|
|
|
2
2
|
const i = { type: "Feature" };
|
|
3
3
|
return (n.id === 0 || n.id) && (i.id = n.id), n.bbox && (i.bbox = n.bbox), i.properties = t || {}, i.geometry = e, i;
|
|
4
4
|
}
|
|
5
|
-
function
|
|
5
|
+
function Yt(e, t, n = {}) {
|
|
6
6
|
if (!e)
|
|
7
7
|
throw new Error("coordinates is required");
|
|
8
8
|
if (!Array.isArray(e))
|
|
@@ -41,14 +41,14 @@ function He(e, t, n = {}) {
|
|
|
41
41
|
coordinates: e
|
|
42
42
|
}, t, n);
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function Et(e, t = {}) {
|
|
45
45
|
const n = { type: "FeatureCollection" };
|
|
46
46
|
return t.id && (n.id = t.id), t.bbox && (n.bbox = t.bbox), n.features = e, n;
|
|
47
47
|
}
|
|
48
48
|
function We(e) {
|
|
49
49
|
return !isNaN(e) && e !== null && !Array.isArray(e);
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function oi(e) {
|
|
52
52
|
if (!e)
|
|
53
53
|
throw new Error("coord is required");
|
|
54
54
|
if (!Array.isArray(e)) {
|
|
@@ -61,100 +61,100 @@ function ni(e) {
|
|
|
61
61
|
return [...e];
|
|
62
62
|
throw new Error("coord must be GeoJSON Point or an Array of numbers");
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function si(e) {
|
|
65
65
|
return e.type === "Feature" ? e.geometry : e;
|
|
66
66
|
}
|
|
67
67
|
function ze(e, t, n) {
|
|
68
68
|
if (e !== null)
|
|
69
|
-
for (var i, o, r, s, a,
|
|
70
|
-
|
|
69
|
+
for (var i, o, r, s, a, c, f, h = 0, l = 0, u, p = e.type, _ = p === "FeatureCollection", w = p === "Feature", O = _ ? e.features.length : 1, M = 0; M < O; M++) {
|
|
70
|
+
f = _ ? (
|
|
71
71
|
// @ts-expect-error: Known type conflict
|
|
72
|
-
e.features[
|
|
72
|
+
e.features[M].geometry
|
|
73
73
|
) : w ? (
|
|
74
74
|
// @ts-expect-error: Known type conflict
|
|
75
75
|
e.geometry
|
|
76
|
-
) : e,
|
|
76
|
+
) : e, u = f ? f.type === "GeometryCollection" : !1, a = u ? f.geometries.length : 1;
|
|
77
77
|
for (var m = 0; m < a; m++) {
|
|
78
|
-
var
|
|
79
|
-
if (s =
|
|
80
|
-
|
|
81
|
-
var
|
|
82
|
-
switch (
|
|
78
|
+
var v = 0, d = 0;
|
|
79
|
+
if (s = u ? f.geometries[m] : f, s !== null) {
|
|
80
|
+
c = s.coordinates;
|
|
81
|
+
var b = s.type;
|
|
82
|
+
switch (h = n && (b === "Polygon" || b === "MultiPolygon") ? 1 : 0, b) {
|
|
83
83
|
case null:
|
|
84
84
|
break;
|
|
85
85
|
case "Point":
|
|
86
86
|
if (
|
|
87
87
|
// @ts-expect-error: Known type conflict
|
|
88
88
|
t(
|
|
89
|
-
h,
|
|
90
89
|
c,
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
l,
|
|
91
|
+
M,
|
|
92
|
+
v,
|
|
93
93
|
d
|
|
94
94
|
) === !1
|
|
95
95
|
)
|
|
96
96
|
return !1;
|
|
97
|
-
|
|
97
|
+
l++, v++;
|
|
98
98
|
break;
|
|
99
99
|
case "LineString":
|
|
100
100
|
case "MultiPoint":
|
|
101
|
-
for (i = 0; i <
|
|
101
|
+
for (i = 0; i < c.length; i++) {
|
|
102
102
|
if (
|
|
103
103
|
// @ts-expect-error: Known type conflict
|
|
104
104
|
t(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
c[i],
|
|
106
|
+
l,
|
|
107
|
+
M,
|
|
108
|
+
v,
|
|
109
109
|
d
|
|
110
110
|
) === !1
|
|
111
111
|
)
|
|
112
112
|
return !1;
|
|
113
|
-
|
|
113
|
+
l++, b === "MultiPoint" && v++;
|
|
114
114
|
}
|
|
115
|
-
|
|
115
|
+
b === "LineString" && v++;
|
|
116
116
|
break;
|
|
117
117
|
case "Polygon":
|
|
118
118
|
case "MultiLineString":
|
|
119
|
-
for (i = 0; i <
|
|
120
|
-
for (o = 0; o <
|
|
119
|
+
for (i = 0; i < c.length; i++) {
|
|
120
|
+
for (o = 0; o < c[i].length - h; o++) {
|
|
121
121
|
if (
|
|
122
122
|
// @ts-expect-error: Known type conflict
|
|
123
123
|
t(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
c[i][o],
|
|
125
|
+
l,
|
|
126
|
+
M,
|
|
127
|
+
v,
|
|
128
128
|
d
|
|
129
129
|
) === !1
|
|
130
130
|
)
|
|
131
131
|
return !1;
|
|
132
|
-
|
|
132
|
+
l++;
|
|
133
133
|
}
|
|
134
|
-
|
|
134
|
+
b === "MultiLineString" && v++, b === "Polygon" && d++;
|
|
135
135
|
}
|
|
136
|
-
|
|
136
|
+
b === "Polygon" && v++;
|
|
137
137
|
break;
|
|
138
138
|
case "MultiPolygon":
|
|
139
|
-
for (i = 0; i <
|
|
140
|
-
for (d = 0, o = 0; o <
|
|
141
|
-
for (r = 0; r <
|
|
139
|
+
for (i = 0; i < c.length; i++) {
|
|
140
|
+
for (d = 0, o = 0; o < c[i].length; o++) {
|
|
141
|
+
for (r = 0; r < c[i][o].length - h; r++) {
|
|
142
142
|
if (
|
|
143
143
|
// @ts-expect-error: Known type conflict
|
|
144
144
|
t(
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
145
|
+
c[i][o][r],
|
|
146
|
+
l,
|
|
147
|
+
M,
|
|
148
|
+
v,
|
|
149
149
|
d
|
|
150
150
|
) === !1
|
|
151
151
|
)
|
|
152
152
|
return !1;
|
|
153
|
-
|
|
153
|
+
l++;
|
|
154
154
|
}
|
|
155
155
|
d++;
|
|
156
156
|
}
|
|
157
|
-
|
|
157
|
+
v++;
|
|
158
158
|
}
|
|
159
159
|
break;
|
|
160
160
|
case "GeometryCollection":
|
|
@@ -172,35 +172,35 @@ function ze(e, t, n) {
|
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
const pt = 11102230246251565e-32,
|
|
176
|
-
function
|
|
177
|
-
let r, s, a,
|
|
178
|
-
|
|
175
|
+
const pt = 11102230246251565e-32, q = 134217729, Ln = (3 + 8 * pt) * pt;
|
|
176
|
+
function ht(e, t, n, i, o) {
|
|
177
|
+
let r, s, a, c, f = t[0], h = i[0], l = 0, u = 0;
|
|
178
|
+
h > f == h > -f ? (r = f, f = t[++l]) : (r = h, h = i[++u]);
|
|
179
179
|
let p = 0;
|
|
180
|
-
if (
|
|
181
|
-
for (
|
|
182
|
-
|
|
183
|
-
for (;
|
|
184
|
-
s = r +
|
|
185
|
-
for (;
|
|
186
|
-
s = r +
|
|
180
|
+
if (l < e && u < n)
|
|
181
|
+
for (h > f == h > -f ? (s = f + r, a = r - (s - f), f = t[++l]) : (s = h + r, a = r - (s - h), h = i[++u]), r = s, a !== 0 && (o[p++] = a); l < e && u < n; )
|
|
182
|
+
h > f == h > -f ? (s = r + f, c = s - r, a = r - (s - c) + (f - c), f = t[++l]) : (s = r + h, c = s - r, a = r - (s - c) + (h - c), h = i[++u]), r = s, a !== 0 && (o[p++] = a);
|
|
183
|
+
for (; l < e; )
|
|
184
|
+
s = r + f, c = s - r, a = r - (s - c) + (f - c), f = t[++l], r = s, a !== 0 && (o[p++] = a);
|
|
185
|
+
for (; u < n; )
|
|
186
|
+
s = r + h, c = s - r, a = r - (s - c) + (h - c), h = i[++u], r = s, a !== 0 && (o[p++] = a);
|
|
187
187
|
return (r !== 0 || p === 0) && (o[p++] = r), p;
|
|
188
188
|
}
|
|
189
|
-
function
|
|
190
|
-
return
|
|
189
|
+
function Mt(e, t, n, i, o, r, s, a) {
|
|
190
|
+
return ht(ht(e, t, n, i, s), s, o, r, a);
|
|
191
191
|
}
|
|
192
|
-
function
|
|
193
|
-
let o, r, s, a,
|
|
194
|
-
|
|
192
|
+
function Y(e, t, n, i) {
|
|
193
|
+
let o, r, s, a, c, f, h, l, u, p, _;
|
|
194
|
+
h = q * n, p = h - (h - n), _ = n - p;
|
|
195
195
|
let w = t[0];
|
|
196
|
-
o = w * n,
|
|
197
|
-
let
|
|
198
|
-
s !== 0 && (i[
|
|
199
|
-
for (let
|
|
200
|
-
w = t[
|
|
201
|
-
return (o !== 0 ||
|
|
202
|
-
}
|
|
203
|
-
function
|
|
196
|
+
o = w * n, h = q * w, l = h - (h - w), u = w - l, s = u * _ - (o - l * p - u * p - l * _);
|
|
197
|
+
let O = 0;
|
|
198
|
+
s !== 0 && (i[O++] = s);
|
|
199
|
+
for (let M = 1; M < e; M++)
|
|
200
|
+
w = t[M], a = w * n, h = q * w, l = h - (h - w), u = w - l, c = u * _ - (a - l * p - u * p - l * _), r = o + c, f = r - o, s = o - (r - f) + (c - f), s !== 0 && (i[O++] = s), o = a + r, s = r - (o - a), s !== 0 && (i[O++] = s);
|
|
201
|
+
return (o !== 0 || O === 0) && (i[O++] = o), O;
|
|
202
|
+
}
|
|
203
|
+
function Vn(e, t) {
|
|
204
204
|
let n = t[0];
|
|
205
205
|
for (let i = 1; i < e; i++) n += t[i];
|
|
206
206
|
return n;
|
|
@@ -208,304 +208,304 @@ function $n(e, t) {
|
|
|
208
208
|
function tt(e) {
|
|
209
209
|
return new Float64Array(e);
|
|
210
210
|
}
|
|
211
|
-
const
|
|
212
|
-
function
|
|
213
|
-
let a,
|
|
214
|
-
const
|
|
215
|
-
d =
|
|
216
|
-
let
|
|
217
|
-
if (
|
|
218
|
-
d = a *
|
|
219
|
-
const
|
|
220
|
-
d =
|
|
221
|
-
const
|
|
222
|
-
d = a *
|
|
223
|
-
const T =
|
|
211
|
+
const ai = (3 + 16 * pt) * pt, ci = (2 + 12 * pt) * pt, li = (9 + 64 * pt) * pt * pt, zt = tt(4), Ze = tt(8), tn = tt(12), en = tt(16), mt = tt(4);
|
|
212
|
+
function fi(e, t, n, i, o, r, s) {
|
|
213
|
+
let a, c, f, h, l, u, p, _, w, O, M, m, v, d, b, g, E, S;
|
|
214
|
+
const k = e - o, P = n - o, N = t - r, C = i - r;
|
|
215
|
+
d = k * C, u = q * k, p = u - (u - k), _ = k - p, u = q * C, w = u - (u - C), O = C - w, b = _ * O - (d - p * w - _ * w - p * O), g = N * P, u = q * N, p = u - (u - N), _ = N - p, u = q * P, w = u - (u - P), O = P - w, E = _ * O - (g - p * w - _ * w - p * O), M = b - E, l = b - M, zt[0] = b - (M + l) + (l - E), m = d + M, l = m - d, v = d - (m - l) + (M - l), M = v - g, l = v - M, zt[1] = v - (M + l) + (l - g), S = m + M, l = S - m, zt[2] = m - (S - l) + (M - l), zt[3] = S;
|
|
216
|
+
let F = Vn(4, zt), y = ci * s;
|
|
217
|
+
if (F >= y || -F >= y || (l = e - k, a = e - (k + l) + (l - o), l = n - P, f = n - (P + l) + (l - o), l = t - N, c = t - (N + l) + (l - r), l = i - C, h = i - (C + l) + (l - r), a === 0 && c === 0 && f === 0 && h === 0) || (y = li * s + Ln * Math.abs(F), F += k * h + C * a - (N * f + P * c), F >= y || -F >= y)) return F;
|
|
218
|
+
d = a * C, u = q * a, p = u - (u - a), _ = a - p, u = q * C, w = u - (u - C), O = C - w, b = _ * O - (d - p * w - _ * w - p * O), g = c * P, u = q * c, p = u - (u - c), _ = c - p, u = q * P, w = u - (u - P), O = P - w, E = _ * O - (g - p * w - _ * w - p * O), M = b - E, l = b - M, mt[0] = b - (M + l) + (l - E), m = d + M, l = m - d, v = d - (m - l) + (M - l), M = v - g, l = v - M, mt[1] = v - (M + l) + (l - g), S = m + M, l = S - m, mt[2] = m - (S - l) + (M - l), mt[3] = S;
|
|
219
|
+
const I = ht(4, zt, 4, mt, Ze);
|
|
220
|
+
d = k * h, u = q * k, p = u - (u - k), _ = k - p, u = q * h, w = u - (u - h), O = h - w, b = _ * O - (d - p * w - _ * w - p * O), g = N * f, u = q * N, p = u - (u - N), _ = N - p, u = q * f, w = u - (u - f), O = f - w, E = _ * O - (g - p * w - _ * w - p * O), M = b - E, l = b - M, mt[0] = b - (M + l) + (l - E), m = d + M, l = m - d, v = d - (m - l) + (M - l), M = v - g, l = v - M, mt[1] = v - (M + l) + (l - g), S = m + M, l = S - m, mt[2] = m - (S - l) + (M - l), mt[3] = S;
|
|
221
|
+
const A = ht(I, Ze, 4, mt, tn);
|
|
222
|
+
d = a * h, u = q * a, p = u - (u - a), _ = a - p, u = q * h, w = u - (u - h), O = h - w, b = _ * O - (d - p * w - _ * w - p * O), g = c * f, u = q * c, p = u - (u - c), _ = c - p, u = q * f, w = u - (u - f), O = f - w, E = _ * O - (g - p * w - _ * w - p * O), M = b - E, l = b - M, mt[0] = b - (M + l) + (l - E), m = d + M, l = m - d, v = d - (m - l) + (M - l), M = v - g, l = v - M, mt[1] = v - (M + l) + (l - g), S = m + M, l = S - m, mt[2] = m - (S - l) + (M - l), mt[3] = S;
|
|
223
|
+
const T = ht(A, tn, 4, mt, en);
|
|
224
224
|
return en[T - 1];
|
|
225
225
|
}
|
|
226
|
-
function
|
|
227
|
-
const s = (t - r) * (n - o), a = (e - o) * (i - r),
|
|
228
|
-
return Math.abs(
|
|
226
|
+
function Ot(e, t, n, i, o, r) {
|
|
227
|
+
const s = (t - r) * (n - o), a = (e - o) * (i - r), c = s - a, f = Math.abs(s + a);
|
|
228
|
+
return Math.abs(c) >= ai * f ? c : -fi(e, t, n, i, o, r, f);
|
|
229
229
|
}
|
|
230
|
-
const
|
|
231
|
-
let Qt = tt(1152),
|
|
230
|
+
const hi = (10 + 96 * pt) * pt, ui = (4 + 48 * pt) * pt, di = (44 + 576 * pt) * pt * pt, Xt = tt(4), $t = tt(4), Dt = tt(4), kt = tt(4), At = tt(4), It = tt(4), gt = tt(4), wt = tt(4), Oe = tt(8), Pe = tt(8), Ne = tt(8), Be = tt(8), Te = tt(8), Ce = tt(8), ue = tt(8), de = tt(8), pe = tt(8), Lt = tt(4), Vt = tt(4), Ut = tt(4), z = tt(8), K = tt(16), nt = tt(16), it = tt(16), et = tt(32), Ft = tt(32), at = tt(48), bt = tt(64);
|
|
231
|
+
let Qt = tt(1152), Xe = tt(1152);
|
|
232
232
|
function ct(e, t, n) {
|
|
233
|
-
e =
|
|
233
|
+
e = ht(e, Qt, t, n, Xe);
|
|
234
234
|
const i = Qt;
|
|
235
|
-
return Qt =
|
|
236
|
-
}
|
|
237
|
-
function
|
|
238
|
-
let
|
|
239
|
-
const
|
|
240
|
-
R =
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
235
|
+
return Qt = Xe, Xe = i, e;
|
|
236
|
+
}
|
|
237
|
+
function pi(e, t, n, i, o, r, s, a, c) {
|
|
238
|
+
let f, h, l, u, p, _, w, O, M, m, v, d, b, g, E, S, k, P, N, C, F, y, I, A, T, X, D, x, B, $, R, L, V, j, U;
|
|
239
|
+
const G = e - s, J = n - s, Q = o - s, H = t - a, Z = i - a, W = r - a;
|
|
240
|
+
R = J * W, I = q * J, A = I - (I - J), T = J - A, I = q * W, X = I - (I - W), D = W - X, L = T * D - (R - A * X - T * X - A * D), V = Q * Z, I = q * Q, A = I - (I - Q), T = Q - A, I = q * Z, X = I - (I - Z), D = Z - X, j = T * D - (V - A * X - T * X - A * D), x = L - j, y = L - x, Xt[0] = L - (x + y) + (y - j), B = R + x, y = B - R, $ = R - (B - y) + (x - y), x = $ - V, y = $ - x, Xt[1] = $ - (x + y) + (y - V), U = B + x, y = U - B, Xt[2] = B - (U - y) + (x - y), Xt[3] = U, R = Q * H, I = q * Q, A = I - (I - Q), T = Q - A, I = q * H, X = I - (I - H), D = H - X, L = T * D - (R - A * X - T * X - A * D), V = G * W, I = q * G, A = I - (I - G), T = G - A, I = q * W, X = I - (I - W), D = W - X, j = T * D - (V - A * X - T * X - A * D), x = L - j, y = L - x, $t[0] = L - (x + y) + (y - j), B = R + x, y = B - R, $ = R - (B - y) + (x - y), x = $ - V, y = $ - x, $t[1] = $ - (x + y) + (y - V), U = B + x, y = U - B, $t[2] = B - (U - y) + (x - y), $t[3] = U, R = G * Z, I = q * G, A = I - (I - G), T = G - A, I = q * Z, X = I - (I - Z), D = Z - X, L = T * D - (R - A * X - T * X - A * D), V = J * H, I = q * J, A = I - (I - J), T = J - A, I = q * H, X = I - (I - H), D = H - X, j = T * D - (V - A * X - T * X - A * D), x = L - j, y = L - x, Dt[0] = L - (x + y) + (y - j), B = R + x, y = B - R, $ = R - (B - y) + (x - y), x = $ - V, y = $ - x, Dt[1] = $ - (x + y) + (y - V), U = B + x, y = U - B, Dt[2] = B - (U - y) + (x - y), Dt[3] = U, f = ht(
|
|
241
|
+
ht(
|
|
242
|
+
ht(
|
|
243
|
+
Y(Y(4, Xt, G, z), z, G, K),
|
|
244
244
|
K,
|
|
245
|
-
|
|
245
|
+
Y(Y(4, Xt, H, z), z, H, nt),
|
|
246
246
|
nt,
|
|
247
247
|
et
|
|
248
248
|
),
|
|
249
249
|
et,
|
|
250
|
-
|
|
251
|
-
|
|
250
|
+
ht(
|
|
251
|
+
Y(Y(4, $t, J, z), z, J, K),
|
|
252
252
|
K,
|
|
253
|
-
|
|
253
|
+
Y(Y(4, $t, Z, z), z, Z, nt),
|
|
254
254
|
nt,
|
|
255
|
-
|
|
255
|
+
Ft
|
|
256
256
|
),
|
|
257
|
-
|
|
257
|
+
Ft,
|
|
258
258
|
bt
|
|
259
259
|
),
|
|
260
260
|
bt,
|
|
261
|
-
|
|
262
|
-
|
|
261
|
+
ht(
|
|
262
|
+
Y(Y(4, Dt, Q, z), z, Q, K),
|
|
263
263
|
K,
|
|
264
|
-
|
|
264
|
+
Y(Y(4, Dt, W, z), z, W, nt),
|
|
265
265
|
nt,
|
|
266
266
|
et
|
|
267
267
|
),
|
|
268
268
|
et,
|
|
269
269
|
Qt
|
|
270
270
|
);
|
|
271
|
-
let st =
|
|
272
|
-
if (st >=
|
|
271
|
+
let st = Vn(f, Qt), ft = ui * c;
|
|
272
|
+
if (st >= ft || -st >= ft || (y = e - G, h = e - (G + y) + (y - s), y = t - H, p = t - (H + y) + (y - a), y = n - J, l = n - (J + y) + (y - s), y = i - Z, _ = i - (Z + y) + (y - a), y = o - Q, u = o - (Q + y) + (y - s), y = r - W, w = r - (W + y) + (y - a), h === 0 && l === 0 && u === 0 && p === 0 && _ === 0 && w === 0) || (ft = di * c + Ln * Math.abs(st), st += (G * G + H * H) * (J * w + W * l - (Z * u + Q * _)) + 2 * (G * h + H * p) * (J * W - Z * Q) + ((J * J + Z * Z) * (Q * p + H * u - (W * h + G * w)) + 2 * (J * l + Z * _) * (Q * H - W * G)) + ((Q * Q + W * W) * (G * _ + Z * h - (H * l + J * p)) + 2 * (Q * u + W * w) * (G * Z - H * J)), st >= ft || -st >= ft))
|
|
273
273
|
return st;
|
|
274
|
-
if ((
|
|
275
|
-
|
|
274
|
+
if ((l !== 0 || _ !== 0 || u !== 0 || w !== 0) && (R = G * G, I = q * G, A = I - (I - G), T = G - A, L = T * T - (R - A * A - (A + A) * T), V = H * H, I = q * H, A = I - (I - H), T = H - A, j = T * T - (V - A * A - (A + A) * T), x = L + j, y = x - L, kt[0] = L - (x - y) + (j - y), B = R + x, y = B - R, $ = R - (B - y) + (x - y), x = $ + V, y = x - $, kt[1] = $ - (x - y) + (V - y), U = B + x, y = U - B, kt[2] = B - (U - y) + (x - y), kt[3] = U), (u !== 0 || w !== 0 || h !== 0 || p !== 0) && (R = J * J, I = q * J, A = I - (I - J), T = J - A, L = T * T - (R - A * A - (A + A) * T), V = Z * Z, I = q * Z, A = I - (I - Z), T = Z - A, j = T * T - (V - A * A - (A + A) * T), x = L + j, y = x - L, At[0] = L - (x - y) + (j - y), B = R + x, y = B - R, $ = R - (B - y) + (x - y), x = $ + V, y = x - $, At[1] = $ - (x - y) + (V - y), U = B + x, y = U - B, At[2] = B - (U - y) + (x - y), At[3] = U), (h !== 0 || p !== 0 || l !== 0 || _ !== 0) && (R = Q * Q, I = q * Q, A = I - (I - Q), T = Q - A, L = T * T - (R - A * A - (A + A) * T), V = W * W, I = q * W, A = I - (I - W), T = W - A, j = T * T - (V - A * A - (A + A) * T), x = L + j, y = x - L, It[0] = L - (x - y) + (j - y), B = R + x, y = B - R, $ = R - (B - y) + (x - y), x = $ + V, y = x - $, It[1] = $ - (x - y) + (V - y), U = B + x, y = U - B, It[2] = B - (U - y) + (x - y), It[3] = U), h !== 0 && (O = Y(4, Xt, h, Oe), f = ct(f, Mt(
|
|
275
|
+
Y(O, Oe, 2 * G, K),
|
|
276
276
|
K,
|
|
277
|
-
|
|
277
|
+
Y(Y(4, It, h, z), z, Z, nt),
|
|
278
278
|
nt,
|
|
279
|
-
|
|
279
|
+
Y(Y(4, At, h, z), z, -W, it),
|
|
280
280
|
it,
|
|
281
281
|
et,
|
|
282
282
|
at
|
|
283
|
-
), at)), p !== 0 && (
|
|
284
|
-
|
|
283
|
+
), at)), p !== 0 && (M = Y(4, Xt, p, Pe), f = ct(f, Mt(
|
|
284
|
+
Y(M, Pe, 2 * H, K),
|
|
285
285
|
K,
|
|
286
|
-
|
|
286
|
+
Y(Y(4, At, p, z), z, Q, nt),
|
|
287
287
|
nt,
|
|
288
|
-
|
|
288
|
+
Y(Y(4, It, p, z), z, -J, it),
|
|
289
289
|
it,
|
|
290
290
|
et,
|
|
291
291
|
at
|
|
292
|
-
), at)),
|
|
293
|
-
|
|
292
|
+
), at)), l !== 0 && (m = Y(4, $t, l, Ne), f = ct(f, Mt(
|
|
293
|
+
Y(m, Ne, 2 * J, K),
|
|
294
294
|
K,
|
|
295
|
-
|
|
295
|
+
Y(Y(4, kt, l, z), z, W, nt),
|
|
296
296
|
nt,
|
|
297
|
-
|
|
297
|
+
Y(Y(4, It, l, z), z, -H, it),
|
|
298
298
|
it,
|
|
299
299
|
et,
|
|
300
300
|
at
|
|
301
|
-
), at)),
|
|
302
|
-
|
|
301
|
+
), at)), _ !== 0 && (v = Y(4, $t, _, Be), f = ct(f, Mt(
|
|
302
|
+
Y(v, Be, 2 * Z, K),
|
|
303
303
|
K,
|
|
304
|
-
|
|
304
|
+
Y(Y(4, It, _, z), z, G, nt),
|
|
305
305
|
nt,
|
|
306
|
-
|
|
306
|
+
Y(Y(4, kt, _, z), z, -Q, it),
|
|
307
307
|
it,
|
|
308
308
|
et,
|
|
309
309
|
at
|
|
310
|
-
), at)),
|
|
311
|
-
|
|
310
|
+
), at)), u !== 0 && (d = Y(4, Dt, u, Te), f = ct(f, Mt(
|
|
311
|
+
Y(d, Te, 2 * Q, K),
|
|
312
312
|
K,
|
|
313
|
-
|
|
313
|
+
Y(Y(4, At, u, z), z, H, nt),
|
|
314
314
|
nt,
|
|
315
|
-
|
|
315
|
+
Y(Y(4, kt, u, z), z, -Z, it),
|
|
316
316
|
it,
|
|
317
317
|
et,
|
|
318
318
|
at
|
|
319
|
-
), at)), w !== 0 && (
|
|
320
|
-
|
|
319
|
+
), at)), w !== 0 && (b = Y(4, Dt, w, Ce), f = ct(f, Mt(
|
|
320
|
+
Y(b, Ce, 2 * W, K),
|
|
321
321
|
K,
|
|
322
|
-
|
|
322
|
+
Y(Y(4, kt, w, z), z, J, nt),
|
|
323
323
|
nt,
|
|
324
|
-
|
|
324
|
+
Y(Y(4, At, w, z), z, -G, it),
|
|
325
325
|
it,
|
|
326
326
|
et,
|
|
327
327
|
at
|
|
328
|
-
), at)),
|
|
329
|
-
if (
|
|
330
|
-
const rt =
|
|
331
|
-
|
|
332
|
-
|
|
328
|
+
), at)), h !== 0 || p !== 0) {
|
|
329
|
+
if (l !== 0 || _ !== 0 || u !== 0 || w !== 0 ? (R = l * W, I = q * l, A = I - (I - l), T = l - A, I = q * W, X = I - (I - W), D = W - X, L = T * D - (R - A * X - T * X - A * D), V = J * w, I = q * J, A = I - (I - J), T = J - A, I = q * w, X = I - (I - w), D = w - X, j = T * D - (V - A * X - T * X - A * D), x = L + j, y = x - L, gt[0] = L - (x - y) + (j - y), B = R + x, y = B - R, $ = R - (B - y) + (x - y), x = $ + V, y = x - $, gt[1] = $ - (x - y) + (V - y), U = B + x, y = U - B, gt[2] = B - (U - y) + (x - y), gt[3] = U, R = u * -Z, I = q * u, A = I - (I - u), T = u - A, I = q * -Z, X = I - (I - -Z), D = -Z - X, L = T * D - (R - A * X - T * X - A * D), V = Q * -_, I = q * Q, A = I - (I - Q), T = Q - A, I = q * -_, X = I - (I - -_), D = -_ - X, j = T * D - (V - A * X - T * X - A * D), x = L + j, y = x - L, wt[0] = L - (x - y) + (j - y), B = R + x, y = B - R, $ = R - (B - y) + (x - y), x = $ + V, y = x - $, wt[1] = $ - (x - y) + (V - y), U = B + x, y = U - B, wt[2] = B - (U - y) + (x - y), wt[3] = U, E = ht(4, gt, 4, wt, de), R = l * w, I = q * l, A = I - (I - l), T = l - A, I = q * w, X = I - (I - w), D = w - X, L = T * D - (R - A * X - T * X - A * D), V = u * _, I = q * u, A = I - (I - u), T = u - A, I = q * _, X = I - (I - _), D = _ - X, j = T * D - (V - A * X - T * X - A * D), x = L - j, y = L - x, Vt[0] = L - (x + y) + (y - j), B = R + x, y = B - R, $ = R - (B - y) + (x - y), x = $ - V, y = $ - x, Vt[1] = $ - (x + y) + (y - V), U = B + x, y = U - B, Vt[2] = B - (U - y) + (x - y), Vt[3] = U, P = 4) : (de[0] = 0, E = 1, Vt[0] = 0, P = 1), h !== 0) {
|
|
330
|
+
const rt = Y(E, de, h, it);
|
|
331
|
+
f = ct(f, ht(
|
|
332
|
+
Y(O, Oe, h, K),
|
|
333
333
|
K,
|
|
334
|
-
|
|
334
|
+
Y(rt, it, 2 * G, et),
|
|
335
335
|
et,
|
|
336
336
|
at
|
|
337
337
|
), at);
|
|
338
|
-
const ot =
|
|
339
|
-
|
|
340
|
-
|
|
338
|
+
const ot = Y(P, Vt, h, z);
|
|
339
|
+
f = ct(f, Mt(
|
|
340
|
+
Y(ot, z, 2 * G, K),
|
|
341
341
|
K,
|
|
342
|
-
|
|
342
|
+
Y(ot, z, h, nt),
|
|
343
343
|
nt,
|
|
344
|
-
|
|
344
|
+
Y(rt, it, h, et),
|
|
345
345
|
et,
|
|
346
|
-
|
|
346
|
+
Ft,
|
|
347
347
|
bt
|
|
348
|
-
), bt),
|
|
348
|
+
), bt), _ !== 0 && (f = ct(f, Y(Y(4, It, h, z), z, _, K), K)), w !== 0 && (f = ct(f, Y(Y(4, At, -h, z), z, w, K), K));
|
|
349
349
|
}
|
|
350
350
|
if (p !== 0) {
|
|
351
|
-
const rt =
|
|
352
|
-
|
|
353
|
-
|
|
351
|
+
const rt = Y(E, de, p, it);
|
|
352
|
+
f = ct(f, ht(
|
|
353
|
+
Y(M, Pe, p, K),
|
|
354
354
|
K,
|
|
355
|
-
|
|
355
|
+
Y(rt, it, 2 * H, et),
|
|
356
356
|
et,
|
|
357
357
|
at
|
|
358
358
|
), at);
|
|
359
|
-
const ot =
|
|
360
|
-
|
|
361
|
-
|
|
359
|
+
const ot = Y(P, Vt, p, z);
|
|
360
|
+
f = ct(f, Mt(
|
|
361
|
+
Y(ot, z, 2 * H, K),
|
|
362
362
|
K,
|
|
363
|
-
|
|
363
|
+
Y(ot, z, p, nt),
|
|
364
364
|
nt,
|
|
365
|
-
|
|
365
|
+
Y(rt, it, p, et),
|
|
366
366
|
et,
|
|
367
|
-
|
|
367
|
+
Ft,
|
|
368
368
|
bt
|
|
369
369
|
), bt);
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
|
-
if (
|
|
373
|
-
if (
|
|
374
|
-
const rt =
|
|
375
|
-
|
|
376
|
-
|
|
372
|
+
if (l !== 0 || _ !== 0) {
|
|
373
|
+
if (u !== 0 || w !== 0 || h !== 0 || p !== 0 ? (R = u * H, I = q * u, A = I - (I - u), T = u - A, I = q * H, X = I - (I - H), D = H - X, L = T * D - (R - A * X - T * X - A * D), V = Q * p, I = q * Q, A = I - (I - Q), T = Q - A, I = q * p, X = I - (I - p), D = p - X, j = T * D - (V - A * X - T * X - A * D), x = L + j, y = x - L, gt[0] = L - (x - y) + (j - y), B = R + x, y = B - R, $ = R - (B - y) + (x - y), x = $ + V, y = x - $, gt[1] = $ - (x - y) + (V - y), U = B + x, y = U - B, gt[2] = B - (U - y) + (x - y), gt[3] = U, C = -W, F = -w, R = h * C, I = q * h, A = I - (I - h), T = h - A, I = q * C, X = I - (I - C), D = C - X, L = T * D - (R - A * X - T * X - A * D), V = G * F, I = q * G, A = I - (I - G), T = G - A, I = q * F, X = I - (I - F), D = F - X, j = T * D - (V - A * X - T * X - A * D), x = L + j, y = x - L, wt[0] = L - (x - y) + (j - y), B = R + x, y = B - R, $ = R - (B - y) + (x - y), x = $ + V, y = x - $, wt[1] = $ - (x - y) + (V - y), U = B + x, y = U - B, wt[2] = B - (U - y) + (x - y), wt[3] = U, S = ht(4, gt, 4, wt, pe), R = u * p, I = q * u, A = I - (I - u), T = u - A, I = q * p, X = I - (I - p), D = p - X, L = T * D - (R - A * X - T * X - A * D), V = h * w, I = q * h, A = I - (I - h), T = h - A, I = q * w, X = I - (I - w), D = w - X, j = T * D - (V - A * X - T * X - A * D), x = L - j, y = L - x, Ut[0] = L - (x + y) + (y - j), B = R + x, y = B - R, $ = R - (B - y) + (x - y), x = $ - V, y = $ - x, Ut[1] = $ - (x + y) + (y - V), U = B + x, y = U - B, Ut[2] = B - (U - y) + (x - y), Ut[3] = U, N = 4) : (pe[0] = 0, S = 1, Ut[0] = 0, N = 1), l !== 0) {
|
|
374
|
+
const rt = Y(S, pe, l, it);
|
|
375
|
+
f = ct(f, ht(
|
|
376
|
+
Y(m, Ne, l, K),
|
|
377
377
|
K,
|
|
378
|
-
|
|
378
|
+
Y(rt, it, 2 * J, et),
|
|
379
379
|
et,
|
|
380
380
|
at
|
|
381
381
|
), at);
|
|
382
|
-
const ot =
|
|
383
|
-
|
|
384
|
-
|
|
382
|
+
const ot = Y(N, Ut, l, z);
|
|
383
|
+
f = ct(f, Mt(
|
|
384
|
+
Y(ot, z, 2 * J, K),
|
|
385
385
|
K,
|
|
386
|
-
|
|
386
|
+
Y(ot, z, l, nt),
|
|
387
387
|
nt,
|
|
388
|
-
|
|
388
|
+
Y(rt, it, l, et),
|
|
389
389
|
et,
|
|
390
|
-
|
|
390
|
+
Ft,
|
|
391
391
|
bt
|
|
392
|
-
), bt), w !== 0 && (
|
|
392
|
+
), bt), w !== 0 && (f = ct(f, Y(Y(4, kt, l, z), z, w, K), K)), p !== 0 && (f = ct(f, Y(Y(4, It, -l, z), z, p, K), K));
|
|
393
393
|
}
|
|
394
|
-
if (
|
|
395
|
-
const rt =
|
|
396
|
-
|
|
397
|
-
|
|
394
|
+
if (_ !== 0) {
|
|
395
|
+
const rt = Y(S, pe, _, it);
|
|
396
|
+
f = ct(f, ht(
|
|
397
|
+
Y(v, Be, _, K),
|
|
398
398
|
K,
|
|
399
|
-
|
|
399
|
+
Y(rt, it, 2 * Z, et),
|
|
400
400
|
et,
|
|
401
401
|
at
|
|
402
402
|
), at);
|
|
403
|
-
const ot =
|
|
404
|
-
|
|
405
|
-
|
|
403
|
+
const ot = Y(N, Ut, _, z);
|
|
404
|
+
f = ct(f, Mt(
|
|
405
|
+
Y(ot, z, 2 * Z, K),
|
|
406
406
|
K,
|
|
407
|
-
|
|
407
|
+
Y(ot, z, _, nt),
|
|
408
408
|
nt,
|
|
409
|
-
|
|
409
|
+
Y(rt, it, _, et),
|
|
410
410
|
et,
|
|
411
|
-
|
|
411
|
+
Ft,
|
|
412
412
|
bt
|
|
413
413
|
), bt);
|
|
414
414
|
}
|
|
415
415
|
}
|
|
416
|
-
if (
|
|
417
|
-
if (
|
|
418
|
-
const rt =
|
|
419
|
-
|
|
420
|
-
|
|
416
|
+
if (u !== 0 || w !== 0) {
|
|
417
|
+
if (h !== 0 || p !== 0 || l !== 0 || _ !== 0 ? (R = h * Z, I = q * h, A = I - (I - h), T = h - A, I = q * Z, X = I - (I - Z), D = Z - X, L = T * D - (R - A * X - T * X - A * D), V = G * _, I = q * G, A = I - (I - G), T = G - A, I = q * _, X = I - (I - _), D = _ - X, j = T * D - (V - A * X - T * X - A * D), x = L + j, y = x - L, gt[0] = L - (x - y) + (j - y), B = R + x, y = B - R, $ = R - (B - y) + (x - y), x = $ + V, y = x - $, gt[1] = $ - (x - y) + (V - y), U = B + x, y = U - B, gt[2] = B - (U - y) + (x - y), gt[3] = U, C = -H, F = -p, R = l * C, I = q * l, A = I - (I - l), T = l - A, I = q * C, X = I - (I - C), D = C - X, L = T * D - (R - A * X - T * X - A * D), V = J * F, I = q * J, A = I - (I - J), T = J - A, I = q * F, X = I - (I - F), D = F - X, j = T * D - (V - A * X - T * X - A * D), x = L + j, y = x - L, wt[0] = L - (x - y) + (j - y), B = R + x, y = B - R, $ = R - (B - y) + (x - y), x = $ + V, y = x - $, wt[1] = $ - (x - y) + (V - y), U = B + x, y = U - B, wt[2] = B - (U - y) + (x - y), wt[3] = U, g = ht(4, gt, 4, wt, ue), R = h * _, I = q * h, A = I - (I - h), T = h - A, I = q * _, X = I - (I - _), D = _ - X, L = T * D - (R - A * X - T * X - A * D), V = l * p, I = q * l, A = I - (I - l), T = l - A, I = q * p, X = I - (I - p), D = p - X, j = T * D - (V - A * X - T * X - A * D), x = L - j, y = L - x, Lt[0] = L - (x + y) + (y - j), B = R + x, y = B - R, $ = R - (B - y) + (x - y), x = $ - V, y = $ - x, Lt[1] = $ - (x + y) + (y - V), U = B + x, y = U - B, Lt[2] = B - (U - y) + (x - y), Lt[3] = U, k = 4) : (ue[0] = 0, g = 1, Lt[0] = 0, k = 1), u !== 0) {
|
|
418
|
+
const rt = Y(g, ue, u, it);
|
|
419
|
+
f = ct(f, ht(
|
|
420
|
+
Y(d, Te, u, K),
|
|
421
421
|
K,
|
|
422
|
-
|
|
422
|
+
Y(rt, it, 2 * Q, et),
|
|
423
423
|
et,
|
|
424
424
|
at
|
|
425
425
|
), at);
|
|
426
|
-
const ot =
|
|
427
|
-
|
|
428
|
-
|
|
426
|
+
const ot = Y(k, Lt, u, z);
|
|
427
|
+
f = ct(f, Mt(
|
|
428
|
+
Y(ot, z, 2 * Q, K),
|
|
429
429
|
K,
|
|
430
|
-
|
|
430
|
+
Y(ot, z, u, nt),
|
|
431
431
|
nt,
|
|
432
|
-
|
|
432
|
+
Y(rt, it, u, et),
|
|
433
433
|
et,
|
|
434
|
-
|
|
434
|
+
Ft,
|
|
435
435
|
bt
|
|
436
|
-
), bt), p !== 0 && (
|
|
436
|
+
), bt), p !== 0 && (f = ct(f, Y(Y(4, At, u, z), z, p, K), K)), _ !== 0 && (f = ct(f, Y(Y(4, kt, -u, z), z, _, K), K));
|
|
437
437
|
}
|
|
438
438
|
if (w !== 0) {
|
|
439
|
-
const rt =
|
|
440
|
-
|
|
441
|
-
|
|
439
|
+
const rt = Y(g, ue, w, it);
|
|
440
|
+
f = ct(f, ht(
|
|
441
|
+
Y(b, Ce, w, K),
|
|
442
442
|
K,
|
|
443
|
-
|
|
443
|
+
Y(rt, it, 2 * W, et),
|
|
444
444
|
et,
|
|
445
445
|
at
|
|
446
446
|
), at);
|
|
447
|
-
const ot =
|
|
448
|
-
|
|
449
|
-
|
|
447
|
+
const ot = Y(k, Lt, w, z);
|
|
448
|
+
f = ct(f, Mt(
|
|
449
|
+
Y(ot, z, 2 * W, K),
|
|
450
450
|
K,
|
|
451
|
-
|
|
451
|
+
Y(ot, z, w, nt),
|
|
452
452
|
nt,
|
|
453
|
-
|
|
453
|
+
Y(rt, it, w, et),
|
|
454
454
|
et,
|
|
455
|
-
|
|
455
|
+
Ft,
|
|
456
456
|
bt
|
|
457
457
|
), bt);
|
|
458
458
|
}
|
|
459
459
|
}
|
|
460
|
-
return Qt[
|
|
460
|
+
return Qt[f - 1];
|
|
461
461
|
}
|
|
462
|
-
function
|
|
463
|
-
const
|
|
464
|
-
return
|
|
462
|
+
function mi(e, t, n, i, o, r, s, a) {
|
|
463
|
+
const c = e - s, f = n - s, h = o - s, l = t - a, u = i - a, p = r - a, _ = f * p, w = h * u, O = c * c + l * l, M = h * l, m = c * p, v = f * f + u * u, d = c * u, b = f * l, g = h * h + p * p, E = O * (_ - w) + v * (M - m) + g * (d - b), S = (Math.abs(_) + Math.abs(w)) * O + (Math.abs(M) + Math.abs(m)) * v + (Math.abs(d) + Math.abs(b)) * g, k = hi * S;
|
|
464
|
+
return E > k || -E > k ? E : pi(e, t, n, i, o, r, s, a, S);
|
|
465
465
|
}
|
|
466
|
-
function
|
|
467
|
-
var n, i, o = 0, r, s, a,
|
|
468
|
-
for (n = 0; n <
|
|
466
|
+
function gi(e, t) {
|
|
467
|
+
var n, i, o = 0, r, s, a, c, f, h, l, u = e[0], p = e[1], _ = t.length;
|
|
468
|
+
for (n = 0; n < _; n++) {
|
|
469
469
|
i = 0;
|
|
470
|
-
var w = t[n],
|
|
471
|
-
if (
|
|
470
|
+
var w = t[n], O = w.length - 1;
|
|
471
|
+
if (h = w[0], h[0] !== w[O][0] && h[1] !== w[O][1])
|
|
472
472
|
throw new Error("First and last coordinates in a ring must be the same");
|
|
473
|
-
for (s =
|
|
474
|
-
if (
|
|
475
|
-
if (
|
|
473
|
+
for (s = h[0] - u, a = h[1] - p, i; i < O; i++) {
|
|
474
|
+
if (l = w[i + 1], c = l[0] - u, f = l[1] - p, a === 0 && f === 0) {
|
|
475
|
+
if (c <= 0 && s >= 0 || s <= 0 && c >= 0)
|
|
476
476
|
return 0;
|
|
477
|
-
} else if (
|
|
478
|
-
if (r =
|
|
477
|
+
} else if (f >= 0 && a <= 0 || f <= 0 && a >= 0) {
|
|
478
|
+
if (r = Ot(s, c, a, f, 0, 0), r === 0)
|
|
479
479
|
return 0;
|
|
480
|
-
(r > 0 &&
|
|
480
|
+
(r > 0 && f > 0 && a <= 0 || r < 0 && f <= 0 && a > 0) && o++;
|
|
481
481
|
}
|
|
482
|
-
|
|
482
|
+
h = l, a = f, s = c;
|
|
483
483
|
}
|
|
484
484
|
}
|
|
485
485
|
return o % 2 !== 0;
|
|
486
486
|
}
|
|
487
|
-
function
|
|
487
|
+
function $e(e, t, n = {}) {
|
|
488
488
|
if (!e)
|
|
489
489
|
throw new Error("point is required");
|
|
490
490
|
if (!t)
|
|
491
491
|
throw new Error("polygon is required");
|
|
492
|
-
const i =
|
|
492
|
+
const i = oi(e), o = si(t), r = o.type, s = t.bbox;
|
|
493
493
|
let a = o.coordinates;
|
|
494
|
-
if (s &&
|
|
494
|
+
if (s && wi(i, s) === !1)
|
|
495
495
|
return !1;
|
|
496
496
|
r === "Polygon" && (a = [a]);
|
|
497
|
-
for (var
|
|
498
|
-
const
|
|
499
|
-
if (
|
|
500
|
-
if (
|
|
497
|
+
for (var c = 0; c < a.length; ++c) {
|
|
498
|
+
const f = gi(i, a[c]);
|
|
499
|
+
if (f === 0 && !n.ignoreBoundary) return !0;
|
|
500
|
+
if (f) return !0;
|
|
501
501
|
}
|
|
502
502
|
return !1;
|
|
503
503
|
}
|
|
504
|
-
function
|
|
504
|
+
function wi(e, t) {
|
|
505
505
|
return t[0] <= e[0] && t[1] <= e[1] && t[2] >= e[0] && t[3] >= e[1];
|
|
506
506
|
}
|
|
507
|
-
class
|
|
508
|
-
constructor(t = [], n =
|
|
507
|
+
class Je {
|
|
508
|
+
constructor(t = [], n = yi) {
|
|
509
509
|
if (this.data = t, this.length = this.data.length, this.compare = n, this.length > 0)
|
|
510
510
|
for (let i = (this.length >> 1) - 1; i >= 0; i--) this._down(i);
|
|
511
511
|
}
|
|
@@ -533,73 +533,73 @@ class Ge {
|
|
|
533
533
|
const { data: n, compare: i } = this, o = this.length >> 1, r = n[t];
|
|
534
534
|
for (; t < o; ) {
|
|
535
535
|
let s = (t << 1) + 1, a = n[s];
|
|
536
|
-
const
|
|
537
|
-
if (
|
|
536
|
+
const c = s + 1;
|
|
537
|
+
if (c < this.length && i(n[c], a) < 0 && (s = c, a = n[c]), i(a, r) >= 0) break;
|
|
538
538
|
n[t] = a, t = s;
|
|
539
539
|
}
|
|
540
540
|
n[t] = r;
|
|
541
541
|
}
|
|
542
542
|
}
|
|
543
|
-
function
|
|
543
|
+
function yi(e, t) {
|
|
544
544
|
return e < t ? -1 : e > t ? 1 : 0;
|
|
545
545
|
}
|
|
546
|
-
const
|
|
546
|
+
const vi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
547
547
|
__proto__: null,
|
|
548
|
-
default:
|
|
549
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
550
|
-
function
|
|
551
|
-
let r, s, a,
|
|
552
|
-
|
|
548
|
+
default: Je
|
|
549
|
+
}, Symbol.toStringTag, { value: "Module" })), Bt = 11102230246251565e-32, ut = 134217729, bi = (3 + 8 * Bt) * Bt;
|
|
550
|
+
function De(e, t, n, i, o) {
|
|
551
|
+
let r, s, a, c, f = t[0], h = i[0], l = 0, u = 0;
|
|
552
|
+
h > f == h > -f ? (r = f, f = t[++l]) : (r = h, h = i[++u]);
|
|
553
553
|
let p = 0;
|
|
554
|
-
if (
|
|
555
|
-
for (
|
|
556
|
-
|
|
557
|
-
for (;
|
|
558
|
-
s = r +
|
|
559
|
-
for (;
|
|
560
|
-
s = r +
|
|
554
|
+
if (l < e && u < n)
|
|
555
|
+
for (h > f == h > -f ? (s = f + r, a = r - (s - f), f = t[++l]) : (s = h + r, a = r - (s - h), h = i[++u]), r = s, a !== 0 && (o[p++] = a); l < e && u < n; )
|
|
556
|
+
h > f == h > -f ? (s = r + f, c = s - r, a = r - (s - c) + (f - c), f = t[++l]) : (s = r + h, c = s - r, a = r - (s - c) + (h - c), h = i[++u]), r = s, a !== 0 && (o[p++] = a);
|
|
557
|
+
for (; l < e; )
|
|
558
|
+
s = r + f, c = s - r, a = r - (s - c) + (f - c), f = t[++l], r = s, a !== 0 && (o[p++] = a);
|
|
559
|
+
for (; u < n; )
|
|
560
|
+
s = r + h, c = s - r, a = r - (s - c) + (h - c), h = i[++u], r = s, a !== 0 && (o[p++] = a);
|
|
561
561
|
return (r !== 0 || p === 0) && (o[p++] = r), p;
|
|
562
562
|
}
|
|
563
|
-
function
|
|
563
|
+
function xi(e, t) {
|
|
564
564
|
let n = t[0];
|
|
565
565
|
for (let i = 1; i < e; i++) n += t[i];
|
|
566
566
|
return n;
|
|
567
567
|
}
|
|
568
|
-
function
|
|
568
|
+
function fe(e) {
|
|
569
569
|
return new Float64Array(e);
|
|
570
570
|
}
|
|
571
|
-
const
|
|
572
|
-
function
|
|
573
|
-
let a,
|
|
574
|
-
const
|
|
575
|
-
d =
|
|
576
|
-
let
|
|
577
|
-
if (
|
|
578
|
-
d = a *
|
|
579
|
-
const
|
|
580
|
-
d =
|
|
581
|
-
const
|
|
582
|
-
d = a *
|
|
583
|
-
const T =
|
|
571
|
+
const _i = (3 + 16 * Bt) * Bt, Mi = (2 + 12 * Bt) * Bt, Si = (9 + 64 * Bt) * Bt * Bt, Jt = fe(4), nn = fe(8), rn = fe(12), on = fe(16), yt = fe(4);
|
|
572
|
+
function Ei(e, t, n, i, o, r, s) {
|
|
573
|
+
let a, c, f, h, l, u, p, _, w, O, M, m, v, d, b, g, E, S;
|
|
574
|
+
const k = e - o, P = n - o, N = t - r, C = i - r;
|
|
575
|
+
d = k * C, u = ut * k, p = u - (u - k), _ = k - p, u = ut * C, w = u - (u - C), O = C - w, b = _ * O - (d - p * w - _ * w - p * O), g = N * P, u = ut * N, p = u - (u - N), _ = N - p, u = ut * P, w = u - (u - P), O = P - w, E = _ * O - (g - p * w - _ * w - p * O), M = b - E, l = b - M, Jt[0] = b - (M + l) + (l - E), m = d + M, l = m - d, v = d - (m - l) + (M - l), M = v - g, l = v - M, Jt[1] = v - (M + l) + (l - g), S = m + M, l = S - m, Jt[2] = m - (S - l) + (M - l), Jt[3] = S;
|
|
576
|
+
let F = xi(4, Jt), y = Mi * s;
|
|
577
|
+
if (F >= y || -F >= y || (l = e - k, a = e - (k + l) + (l - o), l = n - P, f = n - (P + l) + (l - o), l = t - N, c = t - (N + l) + (l - r), l = i - C, h = i - (C + l) + (l - r), a === 0 && c === 0 && f === 0 && h === 0) || (y = Si * s + bi * Math.abs(F), F += k * h + C * a - (N * f + P * c), F >= y || -F >= y)) return F;
|
|
578
|
+
d = a * C, u = ut * a, p = u - (u - a), _ = a - p, u = ut * C, w = u - (u - C), O = C - w, b = _ * O - (d - p * w - _ * w - p * O), g = c * P, u = ut * c, p = u - (u - c), _ = c - p, u = ut * P, w = u - (u - P), O = P - w, E = _ * O - (g - p * w - _ * w - p * O), M = b - E, l = b - M, yt[0] = b - (M + l) + (l - E), m = d + M, l = m - d, v = d - (m - l) + (M - l), M = v - g, l = v - M, yt[1] = v - (M + l) + (l - g), S = m + M, l = S - m, yt[2] = m - (S - l) + (M - l), yt[3] = S;
|
|
579
|
+
const I = De(4, Jt, 4, yt, nn);
|
|
580
|
+
d = k * h, u = ut * k, p = u - (u - k), _ = k - p, u = ut * h, w = u - (u - h), O = h - w, b = _ * O - (d - p * w - _ * w - p * O), g = N * f, u = ut * N, p = u - (u - N), _ = N - p, u = ut * f, w = u - (u - f), O = f - w, E = _ * O - (g - p * w - _ * w - p * O), M = b - E, l = b - M, yt[0] = b - (M + l) + (l - E), m = d + M, l = m - d, v = d - (m - l) + (M - l), M = v - g, l = v - M, yt[1] = v - (M + l) + (l - g), S = m + M, l = S - m, yt[2] = m - (S - l) + (M - l), yt[3] = S;
|
|
581
|
+
const A = De(I, nn, 4, yt, rn);
|
|
582
|
+
d = a * h, u = ut * a, p = u - (u - a), _ = a - p, u = ut * h, w = u - (u - h), O = h - w, b = _ * O - (d - p * w - _ * w - p * O), g = c * f, u = ut * c, p = u - (u - c), _ = c - p, u = ut * f, w = u - (u - f), O = f - w, E = _ * O - (g - p * w - _ * w - p * O), M = b - E, l = b - M, yt[0] = b - (M + l) + (l - E), m = d + M, l = m - d, v = d - (m - l) + (M - l), M = v - g, l = v - M, yt[1] = v - (M + l) + (l - g), S = m + M, l = S - m, yt[2] = m - (S - l) + (M - l), yt[3] = S;
|
|
583
|
+
const T = De(A, rn, 4, yt, on);
|
|
584
584
|
return on[T - 1];
|
|
585
585
|
}
|
|
586
586
|
function sn(e, t, n, i, o, r) {
|
|
587
|
-
const s = (t - r) * (n - o), a = (e - o) * (i - r),
|
|
588
|
-
if (s === 0 || a === 0 || s > 0 != a > 0) return
|
|
589
|
-
const
|
|
590
|
-
return Math.abs(
|
|
587
|
+
const s = (t - r) * (n - o), a = (e - o) * (i - r), c = s - a;
|
|
588
|
+
if (s === 0 || a === 0 || s > 0 != a > 0) return c;
|
|
589
|
+
const f = Math.abs(s + a);
|
|
590
|
+
return Math.abs(c) >= _i * f ? c : -Ei(e, t, n, i, o, r, f);
|
|
591
591
|
}
|
|
592
|
-
function
|
|
593
|
-
const n = new
|
|
594
|
-
return
|
|
592
|
+
function ki(e, t) {
|
|
593
|
+
const n = new Je([], Un);
|
|
594
|
+
return Ii(e, n), Oi(n, t);
|
|
595
595
|
}
|
|
596
|
-
function
|
|
596
|
+
function Un(e, t) {
|
|
597
597
|
return e.p.x > t.p.x ? 1 : e.p.x < t.p.x || e.p.x === t.p.x && (e.featureId !== t.featureId || e.ringId !== t.ringId) && e.isLeftEndpoint && !t.isLeftEndpoint ? -1 : e.p.y !== t.p.y ? e.p.y > t.p.y ? 1 : -1 : 1;
|
|
598
598
|
}
|
|
599
|
-
function
|
|
599
|
+
function Ai(e, t) {
|
|
600
600
|
return e.rightSweepEvent.p.x > t.rightSweepEvent.p.x ? 1 : e.rightSweepEvent.p.x < t.rightSweepEvent.p.x ? -1 : e.rightSweepEvent.p.y !== t.rightSweepEvent.p.y ? e.rightSweepEvent.p.y < t.rightSweepEvent.p.y ? 1 : -1 : 1;
|
|
601
601
|
}
|
|
602
|
-
function
|
|
602
|
+
function Ii(e, t) {
|
|
603
603
|
if (e.type === "FeatureCollection") {
|
|
604
604
|
const n = e.features;
|
|
605
605
|
for (let i = 0; i < n.length; i++)
|
|
@@ -616,10 +616,10 @@ function an(e, t) {
|
|
|
616
616
|
for (let r = 0; r < i[o].length; r++) {
|
|
617
617
|
let s = i[o][r][0], a = null;
|
|
618
618
|
ge = ge + 1;
|
|
619
|
-
for (let
|
|
620
|
-
a = i[o][r][
|
|
621
|
-
const
|
|
622
|
-
|
|
619
|
+
for (let c = 0; c < i[o][r].length - 1; c++) {
|
|
620
|
+
a = i[o][r][c + 1];
|
|
621
|
+
const f = new cn(s, me, ge, we), h = new cn(a, me, ge, we + 1);
|
|
622
|
+
f.otherEvent = h, h.otherEvent = f, Un(f, h) > 0 ? (h.isLeftEndpoint = !0, f.isLeftEndpoint = !1) : (f.isLeftEndpoint = !0, h.isLeftEndpoint = !1), t.push(f), t.push(h), s = a, we = we + 1;
|
|
623
623
|
}
|
|
624
624
|
}
|
|
625
625
|
me = me + 1;
|
|
@@ -638,35 +638,35 @@ var cn = class {
|
|
|
638
638
|
return [this.p.x, this.p.y];
|
|
639
639
|
}
|
|
640
640
|
};
|
|
641
|
-
function
|
|
642
|
-
const n = [], i = new
|
|
641
|
+
function Oi(e, t = !1) {
|
|
642
|
+
const n = [], i = new Je([], Ai);
|
|
643
643
|
for (; e.length; ) {
|
|
644
644
|
const o = e.pop();
|
|
645
645
|
if (o.isLeftEndpoint) {
|
|
646
|
-
const r = new
|
|
646
|
+
const r = new Pi(o);
|
|
647
647
|
for (let s = 0; s < i.data.length; s++) {
|
|
648
648
|
const a = i.data[s];
|
|
649
649
|
if (t && a.leftSweepEvent.featureId === o.featureId)
|
|
650
650
|
continue;
|
|
651
|
-
const
|
|
652
|
-
|
|
651
|
+
const c = Ni(r, a);
|
|
652
|
+
c !== !1 && n.push(c);
|
|
653
653
|
}
|
|
654
654
|
i.push(r);
|
|
655
655
|
} else o.isLeftEndpoint === !1 && i.pop();
|
|
656
656
|
}
|
|
657
657
|
return n;
|
|
658
658
|
}
|
|
659
|
-
var
|
|
659
|
+
var Pi = class {
|
|
660
660
|
/** @param event must have otherEvent non-null */
|
|
661
661
|
constructor(e) {
|
|
662
662
|
this.leftSweepEvent = e, this.rightSweepEvent = e.otherEvent;
|
|
663
663
|
}
|
|
664
664
|
};
|
|
665
|
-
function
|
|
665
|
+
function Ni(e, t) {
|
|
666
666
|
if (e === null || t === null) return !1;
|
|
667
|
-
const n = e.leftSweepEvent.p.x, i = e.leftSweepEvent.p.y, o = e.rightSweepEvent.p.x, r = e.rightSweepEvent.p.y, s = t.leftSweepEvent.p.x, a = t.leftSweepEvent.p.y,
|
|
668
|
-
if (
|
|
669
|
-
if (
|
|
667
|
+
const n = e.leftSweepEvent.p.x, i = e.leftSweepEvent.p.y, o = e.rightSweepEvent.p.x, r = e.rightSweepEvent.p.y, s = t.leftSweepEvent.p.x, a = t.leftSweepEvent.p.y, c = t.rightSweepEvent.p.x, f = t.rightSweepEvent.p.y, h = sn(n, i, o, r, s, a), l = sn(n, i, o, r, c, f);
|
|
668
|
+
if (h > 0 && l > 0) return !1;
|
|
669
|
+
if (h < 0 && l < 0) return !1;
|
|
670
670
|
if (e.leftSweepEvent.ringId === t.leftSweepEvent.ringId) {
|
|
671
671
|
if (e.rightSweepEvent.isSamePoint(t.leftSweepEvent) || e.rightSweepEvent.isSamePoint(t.rightSweepEvent) || e.leftSweepEvent.isSamePoint(t.leftSweepEvent) || e.leftSweepEvent.isSamePoint(t.rightSweepEvent))
|
|
672
672
|
return !1;
|
|
@@ -680,39 +680,39 @@ function Ii(e, t) {
|
|
|
680
680
|
if (e.leftSweepEvent.isSamePoint(t.rightSweepEvent))
|
|
681
681
|
return t.rightSweepEvent.asNewXY();
|
|
682
682
|
}
|
|
683
|
-
const
|
|
684
|
-
if (
|
|
683
|
+
const u = (f - a) * (o - n) - (c - s) * (r - i), p = (c - s) * (i - a) - (f - a) * (n - s), _ = (o - n) * (i - a) - (r - i) * (n - s);
|
|
684
|
+
if (u === 0)
|
|
685
685
|
return !1;
|
|
686
|
-
const w = p /
|
|
687
|
-
if (w >= 0 && w <= 1 &&
|
|
688
|
-
const
|
|
689
|
-
return [
|
|
686
|
+
const w = p / u, O = _ / u;
|
|
687
|
+
if (w >= 0 && w <= 1 && O >= 0 && O <= 1) {
|
|
688
|
+
const M = n + w * (o - n), m = i + w * (r - i);
|
|
689
|
+
return [M, m];
|
|
690
690
|
}
|
|
691
691
|
return !1;
|
|
692
692
|
}
|
|
693
|
-
function
|
|
693
|
+
function Bi(e, t, n = {}) {
|
|
694
694
|
const { removeDuplicates: i = !0, ignoreSelfIntersections: o = !0 } = n;
|
|
695
695
|
let r = [];
|
|
696
696
|
e.type === "FeatureCollection" ? r = r.concat(e.features) : e.type === "Feature" ? r.push(e) : (e.type === "LineString" || e.type === "Polygon" || e.type === "MultiLineString" || e.type === "MultiPolygon") && r.push(oe(e)), t.type === "FeatureCollection" ? r = r.concat(t.features) : t.type === "Feature" ? r.push(t) : (t.type === "LineString" || t.type === "Polygon" || t.type === "MultiLineString" || t.type === "MultiPolygon") && r.push(oe(t));
|
|
697
|
-
const s =
|
|
698
|
-
|
|
697
|
+
const s = ki(
|
|
698
|
+
Et(r),
|
|
699
699
|
o
|
|
700
700
|
);
|
|
701
701
|
let a = [];
|
|
702
702
|
if (i) {
|
|
703
|
-
const
|
|
704
|
-
s.forEach((
|
|
705
|
-
const
|
|
706
|
-
h
|
|
703
|
+
const c = {};
|
|
704
|
+
s.forEach((f) => {
|
|
705
|
+
const h = f.join(",");
|
|
706
|
+
c[h] || (c[h] = !0, a.push(f));
|
|
707
707
|
});
|
|
708
708
|
} else
|
|
709
709
|
a = s;
|
|
710
|
-
return
|
|
710
|
+
return Et(a.map((c) => Yt(c)));
|
|
711
711
|
}
|
|
712
|
-
function
|
|
712
|
+
function Ti(e) {
|
|
713
713
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
714
714
|
}
|
|
715
|
-
function
|
|
715
|
+
function Ci(e) {
|
|
716
716
|
if (Object.prototype.hasOwnProperty.call(e, "__esModule")) return e;
|
|
717
717
|
var t = e.default;
|
|
718
718
|
if (typeof t == "function") {
|
|
@@ -736,7 +736,7 @@ function Bi(e) {
|
|
|
736
736
|
});
|
|
737
737
|
}), n;
|
|
738
738
|
}
|
|
739
|
-
function
|
|
739
|
+
function Xi(e, t = {}) {
|
|
740
740
|
let n = 0, i = 0, o = 0;
|
|
741
741
|
return ze(
|
|
742
742
|
e,
|
|
@@ -744,125 +744,125 @@ function Ni(e, t = {}) {
|
|
|
744
744
|
n += r[0], i += r[1], o++;
|
|
745
745
|
},
|
|
746
746
|
!0
|
|
747
|
-
),
|
|
747
|
+
), Yt([n / o, i / o], t.properties);
|
|
748
748
|
}
|
|
749
|
-
var ye = { exports: {} },
|
|
750
|
-
function
|
|
749
|
+
var ye = { exports: {} }, ke = { exports: {} }, $i = ke.exports, ln;
|
|
750
|
+
function Di() {
|
|
751
751
|
return ln || (ln = 1, (function(e, t) {
|
|
752
752
|
(function(n, i) {
|
|
753
753
|
e.exports = i();
|
|
754
|
-
})(
|
|
755
|
-
function n(m,
|
|
756
|
-
(function
|
|
757
|
-
for (;
|
|
758
|
-
if (
|
|
759
|
-
var
|
|
760
|
-
|
|
754
|
+
})($i, function() {
|
|
755
|
+
function n(m, v, d, b, g) {
|
|
756
|
+
(function E(S, k, P, N, C) {
|
|
757
|
+
for (; N > P; ) {
|
|
758
|
+
if (N - P > 600) {
|
|
759
|
+
var F = N - P + 1, y = k - P + 1, I = Math.log(F), A = 0.5 * Math.exp(2 * I / 3), T = 0.5 * Math.sqrt(I * A * (F - A) / F) * (y - F / 2 < 0 ? -1 : 1), X = Math.max(P, Math.floor(k - y * A / F + T)), D = Math.min(N, Math.floor(k + (F - y) * A / F + T));
|
|
760
|
+
E(S, k, X, D, C);
|
|
761
761
|
}
|
|
762
|
-
var
|
|
763
|
-
for (i(S,
|
|
764
|
-
for (i(S,
|
|
765
|
-
for (;
|
|
762
|
+
var x = S[k], B = P, $ = N;
|
|
763
|
+
for (i(S, P, k), C(S[N], x) > 0 && i(S, P, N); B < $; ) {
|
|
764
|
+
for (i(S, B, $), B++, $--; C(S[B], x) < 0; ) B++;
|
|
765
|
+
for (; C(S[$], x) > 0; ) $--;
|
|
766
766
|
}
|
|
767
|
-
|
|
767
|
+
C(S[P], x) === 0 ? i(S, P, $) : i(S, ++$, N), $ <= k && (P = $ + 1), k <= $ && (N = $ - 1);
|
|
768
768
|
}
|
|
769
|
-
})(m,
|
|
769
|
+
})(m, v, d || 0, b || m.length - 1, g || o);
|
|
770
770
|
}
|
|
771
|
-
function i(m,
|
|
772
|
-
var
|
|
773
|
-
m[
|
|
771
|
+
function i(m, v, d) {
|
|
772
|
+
var b = m[v];
|
|
773
|
+
m[v] = m[d], m[d] = b;
|
|
774
774
|
}
|
|
775
|
-
function o(m,
|
|
776
|
-
return m <
|
|
775
|
+
function o(m, v) {
|
|
776
|
+
return m < v ? -1 : m > v ? 1 : 0;
|
|
777
777
|
}
|
|
778
778
|
var r = function(m) {
|
|
779
779
|
m === void 0 && (m = 9), this._maxEntries = Math.max(4, m), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), this.clear();
|
|
780
780
|
};
|
|
781
|
-
function s(m,
|
|
782
|
-
if (!d) return
|
|
783
|
-
for (var
|
|
781
|
+
function s(m, v, d) {
|
|
782
|
+
if (!d) return v.indexOf(m);
|
|
783
|
+
for (var b = 0; b < v.length; b++) if (d(m, v[b])) return b;
|
|
784
784
|
return -1;
|
|
785
785
|
}
|
|
786
|
-
function a(m,
|
|
787
|
-
|
|
786
|
+
function a(m, v) {
|
|
787
|
+
c(m, 0, m.children.length, v, m);
|
|
788
788
|
}
|
|
789
|
-
function
|
|
790
|
-
g || (g =
|
|
791
|
-
for (var
|
|
792
|
-
var S = m.children[
|
|
793
|
-
|
|
789
|
+
function c(m, v, d, b, g) {
|
|
790
|
+
g || (g = O(null)), g.minX = 1 / 0, g.minY = 1 / 0, g.maxX = -1 / 0, g.maxY = -1 / 0;
|
|
791
|
+
for (var E = v; E < d; E++) {
|
|
792
|
+
var S = m.children[E];
|
|
793
|
+
f(g, m.leaf ? b(S) : S);
|
|
794
794
|
}
|
|
795
795
|
return g;
|
|
796
796
|
}
|
|
797
|
-
function
|
|
798
|
-
return m.minX = Math.min(m.minX,
|
|
797
|
+
function f(m, v) {
|
|
798
|
+
return m.minX = Math.min(m.minX, v.minX), m.minY = Math.min(m.minY, v.minY), m.maxX = Math.max(m.maxX, v.maxX), m.maxY = Math.max(m.maxY, v.maxY), m;
|
|
799
799
|
}
|
|
800
|
-
function
|
|
801
|
-
return m.minX -
|
|
800
|
+
function h(m, v) {
|
|
801
|
+
return m.minX - v.minX;
|
|
802
802
|
}
|
|
803
|
-
function
|
|
804
|
-
return m.minY -
|
|
803
|
+
function l(m, v) {
|
|
804
|
+
return m.minY - v.minY;
|
|
805
805
|
}
|
|
806
|
-
function
|
|
806
|
+
function u(m) {
|
|
807
807
|
return (m.maxX - m.minX) * (m.maxY - m.minY);
|
|
808
808
|
}
|
|
809
809
|
function p(m) {
|
|
810
810
|
return m.maxX - m.minX + (m.maxY - m.minY);
|
|
811
811
|
}
|
|
812
|
-
function
|
|
813
|
-
return m.minX <=
|
|
812
|
+
function _(m, v) {
|
|
813
|
+
return m.minX <= v.minX && m.minY <= v.minY && v.maxX <= m.maxX && v.maxY <= m.maxY;
|
|
814
814
|
}
|
|
815
|
-
function w(m,
|
|
816
|
-
return
|
|
815
|
+
function w(m, v) {
|
|
816
|
+
return v.minX <= m.maxX && v.minY <= m.maxY && v.maxX >= m.minX && v.maxY >= m.minY;
|
|
817
817
|
}
|
|
818
|
-
function
|
|
818
|
+
function O(m) {
|
|
819
819
|
return { children: m, height: 1, leaf: !0, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
|
|
820
820
|
}
|
|
821
|
-
function
|
|
822
|
-
for (var
|
|
823
|
-
var S =
|
|
824
|
-
n(m, S,
|
|
821
|
+
function M(m, v, d, b, g) {
|
|
822
|
+
for (var E = [v, d]; E.length; ) if (!((d = E.pop()) - (v = E.pop()) <= b)) {
|
|
823
|
+
var S = v + Math.ceil((d - v) / b / 2) * b;
|
|
824
|
+
n(m, S, v, d, g), E.push(v, S, S, d);
|
|
825
825
|
}
|
|
826
826
|
}
|
|
827
827
|
return r.prototype.all = function() {
|
|
828
828
|
return this._all(this.data, []);
|
|
829
829
|
}, r.prototype.search = function(m) {
|
|
830
|
-
var
|
|
831
|
-
if (!w(m,
|
|
832
|
-
for (var
|
|
833
|
-
for (var
|
|
834
|
-
var S =
|
|
835
|
-
w(m,
|
|
830
|
+
var v = this.data, d = [];
|
|
831
|
+
if (!w(m, v)) return d;
|
|
832
|
+
for (var b = this.toBBox, g = []; v; ) {
|
|
833
|
+
for (var E = 0; E < v.children.length; E++) {
|
|
834
|
+
var S = v.children[E], k = v.leaf ? b(S) : S;
|
|
835
|
+
w(m, k) && (v.leaf ? d.push(S) : _(m, k) ? this._all(S, d) : g.push(S));
|
|
836
836
|
}
|
|
837
|
-
|
|
837
|
+
v = g.pop();
|
|
838
838
|
}
|
|
839
839
|
return d;
|
|
840
840
|
}, r.prototype.collides = function(m) {
|
|
841
|
-
var
|
|
842
|
-
if (!w(m,
|
|
843
|
-
for (var d = [];
|
|
844
|
-
for (var
|
|
845
|
-
var g =
|
|
846
|
-
if (w(m,
|
|
847
|
-
if (
|
|
841
|
+
var v = this.data;
|
|
842
|
+
if (!w(m, v)) return !1;
|
|
843
|
+
for (var d = []; v; ) {
|
|
844
|
+
for (var b = 0; b < v.children.length; b++) {
|
|
845
|
+
var g = v.children[b], E = v.leaf ? this.toBBox(g) : g;
|
|
846
|
+
if (w(m, E)) {
|
|
847
|
+
if (v.leaf || _(m, E)) return !0;
|
|
848
848
|
d.push(g);
|
|
849
849
|
}
|
|
850
850
|
}
|
|
851
|
-
|
|
851
|
+
v = d.pop();
|
|
852
852
|
}
|
|
853
853
|
return !1;
|
|
854
854
|
}, r.prototype.load = function(m) {
|
|
855
855
|
if (!m || !m.length) return this;
|
|
856
856
|
if (m.length < this._minEntries) {
|
|
857
|
-
for (var
|
|
857
|
+
for (var v = 0; v < m.length; v++) this.insert(m[v]);
|
|
858
858
|
return this;
|
|
859
859
|
}
|
|
860
860
|
var d = this._build(m.slice(), 0, m.length - 1, 0);
|
|
861
861
|
if (this.data.children.length) if (this.data.height === d.height) this._splitRoot(this.data, d);
|
|
862
862
|
else {
|
|
863
863
|
if (this.data.height < d.height) {
|
|
864
|
-
var
|
|
865
|
-
this.data = d, d =
|
|
864
|
+
var b = this.data;
|
|
865
|
+
this.data = d, d = b;
|
|
866
866
|
}
|
|
867
867
|
this._insert(d, this.data.height - d.height - 1, !0);
|
|
868
868
|
}
|
|
@@ -871,277 +871,277 @@ function Xi() {
|
|
|
871
871
|
}, r.prototype.insert = function(m) {
|
|
872
872
|
return m && this._insert(m, this.data.height - 1), this;
|
|
873
873
|
}, r.prototype.clear = function() {
|
|
874
|
-
return this.data =
|
|
875
|
-
}, r.prototype.remove = function(m,
|
|
874
|
+
return this.data = O([]), this;
|
|
875
|
+
}, r.prototype.remove = function(m, v) {
|
|
876
876
|
if (!m) return this;
|
|
877
|
-
for (var d,
|
|
878
|
-
if (
|
|
879
|
-
var
|
|
880
|
-
if (
|
|
877
|
+
for (var d, b, g, E = this.data, S = this.toBBox(m), k = [], P = []; E || k.length; ) {
|
|
878
|
+
if (E || (E = k.pop(), b = k[k.length - 1], d = P.pop(), g = !0), E.leaf) {
|
|
879
|
+
var N = s(m, E.children, v);
|
|
880
|
+
if (N !== -1) return E.children.splice(N, 1), k.push(E), this._condense(k), this;
|
|
881
881
|
}
|
|
882
|
-
g ||
|
|
882
|
+
g || E.leaf || !_(E, S) ? b ? (d++, E = b.children[d], g = !1) : E = null : (k.push(E), P.push(d), d = 0, b = E, E = E.children[0]);
|
|
883
883
|
}
|
|
884
884
|
return this;
|
|
885
885
|
}, r.prototype.toBBox = function(m) {
|
|
886
886
|
return m;
|
|
887
|
-
}, r.prototype.compareMinX = function(m,
|
|
888
|
-
return m.minX -
|
|
889
|
-
}, r.prototype.compareMinY = function(m,
|
|
890
|
-
return m.minY -
|
|
887
|
+
}, r.prototype.compareMinX = function(m, v) {
|
|
888
|
+
return m.minX - v.minX;
|
|
889
|
+
}, r.prototype.compareMinY = function(m, v) {
|
|
890
|
+
return m.minY - v.minY;
|
|
891
891
|
}, r.prototype.toJSON = function() {
|
|
892
892
|
return this.data;
|
|
893
893
|
}, r.prototype.fromJSON = function(m) {
|
|
894
894
|
return this.data = m, this;
|
|
895
|
-
}, r.prototype._all = function(m,
|
|
896
|
-
for (var d = []; m; ) m.leaf ?
|
|
897
|
-
return
|
|
898
|
-
}, r.prototype._build = function(m,
|
|
899
|
-
var g,
|
|
900
|
-
if (
|
|
901
|
-
|
|
902
|
-
var
|
|
903
|
-
|
|
904
|
-
for (var
|
|
905
|
-
var
|
|
906
|
-
|
|
907
|
-
for (var
|
|
908
|
-
var y = Math.min(
|
|
909
|
-
g.children.push(this._build(m,
|
|
895
|
+
}, r.prototype._all = function(m, v) {
|
|
896
|
+
for (var d = []; m; ) m.leaf ? v.push.apply(v, m.children) : d.push.apply(d, m.children), m = d.pop();
|
|
897
|
+
return v;
|
|
898
|
+
}, r.prototype._build = function(m, v, d, b) {
|
|
899
|
+
var g, E = d - v + 1, S = this._maxEntries;
|
|
900
|
+
if (E <= S) return a(g = O(m.slice(v, d + 1)), this.toBBox), g;
|
|
901
|
+
b || (b = Math.ceil(Math.log(E) / Math.log(S)), S = Math.ceil(E / Math.pow(S, b - 1))), (g = O([])).leaf = !1, g.height = b;
|
|
902
|
+
var k = Math.ceil(E / S), P = k * Math.ceil(Math.sqrt(S));
|
|
903
|
+
M(m, v, d, P, this.compareMinX);
|
|
904
|
+
for (var N = v; N <= d; N += P) {
|
|
905
|
+
var C = Math.min(N + P - 1, d);
|
|
906
|
+
M(m, N, C, k, this.compareMinY);
|
|
907
|
+
for (var F = N; F <= C; F += k) {
|
|
908
|
+
var y = Math.min(F + k - 1, C);
|
|
909
|
+
g.children.push(this._build(m, F, y, b - 1));
|
|
910
910
|
}
|
|
911
911
|
}
|
|
912
912
|
return a(g, this.toBBox), g;
|
|
913
|
-
}, r.prototype._chooseSubtree = function(m,
|
|
914
|
-
for (;
|
|
915
|
-
for (var g = 1 / 0,
|
|
916
|
-
var
|
|
917
|
-
|
|
913
|
+
}, r.prototype._chooseSubtree = function(m, v, d, b) {
|
|
914
|
+
for (; b.push(v), !v.leaf && b.length - 1 !== d; ) {
|
|
915
|
+
for (var g = 1 / 0, E = 1 / 0, S = void 0, k = 0; k < v.children.length; k++) {
|
|
916
|
+
var P = v.children[k], N = u(P), C = (F = m, y = P, (Math.max(y.maxX, F.maxX) - Math.min(y.minX, F.minX)) * (Math.max(y.maxY, F.maxY) - Math.min(y.minY, F.minY)) - N);
|
|
917
|
+
C < E ? (E = C, g = N < g ? N : g, S = P) : C === E && N < g && (g = N, S = P);
|
|
918
918
|
}
|
|
919
|
-
|
|
919
|
+
v = S || v.children[0];
|
|
920
920
|
}
|
|
921
|
-
var
|
|
922
|
-
return
|
|
923
|
-
}, r.prototype._insert = function(m,
|
|
924
|
-
var
|
|
925
|
-
for (
|
|
926
|
-
this._adjustParentBBoxes(
|
|
927
|
-
}, r.prototype._split = function(m,
|
|
928
|
-
var d = m[
|
|
929
|
-
this._chooseSplitAxis(d, g,
|
|
930
|
-
var
|
|
931
|
-
S.height = d.height, S.leaf = d.leaf, a(d, this.toBBox), a(S, this.toBBox),
|
|
932
|
-
}, r.prototype._splitRoot = function(m,
|
|
933
|
-
this.data =
|
|
934
|
-
}, r.prototype._chooseSplitIndex = function(m,
|
|
935
|
-
for (var
|
|
936
|
-
var
|
|
937
|
-
T <
|
|
921
|
+
var F, y;
|
|
922
|
+
return v;
|
|
923
|
+
}, r.prototype._insert = function(m, v, d) {
|
|
924
|
+
var b = d ? m : this.toBBox(m), g = [], E = this._chooseSubtree(b, this.data, v, g);
|
|
925
|
+
for (E.children.push(m), f(E, b); v >= 0 && g[v].children.length > this._maxEntries; ) this._split(g, v), v--;
|
|
926
|
+
this._adjustParentBBoxes(b, g, v);
|
|
927
|
+
}, r.prototype._split = function(m, v) {
|
|
928
|
+
var d = m[v], b = d.children.length, g = this._minEntries;
|
|
929
|
+
this._chooseSplitAxis(d, g, b);
|
|
930
|
+
var E = this._chooseSplitIndex(d, g, b), S = O(d.children.splice(E, d.children.length - E));
|
|
931
|
+
S.height = d.height, S.leaf = d.leaf, a(d, this.toBBox), a(S, this.toBBox), v ? m[v - 1].children.push(S) : this._splitRoot(d, S);
|
|
932
|
+
}, r.prototype._splitRoot = function(m, v) {
|
|
933
|
+
this.data = O([m, v]), this.data.height = m.height + 1, this.data.leaf = !1, a(this.data, this.toBBox);
|
|
934
|
+
}, r.prototype._chooseSplitIndex = function(m, v, d) {
|
|
935
|
+
for (var b, g, E, S, k, P, N, C = 1 / 0, F = 1 / 0, y = v; y <= d - v; y++) {
|
|
936
|
+
var I = c(m, 0, y, this.toBBox), A = c(m, y, d, this.toBBox), T = (g = I, E = A, S = void 0, k = void 0, P = void 0, N = void 0, S = Math.max(g.minX, E.minX), k = Math.max(g.minY, E.minY), P = Math.min(g.maxX, E.maxX), N = Math.min(g.maxY, E.maxY), Math.max(0, P - S) * Math.max(0, N - k)), X = u(I) + u(A);
|
|
937
|
+
T < C ? (C = T, b = y, F = X < F ? X : F) : T === C && X < F && (F = X, b = y);
|
|
938
938
|
}
|
|
939
|
-
return
|
|
940
|
-
}, r.prototype._chooseSplitAxis = function(m,
|
|
941
|
-
var
|
|
942
|
-
this._allDistMargin(m,
|
|
943
|
-
}, r.prototype._allDistMargin = function(m,
|
|
944
|
-
m.children.sort(
|
|
945
|
-
for (var g = this.toBBox,
|
|
946
|
-
var
|
|
947
|
-
|
|
939
|
+
return b || d - v;
|
|
940
|
+
}, r.prototype._chooseSplitAxis = function(m, v, d) {
|
|
941
|
+
var b = m.leaf ? this.compareMinX : h, g = m.leaf ? this.compareMinY : l;
|
|
942
|
+
this._allDistMargin(m, v, d, b) < this._allDistMargin(m, v, d, g) && m.children.sort(b);
|
|
943
|
+
}, r.prototype._allDistMargin = function(m, v, d, b) {
|
|
944
|
+
m.children.sort(b);
|
|
945
|
+
for (var g = this.toBBox, E = c(m, 0, v, g), S = c(m, d - v, d, g), k = p(E) + p(S), P = v; P < d - v; P++) {
|
|
946
|
+
var N = m.children[P];
|
|
947
|
+
f(E, m.leaf ? g(N) : N), k += p(E);
|
|
948
948
|
}
|
|
949
|
-
for (var
|
|
950
|
-
var
|
|
951
|
-
|
|
949
|
+
for (var C = d - v - 1; C >= v; C--) {
|
|
950
|
+
var F = m.children[C];
|
|
951
|
+
f(S, m.leaf ? g(F) : F), k += p(S);
|
|
952
952
|
}
|
|
953
|
-
return
|
|
954
|
-
}, r.prototype._adjustParentBBoxes = function(m,
|
|
955
|
-
for (var
|
|
953
|
+
return k;
|
|
954
|
+
}, r.prototype._adjustParentBBoxes = function(m, v, d) {
|
|
955
|
+
for (var b = d; b >= 0; b--) f(v[b], m);
|
|
956
956
|
}, r.prototype._condense = function(m) {
|
|
957
|
-
for (var
|
|
957
|
+
for (var v = m.length - 1, d = void 0; v >= 0; v--) m[v].children.length === 0 ? v > 0 ? (d = m[v - 1].children).splice(d.indexOf(m[v]), 1) : this.clear() : a(m[v], this.toBBox);
|
|
958
958
|
}, r;
|
|
959
959
|
});
|
|
960
|
-
})(
|
|
960
|
+
})(ke)), ke.exports;
|
|
961
961
|
}
|
|
962
|
-
const
|
|
963
|
-
var Zt = { exports: {} },
|
|
964
|
-
function
|
|
965
|
-
return
|
|
962
|
+
const Fi = /* @__PURE__ */ Ci(vi);
|
|
963
|
+
var Zt = { exports: {} }, Fe, fn;
|
|
964
|
+
function Ri() {
|
|
965
|
+
return fn || (fn = 1, Fe = function(t, n, i, o) {
|
|
966
966
|
var r = t[0], s = t[1], a = !1;
|
|
967
967
|
i === void 0 && (i = 0), o === void 0 && (o = n.length);
|
|
968
|
-
for (var
|
|
969
|
-
var
|
|
968
|
+
for (var c = (o - i) / 2, f = 0, h = c - 1; f < c; h = f++) {
|
|
969
|
+
var l = n[i + f * 2 + 0], u = n[i + f * 2 + 1], p = n[i + h * 2 + 0], _ = n[i + h * 2 + 1], w = u > s != _ > s && r < (p - l) * (s - u) / (_ - u) + l;
|
|
970
970
|
w && (a = !a);
|
|
971
971
|
}
|
|
972
972
|
return a;
|
|
973
|
-
}),
|
|
973
|
+
}), Fe;
|
|
974
974
|
}
|
|
975
|
-
var Re,
|
|
976
|
-
function
|
|
977
|
-
return
|
|
975
|
+
var Re, hn;
|
|
976
|
+
function Yi() {
|
|
977
|
+
return hn || (hn = 1, Re = function(t, n, i, o) {
|
|
978
978
|
var r = t[0], s = t[1], a = !1;
|
|
979
979
|
i === void 0 && (i = 0), o === void 0 && (o = n.length);
|
|
980
|
-
for (var
|
|
981
|
-
var
|
|
980
|
+
for (var c = o - i, f = 0, h = c - 1; f < c; h = f++) {
|
|
981
|
+
var l = n[f + i][0], u = n[f + i][1], p = n[h + i][0], _ = n[h + i][1], w = u > s != _ > s && r < (p - l) * (s - u) / (_ - u) + l;
|
|
982
982
|
w && (a = !a);
|
|
983
983
|
}
|
|
984
984
|
return a;
|
|
985
985
|
}), Re;
|
|
986
986
|
}
|
|
987
987
|
var un;
|
|
988
|
-
function
|
|
988
|
+
function Li() {
|
|
989
989
|
if (un) return Zt.exports;
|
|
990
990
|
un = 1;
|
|
991
|
-
var e =
|
|
991
|
+
var e = Ri(), t = Yi();
|
|
992
992
|
return Zt.exports = function(i, o, r, s) {
|
|
993
993
|
return o.length > 0 && Array.isArray(o[0]) ? t(i, o, r, s) : e(i, o, r, s);
|
|
994
994
|
}, Zt.exports.nested = t, Zt.exports.flat = e, Zt.exports;
|
|
995
995
|
}
|
|
996
|
-
var ee = { exports: {} },
|
|
997
|
-
function
|
|
996
|
+
var ee = { exports: {} }, Vi = ee.exports, dn;
|
|
997
|
+
function Ui() {
|
|
998
998
|
return dn || (dn = 1, (function(e, t) {
|
|
999
999
|
(function(n, i) {
|
|
1000
1000
|
i(t);
|
|
1001
|
-
})(
|
|
1001
|
+
})(Vi, function(n) {
|
|
1002
1002
|
const o = 33306690738754706e-32;
|
|
1003
|
-
function r(w,
|
|
1004
|
-
let d,
|
|
1005
|
-
|
|
1006
|
-
let
|
|
1007
|
-
if (
|
|
1008
|
-
for (;
|
|
1009
|
-
for (;
|
|
1010
|
-
return d === 0 &&
|
|
1003
|
+
function r(w, O, M, m, v) {
|
|
1004
|
+
let d, b, g, E, S = O[0], k = m[0], P = 0, N = 0;
|
|
1005
|
+
k > S == k > -S ? (d = S, S = O[++P]) : (d = k, k = m[++N]);
|
|
1006
|
+
let C = 0;
|
|
1007
|
+
if (P < w && N < M) for (k > S == k > -S ? (g = d - ((b = S + d) - S), S = O[++P]) : (g = d - ((b = k + d) - k), k = m[++N]), d = b, g !== 0 && (v[C++] = g); P < w && N < M; ) k > S == k > -S ? (g = d - ((b = d + S) - (E = b - d)) + (S - E), S = O[++P]) : (g = d - ((b = d + k) - (E = b - d)) + (k - E), k = m[++N]), d = b, g !== 0 && (v[C++] = g);
|
|
1008
|
+
for (; P < w; ) g = d - ((b = d + S) - (E = b - d)) + (S - E), S = O[++P], d = b, g !== 0 && (v[C++] = g);
|
|
1009
|
+
for (; N < M; ) g = d - ((b = d + k) - (E = b - d)) + (k - E), k = m[++N], d = b, g !== 0 && (v[C++] = g);
|
|
1010
|
+
return d === 0 && C !== 0 || (v[C++] = d), C;
|
|
1011
1011
|
}
|
|
1012
1012
|
function s(w) {
|
|
1013
1013
|
return new Float64Array(w);
|
|
1014
1014
|
}
|
|
1015
|
-
const a = 33306690738754716e-32,
|
|
1016
|
-
n.orient2d = function(w,
|
|
1017
|
-
const
|
|
1018
|
-
if (
|
|
1019
|
-
const S = Math.abs(
|
|
1020
|
-
return Math.abs(
|
|
1021
|
-
let
|
|
1022
|
-
const st =
|
|
1023
|
-
|
|
1024
|
-
let
|
|
1015
|
+
const a = 33306690738754716e-32, c = 22204460492503146e-32, f = 11093356479670487e-47, h = s(4), l = s(8), u = s(12), p = s(16), _ = s(4);
|
|
1016
|
+
n.orient2d = function(w, O, M, m, v, d) {
|
|
1017
|
+
const b = (O - d) * (M - v), g = (w - v) * (m - d), E = b - g;
|
|
1018
|
+
if (b === 0 || g === 0 || b > 0 != g > 0) return E;
|
|
1019
|
+
const S = Math.abs(b + g);
|
|
1020
|
+
return Math.abs(E) >= a * S ? E : -(function(k, P, N, C, F, y, I) {
|
|
1021
|
+
let A, T, X, D, x, B, $, R, L, V, j, U, G, J, Q, H, Z, W;
|
|
1022
|
+
const st = k - F, ft = N - F, rt = P - y, ot = C - y;
|
|
1023
|
+
x = (Q = (R = st - ($ = (B = 134217729 * st) - (B - st))) * (V = ot - (L = (B = 134217729 * ot) - (B - ot))) - ((J = st * ot) - $ * L - R * L - $ * V)) - (j = Q - (Z = (R = rt - ($ = (B = 134217729 * rt) - (B - rt))) * (V = ft - (L = (B = 134217729 * ft) - (B - ft))) - ((H = rt * ft) - $ * L - R * L - $ * V))), h[0] = Q - (j + x) + (x - Z), x = (G = J - ((U = J + j) - (x = U - J)) + (j - x)) - (j = G - H), h[1] = G - (j + x) + (x - H), x = (W = U + j) - U, h[2] = U - (W - x) + (j - x), h[3] = W;
|
|
1024
|
+
let Ct = (function(ri, Ke) {
|
|
1025
1025
|
let Qe = Ke[0];
|
|
1026
|
-
for (let Ie = 1; Ie <
|
|
1026
|
+
for (let Ie = 1; Ie < ri; Ie++) Qe += Ke[Ie];
|
|
1027
1027
|
return Qe;
|
|
1028
|
-
})(4,
|
|
1029
|
-
if (
|
|
1030
|
-
|
|
1031
|
-
const
|
|
1032
|
-
|
|
1033
|
-
const
|
|
1034
|
-
|
|
1035
|
-
const
|
|
1036
|
-
return p[
|
|
1037
|
-
})(w,
|
|
1038
|
-
}, n.orient2dfast = function(w,
|
|
1039
|
-
return (
|
|
1028
|
+
})(4, h), Wt = c * I;
|
|
1029
|
+
if (Ct >= Wt || -Ct >= Wt || (A = k - (st + (x = k - st)) + (x - F), X = N - (ft + (x = N - ft)) + (x - F), T = P - (rt + (x = P - rt)) + (x - y), D = C - (ot + (x = C - ot)) + (x - y), A === 0 && T === 0 && X === 0 && D === 0) || (Wt = f * I + o * Math.abs(Ct), (Ct += st * D + ot * A - (rt * X + ft * T)) >= Wt || -Ct >= Wt)) return Ct;
|
|
1030
|
+
x = (Q = (R = A - ($ = (B = 134217729 * A) - (B - A))) * (V = ot - (L = (B = 134217729 * ot) - (B - ot))) - ((J = A * ot) - $ * L - R * L - $ * V)) - (j = Q - (Z = (R = T - ($ = (B = 134217729 * T) - (B - T))) * (V = ft - (L = (B = 134217729 * ft) - (B - ft))) - ((H = T * ft) - $ * L - R * L - $ * V))), _[0] = Q - (j + x) + (x - Z), x = (G = J - ((U = J + j) - (x = U - J)) + (j - x)) - (j = G - H), _[1] = G - (j + x) + (x - H), x = (W = U + j) - U, _[2] = U - (W - x) + (j - x), _[3] = W;
|
|
1031
|
+
const ei = r(4, h, 4, _, l);
|
|
1032
|
+
x = (Q = (R = st - ($ = (B = 134217729 * st) - (B - st))) * (V = D - (L = (B = 134217729 * D) - (B - D))) - ((J = st * D) - $ * L - R * L - $ * V)) - (j = Q - (Z = (R = rt - ($ = (B = 134217729 * rt) - (B - rt))) * (V = X - (L = (B = 134217729 * X) - (B - X))) - ((H = rt * X) - $ * L - R * L - $ * V))), _[0] = Q - (j + x) + (x - Z), x = (G = J - ((U = J + j) - (x = U - J)) + (j - x)) - (j = G - H), _[1] = G - (j + x) + (x - H), x = (W = U + j) - U, _[2] = U - (W - x) + (j - x), _[3] = W;
|
|
1033
|
+
const ni = r(ei, l, 4, _, u);
|
|
1034
|
+
x = (Q = (R = A - ($ = (B = 134217729 * A) - (B - A))) * (V = D - (L = (B = 134217729 * D) - (B - D))) - ((J = A * D) - $ * L - R * L - $ * V)) - (j = Q - (Z = (R = T - ($ = (B = 134217729 * T) - (B - T))) * (V = X - (L = (B = 134217729 * X) - (B - X))) - ((H = T * X) - $ * L - R * L - $ * V))), _[0] = Q - (j + x) + (x - Z), x = (G = J - ((U = J + j) - (x = U - J)) + (j - x)) - (j = G - H), _[1] = G - (j + x) + (x - H), x = (W = U + j) - U, _[2] = U - (W - x) + (j - x), _[3] = W;
|
|
1035
|
+
const ii = r(ni, u, 4, _, p);
|
|
1036
|
+
return p[ii - 1];
|
|
1037
|
+
})(w, O, M, m, v, d, S);
|
|
1038
|
+
}, n.orient2dfast = function(w, O, M, m, v, d) {
|
|
1039
|
+
return (O - d) * (M - v) - (w - v) * (m - d);
|
|
1040
1040
|
}, Object.defineProperty(n, "__esModule", { value: !0 });
|
|
1041
1041
|
});
|
|
1042
1042
|
})(ee, ee.exports)), ee.exports;
|
|
1043
1043
|
}
|
|
1044
1044
|
var pn;
|
|
1045
|
-
function
|
|
1045
|
+
function ji() {
|
|
1046
1046
|
if (pn) return ye.exports;
|
|
1047
1047
|
pn = 1;
|
|
1048
|
-
var e =
|
|
1048
|
+
var e = Di(), t = Fi, n = Li(), i = Ui().orient2d;
|
|
1049
1049
|
t.default && (t = t.default), ye.exports = o, ye.exports.default = o;
|
|
1050
|
-
function o(d,
|
|
1051
|
-
|
|
1052
|
-
var
|
|
1053
|
-
S.toBBox = function(
|
|
1050
|
+
function o(d, b, g) {
|
|
1051
|
+
b = Math.max(0, b === void 0 ? 2 : b), g = g || 0;
|
|
1052
|
+
var E = p(d), S = new e(16);
|
|
1053
|
+
S.toBBox = function($) {
|
|
1054
1054
|
return {
|
|
1055
|
-
minX:
|
|
1056
|
-
minY:
|
|
1057
|
-
maxX:
|
|
1058
|
-
maxY:
|
|
1055
|
+
minX: $[0],
|
|
1056
|
+
minY: $[1],
|
|
1057
|
+
maxX: $[0],
|
|
1058
|
+
maxY: $[1]
|
|
1059
1059
|
};
|
|
1060
|
-
}, S.compareMinX = function(
|
|
1061
|
-
return
|
|
1062
|
-
}, S.compareMinY = function(
|
|
1063
|
-
return
|
|
1060
|
+
}, S.compareMinX = function($, R) {
|
|
1061
|
+
return $[0] - R[0];
|
|
1062
|
+
}, S.compareMinY = function($, R) {
|
|
1063
|
+
return $[1] - R[1];
|
|
1064
1064
|
}, S.load(d);
|
|
1065
|
-
for (var
|
|
1066
|
-
var
|
|
1067
|
-
S.remove(
|
|
1065
|
+
for (var k = [], P = 0, N; P < E.length; P++) {
|
|
1066
|
+
var C = E[P];
|
|
1067
|
+
S.remove(C), N = _(C, N), k.push(N);
|
|
1068
1068
|
}
|
|
1069
|
-
var
|
|
1070
|
-
for (
|
|
1071
|
-
for (var y =
|
|
1072
|
-
var
|
|
1073
|
-
if (!(
|
|
1074
|
-
var
|
|
1075
|
-
|
|
1069
|
+
var F = new e(16);
|
|
1070
|
+
for (P = 0; P < k.length; P++) F.insert(u(k[P]));
|
|
1071
|
+
for (var y = b * b, I = g * g; k.length; ) {
|
|
1072
|
+
var A = k.shift(), T = A.p, X = A.next.p, D = w(T, X);
|
|
1073
|
+
if (!(D < I)) {
|
|
1074
|
+
var x = D / y;
|
|
1075
|
+
C = r(S, A.prev.p, T, X, A.next.next.p, x, F), C && Math.min(w(C, T), w(C, X)) <= x && (k.push(A), k.push(_(C, A)), S.remove(C), F.remove(A), F.insert(u(A)), F.insert(u(A.next)));
|
|
1076
1076
|
}
|
|
1077
1077
|
}
|
|
1078
|
-
|
|
1079
|
-
var
|
|
1078
|
+
A = N;
|
|
1079
|
+
var B = [];
|
|
1080
1080
|
do
|
|
1081
|
-
|
|
1082
|
-
while (
|
|
1083
|
-
return
|
|
1084
|
-
}
|
|
1085
|
-
function r(d,
|
|
1086
|
-
for (var
|
|
1087
|
-
for (var
|
|
1088
|
-
var y =
|
|
1089
|
-
|
|
1081
|
+
B.push(A.p), A = A.next;
|
|
1082
|
+
while (A !== N);
|
|
1083
|
+
return B.push(A.p), B;
|
|
1084
|
+
}
|
|
1085
|
+
function r(d, b, g, E, S, k, P) {
|
|
1086
|
+
for (var N = new t([], s), C = d.data; C; ) {
|
|
1087
|
+
for (var F = 0; F < C.children.length; F++) {
|
|
1088
|
+
var y = C.children[F], I = C.leaf ? O(y, g, E) : a(g, E, y);
|
|
1089
|
+
I > k || N.push({
|
|
1090
1090
|
node: y,
|
|
1091
|
-
dist:
|
|
1091
|
+
dist: I
|
|
1092
1092
|
});
|
|
1093
1093
|
}
|
|
1094
|
-
for (;
|
|
1095
|
-
var
|
|
1096
|
-
if (
|
|
1094
|
+
for (; N.length && !N.peek().node.children; ) {
|
|
1095
|
+
var A = N.pop(), T = A.node, X = O(T, b, g), D = O(T, E, S);
|
|
1096
|
+
if (A.dist < X && A.dist < D && f(g, T, P) && f(E, T, P)) return T;
|
|
1097
1097
|
}
|
|
1098
|
-
|
|
1098
|
+
C = N.pop(), C && (C = C.node);
|
|
1099
1099
|
}
|
|
1100
1100
|
return null;
|
|
1101
1101
|
}
|
|
1102
|
-
function s(d,
|
|
1103
|
-
return d.dist -
|
|
1102
|
+
function s(d, b) {
|
|
1103
|
+
return d.dist - b.dist;
|
|
1104
1104
|
}
|
|
1105
|
-
function a(d,
|
|
1106
|
-
if (
|
|
1107
|
-
var
|
|
1108
|
-
if (
|
|
1109
|
-
var S =
|
|
1105
|
+
function a(d, b, g) {
|
|
1106
|
+
if (c(d, g) || c(b, g)) return 0;
|
|
1107
|
+
var E = M(d[0], d[1], b[0], b[1], g.minX, g.minY, g.maxX, g.minY);
|
|
1108
|
+
if (E === 0) return 0;
|
|
1109
|
+
var S = M(d[0], d[1], b[0], b[1], g.minX, g.minY, g.minX, g.maxY);
|
|
1110
1110
|
if (S === 0) return 0;
|
|
1111
|
-
var
|
|
1112
|
-
if (
|
|
1113
|
-
var
|
|
1114
|
-
return
|
|
1111
|
+
var k = M(d[0], d[1], b[0], b[1], g.maxX, g.minY, g.maxX, g.maxY);
|
|
1112
|
+
if (k === 0) return 0;
|
|
1113
|
+
var P = M(d[0], d[1], b[0], b[1], g.minX, g.maxY, g.maxX, g.maxY);
|
|
1114
|
+
return P === 0 ? 0 : Math.min(E, S, k, P);
|
|
1115
1115
|
}
|
|
1116
|
-
function
|
|
1117
|
-
return d[0] >=
|
|
1116
|
+
function c(d, b) {
|
|
1117
|
+
return d[0] >= b.minX && d[0] <= b.maxX && d[1] >= b.minY && d[1] <= b.maxY;
|
|
1118
1118
|
}
|
|
1119
|
-
function
|
|
1120
|
-
for (var
|
|
1121
|
-
if (
|
|
1119
|
+
function f(d, b, g) {
|
|
1120
|
+
for (var E = Math.min(d[0], b[0]), S = Math.min(d[1], b[1]), k = Math.max(d[0], b[0]), P = Math.max(d[1], b[1]), N = g.search({ minX: E, minY: S, maxX: k, maxY: P }), C = 0; C < N.length; C++)
|
|
1121
|
+
if (l(N[C].p, N[C].next.p, d, b)) return !1;
|
|
1122
1122
|
return !0;
|
|
1123
1123
|
}
|
|
1124
|
-
function
|
|
1125
|
-
return i(d[0], d[1],
|
|
1124
|
+
function h(d, b, g) {
|
|
1125
|
+
return i(d[0], d[1], b[0], b[1], g[0], g[1]);
|
|
1126
1126
|
}
|
|
1127
|
-
function
|
|
1128
|
-
return d !==
|
|
1127
|
+
function l(d, b, g, E) {
|
|
1128
|
+
return d !== E && b !== g && h(d, b, g) > 0 != h(d, b, E) > 0 && h(g, E, d) > 0 != h(g, E, b) > 0;
|
|
1129
1129
|
}
|
|
1130
|
-
function
|
|
1131
|
-
var
|
|
1132
|
-
return d.minX = Math.min(
|
|
1130
|
+
function u(d) {
|
|
1131
|
+
var b = d.p, g = d.next.p;
|
|
1132
|
+
return d.minX = Math.min(b[0], g[0]), d.minY = Math.min(b[1], g[1]), d.maxX = Math.max(b[0], g[0]), d.maxY = Math.max(b[1], g[1]), d;
|
|
1133
1133
|
}
|
|
1134
1134
|
function p(d) {
|
|
1135
|
-
for (var
|
|
1136
|
-
var
|
|
1137
|
-
|
|
1135
|
+
for (var b = d[0], g = d[0], E = d[0], S = d[0], k = 0; k < d.length; k++) {
|
|
1136
|
+
var P = d[k];
|
|
1137
|
+
P[0] < b[0] && (b = P), P[0] > E[0] && (E = P), P[1] < g[1] && (g = P), P[1] > S[1] && (S = P);
|
|
1138
1138
|
}
|
|
1139
|
-
var
|
|
1140
|
-
for (
|
|
1141
|
-
n(d[
|
|
1142
|
-
return
|
|
1139
|
+
var N = [b, g, E, S], C = N.slice();
|
|
1140
|
+
for (k = 0; k < d.length; k++)
|
|
1141
|
+
n(d[k], N) || C.push(d[k]);
|
|
1142
|
+
return v(C);
|
|
1143
1143
|
}
|
|
1144
|
-
function
|
|
1144
|
+
function _(d, b) {
|
|
1145
1145
|
var g = {
|
|
1146
1146
|
p: d,
|
|
1147
1147
|
prev: null,
|
|
@@ -1151,47 +1151,47 @@ function Li() {
|
|
|
1151
1151
|
maxX: 0,
|
|
1152
1152
|
maxY: 0
|
|
1153
1153
|
};
|
|
1154
|
-
return
|
|
1154
|
+
return b ? (g.next = b.next, g.prev = b, b.next.prev = g, b.next = g) : (g.prev = g, g.next = g), g;
|
|
1155
1155
|
}
|
|
1156
|
-
function w(d,
|
|
1157
|
-
var g = d[0] -
|
|
1158
|
-
return g * g +
|
|
1156
|
+
function w(d, b) {
|
|
1157
|
+
var g = d[0] - b[0], E = d[1] - b[1];
|
|
1158
|
+
return g * g + E * E;
|
|
1159
1159
|
}
|
|
1160
|
-
function
|
|
1161
|
-
var
|
|
1162
|
-
if (
|
|
1163
|
-
var
|
|
1164
|
-
|
|
1160
|
+
function O(d, b, g) {
|
|
1161
|
+
var E = b[0], S = b[1], k = g[0] - E, P = g[1] - S;
|
|
1162
|
+
if (k !== 0 || P !== 0) {
|
|
1163
|
+
var N = ((d[0] - E) * k + (d[1] - S) * P) / (k * k + P * P);
|
|
1164
|
+
N > 1 ? (E = g[0], S = g[1]) : N > 0 && (E += k * N, S += P * N);
|
|
1165
1165
|
}
|
|
1166
|
-
return
|
|
1166
|
+
return k = d[0] - E, P = d[1] - S, k * k + P * P;
|
|
1167
1167
|
}
|
|
1168
|
-
function
|
|
1169
|
-
var
|
|
1170
|
-
R === 0 ? (V = 0,
|
|
1171
|
-
var Q = (1 - L) * d + L * g, H = (1 - L) *
|
|
1172
|
-
return st * st +
|
|
1168
|
+
function M(d, b, g, E, S, k, P, N) {
|
|
1169
|
+
var C = g - d, F = E - b, y = P - S, I = N - k, A = d - S, T = b - k, X = C * C + F * F, D = C * y + F * I, x = y * y + I * I, B = C * A + F * T, $ = y * A + I * T, R = X * x - D * D, L, V, j, U, G = R, J = R;
|
|
1170
|
+
R === 0 ? (V = 0, G = 1, U = $, J = x) : (V = D * $ - x * B, U = X * $ - D * B, V < 0 ? (V = 0, U = $, J = x) : V > G && (V = G, U = $ + D, J = x)), U < 0 ? (U = 0, -B < 0 ? V = 0 : -B > X ? V = G : (V = -B, G = X)) : U > J && (U = J, -B + D < 0 ? V = 0 : -B + D > X ? V = G : (V = -B + D, G = X)), L = V === 0 ? 0 : V / G, j = U === 0 ? 0 : U / J;
|
|
1171
|
+
var Q = (1 - L) * d + L * g, H = (1 - L) * b + L * E, Z = (1 - j) * S + j * P, W = (1 - j) * k + j * N, st = Z - Q, ft = W - H;
|
|
1172
|
+
return st * st + ft * ft;
|
|
1173
1173
|
}
|
|
1174
|
-
function m(d,
|
|
1175
|
-
return d[0] ===
|
|
1174
|
+
function m(d, b) {
|
|
1175
|
+
return d[0] === b[0] ? d[1] - b[1] : d[0] - b[0];
|
|
1176
1176
|
}
|
|
1177
|
-
function
|
|
1177
|
+
function v(d) {
|
|
1178
1178
|
d.sort(m);
|
|
1179
|
-
for (var
|
|
1180
|
-
for (;
|
|
1181
|
-
|
|
1182
|
-
|
|
1179
|
+
for (var b = [], g = 0; g < d.length; g++) {
|
|
1180
|
+
for (; b.length >= 2 && h(b[b.length - 2], b[b.length - 1], d[g]) <= 0; )
|
|
1181
|
+
b.pop();
|
|
1182
|
+
b.push(d[g]);
|
|
1183
1183
|
}
|
|
1184
|
-
for (var
|
|
1185
|
-
for (;
|
|
1186
|
-
|
|
1187
|
-
|
|
1184
|
+
for (var E = [], S = d.length - 1; S >= 0; S--) {
|
|
1185
|
+
for (; E.length >= 2 && h(E[E.length - 2], E[E.length - 1], d[S]) <= 0; )
|
|
1186
|
+
E.pop();
|
|
1187
|
+
E.push(d[S]);
|
|
1188
1188
|
}
|
|
1189
|
-
return
|
|
1189
|
+
return E.pop(), b.pop(), b.concat(E);
|
|
1190
1190
|
}
|
|
1191
1191
|
return ye.exports;
|
|
1192
1192
|
}
|
|
1193
|
-
var
|
|
1194
|
-
const
|
|
1193
|
+
var qi = ji();
|
|
1194
|
+
const zi = /* @__PURE__ */ Ti(qi);
|
|
1195
1195
|
function mn(e, t = {}) {
|
|
1196
1196
|
t.concavity = t.concavity || 1 / 0;
|
|
1197
1197
|
const n = [];
|
|
@@ -1199,10 +1199,10 @@ function mn(e, t = {}) {
|
|
|
1199
1199
|
n.push([o[0], o[1]]);
|
|
1200
1200
|
}), !n.length)
|
|
1201
1201
|
return null;
|
|
1202
|
-
const i =
|
|
1202
|
+
const i = zi(n, t.concavity);
|
|
1203
1203
|
return i.length > 3 ? le([i], t.properties) : null;
|
|
1204
1204
|
}
|
|
1205
|
-
function
|
|
1205
|
+
function jn(e, t, n = {}) {
|
|
1206
1206
|
const i = { type: "Feature" };
|
|
1207
1207
|
return (n.id === 0 || n.id) && (i.id = n.id), n.bbox && (i.bbox = n.bbox), i.properties = t || {}, i.geometry = e, i;
|
|
1208
1208
|
}
|
|
@@ -1215,12 +1215,12 @@ function se(e, t, n = {}) {
|
|
|
1215
1215
|
throw new Error("coordinates must be at least 2 numbers long");
|
|
1216
1216
|
if (!gn(e[0]) || !gn(e[1]))
|
|
1217
1217
|
throw new Error("coordinates must contain numbers");
|
|
1218
|
-
return
|
|
1218
|
+
return jn({
|
|
1219
1219
|
type: "Point",
|
|
1220
1220
|
coordinates: e
|
|
1221
1221
|
}, t, n);
|
|
1222
1222
|
}
|
|
1223
|
-
function
|
|
1223
|
+
function qn(e, t, n = {}) {
|
|
1224
1224
|
for (const i of e) {
|
|
1225
1225
|
if (i.length < 4)
|
|
1226
1226
|
throw new Error(
|
|
@@ -1232,7 +1232,7 @@ function jn(e, t, n = {}) {
|
|
|
1232
1232
|
if (i[i.length - 1][o] !== i[0][o])
|
|
1233
1233
|
throw new Error("First and last Position are not equivalent.");
|
|
1234
1234
|
}
|
|
1235
|
-
return
|
|
1235
|
+
return jn({
|
|
1236
1236
|
type: "Polygon",
|
|
1237
1237
|
coordinates: e
|
|
1238
1238
|
}, t, n);
|
|
@@ -1244,7 +1244,7 @@ function Ht(e, t = {}) {
|
|
|
1244
1244
|
function gn(e) {
|
|
1245
1245
|
return !isNaN(e) && e !== null && !Array.isArray(e);
|
|
1246
1246
|
}
|
|
1247
|
-
function
|
|
1247
|
+
function Ji(e) {
|
|
1248
1248
|
if (!e)
|
|
1249
1249
|
throw new Error("coord is required");
|
|
1250
1250
|
if (!Array.isArray(e)) {
|
|
@@ -1269,136 +1269,144 @@ function wn(e) {
|
|
|
1269
1269
|
"coords must be GeoJSON Feature, Geometry Object or an Array"
|
|
1270
1270
|
);
|
|
1271
1271
|
}
|
|
1272
|
-
function
|
|
1272
|
+
function Gi(e) {
|
|
1273
1273
|
return e.type === "Feature" ? e.geometry : e;
|
|
1274
1274
|
}
|
|
1275
|
-
const Tt = 11102230246251565e-32, dt = 134217729,
|
|
1276
|
-
function
|
|
1277
|
-
let r, s, a,
|
|
1278
|
-
|
|
1275
|
+
const Tt = 11102230246251565e-32, dt = 134217729, Ki = (3 + 8 * Tt) * Tt;
|
|
1276
|
+
function Ye(e, t, n, i, o) {
|
|
1277
|
+
let r, s, a, c, f = t[0], h = i[0], l = 0, u = 0;
|
|
1278
|
+
h > f == h > -f ? (r = f, f = t[++l]) : (r = h, h = i[++u]);
|
|
1279
1279
|
let p = 0;
|
|
1280
|
-
if (
|
|
1281
|
-
for (
|
|
1282
|
-
|
|
1283
|
-
for (;
|
|
1284
|
-
s = r +
|
|
1285
|
-
for (;
|
|
1286
|
-
s = r +
|
|
1280
|
+
if (l < e && u < n)
|
|
1281
|
+
for (h > f == h > -f ? (s = f + r, a = r - (s - f), f = t[++l]) : (s = h + r, a = r - (s - h), h = i[++u]), r = s, a !== 0 && (o[p++] = a); l < e && u < n; )
|
|
1282
|
+
h > f == h > -f ? (s = r + f, c = s - r, a = r - (s - c) + (f - c), f = t[++l]) : (s = r + h, c = s - r, a = r - (s - c) + (h - c), h = i[++u]), r = s, a !== 0 && (o[p++] = a);
|
|
1283
|
+
for (; l < e; )
|
|
1284
|
+
s = r + f, c = s - r, a = r - (s - c) + (f - c), f = t[++l], r = s, a !== 0 && (o[p++] = a);
|
|
1285
|
+
for (; u < n; )
|
|
1286
|
+
s = r + h, c = s - r, a = r - (s - c) + (h - c), h = i[++u], r = s, a !== 0 && (o[p++] = a);
|
|
1287
1287
|
return (r !== 0 || p === 0) && (o[p++] = r), p;
|
|
1288
1288
|
}
|
|
1289
|
-
function
|
|
1289
|
+
function Qi(e, t) {
|
|
1290
1290
|
let n = t[0];
|
|
1291
1291
|
for (let i = 1; i < e; i++) n += t[i];
|
|
1292
1292
|
return n;
|
|
1293
1293
|
}
|
|
1294
|
-
function
|
|
1294
|
+
function he(e) {
|
|
1295
1295
|
return new Float64Array(e);
|
|
1296
1296
|
}
|
|
1297
|
-
const
|
|
1298
|
-
function
|
|
1299
|
-
let a,
|
|
1300
|
-
const
|
|
1301
|
-
d =
|
|
1302
|
-
let
|
|
1303
|
-
if (
|
|
1304
|
-
d = a *
|
|
1305
|
-
const
|
|
1306
|
-
d =
|
|
1307
|
-
const
|
|
1308
|
-
d = a *
|
|
1309
|
-
const T =
|
|
1297
|
+
const Hi = (3 + 16 * Tt) * Tt, Wi = (2 + 12 * Tt) * Tt, Zi = (9 + 64 * Tt) * Tt * Tt, Gt = he(4), yn = he(8), vn = he(12), bn = he(16), vt = he(4);
|
|
1298
|
+
function tr(e, t, n, i, o, r, s) {
|
|
1299
|
+
let a, c, f, h, l, u, p, _, w, O, M, m, v, d, b, g, E, S;
|
|
1300
|
+
const k = e - o, P = n - o, N = t - r, C = i - r;
|
|
1301
|
+
d = k * C, u = dt * k, p = u - (u - k), _ = k - p, u = dt * C, w = u - (u - C), O = C - w, b = _ * O - (d - p * w - _ * w - p * O), g = N * P, u = dt * N, p = u - (u - N), _ = N - p, u = dt * P, w = u - (u - P), O = P - w, E = _ * O - (g - p * w - _ * w - p * O), M = b - E, l = b - M, Gt[0] = b - (M + l) + (l - E), m = d + M, l = m - d, v = d - (m - l) + (M - l), M = v - g, l = v - M, Gt[1] = v - (M + l) + (l - g), S = m + M, l = S - m, Gt[2] = m - (S - l) + (M - l), Gt[3] = S;
|
|
1302
|
+
let F = Qi(4, Gt), y = Wi * s;
|
|
1303
|
+
if (F >= y || -F >= y || (l = e - k, a = e - (k + l) + (l - o), l = n - P, f = n - (P + l) + (l - o), l = t - N, c = t - (N + l) + (l - r), l = i - C, h = i - (C + l) + (l - r), a === 0 && c === 0 && f === 0 && h === 0) || (y = Zi * s + Ki * Math.abs(F), F += k * h + C * a - (N * f + P * c), F >= y || -F >= y)) return F;
|
|
1304
|
+
d = a * C, u = dt * a, p = u - (u - a), _ = a - p, u = dt * C, w = u - (u - C), O = C - w, b = _ * O - (d - p * w - _ * w - p * O), g = c * P, u = dt * c, p = u - (u - c), _ = c - p, u = dt * P, w = u - (u - P), O = P - w, E = _ * O - (g - p * w - _ * w - p * O), M = b - E, l = b - M, vt[0] = b - (M + l) + (l - E), m = d + M, l = m - d, v = d - (m - l) + (M - l), M = v - g, l = v - M, vt[1] = v - (M + l) + (l - g), S = m + M, l = S - m, vt[2] = m - (S - l) + (M - l), vt[3] = S;
|
|
1305
|
+
const I = Ye(4, Gt, 4, vt, yn);
|
|
1306
|
+
d = k * h, u = dt * k, p = u - (u - k), _ = k - p, u = dt * h, w = u - (u - h), O = h - w, b = _ * O - (d - p * w - _ * w - p * O), g = N * f, u = dt * N, p = u - (u - N), _ = N - p, u = dt * f, w = u - (u - f), O = f - w, E = _ * O - (g - p * w - _ * w - p * O), M = b - E, l = b - M, vt[0] = b - (M + l) + (l - E), m = d + M, l = m - d, v = d - (m - l) + (M - l), M = v - g, l = v - M, vt[1] = v - (M + l) + (l - g), S = m + M, l = S - m, vt[2] = m - (S - l) + (M - l), vt[3] = S;
|
|
1307
|
+
const A = Ye(I, yn, 4, vt, vn);
|
|
1308
|
+
d = a * h, u = dt * a, p = u - (u - a), _ = a - p, u = dt * h, w = u - (u - h), O = h - w, b = _ * O - (d - p * w - _ * w - p * O), g = c * f, u = dt * c, p = u - (u - c), _ = c - p, u = dt * f, w = u - (u - f), O = f - w, E = _ * O - (g - p * w - _ * w - p * O), M = b - E, l = b - M, vt[0] = b - (M + l) + (l - E), m = d + M, l = m - d, v = d - (m - l) + (M - l), M = v - g, l = v - M, vt[1] = v - (M + l) + (l - g), S = m + M, l = S - m, vt[2] = m - (S - l) + (M - l), vt[3] = S;
|
|
1309
|
+
const T = Ye(A, vn, 4, vt, bn);
|
|
1310
1310
|
return bn[T - 1];
|
|
1311
1311
|
}
|
|
1312
|
-
function
|
|
1313
|
-
const s = (t - r) * (n - o), a = (e - o) * (i - r),
|
|
1314
|
-
return Math.abs(
|
|
1312
|
+
function er(e, t, n, i, o, r) {
|
|
1313
|
+
const s = (t - r) * (n - o), a = (e - o) * (i - r), c = s - a, f = Math.abs(s + a);
|
|
1314
|
+
return Math.abs(c) >= Hi * f ? c : -tr(e, t, n, i, o, r, f);
|
|
1315
1315
|
}
|
|
1316
|
-
function
|
|
1317
|
-
var n, i, o = 0, r, s, a,
|
|
1318
|
-
for (n = 0; n <
|
|
1316
|
+
function nr(e, t) {
|
|
1317
|
+
var n, i, o = 0, r, s, a, c, f, h, l, u = e[0], p = e[1], _ = t.length;
|
|
1318
|
+
for (n = 0; n < _; n++) {
|
|
1319
1319
|
i = 0;
|
|
1320
|
-
var w = t[n],
|
|
1321
|
-
if (
|
|
1320
|
+
var w = t[n], O = w.length - 1;
|
|
1321
|
+
if (h = w[0], h[0] !== w[O][0] && h[1] !== w[O][1])
|
|
1322
1322
|
throw new Error("First and last coordinates in a ring must be the same");
|
|
1323
|
-
for (s =
|
|
1324
|
-
if (
|
|
1325
|
-
if (
|
|
1323
|
+
for (s = h[0] - u, a = h[1] - p, i; i < O; i++) {
|
|
1324
|
+
if (l = w[i + 1], c = l[0] - u, f = l[1] - p, a === 0 && f === 0) {
|
|
1325
|
+
if (c <= 0 && s >= 0 || s <= 0 && c >= 0)
|
|
1326
1326
|
return 0;
|
|
1327
|
-
} else if (
|
|
1328
|
-
if (r =
|
|
1327
|
+
} else if (f >= 0 && a <= 0 || f <= 0 && a >= 0) {
|
|
1328
|
+
if (r = er(s, c, a, f, 0, 0), r === 0)
|
|
1329
1329
|
return 0;
|
|
1330
|
-
(r > 0 &&
|
|
1330
|
+
(r > 0 && f > 0 && a <= 0 || r < 0 && f <= 0 && a > 0) && o++;
|
|
1331
1331
|
}
|
|
1332
|
-
|
|
1332
|
+
h = l, a = f, s = c;
|
|
1333
1333
|
}
|
|
1334
1334
|
}
|
|
1335
1335
|
return o % 2 !== 0;
|
|
1336
1336
|
}
|
|
1337
|
-
function
|
|
1337
|
+
function Ue(e, t, n = {}) {
|
|
1338
1338
|
if (!e)
|
|
1339
1339
|
throw new Error("point is required");
|
|
1340
1340
|
if (!t)
|
|
1341
1341
|
throw new Error("polygon is required");
|
|
1342
|
-
const i =
|
|
1342
|
+
const i = Ji(e), o = Gi(t), r = o.type, s = t.bbox;
|
|
1343
1343
|
let a = o.coordinates;
|
|
1344
|
-
if (s &&
|
|
1344
|
+
if (s && ir(i, s) === !1)
|
|
1345
1345
|
return !1;
|
|
1346
1346
|
r === "Polygon" && (a = [a]);
|
|
1347
|
-
for (var
|
|
1348
|
-
const
|
|
1349
|
-
if (
|
|
1347
|
+
for (var c = 0; c < a.length; ++c) {
|
|
1348
|
+
const f = nr(i, a[c]);
|
|
1349
|
+
if (f === 0 && !n.ignoreBoundary || f) return !0;
|
|
1350
1350
|
}
|
|
1351
1351
|
return !1;
|
|
1352
1352
|
}
|
|
1353
|
-
function
|
|
1353
|
+
function ir(e, t) {
|
|
1354
1354
|
return t[0] <= e[0] && t[1] <= e[1] && t[2] >= e[0] && t[3] >= e[1];
|
|
1355
1355
|
}
|
|
1356
1356
|
function Le(e, t) {
|
|
1357
1357
|
for (let n = 0; n < t.features.length; n++)
|
|
1358
|
-
if (
|
|
1358
|
+
if (Ue(e, t.features[n]))
|
|
1359
1359
|
return t.features[n];
|
|
1360
1360
|
}
|
|
1361
|
-
function
|
|
1362
|
-
const n = t.geometry.coordinates[0][0], i = t.geometry.coordinates[0][1], o = t.geometry.coordinates[0][2], r = e.geometry.coordinates, s = t.properties.a.geom, a = t.properties.b.geom,
|
|
1361
|
+
function zn(e, t) {
|
|
1362
|
+
const n = t.geometry.coordinates[0][0], i = t.geometry.coordinates[0][1], o = t.geometry.coordinates[0][2], r = e.geometry.coordinates, s = t.properties.a.geom, a = t.properties.b.geom, c = t.properties.c.geom, f = [i[0] - n[0], i[1] - n[1]], h = [o[0] - n[0], o[1] - n[1]], l = [r[0] - n[0], r[1] - n[1]], u = [a[0] - s[0], a[1] - s[1]], p = [c[0] - s[0], c[1] - s[1]], _ = (h[1] * l[0] - h[0] * l[1]) / (f[0] * h[1] - f[1] * h[0]), w = (f[0] * l[1] - f[1] * l[0]) / (f[0] * h[1] - f[1] * h[0]);
|
|
1363
1363
|
return [
|
|
1364
|
-
|
|
1365
|
-
|
|
1364
|
+
_ * u[0] + w * p[0] + s[0],
|
|
1365
|
+
_ * u[1] + w * p[1] + s[1]
|
|
1366
1366
|
];
|
|
1367
1367
|
}
|
|
1368
|
-
function
|
|
1369
|
-
const i = e.geometry.coordinates, o = n.geometry.coordinates, r = Math.atan2(i[0] - o[0], i[1] - o[1]), s =
|
|
1368
|
+
function rr(e, t, n) {
|
|
1369
|
+
const i = e.geometry.coordinates, o = n.geometry.coordinates, r = Math.atan2(i[0] - o[0], i[1] - o[1]), s = sr(r, t[0]);
|
|
1370
1370
|
if (s === void 0)
|
|
1371
1371
|
throw new Error("Unable to determine vertex index");
|
|
1372
1372
|
const a = t[1][s];
|
|
1373
|
-
return
|
|
1373
|
+
return zn(e, a.features[0]);
|
|
1374
1374
|
}
|
|
1375
1375
|
function ne(e, t, n, i, o, r, s, a) {
|
|
1376
|
-
let
|
|
1377
|
-
if (s && (
|
|
1376
|
+
let c;
|
|
1377
|
+
if (s && (c = Le(e, Ht([s]))), !c)
|
|
1378
1378
|
if (n) {
|
|
1379
|
-
const
|
|
1380
|
-
|
|
1379
|
+
const f = e.geometry.coordinates, h = n.gridNum, l = n.xOrigin, u = n.yOrigin, p = n.xUnit, _ = n.yUnit, w = n.gridCache, O = xt(f[0], l, p, h), M = xt(f[1], u, _, h), m = w[O] ? w[O][M] ? w[O][M] : [] : [], v = Ht(m.map((d) => t.features[d]));
|
|
1380
|
+
c = Le(e, v);
|
|
1381
1381
|
} else
|
|
1382
|
-
|
|
1383
|
-
return a && a(
|
|
1382
|
+
c = Le(e, t);
|
|
1383
|
+
return a && a(c), c ? zn(e, c) : rr(e, i, o);
|
|
1384
1384
|
}
|
|
1385
|
-
function
|
|
1385
|
+
function xt(e, t, n, i) {
|
|
1386
1386
|
let o = Math.floor((e - t) / n);
|
|
1387
1387
|
return o < 0 && (o = 0), o >= i && (o = i - 1), o;
|
|
1388
1388
|
}
|
|
1389
|
-
|
|
1390
|
-
|
|
1389
|
+
const or = 36;
|
|
1390
|
+
function xn(e, t, n) {
|
|
1391
|
+
const i = (t[1][0] - t[0][0]) / n, o = (t[1][1] - t[0][1]) / n;
|
|
1392
|
+
return e.reduce((r, s) => {
|
|
1393
|
+
const a = xt(s[0][0], t[0][0], i, n), c = xt(s[1][0], t[0][0], i, n), f = xt(s[0][1], t[0][1], o, n), h = xt(s[1][1], t[0][1], o, n), l = (c - a + 1) * (h - f + 1);
|
|
1394
|
+
return l > 0 ? r + l : r;
|
|
1395
|
+
}, 0);
|
|
1396
|
+
}
|
|
1397
|
+
function sr(e, t) {
|
|
1398
|
+
let n = _n(e - t[0]), i = Math.PI * 2, o;
|
|
1391
1399
|
for (let r = 0; r < t.length; r++) {
|
|
1392
|
-
const s = (r + 1) % t.length, a =
|
|
1393
|
-
n * a <= 0 &&
|
|
1400
|
+
const s = (r + 1) % t.length, a = _n(e - t[s]), c = Math.min(Math.abs(n), Math.abs(a));
|
|
1401
|
+
n * a <= 0 && c < i && (i = c, o = r), n = a;
|
|
1394
1402
|
}
|
|
1395
1403
|
return o;
|
|
1396
1404
|
}
|
|
1397
|
-
function
|
|
1405
|
+
function _n(e, t = !1) {
|
|
1398
1406
|
const n = 2 * Math.PI, i = e - Math.floor(e / n) * n;
|
|
1399
1407
|
return t ? i : i > Math.PI ? i - n : i;
|
|
1400
1408
|
}
|
|
1401
|
-
function
|
|
1409
|
+
function Mn(e) {
|
|
1402
1410
|
const t = e.features;
|
|
1403
1411
|
for (let n = 0; n < t.length; n++) {
|
|
1404
1412
|
const i = t[n];
|
|
@@ -1460,7 +1468,7 @@ function _n(e) {
|
|
|
1460
1468
|
}
|
|
1461
1469
|
return e;
|
|
1462
1470
|
}
|
|
1463
|
-
function
|
|
1471
|
+
function Jn(e) {
|
|
1464
1472
|
const t = ["a", "b", "c", "a"].map(
|
|
1465
1473
|
(r) => e.properties[r].geom
|
|
1466
1474
|
), n = e.geometry.coordinates[0], i = e.properties, o = {
|
|
@@ -1468,56 +1476,56 @@ function Un(e) {
|
|
|
1468
1476
|
b: { geom: n[1], index: i.b.index },
|
|
1469
1477
|
c: { geom: n[2], index: i.c.index }
|
|
1470
1478
|
};
|
|
1471
|
-
return
|
|
1479
|
+
return qn([t], o);
|
|
1472
1480
|
}
|
|
1473
|
-
function
|
|
1481
|
+
function ar(e) {
|
|
1474
1482
|
const t = [0, 1, 2, 0].map((i) => e[i][0][0]), n = {
|
|
1475
1483
|
a: { geom: e[0][0][1], index: e[0][1] },
|
|
1476
1484
|
b: { geom: e[1][0][1], index: e[1][1] },
|
|
1477
1485
|
c: { geom: e[2][0][1], index: e[2][1] }
|
|
1478
1486
|
};
|
|
1479
|
-
return
|
|
1487
|
+
return qn([t], n);
|
|
1480
1488
|
}
|
|
1481
|
-
function
|
|
1489
|
+
function je(e, t, n, i, o, r = !1, s) {
|
|
1482
1490
|
const a = e.map(
|
|
1483
|
-
(
|
|
1484
|
-
(!s || s < 2.00703) && (
|
|
1485
|
-
const
|
|
1486
|
-
const
|
|
1487
|
-
if (
|
|
1488
|
-
const
|
|
1489
|
-
if (
|
|
1491
|
+
(c) => {
|
|
1492
|
+
(!s || s < 2.00703) && (c = cr(c));
|
|
1493
|
+
const f = isFinite(c) ? t[c] : c === "c" ? i : (function() {
|
|
1494
|
+
const h = c.match(/^b(\d+)$/);
|
|
1495
|
+
if (h) return o[parseInt(h[1])];
|
|
1496
|
+
const l = c.match(/^e(\d+)$/);
|
|
1497
|
+
if (l) return n[parseInt(l[1])];
|
|
1490
1498
|
throw new Error("Bad index value for indexesToTri");
|
|
1491
1499
|
})();
|
|
1492
|
-
return r ? [[
|
|
1500
|
+
return r ? [[f[1], f[0]], c] : [[f[0], f[1]], c];
|
|
1493
1501
|
}
|
|
1494
1502
|
);
|
|
1495
|
-
return
|
|
1503
|
+
return ar(a);
|
|
1496
1504
|
}
|
|
1497
|
-
function
|
|
1505
|
+
function cr(e) {
|
|
1498
1506
|
return typeof e == "number" ? e : e.replace(/^(c|e|b)(?:ent|dgeNode|box)(\d+)?$/, "$1$2");
|
|
1499
1507
|
}
|
|
1500
|
-
function
|
|
1508
|
+
function Gn(e, t) {
|
|
1501
1509
|
return t && t >= 2.00703 || Array.isArray(e[0]) ? e : e.map((n) => [
|
|
1502
1510
|
n.illstNodes,
|
|
1503
1511
|
n.mercNodes,
|
|
1504
1512
|
n.startEnd
|
|
1505
1513
|
]);
|
|
1506
1514
|
}
|
|
1507
|
-
const
|
|
1508
|
-
function
|
|
1515
|
+
const lr = 2.00704;
|
|
1516
|
+
function fr(e) {
|
|
1509
1517
|
return !!(e.version !== void 0 || !e.tins && e.points && e.tins_points);
|
|
1510
1518
|
}
|
|
1511
|
-
function
|
|
1519
|
+
function hr(e) {
|
|
1512
1520
|
return {
|
|
1513
1521
|
points: e.points,
|
|
1514
|
-
strictStatus:
|
|
1515
|
-
verticesParams:
|
|
1516
|
-
centroid:
|
|
1517
|
-
edges:
|
|
1522
|
+
strictStatus: dr(e),
|
|
1523
|
+
verticesParams: pr(e),
|
|
1524
|
+
centroid: mr(e),
|
|
1525
|
+
edges: Gn(e.edges || []),
|
|
1518
1526
|
edgeNodes: e.edgeNodes || [],
|
|
1519
|
-
tins:
|
|
1520
|
-
kinks:
|
|
1527
|
+
tins: gr(e),
|
|
1528
|
+
kinks: wr(e.kinks_points),
|
|
1521
1529
|
yaxisMode: e.yaxisMode ?? "invert",
|
|
1522
1530
|
strictMode: e.strictMode ?? "auto",
|
|
1523
1531
|
vertexMode: e.vertexMode,
|
|
@@ -1527,44 +1535,68 @@ function ar(e) {
|
|
|
1527
1535
|
xy: e.xy ?? [0, 0]
|
|
1528
1536
|
};
|
|
1529
1537
|
}
|
|
1530
|
-
function
|
|
1531
|
-
const t =
|
|
1532
|
-
return {
|
|
1538
|
+
function ur(e) {
|
|
1539
|
+
const t = yr(e), n = t.tins, i = t.vertices_params;
|
|
1540
|
+
return i != null && Kn(i), {
|
|
1533
1541
|
compiled: t,
|
|
1534
1542
|
tins: n,
|
|
1535
|
-
points:
|
|
1543
|
+
points: vr(n),
|
|
1536
1544
|
strictStatus: t.strict_status,
|
|
1537
|
-
verticesParams:
|
|
1545
|
+
verticesParams: i,
|
|
1538
1546
|
centroid: t.centroid,
|
|
1539
1547
|
kinks: t.kinks
|
|
1540
1548
|
};
|
|
1541
1549
|
}
|
|
1542
|
-
function
|
|
1550
|
+
function dr(e) {
|
|
1543
1551
|
return e.strict_status ? e.strict_status : e.kinks_points ? "strict_error" : e.tins_points.length === 2 ? "loose" : "strict";
|
|
1544
1552
|
}
|
|
1545
|
-
function
|
|
1553
|
+
function pr(e) {
|
|
1554
|
+
if (!Array.isArray(e.vertices_params) || !Array.isArray(e.vertices_points))
|
|
1555
|
+
throw new Error(
|
|
1556
|
+
"Invalid compiled data: vertices_params and vertices_points must be arrays"
|
|
1557
|
+
);
|
|
1546
1558
|
const t = {
|
|
1547
1559
|
forw: [e.vertices_params[0]],
|
|
1548
1560
|
bakw: [e.vertices_params[1]]
|
|
1549
1561
|
};
|
|
1550
|
-
return t.forw[1] =
|
|
1562
|
+
return t.forw[1] = Sn(e, !1), t.bakw[1] = Sn(e, !0), Kn(t), t;
|
|
1563
|
+
}
|
|
1564
|
+
function Kn(e) {
|
|
1565
|
+
if (typeof e != "object")
|
|
1566
|
+
throw new Error("Invalid compiled data: vertices_params has a wrong shape");
|
|
1567
|
+
["forw", "bakw"].forEach((t) => {
|
|
1568
|
+
const n = e[t];
|
|
1569
|
+
if (n == null) return;
|
|
1570
|
+
const i = `vertices_params.${t}`, o = n[0], r = n[1];
|
|
1571
|
+
if (!Array.isArray(o) || !Array.isArray(r))
|
|
1572
|
+
throw new Error(`Invalid compiled data: ${i} must hold two arrays`);
|
|
1573
|
+
if (o.length !== r.length)
|
|
1574
|
+
throw new Error(
|
|
1575
|
+
`Invalid compiled data: ${i} must have one angle per vertex`
|
|
1576
|
+
);
|
|
1577
|
+
for (let s = 0; s < o.length; s++)
|
|
1578
|
+
if (typeof o[s] != "number" || !Number.isFinite(o[s]))
|
|
1579
|
+
throw new Error(
|
|
1580
|
+
`Invalid compiled data: ${i} must contain only finite numbers`
|
|
1581
|
+
);
|
|
1582
|
+
});
|
|
1551
1583
|
}
|
|
1552
|
-
function
|
|
1584
|
+
function Sn(e, t) {
|
|
1553
1585
|
const n = e.vertices_points.length;
|
|
1554
1586
|
return Array.from({ length: n }, (i, o) => {
|
|
1555
|
-
const r = (o + 1) % n, s =
|
|
1587
|
+
const r = (o + 1) % n, s = je(
|
|
1556
1588
|
["c", `b${o}`, `b${r}`],
|
|
1557
1589
|
e.points,
|
|
1558
1590
|
e.edgeNodes || [],
|
|
1559
1591
|
e.centroid_point,
|
|
1560
1592
|
e.vertices_points,
|
|
1561
1593
|
t,
|
|
1562
|
-
|
|
1594
|
+
lr
|
|
1563
1595
|
);
|
|
1564
1596
|
return Ht([s]);
|
|
1565
1597
|
});
|
|
1566
1598
|
}
|
|
1567
|
-
function
|
|
1599
|
+
function mr(e) {
|
|
1568
1600
|
return {
|
|
1569
1601
|
forw: se(e.centroid_point[0], {
|
|
1570
1602
|
target: {
|
|
@@ -1580,12 +1612,12 @@ function fr(e) {
|
|
|
1580
1612
|
})
|
|
1581
1613
|
};
|
|
1582
1614
|
}
|
|
1583
|
-
function
|
|
1615
|
+
function gr(e) {
|
|
1584
1616
|
const t = e.tins_points.length === 1 ? 0 : 1;
|
|
1585
1617
|
return {
|
|
1586
1618
|
forw: Ht(
|
|
1587
1619
|
e.tins_points[0].map(
|
|
1588
|
-
(n) =>
|
|
1620
|
+
(n) => je(
|
|
1589
1621
|
n,
|
|
1590
1622
|
e.points,
|
|
1591
1623
|
e.edgeNodes || [],
|
|
@@ -1598,7 +1630,7 @@ function ur(e) {
|
|
|
1598
1630
|
),
|
|
1599
1631
|
bakw: Ht(
|
|
1600
1632
|
e.tins_points[t].map(
|
|
1601
|
-
(n) =>
|
|
1633
|
+
(n) => je(
|
|
1602
1634
|
n,
|
|
1603
1635
|
e.points,
|
|
1604
1636
|
e.edgeNodes || [],
|
|
@@ -1611,7 +1643,7 @@ function ur(e) {
|
|
|
1611
1643
|
)
|
|
1612
1644
|
};
|
|
1613
1645
|
}
|
|
1614
|
-
function
|
|
1646
|
+
function wr(e) {
|
|
1615
1647
|
if (e)
|
|
1616
1648
|
return {
|
|
1617
1649
|
bakw: Ht(
|
|
@@ -1619,23 +1651,23 @@ function dr(e) {
|
|
|
1619
1651
|
)
|
|
1620
1652
|
};
|
|
1621
1653
|
}
|
|
1622
|
-
function
|
|
1654
|
+
function yr(e) {
|
|
1623
1655
|
return JSON.parse(
|
|
1624
1656
|
JSON.stringify(e).replace('"cent"', '"c"').replace(/"bbox(\d+)"/g, '"b$1"')
|
|
1625
1657
|
);
|
|
1626
1658
|
}
|
|
1627
|
-
function
|
|
1659
|
+
function vr(e) {
|
|
1628
1660
|
const t = [], n = e.forw.features;
|
|
1629
1661
|
for (let i = 0; i < n.length; i++) {
|
|
1630
1662
|
const o = n[i];
|
|
1631
1663
|
["a", "b", "c"].forEach((r, s) => {
|
|
1632
|
-
const a = o.geometry.coordinates[0][s],
|
|
1633
|
-
typeof
|
|
1664
|
+
const a = o.geometry.coordinates[0][s], c = o.properties[r].geom, f = o.properties[r].index;
|
|
1665
|
+
typeof f == "number" && (t[f] = [a, c]);
|
|
1634
1666
|
});
|
|
1635
1667
|
}
|
|
1636
1668
|
return t;
|
|
1637
1669
|
}
|
|
1638
|
-
class
|
|
1670
|
+
class St {
|
|
1639
1671
|
/**
|
|
1640
1672
|
* 各種モードの定数定義
|
|
1641
1673
|
* すべてreadonlyで、型安全性を確保
|
|
@@ -1651,7 +1683,7 @@ class Mt {
|
|
|
1651
1683
|
static YAXIS_FOLLOW = "follow";
|
|
1652
1684
|
static YAXIS_INVERT = "invert";
|
|
1653
1685
|
points = [];
|
|
1654
|
-
/** @deprecated 2.00704 以降、Transform はこのプロパティを設定も参照もしない。サブクラス(MaplatTin)は、旧 @maplat/transform と組まれたときの互換のため {}
|
|
1686
|
+
/** @deprecated 2.00704 以降、Transform はこのプロパティを設定も参照もしない。サブクラス(MaplatTin)は、旧 @maplat/transform と組まれたときの互換のため {} を入れる */
|
|
1655
1687
|
pointsWeightBuffer;
|
|
1656
1688
|
strict_status;
|
|
1657
1689
|
vertices_params;
|
|
@@ -1660,9 +1692,9 @@ class Mt {
|
|
|
1660
1692
|
edges;
|
|
1661
1693
|
tins;
|
|
1662
1694
|
kinks;
|
|
1663
|
-
yaxisMode =
|
|
1664
|
-
strictMode =
|
|
1665
|
-
vertexMode =
|
|
1695
|
+
yaxisMode = St.YAXIS_INVERT;
|
|
1696
|
+
strictMode = St.MODE_AUTO;
|
|
1697
|
+
vertexMode = St.VERTEX_PLAIN;
|
|
1666
1698
|
bounds;
|
|
1667
1699
|
boundsPolygon;
|
|
1668
1700
|
wh;
|
|
@@ -1699,14 +1731,14 @@ class Mt {
|
|
|
1699
1731
|
* 4. インデックスの作成
|
|
1700
1732
|
*/
|
|
1701
1733
|
setCompiled(t) {
|
|
1702
|
-
if (
|
|
1703
|
-
this.applyModernState(
|
|
1734
|
+
if (fr(t)) {
|
|
1735
|
+
this.applyModernState(hr(t));
|
|
1704
1736
|
return;
|
|
1705
1737
|
}
|
|
1706
|
-
this.applyLegacyState(
|
|
1738
|
+
this.applyLegacyState(ur(t));
|
|
1707
1739
|
}
|
|
1708
1740
|
applyModernState(t) {
|
|
1709
|
-
this.points = t.points, this.strict_status = t.strictStatus, this.vertices_params = t.verticesParams, this.centroid = t.centroid, this.edges = t.edges, this.edgeNodes = t.edgeNodes || [], this.tins = t.tins, this.addIndexedTin(), this.kinks = t.kinks, this.yaxisMode = t.yaxisMode ??
|
|
1741
|
+
this.points = t.points, this.strict_status = t.strictStatus, this.vertices_params = t.verticesParams, this.centroid = t.centroid, this.edges = t.edges, this.edgeNodes = t.edgeNodes || [], this.tins = t.tins, this.addIndexedTin(), this.kinks = t.kinks, this.yaxisMode = t.yaxisMode ?? St.YAXIS_INVERT, this.vertexMode = t.vertexMode ?? St.VERTEX_PLAIN, this.strictMode = t.strictMode ?? St.MODE_AUTO, t.bounds ? (this.bounds = t.bounds, this.boundsPolygon = t.boundsPolygon, this.xy = t.xy, this.wh = t.wh) : (this.bounds = void 0, this.boundsPolygon = void 0, this.xy = t.xy ?? [0, 0], t.wh && (this.wh = t.wh));
|
|
1710
1742
|
}
|
|
1711
1743
|
applyLegacyState(t) {
|
|
1712
1744
|
this.tins = t.tins, this.addIndexedTin(), this.strict_status = t.strictStatus, this.vertices_params = t.verticesParams, this.centroid = t.centroid, this.kinks = t.kinks, this.points = t.points;
|
|
@@ -1717,6 +1749,8 @@ class Mt {
|
|
|
1717
1749
|
* インデックスは変換処理を高速化するために使用されます。
|
|
1718
1750
|
* グリッド形式のインデックスを作成し、各グリッドに
|
|
1719
1751
|
* 含まれる三角形を記録します。
|
|
1752
|
+
* セル数が MAX_INDEX_CELLS_PER_TRIANGLE で決まる上限を超えるデータは
|
|
1753
|
+
* 索引を作らず、変換時に全三角形を線形に探します。
|
|
1720
1754
|
*/
|
|
1721
1755
|
addIndexedTin() {
|
|
1722
1756
|
const t = this.tins, n = t.forw, i = t.bakw, o = Math.ceil(Math.sqrt(n.features.length));
|
|
@@ -1726,33 +1760,41 @@ class Mt {
|
|
|
1726
1760
|
}
|
|
1727
1761
|
let r = [], s = [];
|
|
1728
1762
|
const a = n.features.map((w) => {
|
|
1729
|
-
let
|
|
1730
|
-
return wn(w)[0].map((
|
|
1731
|
-
r.length === 0 ? r = [Array.from(
|
|
1732
|
-
}),
|
|
1733
|
-
}),
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1763
|
+
let O = [];
|
|
1764
|
+
return wn(w)[0].map((M) => {
|
|
1765
|
+
r.length === 0 ? r = [Array.from(M), Array.from(M)] : (M[0] < r[0][0] && (r[0][0] = M[0]), M[0] > r[1][0] && (r[1][0] = M[0]), M[1] < r[0][1] && (r[0][1] = M[1]), M[1] > r[1][1] && (r[1][1] = M[1])), O.length === 0 ? O = [Array.from(M), Array.from(M)] : (M[0] < O[0][0] && (O[0][0] = M[0]), M[0] > O[1][0] && (O[1][0] = M[0]), M[1] < O[0][1] && (O[0][1] = M[1]), M[1] > O[1][1] && (O[1][1] = M[1]));
|
|
1766
|
+
}), O;
|
|
1767
|
+
}), c = i.features.map((w) => {
|
|
1768
|
+
let O = [];
|
|
1769
|
+
return wn(w)[0].map((M) => {
|
|
1770
|
+
s.length === 0 ? s = [Array.from(M), Array.from(M)] : (M[0] < s[0][0] && (s[0][0] = M[0]), M[0] > s[1][0] && (s[1][0] = M[0]), M[1] < s[0][1] && (s[0][1] = M[1]), M[1] > s[1][1] && (s[1][1] = M[1])), O.length === 0 ? O = [Array.from(M), Array.from(M)] : (M[0] < O[0][0] && (O[0][0] = M[0]), M[0] > O[1][0] && (O[1][0] = M[0]), M[1] < O[0][1] && (O[0][1] = M[1]), M[1] > O[1][1] && (O[1][1] = M[1]));
|
|
1771
|
+
}), O;
|
|
1772
|
+
});
|
|
1773
|
+
if (Math.max(
|
|
1774
|
+
xn(a, r, o),
|
|
1775
|
+
xn(c, s, o)
|
|
1776
|
+
) > or * n.features.length) {
|
|
1777
|
+
this.indexedTins = void 0;
|
|
1778
|
+
return;
|
|
1779
|
+
}
|
|
1780
|
+
const f = (r[1][0] - r[0][0]) / o, h = (r[1][1] - r[0][1]) / o, l = a.reduce(
|
|
1781
|
+
(w, O, M) => {
|
|
1782
|
+
const m = xt(O[0][0], r[0][0], f, o), v = xt(O[1][0], r[0][0], f, o), d = xt(O[0][1], r[0][1], h, o), b = xt(O[1][1], r[0][1], h, o);
|
|
1783
|
+
for (let g = m; g <= v; g++) {
|
|
1737
1784
|
w[g] || (w[g] = []);
|
|
1738
|
-
for (let
|
|
1739
|
-
w[g][
|
|
1785
|
+
for (let E = d; E <= b; E++)
|
|
1786
|
+
w[g][E] || (w[g][E] = []), w[g][E].push(M);
|
|
1740
1787
|
}
|
|
1741
1788
|
return w;
|
|
1742
1789
|
},
|
|
1743
1790
|
[]
|
|
1744
|
-
),
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
}), I;
|
|
1749
|
-
}), f = (s[1][0] - s[0][0]) / o, p = (s[1][1] - s[0][1]) / o, M = c.reduce(
|
|
1750
|
-
(w, I, x) => {
|
|
1751
|
-
const m = It(I[0][0], s[0][0], f, o), _ = It(I[1][0], s[0][0], f, o), d = It(I[0][1], s[0][1], p, o), v = It(I[1][1], s[0][1], p, o);
|
|
1752
|
-
for (let g = m; g <= _; g++) {
|
|
1791
|
+
), u = (s[1][0] - s[0][0]) / o, p = (s[1][1] - s[0][1]) / o, _ = c.reduce(
|
|
1792
|
+
(w, O, M) => {
|
|
1793
|
+
const m = xt(O[0][0], s[0][0], u, o), v = xt(O[1][0], s[0][0], u, o), d = xt(O[0][1], s[0][1], p, o), b = xt(O[1][1], s[0][1], p, o);
|
|
1794
|
+
for (let g = m; g <= v; g++) {
|
|
1753
1795
|
w[g] || (w[g] = []);
|
|
1754
|
-
for (let
|
|
1755
|
-
w[g][
|
|
1796
|
+
for (let E = d; E <= b; E++)
|
|
1797
|
+
w[g][E] || (w[g][E] = []), w[g][E].push(M);
|
|
1756
1798
|
}
|
|
1757
1799
|
return w;
|
|
1758
1800
|
},
|
|
@@ -1763,17 +1805,17 @@ class Mt {
|
|
|
1763
1805
|
gridNum: o,
|
|
1764
1806
|
xOrigin: r[0][0],
|
|
1765
1807
|
yOrigin: r[0][1],
|
|
1766
|
-
xUnit:
|
|
1767
|
-
yUnit:
|
|
1768
|
-
gridCache:
|
|
1808
|
+
xUnit: f,
|
|
1809
|
+
yUnit: h,
|
|
1810
|
+
gridCache: l
|
|
1769
1811
|
},
|
|
1770
1812
|
bakw: {
|
|
1771
1813
|
gridNum: o,
|
|
1772
1814
|
xOrigin: s[0][0],
|
|
1773
1815
|
yOrigin: s[0][1],
|
|
1774
|
-
xUnit:
|
|
1816
|
+
xUnit: u,
|
|
1775
1817
|
yUnit: p,
|
|
1776
|
-
gridCache:
|
|
1818
|
+
gridCache: _
|
|
1777
1819
|
}
|
|
1778
1820
|
};
|
|
1779
1821
|
}
|
|
@@ -1790,36 +1832,36 @@ class Mt {
|
|
|
1790
1832
|
transform(t, n, i) {
|
|
1791
1833
|
if (!this.tins)
|
|
1792
1834
|
throw new Error("setCompiled() must be called before transform()");
|
|
1793
|
-
if (n && this.strict_status ==
|
|
1835
|
+
if (n && this.strict_status == St.STATUS_ERROR)
|
|
1794
1836
|
throw new Error('Backward transform is not allowed if strict_status == "strict_error"');
|
|
1795
|
-
this.yaxisMode ==
|
|
1837
|
+
this.yaxisMode == St.YAXIS_FOLLOW && n && (t = [t[0], -1 * t[1]]);
|
|
1796
1838
|
const o = se(t);
|
|
1797
|
-
if (this.bounds && !n && !i && !
|
|
1839
|
+
if (this.bounds && !n && !i && !Ue(o, this.boundsPolygon))
|
|
1798
1840
|
return !1;
|
|
1799
|
-
const r = n ? this.tins.bakw : this.tins.forw, s = n ? this.indexedTins
|
|
1800
|
-
let
|
|
1801
|
-
this.stateFull && (this.stateBackward == n ?
|
|
1802
|
-
this.stateTriangle =
|
|
1841
|
+
const r = n ? this.tins.bakw : this.tins.forw, s = n ? this.indexedTins?.bakw : this.indexedTins?.forw, a = n ? this.vertices_params.bakw : this.vertices_params.forw, c = n ? this.centroid.bakw : this.centroid.forw;
|
|
1842
|
+
let f, h;
|
|
1843
|
+
this.stateFull && (this.stateBackward == n ? f = this.stateTriangle : (this.stateBackward = n, this.stateTriangle = void 0), h = (u) => {
|
|
1844
|
+
this.stateTriangle = u;
|
|
1803
1845
|
});
|
|
1804
|
-
let
|
|
1846
|
+
let l = ne(
|
|
1805
1847
|
o,
|
|
1806
1848
|
r,
|
|
1807
1849
|
s,
|
|
1808
1850
|
a,
|
|
1809
|
-
|
|
1851
|
+
c,
|
|
1810
1852
|
void 0,
|
|
1811
|
-
|
|
1812
|
-
|
|
1853
|
+
f,
|
|
1854
|
+
h
|
|
1813
1855
|
);
|
|
1814
1856
|
if (this.bounds && n && !i) {
|
|
1815
|
-
const
|
|
1816
|
-
if (!
|
|
1817
|
-
} else this.yaxisMode ==
|
|
1818
|
-
return
|
|
1857
|
+
const u = se(l);
|
|
1858
|
+
if (!Ue(u, this.boundsPolygon)) return !1;
|
|
1859
|
+
} else this.yaxisMode == St.YAXIS_FOLLOW && !n && (l = [l[0], -1 * l[1]]);
|
|
1860
|
+
return l;
|
|
1819
1861
|
}
|
|
1820
1862
|
}
|
|
1821
|
-
const
|
|
1822
|
-
class
|
|
1863
|
+
const En = Math.pow(2, -52), ve = new Uint32Array(512);
|
|
1864
|
+
class Ge {
|
|
1823
1865
|
/**
|
|
1824
1866
|
* Constructs a delaunay triangulation object given an array of points (`[x, y]` by default).
|
|
1825
1867
|
* `getX` and `getY` are optional functions of the form `(point) => value` for custom point formats.
|
|
@@ -1830,13 +1872,13 @@ class Je {
|
|
|
1830
1872
|
* @param {(p: P) => number} [getY]
|
|
1831
1873
|
*/
|
|
1832
1874
|
// @ts-expect-error TS2322
|
|
1833
|
-
static from(t, n =
|
|
1875
|
+
static from(t, n = Sr, i = Er) {
|
|
1834
1876
|
const o = t.length, r = new Float64Array(o * 2);
|
|
1835
1877
|
for (let s = 0; s < o; s++) {
|
|
1836
1878
|
const a = t[s];
|
|
1837
1879
|
r[2 * s] = n(a), r[2 * s + 1] = i(a);
|
|
1838
1880
|
}
|
|
1839
|
-
return new
|
|
1881
|
+
return new Ge(r);
|
|
1840
1882
|
}
|
|
1841
1883
|
/**
|
|
1842
1884
|
* Constructs a delaunay triangulation object given an array of point coordinates of the form:
|
|
@@ -1857,81 +1899,81 @@ class Je {
|
|
|
1857
1899
|
*/
|
|
1858
1900
|
update() {
|
|
1859
1901
|
const { coords: t, _hullPrev: n, _hullNext: i, _hullTri: o, _hullHash: r } = this, s = t.length >> 1;
|
|
1860
|
-
let a = 1 / 0,
|
|
1861
|
-
for (let
|
|
1862
|
-
const
|
|
1863
|
-
|
|
1902
|
+
let a = 1 / 0, c = 1 / 0, f = -1 / 0, h = -1 / 0;
|
|
1903
|
+
for (let k = 0; k < s; k++) {
|
|
1904
|
+
const P = t[2 * k], N = t[2 * k + 1];
|
|
1905
|
+
P < a && (a = P), N < c && (c = N), P > f && (f = P), N > h && (h = N), this._ids[k] = k;
|
|
1864
1906
|
}
|
|
1865
|
-
const
|
|
1866
|
-
let p = 0,
|
|
1867
|
-
for (let
|
|
1868
|
-
const
|
|
1869
|
-
|
|
1907
|
+
const l = (a + f) / 2, u = (c + h) / 2;
|
|
1908
|
+
let p = 0, _ = 0, w = 0;
|
|
1909
|
+
for (let k = 0, P = 1 / 0; k < s; k++) {
|
|
1910
|
+
const N = Ve(l, u, t[2 * k], t[2 * k + 1]);
|
|
1911
|
+
N < P && (p = k, P = N);
|
|
1870
1912
|
}
|
|
1871
|
-
const
|
|
1872
|
-
for (let
|
|
1873
|
-
if (
|
|
1874
|
-
const
|
|
1875
|
-
|
|
1913
|
+
const O = t[2 * p], M = t[2 * p + 1];
|
|
1914
|
+
for (let k = 0, P = 1 / 0; k < s; k++) {
|
|
1915
|
+
if (k === p) continue;
|
|
1916
|
+
const N = Ve(O, M, t[2 * k], t[2 * k + 1]);
|
|
1917
|
+
N < P && N > 0 && (_ = k, P = N);
|
|
1876
1918
|
}
|
|
1877
|
-
let m = t[2 *
|
|
1878
|
-
for (let
|
|
1879
|
-
if (
|
|
1880
|
-
const
|
|
1881
|
-
|
|
1919
|
+
let m = t[2 * _], v = t[2 * _ + 1], d = 1 / 0;
|
|
1920
|
+
for (let k = 0; k < s; k++) {
|
|
1921
|
+
if (k === p || k === _) continue;
|
|
1922
|
+
const P = _r(O, M, m, v, t[2 * k], t[2 * k + 1]);
|
|
1923
|
+
P < d && (w = k, d = P);
|
|
1882
1924
|
}
|
|
1883
|
-
let
|
|
1925
|
+
let b = t[2 * w], g = t[2 * w + 1];
|
|
1884
1926
|
if (d === 1 / 0) {
|
|
1885
|
-
for (let
|
|
1886
|
-
this._dists[
|
|
1927
|
+
for (let N = 0; N < s; N++)
|
|
1928
|
+
this._dists[N] = t[2 * N] - t[0] || t[2 * N + 1] - t[1];
|
|
1887
1929
|
Kt(this._ids, this._dists, 0, s - 1);
|
|
1888
|
-
const
|
|
1889
|
-
let
|
|
1890
|
-
for (let
|
|
1891
|
-
const
|
|
1892
|
-
y >
|
|
1930
|
+
const k = new Uint32Array(s);
|
|
1931
|
+
let P = 0;
|
|
1932
|
+
for (let N = 0, C = -1 / 0; N < s; N++) {
|
|
1933
|
+
const F = this._ids[N], y = this._dists[F];
|
|
1934
|
+
y > C && (k[P++] = F, C = y);
|
|
1893
1935
|
}
|
|
1894
|
-
this.hull =
|
|
1936
|
+
this.hull = k.subarray(0, P), this.triangles = new Uint32Array(0), this.halfedges = new Int32Array(0);
|
|
1895
1937
|
return;
|
|
1896
1938
|
}
|
|
1897
|
-
if (
|
|
1898
|
-
const
|
|
1899
|
-
|
|
1939
|
+
if (Ot(O, M, m, v, b, g) < 0) {
|
|
1940
|
+
const k = _, P = m, N = v;
|
|
1941
|
+
_ = w, m = b, v = g, w = k, b = P, g = N;
|
|
1900
1942
|
}
|
|
1901
|
-
const
|
|
1902
|
-
this._cx =
|
|
1903
|
-
for (let
|
|
1904
|
-
this._dists[
|
|
1943
|
+
const E = Mr(O, M, m, v, b, g);
|
|
1944
|
+
this._cx = E.x, this._cy = E.y;
|
|
1945
|
+
for (let k = 0; k < s; k++)
|
|
1946
|
+
this._dists[k] = Ve(t[2 * k], t[2 * k + 1], E.x, E.y);
|
|
1905
1947
|
Kt(this._ids, this._dists, 0, s - 1), this._hullStart = p;
|
|
1906
1948
|
let S = 3;
|
|
1907
|
-
i[p] = n[w] =
|
|
1908
|
-
for (let
|
|
1909
|
-
const
|
|
1910
|
-
if (
|
|
1911
|
-
let
|
|
1912
|
-
for (let
|
|
1949
|
+
i[p] = n[w] = _, i[_] = n[p] = w, i[w] = n[_] = p, o[p] = 0, o[_] = 1, o[w] = 2, r.fill(-1), r[this._hashKey(O, M)] = p, r[this._hashKey(m, v)] = _, r[this._hashKey(b, g)] = w, this.trianglesLen = 0, this._addTriangle(p, _, w, -1, -1, -1);
|
|
1950
|
+
for (let k = 0, P = 0, N = 0; k < this._ids.length; k++) {
|
|
1951
|
+
const C = this._ids[k], F = t[2 * C], y = t[2 * C + 1];
|
|
1952
|
+
if (k > 0 && Math.abs(F - P) <= En && Math.abs(y - N) <= En || (P = F, N = y, C === p || C === _ || C === w)) continue;
|
|
1953
|
+
let I = 0;
|
|
1954
|
+
for (let x = 0, B = this._hashKey(F, y); x < this._hashSize && (I = r[(B + x) % this._hashSize], !(I !== -1 && I !== i[I])); x++)
|
|
1913
1955
|
;
|
|
1914
|
-
|
|
1915
|
-
let
|
|
1916
|
-
for (; T = i[
|
|
1917
|
-
if (
|
|
1918
|
-
|
|
1956
|
+
I = n[I];
|
|
1957
|
+
let A = I, T;
|
|
1958
|
+
for (; T = i[A], Ot(F, y, t[2 * A], t[2 * A + 1], t[2 * T], t[2 * T + 1]) >= 0; )
|
|
1959
|
+
if (A = T, A === I) {
|
|
1960
|
+
A = -1;
|
|
1919
1961
|
break;
|
|
1920
1962
|
}
|
|
1921
|
-
if (
|
|
1922
|
-
let
|
|
1923
|
-
o[
|
|
1924
|
-
let
|
|
1925
|
-
for (; T = i[
|
|
1926
|
-
|
|
1927
|
-
if (
|
|
1928
|
-
for (; T = n[
|
|
1929
|
-
|
|
1930
|
-
this._hullStart = n[
|
|
1963
|
+
if (A === -1) continue;
|
|
1964
|
+
let X = this._addTriangle(A, C, i[A], -1, -1, o[A]);
|
|
1965
|
+
o[C] = this._legalize(X + 2), o[A] = X, S++;
|
|
1966
|
+
let D = i[A];
|
|
1967
|
+
for (; T = i[D], Ot(F, y, t[2 * D], t[2 * D + 1], t[2 * T], t[2 * T + 1]) < 0; )
|
|
1968
|
+
X = this._addTriangle(D, C, T, o[C], -1, o[D]), o[C] = this._legalize(X + 2), i[D] = D, S--, D = T;
|
|
1969
|
+
if (A === I)
|
|
1970
|
+
for (; T = n[A], Ot(F, y, t[2 * T], t[2 * T + 1], t[2 * A], t[2 * A + 1]) < 0; )
|
|
1971
|
+
X = this._addTriangle(T, C, A, -1, o[A], o[T]), this._legalize(X + 2), o[T] = X, i[A] = A, S--, A = T;
|
|
1972
|
+
this._hullStart = n[C] = A, i[A] = n[D] = C, i[C] = D, r[this._hashKey(F, y)] = C, r[this._hashKey(t[2 * A], t[2 * A + 1])] = A;
|
|
1931
1973
|
}
|
|
1932
1974
|
this.hull = new Uint32Array(S);
|
|
1933
|
-
for (let
|
|
1934
|
-
this.hull[
|
|
1975
|
+
for (let k = 0, P = this._hullStart; k < S; k++)
|
|
1976
|
+
this.hull[k] = P, P = i[P];
|
|
1935
1977
|
this.triangles = this._triangles.subarray(0, this.trianglesLen), this.halfedges = this._halfedges.subarray(0, this.trianglesLen);
|
|
1936
1978
|
}
|
|
1937
1979
|
/**
|
|
@@ -1942,7 +1984,7 @@ class Je {
|
|
|
1942
1984
|
* @private
|
|
1943
1985
|
*/
|
|
1944
1986
|
_hashKey(t, n) {
|
|
1945
|
-
return Math.floor(
|
|
1987
|
+
return Math.floor(br(t - this._cx, n - this._cy) * this._hashSize) % this._hashSize;
|
|
1946
1988
|
}
|
|
1947
1989
|
/**
|
|
1948
1990
|
* Flip an edge in a pair of triangles if it doesn't satisfy the Delaunay condition.
|
|
@@ -1954,37 +1996,37 @@ class Je {
|
|
|
1954
1996
|
const { _triangles: n, _halfedges: i, coords: o } = this;
|
|
1955
1997
|
let r = 0, s = 0;
|
|
1956
1998
|
for (; ; ) {
|
|
1957
|
-
const a = i[t],
|
|
1958
|
-
if (s =
|
|
1999
|
+
const a = i[t], c = t - t % 3;
|
|
2000
|
+
if (s = c + (t + 2) % 3, a === -1) {
|
|
1959
2001
|
if (r === 0) break;
|
|
1960
2002
|
t = ve[--r];
|
|
1961
2003
|
continue;
|
|
1962
2004
|
}
|
|
1963
|
-
const
|
|
1964
|
-
if (
|
|
1965
|
-
o[2 *
|
|
1966
|
-
o[2 *
|
|
2005
|
+
const f = a - a % 3, h = c + (t + 1) % 3, l = f + (a + 2) % 3, u = n[s], p = n[t], _ = n[h], w = n[l];
|
|
2006
|
+
if (xr(
|
|
2007
|
+
o[2 * u],
|
|
2008
|
+
o[2 * u + 1],
|
|
1967
2009
|
o[2 * p],
|
|
1968
2010
|
o[2 * p + 1],
|
|
1969
|
-
o[2 *
|
|
1970
|
-
o[2 *
|
|
2011
|
+
o[2 * _],
|
|
2012
|
+
o[2 * _ + 1],
|
|
1971
2013
|
o[2 * w],
|
|
1972
2014
|
o[2 * w + 1]
|
|
1973
2015
|
)) {
|
|
1974
|
-
n[t] = w, n[a] =
|
|
1975
|
-
const
|
|
1976
|
-
if (
|
|
1977
|
-
let
|
|
2016
|
+
n[t] = w, n[a] = u;
|
|
2017
|
+
const M = i[l];
|
|
2018
|
+
if (M === -1) {
|
|
2019
|
+
let v = this._hullStart;
|
|
1978
2020
|
do {
|
|
1979
|
-
if (this._hullTri[
|
|
1980
|
-
this._hullTri[
|
|
2021
|
+
if (this._hullTri[v] === l) {
|
|
2022
|
+
this._hullTri[v] = t;
|
|
1981
2023
|
break;
|
|
1982
2024
|
}
|
|
1983
|
-
|
|
1984
|
-
} while (
|
|
2025
|
+
v = this._hullPrev[v];
|
|
2026
|
+
} while (v !== this._hullStart);
|
|
1985
2027
|
}
|
|
1986
|
-
this._link(t,
|
|
1987
|
-
const m =
|
|
2028
|
+
this._link(t, M), this._link(a, i[s]), this._link(s, l);
|
|
2029
|
+
const m = f + (a + 1) % 3;
|
|
1988
2030
|
r < ve.length && (ve[r++] = m);
|
|
1989
2031
|
} else {
|
|
1990
2032
|
if (r === 0) break;
|
|
@@ -2018,7 +2060,7 @@ class Je {
|
|
|
2018
2060
|
return this._triangles[a] = t, this._triangles[a + 1] = n, this._triangles[a + 2] = i, this._link(a, o), this._link(a + 1, r), this._link(a + 2, s), this.trianglesLen += 3, a;
|
|
2019
2061
|
}
|
|
2020
2062
|
}
|
|
2021
|
-
function
|
|
2063
|
+
function br(e, t) {
|
|
2022
2064
|
const n = e / (Math.abs(e) + Math.abs(t));
|
|
2023
2065
|
return (t > 0 ? 3 - n : 1 + n) / 4;
|
|
2024
2066
|
}
|
|
@@ -2026,17 +2068,17 @@ function Ve(e, t, n, i) {
|
|
|
2026
2068
|
const o = e - n, r = t - i;
|
|
2027
2069
|
return o * o + r * r;
|
|
2028
2070
|
}
|
|
2029
|
-
function
|
|
2030
|
-
const
|
|
2031
|
-
return
|
|
2071
|
+
function xr(e, t, n, i, o, r, s, a) {
|
|
2072
|
+
const c = e - s, f = t - a, h = n - s, l = i - a, u = o - s, p = r - a, _ = c * c + f * f, w = h * h + l * l, O = u * u + p * p;
|
|
2073
|
+
return c * (l * O - w * p) - f * (h * O - w * u) + _ * (h * p - l * u) < 0;
|
|
2032
2074
|
}
|
|
2033
|
-
function
|
|
2034
|
-
const s = n - e, a = i - t,
|
|
2035
|
-
return p * p +
|
|
2075
|
+
function _r(e, t, n, i, o, r) {
|
|
2076
|
+
const s = n - e, a = i - t, c = o - e, f = r - t, h = s * s + a * a, l = c * c + f * f, u = 0.5 / (s * f - a * c), p = (f * h - a * l) * u, _ = (s * l - c * h) * u;
|
|
2077
|
+
return p * p + _ * _;
|
|
2036
2078
|
}
|
|
2037
|
-
function
|
|
2038
|
-
const s = n - e, a = i - t,
|
|
2039
|
-
return { x: p, y:
|
|
2079
|
+
function Mr(e, t, n, i, o, r) {
|
|
2080
|
+
const s = n - e, a = i - t, c = o - e, f = r - t, h = s * s + a * a, l = c * c + f * f, u = 0.5 / (s * f - a * c), p = e + (f * h - a * l) * u, _ = t + (s * l - c * h) * u;
|
|
2081
|
+
return { x: p, y: _ };
|
|
2040
2082
|
}
|
|
2041
2083
|
function Kt(e, t, n, i) {
|
|
2042
2084
|
if (i - n <= 20)
|
|
@@ -2050,14 +2092,14 @@ function Kt(e, t, n, i) {
|
|
|
2050
2092
|
const o = n + i >> 1;
|
|
2051
2093
|
let r = n + 1, s = i;
|
|
2052
2094
|
te(e, o, r), t[e[n]] > t[e[i]] && te(e, n, i), t[e[r]] > t[e[i]] && te(e, r, i), t[e[n]] > t[e[r]] && te(e, n, r);
|
|
2053
|
-
const a = e[r],
|
|
2095
|
+
const a = e[r], c = t[a];
|
|
2054
2096
|
for (; ; ) {
|
|
2055
2097
|
do
|
|
2056
2098
|
r++;
|
|
2057
|
-
while (t[e[r]] <
|
|
2099
|
+
while (t[e[r]] < c);
|
|
2058
2100
|
do
|
|
2059
2101
|
s--;
|
|
2060
|
-
while (t[e[s]] >
|
|
2102
|
+
while (t[e[s]] > c);
|
|
2061
2103
|
if (s < r) break;
|
|
2062
2104
|
te(e, r, s);
|
|
2063
2105
|
}
|
|
@@ -2068,13 +2110,13 @@ function te(e, t, n) {
|
|
|
2068
2110
|
const i = e[t];
|
|
2069
2111
|
e[t] = e[n], e[n] = i;
|
|
2070
2112
|
}
|
|
2071
|
-
function
|
|
2113
|
+
function Sr(e) {
|
|
2072
2114
|
return e[0];
|
|
2073
2115
|
}
|
|
2074
|
-
function
|
|
2116
|
+
function Er(e) {
|
|
2075
2117
|
return e[1];
|
|
2076
2118
|
}
|
|
2077
|
-
class
|
|
2119
|
+
class kr {
|
|
2078
2120
|
bs;
|
|
2079
2121
|
width;
|
|
2080
2122
|
constructor(t, n) {
|
|
@@ -2130,25 +2172,25 @@ class _r {
|
|
|
2130
2172
|
return this;
|
|
2131
2173
|
}
|
|
2132
2174
|
}
|
|
2133
|
-
class kn extends
|
|
2175
|
+
class kn extends kr {
|
|
2134
2176
|
constructor(t) {
|
|
2135
2177
|
super(8, new Uint8Array(Math.ceil(t / 8)).fill(0));
|
|
2136
2178
|
}
|
|
2137
2179
|
}
|
|
2138
|
-
function
|
|
2180
|
+
function jt(e) {
|
|
2139
2181
|
return e % 3 === 2 ? e - 2 : e + 1;
|
|
2140
2182
|
}
|
|
2141
|
-
function
|
|
2183
|
+
function Pt(e) {
|
|
2142
2184
|
return e % 3 === 0 ? e + 2 : e - 1;
|
|
2143
2185
|
}
|
|
2144
|
-
function
|
|
2145
|
-
const
|
|
2146
|
-
if (
|
|
2186
|
+
function An(e, t, n, i, o, r, s, a) {
|
|
2187
|
+
const c = Ot(e, t, o, r, s, a), f = Ot(n, i, o, r, s, a);
|
|
2188
|
+
if (c > 0 && f > 0 || c < 0 && f < 0)
|
|
2147
2189
|
return !1;
|
|
2148
|
-
const
|
|
2149
|
-
return
|
|
2190
|
+
const h = Ot(o, r, e, t, n, i), l = Ot(s, a, e, t, n, i);
|
|
2191
|
+
return h > 0 && l > 0 || h < 0 && l < 0 ? !1 : c === 0 && f === 0 && h === 0 && l === 0 ? !(Math.max(o, s) < Math.min(e, n) || Math.max(e, n) < Math.min(o, s) || Math.max(r, a) < Math.min(t, i) || Math.max(t, i) < Math.min(r, a)) : !0;
|
|
2150
2192
|
}
|
|
2151
|
-
class
|
|
2193
|
+
class Ar {
|
|
2152
2194
|
/**
|
|
2153
2195
|
* The triangulation object from Delaunator.
|
|
2154
2196
|
*/
|
|
@@ -2157,7 +2199,7 @@ class Mr {
|
|
|
2157
2199
|
this.del = t;
|
|
2158
2200
|
}
|
|
2159
2201
|
}
|
|
2160
|
-
class
|
|
2202
|
+
class Ir extends Ar {
|
|
2161
2203
|
vertMap;
|
|
2162
2204
|
flips;
|
|
2163
2205
|
consd;
|
|
@@ -2187,75 +2229,120 @@ class Sr extends Mr {
|
|
|
2187
2229
|
* Constrain the triangulation such that there is an edge between p1 and p2.
|
|
2188
2230
|
*/
|
|
2189
2231
|
constrainOne(t, n) {
|
|
2190
|
-
const { triangles: i, halfedges: o } = this.del
|
|
2191
|
-
|
|
2232
|
+
const { triangles: i, halfedges: o } = this.del;
|
|
2233
|
+
this.assertVertex(t, t, n), this.assertVertex(n, t, n), this.assertInTriangulation(t, t, n), this.assertInTriangulation(n, t, n);
|
|
2234
|
+
const r = this.vertMap[t], s = this.maxConstrainSteps();
|
|
2235
|
+
let a = 0, c = r;
|
|
2192
2236
|
do {
|
|
2193
|
-
|
|
2237
|
+
if (++a > s)
|
|
2238
|
+
throw new Error(
|
|
2239
|
+
`Constraining edge [${t}, ${n}] exceeded the iteration limit`
|
|
2240
|
+
);
|
|
2241
|
+
const l = i[c], u = jt(c);
|
|
2194
2242
|
if (l === n)
|
|
2195
|
-
return this.protect(
|
|
2196
|
-
const
|
|
2197
|
-
if (
|
|
2243
|
+
return this.protect(c);
|
|
2244
|
+
const p = Pt(c), _ = i[p];
|
|
2245
|
+
if (_ === n)
|
|
2198
2246
|
return this.protect(u), u;
|
|
2199
|
-
if (this.intersectSegments(t, n,
|
|
2200
|
-
|
|
2247
|
+
if (this.intersectSegments(t, n, _, l)) {
|
|
2248
|
+
c = p;
|
|
2201
2249
|
break;
|
|
2202
2250
|
}
|
|
2203
|
-
|
|
2204
|
-
} while (
|
|
2205
|
-
let
|
|
2206
|
-
for (;
|
|
2207
|
-
|
|
2251
|
+
c = o[u];
|
|
2252
|
+
} while (c !== -1 && c !== r);
|
|
2253
|
+
let f = c, h = -1;
|
|
2254
|
+
for (; c !== -1; ) {
|
|
2255
|
+
if (++a > s)
|
|
2256
|
+
throw new Error(
|
|
2257
|
+
`Constraining edge [${t}, ${n}] exceeded the iteration limit`
|
|
2258
|
+
);
|
|
2259
|
+
const l = o[c], u = Pt(c), p = Pt(l), _ = jt(l);
|
|
2208
2260
|
if (l === -1)
|
|
2209
2261
|
throw new Error("Constraining edge exited the hull");
|
|
2210
|
-
if (this.consd.has(
|
|
2262
|
+
if (this.consd.has(c))
|
|
2211
2263
|
throw new Error("Edge intersects already constrained edge");
|
|
2212
|
-
if (this.isCollinear(t, n, i[
|
|
2264
|
+
if (this.isCollinear(t, n, i[c]) || this.isCollinear(t, n, i[l]))
|
|
2213
2265
|
throw new Error("Constraining edge intersects point");
|
|
2214
2266
|
if (!this.intersectSegments(
|
|
2215
|
-
i[
|
|
2267
|
+
i[c],
|
|
2216
2268
|
i[l],
|
|
2217
2269
|
i[u],
|
|
2218
|
-
i[
|
|
2270
|
+
i[p]
|
|
2219
2271
|
)) {
|
|
2220
|
-
if (h === -1 && (h =
|
|
2221
|
-
if (
|
|
2272
|
+
if (h === -1 && (h = c), i[p] === n) {
|
|
2273
|
+
if (c === h)
|
|
2222
2274
|
throw new Error("Infinite loop: non-convex quadrilateral");
|
|
2223
|
-
|
|
2275
|
+
c = h, h = -1;
|
|
2224
2276
|
continue;
|
|
2225
2277
|
}
|
|
2226
2278
|
if (this.intersectSegments(
|
|
2227
2279
|
t,
|
|
2228
2280
|
n,
|
|
2229
|
-
i[
|
|
2281
|
+
i[p],
|
|
2230
2282
|
i[l]
|
|
2231
2283
|
))
|
|
2232
|
-
|
|
2284
|
+
c = p;
|
|
2233
2285
|
else if (this.intersectSegments(
|
|
2234
2286
|
t,
|
|
2235
2287
|
n,
|
|
2236
|
-
i[
|
|
2237
|
-
i[
|
|
2288
|
+
i[_],
|
|
2289
|
+
i[p]
|
|
2238
2290
|
))
|
|
2239
|
-
|
|
2240
|
-
else if (h ===
|
|
2291
|
+
c = _;
|
|
2292
|
+
else if (h === c)
|
|
2241
2293
|
throw new Error("Infinite loop: no further intersect after non-convex");
|
|
2242
2294
|
continue;
|
|
2243
2295
|
}
|
|
2244
|
-
if (this.flipDiagonal(
|
|
2296
|
+
if (this.flipDiagonal(c), this.intersectSegments(
|
|
2245
2297
|
t,
|
|
2246
2298
|
n,
|
|
2247
2299
|
i[u],
|
|
2248
|
-
i[
|
|
2300
|
+
i[p]
|
|
2249
2301
|
) && (h === -1 && (h = u), h === u))
|
|
2250
2302
|
throw new Error("Infinite loop: flipped diagonal still intersects");
|
|
2251
|
-
i[
|
|
2303
|
+
i[p] === n ? (f = p, c = h, h = -1) : this.intersectSegments(
|
|
2252
2304
|
t,
|
|
2253
2305
|
n,
|
|
2254
|
-
i[
|
|
2255
|
-
i[
|
|
2256
|
-
) && (
|
|
2306
|
+
i[_],
|
|
2307
|
+
i[p]
|
|
2308
|
+
) && (c = _);
|
|
2257
2309
|
}
|
|
2258
|
-
return this.protect(
|
|
2310
|
+
return this.protect(f), this.delaunify(!0), this.findEdge(t, n);
|
|
2311
|
+
}
|
|
2312
|
+
/**
|
|
2313
|
+
* Upper bound for the number of steps taken while constraining one edge.
|
|
2314
|
+
*
|
|
2315
|
+
* A constraint that crosses k edges is resolved in passes over the crossed
|
|
2316
|
+
* edges, so the number of steps can grow with k squared (for example when
|
|
2317
|
+
* the crossed edges fan out between two bowed rows of points). k is less
|
|
2318
|
+
* than the number of half-edges, so the square of that number is never
|
|
2319
|
+
* reached by a walk that terminates. The floor keeps tiny meshes away from
|
|
2320
|
+
* the limit.
|
|
2321
|
+
*/
|
|
2322
|
+
maxConstrainSteps() {
|
|
2323
|
+
const t = this.del.triangles.length;
|
|
2324
|
+
return Math.max(t * t, 4096);
|
|
2325
|
+
}
|
|
2326
|
+
/**
|
|
2327
|
+
* Throw unless `vertex` is part of the triangulation. Delaunator leaves out
|
|
2328
|
+
* points that coincide with another point, so a valid point id may have no
|
|
2329
|
+
* triangle. An edge cannot start or end at such a point.
|
|
2330
|
+
*/
|
|
2331
|
+
assertInTriangulation(t, n, i) {
|
|
2332
|
+
if (this.vertMap[t] >= this.del.triangles.length)
|
|
2333
|
+
throw new Error(
|
|
2334
|
+
`Invalid edge [${n}, ${i}]: vertex ${t} is not part of the triangulation`
|
|
2335
|
+
);
|
|
2336
|
+
}
|
|
2337
|
+
/**
|
|
2338
|
+
* Throw unless `vertex` is an id of a point given to Delaunator.
|
|
2339
|
+
*/
|
|
2340
|
+
assertVertex(t, n, i) {
|
|
2341
|
+
const o = this.vertMap.length;
|
|
2342
|
+
if (!Number.isInteger(t) || t < 0 || t >= o)
|
|
2343
|
+
throw new Error(
|
|
2344
|
+
`Invalid edge [${String(n)}, ${String(i)}]: vertex ids must be integers from 0 to ${o - 1}`
|
|
2345
|
+
);
|
|
2259
2346
|
}
|
|
2260
2347
|
/**
|
|
2261
2348
|
* Fix the Delaunay condition.
|
|
@@ -2269,8 +2356,8 @@ class Sr extends Mr {
|
|
|
2269
2356
|
if (o.has(a))
|
|
2270
2357
|
continue;
|
|
2271
2358
|
i.delete(a);
|
|
2272
|
-
const
|
|
2273
|
-
|
|
2359
|
+
const c = n[a];
|
|
2360
|
+
c !== -1 && (i.delete(c), this.isDelaunay(a) || (this.flipDiagonal(a), s++));
|
|
2274
2361
|
}
|
|
2275
2362
|
} while (t && s > 0);
|
|
2276
2363
|
return this;
|
|
@@ -2298,13 +2385,19 @@ class Sr extends Mr {
|
|
|
2298
2385
|
*/
|
|
2299
2386
|
findEdge(t, n) {
|
|
2300
2387
|
const i = this.vertMap[n], { triangles: o, halfedges: r } = this.del;
|
|
2301
|
-
|
|
2388
|
+
if (!(i < o.length))
|
|
2389
|
+
return 1 / 0;
|
|
2390
|
+
let s = i, a, c = 0;
|
|
2302
2391
|
do {
|
|
2392
|
+
if (++c > o.length)
|
|
2393
|
+
throw new Error(
|
|
2394
|
+
`Looking up edge [${t}, ${n}] exceeded the iteration limit`
|
|
2395
|
+
);
|
|
2303
2396
|
if (o[s] === t)
|
|
2304
2397
|
return s;
|
|
2305
|
-
a =
|
|
2398
|
+
a = jt(s), s = r[a];
|
|
2306
2399
|
} while (s !== -1 && s !== i);
|
|
2307
|
-
return o[
|
|
2400
|
+
return o[jt(a)] === t ? -a : 1 / 0;
|
|
2308
2401
|
}
|
|
2309
2402
|
/**
|
|
2310
2403
|
* Mark an edge as constrained, i.e. should not be touched by `delaunify`.
|
|
@@ -2327,17 +2420,17 @@ class Sr extends Mr {
|
|
|
2327
2420
|
* Flip the edge shared by two triangles.
|
|
2328
2421
|
*/
|
|
2329
2422
|
flipDiagonal(t) {
|
|
2330
|
-
const { triangles: n, halfedges: i } = this.del, o = this.flips, r = this.consd, s = i[t], a =
|
|
2423
|
+
const { triangles: n, halfedges: i } = this.del, o = this.flips, r = this.consd, s = i[t], a = Pt(t), c = jt(t), f = Pt(s), h = jt(s), l = i[a], u = i[f];
|
|
2331
2424
|
if (r.has(t))
|
|
2332
2425
|
throw new Error("Trying to flip a constrained edge");
|
|
2333
|
-
return n[t] = n[
|
|
2426
|
+
return n[t] = n[f], i[t] = u, o.set(t, o.has(f)) || r.set(t, r.has(f)), u !== -1 && (i[u] = t), i[a] = f, n[s] = n[a], i[s] = l, o.set(s, o.has(a)) || r.set(s, r.has(a)), l !== -1 && (i[l] = s), i[f] = a, this.markFlip(t), this.markFlip(c), this.markFlip(s), this.markFlip(h), o.add(a), r.delete(a), o.add(f), r.delete(f), this.updateVert(t), this.updateVert(c), this.updateVert(s), this.updateVert(h), a;
|
|
2334
2427
|
}
|
|
2335
2428
|
/**
|
|
2336
2429
|
* Whether point p1, p2, and p are collinear.
|
|
2337
2430
|
*/
|
|
2338
2431
|
isCollinear(t, n, i) {
|
|
2339
2432
|
const o = this.del.coords;
|
|
2340
|
-
return
|
|
2433
|
+
return Ot(
|
|
2341
2434
|
o[t * 2],
|
|
2342
2435
|
o[t * 2 + 1],
|
|
2343
2436
|
o[n * 2],
|
|
@@ -2351,7 +2444,7 @@ class Sr extends Mr {
|
|
|
2351
2444
|
*/
|
|
2352
2445
|
inCircle(t, n, i, o) {
|
|
2353
2446
|
const r = this.del.coords;
|
|
2354
|
-
return
|
|
2447
|
+
return mi(
|
|
2355
2448
|
r[t * 2],
|
|
2356
2449
|
r[t * 2 + 1],
|
|
2357
2450
|
r[n * 2],
|
|
@@ -2369,17 +2462,17 @@ class Sr extends Mr {
|
|
|
2369
2462
|
const { triangles: n, halfedges: i } = this.del, o = i[t];
|
|
2370
2463
|
if (o === -1)
|
|
2371
2464
|
return !0;
|
|
2372
|
-
const r = n[
|
|
2373
|
-
return !this.inCircle(r, s, a,
|
|
2465
|
+
const r = n[Pt(t)], s = n[t], a = n[jt(t)], c = n[Pt(o)];
|
|
2466
|
+
return !this.inCircle(r, s, a, c);
|
|
2374
2467
|
}
|
|
2375
2468
|
/**
|
|
2376
2469
|
* Update the vertex -> incoming edge map.
|
|
2377
2470
|
*/
|
|
2378
2471
|
updateVert(t) {
|
|
2379
2472
|
const { triangles: n, halfedges: i } = this.del, o = this.vertMap, r = n[t];
|
|
2380
|
-
let s =
|
|
2473
|
+
let s = Pt(t), a = i[s];
|
|
2381
2474
|
for (; a !== -1 && a !== t; )
|
|
2382
|
-
s =
|
|
2475
|
+
s = Pt(a), a = i[s];
|
|
2383
2476
|
return o[r] = s, s;
|
|
2384
2477
|
}
|
|
2385
2478
|
/**
|
|
@@ -2387,7 +2480,7 @@ class Sr extends Mr {
|
|
|
2387
2480
|
*/
|
|
2388
2481
|
intersectSegments(t, n, i, o) {
|
|
2389
2482
|
const r = this.del.coords;
|
|
2390
|
-
return t === i || t === o || n === i || n === o ? !1 :
|
|
2483
|
+
return t === i || t === o || n === i || n === o ? !1 : An(
|
|
2391
2484
|
r[t * 2],
|
|
2392
2485
|
r[t * 2 + 1],
|
|
2393
2486
|
r[n * 2],
|
|
@@ -2398,65 +2491,115 @@ class Sr extends Mr {
|
|
|
2398
2491
|
r[o * 2 + 1]
|
|
2399
2492
|
);
|
|
2400
2493
|
}
|
|
2401
|
-
static intersectSegments =
|
|
2494
|
+
static intersectSegments = An;
|
|
2402
2495
|
}
|
|
2403
2496
|
function be(e, t, n) {
|
|
2404
2497
|
if (t || (t = []), typeof e != "object" || e.type !== "FeatureCollection")
|
|
2405
2498
|
throw "Argument points must be FeatureCollection";
|
|
2406
2499
|
if (!Array.isArray(t)) throw "Argument points must be Array of Array";
|
|
2407
2500
|
const i = e.features.map(
|
|
2408
|
-
(
|
|
2409
|
-
), o =
|
|
2501
|
+
(c) => c.geometry.coordinates
|
|
2502
|
+
), o = Ge.from(i);
|
|
2410
2503
|
let r;
|
|
2411
2504
|
const s = [];
|
|
2412
|
-
o.triangles.length !== 0 && t.length !== 0 && (r = new
|
|
2413
|
-
for (let
|
|
2414
|
-
s.push([o.triangles[
|
|
2505
|
+
o.triangles.length !== 0 && t.length !== 0 && (r = new Ir(o), r.constrainAll(t));
|
|
2506
|
+
for (let c = 0; c < o.triangles.length; c += 3)
|
|
2507
|
+
s.push([o.triangles[c], o.triangles[c + 1], o.triangles[c + 2]]);
|
|
2415
2508
|
const a = ["a", "b", "c"];
|
|
2416
|
-
return
|
|
2417
|
-
s.map((
|
|
2418
|
-
const
|
|
2419
|
-
const p = e.features[
|
|
2420
|
-
return
|
|
2509
|
+
return Et(
|
|
2510
|
+
s.map((c) => {
|
|
2511
|
+
const f = {}, h = c.map((l, u) => {
|
|
2512
|
+
const p = e.features[l], _ = p.geometry.coordinates, w = [_[0], _[1]];
|
|
2513
|
+
return _.length === 3 ? w[2] = _[2] : f[a[u]] = p.properties[n], w;
|
|
2421
2514
|
});
|
|
2422
|
-
return
|
|
2515
|
+
return h[3] = h[0], le([h], f);
|
|
2423
2516
|
})
|
|
2424
2517
|
);
|
|
2425
2518
|
}
|
|
2426
|
-
|
|
2519
|
+
const Or = 256 * Number.EPSILON;
|
|
2520
|
+
function Pr(e, t) {
|
|
2521
|
+
const n = [e, t].map((o) => {
|
|
2522
|
+
const r = o.map((a, c, f) => {
|
|
2523
|
+
if (c === 0) return 0;
|
|
2524
|
+
const h = f[c - 1];
|
|
2525
|
+
return Math.sqrt(
|
|
2526
|
+
Math.pow(a[0] - h[0], 2) + Math.pow(a[1] - h[1], 2)
|
|
2527
|
+
);
|
|
2528
|
+
}), s = r.reduce((a, c, f) => f === 0 ? [0] : (a.push(a[f - 1] + c), a), []);
|
|
2529
|
+
return s.map((a, c, f) => {
|
|
2530
|
+
const h = a / f[f.length - 1];
|
|
2531
|
+
return [o[c], r[c], s[c], h];
|
|
2532
|
+
});
|
|
2533
|
+
}), i = [];
|
|
2534
|
+
return n.forEach((o, r) => {
|
|
2535
|
+
const s = n[r ? 0 : 1];
|
|
2536
|
+
o.forEach((a, c) => {
|
|
2537
|
+
if (c === 0 || c === o.length - 1 || a[4] === "handled")
|
|
2538
|
+
return;
|
|
2539
|
+
const f = a[0], h = a[3];
|
|
2540
|
+
let l, u = 1 / 0;
|
|
2541
|
+
for (let p = 1; p < s.length - 1; p++) {
|
|
2542
|
+
const _ = s[p];
|
|
2543
|
+
if (_[4] === "handled") continue;
|
|
2544
|
+
const w = Math.abs(_[3] - h);
|
|
2545
|
+
w <= Or && w < u && (l = _, u = w);
|
|
2546
|
+
}
|
|
2547
|
+
if (l) {
|
|
2548
|
+
l[4] = "handled", a[4] = "handled", i.push(
|
|
2549
|
+
r === 0 ? [f, l[0], h] : [l[0], f, h]
|
|
2550
|
+
);
|
|
2551
|
+
return;
|
|
2552
|
+
}
|
|
2553
|
+
for (let p = 0; p < s.length - 1; p++) {
|
|
2554
|
+
const _ = s[p], w = s[p + 1], O = _[3], M = w[3];
|
|
2555
|
+
if (O < h && M > h) {
|
|
2556
|
+
const m = (h - O) / (M - O), v = [
|
|
2557
|
+
(w[0][0] - _[0][0]) * m + _[0][0],
|
|
2558
|
+
(w[0][1] - _[0][1]) * m + _[0][1]
|
|
2559
|
+
];
|
|
2560
|
+
i.push(
|
|
2561
|
+
r === 0 ? [f, v, h] : [v, f, h]
|
|
2562
|
+
);
|
|
2563
|
+
return;
|
|
2564
|
+
}
|
|
2565
|
+
}
|
|
2566
|
+
});
|
|
2567
|
+
}), i.sort((o, r) => o[2] - r[2]);
|
|
2568
|
+
}
|
|
2569
|
+
function Nr(e, t) {
|
|
2427
2570
|
const n = [[], [], [], []], i = [];
|
|
2428
2571
|
return Object.keys(e).forEach((o) => {
|
|
2429
|
-
const r = e[o], s = r.forw, a = r.bakw,
|
|
2572
|
+
const r = e[o], s = r.forw, a = r.bakw, c = [
|
|
2430
2573
|
s[0] - t.forw[0],
|
|
2431
2574
|
s[1] - t.forw[1]
|
|
2432
|
-
],
|
|
2575
|
+
], f = [
|
|
2433
2576
|
a[0] - t.bakw[0],
|
|
2434
2577
|
t.bakw[1] - a[1]
|
|
2435
|
-
],
|
|
2436
|
-
if (i.push(
|
|
2578
|
+
], h = { forw: c, bakw: f };
|
|
2579
|
+
if (i.push(h), c[0] === 0 || c[1] === 0)
|
|
2437
2580
|
return;
|
|
2438
|
-
let
|
|
2439
|
-
|
|
2581
|
+
let l = 0;
|
|
2582
|
+
c[0] > 0 && (l += 1), c[1] > 0 && (l += 2), n[l].push(h);
|
|
2440
2583
|
}), { perQuad: n, aggregate: i };
|
|
2441
2584
|
}
|
|
2442
|
-
function
|
|
2585
|
+
function Br(e) {
|
|
2443
2586
|
let t = 1 / 0, n = 0, i = 0;
|
|
2444
2587
|
return e.forEach((o) => {
|
|
2445
|
-
const { forw: r, bakw: s } = o, a = Math.hypot(r[0], r[1]),
|
|
2446
|
-
if (
|
|
2447
|
-
const
|
|
2448
|
-
t = Math.min(t,
|
|
2588
|
+
const { forw: r, bakw: s } = o, a = Math.hypot(r[0], r[1]), c = Math.hypot(s[0], s[1]);
|
|
2589
|
+
if (c === 0) return;
|
|
2590
|
+
const f = a / c, h = Math.atan2(r[0], r[1]) - Math.atan2(s[0], s[1]);
|
|
2591
|
+
t = Math.min(t, f), n += Math.cos(h), i += Math.sin(h);
|
|
2449
2592
|
}), isFinite(t) ? [t, Math.atan2(i, n)] : [1, 0];
|
|
2450
2593
|
}
|
|
2451
|
-
function
|
|
2452
|
-
const { perQuad: i, aggregate: o } =
|
|
2594
|
+
function Tr(e, t, n) {
|
|
2595
|
+
const { perQuad: i, aggregate: o } = Nr(e, t), r = i.every((c) => c.length > 0), a = (n === "birdeye" ? r ? i : [o] : [o]).map((c) => Br(c));
|
|
2453
2596
|
return a.length === 1 ? [a[0], a[0], a[0], a[0]] : a;
|
|
2454
2597
|
}
|
|
2455
|
-
function
|
|
2598
|
+
function Cr(e, t) {
|
|
2456
2599
|
let n = 0;
|
|
2457
2600
|
return e[0] > t[0] && (n += 1), e[1] > t[1] && (n += 2), n;
|
|
2458
2601
|
}
|
|
2459
|
-
function
|
|
2602
|
+
function Xr(e, t, n) {
|
|
2460
2603
|
const i = [
|
|
2461
2604
|
e[0] - t.forw[0],
|
|
2462
2605
|
e[1] - t.forw[1]
|
|
@@ -2466,69 +2609,69 @@ function Pr(e, t, n) {
|
|
|
2466
2609
|
t.bakw[1] - r * Math.cos(s)
|
|
2467
2610
|
];
|
|
2468
2611
|
}
|
|
2469
|
-
function
|
|
2612
|
+
function $r(e, t, n, i) {
|
|
2470
2613
|
const o = t[0] - e[0], r = t[1] - e[1];
|
|
2471
2614
|
if (Math.abs(o) < 1e-12 && Math.abs(r) < 1e-12) return null;
|
|
2472
|
-
const s = i[0] - n[0], a = i[1] - n[1],
|
|
2473
|
-
if (Math.abs(
|
|
2474
|
-
const
|
|
2475
|
-
return
|
|
2615
|
+
const s = i[0] - n[0], a = i[1] - n[1], c = n[0] - e[0], f = n[1] - e[1], h = o * a - r * s;
|
|
2616
|
+
if (Math.abs(h) < 1e-12) return null;
|
|
2617
|
+
const l = (c * a - f * s) / h, u = (c * r - f * o) / h;
|
|
2618
|
+
return l <= 1e-10 || u < -1e-10 || u > 1 + 1e-10 ? null : { t: l, point: [e[0] + l * o, e[1] + l * r] };
|
|
2476
2619
|
}
|
|
2477
|
-
function
|
|
2620
|
+
function Dr(e, t, n) {
|
|
2478
2621
|
const i = n.length;
|
|
2479
2622
|
let o = -1 / 0, r = null;
|
|
2480
2623
|
for (let s = 0; s < i; s++) {
|
|
2481
|
-
const a = (s + 1) % i,
|
|
2624
|
+
const a = (s + 1) % i, c = $r(
|
|
2482
2625
|
e,
|
|
2483
2626
|
t,
|
|
2484
2627
|
n[s].bakw,
|
|
2485
2628
|
n[a].bakw
|
|
2486
2629
|
);
|
|
2487
|
-
|
|
2630
|
+
c && c.t > o && (o = c.t, r = c.point);
|
|
2488
2631
|
}
|
|
2489
2632
|
return r;
|
|
2490
2633
|
}
|
|
2491
|
-
function
|
|
2634
|
+
function In(e, t) {
|
|
2492
2635
|
const i = Math.atan2(e[0] - t[0], e[1] - t[1]) * (180 / Math.PI);
|
|
2493
2636
|
return i < 0 ? i + 360 : i;
|
|
2494
2637
|
}
|
|
2495
|
-
function
|
|
2638
|
+
function On(e, t, n, i, o, r) {
|
|
2496
2639
|
const s = t[0] - e[0], a = t[1] - e[1];
|
|
2497
2640
|
if (s === 0 && a === 0) return null;
|
|
2498
|
-
const
|
|
2641
|
+
const c = [];
|
|
2499
2642
|
if (s !== 0)
|
|
2500
|
-
for (const
|
|
2501
|
-
const
|
|
2502
|
-
if (
|
|
2503
|
-
const
|
|
2504
|
-
|
|
2643
|
+
for (const h of [n, i]) {
|
|
2644
|
+
const l = (h - e[0]) / s;
|
|
2645
|
+
if (l > 0) {
|
|
2646
|
+
const u = e[1] + l * a;
|
|
2647
|
+
u >= o && u <= r && c.push({ t: l, x: h, y: u });
|
|
2505
2648
|
}
|
|
2506
2649
|
}
|
|
2507
2650
|
if (a !== 0)
|
|
2508
|
-
for (const
|
|
2509
|
-
const
|
|
2510
|
-
if (
|
|
2511
|
-
const
|
|
2512
|
-
|
|
2651
|
+
for (const h of [o, r]) {
|
|
2652
|
+
const l = (h - e[1]) / a;
|
|
2653
|
+
if (l > 0) {
|
|
2654
|
+
const u = e[0] + l * s;
|
|
2655
|
+
u >= n && u <= i && c.push({ t: l, x: u, y: h });
|
|
2513
2656
|
}
|
|
2514
2657
|
}
|
|
2515
|
-
if (
|
|
2516
|
-
|
|
2517
|
-
const
|
|
2518
|
-
return [
|
|
2658
|
+
if (c.length === 0) return null;
|
|
2659
|
+
c.sort((h, l) => h.t - l.t);
|
|
2660
|
+
const f = c[0];
|
|
2661
|
+
return [f.x, f.y];
|
|
2519
2662
|
}
|
|
2520
2663
|
function Pn(e, t, n) {
|
|
2521
2664
|
const i = e.length, o = new Array(i).fill(1);
|
|
2522
2665
|
for (const r of t)
|
|
2523
2666
|
for (let s = 0; s < i; s++) {
|
|
2524
|
-
const a = (s + 1) % i,
|
|
2525
|
-
if (
|
|
2526
|
-
const
|
|
2667
|
+
const a = (s + 1) % i, c = He([e[s].bakw, e[a].bakw]), f = He([n.bakw, r.bakw]), h = Bi(c, f);
|
|
2668
|
+
if (h.features.length > 0 && h.features[0].geometry) {
|
|
2669
|
+
const l = h.features[0], u = Math.sqrt(
|
|
2527
2670
|
Math.pow(r.bakw[0] - n.bakw[0], 2) + Math.pow(r.bakw[1] - n.bakw[1], 2)
|
|
2528
2671
|
), p = Math.sqrt(
|
|
2529
|
-
Math.pow(
|
|
2530
|
-
),
|
|
2531
|
-
|
|
2672
|
+
Math.pow(l.geometry.coordinates[0] - n.bakw[0], 2) + Math.pow(l.geometry.coordinates[1] - n.bakw[1], 2)
|
|
2673
|
+
), _ = u / p;
|
|
2674
|
+
_ > o[s] && (o[s] = _), _ > o[a] && (o[a] = _);
|
|
2532
2675
|
}
|
|
2533
2676
|
}
|
|
2534
2677
|
e.forEach((r, s) => {
|
|
@@ -2539,114 +2682,114 @@ function Pn(e, t, n) {
|
|
|
2539
2682
|
];
|
|
2540
2683
|
});
|
|
2541
2684
|
}
|
|
2542
|
-
function
|
|
2543
|
-
const { convexBuf: i, centroid: o, allGcps: r, minx: s, maxx: a, miny:
|
|
2544
|
-
[s,
|
|
2545
|
-
[a,
|
|
2546
|
-
[a,
|
|
2547
|
-
[s,
|
|
2685
|
+
function Qn(e, t, n) {
|
|
2686
|
+
const { convexBuf: i, centroid: o, allGcps: r, minx: s, maxx: a, miny: c, maxy: f } = e, h = Tr(i, o, t), u = [
|
|
2687
|
+
[s, c],
|
|
2688
|
+
[a, c],
|
|
2689
|
+
[a, f],
|
|
2690
|
+
[s, f]
|
|
2548
2691
|
].map((g) => ({
|
|
2549
2692
|
forw: g,
|
|
2550
|
-
bakw:
|
|
2693
|
+
bakw: Xr(
|
|
2551
2694
|
g,
|
|
2552
2695
|
o,
|
|
2553
|
-
|
|
2696
|
+
h[Cr(g, o.forw)]
|
|
2554
2697
|
)
|
|
2555
2698
|
}));
|
|
2556
|
-
if (
|
|
2557
|
-
(g,
|
|
2558
|
-
), Pn(
|
|
2559
|
-
const p = 4,
|
|
2699
|
+
if (u.sort(
|
|
2700
|
+
(g, E) => Math.atan2(g.forw[0] - o.forw[0], g.forw[1] - o.forw[1]) - Math.atan2(E.forw[0] - o.forw[0], E.forw[1] - o.forw[1])
|
|
2701
|
+
), Pn(u, r, o), !n) return u;
|
|
2702
|
+
const p = 4, _ = u.map(
|
|
2560
2703
|
(g) => Math.atan2(g.forw[0] - o.forw[0], g.forw[1] - o.forw[1])
|
|
2561
|
-
), w =
|
|
2704
|
+
), w = u.map(
|
|
2562
2705
|
(g) => Math.atan2(
|
|
2563
2706
|
g.bakw[0] - o.bakw[0],
|
|
2564
2707
|
-(g.bakw[1] - o.bakw[1])
|
|
2565
2708
|
)
|
|
2566
2709
|
);
|
|
2567
|
-
function
|
|
2568
|
-
for (let
|
|
2569
|
-
const S = (
|
|
2570
|
-
let
|
|
2571
|
-
for (;
|
|
2572
|
-
for (;
|
|
2573
|
-
if (
|
|
2574
|
-
return { i:
|
|
2710
|
+
function O(g) {
|
|
2711
|
+
for (let E = 0; E < p; E++) {
|
|
2712
|
+
const S = (E + 1) % p, k = _[E], P = E < p - 1 ? _[S] : _[S] + 2 * Math.PI;
|
|
2713
|
+
let N = g;
|
|
2714
|
+
for (; N < k; ) N += 2 * Math.PI;
|
|
2715
|
+
for (; N >= k + 2 * Math.PI; ) N -= 2 * Math.PI;
|
|
2716
|
+
if (N >= k && N < P)
|
|
2717
|
+
return { i: E, j: S, frac: (N - k) / (P - k) };
|
|
2575
2718
|
}
|
|
2576
2719
|
return { i: 0, j: 1, frac: 0 };
|
|
2577
2720
|
}
|
|
2578
|
-
function
|
|
2579
|
-
const { i:
|
|
2580
|
-
let
|
|
2581
|
-
for (;
|
|
2582
|
-
for (;
|
|
2583
|
-
return
|
|
2721
|
+
function M(g) {
|
|
2722
|
+
const { i: E, j: S, frac: k } = O(g), P = w[E];
|
|
2723
|
+
let C = w[S] - P;
|
|
2724
|
+
for (; C > Math.PI; ) C -= 2 * Math.PI;
|
|
2725
|
+
for (; C < -Math.PI; ) C += 2 * Math.PI;
|
|
2726
|
+
return P + k * C;
|
|
2584
2727
|
}
|
|
2585
2728
|
const m = new Set(
|
|
2586
|
-
|
|
2587
|
-
(g) => Math.floor(
|
|
2729
|
+
u.map(
|
|
2730
|
+
(g) => Math.floor(In(g.forw, o.forw) / 10) % 36
|
|
2588
2731
|
)
|
|
2589
|
-
),
|
|
2732
|
+
), v = r.map((g) => ({
|
|
2590
2733
|
forw: g.forw,
|
|
2591
2734
|
bakw: g.bakw,
|
|
2592
|
-
angleDeg:
|
|
2735
|
+
angleDeg: In(g.forw, o.forw),
|
|
2593
2736
|
forwDist: Math.hypot(g.forw[0] - o.forw[0], g.forw[1] - o.forw[1])
|
|
2594
2737
|
})), d = [];
|
|
2595
2738
|
for (let g = 0; g < 36; g++) {
|
|
2596
2739
|
if (m.has(g)) continue;
|
|
2597
|
-
const
|
|
2598
|
-
(
|
|
2740
|
+
const E = g * 10, S = v.filter(
|
|
2741
|
+
(I) => I.angleDeg >= E && I.angleDeg < E + 10
|
|
2599
2742
|
);
|
|
2600
|
-
let
|
|
2743
|
+
let k = null;
|
|
2601
2744
|
if (S.length > 0) {
|
|
2602
|
-
const
|
|
2603
|
-
|
|
2745
|
+
const I = S.reduce((A, T) => T.forwDist > A.forwDist ? T : A);
|
|
2746
|
+
k = On(o.forw, I.forw, s, a, c, f);
|
|
2604
2747
|
}
|
|
2605
|
-
if (!
|
|
2606
|
-
const
|
|
2607
|
-
o.forw[0] + Math.sin(
|
|
2608
|
-
o.forw[1] + Math.cos(
|
|
2748
|
+
if (!k) {
|
|
2749
|
+
const I = (E + 5) % 360 * (Math.PI / 180), A = [
|
|
2750
|
+
o.forw[0] + Math.sin(I),
|
|
2751
|
+
o.forw[1] + Math.cos(I)
|
|
2609
2752
|
];
|
|
2610
|
-
|
|
2753
|
+
k = On(o.forw, A, s, a, c, f);
|
|
2611
2754
|
}
|
|
2612
|
-
if (!
|
|
2613
|
-
const
|
|
2614
|
-
o.bakw[0] + Math.sin(
|
|
2615
|
-
o.bakw[1] - Math.cos(
|
|
2616
|
-
], y =
|
|
2617
|
-
y && d.push({ forw:
|
|
2618
|
-
}
|
|
2619
|
-
const
|
|
2620
|
-
return
|
|
2621
|
-
(g,
|
|
2622
|
-
), Pn(
|
|
2623
|
-
}
|
|
2624
|
-
function
|
|
2625
|
-
return
|
|
2626
|
-
}
|
|
2627
|
-
function
|
|
2628
|
-
return
|
|
2629
|
-
}
|
|
2630
|
-
function
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
(
|
|
2755
|
+
if (!k) continue;
|
|
2756
|
+
const P = [k[0] - o.forw[0], k[1] - o.forw[1]], N = Math.atan2(P[0], P[1]), C = M(N), F = [
|
|
2757
|
+
o.bakw[0] + Math.sin(C),
|
|
2758
|
+
o.bakw[1] - Math.cos(C)
|
|
2759
|
+
], y = Dr(o.bakw, F, u);
|
|
2760
|
+
y && d.push({ forw: k, bakw: y });
|
|
2761
|
+
}
|
|
2762
|
+
const b = [...u, ...d];
|
|
2763
|
+
return b.sort(
|
|
2764
|
+
(g, E) => Math.atan2(g.forw[0] - o.forw[0], g.forw[1] - o.forw[1]) - Math.atan2(E.forw[0] - o.forw[0], E.forw[1] - o.forw[1])
|
|
2765
|
+
), Pn(b, r, o), b;
|
|
2766
|
+
}
|
|
2767
|
+
function Fr(e, t = !1) {
|
|
2768
|
+
return Qn(e, "plain", t);
|
|
2769
|
+
}
|
|
2770
|
+
function Rr(e, t = !1) {
|
|
2771
|
+
return Qn(e, "birdeye", t);
|
|
2772
|
+
}
|
|
2773
|
+
function vo(e) {
|
|
2774
|
+
return Hn(e, 1 / 0);
|
|
2775
|
+
}
|
|
2776
|
+
const Nn = 1e5, Yr = 16;
|
|
2777
|
+
function Hn(e, t) {
|
|
2778
|
+
return Lr(e), new Vr(e).findSegmentIntersections(t).map(
|
|
2779
|
+
(o) => Yt([o.x, o.y])
|
|
2637
2780
|
);
|
|
2638
2781
|
}
|
|
2639
|
-
function
|
|
2782
|
+
function Lr(e) {
|
|
2640
2783
|
for (let t = 0, n = e.length; t < n; t++) {
|
|
2641
2784
|
const i = e[t];
|
|
2642
|
-
ae(i) ||
|
|
2785
|
+
ae(i) || qt(
|
|
2643
2786
|
"findIntersections() received invalid coordinates:",
|
|
2644
2787
|
`line=${t}`,
|
|
2645
2788
|
`points=${i}`
|
|
2646
2789
|
);
|
|
2647
2790
|
for (let o = 0, r = i.length; o < r; o++) {
|
|
2648
2791
|
const s = i[o];
|
|
2649
|
-
(!ae(s) || !Number.isFinite(s[0]) || !Number.isFinite(s[1])) &&
|
|
2792
|
+
(!ae(s) || !Number.isFinite(s[0]) || !Number.isFinite(s[1])) && qt(
|
|
2650
2793
|
"findIntersections() received non-finite coordinates:",
|
|
2651
2794
|
`line=${t}`,
|
|
2652
2795
|
`point=${o}`,
|
|
@@ -2655,7 +2798,7 @@ function Cr(e) {
|
|
|
2655
2798
|
}
|
|
2656
2799
|
}
|
|
2657
2800
|
}
|
|
2658
|
-
class
|
|
2801
|
+
class Vr {
|
|
2659
2802
|
/**
|
|
2660
2803
|
* 座標データの配列
|
|
2661
2804
|
* _xx, _yy: Float64Array形式で座標を保持
|
|
@@ -2700,7 +2843,7 @@ class Dr {
|
|
|
2700
2843
|
let r = 0;
|
|
2701
2844
|
for (let s = 0; s < o; s++)
|
|
2702
2845
|
this._ii[s] = r, r += t[s];
|
|
2703
|
-
(r != this._xx.length || this._xx.length != this._yy.length) &&
|
|
2846
|
+
(r != this._xx.length || this._xx.length != this._yy.length) && qt("ArcCollection#initXYData() Counting error"), this.initBounds(), this._arcIter = new co(this._xx, this._yy);
|
|
2704
2847
|
}
|
|
2705
2848
|
initBounds() {
|
|
2706
2849
|
const t = this.calcArcBounds_(this._xx, this._yy, this._nn);
|
|
@@ -2712,9 +2855,9 @@ class Dr {
|
|
|
2712
2855
|
*/
|
|
2713
2856
|
calcArcBounds_(t, n, i) {
|
|
2714
2857
|
const o = i.length, r = new Float64Array(o * 4), s = new ce();
|
|
2715
|
-
let a = 0,
|
|
2716
|
-
for (let
|
|
2717
|
-
|
|
2858
|
+
let a = 0, c, f, h;
|
|
2859
|
+
for (let l = 0; l < o; l++)
|
|
2860
|
+
c = i[l], c > 0 && (f = l * 4, h = lo(t, n, a, c), r[f++] = h[0], r[f++] = h[1], r[f++] = h[2], r[f] = h[3], a += c, s.mergeBounds(h));
|
|
2718
2861
|
return {
|
|
2719
2862
|
bb: r,
|
|
2720
2863
|
bounds: s
|
|
@@ -2736,10 +2879,10 @@ class Dr {
|
|
|
2736
2879
|
// @cb function(i, j, xx, yy)
|
|
2737
2880
|
forEachArcSegment(t, n) {
|
|
2738
2881
|
const i = t >= 0, o = i ? t : ~t, r = this.getRetainedInterval(), s = this._nn[o], a = i ? 1 : -1;
|
|
2739
|
-
let
|
|
2740
|
-
for (let
|
|
2741
|
-
|
|
2742
|
-
return
|
|
2882
|
+
let c = i ? this._ii[o] : this._ii[o] + s - 1, f = c, h = 0;
|
|
2883
|
+
for (let l = 1; l < s; l++)
|
|
2884
|
+
f += a, (r === 0 || this._zz[f] >= r) && (n(c, f, this._xx, this._yy), c = f, h++);
|
|
2885
|
+
return h;
|
|
2743
2886
|
}
|
|
2744
2887
|
getRetainedInterval() {
|
|
2745
2888
|
return this._zlimit;
|
|
@@ -2782,184 +2925,188 @@ class Dr {
|
|
|
2782
2925
|
* 線分の交差を検出
|
|
2783
2926
|
* ストライプ分割による効率的な判定を実装
|
|
2784
2927
|
*
|
|
2785
|
-
* @
|
|
2928
|
+
* @param limit - 返す交差点の件数の上限(同じ位置の交差は 1 件に数える)
|
|
2929
|
+
* @returns 検出された交差点の配列(同じ位置の重複なし)
|
|
2786
2930
|
*/
|
|
2787
|
-
findSegmentIntersections() {
|
|
2788
|
-
const
|
|
2789
|
-
let
|
|
2931
|
+
findSegmentIntersections(t = 1 / 0) {
|
|
2932
|
+
const n = this.getBounds(), i = n.ymin || 0, o = (n.ymax || 0) - i, r = this.calcSegmentIntersectionStripeCount(), s = new Uint32Array(r), a = r > 1 ? (v) => Math.floor((r - 1) * (v - i) / o) : () => 0, c = r + 1;
|
|
2933
|
+
let f;
|
|
2790
2934
|
this.forEachSegment(
|
|
2791
|
-
(
|
|
2792
|
-
let
|
|
2793
|
-
const
|
|
2794
|
-
let
|
|
2795
|
-
for (;
|
|
2796
|
-
|
|
2935
|
+
(v, d, b, g) => {
|
|
2936
|
+
let E = a(g[v]);
|
|
2937
|
+
const S = a(g[d]);
|
|
2938
|
+
let k = 0;
|
|
2939
|
+
for (; s[E] = s[E] + 2, E != S; )
|
|
2940
|
+
k++, k > c && qt(
|
|
2797
2941
|
"findSegmentIntersections() exceeded the stripe iteration limit:",
|
|
2798
|
-
`stripeCount=${
|
|
2799
|
-
`s1=${
|
|
2800
|
-
`s2=${
|
|
2801
|
-
),
|
|
2942
|
+
`stripeCount=${r}`,
|
|
2943
|
+
`s1=${E}`,
|
|
2944
|
+
`s2=${S}`
|
|
2945
|
+
), E += S > E ? 1 : -1;
|
|
2802
2946
|
}
|
|
2803
2947
|
);
|
|
2804
|
-
const
|
|
2805
|
-
let
|
|
2806
|
-
const
|
|
2807
|
-
|
|
2808
|
-
const
|
|
2809
|
-
|
|
2810
|
-
}),
|
|
2811
|
-
(
|
|
2812
|
-
let
|
|
2813
|
-
const
|
|
2814
|
-
let
|
|
2815
|
-
for (;
|
|
2816
|
-
|
|
2948
|
+
const h = this.getUint32Array(qr(s));
|
|
2949
|
+
let l = 0;
|
|
2950
|
+
const u = [];
|
|
2951
|
+
zr(s, (v) => {
|
|
2952
|
+
const d = l;
|
|
2953
|
+
l += v, u.push(h.subarray(d, l));
|
|
2954
|
+
}), Jr(s, 0), this.forEachSegment(
|
|
2955
|
+
(v, d, b, g) => {
|
|
2956
|
+
let E = a(g[v]);
|
|
2957
|
+
const S = a(g[d]);
|
|
2958
|
+
let k, P, N = 0;
|
|
2959
|
+
for (; k = s[E], s[E] = k + 2, P = u[E], P[k] = v, P[k + 1] = d, E != S; )
|
|
2960
|
+
N++, N > c && qt(
|
|
2817
2961
|
"findSegmentIntersections() exceeded the stripe iteration limit:",
|
|
2818
|
-
`stripeCount=${
|
|
2819
|
-
`s1=${
|
|
2820
|
-
`s2=${
|
|
2821
|
-
),
|
|
2962
|
+
`stripeCount=${r}`,
|
|
2963
|
+
`s1=${E}`,
|
|
2964
|
+
`s2=${S}`
|
|
2965
|
+
), E += S > E ? 1 : -1;
|
|
2822
2966
|
}
|
|
2823
2967
|
);
|
|
2824
|
-
const p = this.getVertexData(),
|
|
2825
|
-
let w;
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2968
|
+
const p = this.getVertexData(), _ = t * Yr;
|
|
2969
|
+
let w = 0;
|
|
2970
|
+
const O = /* @__PURE__ */ new Set(), M = /* @__PURE__ */ new Map(), m = (v) => {
|
|
2971
|
+
w++;
|
|
2972
|
+
const d = ao(v);
|
|
2973
|
+
return O.has(d) || (O.add(d), M.set(`${v.x}:${v.y}`, v)), M.size >= t || w >= _;
|
|
2974
|
+
};
|
|
2975
|
+
if (p.xx && p.yy)
|
|
2976
|
+
for (f = 0; f < r && !Gr(u[f], p.xx, p.yy, m); f++)
|
|
2977
|
+
;
|
|
2978
|
+
return Array.from(M.values());
|
|
2831
2979
|
}
|
|
2832
2980
|
}
|
|
2833
|
-
function
|
|
2981
|
+
function qt(...e) {
|
|
2834
2982
|
const t = e.join(" ");
|
|
2835
2983
|
throw new Error(t);
|
|
2836
2984
|
}
|
|
2837
2985
|
function ae(e) {
|
|
2838
|
-
return e ?
|
|
2986
|
+
return e ? jr(e) ? !0 : Ur(e) ? !1 : e.length === 0 ? !0 : e.length > 0 : !1;
|
|
2839
2987
|
}
|
|
2840
|
-
function
|
|
2988
|
+
function Ur(e) {
|
|
2841
2989
|
return e != null && e.toString === String.prototype.toString;
|
|
2842
2990
|
}
|
|
2843
|
-
function
|
|
2991
|
+
function jr(e) {
|
|
2844
2992
|
return Array.isArray(e);
|
|
2845
2993
|
}
|
|
2846
|
-
function
|
|
2847
|
-
ae(e) ||
|
|
2994
|
+
function qr(e, t) {
|
|
2995
|
+
ae(e) || qt("utils.sum() expects an array, received:", e);
|
|
2848
2996
|
let n = 0, i;
|
|
2849
2997
|
for (let o = 0, r = e.length; o < r; o++)
|
|
2850
2998
|
i = e[o], i && (n += i);
|
|
2851
2999
|
return n;
|
|
2852
3000
|
}
|
|
2853
|
-
function
|
|
3001
|
+
function zr(e, t, n) {
|
|
2854
3002
|
if (!ae(e))
|
|
2855
3003
|
throw new Error(`#forEach() takes an array-like argument. ${e}`);
|
|
2856
3004
|
for (let i = 0, o = e.length; i < o; i++)
|
|
2857
3005
|
t.call(n, e[i], i);
|
|
2858
3006
|
}
|
|
2859
|
-
function
|
|
3007
|
+
function Jr(e, t) {
|
|
2860
3008
|
for (let n = 0, i = e.length; n < i; n++)
|
|
2861
3009
|
e[n] = t;
|
|
2862
3010
|
return e;
|
|
2863
3011
|
}
|
|
2864
|
-
function
|
|
2865
|
-
const
|
|
2866
|
-
let r, s, a,
|
|
2867
|
-
for (
|
|
2868
|
-
for (r = e[d], s = e[d + 1],
|
|
2869
|
-
if (w = n[a],
|
|
2870
|
-
if (p >
|
|
2871
|
-
} else if (p <
|
|
2872
|
-
r == a || r ==
|
|
2873
|
-
|
|
3012
|
+
function Gr(e, t, n, i) {
|
|
3013
|
+
const o = e.length - 2;
|
|
3014
|
+
let r, s, a, c, f, h, l, u, p, _, w, O, M, m, v, d, b;
|
|
3015
|
+
for (ro(t, e), d = 0; d < o; ) {
|
|
3016
|
+
for (r = e[d], s = e[d + 1], f = t[r], h = t[s], p = n[r], _ = n[s], b = d; b < o && (b += 2, a = e[b], l = t[a], !(h < l)); ) {
|
|
3017
|
+
if (w = n[a], c = e[b + 1], u = t[c], O = n[c], p >= w) {
|
|
3018
|
+
if (p > O && _ > w && _ > O) continue;
|
|
3019
|
+
} else if (p < O && _ < w && _ < O) continue;
|
|
3020
|
+
if (!(r == a || r == c || s == a || s == c) && (M = Kr(
|
|
3021
|
+
f,
|
|
2874
3022
|
p,
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
3023
|
+
h,
|
|
3024
|
+
_,
|
|
3025
|
+
l,
|
|
2878
3026
|
w,
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
),
|
|
2882
|
-
|
|
2883
|
-
)));
|
|
3027
|
+
u,
|
|
3028
|
+
O
|
|
3029
|
+
), M && (m = [r, s], v = [a, c], i(Tn(M, m, v, t, n)) || M.length == 4 && i(Tn(M.slice(2), m, v, t, n)))))
|
|
3030
|
+
return !0;
|
|
2884
3031
|
}
|
|
2885
3032
|
d += 2;
|
|
2886
3033
|
}
|
|
2887
|
-
return
|
|
3034
|
+
return !1;
|
|
2888
3035
|
}
|
|
2889
|
-
function
|
|
2890
|
-
const
|
|
2891
|
-
let
|
|
2892
|
-
return
|
|
3036
|
+
function Kr(e, t, n, i, o, r, s, a) {
|
|
3037
|
+
const c = Qr(e, t, n, i, o, r, s, a);
|
|
3038
|
+
let f = null;
|
|
3039
|
+
return c && (f = Hr(e, t, n, i, o, r, s, a), f ? io(e, t, n, i, o, r, s, a) && (f = null) : f = no(e, t, n, i, o, r, s, a)), f;
|
|
2893
3040
|
}
|
|
2894
|
-
function
|
|
3041
|
+
function Qr(e, t, n, i, o, r, s, a) {
|
|
2895
3042
|
return ie(e, t, n, i, o, r) * ie(e, t, n, i, s, a) <= 0 && ie(o, r, s, a, e, t) * ie(o, r, s, a, n, i) <= 0;
|
|
2896
3043
|
}
|
|
2897
3044
|
function ie(e, t, n, i, o, r) {
|
|
2898
|
-
return
|
|
3045
|
+
return Wn(e - o, t - r, n - o, i - r);
|
|
2899
3046
|
}
|
|
2900
|
-
function
|
|
3047
|
+
function Wn(e, t, n, i) {
|
|
2901
3048
|
return e * i - t * n;
|
|
2902
3049
|
}
|
|
2903
|
-
function
|
|
2904
|
-
let
|
|
2905
|
-
return
|
|
3050
|
+
function Hr(e, t, n, i, o, r, s, a) {
|
|
3051
|
+
let c = xe(e, t, n, i, o, r, s, a), f;
|
|
3052
|
+
return c && (f = Zr(c[0], c[1], e, t, n, i, o, r, s, a), f == 1 ? c = xe(n, i, e, t, o, r, s, a) : f == 2 ? c = xe(o, r, s, a, e, t, n, i) : f == 3 && (c = xe(s, a, o, r, e, t, n, i))), c && eo(c, e, t, n, i, o, r, s, a), c;
|
|
2906
3053
|
}
|
|
2907
3054
|
function xe(e, t, n, i, o, r, s, a) {
|
|
2908
|
-
const
|
|
2909
|
-
let
|
|
2910
|
-
if (
|
|
2911
|
-
const
|
|
2912
|
-
return
|
|
3055
|
+
const c = Wn(n - e, i - t, s - o, a - r), f = 1e-18;
|
|
3056
|
+
let h;
|
|
3057
|
+
if (c === 0) return null;
|
|
3058
|
+
const l = ie(o, r, s, a, e, t) / c;
|
|
3059
|
+
return c <= f && c >= -f ? h = Wr(e, t, n, i, o, r, s, a) : h = [e + l * (n - e), t + l * (i - t)], h;
|
|
2913
3060
|
}
|
|
2914
|
-
function
|
|
2915
|
-
let
|
|
2916
|
-
return !
|
|
3061
|
+
function Wr(e, t, n, i, o, r, s, a) {
|
|
3062
|
+
let c = null;
|
|
3063
|
+
return !Nt(e, o, s) && !Nt(t, r, a) ? c = [e, t] : !Nt(n, o, s) && !Nt(i, r, a) ? c = [n, i] : !Nt(o, e, n) && !Nt(r, t, i) ? c = [o, r] : !Nt(s, e, n) && !Nt(a, t, i) && (c = [s, a]), c;
|
|
2917
3064
|
}
|
|
2918
|
-
function
|
|
3065
|
+
function Nt(e, t, n) {
|
|
2919
3066
|
let i;
|
|
2920
3067
|
return t < n ? i = e < t || e > n : t > n ? i = e > t || e < n : i = e != t, i;
|
|
2921
3068
|
}
|
|
2922
|
-
function
|
|
3069
|
+
function Zr(e, t, ...n) {
|
|
2923
3070
|
let i = -1, o = 1 / 0, r;
|
|
2924
|
-
for (let s = 0, a = 0,
|
|
2925
|
-
r =
|
|
3071
|
+
for (let s = 0, a = 0, c = n.length; a < c; s++, a += 2)
|
|
3072
|
+
r = to(e, t, n[a], n[a + 1]), r < o && (o = r, i = s);
|
|
2926
3073
|
return i;
|
|
2927
3074
|
}
|
|
2928
|
-
function
|
|
3075
|
+
function to(e, t, n, i) {
|
|
2929
3076
|
const o = e - n, r = t - i;
|
|
2930
3077
|
return o * o + r * r;
|
|
2931
3078
|
}
|
|
2932
|
-
function
|
|
2933
|
-
let
|
|
2934
|
-
|
|
3079
|
+
function eo(e, t, n, i, o, r, s, a, c) {
|
|
3080
|
+
let f = e[0], h = e[1];
|
|
3081
|
+
f = _e(f, t, i), f = _e(f, r, a), h = _e(h, n, o), h = _e(h, s, c), e[0] = f, e[1] = h;
|
|
2935
3082
|
}
|
|
2936
3083
|
function _e(e, t, n) {
|
|
2937
3084
|
let i;
|
|
2938
|
-
return
|
|
3085
|
+
return Nt(e, t, n) && (i = Math.abs(e - t) < Math.abs(e - n) ? t : n, e = i), e;
|
|
2939
3086
|
}
|
|
2940
|
-
function
|
|
2941
|
-
const
|
|
3087
|
+
function no(e, t, n, i, o, r, s, a) {
|
|
3088
|
+
const c = Math.min(e, n, o, s), f = Math.max(e, n, o, s), h = Math.min(t, i, r, a), l = Math.max(t, i, r, a), u = l - h > f - c;
|
|
2942
3089
|
let p = [];
|
|
2943
|
-
return (
|
|
3090
|
+
return (u ? Rt(t, h, l) : Rt(e, c, f)) && p.push(e, t), (u ? Rt(i, h, l) : Rt(n, c, f)) && p.push(n, i), (u ? Rt(r, h, l) : Rt(o, c, f)) && p.push(o, r), (u ? Rt(a, h, l) : Rt(s, c, f)) && p.push(s, a), (p.length != 2 && p.length != 4 || p.length == 4 && p[0] == p[2] && p[1] == p[3]) && (p = null), p;
|
|
2944
3091
|
}
|
|
2945
|
-
function
|
|
3092
|
+
function io(e, t, n, i, o, r, s, a) {
|
|
2946
3093
|
return e == o && t == r || e == s && t == a || n == o && i == r || n == s && i == a;
|
|
2947
3094
|
}
|
|
2948
3095
|
function Rt(e, t, n) {
|
|
2949
3096
|
return e > t && e < n;
|
|
2950
3097
|
}
|
|
2951
|
-
function
|
|
2952
|
-
|
|
3098
|
+
function ro(e, t) {
|
|
3099
|
+
oo(e, t), Zn(e, t, 0, t.length - 2);
|
|
2953
3100
|
}
|
|
2954
|
-
function
|
|
3101
|
+
function oo(e, t) {
|
|
2955
3102
|
for (let n = 0, i = t.length; n < i; n += 2)
|
|
2956
|
-
e[t[n]] > e[t[n + 1]] &&
|
|
3103
|
+
e[t[n]] > e[t[n + 1]] && so(t, n, n + 1);
|
|
2957
3104
|
}
|
|
2958
|
-
function
|
|
3105
|
+
function so(e, t, n) {
|
|
2959
3106
|
const i = e[t];
|
|
2960
3107
|
e[t] = e[n], e[n] = i;
|
|
2961
3108
|
}
|
|
2962
|
-
function
|
|
3109
|
+
function Zn(e, t, n, i) {
|
|
2963
3110
|
let o = n, r = i, s, a;
|
|
2964
3111
|
for (; o < i; ) {
|
|
2965
3112
|
for (s = e[t[n + i >> 2 << 1]]; o <= r; ) {
|
|
@@ -2967,14 +3114,14 @@ function Kn(e, t, n, i) {
|
|
|
2967
3114
|
for (; e[t[r]] > s; ) r -= 2;
|
|
2968
3115
|
o <= r && (a = t[o], t[o] = t[r], t[r] = a, a = t[o + 1], t[o + 1] = t[r + 1], t[r + 1] = a, o += 2, r -= 2);
|
|
2969
3116
|
}
|
|
2970
|
-
if (r - n < 40 ?
|
|
2971
|
-
|
|
3117
|
+
if (r - n < 40 ? Bn(e, t, n, r) : Zn(e, t, n, r), i - o < 40) {
|
|
3118
|
+
Bn(e, t, o, i);
|
|
2972
3119
|
return;
|
|
2973
3120
|
}
|
|
2974
3121
|
n = o, r = i;
|
|
2975
3122
|
}
|
|
2976
3123
|
}
|
|
2977
|
-
function
|
|
3124
|
+
function Bn(e, t, n, i) {
|
|
2978
3125
|
let o, r;
|
|
2979
3126
|
for (let s = n + 2; s <= i; s += 2) {
|
|
2980
3127
|
o = t[s], r = t[s + 1];
|
|
@@ -2984,27 +3131,20 @@ function On(e, t, n, i) {
|
|
|
2984
3131
|
t[a + 2] = o, t[a + 3] = r;
|
|
2985
3132
|
}
|
|
2986
3133
|
}
|
|
2987
|
-
function
|
|
3134
|
+
function Tn(e, t, n, i, o) {
|
|
2988
3135
|
const r = e[0], s = e[1];
|
|
2989
|
-
t =
|
|
2990
|
-
const a = t[0] < n[0] ? t : n,
|
|
2991
|
-
return { x: r, y: s, a, b:
|
|
3136
|
+
t = Cn(r, s, t[0], t[1], i, o), n = Cn(r, s, n[0], n[1], i, o);
|
|
3137
|
+
const a = t[0] < n[0] ? t : n, c = a == t ? n : t;
|
|
3138
|
+
return { x: r, y: s, a, b: c };
|
|
2992
3139
|
}
|
|
2993
|
-
function
|
|
3140
|
+
function Cn(e, t, n, i, o, r) {
|
|
2994
3141
|
let s = n < i ? n : i, a = s === n ? i : n;
|
|
2995
3142
|
return o[s] == e && r[s] == t ? a = s : o[a] == e && r[a] == t && (s = a), [s, a];
|
|
2996
3143
|
}
|
|
2997
|
-
function
|
|
2998
|
-
const t = {};
|
|
2999
|
-
return e.filter((n) => {
|
|
3000
|
-
const i = eo(n);
|
|
3001
|
-
return i in t ? !1 : (t[i] = !0, !0);
|
|
3002
|
-
});
|
|
3003
|
-
}
|
|
3004
|
-
function eo(e) {
|
|
3144
|
+
function ao(e) {
|
|
3005
3145
|
return `${e.a.join(",")};${e.b.join(",")}`;
|
|
3006
3146
|
}
|
|
3007
|
-
class
|
|
3147
|
+
class co {
|
|
3008
3148
|
_i = 0;
|
|
3009
3149
|
_n = 0;
|
|
3010
3150
|
_inc = 1;
|
|
@@ -3017,16 +3157,16 @@ class no {
|
|
|
3017
3157
|
this._xx = t, this._yy = n;
|
|
3018
3158
|
}
|
|
3019
3159
|
}
|
|
3020
|
-
function
|
|
3160
|
+
function lo(e, t, n, i) {
|
|
3021
3161
|
let o = n | 0;
|
|
3022
3162
|
const r = isNaN(i) ? e.length - o : i + o;
|
|
3023
|
-
let s, a,
|
|
3163
|
+
let s, a, c, f, h, l;
|
|
3024
3164
|
if (r > 0)
|
|
3025
|
-
|
|
3165
|
+
c = h = e[o], f = l = t[o];
|
|
3026
3166
|
else return [void 0, void 0, void 0, void 0];
|
|
3027
3167
|
for (o++; o < r; o++)
|
|
3028
|
-
s = e[o], a = t[o], s <
|
|
3029
|
-
return [
|
|
3168
|
+
s = e[o], a = t[o], s < c && (c = s), s > h && (h = s), a < f && (f = a), a > l && (l = a);
|
|
3169
|
+
return [c, f, h, l];
|
|
3030
3170
|
}
|
|
3031
3171
|
class ce {
|
|
3032
3172
|
xmin;
|
|
@@ -3055,18 +3195,18 @@ class ce {
|
|
|
3055
3195
|
return this.ymax - this.ymin || 0;
|
|
3056
3196
|
}
|
|
3057
3197
|
setBounds(t, n, i, o) {
|
|
3058
|
-
let r, s, a,
|
|
3198
|
+
let r, s, a, c;
|
|
3059
3199
|
if (arguments.length == 1)
|
|
3060
3200
|
if (ae(t)) {
|
|
3061
|
-
const
|
|
3062
|
-
r =
|
|
3201
|
+
const f = t;
|
|
3202
|
+
r = f[0], s = f[1], a = f[2], c = f[3];
|
|
3063
3203
|
} else {
|
|
3064
|
-
const
|
|
3065
|
-
r =
|
|
3204
|
+
const f = t;
|
|
3205
|
+
r = f.xmin, s = f.ymin, a = f.xmax, c = f.ymax;
|
|
3066
3206
|
}
|
|
3067
3207
|
else
|
|
3068
|
-
r = t, s = n, a = i,
|
|
3069
|
-
return this.xmin = r, this.ymin = s, this.xmax = a, this.ymax =
|
|
3208
|
+
r = t, s = n, a = i, c = o;
|
|
3209
|
+
return this.xmin = r, this.ymin = s, this.xmax = a, this.ymax = c, (r > a || s > c) && this.update(), this;
|
|
3070
3210
|
}
|
|
3071
3211
|
update() {
|
|
3072
3212
|
let t;
|
|
@@ -3074,7 +3214,7 @@ class ce {
|
|
|
3074
3214
|
}
|
|
3075
3215
|
mergeBounds(t, ...n) {
|
|
3076
3216
|
let i, o, r, s;
|
|
3077
|
-
return t instanceof ce ? (i = t.xmin, o = t.ymin, r = t.xmax, s = t.ymax) : n.length == 3 ? (i = t, o = n[0], r = n[1], s = n[2]) : t.length == 4 ? (i = t[0], o = t[1], r = t[2], s = t[3]) :
|
|
3217
|
+
return t instanceof ce ? (i = t.xmin, o = t.ymin, r = t.xmax, s = t.ymax) : n.length == 3 ? (i = t, o = n[0], r = n[1], s = n[2]) : t.length == 4 ? (i = t[0], o = t[1], r = t[2], s = t[3]) : qt("Bounds#mergeBounds() invalid argument:", t), this.xmin === void 0 ? this.setBounds(i, o, r, s) : (i < this.xmin && (this.xmin = i), o < this.ymin && (this.ymin = o), r > this.xmax && (this.xmax = r), s > this.ymax && (this.ymax = s)), this;
|
|
3078
3218
|
}
|
|
3079
3219
|
}
|
|
3080
3220
|
function Ae(e) {
|
|
@@ -3090,7 +3230,7 @@ function Ae(e) {
|
|
|
3090
3230
|
(n) => n.map((i) => t[i]).sort().join("-")
|
|
3091
3231
|
).sort();
|
|
3092
3232
|
}
|
|
3093
|
-
function
|
|
3233
|
+
function ti(e, t, n) {
|
|
3094
3234
|
const i = Ae(t.forw), o = Ae(t.bakw);
|
|
3095
3235
|
if (JSON.stringify(i) != JSON.stringify(o))
|
|
3096
3236
|
throw `${JSON.stringify(t, null, 2)}
|
|
@@ -3104,7 +3244,7 @@ ${JSON.stringify(o)}`;
|
|
|
3104
3244
|
}
|
|
3105
3245
|
n && (n.forw.features.push(t.forw), n.bakw.features.push(t.bakw));
|
|
3106
3246
|
}
|
|
3107
|
-
function
|
|
3247
|
+
function Xn(e, t, n) {
|
|
3108
3248
|
const i = Ae(t.forw), o = Ae(t.bakw);
|
|
3109
3249
|
if (JSON.stringify(i) != JSON.stringify(o))
|
|
3110
3250
|
throw `${JSON.stringify(t, null, 2)}
|
|
@@ -3113,35 +3253,35 @@ ${JSON.stringify(o)}`;
|
|
|
3113
3253
|
if (i.forEach((r) => {
|
|
3114
3254
|
const s = e[r];
|
|
3115
3255
|
if (!s) return;
|
|
3116
|
-
const a = s.filter((
|
|
3256
|
+
const a = s.filter((c) => c !== t);
|
|
3117
3257
|
a.length === 0 ? delete e[r] : e[r] = a;
|
|
3118
3258
|
}), n) {
|
|
3119
3259
|
const r = (s, a) => {
|
|
3120
|
-
!s || !a || (s.features = s.features.filter((
|
|
3260
|
+
!s || !a || (s.features = s.features.filter((c) => c !== a));
|
|
3121
3261
|
};
|
|
3122
3262
|
r(n.forw, t.forw), r(n.bakw, t.bakw);
|
|
3123
3263
|
}
|
|
3124
3264
|
}
|
|
3125
3265
|
function Me(e, t, n) {
|
|
3126
|
-
return
|
|
3266
|
+
return Yt(e, { target: { geom: t, index: n } });
|
|
3127
3267
|
}
|
|
3128
3268
|
function Se(e) {
|
|
3129
|
-
return
|
|
3269
|
+
return Yt(e.properties.target.geom, {
|
|
3130
3270
|
target: {
|
|
3131
3271
|
geom: e.geometry.coordinates,
|
|
3132
3272
|
index: e.properties.target.index
|
|
3133
3273
|
}
|
|
3134
3274
|
});
|
|
3135
3275
|
}
|
|
3136
|
-
function
|
|
3276
|
+
function $n(e, t) {
|
|
3137
3277
|
const n = e.length, i = t.geometry.coordinates;
|
|
3138
3278
|
return Array.from({ length: n }, (o, r) => r).map((o) => {
|
|
3139
|
-
const r = (o + 1) % n, s = e[o], a = e[r],
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
),
|
|
3279
|
+
const r = (o + 1) % n, s = e[o], a = e[r], c = s.geometry.coordinates, f = Math.atan2(
|
|
3280
|
+
c[0] - i[0],
|
|
3281
|
+
c[1] - i[1]
|
|
3282
|
+
), h = [t, s, a, t].map(
|
|
3143
3283
|
(p) => p.geometry.coordinates
|
|
3144
|
-
),
|
|
3284
|
+
), l = {
|
|
3145
3285
|
a: {
|
|
3146
3286
|
geom: t.properties.target.geom,
|
|
3147
3287
|
index: t.properties.target.index
|
|
@@ -3154,20 +3294,20 @@ function Xn(e, t) {
|
|
|
3154
3294
|
geom: a.properties.target.geom,
|
|
3155
3295
|
index: a.properties.target.index
|
|
3156
3296
|
}
|
|
3157
|
-
},
|
|
3158
|
-
le([
|
|
3297
|
+
}, u = Et([
|
|
3298
|
+
le([h], l)
|
|
3159
3299
|
]);
|
|
3160
|
-
return [
|
|
3300
|
+
return [f, u];
|
|
3161
3301
|
}).reduce(
|
|
3162
3302
|
(o, r) => (o[0].push(r[0]), o[1].push(r[1]), o),
|
|
3163
3303
|
[[], []]
|
|
3164
3304
|
);
|
|
3165
3305
|
}
|
|
3166
|
-
function
|
|
3306
|
+
function Ee(e, t = 1e-6) {
|
|
3167
3307
|
const [n, i] = e[0], [o, r] = e[1], [s, a] = e[2];
|
|
3168
3308
|
return Math.abs((o - n) * (a - i) - (s - n) * (r - i)) < t;
|
|
3169
3309
|
}
|
|
3170
|
-
function
|
|
3310
|
+
function fo(e, t) {
|
|
3171
3311
|
const n = /* @__PURE__ */ new Set();
|
|
3172
3312
|
return e.forEach((i) => {
|
|
3173
3313
|
if (i.length !== 2) return;
|
|
@@ -3181,147 +3321,147 @@ function re(e) {
|
|
|
3181
3321
|
geom: e.geometry.coordinates[0][n]
|
|
3182
3322
|
}));
|
|
3183
3323
|
}
|
|
3184
|
-
const
|
|
3185
|
-
function
|
|
3324
|
+
const ho = 10;
|
|
3325
|
+
function uo(e, t, n, i, o, r) {
|
|
3186
3326
|
if (!e && !t) return !1;
|
|
3187
|
-
const s = e ? 0 : 1, a = 1 - s,
|
|
3188
|
-
if (!
|
|
3189
|
-
const
|
|
3190
|
-
let
|
|
3327
|
+
const s = e ? 0 : 1, a = 1 - s, c = n[s], f = n[a];
|
|
3328
|
+
if (!c || !f) return !1;
|
|
3329
|
+
const h = _t(f.geom);
|
|
3330
|
+
let l = !1, u = !1;
|
|
3191
3331
|
for (let p = 0; p <= 1; p++) {
|
|
3192
|
-
const
|
|
3193
|
-
if (!
|
|
3194
|
-
const w = [String(
|
|
3195
|
-
if (!
|
|
3196
|
-
const
|
|
3197
|
-
(
|
|
3332
|
+
const _ = i[p];
|
|
3333
|
+
if (!_) continue;
|
|
3334
|
+
const w = [String(_.prop.index), String(c.prop.index)].sort().join("-"), O = o[w];
|
|
3335
|
+
if (!O || O.length < 2) continue;
|
|
3336
|
+
const M = O.find(
|
|
3337
|
+
(N) => N.bakw !== r[s].bakw
|
|
3198
3338
|
);
|
|
3199
|
-
if (!
|
|
3200
|
-
const
|
|
3201
|
-
(
|
|
3339
|
+
if (!M) continue;
|
|
3340
|
+
const v = re(M.bakw).find(
|
|
3341
|
+
(N) => String(N.prop.index) !== String(_.prop.index) && String(N.prop.index) !== String(c.prop.index)
|
|
3202
3342
|
);
|
|
3203
|
-
if (!
|
|
3204
|
-
|
|
3205
|
-
const d =
|
|
3206
|
-
if (
|
|
3207
|
-
|
|
3343
|
+
if (!v) continue;
|
|
3344
|
+
l = !0;
|
|
3345
|
+
const d = _t(v.geom), b = _t(_.geom), g = _t(c.geom), E = g[0] - b[0], S = g[1] - b[1], k = E * (h[1] - b[1]) - S * (h[0] - b[0]), P = E * (d[1] - b[1]) - S * (d[0] - b[0]);
|
|
3346
|
+
if (k * P > 0) {
|
|
3347
|
+
u = !0;
|
|
3208
3348
|
break;
|
|
3209
3349
|
}
|
|
3210
3350
|
}
|
|
3211
|
-
return
|
|
3351
|
+
return l && !u;
|
|
3212
3352
|
}
|
|
3213
|
-
function
|
|
3353
|
+
function po(e, t, n, i) {
|
|
3214
3354
|
if (!e && !t) return !1;
|
|
3215
3355
|
if (n[0] && n[1] && i[0] && i[1]) {
|
|
3216
|
-
const o = i.map((
|
|
3217
|
-
return
|
|
3356
|
+
const o = i.map((h) => _t(h.geom)), r = n.map((h) => _t(h.geom)), s = o[1][0] - o[0][0], a = o[1][1] - o[0][1], c = s * (r[0][1] - o[0][1]) - a * (r[0][0] - o[0][0]), f = s * (r[1][1] - o[0][1]) - a * (r[1][0] - o[0][0]);
|
|
3357
|
+
return c * f < 0;
|
|
3218
3358
|
}
|
|
3219
3359
|
return !1;
|
|
3220
3360
|
}
|
|
3221
|
-
function
|
|
3222
|
-
const o =
|
|
3361
|
+
function mo(e, t, n, i) {
|
|
3362
|
+
const o = fo(n, i), r = /* @__PURE__ */ new Set();
|
|
3223
3363
|
let s = !1;
|
|
3224
|
-
for (let a = 0; a <
|
|
3225
|
-
let
|
|
3226
|
-
for (const
|
|
3227
|
-
if (r.has(
|
|
3228
|
-
r.add(
|
|
3229
|
-
const
|
|
3230
|
-
if (!
|
|
3231
|
-
const
|
|
3232
|
-
if (
|
|
3233
|
-
const
|
|
3234
|
-
(
|
|
3235
|
-
),
|
|
3236
|
-
(
|
|
3364
|
+
for (let a = 0; a < ho; a++) {
|
|
3365
|
+
let c = !1;
|
|
3366
|
+
for (const f of Object.keys(t)) {
|
|
3367
|
+
if (r.has(f)) continue;
|
|
3368
|
+
r.add(f);
|
|
3369
|
+
const h = t[f];
|
|
3370
|
+
if (!h || h.length < 2) continue;
|
|
3371
|
+
const l = f.split("-");
|
|
3372
|
+
if (l.length !== 2 || o.has(f)) continue;
|
|
3373
|
+
const u = re(h[0].bakw), p = re(h[1].bakw), _ = re(h[0].forw), w = re(h[1].forw), O = l.map(
|
|
3374
|
+
(x) => u.find((B) => `${B.prop.index}` === x) || p.find((B) => `${B.prop.index}` === x)
|
|
3375
|
+
), M = l.map(
|
|
3376
|
+
(x) => _.find((B) => `${B.prop.index}` === x) || w.find((B) => `${B.prop.index}` === x)
|
|
3237
3377
|
);
|
|
3238
|
-
if (
|
|
3378
|
+
if (O.some((x) => !x) || M.some((x) => !x))
|
|
3239
3379
|
continue;
|
|
3240
|
-
const m = [
|
|
3241
|
-
(
|
|
3242
|
-
),
|
|
3243
|
-
(
|
|
3380
|
+
const m = [u, p].map(
|
|
3381
|
+
(x) => x.find((B) => !l.includes(`${B.prop.index}`))
|
|
3382
|
+
), v = [_, w].map(
|
|
3383
|
+
(x) => x.find((B) => !l.includes(`${B.prop.index}`))
|
|
3244
3384
|
);
|
|
3245
|
-
if (m.some((
|
|
3385
|
+
if (m.some((x) => !x) || v.some((x) => !x))
|
|
3246
3386
|
continue;
|
|
3247
|
-
const d =
|
|
3387
|
+
const d = h[0].bakw.geometry.coordinates[0].slice(0, 3).map((x) => _t(x)), b = h[1].bakw.geometry.coordinates[0].slice(0, 3).map((x) => _t(x)), g = h[0].forw.geometry.coordinates[0].slice(0, 3).map((x) => _t(x)), E = h[1].forw.geometry.coordinates[0].slice(0, 3).map((x) => _t(x)), S = Ee(d), k = Ee(b), P = Ee(g), N = Ee(E), C = uo(
|
|
3248
3388
|
S,
|
|
3249
|
-
|
|
3389
|
+
k,
|
|
3250
3390
|
m,
|
|
3251
|
-
I,
|
|
3252
|
-
t,
|
|
3253
|
-
u
|
|
3254
|
-
), Y = ao(
|
|
3255
3391
|
O,
|
|
3256
|
-
|
|
3392
|
+
t,
|
|
3393
|
+
h
|
|
3394
|
+
), F = po(
|
|
3395
|
+
P,
|
|
3396
|
+
N,
|
|
3257
3397
|
m,
|
|
3258
|
-
|
|
3398
|
+
O
|
|
3259
3399
|
);
|
|
3260
|
-
if (!(
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
) ||
|
|
3264
|
-
|
|
3400
|
+
if (!(C || F || Dn(
|
|
3401
|
+
_t(m[0].geom),
|
|
3402
|
+
b
|
|
3403
|
+
) || Dn(
|
|
3404
|
+
_t(m[1].geom),
|
|
3265
3405
|
d
|
|
3266
3406
|
)))
|
|
3267
3407
|
continue;
|
|
3268
|
-
const
|
|
3269
|
-
(
|
|
3270
|
-
),
|
|
3271
|
-
(
|
|
3272
|
-
), T =
|
|
3273
|
-
...
|
|
3274
|
-
...
|
|
3275
|
-
]),
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
) +
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3408
|
+
const I = M.map(
|
|
3409
|
+
(x) => _t(x.geom)
|
|
3410
|
+
), A = v.map(
|
|
3411
|
+
(x) => _t(x.geom)
|
|
3412
|
+
), T = go([
|
|
3413
|
+
...I,
|
|
3414
|
+
...A
|
|
3415
|
+
]), X = wo(T), D = Fn(
|
|
3416
|
+
I[0],
|
|
3417
|
+
I[1],
|
|
3418
|
+
A[0]
|
|
3419
|
+
) + Fn(
|
|
3420
|
+
I[0],
|
|
3421
|
+
I[1],
|
|
3422
|
+
A[1]
|
|
3283
3423
|
);
|
|
3284
|
-
|
|
3285
|
-
if (!
|
|
3286
|
-
const
|
|
3287
|
-
|
|
3424
|
+
qe(X, D) && (Xn(t, h[0], e), Xn(t, h[1], e), O.forEach((x) => {
|
|
3425
|
+
if (!x) return;
|
|
3426
|
+
const B = [
|
|
3427
|
+
x.geom,
|
|
3288
3428
|
m[0].geom,
|
|
3289
3429
|
m[1].geom,
|
|
3290
|
-
|
|
3291
|
-
],
|
|
3292
|
-
a:
|
|
3430
|
+
x.geom
|
|
3431
|
+
], $ = {
|
|
3432
|
+
a: x.prop,
|
|
3293
3433
|
b: m[0].prop,
|
|
3294
3434
|
c: m[1].prop
|
|
3295
|
-
}, R = le([
|
|
3296
|
-
|
|
3435
|
+
}, R = le([B], $), L = Jn(R);
|
|
3436
|
+
ti(t, {
|
|
3297
3437
|
forw: L,
|
|
3298
3438
|
bakw: R
|
|
3299
3439
|
}, e);
|
|
3300
|
-
}),
|
|
3440
|
+
}), c = !0, s = !0);
|
|
3301
3441
|
}
|
|
3302
|
-
if (!
|
|
3442
|
+
if (!c) break;
|
|
3303
3443
|
}
|
|
3304
3444
|
return s;
|
|
3305
3445
|
}
|
|
3306
|
-
function
|
|
3446
|
+
function _t(e) {
|
|
3307
3447
|
return [e[0], e[1]];
|
|
3308
3448
|
}
|
|
3309
|
-
function
|
|
3310
|
-
const [n, i] = t[0], [o, r] = t[1], [s, a] = t[2],
|
|
3311
|
-
if (
|
|
3312
|
-
const d = 1 /
|
|
3313
|
-
return
|
|
3449
|
+
function Dn(e, t) {
|
|
3450
|
+
const [n, i] = t[0], [o, r] = t[1], [s, a] = t[2], c = s - n, f = a - i, h = o - n, l = r - i, u = e[0] - n, p = e[1] - i, _ = c * c + f * f, w = c * h + f * l, O = c * u + f * p, M = h * h + l * l, m = h * u + l * p, v = _ * M - w * w;
|
|
3451
|
+
if (v === 0) return !1;
|
|
3452
|
+
const d = 1 / v, b = (M * O - w * m) * d, g = (_ * m - w * O) * d, E = 1e-9;
|
|
3453
|
+
return b >= -E && g >= -E && b + g <= 1 + E;
|
|
3314
3454
|
}
|
|
3315
|
-
function
|
|
3455
|
+
function go(e) {
|
|
3316
3456
|
const t = e.map((s) => s.slice()).filter(
|
|
3317
|
-
(s, a,
|
|
3318
|
-
(
|
|
3457
|
+
(s, a, c) => c.findIndex(
|
|
3458
|
+
(f) => qe(f[0], s[0]) && qe(f[1], s[1])
|
|
3319
3459
|
) === a
|
|
3320
3460
|
);
|
|
3321
3461
|
if (t.length <= 1) return t;
|
|
3322
3462
|
const n = t.sort(
|
|
3323
3463
|
(s, a) => s[0] === a[0] ? s[1] - a[1] : s[0] - a[0]
|
|
3324
|
-
), i = (s, a,
|
|
3464
|
+
), i = (s, a, c) => (a[0] - s[0]) * (c[1] - s[1]) - (a[1] - s[1]) * (c[0] - s[0]), o = [];
|
|
3325
3465
|
for (const s of n) {
|
|
3326
3466
|
for (; o.length >= 2 && i(
|
|
3327
3467
|
o[o.length - 2],
|
|
@@ -3344,7 +3484,7 @@ function lo(e) {
|
|
|
3344
3484
|
}
|
|
3345
3485
|
return r.pop(), o.pop(), o.concat(r);
|
|
3346
3486
|
}
|
|
3347
|
-
function
|
|
3487
|
+
function wo(e) {
|
|
3348
3488
|
if (e.length < 3) return 0;
|
|
3349
3489
|
let t = 0;
|
|
3350
3490
|
for (let n = 0; n < e.length; n++) {
|
|
@@ -3353,16 +3493,16 @@ function ho(e) {
|
|
|
3353
3493
|
}
|
|
3354
3494
|
return Math.abs(t) / 2;
|
|
3355
3495
|
}
|
|
3356
|
-
function
|
|
3496
|
+
function Fn(e, t, n) {
|
|
3357
3497
|
return Math.abs(
|
|
3358
3498
|
(e[0] * (t[1] - n[1]) + t[0] * (n[1] - e[1]) + n[0] * (e[1] - t[1])) / 2
|
|
3359
3499
|
);
|
|
3360
3500
|
}
|
|
3361
|
-
function
|
|
3501
|
+
function qe(e, t, n = 1e-9) {
|
|
3362
3502
|
return Math.abs(e - t) <= n;
|
|
3363
3503
|
}
|
|
3364
|
-
const
|
|
3365
|
-
class
|
|
3504
|
+
const Rn = 2.00704, Yn = 3.00001;
|
|
3505
|
+
class lt extends St {
|
|
3366
3506
|
importance;
|
|
3367
3507
|
priority;
|
|
3368
3508
|
pointsSet;
|
|
@@ -3372,20 +3512,20 @@ class ht extends Mt {
|
|
|
3372
3512
|
* @param options - 初期化オプション
|
|
3373
3513
|
*/
|
|
3374
3514
|
constructor(t = {}) {
|
|
3375
|
-
super(), t.bounds ? this.setBounds(t.bounds) : (this.setWh(t.wh), this.vertexMode = t.vertexMode ||
|
|
3515
|
+
super(), t.bounds ? this.setBounds(t.bounds) : (this.setWh(t.wh), this.vertexMode = t.vertexMode || lt.VERTEX_PLAIN), this.strictMode = t.strictMode || lt.MODE_AUTO, this.yaxisMode = t.yaxisMode || lt.YAXIS_INVERT, this.importance = t.importance || 0, this.priority = t.priority || 0, this.stateFull = t.stateFull || !1, this.useV2Algorithm = t.useV2Algorithm ?? !1, t.points && this.setPoints(t.points), t.edges && this.setEdges(t.edges);
|
|
3376
3516
|
}
|
|
3377
3517
|
/**
|
|
3378
3518
|
* フォーマットバージョンを取得します
|
|
3379
3519
|
*/
|
|
3380
3520
|
getFormatVersion() {
|
|
3381
|
-
return this.useV2Algorithm ?
|
|
3521
|
+
return this.useV2Algorithm ? Rn : Yn;
|
|
3382
3522
|
}
|
|
3383
3523
|
/**
|
|
3384
3524
|
* 制御点(GCP: Ground Control Points)を設定します。
|
|
3385
3525
|
* 指定した点群に合わせて内部のTINキャッシュをリセットします。
|
|
3386
3526
|
*/
|
|
3387
3527
|
setPoints(t) {
|
|
3388
|
-
this.yaxisMode ===
|
|
3528
|
+
this.yaxisMode === lt.YAXIS_FOLLOW && (t = t.map((n) => [
|
|
3389
3529
|
n[0],
|
|
3390
3530
|
[n[1][0], -1 * n[1][1]]
|
|
3391
3531
|
])), this.points = t, this.tins = void 0, this.indexedTins = void 0;
|
|
@@ -3395,7 +3535,7 @@ class ht extends Mt {
|
|
|
3395
3535
|
* 制約線を正規化した上で、依存するキャッシュをリセットします。
|
|
3396
3536
|
*/
|
|
3397
3537
|
setEdges(t = []) {
|
|
3398
|
-
this.edges =
|
|
3538
|
+
this.edges = Gn(t), this.edgeNodes = void 0, this.tins = void 0, this.indexedTins = void 0;
|
|
3399
3539
|
}
|
|
3400
3540
|
/**
|
|
3401
3541
|
* 境界ポリゴンを設定します
|
|
@@ -3405,17 +3545,17 @@ class ht extends Mt {
|
|
|
3405
3545
|
let n = t[0][0], i = n, o = t[0][1], r = o;
|
|
3406
3546
|
const s = [t[0]];
|
|
3407
3547
|
for (let a = 1; a < t.length; a++) {
|
|
3408
|
-
const
|
|
3409
|
-
|
|
3548
|
+
const c = t[a];
|
|
3549
|
+
c[0] < n && (n = c[0]), c[0] > i && (i = c[0]), c[1] < o && (o = c[1]), c[1] > r && (r = c[1]), s.push(c);
|
|
3410
3550
|
}
|
|
3411
|
-
s.push(t[0]), this.boundsPolygon = le([s]), this.xy = [n, o], this.wh = [i - n, r - o], this.vertexMode =
|
|
3551
|
+
s.push(t[0]), this.boundsPolygon = le([s]), this.xy = [n, o], this.wh = [i - n, r - o], this.vertexMode = lt.VERTEX_PLAIN, this.tins = void 0, this.indexedTins = void 0;
|
|
3412
3552
|
}
|
|
3413
3553
|
/**
|
|
3414
3554
|
* 現在の設定を永続化可能な形式にコンパイルします
|
|
3415
3555
|
*/
|
|
3416
3556
|
getCompiled() {
|
|
3417
3557
|
const t = {};
|
|
3418
|
-
t.version = this.useV2Algorithm ?
|
|
3558
|
+
t.version = this.useV2Algorithm ? Rn : Yn, t.points = this.points, t.weight_buffer = {}, t.centroid_point = [
|
|
3419
3559
|
this.centroid.forw.geometry.coordinates,
|
|
3420
3560
|
this.centroid.forw.properties.target.geom
|
|
3421
3561
|
], t.vertices_params = [
|
|
@@ -3434,13 +3574,13 @@ class ht extends Mt {
|
|
|
3434
3574
|
(o) => i.properties[o].index
|
|
3435
3575
|
)
|
|
3436
3576
|
);
|
|
3437
|
-
}), this.strict_status ===
|
|
3577
|
+
}), this.strict_status === lt.STATUS_LOOSE ? (t.tins_points[1] = [], this.tins.bakw.features.map((i) => {
|
|
3438
3578
|
t.tins_points[1].push(
|
|
3439
3579
|
["a", "b", "c"].map(
|
|
3440
3580
|
(o) => i.properties[o].index
|
|
3441
3581
|
)
|
|
3442
3582
|
);
|
|
3443
|
-
})) : this.strict_status ===
|
|
3583
|
+
})) : this.strict_status === lt.STATUS_ERROR && this.kinks?.bakw && (t.kinks_points = this.kinks.bakw.features.map(
|
|
3444
3584
|
(i) => i.geometry.coordinates
|
|
3445
3585
|
)), t.yaxisMode = this.yaxisMode, t.vertexMode = this.vertexMode, t.strictMode = this.strictMode, this.bounds ? (t.bounds = this.bounds, t.boundsPolygon = this.boundsPolygon, this.useV2Algorithm && (t.xy = this.xy, t.wh = this.wh)) : t.wh = this.wh, t.edges = this.edges ?? [], t.edgeNodes = this.edgeNodes ?? [], t;
|
|
3446
3586
|
}
|
|
@@ -3473,35 +3613,38 @@ class ht extends Mt {
|
|
|
3473
3613
|
}
|
|
3474
3614
|
/**
|
|
3475
3615
|
* 厳密なTINを計算します
|
|
3616
|
+
*
|
|
3617
|
+
* @param kinkLimit - forw / bakw それぞれで残す交差(kinks)の件数の上限
|
|
3618
|
+
* (同じ位置の交差を 1 件に数えた件数)。届いた時点で数え上げをやめます
|
|
3476
3619
|
*/
|
|
3477
|
-
calculateStrictTin() {
|
|
3478
|
-
const
|
|
3479
|
-
(
|
|
3620
|
+
calculateStrictTin(t = Nn) {
|
|
3621
|
+
const n = this.tins.forw.features.map(
|
|
3622
|
+
(s) => Jn(s)
|
|
3480
3623
|
);
|
|
3481
|
-
this.tins.bakw =
|
|
3482
|
-
const
|
|
3483
|
-
this.tins.forw.features.forEach((
|
|
3484
|
-
const
|
|
3485
|
-
|
|
3624
|
+
this.tins.bakw = Et(n);
|
|
3625
|
+
const i = {};
|
|
3626
|
+
this.tins.forw.features.forEach((s, a) => {
|
|
3627
|
+
const c = this.tins.bakw.features[a];
|
|
3628
|
+
ti(i, { forw: s, bakw: c });
|
|
3486
3629
|
});
|
|
3487
|
-
const
|
|
3488
|
-
(
|
|
3630
|
+
const o = (this.pointsSet?.forw.features ?? []).map(
|
|
3631
|
+
(s) => s.properties.target.index
|
|
3489
3632
|
);
|
|
3490
|
-
|
|
3633
|
+
mo(
|
|
3491
3634
|
this.tins,
|
|
3492
|
-
|
|
3635
|
+
i,
|
|
3493
3636
|
this.pointsSet?.edges || [],
|
|
3494
|
-
|
|
3637
|
+
o
|
|
3495
3638
|
);
|
|
3496
|
-
const
|
|
3497
|
-
const
|
|
3498
|
-
(
|
|
3639
|
+
const r = ["forw", "bakw"].map((s) => {
|
|
3640
|
+
const a = this.tins[s].features.map(
|
|
3641
|
+
(c) => c.geometry.coordinates[0]
|
|
3499
3642
|
);
|
|
3500
|
-
return
|
|
3643
|
+
return Hn(a, t);
|
|
3501
3644
|
});
|
|
3502
|
-
|
|
3503
|
-
forw:
|
|
3504
|
-
bakw:
|
|
3645
|
+
r[0].length === 0 && r[1].length === 0 ? (this.strict_status = lt.STATUS_STRICT, delete this.kinks) : (this.strict_status = lt.STATUS_ERROR, this.kinks = {
|
|
3646
|
+
forw: Et(r[0]),
|
|
3647
|
+
bakw: Et(r[1])
|
|
3505
3648
|
});
|
|
3506
3649
|
}
|
|
3507
3650
|
/**
|
|
@@ -3522,63 +3665,24 @@ class ht extends Mt {
|
|
|
3522
3665
|
this.edgeNodes = [], this.edges || (this.edges = []);
|
|
3523
3666
|
for (let o = 0; o < this.edges.length; o++) {
|
|
3524
3667
|
const r = this.edges[o][2], s = Object.assign([], this.edges[o][0]), a = Object.assign([], this.edges[o][1]);
|
|
3525
|
-
if (s.length === 0 && a.length === 0) {
|
|
3668
|
+
if (yo(r, this.points.length, o), s.length === 0 && a.length === 0) {
|
|
3526
3669
|
n.push(r);
|
|
3527
3670
|
continue;
|
|
3528
3671
|
}
|
|
3529
|
-
s.unshift(this.points[r[0]][0]), s.push(this.points[r[1]][0]), a.unshift(this.points[r[0]][1]), a.push(this.points[r[1]][1])
|
|
3530
|
-
const h = [s, a].map((l) => {
|
|
3531
|
-
const u = l.map((f, p, M) => {
|
|
3532
|
-
if (p === 0) return 0;
|
|
3533
|
-
const w = M[p - 1];
|
|
3534
|
-
return Math.sqrt(
|
|
3535
|
-
Math.pow(f[0] - w[0], 2) + Math.pow(f[1] - w[1], 2)
|
|
3536
|
-
);
|
|
3537
|
-
}), c = u.reduce((f, p, M) => M === 0 ? [0] : (f.push(f[M - 1] + p), f), []);
|
|
3538
|
-
return c.map((f, p, M) => {
|
|
3539
|
-
const w = f / M[M.length - 1];
|
|
3540
|
-
return [l[p], u[p], c[p], w];
|
|
3541
|
-
});
|
|
3542
|
-
});
|
|
3543
|
-
h.map((l, u) => {
|
|
3544
|
-
const c = h[u ? 0 : 1];
|
|
3545
|
-
return l.filter((f, p) => !(p === 0 || p === l.length - 1 || f[4] === "handled")).flatMap((f) => {
|
|
3546
|
-
const p = f[0], M = f[3], w = c.reduce(
|
|
3547
|
-
(I, x, m, _) => {
|
|
3548
|
-
if (I) return I;
|
|
3549
|
-
const d = _[m + 1];
|
|
3550
|
-
if (x[3] === M)
|
|
3551
|
-
return x[4] = "handled", [x];
|
|
3552
|
-
if (x[3] < M && d && d[3] > M)
|
|
3553
|
-
return [x, d];
|
|
3554
|
-
},
|
|
3555
|
-
void 0
|
|
3556
|
-
);
|
|
3557
|
-
if (w && w.length === 1)
|
|
3558
|
-
return u === 0 ? [[p, w[0][0], M]] : [[w[0][0], p, M]];
|
|
3559
|
-
if (w && w.length === 2) {
|
|
3560
|
-
const I = w[0], x = w[1], m = (M - I[3]) / (x[3] - I[3]), _ = [
|
|
3561
|
-
(x[0][0] - I[0][0]) * m + I[0][0],
|
|
3562
|
-
(x[0][1] - I[0][1]) * m + I[0][1]
|
|
3563
|
-
];
|
|
3564
|
-
return u === 0 ? [[p, _, M]] : [[_, p, M]];
|
|
3565
|
-
}
|
|
3566
|
-
return [];
|
|
3567
|
-
});
|
|
3568
|
-
}).reduce((l, u) => l.concat(u), []).sort((l, u) => l[2] < u[2] ? -1 : 1).map((l, u, c) => {
|
|
3672
|
+
s.unshift(this.points[r[0]][0]), s.push(this.points[r[1]][0]), a.unshift(this.points[r[0]][1]), a.push(this.points[r[1]][1]), Pr(s, a).map((c, f, h) => {
|
|
3569
3673
|
this.edgeNodes[i] = [
|
|
3570
|
-
|
|
3571
|
-
|
|
3674
|
+
c[0],
|
|
3675
|
+
c[1]
|
|
3572
3676
|
];
|
|
3573
|
-
const
|
|
3574
|
-
|
|
3575
|
-
|
|
3677
|
+
const l = Me(
|
|
3678
|
+
c[0],
|
|
3679
|
+
c[1],
|
|
3576
3680
|
`e${i}`
|
|
3577
3681
|
);
|
|
3578
|
-
i++, t.forw.push(
|
|
3682
|
+
i++, t.forw.push(l), t.bakw.push(Se(l)), f === 0 ? n.push([r[0], t.forw.length - 1]) : n.push([
|
|
3579
3683
|
t.forw.length - 2,
|
|
3580
3684
|
t.forw.length - 1
|
|
3581
|
-
]),
|
|
3685
|
+
]), f === h.length - 1 && n.push([t.forw.length - 1, r[1]]);
|
|
3582
3686
|
});
|
|
3583
3687
|
}
|
|
3584
3688
|
return {
|
|
@@ -3594,7 +3698,7 @@ class ht extends Mt {
|
|
|
3594
3698
|
const t = this.xy[0] - 0.05 * this.wh[0], n = this.xy[0] + 1.05 * this.wh[0], i = this.xy[1] - 0.05 * this.wh[1], o = this.xy[1] + 1.05 * this.wh[1];
|
|
3595
3699
|
if (this.bounds && !this.boundsPolygon) throw new Error("Internal error: bounds is set but boundsPolygon is missing");
|
|
3596
3700
|
const r = this.bounds ? this.boundsPolygon : void 0;
|
|
3597
|
-
if (!this.points.reduce((
|
|
3701
|
+
if (!this.points.reduce((c, f) => c && (r ? $e(f[0], r) : f[0][0] >= t && f[0][0] <= n && f[0][1] >= i && f[0][1] <= o), !0))
|
|
3598
3702
|
throw "SOME POINTS OUTSIDE";
|
|
3599
3703
|
let a = [];
|
|
3600
3704
|
return this.wh && (a = [[t, i], [n, i], [t, o], [n, o]]), {
|
|
@@ -3613,8 +3717,8 @@ class ht extends Mt {
|
|
|
3613
3717
|
computeGcpBbox() {
|
|
3614
3718
|
let t = 1 / 0, n = -1 / 0, i = 1 / 0, o = -1 / 0;
|
|
3615
3719
|
for (const a of this.points) {
|
|
3616
|
-
const
|
|
3617
|
-
|
|
3720
|
+
const c = a[0][0], f = a[0][1];
|
|
3721
|
+
c < t && (t = c), c > n && (n = c), f < i && (i = f), f > o && (o = f);
|
|
3618
3722
|
}
|
|
3619
3723
|
const r = n - t, s = o - i;
|
|
3620
3724
|
return {
|
|
@@ -3631,7 +3735,7 @@ class ht extends Mt {
|
|
|
3631
3735
|
*/
|
|
3632
3736
|
updateTin() {
|
|
3633
3737
|
let t = this.strictMode;
|
|
3634
|
-
t !==
|
|
3738
|
+
t !== lt.MODE_STRICT && t !== lt.MODE_LOOSE && (t = lt.MODE_AUTO);
|
|
3635
3739
|
const n = !this.useV2Algorithm;
|
|
3636
3740
|
let i, o, r, s, a;
|
|
3637
3741
|
if (n) {
|
|
@@ -3639,7 +3743,7 @@ class ht extends Mt {
|
|
|
3639
3743
|
const S = this.boundsPolygon;
|
|
3640
3744
|
if (!S) throw new Error("Internal error: bounds is set but boundsPolygon is missing");
|
|
3641
3745
|
if (!this.points.every(
|
|
3642
|
-
(
|
|
3746
|
+
(P) => $e(P[0], S)
|
|
3643
3747
|
)) throw "SOME POINTS OUTSIDE";
|
|
3644
3748
|
}
|
|
3645
3749
|
i = this.generatePointsSet(), { minx: o, maxx: r, miny: s, maxy: a } = this.computeGcpBbox();
|
|
@@ -3647,41 +3751,41 @@ class ht extends Mt {
|
|
|
3647
3751
|
const S = this.validateAndPrepareInputs();
|
|
3648
3752
|
i = S.pointsSet, o = S.minx, r = S.maxx, s = S.miny, a = S.maxy;
|
|
3649
3753
|
}
|
|
3650
|
-
const
|
|
3651
|
-
forw:
|
|
3652
|
-
bakw:
|
|
3653
|
-
},
|
|
3654
|
-
|
|
3754
|
+
const c = {
|
|
3755
|
+
forw: Et(i.forw),
|
|
3756
|
+
bakw: Et(i.bakw)
|
|
3757
|
+
}, f = be(
|
|
3758
|
+
c.forw,
|
|
3655
3759
|
i.edges,
|
|
3656
3760
|
"target"
|
|
3657
|
-
),
|
|
3658
|
-
|
|
3761
|
+
), h = be(
|
|
3762
|
+
c.bakw,
|
|
3659
3763
|
i.edges,
|
|
3660
3764
|
"target"
|
|
3661
3765
|
);
|
|
3662
|
-
if (
|
|
3766
|
+
if (f.features.length === 0 || h.features.length === 0)
|
|
3663
3767
|
throw "TOO LINEAR1";
|
|
3664
|
-
const
|
|
3665
|
-
if (!
|
|
3666
|
-
const p = {},
|
|
3768
|
+
const l = Xi(c.forw), u = mn(c.forw);
|
|
3769
|
+
if (!u) throw "TOO LINEAR2";
|
|
3770
|
+
const p = {}, _ = u.geometry.coordinates[0];
|
|
3667
3771
|
let w;
|
|
3668
3772
|
try {
|
|
3669
|
-
w =
|
|
3773
|
+
w = _.map((S) => ({
|
|
3670
3774
|
forw: S,
|
|
3671
|
-
bakw: ne(
|
|
3775
|
+
bakw: ne(Yt(S), f)
|
|
3672
3776
|
})), w.forEach((S) => {
|
|
3673
3777
|
p[`${S.forw[0]}:${S.forw[1]}`] = S;
|
|
3674
3778
|
});
|
|
3675
3779
|
} catch {
|
|
3676
3780
|
throw "TOO LINEAR2";
|
|
3677
3781
|
}
|
|
3678
|
-
const
|
|
3679
|
-
if (!
|
|
3680
|
-
const
|
|
3782
|
+
const O = mn(c.bakw);
|
|
3783
|
+
if (!O) throw "TOO LINEAR2";
|
|
3784
|
+
const M = O.geometry.coordinates[0];
|
|
3681
3785
|
try {
|
|
3682
|
-
w =
|
|
3786
|
+
w = M.map((S) => ({
|
|
3683
3787
|
bakw: S,
|
|
3684
|
-
forw: ne(
|
|
3788
|
+
forw: ne(Yt(S), h)
|
|
3685
3789
|
})), w.forEach((S) => {
|
|
3686
3790
|
p[`${S.forw[0]}:${S.forw[1]}`] = S;
|
|
3687
3791
|
});
|
|
@@ -3690,43 +3794,43 @@ class ht extends Mt {
|
|
|
3690
3794
|
}
|
|
3691
3795
|
let m;
|
|
3692
3796
|
if (n) {
|
|
3693
|
-
const S =
|
|
3694
|
-
(
|
|
3695
|
-
|
|
3696
|
-
|
|
3797
|
+
const S = l.geometry.coordinates, k = f.features.find(
|
|
3798
|
+
(P) => $e(
|
|
3799
|
+
Yt(S),
|
|
3800
|
+
P
|
|
3697
3801
|
)
|
|
3698
3802
|
);
|
|
3699
|
-
if (
|
|
3700
|
-
const
|
|
3803
|
+
if (k) {
|
|
3804
|
+
const P = k.geometry.coordinates[0], N = k.properties.a.geom, C = k.properties.b.geom, F = k.properties.c.geom;
|
|
3701
3805
|
m = {
|
|
3702
3806
|
forw: [
|
|
3703
|
-
(
|
|
3704
|
-
(
|
|
3807
|
+
(P[0][0] + P[1][0] + P[2][0]) / 3,
|
|
3808
|
+
(P[0][1] + P[1][1] + P[2][1]) / 3
|
|
3705
3809
|
],
|
|
3706
3810
|
bakw: [
|
|
3707
|
-
(
|
|
3708
|
-
(
|
|
3811
|
+
(N[0] + C[0] + F[0]) / 3,
|
|
3812
|
+
(N[1] + C[1] + F[1]) / 3
|
|
3709
3813
|
]
|
|
3710
3814
|
};
|
|
3711
3815
|
} else
|
|
3712
3816
|
m = {
|
|
3713
3817
|
forw: S,
|
|
3714
|
-
bakw: ne(
|
|
3818
|
+
bakw: ne(l, f)
|
|
3715
3819
|
};
|
|
3716
3820
|
} else
|
|
3717
3821
|
m = {
|
|
3718
|
-
forw:
|
|
3719
|
-
bakw: ne(
|
|
3822
|
+
forw: l.geometry.coordinates,
|
|
3823
|
+
bakw: ne(l, f)
|
|
3720
3824
|
};
|
|
3721
|
-
const
|
|
3825
|
+
const v = Me(m.forw, m.bakw, "c");
|
|
3722
3826
|
this.centroid = {
|
|
3723
|
-
forw:
|
|
3724
|
-
bakw: Se(
|
|
3827
|
+
forw: v,
|
|
3828
|
+
bakw: Se(v)
|
|
3725
3829
|
};
|
|
3726
3830
|
const d = [
|
|
3727
3831
|
...this.points.map((S) => ({ forw: S[0], bakw: S[1] })),
|
|
3728
3832
|
...(this.edgeNodes ?? []).map((S) => ({ forw: S[0], bakw: S[1] }))
|
|
3729
|
-
],
|
|
3833
|
+
], b = {
|
|
3730
3834
|
convexBuf: p,
|
|
3731
3835
|
centroid: m,
|
|
3732
3836
|
allGcps: d,
|
|
@@ -3734,35 +3838,37 @@ class ht extends Mt {
|
|
|
3734
3838
|
maxx: r,
|
|
3735
3839
|
miny: s,
|
|
3736
3840
|
maxy: a
|
|
3737
|
-
}, g = this.vertexMode ===
|
|
3841
|
+
}, g = this.vertexMode === lt.VERTEX_BIRDEYE ? Rr(b, n) : Fr(b, n), E = {
|
|
3738
3842
|
forw: [],
|
|
3739
3843
|
bakw: []
|
|
3740
3844
|
};
|
|
3741
3845
|
for (let S = 0; S < g.length; S++) {
|
|
3742
|
-
const
|
|
3743
|
-
i.forw.push(
|
|
3846
|
+
const k = g[S].forw, P = g[S].bakw, N = Me(k, P, `b${S}`), C = Se(N);
|
|
3847
|
+
i.forw.push(N), i.bakw.push(C), E.forw.push(N), E.bakw.push(C);
|
|
3744
3848
|
}
|
|
3745
3849
|
this.pointsSet = {
|
|
3746
|
-
forw:
|
|
3747
|
-
bakw:
|
|
3850
|
+
forw: Et(i.forw),
|
|
3851
|
+
bakw: Et(i.bakw),
|
|
3748
3852
|
edges: i.edges
|
|
3749
3853
|
}, this.tins = {
|
|
3750
|
-
forw:
|
|
3854
|
+
forw: Mn(
|
|
3751
3855
|
be(
|
|
3752
3856
|
this.pointsSet.forw,
|
|
3753
3857
|
i.edges,
|
|
3754
3858
|
"target"
|
|
3755
3859
|
)
|
|
3756
3860
|
)
|
|
3757
|
-
}, (t ===
|
|
3861
|
+
}, (t === lt.MODE_STRICT || t === lt.MODE_AUTO) && this.calculateStrictTin(
|
|
3862
|
+
t === lt.MODE_AUTO ? 1 : Nn
|
|
3863
|
+
), (t === lt.MODE_LOOSE || t === lt.MODE_AUTO && this.strict_status === lt.STATUS_ERROR) && (this.tins.bakw = Mn(
|
|
3758
3864
|
be(
|
|
3759
3865
|
this.pointsSet.bakw,
|
|
3760
3866
|
i.edges,
|
|
3761
3867
|
"target"
|
|
3762
3868
|
)
|
|
3763
|
-
), delete this.kinks, this.strict_status =
|
|
3764
|
-
forw:
|
|
3765
|
-
bakw:
|
|
3869
|
+
), delete this.kinks, this.strict_status = lt.STATUS_LOOSE), this.vertices_params = {
|
|
3870
|
+
forw: $n(E.forw, this.centroid.forw),
|
|
3871
|
+
bakw: $n(E.bakw, this.centroid.bakw)
|
|
3766
3872
|
}, this.addIndexedTin(), this.pointsWeightBuffer = {};
|
|
3767
3873
|
}
|
|
3768
3874
|
/**
|
|
@@ -3773,14 +3879,21 @@ class ht extends Mt {
|
|
|
3773
3879
|
this.updateTin();
|
|
3774
3880
|
}
|
|
3775
3881
|
}
|
|
3882
|
+
function yo(e, t, n) {
|
|
3883
|
+
const i = (o) => Number.isInteger(o) && o >= 0 && o < t;
|
|
3884
|
+
if (!Array.isArray(e) || !i(e[0]) || !i(e[1]))
|
|
3885
|
+
throw new Error(
|
|
3886
|
+
`Invalid edge at edges[${n}]: start/end ${JSON.stringify(e)} must be integer indices of points (0 to ${t - 1})`
|
|
3887
|
+
);
|
|
3888
|
+
}
|
|
3776
3889
|
export {
|
|
3777
|
-
|
|
3890
|
+
lt as Tin,
|
|
3778
3891
|
be as constrainedTin,
|
|
3779
3892
|
Se as counterPoint,
|
|
3780
3893
|
Me as createPoint,
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3894
|
+
lt as default,
|
|
3895
|
+
vo as findIntersections,
|
|
3896
|
+
Rn as format_version,
|
|
3897
|
+
ti as insertSearchIndex,
|
|
3898
|
+
$n as vertexCalc
|
|
3786
3899
|
};
|