@maplat/transform 0.5.0 → 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,227 +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 X(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 (!z(t[0]) || !z(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 z(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 G(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, P = 134217729, dt = (3 + 8 * R) * R;
75
- function V(t, e, r, n, c) {
76
- let i, u, g, h, l = e[0], y = n[0], o = 0, f = 0;
77
- y > l == y > -l ? (i = l, l = e[++o]) : (i = y, y = n[++f]);
78
- let b = 0;
79
- if (o < t && f < r)
80
- for (y > l == y > -l ? (u = l + i, g = i - (u - l), l = e[++o]) : (u = y + i, g = i - (u - y), y = n[++f]), i = u, g !== 0 && (c[b++] = g); o < t && f < r; )
81
- y > l == y > -l ? (u = i + l, h = u - i, g = i - (u - h) + (l - h), l = e[++o]) : (u = i + y, h = u - i, g = i - (u - h) + (y - h), y = n[++f]), i = u, g !== 0 && (c[b++] = g);
82
- for (; o < t; )
83
- u = i + l, h = u - i, g = i - (u - h) + (l - h), l = e[++o], i = u, g !== 0 && (c[b++] = g);
84
- for (; f < r; )
85
- u = i + y, h = u - i, g = i - (u - h) + (y - h), y = n[++f], i = u, 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), j = Y(8), J = Y(12), K = Y(16), S = Y(4);
97
- function bt(t, e, r, n, c, i, u) {
98
- let g, h, l, y, o, f, b, p, d, a, s, m, M, v, _, w, A, O;
99
- const k = t - c, T = r - c, I = e - i, N = n - i;
100
- v = k * N, f = P * k, b = f - (f - k), p = k - b, f = P * N, d = f - (f - N), a = N - d, _ = p * a - (v - b * d - p * d - b * a), w = I * T, f = P * I, b = f - (f - I), p = I - b, f = P * T, d = f - (f - T), a = T - d, A = p * a - (w - b * d - p * d - b * a), s = _ - A, o = _ - s, U[0] = _ - (s + o) + (o - A), m = v + s, o = m - v, M = v - (m - o) + (s - o), s = M - w, o = M - s, U[1] = M - (s + o) + (o - w), O = m + s, o = O - m, U[2] = m - (O - o) + (s - o), U[3] = O;
101
- let C = ht(4, U), W = lt * u;
102
- if (C >= W || -C >= W || (o = t - k, g = t - (k + o) + (o - c), o = r - T, l = r - (T + o) + (o - c), o = e - I, h = e - (I + o) + (o - i), o = n - N, y = n - (N + o) + (o - i), g === 0 && h === 0 && l === 0 && y === 0) || (W = yt * u + dt * Math.abs(C), C += k * y + N * g - (I * l + T * h), C >= W || -C >= W)) return C;
103
- v = g * N, f = P * g, b = f - (f - g), p = g - b, f = P * N, d = f - (f - N), a = N - d, _ = p * a - (v - b * d - p * d - b * a), w = h * T, f = P * h, b = f - (f - h), p = h - b, f = P * T, d = f - (f - T), a = T - d, A = p * a - (w - b * d - p * d - b * a), s = _ - A, o = _ - s, S[0] = _ - (s + o) + (o - A), m = v + s, o = m - v, M = v - (m - o) + (s - o), s = M - w, o = M - s, S[1] = M - (s + o) + (o - w), O = m + s, o = O - m, S[2] = m - (O - o) + (s - o), S[3] = O;
104
- const it = V(4, U, 4, S, j);
105
- v = k * y, f = P * k, b = f - (f - k), p = k - b, f = P * y, d = f - (f - y), a = y - d, _ = p * a - (v - b * d - p * d - b * a), w = I * l, f = P * I, b = f - (f - I), p = I - b, f = P * l, d = f - (f - 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 = v + s, o = m - v, M = v - (m - o) + (s - o), s = M - w, o = M - s, S[1] = M - (s + o) + (o - w), O = m + s, o = O - m, S[2] = m - (O - o) + (s - o), S[3] = O;
106
- const st = V(it, j, 4, S, J);
107
- v = g * y, f = P * g, b = f - (f - g), p = g - b, f = P * y, d = f - (f - y), a = y - d, _ = p * a - (v - b * d - p * d - b * a), w = h * l, f = P * h, b = f - (f - h), p = h - b, f = P * l, d = f - (f - 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 = v + s, o = m - v, M = v - (m - o) + (s - o), s = M - w, o = M - s, S[1] = M - (s + o) + (o - w), O = m + s, o = O - m, S[2] = m - (O - o) + (s - o), S[3] = O;
108
- const ot = V(st, J, 4, S, K);
109
- return K[ot - 1];
110
- }
111
- function mt(t, e, r, n, c, i) {
112
- const u = (e - i) * (r - c), g = (t - c) * (n - i), h = u - g, l = Math.abs(u + 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, u, g, h, l, y, o, f = 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 (u = y[0] - f, g = y[1] - b, n; n < a; n++) {
123
- if (o = d[n + 1], h = o[0] - f, l = o[1] - b, g === 0 && l === 0) {
124
- if (h <= 0 && u >= 0 || u <= 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(u, 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, u = 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 $(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, u = e.bbox;
142
- let g = c.coordinates;
143
- if (u && xt(n, u) === !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 L(t, e) {
158
- for (let r = 0; r < e.features.length; r++)
159
- if ($(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], u = 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]], f = [u[0] - n[0], u[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] * f[0] - o[0] * f[1]) / (y[0] * o[1] - y[1] * o[0]), a = (y[0] * f[1] - y[1] * f[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], M = r[e.properties.c.index];
167
- let v;
168
- if (d < 0 || a < 0 || 1 - d - a < 0) {
169
- const _ = d / (d + a), w = a / (d + a);
170
- v = d / m / (_ / m + w / M), a = a / M / (_ / m + w / M);
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
- v = d / m / (d / m + a / M + (1 - d - a) / s), a = a / M / (d / m + a / M + (1 - d - a) / s);
173
- d = v;
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, u = Math.atan2(c[0] - i[0], c[1] - i[1]), g = Mt(u, 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, u, g) {
188
- let h;
189
- if (u && (h = L(t, F([u]))), !h)
190
- if (r) {
191
- const l = t.geometry.coordinates, y = r.gridNum, o = r.xOrigin, f = r.yOrigin, b = r.xUnit, p = r.yUnit, d = r.gridCache, a = B(l[0], o, b, y), s = B(l[1], f, p, y), m = d[a] ? d[a][s] ? d[a][s] : [] : [], M = F(m.map((v) => e.features[v]));
192
- h = L(t, M);
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
193
  } else
194
- h = L(t, e);
195
- return g && g(h), h ? rt(t, h, i) : pt(t, n, c, i);
196
- }
197
- function B(t, e, r, n) {
198
- let c = Math.floor((t - e) / r);
199
- return c < 0 && (c = 0), c >= n && (c = n - 1), c;
200
- }
201
- function Mt(t, e) {
202
- let r = Q(t - e[0]), n = Math.PI * 2, c;
203
- for (let i = 0; i < e.length; i++) {
204
- const u = (i + 1) % e.length, g = Q(t - e[u]), h = Math.min(Math.abs(r), Math.abs(g));
205
- r * g <= 0 && h < n && (n = h, c = i), r = g;
206
- }
207
- return c;
208
- }
209
- function Q(t, e = !1) {
210
- const r = 2 * Math.PI, n = t - Math.floor(t / r) * r;
211
- return e ? n : n > Math.PI ? n - r : n;
212
- }
213
- function At(t, e) {
214
- return e && e >= 2.00703 || Array.isArray(t[0]) ? t : t.map((r) => [
215
- r.illstNodes,
216
- r.mercNodes,
217
- r.startEnd
218
- ]);
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;
206
+ }
207
+ return s;
208
+ }
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;
219
212
  }
220
- function Ft(t) {
221
- const e = t.features;
222
- for (let r = 0; r < e.length; r++) {
223
- const n = e[r];
224
- `${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] = {
225
218
  geometry: {
226
219
  type: "Polygon",
227
220
  coordinates: [
@@ -248,7 +241,7 @@ function Ft(t) {
248
241
  }
249
242
  },
250
243
  type: "Feature"
251
- } : `${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] = {
252
245
  geometry: {
253
246
  type: "Polygon",
254
247
  coordinates: [
@@ -277,406 +270,715 @@ function Ft(t) {
277
270
  type: "Feature"
278
271
  });
279
272
  }
280
- return t;
273
+ return r;
281
274
  }
282
- function Wt(t) {
283
- const e = ["a", "b", "c", "a"].map(
284
- (i) => t.properties[i].geom
285
- ), r = t.geometry.coordinates[0], n = t.properties, c = {
286
- a: { geom: r[0], index: n.a.index },
287
- b: { geom: r[1], index: n.b.index },
288
- 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 }
289
282
  };
290
- return et([e], c);
283
+ return Y([t], s);
291
284
  }
292
- function _t(t) {
293
- const e = [0, 1, 2, 0].map((n) => t[n][0][0]), r = {
294
- a: { geom: t[0][0][1], index: t[0][1] },
295
- b: { geom: t[1][0][1], index: t[1][1] },
296
- 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] }
297
290
  };
298
- return et([e], r);
299
- }
300
- function D(t, e, r, n, c, i = !1, u) {
301
- const g = t.map(
302
- (h) => {
303
- (!u || u < 2.00703) && (h = nt(h));
304
- const l = isFinite(h) ? e[h] : h === "c" ? n : (function() {
305
- const y = h.match(/^b(\d+)$/);
306
- if (y) return c[parseInt(y[1])];
307
- const o = h.match(/^e(\d+)$/);
308
- if (o) return r[parseInt(o[1])];
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])];
309
302
  throw new Error("Bad index value for indexesToTri");
310
303
  })();
311
- 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];
312
305
  }
313
306
  );
314
- 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");
315
311
  }
316
- function nt(t) {
317
- 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
+ ]);
318
318
  }
319
- const q = 2.00703;
320
- function Et(t) {
321
- return !!(t.version !== void 0 || !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);
322
322
  }
323
- function Ot(t) {
323
+ function Rt(r) {
324
324
  return {
325
- points: t.points,
326
- pointsWeightBuffer: St(t),
327
- strictStatus: kt(t),
328
- verticesParams: Tt(t),
329
- centroid: It(t),
330
- edges: At(t.edges || []),
331
- edgeNodes: t.edgeNodes || [],
332
- tins: Nt(t),
333
- kinks: Bt(t.kinks_points),
334
- yaxisMode: t.yaxisMode ?? "invert",
335
- strictMode: t.strictMode ?? "auto",
336
- vertexMode: t.vertexMode,
337
- bounds: t.bounds,
338
- boundsPolygon: t.boundsPolygon,
339
- wh: t.wh,
340
- xy: 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]
341
341
  };
342
342
  }
343
- function Pt(t) {
344
- const e = Ct(t), r = e.tins;
343
+ function kt(r) {
344
+ const t = Vt(r), e = t.tins;
345
345
  return {
346
- compiled: e,
347
- tins: r,
348
- points: Rt(r),
349
- strictStatus: e.strict_status,
350
- pointsWeightBuffer: e.weight_buffer,
351
- verticesParams: e.vertices_params,
352
- centroid: e.centroid,
353
- 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
354
354
  };
355
355
  }
356
- function St(t) {
357
- return !t.version || t.version < q ? ["forw", "bakw"].reduce((e, r) => {
358
- const n = t.weight_buffer[r];
359
- return n && (e[r] = Object.keys(n).reduce((c, i) => {
360
- const u = nt(i);
361
- return c[u] = n[i], c;
362
- }, {})), e;
363
- }, {}) : t.weight_buffer;
364
- }
365
- function kt(t) {
366
- return t.strict_status ? t.strict_status : t.kinks_points ? "strict_error" : t.tins_points.length === 2 ? "loose" : "strict";
367
- }
368
- function Tt(t) {
369
- const e = {
370
- forw: [t.vertices_params[0]],
371
- 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]]
372
372
  };
373
- return e.forw[1] = H(t, !1), e.bakw[1] = H(t, !0), e;
374
- }
375
- function H(t, e) {
376
- const r = t.vertices_points.length;
377
- return Array.from({ length: r }, (n, c) => {
378
- const i = (c + 1) % r, u = D(
379
- ["c", `b${c}`, `b${i}`],
380
- t.points,
381
- t.edgeNodes || [],
382
- t.centroid_point,
383
- t.vertices_points,
384
- e,
385
- q
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
386
386
  );
387
- return F([u]);
387
+ return F([o]);
388
388
  });
389
389
  }
390
- function It(t) {
390
+ function Lt(r) {
391
391
  return {
392
- forw: X(t.centroid_point[0], {
392
+ forw: W(r.centroid_point[0], {
393
393
  target: {
394
- geom: t.centroid_point[1],
394
+ geom: r.centroid_point[1],
395
395
  index: "c"
396
396
  }
397
397
  }),
398
- bakw: X(t.centroid_point[1], {
398
+ bakw: W(r.centroid_point[1], {
399
399
  target: {
400
- geom: t.centroid_point[0],
400
+ geom: r.centroid_point[0],
401
401
  index: "c"
402
402
  }
403
403
  })
404
404
  };
405
405
  }
406
- function Nt(t) {
407
- const e = t.tins_points.length === 1 ? 0 : 1;
406
+ function Ut(r) {
407
+ const t = r.tins_points.length === 1 ? 0 : 1;
408
408
  return {
409
409
  forw: F(
410
- t.tins_points[0].map(
411
- (r) => D(
412
- r,
413
- t.points,
414
- t.edgeNodes || [],
415
- t.centroid_point,
416
- 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,
417
417
  !1,
418
- t.version
418
+ r.version
419
419
  )
420
420
  )
421
421
  ),
422
422
  bakw: F(
423
- t.tins_points[e].map(
424
- (r) => D(
425
- r,
426
- t.points,
427
- t.edgeNodes || [],
428
- t.centroid_point,
429
- 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,
430
430
  !0,
431
- t.version
431
+ r.version
432
432
  )
433
433
  )
434
434
  )
435
435
  };
436
436
  }
437
- function Bt(t) {
438
- if (t)
437
+ function Ft(r) {
438
+ if (r)
439
439
  return {
440
440
  bakw: F(
441
- t.map((e) => X(e))
441
+ r.map((t) => W(t))
442
442
  )
443
443
  };
444
444
  }
445
- function Ct(t) {
445
+ function Vt(r) {
446
446
  return JSON.parse(
447
- 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"')
448
448
  );
449
449
  }
450
- function Rt(t) {
451
- const e = [], r = t.forw.features;
452
- for (let n = 0; n < r.length; n++) {
453
- const c = r[n];
454
- ["a", "b", "c"].forEach((i, u) => {
455
- const g = c.geometry.coordinates[0][u], h = c.properties[i].geom, l = c.properties[i].index;
456
- 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]);
457
457
  });
458
458
  }
459
- return e;
459
+ return t;
460
460
  }
461
- const Xt = q, E = class E {
461
+ const Zt = J, E = class E {
462
462
  constructor() {
463
- x(this, "points", []);
464
- x(this, "pointsWeightBuffer");
465
- x(this, "strict_status");
466
- x(this, "vertices_params");
467
- x(this, "centroid");
468
- x(this, "edgeNodes");
469
- x(this, "edges");
470
- x(this, "tins");
471
- x(this, "kinks");
472
- x(this, "yaxisMode", E.YAXIS_INVERT);
473
- x(this, "strictMode", E.MODE_AUTO);
474
- x(this, "vertexMode", E.VERTEX_PLAIN);
475
- x(this, "bounds");
476
- x(this, "boundsPolygon");
477
- x(this, "wh");
478
- x(this, "xy");
479
- x(this, "indexedTins");
480
- x(this, "stateFull", !1);
481
- x(this, "stateTriangle");
482
- 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");
483
483
  /**
484
484
  * Optional properties for MaplatCore extension
485
485
  * These properties allow consuming applications to extend Transform instances
486
486
  * with additional metadata without requiring Module Augmentation
487
487
  */
488
488
  /** Layer priority for rendering order */
489
- x(this, "priority");
489
+ w(this, "priority");
490
490
  /** Layer importance for display decisions */
491
- x(this, "importance");
491
+ w(this, "importance");
492
492
  /** Bounds in XY (source) coordinate system */
493
- x(this, "xyBounds");
493
+ w(this, "xyBounds");
494
494
  /** Bounds in Mercator (Web Mercator) coordinate system */
495
- x(this, "mercBounds");
495
+ w(this, "mercBounds");
496
496
  }
497
497
  /**
498
498
  * コンパイルされた設定を適用します
499
- *
499
+ *
500
500
  * @param compiled - コンパイルされた設定オブジェクト
501
501
  * @returns 変換に必要な主要なオブジェクトのセット
502
- *
502
+ *
503
503
  * 以下の処理を行います:
504
504
  * 1. バージョンに応じた設定の解釈
505
505
  * 2. 各種パラメータの復元
506
506
  * 3. TINネットワークの再構築
507
507
  * 4. インデックスの作成
508
508
  */
509
- setCompiled(e) {
510
- if (Et(e)) {
511
- this.applyModernState(Ot(e));
509
+ setCompiled(t) {
510
+ if (Ot(t)) {
511
+ this.applyModernState(Rt(t));
512
512
  return;
513
513
  }
514
- this.applyLegacyState(Pt(e));
514
+ this.applyLegacyState(kt(t));
515
515
  }
516
- applyModernState(e) {
517
- 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));
518
518
  }
519
- applyLegacyState(e) {
520
- 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;
521
521
  }
522
522
  /**
523
523
  * TINネットワークのインデックスを作成します
524
- *
524
+ *
525
525
  * インデックスは変換処理を高速化するために使用されます。
526
526
  * グリッド形式のインデックスを作成し、各グリッドに
527
527
  * 含まれる三角形を記録します。
528
528
  */
529
529
  addIndexedTin() {
530
- const e = this.tins, r = e.forw, n = e.bakw, c = Math.ceil(Math.sqrt(r.features.length));
531
- 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) {
532
532
  this.indexedTins = void 0;
533
533
  return;
534
534
  }
535
- let i = [], u = [];
536
- const g = r.features.map((d) => {
537
- let a = [];
538
- return G(d)[0].map((s) => {
539
- 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]));
540
- }), a;
541
- }), h = (i[1][0] - i[0][0]) / c, l = (i[1][1] - i[0][1]) / c, y = g.reduce(
542
- (d, a, s) => {
543
- const m = B(
544
- a[0][0],
545
- i[0][0],
546
- h,
547
- c
548
- ), M = B(
549
- a[1][0],
550
- i[0][0],
551
- h,
552
- c
553
- ), v = B(
554
- a[0][1],
555
- i[0][1],
556
- l,
557
- c
558
- ), _ = B(
559
- a[1][1],
560
- i[0][1],
561
- l,
562
- c
563
- );
564
- for (let w = m; w <= M; w++) {
565
- d[w] || (d[w] = []);
566
- for (let A = v; A <= _; A++)
567
- 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);
568
548
  }
569
- return d;
549
+ return y;
570
550
  },
571
551
  []
572
- ), o = n.features.map((d) => {
573
- let a = [];
574
- return G(d)[0].map((s) => {
575
- u.length === 0 ? u = [Array.from(s), Array.from(s)] : (s[0] < u[0][0] && (u[0][0] = s[0]), s[0] > u[1][0] && (u[1][0] = s[0]), s[1] < u[0][1] && (u[0][1] = s[1]), s[1] > u[1][1] && (u[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]));
576
- }), a;
577
- }), f = (u[1][0] - u[0][0]) / c, b = (u[1][1] - u[0][1]) / c, p = o.reduce(
578
- (d, a, s) => {
579
- const m = B(
580
- a[0][0],
581
- u[0][0],
582
- f,
583
- c
584
- ), M = B(
585
- a[1][0],
586
- u[0][0],
587
- f,
588
- c
589
- ), v = B(
590
- a[0][1],
591
- u[0][1],
592
- b,
593
- c
594
- ), _ = B(
595
- a[1][1],
596
- u[0][1],
597
- b,
598
- c
599
- );
600
- for (let w = m; w <= M; w++) {
601
- d[w] || (d[w] = []);
602
- for (let A = v; A <= _; A++)
603
- 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);
604
564
  }
605
- return d;
565
+ return y;
606
566
  },
607
567
  []
608
568
  );
609
569
  this.indexedTins = {
610
570
  forw: {
611
- gridNum: c,
571
+ gridNum: s,
612
572
  xOrigin: i[0][0],
613
573
  yOrigin: i[0][1],
614
- xUnit: h,
615
- yUnit: l,
616
- gridCache: y
574
+ xUnit: d,
575
+ yUnit: f,
576
+ gridCache: m
617
577
  },
618
578
  bakw: {
619
- gridNum: c,
620
- xOrigin: u[0][0],
621
- yOrigin: u[0][1],
622
- xUnit: f,
623
- yUnit: b,
624
- gridCache: p
579
+ gridNum: s,
580
+ xOrigin: o[0][0],
581
+ yOrigin: o[0][1],
582
+ xUnit: l,
583
+ yUnit: g,
584
+ gridCache: b
625
585
  }
626
586
  };
627
587
  }
628
588
  /**
629
589
  * 座標変換を実行します
630
- *
590
+ *
631
591
  * @param apoint - 変換する座標
632
592
  * @param backward - 逆方向の変換かどうか
633
593
  * @param ignoreBounds - 境界チェックを無視するかどうか
634
594
  * @returns 変換後の座標、または境界外の場合はfalse
635
- *
595
+ *
636
596
  * @throws {Error} 逆方向変換が許可されていない状態での逆変換時
637
597
  */
638
- transform(e, r, n) {
598
+ transform(t, e, n) {
639
599
  if (!this.tins)
640
600
  throw new Error("setCompiled() must be called before transform()");
641
- if (r && this.strict_status == E.STATUS_ERROR)
601
+ if (e && this.strict_status == E.STATUS_ERROR)
642
602
  throw new Error('Backward transform is not allowed if strict_status == "strict_error"');
643
- this.yaxisMode == E.YAXIS_FOLLOW && r && (e = [e[0], -1 * e[1]]);
644
- const c = X(e);
645
- if (this.bounds && !r && !n && !$(c, this.boundsPolygon))
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))
646
606
  return !1;
647
- const i = r ? this.tins.bakw : this.tins.forw, u = 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;
648
- let y, o;
649
- this.stateFull && (this.stateBackward == r ? y = this.stateTriangle : (this.stateBackward = r, this.stateTriangle = void 0), o = (b) => {
650
- 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;
651
611
  });
652
- let f = vt(
653
- c,
612
+ let l = St(
613
+ s,
654
614
  i,
615
+ o,
655
616
  u,
656
- g,
657
- h,
658
- l,
659
- y,
660
- o
617
+ d,
618
+ f,
619
+ m,
620
+ a
661
621
  );
662
- if (this.bounds && r && !n) {
663
- const b = X(f);
664
- if (!$(b, this.boundsPolygon)) return !1;
665
- } else this.yaxisMode == E.YAXIS_FOLLOW && !r && (f = [f[0], -1 * f[1]]);
666
- return f;
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;
667
627
  }
668
628
  };
669
629
  /**
670
630
  * 各種モードの定数定義
671
631
  * すべてreadonlyで、型安全性を確保
672
632
  */
673
- 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");
674
- 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
+ }
675
968
  export {
676
- Z as Transform,
677
- Wt as counterTri,
678
- Xt as format_version,
679
- At as normalizeEdges,
680
- Ft as rotateVerticesTriangle,
681
- 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
682
984
  };