aviation-chart 0.1.8 → 0.1.9
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 +259 -255
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -142,77 +142,77 @@ Mt(["exports"], function(o) {
|
|
|
142
142
|
if (!t)
|
|
143
143
|
return {};
|
|
144
144
|
const a = i / (e.width - 1);
|
|
145
|
-
let l, s, c, m,
|
|
146
|
-
const
|
|
147
|
-
function P
|
|
148
|
-
|
|
145
|
+
let l, s, c, m, h, d;
|
|
146
|
+
const f = {}, w = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map();
|
|
147
|
+
function C(P, I, k) {
|
|
148
|
+
P[0] === 0 ? k(a * (d - 1), a * (h - y(c, I, l))) : P[0] === 2 ? k(a * d, a * (h - y(m, I, s))) : P[1] === 0 ? k(a * (d - y(s, I, l)), a * (h - 1)) : k(a * (d - y(m, I, c)), a * h);
|
|
149
149
|
}
|
|
150
|
-
for (
|
|
151
|
-
s = e.get(0,
|
|
152
|
-
let
|
|
153
|
-
for (
|
|
154
|
-
l = s, c = m, s = e.get(
|
|
155
|
-
const
|
|
156
|
-
if (
|
|
150
|
+
for (h = 1 - n; h < e.height + n; h++) {
|
|
151
|
+
s = e.get(0, h - 1), m = e.get(0, h);
|
|
152
|
+
let P = Math.min(s, m), I = Math.max(s, m);
|
|
153
|
+
for (d = 1 - n; d < e.width + n; d++) {
|
|
154
|
+
l = s, c = m, s = e.get(d, h - 1), m = e.get(d, h);
|
|
155
|
+
const k = P, V = I;
|
|
156
|
+
if (P = Math.min(s, m), I = Math.max(s, m), isNaN(l) || isNaN(s) || isNaN(m) || isNaN(c))
|
|
157
157
|
continue;
|
|
158
|
-
const
|
|
159
|
-
for (let
|
|
160
|
-
const At = l >
|
|
158
|
+
const ft = Math.min(k, P), pt = Math.max(V, I), X = Math.ceil(ft / t) * t, ot = Math.floor(pt / t) * t;
|
|
159
|
+
for (let R = X; R <= ot; R += t) {
|
|
160
|
+
const At = l > R, q = s > R, nt = c > R, _t = m > R;
|
|
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 =
|
|
165
|
-
lt ||
|
|
166
|
-
const kt = bt[0], zt = bt[1], yt = g(e.width,
|
|
162
|
+
let Y = w.get(R);
|
|
163
|
+
Y || w.set(R, Y = /* @__PURE__ */ new Map());
|
|
164
|
+
let lt = F.get(R);
|
|
165
|
+
lt || F.set(R, lt = /* @__PURE__ */ new Map());
|
|
166
|
+
const kt = bt[0], zt = bt[1], yt = g(e.width, d, h, kt), st = g(e.width, d, 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 =
|
|
173
|
-
rt || (
|
|
171
|
+
if (C(zt, R, L.append), !L.isEmpty()) {
|
|
172
|
+
let rt = f[R];
|
|
173
|
+
rt || (f[R] = 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
|
+
C(zt, R, L.append), lt.set(L.end = st, L);
|
|
179
179
|
else if (L = Y.get(st))
|
|
180
|
-
Y.delete(st),
|
|
180
|
+
Y.delete(st), C(kt, R, L.prepend), Y.set(L.start = yt, L);
|
|
181
181
|
else {
|
|
182
182
|
const rt = new r(yt, st);
|
|
183
|
-
|
|
183
|
+
C(kt, R, rt.append), C(zt, R, 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 [P, I] of w.entries()) {
|
|
190
|
+
let k = null;
|
|
191
191
|
for (const V of I.values())
|
|
192
|
-
V.isEmpty() || (
|
|
192
|
+
V.isEmpty() || (k == null && (k = f[P] || (f[P] = [])), k.push(V.lineString()));
|
|
193
193
|
}
|
|
194
|
-
return
|
|
194
|
+
return f;
|
|
195
195
|
}
|
|
196
|
-
function
|
|
196
|
+
function z(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
|
-
function
|
|
201
|
-
return
|
|
200
|
+
function S(t) {
|
|
201
|
+
return z(t).map(([e, i]) => [e, ...typeof i == "number" ? [i] : i].join("*")).join("~");
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function O(t) {
|
|
204
204
|
return Object.fromEntries(t.split("~").map((e) => e.split("*").map(Number)).map(([e, ...i]) => [e, i]));
|
|
205
205
|
}
|
|
206
206
|
function A({ thresholds: t, ...e }) {
|
|
207
|
-
return
|
|
207
|
+
return z({ thresholds: S(t), ...e }).map(([i, n]) => `${encodeURIComponent(i)}=${encodeURIComponent(n)}`).join("&");
|
|
208
208
|
}
|
|
209
|
-
function
|
|
209
|
+
function _(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 a = i[1];
|
|
213
213
|
switch (n) {
|
|
214
214
|
case "thresholds":
|
|
215
|
-
a =
|
|
215
|
+
a = O(a);
|
|
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 z(t).map(([e, i]) => `${encodeURIComponent(e)}=${encodeURIComponent(i)}`).join(",");
|
|
228
228
|
}
|
|
229
|
-
function
|
|
229
|
+
function b(t, e) {
|
|
230
230
|
const { thresholds: i, ...n } = t;
|
|
231
231
|
let a = [], l = -1 / 0;
|
|
232
232
|
return Object.entries(i).forEach(([s, c]) => {
|
|
@@ -241,7 +241,7 @@ Mt(["exports"], function(o) {
|
|
|
241
241
|
const e = new ArrayBuffer(t.byteLength);
|
|
242
242
|
return new Uint8Array(e).set(new Uint8Array(t)), e;
|
|
243
243
|
}
|
|
244
|
-
function
|
|
244
|
+
function D(t, e) {
|
|
245
245
|
return t.then(({ data: i, ...n }) => {
|
|
246
246
|
let a = i;
|
|
247
247
|
return e && (a = new Float32Array(i.length), a.set(i)), { ...n, data: a, transferrables: [a.buffer] };
|
|
@@ -303,27 +303,27 @@ Mt(["exports"], function(o) {
|
|
|
303
303
|
var e;
|
|
304
304
|
return !!(!((e = t == null ? void 0 : t.signal) === null || e === void 0) && e.aborted);
|
|
305
305
|
}
|
|
306
|
-
let
|
|
306
|
+
let E = 0;
|
|
307
307
|
class Z {
|
|
308
308
|
constructor(e = 100) {
|
|
309
309
|
this.size = () => this.items.size, this.get = (i, n, a) => {
|
|
310
310
|
let l = this.items.get(i);
|
|
311
311
|
if (l)
|
|
312
|
-
l.lastUsed = ++
|
|
312
|
+
l.lastUsed = ++E, l.waiting++;
|
|
313
313
|
else {
|
|
314
|
-
const
|
|
314
|
+
const h = new AbortController(), d = n(i, h);
|
|
315
315
|
l = {
|
|
316
|
-
abortController:
|
|
317
|
-
item:
|
|
318
|
-
lastUsed: ++
|
|
316
|
+
abortController: h,
|
|
317
|
+
item: d,
|
|
318
|
+
lastUsed: ++E,
|
|
319
319
|
waiting: 1
|
|
320
320
|
}, this.items.set(i, l), this.prune();
|
|
321
321
|
}
|
|
322
|
-
const s = this.items, c = l.item.then((
|
|
322
|
+
const s = this.items, c = l.item.then((h) => h, (h) => (s.delete(i), Promise.reject(h)));
|
|
323
323
|
let m = !1;
|
|
324
324
|
return U(a, () => {
|
|
325
|
-
var
|
|
326
|
-
l && l.abortController && !m && (m = !0, --l.waiting <= 0 && ((
|
|
325
|
+
var h;
|
|
326
|
+
l && l.abortController && !m && (m = !0, --l.waiting <= 0 && ((h = l.abortController) === null || h === void 0 || h.abort(), s.delete(i)));
|
|
327
327
|
}), c;
|
|
328
328
|
}, this.clear = () => this.items.clear(), this.maxSize = e, this.items = /* @__PURE__ */ new Map();
|
|
329
329
|
}
|
|
@@ -355,13 +355,13 @@ Mt(["exports"], function(o) {
|
|
|
355
355
|
try {
|
|
356
356
|
if (!(((n = c == null ? void 0 : c.format) === null || n === void 0 ? void 0 : n.startsWith("BGR")) || ((a = c == null ? void 0 : c.format) === null || a === void 0 ? void 0 : a.startsWith("RGB"))))
|
|
357
357
|
throw new Error(`Unrecognized format: ${c == null ? void 0 : c.format}`);
|
|
358
|
-
const
|
|
359
|
-
if (await c.copyTo(
|
|
360
|
-
for (let w = 0; w <
|
|
361
|
-
const
|
|
362
|
-
|
|
358
|
+
const h = (l = c == null ? void 0 : c.format) === null || l === void 0 ? void 0 : l.startsWith("BGR"), d = c.allocationSize(), f = new Uint8ClampedArray(d);
|
|
359
|
+
if (await c.copyTo(f), h)
|
|
360
|
+
for (let w = 0; w < f.length; w += 4) {
|
|
361
|
+
const F = f[w];
|
|
362
|
+
f[w] = f[w + 2], f[w + 2] = F;
|
|
363
363
|
}
|
|
364
|
-
return Dt(s.width, s.height, e,
|
|
364
|
+
return Dt(s.width, s.height, e, f);
|
|
365
365
|
} catch {
|
|
366
366
|
return B(i) ? null : W(s, e);
|
|
367
367
|
} finally {
|
|
@@ -414,30 +414,30 @@ Mt(["exports"], function(o) {
|
|
|
414
414
|
this.split = (a, l, s) => {
|
|
415
415
|
if (a === 0)
|
|
416
416
|
return this;
|
|
417
|
-
const c = 1 << a, m = l * this.width / c,
|
|
418
|
-
return new $(this.width / c, this.height / c, (
|
|
417
|
+
const c = 1 << a, m = l * this.width / c, h = s * this.height / c;
|
|
418
|
+
return new $(this.width / c, this.height / c, (d, f) => this.get(d + m, f + h));
|
|
419
419
|
}, this.subsamplePixelCenters = (a) => {
|
|
420
|
-
const l = (m,
|
|
420
|
+
const l = (m, h, d) => isNaN(m) ? h : isNaN(h) ? m : m + (h - m) * d;
|
|
421
421
|
if (a <= 1)
|
|
422
422
|
return this;
|
|
423
|
-
const s = 0.5 - 1 / (2 * a), c = (m,
|
|
424
|
-
const
|
|
425
|
-
return l(pt, X,
|
|
423
|
+
const s = 0.5 - 1 / (2 * a), c = (m, h) => {
|
|
424
|
+
const d = m / a - s, f = h / a - s, w = Math.floor(d), F = Math.floor(f), C = this.get(w, F), P = this.get(w + 1, F), I = this.get(w, F + 1), k = this.get(w + 1, F + 1), V = d - w, ft = f - F, pt = l(C, P, V), X = l(I, k, V);
|
|
425
|
+
return l(pt, X, ft);
|
|
426
426
|
};
|
|
427
427
|
return new $(this.width * a, this.height * a, c);
|
|
428
428
|
}, this.averagePixelCentersToGrid = (a = 1) => new $(this.width + 1, this.height + 1, (l, s) => {
|
|
429
|
-
let c = 0, m = 0,
|
|
430
|
-
for (let
|
|
431
|
-
for (let
|
|
432
|
-
isNaN(
|
|
429
|
+
let c = 0, m = 0, h = 0;
|
|
430
|
+
for (let d = l - a; d < l + a; d++)
|
|
431
|
+
for (let f = s - a; f < s + a; f++)
|
|
432
|
+
isNaN(h = this.get(d, f)) || (m++, c += h);
|
|
433
433
|
return m === 0 ? NaN : c / m;
|
|
434
434
|
}), this.scaleElevation = (a) => a === 1 ? this : new $(this.width, this.height, (l, s) => this.get(l, s) * a), this.materialize = (a = 2) => {
|
|
435
435
|
const l = this.width + 2 * a, s = new Float32Array(l * (this.height + 2 * a));
|
|
436
436
|
let c = 0;
|
|
437
437
|
for (let m = -a; m < this.height + a; m++)
|
|
438
|
-
for (let
|
|
439
|
-
s[c++] = this.get(
|
|
440
|
-
return new $(this.width, this.height, (m,
|
|
438
|
+
for (let h = -a; h < this.width + a; h++)
|
|
439
|
+
s[c++] = this.get(h, m);
|
|
440
|
+
return new $(this.width, this.height, (m, h) => s[(h + a) * l + m + a]);
|
|
441
441
|
}, this.get = n, this.width = e, this.height = i;
|
|
442
442
|
}
|
|
443
443
|
/** Construct a height tile from raw DEM pixel values */
|
|
@@ -474,26 +474,26 @@ 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, a) {
|
|
477
|
-
var l, s, c = a * 8 - n - 1, m = (1 << c) - 1,
|
|
478
|
-
for (
|
|
477
|
+
var l, s, c = a * 8 - n - 1, m = (1 << c) - 1, h = m >> 1, d = -7, f = i ? a - 1 : 0, w = i ? -1 : 1, F = t[e + f];
|
|
478
|
+
for (f += w, l = F & (1 << -d) - 1, F >>= -d, d += c; d > 0; l = l * 256 + t[e + f], f += w, d -= 8)
|
|
479
479
|
;
|
|
480
|
-
for (s = l & (1 << -
|
|
480
|
+
for (s = l & (1 << -d) - 1, l >>= -d, d += n; d > 0; s = s * 256 + t[e + f], f += w, d -= 8)
|
|
481
481
|
;
|
|
482
482
|
if (l === 0)
|
|
483
|
-
l = 1 -
|
|
483
|
+
l = 1 - h;
|
|
484
484
|
else {
|
|
485
485
|
if (l === m)
|
|
486
|
-
return s ? NaN : (
|
|
487
|
-
s = s + Math.pow(2, n), l = l -
|
|
486
|
+
return s ? NaN : (F ? -1 : 1) * (1 / 0);
|
|
487
|
+
s = s + Math.pow(2, n), l = l - h;
|
|
488
488
|
}
|
|
489
|
-
return (
|
|
489
|
+
return (F ? -1 : 1) * s * Math.pow(2, l - n);
|
|
490
490
|
}, Et.write = function(t, e, i, n, a, l) {
|
|
491
|
-
var s, c, m,
|
|
492
|
-
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (c = isNaN(e) ? 1 : 0, s =
|
|
491
|
+
var s, c, m, h = l * 8 - a - 1, d = (1 << h) - 1, f = d >> 1, w = a === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, F = n ? 0 : l - 1, C = n ? 1 : -1, P = 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 = d) : (s = Math.floor(Math.log(e) / Math.LN2), e * (m = Math.pow(2, -s)) < 1 && (s--, m *= 2), s + f >= 1 ? e += w / m : e += w * Math.pow(2, 1 - f), e * m >= 2 && (s++, m /= 2), s + f >= d ? (c = 0, s = d) : s + f >= 1 ? (c = (e * m - 1) * Math.pow(2, a), s = s + f) : (c = e * Math.pow(2, f - 1) * Math.pow(2, a), s = 0)); a >= 8; t[i + F] = c & 255, F += C, c /= 256, a -= 8)
|
|
493
493
|
;
|
|
494
|
-
for (s = s << a | c,
|
|
494
|
+
for (s = s << a | c, h += a; h > 0; t[i + F] = s & 255, F += C, s /= 256, h -= 8)
|
|
495
495
|
;
|
|
496
|
-
t[i +
|
|
496
|
+
t[i + F - C] |= P * 128;
|
|
497
497
|
};
|
|
498
498
|
var ne = T, gt = Et;
|
|
499
499
|
function T(t) {
|
|
@@ -642,16 +642,16 @@ Mt(["exports"], function(o) {
|
|
|
642
642
|
return this.length = this.pos, this.pos = 0, this.buf.subarray(0, this.length);
|
|
643
643
|
},
|
|
644
644
|
writeFixed32: function(t) {
|
|
645
|
-
this.realloc(4),
|
|
645
|
+
this.realloc(4), ht(this.buf, t, this.pos), this.pos += 4;
|
|
646
646
|
},
|
|
647
647
|
writeSFixed32: function(t) {
|
|
648
|
-
this.realloc(4),
|
|
648
|
+
this.realloc(4), ht(this.buf, t, this.pos), this.pos += 4;
|
|
649
649
|
},
|
|
650
650
|
writeFixed64: function(t) {
|
|
651
|
-
this.realloc(8),
|
|
651
|
+
this.realloc(8), ht(this.buf, t & -1, this.pos), ht(this.buf, Math.floor(t * Gt), this.pos + 4), this.pos += 8;
|
|
652
652
|
},
|
|
653
653
|
writeSFixed64: function(t) {
|
|
654
|
-
this.realloc(8),
|
|
654
|
+
this.realloc(8), ht(this.buf, t & -1, this.pos), ht(this.buf, Math.floor(t * Gt), this.pos + 4), this.pos += 8;
|
|
655
655
|
},
|
|
656
656
|
writeVarint: function(t) {
|
|
657
657
|
if (t = +t || 0, t > 268435455 || t < 0) {
|
|
@@ -695,10 +695,10 @@ Mt(["exports"], function(o) {
|
|
|
695
695
|
this.writeTag(t, T.Bytes), this.writeRawMessage(e, i);
|
|
696
696
|
},
|
|
697
697
|
writePackedVarint: function(t, e) {
|
|
698
|
-
e.length && this.writeMessage(t,
|
|
698
|
+
e.length && this.writeMessage(t, de, e);
|
|
699
699
|
},
|
|
700
700
|
writePackedSVarint: function(t, e) {
|
|
701
|
-
e.length && this.writeMessage(t,
|
|
701
|
+
e.length && this.writeMessage(t, fe, e);
|
|
702
702
|
},
|
|
703
703
|
writePackedBoolean: function(t, e) {
|
|
704
704
|
e.length && this.writeMessage(t, ye, e);
|
|
@@ -770,12 +770,12 @@ Mt(["exports"], function(o) {
|
|
|
770
770
|
var i, n;
|
|
771
771
|
if (t >= 0 ? (i = t % 4294967296 | 0, n = t / 4294967296 | 0) : (i = ~(-t % 4294967296), n = ~(-t / 4294967296), i ^ 4294967295 ? i = i + 1 | 0 : (i = 0, n = n + 1 | 0)), t >= 18446744073709552e3 || t < -18446744073709552e3)
|
|
772
772
|
throw new Error("Given varint doesn't fit into 10 bytes");
|
|
773
|
-
e.realloc(10), me(i, n, e),
|
|
773
|
+
e.realloc(10), me(i, n, e), he(n, e);
|
|
774
774
|
}
|
|
775
775
|
function me(t, e, i) {
|
|
776
776
|
i.buf[i.pos++] = t & 127 | 128, t >>>= 7, i.buf[i.pos++] = t & 127 | 128, t >>>= 7, i.buf[i.pos++] = t & 127 | 128, t >>>= 7, i.buf[i.pos++] = t & 127 | 128, t >>>= 7, i.buf[i.pos] = t & 127;
|
|
777
777
|
}
|
|
778
|
-
function
|
|
778
|
+
function he(t, e) {
|
|
779
779
|
var i = (t & 7) << 4;
|
|
780
780
|
e.buf[e.pos++] |= i | ((t >>>= 3) ? 128 : 0), t && (e.buf[e.pos++] = t & 127 | ((t >>>= 7) ? 128 : 0), t && (e.buf[e.pos++] = t & 127 | ((t >>>= 7) ? 128 : 0), t && (e.buf[e.pos++] = t & 127 | ((t >>>= 7) ? 128 : 0), t && (e.buf[e.pos++] = t & 127 | ((t >>>= 7) ? 128 : 0), t && (e.buf[e.pos++] = t & 127)))));
|
|
781
781
|
}
|
|
@@ -784,10 +784,10 @@ Mt(["exports"], function(o) {
|
|
|
784
784
|
i.realloc(n);
|
|
785
785
|
for (var a = i.pos - 1; a >= t; a--) i.buf[a + n] = i.buf[a];
|
|
786
786
|
}
|
|
787
|
-
function
|
|
787
|
+
function de(t, e) {
|
|
788
788
|
for (var i = 0; i < t.length; i++) e.writeVarint(t[i]);
|
|
789
789
|
}
|
|
790
|
-
function
|
|
790
|
+
function fe(t, e) {
|
|
791
791
|
for (var i = 0; i < t.length; i++) e.writeSVarint(t[i]);
|
|
792
792
|
}
|
|
793
793
|
function ue(t, e) {
|
|
@@ -814,7 +814,7 @@ Mt(["exports"], function(o) {
|
|
|
814
814
|
function wt(t, e) {
|
|
815
815
|
return (t[e] | t[e + 1] << 8 | t[e + 2] << 16) + t[e + 3] * 16777216;
|
|
816
816
|
}
|
|
817
|
-
function
|
|
817
|
+
function ht(t, e, i) {
|
|
818
818
|
t[i] = e, t[i + 1] = e >>> 8, t[i + 2] = e >>> 16, t[i + 3] = e >>> 24;
|
|
819
819
|
}
|
|
820
820
|
function Nt(t, e) {
|
|
@@ -824,8 +824,8 @@ Mt(["exports"], function(o) {
|
|
|
824
824
|
for (var n = "", a = e; a < i; ) {
|
|
825
825
|
var l = t[a], s = null, c = l > 239 ? 4 : l > 223 ? 3 : l > 191 ? 2 : 1;
|
|
826
826
|
if (a + c > i) break;
|
|
827
|
-
var m,
|
|
828
|
-
c === 1 ? l < 128 && (s = l) : c === 2 ? (m = t[a + 1], (m & 192) === 128 && (s = (l & 31) << 6 | m & 63, s <= 127 && (s = null))) : c === 3 ? (m = t[a + 1],
|
|
827
|
+
var m, h, d;
|
|
828
|
+
c === 1 ? l < 128 && (s = l) : c === 2 ? (m = t[a + 1], (m & 192) === 128 && (s = (l & 31) << 6 | m & 63, s <= 127 && (s = null))) : c === 3 ? (m = t[a + 1], h = t[a + 2], (m & 192) === 128 && (h & 192) === 128 && (s = (l & 15) << 12 | (m & 63) << 6 | h & 63, (s <= 2047 || s >= 55296 && s <= 57343) && (s = null))) : c === 4 && (m = t[a + 1], h = t[a + 2], d = t[a + 3], (m & 192) === 128 && (h & 192) === 128 && (d & 192) === 128 && (s = (l & 15) << 18 | (m & 63) << 12 | (h & 63) << 6 | d & 63, (s <= 65535 || s >= 1114112) && (s = null))), s === null ? (s = 65533, c = 1) : s > 65535 && (s -= 65536, n += String.fromCharCode(s >>> 10 & 1023 | 55296), s = 56320 | s & 1023), n += String.fromCharCode(s), a += c;
|
|
829
829
|
}
|
|
830
830
|
return n;
|
|
831
831
|
}
|
|
@@ -850,10 +850,10 @@ Mt(["exports"], function(o) {
|
|
|
850
850
|
}
|
|
851
851
|
return i;
|
|
852
852
|
}
|
|
853
|
-
var ve = /* @__PURE__ */ ae(ne),
|
|
853
|
+
var ve = /* @__PURE__ */ ae(ne), dt;
|
|
854
854
|
(function(t) {
|
|
855
855
|
t[t.UNKNOWN = 0] = "UNKNOWN", t[t.POINT = 1] = "POINT", t[t.LINESTRING = 2] = "LINESTRING", t[t.POLYGON = 3] = "POLYGON";
|
|
856
|
-
})(
|
|
856
|
+
})(dt || (dt = {}));
|
|
857
857
|
function De(t) {
|
|
858
858
|
const e = new ve();
|
|
859
859
|
for (const i in t.layers) {
|
|
@@ -891,15 +891,15 @@ Mt(["exports"], function(o) {
|
|
|
891
891
|
throw new Error();
|
|
892
892
|
const n = t.keys, a = t.values, l = t.keycache, s = t.valuecache;
|
|
893
893
|
for (const c in i.properties) {
|
|
894
|
-
let m = i.properties[c],
|
|
894
|
+
let m = i.properties[c], h = l[c];
|
|
895
895
|
if (m === null)
|
|
896
896
|
continue;
|
|
897
|
-
typeof
|
|
898
|
-
const
|
|
899
|
-
|
|
900
|
-
const
|
|
901
|
-
let w = s[
|
|
902
|
-
typeof w > "u" && (a.push(m), w = a.length - 1, s[
|
|
897
|
+
typeof h > "u" && (n.push(c), h = n.length - 1, l[c] = h), e.writeVarint(h);
|
|
898
|
+
const d = typeof m;
|
|
899
|
+
d !== "string" && d !== "boolean" && d !== "number" && (m = JSON.stringify(m));
|
|
900
|
+
const f = `${d}:${m}`;
|
|
901
|
+
let w = s[f];
|
|
902
|
+
typeof w > "u" && (a.push(m), w = a.length - 1, s[f] = w), e.writeVarint(w);
|
|
903
903
|
}
|
|
904
904
|
}
|
|
905
905
|
function St(t, e) {
|
|
@@ -915,14 +915,14 @@ Mt(["exports"], function(o) {
|
|
|
915
915
|
let a = 0, l = 0;
|
|
916
916
|
for (const s of i) {
|
|
917
917
|
let c = 1;
|
|
918
|
-
n ===
|
|
919
|
-
const m = s.length / 2,
|
|
920
|
-
for (let
|
|
921
|
-
|
|
922
|
-
const
|
|
923
|
-
e.writeVarint(Vt(
|
|
918
|
+
n === dt.POINT && (c = s.length / 2), e.writeVarint(St(1, c));
|
|
919
|
+
const m = s.length / 2, h = n === dt.POLYGON ? m - 1 : m;
|
|
920
|
+
for (let d = 0; d < h; d++) {
|
|
921
|
+
d === 1 && n !== 1 && e.writeVarint(St(2, h - 1));
|
|
922
|
+
const f = s[d * 2] - a, w = s[d * 2 + 1] - l;
|
|
923
|
+
e.writeVarint(Vt(f)), e.writeVarint(Vt(w)), a += f, l += w;
|
|
924
924
|
}
|
|
925
|
-
n ===
|
|
925
|
+
n === dt.POLYGON && e.writeVarint(St(7, 1));
|
|
926
926
|
}
|
|
927
927
|
}
|
|
928
928
|
function ke(t, e) {
|
|
@@ -932,75 +932,75 @@ Mt(["exports"], function(o) {
|
|
|
932
932
|
}
|
|
933
933
|
class Re {
|
|
934
934
|
constructor(e, i, n, a, l) {
|
|
935
|
-
this.loaded = Promise.resolve(), this.decodeImage = It, this.fetchAndParseTile = (s, c, m,
|
|
936
|
-
const
|
|
937
|
-
return
|
|
938
|
-
const
|
|
939
|
-
if (B(
|
|
935
|
+
this.loaded = Promise.resolve(), this.decodeImage = It, this.fetchAndParseTile = (s, c, m, h, d) => {
|
|
936
|
+
const f = this, w = this.demUrlPattern.replace("{z}", s.toString()).replace("{x}", c.toString()).replace("{y}", m.toString());
|
|
937
|
+
return d == null || d.useTile(w), this.parsedCache.get(w, async (F, C) => {
|
|
938
|
+
const P = await f.fetchTile(s, c, m, C, d);
|
|
939
|
+
if (B(C))
|
|
940
940
|
throw new Error("canceled");
|
|
941
|
-
const I =
|
|
942
|
-
return
|
|
943
|
-
},
|
|
941
|
+
const I = f.decodeImage(P.data, f.encoding, C), k = d == null ? void 0 : d.marker("decode"), V = await I;
|
|
942
|
+
return k == null || k(), V;
|
|
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 = a;
|
|
945
945
|
}
|
|
946
946
|
fetchTile(e, i, n, a, l) {
|
|
947
947
|
const s = this.demUrlPattern.replace("{z}", e.toString()).replace("{x}", i.toString()).replace("{y}", n.toString());
|
|
948
948
|
return l == null || l.useTile(s), this.tileCache.get(s, (c, m) => {
|
|
949
|
-
const
|
|
949
|
+
const h = {
|
|
950
950
|
signal: m.signal
|
|
951
951
|
};
|
|
952
952
|
l == null || l.fetchTile(s);
|
|
953
|
-
const
|
|
954
|
-
return G(this.timeoutMs, fetch(s,
|
|
955
|
-
if (
|
|
956
|
-
throw new Error(`Bad response: ${
|
|
953
|
+
const d = l == null ? void 0 : l.marker("fetch");
|
|
954
|
+
return G(this.timeoutMs, fetch(s, h).then(async (f) => {
|
|
955
|
+
if (d == null || d(), !f.ok)
|
|
956
|
+
throw new Error(`Bad response: ${f.status} for ${s}`);
|
|
957
957
|
return {
|
|
958
|
-
data: await
|
|
959
|
-
expires:
|
|
960
|
-
cacheControl:
|
|
958
|
+
data: await f.blob(),
|
|
959
|
+
expires: f.headers.get("expires") || void 0,
|
|
960
|
+
cacheControl: f.headers.get("cache-control") || void 0
|
|
961
961
|
};
|
|
962
962
|
}), m);
|
|
963
963
|
}, a);
|
|
964
964
|
}
|
|
965
965
|
async fetchDem(e, i, n, a, l, s) {
|
|
966
|
-
const c = Math.min(e - (a.overzoom || 0), this.maxzoom), m = e - c,
|
|
967
|
-
return $.fromRawDem(w).split(m, i %
|
|
966
|
+
const c = Math.min(e - (a.overzoom || 0), this.maxzoom), m = e - c, h = 1 << m, d = Math.floor(i / h), f = Math.floor(n / h), w = await this.fetchAndParseTile(c, d, f, l, s);
|
|
967
|
+
return $.fromRawDem(w).split(m, i % h, n % h);
|
|
968
968
|
}
|
|
969
969
|
fetchContourTile(e, i, n, a, l, s) {
|
|
970
|
-
const { levels: c, multiplier: m = 1, buffer:
|
|
970
|
+
const { levels: c, multiplier: m = 1, buffer: h = 1, extent: d = 4096, contourLayer: f = "contours", elevationKey: w = "ele", levelKey: F = "level", subsampleBelow: C = 100 } = a;
|
|
971
971
|
if (!c || c.length === 0)
|
|
972
972
|
return Promise.resolve({ arrayBuffer: new ArrayBuffer(0) });
|
|
973
|
-
const
|
|
974
|
-
return this.contourCache.get(
|
|
975
|
-
const V = 1 << e,
|
|
973
|
+
const P = [e, i, n, p(a)].join("/");
|
|
974
|
+
return this.contourCache.get(P, async (I, k) => {
|
|
975
|
+
const V = 1 << e, ft = [];
|
|
976
976
|
for (let q = n - 1; q <= n + 1; q++)
|
|
977
977
|
for (let nt = i - 1; nt <= i + 1; nt++)
|
|
978
|
-
|
|
979
|
-
const pt = await Promise.all(
|
|
978
|
+
ft.push(q < 0 || q >= V ? void 0 : this.fetchDem(e, (nt + V) % V, q, a, k, s));
|
|
979
|
+
const pt = await Promise.all(ft);
|
|
980
980
|
let X = $.combineNeighbors(pt);
|
|
981
|
-
if (!X || B(
|
|
981
|
+
if (!X || B(k))
|
|
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 >= C)
|
|
985
985
|
X = X.materialize(2);
|
|
986
986
|
else
|
|
987
|
-
for (; X.width <
|
|
987
|
+
for (; X.width < C; )
|
|
988
988
|
X = X.subsamplePixelCenters(2).materialize(2);
|
|
989
989
|
X = X.averagePixelCentersToGrid().scaleElevation(m).materialize(1);
|
|
990
|
-
const
|
|
990
|
+
const R = x(c[0], X, d, h);
|
|
991
991
|
ot == null || ot();
|
|
992
992
|
const At = De({
|
|
993
|
-
extent:
|
|
993
|
+
extent: d,
|
|
994
994
|
layers: {
|
|
995
|
-
[
|
|
996
|
-
features: Object.entries(
|
|
995
|
+
[f]: {
|
|
996
|
+
features: Object.entries(R).map(([q, nt]) => {
|
|
997
997
|
const _t = Number(q);
|
|
998
998
|
return {
|
|
999
|
-
type:
|
|
999
|
+
type: dt.LINESTRING,
|
|
1000
1000
|
geometry: nt,
|
|
1001
1001
|
properties: {
|
|
1002
1002
|
[w]: _t,
|
|
1003
|
-
[
|
|
1003
|
+
[F]: Math.max(...c.map((bt, Y) => _t % bt === 0 ? Y : 0))
|
|
1004
1004
|
}
|
|
1005
1005
|
};
|
|
1006
1006
|
})
|
|
@@ -1030,8 +1030,8 @@ 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
|
|
1034
|
-
return Number.isFinite(
|
|
1033
|
+
const h = this.marks[m] || [], d = Math.max(...h.map((w) => Math.max(...w))), f = Math.min(...h.map((w) => Math.min(...w)));
|
|
1034
|
+
return Number.isFinite(d) ? d - f : void 0;
|
|
1035
1035
|
}, a = n("main") || 0, l = n("fetch"), s = n("decode"), c = n("isoline");
|
|
1036
1036
|
return {
|
|
1037
1037
|
url: i,
|
|
@@ -1063,7 +1063,7 @@ Mt(["exports"], function(o) {
|
|
|
1063
1063
|
const a = i.origin - this.timeOrigin;
|
|
1064
1064
|
for (const l in i.marks) {
|
|
1065
1065
|
const s = l;
|
|
1066
|
-
(this.marks[s] || (this.marks[s] = [])).push(...((n = i.marks[s]) === null || n === void 0 ? void 0 : n.map((m) => m.map((
|
|
1066
|
+
(this.marks[s] || (this.marks[s] = [])).push(...((n = i.marks[s]) === null || n === void 0 ? void 0 : n.map((m) => m.map((h) => h + a))) || []);
|
|
1067
1067
|
}
|
|
1068
1068
|
this.resources.push(...i.resources.map((l) => Ie(l, a)));
|
|
1069
1069
|
}, this.markFinish = this.marker(e);
|
|
@@ -1088,27 +1088,27 @@ Mt(["exports"], function(o) {
|
|
|
1088
1088
|
const s = this.callbacks[l.id];
|
|
1089
1089
|
delete this.callbacks[l.id], s && s(l.error ? new Error(l.error) : void 0, l.response, l.timings);
|
|
1090
1090
|
} else if (l.type === "request") {
|
|
1091
|
-
const s = new Wt("worker"), c = i[l.name], m = new AbortController(),
|
|
1091
|
+
const s = new Wt("worker"), c = i[l.name], m = new AbortController(), h = c.apply(c, [
|
|
1092
1092
|
...l.args,
|
|
1093
1093
|
m,
|
|
1094
1094
|
s
|
|
1095
|
-
]),
|
|
1096
|
-
if (l.id &&
|
|
1095
|
+
]), d = `${l.name}_${l.id}`;
|
|
1096
|
+
if (l.id && h) {
|
|
1097
1097
|
this.cancels[l.id] = m;
|
|
1098
1098
|
try {
|
|
1099
|
-
const
|
|
1099
|
+
const f = await h, w = f == null ? void 0 : f.transferrables;
|
|
1100
1100
|
this.postMessage({
|
|
1101
1101
|
id: l.id,
|
|
1102
1102
|
type: "response",
|
|
1103
|
-
response:
|
|
1104
|
-
timings: s.finish(
|
|
1103
|
+
response: f,
|
|
1104
|
+
timings: s.finish(d)
|
|
1105
1105
|
}, w);
|
|
1106
|
-
} catch (
|
|
1106
|
+
} catch (f) {
|
|
1107
1107
|
this.postMessage({
|
|
1108
1108
|
id: l.id,
|
|
1109
1109
|
type: "response",
|
|
1110
|
-
error: (
|
|
1111
|
-
timings: s.finish(
|
|
1110
|
+
error: (f == null ? void 0 : f.toString()) || "error",
|
|
1111
|
+
timings: s.finish(d)
|
|
1112
1112
|
});
|
|
1113
1113
|
}
|
|
1114
1114
|
delete this.cancels[l.id];
|
|
@@ -1121,9 +1121,9 @@ Mt(["exports"], function(o) {
|
|
|
1121
1121
|
}
|
|
1122
1122
|
/** Invokes a method by name with a set of arguments in the remote context. */
|
|
1123
1123
|
send(e, i, n, a, ...l) {
|
|
1124
|
-
const s = ++Le, c = new Promise((m,
|
|
1125
|
-
this.postMessage({ id: s, type: "request", name: e, args: l }, i), this.callbacks[s] = (
|
|
1126
|
-
a == null || a.addAll(w),
|
|
1124
|
+
const s = ++Le, c = new Promise((m, h) => {
|
|
1125
|
+
this.postMessage({ id: s, type: "request", name: e, args: l }, i), this.callbacks[s] = (d, f, w) => {
|
|
1126
|
+
a == null || a.addAll(w), d ? h(d) : m(f);
|
|
1127
1127
|
};
|
|
1128
1128
|
});
|
|
1129
1129
|
return U(n, () => {
|
|
@@ -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 = _, o.b = x, o.c = Dt, o.d = It, o.e = A, o.f = M, o.g = b, o.p = D;
|
|
1135
1135
|
});
|
|
1136
1136
|
Mt(["./shared"], function(o) {
|
|
1137
1137
|
const r = (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, z) => (this.managers[x.managerId] = new o.L(x.demUrlPattern, x.cacheSize, x.encoding, x.maxzoom, x.timeoutMs), Promise.resolve()), this.fetchTile = (x, z, S, O, A, _) => {
|
|
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(z, S, O, A, _)) || r(x);
|
|
1143
|
+
}, this.fetchAndParseTile = (x, z, S, O, A, _) => {
|
|
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(z, S, O, A, _)) || r(x), !0);
|
|
1146
|
+
}, this.fetchContourTile = (x, z, S, O, A, _, p) => {
|
|
1147
|
+
var b;
|
|
1148
|
+
return o.f(((b = this.managers[x]) === null || b === void 0 ? void 0 : b.fetchContourTile(z, S, O, A, _, p)) || r(x));
|
|
1149
1149
|
};
|
|
1150
1150
|
}
|
|
1151
1151
|
}
|
|
@@ -1157,24 +1157,24 @@ Mt(["./shared"], function(o) {
|
|
|
1157
1157
|
let u, g = 0;
|
|
1158
1158
|
class y {
|
|
1159
1159
|
constructor() {
|
|
1160
|
-
this.decodeImage = (
|
|
1160
|
+
this.decodeImage = (b, v, D) => o.p(o.d(b, v, D), !1);
|
|
1161
1161
|
}
|
|
1162
1162
|
}
|
|
1163
1163
|
function x() {
|
|
1164
1164
|
if (!u) {
|
|
1165
|
-
const p = new Worker(r.workerUrl),
|
|
1166
|
-
u = new o.A(p,
|
|
1165
|
+
const p = new Worker(r.workerUrl), b = new y();
|
|
1166
|
+
u = new o.A(p, b);
|
|
1167
1167
|
}
|
|
1168
1168
|
return u;
|
|
1169
1169
|
}
|
|
1170
|
-
class
|
|
1171
|
-
constructor(
|
|
1172
|
-
this.fetchTile = (H, G, U, B,
|
|
1170
|
+
class z {
|
|
1171
|
+
constructor(b, v, D, M, j, ct) {
|
|
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:
|
|
1177
|
-
encoding:
|
|
1176
|
+
demUrlPattern: b,
|
|
1177
|
+
encoding: D,
|
|
1178
1178
|
maxzoom: M,
|
|
1179
1179
|
managerId: tt,
|
|
1180
1180
|
timeoutMs: j
|
|
@@ -1182,68 +1182,68 @@ Mt(["./shared"], function(o) {
|
|
|
1182
1182
|
}
|
|
1183
1183
|
}
|
|
1184
1184
|
Blob.prototype.arrayBuffer || (Blob.prototype.arrayBuffer = function() {
|
|
1185
|
-
return new Promise((
|
|
1186
|
-
const
|
|
1187
|
-
|
|
1185
|
+
return new Promise((b, v) => {
|
|
1186
|
+
const D = new FileReader();
|
|
1187
|
+
D.onload = (M) => {
|
|
1188
1188
|
var j;
|
|
1189
|
-
return
|
|
1190
|
-
},
|
|
1189
|
+
return b((j = M.target) === null || j === void 0 ? void 0 : j.result);
|
|
1190
|
+
}, D.onerror = v, D.readAsArrayBuffer(this);
|
|
1191
1191
|
});
|
|
1192
1192
|
});
|
|
1193
|
-
const
|
|
1193
|
+
const S = (p) => (b, v) => {
|
|
1194
1194
|
if (v instanceof AbortController)
|
|
1195
|
-
return p(
|
|
1195
|
+
return p(b, v);
|
|
1196
1196
|
{
|
|
1197
|
-
const
|
|
1198
|
-
return p(
|
|
1197
|
+
const D = new AbortController();
|
|
1198
|
+
return p(b, D).then((M) => v(void 0, M.data, M.cacheControl, M.expires), (M) => v(M)), { cancel: () => D.abort() };
|
|
1199
1199
|
}
|
|
1200
|
-
},
|
|
1200
|
+
}, O = /* @__PURE__ */ new Set();
|
|
1201
1201
|
class A {
|
|
1202
|
-
constructor({ url:
|
|
1203
|
-
this.timingCallbacks = [], this.onTiming = (
|
|
1204
|
-
this.timingCallbacks.push(
|
|
1205
|
-
}, this.setupMaplibre = (
|
|
1206
|
-
|
|
1207
|
-
}, this.sharedDemProtocolV4 = async (
|
|
1208
|
-
const [K, et, N] = this.parseUrl(
|
|
1202
|
+
constructor({ url: b, cacheSize: v = 100, id: D = "dem", encoding: M = "terrarium", maxzoom: j = 12, worker: ct = !0, timeoutMs: tt = 1e4, actor: H }) {
|
|
1203
|
+
this.timingCallbacks = [], this.onTiming = (E) => {
|
|
1204
|
+
this.timingCallbacks.push(E);
|
|
1205
|
+
}, this.setupMaplibre = (E) => {
|
|
1206
|
+
E.addProtocol(this.sharedDemProtocolId, this.sharedDemProtocol), E.addProtocol(this.contourProtocolId, this.contourProtocol);
|
|
1207
|
+
}, this.sharedDemProtocolV4 = async (E, Z) => {
|
|
1208
|
+
const [K, et, N] = this.parseUrl(E.url), it = new o.T("main");
|
|
1209
1209
|
let at;
|
|
1210
1210
|
try {
|
|
1211
1211
|
const W = await this.manager.fetchTile(K, et, N, Z, it);
|
|
1212
|
-
return at = it.finish(
|
|
1212
|
+
return at = it.finish(E.url), {
|
|
1213
1213
|
data: await W.data.arrayBuffer(),
|
|
1214
1214
|
cacheControl: W.cacheControl,
|
|
1215
1215
|
expires: W.expires
|
|
1216
1216
|
};
|
|
1217
1217
|
} catch (W) {
|
|
1218
|
-
throw at = it.error(
|
|
1218
|
+
throw at = it.error(E.url), W;
|
|
1219
1219
|
} finally {
|
|
1220
1220
|
this.timingCallbacks.forEach((W) => W(at));
|
|
1221
1221
|
}
|
|
1222
|
-
}, this.contourProtocolV4 = async (
|
|
1222
|
+
}, this.contourProtocolV4 = async (E, Z) => {
|
|
1223
1223
|
const K = new o.T("main");
|
|
1224
1224
|
let et;
|
|
1225
1225
|
try {
|
|
1226
|
-
const [N, it, at] = this.parseUrl(
|
|
1227
|
-
return et = K.finish(
|
|
1226
|
+
const [N, it, at] = this.parseUrl(E.url), W = o.a(E.url), xt = await this.manager.fetchContourTile(N, it, at, o.g(W, N), Z, K);
|
|
1227
|
+
return et = K.finish(E.url), { data: xt.arrayBuffer };
|
|
1228
1228
|
} catch (N) {
|
|
1229
|
-
throw et = K.error(
|
|
1229
|
+
throw et = K.error(E.url), N;
|
|
1230
1230
|
} finally {
|
|
1231
1231
|
this.timingCallbacks.forEach((N) => N(et));
|
|
1232
1232
|
}
|
|
1233
|
-
}, this.contourProtocol =
|
|
1234
|
-
let G =
|
|
1235
|
-
for (;
|
|
1236
|
-
G =
|
|
1237
|
-
|
|
1238
|
-
const B = ct ?
|
|
1239
|
-
this.manager = new B(
|
|
1233
|
+
}, this.contourProtocol = S(this.contourProtocolV4), this.sharedDemProtocol = S(this.sharedDemProtocolV4), this.contourProtocolUrl = (E) => `${this.contourProtocolUrlBase}?${o.e(E)}`;
|
|
1234
|
+
let G = D, U = 1;
|
|
1235
|
+
for (; O.has(G); )
|
|
1236
|
+
G = D + U++;
|
|
1237
|
+
O.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 ? z : o.L;
|
|
1239
|
+
this.manager = new B(b, v, M, j, tt, H);
|
|
1240
1240
|
}
|
|
1241
|
-
getDemTile(
|
|
1242
|
-
return this.manager.fetchAndParseTile(
|
|
1241
|
+
getDemTile(b, v, D, M) {
|
|
1242
|
+
return this.manager.fetchAndParseTile(b, v, D, M || new AbortController());
|
|
1243
1243
|
}
|
|
1244
|
-
parseUrl(
|
|
1245
|
-
const [, v,
|
|
1246
|
-
return [Number(v), Number(
|
|
1244
|
+
parseUrl(b) {
|
|
1245
|
+
const [, v, D, M] = /\/\/(\d+)\/(\d+)\/(\d+)/.exec(b) || [];
|
|
1246
|
+
return [Number(v), Number(D), Number(M)];
|
|
1247
1247
|
}
|
|
1248
1248
|
}
|
|
1249
1249
|
return {
|
|
@@ -1266,11 +1266,11 @@ function Xe(o) {
|
|
|
1266
1266
|
}
|
|
1267
1267
|
function Ne(o) {
|
|
1268
1268
|
if (o == null) return Xe;
|
|
1269
|
-
var r, u, g = o.scale[0], y = o.scale[1], x = o.translate[0],
|
|
1270
|
-
return function(
|
|
1271
|
-
|
|
1272
|
-
var A = 2,
|
|
1273
|
-
for (p[0] = (r +=
|
|
1269
|
+
var r, u, g = o.scale[0], y = o.scale[1], x = o.translate[0], z = o.translate[1];
|
|
1270
|
+
return function(S, O) {
|
|
1271
|
+
O || (r = u = 0);
|
|
1272
|
+
var A = 2, _ = S.length, p = new Array(_);
|
|
1273
|
+
for (p[0] = (r += S[0]) * g + x, p[1] = (u += S[1]) * y + z; A < _; ) p[A] = S[A], ++A;
|
|
1274
1274
|
return p;
|
|
1275
1275
|
};
|
|
1276
1276
|
}
|
|
@@ -1288,53 +1288,53 @@ function Kt(o, r) {
|
|
|
1288
1288
|
}
|
|
1289
1289
|
function Ue(o, r) {
|
|
1290
1290
|
var u = Ne(o.transform), g = o.arcs;
|
|
1291
|
-
function y(
|
|
1291
|
+
function y(_, p) {
|
|
1292
1292
|
p.length && p.pop();
|
|
1293
|
-
for (var
|
|
1294
|
-
p.push(u(
|
|
1295
|
-
|
|
1293
|
+
for (var b = g[_ < 0 ? ~_ : _], v = 0, D = b.length; v < D; ++v)
|
|
1294
|
+
p.push(u(b[v], v));
|
|
1295
|
+
_ < 0 && Ve(p, D);
|
|
1296
1296
|
}
|
|
1297
|
-
function x(
|
|
1298
|
-
return u(
|
|
1297
|
+
function x(_) {
|
|
1298
|
+
return u(_);
|
|
1299
1299
|
}
|
|
1300
|
-
function
|
|
1301
|
-
for (var p = [],
|
|
1300
|
+
function z(_) {
|
|
1301
|
+
for (var p = [], b = 0, v = _.length; b < v; ++b) y(_[b], p);
|
|
1302
1302
|
return p.length < 2 && p.push(p[0]), p;
|
|
1303
1303
|
}
|
|
1304
|
-
function
|
|
1305
|
-
for (var p =
|
|
1304
|
+
function S(_) {
|
|
1305
|
+
for (var p = z(_); p.length < 4; ) p.push(p[0]);
|
|
1306
1306
|
return p;
|
|
1307
1307
|
}
|
|
1308
|
-
function
|
|
1309
|
-
return
|
|
1308
|
+
function O(_) {
|
|
1309
|
+
return _.map(S);
|
|
1310
1310
|
}
|
|
1311
|
-
function A(
|
|
1312
|
-
var p =
|
|
1311
|
+
function A(_) {
|
|
1312
|
+
var p = _.type, b;
|
|
1313
1313
|
switch (p) {
|
|
1314
1314
|
case "GeometryCollection":
|
|
1315
|
-
return { type: p, geometries:
|
|
1315
|
+
return { type: p, geometries: _.geometries.map(A) };
|
|
1316
1316
|
case "Point":
|
|
1317
|
-
|
|
1317
|
+
b = x(_.coordinates);
|
|
1318
1318
|
break;
|
|
1319
1319
|
case "MultiPoint":
|
|
1320
|
-
|
|
1320
|
+
b = _.coordinates.map(x);
|
|
1321
1321
|
break;
|
|
1322
1322
|
case "LineString":
|
|
1323
|
-
|
|
1323
|
+
b = z(_.arcs);
|
|
1324
1324
|
break;
|
|
1325
1325
|
case "MultiLineString":
|
|
1326
|
-
|
|
1326
|
+
b = _.arcs.map(z);
|
|
1327
1327
|
break;
|
|
1328
1328
|
case "Polygon":
|
|
1329
|
-
|
|
1329
|
+
b = O(_.arcs);
|
|
1330
1330
|
break;
|
|
1331
1331
|
case "MultiPolygon":
|
|
1332
|
-
|
|
1332
|
+
b = _.arcs.map(O);
|
|
1333
1333
|
break;
|
|
1334
1334
|
default:
|
|
1335
1335
|
return null;
|
|
1336
1336
|
}
|
|
1337
|
-
return { type: p, coordinates:
|
|
1337
|
+
return { type: p, coordinates: b };
|
|
1338
1338
|
}
|
|
1339
1339
|
return A(r);
|
|
1340
1340
|
}
|
|
@@ -3256,6 +3256,8 @@ 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] Initial map center [lng, lat] (default [104, 36])
|
|
3260
|
+
* @param {number} [options.zoom] Initial zoom level (default 4)
|
|
3259
3261
|
*/
|
|
3260
3262
|
constructor(r = {}) {
|
|
3261
3263
|
const {
|
|
@@ -3263,10 +3265,12 @@ class ri {
|
|
|
3263
3265
|
theme: g = "light",
|
|
3264
3266
|
apiUrl: y = ti,
|
|
3265
3267
|
spriteUrl: x,
|
|
3266
|
-
period:
|
|
3267
|
-
layers:
|
|
3268
|
+
period: z = null,
|
|
3269
|
+
layers: S = {},
|
|
3270
|
+
center: O = [104, 36],
|
|
3271
|
+
zoom: A = 4
|
|
3268
3272
|
} = r;
|
|
3269
|
-
return this._apiUrl = y.replace(/\/$/, ""), this._spriteUrl = (x ?? y).replace(/\/$/, ""), this._theme = g, this._period =
|
|
3273
|
+
return this._apiUrl = y.replace(/\/$/, ""), this._spriteUrl = (x ?? y).replace(/\/$/, ""), this._theme = g, this._period = z, this._center = O, this._zoom = A, this._ready = !1, this._layerVisible = {
|
|
3270
3274
|
// aviation groups — all visible by default
|
|
3271
3275
|
adiz: !0,
|
|
3272
3276
|
fir: !0,
|
|
@@ -3284,13 +3288,13 @@ class ri {
|
|
|
3284
3288
|
terrain: !1,
|
|
3285
3289
|
contour: !1,
|
|
3286
3290
|
// user overrides
|
|
3287
|
-
...
|
|
3291
|
+
...S
|
|
3288
3292
|
}, this._initMap(u), new Proxy(this, {
|
|
3289
|
-
get(
|
|
3290
|
-
var
|
|
3291
|
-
if (
|
|
3292
|
-
const
|
|
3293
|
-
return typeof
|
|
3293
|
+
get(_, p, b) {
|
|
3294
|
+
var D;
|
|
3295
|
+
if (p in _) return Reflect.get(_, p, b);
|
|
3296
|
+
const v = (D = _._map) == null ? void 0 : D[p];
|
|
3297
|
+
return typeof v == "function" ? v.bind(_._map) : v;
|
|
3294
3298
|
}
|
|
3295
3299
|
});
|
|
3296
3300
|
}
|
|
@@ -3315,8 +3319,8 @@ class ri {
|
|
|
3315
3319
|
{ id: "background", type: "background", paint: { "background-color": u.background } }
|
|
3316
3320
|
]
|
|
3317
3321
|
},
|
|
3318
|
-
center:
|
|
3319
|
-
zoom:
|
|
3322
|
+
center: this._center,
|
|
3323
|
+
zoom: this._zoom,
|
|
3320
3324
|
minZoom: 0,
|
|
3321
3325
|
maxZoom: 17.5,
|
|
3322
3326
|
crossSourceCollisions: !1,
|
|
@@ -3379,11 +3383,11 @@ class ri {
|
|
|
3379
3383
|
async _loadBaseData() {
|
|
3380
3384
|
var r, u, g, y;
|
|
3381
3385
|
try {
|
|
3382
|
-
const [x,
|
|
3386
|
+
const [x, z] = await Promise.all([
|
|
3383
3387
|
Qt(`${this._apiUrl}/topjson/land.topojson.gz`),
|
|
3384
3388
|
Qt(`${this._apiUrl}/topjson/boundary.topojson.gz`)
|
|
3385
3389
|
]);
|
|
3386
|
-
(r = x == null ? void 0 : x.objects) != null && r.land ? (u = this._map.getSource("land")) == null || u.setData($t(x, x.objects.land)) : console.warn("[AviationChart] land topojson missing objects.land"), (g =
|
|
3390
|
+
(r = x == null ? void 0 : x.objects) != null && r.land ? (u = this._map.getSource("land")) == null || u.setData($t(x, x.objects.land)) : console.warn("[AviationChart] land topojson missing objects.land"), (g = z == null ? void 0 : z.objects) != null && g.boundary ? (y = this._map.getSource("boundary")) == null || y.setData($t(z, z.objects.boundary)) : console.warn("[AviationChart] boundary topojson missing objects.boundary");
|
|
3387
3391
|
} catch (x) {
|
|
3388
3392
|
console.error("[AviationChart] loadBaseData failed:", x);
|
|
3389
3393
|
}
|
|
@@ -3447,9 +3451,9 @@ class ri {
|
|
|
3447
3451
|
}
|
|
3448
3452
|
_applyVisibility() {
|
|
3449
3453
|
for (const [y, x] of Object.entries(Ct)) {
|
|
3450
|
-
const
|
|
3451
|
-
for (const
|
|
3452
|
-
this._map.getLayer(
|
|
3454
|
+
const z = this._layerVisible[y] !== !1 ? "visible" : "none";
|
|
3455
|
+
for (const S of x)
|
|
3456
|
+
this._map.getLayer(S) && this._map.setLayoutProperty(S, "visibility", z);
|
|
3453
3457
|
}
|
|
3454
3458
|
const r = this._layerVisible.amm !== !1 ? "visible" : "none";
|
|
3455
3459
|
for (const y of Pt)
|
|
@@ -3511,21 +3515,21 @@ class ri {
|
|
|
3511
3515
|
setLayerVisible(r, u) {
|
|
3512
3516
|
if (this._layerVisible[r] = u, r === "terrain") {
|
|
3513
3517
|
const x = u ? "visible" : "none";
|
|
3514
|
-
for (const
|
|
3515
|
-
this._map.getLayer(
|
|
3518
|
+
for (const z of Zt)
|
|
3519
|
+
this._map.getLayer(z) && this._map.setLayoutProperty(z, "visibility", x);
|
|
3516
3520
|
this._map.setTerrain(u ? { source: "terrain", exaggeration: 4 } : null);
|
|
3517
3521
|
return;
|
|
3518
3522
|
}
|
|
3519
3523
|
if (r === "contour") {
|
|
3520
3524
|
const x = u ? "visible" : "none";
|
|
3521
|
-
for (const
|
|
3522
|
-
this._map.getLayer(
|
|
3525
|
+
for (const z of Jt)
|
|
3526
|
+
this._map.getLayer(z) && this._map.setLayoutProperty(z, "visibility", x);
|
|
3523
3527
|
return;
|
|
3524
3528
|
}
|
|
3525
3529
|
if (r === "amm") {
|
|
3526
3530
|
const x = u ? "visible" : "none";
|
|
3527
|
-
for (const
|
|
3528
|
-
this._map.getLayer(
|
|
3531
|
+
for (const z of Pt)
|
|
3532
|
+
this._map.getLayer(z) && this._map.setLayoutProperty(z, "visibility", x);
|
|
3529
3533
|
return;
|
|
3530
3534
|
}
|
|
3531
3535
|
const g = Ct[r];
|