@maplat/transform 0.2.3 → 0.4.0

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.
@@ -1,352 +1,505 @@
1
- var ot = Object.defineProperty;
2
- var at = (e, t, s) => t in e ? ot(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
- var _ = (e, t, s) => at(e, typeof t != "symbol" ? t + "" : t, s);
4
- const R = 11102230246251565e-32, I = 134217729, ft = (3 + 8 * R) * R;
5
- function V(e, t, s, r, a) {
6
- let n, c, d, g, l = t[0], y = r[0], o = 0, u = 0;
7
- y > l == y > -l ? (n = l, l = t[++o]) : (n = y, y = r[++u]);
8
- let b = 0;
9
- if (o < e && u < s)
10
- for (y > l == y > -l ? (c = l + n, d = n - (c - l), l = t[++o]) : (c = y + n, d = n - (c - y), y = r[++u]), n = c, d !== 0 && (a[b++] = d); o < e && u < s; )
11
- y > l == y > -l ? (c = n + l, g = c - n, d = n - (c - g) + (l - g), l = t[++o]) : (c = n + y, g = c - n, d = n - (c - g) + (y - g), y = r[++u]), n = c, d !== 0 && (a[b++] = d);
12
- for (; o < e; )
13
- c = n + l, g = c - n, d = n - (c - g) + (l - g), l = t[++o], n = c, d !== 0 && (a[b++] = d);
14
- for (; u < s; )
15
- c = n + y, g = c - n, d = n - (c - g) + (y - g), y = r[++u], n = c, d !== 0 && (a[b++] = d);
16
- return (n !== 0 || b === 0) && (a[b++] = n), b;
17
- }
18
- function ct(e, t) {
19
- let s = t[0];
20
- for (let r = 1; r < e; r++) s += t[r];
21
- return s;
22
- }
23
- function $(e) {
24
- return new Float64Array(e);
25
- }
26
- const ut = (3 + 16 * R) * R, ht = (2 + 12 * R) * R, gt = (9 + 64 * R) * R * R, F = $(4), q = $(8), L = $(12), G = $(16), P = $(4);
27
- function dt(e, t, s, r, a, n, c) {
28
- let d, g, l, y, o, u, b, x, h, f, i, w, A, v, E, m, M, T;
29
- const S = e - a, p = s - a, k = t - n, N = r - n;
30
- v = S * N, u = I * S, b = u - (u - S), x = S - b, u = I * N, h = u - (u - N), f = N - h, E = x * f - (v - b * h - x * h - b * f), m = k * p, u = I * k, b = u - (u - k), x = k - b, u = I * p, h = u - (u - p), f = p - h, M = x * f - (m - b * h - x * h - b * f), i = E - M, o = E - i, F[0] = E - (i + o) + (o - M), w = v + i, o = w - v, A = v - (w - o) + (i - o), i = A - m, o = A - i, F[1] = A - (i + o) + (o - m), T = w + i, o = T - w, F[2] = w - (T - o) + (i - o), F[3] = T;
31
- let U = ct(4, F), X = ht * c;
32
- if (U >= X || -U >= X || (o = e - S, d = e - (S + o) + (o - a), o = s - p, l = s - (p + o) + (o - a), o = t - k, g = t - (k + o) + (o - n), o = r - N, y = r - (N + o) + (o - n), d === 0 && g === 0 && l === 0 && y === 0) || (X = gt * c + ft * Math.abs(U), U += S * y + N * d - (k * l + p * g), U >= X || -U >= X)) return U;
33
- v = d * N, u = I * d, b = u - (u - d), x = d - b, u = I * N, h = u - (u - N), f = N - h, E = x * f - (v - b * h - x * h - b * f), m = g * p, u = I * g, b = u - (u - g), x = g - b, u = I * p, h = u - (u - p), f = p - h, M = x * f - (m - b * h - x * h - b * f), i = E - M, o = E - i, P[0] = E - (i + o) + (o - M), w = v + i, o = w - v, A = v - (w - o) + (i - o), i = A - m, o = A - i, P[1] = A - (i + o) + (o - m), T = w + i, o = T - w, P[2] = w - (T - o) + (i - o), P[3] = T;
34
- const st = V(4, F, 4, P, q);
35
- v = S * y, u = I * S, b = u - (u - S), x = S - b, u = I * y, h = u - (u - y), f = y - h, E = x * f - (v - b * h - x * h - b * f), m = k * l, u = I * k, b = u - (u - k), x = k - b, u = I * l, h = u - (u - l), f = l - h, M = x * f - (m - b * h - x * h - b * f), i = E - M, o = E - i, P[0] = E - (i + o) + (o - M), w = v + i, o = w - v, A = v - (w - o) + (i - o), i = A - m, o = A - i, P[1] = A - (i + o) + (o - m), T = w + i, o = T - w, P[2] = w - (T - o) + (i - o), P[3] = T;
36
- const nt = V(st, q, 4, P, L);
37
- v = d * y, u = I * d, b = u - (u - d), x = d - b, u = I * y, h = u - (u - y), f = y - h, E = x * f - (v - b * h - x * h - b * f), m = g * l, u = I * g, b = u - (u - g), x = g - b, u = I * l, h = u - (u - l), f = l - h, M = x * f - (m - b * h - x * h - b * f), i = E - M, o = E - i, P[0] = E - (i + o) + (o - M), w = v + i, o = w - v, A = v - (w - o) + (i - o), i = A - m, o = A - i, P[1] = A - (i + o) + (o - m), T = w + i, o = T - w, P[2] = w - (T - o) + (i - o), P[3] = T;
38
- const it = V(nt, L, 4, P, G);
39
- return G[it - 1];
40
- }
41
- function lt(e, t, s, r, a, n) {
42
- const c = (t - n) * (s - a), d = (e - a) * (r - n), g = c - d, l = Math.abs(c + d);
43
- return Math.abs(g) >= ut * l ? g : -dt(e, t, s, r, a, n, l);
44
- }
45
- function yt(e, t) {
46
- var s, r, a = 0, n, c, d, g, l, y, o, u = e[0], b = e[1], x = t.length;
47
- for (s = 0; s < x; s++) {
48
- r = 0;
49
- var h = t[s], f = h.length - 1;
50
- if (y = h[0], y[0] !== h[f][0] && y[1] !== h[f][1])
51
- throw new Error("First and last coordinates in a ring must be the same");
52
- for (c = y[0] - u, d = y[1] - b, r; r < f; r++) {
53
- if (o = h[r + 1], g = o[0] - u, l = o[1] - b, d === 0 && l === 0) {
54
- if (g <= 0 && c >= 0 || c <= 0 && g >= 0)
55
- return 0;
56
- } else if (l >= 0 && d <= 0 || l <= 0 && d >= 0) {
57
- if (n = lt(c, g, d, l, 0, 0), n === 0)
58
- return 0;
59
- (n > 0 && l > 0 && d <= 0 || n < 0 && l <= 0 && d > 0) && a++;
60
- }
61
- y = o, d = l, c = g;
62
- }
63
- }
64
- return a % 2 !== 0;
1
+ var at = Object.defineProperty;
2
+ var ct = (t, e, r) => e in t ? at(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
+ var x = (t, e, r) => ct(t, typeof e != "symbol" ? e + "" : e, r);
4
+ function tt(t, e, r = {}) {
5
+ const n = { type: "Feature" };
6
+ return (r.id === 0 || r.id) && (n.id = r.id), r.bbox && (n.bbox = r.bbox), n.properties = e || {}, n.geometry = t, n;
65
7
  }
66
- function Z(e, t, s = {}) {
67
- const r = { type: "Feature" };
68
- return (s.id === 0 || s.id) && (r.id = s.id), s.bbox && (r.bbox = s.bbox), r.properties = t || {}, r.geometry = e, r;
69
- }
70
- function Y(e, t, s = {}) {
71
- if (!e)
8
+ function W(t, e, r = {}) {
9
+ if (!t)
72
10
  throw new Error("coordinates is required");
73
- if (!Array.isArray(e))
11
+ if (!Array.isArray(t))
74
12
  throw new Error("coordinates must be an Array");
75
- if (e.length < 2)
13
+ if (t.length < 2)
76
14
  throw new Error("coordinates must be at least 2 numbers long");
77
- if (!j(e[0]) || !j(e[1]))
15
+ if (!q(t[0]) || !q(t[1]))
78
16
  throw new Error("coordinates must contain numbers");
79
- return Z({
17
+ return tt({
80
18
  type: "Point",
81
- coordinates: e
82
- }, t, s);
19
+ coordinates: t
20
+ }, e, r);
83
21
  }
84
- function tt(e, t, s = {}) {
85
- for (const a of e) {
86
- if (a.length < 4)
22
+ function et(t, e, r = {}) {
23
+ for (const c of t) {
24
+ if (c.length < 4)
87
25
  throw new Error(
88
26
  "Each LinearRing of a Polygon must have 4 or more Positions."
89
27
  );
90
- if (a[a.length - 1].length !== a[0].length)
28
+ if (c[c.length - 1].length !== c[0].length)
91
29
  throw new Error("First and last Position are not equivalent.");
92
- for (let n = 0; n < a[a.length - 1].length; n++)
93
- if (a[a.length - 1][n] !== a[0][n])
30
+ for (let i = 0; i < c[c.length - 1].length; i++)
31
+ if (c[c.length - 1][i] !== c[0][i])
94
32
  throw new Error("First and last Position are not equivalent.");
95
33
  }
96
- return Z({
34
+ return tt({
97
35
  type: "Polygon",
98
- coordinates: e
99
- }, t, s);
36
+ coordinates: t
37
+ }, e, r);
100
38
  }
101
- function B(e, t = {}) {
102
- const s = { type: "FeatureCollection" };
103
- return t.id && (s.id = t.id), t.bbox && (s.bbox = t.bbox), s.features = e, s;
39
+ function F(t, e = {}) {
40
+ const r = { type: "FeatureCollection" };
41
+ return e.id && (r.id = e.id), e.bbox && (r.bbox = e.bbox), r.features = t, r;
104
42
  }
105
- function j(e) {
106
- return !isNaN(e) && e !== null && !Array.isArray(e);
43
+ function q(t) {
44
+ return !isNaN(t) && t !== null && !Array.isArray(t);
107
45
  }
108
- function bt(e) {
109
- if (!e)
46
+ function ut(t) {
47
+ if (!t)
110
48
  throw new Error("coord is required");
111
- if (!Array.isArray(e)) {
112
- if (e.type === "Feature" && e.geometry !== null && e.geometry.type === "Point")
113
- return [...e.geometry.coordinates];
114
- if (e.type === "Point")
115
- return [...e.coordinates];
49
+ if (!Array.isArray(t)) {
50
+ if (t.type === "Feature" && t.geometry !== null && t.geometry.type === "Point")
51
+ return [...t.geometry.coordinates];
52
+ if (t.type === "Point")
53
+ return [...t.coordinates];
116
54
  }
117
- if (Array.isArray(e) && e.length >= 2 && !Array.isArray(e[0]) && !Array.isArray(e[1]))
118
- return [...e];
55
+ if (Array.isArray(t) && t.length >= 2 && !Array.isArray(t[0]) && !Array.isArray(t[1]))
56
+ return [...t];
119
57
  throw new Error("coord must be GeoJSON Point or an Array of numbers");
120
58
  }
121
- function J(e) {
122
- if (Array.isArray(e))
123
- return e;
124
- if (e.type === "Feature") {
125
- if (e.geometry !== null)
126
- return e.geometry.coordinates;
127
- } else if (e.coordinates)
128
- return e.coordinates;
59
+ function z(t) {
60
+ if (Array.isArray(t))
61
+ return t;
62
+ if (t.type === "Feature") {
63
+ if (t.geometry !== null)
64
+ return t.geometry.coordinates;
65
+ } else if (t.coordinates)
66
+ return t.coordinates;
129
67
  throw new Error(
130
68
  "coords must be GeoJSON Feature, Geometry Object or an Array"
131
69
  );
132
70
  }
133
- function wt(e) {
134
- return e.type === "Feature" ? e.geometry : e;
71
+ function ft(t) {
72
+ return t.type === "Feature" ? t.geometry : t;
135
73
  }
136
- function mt(e, t, s = {}) {
137
- if (!e)
138
- throw new Error("point is required");
74
+ const R = 11102230246251565e-32, O = 134217729, dt = (3 + 8 * R) * R;
75
+ function V(t, e, r, n, c) {
76
+ let i, f, g, h, l = e[0], y = n[0], o = 0, u = 0;
77
+ y > l == y > -l ? (i = l, l = e[++o]) : (i = y, y = n[++u]);
78
+ let b = 0;
79
+ if (o < t && u < r)
80
+ for (y > l == y > -l ? (f = l + i, g = i - (f - l), l = e[++o]) : (f = y + i, g = i - (f - y), y = n[++u]), i = f, g !== 0 && (c[b++] = g); o < t && u < r; )
81
+ y > l == y > -l ? (f = i + l, h = f - i, g = i - (f - h) + (l - h), l = e[++o]) : (f = i + y, h = f - i, g = i - (f - h) + (y - h), y = n[++u]), i = f, g !== 0 && (c[b++] = g);
82
+ for (; o < t; )
83
+ f = i + l, h = f - i, g = i - (f - h) + (l - h), l = e[++o], i = f, g !== 0 && (c[b++] = g);
84
+ for (; u < r; )
85
+ f = i + y, h = f - i, g = i - (f - h) + (y - h), y = n[++u], i = f, g !== 0 && (c[b++] = g);
86
+ return (i !== 0 || b === 0) && (c[b++] = i), b;
87
+ }
88
+ function ht(t, e) {
89
+ let r = e[0];
90
+ for (let n = 1; n < t; n++) r += e[n];
91
+ return r;
92
+ }
93
+ function Y(t) {
94
+ return new Float64Array(t);
95
+ }
96
+ const gt = (3 + 16 * R) * R, lt = (2 + 12 * R) * R, yt = (9 + 64 * R) * R * R, U = Y(4), G = Y(8), j = Y(12), J = Y(16), S = Y(4);
97
+ function bt(t, e, r, n, c, i, f) {
98
+ let g, h, l, y, o, u, b, p, d, a, s, m, v, M, _, w, A, P;
99
+ const k = t - c, I = r - c, T = e - i, N = n - i;
100
+ M = k * N, u = O * k, b = u - (u - k), p = k - b, u = O * N, d = u - (u - N), a = N - d, _ = p * a - (M - b * d - p * d - b * a), w = T * I, u = O * T, b = u - (u - T), p = T - b, u = O * I, d = u - (u - I), a = I - d, A = p * a - (w - b * d - p * d - b * a), s = _ - A, o = _ - s, U[0] = _ - (s + o) + (o - A), m = M + s, o = m - M, v = M - (m - o) + (s - o), s = v - w, o = v - s, U[1] = v - (s + o) + (o - w), P = m + s, o = P - m, U[2] = m - (P - o) + (s - o), U[3] = P;
101
+ let C = ht(4, U), X = lt * f;
102
+ if (C >= X || -C >= X || (o = t - k, g = t - (k + o) + (o - c), o = r - I, l = r - (I + o) + (o - c), o = e - T, h = e - (T + o) + (o - i), o = n - N, y = n - (N + o) + (o - i), g === 0 && h === 0 && l === 0 && y === 0) || (X = yt * f + dt * Math.abs(C), C += k * y + N * g - (T * l + I * h), C >= X || -C >= X)) return C;
103
+ M = g * N, u = O * g, b = u - (u - g), p = g - b, u = O * N, d = u - (u - N), a = N - d, _ = p * a - (M - b * d - p * d - b * a), w = h * I, u = O * h, b = u - (u - h), p = h - b, u = O * I, d = u - (u - I), a = I - d, A = p * a - (w - b * d - p * d - b * a), s = _ - A, o = _ - s, S[0] = _ - (s + o) + (o - A), m = M + s, o = m - M, v = M - (m - o) + (s - o), s = v - w, o = v - s, S[1] = v - (s + o) + (o - w), P = m + s, o = P - m, S[2] = m - (P - o) + (s - o), S[3] = P;
104
+ const it = V(4, U, 4, S, G);
105
+ M = k * y, u = O * k, b = u - (u - k), p = k - b, u = O * y, d = u - (u - y), a = y - d, _ = p * a - (M - b * d - p * d - b * a), w = T * l, u = O * T, b = u - (u - T), p = T - b, u = O * l, d = u - (u - l), a = l - d, A = p * a - (w - b * d - p * d - b * a), s = _ - A, o = _ - s, S[0] = _ - (s + o) + (o - A), m = M + s, o = m - M, v = M - (m - o) + (s - o), s = v - w, o = v - s, S[1] = v - (s + o) + (o - w), P = m + s, o = P - m, S[2] = m - (P - o) + (s - o), S[3] = P;
106
+ const st = V(it, G, 4, S, j);
107
+ M = g * y, u = O * g, b = u - (u - g), p = g - b, u = O * y, d = u - (u - y), a = y - d, _ = p * a - (M - b * d - p * d - b * a), w = h * l, u = O * h, b = u - (u - h), p = h - b, u = O * l, d = u - (u - l), a = l - d, A = p * a - (w - b * d - p * d - b * a), s = _ - A, o = _ - s, S[0] = _ - (s + o) + (o - A), m = M + s, o = m - M, v = M - (m - o) + (s - o), s = v - w, o = v - s, S[1] = v - (s + o) + (o - w), P = m + s, o = P - m, S[2] = m - (P - o) + (s - o), S[3] = P;
108
+ const ot = V(st, j, 4, S, J);
109
+ return J[ot - 1];
110
+ }
111
+ function mt(t, e, r, n, c, i) {
112
+ const f = (e - i) * (r - c), g = (t - c) * (n - i), h = f - g, l = Math.abs(f + g);
113
+ return Math.abs(h) >= gt * l ? h : -bt(t, e, r, n, c, i, l);
114
+ }
115
+ function wt(t, e) {
116
+ var r, n, c = 0, i, f, g, h, l, y, o, u = t[0], b = t[1], p = e.length;
117
+ for (r = 0; r < p; r++) {
118
+ n = 0;
119
+ var d = e[r], a = d.length - 1;
120
+ if (y = d[0], y[0] !== d[a][0] && y[1] !== d[a][1])
121
+ throw new Error("First and last coordinates in a ring must be the same");
122
+ for (f = y[0] - u, g = y[1] - b, n; n < a; n++) {
123
+ if (o = d[n + 1], h = o[0] - u, l = o[1] - b, g === 0 && l === 0) {
124
+ if (h <= 0 && f >= 0 || f <= 0 && h >= 0)
125
+ return 0;
126
+ } else if (l >= 0 && g <= 0 || l <= 0 && g >= 0) {
127
+ if (i = mt(f, h, g, l, 0, 0), i === 0)
128
+ return 0;
129
+ (i > 0 && l > 0 && g <= 0 || i < 0 && l <= 0 && g > 0) && c++;
130
+ }
131
+ y = o, g = l, f = h;
132
+ }
133
+ }
134
+ return c % 2 !== 0;
135
+ }
136
+ function L(t, e, r = {}) {
139
137
  if (!t)
138
+ throw new Error("point is required");
139
+ if (!e)
140
140
  throw new Error("polygon is required");
141
- const r = bt(e), a = wt(t), n = a.type, c = t.bbox;
142
- let d = a.coordinates;
143
- if (c && xt(r, c) === !1)
141
+ const n = ut(t), c = ft(e), i = c.type, f = e.bbox;
142
+ let g = c.coordinates;
143
+ if (f && xt(n, f) === !1)
144
144
  return !1;
145
- n === "Polygon" && (d = [d]);
146
- let g = !1;
147
- for (var l = 0; l < d.length; ++l) {
148
- const y = yt(r, d[l]);
149
- if (y === 0) return !s.ignoreBoundary;
150
- y && (g = !0);
145
+ i === "Polygon" && (g = [g]);
146
+ let h = !1;
147
+ for (var l = 0; l < g.length; ++l) {
148
+ const y = wt(n, g[l]);
149
+ if (y === 0) return !r.ignoreBoundary;
150
+ y && (h = !0);
151
+ }
152
+ return h;
153
+ }
154
+ function xt(t, e) {
155
+ return e[0] <= t[0] && e[1] <= t[1] && e[2] >= t[0] && e[3] >= t[1];
156
+ }
157
+ function K(t, e) {
158
+ for (let r = 0; r < e.features.length; r++)
159
+ if (L(t, e.features[r]))
160
+ return e.features[r];
161
+ }
162
+ function rt(t, e, r) {
163
+ const n = e.geometry.coordinates[0][0], c = e.geometry.coordinates[0][1], i = e.geometry.coordinates[0][2], f = t.geometry.coordinates, g = e.properties.a.geom, h = e.properties.b.geom, l = e.properties.c.geom, y = [c[0] - n[0], c[1] - n[1]], o = [i[0] - n[0], i[1] - n[1]], u = [f[0] - n[0], f[1] - n[1]], b = [h[0] - g[0], h[1] - g[1]], p = [l[0] - g[0], l[1] - g[1]];
164
+ let d = (o[1] * u[0] - o[0] * u[1]) / (y[0] * o[1] - y[1] * o[0]), a = (y[0] * u[1] - y[1] * u[0]) / (y[0] * o[1] - y[1] * o[0]);
165
+ if (r) {
166
+ const s = r[e.properties.a.index], m = r[e.properties.b.index], v = r[e.properties.c.index];
167
+ let M;
168
+ if (d < 0 || a < 0 || 1 - d - a < 0) {
169
+ const _ = d / (d + a), w = a / (d + a);
170
+ M = d / m / (_ / m + w / v), a = a / v / (_ / m + w / v);
171
+ } else
172
+ M = d / m / (d / m + a / v + (1 - d - a) / s), a = a / v / (d / m + a / v + (1 - d - a) / s);
173
+ d = M;
174
+ }
175
+ return [
176
+ d * b[0] + a * p[0] + g[0],
177
+ d * b[1] + a * p[1] + g[1]
178
+ ];
179
+ }
180
+ function pt(t, e, r, n) {
181
+ const c = t.geometry.coordinates, i = r.geometry.coordinates, f = Math.atan2(c[0] - i[0], c[1] - i[1]), g = Mt(f, e[0]);
182
+ if (g === void 0)
183
+ throw new Error("Unable to determine vertex index");
184
+ const h = e[1][g];
185
+ return rt(t, h.features[0], n);
186
+ }
187
+ function vt(t, e, r, n, c, i, f, g) {
188
+ let h;
189
+ if (f && (h = K(t, F([f]))), !h) {
190
+ if (r) {
191
+ const l = t.geometry.coordinates, y = r.gridNum, o = r.xOrigin, u = r.yOrigin, b = r.xUnit, p = r.yUnit, d = r.gridCache, a = B(l[0], o, b, y), s = B(l[1], u, p, y), m = d[a] ? d[a][s] ? d[a][s] : [] : [];
192
+ e = F(m.map((v) => e.features[v]));
193
+ }
194
+ h = K(t, e);
151
195
  }
152
- return g;
196
+ return g && g(h), h ? rt(t, h, i) : pt(t, n, c, i);
153
197
  }
154
- function xt(e, t) {
155
- return t[0] <= e[0] && t[1] <= e[1] && t[2] >= e[0] && t[3] >= e[1];
198
+ function B(t, e, r, n) {
199
+ let c = Math.floor((t - e) / r);
200
+ return c >= n && (c = n - 1), c;
156
201
  }
157
- var D = mt;
158
- function Tt(e) {
159
- const t = e.features;
160
- for (let s = 0; s < t.length; s++) {
161
- const r = t[s];
162
- `${r.properties.a.index}`.substring(0, 1) === "b" && `${r.properties.b.index}`.substring(0, 1) === "b" ? t[s] = {
202
+ function Mt(t, e) {
203
+ let r = Q(t - e[0]), n = Math.PI * 2, c;
204
+ for (let i = 0; i < e.length; i++) {
205
+ const f = (i + 1) % e.length, g = Q(t - e[f]), h = Math.min(Math.abs(r), Math.abs(g));
206
+ r * g <= 0 && h < n && (n = h, c = i), r = g;
207
+ }
208
+ return c;
209
+ }
210
+ function Q(t, e = !1) {
211
+ const r = e ? function(n) {
212
+ return !(n >= 0 && n < Math.PI * 2);
213
+ } : function(n) {
214
+ return !(n > -1 * Math.PI && n <= Math.PI);
215
+ };
216
+ for (; r(t); )
217
+ t = t + 2 * Math.PI * (t > 0 ? -1 : 1);
218
+ return t;
219
+ }
220
+ function At(t, e) {
221
+ return e && e >= 2.00703 || Array.isArray(t[0]) ? t : t.map((r) => [
222
+ r.illstNodes,
223
+ r.mercNodes,
224
+ r.startEnd
225
+ ]);
226
+ }
227
+ function Ft(t) {
228
+ const e = t.features;
229
+ for (let r = 0; r < e.length; r++) {
230
+ const n = e[r];
231
+ `${n.properties.a.index}`.substring(0, 1) === "b" && `${n.properties.b.index}`.substring(0, 1) === "b" ? e[r] = {
163
232
  geometry: {
164
233
  type: "Polygon",
165
234
  coordinates: [
166
235
  [
167
- r.geometry.coordinates[0][2],
168
- r.geometry.coordinates[0][0],
169
- r.geometry.coordinates[0][1],
170
- r.geometry.coordinates[0][2]
236
+ n.geometry.coordinates[0][2],
237
+ n.geometry.coordinates[0][0],
238
+ n.geometry.coordinates[0][1],
239
+ n.geometry.coordinates[0][2]
171
240
  ]
172
241
  ]
173
242
  },
174
243
  properties: {
175
244
  a: {
176
- geom: r.properties.c.geom,
177
- index: r.properties.c.index
245
+ geom: n.properties.c.geom,
246
+ index: n.properties.c.index
178
247
  },
179
248
  b: {
180
- geom: r.properties.a.geom,
181
- index: r.properties.a.index
249
+ geom: n.properties.a.geom,
250
+ index: n.properties.a.index
182
251
  },
183
252
  c: {
184
- geom: r.properties.b.geom,
185
- index: r.properties.b.index
253
+ geom: n.properties.b.geom,
254
+ index: n.properties.b.index
186
255
  }
187
256
  },
188
257
  type: "Feature"
189
- } : `${r.properties.c.index}`.substring(0, 1) === "b" && `${r.properties.a.index}`.substring(0, 1) === "b" && (t[s] = {
258
+ } : `${n.properties.c.index}`.substring(0, 1) === "b" && `${n.properties.a.index}`.substring(0, 1) === "b" && (e[r] = {
190
259
  geometry: {
191
260
  type: "Polygon",
192
261
  coordinates: [
193
262
  [
194
- r.geometry.coordinates[0][1],
195
- r.geometry.coordinates[0][2],
196
- r.geometry.coordinates[0][0],
197
- r.geometry.coordinates[0][1]
263
+ n.geometry.coordinates[0][1],
264
+ n.geometry.coordinates[0][2],
265
+ n.geometry.coordinates[0][0],
266
+ n.geometry.coordinates[0][1]
198
267
  ]
199
268
  ]
200
269
  },
201
270
  properties: {
202
271
  a: {
203
- geom: r.properties.b.geom,
204
- index: r.properties.b.index
272
+ geom: n.properties.b.geom,
273
+ index: n.properties.b.index
205
274
  },
206
275
  b: {
207
- geom: r.properties.c.geom,
208
- index: r.properties.c.index
276
+ geom: n.properties.c.geom,
277
+ index: n.properties.c.index
209
278
  },
210
279
  c: {
211
- geom: r.properties.a.geom,
212
- index: r.properties.a.index
280
+ geom: n.properties.a.geom,
281
+ index: n.properties.a.index
213
282
  }
214
283
  },
215
284
  type: "Feature"
216
285
  });
217
286
  }
218
- return e;
287
+ return t;
219
288
  }
220
- function It(e) {
221
- const t = ["a", "b", "c", "a"].map(
222
- (n) => e.properties[n].geom
223
- ), s = e.geometry.coordinates[0], r = e.properties, a = {
224
- a: { geom: s[0], index: r.a.index },
225
- b: { geom: s[1], index: r.b.index },
226
- c: { geom: s[2], index: r.c.index }
289
+ function Xt(t) {
290
+ const e = ["a", "b", "c", "a"].map(
291
+ (i) => t.properties[i].geom
292
+ ), r = t.geometry.coordinates[0], n = t.properties, c = {
293
+ a: { geom: r[0], index: n.a.index },
294
+ b: { geom: r[1], index: n.b.index },
295
+ c: { geom: r[2], index: n.c.index }
227
296
  };
228
- return tt([t], a);
297
+ return et([e], c);
229
298
  }
230
- function _t(e) {
231
- const t = [0, 1, 2, 0].map((r) => e[r][0][0]), s = {
232
- a: { geom: e[0][0][1], index: e[0][1] },
233
- b: { geom: e[1][0][1], index: e[1][1] },
234
- c: { geom: e[2][0][1], index: e[2][1] }
299
+ function _t(t) {
300
+ const e = [0, 1, 2, 0].map((n) => t[n][0][0]), r = {
301
+ a: { geom: t[0][0][1], index: t[0][1] },
302
+ b: { geom: t[1][0][1], index: t[1][1] },
303
+ c: { geom: t[2][0][1], index: t[2][1] }
235
304
  };
236
- return tt([t], s);
237
- }
238
- function W(e, t, s, r, a, n = !1, c) {
239
- const d = e.map(
240
- (g) => {
241
- (!c || c < 2.00703) && (g = et(g));
242
- const l = isFinite(g) ? t[g] : g === "c" ? r : g === "b0" ? a[0] : g === "b1" ? a[1] : g === "b2" ? a[2] : g === "b3" ? a[3] : function() {
243
- const y = g.match(/e(\d+)/);
305
+ return et([e], r);
306
+ }
307
+ function $(t, e, r, n, c, i = !1, f) {
308
+ const g = t.map(
309
+ (h) => {
310
+ (!f || f < 2.00703) && (h = nt(h));
311
+ const l = isFinite(h) ? e[h] : h === "c" ? n : h === "b0" ? c[0] : h === "b1" ? c[1] : h === "b2" ? c[2] : h === "b3" ? c[3] : (function() {
312
+ const y = h.match(/e(\d+)/);
244
313
  if (y) {
245
314
  const o = parseInt(y[1]);
246
- return s[o];
315
+ return r[o];
247
316
  }
248
317
  throw "Bad index value for indexesToTri";
249
- }();
250
- return n ? [[l[1], l[0]], g] : [[l[0], l[1]], g];
318
+ })();
319
+ return i ? [[l[1], l[0]], h] : [[l[0], l[1]], h];
251
320
  }
252
321
  );
253
- return _t(d);
322
+ return _t(g);
254
323
  }
255
- function et(e) {
256
- return typeof e == "number" ? e : e.replace(/^(c|e|b)(?:ent|dgeNode|box)(\d+)?$/, "$1$2");
324
+ function nt(t) {
325
+ return typeof t == "number" ? t : t.replace(/^(c|e|b)(?:ent|dgeNode|box)(\d+)?$/, "$1$2");
257
326
  }
258
- function At(e, t) {
259
- return t && t >= 2.00703 || Array.isArray(e[0]) ? e : e.map((s) => [
260
- s.illstNodes,
261
- s.mercNodes,
262
- s.startEnd
263
- ]);
327
+ const D = 2.00703;
328
+ function Et(t) {
329
+ return !!(t.version || !t.tins && t.points && t.tins_points);
264
330
  }
265
- function z(e, t) {
266
- for (let s = 0; s < t.features.length; s++)
267
- if (D(e, t.features[s]))
268
- return t.features[s];
269
- }
270
- function rt(e, t, s) {
271
- const r = t.geometry.coordinates[0][0], a = t.geometry.coordinates[0][1], n = t.geometry.coordinates[0][2], c = e.geometry.coordinates, d = t.properties.a.geom, g = t.properties.b.geom, l = t.properties.c.geom, y = [a[0] - r[0], a[1] - r[1]], o = [n[0] - r[0], n[1] - r[1]], u = [c[0] - r[0], c[1] - r[1]], b = [g[0] - d[0], g[1] - d[1]], x = [l[0] - d[0], l[1] - d[1]];
272
- let h = (o[1] * u[0] - o[0] * u[1]) / (y[0] * o[1] - y[1] * o[0]), f = (y[0] * u[1] - y[1] * u[0]) / (y[0] * o[1] - y[1] * o[0]);
273
- if (s) {
274
- const i = s[t.properties.a.index], w = s[t.properties.b.index], A = s[t.properties.c.index];
275
- let v;
276
- if (h < 0 || f < 0 || 1 - h - f < 0) {
277
- const E = h / (h + f), m = f / (h + f);
278
- v = h / w / (E / w + m / A), f = f / A / (E / w + m / A);
279
- } else
280
- v = h / w / (h / w + f / A + (1 - h - f) / i), f = f / A / (h / w + f / A + (1 - h - f) / i);
281
- h = v;
282
- }
283
- return [
284
- h * b[0] + f * x[0] + d[0],
285
- h * b[1] + f * x[1] + d[1]
286
- ];
331
+ function Pt(t) {
332
+ return {
333
+ points: t.points,
334
+ pointsWeightBuffer: St(t),
335
+ strictStatus: kt(t),
336
+ verticesParams: It(t),
337
+ centroid: Tt(t),
338
+ edges: At(t.edges || []),
339
+ edgeNodes: t.edgeNodes || [],
340
+ tins: Nt(t),
341
+ kinks: Bt(t.kinks_points),
342
+ yaxisMode: t.yaxisMode ?? "invert",
343
+ strictMode: t.strictMode ?? "auto",
344
+ vertexMode: t.vertexMode,
345
+ bounds: t.bounds,
346
+ boundsPolygon: t.boundsPolygon,
347
+ wh: t.wh,
348
+ xy: t.bounds ? t.xy : [0, 0]
349
+ };
287
350
  }
288
- function vt(e, t, s, r) {
289
- const a = e.geometry.coordinates, n = s.geometry.coordinates, c = Math.atan2(a[0] - n[0], a[1] - n[1]), d = Et(c, t[0]);
290
- if (d === void 0)
291
- throw new Error("Unable to determine vertex index");
292
- const g = t[1][d];
293
- return rt(e, g.features[0], r);
294
- }
295
- function Mt(e, t, s, r, a, n, c, d) {
296
- let g;
297
- if (c && (g = z(e, B([c]))), !g) {
298
- if (s) {
299
- const l = e.geometry.coordinates, y = s.gridNum, o = s.xOrigin, u = s.yOrigin, b = s.xUnit, x = s.yUnit, h = s.gridCache, f = C(l[0], o, b, y), i = C(l[1], u, x, y), w = h[f] ? h[f][i] ? h[f][i] : [] : [];
300
- t = B(w.map((A) => t.features[A]));
301
- }
302
- g = z(e, t);
303
- }
304
- return d && d(g), g ? rt(e, g, n) : vt(e, r, a, n);
351
+ function Ot(t) {
352
+ const e = Ct(t), r = e.tins;
353
+ return {
354
+ compiled: e,
355
+ tins: r,
356
+ points: Rt(r),
357
+ strictStatus: e.strict_status,
358
+ pointsWeightBuffer: e.weight_buffer,
359
+ verticesParams: e.vertices_params,
360
+ centroid: e.centroid,
361
+ kinks: e.kinks
362
+ };
305
363
  }
306
- function C(e, t, s, r) {
307
- let a = Math.floor((e - t) / s);
308
- return a >= r && (a = r - 1), a;
364
+ function St(t) {
365
+ return !t.version || t.version < D ? ["forw", "bakw"].reduce((e, r) => {
366
+ const n = t.weight_buffer[r];
367
+ return n && (e[r] = Object.keys(n).reduce((c, i) => {
368
+ const f = nt(i);
369
+ return c[f] = n[i], c;
370
+ }, {})), e;
371
+ }, {}) : t.weight_buffer;
309
372
  }
310
- function Et(e, t) {
311
- let s = K(e - t[0]), r = Math.PI * 2, a;
312
- for (let n = 0; n < t.length; n++) {
313
- const c = (n + 1) % t.length, d = K(e - t[c]), g = Math.min(Math.abs(s), Math.abs(d));
314
- s * d <= 0 && g < r && (r = g, a = n), s = d;
315
- }
316
- return a;
373
+ function kt(t) {
374
+ return t.strict_status ? t.strict_status : t.kinks_points ? "strict_error" : t.tins_points.length === 2 ? "loose" : "strict";
375
+ }
376
+ function It(t) {
377
+ const e = {
378
+ forw: [t.vertices_params[0]],
379
+ bakw: [t.vertices_params[1]]
380
+ };
381
+ return e.forw[1] = H(t, !1), e.bakw[1] = H(t, !0), e;
317
382
  }
318
- function K(e, t = !1) {
319
- const s = t ? function(r) {
320
- return !(r >= 0 && r < Math.PI * 2);
321
- } : function(r) {
322
- return !(r > -1 * Math.PI && r <= Math.PI);
383
+ function H(t, e) {
384
+ return [0, 1, 2, 3].map((r) => {
385
+ const n = (r + 1) % 4, c = $(
386
+ ["c", `b${r}`, `b${n}`],
387
+ t.points,
388
+ t.edgeNodes || [],
389
+ t.centroid_point,
390
+ t.vertices_points,
391
+ e,
392
+ D
393
+ );
394
+ return F([c]);
395
+ });
396
+ }
397
+ function Tt(t) {
398
+ return {
399
+ forw: W(t.centroid_point[0], {
400
+ target: {
401
+ geom: t.centroid_point[1],
402
+ index: "c"
403
+ }
404
+ }),
405
+ bakw: W(t.centroid_point[1], {
406
+ target: {
407
+ geom: t.centroid_point[0],
408
+ index: "c"
409
+ }
410
+ })
323
411
  };
324
- for (; s(e); )
325
- e = e + 2 * Math.PI * (e > 0 ? -1 : 1);
412
+ }
413
+ function Nt(t) {
414
+ const e = t.tins_points.length === 1 ? 0 : 1;
415
+ return {
416
+ forw: F(
417
+ t.tins_points[0].map(
418
+ (r) => $(
419
+ r,
420
+ t.points,
421
+ t.edgeNodes || [],
422
+ t.centroid_point,
423
+ t.vertices_points,
424
+ !1,
425
+ t.version
426
+ )
427
+ )
428
+ ),
429
+ bakw: F(
430
+ t.tins_points[e].map(
431
+ (r) => $(
432
+ r,
433
+ t.points,
434
+ t.edgeNodes || [],
435
+ t.centroid_point,
436
+ t.vertices_points,
437
+ !0,
438
+ t.version
439
+ )
440
+ )
441
+ )
442
+ };
443
+ }
444
+ function Bt(t) {
445
+ if (t)
446
+ return {
447
+ bakw: F(
448
+ t.map((e) => W(e))
449
+ )
450
+ };
451
+ }
452
+ function Ct(t) {
453
+ return JSON.parse(
454
+ JSON.stringify(t).replace('"cent"', '"c"').replace(/"bbox(\d+)"/g, '"b$1"')
455
+ );
456
+ }
457
+ function Rt(t) {
458
+ const e = [], r = t.forw.features;
459
+ for (let n = 0; n < r.length; n++) {
460
+ const c = r[n];
461
+ ["a", "b", "c"].map((i, f) => {
462
+ const g = c.geometry.coordinates[0][f], h = c.properties[i].geom, l = c.properties[i].index;
463
+ typeof l == "number" && (e[l] = [g, h]);
464
+ });
465
+ }
326
466
  return e;
327
467
  }
328
- const Q = 2.00703, O = class O {
468
+ const Wt = D, E = class E {
329
469
  constructor() {
330
- _(this, "points", []);
331
- _(this, "pointsWeightBuffer");
332
- _(this, "strict_status");
333
- _(this, "vertices_params");
334
- _(this, "centroid");
335
- _(this, "edgeNodes");
336
- _(this, "edges");
337
- _(this, "tins");
338
- _(this, "kinks");
339
- _(this, "yaxisMode", O.YAXIS_INVERT);
340
- _(this, "strictMode", O.MODE_AUTO);
341
- _(this, "vertexMode", O.VERTEX_PLAIN);
342
- _(this, "bounds");
343
- _(this, "boundsPolygon");
344
- _(this, "wh");
345
- _(this, "xy");
346
- _(this, "indexedTins");
347
- _(this, "stateFull", !1);
348
- _(this, "stateTriangle");
349
- _(this, "stateBackward");
470
+ x(this, "points", []);
471
+ x(this, "pointsWeightBuffer");
472
+ x(this, "strict_status");
473
+ x(this, "vertices_params");
474
+ x(this, "centroid");
475
+ x(this, "edgeNodes");
476
+ x(this, "edges");
477
+ x(this, "tins");
478
+ x(this, "kinks");
479
+ x(this, "yaxisMode", E.YAXIS_INVERT);
480
+ x(this, "strictMode", E.MODE_AUTO);
481
+ x(this, "vertexMode", E.VERTEX_PLAIN);
482
+ x(this, "bounds");
483
+ x(this, "boundsPolygon");
484
+ x(this, "wh");
485
+ x(this, "xy");
486
+ x(this, "indexedTins");
487
+ x(this, "stateFull", !1);
488
+ x(this, "stateTriangle");
489
+ x(this, "stateBackward");
490
+ /**
491
+ * Optional properties for MaplatCore extension
492
+ * These properties allow consuming applications to extend Transform instances
493
+ * with additional metadata without requiring Module Augmentation
494
+ */
495
+ /** Layer priority for rendering order */
496
+ x(this, "priority");
497
+ /** Layer importance for display decisions */
498
+ x(this, "importance");
499
+ /** Bounds in XY (source) coordinate system */
500
+ x(this, "xyBounds");
501
+ /** Bounds in Mercator (Web Mercator) coordinate system */
502
+ x(this, "mercBounds");
350
503
  }
351
504
  /**
352
505
  * コンパイルされた設定を適用します
@@ -360,100 +513,18 @@ const Q = 2.00703, O = class O {
360
513
  * 3. TINネットワークの再構築
361
514
  * 4. インデックスの作成
362
515
  */
363
- setCompiled(t) {
364
- if (t.version || !t.tins && t.points && t.tins_points) {
365
- this.points = t.points, this.pointsWeightBuffer = !t.version || t.version < 2.00703 ? ["forw", "bakw"].reduce((r, a) => {
366
- const n = t.weight_buffer[a];
367
- return n && (r[a] = Object.keys(n).reduce((c, d) => {
368
- const g = et(d);
369
- return c[g] = n[d], c;
370
- }, {})), r;
371
- }, {}) : t.weight_buffer, t.strict_status ? this.strict_status = t.strict_status : t.kinks_points ? this.strict_status = O.STATUS_ERROR : t.tins_points.length == 2 ? this.strict_status = O.STATUS_LOOSE : this.strict_status = O.STATUS_STRICT, this.vertices_params = {
372
- forw: [t.vertices_params[0]],
373
- bakw: [t.vertices_params[1]]
374
- }, this.vertices_params.forw[1] = [0, 1, 2, 3].map((r) => {
375
- const a = (r + 1) % 4, n = W(
376
- ["c", `b${r}`, `b${a}`],
377
- t.points,
378
- t.edgeNodes || [],
379
- t.centroid_point,
380
- t.vertices_points,
381
- !1,
382
- Q
383
- );
384
- return B([n]);
385
- }), this.vertices_params.bakw[1] = [0, 1, 2, 3].map((r) => {
386
- const a = (r + 1) % 4, n = W(
387
- ["c", `b${r}`, `b${a}`],
388
- t.points,
389
- t.edgeNodes || [],
390
- t.centroid_point,
391
- t.vertices_points,
392
- !0,
393
- Q
394
- );
395
- return B([n]);
396
- }), this.centroid = {
397
- forw: Y(t.centroid_point[0], {
398
- target: {
399
- geom: t.centroid_point[1],
400
- index: "c"
401
- }
402
- }),
403
- bakw: Y(t.centroid_point[1], {
404
- target: {
405
- geom: t.centroid_point[0],
406
- index: "c"
407
- }
408
- })
409
- }, this.edges = At(t.edges || []), this.edgeNodes = t.edgeNodes || [];
410
- const s = t.tins_points.length == 1 ? 0 : 1;
411
- this.tins = {
412
- forw: B(
413
- t.tins_points[0].map(
414
- (r) => W(
415
- r,
416
- t.points,
417
- t.edgeNodes || [],
418
- t.centroid_point,
419
- t.vertices_points,
420
- !1,
421
- t.version
422
- )
423
- )
424
- ),
425
- bakw: B(
426
- t.tins_points[s].map(
427
- (r) => W(
428
- r,
429
- t.points,
430
- t.edgeNodes || [],
431
- t.centroid_point,
432
- t.vertices_points,
433
- !0,
434
- t.version
435
- )
436
- )
437
- )
438
- }, this.addIndexedTin(), t.kinks_points && (this.kinks = {
439
- bakw: B(
440
- t.kinks_points.map((r) => Y(r))
441
- )
442
- }), t.yaxisMode ? this.yaxisMode = t.yaxisMode : this.yaxisMode = O.YAXIS_INVERT, t.vertexMode && (this.vertexMode = t.vertexMode), t.strictMode && (this.strictMode = t.strictMode), t.bounds ? (this.bounds = t.bounds, this.boundsPolygon = t.boundsPolygon, this.xy = t.xy, this.wh = t.wh) : (this.xy = [0, 0], t.wh && (this.wh = t.wh), this.bounds = void 0, this.boundsPolygon = void 0);
443
- } else {
444
- t = JSON.parse(
445
- JSON.stringify(t).replace('"cent"', '"c"').replace(/"bbox(\d+)"/g, '"b$1"')
446
- ), this.tins = t.tins, this.addIndexedTin(), this.strict_status = t.strict_status, this.pointsWeightBuffer = t.weight_buffer, this.vertices_params = t.vertices_params, this.centroid = t.centroid, this.kinks = t.kinks;
447
- const s = [];
448
- for (let r = 0; r < this.tins.forw.features.length; r++) {
449
- const a = this.tins.forw.features[r];
450
- ["a", "b", "c"].map((n, c) => {
451
- const d = a.geometry.coordinates[0][c], g = a.properties[n].geom, l = a.properties[n].index;
452
- typeof l == "number" && (s[l] = [d, g]);
453
- });
454
- }
455
- this.points = s;
516
+ setCompiled(e) {
517
+ if (Et(e)) {
518
+ this.applyModernState(Pt(e));
519
+ return;
456
520
  }
521
+ this.applyLegacyState(Ot(e));
522
+ }
523
+ applyModernState(e) {
524
+ this.points = e.points, this.pointsWeightBuffer = e.pointsWeightBuffer, this.strict_status = e.strictStatus, this.vertices_params = e.verticesParams, this.centroid = e.centroid, this.edges = e.edges, this.edgeNodes = e.edgeNodes || [], this.tins = e.tins, this.addIndexedTin(), this.kinks = e.kinks, this.yaxisMode = e.yaxisMode ?? E.YAXIS_INVERT, this.vertexMode = e.vertexMode ?? E.VERTEX_PLAIN, this.strictMode = e.strictMode ?? E.MODE_AUTO, e.bounds ? (this.bounds = e.bounds, this.boundsPolygon = e.boundsPolygon, this.xy = e.xy, this.wh = e.wh) : (this.bounds = void 0, this.boundsPolygon = void 0, this.xy = e.xy ?? [0, 0], e.wh && (this.wh = e.wh));
525
+ }
526
+ applyLegacyState(e) {
527
+ this.tins = e.tins, this.addIndexedTin(), this.strict_status = e.strictStatus, this.pointsWeightBuffer = e.pointsWeightBuffer, this.vertices_params = e.verticesParams, this.centroid = e.centroid, this.kinks = e.kinks, this.points = e.points;
457
528
  }
458
529
  /**
459
530
  * TINネットワークのインデックスを作成します
@@ -463,101 +534,101 @@ const Q = 2.00703, O = class O {
463
534
  * 含まれる三角形を記録します。
464
535
  */
465
536
  addIndexedTin() {
466
- const t = this.tins, s = t.forw, r = t.bakw, a = Math.ceil(Math.sqrt(s.features.length));
467
- if (a < 3) {
537
+ const e = this.tins, r = e.forw, n = e.bakw, c = Math.ceil(Math.sqrt(r.features.length));
538
+ if (c < 3) {
468
539
  this.indexedTins = void 0;
469
540
  return;
470
541
  }
471
- let n = [], c = [];
472
- const d = s.features.map((h) => {
473
- let f = [];
474
- return J(h)[0].map((i) => {
475
- n.length === 0 ? n = [Array.from(i), Array.from(i)] : (i[0] < n[0][0] && (n[0][0] = i[0]), i[0] > n[1][0] && (n[1][0] = i[0]), i[1] < n[0][1] && (n[0][1] = i[1]), i[1] > n[1][1] && (n[1][1] = i[1])), f.length === 0 ? f = [Array.from(i), Array.from(i)] : (i[0] < f[0][0] && (f[0][0] = i[0]), i[0] > f[1][0] && (f[1][0] = i[0]), i[1] < f[0][1] && (f[0][1] = i[1]), i[1] > f[1][1] && (f[1][1] = i[1]));
476
- }), f;
477
- }), g = (n[1][0] - n[0][0]) / a, l = (n[1][1] - n[0][1]) / a, y = d.reduce(
478
- (h, f, i) => {
479
- const w = C(
480
- f[0][0],
481
- n[0][0],
482
- g,
483
- a
484
- ), A = C(
485
- f[1][0],
486
- n[0][0],
487
- g,
488
- a
489
- ), v = C(
490
- f[0][1],
491
- n[0][1],
542
+ let i = [], f = [];
543
+ const g = r.features.map((d) => {
544
+ let a = [];
545
+ return z(d)[0].map((s) => {
546
+ i.length === 0 ? i = [Array.from(s), Array.from(s)] : (s[0] < i[0][0] && (i[0][0] = s[0]), s[0] > i[1][0] && (i[1][0] = s[0]), s[1] < i[0][1] && (i[0][1] = s[1]), s[1] > i[1][1] && (i[1][1] = s[1])), a.length === 0 ? a = [Array.from(s), Array.from(s)] : (s[0] < a[0][0] && (a[0][0] = s[0]), s[0] > a[1][0] && (a[1][0] = s[0]), s[1] < a[0][1] && (a[0][1] = s[1]), s[1] > a[1][1] && (a[1][1] = s[1]));
547
+ }), a;
548
+ }), h = (i[1][0] - i[0][0]) / c, l = (i[1][1] - i[0][1]) / c, y = g.reduce(
549
+ (d, a, s) => {
550
+ const m = B(
551
+ a[0][0],
552
+ i[0][0],
553
+ h,
554
+ c
555
+ ), v = B(
556
+ a[1][0],
557
+ i[0][0],
558
+ h,
559
+ c
560
+ ), M = B(
561
+ a[0][1],
562
+ i[0][1],
492
563
  l,
493
- a
494
- ), E = C(
495
- f[1][1],
496
- n[0][1],
564
+ c
565
+ ), _ = B(
566
+ a[1][1],
567
+ i[0][1],
497
568
  l,
498
- a
569
+ c
499
570
  );
500
- for (let m = w; m <= A; m++) {
501
- h[m] || (h[m] = []);
502
- for (let M = v; M <= E; M++)
503
- h[m][M] || (h[m][M] = []), h[m][M].push(i);
571
+ for (let w = m; w <= v; w++) {
572
+ d[w] || (d[w] = []);
573
+ for (let A = M; A <= _; A++)
574
+ d[w][A] || (d[w][A] = []), d[w][A].push(s);
504
575
  }
505
- return h;
576
+ return d;
506
577
  },
507
578
  []
508
- ), o = r.features.map((h) => {
509
- let f = [];
510
- return J(h)[0].map((i) => {
511
- c.length === 0 ? c = [Array.from(i), Array.from(i)] : (i[0] < c[0][0] && (c[0][0] = i[0]), i[0] > c[1][0] && (c[1][0] = i[0]), i[1] < c[0][1] && (c[0][1] = i[1]), i[1] > c[1][1] && (c[1][1] = i[1])), f.length === 0 ? f = [Array.from(i), Array.from(i)] : (i[0] < f[0][0] && (f[0][0] = i[0]), i[0] > f[1][0] && (f[1][0] = i[0]), i[1] < f[0][1] && (f[0][1] = i[1]), i[1] > f[1][1] && (f[1][1] = i[1]));
512
- }), f;
513
- }), u = (c[1][0] - c[0][0]) / a, b = (c[1][1] - c[0][1]) / a, x = o.reduce(
514
- (h, f, i) => {
515
- const w = C(
579
+ ), o = n.features.map((d) => {
580
+ let a = [];
581
+ return z(d)[0].map((s) => {
582
+ f.length === 0 ? f = [Array.from(s), Array.from(s)] : (s[0] < f[0][0] && (f[0][0] = s[0]), s[0] > f[1][0] && (f[1][0] = s[0]), s[1] < f[0][1] && (f[0][1] = s[1]), s[1] > f[1][1] && (f[1][1] = s[1])), a.length === 0 ? a = [Array.from(s), Array.from(s)] : (s[0] < a[0][0] && (a[0][0] = s[0]), s[0] > a[1][0] && (a[1][0] = s[0]), s[1] < a[0][1] && (a[0][1] = s[1]), s[1] > a[1][1] && (a[1][1] = s[1]));
583
+ }), a;
584
+ }), u = (f[1][0] - f[0][0]) / c, b = (f[1][1] - f[0][1]) / c, p = o.reduce(
585
+ (d, a, s) => {
586
+ const m = B(
587
+ a[0][0],
516
588
  f[0][0],
517
- c[0][0],
518
589
  u,
519
- a
520
- ), A = C(
521
- f[1][0],
522
- c[0][0],
590
+ c
591
+ ), v = B(
592
+ a[1][0],
593
+ f[0][0],
523
594
  u,
524
- a
525
- ), v = C(
595
+ c
596
+ ), M = B(
597
+ a[0][1],
526
598
  f[0][1],
527
- c[0][1],
528
599
  b,
529
- a
530
- ), E = C(
531
- f[1][1],
532
- c[0][1],
600
+ c
601
+ ), _ = B(
602
+ a[1][1],
603
+ f[0][1],
533
604
  b,
534
- a
605
+ c
535
606
  );
536
- for (let m = w; m <= A; m++) {
537
- h[m] || (h[m] = []);
538
- for (let M = v; M <= E; M++)
539
- h[m][M] || (h[m][M] = []), h[m][M].push(i);
607
+ for (let w = m; w <= v; w++) {
608
+ d[w] || (d[w] = []);
609
+ for (let A = M; A <= _; A++)
610
+ d[w][A] || (d[w][A] = []), d[w][A].push(s);
540
611
  }
541
- return h;
612
+ return d;
542
613
  },
543
614
  []
544
615
  );
545
616
  this.indexedTins = {
546
617
  forw: {
547
- gridNum: a,
548
- xOrigin: n[0][0],
549
- yOrigin: n[0][1],
550
- xUnit: g,
618
+ gridNum: c,
619
+ xOrigin: i[0][0],
620
+ yOrigin: i[0][1],
621
+ xUnit: h,
551
622
  yUnit: l,
552
623
  gridCache: y
553
624
  },
554
625
  bakw: {
555
- gridNum: a,
556
- xOrigin: c[0][0],
557
- yOrigin: c[0][1],
626
+ gridNum: c,
627
+ xOrigin: f[0][0],
628
+ yOrigin: f[0][1],
558
629
  xUnit: u,
559
630
  yUnit: b,
560
- gridCache: x
631
+ gridCache: p
561
632
  }
562
633
  };
563
634
  }
@@ -571,32 +642,32 @@ const Q = 2.00703, O = class O {
571
642
  *
572
643
  * @throws {Error} 逆方向変換が許可されていない状態での逆変換時
573
644
  */
574
- transform(t, s, r) {
575
- if (s && this.strict_status == O.STATUS_ERROR)
645
+ transform(e, r, n) {
646
+ if (r && this.strict_status == E.STATUS_ERROR)
576
647
  throw 'Backward transform is not allowed if strict_status == "strict_error"';
577
- this.yaxisMode == O.YAXIS_FOLLOW && s && (t = [t[0], -1 * t[1]]);
578
- const a = Y(t);
579
- if (this.bounds && !s && !r && !D(a, this.boundsPolygon))
648
+ this.yaxisMode == E.YAXIS_FOLLOW && r && (e = [e[0], -1 * e[1]]);
649
+ const c = W(e);
650
+ if (this.bounds && !r && !n && !L(c, this.boundsPolygon))
580
651
  return !1;
581
- const n = s ? this.tins.bakw : this.tins.forw, c = s ? this.indexedTins.bakw : this.indexedTins.forw, d = s ? this.vertices_params.bakw : this.vertices_params.forw, g = s ? this.centroid.bakw : this.centroid.forw, l = s ? this.pointsWeightBuffer.bakw : this.pointsWeightBuffer.forw;
652
+ const i = r ? this.tins.bakw : this.tins.forw, f = r ? this.indexedTins.bakw : this.indexedTins.forw, g = r ? this.vertices_params.bakw : this.vertices_params.forw, h = r ? this.centroid.bakw : this.centroid.forw, l = r ? this.pointsWeightBuffer.bakw : this.pointsWeightBuffer.forw;
582
653
  let y, o;
583
- this.stateFull && (this.stateBackward == s ? y = this.stateTriangle : (this.stateBackward = s, this.stateTriangle = void 0), o = (b) => {
654
+ this.stateFull && (this.stateBackward == r ? y = this.stateTriangle : (this.stateBackward = r, this.stateTriangle = void 0), o = (b) => {
584
655
  this.stateTriangle = b;
585
656
  });
586
- let u = Mt(
587
- a,
588
- n,
657
+ let u = vt(
589
658
  c,
590
- d,
659
+ i,
660
+ f,
591
661
  g,
662
+ h,
592
663
  l,
593
664
  y,
594
665
  o
595
666
  );
596
- if (this.bounds && s && !r) {
597
- const b = Y(u);
598
- if (!D(b, this.boundsPolygon)) return !1;
599
- } else this.yaxisMode == O.YAXIS_FOLLOW && !s && (u = [u[0], -1 * u[1]]);
667
+ if (this.bounds && r && !n) {
668
+ const b = W(u);
669
+ if (!L(b, this.boundsPolygon)) return !1;
670
+ } else this.yaxisMode == E.YAXIS_FOLLOW && !r && (u = [u[0], -1 * u[1]]);
600
671
  return u;
601
672
  }
602
673
  };
@@ -604,13 +675,13 @@ const Q = 2.00703, O = class O {
604
675
  * 各種モードの定数定義
605
676
  * すべてreadonlyで、型安全性を確保
606
677
  */
607
- _(O, "VERTEX_PLAIN", "plain"), _(O, "VERTEX_BIRDEYE", "birdeye"), _(O, "MODE_STRICT", "strict"), _(O, "MODE_AUTO", "auto"), _(O, "MODE_LOOSE", "loose"), _(O, "STATUS_STRICT", "strict"), _(O, "STATUS_ERROR", "strict_error"), _(O, "STATUS_LOOSE", "loose"), _(O, "YAXIS_FOLLOW", "follow"), _(O, "YAXIS_INVERT", "invert");
608
- let H = O;
678
+ x(E, "VERTEX_PLAIN", "plain"), x(E, "VERTEX_BIRDEYE", "birdeye"), x(E, "MODE_STRICT", "strict"), x(E, "MODE_AUTO", "auto"), x(E, "MODE_LOOSE", "loose"), x(E, "STATUS_STRICT", "strict"), x(E, "STATUS_ERROR", "strict_error"), x(E, "STATUS_LOOSE", "loose"), x(E, "YAXIS_FOLLOW", "follow"), x(E, "YAXIS_INVERT", "invert");
679
+ let Z = E;
609
680
  export {
610
- H as Transform,
611
- It as counterTri,
612
- Q as format_version,
681
+ Z as Transform,
682
+ Xt as counterTri,
683
+ Wt as format_version,
613
684
  At as normalizeEdges,
614
- Tt as rotateVerticesTriangle,
615
- Mt as transformArr
685
+ Ft as rotateVerticesTriangle,
686
+ vt as transformArr
616
687
  };