@maplat/transform 0.3.0 → 0.4.0

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