aviation-chart 0.1.14 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aviation-chart.umd.js +2 -2
- package/dist/index.cjs +2 -2
- package/dist/index.js +137 -135
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -144,75 +144,75 @@ Mt(["exports"], function(o) {
|
|
|
144
144
|
const r = i / (e.width - 1);
|
|
145
145
|
let l, s, c, m, h, f;
|
|
146
146
|
const d = {}, w = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map();
|
|
147
|
-
function
|
|
148
|
-
|
|
147
|
+
function P(O, I, R) {
|
|
148
|
+
O[0] === 0 ? R(r * (f - 1), r * (h - y(c, I, l))) : O[0] === 2 ? R(r * f, r * (h - y(m, I, s))) : O[1] === 0 ? R(r * (f - y(s, I, l)), r * (h - 1)) : R(r * (f - y(m, I, c)), r * h);
|
|
149
149
|
}
|
|
150
150
|
for (h = 1 - n; h < e.height + n; h++) {
|
|
151
151
|
s = e.get(0, h - 1), m = e.get(0, h);
|
|
152
|
-
let
|
|
152
|
+
let O = Math.min(s, m), I = Math.max(s, m);
|
|
153
153
|
for (f = 1 - n; f < e.width + n; f++) {
|
|
154
154
|
l = s, c = m, s = e.get(f, h - 1), m = e.get(f, h);
|
|
155
|
-
const
|
|
156
|
-
if (
|
|
155
|
+
const R = O, V = I;
|
|
156
|
+
if (O = Math.min(s, m), I = Math.max(s, m), isNaN(l) || isNaN(s) || isNaN(m) || isNaN(c))
|
|
157
157
|
continue;
|
|
158
|
-
const dt = Math.min(
|
|
159
|
-
for (let
|
|
160
|
-
const At = l >
|
|
158
|
+
const dt = Math.min(R, O), pt = Math.max(V, I), X = Math.ceil(dt / t) * t, ot = Math.floor(pt / t) * t;
|
|
159
|
+
for (let C = X; C <= ot; C += t) {
|
|
160
|
+
const At = l > C, q = s > C, nt = c > C, _t = m > C;
|
|
161
161
|
for (const bt of u[(At ? 8 : 0) | (q ? 4 : 0) | (_t ? 2 : 0) | (nt ? 1 : 0)]) {
|
|
162
|
-
let Y = w.get(
|
|
163
|
-
Y || w.set(
|
|
164
|
-
let lt = F.get(
|
|
165
|
-
lt || F.set(
|
|
162
|
+
let Y = w.get(C);
|
|
163
|
+
Y || w.set(C, Y = /* @__PURE__ */ new Map());
|
|
164
|
+
let lt = F.get(C);
|
|
165
|
+
lt || F.set(C, lt = /* @__PURE__ */ new Map());
|
|
166
166
|
const kt = bt[0], zt = bt[1], yt = g(e.width, f, h, kt), st = g(e.width, f, h, zt);
|
|
167
167
|
let L, Tt;
|
|
168
168
|
if (L = lt.get(yt))
|
|
169
169
|
if (lt.delete(yt), Tt = Y.get(st))
|
|
170
170
|
if (Y.delete(st), L === Tt) {
|
|
171
|
-
if (
|
|
172
|
-
let rt = d[
|
|
173
|
-
rt || (d[
|
|
171
|
+
if (P(zt, C, L.append), !L.isEmpty()) {
|
|
172
|
+
let rt = d[C];
|
|
173
|
+
rt || (d[C] = rt = []), rt.push(L.lineString());
|
|
174
174
|
}
|
|
175
175
|
} else
|
|
176
176
|
L.appendFragment(Tt), lt.set(L.end = Tt.end, L);
|
|
177
177
|
else
|
|
178
|
-
|
|
178
|
+
P(zt, C, L.append), lt.set(L.end = st, L);
|
|
179
179
|
else if (L = Y.get(st))
|
|
180
|
-
Y.delete(st),
|
|
180
|
+
Y.delete(st), P(kt, C, L.prepend), Y.set(L.start = yt, L);
|
|
181
181
|
else {
|
|
182
182
|
const rt = new a(yt, st);
|
|
183
|
-
|
|
183
|
+
P(kt, C, rt.append), P(zt, C, rt.append), Y.set(yt, rt), lt.set(st, rt);
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
-
for (const [
|
|
190
|
-
let
|
|
189
|
+
for (const [O, I] of w.entries()) {
|
|
190
|
+
let R = null;
|
|
191
191
|
for (const V of I.values())
|
|
192
|
-
V.isEmpty() || (
|
|
192
|
+
V.isEmpty() || (R == null && (R = d[O] || (d[O] = [])), R.push(V.lineString()));
|
|
193
193
|
}
|
|
194
194
|
return d;
|
|
195
195
|
}
|
|
196
|
-
function
|
|
196
|
+
function b(t) {
|
|
197
197
|
const e = Object.entries(t);
|
|
198
198
|
return e.sort(([i], [n]) => i < n ? -1 : i > n ? 1 : 0), e;
|
|
199
199
|
}
|
|
200
200
|
function S(t) {
|
|
201
|
-
return
|
|
201
|
+
return b(t).map(([e, i]) => [e, ...typeof i == "number" ? [i] : i].join("*")).join("~");
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function M(t) {
|
|
204
204
|
return Object.fromEntries(t.split("~").map((e) => e.split("*").map(Number)).map(([e, ...i]) => [e, i]));
|
|
205
205
|
}
|
|
206
|
-
function
|
|
207
|
-
return
|
|
206
|
+
function k({ thresholds: t, ...e }) {
|
|
207
|
+
return b({ thresholds: S(t), ...e }).map(([i, n]) => `${encodeURIComponent(i)}=${encodeURIComponent(n)}`).join("&");
|
|
208
208
|
}
|
|
209
|
-
function
|
|
209
|
+
function z(t) {
|
|
210
210
|
return Object.fromEntries(t.replace(/^.*\?/, "").split("&").map((e) => {
|
|
211
211
|
const i = e.split("=").map(decodeURIComponent), n = i[0];
|
|
212
212
|
let r = i[1];
|
|
213
213
|
switch (n) {
|
|
214
214
|
case "thresholds":
|
|
215
|
-
r =
|
|
215
|
+
r = M(r);
|
|
216
216
|
break;
|
|
217
217
|
case "extent":
|
|
218
218
|
case "multiplier":
|
|
@@ -224,9 +224,9 @@ Mt(["exports"], function(o) {
|
|
|
224
224
|
}));
|
|
225
225
|
}
|
|
226
226
|
function p(t) {
|
|
227
|
-
return
|
|
227
|
+
return b(t).map(([e, i]) => `${encodeURIComponent(e)}=${encodeURIComponent(i)}`).join(",");
|
|
228
228
|
}
|
|
229
|
-
function
|
|
229
|
+
function _(t, e) {
|
|
230
230
|
const { thresholds: i, ...n } = t;
|
|
231
231
|
let r = [], l = -1 / 0;
|
|
232
232
|
return Object.entries(i).forEach(([s, c]) => {
|
|
@@ -247,7 +247,7 @@ Mt(["exports"], function(o) {
|
|
|
247
247
|
return e && (r = new Float32Array(i.length), r.set(i)), { ...n, data: r, transferrables: [r.buffer] };
|
|
248
248
|
});
|
|
249
249
|
}
|
|
250
|
-
function
|
|
250
|
+
function A(t) {
|
|
251
251
|
return t.then(({ arrayBuffer: e }) => {
|
|
252
252
|
const i = v(e);
|
|
253
253
|
return {
|
|
@@ -421,7 +421,7 @@ Mt(["exports"], function(o) {
|
|
|
421
421
|
if (r <= 1)
|
|
422
422
|
return this;
|
|
423
423
|
const s = 0.5 - 1 / (2 * r), c = (m, h) => {
|
|
424
|
-
const f = m / r - s, d = h / r - s, w = Math.floor(f), F = Math.floor(d),
|
|
424
|
+
const f = m / r - s, d = h / r - s, w = Math.floor(f), F = Math.floor(d), P = this.get(w, F), O = this.get(w + 1, F), I = this.get(w, F + 1), R = this.get(w + 1, F + 1), V = f - w, dt = d - F, pt = l(P, O, V), X = l(I, R, V);
|
|
425
425
|
return l(pt, X, dt);
|
|
426
426
|
};
|
|
427
427
|
return new $(this.width * r, this.height * r, c);
|
|
@@ -488,12 +488,12 @@ Mt(["exports"], function(o) {
|
|
|
488
488
|
}
|
|
489
489
|
return (F ? -1 : 1) * s * Math.pow(2, l - n);
|
|
490
490
|
}, Et.write = function(t, e, i, n, r, l) {
|
|
491
|
-
var s, c, m, h = l * 8 - r - 1, f = (1 << h) - 1, d = f >> 1, w = r === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, F = n ? 0 : l - 1,
|
|
492
|
-
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (c = isNaN(e) ? 1 : 0, s = f) : (s = Math.floor(Math.log(e) / Math.LN2), e * (m = Math.pow(2, -s)) < 1 && (s--, m *= 2), s + d >= 1 ? e += w / m : e += w * Math.pow(2, 1 - d), e * m >= 2 && (s++, m /= 2), s + d >= f ? (c = 0, s = f) : s + d >= 1 ? (c = (e * m - 1) * Math.pow(2, r), s = s + d) : (c = e * Math.pow(2, d - 1) * Math.pow(2, r), s = 0)); r >= 8; t[i + F] = c & 255, F +=
|
|
491
|
+
var s, c, m, h = l * 8 - r - 1, f = (1 << h) - 1, d = f >> 1, w = r === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, F = n ? 0 : l - 1, P = n ? 1 : -1, O = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0;
|
|
492
|
+
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (c = isNaN(e) ? 1 : 0, s = f) : (s = Math.floor(Math.log(e) / Math.LN2), e * (m = Math.pow(2, -s)) < 1 && (s--, m *= 2), s + d >= 1 ? e += w / m : e += w * Math.pow(2, 1 - d), e * m >= 2 && (s++, m /= 2), s + d >= f ? (c = 0, s = f) : s + d >= 1 ? (c = (e * m - 1) * Math.pow(2, r), s = s + d) : (c = e * Math.pow(2, d - 1) * Math.pow(2, r), s = 0)); r >= 8; t[i + F] = c & 255, F += P, c /= 256, r -= 8)
|
|
493
493
|
;
|
|
494
|
-
for (s = s << r | c, h += r; h > 0; t[i + F] = s & 255, F +=
|
|
494
|
+
for (s = s << r | c, h += r; h > 0; t[i + F] = s & 255, F += P, s /= 256, h -= 8)
|
|
495
495
|
;
|
|
496
|
-
t[i + F -
|
|
496
|
+
t[i + F - P] |= O * 128;
|
|
497
497
|
};
|
|
498
498
|
var ne = T, gt = Et;
|
|
499
499
|
function T(t) {
|
|
@@ -934,12 +934,12 @@ Mt(["exports"], function(o) {
|
|
|
934
934
|
constructor(e, i, n, r, l) {
|
|
935
935
|
this.loaded = Promise.resolve(), this.decodeImage = It, this.fetchAndParseTile = (s, c, m, h, f) => {
|
|
936
936
|
const d = this, w = this.demUrlPattern.replace("{z}", s.toString()).replace("{x}", c.toString()).replace("{y}", m.toString());
|
|
937
|
-
return f == null || f.useTile(w), this.parsedCache.get(w, async (F,
|
|
938
|
-
const
|
|
939
|
-
if (B(
|
|
937
|
+
return f == null || f.useTile(w), this.parsedCache.get(w, async (F, P) => {
|
|
938
|
+
const O = await d.fetchTile(s, c, m, P, f);
|
|
939
|
+
if (B(P))
|
|
940
940
|
throw new Error("canceled");
|
|
941
|
-
const I = d.decodeImage(
|
|
942
|
-
return
|
|
941
|
+
const I = d.decodeImage(O.data, d.encoding, P), R = f == null ? void 0 : f.marker("decode"), V = await I;
|
|
942
|
+
return R == null || R(), V;
|
|
943
943
|
}, h);
|
|
944
944
|
}, this.tileCache = new Z(i), this.parsedCache = new Z(i), this.contourCache = new Z(i), this.timeoutMs = l, this.demUrlPattern = e, this.encoding = n, this.maxzoom = r;
|
|
945
945
|
}
|
|
@@ -967,33 +967,33 @@ Mt(["exports"], function(o) {
|
|
|
967
967
|
return $.fromRawDem(w).split(m, i % h, n % h);
|
|
968
968
|
}
|
|
969
969
|
fetchContourTile(e, i, n, r, l, s) {
|
|
970
|
-
const { levels: c, multiplier: m = 1, buffer: h = 1, extent: f = 4096, contourLayer: d = "contours", elevationKey: w = "ele", levelKey: F = "level", subsampleBelow:
|
|
970
|
+
const { levels: c, multiplier: m = 1, buffer: h = 1, extent: f = 4096, contourLayer: d = "contours", elevationKey: w = "ele", levelKey: F = "level", subsampleBelow: P = 100 } = r;
|
|
971
971
|
if (!c || c.length === 0)
|
|
972
972
|
return Promise.resolve({ arrayBuffer: new ArrayBuffer(0) });
|
|
973
|
-
const
|
|
974
|
-
return this.contourCache.get(
|
|
973
|
+
const O = [e, i, n, p(r)].join("/");
|
|
974
|
+
return this.contourCache.get(O, async (I, R) => {
|
|
975
975
|
const V = 1 << e, dt = [];
|
|
976
976
|
for (let q = n - 1; q <= n + 1; q++)
|
|
977
977
|
for (let nt = i - 1; nt <= i + 1; nt++)
|
|
978
|
-
dt.push(q < 0 || q >= V ? void 0 : this.fetchDem(e, (nt + V) % V, q, r,
|
|
978
|
+
dt.push(q < 0 || q >= V ? void 0 : this.fetchDem(e, (nt + V) % V, q, r, R, s));
|
|
979
979
|
const pt = await Promise.all(dt);
|
|
980
980
|
let X = $.combineNeighbors(pt);
|
|
981
|
-
if (!X || B(
|
|
981
|
+
if (!X || B(R))
|
|
982
982
|
return { arrayBuffer: new Uint8Array().buffer };
|
|
983
983
|
const ot = s == null ? void 0 : s.marker("isoline");
|
|
984
|
-
if (X.width >=
|
|
984
|
+
if (X.width >= P)
|
|
985
985
|
X = X.materialize(2);
|
|
986
986
|
else
|
|
987
|
-
for (; X.width <
|
|
987
|
+
for (; X.width < P; )
|
|
988
988
|
X = X.subsamplePixelCenters(2).materialize(2);
|
|
989
989
|
X = X.averagePixelCentersToGrid().scaleElevation(m).materialize(1);
|
|
990
|
-
const
|
|
990
|
+
const C = x(c[0], X, f, h);
|
|
991
991
|
ot == null || ot();
|
|
992
992
|
const At = De({
|
|
993
993
|
extent: f,
|
|
994
994
|
layers: {
|
|
995
995
|
[d]: {
|
|
996
|
-
features: Object.entries(
|
|
996
|
+
features: Object.entries(C).map(([q, nt]) => {
|
|
997
997
|
const _t = Number(q);
|
|
998
998
|
return {
|
|
999
999
|
type: ft.LINESTRING,
|
|
@@ -1131,21 +1131,21 @@ Mt(["exports"], function(o) {
|
|
|
1131
1131
|
}), G(this.timeoutMs, c, n);
|
|
1132
1132
|
}
|
|
1133
1133
|
}
|
|
1134
|
-
o.A = Ge, o.H = $, o.L = Re, o.T = Wt, o.a =
|
|
1134
|
+
o.A = Ge, o.H = $, o.L = Re, o.T = Wt, o.a = z, o.b = x, o.c = Dt, o.d = It, o.e = k, o.f = A, o.g = _, o.p = D;
|
|
1135
1135
|
});
|
|
1136
1136
|
Mt(["./shared"], function(o) {
|
|
1137
1137
|
const a = (y) => Promise.reject(new Error(`No manager registered for ${y}`));
|
|
1138
1138
|
class u {
|
|
1139
1139
|
constructor() {
|
|
1140
|
-
this.managers = {}, this.init = (x,
|
|
1140
|
+
this.managers = {}, this.init = (x, b) => (this.managers[x.managerId] = new o.L(x.demUrlPattern, x.cacheSize, x.encoding, x.maxzoom, x.timeoutMs), Promise.resolve()), this.fetchTile = (x, b, S, M, k, z) => {
|
|
1141
1141
|
var p;
|
|
1142
|
-
return ((p = this.managers[x]) === null || p === void 0 ? void 0 : p.fetchTile(
|
|
1143
|
-
}, this.fetchAndParseTile = (x,
|
|
1142
|
+
return ((p = this.managers[x]) === null || p === void 0 ? void 0 : p.fetchTile(b, S, M, k, z)) || a(x);
|
|
1143
|
+
}, this.fetchAndParseTile = (x, b, S, M, k, z) => {
|
|
1144
1144
|
var p;
|
|
1145
|
-
return o.p(((p = this.managers[x]) === null || p === void 0 ? void 0 : p.fetchAndParseTile(
|
|
1146
|
-
}, this.fetchContourTile = (x,
|
|
1147
|
-
var
|
|
1148
|
-
return o.f(((
|
|
1145
|
+
return o.p(((p = this.managers[x]) === null || p === void 0 ? void 0 : p.fetchAndParseTile(b, S, M, k, z)) || a(x), !0);
|
|
1146
|
+
}, this.fetchContourTile = (x, b, S, M, k, z, p) => {
|
|
1147
|
+
var _;
|
|
1148
|
+
return o.f(((_ = this.managers[x]) === null || _ === void 0 ? void 0 : _.fetchContourTile(b, S, M, k, z, p)) || a(x));
|
|
1149
1149
|
};
|
|
1150
1150
|
}
|
|
1151
1151
|
}
|
|
@@ -1157,49 +1157,49 @@ Mt(["./shared"], function(o) {
|
|
|
1157
1157
|
let u, g = 0;
|
|
1158
1158
|
class y {
|
|
1159
1159
|
constructor() {
|
|
1160
|
-
this.decodeImage = (
|
|
1160
|
+
this.decodeImage = (_, v, D) => o.p(o.d(_, v, D), !1);
|
|
1161
1161
|
}
|
|
1162
1162
|
}
|
|
1163
1163
|
function x() {
|
|
1164
1164
|
if (!u) {
|
|
1165
|
-
const p = new Worker(a.workerUrl),
|
|
1166
|
-
u = new o.A(p,
|
|
1165
|
+
const p = new Worker(a.workerUrl), _ = new y();
|
|
1166
|
+
u = new o.A(p, _);
|
|
1167
1167
|
}
|
|
1168
1168
|
return u;
|
|
1169
1169
|
}
|
|
1170
|
-
class
|
|
1171
|
-
constructor(
|
|
1170
|
+
class b {
|
|
1171
|
+
constructor(_, v, D, A, j, ct) {
|
|
1172
1172
|
this.fetchTile = (H, G, U, B, E) => this.actor.send("fetchTile", [], B, E, this.managerId, H, G, U), this.fetchAndParseTile = (H, G, U, B, E) => this.actor.send("fetchAndParseTile", [], B, E, this.managerId, H, G, U), this.fetchContourTile = (H, G, U, B, E, Z) => this.actor.send("fetchContourTile", [], E, Z, this.managerId, H, G, U, B);
|
|
1173
1173
|
const tt = this.managerId = ++g;
|
|
1174
1174
|
this.actor = ct || x(), this.loaded = this.actor.send("init", [], new AbortController(), void 0, {
|
|
1175
1175
|
cacheSize: v,
|
|
1176
|
-
demUrlPattern:
|
|
1176
|
+
demUrlPattern: _,
|
|
1177
1177
|
encoding: D,
|
|
1178
|
-
maxzoom:
|
|
1178
|
+
maxzoom: A,
|
|
1179
1179
|
managerId: tt,
|
|
1180
1180
|
timeoutMs: j
|
|
1181
1181
|
});
|
|
1182
1182
|
}
|
|
1183
1183
|
}
|
|
1184
1184
|
Blob.prototype.arrayBuffer || (Blob.prototype.arrayBuffer = function() {
|
|
1185
|
-
return new Promise((
|
|
1185
|
+
return new Promise((_, v) => {
|
|
1186
1186
|
const D = new FileReader();
|
|
1187
|
-
D.onload = (
|
|
1187
|
+
D.onload = (A) => {
|
|
1188
1188
|
var j;
|
|
1189
|
-
return
|
|
1189
|
+
return _((j = A.target) === null || j === void 0 ? void 0 : j.result);
|
|
1190
1190
|
}, D.onerror = v, D.readAsArrayBuffer(this);
|
|
1191
1191
|
});
|
|
1192
1192
|
});
|
|
1193
|
-
const S = (p) => (
|
|
1193
|
+
const S = (p) => (_, v) => {
|
|
1194
1194
|
if (v instanceof AbortController)
|
|
1195
|
-
return p(
|
|
1195
|
+
return p(_, v);
|
|
1196
1196
|
{
|
|
1197
1197
|
const D = new AbortController();
|
|
1198
|
-
return p(
|
|
1198
|
+
return p(_, D).then((A) => v(void 0, A.data, A.cacheControl, A.expires), (A) => v(A)), { cancel: () => D.abort() };
|
|
1199
1199
|
}
|
|
1200
|
-
},
|
|
1201
|
-
class
|
|
1202
|
-
constructor({ url:
|
|
1200
|
+
}, M = /* @__PURE__ */ new Set();
|
|
1201
|
+
class k {
|
|
1202
|
+
constructor({ url: _, cacheSize: v = 100, id: D = "dem", encoding: A = "terrarium", maxzoom: j = 12, worker: ct = !0, timeoutMs: tt = 1e4, actor: H }) {
|
|
1203
1203
|
this.timingCallbacks = [], this.onTiming = (E) => {
|
|
1204
1204
|
this.timingCallbacks.push(E);
|
|
1205
1205
|
}, this.setupMaplibre = (E) => {
|
|
@@ -1232,23 +1232,23 @@ Mt(["./shared"], function(o) {
|
|
|
1232
1232
|
}
|
|
1233
1233
|
}, this.contourProtocol = S(this.contourProtocolV4), this.sharedDemProtocol = S(this.sharedDemProtocolV4), this.contourProtocolUrl = (E) => `${this.contourProtocolUrlBase}?${o.e(E)}`;
|
|
1234
1234
|
let G = D, U = 1;
|
|
1235
|
-
for (;
|
|
1235
|
+
for (; M.has(G); )
|
|
1236
1236
|
G = D + U++;
|
|
1237
|
-
|
|
1238
|
-
const B = ct ?
|
|
1239
|
-
this.manager = new B(
|
|
1237
|
+
M.add(G), this.sharedDemProtocolId = `${G}-shared`, this.contourProtocolId = `${G}-contour`, this.sharedDemProtocolUrl = `${this.sharedDemProtocolId}://{z}/{x}/{y}`, this.contourProtocolUrlBase = `${this.contourProtocolId}://{z}/{x}/{y}`;
|
|
1238
|
+
const B = ct ? b : o.L;
|
|
1239
|
+
this.manager = new B(_, v, A, j, tt, H);
|
|
1240
1240
|
}
|
|
1241
|
-
getDemTile(
|
|
1242
|
-
return this.manager.fetchAndParseTile(
|
|
1241
|
+
getDemTile(_, v, D, A) {
|
|
1242
|
+
return this.manager.fetchAndParseTile(_, v, D, A || new AbortController());
|
|
1243
1243
|
}
|
|
1244
|
-
parseUrl(
|
|
1245
|
-
const [, v, D,
|
|
1246
|
-
return [Number(v), Number(D), Number(
|
|
1244
|
+
parseUrl(_) {
|
|
1245
|
+
const [, v, D, A] = /\/\/(\d+)\/(\d+)\/(\d+)/.exec(_) || [];
|
|
1246
|
+
return [Number(v), Number(D), Number(A)];
|
|
1247
1247
|
}
|
|
1248
1248
|
}
|
|
1249
1249
|
return {
|
|
1250
1250
|
generateIsolines: o.b,
|
|
1251
|
-
DemSource:
|
|
1251
|
+
DemSource: k,
|
|
1252
1252
|
HeightTile: o.H,
|
|
1253
1253
|
LocalDemManager: o.L,
|
|
1254
1254
|
decodeParsedImage: o.c,
|
|
@@ -1266,11 +1266,11 @@ function Xe(o) {
|
|
|
1266
1266
|
}
|
|
1267
1267
|
function Ne(o) {
|
|
1268
1268
|
if (o == null) return Xe;
|
|
1269
|
-
var a, u, g = o.scale[0], y = o.scale[1], x = o.translate[0],
|
|
1270
|
-
return function(S,
|
|
1271
|
-
|
|
1272
|
-
var
|
|
1273
|
-
for (p[0] = (a += S[0]) * g + x, p[1] = (u += S[1]) * y +
|
|
1269
|
+
var a, u, g = o.scale[0], y = o.scale[1], x = o.translate[0], b = o.translate[1];
|
|
1270
|
+
return function(S, M) {
|
|
1271
|
+
M || (a = u = 0);
|
|
1272
|
+
var k = 2, z = S.length, p = new Array(z);
|
|
1273
|
+
for (p[0] = (a += S[0]) * g + x, p[1] = (u += S[1]) * y + b; k < z; ) p[k] = S[k], ++k;
|
|
1274
1274
|
return p;
|
|
1275
1275
|
};
|
|
1276
1276
|
}
|
|
@@ -1288,55 +1288,55 @@ function Kt(o, a) {
|
|
|
1288
1288
|
}
|
|
1289
1289
|
function Ue(o, a) {
|
|
1290
1290
|
var u = Ne(o.transform), g = o.arcs;
|
|
1291
|
-
function y(
|
|
1291
|
+
function y(z, p) {
|
|
1292
1292
|
p.length && p.pop();
|
|
1293
|
-
for (var
|
|
1294
|
-
p.push(u(
|
|
1295
|
-
|
|
1293
|
+
for (var _ = g[z < 0 ? ~z : z], v = 0, D = _.length; v < D; ++v)
|
|
1294
|
+
p.push(u(_[v], v));
|
|
1295
|
+
z < 0 && Ve(p, D);
|
|
1296
1296
|
}
|
|
1297
|
-
function x(
|
|
1298
|
-
return u(
|
|
1297
|
+
function x(z) {
|
|
1298
|
+
return u(z);
|
|
1299
1299
|
}
|
|
1300
|
-
function z
|
|
1301
|
-
for (var p = [],
|
|
1300
|
+
function b(z) {
|
|
1301
|
+
for (var p = [], _ = 0, v = z.length; _ < v; ++_) y(z[_], p);
|
|
1302
1302
|
return p.length < 2 && p.push(p[0]), p;
|
|
1303
1303
|
}
|
|
1304
|
-
function S(
|
|
1305
|
-
for (var p = z
|
|
1304
|
+
function S(z) {
|
|
1305
|
+
for (var p = b(z); p.length < 4; ) p.push(p[0]);
|
|
1306
1306
|
return p;
|
|
1307
1307
|
}
|
|
1308
|
-
function
|
|
1309
|
-
return
|
|
1308
|
+
function M(z) {
|
|
1309
|
+
return z.map(S);
|
|
1310
1310
|
}
|
|
1311
|
-
function
|
|
1312
|
-
var p =
|
|
1311
|
+
function k(z) {
|
|
1312
|
+
var p = z.type, _;
|
|
1313
1313
|
switch (p) {
|
|
1314
1314
|
case "GeometryCollection":
|
|
1315
|
-
return { type: p, geometries:
|
|
1315
|
+
return { type: p, geometries: z.geometries.map(k) };
|
|
1316
1316
|
case "Point":
|
|
1317
|
-
|
|
1317
|
+
_ = x(z.coordinates);
|
|
1318
1318
|
break;
|
|
1319
1319
|
case "MultiPoint":
|
|
1320
|
-
|
|
1320
|
+
_ = z.coordinates.map(x);
|
|
1321
1321
|
break;
|
|
1322
1322
|
case "LineString":
|
|
1323
|
-
|
|
1323
|
+
_ = b(z.arcs);
|
|
1324
1324
|
break;
|
|
1325
1325
|
case "MultiLineString":
|
|
1326
|
-
|
|
1326
|
+
_ = z.arcs.map(b);
|
|
1327
1327
|
break;
|
|
1328
1328
|
case "Polygon":
|
|
1329
|
-
|
|
1329
|
+
_ = M(z.arcs);
|
|
1330
1330
|
break;
|
|
1331
1331
|
case "MultiPolygon":
|
|
1332
|
-
|
|
1332
|
+
_ = z.arcs.map(M);
|
|
1333
1333
|
break;
|
|
1334
1334
|
default:
|
|
1335
1335
|
return null;
|
|
1336
1336
|
}
|
|
1337
|
-
return { type: p, coordinates:
|
|
1337
|
+
return { type: p, coordinates: _ };
|
|
1338
1338
|
}
|
|
1339
|
-
return
|
|
1339
|
+
return k(a);
|
|
1340
1340
|
}
|
|
1341
1341
|
const We = {
|
|
1342
1342
|
airspaceStroke: "#AAB7B8",
|
|
@@ -3256,8 +3256,9 @@ class ri {
|
|
|
3256
3256
|
* @param {string} [options.spriteUrl] Override sprite server URL (defaults to apiUrl)
|
|
3257
3257
|
* @param {string} [options.period] Period id; defaults to latest
|
|
3258
3258
|
* @param {object} [options.layers] Initial layer visibility map
|
|
3259
|
-
* @param {[number,number]} [options.center]
|
|
3260
|
-
* @param {number} [options.zoom]
|
|
3259
|
+
* @param {[number,number]} [options.center] Initial map center [lng, lat] (default [104, 36])
|
|
3260
|
+
* @param {number} [options.zoom] Initial zoom level (default 4)
|
|
3261
|
+
* @param {string} [options.terrainUrl] Terrain DEM tile URL template (default internal server)
|
|
3261
3262
|
*/
|
|
3262
3263
|
constructor(a = {}) {
|
|
3263
3264
|
const {
|
|
@@ -3265,12 +3266,13 @@ class ri {
|
|
|
3265
3266
|
theme: g = "light",
|
|
3266
3267
|
apiUrl: y = ti,
|
|
3267
3268
|
spriteUrl: x,
|
|
3268
|
-
period:
|
|
3269
|
+
period: b = null,
|
|
3269
3270
|
layers: S = {},
|
|
3270
|
-
center:
|
|
3271
|
-
zoom:
|
|
3271
|
+
center: M = [104, 36],
|
|
3272
|
+
zoom: k = 4,
|
|
3273
|
+
terrainUrl: z = null
|
|
3272
3274
|
} = a;
|
|
3273
|
-
return this._apiUrl = y.replace(/\/$/, ""), this._spriteUrl = (x ?? y).replace(/\/$/, ""), this._theme = g, this._period =
|
|
3275
|
+
return this._apiUrl = y.replace(/\/$/, ""), this._spriteUrl = (x ?? y).replace(/\/$/, ""), this._terrainUrl = z ?? `${this._apiUrl}/api/terrain/{z}/{x}/{y}.png`, this._theme = g, this._period = b, this._center = M, this._zoom = k, this._ready = !1, this._layerVisible = {
|
|
3274
3276
|
// aviation groups — all visible by default
|
|
3275
3277
|
adiz: !0,
|
|
3276
3278
|
fir: !0,
|
|
@@ -3290,11 +3292,11 @@ class ri {
|
|
|
3290
3292
|
// user overrides
|
|
3291
3293
|
...S
|
|
3292
3294
|
}, this._initMap(u), new Proxy(this, {
|
|
3293
|
-
get(
|
|
3294
|
-
var
|
|
3295
|
-
if (
|
|
3296
|
-
const
|
|
3297
|
-
return typeof
|
|
3295
|
+
get(p, _, v) {
|
|
3296
|
+
var A;
|
|
3297
|
+
if (_ in p) return Reflect.get(p, _, v);
|
|
3298
|
+
const D = (A = p._map) == null ? void 0 : A[_];
|
|
3299
|
+
return typeof D == "function" ? D.bind(p._map) : D;
|
|
3298
3300
|
}
|
|
3299
3301
|
});
|
|
3300
3302
|
}
|
|
@@ -3352,13 +3354,13 @@ class ri {
|
|
|
3352
3354
|
maxzoom: 18
|
|
3353
3355
|
}), this._map.addSource("terrain", {
|
|
3354
3356
|
type: "raster-dem",
|
|
3355
|
-
tiles: [
|
|
3357
|
+
tiles: [this._terrainUrl],
|
|
3356
3358
|
tileSize: 256,
|
|
3357
3359
|
encoding: "mapbox",
|
|
3358
3360
|
maxzoom: 8
|
|
3359
3361
|
});
|
|
3360
3362
|
const a = new Be.DemSource({
|
|
3361
|
-
url:
|
|
3363
|
+
url: this._terrainUrl,
|
|
3362
3364
|
encoding: "mapbox",
|
|
3363
3365
|
maxzoom: 8,
|
|
3364
3366
|
worker: !0
|
|
@@ -3383,11 +3385,11 @@ class ri {
|
|
|
3383
3385
|
async _loadBaseData() {
|
|
3384
3386
|
var a, u, g, y;
|
|
3385
3387
|
try {
|
|
3386
|
-
const [x,
|
|
3388
|
+
const [x, b] = await Promise.all([
|
|
3387
3389
|
Qt(`${this._apiUrl}/topjson/land.topojson.gz`),
|
|
3388
3390
|
Qt(`${this._apiUrl}/topjson/boundary.topojson.gz`)
|
|
3389
3391
|
]);
|
|
3390
|
-
(a = x == null ? void 0 : x.objects) != null && a.land ? (u = this._map.getSource("land")) == null || u.setData($t(x, x.objects.land)) : console.warn("[AviationChart] land topojson missing objects.land"), (g =
|
|
3392
|
+
(a = x == null ? void 0 : x.objects) != null && a.land ? (u = this._map.getSource("land")) == null || u.setData($t(x, x.objects.land)) : console.warn("[AviationChart] land topojson missing objects.land"), (g = b == null ? void 0 : b.objects) != null && g.boundary ? (y = this._map.getSource("boundary")) == null || y.setData($t(b, b.objects.boundary)) : console.warn("[AviationChart] boundary topojson missing objects.boundary");
|
|
3391
3393
|
} catch (x) {
|
|
3392
3394
|
console.error("[AviationChart] loadBaseData failed:", x);
|
|
3393
3395
|
}
|
|
@@ -3451,9 +3453,9 @@ class ri {
|
|
|
3451
3453
|
}
|
|
3452
3454
|
_applyVisibility() {
|
|
3453
3455
|
for (const [y, x] of Object.entries(Ct)) {
|
|
3454
|
-
const
|
|
3456
|
+
const b = this._layerVisible[y] !== !1 ? "visible" : "none";
|
|
3455
3457
|
for (const S of x)
|
|
3456
|
-
this._map.getLayer(S) && this._map.setLayoutProperty(S, "visibility",
|
|
3458
|
+
this._map.getLayer(S) && this._map.setLayoutProperty(S, "visibility", b);
|
|
3457
3459
|
}
|
|
3458
3460
|
const a = this._layerVisible.amm !== !1 ? "visible" : "none";
|
|
3459
3461
|
for (const y of Pt)
|
|
@@ -3515,21 +3517,21 @@ class ri {
|
|
|
3515
3517
|
setLayerVisible(a, u) {
|
|
3516
3518
|
if (this._layerVisible[a] = u, a === "terrain") {
|
|
3517
3519
|
const x = u ? "visible" : "none";
|
|
3518
|
-
for (const
|
|
3519
|
-
this._map.getLayer(
|
|
3520
|
+
for (const b of Zt)
|
|
3521
|
+
this._map.getLayer(b) && this._map.setLayoutProperty(b, "visibility", x);
|
|
3520
3522
|
this._map.setTerrain(u ? { source: "terrain", exaggeration: 4 } : null);
|
|
3521
3523
|
return;
|
|
3522
3524
|
}
|
|
3523
3525
|
if (a === "contour") {
|
|
3524
3526
|
const x = u ? "visible" : "none";
|
|
3525
|
-
for (const
|
|
3526
|
-
this._map.getLayer(
|
|
3527
|
+
for (const b of Jt)
|
|
3528
|
+
this._map.getLayer(b) && this._map.setLayoutProperty(b, "visibility", x);
|
|
3527
3529
|
return;
|
|
3528
3530
|
}
|
|
3529
3531
|
if (a === "amm") {
|
|
3530
3532
|
const x = u ? "visible" : "none";
|
|
3531
|
-
for (const
|
|
3532
|
-
this._map.getLayer(
|
|
3533
|
+
for (const b of Pt)
|
|
3534
|
+
this._map.getLayer(b) && this._map.setLayoutProperty(b, "visibility", x);
|
|
3533
3535
|
return;
|
|
3534
3536
|
}
|
|
3535
3537
|
const g = Ct[a];
|