aviation-chart 0.1.18 → 0.1.20
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 +187 -177
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,8 +6,8 @@ function Mt(o, a) {
|
|
|
6
6
|
else if (!Rt)
|
|
7
7
|
Rt = a;
|
|
8
8
|
else {
|
|
9
|
-
var u = "var sharedChunk = {}; (" + vt + ")(sharedChunk); (" + Rt + ")(sharedChunk);",
|
|
10
|
-
vt(
|
|
9
|
+
var u = "var sharedChunk = {}; (" + vt + ")(sharedChunk); (" + Rt + ")(sharedChunk);", w = {};
|
|
10
|
+
vt(w), Ot = a(w), typeof window < "u" && (Ot.workerUrl = window.URL.createObjectURL(
|
|
11
11
|
new Blob([u], { type: "text/javascript" })
|
|
12
12
|
));
|
|
13
13
|
}
|
|
@@ -132,20 +132,20 @@ Mt(["exports"], function(o) {
|
|
|
132
132
|
],
|
|
133
133
|
[]
|
|
134
134
|
];
|
|
135
|
-
function
|
|
135
|
+
function w(t, e, i, n) {
|
|
136
136
|
return e = e * 2 + n[0], i = i * 2 + n[1], e + i * (t + 1) * 2;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function x(t, e, i) {
|
|
139
139
|
return (e - t) / (i - t);
|
|
140
140
|
}
|
|
141
|
-
function
|
|
141
|
+
function g(t, e, i = 4096, n = 1) {
|
|
142
142
|
if (!t)
|
|
143
143
|
return {};
|
|
144
144
|
const r = i / (e.width - 1);
|
|
145
145
|
let l, s, c, m, f, h;
|
|
146
|
-
const d = {},
|
|
146
|
+
const d = {}, _ = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map();
|
|
147
147
|
function P(O, I, R) {
|
|
148
|
-
O[0] === 0 ? R(r * (h - 1), r * (f -
|
|
148
|
+
O[0] === 0 ? R(r * (h - 1), r * (f - x(c, I, l))) : O[0] === 2 ? R(r * h, r * (f - x(m, I, s))) : O[1] === 0 ? R(r * (h - x(s, I, l)), r * (f - 1)) : R(r * (h - x(m, I, c)), r * f);
|
|
149
149
|
}
|
|
150
150
|
for (f = 1 - n; f < e.height + n; f++) {
|
|
151
151
|
s = e.get(0, f - 1), m = e.get(0, f);
|
|
@@ -159,11 +159,11 @@ Mt(["exports"], function(o) {
|
|
|
159
159
|
for (let C = X; C <= ot; C += t) {
|
|
160
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 =
|
|
163
|
-
Y ||
|
|
162
|
+
let Y = _.get(C);
|
|
163
|
+
Y || _.set(C, Y = /* @__PURE__ */ new Map());
|
|
164
164
|
let lt = F.get(C);
|
|
165
165
|
lt || F.set(C, lt = /* @__PURE__ */ new Map());
|
|
166
|
-
const kt = bt[0], zt = bt[1], yt =
|
|
166
|
+
const kt = bt[0], zt = bt[1], yt = w(e.width, h, f, kt), st = w(e.width, h, f, zt);
|
|
167
167
|
let L, Tt;
|
|
168
168
|
if (L = lt.get(yt))
|
|
169
169
|
if (lt.delete(yt), Tt = Y.get(st))
|
|
@@ -186,7 +186,7 @@ Mt(["exports"], function(o) {
|
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
-
for (const [O, I] of
|
|
189
|
+
for (const [O, I] of _.entries()) {
|
|
190
190
|
let R = null;
|
|
191
191
|
for (const V of I.values())
|
|
192
192
|
V.isEmpty() || (R == null && (R = d[O] || (d[O] = [])), R.push(V.lineString()));
|
|
@@ -226,7 +226,7 @@ Mt(["exports"], function(o) {
|
|
|
226
226
|
function p(t) {
|
|
227
227
|
return b(t).map(([e, i]) => `${encodeURIComponent(e)}=${encodeURIComponent(i)}`).join(",");
|
|
228
228
|
}
|
|
229
|
-
function
|
|
229
|
+
function y(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]) => {
|
|
@@ -237,7 +237,7 @@ Mt(["exports"], function(o) {
|
|
|
237
237
|
...n
|
|
238
238
|
};
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function T(t) {
|
|
241
241
|
const e = new ArrayBuffer(t.byteLength);
|
|
242
242
|
return new Uint8Array(e).set(new Uint8Array(t)), e;
|
|
243
243
|
}
|
|
@@ -249,7 +249,7 @@ Mt(["exports"], function(o) {
|
|
|
249
249
|
}
|
|
250
250
|
function A(t) {
|
|
251
251
|
return t.then(({ arrayBuffer: e }) => {
|
|
252
|
-
const i =
|
|
252
|
+
const i = T(e);
|
|
253
253
|
return {
|
|
254
254
|
arrayBuffer: i,
|
|
255
255
|
transferrables: [i]
|
|
@@ -357,9 +357,9 @@ Mt(["exports"], function(o) {
|
|
|
357
357
|
throw new Error(`Unrecognized format: ${c == null ? void 0 : c.format}`);
|
|
358
358
|
const f = (l = c == null ? void 0 : c.format) === null || l === void 0 ? void 0 : l.startsWith("BGR"), h = c.allocationSize(), d = new Uint8ClampedArray(h);
|
|
359
359
|
if (await c.copyTo(d), f)
|
|
360
|
-
for (let
|
|
361
|
-
const F = d[
|
|
362
|
-
d[
|
|
360
|
+
for (let _ = 0; _ < d.length; _ += 4) {
|
|
361
|
+
const F = d[_];
|
|
362
|
+
d[_] = d[_ + 2], d[_ + 2] = F;
|
|
363
363
|
}
|
|
364
364
|
return Dt(s.width, s.height, e, d);
|
|
365
365
|
} catch {
|
|
@@ -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, f) => {
|
|
424
|
-
const h = m / r - s, d = f / r - s,
|
|
424
|
+
const h = m / r - s, d = f / r - s, _ = Math.floor(h), F = Math.floor(d), P = this.get(_, F), O = this.get(_ + 1, F), I = this.get(_, F + 1), R = this.get(_ + 1, F + 1), V = h - _, 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);
|
|
@@ -474,10 +474,10 @@ Mt(["exports"], function(o) {
|
|
|
474
474
|
var Et = {};
|
|
475
475
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
476
476
|
Et.read = function(t, e, i, n, r) {
|
|
477
|
-
var l, s, c = r * 8 - n - 1, m = (1 << c) - 1, f = m >> 1, h = -7, d = i ? r - 1 : 0,
|
|
478
|
-
for (d +=
|
|
477
|
+
var l, s, c = r * 8 - n - 1, m = (1 << c) - 1, f = m >> 1, h = -7, d = i ? r - 1 : 0, _ = i ? -1 : 1, F = t[e + d];
|
|
478
|
+
for (d += _, l = F & (1 << -h) - 1, F >>= -h, h += c; h > 0; l = l * 256 + t[e + d], d += _, h -= 8)
|
|
479
479
|
;
|
|
480
|
-
for (s = l & (1 << -h) - 1, l >>= -h, h += n; h > 0; s = s * 256 + t[e + d], d +=
|
|
480
|
+
for (s = l & (1 << -h) - 1, l >>= -h, h += n; h > 0; s = s * 256 + t[e + d], d += _, h -= 8)
|
|
481
481
|
;
|
|
482
482
|
if (l === 0)
|
|
483
483
|
l = 1 - f;
|
|
@@ -488,20 +488,20 @@ 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, f = l * 8 - r - 1, h = (1 << f) - 1, d = h >> 1,
|
|
492
|
-
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (c = isNaN(e) ? 1 : 0, s = h) : (s = Math.floor(Math.log(e) / Math.LN2), e * (m = Math.pow(2, -s)) < 1 && (s--, m *= 2), s + d >= 1 ? e +=
|
|
491
|
+
var s, c, m, f = l * 8 - r - 1, h = (1 << f) - 1, d = h >> 1, _ = 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 = h) : (s = Math.floor(Math.log(e) / Math.LN2), e * (m = Math.pow(2, -s)) < 1 && (s--, m *= 2), s + d >= 1 ? e += _ / m : e += _ * Math.pow(2, 1 - d), e * m >= 2 && (s++, m /= 2), s + d >= h ? (c = 0, s = h) : 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
494
|
for (s = s << r | c, f += r; f > 0; t[i + F] = s & 255, F += P, s /= 256, f -= 8)
|
|
495
495
|
;
|
|
496
496
|
t[i + F - P] |= O * 128;
|
|
497
497
|
};
|
|
498
|
-
var ne =
|
|
499
|
-
function
|
|
498
|
+
var ne = v, gt = Et;
|
|
499
|
+
function v(t) {
|
|
500
500
|
this.buf = ArrayBuffer.isView && ArrayBuffer.isView(t) ? t : new Uint8Array(t || 0), this.pos = 0, this.type = 0, this.length = this.buf.length;
|
|
501
501
|
}
|
|
502
|
-
|
|
502
|
+
v.Varint = 0, v.Fixed64 = 1, v.Bytes = 2, v.Fixed32 = 5;
|
|
503
503
|
var Ft = 65536 * 65536, Gt = 1 / Ft, le = 12, Bt = typeof TextDecoder > "u" ? null : new TextDecoder("utf8");
|
|
504
|
-
|
|
504
|
+
v.prototype = {
|
|
505
505
|
destroy: function() {
|
|
506
506
|
this.buf = null;
|
|
507
507
|
},
|
|
@@ -565,66 +565,66 @@ Mt(["exports"], function(o) {
|
|
|
565
565
|
},
|
|
566
566
|
// verbose for performance reasons; doesn't affect gzipped size
|
|
567
567
|
readPackedVarint: function(t, e) {
|
|
568
|
-
if (this.type !==
|
|
568
|
+
if (this.type !== v.Bytes) return t.push(this.readVarint(e));
|
|
569
569
|
var i = J(this);
|
|
570
570
|
for (t = t || []; this.pos < i; ) t.push(this.readVarint(e));
|
|
571
571
|
return t;
|
|
572
572
|
},
|
|
573
573
|
readPackedSVarint: function(t) {
|
|
574
|
-
if (this.type !==
|
|
574
|
+
if (this.type !== v.Bytes) return t.push(this.readSVarint());
|
|
575
575
|
var e = J(this);
|
|
576
576
|
for (t = t || []; this.pos < e; ) t.push(this.readSVarint());
|
|
577
577
|
return t;
|
|
578
578
|
},
|
|
579
579
|
readPackedBoolean: function(t) {
|
|
580
|
-
if (this.type !==
|
|
580
|
+
if (this.type !== v.Bytes) return t.push(this.readBoolean());
|
|
581
581
|
var e = J(this);
|
|
582
582
|
for (t = t || []; this.pos < e; ) t.push(this.readBoolean());
|
|
583
583
|
return t;
|
|
584
584
|
},
|
|
585
585
|
readPackedFloat: function(t) {
|
|
586
|
-
if (this.type !==
|
|
586
|
+
if (this.type !== v.Bytes) return t.push(this.readFloat());
|
|
587
587
|
var e = J(this);
|
|
588
588
|
for (t = t || []; this.pos < e; ) t.push(this.readFloat());
|
|
589
589
|
return t;
|
|
590
590
|
},
|
|
591
591
|
readPackedDouble: function(t) {
|
|
592
|
-
if (this.type !==
|
|
592
|
+
if (this.type !== v.Bytes) return t.push(this.readDouble());
|
|
593
593
|
var e = J(this);
|
|
594
594
|
for (t = t || []; this.pos < e; ) t.push(this.readDouble());
|
|
595
595
|
return t;
|
|
596
596
|
},
|
|
597
597
|
readPackedFixed32: function(t) {
|
|
598
|
-
if (this.type !==
|
|
598
|
+
if (this.type !== v.Bytes) return t.push(this.readFixed32());
|
|
599
599
|
var e = J(this);
|
|
600
600
|
for (t = t || []; this.pos < e; ) t.push(this.readFixed32());
|
|
601
601
|
return t;
|
|
602
602
|
},
|
|
603
603
|
readPackedSFixed32: function(t) {
|
|
604
|
-
if (this.type !==
|
|
604
|
+
if (this.type !== v.Bytes) return t.push(this.readSFixed32());
|
|
605
605
|
var e = J(this);
|
|
606
606
|
for (t = t || []; this.pos < e; ) t.push(this.readSFixed32());
|
|
607
607
|
return t;
|
|
608
608
|
},
|
|
609
609
|
readPackedFixed64: function(t) {
|
|
610
|
-
if (this.type !==
|
|
610
|
+
if (this.type !== v.Bytes) return t.push(this.readFixed64());
|
|
611
611
|
var e = J(this);
|
|
612
612
|
for (t = t || []; this.pos < e; ) t.push(this.readFixed64());
|
|
613
613
|
return t;
|
|
614
614
|
},
|
|
615
615
|
readPackedSFixed64: function(t) {
|
|
616
|
-
if (this.type !==
|
|
616
|
+
if (this.type !== v.Bytes) return t.push(this.readSFixed64());
|
|
617
617
|
var e = J(this);
|
|
618
618
|
for (t = t || []; this.pos < e; ) t.push(this.readSFixed64());
|
|
619
619
|
return t;
|
|
620
620
|
},
|
|
621
621
|
skip: function(t) {
|
|
622
622
|
var e = t & 7;
|
|
623
|
-
if (e ===
|
|
623
|
+
if (e === v.Varint) for (; this.buf[this.pos++] > 127; )
|
|
624
624
|
;
|
|
625
|
-
else if (e ===
|
|
626
|
-
else if (e ===
|
|
627
|
-
else if (e ===
|
|
625
|
+
else if (e === v.Bytes) this.pos = this.readVarint() + this.pos;
|
|
626
|
+
else if (e === v.Fixed32) this.pos += 4;
|
|
627
|
+
else if (e === v.Fixed64) this.pos += 8;
|
|
628
628
|
else throw new Error("Unimplemented type: " + e);
|
|
629
629
|
},
|
|
630
630
|
// === WRITING =================================================================
|
|
@@ -692,7 +692,7 @@ Mt(["exports"], function(o) {
|
|
|
692
692
|
n >= 128 && Xt(i, n, this), this.pos = i - 1, this.writeVarint(n), this.pos += n;
|
|
693
693
|
},
|
|
694
694
|
writeMessage: function(t, e, i) {
|
|
695
|
-
this.writeTag(t,
|
|
695
|
+
this.writeTag(t, v.Bytes), this.writeRawMessage(e, i);
|
|
696
696
|
},
|
|
697
697
|
writePackedVarint: function(t, e) {
|
|
698
698
|
e.length && this.writeMessage(t, he, e);
|
|
@@ -722,34 +722,34 @@ Mt(["exports"], function(o) {
|
|
|
722
722
|
e.length && this.writeMessage(t, _e, e);
|
|
723
723
|
},
|
|
724
724
|
writeBytesField: function(t, e) {
|
|
725
|
-
this.writeTag(t,
|
|
725
|
+
this.writeTag(t, v.Bytes), this.writeBytes(e);
|
|
726
726
|
},
|
|
727
727
|
writeFixed32Field: function(t, e) {
|
|
728
|
-
this.writeTag(t,
|
|
728
|
+
this.writeTag(t, v.Fixed32), this.writeFixed32(e);
|
|
729
729
|
},
|
|
730
730
|
writeSFixed32Field: function(t, e) {
|
|
731
|
-
this.writeTag(t,
|
|
731
|
+
this.writeTag(t, v.Fixed32), this.writeSFixed32(e);
|
|
732
732
|
},
|
|
733
733
|
writeFixed64Field: function(t, e) {
|
|
734
|
-
this.writeTag(t,
|
|
734
|
+
this.writeTag(t, v.Fixed64), this.writeFixed64(e);
|
|
735
735
|
},
|
|
736
736
|
writeSFixed64Field: function(t, e) {
|
|
737
|
-
this.writeTag(t,
|
|
737
|
+
this.writeTag(t, v.Fixed64), this.writeSFixed64(e);
|
|
738
738
|
},
|
|
739
739
|
writeVarintField: function(t, e) {
|
|
740
|
-
this.writeTag(t,
|
|
740
|
+
this.writeTag(t, v.Varint), this.writeVarint(e);
|
|
741
741
|
},
|
|
742
742
|
writeSVarintField: function(t, e) {
|
|
743
|
-
this.writeTag(t,
|
|
743
|
+
this.writeTag(t, v.Varint), this.writeSVarint(e);
|
|
744
744
|
},
|
|
745
745
|
writeStringField: function(t, e) {
|
|
746
|
-
this.writeTag(t,
|
|
746
|
+
this.writeTag(t, v.Bytes), this.writeString(e);
|
|
747
747
|
},
|
|
748
748
|
writeFloatField: function(t, e) {
|
|
749
|
-
this.writeTag(t,
|
|
749
|
+
this.writeTag(t, v.Fixed32), this.writeFloat(e);
|
|
750
750
|
},
|
|
751
751
|
writeDoubleField: function(t, e) {
|
|
752
|
-
this.writeTag(t,
|
|
752
|
+
this.writeTag(t, v.Fixed64), this.writeDouble(e);
|
|
753
753
|
},
|
|
754
754
|
writeBooleanField: function(t, e) {
|
|
755
755
|
this.writeVarintField(t, !!e);
|
|
@@ -761,7 +761,7 @@ Mt(["exports"], function(o) {
|
|
|
761
761
|
throw new Error("Expected varint not more than 10 bytes");
|
|
762
762
|
}
|
|
763
763
|
function J(t) {
|
|
764
|
-
return t.type ===
|
|
764
|
+
return t.type === v.Bytes ? t.readVarint() + t.pos : t.pos + 1;
|
|
765
765
|
}
|
|
766
766
|
function mt(t, e, i) {
|
|
767
767
|
return i ? e * 4294967296 + (t >>> 0) : (e >>> 0) * 4294967296 + (t >>> 0);
|
|
@@ -898,8 +898,8 @@ Mt(["exports"], function(o) {
|
|
|
898
898
|
const h = typeof m;
|
|
899
899
|
h !== "string" && h !== "boolean" && h !== "number" && (m = JSON.stringify(m));
|
|
900
900
|
const d = `${h}:${m}`;
|
|
901
|
-
let
|
|
902
|
-
typeof
|
|
901
|
+
let _ = s[d];
|
|
902
|
+
typeof _ > "u" && (r.push(m), _ = r.length - 1, s[d] = _), e.writeVarint(_);
|
|
903
903
|
}
|
|
904
904
|
}
|
|
905
905
|
function St(t, e) {
|
|
@@ -919,8 +919,8 @@ Mt(["exports"], function(o) {
|
|
|
919
919
|
const m = s.length / 2, f = n === ht.POLYGON ? m - 1 : m;
|
|
920
920
|
for (let h = 0; h < f; h++) {
|
|
921
921
|
h === 1 && n !== 1 && e.writeVarint(St(2, f - 1));
|
|
922
|
-
const d = s[h * 2] - r,
|
|
923
|
-
e.writeVarint(Vt(d)), e.writeVarint(Vt(
|
|
922
|
+
const d = s[h * 2] - r, _ = s[h * 2 + 1] - l;
|
|
923
|
+
e.writeVarint(Vt(d)), e.writeVarint(Vt(_)), r += d, l += _;
|
|
924
924
|
}
|
|
925
925
|
n === ht.POLYGON && e.writeVarint(St(7, 1));
|
|
926
926
|
}
|
|
@@ -933,8 +933,8 @@ Mt(["exports"], function(o) {
|
|
|
933
933
|
class Re {
|
|
934
934
|
constructor(e, i, n, r, l) {
|
|
935
935
|
this.loaded = Promise.resolve(), this.decodeImage = It, this.fetchAndParseTile = (s, c, m, f, h) => {
|
|
936
|
-
const d = this,
|
|
937
|
-
return h == null || h.useTile(
|
|
936
|
+
const d = this, _ = this.demUrlPattern.replace("{z}", s.toString()).replace("{x}", c.toString()).replace("{y}", m.toString());
|
|
937
|
+
return h == null || h.useTile(_), this.parsedCache.get(_, async (F, P) => {
|
|
938
938
|
const O = await d.fetchTile(s, c, m, P, h);
|
|
939
939
|
if (B(P))
|
|
940
940
|
throw new Error("canceled");
|
|
@@ -963,11 +963,11 @@ Mt(["exports"], function(o) {
|
|
|
963
963
|
}, r);
|
|
964
964
|
}
|
|
965
965
|
async fetchDem(e, i, n, r, l, s) {
|
|
966
|
-
const c = Math.min(e - (r.overzoom || 0), this.maxzoom), m = e - c, f = 1 << m, h = Math.floor(i / f), d = Math.floor(n / f),
|
|
967
|
-
return $.fromRawDem(
|
|
966
|
+
const c = Math.min(e - (r.overzoom || 0), this.maxzoom), m = e - c, f = 1 << m, h = Math.floor(i / f), d = Math.floor(n / f), _ = await this.fetchAndParseTile(c, h, d, l, s);
|
|
967
|
+
return $.fromRawDem(_).split(m, i % f, n % f);
|
|
968
968
|
}
|
|
969
969
|
fetchContourTile(e, i, n, r, l, s) {
|
|
970
|
-
const { levels: c, multiplier: m = 1, buffer: f = 1, extent: h = 4096, contourLayer: d = "contours", elevationKey:
|
|
970
|
+
const { levels: c, multiplier: m = 1, buffer: f = 1, extent: h = 4096, contourLayer: d = "contours", elevationKey: _ = "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
973
|
const O = [e, i, n, p(r)].join("/");
|
|
@@ -987,7 +987,7 @@ Mt(["exports"], function(o) {
|
|
|
987
987
|
for (; X.width < P; )
|
|
988
988
|
X = X.subsamplePixelCenters(2).materialize(2);
|
|
989
989
|
X = X.averagePixelCentersToGrid().scaleElevation(m).materialize(1);
|
|
990
|
-
const C =
|
|
990
|
+
const C = g(c[0], X, h, f);
|
|
991
991
|
ot == null || ot();
|
|
992
992
|
const At = De({
|
|
993
993
|
extent: h,
|
|
@@ -999,7 +999,7 @@ Mt(["exports"], function(o) {
|
|
|
999
999
|
type: ht.LINESTRING,
|
|
1000
1000
|
geometry: nt,
|
|
1001
1001
|
properties: {
|
|
1002
|
-
[
|
|
1002
|
+
[_]: _t,
|
|
1003
1003
|
[F]: Math.max(...c.map((bt, Y) => _t % bt === 0 ? Y : 0))
|
|
1004
1004
|
}
|
|
1005
1005
|
};
|
|
@@ -1030,7 +1030,7 @@ Mt(["exports"], function(o) {
|
|
|
1030
1030
|
this.marks = {}, this.urls = [], this.fetched = [], this.resources = [], this.tilesFetched = 0, this.timeOrigin = Ce, this.finish = (i) => {
|
|
1031
1031
|
this.markFinish();
|
|
1032
1032
|
const n = (m) => {
|
|
1033
|
-
const f = this.marks[m] || [], h = Math.max(...f.map((
|
|
1033
|
+
const f = this.marks[m] || [], h = Math.max(...f.map((_) => Math.max(..._))), d = Math.min(...f.map((_) => Math.min(..._)));
|
|
1034
1034
|
return Number.isFinite(h) ? h - d : void 0;
|
|
1035
1035
|
}, r = n("main") || 0, l = n("fetch"), s = n("decode"), c = n("isoline");
|
|
1036
1036
|
return {
|
|
@@ -1096,13 +1096,13 @@ Mt(["exports"], function(o) {
|
|
|
1096
1096
|
if (l.id && f) {
|
|
1097
1097
|
this.cancels[l.id] = m;
|
|
1098
1098
|
try {
|
|
1099
|
-
const d = await f,
|
|
1099
|
+
const d = await f, _ = d == null ? void 0 : d.transferrables;
|
|
1100
1100
|
this.postMessage({
|
|
1101
1101
|
id: l.id,
|
|
1102
1102
|
type: "response",
|
|
1103
1103
|
response: d,
|
|
1104
1104
|
timings: s.finish(h)
|
|
1105
|
-
},
|
|
1105
|
+
}, _);
|
|
1106
1106
|
} catch (d) {
|
|
1107
1107
|
this.postMessage({
|
|
1108
1108
|
id: l.id,
|
|
@@ -1122,8 +1122,8 @@ Mt(["exports"], function(o) {
|
|
|
1122
1122
|
/** Invokes a method by name with a set of arguments in the remote context. */
|
|
1123
1123
|
send(e, i, n, r, ...l) {
|
|
1124
1124
|
const s = ++Le, c = new Promise((m, f) => {
|
|
1125
|
-
this.postMessage({ id: s, type: "request", name: e, args: l }, i), this.callbacks[s] = (h, d,
|
|
1126
|
-
r == null || r.addAll(
|
|
1125
|
+
this.postMessage({ id: s, type: "request", name: e, args: l }, i), this.callbacks[s] = (h, d, _) => {
|
|
1126
|
+
r == null || r.addAll(_), h ? f(h) : m(d);
|
|
1127
1127
|
};
|
|
1128
1128
|
});
|
|
1129
1129
|
return U(n, () => {
|
|
@@ -1131,49 +1131,49 @@ 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 = z, o.b =
|
|
1134
|
+
o.A = Ge, o.H = $, o.L = Re, o.T = Wt, o.a = z, o.b = g, o.c = Dt, o.d = It, o.e = k, o.f = A, o.g = y, o.p = D;
|
|
1135
1135
|
});
|
|
1136
1136
|
Mt(["./shared"], function(o) {
|
|
1137
|
-
const a = (
|
|
1137
|
+
const a = (x) => Promise.reject(new Error(`No manager registered for ${x}`));
|
|
1138
1138
|
class u {
|
|
1139
1139
|
constructor() {
|
|
1140
|
-
this.managers = {}, this.init = (
|
|
1140
|
+
this.managers = {}, this.init = (g, b) => (this.managers[g.managerId] = new o.L(g.demUrlPattern, g.cacheSize, g.encoding, g.maxzoom, g.timeoutMs), Promise.resolve()), this.fetchTile = (g, b, S, M, k, z) => {
|
|
1141
1141
|
var p;
|
|
1142
|
-
return ((p = this.managers[
|
|
1143
|
-
}, this.fetchAndParseTile = (
|
|
1142
|
+
return ((p = this.managers[g]) === null || p === void 0 ? void 0 : p.fetchTile(b, S, M, k, z)) || a(g);
|
|
1143
|
+
}, this.fetchAndParseTile = (g, b, S, M, k, z) => {
|
|
1144
1144
|
var p;
|
|
1145
|
-
return o.p(((p = this.managers[
|
|
1146
|
-
}, this.fetchContourTile = (
|
|
1147
|
-
var
|
|
1148
|
-
return o.f(((
|
|
1145
|
+
return o.p(((p = this.managers[g]) === null || p === void 0 ? void 0 : p.fetchAndParseTile(b, S, M, k, z)) || a(g), !0);
|
|
1146
|
+
}, this.fetchContourTile = (g, b, S, M, k, z, p) => {
|
|
1147
|
+
var y;
|
|
1148
|
+
return o.f(((y = this.managers[g]) === null || y === void 0 ? void 0 : y.fetchContourTile(b, S, M, k, z, p)) || a(g));
|
|
1149
1149
|
};
|
|
1150
1150
|
}
|
|
1151
1151
|
}
|
|
1152
|
-
const
|
|
1153
|
-
|
|
1152
|
+
const w = typeof self < "u" ? self : typeof window < "u" ? window : global;
|
|
1153
|
+
w.actor = new o.A(w, new u());
|
|
1154
1154
|
});
|
|
1155
1155
|
Mt(["./shared"], function(o) {
|
|
1156
1156
|
const a = { workerUrl: "" };
|
|
1157
|
-
let u,
|
|
1158
|
-
class
|
|
1157
|
+
let u, w = 0;
|
|
1158
|
+
class x {
|
|
1159
1159
|
constructor() {
|
|
1160
|
-
this.decodeImage = (
|
|
1160
|
+
this.decodeImage = (y, T, D) => o.p(o.d(y, T, D), !1);
|
|
1161
1161
|
}
|
|
1162
1162
|
}
|
|
1163
|
-
function
|
|
1163
|
+
function g() {
|
|
1164
1164
|
if (!u) {
|
|
1165
|
-
const p = new Worker(a.workerUrl),
|
|
1166
|
-
u = new o.A(p,
|
|
1165
|
+
const p = new Worker(a.workerUrl), y = new x();
|
|
1166
|
+
u = new o.A(p, y);
|
|
1167
1167
|
}
|
|
1168
1168
|
return u;
|
|
1169
1169
|
}
|
|
1170
1170
|
class b {
|
|
1171
|
-
constructor(
|
|
1171
|
+
constructor(y, T, 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
|
-
const tt = this.managerId = ++
|
|
1174
|
-
this.actor = ct ||
|
|
1175
|
-
cacheSize:
|
|
1176
|
-
demUrlPattern:
|
|
1173
|
+
const tt = this.managerId = ++w;
|
|
1174
|
+
this.actor = ct || g(), this.loaded = this.actor.send("init", [], new AbortController(), void 0, {
|
|
1175
|
+
cacheSize: T,
|
|
1176
|
+
demUrlPattern: y,
|
|
1177
1177
|
encoding: D,
|
|
1178
1178
|
maxzoom: A,
|
|
1179
1179
|
managerId: tt,
|
|
@@ -1182,24 +1182,24 @@ Mt(["./shared"], function(o) {
|
|
|
1182
1182
|
}
|
|
1183
1183
|
}
|
|
1184
1184
|
Blob.prototype.arrayBuffer || (Blob.prototype.arrayBuffer = function() {
|
|
1185
|
-
return new Promise((
|
|
1185
|
+
return new Promise((y, T) => {
|
|
1186
1186
|
const D = new FileReader();
|
|
1187
1187
|
D.onload = (A) => {
|
|
1188
1188
|
var j;
|
|
1189
|
-
return
|
|
1190
|
-
}, D.onerror =
|
|
1189
|
+
return y((j = A.target) === null || j === void 0 ? void 0 : j.result);
|
|
1190
|
+
}, D.onerror = T, D.readAsArrayBuffer(this);
|
|
1191
1191
|
});
|
|
1192
1192
|
});
|
|
1193
|
-
const S = (p) => (
|
|
1194
|
-
if (
|
|
1195
|
-
return p(
|
|
1193
|
+
const S = (p) => (y, T) => {
|
|
1194
|
+
if (T instanceof AbortController)
|
|
1195
|
+
return p(y, T);
|
|
1196
1196
|
{
|
|
1197
1197
|
const D = new AbortController();
|
|
1198
|
-
return p(
|
|
1198
|
+
return p(y, D).then((A) => T(void 0, A.data, A.cacheControl, A.expires), (A) => T(A)), { cancel: () => D.abort() };
|
|
1199
1199
|
}
|
|
1200
1200
|
}, M = /* @__PURE__ */ new Set();
|
|
1201
1201
|
class k {
|
|
1202
|
-
constructor({ url:
|
|
1202
|
+
constructor({ url: y, cacheSize: T = 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) => {
|
|
@@ -1236,14 +1236,14 @@ Mt(["./shared"], function(o) {
|
|
|
1236
1236
|
G = D + U++;
|
|
1237
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
1238
|
const B = ct ? b : o.L;
|
|
1239
|
-
this.manager = new B(
|
|
1239
|
+
this.manager = new B(y, T, A, j, tt, H);
|
|
1240
1240
|
}
|
|
1241
|
-
getDemTile(
|
|
1242
|
-
return this.manager.fetchAndParseTile(
|
|
1241
|
+
getDemTile(y, T, D, A) {
|
|
1242
|
+
return this.manager.fetchAndParseTile(y, T, D, A || new AbortController());
|
|
1243
1243
|
}
|
|
1244
|
-
parseUrl(
|
|
1245
|
-
const [,
|
|
1246
|
-
return [Number(
|
|
1244
|
+
parseUrl(y) {
|
|
1245
|
+
const [, T, D, A] = /\/\/(\d+)\/(\d+)\/(\d+)/.exec(y) || [];
|
|
1246
|
+
return [Number(T), Number(D), Number(A)];
|
|
1247
1247
|
}
|
|
1248
1248
|
}
|
|
1249
1249
|
return {
|
|
@@ -1266,16 +1266,16 @@ function Xe(o) {
|
|
|
1266
1266
|
}
|
|
1267
1267
|
function Ne(o) {
|
|
1268
1268
|
if (o == null) return Xe;
|
|
1269
|
-
var a, u,
|
|
1269
|
+
var a, u, w = o.scale[0], x = o.scale[1], g = o.translate[0], b = o.translate[1];
|
|
1270
1270
|
return function(S, M) {
|
|
1271
1271
|
M || (a = u = 0);
|
|
1272
1272
|
var k = 2, z = S.length, p = new Array(z);
|
|
1273
|
-
for (p[0] = (a += S[0]) *
|
|
1273
|
+
for (p[0] = (a += S[0]) * w + g, p[1] = (u += S[1]) * x + b; k < z; ) p[k] = S[k], ++k;
|
|
1274
1274
|
return p;
|
|
1275
1275
|
};
|
|
1276
1276
|
}
|
|
1277
1277
|
function Ve(o, a) {
|
|
1278
|
-
for (var u,
|
|
1278
|
+
for (var u, w = o.length, x = w - a; x < --w; ) u = o[x], o[x++] = o[w], o[w] = u;
|
|
1279
1279
|
}
|
|
1280
1280
|
function $t(o, a) {
|
|
1281
1281
|
return typeof a == "string" && (a = o.objects[a]), a.type === "GeometryCollection" ? { type: "FeatureCollection", features: a.geometries.map(function(u) {
|
|
@@ -1283,22 +1283,22 @@ function $t(o, a) {
|
|
|
1283
1283
|
}) } : Kt(o, a);
|
|
1284
1284
|
}
|
|
1285
1285
|
function Kt(o, a) {
|
|
1286
|
-
var u = a.id,
|
|
1287
|
-
return u == null &&
|
|
1286
|
+
var u = a.id, w = a.bbox, x = a.properties == null ? {} : a.properties, g = Ue(o, a);
|
|
1287
|
+
return u == null && w == null ? { type: "Feature", properties: x, geometry: g } : w == null ? { type: "Feature", id: u, properties: x, geometry: g } : { type: "Feature", id: u, bbox: w, properties: x, geometry: g };
|
|
1288
1288
|
}
|
|
1289
1289
|
function Ue(o, a) {
|
|
1290
|
-
var u = Ne(o.transform),
|
|
1291
|
-
function
|
|
1290
|
+
var u = Ne(o.transform), w = o.arcs;
|
|
1291
|
+
function x(z, p) {
|
|
1292
1292
|
p.length && p.pop();
|
|
1293
|
-
for (var
|
|
1294
|
-
p.push(u(
|
|
1293
|
+
for (var y = w[z < 0 ? ~z : z], T = 0, D = y.length; T < D; ++T)
|
|
1294
|
+
p.push(u(y[T], T));
|
|
1295
1295
|
z < 0 && Ve(p, D);
|
|
1296
1296
|
}
|
|
1297
|
-
function
|
|
1297
|
+
function g(z) {
|
|
1298
1298
|
return u(z);
|
|
1299
1299
|
}
|
|
1300
1300
|
function b(z) {
|
|
1301
|
-
for (var p = [],
|
|
1301
|
+
for (var p = [], y = 0, T = z.length; y < T; ++y) x(z[y], p);
|
|
1302
1302
|
return p.length < 2 && p.push(p[0]), p;
|
|
1303
1303
|
}
|
|
1304
1304
|
function S(z) {
|
|
@@ -1309,32 +1309,32 @@ function Ue(o, a) {
|
|
|
1309
1309
|
return z.map(S);
|
|
1310
1310
|
}
|
|
1311
1311
|
function k(z) {
|
|
1312
|
-
var p = z.type,
|
|
1312
|
+
var p = z.type, y;
|
|
1313
1313
|
switch (p) {
|
|
1314
1314
|
case "GeometryCollection":
|
|
1315
1315
|
return { type: p, geometries: z.geometries.map(k) };
|
|
1316
1316
|
case "Point":
|
|
1317
|
-
|
|
1317
|
+
y = g(z.coordinates);
|
|
1318
1318
|
break;
|
|
1319
1319
|
case "MultiPoint":
|
|
1320
|
-
|
|
1320
|
+
y = z.coordinates.map(g);
|
|
1321
1321
|
break;
|
|
1322
1322
|
case "LineString":
|
|
1323
|
-
|
|
1323
|
+
y = b(z.arcs);
|
|
1324
1324
|
break;
|
|
1325
1325
|
case "MultiLineString":
|
|
1326
|
-
|
|
1326
|
+
y = z.arcs.map(b);
|
|
1327
1327
|
break;
|
|
1328
1328
|
case "Polygon":
|
|
1329
|
-
|
|
1329
|
+
y = M(z.arcs);
|
|
1330
1330
|
break;
|
|
1331
1331
|
case "MultiPolygon":
|
|
1332
|
-
|
|
1332
|
+
y = 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: y };
|
|
1338
1338
|
}
|
|
1339
1339
|
return k(a);
|
|
1340
1340
|
}
|
|
@@ -3240,11 +3240,11 @@ const oi = {
|
|
|
3240
3240
|
async function Qt(o) {
|
|
3241
3241
|
const a = await fetch(o);
|
|
3242
3242
|
if (!a.ok) throw new Error(`fetch ${o} → ${a.status}`);
|
|
3243
|
-
const u = a.headers.get("Content-Encoding"),
|
|
3244
|
-
if (u === "gzip" ||
|
|
3243
|
+
const u = a.headers.get("Content-Encoding"), w = a.headers.get("Content-Type") || "";
|
|
3244
|
+
if (u === "gzip" || w.includes("json"))
|
|
3245
3245
|
return a.json();
|
|
3246
|
-
const
|
|
3247
|
-
return new Response(
|
|
3246
|
+
const x = a.body.pipeThrough(new DecompressionStream("gzip"));
|
|
3247
|
+
return new Response(x).json();
|
|
3248
3248
|
}
|
|
3249
3249
|
class ri {
|
|
3250
3250
|
/**
|
|
@@ -3262,16 +3262,16 @@ class ri {
|
|
|
3262
3262
|
constructor(a = {}) {
|
|
3263
3263
|
const {
|
|
3264
3264
|
container: u,
|
|
3265
|
-
theme:
|
|
3266
|
-
apiUrl:
|
|
3267
|
-
spriteUrl:
|
|
3265
|
+
theme: w = "light",
|
|
3266
|
+
apiUrl: x = ti,
|
|
3267
|
+
spriteUrl: g,
|
|
3268
3268
|
period: b = null,
|
|
3269
3269
|
layers: S = {},
|
|
3270
3270
|
center: M = [104, 36],
|
|
3271
3271
|
zoom: k = 4,
|
|
3272
3272
|
terrainUrl: z = null
|
|
3273
3273
|
} = a;
|
|
3274
|
-
return this._apiUrl =
|
|
3274
|
+
return this._apiUrl = x.replace(/\/$/, ""), this._spriteUrl = (g ?? x).replace(/\/$/, ""), this._terrainUrl = z ?? `${this._apiUrl}/api/terrain/{z}/{x}/{y}.png`, this._theme = w, this._period = b, this._center = M, this._zoom = k, this._ready = !1, this._layerVisible = {
|
|
3275
3275
|
// aviation groups — all visible by default
|
|
3276
3276
|
adiz: !0,
|
|
3277
3277
|
fir: !0,
|
|
@@ -3291,11 +3291,21 @@ class ri {
|
|
|
3291
3291
|
// user overrides
|
|
3292
3292
|
...S
|
|
3293
3293
|
}, this._initMap(u), new Proxy(this, {
|
|
3294
|
-
get(p,
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3294
|
+
get(p, y) {
|
|
3295
|
+
if (typeof y == "symbol" || Reflect.has(p, y)) {
|
|
3296
|
+
const A = p[y];
|
|
3297
|
+
return typeof A == "function" ? A.bind(p) : A;
|
|
3298
|
+
}
|
|
3299
|
+
const T = p._map;
|
|
3300
|
+
if (!T) return;
|
|
3301
|
+
const D = T[y];
|
|
3302
|
+
return typeof D == "function" ? D.bind(T) : D;
|
|
3303
|
+
},
|
|
3304
|
+
set(p, y, T) {
|
|
3305
|
+
return typeof y == "symbol" || Reflect.has(p, y) || !p._map ? p[y] = T : y in p._map ? p._map[y] = T : p[y] = T, !0;
|
|
3306
|
+
},
|
|
3307
|
+
has(p, y) {
|
|
3308
|
+
return Reflect.has(p, y) || (p._map ? y in p._map : !1);
|
|
3299
3309
|
}
|
|
3300
3310
|
});
|
|
3301
3311
|
}
|
|
@@ -3336,8 +3346,8 @@ class ri {
|
|
|
3336
3346
|
async _initSources() {
|
|
3337
3347
|
if (!this._period)
|
|
3338
3348
|
try {
|
|
3339
|
-
const
|
|
3340
|
-
this._period =
|
|
3349
|
+
const w = await (await fetch(`${this._apiUrl}/api/periods`)).json();
|
|
3350
|
+
this._period = w[w.length - 1];
|
|
3341
3351
|
} catch (u) {
|
|
3342
3352
|
console.warn("[AviationChart] fetchPeriods failed:", u), this._period = "latest";
|
|
3343
3353
|
}
|
|
@@ -3382,15 +3392,15 @@ class ri {
|
|
|
3382
3392
|
}), await this._loadBaseData();
|
|
3383
3393
|
}
|
|
3384
3394
|
async _loadBaseData() {
|
|
3385
|
-
var a, u,
|
|
3395
|
+
var a, u, w, x;
|
|
3386
3396
|
try {
|
|
3387
|
-
const [
|
|
3397
|
+
const [g, b] = await Promise.all([
|
|
3388
3398
|
Qt(`${this._apiUrl}/topjson/land.topojson.gz`),
|
|
3389
3399
|
Qt(`${this._apiUrl}/topjson/boundary.topojson.gz`)
|
|
3390
3400
|
]);
|
|
3391
|
-
(a =
|
|
3392
|
-
} catch (
|
|
3393
|
-
console.error("[AviationChart] loadBaseData failed:",
|
|
3401
|
+
(a = g == null ? void 0 : g.objects) != null && a.land ? (u = this._map.getSource("land")) == null || u.setData($t(g, g.objects.land)) : console.warn("[AviationChart] land topojson missing objects.land"), (w = b == null ? void 0 : b.objects) != null && w.boundary ? (x = this._map.getSource("boundary")) == null || x.setData($t(b, b.objects.boundary)) : console.warn("[AviationChart] boundary topojson missing objects.boundary");
|
|
3402
|
+
} catch (g) {
|
|
3403
|
+
console.error("[AviationChart] loadBaseData failed:", g);
|
|
3394
3404
|
}
|
|
3395
3405
|
}
|
|
3396
3406
|
_initLayers() {
|
|
@@ -3445,26 +3455,26 @@ class ri {
|
|
|
3445
3455
|
"text-halo-width": 1
|
|
3446
3456
|
}
|
|
3447
3457
|
}), this._layerVisible.terrain && this._map.setTerrain({ source: "terrain", exaggeration: 4 });
|
|
3448
|
-
for (const
|
|
3449
|
-
this._map.getLayer(
|
|
3450
|
-
for (const
|
|
3451
|
-
this._map.getLayer(
|
|
3458
|
+
for (const w of Yt(this._theme))
|
|
3459
|
+
this._map.getLayer(w.id) || this._map.addLayer(w);
|
|
3460
|
+
for (const w of Ht("amm", this._theme))
|
|
3461
|
+
this._map.getLayer(w.id) || this._map.addLayer(w, "fir-line");
|
|
3452
3462
|
}
|
|
3453
3463
|
_applyVisibility() {
|
|
3454
|
-
for (const [
|
|
3455
|
-
const b = this._layerVisible[
|
|
3456
|
-
for (const S of
|
|
3464
|
+
for (const [x, g] of Object.entries(Ct)) {
|
|
3465
|
+
const b = this._layerVisible[x] !== !1 ? "visible" : "none";
|
|
3466
|
+
for (const S of g)
|
|
3457
3467
|
this._map.getLayer(S) && this._map.setLayoutProperty(S, "visibility", b);
|
|
3458
3468
|
}
|
|
3459
3469
|
const a = this._layerVisible.amm !== !1 ? "visible" : "none";
|
|
3460
|
-
for (const
|
|
3461
|
-
this._map.getLayer(
|
|
3470
|
+
for (const x of Pt)
|
|
3471
|
+
this._map.getLayer(x) && this._map.setLayoutProperty(x, "visibility", a);
|
|
3462
3472
|
const u = this._layerVisible.terrain ? "visible" : "none";
|
|
3463
|
-
for (const
|
|
3464
|
-
this._map.getLayer(
|
|
3465
|
-
const
|
|
3466
|
-
for (const
|
|
3467
|
-
this._map.getLayer(
|
|
3473
|
+
for (const x of Zt)
|
|
3474
|
+
this._map.getLayer(x) && this._map.setLayoutProperty(x, "visibility", u);
|
|
3475
|
+
const w = this._layerVisible.contour ? "visible" : "none";
|
|
3476
|
+
for (const x of Jt)
|
|
3477
|
+
this._map.getLayer(x) && this._map.setLayoutProperty(x, "visibility", w);
|
|
3468
3478
|
}
|
|
3469
3479
|
// ── Public API ────────────────────────────────────────────────────────────
|
|
3470
3480
|
/** Raw MapLibre Map instance */
|
|
@@ -3488,18 +3498,18 @@ class ri {
|
|
|
3488
3498
|
this._theme = a;
|
|
3489
3499
|
const u = ut[a] ?? ut.light;
|
|
3490
3500
|
this._map.setPaintProperty("background", "background-color", u.background);
|
|
3491
|
-
const
|
|
3501
|
+
const w = [
|
|
3492
3502
|
"landLaye",
|
|
3493
3503
|
"boundary",
|
|
3494
3504
|
...Object.values(Ct).flat(),
|
|
3495
3505
|
...Pt
|
|
3496
3506
|
];
|
|
3497
|
-
for (const
|
|
3498
|
-
this._map.getLayer(
|
|
3499
|
-
for (const
|
|
3500
|
-
this._map.addLayer(
|
|
3501
|
-
for (const
|
|
3502
|
-
this._map.getLayer(
|
|
3507
|
+
for (const x of w)
|
|
3508
|
+
this._map.getLayer(x) && this._map.removeLayer(x);
|
|
3509
|
+
for (const x of Yt(this._theme))
|
|
3510
|
+
this._map.addLayer(x);
|
|
3511
|
+
for (const x of Ht("amm", this._theme))
|
|
3512
|
+
this._map.getLayer(x.id) || this._map.addLayer(x, "fir-line");
|
|
3503
3513
|
this._applyVisibility();
|
|
3504
3514
|
}
|
|
3505
3515
|
/**
|
|
@@ -3515,41 +3525,41 @@ class ri {
|
|
|
3515
3525
|
*/
|
|
3516
3526
|
setLayerVisible(a, u) {
|
|
3517
3527
|
if (this._layerVisible[a] = u, a === "terrain") {
|
|
3518
|
-
const
|
|
3528
|
+
const g = u ? "visible" : "none";
|
|
3519
3529
|
for (const b of Zt)
|
|
3520
|
-
this._map.getLayer(b) && this._map.setLayoutProperty(b, "visibility",
|
|
3530
|
+
this._map.getLayer(b) && this._map.setLayoutProperty(b, "visibility", g);
|
|
3521
3531
|
this._map.setTerrain(u ? { source: "terrain", exaggeration: 4 } : null);
|
|
3522
3532
|
return;
|
|
3523
3533
|
}
|
|
3524
3534
|
if (a === "contour") {
|
|
3525
|
-
const
|
|
3535
|
+
const g = u ? "visible" : "none";
|
|
3526
3536
|
for (const b of Jt)
|
|
3527
|
-
this._map.getLayer(b) && this._map.setLayoutProperty(b, "visibility",
|
|
3537
|
+
this._map.getLayer(b) && this._map.setLayoutProperty(b, "visibility", g);
|
|
3528
3538
|
return;
|
|
3529
3539
|
}
|
|
3530
3540
|
if (a === "amm") {
|
|
3531
|
-
const
|
|
3541
|
+
const g = u ? "visible" : "none";
|
|
3532
3542
|
for (const b of Pt)
|
|
3533
|
-
this._map.getLayer(b) && this._map.setLayoutProperty(b, "visibility",
|
|
3543
|
+
this._map.getLayer(b) && this._map.setLayoutProperty(b, "visibility", g);
|
|
3534
3544
|
return;
|
|
3535
3545
|
}
|
|
3536
|
-
const
|
|
3537
|
-
if (!
|
|
3546
|
+
const w = Ct[a];
|
|
3547
|
+
if (!w) {
|
|
3538
3548
|
console.warn(`[AviationChart] Unknown layer key: "${a}"`);
|
|
3539
3549
|
return;
|
|
3540
3550
|
}
|
|
3541
|
-
const
|
|
3542
|
-
for (const
|
|
3543
|
-
this._map.getLayer(
|
|
3551
|
+
const x = u ? "visible" : "none";
|
|
3552
|
+
for (const g of w)
|
|
3553
|
+
this._map.getLayer(g) && this._map.setLayoutProperty(g, "visibility", x);
|
|
3544
3554
|
}
|
|
3545
3555
|
/**
|
|
3546
3556
|
* Switch the navdata period. Fetches tiles for the new period immediately.
|
|
3547
3557
|
* @param {string} period
|
|
3548
3558
|
*/
|
|
3549
3559
|
setPeriod(a) {
|
|
3550
|
-
var
|
|
3560
|
+
var w;
|
|
3551
3561
|
this._period = a;
|
|
3552
|
-
const u = (
|
|
3562
|
+
const u = (w = this._map) == null ? void 0 : w.getSource("navdata");
|
|
3553
3563
|
u && u.setTiles([`${this._apiUrl}/api/tiles/${a}/{z}/{x}/{y}.pbf`]);
|
|
3554
3564
|
}
|
|
3555
3565
|
/** Proxy to map.on — returns `this` for chaining */
|