bluestar-maplibre 1.1.7 → 1.1.8
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/index.js
CHANGED
|
@@ -13,7 +13,7 @@ var Ft = (r, e, t, n) => ({
|
|
|
13
13
|
return a(r, e, n);
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
-
import { reactive as Ge, watch as
|
|
16
|
+
import { reactive as Ge, watch as P, provide as Ln, onMounted as sr, onUnmounted as Sn, inject as _n, defineComponent as $e, getCurrentInstance as kn, onBeforeUnmount as Bt, openBlock as N, createElementBlock as Z, normalizeClass as pe, normalizeStyle as tt, renderSlot as Dt, Fragment as Ee, renderList as Ze, computed as pr, shallowRef as Mn, unref as Xt, withModifiers as Vn, createCommentVNode as be, ref as le, toRaw as mr, createElementVNode as y, createTextVNode as qe, toDisplayString as ce, withDirectives as ke, vModelText as et, withKeys as Wt, createVNode as zt, Transition as Bn, withCtx as Gr, useModel as Dn, createBlock as Yr, createStaticVNode as Nn, vModelDynamic as Zn, vModelSelect as Gn } from "vue";
|
|
17
17
|
import { addSourceType as Fr, Evented as Pr, Event as Xr, Map as Yn, addProtocol as Fn, removeProtocol as Pn } from "maplibre-gl";
|
|
18
18
|
import { v4 as Ct } from "uuid";
|
|
19
19
|
import { Color as ft, EventListenControl as Xn, createUseApiInterceptor as Wr, fontSize as Ht, decodeWegFile as vr, encodeGzip as Wn, WebGLTool as zn } from "bluestar-util";
|
|
@@ -42,8 +42,8 @@ var O = /* @__PURE__ */ (() => {
|
|
|
42
42
|
for (var r = new Uint8Array(128), e = 0; e < 64; e++) r[e < 26 ? e + 65 : e < 52 ? e + 71 : e < 62 ? e - 4 : e * 4 - 205] = e;
|
|
43
43
|
return (t) => {
|
|
44
44
|
for (var n = t.length, o = new Uint8Array((n - (t[n - 1] == "=") - (t[n - 2] == "=")) * 3 / 4 | 0), i = 0, s = 0; i < n; ) {
|
|
45
|
-
var l = r[t.charCodeAt(i++)],
|
|
46
|
-
o[s++] = l << 2 |
|
|
45
|
+
var l = r[t.charCodeAt(i++)], c = r[t.charCodeAt(i++)], u = r[t.charCodeAt(i++)], h = r[t.charCodeAt(i++)];
|
|
46
|
+
o[s++] = l << 2 | c >> 4, o[s++] = c << 4 | u >> 2, o[s++] = u << 6 | h;
|
|
47
47
|
}
|
|
48
48
|
return o;
|
|
49
49
|
};
|
|
@@ -126,12 +126,12 @@ var rt, re, ue, Xe, vt, Lr, ao = (Lr = class extends Pr {
|
|
|
126
126
|
}, Lr);
|
|
127
127
|
function io({ x: r, y: e, z: t }, n) {
|
|
128
128
|
if (!n) return !0;
|
|
129
|
-
const [o, i] = xt([r, e, t]), [s, l] = xt([r + 1, e + 1, t]),
|
|
129
|
+
const [o, i] = xt([r, e, t]), [s, l] = xt([r + 1, e + 1, t]), c = Math.min(...n.lat), u = Math.max(...n.lat);
|
|
130
130
|
let [h, d] = n.lon;
|
|
131
|
-
return d > 180 && s <= 0 && (h -= 360, d -= 360), !(
|
|
131
|
+
return d > 180 && s <= 0 && (h -= 360, d -= 360), !(c > i || u < l || h > s || d < o);
|
|
132
132
|
}
|
|
133
133
|
function Hr({ x: r, y: e, z: t }, n, o, i, s = 1) {
|
|
134
|
-
const l = 2 ** t,
|
|
134
|
+
const l = 2 ** t, c = 120 / o / l, { x: u, y: h, lon: d, lat: p } = n, f = Math.abs((d[1] - d[0]) / (u - 1)), m = Math.abs((p[1] - p[0]) / (h - 1)), v = Math.ceil(c / f) * f, x = Math.ceil(c / m) * m;
|
|
135
135
|
let [R, C] = xt([r, e, t]), [b, B] = xt([r + 1, e + 1, t]);
|
|
136
136
|
if (R -= v * s, b += v * s, C = Math.min(C + v * s, 85), B = Math.max(B - v * s, -85), R = R - (R - d[0]) % v, C = C - (C - p[0]) % x, i) {
|
|
137
137
|
let [T, I] = i.lon;
|
|
@@ -151,8 +151,8 @@ function Hr({ x: r, y: e, z: t }, n, o, i, s = 1) {
|
|
|
151
151
|
function Kr(r, e, t, n) {
|
|
152
152
|
const [o, i] = Hr(r, e, t, n), s = [];
|
|
153
153
|
for (const l of i)
|
|
154
|
-
for (const
|
|
155
|
-
s.push([
|
|
154
|
+
for (const c of o)
|
|
155
|
+
s.push([c, l]);
|
|
156
156
|
return s;
|
|
157
157
|
}
|
|
158
158
|
function Or(r, [e, t]) {
|
|
@@ -220,14 +220,14 @@ var We, nt, de, Me, Ae, Ve, ze, me, He, Se, Kt, ot, Et, At, Rt, Ot, Sr, lr = (Sr
|
|
|
220
220
|
r.state = "unloaded";
|
|
221
221
|
return;
|
|
222
222
|
}
|
|
223
|
-
const { width: i, height: s } = o, l = i,
|
|
223
|
+
const { width: i, height: s } = o, l = i, c = a(this, de).painter.context.gl;
|
|
224
224
|
if (r.texture)
|
|
225
225
|
r.texture.bind();
|
|
226
226
|
else {
|
|
227
|
-
let
|
|
228
|
-
|
|
227
|
+
let u = a(this, de).renderFactory.getTexture(l);
|
|
228
|
+
u ? c.bindTexture(c.TEXTURE_2D, u) : (u = c.createTexture(), c.bindTexture(c.TEXTURE_2D, u), c.texStorage2D(c.TEXTURE_2D, 1, c.RGBA8, i, s), c.texParameteri(c.TEXTURE_2D, c.TEXTURE_MIN_FILTER, c.LINEAR_MIPMAP_LINEAR), c.texParameteri(c.TEXTURE_2D, c.TEXTURE_MAG_FILTER, c.LINEAR), c.texParameteri(c.TEXTURE_2D, c.TEXTURE_WRAP_S, c.CLAMP_TO_EDGE), c.texParameteri(c.TEXTURE_2D, c.TEXTURE_WRAP_T, c.CLAMP_TO_EDGE)), r.texture = { bind: () => c.bindTexture(c.TEXTURE_2D, u), texture: u };
|
|
229
229
|
}
|
|
230
|
-
|
|
230
|
+
c.texSubImage2D(c.TEXTURE_2D, 0, 0, 0, i, s, c.RGBA, c.UNSIGNED_BYTE, o), o.close(), r.updateTime = e, r.state = "loaded", n > 0 && requestAnimationFrame(() => a(this, ot).call(this, r));
|
|
231
231
|
}
|
|
232
232
|
});
|
|
233
233
|
A(this, Et, async (r) => {
|
|
@@ -338,19 +338,19 @@ function uo(r, e, t, n) {
|
|
|
338
338
|
const o = r.createProgram();
|
|
339
339
|
if (r.attachShader(o, e), r.attachShader(o, t), n && r.transformFeedbackVaryings(o, n, r.SEPARATE_ATTRIBS), r.linkProgram(o), !r.getProgramParameter(o, r.LINK_STATUS))
|
|
340
340
|
throw new Error("Unable to initialize the shader program: " + r.getProgramInfoLog(o));
|
|
341
|
-
const i = l(), s =
|
|
341
|
+
const i = l(), s = c();
|
|
342
342
|
return { gl: r, program: o, uniform: i, attribute: s };
|
|
343
343
|
function l() {
|
|
344
|
-
const
|
|
345
|
-
for (let d = 0; d <
|
|
344
|
+
const u = r.getProgramParameter(o, r.ACTIVE_UNIFORMS), h = {};
|
|
345
|
+
for (let d = 0; d < u; d++) {
|
|
346
346
|
const { name: p, type: f, size: m } = r.getActiveUniform(o, d), v = r.getUniformLocation(o, p);
|
|
347
347
|
v && (h[p] = { type: f, location: v, size: m });
|
|
348
348
|
}
|
|
349
349
|
return h;
|
|
350
350
|
}
|
|
351
|
-
function
|
|
352
|
-
const
|
|
353
|
-
for (let d = 0; d <
|
|
351
|
+
function c() {
|
|
352
|
+
const u = r.getProgramParameter(o, r.ACTIVE_ATTRIBUTES), h = {};
|
|
353
|
+
for (let d = 0; d < u; d++) {
|
|
354
354
|
const { name: p, type: f } = r.getActiveAttrib(o, d), m = r.getAttribLocation(o, p);
|
|
355
355
|
h[p] = { type: f, index: m };
|
|
356
356
|
}
|
|
@@ -374,22 +374,22 @@ function $r(r, e, t) {
|
|
|
374
374
|
function Ut(r, e, t, n) {
|
|
375
375
|
const o = r.createVertexArray();
|
|
376
376
|
r.bindVertexArray(o), mo(e, t), r.bindVertexArray(null);
|
|
377
|
-
const i = t.count, s = t.attribute.indices, l = s !== void 0,
|
|
378
|
-
return { gl: r, vao: o, count: i, mode: n, type:
|
|
377
|
+
const i = t.count, s = t.attribute.indices, l = s !== void 0, c = r.UNSIGNED_SHORT, u = l ? s.offset ?? 0 : 0;
|
|
378
|
+
return { gl: r, vao: o, count: i, mode: n, type: c, offset: u, indices: l };
|
|
379
379
|
}
|
|
380
380
|
function po(r, { x: e, y: t } = { x: 64, y: 64 }) {
|
|
381
381
|
const n = Pt / e, o = Pt / t, i = e + 1, s = new Uint8Array(i * (t + 1) * 2), l = new Uint16Array((i * 2 + 1) * t);
|
|
382
|
-
let
|
|
382
|
+
let c = 0, u = 0;
|
|
383
383
|
for (let h = 0; h < t; h++) {
|
|
384
384
|
for (let d = 0; d <= e; d++) {
|
|
385
|
-
s[
|
|
385
|
+
s[c++] = d * n, s[c++] = h * o;
|
|
386
386
|
const p = h * i + d;
|
|
387
|
-
l[
|
|
387
|
+
l[u++] = p, l[u++] = p + i;
|
|
388
388
|
}
|
|
389
|
-
l[
|
|
389
|
+
l[u++] = 65535;
|
|
390
390
|
}
|
|
391
391
|
for (let h = 0; h <= e; h++)
|
|
392
|
-
s[
|
|
392
|
+
s[c++] = h * n, s[c++] = Pt;
|
|
393
393
|
return cr(r, {
|
|
394
394
|
a_pos: { size: 2, data: s, type: r.UNSIGNED_BYTE },
|
|
395
395
|
indices: { size: 1, data: l, type: r.UNSIGNED_SHORT }
|
|
@@ -401,10 +401,10 @@ function cr(r, e) {
|
|
|
401
401
|
throw new Error("The buffer data of indices must be Uint16Array!");
|
|
402
402
|
let o = 0;
|
|
403
403
|
for (const i in e) {
|
|
404
|
-
const { size: s, data: l, divisor:
|
|
404
|
+
const { size: s, data: l, divisor: c, stride: u, offset: h, normalize: d, type: p } = e[i], f = r.createBuffer();
|
|
405
405
|
if (!f) throw new Error("Unable to initialize buffer!");
|
|
406
406
|
const m = i === "indices" ? r.ELEMENT_ARRAY_BUFFER : r.ARRAY_BUFFER;
|
|
407
|
-
r.bindBuffer(m, f), r.bufferData(m, l, r.STATIC_DRAW), t[i] = { size: s, type: p, normalize: d === !0, stride:
|
|
407
|
+
r.bindBuffer(m, f), r.bufferData(m, l, r.STATIC_DRAW), t[i] = { size: s, type: p, normalize: d === !0, stride: u ?? 0, offset: h ?? 0, divisor: c ?? 0, buffer: f };
|
|
408
408
|
const v = (l.length - (h ?? 0)) / s;
|
|
409
409
|
o = o === 0 ? v : Math.min(o, v);
|
|
410
410
|
}
|
|
@@ -414,67 +414,67 @@ function yt(r, e) {
|
|
|
414
414
|
const { gl: t, uniform: n } = r;
|
|
415
415
|
let o = 0;
|
|
416
416
|
for (const i in n) {
|
|
417
|
-
const { type: s, location: l, size:
|
|
418
|
-
if (e.hasOwnProperty(i) &&
|
|
417
|
+
const { type: s, location: l, size: c } = n[i], u = e[i];
|
|
418
|
+
if (e.hasOwnProperty(i) && u !== void 0)
|
|
419
419
|
switch (s) {
|
|
420
420
|
case WebGL2RenderingContext.FLOAT:
|
|
421
|
-
t.uniform1f(l,
|
|
421
|
+
t.uniform1f(l, u);
|
|
422
422
|
break;
|
|
423
423
|
case WebGL2RenderingContext.FLOAT_VEC2:
|
|
424
|
-
t.uniform2fv(l,
|
|
424
|
+
t.uniform2fv(l, u);
|
|
425
425
|
break;
|
|
426
426
|
case WebGL2RenderingContext.FLOAT_VEC3:
|
|
427
|
-
t.uniform3fv(l,
|
|
427
|
+
t.uniform3fv(l, u);
|
|
428
428
|
break;
|
|
429
429
|
case WebGL2RenderingContext.FLOAT_VEC4:
|
|
430
|
-
t.uniform4fv(l,
|
|
430
|
+
t.uniform4fv(l, u);
|
|
431
431
|
break;
|
|
432
432
|
case WebGL2RenderingContext.INT:
|
|
433
433
|
case WebGL2RenderingContext.BOOL:
|
|
434
|
-
t.uniform1i(l,
|
|
434
|
+
t.uniform1i(l, u);
|
|
435
435
|
break;
|
|
436
436
|
case WebGL2RenderingContext.INT_VEC2:
|
|
437
437
|
case WebGL2RenderingContext.BOOL_VEC2:
|
|
438
|
-
t.uniform2iv(l,
|
|
438
|
+
t.uniform2iv(l, u);
|
|
439
439
|
break;
|
|
440
440
|
case WebGL2RenderingContext.INT_VEC3:
|
|
441
441
|
case WebGL2RenderingContext.BOOL_VEC3:
|
|
442
|
-
t.uniform3iv(l,
|
|
442
|
+
t.uniform3iv(l, u);
|
|
443
443
|
break;
|
|
444
444
|
case WebGL2RenderingContext.INT_VEC4:
|
|
445
445
|
case WebGL2RenderingContext.BOOL_VEC4:
|
|
446
|
-
t.uniform4iv(l,
|
|
446
|
+
t.uniform4iv(l, u);
|
|
447
447
|
break;
|
|
448
448
|
case WebGL2RenderingContext.UNSIGNED_INT:
|
|
449
|
-
t.uniform1ui(l,
|
|
449
|
+
t.uniform1ui(l, u);
|
|
450
450
|
break;
|
|
451
451
|
case WebGL2RenderingContext.UNSIGNED_INT_VEC2:
|
|
452
|
-
t.uniform2uiv(l,
|
|
452
|
+
t.uniform2uiv(l, u);
|
|
453
453
|
break;
|
|
454
454
|
case WebGL2RenderingContext.UNSIGNED_INT_VEC3:
|
|
455
|
-
t.uniform3uiv(l,
|
|
455
|
+
t.uniform3uiv(l, u);
|
|
456
456
|
break;
|
|
457
457
|
case WebGL2RenderingContext.UNSIGNED_INT_VEC4:
|
|
458
|
-
t.uniform4uiv(l,
|
|
458
|
+
t.uniform4uiv(l, u);
|
|
459
459
|
break;
|
|
460
460
|
case WebGL2RenderingContext.FLOAT_MAT2:
|
|
461
|
-
t.uniformMatrix2fv(l, !1,
|
|
461
|
+
t.uniformMatrix2fv(l, !1, u);
|
|
462
462
|
break;
|
|
463
463
|
case WebGL2RenderingContext.FLOAT_MAT3:
|
|
464
|
-
t.uniformMatrix3fv(l, !1,
|
|
464
|
+
t.uniformMatrix3fv(l, !1, u);
|
|
465
465
|
break;
|
|
466
466
|
case WebGL2RenderingContext.FLOAT_MAT4:
|
|
467
|
-
t.uniformMatrix4fv(l, !1,
|
|
467
|
+
t.uniformMatrix4fv(l, !1, u);
|
|
468
468
|
break;
|
|
469
469
|
case WebGL2RenderingContext.SAMPLER_2D:
|
|
470
470
|
case WebGL2RenderingContext.INT_SAMPLER_2D:
|
|
471
471
|
case WebGL2RenderingContext.UNSIGNED_INT_SAMPLER_2D:
|
|
472
|
-
t.activeTexture(WebGL2RenderingContext.TEXTURE0 + o), t.bindTexture(WebGL2RenderingContext.TEXTURE_2D,
|
|
472
|
+
t.activeTexture(WebGL2RenderingContext.TEXTURE0 + o), t.bindTexture(WebGL2RenderingContext.TEXTURE_2D, u), t.uniform1i(l, o), o += c;
|
|
473
473
|
break;
|
|
474
474
|
case WebGL2RenderingContext.SAMPLER_3D:
|
|
475
475
|
case WebGL2RenderingContext.INT_SAMPLER_3D:
|
|
476
476
|
case WebGL2RenderingContext.UNSIGNED_INT_SAMPLER_3D:
|
|
477
|
-
t.uniform1i(l, o), t.activeTexture(WebGL2RenderingContext.TEXTURE0 + o), t.bindTexture(WebGL2RenderingContext.TEXTURE_3D,
|
|
477
|
+
t.uniform1i(l, o), t.activeTexture(WebGL2RenderingContext.TEXTURE0 + o), t.bindTexture(WebGL2RenderingContext.TEXTURE_3D, u), o += c;
|
|
478
478
|
break;
|
|
479
479
|
default:
|
|
480
480
|
throw new Error("The uniform's type is undefined! type: " + s);
|
|
@@ -487,7 +487,7 @@ function yt(r, e) {
|
|
|
487
487
|
case WebGL2RenderingContext.SAMPLER_3D:
|
|
488
488
|
case WebGL2RenderingContext.INT_SAMPLER_3D:
|
|
489
489
|
case WebGL2RenderingContext.UNSIGNED_INT_SAMPLER_3D:
|
|
490
|
-
o +=
|
|
490
|
+
o += c;
|
|
491
491
|
break;
|
|
492
492
|
}
|
|
493
493
|
}
|
|
@@ -497,13 +497,13 @@ function mo(r, e) {
|
|
|
497
497
|
i && t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, i.buffer);
|
|
498
498
|
for (const s in n)
|
|
499
499
|
if (o.hasOwnProperty(s)) {
|
|
500
|
-
const { type: l, index:
|
|
501
|
-
switch (t.bindBuffer(t.ARRAY_BUFFER,
|
|
500
|
+
const { type: l, index: c } = n[s], { buffer: u, type: h, size: d, normalize: p, stride: f, divisor: m, offset: v } = o[s];
|
|
501
|
+
switch (t.bindBuffer(t.ARRAY_BUFFER, u), l) {
|
|
502
502
|
case WebGL2RenderingContext.FLOAT:
|
|
503
503
|
case WebGL2RenderingContext.FLOAT_VEC2:
|
|
504
504
|
case WebGL2RenderingContext.FLOAT_VEC3:
|
|
505
505
|
case WebGL2RenderingContext.FLOAT_VEC4:
|
|
506
|
-
t.vertexAttribPointer(
|
|
506
|
+
t.vertexAttribPointer(c, d, h, p, f, v);
|
|
507
507
|
break;
|
|
508
508
|
case WebGL2RenderingContext.BOOL:
|
|
509
509
|
case WebGL2RenderingContext.INT:
|
|
@@ -514,12 +514,12 @@ function mo(r, e) {
|
|
|
514
514
|
case WebGL2RenderingContext.UNSIGNED_INT_VEC2:
|
|
515
515
|
case WebGL2RenderingContext.UNSIGNED_INT_VEC3:
|
|
516
516
|
case WebGL2RenderingContext.UNSIGNED_INT_VEC4:
|
|
517
|
-
t.vertexAttribIPointer(
|
|
517
|
+
t.vertexAttribIPointer(c, d, h, f, v);
|
|
518
518
|
break;
|
|
519
519
|
default:
|
|
520
520
|
throw new Error("The buffer's type is undefined! type: " + l);
|
|
521
521
|
}
|
|
522
|
-
t.enableVertexAttribArray(
|
|
522
|
+
t.enableVertexAttribArray(c), m && t.vertexAttribDivisor && t.vertexAttribDivisor(c, m);
|
|
523
523
|
}
|
|
524
524
|
}
|
|
525
525
|
function Qt(r) {
|
|
@@ -963,7 +963,7 @@ function iso(xs, ys, data, interval) {
|
|
|
963
963
|
const max = Math.max(v0, v1);
|
|
964
964
|
if (array) {
|
|
965
965
|
for (const v of interval) {
|
|
966
|
-
const o =
|
|
966
|
+
const o = 10 ** (4 + (Math.abs(v) > 1e-9 ? ~~Math.log10(Math.abs(v) + 1e-9) : 0));
|
|
967
967
|
const ov = Math.round(o * v);
|
|
968
968
|
if (Math.round(o * min) < ov && ov <= Math.round(o * max)) {
|
|
969
969
|
const c = { x: x2, y: y2, z };
|
|
@@ -1304,10 +1304,10 @@ function rn(r, e, t, n = !1) {
|
|
|
1304
1304
|
}
|
|
1305
1305
|
s.fillStyle = t[o.length - 1], s.fillRect(l - 1, 0, 1, 1), e.u_color_range = [d, p];
|
|
1306
1306
|
}
|
|
1307
|
-
let
|
|
1308
|
-
|
|
1309
|
-
const
|
|
1310
|
-
r.texSubImage2D(r.TEXTURE_2D, 0, 0, 0, l, 1, r.RGBA, r.UNSIGNED_BYTE,
|
|
1307
|
+
let c = e.u_color;
|
|
1308
|
+
c ? r.bindTexture(r.TEXTURE_2D, c) : (c = r.createTexture(), r.bindTexture(r.TEXTURE_2D, c), r.texStorage2D(r.TEXTURE_2D, 1, r.RGBA8, l, 1), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MIN_FILTER, r.NEAREST), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_S, r.CLAMP_TO_EDGE), e.u_color = c);
|
|
1309
|
+
const u = i.transferToImageBitmap();
|
|
1310
|
+
r.texSubImage2D(r.TEXTURE_2D, 0, 0, 0, l, 1, r.RGBA, r.UNSIGNED_BYTE, u), u.close(), r.bindTexture(r.TEXTURE_2D, null);
|
|
1311
1311
|
}
|
|
1312
1312
|
function nn(r, e) {
|
|
1313
1313
|
return !e && tn(r) ? "uint" : "float";
|
|
@@ -1316,9 +1316,9 @@ function bt(r, e, t, n = !1) {
|
|
|
1316
1316
|
let o, i = 1;
|
|
1317
1317
|
Array.isArray(e) ? (o = e[0], e.length > 1 && (i = 2)) : o = e;
|
|
1318
1318
|
const s = nn(o, n), l = `${s}-${t}-${n}`;
|
|
1319
|
-
let
|
|
1320
|
-
return
|
|
1321
|
-
function
|
|
1319
|
+
let c = u(e, l);
|
|
1320
|
+
return c || (c = {}, Vo(r, c, e, t, n), e.texture.get(r)[l] = i === 1 ? [c.u_data00] : [c.u_data00, c.u_data01], e.info[l] = c), { number: i, filter: t, type: s, useLog: n, uniforms: c };
|
|
1321
|
+
function u(h, d) {
|
|
1322
1322
|
return h.texture || (h.texture = /* @__PURE__ */ new WeakMap()), (!h.texture.get(r) || !h.info) && (h.texture.set(r, {}), h.info = {}), h.info[d];
|
|
1323
1323
|
}
|
|
1324
1324
|
}
|
|
@@ -1326,17 +1326,17 @@ function gr(r, e, t, n, o, i) {
|
|
|
1326
1326
|
const s = t === "linear" ? r.LINEAR : r.NEAREST;
|
|
1327
1327
|
if (o === 1 && i === 1)
|
|
1328
1328
|
return Je(r, r.R8, e.x, e.y, r.RED, r.UNSIGNED_BYTE, e.data, s, n ? r.REPEAT : r.CLAMP_TO_EDGE);
|
|
1329
|
-
const l = Math.floor(e.x / o),
|
|
1329
|
+
const l = Math.floor(e.x / o), c = Math.floor(e.y / i), u = new Uint8Array(l * c);
|
|
1330
1330
|
let h = 0;
|
|
1331
1331
|
for (let d = 0; d < e.y; d += i) {
|
|
1332
1332
|
const p = d * e.x;
|
|
1333
1333
|
for (let f = 0; f < e.x; f += o)
|
|
1334
|
-
|
|
1334
|
+
u[h++] = e.data[p + f];
|
|
1335
1335
|
}
|
|
1336
|
-
return Je(r, r.R8, l,
|
|
1336
|
+
return Je(r, r.R8, l, c, r.RED, r.UNSIGNED_BYTE, u, s, n ? r.REPEAT : r.CLAMP_TO_EDGE);
|
|
1337
1337
|
}
|
|
1338
1338
|
function br(r, e, t, n, o, i) {
|
|
1339
|
-
const s = e.data, l = typeof window.Float16Array == "function",
|
|
1339
|
+
const s = e.data, l = typeof window.Float16Array == "function", c = Math.floor(e.x / o), u = Math.floor(e.y / i), h = l ? new Float16Array(c * u) : new Float32Array(c * u), d = 1 << e.data.BYTES_PER_ELEMENT * 8 - 1, p = e.zeroNaN;
|
|
1340
1340
|
let f = 0;
|
|
1341
1341
|
for (let v = 0; v < e.y; v += i) {
|
|
1342
1342
|
const x = v * e.x;
|
|
@@ -1349,8 +1349,8 @@ function br(r, e, t, n, o, i) {
|
|
|
1349
1349
|
return Je(
|
|
1350
1350
|
r,
|
|
1351
1351
|
r.R16F,
|
|
1352
|
-
u,
|
|
1353
1352
|
c,
|
|
1353
|
+
u,
|
|
1354
1354
|
r.RED,
|
|
1355
1355
|
l ? r.HALF_FLOAT : r.FLOAT,
|
|
1356
1356
|
l ? new Uint16Array(h.buffer) : h,
|
|
@@ -1362,17 +1362,17 @@ function Ir(r, e, t, n, o, i) {
|
|
|
1362
1362
|
const s = t === "linear" ? r.LINEAR : r.NEAREST;
|
|
1363
1363
|
if (o === 1 && i === 1)
|
|
1364
1364
|
return Je(r, r.R32F, e.x, e.y, r.RED, r.FLOAT, e.data, s, n ? r.REPEAT : r.CLAMP_TO_EDGE);
|
|
1365
|
-
const l = Math.floor(e.x / o),
|
|
1365
|
+
const l = Math.floor(e.x / o), c = Math.floor(e.y / i), u = new Float32Array(l * c);
|
|
1366
1366
|
let h = 0;
|
|
1367
1367
|
for (let d = 0; d < e.y; d += i) {
|
|
1368
1368
|
const p = d * e.x;
|
|
1369
1369
|
for (let f = 0; f < e.x; f += o)
|
|
1370
|
-
|
|
1370
|
+
u[h++] = e.data[p + f];
|
|
1371
1371
|
}
|
|
1372
|
-
return Je(r, r.R32F, l,
|
|
1372
|
+
return Je(r, r.R32F, l, c, r.RED, r.FLOAT, u, s, n ? r.REPEAT : r.CLAMP_TO_EDGE);
|
|
1373
1373
|
}
|
|
1374
1374
|
function Cr(r, e, t, n, o, i) {
|
|
1375
|
-
const s = e.data, l = typeof window.Float16Array == "function",
|
|
1375
|
+
const s = e.data, l = typeof window.Float16Array == "function", c = Math.floor(e.x / o), u = Math.floor(e.y / i), h = l ? new Float16Array(c * u) : new Float32Array(c * u);
|
|
1376
1376
|
if (tn(e)) {
|
|
1377
1377
|
const { reference: f, scale: m, zeroNaN: v } = e;
|
|
1378
1378
|
let x = 0;
|
|
@@ -1395,8 +1395,8 @@ function Cr(r, e, t, n, o, i) {
|
|
|
1395
1395
|
return Je(
|
|
1396
1396
|
r,
|
|
1397
1397
|
r.R16F,
|
|
1398
|
-
u,
|
|
1399
1398
|
c,
|
|
1399
|
+
u,
|
|
1400
1400
|
r.RED,
|
|
1401
1401
|
l ? r.HALF_FLOAT : r.FLOAT,
|
|
1402
1402
|
l ? new Uint16Array(h.buffer) : h,
|
|
@@ -1404,26 +1404,26 @@ function Cr(r, e, t, n, o, i) {
|
|
|
1404
1404
|
n ? r.REPEAT : r.CLAMP_TO_EDGE
|
|
1405
1405
|
);
|
|
1406
1406
|
}
|
|
1407
|
-
function Je(r, e, t, n, o, i, s, l,
|
|
1408
|
-
const
|
|
1409
|
-
return r.bindTexture(r.TEXTURE_2D,
|
|
1407
|
+
function Je(r, e, t, n, o, i, s, l, c) {
|
|
1408
|
+
const u = r.createTexture();
|
|
1409
|
+
return r.bindTexture(r.TEXTURE_2D, u), r.pixelStorei(r.UNPACK_ALIGNMENT, 1), r.texStorage2D(r.TEXTURE_2D, 1, e, t, n), r.texSubImage2D(r.TEXTURE_2D, 0, 0, 0, t, n, o, i, s), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MIN_FILTER, l), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MAG_FILTER, l), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_S, c), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_T, r.CLAMP_TO_EDGE), r.bindTexture(r.TEXTURE_2D, null), u;
|
|
1410
1410
|
}
|
|
1411
1411
|
function Vo(r, e, t, n, o) {
|
|
1412
1412
|
let i, s = null;
|
|
1413
1413
|
Array.isArray(t) ? (i = t[0], t.length === 2 && (s = t[1])) : i = t;
|
|
1414
|
-
const l = nn(i, o),
|
|
1414
|
+
const l = nn(i, o), c = r.getParameter(r.MAX_TEXTURE_SIZE), u = Math.ceil(i.x / c), h = Math.ceil(i.y / c), d = i.lon[0], f = (i.lon[1] - d) / (i.x - 1) * u, m = Math.floor(i.x / u);
|
|
1415
1415
|
e.u_data_lon = [d - f / 2, d + f * (m - 0.5)];
|
|
1416
1416
|
const v = i.lat[0], R = (i.lat[1] - v) / (i.y - 1) * h, C = Math.floor(i.y / h);
|
|
1417
1417
|
e.u_data_lat = [v - R / 2, v + R * (C - 0.5)];
|
|
1418
1418
|
const b = Math.round(e.u_data_lon[1] - e.u_data_lon[0]) === 360;
|
|
1419
1419
|
if (l === "uint") {
|
|
1420
1420
|
const L = i;
|
|
1421
|
-
if (L.zeroNaN || L.data.BYTES_PER_ELEMENT > 1 ? (e.u_data00 = br(r, L, n, b,
|
|
1421
|
+
if (L.zeroNaN || L.data.BYTES_PER_ELEMENT > 1 ? (e.u_data00 = br(r, L, n, b, u, h), e.u_data00_info = B(L.reference, L.scale, L.data.BYTES_PER_ELEMENT * 8)) : (e.u_data00 = gr(r, L, n, b, u, h), e.u_data00_info = [L.reference, L.scale * 255]), s) {
|
|
1422
1422
|
const M = s;
|
|
1423
|
-
M.zeroNaN || M.data.BYTES_PER_ELEMENT > 1 ? (e.u_data01 = br(r, M, n, b,
|
|
1423
|
+
M.zeroNaN || M.data.BYTES_PER_ELEMENT > 1 ? (e.u_data01 = br(r, M, n, b, u, h), e.u_data01_info = B(M.reference, M.scale, M.data.BYTES_PER_ELEMENT * 8)) : (e.u_data01 = gr(r, M, n, b, u, h), e.u_data01_info = [M.reference, M.scale * 255]);
|
|
1424
1424
|
}
|
|
1425
1425
|
} else if (l === "float")
|
|
1426
|
-
e.u_data00 = o ? Cr(r, i, n, b,
|
|
1426
|
+
e.u_data00 = o ? Cr(r, i, n, b, u, h) : Ir(r, i, n, b, u, h), s && (e.u_data01 = o ? Cr(r, s, n, b, u, h) : Ir(r, s, n, b, u, h));
|
|
1427
1427
|
else
|
|
1428
1428
|
throw new Error(`Unknown data texture type: ${l}`);
|
|
1429
1429
|
function B(L, M, T) {
|
|
@@ -1488,19 +1488,19 @@ var Do = O("I2luY2x1ZGUgPGhlYWRlcl92ZXJ0ZXg+DQojaW5jbHVkZSA8ZGVmaW5lPg0KdW5pZm9y
|
|
|
1488
1488
|
let l;
|
|
1489
1489
|
if (i > 0) {
|
|
1490
1490
|
a(this, ne).u_transition = i / (a(this, se).transition ?? a(this, ae).transition);
|
|
1491
|
-
const
|
|
1492
|
-
l = S(this, $, tr).call(this, s,
|
|
1491
|
+
const u = bt(e, a(this, W), n, o), h = bt(e, a(this, ee), n, o);
|
|
1492
|
+
l = S(this, $, tr).call(this, s, u, h), Object.assign(a(this, ne), u.uniforms);
|
|
1493
1493
|
for (let d in h.uniforms)
|
|
1494
1494
|
a(this, ne)[d.replace("u_data0", "u_data1")] = h.uniforms[d];
|
|
1495
1495
|
a(this, ae).triggerRepaint();
|
|
1496
1496
|
} else {
|
|
1497
1497
|
E(this, De, 0), E(this, ee, null);
|
|
1498
|
-
const
|
|
1499
|
-
l = S(this, $, tr).call(this, s,
|
|
1498
|
+
const u = bt(e, a(this, W), n, o);
|
|
1499
|
+
l = S(this, $, tr).call(this, s, u), Object.assign(a(this, ne), u.uniforms);
|
|
1500
1500
|
}
|
|
1501
1501
|
a(this, ne).u_matrix = S(this, $, sn).call(this, t), e.useProgram(l.program), e.enable(e.CULL_FACE), yt(l, a(this, ne));
|
|
1502
|
-
const
|
|
1503
|
-
Qt(
|
|
1502
|
+
const c = a(this, Ce).vao(s, () => S(this, $, ln).call(this, e, s, l));
|
|
1503
|
+
Qt(c);
|
|
1504
1504
|
}
|
|
1505
1505
|
setOptions(e) {
|
|
1506
1506
|
var t;
|
|
@@ -1513,20 +1513,20 @@ var Do = O("I2luY2x1ZGUgPGhlYWRlcl92ZXJ0ZXg+DQojaW5jbHVkZSA8ZGVmaW5lPg0KdW5pZm9y
|
|
|
1513
1513
|
const n = a(this, se), o = a(this, ne);
|
|
1514
1514
|
t && e.color && rn(a(this, ae).painter.context.gl, o, e.color, a(this, Ue)), E(this, se, Object.assign(n, e)), Bo(o, n), on(o, n.bound), an(o, n);
|
|
1515
1515
|
}, tr = function(e, t, n) {
|
|
1516
|
-
const { number: o, type: i } = t, s = n !== void 0, l = `heatmap:${e}-${o}-${i + (s ? "-" + n.type : "")}-${a(this, se).mask ? "mask" : "unmask"}`,
|
|
1516
|
+
const { number: o, type: i } = t, s = n !== void 0, l = `heatmap:${e}-${o}-${i + (s ? "-" + n.type : "")}-${a(this, se).mask ? "mask" : "unmask"}`, c = e === "globe";
|
|
1517
1517
|
return a(this, Ce).program(
|
|
1518
1518
|
l,
|
|
1519
|
-
() => a(this, Ce).vertex("heatmap:" + e, Do, () =>
|
|
1519
|
+
() => a(this, Ce).vertex("heatmap:" + e, Do, () => c ? "#define GLOBE" : ""),
|
|
1520
1520
|
() => a(this, Ce).fragment(
|
|
1521
1521
|
l,
|
|
1522
1522
|
No,
|
|
1523
1523
|
() => {
|
|
1524
|
-
const
|
|
1525
|
-
if (
|
|
1524
|
+
const u = [];
|
|
1525
|
+
if (c && u.push("GLOBE"), u.push(o === 1 ? "DATA_GRID" : "DATA_GRID_UV"), i === "uint" ? u.push("DATA0_UINT") : i === "float" && u.push("DATA0_FLOAT"), s) {
|
|
1526
1526
|
const h = n.type;
|
|
1527
|
-
|
|
1527
|
+
u.push("DATA1"), h === "uint" ? u.push("DATA1_UINT") : h === "float" && u.push("DATA1_FLOAT");
|
|
1528
1528
|
}
|
|
1529
|
-
return
|
|
1529
|
+
return u.map((h) => "#define " + h).join(`
|
|
1530
1530
|
`);
|
|
1531
1531
|
}
|
|
1532
1532
|
)
|
|
@@ -1554,11 +1554,11 @@ function Fo(r) {
|
|
|
1554
1554
|
return r.data.BYTES_PER_ELEMENT <= 2;
|
|
1555
1555
|
}
|
|
1556
1556
|
function cn(r, e, t, n, o, i, s, l) {
|
|
1557
|
-
const
|
|
1558
|
-
if (
|
|
1557
|
+
const c = Math.round((l - i[0]) / n);
|
|
1558
|
+
if (c < 0 || c >= e) return -1;
|
|
1559
1559
|
s - o[0] >= 360 && (s -= 360), o[1] - s >= 360 && (s += 360);
|
|
1560
|
-
const
|
|
1561
|
-
return
|
|
1560
|
+
const u = Math.round((s - o[0]) / t);
|
|
1561
|
+
return u < 0 || u >= r ? -1 : c * r + u;
|
|
1562
1562
|
}
|
|
1563
1563
|
function un(r, e) {
|
|
1564
1564
|
if (e < 0) return NaN;
|
|
@@ -1568,19 +1568,19 @@ function un(r, e) {
|
|
|
1568
1568
|
}
|
|
1569
1569
|
}
|
|
1570
1570
|
function Le(r, e) {
|
|
1571
|
-
const { x: t, y: n, lon: o, lat: i } = r, s = new Float32Array(e.length), l = (o[1] - o[0]) / (t - 1),
|
|
1572
|
-
for (let
|
|
1573
|
-
const [h, d] = e[
|
|
1574
|
-
s[
|
|
1571
|
+
const { x: t, y: n, lon: o, lat: i } = r, s = new Float32Array(e.length), l = (o[1] - o[0]) / (t - 1), c = (i[1] - i[0]) / (n - 1);
|
|
1572
|
+
for (let u = 0; u < e.length; u++) {
|
|
1573
|
+
const [h, d] = e[u], p = cn(t, n, l, c, o, i, h, d);
|
|
1574
|
+
s[u] = un(r, p);
|
|
1575
1575
|
}
|
|
1576
1576
|
return s;
|
|
1577
1577
|
}
|
|
1578
1578
|
function pt(r, e, t) {
|
|
1579
|
-
const { x: n, y: o, lon: i, lat: s } = r, l = new Float32Array(e.length * t.length),
|
|
1579
|
+
const { x: n, y: o, lon: i, lat: s } = r, l = new Float32Array(e.length * t.length), c = (i[1] - i[0]) / (n - 1), u = (s[1] - s[0]) / (o - 1);
|
|
1580
1580
|
let h = 0;
|
|
1581
1581
|
for (const d of t)
|
|
1582
1582
|
for (const p of e) {
|
|
1583
|
-
const f = cn(n, o,
|
|
1583
|
+
const f = cn(n, o, c, u, i, s, p, d);
|
|
1584
1584
|
l[h++] = un(r, f);
|
|
1585
1585
|
}
|
|
1586
1586
|
return l;
|
|
@@ -1632,10 +1632,10 @@ var Po = {
|
|
|
1632
1632
|
for (let m = 0; m < s.length; m++)
|
|
1633
1633
|
s[m] = p * s[m] + d * f[m];
|
|
1634
1634
|
}
|
|
1635
|
-
const l = [],
|
|
1635
|
+
const l = [], c = a(this, z).min, u = a(this, z).max;
|
|
1636
1636
|
for (let d = 0; d < s.length; d++) {
|
|
1637
1637
|
const p = s[d];
|
|
1638
|
-
if (isNaN(p) || p <
|
|
1638
|
+
if (isNaN(p) || p < c || p > u) continue;
|
|
1639
1639
|
const [f, m] = Or(e, i[d]);
|
|
1640
1640
|
l.push(f, m, p);
|
|
1641
1641
|
}
|
|
@@ -1742,10 +1742,10 @@ var Ko = {
|
|
|
1742
1742
|
}, Y = new WeakMap(), lt = new WeakMap(), Mt = new WeakSet(), fn = function(e, t, n) {
|
|
1743
1743
|
const { bound: o } = a(this, Y), i = Array.isArray(this.data0) ? this.data0[0] : this.data0, s = Kr(e, i, a(this, Y).cell, o);
|
|
1744
1744
|
if (s.length === 0) return null;
|
|
1745
|
-
const l = p(this.data0, s),
|
|
1745
|
+
const l = p(this.data0, s), c = t === "uv";
|
|
1746
1746
|
if (n > 0) {
|
|
1747
1747
|
const f = n, m = 1 - f, v = p(this.data1, s);
|
|
1748
|
-
if (
|
|
1748
|
+
if (c)
|
|
1749
1749
|
for (let x = 0; x < l.length; x++)
|
|
1750
1750
|
l[x] = m * l[x] + f * v[x];
|
|
1751
1751
|
else
|
|
@@ -1754,14 +1754,14 @@ var Ko = {
|
|
|
1754
1754
|
R > 180 && (R -= 360), R < -180 && (R += 360), l[x] = l[x] + m * R;
|
|
1755
1755
|
}
|
|
1756
1756
|
}
|
|
1757
|
-
const
|
|
1757
|
+
const u = [], h = a(this, Y).min, d = a(this, Y).max;
|
|
1758
1758
|
for (let f = 0; f < s.length; f++) {
|
|
1759
|
-
const m = l[2 * f], v = l[2 * f + 1], x =
|
|
1759
|
+
const m = l[2 * f], v = l[2 * f + 1], x = c ? Math.hypot(m, v) : m;
|
|
1760
1760
|
if (isNaN(x) || x < h || x > d) continue;
|
|
1761
1761
|
const [R, C] = Or(e, s[f]);
|
|
1762
|
-
|
|
1762
|
+
u.push(R, C, m, v);
|
|
1763
1763
|
}
|
|
1764
|
-
return
|
|
1764
|
+
return u.length > 0 ? new Float32Array(u).buffer : null;
|
|
1765
1765
|
function p(f, m) {
|
|
1766
1766
|
let v, x;
|
|
1767
1767
|
Array.isArray(f) ? f.length === 1 ? v = Le(f[0], m) : (v = Le(f[0], m), x = Le(f[1], m)) : v = Le(f, m);
|
|
@@ -1782,12 +1782,12 @@ var Ko = {
|
|
|
1782
1782
|
size: 1,
|
|
1783
1783
|
speed: 1,
|
|
1784
1784
|
elevation: 0
|
|
1785
|
-
}, ve,
|
|
1785
|
+
}, ve, X, Qe, te, ye, J, je, Te, oe, H, V, pn, mn, vn, yn, gn, bn, In, It, Cn, nr, or, ar, xn, En, ir, Nr, ta = (Nr = class extends jr {
|
|
1786
1786
|
constructor(e) {
|
|
1787
1787
|
super(e);
|
|
1788
1788
|
A(this, V);
|
|
1789
1789
|
A(this, ve);
|
|
1790
|
-
A(this,
|
|
1790
|
+
A(this, X);
|
|
1791
1791
|
A(this, Qe);
|
|
1792
1792
|
A(this, te);
|
|
1793
1793
|
A(this, ye, null);
|
|
@@ -1805,7 +1805,7 @@ var Ko = {
|
|
|
1805
1805
|
onAdd(e, t) {
|
|
1806
1806
|
E(this, ve, e), e.on("movestart", () => {
|
|
1807
1807
|
E(this, je, !0), S(this, V, ir).call(this, t);
|
|
1808
|
-
}), e.on("moveend", () => E(this, je, !1)), e.on("projectiontransition", () => S(this, V, ir).call(this, t)), E(this,
|
|
1808
|
+
}), e.on("moveend", () => E(this, je, !1)), e.on("projectiontransition", () => S(this, V, ir).call(this, t)), E(this, X, e.renderFactory);
|
|
1809
1809
|
const n = e.getSource(this.source);
|
|
1810
1810
|
if (!n) throw new Error(`The source(id:${this.source}) not found!`);
|
|
1811
1811
|
E(this, Qe, n), n.on("data", ({ data: o }) => S(this, V, ar).call(this, o)), S(this, V, or).call(this, a(this, te), !0), S(this, V, ar).call(this, n.lastData());
|
|
@@ -1818,8 +1818,8 @@ var Ko = {
|
|
|
1818
1818
|
S(this, V, pn).call(this, e);
|
|
1819
1819
|
const n = a(this, J), o = t.shaderData.variantName, i = bt(e, a(this, ye), "linear");
|
|
1820
1820
|
Object.assign(n, i.uniforms), S(this, V, En).call(this, t);
|
|
1821
|
-
const s = S(this, V, mn).call(this, o, i.type), l = S(this, V, vn).call(this),
|
|
1822
|
-
n.u_scale = 1 / 2 ** Math.max(1, a(this, ve).getZoom() - 1), e.useProgram(s.program), e.bindVertexArray(
|
|
1821
|
+
const s = S(this, V, mn).call(this, o, i.type), l = S(this, V, vn).call(this), c = S(this, V, gn).call(this), u = S(this, V, Cn).call(this, e, s.program, c.program), h = a(this, Te);
|
|
1822
|
+
n.u_scale = 1 / 2 ** Math.max(1, a(this, ve).getZoom() - 1), e.useProgram(s.program), e.bindVertexArray(u.feedbackVao), yt(s, n), e.enable(e.RASTERIZER_DISCARD), e.bindTransformFeedback(e.TRANSFORM_FEEDBACK, u.feedback), e.beginTransformFeedback(e.POINTS), e.drawArrays(e.POINTS, 0, h), e.endTransformFeedback(), e.bindTransformFeedback(e.TRANSFORM_FEEDBACK, null), e.disable(e.RASTERIZER_DISCARD), e.bindFramebuffer(e.FRAMEBUFFER, a(this, H).buffer), e.useProgram(l.program), e.enable(e.BLEND), e.blendColor(0, 0, 0, n.u_disappear), e.blendFunc(e.ZERO, e.CONSTANT_ALPHA), Qt(S(this, V, yn).call(this, e, l)), e.disable(e.BLEND), e.useProgram(c.program), e.bindVertexArray(u.drawVao), yt(c, n), e.drawArraysInstanced(e.TRIANGLE_STRIP, 0, 4, h), e.bindFramebuffer(e.FRAMEBUFFER, null);
|
|
1823
1823
|
const d = S(this, V, bn).call(this);
|
|
1824
1824
|
e.useProgram(d.program), yt(d, n), Qt(S(this, V, In).call(this, e, d)), a(this, ve).triggerRepaint();
|
|
1825
1825
|
}
|
|
@@ -1827,7 +1827,7 @@ var Ko = {
|
|
|
1827
1827
|
var t;
|
|
1828
1828
|
S(this, V, or).call(this, e, e.color !== void 0 && Jr((t = a(this, te)) == null ? void 0 : t.color, e.color)), a(this, ve).triggerRepaint();
|
|
1829
1829
|
}
|
|
1830
|
-
}, ve = new WeakMap(),
|
|
1830
|
+
}, ve = new WeakMap(), X = new WeakMap(), Qe = new WeakMap(), te = new WeakMap(), ye = new WeakMap(), J = new WeakMap(), je = new WeakMap(), Te = new WeakMap(), oe = new WeakMap(), H = new WeakMap(), V = new WeakSet(), pn = function(e) {
|
|
1831
1831
|
const t = e.drawingBufferWidth, n = e.drawingBufferHeight;
|
|
1832
1832
|
if (a(this, H).width === t && a(this, H).height === n)
|
|
1833
1833
|
return;
|
|
@@ -1840,36 +1840,36 @@ var Ko = {
|
|
|
1840
1840
|
a(this, J).u_size = [s / t, s / n];
|
|
1841
1841
|
}, mn = function(e, t) {
|
|
1842
1842
|
const n = `${fe.feedback}:${e}-${t}-${a(this, te).type}-${a(this, te).mask ? "mask" : "unmask"}`, o = e === "globe";
|
|
1843
|
-
return a(this,
|
|
1843
|
+
return a(this, X).program(
|
|
1844
1844
|
n,
|
|
1845
|
-
() => a(this,
|
|
1845
|
+
() => a(this, X).vertex(n, jo, () => {
|
|
1846
1846
|
const i = ["DATA_GRID_UV"];
|
|
1847
1847
|
return o && i.push("GLOBE"), t === "uint" ? i.push("DATA0_UINT") : t === "float" && i.push("DATA0_FLOAT"), i.map((s) => "#define " + s).join(`
|
|
1848
1848
|
`);
|
|
1849
1849
|
}),
|
|
1850
|
-
() => a(this,
|
|
1850
|
+
() => a(this, X).fragment(fe.blend, xr),
|
|
1851
1851
|
["v_data"]
|
|
1852
1852
|
);
|
|
1853
1853
|
}, vn = function() {
|
|
1854
|
-
return a(this,
|
|
1854
|
+
return a(this, X).program(fe.blend, () => a(this, X).vertex(fe.screen, Er), () => a(this, X).fragment(fe.blend, xr));
|
|
1855
1855
|
}, yn = function(e, t) {
|
|
1856
|
-
return a(this,
|
|
1856
|
+
return a(this, X).vao(fe.blend, () => {
|
|
1857
1857
|
const n = S(this, V, It).call(this, e);
|
|
1858
1858
|
return Ut(e, t, n, e.TRIANGLE_STRIP);
|
|
1859
1859
|
});
|
|
1860
1860
|
}, gn = function() {
|
|
1861
1861
|
const e = fe.draw;
|
|
1862
|
-
return a(this,
|
|
1862
|
+
return a(this, X).program(e, () => a(this, X).vertex(e, Jo), () => a(this, X).fragment(e, $o));
|
|
1863
1863
|
}, bn = function() {
|
|
1864
1864
|
const e = fe.screen;
|
|
1865
|
-
return a(this,
|
|
1865
|
+
return a(this, X).program(e, () => a(this, X).vertex(e, Er), () => a(this, X).fragment(e, qo));
|
|
1866
1866
|
}, In = function(e, t) {
|
|
1867
|
-
return a(this,
|
|
1867
|
+
return a(this, X).vao(fe.screen, () => {
|
|
1868
1868
|
const n = S(this, V, It).call(this, e);
|
|
1869
1869
|
return Ut(e, t, n, e.TRIANGLE_STRIP);
|
|
1870
1870
|
});
|
|
1871
1871
|
}, It = function(e) {
|
|
1872
|
-
return a(this,
|
|
1872
|
+
return a(this, X).buffer(
|
|
1873
1873
|
fe.screen,
|
|
1874
1874
|
() => cr(e, { a_pos: { size: 2, data: new Int8Array([-1, 1, -1, -1, 1, 1, 1, -1]), type: e.BYTE } })
|
|
1875
1875
|
);
|
|
@@ -1881,24 +1881,24 @@ var Ko = {
|
|
|
1881
1881
|
const o = S(this, V, It).call(this, e).attribute.a_pos.buffer, i = l(a(this, Te) * 16, e.DYNAMIC_DRAW), s = l(a(this, Te) * 16, e.DYNAMIC_DRAW);
|
|
1882
1882
|
return E(this, oe, [{
|
|
1883
1883
|
buffer: i,
|
|
1884
|
-
feedbackVao:
|
|
1885
|
-
feedback:
|
|
1884
|
+
feedbackVao: u(t, i),
|
|
1885
|
+
feedback: c(s),
|
|
1886
1886
|
drawVao: h(n, o, [s, i])
|
|
1887
1887
|
}, {
|
|
1888
1888
|
buffer: s,
|
|
1889
|
-
feedbackVao:
|
|
1890
|
-
feedback:
|
|
1889
|
+
feedbackVao: u(t, s),
|
|
1890
|
+
feedback: c(null),
|
|
1891
1891
|
drawVao: h(n, o, [i, s])
|
|
1892
1892
|
}]), S(this, V, nr).call(this, e), a(this, oe)[0];
|
|
1893
1893
|
function l(d, p) {
|
|
1894
1894
|
const f = e.createBuffer();
|
|
1895
1895
|
return e.bindBuffer(e.ARRAY_BUFFER, f), e.bufferData(e.ARRAY_BUFFER, d, p), f;
|
|
1896
1896
|
}
|
|
1897
|
-
function
|
|
1897
|
+
function c(d) {
|
|
1898
1898
|
const p = e.createTransformFeedback();
|
|
1899
1899
|
return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK, p), d && e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER, 0, d), p;
|
|
1900
1900
|
}
|
|
1901
|
-
function
|
|
1901
|
+
function u(d, p) {
|
|
1902
1902
|
const f = e.createVertexArray();
|
|
1903
1903
|
e.bindVertexArray(f), e.bindBuffer(e.ARRAY_BUFFER, p);
|
|
1904
1904
|
const m = e.getAttribLocation(d, "a_data");
|
|
@@ -1935,12 +1935,12 @@ var Ko = {
|
|
|
1935
1935
|
a(this, ye) && a(this, Qe).unlink(a(this, ye)), E(this, ye, S(this, V, xn).call(this, e)), a(this, ye) && a(this, Qe).link(a(this, ye)), a(this, ve).triggerRepaint();
|
|
1936
1936
|
}, xn = function(e) {
|
|
1937
1937
|
if (a(this, te).type === "uv" || !e || !Array.isArray(e) || e.length != 2) return e;
|
|
1938
|
-
const t = e[0].data, n = "reference" in e[0] ? e[0].reference : 0, o = "scale" in e[0] ? e[0].scale : 1, i = "reference" in e[1] ? e[1].reference : 0, s = "scale" in e[1] ? e[1].scale : 1, { x: l, y:
|
|
1938
|
+
const t = e[0].data, n = "reference" in e[0] ? e[0].reference : 0, o = "scale" in e[0] ? e[0].scale : 1, i = "reference" in e[1] ? e[1].reference : 0, s = "scale" in e[1] ? e[1].scale : 1, { x: l, y: c, lon: u, lat: h, data: d } = e[1], p = new Float32Array(d.length), f = new Float32Array(d.length);
|
|
1939
1939
|
for (let m = 0; m < d.length; m++) {
|
|
1940
1940
|
const v = (t[m] * o + n) * Math.PI / 180, x = -(d[m] * s + i);
|
|
1941
1941
|
p[m] = x * Math.sin(v), f[m] = x * Math.cos(v);
|
|
1942
1942
|
}
|
|
1943
|
-
return [{ x: l, y:
|
|
1943
|
+
return [{ x: l, y: c, lon: u, lat: h, data: p }, { x: l, y: c, lon: u, lat: h, data: f }];
|
|
1944
1944
|
}, En = function({ shaderData: e, defaultProjectionData: t }) {
|
|
1945
1945
|
const n = e.variantName === "globe";
|
|
1946
1946
|
a(this, J).u_matrix = n ? a(this, ve).transform.getProjectionData({
|
|
@@ -1951,9 +1951,9 @@ var Ko = {
|
|
|
1951
1951
|
a(this, J).u_matrix_inverse = void 0, a(this, H).buffer && (S(this, V, nr).call(this, e), e.bindFramebuffer(e.FRAMEBUFFER, a(this, H).buffer), e.clearColor(0, 0, 0, 0), e.clear(e.COLOR_BUFFER_BIT), e.bindFramebuffer(e.FRAMEBUFFER, null));
|
|
1952
1952
|
}, Nr);
|
|
1953
1953
|
function ra(r, e) {
|
|
1954
|
-
const t = e[0], n = e[1], o = e[2], i = e[3], s = e[4], l = e[5],
|
|
1954
|
+
const t = e[0], n = e[1], o = e[2], i = e[3], s = e[4], l = e[5], c = e[6], u = e[7], h = e[8], d = e[9], p = e[10], f = e[11], m = e[12], v = e[13], x = e[14], R = e[15], C = t * l - n * s, b = t * c - o * s, B = t * u - i * s, L = n * c - o * l, M = n * u - i * l, T = o * u - i * c, I = h * v - d * m, w = h * x - p * m, _ = h * R - f * m, k = d * x - p * v, G = d * R - f * v, F = p * R - f * x;
|
|
1955
1955
|
let D = C * F - b * G + B * k + L * _ - M * w + T * I;
|
|
1956
|
-
D && (D = 1 / D, r[0] = (l * F -
|
|
1956
|
+
D && (D = 1 / D, r[0] = (l * F - c * G + u * k) * D, r[1] = (o * G - n * F - i * k) * D, r[2] = (v * T - x * M + R * L) * D, r[3] = (p * M - d * T - f * L) * D, r[4] = (c * _ - s * F - u * w) * D, r[5] = (t * F - o * _ + i * w) * D, r[6] = (x * B - m * T - R * b) * D, r[7] = (h * T - p * B + f * b) * D, r[8] = (s * G - l * _ + u * I) * D, r[9] = (n * _ - t * G - i * I) * D, r[10] = (m * M - v * B + R * C) * D, r[11] = (d * B - h * M - f * C) * D, r[12] = (l * w - s * k - c * I) * D, r[13] = (t * k - n * w + o * I) * D, r[14] = (v * b - m * L - x * C) * D, r[15] = (h * L - d * b + p * C) * D);
|
|
1957
1957
|
}
|
|
1958
1958
|
var na = "isoline-tile", oa = 2;
|
|
1959
1959
|
aa(oa * 2 + 1, 1);
|
|
@@ -1962,15 +1962,15 @@ function aa(r, e) {
|
|
|
1962
1962
|
for (let o = 0; o < e; o++) {
|
|
1963
1963
|
const i = new Float32Array(r), s = new Float32Array(r);
|
|
1964
1964
|
n[t * o] = 1;
|
|
1965
|
-
const l = o / e,
|
|
1966
|
-
for (let
|
|
1967
|
-
i[
|
|
1965
|
+
const l = o / e, c = (e - o) / e;
|
|
1966
|
+
for (let u = 0; u < r; ++u) {
|
|
1967
|
+
i[u] = u + l, s[u] = u + c;
|
|
1968
1968
|
let h = 0;
|
|
1969
|
-
for (let d = 0; d <
|
|
1970
|
-
const p = s[d], f = i[
|
|
1969
|
+
for (let d = 0; d < u + 1; ++d) {
|
|
1970
|
+
const p = s[d], f = i[u - d], m = n[t * o + d] / (p + f);
|
|
1971
1971
|
n[t * o + d] = h + p * m, h = f * m;
|
|
1972
1972
|
}
|
|
1973
|
-
n[t * o +
|
|
1973
|
+
n[t * o + u + 1] = h;
|
|
1974
1974
|
}
|
|
1975
1975
|
}
|
|
1976
1976
|
return n;
|
|
@@ -2008,10 +2008,10 @@ var mt = {
|
|
|
2008
2008
|
const o = a(this, ge), i = t > 0 || o.label === null ? void 0 : {
|
|
2009
2009
|
...o.label,
|
|
2010
2010
|
convert: o.label.convert.toString()
|
|
2011
|
-
}, { width: s, color: l, dash:
|
|
2012
|
-
below: { width: ((d =
|
|
2013
|
-
at: { width: ((m =
|
|
2014
|
-
above: { width: ((R =
|
|
2011
|
+
}, { width: s, color: l, dash: c } = o, u = o.style ?? {}, h = {
|
|
2012
|
+
below: { width: ((d = u.below) == null ? void 0 : d.width) ?? s, color: ((p = u.below) == null ? void 0 : p.color) ?? l, dash: ((f = u.below) == null ? void 0 : f.dash) ?? c },
|
|
2013
|
+
at: { width: ((m = u.at) == null ? void 0 : m.width) ?? s, color: ((v = u.at) == null ? void 0 : v.color) ?? l, dash: ((x = u.at) == null ? void 0 : x.dash) ?? c },
|
|
2014
|
+
above: { width: ((R = u.above) == null ? void 0 : R.width) ?? s, color: ((C = u.above) == null ? void 0 : C.color) ?? l, dash: ((b = u.above) == null ? void 0 : b.dash) ?? c }
|
|
2015
2015
|
};
|
|
2016
2016
|
return this.renderFactory.exec(na, {
|
|
2017
2017
|
canvas: { type: "2d", size: this.tileSize * 2 },
|
|
@@ -2041,12 +2041,12 @@ var mt = {
|
|
|
2041
2041
|
for (let v = 0; v < l.length; v++)
|
|
2042
2042
|
l[v] = f * l[v] + p * m[v];
|
|
2043
2043
|
}
|
|
2044
|
-
const
|
|
2044
|
+
const c = 2 + i.length + s.length, u = new Float32Array(c + l.length);
|
|
2045
2045
|
let h = 0;
|
|
2046
|
-
|
|
2047
|
-
for (const p of i)
|
|
2048
|
-
for (const p of s)
|
|
2049
|
-
return
|
|
2046
|
+
u[h++] = i.length, u[h++] = s.length;
|
|
2047
|
+
for (const p of i) u[h++] = Ur(e, p);
|
|
2048
|
+
for (const p of s) u[h++] = Qr(e, p);
|
|
2049
|
+
return u.set(l, c), u.buffer;
|
|
2050
2050
|
function d(p, f, m) {
|
|
2051
2051
|
if (!Array.isArray(p)) return pt(p, f, m);
|
|
2052
2052
|
if (p.length === 1) return pt(p[0], f, m);
|
|
@@ -2237,13 +2237,14 @@ class ca {
|
|
|
2237
2237
|
}
|
|
2238
2238
|
/** 创建热力图图层 */
|
|
2239
2239
|
createColorMapLayer(e) {
|
|
2240
|
-
const { colorRamp: t, colorRampDefaultColor: n, linearValue: o,
|
|
2241
|
-
n &&
|
|
2240
|
+
const { colorRamp: t, colorRampDefaultColor: n, linearValue: o, linearColorRamp: i, alpha: s } = this.state, l = t.map((c) => [c.value, c.color]).flat();
|
|
2241
|
+
n && l.unshift(n), this.colorMapLayer = new Go({
|
|
2242
2242
|
id: this.colorMapId,
|
|
2243
2243
|
source: e.ftype === "UV" ? this.valueDirectionSourceId : this.sourceId,
|
|
2244
2244
|
dataFilter: o ? "linear" : "nearest",
|
|
2245
|
-
|
|
2246
|
-
|
|
2245
|
+
colorRampFilter: i ? "linear" : "nearest",
|
|
2246
|
+
color: l,
|
|
2247
|
+
opacity: s,
|
|
2247
2248
|
elevation: 0
|
|
2248
2249
|
});
|
|
2249
2250
|
}
|
|
@@ -2285,12 +2286,12 @@ class ca {
|
|
|
2285
2286
|
}
|
|
2286
2287
|
/** 创建向量和粒子图层 */
|
|
2287
2288
|
createVectorAndParticleLayers(e) {
|
|
2288
|
-
const { level: t, vectorColor: n, cell: o, vectorImage: i, particleConfig: s, colorRamp: l } = this.state,
|
|
2289
|
+
const { level: t, vectorColor: n, cell: o, vectorImage: i, particleConfig: s, colorRamp: l } = this.state, c = e.ftype.toLowerCase();
|
|
2289
2290
|
this.vectorLayer = new Qo({
|
|
2290
2291
|
id: this.vectorLayerId,
|
|
2291
2292
|
source: this.valueDirectionSourceId,
|
|
2292
2293
|
level: [...t],
|
|
2293
|
-
type:
|
|
2294
|
+
type: c,
|
|
2294
2295
|
color: n,
|
|
2295
2296
|
cell: o,
|
|
2296
2297
|
image: {
|
|
@@ -2310,7 +2311,7 @@ class ca {
|
|
|
2310
2311
|
size: s.size,
|
|
2311
2312
|
speed: s.speed,
|
|
2312
2313
|
disappear: s.disappear,
|
|
2313
|
-
type:
|
|
2314
|
+
type: c
|
|
2314
2315
|
});
|
|
2315
2316
|
}
|
|
2316
2317
|
// ======================== 图层添加与可见性 ========================
|
|
@@ -2336,6 +2337,7 @@ function ua() {
|
|
|
2336
2337
|
gridValue: !1,
|
|
2337
2338
|
level: [0, 0.2, 1.5, 3.3, 5.4, 7.9, 10.7, 13.8, 17.1, 20.7, 24.4, 28.4, 32.6, 36.9, 41.4, 46.1, 50.9, 56, 61.2],
|
|
2338
2339
|
linearValue: !1,
|
|
2340
|
+
linearColorRamp: !1,
|
|
2339
2341
|
contour: [],
|
|
2340
2342
|
contourStyle: {
|
|
2341
2343
|
width: 2,
|
|
@@ -2402,7 +2404,7 @@ class ur {
|
|
|
2402
2404
|
/** 将用户配置合并到响应式 state 中 */
|
|
2403
2405
|
applyConfig(e) {
|
|
2404
2406
|
const t = this.state;
|
|
2405
|
-
e.name !== void 0 && (t.name = e.name), e.colorRamp && (t.colorRamp = e.colorRamp), e.colorRampDefaultColor !== void 0 && (t.colorRampDefaultColor = e.colorRampDefaultColor), e.fillFulling !== void 0 && (t.fillFulling = e.fillFulling), e.linearValue !== void 0 && (t.linearValue = e.linearValue), e.gridValue !== void 0 && (t.gridValue = e.gridValue), e.gridValueFormat && (t.gridValueFormat = e.gridValueFormat), e.direction !== void 0 && (t.direction = e.direction), e.alpha !== void 0 && (t.alpha = e.alpha), e.zeroToNaN !== void 0 && (t.zeroToNaN = e.zeroToNaN), e.particle !== void 0 && (t.particle = e.particle), e.level && (t.level = [...e.level]), e.cell !== void 0 && (t.cell = e.cell), e.vectorColor !== void 0 && (t.vectorColor = e.vectorColor), e.vectorImage && (t.vectorImage = { ...e.vectorImage }), e.contour && (t.contour = [...e.contour]), e.contourStyle && Object.assign(t.contourStyle, e.contourStyle), e.contourLabel && Object.assign(t.contourLabel, e.contourLabel), e.gridValueStyle && Object.assign(t.gridValueStyle, e.gridValueStyle), e.particleConfig && Object.assign(t.particleConfig, e.particleConfig), e.particleSize !== void 0 && (t.particleConfig.size = e.particleSize), e.particleSpeed !== void 0 && (t.particleConfig.speed = e.particleSpeed), e.particleDisappear !== void 0 && (t.particleConfig.disappear = e.particleDisappear), e.particleColorRamp && (t.particleConfig.colorRamp = e.particleColorRamp);
|
|
2407
|
+
e.name !== void 0 && (t.name = e.name), e.colorRamp && (t.colorRamp = e.colorRamp), e.colorRampDefaultColor !== void 0 && (t.colorRampDefaultColor = e.colorRampDefaultColor), e.fillFulling !== void 0 && (t.fillFulling = e.fillFulling), e.linearValue !== void 0 && (t.linearValue = e.linearValue), e.linearColorRamp !== void 0 && (t.linearColorRamp = e.linearColorRamp), e.gridValue !== void 0 && (t.gridValue = e.gridValue), e.gridValueFormat && (t.gridValueFormat = e.gridValueFormat), e.direction !== void 0 && (t.direction = e.direction), e.alpha !== void 0 && (t.alpha = e.alpha), e.zeroToNaN !== void 0 && (t.zeroToNaN = e.zeroToNaN), e.particle !== void 0 && (t.particle = e.particle), e.level && (t.level = [...e.level]), e.cell !== void 0 && (t.cell = e.cell), e.vectorColor !== void 0 && (t.vectorColor = e.vectorColor), e.vectorImage && (t.vectorImage = { ...e.vectorImage }), e.contour && (t.contour = [...e.contour]), e.contourStyle && Object.assign(t.contourStyle, e.contourStyle), e.contourLabel && Object.assign(t.contourLabel, e.contourLabel), e.gridValueStyle && Object.assign(t.gridValueStyle, e.gridValueStyle), e.particleConfig && Object.assign(t.particleConfig, e.particleConfig), e.particleSize !== void 0 && (t.particleConfig.size = e.particleSize), e.particleSpeed !== void 0 && (t.particleConfig.speed = e.particleSpeed), e.particleDisappear !== void 0 && (t.particleConfig.disappear = e.particleDisappear), e.particleColorRamp && (t.particleConfig.colorRamp = e.particleColorRamp);
|
|
2406
2408
|
}
|
|
2407
2409
|
/**
|
|
2408
2410
|
* 绑定图层引用并启动 watcher 监听
|
|
@@ -2413,21 +2415,21 @@ class ur {
|
|
|
2413
2415
|
}
|
|
2414
2416
|
/** 建立 watch 监听:state 变化 → 自动更新图层 */
|
|
2415
2417
|
setupWatchers() {
|
|
2416
|
-
this._watchersSetup || (this._watchersSetup = !0,
|
|
2418
|
+
this._watchersSetup || (this._watchersSetup = !0, P(() => this.state.fillFulling, (e) => {
|
|
2417
2419
|
this.colorMapId && this.viewer.setLayoutProperty(this.colorMapId, "visibility", e ? "visible" : "none");
|
|
2418
|
-
}),
|
|
2420
|
+
}), P(() => this.state.particle, (e) => {
|
|
2419
2421
|
this.particleLayer && (this.particleLayer.visible = e);
|
|
2420
|
-
}),
|
|
2422
|
+
}), P(() => this.state.gridValue, (e) => {
|
|
2421
2423
|
this.gridValueId && this.viewer.setLayoutProperty(this.gridValueId, "visibility", e ? "visible" : "none");
|
|
2422
|
-
}),
|
|
2424
|
+
}), P(() => this.state.direction, (e) => {
|
|
2423
2425
|
this.vectorLayerId && this.viewer.setLayoutProperty(this.vectorLayerId, "visibility", e ? "visible" : "none");
|
|
2424
|
-
}),
|
|
2426
|
+
}), P(() => this.state.level, (e) => {
|
|
2425
2427
|
this.vectorLayer && this.vectorLayer.setOptions({ level: [...this.state.level], color: this.state.vectorColor });
|
|
2426
|
-
}),
|
|
2428
|
+
}), P(() => this.state.vectorColor, (e) => {
|
|
2427
2429
|
this.vectorLayer && this.vectorLayer.setOptions({ color: e, level: [...this.state.level], cell: this.state.cell });
|
|
2428
|
-
}),
|
|
2430
|
+
}), P(() => this.state.cell, (e) => {
|
|
2429
2431
|
this.vectorLayer && this.vectorLayer.setOptions({ cell: e, level: [...this.state.level], color: this.state.vectorColor }), this.gridValueLayer && this.gridValueLayer.setOptions({ cell: e ?? 4 });
|
|
2430
|
-
}),
|
|
2432
|
+
}), P(() => this.state.colorRamp, () => this.updateHeatmapLayer()), P(() => this.state.colorRampDefaultColor, () => this.updateHeatmapLayer()), P(() => this.state.alpha, () => this.updateHeatmapLayer()), P(() => this.state.linearValue, () => this.updateHeatmapLayer()), P(() => this.state.linearColorRamp, () => this.updateHeatmapLayer()), P(() => this.state.contour, () => this.updateIsolineLayer(), { deep: !0 }), P(() => this.state.contourStyle, () => this.updateIsolineLayer(), { deep: !0 }), P(() => this.state.contourLabel, () => this.updateIsolineLayer(), { deep: !0 }), P(() => this.state.gridValueStyle, () => this.updateTextLayer(), { deep: !0 }), P(() => this.state.gridValueFormat, () => this.updateTextLayer()));
|
|
2431
2433
|
}
|
|
2432
2434
|
// ======================== 图层更新方法 ========================
|
|
2433
2435
|
updateHeatmapLayer() {
|
|
@@ -2946,20 +2948,20 @@ async function Rr(r, e = 1) {
|
|
|
2946
2948
|
const l = o.V.data;
|
|
2947
2949
|
if (!l)
|
|
2948
2950
|
throw new Error("Weg 文件数据为空");
|
|
2949
|
-
const
|
|
2950
|
-
|
|
2951
|
-
const
|
|
2952
|
-
if (!
|
|
2951
|
+
const c = document.createElement("canvas");
|
|
2952
|
+
c.width = t, c.height = n;
|
|
2953
|
+
const u = c.getContext("2d");
|
|
2954
|
+
if (!u)
|
|
2953
2955
|
throw new Error("无法获取 Canvas 2D 上下文");
|
|
2954
|
-
const h =
|
|
2956
|
+
const h = u.createImageData(t, n), d = h.data;
|
|
2955
2957
|
for (let f = 0; f < t * n; f++) {
|
|
2956
2958
|
const m = f * 3, v = f * 4, x = l[m], R = l[m + 1], C = l[m + 2];
|
|
2957
2959
|
d[v] = isNaN(x) ? 0 : Math.round(x), d[v + 1] = isNaN(R) ? 0 : Math.round(R), d[v + 2] = isNaN(C) ? 0 : Math.round(C);
|
|
2958
2960
|
let b = 255;
|
|
2959
2961
|
e !== 1 && (b = Math.round(255 * e)), b = Math.min(255, Math.max(0, b)), d[v + 3] = b;
|
|
2960
2962
|
}
|
|
2961
|
-
return
|
|
2962
|
-
uri: await ha(
|
|
2963
|
+
return u.putImageData(h, 0, 0), {
|
|
2964
|
+
uri: await ha(c),
|
|
2963
2965
|
west: r.west,
|
|
2964
2966
|
north: r.north,
|
|
2965
2967
|
east: r.east,
|
|
@@ -3246,7 +3248,7 @@ class pa {
|
|
|
3246
3248
|
const t = document.querySelectorAll(".bluestar-bubble-container");
|
|
3247
3249
|
if (t.length > 0) {
|
|
3248
3250
|
const n = e.originalEvent, o = t[0].parentElement, i = Array.from(o.children), l = this.map.getCanvas().getBoundingClientRect();
|
|
3249
|
-
let
|
|
3251
|
+
let c, u = -1;
|
|
3250
3252
|
for (let h = 0; h < t.length; h++) {
|
|
3251
3253
|
const d = t[h], p = d.getBoundingClientRect(), f = {
|
|
3252
3254
|
left: p.left - l.left,
|
|
@@ -3256,11 +3258,11 @@ class pa {
|
|
|
3256
3258
|
};
|
|
3257
3259
|
if (f.left < n.offsetX && f.right > n.offsetX && f.top < n.offsetY && f.bottom > n.offsetY) {
|
|
3258
3260
|
let m = i.indexOf(d);
|
|
3259
|
-
m >
|
|
3261
|
+
m > u && (c = d, u = m);
|
|
3260
3262
|
}
|
|
3261
3263
|
}
|
|
3262
|
-
if (
|
|
3263
|
-
const h =
|
|
3264
|
+
if (c) {
|
|
3265
|
+
const h = c.getAttribute("data-bluestar-bubble-id");
|
|
3264
3266
|
if (h !== void 0 && h !== "") {
|
|
3265
3267
|
const d = this.bubbleList.find((p) => p.props.id == h);
|
|
3266
3268
|
d && d.exposed && d.exposed.bubbleClick && d.exposed.bubbleClick();
|
|
@@ -3490,10 +3492,10 @@ const ma = ["data-bluestar-bubble-id"], va = /* @__PURE__ */ $e({
|
|
|
3490
3492
|
function l(d) {
|
|
3491
3493
|
return d != null;
|
|
3492
3494
|
}
|
|
3493
|
-
let
|
|
3494
|
-
function
|
|
3495
|
+
let c;
|
|
3496
|
+
function u() {
|
|
3495
3497
|
if (l(o.lon) && l(o.lat)) {
|
|
3496
|
-
const { x: d, y: p } =
|
|
3498
|
+
const { x: d, y: p } = c.project([o.lon, o.lat]);
|
|
3497
3499
|
s.x = d, s.y = p;
|
|
3498
3500
|
}
|
|
3499
3501
|
}
|
|
@@ -3503,11 +3505,11 @@ const ma = ["data-bluestar-bubble-id"], va = /* @__PURE__ */ $e({
|
|
|
3503
3505
|
}
|
|
3504
3506
|
});
|
|
3505
3507
|
const h = Nt((d) => {
|
|
3506
|
-
|
|
3508
|
+
c = d.viewer, u(), c.on("move", u), o.window || h.blueStar.bubbleList.push(n);
|
|
3507
3509
|
});
|
|
3508
3510
|
return Bt(() => {
|
|
3509
3511
|
const d = h.blueStar.bubbleList.findIndex((p) => n === p);
|
|
3510
|
-
d >= 0 && h.blueStar.bubbleList.splice(d, 1),
|
|
3512
|
+
d >= 0 && h.blueStar.bubbleList.splice(d, 1), c.off("move", u);
|
|
3511
3513
|
}), (d, p) => (N(), Z("div", {
|
|
3512
3514
|
class: pe(["bluestar-bubble-container", { "no-event": o.window ? "" : "no-event" }]),
|
|
3513
3515
|
"data-bluestar-bubble-id": o.id,
|
|
@@ -3540,14 +3542,14 @@ const ma = ["data-bluestar-bubble-id"], va = /* @__PURE__ */ $e({
|
|
|
3540
3542
|
});
|
|
3541
3543
|
Bt(() => {
|
|
3542
3544
|
n.blueStar.viewer.off("move", i);
|
|
3543
|
-
}),
|
|
3545
|
+
}), P(() => [e.data, e.idKey, e.latKey, e.lonKey], i);
|
|
3544
3546
|
let o;
|
|
3545
3547
|
function i() {
|
|
3546
3548
|
o && clearTimeout(o), o = setTimeout(() => {
|
|
3547
|
-
const s = n.blueStar.viewer.getBounds(), l = s.getWest(),
|
|
3549
|
+
const s = n.blueStar.viewer.getBounds(), l = s.getWest(), c = s.getEast(), u = s.getSouth(), h = s.getNorth(), d = [], p = [], f = [];
|
|
3548
3550
|
for (let m = 0; m < e.data.length; m++) {
|
|
3549
3551
|
const v = e.data[m];
|
|
3550
|
-
if (v[e.lonKey] >= l && v[e.lonKey] <=
|
|
3552
|
+
if (v[e.lonKey] >= l && v[e.lonKey] <= c && v[e.latKey] >= u && v[e.latKey] <= h) {
|
|
3551
3553
|
const x = n.blueStar.viewer.project([v[e.lonKey], v[e.latKey]]);
|
|
3552
3554
|
if (!x) break;
|
|
3553
3555
|
const R = p.findIndex((C) => Math.sqrt((C.x - x.x) ** 2 + (C.y - x.y) ** 2) < Ht(e.clusterPixelRange));
|
|
@@ -3557,11 +3559,11 @@ const ma = ["data-bluestar-bubble-id"], va = /* @__PURE__ */ $e({
|
|
|
3557
3559
|
t.list = d, t.groupCountList = f;
|
|
3558
3560
|
}, 100);
|
|
3559
3561
|
}
|
|
3560
|
-
return (s, l) => (N(!0), Z(Ee, null, Ze(t.list, (
|
|
3561
|
-
value:
|
|
3562
|
-
count: t.groupCountList[
|
|
3563
|
-
group: t.groupCountList[
|
|
3564
|
-
key:
|
|
3562
|
+
return (s, l) => (N(!0), Z(Ee, null, Ze(t.list, (c, u) => Dt(s.$slots, "default", {
|
|
3563
|
+
value: c,
|
|
3564
|
+
count: t.groupCountList[u].length,
|
|
3565
|
+
group: t.groupCountList[u],
|
|
3566
|
+
key: c[e.idKey]
|
|
3565
3567
|
})), 128));
|
|
3566
3568
|
}
|
|
3567
3569
|
}), ba = {
|
|
@@ -3583,16 +3585,16 @@ const ma = ["data-bluestar-bubble-id"], va = /* @__PURE__ */ $e({
|
|
|
3583
3585
|
emits: ["click"],
|
|
3584
3586
|
setup(r, { emit: e }) {
|
|
3585
3587
|
const t = r, n = e, o = pr(() => Array.isArray(t.data) ? t.data : t.data ? [t.data] : []), i = pr(() => o.value.length > 0), s = Mn([]), l = {};
|
|
3586
|
-
let
|
|
3587
|
-
function
|
|
3588
|
+
let c = 16;
|
|
3589
|
+
function u() {
|
|
3588
3590
|
return parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;
|
|
3589
3591
|
}
|
|
3590
3592
|
let h, d = null;
|
|
3591
3593
|
Nt((I) => {
|
|
3592
|
-
h = I.viewer,
|
|
3594
|
+
h = I.viewer, c = u(), x(), h.on("move", p), h.on("zoomend", f), h.on("click", T);
|
|
3593
3595
|
}), Bt(() => {
|
|
3594
3596
|
h && (h.off("move", p), h.off("zoomend", f), h.off("click", T)), d == null || d.terminate();
|
|
3595
|
-
}),
|
|
3597
|
+
}), P(
|
|
3596
3598
|
() => [o.value.length, t.lonKey, t.latKey, t.clusterPixelRange],
|
|
3597
3599
|
() => x(),
|
|
3598
3600
|
{ flush: "post" }
|
|
@@ -3601,7 +3603,7 @@ const ma = ["data-bluestar-bubble-id"], va = /* @__PURE__ */ $e({
|
|
|
3601
3603
|
R();
|
|
3602
3604
|
}
|
|
3603
3605
|
function f() {
|
|
3604
|
-
|
|
3606
|
+
c = u(), x();
|
|
3605
3607
|
}
|
|
3606
3608
|
function m(I) {
|
|
3607
3609
|
return new Promise((w) => setTimeout(w, I));
|
|
@@ -3641,7 +3643,7 @@ const ma = ["data-bluestar-bubble-id"], va = /* @__PURE__ */ $e({
|
|
|
3641
3643
|
function R() {
|
|
3642
3644
|
const I = s.value;
|
|
3643
3645
|
if (!I.length || !h) return;
|
|
3644
|
-
const w = t.offsetX *
|
|
3646
|
+
const w = t.offsetX * c, _ = t.offsetY * c;
|
|
3645
3647
|
for (const k of I) {
|
|
3646
3648
|
const G = h.project([
|
|
3647
3649
|
k.original[t.lonKey],
|
|
@@ -3753,7 +3755,7 @@ self.onmessage = function(e) {
|
|
|
3753
3755
|
position: "absolute",
|
|
3754
3756
|
left: 0,
|
|
3755
3757
|
top: 0,
|
|
3756
|
-
transform: `translate3d(${_.x + I.offsetX * Xt(
|
|
3758
|
+
transform: `translate3d(${_.x + I.offsetX * Xt(c)}px,${_.y + I.offsetY * Xt(c)}px,0)`,
|
|
3757
3759
|
// window=false 时始终穿透,拖拽不阻塞,点击由 map.click 命中检测处理
|
|
3758
3760
|
pointerEvents: I.window && I.clickable ? "auto" : "none",
|
|
3759
3761
|
willChange: "transform"
|
|
@@ -3937,7 +3939,7 @@ self.onmessage = function(e) {
|
|
|
3937
3939
|
},
|
|
3938
3940
|
emits: ["confirm", "cancel"],
|
|
3939
3941
|
setup(r, { emit: e }) {
|
|
3940
|
-
const t = r, n = e, o = le([...t.modelValue]), i = le([]), s = le(-1), l = le(!1),
|
|
3942
|
+
const t = r, n = e, o = le([...t.modelValue]), i = le([]), s = le(-1), l = le(!1), c = le(""), u = le(!1), h = le(""), d = le("success");
|
|
3941
3943
|
sr(() => {
|
|
3942
3944
|
i.value = Ra.map((I) => ({
|
|
3943
3945
|
...I,
|
|
@@ -3961,24 +3963,24 @@ self.onmessage = function(e) {
|
|
|
3961
3963
|
localStorage.setItem(Tr, JSON.stringify(T));
|
|
3962
3964
|
}
|
|
3963
3965
|
function f(T, I = "success") {
|
|
3964
|
-
h.value = T, d.value = I,
|
|
3965
|
-
|
|
3966
|
+
h.value = T, d.value = I, u.value = !0, setTimeout(() => {
|
|
3967
|
+
u.value = !1;
|
|
3966
3968
|
}, 2e3);
|
|
3967
3969
|
}
|
|
3968
3970
|
function m() {
|
|
3969
|
-
|
|
3971
|
+
c.value = "", l.value = !0;
|
|
3970
3972
|
}
|
|
3971
3973
|
function v() {
|
|
3972
|
-
l.value = !1,
|
|
3974
|
+
l.value = !1, c.value = "";
|
|
3973
3975
|
}
|
|
3974
3976
|
function x() {
|
|
3975
|
-
if (!
|
|
3977
|
+
if (!c.value.trim()) {
|
|
3976
3978
|
f("请输入色卡名称", "error");
|
|
3977
3979
|
return;
|
|
3978
3980
|
}
|
|
3979
|
-
const T = i.value.findIndex((I) => !I.isPreset && I.name ===
|
|
3981
|
+
const T = i.value.findIndex((I) => !I.isPreset && I.name === c.value.trim());
|
|
3980
3982
|
if (T !== -1)
|
|
3981
|
-
if (confirm(`色卡"${
|
|
3983
|
+
if (confirm(`色卡"${c.value}"已存在,是否覆盖?`))
|
|
3982
3984
|
i.value[T].colors = [...o.value], p(), f("色卡已更新", "success");
|
|
3983
3985
|
else {
|
|
3984
3986
|
v();
|
|
@@ -3986,7 +3988,7 @@ self.onmessage = function(e) {
|
|
|
3986
3988
|
}
|
|
3987
3989
|
else {
|
|
3988
3990
|
const I = {
|
|
3989
|
-
name:
|
|
3991
|
+
name: c.value.trim(),
|
|
3990
3992
|
colors: [...o.value],
|
|
3991
3993
|
isPreset: !1
|
|
3992
3994
|
};
|
|
@@ -4178,7 +4180,7 @@ self.onmessage = function(e) {
|
|
|
4178
4180
|
I[9] || (I[9] = y("h4", null, "保存色卡", -1)),
|
|
4179
4181
|
ke(y("input", {
|
|
4180
4182
|
type: "text",
|
|
4181
|
-
"onUpdate:modelValue": I[0] || (I[0] = (w) =>
|
|
4183
|
+
"onUpdate:modelValue": I[0] || (I[0] = (w) => c.value = w),
|
|
4182
4184
|
placeholder: "请输入色卡名称",
|
|
4183
4185
|
class: "preset-name-input",
|
|
4184
4186
|
onKeyup: [
|
|
@@ -4187,7 +4189,7 @@ self.onmessage = function(e) {
|
|
|
4187
4189
|
],
|
|
4188
4190
|
autofocus: ""
|
|
4189
4191
|
}, null, 544), [
|
|
4190
|
-
[et,
|
|
4192
|
+
[et, c.value]
|
|
4191
4193
|
]),
|
|
4192
4194
|
y("div", { class: "save-dialog-buttons" }, [
|
|
4193
4195
|
y("button", {
|
|
@@ -4203,7 +4205,7 @@ self.onmessage = function(e) {
|
|
|
4203
4205
|
])) : be("", !0),
|
|
4204
4206
|
zt(Bn, { name: "toast" }, {
|
|
4205
4207
|
default: Gr(() => [
|
|
4206
|
-
|
|
4208
|
+
u.value ? (N(), Z("div", {
|
|
4207
4209
|
key: 0,
|
|
4208
4210
|
class: pe(["toast", "toast-" + d.value])
|
|
4209
4211
|
}, ce(h.value), 3)) : be("", !0)
|
|
@@ -4295,10 +4297,10 @@ self.onmessage = function(e) {
|
|
|
4295
4297
|
function s() {
|
|
4296
4298
|
o && (o.colorRamp = n.colors);
|
|
4297
4299
|
}
|
|
4298
|
-
return Bt(() => o == null ? void 0 : o.destroy()), e({ renderWeg: i }), (l,
|
|
4300
|
+
return Bt(() => o == null ? void 0 : o.destroy()), e({ renderWeg: i }), (l, c) => (N(), Yr(ri, {
|
|
4299
4301
|
modelValue: n.colors,
|
|
4300
4302
|
"onUpdate:modelValue": [
|
|
4301
|
-
|
|
4303
|
+
c[0] || (c[0] = (u) => n.colors = u),
|
|
4302
4304
|
s
|
|
4303
4305
|
]
|
|
4304
4306
|
}, null, 8, ["modelValue"]));
|
|
@@ -4342,11 +4344,11 @@ self.onmessage = function(e) {
|
|
|
4342
4344
|
const C = (b = window.present) == null ? void 0 : b.wegCache;
|
|
4343
4345
|
C && confirm("已存在缓存文件,是否加载?") && p(C);
|
|
4344
4346
|
}
|
|
4345
|
-
async function
|
|
4347
|
+
async function c(C) {
|
|
4346
4348
|
let b = await C.target.files[0].arrayBuffer(), B = await vr(b);
|
|
4347
4349
|
p(B);
|
|
4348
4350
|
}
|
|
4349
|
-
async function
|
|
4351
|
+
async function u(C) {
|
|
4350
4352
|
var L;
|
|
4351
4353
|
C.preventDefault(), C.stopPropagation(), i.value = !1;
|
|
4352
4354
|
const b = (L = C.dataTransfer) == null ? void 0 : L.files;
|
|
@@ -4462,13 +4464,13 @@ self.onmessage = function(e) {
|
|
|
4462
4464
|
], -1)),
|
|
4463
4465
|
y("div", {
|
|
4464
4466
|
class: pe(["file-upload-area", { "drag-over": i.value }]),
|
|
4465
|
-
onDrop:
|
|
4467
|
+
onDrop: u,
|
|
4466
4468
|
onDragover: h,
|
|
4467
4469
|
onDragleave: d
|
|
4468
4470
|
}, [
|
|
4469
4471
|
y("input", {
|
|
4470
4472
|
type: "file",
|
|
4471
|
-
onInput:
|
|
4473
|
+
onInput: c,
|
|
4472
4474
|
id: "file-input",
|
|
4473
4475
|
class: "file-input",
|
|
4474
4476
|
accept: ".weg,.weg.gz"
|
|
@@ -206,6 +206,8 @@ export declare interface HeatmapOptions extends DisplayOptions, ColorOptions, Tr
|
|
|
206
206
|
bound?: BoundOptions;
|
|
207
207
|
/** 数据插值方式 */
|
|
208
208
|
dataFilter?: DataFilter;
|
|
209
|
+
/** 色卡插值方式 **/
|
|
210
|
+
colorRampFilter?: DataFilter;
|
|
209
211
|
/** 遮罩图层 ID,用于限制显示区域 */
|
|
210
212
|
mask?: string;
|
|
211
213
|
}
|
package/package.json
CHANGED