@maplat/transform 0.4.1 → 0.5.1

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,234 +1,220 @@
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 = {}) {
1
+ var yt = Object.defineProperty;
2
+ var mt = (r, t, e) => t in r ? yt(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
+ var w = (r, t, e) => mt(r, typeof t != "symbol" ? t + "" : t, e);
4
+ function at(r, t, e = {}) {
5
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;
6
+ return (e.id === 0 || e.id) && (n.id = e.id), e.bbox && (n.bbox = e.bbox), n.properties = t || {}, n.geometry = r, n;
7
7
  }
8
- function W(t, e, r = {}) {
9
- if (!t)
8
+ function W(r, t, e = {}) {
9
+ if (!r)
10
10
  throw new Error("coordinates is required");
11
- if (!Array.isArray(t))
11
+ if (!Array.isArray(r))
12
12
  throw new Error("coordinates must be an Array");
13
- if (t.length < 2)
13
+ if (r.length < 2)
14
14
  throw new Error("coordinates must be at least 2 numbers long");
15
- if (!q(t[0]) || !q(t[1]))
15
+ if (!K(r[0]) || !K(r[1]))
16
16
  throw new Error("coordinates must contain numbers");
17
- return tt({
17
+ return at({
18
18
  type: "Point",
19
- coordinates: t
20
- }, e, r);
19
+ coordinates: r
20
+ }, t, e);
21
21
  }
22
- function et(t, e, r = {}) {
23
- for (const c of t) {
24
- if (c.length < 4)
22
+ function Y(r, t, e = {}) {
23
+ for (const s of r) {
24
+ if (s.length < 4)
25
25
  throw new Error(
26
26
  "Each LinearRing of a Polygon must have 4 or more Positions."
27
27
  );
28
- if (c[c.length - 1].length !== c[0].length)
28
+ if (s[s.length - 1].length !== s[0].length)
29
29
  throw new Error("First and last Position are not equivalent.");
30
- for (let i = 0; i < c[c.length - 1].length; i++)
31
- if (c[c.length - 1][i] !== c[0][i])
30
+ for (let i = 0; i < s[s.length - 1].length; i++)
31
+ if (s[s.length - 1][i] !== s[0][i])
32
32
  throw new Error("First and last Position are not equivalent.");
33
33
  }
34
- return tt({
34
+ return at({
35
35
  type: "Polygon",
36
- coordinates: t
37
- }, e, r);
36
+ coordinates: r
37
+ }, t, e);
38
38
  }
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;
39
+ function F(r, t = {}) {
40
+ const e = { type: "FeatureCollection" };
41
+ return t.id && (e.id = t.id), t.bbox && (e.bbox = t.bbox), e.features = r, e;
42
42
  }
43
- function q(t) {
44
- return !isNaN(t) && t !== null && !Array.isArray(t);
43
+ function K(r) {
44
+ return !isNaN(r) && r !== null && !Array.isArray(r);
45
45
  }
46
- function ut(t) {
47
- if (!t)
46
+ function gt(r) {
47
+ if (!r)
48
48
  throw new Error("coord is required");
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];
54
- }
55
- if (Array.isArray(t) && t.length >= 2 && !Array.isArray(t[0]) && !Array.isArray(t[1]))
56
- return [...t];
49
+ if (!Array.isArray(r)) {
50
+ if (r.type === "Feature" && r.geometry !== null && r.geometry.type === "Point")
51
+ return [...r.geometry.coordinates];
52
+ if (r.type === "Point")
53
+ return [...r.coordinates];
54
+ }
55
+ if (Array.isArray(r) && r.length >= 2 && !Array.isArray(r[0]) && !Array.isArray(r[1]))
56
+ return [...r];
57
57
  throw new Error("coord must be GeoJSON Point or an Array of numbers");
58
58
  }
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;
59
+ function Q(r) {
60
+ if (Array.isArray(r))
61
+ return r;
62
+ if (r.type === "Feature") {
63
+ if (r.geometry !== null)
64
+ return r.geometry.coordinates;
65
+ } else if (r.coordinates)
66
+ return r.coordinates;
67
67
  throw new Error(
68
68
  "coords must be GeoJSON Feature, Geometry Object or an Array"
69
69
  );
70
70
  }
71
- function ft(t) {
72
- return t.type === "Feature" ? t.geometry : t;
73
- }
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;
71
+ function bt(r) {
72
+ return r.type === "Feature" ? r.geometry : r;
73
+ }
74
+ const X = 11102230246251565e-32, I = 134217729, xt = (3 + 8 * X) * X;
75
+ function q(r, t, e, n, s) {
76
+ let i, o, u, d, f = t[0], m = n[0], a = 0, l = 0;
77
+ m > f == m > -f ? (i = f, f = t[++a]) : (i = m, m = n[++l]);
78
+ let g = 0;
79
+ if (a < r && l < e)
80
+ for (m > f == m > -f ? (o = f + i, u = i - (o - f), f = t[++a]) : (o = m + i, u = i - (o - m), m = n[++l]), i = o, u !== 0 && (s[g++] = u); a < r && l < e; )
81
+ m > f == m > -f ? (o = i + f, d = o - i, u = i - (o - d) + (f - d), f = t[++a]) : (o = i + m, d = o - i, u = i - (o - d) + (m - d), m = n[++l]), i = o, u !== 0 && (s[g++] = u);
82
+ for (; a < r; )
83
+ o = i + f, d = o - i, u = i - (o - d) + (f - d), f = t[++a], i = o, u !== 0 && (s[g++] = u);
84
+ for (; l < e; )
85
+ o = i + m, d = o - i, u = i - (o - d) + (m - d), m = n[++l], i = o, u !== 0 && (s[g++] = u);
86
+ return (i !== 0 || g === 0) && (s[g++] = i), g;
87
+ }
88
+ function pt(r, t) {
89
+ let e = t[0];
90
+ for (let n = 1; n < r; n++) e += t[n];
91
+ return e;
92
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++) {
93
+ function D(r) {
94
+ return new Float64Array(r);
95
+ }
96
+ const wt = (3 + 16 * X) * X, Mt = (2 + 12 * X) * X, _t = (9 + 64 * X) * X * X, L = D(4), H = D(8), tt = D(12), rt = D(16), S = D(4);
97
+ function vt(r, t, e, n, s, i, o) {
98
+ let u, d, f, m, a, l, g, b, y, h, c, x, M, _, T, p, v, A;
99
+ const B = r - s, C = e - s, P = t - i, O = n - i;
100
+ _ = B * O, l = I * B, g = l - (l - B), b = B - g, l = I * O, y = l - (l - O), h = O - y, T = b * h - (_ - g * y - b * y - g * h), p = P * C, l = I * P, g = l - (l - P), b = P - g, l = I * C, y = l - (l - C), h = C - y, v = b * h - (p - g * y - b * y - g * h), c = T - v, a = T - c, L[0] = T - (c + a) + (a - v), x = _ + c, a = x - _, M = _ - (x - a) + (c - a), c = M - p, a = M - c, L[1] = M - (c + a) + (a - p), A = x + c, a = A - x, L[2] = x - (A - a) + (c - a), L[3] = A;
101
+ let N = pt(4, L), V = Mt * o;
102
+ if (N >= V || -N >= V || (a = r - B, u = r - (B + a) + (a - s), a = e - C, f = e - (C + a) + (a - s), a = t - P, d = t - (P + a) + (a - i), a = n - O, m = n - (O + a) + (a - i), u === 0 && d === 0 && f === 0 && m === 0) || (V = _t * o + xt * Math.abs(N), N += B * m + O * u - (P * f + C * d), N >= V || -N >= V)) return N;
103
+ _ = u * O, l = I * u, g = l - (l - u), b = u - g, l = I * O, y = l - (l - O), h = O - y, T = b * h - (_ - g * y - b * y - g * h), p = d * C, l = I * d, g = l - (l - d), b = d - g, l = I * C, y = l - (l - C), h = C - y, v = b * h - (p - g * y - b * y - g * h), c = T - v, a = T - c, S[0] = T - (c + a) + (a - v), x = _ + c, a = x - _, M = _ - (x - a) + (c - a), c = M - p, a = M - c, S[1] = M - (c + a) + (a - p), A = x + c, a = A - x, S[2] = x - (A - a) + (c - a), S[3] = A;
104
+ const ht = q(4, L, 4, S, H);
105
+ _ = B * m, l = I * B, g = l - (l - B), b = B - g, l = I * m, y = l - (l - m), h = m - y, T = b * h - (_ - g * y - b * y - g * h), p = P * f, l = I * P, g = l - (l - P), b = P - g, l = I * f, y = l - (l - f), h = f - y, v = b * h - (p - g * y - b * y - g * h), c = T - v, a = T - c, S[0] = T - (c + a) + (a - v), x = _ + c, a = x - _, M = _ - (x - a) + (c - a), c = M - p, a = M - c, S[1] = M - (c + a) + (a - p), A = x + c, a = A - x, S[2] = x - (A - a) + (c - a), S[3] = A;
106
+ const lt = q(ht, H, 4, S, tt);
107
+ _ = u * m, l = I * u, g = l - (l - u), b = u - g, l = I * m, y = l - (l - m), h = m - y, T = b * h - (_ - g * y - b * y - g * h), p = d * f, l = I * d, g = l - (l - d), b = d - g, l = I * f, y = l - (l - f), h = f - y, v = b * h - (p - g * y - b * y - g * h), c = T - v, a = T - c, S[0] = T - (c + a) + (a - v), x = _ + c, a = x - _, M = _ - (x - a) + (c - a), c = M - p, a = M - c, S[1] = M - (c + a) + (a - p), A = x + c, a = A - x, S[2] = x - (A - a) + (c - a), S[3] = A;
108
+ const dt = q(lt, tt, 4, S, rt);
109
+ return rt[dt - 1];
110
+ }
111
+ function Tt(r, t, e, n, s, i) {
112
+ const o = (t - i) * (e - s), u = (r - s) * (n - i), d = o - u, f = Math.abs(o + u);
113
+ return Math.abs(d) >= wt * f ? d : -vt(r, t, e, n, s, i, f);
114
+ }
115
+ function Et(r, t) {
116
+ var e, n, s = 0, i, o, u, d, f, m, a, l = r[0], g = r[1], b = t.length;
117
+ for (e = 0; e < b; e++) {
118
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])
119
+ var y = t[e], h = y.length - 1;
120
+ if (m = y[0], m[0] !== y[h][0] && m[1] !== y[h][1])
121
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)
122
+ for (o = m[0] - l, u = m[1] - g, n; n < h; n++) {
123
+ if (a = y[n + 1], d = a[0] - l, f = a[1] - g, u === 0 && f === 0) {
124
+ if (d <= 0 && o >= 0 || o <= 0 && d >= 0)
125
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)
126
+ } else if (f >= 0 && u <= 0 || f <= 0 && u >= 0) {
127
+ if (i = Tt(o, d, u, f, 0, 0), i === 0)
128
128
  return 0;
129
- (i > 0 && l > 0 && g <= 0 || i < 0 && l <= 0 && g > 0) && c++;
129
+ (i > 0 && f > 0 && u <= 0 || i < 0 && f <= 0 && u > 0) && s++;
130
130
  }
131
- y = o, g = l, f = h;
131
+ m = a, u = f, o = d;
132
132
  }
133
133
  }
134
- return c % 2 !== 0;
134
+ return s % 2 !== 0;
135
135
  }
136
- function L(t, e, r = {}) {
137
- if (!t)
136
+ function U(r, t, e = {}) {
137
+ if (!r)
138
138
  throw new Error("point is required");
139
- if (!e)
139
+ if (!t)
140
140
  throw new Error("polygon is required");
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)
141
+ const n = gt(r), s = bt(t), i = s.type, o = t.bbox;
142
+ let u = s.coordinates;
143
+ if (o && At(n, o) === !1)
144
144
  return !1;
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);
145
+ i === "Polygon" && (u = [u]);
146
+ let d = !1;
147
+ for (var f = 0; f < u.length; ++f) {
148
+ const m = Et(n, u[f]);
149
+ if (m === 0) return !e.ignoreBoundary;
150
+ m && (d = !0);
151
+ }
152
+ return d;
153
+ }
154
+ function At(r, t) {
155
+ return t[0] <= r[0] && t[1] <= r[1] && t[2] >= r[0] && t[3] >= r[1];
156
+ }
157
+ function z(r, t) {
158
+ for (let e = 0; e < t.features.length; e++)
159
+ if (U(r, t.features[e]))
160
+ return t.features[e];
161
+ }
162
+ function ct(r, t, e) {
163
+ const n = t.geometry.coordinates[0][0], s = t.geometry.coordinates[0][1], i = t.geometry.coordinates[0][2], o = r.geometry.coordinates, u = t.properties.a.geom, d = t.properties.b.geom, f = t.properties.c.geom, m = [s[0] - n[0], s[1] - n[1]], a = [i[0] - n[0], i[1] - n[1]], l = [o[0] - n[0], o[1] - n[1]], g = [d[0] - u[0], d[1] - u[1]], b = [f[0] - u[0], f[1] - u[1]];
164
+ let y = (a[1] * l[0] - a[0] * l[1]) / (m[0] * a[1] - m[1] * a[0]), h = (m[0] * l[1] - m[1] * l[0]) / (m[0] * a[1] - m[1] * a[0]);
165
+ if (e) {
166
+ const c = e[t.properties.a.index], x = e[t.properties.b.index], M = e[t.properties.c.index];
167
+ let _;
168
+ if (y < 0 || h < 0 || 1 - y - h < 0) {
169
+ const T = y / (y + h), p = h / (y + h);
170
+ _ = y / x / (T / x + p / M), h = h / M / (T / x + p / M);
171
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;
172
+ _ = y / x / (y / x + h / M + (1 - y - h) / c), h = h / M / (y / x + h / M + (1 - y - h) / c);
173
+ y = _;
174
174
  }
175
175
  return [
176
- d * b[0] + a * p[0] + g[0],
177
- d * b[1] + a * p[1] + g[1]
176
+ y * g[0] + h * b[0] + u[0],
177
+ y * g[1] + h * b[1] + u[1]
178
178
  ];
179
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)
180
+ function It(r, t, e, n) {
181
+ const s = r.geometry.coordinates, i = e.geometry.coordinates, o = Math.atan2(s[0] - i[0], s[1] - i[1]), u = Bt(o, t[0]);
182
+ if (u === void 0)
183
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);
184
+ const d = t[1][u];
185
+ return ct(r, d.features[0], n);
186
+ }
187
+ function St(r, t, e, n, s, i, o, u) {
188
+ let d;
189
+ if (o && (d = z(r, F([o]))), !d)
190
+ if (e) {
191
+ const f = r.geometry.coordinates, m = e.gridNum, a = e.xOrigin, l = e.yOrigin, g = e.xUnit, b = e.yUnit, y = e.gridCache, h = R(f[0], a, g, m), c = R(f[1], l, b, m), x = y[h] ? y[h][c] ? y[h][c] : [] : [], M = F(x.map((_) => t.features[_]));
192
+ d = z(r, M);
193
+ } else
194
+ d = z(r, t);
195
+ return u && u(d), d ? ct(r, d, i) : It(r, n, s, i);
196
+ }
197
+ function R(r, t, e, n) {
198
+ let s = Math.floor((r - t) / e);
199
+ return s < 0 && (s = 0), s >= n && (s = n - 1), s;
200
+ }
201
+ function Bt(r, t) {
202
+ let e = et(r - t[0]), n = Math.PI * 2, s;
203
+ for (let i = 0; i < t.length; i++) {
204
+ const o = (i + 1) % t.length, u = et(r - t[o]), d = Math.min(Math.abs(e), Math.abs(u));
205
+ e * u <= 0 && d < n && (n = d, s = i), e = u;
195
206
  }
196
- return g && g(h), h ? rt(t, h, i) : pt(t, n, c, i);
207
+ return s;
197
208
  }
198
- function B(t, e, r, n) {
199
- let c = Math.floor((t - e) / r);
200
- return c >= n && (c = n - 1), c;
209
+ function et(r, t = !1) {
210
+ const e = 2 * Math.PI, n = r - Math.floor(r / e) * e;
211
+ return t ? n : n > Math.PI ? n - e : n;
201
212
  }
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] = {
213
+ function zt(r) {
214
+ const t = r.features;
215
+ for (let e = 0; e < t.length; e++) {
216
+ const n = t[e];
217
+ `${n.properties.a.index}`.substring(0, 1) === "b" && `${n.properties.b.index}`.substring(0, 1) === "b" ? t[e] = {
232
218
  geometry: {
233
219
  type: "Polygon",
234
220
  coordinates: [
@@ -255,7 +241,7 @@ function Ft(t) {
255
241
  }
256
242
  },
257
243
  type: "Feature"
258
- } : `${n.properties.c.index}`.substring(0, 1) === "b" && `${n.properties.a.index}`.substring(0, 1) === "b" && (e[r] = {
244
+ } : `${n.properties.c.index}`.substring(0, 1) === "b" && `${n.properties.a.index}`.substring(0, 1) === "b" && (t[e] = {
259
245
  geometry: {
260
246
  type: "Polygon",
261
247
  coordinates: [
@@ -284,404 +270,715 @@ function Ft(t) {
284
270
  type: "Feature"
285
271
  });
286
272
  }
287
- return t;
273
+ return r;
288
274
  }
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 }
275
+ function Gt(r) {
276
+ const t = ["a", "b", "c", "a"].map(
277
+ (i) => r.properties[i].geom
278
+ ), e = r.geometry.coordinates[0], n = r.properties, s = {
279
+ a: { geom: e[0], index: n.a.index },
280
+ b: { geom: e[1], index: n.b.index },
281
+ c: { geom: e[2], index: n.c.index }
296
282
  };
297
- return et([e], c);
283
+ return Y([t], s);
298
284
  }
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] }
285
+ function Ct(r) {
286
+ const t = [0, 1, 2, 0].map((n) => r[n][0][0]), e = {
287
+ a: { geom: r[0][0][1], index: r[0][1] },
288
+ b: { geom: r[1][0][1], index: r[1][1] },
289
+ c: { geom: r[2][0][1], index: r[2][1] }
304
290
  };
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+)/);
313
- if (y) {
314
- const o = parseInt(y[1]);
315
- return r[o];
316
- }
317
- throw "Bad index value for indexesToTri";
291
+ return Y([t], e);
292
+ }
293
+ function j(r, t, e, n, s, i = !1, o) {
294
+ const u = r.map(
295
+ (d) => {
296
+ (!o || o < 2.00703) && (d = ut(d));
297
+ const f = isFinite(d) ? t[d] : d === "c" ? n : (function() {
298
+ const m = d.match(/^b(\d+)$/);
299
+ if (m) return s[parseInt(m[1])];
300
+ const a = d.match(/^e(\d+)$/);
301
+ if (a) return e[parseInt(a[1])];
302
+ throw new Error("Bad index value for indexesToTri");
318
303
  })();
319
- return i ? [[l[1], l[0]], h] : [[l[0], l[1]], h];
304
+ return i ? [[f[1], f[0]], d] : [[f[0], f[1]], d];
320
305
  }
321
306
  );
322
- return _t(g);
307
+ return Ct(u);
308
+ }
309
+ function ut(r) {
310
+ return typeof r == "number" ? r : r.replace(/^(c|e|b)(?:ent|dgeNode|box)(\d+)?$/, "$1$2");
323
311
  }
324
- function nt(t) {
325
- return typeof t == "number" ? t : t.replace(/^(c|e|b)(?:ent|dgeNode|box)(\d+)?$/, "$1$2");
312
+ function Pt(r, t) {
313
+ return t && t >= 2.00703 || Array.isArray(r[0]) ? r : r.map((e) => [
314
+ e.illstNodes,
315
+ e.mercNodes,
316
+ e.startEnd
317
+ ]);
326
318
  }
327
- const D = 2.00703;
328
- function Et(t) {
329
- return !!(t.version || !t.tins && t.points && t.tins_points);
319
+ const J = 2.00703;
320
+ function Ot(r) {
321
+ return !!(r.version !== void 0 || !r.tins && r.points && r.tins_points);
330
322
  }
331
- function Pt(t) {
323
+ function Rt(r) {
332
324
  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]
325
+ points: r.points,
326
+ pointsWeightBuffer: Nt(r),
327
+ strictStatus: Xt(r),
328
+ verticesParams: Wt(r),
329
+ centroid: Lt(r),
330
+ edges: Pt(r.edges || []),
331
+ edgeNodes: r.edgeNodes || [],
332
+ tins: Ut(r),
333
+ kinks: Ft(r.kinks_points),
334
+ yaxisMode: r.yaxisMode ?? "invert",
335
+ strictMode: r.strictMode ?? "auto",
336
+ vertexMode: r.vertexMode,
337
+ bounds: r.bounds,
338
+ boundsPolygon: r.boundsPolygon,
339
+ wh: r.wh,
340
+ xy: r.xy ?? [0, 0]
349
341
  };
350
342
  }
351
- function Ot(t) {
352
- const e = Ct(t), r = e.tins;
343
+ function kt(r) {
344
+ const t = Vt(r), e = t.tins;
353
345
  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
346
+ compiled: t,
347
+ tins: e,
348
+ points: Dt(e),
349
+ strictStatus: t.strict_status,
350
+ pointsWeightBuffer: t.weight_buffer,
351
+ verticesParams: t.vertices_params,
352
+ centroid: t.centroid,
353
+ kinks: t.kinks
362
354
  };
363
355
  }
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;
372
- }
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]]
356
+ function Nt(r) {
357
+ return !r.version || r.version < J ? ["forw", "bakw"].reduce((t, e) => {
358
+ const n = r.weight_buffer[e];
359
+ return n && (t[e] = Object.keys(n).reduce((s, i) => {
360
+ const o = ut(i);
361
+ return s[o] = n[i], s;
362
+ }, {})), t;
363
+ }, {}) : r.weight_buffer;
364
+ }
365
+ function Xt(r) {
366
+ return r.strict_status ? r.strict_status : r.kinks_points ? "strict_error" : r.tins_points.length === 2 ? "loose" : "strict";
367
+ }
368
+ function Wt(r) {
369
+ const t = {
370
+ forw: [r.vertices_params[0]],
371
+ bakw: [r.vertices_params[1]]
380
372
  };
381
- return e.forw[1] = H(t, !1), e.bakw[1] = H(t, !0), e;
382
- }
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
373
+ return t.forw[1] = nt(r, !1), t.bakw[1] = nt(r, !0), t;
374
+ }
375
+ function nt(r, t) {
376
+ const e = r.vertices_points.length;
377
+ return Array.from({ length: e }, (n, s) => {
378
+ const i = (s + 1) % e, o = j(
379
+ ["c", `b${s}`, `b${i}`],
380
+ r.points,
381
+ r.edgeNodes || [],
382
+ r.centroid_point,
383
+ r.vertices_points,
384
+ t,
385
+ J
393
386
  );
394
- return F([c]);
387
+ return F([o]);
395
388
  });
396
389
  }
397
- function Tt(t) {
390
+ function Lt(r) {
398
391
  return {
399
- forw: W(t.centroid_point[0], {
392
+ forw: W(r.centroid_point[0], {
400
393
  target: {
401
- geom: t.centroid_point[1],
394
+ geom: r.centroid_point[1],
402
395
  index: "c"
403
396
  }
404
397
  }),
405
- bakw: W(t.centroid_point[1], {
398
+ bakw: W(r.centroid_point[1], {
406
399
  target: {
407
- geom: t.centroid_point[0],
400
+ geom: r.centroid_point[0],
408
401
  index: "c"
409
402
  }
410
403
  })
411
404
  };
412
405
  }
413
- function Nt(t) {
414
- const e = t.tins_points.length === 1 ? 0 : 1;
406
+ function Ut(r) {
407
+ const t = r.tins_points.length === 1 ? 0 : 1;
415
408
  return {
416
409
  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,
410
+ r.tins_points[0].map(
411
+ (e) => j(
412
+ e,
413
+ r.points,
414
+ r.edgeNodes || [],
415
+ r.centroid_point,
416
+ r.vertices_points,
424
417
  !1,
425
- t.version
418
+ r.version
426
419
  )
427
420
  )
428
421
  ),
429
422
  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,
423
+ r.tins_points[t].map(
424
+ (e) => j(
425
+ e,
426
+ r.points,
427
+ r.edgeNodes || [],
428
+ r.centroid_point,
429
+ r.vertices_points,
437
430
  !0,
438
- t.version
431
+ r.version
439
432
  )
440
433
  )
441
434
  )
442
435
  };
443
436
  }
444
- function Bt(t) {
445
- if (t)
437
+ function Ft(r) {
438
+ if (r)
446
439
  return {
447
440
  bakw: F(
448
- t.map((e) => W(e))
441
+ r.map((t) => W(t))
449
442
  )
450
443
  };
451
444
  }
452
- function Ct(t) {
445
+ function Vt(r) {
453
446
  return JSON.parse(
454
- JSON.stringify(t).replace('"cent"', '"c"').replace(/"bbox(\d+)"/g, '"b$1"')
447
+ JSON.stringify(r).replace('"cent"', '"c"').replace(/"bbox(\d+)"/g, '"b$1"')
455
448
  );
456
449
  }
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]);
450
+ function Dt(r) {
451
+ const t = [], e = r.forw.features;
452
+ for (let n = 0; n < e.length; n++) {
453
+ const s = e[n];
454
+ ["a", "b", "c"].forEach((i, o) => {
455
+ const u = s.geometry.coordinates[0][o], d = s.properties[i].geom, f = s.properties[i].index;
456
+ typeof f == "number" && (t[f] = [u, d]);
464
457
  });
465
458
  }
466
- return e;
459
+ return t;
467
460
  }
468
- const Wt = D, E = class E {
461
+ const Zt = J, E = class E {
469
462
  constructor() {
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");
463
+ w(this, "points", []);
464
+ w(this, "pointsWeightBuffer");
465
+ w(this, "strict_status");
466
+ w(this, "vertices_params");
467
+ w(this, "centroid");
468
+ w(this, "edgeNodes");
469
+ w(this, "edges");
470
+ w(this, "tins");
471
+ w(this, "kinks");
472
+ w(this, "yaxisMode", E.YAXIS_INVERT);
473
+ w(this, "strictMode", E.MODE_AUTO);
474
+ w(this, "vertexMode", E.VERTEX_PLAIN);
475
+ w(this, "bounds");
476
+ w(this, "boundsPolygon");
477
+ w(this, "wh");
478
+ w(this, "xy");
479
+ w(this, "indexedTins");
480
+ w(this, "stateFull", !1);
481
+ w(this, "stateTriangle");
482
+ w(this, "stateBackward");
490
483
  /**
491
484
  * Optional properties for MaplatCore extension
492
485
  * These properties allow consuming applications to extend Transform instances
493
486
  * with additional metadata without requiring Module Augmentation
494
487
  */
495
488
  /** Layer priority for rendering order */
496
- x(this, "priority");
489
+ w(this, "priority");
497
490
  /** Layer importance for display decisions */
498
- x(this, "importance");
491
+ w(this, "importance");
499
492
  /** Bounds in XY (source) coordinate system */
500
- x(this, "xyBounds");
493
+ w(this, "xyBounds");
501
494
  /** Bounds in Mercator (Web Mercator) coordinate system */
502
- x(this, "mercBounds");
495
+ w(this, "mercBounds");
503
496
  }
504
497
  /**
505
498
  * コンパイルされた設定を適用します
506
- *
499
+ *
507
500
  * @param compiled - コンパイルされた設定オブジェクト
508
501
  * @returns 変換に必要な主要なオブジェクトのセット
509
- *
502
+ *
510
503
  * 以下の処理を行います:
511
504
  * 1. バージョンに応じた設定の解釈
512
505
  * 2. 各種パラメータの復元
513
506
  * 3. TINネットワークの再構築
514
507
  * 4. インデックスの作成
515
508
  */
516
- setCompiled(e) {
517
- if (Et(e)) {
518
- this.applyModernState(Pt(e));
509
+ setCompiled(t) {
510
+ if (Ot(t)) {
511
+ this.applyModernState(Rt(t));
519
512
  return;
520
513
  }
521
- this.applyLegacyState(Ot(e));
514
+ this.applyLegacyState(kt(t));
522
515
  }
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));
516
+ applyModernState(t) {
517
+ this.points = t.points, this.pointsWeightBuffer = t.pointsWeightBuffer, 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 ?? E.YAXIS_INVERT, this.vertexMode = t.vertexMode ?? E.VERTEX_PLAIN, this.strictMode = t.strictMode ?? E.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));
525
518
  }
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;
519
+ applyLegacyState(t) {
520
+ this.tins = t.tins, this.addIndexedTin(), this.strict_status = t.strictStatus, this.pointsWeightBuffer = t.pointsWeightBuffer, this.vertices_params = t.verticesParams, this.centroid = t.centroid, this.kinks = t.kinks, this.points = t.points;
528
521
  }
529
522
  /**
530
523
  * TINネットワークのインデックスを作成します
531
- *
524
+ *
532
525
  * インデックスは変換処理を高速化するために使用されます。
533
526
  * グリッド形式のインデックスを作成し、各グリッドに
534
527
  * 含まれる三角形を記録します。
535
528
  */
536
529
  addIndexedTin() {
537
- const e = this.tins, r = e.forw, n = e.bakw, c = Math.ceil(Math.sqrt(r.features.length));
538
- if (c < 3) {
530
+ const t = this.tins, e = t.forw, n = t.bakw, s = Math.ceil(Math.sqrt(e.features.length));
531
+ if (s < 3) {
539
532
  this.indexedTins = void 0;
540
533
  return;
541
534
  }
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],
563
- l,
564
- c
565
- ), _ = B(
566
- a[1][1],
567
- i[0][1],
568
- l,
569
- c
570
- );
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);
535
+ let i = [], o = [];
536
+ const u = e.features.map((y) => {
537
+ let h = [];
538
+ return Q(y)[0].map((c) => {
539
+ i.length === 0 ? i = [Array.from(c), Array.from(c)] : (c[0] < i[0][0] && (i[0][0] = c[0]), c[0] > i[1][0] && (i[1][0] = c[0]), c[1] < i[0][1] && (i[0][1] = c[1]), c[1] > i[1][1] && (i[1][1] = c[1])), h.length === 0 ? h = [Array.from(c), Array.from(c)] : (c[0] < h[0][0] && (h[0][0] = c[0]), c[0] > h[1][0] && (h[1][0] = c[0]), c[1] < h[0][1] && (h[0][1] = c[1]), c[1] > h[1][1] && (h[1][1] = c[1]));
540
+ }), h;
541
+ }), d = (i[1][0] - i[0][0]) / s, f = (i[1][1] - i[0][1]) / s, m = u.reduce(
542
+ (y, h, c) => {
543
+ const x = R(h[0][0], i[0][0], d, s), M = R(h[1][0], i[0][0], d, s), _ = R(h[0][1], i[0][1], f, s), T = R(h[1][1], i[0][1], f, s);
544
+ for (let p = x; p <= M; p++) {
545
+ y[p] || (y[p] = []);
546
+ for (let v = _; v <= T; v++)
547
+ y[p][v] || (y[p][v] = []), y[p][v].push(c);
575
548
  }
576
- return d;
549
+ return y;
577
550
  },
578
551
  []
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],
588
- f[0][0],
589
- u,
590
- c
591
- ), v = B(
592
- a[1][0],
593
- f[0][0],
594
- u,
595
- c
596
- ), M = B(
597
- a[0][1],
598
- f[0][1],
599
- b,
600
- c
601
- ), _ = B(
602
- a[1][1],
603
- f[0][1],
604
- b,
605
- c
606
- );
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);
552
+ ), a = n.features.map((y) => {
553
+ let h = [];
554
+ return Q(y)[0].map((c) => {
555
+ o.length === 0 ? o = [Array.from(c), Array.from(c)] : (c[0] < o[0][0] && (o[0][0] = c[0]), c[0] > o[1][0] && (o[1][0] = c[0]), c[1] < o[0][1] && (o[0][1] = c[1]), c[1] > o[1][1] && (o[1][1] = c[1])), h.length === 0 ? h = [Array.from(c), Array.from(c)] : (c[0] < h[0][0] && (h[0][0] = c[0]), c[0] > h[1][0] && (h[1][0] = c[0]), c[1] < h[0][1] && (h[0][1] = c[1]), c[1] > h[1][1] && (h[1][1] = c[1]));
556
+ }), h;
557
+ }), l = (o[1][0] - o[0][0]) / s, g = (o[1][1] - o[0][1]) / s, b = a.reduce(
558
+ (y, h, c) => {
559
+ const x = R(h[0][0], o[0][0], l, s), M = R(h[1][0], o[0][0], l, s), _ = R(h[0][1], o[0][1], g, s), T = R(h[1][1], o[0][1], g, s);
560
+ for (let p = x; p <= M; p++) {
561
+ y[p] || (y[p] = []);
562
+ for (let v = _; v <= T; v++)
563
+ y[p][v] || (y[p][v] = []), y[p][v].push(c);
611
564
  }
612
- return d;
565
+ return y;
613
566
  },
614
567
  []
615
568
  );
616
569
  this.indexedTins = {
617
570
  forw: {
618
- gridNum: c,
571
+ gridNum: s,
619
572
  xOrigin: i[0][0],
620
573
  yOrigin: i[0][1],
621
- xUnit: h,
622
- yUnit: l,
623
- gridCache: y
574
+ xUnit: d,
575
+ yUnit: f,
576
+ gridCache: m
624
577
  },
625
578
  bakw: {
626
- gridNum: c,
627
- xOrigin: f[0][0],
628
- yOrigin: f[0][1],
629
- xUnit: u,
630
- yUnit: b,
631
- gridCache: p
579
+ gridNum: s,
580
+ xOrigin: o[0][0],
581
+ yOrigin: o[0][1],
582
+ xUnit: l,
583
+ yUnit: g,
584
+ gridCache: b
632
585
  }
633
586
  };
634
587
  }
635
588
  /**
636
589
  * 座標変換を実行します
637
- *
590
+ *
638
591
  * @param apoint - 変換する座標
639
592
  * @param backward - 逆方向の変換かどうか
640
593
  * @param ignoreBounds - 境界チェックを無視するかどうか
641
594
  * @returns 変換後の座標、または境界外の場合はfalse
642
- *
595
+ *
643
596
  * @throws {Error} 逆方向変換が許可されていない状態での逆変換時
644
597
  */
645
- transform(e, r, n) {
646
- if (r && this.strict_status == E.STATUS_ERROR)
647
- throw 'Backward transform is not allowed if strict_status == "strict_error"';
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))
598
+ transform(t, e, n) {
599
+ if (!this.tins)
600
+ throw new Error("setCompiled() must be called before transform()");
601
+ if (e && this.strict_status == E.STATUS_ERROR)
602
+ throw new Error('Backward transform is not allowed if strict_status == "strict_error"');
603
+ this.yaxisMode == E.YAXIS_FOLLOW && e && (t = [t[0], -1 * t[1]]);
604
+ const s = W(t);
605
+ if (this.bounds && !e && !n && !U(s, this.boundsPolygon))
651
606
  return !1;
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;
653
- let y, o;
654
- this.stateFull && (this.stateBackward == r ? y = this.stateTriangle : (this.stateBackward = r, this.stateTriangle = void 0), o = (b) => {
655
- this.stateTriangle = b;
607
+ const i = e ? this.tins.bakw : this.tins.forw, o = e ? this.indexedTins.bakw : this.indexedTins.forw, u = e ? this.vertices_params.bakw : this.vertices_params.forw, d = e ? this.centroid.bakw : this.centroid.forw, f = e ? this.pointsWeightBuffer.bakw : this.pointsWeightBuffer.forw;
608
+ let m, a;
609
+ this.stateFull && (this.stateBackward == e ? m = this.stateTriangle : (this.stateBackward = e, this.stateTriangle = void 0), a = (g) => {
610
+ this.stateTriangle = g;
656
611
  });
657
- let u = vt(
658
- c,
612
+ let l = St(
613
+ s,
659
614
  i,
615
+ o,
616
+ u,
617
+ d,
660
618
  f,
661
- g,
662
- h,
663
- l,
664
- y,
665
- o
619
+ m,
620
+ a
666
621
  );
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]]);
671
- return u;
622
+ if (this.bounds && e && !n) {
623
+ const g = W(l);
624
+ if (!U(g, this.boundsPolygon)) return !1;
625
+ } else this.yaxisMode == E.YAXIS_FOLLOW && !e && (l = [l[0], -1 * l[1]]);
626
+ return l;
672
627
  }
673
628
  };
674
629
  /**
675
630
  * 各種モードの定数定義
676
631
  * すべてreadonlyで、型安全性を確保
677
632
  */
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;
633
+ w(E, "VERTEX_PLAIN", "plain"), w(E, "VERTEX_BIRDEYE", "birdeye"), w(E, "MODE_STRICT", "strict"), w(E, "MODE_AUTO", "auto"), w(E, "MODE_LOOSE", "loose"), w(E, "STATUS_STRICT", "strict"), w(E, "STATUS_ERROR", "strict_error"), w(E, "STATUS_LOOSE", "loose"), w(E, "YAXIS_FOLLOW", "follow"), w(E, "YAXIS_INVERT", "invert");
634
+ let $ = E;
635
+ const k = 20037508342789244e-9, Yt = [
636
+ [0, 0],
637
+ [0, 1],
638
+ [1, 0],
639
+ [0, -1],
640
+ [-1, 0]
641
+ ];
642
+ function ft(r, t) {
643
+ return Math.floor(Math.min(r[0], r[1]) / 4) * k / 128 / Math.pow(2, t);
644
+ }
645
+ function $t(r, t) {
646
+ const e = [];
647
+ for (let n = 0; n < r.length; n++) {
648
+ const s = r[n], i = s[0] * Math.cos(t) - s[1] * Math.sin(t), o = s[0] * Math.sin(t) + s[1] * Math.cos(t);
649
+ e.push([i, o]);
650
+ }
651
+ return e;
652
+ }
653
+ function st(r, t, e, n) {
654
+ const s = ft(n, t);
655
+ return $t(Yt, e).map((u) => [
656
+ u[0] * s + r[0],
657
+ u[1] * s + r[1]
658
+ ]);
659
+ }
660
+ function ot(r, t) {
661
+ const e = r[0], s = r.slice(1, 5).map((g) => [
662
+ g[0] - e[0],
663
+ g[1] - e[1]
664
+ ]), i = [
665
+ [0, 1],
666
+ [1, 0],
667
+ [0, -1],
668
+ [-1, 0]
669
+ ];
670
+ let o = 0, u = 0, d = 0;
671
+ for (let g = 0; g < 4; g++) {
672
+ const b = s[g], y = i[g], h = Math.sqrt(Math.pow(b[0], 2) + Math.pow(b[1], 2));
673
+ o += h;
674
+ const c = b[0] * y[1] - b[1] * y[0], x = Math.acos(
675
+ (b[0] * y[0] + b[1] * y[1]) / h
676
+ ), M = c > 0 ? -1 * x : x;
677
+ u += Math.cos(M), d += Math.sin(M);
678
+ }
679
+ const f = o / 4, m = Math.atan2(d, u), a = Math.floor(Math.min(t[0], t[1]) / 4), l = Math.log(a * k / 128 / f) / Math.log(2);
680
+ return { center: e, zoom: l, rotation: m };
681
+ }
682
+ function G(r, t) {
683
+ const e = r[0] * (2 * k) / t - k, n = -1 * (r[1] * (2 * k) / t - k);
684
+ return [e, n];
685
+ }
686
+ function it(r, t) {
687
+ const e = (r[0] + k) * t / (2 * k), n = (-r[1] + k) * t / (2 * k);
688
+ return [e, n];
689
+ }
690
+ const Z = 256;
691
+ class jt {
692
+ constructor() {
693
+ w(this, "mainTin", null);
694
+ w(this, "subTins", []);
695
+ w(this, "_maxxy", 0);
696
+ }
697
+ // ─── 初期化 ────────────────────────────────────────────────────────────────
698
+ /**
699
+ * 地図データ(コンパイル済み TIN + sub_maps)をロードする
700
+ *
701
+ * @param mapData - メイン TIN と sub_maps の情報
702
+ */
703
+ setMapData(t) {
704
+ const e = new $();
705
+ if (e.setCompiled(t.compiled), this.mainTin = e, t.maxZoom !== void 0)
706
+ this._maxxy = Math.pow(2, t.maxZoom) * Z;
707
+ else if (t.compiled.wh) {
708
+ const n = Math.max(t.compiled.wh[0], t.compiled.wh[1]), s = Math.ceil(Math.log2(n / Z));
709
+ this._maxxy = Math.pow(2, s) * Z;
710
+ }
711
+ if (this.subTins = [], t.sub_maps)
712
+ for (const n of t.sub_maps) {
713
+ const s = new $();
714
+ s.setCompiled(n.compiled);
715
+ const i = n.bounds ?? n.compiled.bounds;
716
+ if (!i)
717
+ throw new Error(
718
+ "SubMapData must have bounds or compiled.bounds to create xyBounds polygon"
719
+ );
720
+ const o = [...i, i[0]], u = o.map((d) => {
721
+ const f = s.transform(d, !1);
722
+ if (!f) throw new Error("Failed to transform sub-map bounds to mercator");
723
+ return f;
724
+ });
725
+ this.subTins.push({
726
+ tin: s,
727
+ priority: n.priority,
728
+ importance: n.importance,
729
+ xyBounds: Y([o]),
730
+ mercBounds: Y([u])
731
+ });
732
+ }
733
+ }
734
+ // ─── 処理2: submap TIN 選択付き変換 ───────────────────────────────────────
735
+ /**
736
+ * ピクセル座標 → メルカトル座標(最適レイヤー選択)
737
+ *
738
+ * @param xy - ピクセル座標 [x, y]
739
+ * @returns メルカトル座標、または範囲外の場合は false
740
+ */
741
+ xy2Merc(t) {
742
+ const e = this.xy2MercWithLayer(t);
743
+ return e ? e[1] : !1;
744
+ }
745
+ /**
746
+ * メルカトル座標 → ピクセル座標(最適レイヤー選択)
747
+ *
748
+ * @param merc - メルカトル座標 [x, y]
749
+ * @returns ピクセル座標、または範囲外の場合は false
750
+ */
751
+ merc2Xy(t) {
752
+ const e = this.merc2XyWithLayer(t), n = e[0] || e[1];
753
+ return n ? n[1] : !1;
754
+ }
755
+ /**
756
+ * ピクセル座標 → メルカトル座標(レイヤーID付き)
757
+ * histmap_tin.ts xy2MercAsync_returnLayer() の同期版
758
+ *
759
+ * @param xy - ピクセル座標 [x, y]
760
+ * @returns [レイヤーインデックス, メルカトル座標] または false
761
+ */
762
+ xy2MercWithLayer(t) {
763
+ this._assertMapData();
764
+ const e = this._getTinsSortedByPriority();
765
+ for (let n = 0; n < e.length; n++) {
766
+ const { index: s, isMain: i } = e[n];
767
+ if (i || U(W(t), this.subTins[s - 1].xyBounds)) {
768
+ const o = this._transformByIndex(t, s, !1);
769
+ if (o === !1) continue;
770
+ return [s, o];
771
+ }
772
+ }
773
+ return !1;
774
+ }
775
+ /**
776
+ * メルカトル座標 → ピクセル座標(複数レイヤー結果)
777
+ * histmap_tin.ts merc2XyAsync_returnLayer() の同期版
778
+ *
779
+ * 現在は MaplatCore の仕様に合わせ、最大2レイヤーまで返す。
780
+ * 3レイヤー以上返したい場合は、下記の .slice(0, 2) および .filter(i < 2) の
781
+ * 上限値を増やすか、引数で上限を指定できるようにすること。
782
+ *
783
+ * @param merc - メルカトル座標 [x, y]
784
+ * @returns 最大2要素の配列。各要素は [レイヤーインデックス, ピクセル座標] または undefined
785
+ */
786
+ merc2XyWithLayer(t) {
787
+ return this._assertMapData(), this._getAllTinsWithIndex().map(({ index: o, tin: u, isMain: d }) => {
788
+ const f = this._transformByIndex(t, o, !0);
789
+ return f === !1 ? [u, o] : d || U(W(f), this.subTins[o - 1].xyBounds) ? [u, o, f] : [u, o];
790
+ }).sort((o, u) => {
791
+ const d = o[0].priority ?? 0, f = u[0].priority ?? 0;
792
+ return d < f ? 1 : -1;
793
+ }).reduce(
794
+ (o, u, d, f) => {
795
+ const m = u[0], a = u[1], l = u[2];
796
+ if (!l) return o;
797
+ for (let g = 0; g < d; g++) {
798
+ const b = f[g][1], y = b === 0;
799
+ if (f[g][2] && (y || U(W(l), this.subTins[b - 1].xyBounds)))
800
+ if (o.length) {
801
+ const h = !o[0], c = h ? o[1][2] : o[0][2], x = m.importance ?? 0, M = c.importance ?? 0;
802
+ return h ? x < M ? o : [void 0, [a, l, m]] : [...o.filter(
803
+ (p) => p !== void 0
804
+ ), [a, l, m]].sort(
805
+ (p, v) => (p[2].importance ?? 0) < (v[2].importance ?? 0) ? 1 : -1
806
+ ).slice(0, 2);
807
+ } else
808
+ return [[a, l, m]];
809
+ }
810
+ return !o.length || !o[0] ? [[a, l, m]] : (o.push([a, l, m]), o.sort((g, b) => {
811
+ const y = g[2].importance ?? 0, h = b[2].importance ?? 0;
812
+ return y < h ? 1 : -1;
813
+ }).filter((g, b) => b < 2));
814
+ },
815
+ []
816
+ ).map((o) => {
817
+ if (o)
818
+ return [o[0], o[1]];
819
+ });
820
+ }
821
+ /**
822
+ * メルカトル5点 → システム座標(複数レイヤー)
823
+ * histmap_tin.ts mercs2SysCoordsAsync_multiLayer() の同期版
824
+ *
825
+ * @param mercs - 5点のメルカトル座標配列(中心+上下左右)
826
+ * @returns 各レイヤーのシステム座標配列(または undefined)
827
+ */
828
+ mercs2SysCoords(t) {
829
+ this._assertMapData();
830
+ const e = this.merc2XyWithLayer(t[0]);
831
+ let n = !1;
832
+ return e.map((s, i) => {
833
+ if (!s) {
834
+ n = !0;
835
+ return;
836
+ }
837
+ const o = s[0], u = s[1];
838
+ return i !== 0 && !n ? [this.xy2SysCoordInternal(u)] : t.map((f, m) => m === 0 ? u : this._transformByIndex(f, o, !0)).map((f) => this.xy2SysCoordInternal(f));
839
+ });
840
+ }
841
+ // ─── 処理3: ビューポート変換 ───────────────────────────────────────────────
842
+ /**
843
+ * ビューポート → TIN 適用後メルカトル5点
844
+ * histmap_tin.ts viewpoint2MercsAsync() の同期版
845
+ *
846
+ * @param viewpoint - ビューポート(center, zoom, rotation)
847
+ * @param size - 画面サイズ [width, height]
848
+ * @returns TIN 変換後のメルカトル5点
849
+ */
850
+ viewpoint2Mercs(t, e) {
851
+ this._assertMapData(), this._assertMaxxy();
852
+ const s = st(t.center, t.zoom, t.rotation, e).map((f) => it(f, this._maxxy)), i = this.xy2MercWithLayer(s[0]);
853
+ if (!i) throw new Error("viewpoint2Mercs: center point is out of bounds");
854
+ const o = i[0], u = i[1];
855
+ return s.map((f, m) => {
856
+ if (m === 0) return u;
857
+ const a = this._transformByIndex(f, o, !1);
858
+ if (a === !1) throw new Error(`viewpoint2Mercs: point ${m} is out of bounds`);
859
+ return a;
860
+ });
861
+ }
862
+ /**
863
+ * TIN 適用後メルカトル5点 → ビューポート
864
+ * histmap_tin.ts mercs2ViewpointAsync() の同期版
865
+ *
866
+ * @param mercs - TIN 変換後のメルカトル5点
867
+ * @param size - 画面サイズ [width, height]
868
+ * @returns ビューポート(center, zoom, rotation)
869
+ */
870
+ mercs2Viewpoint(t, e) {
871
+ this._assertMapData(), this._assertMaxxy();
872
+ const n = this.merc2XyWithLayer(t[0]), s = n[0] || n[1];
873
+ if (!s) throw new Error("mercs2Viewpoint: center point is out of bounds");
874
+ const i = s[0], o = s[1], d = t.map((f, m) => {
875
+ if (m === 0) return o;
876
+ const a = this._transformByIndex(f, i, !0);
877
+ if (a === !1) throw new Error(`mercs2Viewpoint: point ${m} is out of bounds`);
878
+ return a;
879
+ }).map((f) => G(f, this._maxxy));
880
+ return ot(d, e);
881
+ }
882
+ // ─── ユーティリティ(静的メソッド)────────────────────────────────────────
883
+ /** zoom2Radius の静的ラッパー */
884
+ static zoom2Radius(t, e) {
885
+ return ft(t, e);
886
+ }
887
+ /** mercViewpoint2Mercs の静的ラッパー */
888
+ static mercViewpoint2Mercs(t, e, n, s) {
889
+ return st(t, e, n, s);
890
+ }
891
+ /** mercs2MercViewpoint の静的ラッパー */
892
+ static mercs2MercViewpoint(t, e) {
893
+ return ot(t, e);
894
+ }
895
+ /** xy2SysCoord の静的ラッパー */
896
+ static xy2SysCoord(t, e) {
897
+ return G(t, e);
898
+ }
899
+ /** sysCoord2Xy の静的ラッパー */
900
+ static sysCoord2Xy(t, e) {
901
+ return it(t, e);
902
+ }
903
+ // ─── 内部ヘルパー ──────────────────────────────────────────────────────────
904
+ _assertMapData() {
905
+ if (!this.mainTin)
906
+ throw new Error("setMapData() must be called before transformation");
907
+ }
908
+ _assertMaxxy() {
909
+ if (this._maxxy === 0)
910
+ throw new Error(
911
+ "MapData.maxZoom or compiled.wh must be set for viewpoint conversion (xy2SysCoord / sysCoord2Xy)"
912
+ );
913
+ }
914
+ /**
915
+ * レイヤーインデックスに対応する Transform インスタンスを返す(三角網描画などの用途)
916
+ *
917
+ * @param idx - 0 = メイン TIN、1以上 = sub_maps[idx-1]
918
+ * @returns 対応する Transform、または範囲外の場合は null
919
+ */
920
+ getLayerTransform(t) {
921
+ if (t === 0) return this.mainTin;
922
+ const e = this.subTins[t - 1];
923
+ return e ? e.tin : null;
924
+ }
925
+ /** レイヤー数を返す(メイン + sub 数) */
926
+ get layerCount() {
927
+ return 1 + this.subTins.length;
928
+ }
929
+ /**
930
+ * viewpoint 変換に使用する最大ピクセル幅(2^maxZoom × 256)
931
+ * stateToViewpoint / viewpointToState で zoom ↔ scale 変換に使用する
932
+ * zoom = log2(scale × maxxy / 256) の関係
933
+ */
934
+ get maxxy() {
935
+ return this._maxxy;
936
+ }
937
+ /** priority 降順でソートした [index, tin, isMain] の配列を返す */
938
+ _getTinsSortedByPriority() {
939
+ return this._getAllTinsWithIndex().sort((e, n) => {
940
+ const s = e.tin.priority ?? 0, i = n.tin.priority ?? 0;
941
+ return s < i ? 1 : -1;
942
+ });
943
+ }
944
+ /** メイン TIN + 全 sub TIN を index 付きで返す */
945
+ _getAllTinsWithIndex() {
946
+ const t = [
947
+ { index: 0, tin: this.mainTin, isMain: !0 }
948
+ ];
949
+ return this.subTins.forEach((e, n) => {
950
+ e.tin.priority = e.priority, e.tin.importance = e.importance, t.push({ index: n + 1, tin: e.tin, isMain: !1 });
951
+ }), t;
952
+ }
953
+ /**
954
+ * 指定レイヤーインデックスで TIN 変換を実行する
955
+ * index 0 → mainTin, index 1..n → subTins[index-1]
956
+ */
957
+ _transformByIndex(t, e, n) {
958
+ if (e === 0)
959
+ return this.mainTin.transform(t, n);
960
+ const s = this.subTins[e - 1];
961
+ return s ? s.tin.transform(t, n, !0) : !1;
962
+ }
963
+ /** 内部用 xy2SysCoord(_maxxy を使用) */
964
+ xy2SysCoordInternal(t) {
965
+ return G(t, this._maxxy);
966
+ }
967
+ }
680
968
  export {
681
- Z as Transform,
682
- Xt as counterTri,
683
- Wt as format_version,
684
- At as normalizeEdges,
685
- Ft as rotateVerticesTriangle,
686
- vt as transformArr
969
+ Yt as MERC_CROSSMATRIX,
970
+ k as MERC_MAX,
971
+ jt as MapTransform,
972
+ $ as Transform,
973
+ Gt as counterTri,
974
+ Zt as format_version,
975
+ st as mercViewpoint2Mercs,
976
+ ot as mercs2MercViewpoint,
977
+ Pt as normalizeEdges,
978
+ $t as rotateMatrix,
979
+ zt as rotateVerticesTriangle,
980
+ it as sysCoord2Xy,
981
+ St as transformArr,
982
+ G as xy2SysCoord,
983
+ ft as zoom2Radius
687
984
  };