@idmwx/idmui-gl3 4.4.9 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +35 -35
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Ve = Object.defineProperty;
|
|
2
2
|
var Ue = (a, e, t) => e in a ? Ve(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
|
|
3
3
|
var R = (a, e, t) => (Ue(a, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
-
import { resolveComponent as P, openBlock as _, createElementBlock as C, createElementVNode as n, normalizeStyle as U, createVNode as k, withCtx as X, normalizeClass as
|
|
4
|
+
import { resolveComponent as P, openBlock as _, createElementBlock as C, createElementVNode as n, normalizeStyle as U, createVNode as k, withCtx as X, normalizeClass as W, Fragment as _e, renderList as Se, toDisplayString as S, createCommentVNode as B, createTextVNode as Ie, withDirectives as Pe, createStaticVNode as Ze, vShow as ze, mergeProps as I } from "vue";
|
|
5
5
|
import * as x from "@turf/turf";
|
|
6
6
|
import He from "@mapbox/sphericalmercator";
|
|
7
7
|
import Z from "moment";
|
|
@@ -671,7 +671,7 @@ function ut(a, e, t, r, i, o) {
|
|
|
671
671
|
}, {
|
|
672
672
|
default: X(() => [
|
|
673
673
|
n("div", {
|
|
674
|
-
class:
|
|
674
|
+
class: W(t.layerToggle ? "menu-icon active" : "menu-icon"),
|
|
675
675
|
onClick: e[0] || (e[0] = (...c) => o.handleMenuToggle && o.handleMenuToggle(...c))
|
|
676
676
|
}, e[9] || (e[9] = [
|
|
677
677
|
n("span", { class: "iconfont" }, "", -1)
|
|
@@ -694,7 +694,7 @@ function ut(a, e, t, r, i, o) {
|
|
|
694
694
|
}, {
|
|
695
695
|
default: X(() => [
|
|
696
696
|
n("div", {
|
|
697
|
-
class:
|
|
697
|
+
class: W(i.showMeasure ? "menu-icon active" : "menu-icon"),
|
|
698
698
|
onClick: e[1] || (e[1] = (...c) => o.handleMeasureToggle && o.handleMeasureToggle(...c))
|
|
699
699
|
}, e[10] || (e[10] = [
|
|
700
700
|
n("span", { class: "iconfont" }, "", -1)
|
|
@@ -710,7 +710,7 @@ function ut(a, e, t, r, i, o) {
|
|
|
710
710
|
}, {
|
|
711
711
|
default: X(() => [
|
|
712
712
|
n("div", {
|
|
713
|
-
class:
|
|
713
|
+
class: W(i.showPoint ? "menu-icon active" : "menu-icon"),
|
|
714
714
|
onClick: e[2] || (e[2] = (...c) => o.handlePointToggle && o.handlePointToggle(...c))
|
|
715
715
|
}, e[11] || (e[11] = [
|
|
716
716
|
n("span", { class: "iconfont" }, "", -1)
|
|
@@ -726,7 +726,7 @@ function ut(a, e, t, r, i, o) {
|
|
|
726
726
|
}, {
|
|
727
727
|
default: X(() => [
|
|
728
728
|
n("div", {
|
|
729
|
-
class:
|
|
729
|
+
class: W(i.showCoord ? "menu-icon active" : "menu-icon"),
|
|
730
730
|
onClick: e[3] || (e[3] = (...c) => o.handleCoordToggle && o.handleCoordToggle(...c))
|
|
731
731
|
}, e[12] || (e[12] = [
|
|
732
732
|
n("span", { class: "iconfont" }, "", -1)
|
|
@@ -742,7 +742,7 @@ function ut(a, e, t, r, i, o) {
|
|
|
742
742
|
}, {
|
|
743
743
|
default: X(() => [
|
|
744
744
|
n("div", {
|
|
745
|
-
class:
|
|
745
|
+
class: W(i.show3d ? "menu-icon active" : "menu-icon"),
|
|
746
746
|
onClick: e[4] || (e[4] = (...c) => o.handle3DToggle && o.handle3DToggle(...c))
|
|
747
747
|
}, e[13] || (e[13] = [
|
|
748
748
|
n("span", { class: "iconfont" }, "", -1)
|
|
@@ -754,13 +754,13 @@ function ut(a, e, t, r, i, o) {
|
|
|
754
754
|
], 4),
|
|
755
755
|
o.hasCollectedLayers ? (_(), C("div", {
|
|
756
756
|
key: 0,
|
|
757
|
-
class: "active-layers flex-between",
|
|
757
|
+
class: W(["active-layers flex-between", i.autoActive ? "active" : ""]),
|
|
758
758
|
style: U({ right: i.right + "px", bottom: "100px" })
|
|
759
759
|
}, [
|
|
760
760
|
n("div", Ke, [
|
|
761
761
|
(_(!0), C(_e, null, Se(i.layers.weather.filter((c) => c.collected), (c) => (_(), C("div", {
|
|
762
762
|
key: c.key,
|
|
763
|
-
class:
|
|
763
|
+
class: W(o.computeLayerClass(c, i.weatherLayers)),
|
|
764
764
|
onClick: (p) => o.handleWeatherLayerPick(c)
|
|
765
765
|
}, [
|
|
766
766
|
e[14] || (e[14] = n("div", { class: "checkbox" }, null, -1)),
|
|
@@ -775,13 +775,13 @@ function ut(a, e, t, r, i, o) {
|
|
|
775
775
|
n("i", { class: "iconfont open" }, "", -1),
|
|
776
776
|
n("i", { class: "iconfont close" }, "", -1)
|
|
777
777
|
]))
|
|
778
|
-
],
|
|
778
|
+
], 6)) : B("", !0),
|
|
779
779
|
n("div", {
|
|
780
780
|
class: "available-layers flex-center",
|
|
781
781
|
style: U({ top: t.top + "px", right: t.layerToggle ? "0px" : "-240px" })
|
|
782
782
|
}, [
|
|
783
783
|
n("div", {
|
|
784
|
-
class:
|
|
784
|
+
class: W(["list-box", t.layerToggle ? "right-bar" : ""])
|
|
785
785
|
}, [
|
|
786
786
|
n("div", tt, [
|
|
787
787
|
e[16] || (e[16] = n("div", null, "Layers", -1)),
|
|
@@ -794,7 +794,7 @@ function ut(a, e, t, r, i, o) {
|
|
|
794
794
|
default: X(() => [
|
|
795
795
|
n("div", at, [
|
|
796
796
|
n("div", {
|
|
797
|
-
class:
|
|
797
|
+
class: W(["layers-title flex-between", i.autoActive ? "active" : ""])
|
|
798
798
|
}, [
|
|
799
799
|
e[18] || (e[18] = n("div", null, "Weather Layers", -1)),
|
|
800
800
|
n("div", {
|
|
@@ -812,7 +812,7 @@ function ut(a, e, t, r, i, o) {
|
|
|
812
812
|
}, [
|
|
813
813
|
c.hide ? B("", !0) : (_(), C("div", {
|
|
814
814
|
key: 0,
|
|
815
|
-
class:
|
|
815
|
+
class: W(o.computeLayerClass(c, i.weatherLayers))
|
|
816
816
|
}, [
|
|
817
817
|
n("div", {
|
|
818
818
|
class: "flex-start",
|
|
@@ -842,7 +842,7 @@ function ut(a, e, t, r, i, o) {
|
|
|
842
842
|
n("div", ct, [
|
|
843
843
|
(_(!0), C(_e, null, Se(i.layers.other, (c) => (_(), C("div", {
|
|
844
844
|
key: c.key,
|
|
845
|
-
class:
|
|
845
|
+
class: W(o.computeLayerClass(c, i.otherLayers)),
|
|
846
846
|
onClick: (p) => o.handleOtherLayerPick(c)
|
|
847
847
|
}, [
|
|
848
848
|
n("div", dt, [
|
|
@@ -1041,14 +1041,14 @@ function bt(a, e, t, r, i, o) {
|
|
|
1041
1041
|
}, [
|
|
1042
1042
|
t.mapProjection === "mercator" ? (_(), C("div", {
|
|
1043
1043
|
key: 0,
|
|
1044
|
-
class:
|
|
1044
|
+
class: W(["item-bar flex-start", t.showParticle ? "active" : "inactive"]),
|
|
1045
1045
|
onClick: e[0] || (e[0] = (...l) => o.handleParticle && o.handleParticle(...l))
|
|
1046
1046
|
}, e[2] || (e[2] = [
|
|
1047
1047
|
n("div", { class: "checkbox" }, null, -1),
|
|
1048
1048
|
n("span", null, "Wind Particles", -1)
|
|
1049
1049
|
]), 2)) : B("", !0),
|
|
1050
1050
|
n("div", {
|
|
1051
|
-
class:
|
|
1051
|
+
class: W(["item-bar flex-start", i.showFeather ? "active" : "inactive"]),
|
|
1052
1052
|
onClick: e[1] || (e[1] = (l) => i.showFeather = !i.showFeather)
|
|
1053
1053
|
}, e[3] || (e[3] = [
|
|
1054
1054
|
n("div", { class: "checkbox" }, null, -1),
|
|
@@ -1282,8 +1282,8 @@ class fe {
|
|
|
1282
1282
|
}
|
|
1283
1283
|
const m = e.getBoundPixel(), b = e.map.getZoom() + 1, y = e.getWorldCopy(m, b);
|
|
1284
1284
|
for (const u of y) {
|
|
1285
|
-
const v = (u[0] - m[0]) * e.ratio, g = (u[1] - m[3]) * e.ratio, L = u[2] * e.ratio, [z, w, A, M] = [v, L + v, g, L + g],
|
|
1286
|
-
t.bindBuffer(t.ARRAY_BUFFER, s), t.bufferData(t.ARRAY_BUFFER,
|
|
1285
|
+
const v = (u[0] - m[0]) * e.ratio, g = (u[1] - m[3]) * e.ratio, L = u[2] * e.ratio, [z, w, A, M] = [v, L + v, g, L + g], j = new Float32Array([z, A, w, A, z, M, z, M, w, A, w, M]);
|
|
1286
|
+
t.bindBuffer(t.ARRAY_BUFFER, s), t.bufferData(t.ARRAY_BUFFER, j, t.STATIC_DRAW), t.drawArrays(t.TRIANGLES, 0, 6);
|
|
1287
1287
|
}
|
|
1288
1288
|
} catch (c) {
|
|
1289
1289
|
console.log(`render failed...${c}`);
|
|
@@ -3474,14 +3474,14 @@ function Pt(a, e, t, r, i, o) {
|
|
|
3474
3474
|
}, [
|
|
3475
3475
|
t.mapProjection === "mercator" ? (_(), C("div", {
|
|
3476
3476
|
key: 0,
|
|
3477
|
-
class:
|
|
3477
|
+
class: W(["flex-start item-bar", t.showParticle ? "active" : "inactive"]),
|
|
3478
3478
|
onClick: e[0] || (e[0] = (l) => o.handleParticle(!t.showParticle))
|
|
3479
3479
|
}, e[2] || (e[2] = [
|
|
3480
3480
|
n("div", { class: "checkbox" }, null, -1),
|
|
3481
3481
|
n("span", null, "Current Particles", -1)
|
|
3482
3482
|
]), 2)) : B("", !0),
|
|
3483
3483
|
n("div", {
|
|
3484
|
-
class:
|
|
3484
|
+
class: W(["flex-start item-bar", i.showJson ? "active" : "inactive"]),
|
|
3485
3485
|
onClick: e[1] || (e[1] = (l) => i.showJson = !i.showJson)
|
|
3486
3486
|
}, e[3] || (e[3] = [
|
|
3487
3487
|
n("div", { class: "checkbox" }, null, -1),
|
|
@@ -4520,7 +4520,7 @@ const Zt = {
|
|
|
4520
4520
|
this.map && (this.map.getLayer(this.historyLayer) && this.map.removeLayer(this.historyLayer), this.map.getLayer(this.forecastLayer) && this.map.removeLayer(this.forecastLayer), this.map.getLayer(this.forecastModelLayer) && this.map.removeLayer(this.forecastModelLayer), this.map.getLayer(this.forecastNameLayer) && this.map.removeLayer(this.forecastNameLayer), this.map.getLayer(this.pointCircleLayer) && this.map.removeLayer(this.pointCircleLayer), this.map.getLayer(this.pointCircleLayer + "-border") && this.map.removeLayer(this.pointCircleLayer + "-border"), this.map.getLayer(this.pointLabelLayer) && this.map.removeLayer(this.pointLabelLayer), this.map.getLayer(this.historyPointCircleLayer) && this.map.removeLayer(this.historyPointCircleLayer), this.map.getLayer(this.historyPointCircleLayer + "-border") && this.map.removeLayer(this.historyPointCircleLayer + "-border"), this.map.getLayer(this.historyPointCircleLayer + "-inner") && this.map.removeLayer(this.historyPointCircleLayer + "-inner"), this.map.getLayer(this.historyPointLabelLayer) && this.map.removeLayer(this.historyPointLabelLayer), this.map.getLayer(this.interpolateLineLayer) && this.map.removeLayer(this.interpolateLineLayer), (a = this.interpolateMarkers) == null || a.forEach((e) => e == null ? void 0 : e.remove()), this.map.getSource(this.source) && this.map.removeSource(this.source), this.map.getSource(this.clusterSource) && this.map.removeSource(this.clusterSource), this.map.getSource(this.interpolateSource) && this.map.removeSource(this.interpolateSource), this.map.getLayer(this.circleLayer) && this.map.removeLayer(this.circleLayer), this.map.getSource(this.circleSource) && this.map.removeSource(this.circleSource));
|
|
4521
4521
|
},
|
|
4522
4522
|
handleDateChange() {
|
|
4523
|
-
var a, e, t, r, i, o, s, l, h, d, c, p, f, m, b, y, u, v, g, L, z, w, A, M,
|
|
4523
|
+
var a, e, t, r, i, o, s, l, h, d, c, p, f, m, b, y, u, v, g, L, z, w, A, M, j, O, F, H, se, ne, le, ce, he, de, pe, te;
|
|
4524
4524
|
if ((a = this.interpolateMarkers) == null || a.forEach((G) => G == null ? void 0 : G.remove()), this.circleSourceData.features = [], (e = this.interpolateData) != null && e.length && this.tropicals.active) {
|
|
4525
4525
|
const G = Z(this.date).utc().set({ minute: 0, second: 0, millisecond: 0 }), Y = this.interpolateData.filter((E) => E.properties.date === G.format() && !E.properties.disabled), me = this.handleComputePolygons(Y), q = x.featureCollection([...Y]);
|
|
4526
4526
|
me.forEach((E) => {
|
|
@@ -4542,7 +4542,7 @@ const Zt = {
|
|
|
4542
4542
|
for (const E of Y)
|
|
4543
4543
|
if (!E.properties.disabled) {
|
|
4544
4544
|
let $ = "#f44336";
|
|
4545
|
-
((l = (s = E.properties) == null ? void 0 : s.wind) == null ? void 0 : l.spd) < 17.2 || !((d = (h = E.properties) == null ? void 0 : h.wind) != null && d.spd) ? $ = "#03f869" : ((p = (c = E.properties) == null ? void 0 : c.wind) == null ? void 0 : p.spd) >= 17.2 && ((m = (f = E.properties) == null ? void 0 : f.wind) == null ? void 0 : m.spd) < 24.5 ? $ = "#f2f202" : ((y = (b = E.properties) == null ? void 0 : b.wind) == null ? void 0 : y.spd) >= 24.5 && ((v = (u = E.properties) == null ? void 0 : u.wind) == null ? void 0 : v.spd) < 32.7 ? $ = "#ff9100" : ((L = (g = E.properties) == null ? void 0 : g.wind) == null ? void 0 : L.spd) >= 32.7 && ((w = (z = E.properties) == null ? void 0 : z.wind) == null ? void 0 : w.spd) < 41.5 ? $ = "#f44336" : ((M = (A = E.properties) == null ? void 0 : A.wind) == null ? void 0 : M.spd) >= 41.5 && ((O = (
|
|
4545
|
+
((l = (s = E.properties) == null ? void 0 : s.wind) == null ? void 0 : l.spd) < 17.2 || !((d = (h = E.properties) == null ? void 0 : h.wind) != null && d.spd) ? $ = "#03f869" : ((p = (c = E.properties) == null ? void 0 : c.wind) == null ? void 0 : p.spd) >= 17.2 && ((m = (f = E.properties) == null ? void 0 : f.wind) == null ? void 0 : m.spd) < 24.5 ? $ = "#f2f202" : ((y = (b = E.properties) == null ? void 0 : b.wind) == null ? void 0 : y.spd) >= 24.5 && ((v = (u = E.properties) == null ? void 0 : u.wind) == null ? void 0 : v.spd) < 32.7 ? $ = "#ff9100" : ((L = (g = E.properties) == null ? void 0 : g.wind) == null ? void 0 : L.spd) >= 32.7 && ((w = (z = E.properties) == null ? void 0 : z.wind) == null ? void 0 : w.spd) < 41.5 ? $ = "#f44336" : ((M = (A = E.properties) == null ? void 0 : A.wind) == null ? void 0 : M.spd) >= 41.5 && ((O = (j = E.properties) == null ? void 0 : j.wind) == null ? void 0 : O.spd) < 51 ? $ = "#f903d0" : ((H = (F = E.properties) == null ? void 0 : F.wind) == null ? void 0 : H.spd) >= 51 ? $ = "#8702f9" : $ = "#f44336";
|
|
4546
4546
|
const ue = `<svg t="1719918955501"
|
|
4547
4547
|
class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" p-id="18382"
|
|
4548
4548
|
xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200">
|
|
@@ -4732,18 +4732,18 @@ function na(a, e, t, r, i, o) {
|
|
|
4732
4732
|
e[4] || (e[4] = n("label", { style: { width: "max-content" } }, "Forecast Models : ", -1)),
|
|
4733
4733
|
n("div", ra, [
|
|
4734
4734
|
(_(!0), C(_e, null, Se((z = i.activeTropicals) == null ? void 0 : z.forecasts, (w, A) => {
|
|
4735
|
-
var M,
|
|
4735
|
+
var M, j, O, F;
|
|
4736
4736
|
return _(), C("div", {
|
|
4737
4737
|
key: A,
|
|
4738
|
-
class:
|
|
4738
|
+
class: W([
|
|
4739
4739
|
"model",
|
|
4740
4740
|
w.disabled ? "" : "active",
|
|
4741
|
-
A > 0 && A < ((
|
|
4741
|
+
A > 0 && A < ((j = (M = i.activeTropicals) == null ? void 0 : M.forecasts) == null ? void 0 : j.length) - 1 && ((F = (O = i.activeTropicals) == null ? void 0 : O.forecasts) == null ? void 0 : F.length) > 2 ? "center-child" : ""
|
|
4742
4742
|
]),
|
|
4743
4743
|
onClick: (H) => o.handleForecastToggle(w)
|
|
4744
4744
|
}, [
|
|
4745
4745
|
n("span", {
|
|
4746
|
-
class:
|
|
4746
|
+
class: W(w.model)
|
|
4747
4747
|
}, S(w.model), 3)
|
|
4748
4748
|
], 10, oa);
|
|
4749
4749
|
}), 128))
|
|
@@ -5448,7 +5448,7 @@ const za = {
|
|
|
5448
5448
|
class: "point-meteo"
|
|
5449
5449
|
}, Ea = { class: "meteo-box" }, Ia = { class: "header-box" }, Ra = { class: "main" }, Aa = { class: "sub" }, Da = { class: "main-box" }, Ma = { class: "flex-space" }, Wa = { class: "flex-space" }, ja = { class: "flex-space" }, Ba = { class: "flex-space" }, Na = { class: "flex-space" }, Oa = { class: "flex-space" }, Fa = { class: "flex-space" }, $a = { class: "flex-space" }, Va = { class: "flex-space" };
|
|
5450
5450
|
function Ua(a, e, t, r, i, o) {
|
|
5451
|
-
var s, l, h, d, c, p, f, m, b, y, u, v, g, L, z, w, A, M,
|
|
5451
|
+
var s, l, h, d, c, p, f, m, b, y, u, v, g, L, z, w, A, M, j, O, F, H, se, ne, le, ce, he, de, pe, te, G, Y, me, q, E, $, ue, Q, ye, ae, ie, re, be, ve, we, Le, xe;
|
|
5452
5452
|
return Pe((_(), C("div", Ta, [
|
|
5453
5453
|
n("div", Ea, [
|
|
5454
5454
|
n("div", Ia, [
|
|
@@ -5466,7 +5466,7 @@ function Ua(a, e, t, r, i, o) {
|
|
|
5466
5466
|
]),
|
|
5467
5467
|
n("div", Wa, [
|
|
5468
5468
|
e[2] || (e[2] = n("label", null, "Wind.Wave", -1)),
|
|
5469
|
-
n("span", null, S(((L = (g = (v = t.meteo) == null ? void 0 : v.wave) == null ? void 0 : g.wd) == null ? void 0 : L.direction) || "-") + "/" + S(o.roundPrecision((A = (w = (z = t.meteo) == null ? void 0 : z.wave) == null ? void 0 : w.wd) == null ? void 0 : A.height, 1)) + "[m]/" + S(o.roundPrecision((O = (
|
|
5469
|
+
n("span", null, S(((L = (g = (v = t.meteo) == null ? void 0 : v.wave) == null ? void 0 : g.wd) == null ? void 0 : L.direction) || "-") + "/" + S(o.roundPrecision((A = (w = (z = t.meteo) == null ? void 0 : z.wave) == null ? void 0 : w.wd) == null ? void 0 : A.height, 1)) + "[m]/" + S(o.roundPrecision((O = (j = (M = t.meteo) == null ? void 0 : M.wave) == null ? void 0 : j.wd) == null ? void 0 : O.period, 1)) + "[s]", 1)
|
|
5470
5470
|
]),
|
|
5471
5471
|
n("div", ja, [
|
|
5472
5472
|
e[3] || (e[3] = n("label", null, "Swell", -1)),
|
|
@@ -7090,7 +7090,7 @@ function Bi(a, e, t, r, i, o) {
|
|
|
7090
7090
|
}, {
|
|
7091
7091
|
default: X(() => [
|
|
7092
7092
|
n("div", {
|
|
7093
|
-
class:
|
|
7093
|
+
class: W(i.vendor === "hi" ? "menu-icon active" : "menu-icon"),
|
|
7094
7094
|
onClick: e[0] || (e[0] = (l) => i.vendor = "hi")
|
|
7095
7095
|
}, e[2] || (e[2] = [
|
|
7096
7096
|
n("span", { class: "iconfont" }, "HI", -1)
|
|
@@ -7106,7 +7106,7 @@ function Bi(a, e, t, r, i, o) {
|
|
|
7106
7106
|
}, {
|
|
7107
7107
|
default: X(() => [
|
|
7108
7108
|
n("div", {
|
|
7109
|
-
class:
|
|
7109
|
+
class: W(i.vendor === "i4" ? "menu-icon active" : "menu-icon"),
|
|
7110
7110
|
onClick: e[1] || (e[1] = (l) => i.vendor = "i4")
|
|
7111
7111
|
}, e[3] || (e[3] = [
|
|
7112
7112
|
n("span", { class: "iconfont" }, "I4", -1)
|
|
@@ -7312,8 +7312,8 @@ const Oi = {
|
|
|
7312
7312
|
);
|
|
7313
7313
|
const z = await Promise.all(L);
|
|
7314
7314
|
this.weatherLayers = {}, z.map((w) => {
|
|
7315
|
-
var
|
|
7316
|
-
const A = ((
|
|
7315
|
+
var j, O, F, H;
|
|
7316
|
+
const A = ((j = w == null ? void 0 : w.data) == null ? void 0 : j.data) || (w == null ? void 0 : w.data), M = (F = (O = w == null ? void 0 : w.config) == null ? void 0 : O.headers) == null ? void 0 : F.key;
|
|
7317
7317
|
M && A && (this.weatherLayers[M] = {
|
|
7318
7318
|
raw: A,
|
|
7319
7319
|
type: ((H = w == null ? void 0 : w.config) == null ? void 0 : H.responseType) === "blob" ? "image" : "json",
|
|
@@ -7325,8 +7325,8 @@ const Oi = {
|
|
|
7325
7325
|
key: "tropicals"
|
|
7326
7326
|
}
|
|
7327
7327
|
}).then((w) => {
|
|
7328
|
-
var
|
|
7329
|
-
const A = Oe.convert2Geojson(((
|
|
7328
|
+
var j, O, F;
|
|
7329
|
+
const A = Oe.convert2Geojson(((j = w == null ? void 0 : w.data) == null ? void 0 : j.data) || (w == null ? void 0 : w.data)), M = (F = (O = w == null ? void 0 : w.config) == null ? void 0 : O.headers) == null ? void 0 : F.key;
|
|
7330
7330
|
this.weatherLayers[M] = {
|
|
7331
7331
|
data: A,
|
|
7332
7332
|
active: !0,
|
|
@@ -7758,7 +7758,7 @@ const Oi = {
|
|
|
7758
7758
|
};
|
|
7759
7759
|
function $i(a, e, t, r, i, o) {
|
|
7760
7760
|
var te, G, Y, me, q, E, $, ue, Q, ye, ae, ie, re, be, ve, we, Le, xe, Te, Ae, De, Me, We, je, Be, Ne;
|
|
7761
|
-
const s = P("IdmGlLayer"), l = P("IdmENC"), h = P("IdmSigWave"), d = P("IdmSwell"), c = P("IdmPrmsl"), p = P("IdmIceberg"), f = P("IdmTropicals"), m = P("IdmCurrents"), b = P("IdmCurrentParticle"), y = P("IdmWindBarb"), u = P("IdmWindParticle"), v = P("IdmPrecip3h"), g = P("IdmVisibility"), L = P("IdmWaterTemp"), z = P("IdmTemp"), w = P("IdmArctic"), A = P("IdmWarZone"), M = P("IdmGmdssArea"),
|
|
7761
|
+
const s = P("IdmGlLayer"), l = P("IdmENC"), h = P("IdmSigWave"), d = P("IdmSwell"), c = P("IdmPrmsl"), p = P("IdmIceberg"), f = P("IdmTropicals"), m = P("IdmCurrents"), b = P("IdmCurrentParticle"), y = P("IdmWindBarb"), u = P("IdmWindParticle"), v = P("IdmPrecip3h"), g = P("IdmVisibility"), L = P("IdmWaterTemp"), z = P("IdmTemp"), w = P("IdmArctic"), A = P("IdmWarZone"), M = P("IdmGmdssArea"), j = P("IdmEcaZone"), O = P("IdmAlertZone"), F = P("IdmPort"), H = P("IdmLoadLine"), se = P("IdmTimezone"), ne = P("IdmVRA"), le = P("IdmSpecialArea"), ce = P("IdmTerminator"), he = P("IdmLatLng"), de = P("IdmMeasure"), pe = P("IdmPoint");
|
|
7762
7762
|
return t.map ? (_(), C("div", Fi, [
|
|
7763
7763
|
k(s, I({
|
|
7764
7764
|
ref: "layer",
|
|
@@ -7896,7 +7896,7 @@ function $i(a, e, t, r, i, o) {
|
|
|
7896
7896
|
area: (xe = i.otherLayers) == null ? void 0 : xe["gmdss-areas"],
|
|
7897
7897
|
"before-layer": t.beforeLayer
|
|
7898
7898
|
}, a.$attrs), null, 16, ["map", "area", "before-layer"]),
|
|
7899
|
-
k(
|
|
7899
|
+
k(j, I({
|
|
7900
7900
|
map: t.map,
|
|
7901
7901
|
zone: (Te = i.otherLayers) == null ? void 0 : Te["eca-zones"],
|
|
7902
7902
|
"before-layer": t.beforeLayer
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(E,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue"),require("@turf/turf"),require("@mapbox/sphericalmercator"),require("moment"),require("mapbox-gl"),require("@idm-plugin/geo"),require("axios")):typeof define=="function"&&define.amd?define(["exports","vue","@turf/turf","@mapbox/sphericalmercator","moment","mapbox-gl","@idm-plugin/geo","axios"],r):(E=typeof globalThis<"u"?globalThis:E||self,r(E["idm-gl"]={},E.Vue,E["@turf/turf"],E["@mapbox/sphericalmercator"],E.moment,E["mapbox-gl"],E["@idm-plugin/geo"],E.axios))})(this,function(E,r,Y,Ne,B,O,C,U){"use strict";var Pr=Object.defineProperty;var zr=(E,r,Y)=>r in E?Pr(E,r,{enumerable:!0,configurable:!0,writable:!0,value:Y}):E[r]=Y;var P=(E,r,Y)=>(zr(E,typeof r!="symbol"?r+"":r,Y),Y);function Te(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,o.get?o:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const x=Te(Y),Nr="";var Ve=Object.defineProperty,Ie=(a,e,t)=>e in a?Ve(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,le=(a,e,t)=>(Ie(a,typeof e!="symbol"?e+"":e,t),t);class ce{}le(ce,"LEVEL",{Basic:1,Prime:2,Supper:1024});class he{}le(he,"WEATHER_LAYERS",[{weight:1,name:"Wind",key:"wind",h5:!0,enabled:!0,type:"json",particle:!0},{weight:524288,name:"Wind Particle",key:"wind-particle",peer:{weight:1,key:"wind"},enabled:!0,hide:!0,type:"jpg"},{weight:16,name:"Sig Waves",key:"sig-wave-height",h5:!0,enabled:!0,type:"json"},{weight:4194304,name:"Sig Waves (JPG)",key:"sig-wave",peer:{weight:16,key:"sig-wave"},enabled:!0,hide:!0,type:"jpg"},{weight:8388608,name:"Sig Waves (Contour)",key:"sig-wave-height-contour",peer:{weight:16,key:"sig-wave-contour"},enabled:!0,hide:!0,type:"json"},{weight:96,name:"Current",key:"current",vendor:"cmems",merge:!0,h5:!0,enabled:!0,type:"json"},{weight:1048576,name:"Current Particle",key:"current-particle",vendor:"cmems",peer:{weight:96,key:"current"},enabled:!0,hide:!0,type:"jpg"},{weight:256,name:"Tropicals",key:"tropicals",h5:!0,enabled:!0,type:"json"},{weight:4096,name:"Pressure",h5:!0,key:"prmsl",enabled:!0,type:"json"},{weight:8192,name:"Visibility",vendor:"gfs",key:"visibility",h5:!0,enabled:!0,type:"jpg"},{weight:262144,name:"Precip Acc",key:"precip3h",h5:!0,enabled:!0,type:"jpg"},{weight:6,name:"Swell",key:"swell",merge:!0,h5:!0,enabled:!0,type:"json"},{weight:2,name:"Swell Height",key:"swell-height",partly:!0,enabled:!0,type:"json"},{weight:4,name:"Swell Direction",key:"swell-direction",partly:!0,enabled:!0,type:"json"},{weight:32,name:"Current Direction",key:"current-direction",vendor:"cmems",partly:!0,enabled:!0,type:"json"},{weight:64,name:"Current Speed",key:"current-speed",vendor:"cmems",partly:!0,enabled:!0,type:"json"},{weight:512,name:"Pressure Contour",key:"prmsl-contour",partly:!0,enabled:!0,hide:!0,type:"json"},{weight:1024,name:"Pressure Value",key:"prmsl-value",partly:!0,enabled:!0,hide:!0,type:"json"},{weight:2048,name:"Pressure Front",key:"prmsl-front",partly:!0,enabled:!0,hide:!0,type:"json"},{weight:16384,name:"Iceberg",key:"iceberg",vendor:"cmems",hide:!0,enabled:!1,type:"json"},{weight:32768,name:"Struct Ice",key:"struct-ice",vendor:"cmems",enabled:!1,hide:!0,type:"json"},{weight:65536,name:"Ice Edge",key:"arctic",vendor:"cmems",h5:!0,enabled:!0,type:"jpg"},{weight:131072,name:"Sea Surf. Temp.",key:"water-temp",vendor:"cmems",h5:!0,enabled:!0,type:"jpg"},{weight:2097152,name:"Temp.",key:"temp",h5:!0,enabled:!0,type:"jpg"}]),le(he,"OTHER_LAYERS",[{weight:1,name:"War Zones",key:"war-zones",h5:!0,enabled:!0,type:"json"},{weight:2,name:"GMDSS Areas",key:"gmdss-areas",h5:!0,enabled:!0,type:"json"},{weight:4,name:"ECA Zones",key:"eca-zones",h5:!0,enabled:!0,type:"json"},{weight:8,name:"Load Lines",key:"load-lines",h5:!0,enabled:!0,type:"json"},{weight:16,name:"HRA",key:"high-risk-area",enabled:!1,type:"json"},{weight:32,name:"Pirates",key:"pirates",enabled:!1,type:"json"},{weight:4096,name:"Alert Zones",key:"alert-zones",h5:!0,enabled:!0,type:"json"},{weight:64,name:"Ports",key:"ports",h5:!0,enabled:!0,type:"json"},{weight:128,name:"Time Zones",key:"time-zones",h5:!0,enabled:!0,type:"json"},{weight:256,name:"VRA",key:"voluntary-reporting-area",h5:!0,enabled:!0,type:"json"},{weight:512,name:"Special Areas",key:"special-area",h5:!0,enabled:!0,type:"json"},{weight:1024,name:"Day/Night",key:"day-night",h5:!0,enabled:!0,type:"json"},{weight:2048,name:"ENC",key:"enc",h5:!0,enabled:!0,type:"origin"},{weight:8192,name:"World-12nm",key:"world12nm",h5:!1,enabled:!0,type:"origin"}]);class ge{}le(ge,"WEATHER_TAG",[{weight:4,name:"Adverse Weather Dangerous",key:"DANGEROUS",positive:!0},{weight:2,name:"Adverse Weather Severe",key:"SEVERE",positive:!0},{weight:1,name:"Adverse Weather Heavy",key:"HEAVY",positive:!0}]),le(ge,"SAILING_TAG",[{weight:2048,name:"Deviation",key:"deviation",positive:!0},{weight:4096,name:"Stoppage",key:"stoppage",positive:!0},{weight:8192,name:"Deceleration",key:"deceleration",positive:!0},{weight:16384,name:"No Lane",key:"noLane",positive:!0},{weight:32768,name:"No Noon",key:"noNoon",positive:!0}]),le(ge,"OTHER_TAG",[{weight:2097152,name:"No CP",key:"noCp",positive:!0},{weight:4194304,name:"Send Rpt",key:"sendRpt",positive:!1},{weight:8388608,name:"Send Bps",key:"sendBps",positive:!1},{weight:16777216,name:"Send Pvar",key:"sendPvar",positive:!1},{weight:33554432,name:"Checked",key:"checked",positive:!1},{weight:67108864,name:"Send PWFR",key:"sendPwfr",positive:!1}]);const Tr="",k=(a,e)=>{const t=a.__vccOpts||a;for(const[o,i]of e)t[o]=i;return t},Re={name:"IdmGlLayer",props:{map:{type:Object},mapProjection:{type:String},top:{type:Number,default:60},layerToggle:{type:Boolean,default:!1},toggleVersion:{type:Number},isLogin:{type:Boolean,default:void 0},showWindFeather:{type:Boolean,default:void 0},showWindParticle:{type:Boolean,default:void 0},showCurrentIsoband:{type:Boolean,default:void 0},showCurrentParticle:{type:Boolean,default:void 0}},emits:["weather","other","coordinate","measure","point","3d","layerToggle","handleToggleVersion"],data(){return{autoActive:!0,layers:{weather:[...he.WEATHER_LAYERS.filter(a=>!["swell-height","swell-direction","current-direction","current-speed"].includes(a.key))],other:[...he.OTHER_LAYERS.filter(a=>a.key!=="world12nm"&&a.enabled)]},weatherLayers:[],otherLayers:[],weatherLayersCache:"weatherLayersCache",autoActiveCache:"autoActiveCache",otherLayersCache:"otherLayersCache",collectedLayerCache:"collectedLayerCache",sourceCache:"defaultSourceCache",showCoord:!1,showMeasure:!1,showPoint:!1,show3d:!1,version:{v:"0.0.7",k:"glCacheVersion"},source:"",right:10,rampColorLayers:["visibility","precip3h","temp","water-temp","arctic"]}},computed:{computeLayerClass(){return function(a,e){var o;let t="layer flex-between";return e.some(i=>i.key===a.key)&&(t=t+" active"),(!a.enabled||(o=this.layers.weather)!=null&&o.some(i=>i.key===a.key)&&!this.autoActive||this.rampColorLayers.includes(a.key)&&this.mapProjection==="globe")&&(t=t+" disabled"),t}},hasCollectedLayers(){var a;return((a=this.layers.weather.filter(e=>e.collected))==null?void 0:a.length)>0}},watch:{toggleVersion:{handler(){this.$nextTick(()=>{var a;this.right=(((a=document.getElementsByClassName("right-bar")[0])==null?void 0:a.clientWidth)||0)+10})}},source:{handler(a,e){a&&e&&a!==e&&this.handleConfirm()}},showWindFeather:{handler(){!this.showWindFeather&&!this.showWindParticle&&this.handleWeatherLayerPick({weight:1,name:"Wind",key:"wind",enabled:!0,type:"json",particle:!0})}},showWindParticle:{handler(){!this.showWindFeather&&!this.showWindParticle&&this.handleWeatherLayerPick({weight:1,name:"Wind",key:"wind",enabled:!0,type:"json",particle:!0})}},showCurrentIsoband:{handler(){!this.showCurrentIsoband&&!this.showCurrentParticle&&this.handleWeatherLayerPick({weight:96,name:"Current",key:"current",vendor:"cmems",merge:!0,h5:!0,enabled:!0})}},showCurrentParticle:{handler(){!this.showCurrentIsoband&&!this.showCurrentParticle&&this.handleWeatherLayerPick({weight:96,name:"Current",key:"current",vendor:"cmems",merge:!0,h5:!0,enabled:!0})}}},mounted(){const a=localStorage.getItem(this.version.k);this.version.v!==a&&(localStorage.removeItem(this.weatherLayersCache),localStorage.removeItem(this.collectedLayerCache),localStorage.removeItem(this.otherLayersCache),localStorage.removeItem("windFeatherCache"),localStorage.removeItem("currentJsonCache"),localStorage.setItem(this.version.k,this.version.v));let e=localStorage.getItem(this.autoActiveCache);this.autoActive=e!=="false",e=localStorage.getItem(this.collectedLayerCache);let t=JSON.parse(e||'[{"weight": 16, "name": "Sig Waves", "key": "sig-wave-height", "collected": true},{"weight": 1, "name": "Wind", "key": "wind", "h5": true, "collected": true},{"weight": 96, "name": "Current", "key": "current", "collected": true},{"weight": 256, "name": "Tropicals", "key": "tropicals", "collected": true},{"weight": 4096, "name": "Pressure", "h5": true, "key": "prmsl", "collected": true},{"weight": 6, "name": "Swell", "key": "swell", "collected": true}]');this.layers.weather.forEach(o=>{o.collected=!!t.some(i=>i.key===o.key&&i.collected)}),e=localStorage.getItem(this.weatherLayersCache),t=JSON.parse(e||'[{"weight":1,"name":"Wind","key":"wind","enabled":true,"type":"json","particle":true},{"weight":4096,"name":"Pressure","key":"prmsl","enabled":true,"type":"json"},{"weight":256,"name":"Tropicals","key":"tropicals","enabled":true,"type":"json"}]'),this.autoActive&&(this.weatherLayers=[...t]),e=localStorage.getItem(this.otherLayersCache),t=JSON.parse(e||'[{"weight":4,"name":"ECA Zones","key":"eca-zones","enabled":true,"type":"json"}]'),this.otherLayers=t,e=localStorage.getItem(this.sourceCache),this.source=e||"GFS",this.handleConfirm()},methods:{handleConfirm(){this.$emit("weather",this.weatherLayers,this.source),this.$emit("other",this.otherLayers),localStorage.setItem(this.autoActiveCache,this.autoActive),localStorage.setItem(this.sourceCache,this.source)},handleWeatherLayerPick(a){if(this.rampColorLayers.includes(a.key)&&this.mapProjection==="globe"||!this.autoActive)return!1;["wind","current"].includes(a.key)&&!this.showWindFeather&&!this.showCurrentIsoband&&(a.particle=!0),this.weatherLayers.some(e=>e.key===a.key)?this.weatherLayers=this.weatherLayers.filter(e=>e.key!==a.key):this.weatherLayers.length<12&&a.enabled&&(["png","jpg"].includes(a.type)&&(this.weatherLayers=this.weatherLayers.filter(e=>e.type==="json")),this.weatherLayers.push(a)),this.$emit("weather",this.weatherLayers,this.source),localStorage.setItem(this.weatherLayersCache,JSON.stringify(this.weatherLayers)),localStorage.setItem(this.sourceCache,this.source)},handleWeatherLayerCollect(a){var e;!a.collected&&((e=this.layers.weather.filter(t=>t.collected))==null?void 0:e.length)>=6&&(this.layers.weather.filter(t=>t.collected)[0].collected=!1),a.collected=!a.collected,localStorage.setItem(this.collectedLayerCache,JSON.stringify(this.layers.weather)),this.$emit("handleToggleVersion")},handleOtherLayerPick(a){this.otherLayers.some(e=>e.key===a.key)?this.otherLayers=this.otherLayers.filter(e=>e.key!==a.key):a.enabled&&this.otherLayers.push(a),localStorage.setItem(this.otherLayersCache,JSON.stringify(this.otherLayers)),this.$emit("other",this.otherLayers)},handleMenuToggle(){this.$emit("layerToggle",!this.layerToggle)},toggleAutoActive(){this.autoActive=!this.autoActive,localStorage.setItem(this.autoActiveCache,this.autoActive),this.autoActive?this.$emit("weather",this.weatherLayers,this.source):this.$emit("weather",[],this.source)},handleCoordToggle(){this.showCoord=!this.showCoord,this.$emit("coordinate",this.showCoord)},handlePointToggle(){this.isLogin?(this.showPoint=!this.showPoint,this.$emit("point",this.showPoint)):this.$emit("handleToggleVersion")},handleMeasureToggle(){this.showMeasure=!this.showMeasure,this.$emit("measure",this.showMeasure)},handle3DToggle(){this.show3d=!this.show3d,this.$emit("3d",this.show3d)}}},De={class:"idm-gl3-layer"},Ae={class:"bar-item layer-bars"},Be={class:"bar-item tool-bars"},Me={style:{display:"flex","align-items":"center","flex-wrap":"wrap"}},je=["onClick"],We={class:"header-box flex-between"},Oe={class:"weather-layers card-bg"},Fe={class:"layers-body"},$e=["onClick"],He=["onClick"],Ue={key:0,class:"iconfont bookmark active"},Ze={key:1,class:"iconfont bookmark inactive"},Ge={class:"other-layers card-bg"},Je={class:"layers-body"},Xe=["onClick"],qe={class:"flex-start"},Ye={class:"source-layers card-bg"},Qe={class:"layers-body"};function Ke(a,e,t,o,i,s){const n=r.resolveComponent("ElTooltip"),l=r.resolveComponent("ElRadio"),h=r.resolveComponent("ElRadioGroup"),d=r.resolveComponent("ElScrollbar");return r.openBlock(),r.createElementBlock("div",De,[r.createElementVNode("div",{class:"menu-bar-box",style:r.normalizeStyle({top:t.top+10+"px",right:i.right+"px"})},[r.createElementVNode("div",Ae,[r.createVNode(n,{placement:"left",effect:"light",content:"Menu","show-after":1e3},{default:r.withCtx(()=>[r.createElementVNode("div",{class:r.normalizeClass(t.layerToggle?"menu-icon active":"menu-icon"),onClick:e[0]||(e[0]=(...c)=>s.handleMenuToggle&&s.handleMenuToggle(...c))},e[9]||(e[9]=[r.createElementVNode("span",{class:"iconfont"},"",-1)]),2)]),_:1})])],4),r.createElementVNode("div",{class:"menu-bar-box",style:r.normalizeStyle({top:t.top+160+"px",right:i.right+"px"})},[r.createElementVNode("div",Be,[r.createVNode(n,{placement:"left",effect:"light",content:"Measure","show-after":1e3},{default:r.withCtx(()=>[r.createElementVNode("div",{class:r.normalizeClass(i.showMeasure?"menu-icon active":"menu-icon"),onClick:e[1]||(e[1]=(...c)=>s.handleMeasureToggle&&s.handleMeasureToggle(...c))},e[10]||(e[10]=[r.createElementVNode("span",{class:"iconfont"},"",-1)]),2)]),_:1}),r.createVNode(n,{placement:"left",effect:"light",content:"Point Meteo","show-after":1e3},{default:r.withCtx(()=>[r.createElementVNode("div",{class:r.normalizeClass(i.showPoint?"menu-icon active":"menu-icon"),onClick:e[2]||(e[2]=(...c)=>s.handlePointToggle&&s.handlePointToggle(...c))},e[11]||(e[11]=[r.createElementVNode("span",{class:"iconfont"},"",-1)]),2)]),_:1}),r.createVNode(n,{placement:"left",effect:"light",content:"Grid","show-after":1e3},{default:r.withCtx(()=>[r.createElementVNode("div",{class:r.normalizeClass(i.showCoord?"menu-icon active":"menu-icon"),onClick:e[3]||(e[3]=(...c)=>s.handleCoordToggle&&s.handleCoordToggle(...c))},e[12]||(e[12]=[r.createElementVNode("span",{class:"iconfont"},"",-1)]),2)]),_:1}),r.createVNode(n,{placement:"left",effect:"light",content:"3D","show-after":1e3},{default:r.withCtx(()=>[r.createElementVNode("div",{class:r.normalizeClass(i.show3d?"menu-icon active":"menu-icon"),onClick:e[4]||(e[4]=(...c)=>s.handle3DToggle&&s.handle3DToggle(...c))},e[13]||(e[13]=[r.createElementVNode("span",{class:"iconfont"},"",-1)]),2)]),_:1})])],4),s.hasCollectedLayers?(r.openBlock(),r.createElementBlock("div",{key:0,class:"active-layers flex-between",style:r.normalizeStyle({right:i.right+"px",bottom:"100px"})},[r.createElementVNode("div",Me,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(i.layers.weather.filter(c=>c.collected),c=>(r.openBlock(),r.createElementBlock("div",{key:c.key,class:r.normalizeClass(s.computeLayerClass(c,i.weatherLayers)),onClick:m=>s.handleWeatherLayerPick(c)},[e[14]||(e[14]=r.createElementVNode("div",{class:"checkbox"},null,-1)),r.createElementVNode("span",null,r.toDisplayString(c.name),1)],10,je))),128))]),r.createElementVNode("div",{class:"switch flex-center",style:{"margin-top":"4px","align-self":"flex-start","font-size":"28px"},onClick:e[5]||(e[5]=(...c)=>s.toggleAutoActive&&s.toggleAutoActive(...c))},e[15]||(e[15]=[r.createElementVNode("i",{class:"iconfont open"},"",-1),r.createElementVNode("i",{class:"iconfont close"},"",-1)]))],4)):r.createCommentVNode("",!0),r.createElementVNode("div",{class:"available-layers flex-center",style:r.normalizeStyle({top:t.top+"px",right:t.layerToggle?"0px":"-240px"})},[r.createElementVNode("div",{class:r.normalizeClass(["list-box",t.layerToggle?"right-bar":""])},[r.createElementVNode("div",We,[e[16]||(e[16]=r.createElementVNode("div",null,"Layers",-1)),r.createElementVNode("div",{class:"iconfont close-btn",onClick:e[6]||(e[6]=(...c)=>s.handleMenuToggle&&s.handleMenuToggle(...c))},"")]),r.createVNode(d,{style:{flex:"1"}},{default:r.withCtx(()=>[r.createElementVNode("div",Oe,[r.createElementVNode("div",{class:r.normalizeClass(["layers-title flex-between",i.autoActive?"active":""])},[e[18]||(e[18]=r.createElementVNode("div",null,"Weather Layers",-1)),r.createElementVNode("div",{class:"switch flex-center",style:{"margin-right":"0"},onClick:e[7]||(e[7]=(...c)=>s.toggleAutoActive&&s.toggleAutoActive(...c))},e[17]||(e[17]=[r.createElementVNode("i",{class:"iconfont open"},"",-1),r.createElementVNode("i",{class:"iconfont close"},"",-1)]))],2),r.createElementVNode("div",Fe,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(i.layers.weather,c=>(r.openBlock(),r.createElementBlock(r.Fragment,{key:c.key},[c.hide?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(s.computeLayerClass(c,i.weatherLayers))},[r.createElementVNode("div",{class:"flex-start",onClick:m=>s.handleWeatherLayerPick(c)},[e[19]||(e[19]=r.createElementVNode("div",{class:"checkbox"},null,-1)),r.createElementVNode("span",null,r.toDisplayString(c.name),1)],8,$e),r.createElementVNode("div",{onClick:m=>s.handleWeatherLayerCollect(c)},[c.collected?(r.openBlock(),r.createElementBlock("i",Ue,"")):(r.openBlock(),r.createElementBlock("i",Ze,""))],8,He)],2))],64))),128)),e[20]||(e[20]=r.createElementVNode("div",{class:"tip flex-start"},[r.createElementVNode("i",{class:"iconfont bookmark",style:{"align-self":"flex-start",padding:"5px 5px 0 0"}},""),r.createElementVNode("div",null,"Bookmark your favorite layer to homepage(Max 6)")],-1))])]),r.createElementVNode("div",Ge,[e[22]||(e[22]=r.createElementVNode("div",{class:"layers-title"},"Other Layers",-1)),r.createElementVNode("div",Je,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(i.layers.other,c=>(r.openBlock(),r.createElementBlock("div",{key:c.key,class:r.normalizeClass(s.computeLayerClass(c,i.otherLayers)),onClick:m=>s.handleOtherLayerPick(c)},[r.createElementVNode("div",qe,[e[21]||(e[21]=r.createElementVNode("div",{class:"switch flex-center"},[r.createElementVNode("i",{class:"iconfont open"},""),r.createElementVNode("i",{class:"iconfont close"},"")],-1)),r.createElementVNode("span",null,r.toDisplayString(c.name),1)])],10,Xe))),128))])]),r.createElementVNode("div",Ye,[e[25]||(e[25]=r.createElementVNode("span",{class:"layers-title"},"Forecast Model",-1)),r.createElementVNode("div",Qe,[r.createVNode(h,{modelValue:i.source,"onUpdate:modelValue":e[8]||(e[8]=c=>i.source=c),class:"layer-radio flex-col-center-start"},{default:r.withCtx(()=>[r.createVNode(l,{value:"GFS"},{default:r.withCtx(()=>e[23]||(e[23]=[r.createTextVNode("GFS")])),_:1}),r.createVNode(l,{value:"CMEMS"},{default:r.withCtx(()=>e[24]||(e[24]=[r.createTextVNode("CMEMS")])),_:1})]),_:1},8,["modelValue"])])])]),_:1})],2)],4)])}const et=k(Re,[["render",Ke]]),Vr="",tt={name:"IdmWindBarb",props:{map:{type:Object},wind:{type:Object},current:{type:Object},beforeLayer:{type:String},mapProjection:{type:String},showParticle:{type:Boolean,default:!1},toggleVersion:{type:Number}},emits:["particle","showWindFeather"],data(){return{source:"wind-barb-source",barbs:[0,2,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105],empty:x.featureCollection([]),showFeather:localStorage.getItem("windFeatherCache")==="true"||!1,windFeatherCache:"windFeatherCache",right:10,bottom:125,windBarbLoaded:!1}},watch:{"wind.version":{handler(){var a;(a=this.wind)!=null&&a.active&&this.showFeather?this.handleRender():this.handleClear()},deep:!0},showParticle:{handler(){},immediate:!0},showFeather:{handler(){localStorage.setItem(this.windFeatherCache,this.showFeather),this.handleToggle(),this.$emit("showWindFeather",this.showFeather)},immediate:!0},toggleVersion:{handler(){var a,e,t,o;this.right=(((a=document.getElementsByClassName("right-bar")[0])==null?void 0:a.clientWidth)||0)+10,this.bottom=(e=this.current)!=null&&e.active?(((t=document.getElementsByClassName("active-layers")[0])==null?void 0:t.clientHeight)||0)+148:(((o=document.getElementsByClassName("active-layers")[0])==null?void 0:o.clientHeight)||0)+110},immediate:!0}},methods:{handleParticle(){this.$emit("particle",{particle:!this.showParticle,key:"wind",weight:1})},handleRender(){var a,e,t,o;if(!this.map)setTimeout(()=>{this.handleRender()},500);else if(this.wind){const i=new Date().valueOf();let s=0,n=0,l=this.empty;if((a=this.wind)!=null&&a.active&&(l=(e=this.wind)==null?void 0:e.data),(t=this.map)!=null&&t.getSource(this.source))(o=this.map)==null||o.getSource(this.source).setData(l),n=new Date().valueOf()-(i+s),console.log("[wind] update elapsed: ",n,", total: ",s+=n);else{this.map.addSource(this.source,{type:"geojson",data:l});for(let h=0;h<(this.barbs??[]).length-1;h++){const d=(this.barbs??[])[h]||0,c=(this.barbs??[])[h+1]||0,m=d<10?`00${d}kts`:d<100?`0${d}kts`:`${d}kts`;this.map.addLayer({id:m,type:"symbol",filter:["all",[">=","spd",d],["<","spd",c]],source:this.source,layout:{"symbol-placement":"point","icon-image":m,"icon-size":.14,"icon-offset":[0,-20],"icon-allow-overlap":!0,"icon-rotation-alignment":"map","icon-rotate":{property:"val",stops:[[0,0],[360,360]]}},paint:{"icon-opacity":1,"text-color":"#222"}},this.beforeLayer)}this.windBarbLoaded=!0,n=new Date().valueOf()-(i+s),console.log("[wind] add elapsed: ",n,", total: ",s+=n)}}},handleToggle(){if(!this.windBarbLoaded)this.handleRender();else for(const a of this.barbs??[]){const e=a<10?`00${a}kts`:a<100?`0${a}kts`:`${a}kts`;this.map.getLayer(e)&&this.map.setLayoutProperty(e,"visibility",this.showFeather?"visible":"none")}},handleClear(){for(const a of this.barbs??[]){const e=a<10?`00${a}kts`:a<100?`0${a}kts`:`${a}kts`;this.map.getLayer(e)&&this.map.removeLayer(e)}this.map.getSource(this.source)&&this.map.removeSource(this.source),this.windBarbLoaded=!1}}},at={key:0};function rt(a,e,t,o,i,s){var n;return(n=t.wind)!=null&&n.active?(r.openBlock(),r.createElementBlock("div",at,[r.createElementVNode("div",{class:"flex-center wind-tool-bars",style:r.normalizeStyle([{position:"absolute"},{right:i.right+"px",bottom:i.bottom+"px"}])},[t.mapProjection==="mercator"?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["item-bar flex-start",t.showParticle?"active":"inactive"]),onClick:e[0]||(e[0]=(...l)=>s.handleParticle&&s.handleParticle(...l))},e[2]||(e[2]=[r.createElementVNode("div",{class:"checkbox"},null,-1),r.createElementVNode("span",null,"Wind Particles",-1)]),2)):r.createCommentVNode("",!0),r.createElementVNode("div",{class:r.normalizeClass(["item-bar flex-start",i.showFeather?"active":"inactive"]),onClick:e[1]||(e[1]=l=>i.showFeather=!i.showFeather)},e[3]||(e[3]=[r.createElementVNode("div",{class:"checkbox"},null,-1),r.createElementVNode("span",null,"Wind Feather",-1)]),2)],4)])):r.createCommentVNode("",!0)}const it=k(tt,[["render",rt]]);class ue{constructor(e){P(this,"map");P(this,"mercator");P(this,"rampColorLayer");P(this,"rampColorSource");P(this,"particleLayer");P(this,"particleSource");P(this,"rampColorCanvas");P(this,"particleCanvas");P(this,"ratio");this.map=e,this.mercator=new Ne,this.rampColorLayer="ramp-color-layer",this.rampColorSource="ramp-color-source",this.particleLayer="particle-layer",this.particleSource="particle-source",this.rampColorCanvas=document.createElement("canvas"),this.particleCanvas=document.createElement("canvas"),this.ratio=window.devicePixelRatio}convertNLng(e,t=0){return e>180?this.convertNLng(e-360,t+1):e<-180?this.convertNLng(e+360,t+1):[e,t]}getBoundLngLat(){const e=this.map.getBounds();return[[e._sw.lng,e._ne.lat],[e._ne.lng,e._ne.lat],[e._ne.lng,e._sw.lat],[e._sw.lng,e._sw.lat]]}getBoundPixel(){const e=this.map.getBounds(),t=this.map.getZoom()+1,o=[e._ne.lng,e._ne.lat],i=[e._sw.lng,e._sw.lat],[s,n]=this.convertNLng(o[0]),[l,h]=this.convertNLng(i[0]),[d,c]=this.mercator.px([s,o[1]],t),[m,u]=this.mercator.px([l,i[1]],t),p=Math.round(this.mercator.size*Math.pow(2,t)*(n+h));return[m,u,d+p,c]}getBoundRange(){const e=this.map.getZoom()+1,t=this.mercator.size*Math.pow(2,e),o=this.getBoundPixel();return[o[0]/t,o[2]/t,o[3]/t,o[1]/t]}getWorldCopy(e,t){const o=2**t,[i,s,n,l]=e.map(c=>~~(c/(o*256))),h=[];for(let c=l;c<=s;c++)for(let m=i;m<=n;m++)h.push([m,c]);return h.map(c=>{const m=2**t*256;return[c[0]*m,c[1]*m,m]})}resize(){let e=this.map.getSource(this.rampColorSource);e.setCoordinates(this.getBoundLngLat()),e=this.map.getSource(this.particleSource),e.setCoordinates(this.getBoundLngLat()),this.rampColorCanvas.width=this.map._canvas.clientWidth,this.rampColorCanvas.height=this.map._canvas.clientHeight,this.particleCanvas.width=this.map._canvas.clientWidth,this.particleCanvas.height=this.map._canvas.clientHeight}toggle(e){const t=this.map.getLayoutProperty(this.rampColorLayer,"visibility"),o=e?"visible":"none";t!==o&&this.map.setLayoutProperty(this.rampColorLayer,"visibility",o)}toggleParticle(e){const t=this.map.getLayoutProperty(this.particleLayer,"visibility"),o=e?"visible":"none";t!==o&&this.map.setLayoutProperty(this.particleLayer,"visibility",o)}}class Z{createShader(e,t,o){const i=e.createShader(t);if(i&&(e.shaderSource(i,o),e.compileShader(i),!e.getShaderParameter(i,e.COMPILE_STATUS)))throw new Error(e.getShaderInfoLog(i)||"error happened while create shader...");return i}createTexture(e,t,o,i,s,n,l){const h=e.createTexture();return e.bindTexture(e.TEXTURE_2D,h),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,o),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,i),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,i),s instanceof Uint8Array?e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n,l,0,e.RGBA,e.UNSIGNED_BYTE,s):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,s),e.bindTexture(e.TEXTURE_2D,null),h}createDataBuffer(e,t,o){if(e){const i=e.createBuffer();return t==="array"?(e.bindBuffer(e.ARRAY_BUFFER,i),o&&e.bufferData(e.ARRAY_BUFFER,o,e.STATIC_DRAW)):t==="element"&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,i),o&&e.bufferData(e.ELEMENT_ARRAY_BUFFER,o,e.STATIC_DRAW)),i}return null}createProgram(e,t,o){const i=e.createProgram(),s=this.createShader(e,e.VERTEX_SHADER,t),n=this.createShader(e,e.FRAGMENT_SHADER,o);if(i&&s&&n&&(e.attachShader(i,s),e.attachShader(i,n),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS)))throw new Error(e.getProgramInfoLog(i)||"error happened while creating ramp color program");return i}createProgramWrapper(e,t,o){const i=this.createProgram(e,t,o);if(i){const s={program:i},n=e.getProgramParameter(i,e.ACTIVE_ATTRIBUTES);for(let h=0;h<n;h++){const d=e.getActiveAttrib(i,h);s[d.name]=e.getAttribLocation(i,d.name)}const l=e.getProgramParameter(i,e.ACTIVE_UNIFORMS);for(let h=0;h<l;h++){const d=e.getActiveUniform(i,h);s[d.name]=e.getUniformLocation(i,d.name)}return s}}setup(e,t,o=!1,i,s){const n=document.createElement("canvas");n.width=256,n.height=1;const l=n.getContext("2d");if(l&&e){const h=l==null?void 0:l.createLinearGradient(0,0,256,0);return t.forEach(([d,c])=>{h.addColorStop(d,c)}),l.fillStyle=h,l.fillRect(0,0,256,1),{canvas:n,texture:this.createTexture(e,e.LINEAR,e.LINEAR,e.CLAMP_TO_EDGE,o?new Uint8Array(l.getImageData(0,0,256,1).data):n,i,s)}}}setupParticle(e,t=1e3){const o=Math.ceil(Math.sqrt(t)),i=o*o,s=new Uint8Array(i*4);for(let c=0;c<s.length;c++)s[c]=Math.floor(Math.random()*256);const n=this.createTexture(e,e.NEAREST,e.NEAREST,e.CLAMP_TO_EDGE,s,o,o),l=this.createTexture(e,e.NEAREST,e.NEAREST,e.CLAMP_TO_EDGE,s,o,o),h=new Float32Array(i);for(let c=0;c<i;c++)h[c]=c;const d=this.createDataBuffer(e,"array",h);return{resolution:o,total:i,texture0:n,texture1:l,indexBuffer:d}}bind(e,t,o){const i=this.createProgram(e,t,o);if(i){const s=this.createDataBuffer(e,"array",void 0),n=e.getAttribLocation(i,"a_position");e.enableVertexAttribArray(n),e.vertexAttribPointer(n,2,e.FLOAT,!1,0,0);const l=new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]);this.createDataBuffer(e,"array",l);const h=e.getAttribLocation(i,"a_texCoord");return e.enableVertexAttribArray(h),e.vertexAttribPointer(h,2,e.FLOAT,!1,0,0),{program:i,aPositionBuffer:s}}return{}}bindParticle(e,t,o,i,s,n){const l=this.createProgramWrapper(e,t,o),h=this.createProgramWrapper(e,i,s),d=this.createProgramWrapper(e,i,n),c=this.createDataBuffer(e,"array",new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1])),m=e.createFramebuffer();return{particle:l,screen:h,update:d,quadBuffer:c,frameBuffer:m}}draw(e,t,o,i,s,n,l){var h,d;if(t&&o){e.resize(),t==null||t.viewport(0,0,(h=t==null?void 0:t.canvas)==null?void 0:h.width,(d=t==null?void 0:t.canvas)==null?void 0:d.height),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT);try{const c=t.getUniformLocation(o,"u_resolution"),m=t.getUniformLocation(o,"u_image"),u=t.getUniformLocation(o,"u_color");if(t.useProgram(o),t.uniform2f(c,t.canvas.width*e.ratio,t.canvas.height*e.ratio),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,i),t.uniform1i(m,0),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,s),t.uniform1i(u,1),l!=null&&l.uvRange&&(l!=null&&l.sRange)){const y=t.getUniformLocation(o,"u_range_u_v"),w=t.getUniformLocation(o,"u_range_s");t.uniform2f(y,l.uvRange[0],l.uvRange[1]),t.uniform2f(w,l.sRange[0],l.sRange[1])}const p=e.getBoundPixel(),b=e.map.getZoom()+1,f=e.getWorldCopy(p,b);for(const y of f){const w=(y[0]-p[0])*e.ratio,g=(y[1]-p[3])*e.ratio,v=y[2]*e.ratio,[_,L,z,N]=[w,v+w,g,v+g],V=new Float32Array([_,z,L,z,_,N,_,N,L,z,L,N]);t.bindBuffer(t.ARRAY_BUFFER,n),t.bufferData(t.ARRAY_BUFFER,V,t.STATIC_DRAW),t.drawArrays(t.TRIANGLES,0,6)}}catch(c){console.log(`render failed...${c}`)}}}drawParticle(e,t,o,i,s){var n,l;t&&(t==null||t.viewport(0,0,(n=t==null?void 0:t.canvas)==null?void 0:n.width,(l=t==null?void 0:t.canvas)==null?void 0:l.height),t.disable(t.DEPTH_TEST),t.disable(t.STENCIL_TEST),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,o),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,i.texture0),this.renderScreen(e,t,i,s),this.updateParticles(e,t,i,s))}renderScreen(e,t,o,i){t.bindFramebuffer(t.FRAMEBUFFER,o.frameBuffer),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,o.screenTexture,0),t.viewport(0,0,t.canvas.width,t.canvas.height),this.renderScreenTexture(t,o.backgroundTexture,o.screen,o.quadBuffer,.95),this.renderParticles(e,t,o,i),t.bindFramebuffer(t.FRAMEBUFFER,null),this.renderScreenTexture(t,o.screenTexture,o.screen,o.quadBuffer,1);const s=o.backgroundTexture;o.backgroundTexture=o.screenTexture,o.screenTexture=s}renderScreenTexture(e,t,o,i,s){e&&(e.useProgram(o.program),e.bindBuffer(e.ARRAY_BUFFER,i),e.enableVertexAttribArray(o.a_pos),e.vertexAttribPointer(o.a_pos,2,e.FLOAT,!1,0,0),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,t),e.uniform1i(o.u_screen,2),e.uniform1f(o.u_opacity,s),e.drawArrays(e.TRIANGLES,0,6))}renderParticles(e,t,o,i){if(t){t.useProgram(o.particle.program),t.bindBuffer(t.ARRAY_BUFFER,o.indexBuffer),t.enableVertexAttribArray(o.particle.a_index),t.vertexAttribPointer(o.particle.a_index,1,t.FLOAT,!1,0,0),t.activeTexture(t.TEXTURE2),t.bindTexture(t.TEXTURE_2D,o.color.texture),t.uniform1i(o.particle.u_factor,0),t.uniform1i(o.particle.u_particles,1),t.uniform1i(o.particle.u_color_ramp,2),t.uniform1f(o.particle.u_particles_resolution,o.resolution*e.ratio),t.uniform1f(o.particle.u_point,e.ratio);const s=e.getBoundRange();t.uniform4f(o.particle.u_viewport,s[0],s[1],s[2],s[3]),t.uniform2f(o.particle.u_factor_min,i.uvRange[0],i.uvRange[0]),t.uniform2f(o.particle.u_factor_max,i.uvRange[1],i.uvRange[1]),t.drawArrays(t.POINTS,0,o.total)}}updateParticles(e,t,o,i){var n,l;if(t){t.bindFramebuffer(t.FRAMEBUFFER,o.frameBuffer),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,o.texture1,0),t.viewport(0,0,o.resolution,o.resolution),t.useProgram(o.update.program),t.bindBuffer(t.ARRAY_BUFFER,o.quadBuffer),t.enableVertexAttribArray(o.update.a_pos),t.vertexAttribPointer(o.update.a_pos,2,t.FLOAT,!1,0,0),t.uniform1i(o.update.u_factor,0),t.uniform1i(o.update.u_particles,1);const h=e.getBoundRange();t.uniform4f(o.update.u_viewport,h[0],h[1],h[2],h[3]),t.uniform1f(o.update.u_rand_seed,Math.random()),t.uniform2f(o.update.u_factor_res,(n=o==null?void 0:o.image)==null?void 0:n.width,(l=o==null?void 0:o.image)==null?void 0:l.height),t.uniform2f(o.update.u_factor_min,i.uvRange[0],i.uvRange[0]),t.uniform2f(o.update.u_factor_max,i.uvRange[1],i.uvRange[1]),t.uniform1f(o.update.u_speed_factor,i.speedFactor*e.ratio),t.uniform1f(o.update.u_drop_rate,i.dropRate),t.uniform1f(o.update.u_drop_rate_bump,i.dropRateBump),t.drawArrays(t.TRIANGLES,0,6)}const s=o.texture0;o.texture0=o.texture1,o.texture1=s}resize(e,t){e.resize();const o=new Uint8Array(t.canvas.width*t.canvas.height*4).fill(0,0,t.canvas.width*t.canvas.height*4),i=this.createTexture(t,t.NEAREST,t.NEAREST,t.CLAMP_TO_EDGE,o,t.canvas.width,t.canvas.height),s=this.createTexture(t,t.NEAREST,t.NEAREST,t.CLAMP_TO_EDGE,o,t.canvas.width,t.canvas.height);return{screenTexture:i,backgroundTexture:s}}async loadImg(e){return new Promise(t=>{const o=new Blob([e],{type:e.type}),i=URL.createObjectURL(o),s=new Image;s.crossOrigin="anonymous",s.src=i,s.onload=()=>t(s)})}}class T{}P(T,"vertexSchema",`
|
|
1
|
+
(function(E,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue"),require("@turf/turf"),require("@mapbox/sphericalmercator"),require("moment"),require("mapbox-gl"),require("@idm-plugin/geo"),require("axios")):typeof define=="function"&&define.amd?define(["exports","vue","@turf/turf","@mapbox/sphericalmercator","moment","mapbox-gl","@idm-plugin/geo","axios"],r):(E=typeof globalThis<"u"?globalThis:E||self,r(E["idm-gl"]={},E.Vue,E["@turf/turf"],E["@mapbox/sphericalmercator"],E.moment,E["mapbox-gl"],E["@idm-plugin/geo"],E.axios))})(this,function(E,r,Y,Ne,B,O,C,U){"use strict";var Pr=Object.defineProperty;var zr=(E,r,Y)=>r in E?Pr(E,r,{enumerable:!0,configurable:!0,writable:!0,value:Y}):E[r]=Y;var P=(E,r,Y)=>(zr(E,typeof r!="symbol"?r+"":r,Y),Y);function Te(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,o.get?o:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const x=Te(Y),Nr="";var Ve=Object.defineProperty,Ie=(a,e,t)=>e in a?Ve(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,le=(a,e,t)=>(Ie(a,typeof e!="symbol"?e+"":e,t),t);class ce{}le(ce,"LEVEL",{Basic:1,Prime:2,Supper:1024});class he{}le(he,"WEATHER_LAYERS",[{weight:1,name:"Wind",key:"wind",h5:!0,enabled:!0,type:"json",particle:!0},{weight:524288,name:"Wind Particle",key:"wind-particle",peer:{weight:1,key:"wind"},enabled:!0,hide:!0,type:"jpg"},{weight:16,name:"Sig Waves",key:"sig-wave-height",h5:!0,enabled:!0,type:"json"},{weight:4194304,name:"Sig Waves (JPG)",key:"sig-wave",peer:{weight:16,key:"sig-wave"},enabled:!0,hide:!0,type:"jpg"},{weight:8388608,name:"Sig Waves (Contour)",key:"sig-wave-height-contour",peer:{weight:16,key:"sig-wave-contour"},enabled:!0,hide:!0,type:"json"},{weight:96,name:"Current",key:"current",vendor:"cmems",merge:!0,h5:!0,enabled:!0,type:"json"},{weight:1048576,name:"Current Particle",key:"current-particle",vendor:"cmems",peer:{weight:96,key:"current"},enabled:!0,hide:!0,type:"jpg"},{weight:256,name:"Tropicals",key:"tropicals",h5:!0,enabled:!0,type:"json"},{weight:4096,name:"Pressure",h5:!0,key:"prmsl",enabled:!0,type:"json"},{weight:8192,name:"Visibility",vendor:"gfs",key:"visibility",h5:!0,enabled:!0,type:"jpg"},{weight:262144,name:"Precip Acc",key:"precip3h",h5:!0,enabled:!0,type:"jpg"},{weight:6,name:"Swell",key:"swell",merge:!0,h5:!0,enabled:!0,type:"json"},{weight:2,name:"Swell Height",key:"swell-height",partly:!0,enabled:!0,type:"json"},{weight:4,name:"Swell Direction",key:"swell-direction",partly:!0,enabled:!0,type:"json"},{weight:32,name:"Current Direction",key:"current-direction",vendor:"cmems",partly:!0,enabled:!0,type:"json"},{weight:64,name:"Current Speed",key:"current-speed",vendor:"cmems",partly:!0,enabled:!0,type:"json"},{weight:512,name:"Pressure Contour",key:"prmsl-contour",partly:!0,enabled:!0,hide:!0,type:"json"},{weight:1024,name:"Pressure Value",key:"prmsl-value",partly:!0,enabled:!0,hide:!0,type:"json"},{weight:2048,name:"Pressure Front",key:"prmsl-front",partly:!0,enabled:!0,hide:!0,type:"json"},{weight:16384,name:"Iceberg",key:"iceberg",vendor:"cmems",hide:!0,enabled:!1,type:"json"},{weight:32768,name:"Struct Ice",key:"struct-ice",vendor:"cmems",enabled:!1,hide:!0,type:"json"},{weight:65536,name:"Ice Edge",key:"arctic",vendor:"cmems",h5:!0,enabled:!0,type:"jpg"},{weight:131072,name:"Sea Surf. Temp.",key:"water-temp",vendor:"cmems",h5:!0,enabled:!0,type:"jpg"},{weight:2097152,name:"Temp.",key:"temp",h5:!0,enabled:!0,type:"jpg"}]),le(he,"OTHER_LAYERS",[{weight:1,name:"War Zones",key:"war-zones",h5:!0,enabled:!0,type:"json"},{weight:2,name:"GMDSS Areas",key:"gmdss-areas",h5:!0,enabled:!0,type:"json"},{weight:4,name:"ECA Zones",key:"eca-zones",h5:!0,enabled:!0,type:"json"},{weight:8,name:"Load Lines",key:"load-lines",h5:!0,enabled:!0,type:"json"},{weight:16,name:"HRA",key:"high-risk-area",enabled:!1,type:"json"},{weight:32,name:"Pirates",key:"pirates",enabled:!1,type:"json"},{weight:4096,name:"Alert Zones",key:"alert-zones",h5:!0,enabled:!0,type:"json"},{weight:64,name:"Ports",key:"ports",h5:!0,enabled:!0,type:"json"},{weight:128,name:"Time Zones",key:"time-zones",h5:!0,enabled:!0,type:"json"},{weight:256,name:"VRA",key:"voluntary-reporting-area",h5:!0,enabled:!0,type:"json"},{weight:512,name:"Special Areas",key:"special-area",h5:!0,enabled:!0,type:"json"},{weight:1024,name:"Day/Night",key:"day-night",h5:!0,enabled:!0,type:"json"},{weight:2048,name:"ENC",key:"enc",h5:!0,enabled:!0,type:"origin"},{weight:8192,name:"World-12nm",key:"world12nm",h5:!1,enabled:!0,type:"origin"}]);class ge{}le(ge,"WEATHER_TAG",[{weight:4,name:"Adverse Weather Dangerous",key:"DANGEROUS",positive:!0},{weight:2,name:"Adverse Weather Severe",key:"SEVERE",positive:!0},{weight:1,name:"Adverse Weather Heavy",key:"HEAVY",positive:!0}]),le(ge,"SAILING_TAG",[{weight:2048,name:"Deviation",key:"deviation",positive:!0},{weight:4096,name:"Stoppage",key:"stoppage",positive:!0},{weight:8192,name:"Deceleration",key:"deceleration",positive:!0},{weight:16384,name:"No Lane",key:"noLane",positive:!0},{weight:32768,name:"No Noon",key:"noNoon",positive:!0}]),le(ge,"OTHER_TAG",[{weight:2097152,name:"No CP",key:"noCp",positive:!0},{weight:4194304,name:"Send Rpt",key:"sendRpt",positive:!1},{weight:8388608,name:"Send Bps",key:"sendBps",positive:!1},{weight:16777216,name:"Send Pvar",key:"sendPvar",positive:!1},{weight:33554432,name:"Checked",key:"checked",positive:!1},{weight:67108864,name:"Send PWFR",key:"sendPwfr",positive:!1}]);const Tr="",k=(a,e)=>{const t=a.__vccOpts||a;for(const[o,i]of e)t[o]=i;return t},Re={name:"IdmGlLayer",props:{map:{type:Object},mapProjection:{type:String},top:{type:Number,default:60},layerToggle:{type:Boolean,default:!1},toggleVersion:{type:Number},isLogin:{type:Boolean,default:void 0},showWindFeather:{type:Boolean,default:void 0},showWindParticle:{type:Boolean,default:void 0},showCurrentIsoband:{type:Boolean,default:void 0},showCurrentParticle:{type:Boolean,default:void 0}},emits:["weather","other","coordinate","measure","point","3d","layerToggle","handleToggleVersion"],data(){return{autoActive:!0,layers:{weather:[...he.WEATHER_LAYERS.filter(a=>!["swell-height","swell-direction","current-direction","current-speed"].includes(a.key))],other:[...he.OTHER_LAYERS.filter(a=>a.key!=="world12nm"&&a.enabled)]},weatherLayers:[],otherLayers:[],weatherLayersCache:"weatherLayersCache",autoActiveCache:"autoActiveCache",otherLayersCache:"otherLayersCache",collectedLayerCache:"collectedLayerCache",sourceCache:"defaultSourceCache",showCoord:!1,showMeasure:!1,showPoint:!1,show3d:!1,version:{v:"0.0.7",k:"glCacheVersion"},source:"",right:10,rampColorLayers:["visibility","precip3h","temp","water-temp","arctic"]}},computed:{computeLayerClass(){return function(a,e){var o;let t="layer flex-between";return e.some(i=>i.key===a.key)&&(t=t+" active"),(!a.enabled||(o=this.layers.weather)!=null&&o.some(i=>i.key===a.key)&&!this.autoActive||this.rampColorLayers.includes(a.key)&&this.mapProjection==="globe")&&(t=t+" disabled"),t}},hasCollectedLayers(){var a;return((a=this.layers.weather.filter(e=>e.collected))==null?void 0:a.length)>0}},watch:{toggleVersion:{handler(){this.$nextTick(()=>{var a;this.right=(((a=document.getElementsByClassName("right-bar")[0])==null?void 0:a.clientWidth)||0)+10})}},source:{handler(a,e){a&&e&&a!==e&&this.handleConfirm()}},showWindFeather:{handler(){!this.showWindFeather&&!this.showWindParticle&&this.handleWeatherLayerPick({weight:1,name:"Wind",key:"wind",enabled:!0,type:"json",particle:!0})}},showWindParticle:{handler(){!this.showWindFeather&&!this.showWindParticle&&this.handleWeatherLayerPick({weight:1,name:"Wind",key:"wind",enabled:!0,type:"json",particle:!0})}},showCurrentIsoband:{handler(){!this.showCurrentIsoband&&!this.showCurrentParticle&&this.handleWeatherLayerPick({weight:96,name:"Current",key:"current",vendor:"cmems",merge:!0,h5:!0,enabled:!0})}},showCurrentParticle:{handler(){!this.showCurrentIsoband&&!this.showCurrentParticle&&this.handleWeatherLayerPick({weight:96,name:"Current",key:"current",vendor:"cmems",merge:!0,h5:!0,enabled:!0})}}},mounted(){const a=localStorage.getItem(this.version.k);this.version.v!==a&&(localStorage.removeItem(this.weatherLayersCache),localStorage.removeItem(this.collectedLayerCache),localStorage.removeItem(this.otherLayersCache),localStorage.removeItem("windFeatherCache"),localStorage.removeItem("currentJsonCache"),localStorage.setItem(this.version.k,this.version.v));let e=localStorage.getItem(this.autoActiveCache);this.autoActive=e!=="false",e=localStorage.getItem(this.collectedLayerCache);let t=JSON.parse(e||'[{"weight": 16, "name": "Sig Waves", "key": "sig-wave-height", "collected": true},{"weight": 1, "name": "Wind", "key": "wind", "h5": true, "collected": true},{"weight": 96, "name": "Current", "key": "current", "collected": true},{"weight": 256, "name": "Tropicals", "key": "tropicals", "collected": true},{"weight": 4096, "name": "Pressure", "h5": true, "key": "prmsl", "collected": true},{"weight": 6, "name": "Swell", "key": "swell", "collected": true}]');this.layers.weather.forEach(o=>{o.collected=!!t.some(i=>i.key===o.key&&i.collected)}),e=localStorage.getItem(this.weatherLayersCache),t=JSON.parse(e||'[{"weight":1,"name":"Wind","key":"wind","enabled":true,"type":"json","particle":true},{"weight":4096,"name":"Pressure","key":"prmsl","enabled":true,"type":"json"},{"weight":256,"name":"Tropicals","key":"tropicals","enabled":true,"type":"json"}]'),this.autoActive&&(this.weatherLayers=[...t]),e=localStorage.getItem(this.otherLayersCache),t=JSON.parse(e||'[{"weight":4,"name":"ECA Zones","key":"eca-zones","enabled":true,"type":"json"}]'),this.otherLayers=t,e=localStorage.getItem(this.sourceCache),this.source=e||"GFS",this.handleConfirm()},methods:{handleConfirm(){this.$emit("weather",this.weatherLayers,this.source),this.$emit("other",this.otherLayers),localStorage.setItem(this.autoActiveCache,this.autoActive),localStorage.setItem(this.sourceCache,this.source)},handleWeatherLayerPick(a){if(this.rampColorLayers.includes(a.key)&&this.mapProjection==="globe"||!this.autoActive)return!1;["wind","current"].includes(a.key)&&!this.showWindFeather&&!this.showCurrentIsoband&&(a.particle=!0),this.weatherLayers.some(e=>e.key===a.key)?this.weatherLayers=this.weatherLayers.filter(e=>e.key!==a.key):this.weatherLayers.length<12&&a.enabled&&(["png","jpg"].includes(a.type)&&(this.weatherLayers=this.weatherLayers.filter(e=>e.type==="json")),this.weatherLayers.push(a)),this.$emit("weather",this.weatherLayers,this.source),localStorage.setItem(this.weatherLayersCache,JSON.stringify(this.weatherLayers)),localStorage.setItem(this.sourceCache,this.source)},handleWeatherLayerCollect(a){var e;!a.collected&&((e=this.layers.weather.filter(t=>t.collected))==null?void 0:e.length)>=6&&(this.layers.weather.filter(t=>t.collected)[0].collected=!1),a.collected=!a.collected,localStorage.setItem(this.collectedLayerCache,JSON.stringify(this.layers.weather)),this.$emit("handleToggleVersion")},handleOtherLayerPick(a){this.otherLayers.some(e=>e.key===a.key)?this.otherLayers=this.otherLayers.filter(e=>e.key!==a.key):a.enabled&&this.otherLayers.push(a),localStorage.setItem(this.otherLayersCache,JSON.stringify(this.otherLayers)),this.$emit("other",this.otherLayers)},handleMenuToggle(){this.$emit("layerToggle",!this.layerToggle)},toggleAutoActive(){this.autoActive=!this.autoActive,localStorage.setItem(this.autoActiveCache,this.autoActive),this.autoActive?this.$emit("weather",this.weatherLayers,this.source):this.$emit("weather",[],this.source)},handleCoordToggle(){this.showCoord=!this.showCoord,this.$emit("coordinate",this.showCoord)},handlePointToggle(){this.isLogin?(this.showPoint=!this.showPoint,this.$emit("point",this.showPoint)):this.$emit("handleToggleVersion")},handleMeasureToggle(){this.showMeasure=!this.showMeasure,this.$emit("measure",this.showMeasure)},handle3DToggle(){this.show3d=!this.show3d,this.$emit("3d",this.show3d)}}},De={class:"idm-gl3-layer"},Ae={class:"bar-item layer-bars"},Be={class:"bar-item tool-bars"},Me={style:{display:"flex","align-items":"center","flex-wrap":"wrap"}},je=["onClick"],We={class:"header-box flex-between"},Oe={class:"weather-layers card-bg"},Fe={class:"layers-body"},$e=["onClick"],He=["onClick"],Ue={key:0,class:"iconfont bookmark active"},Ze={key:1,class:"iconfont bookmark inactive"},Ge={class:"other-layers card-bg"},Je={class:"layers-body"},Xe=["onClick"],qe={class:"flex-start"},Ye={class:"source-layers card-bg"},Qe={class:"layers-body"};function Ke(a,e,t,o,i,s){const n=r.resolveComponent("ElTooltip"),l=r.resolveComponent("ElRadio"),h=r.resolveComponent("ElRadioGroup"),d=r.resolveComponent("ElScrollbar");return r.openBlock(),r.createElementBlock("div",De,[r.createElementVNode("div",{class:"menu-bar-box",style:r.normalizeStyle({top:t.top+10+"px",right:i.right+"px"})},[r.createElementVNode("div",Ae,[r.createVNode(n,{placement:"left",effect:"light",content:"Menu","show-after":1e3},{default:r.withCtx(()=>[r.createElementVNode("div",{class:r.normalizeClass(t.layerToggle?"menu-icon active":"menu-icon"),onClick:e[0]||(e[0]=(...c)=>s.handleMenuToggle&&s.handleMenuToggle(...c))},e[9]||(e[9]=[r.createElementVNode("span",{class:"iconfont"},"",-1)]),2)]),_:1})])],4),r.createElementVNode("div",{class:"menu-bar-box",style:r.normalizeStyle({top:t.top+160+"px",right:i.right+"px"})},[r.createElementVNode("div",Be,[r.createVNode(n,{placement:"left",effect:"light",content:"Measure","show-after":1e3},{default:r.withCtx(()=>[r.createElementVNode("div",{class:r.normalizeClass(i.showMeasure?"menu-icon active":"menu-icon"),onClick:e[1]||(e[1]=(...c)=>s.handleMeasureToggle&&s.handleMeasureToggle(...c))},e[10]||(e[10]=[r.createElementVNode("span",{class:"iconfont"},"",-1)]),2)]),_:1}),r.createVNode(n,{placement:"left",effect:"light",content:"Point Meteo","show-after":1e3},{default:r.withCtx(()=>[r.createElementVNode("div",{class:r.normalizeClass(i.showPoint?"menu-icon active":"menu-icon"),onClick:e[2]||(e[2]=(...c)=>s.handlePointToggle&&s.handlePointToggle(...c))},e[11]||(e[11]=[r.createElementVNode("span",{class:"iconfont"},"",-1)]),2)]),_:1}),r.createVNode(n,{placement:"left",effect:"light",content:"Grid","show-after":1e3},{default:r.withCtx(()=>[r.createElementVNode("div",{class:r.normalizeClass(i.showCoord?"menu-icon active":"menu-icon"),onClick:e[3]||(e[3]=(...c)=>s.handleCoordToggle&&s.handleCoordToggle(...c))},e[12]||(e[12]=[r.createElementVNode("span",{class:"iconfont"},"",-1)]),2)]),_:1}),r.createVNode(n,{placement:"left",effect:"light",content:"3D","show-after":1e3},{default:r.withCtx(()=>[r.createElementVNode("div",{class:r.normalizeClass(i.show3d?"menu-icon active":"menu-icon"),onClick:e[4]||(e[4]=(...c)=>s.handle3DToggle&&s.handle3DToggle(...c))},e[13]||(e[13]=[r.createElementVNode("span",{class:"iconfont"},"",-1)]),2)]),_:1})])],4),s.hasCollectedLayers?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["active-layers flex-between",i.autoActive?"active":""]),style:r.normalizeStyle({right:i.right+"px",bottom:"100px"})},[r.createElementVNode("div",Me,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(i.layers.weather.filter(c=>c.collected),c=>(r.openBlock(),r.createElementBlock("div",{key:c.key,class:r.normalizeClass(s.computeLayerClass(c,i.weatherLayers)),onClick:m=>s.handleWeatherLayerPick(c)},[e[14]||(e[14]=r.createElementVNode("div",{class:"checkbox"},null,-1)),r.createElementVNode("span",null,r.toDisplayString(c.name),1)],10,je))),128))]),r.createElementVNode("div",{class:"switch flex-center",style:{"margin-top":"4px","align-self":"flex-start","font-size":"28px"},onClick:e[5]||(e[5]=(...c)=>s.toggleAutoActive&&s.toggleAutoActive(...c))},e[15]||(e[15]=[r.createElementVNode("i",{class:"iconfont open"},"",-1),r.createElementVNode("i",{class:"iconfont close"},"",-1)]))],6)):r.createCommentVNode("",!0),r.createElementVNode("div",{class:"available-layers flex-center",style:r.normalizeStyle({top:t.top+"px",right:t.layerToggle?"0px":"-240px"})},[r.createElementVNode("div",{class:r.normalizeClass(["list-box",t.layerToggle?"right-bar":""])},[r.createElementVNode("div",We,[e[16]||(e[16]=r.createElementVNode("div",null,"Layers",-1)),r.createElementVNode("div",{class:"iconfont close-btn",onClick:e[6]||(e[6]=(...c)=>s.handleMenuToggle&&s.handleMenuToggle(...c))},"")]),r.createVNode(d,{style:{flex:"1"}},{default:r.withCtx(()=>[r.createElementVNode("div",Oe,[r.createElementVNode("div",{class:r.normalizeClass(["layers-title flex-between",i.autoActive?"active":""])},[e[18]||(e[18]=r.createElementVNode("div",null,"Weather Layers",-1)),r.createElementVNode("div",{class:"switch flex-center",style:{"margin-right":"0"},onClick:e[7]||(e[7]=(...c)=>s.toggleAutoActive&&s.toggleAutoActive(...c))},e[17]||(e[17]=[r.createElementVNode("i",{class:"iconfont open"},"",-1),r.createElementVNode("i",{class:"iconfont close"},"",-1)]))],2),r.createElementVNode("div",Fe,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(i.layers.weather,c=>(r.openBlock(),r.createElementBlock(r.Fragment,{key:c.key},[c.hide?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(s.computeLayerClass(c,i.weatherLayers))},[r.createElementVNode("div",{class:"flex-start",onClick:m=>s.handleWeatherLayerPick(c)},[e[19]||(e[19]=r.createElementVNode("div",{class:"checkbox"},null,-1)),r.createElementVNode("span",null,r.toDisplayString(c.name),1)],8,$e),r.createElementVNode("div",{onClick:m=>s.handleWeatherLayerCollect(c)},[c.collected?(r.openBlock(),r.createElementBlock("i",Ue,"")):(r.openBlock(),r.createElementBlock("i",Ze,""))],8,He)],2))],64))),128)),e[20]||(e[20]=r.createElementVNode("div",{class:"tip flex-start"},[r.createElementVNode("i",{class:"iconfont bookmark",style:{"align-self":"flex-start",padding:"5px 5px 0 0"}},""),r.createElementVNode("div",null,"Bookmark your favorite layer to homepage(Max 6)")],-1))])]),r.createElementVNode("div",Ge,[e[22]||(e[22]=r.createElementVNode("div",{class:"layers-title"},"Other Layers",-1)),r.createElementVNode("div",Je,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(i.layers.other,c=>(r.openBlock(),r.createElementBlock("div",{key:c.key,class:r.normalizeClass(s.computeLayerClass(c,i.otherLayers)),onClick:m=>s.handleOtherLayerPick(c)},[r.createElementVNode("div",qe,[e[21]||(e[21]=r.createElementVNode("div",{class:"switch flex-center"},[r.createElementVNode("i",{class:"iconfont open"},""),r.createElementVNode("i",{class:"iconfont close"},"")],-1)),r.createElementVNode("span",null,r.toDisplayString(c.name),1)])],10,Xe))),128))])]),r.createElementVNode("div",Ye,[e[25]||(e[25]=r.createElementVNode("span",{class:"layers-title"},"Forecast Model",-1)),r.createElementVNode("div",Qe,[r.createVNode(h,{modelValue:i.source,"onUpdate:modelValue":e[8]||(e[8]=c=>i.source=c),class:"layer-radio flex-col-center-start"},{default:r.withCtx(()=>[r.createVNode(l,{value:"GFS"},{default:r.withCtx(()=>e[23]||(e[23]=[r.createTextVNode("GFS")])),_:1}),r.createVNode(l,{value:"CMEMS"},{default:r.withCtx(()=>e[24]||(e[24]=[r.createTextVNode("CMEMS")])),_:1})]),_:1},8,["modelValue"])])])]),_:1})],2)],4)])}const et=k(Re,[["render",Ke]]),Vr="",tt={name:"IdmWindBarb",props:{map:{type:Object},wind:{type:Object},current:{type:Object},beforeLayer:{type:String},mapProjection:{type:String},showParticle:{type:Boolean,default:!1},toggleVersion:{type:Number}},emits:["particle","showWindFeather"],data(){return{source:"wind-barb-source",barbs:[0,2,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105],empty:x.featureCollection([]),showFeather:localStorage.getItem("windFeatherCache")==="true"||!1,windFeatherCache:"windFeatherCache",right:10,bottom:125,windBarbLoaded:!1}},watch:{"wind.version":{handler(){var a;(a=this.wind)!=null&&a.active&&this.showFeather?this.handleRender():this.handleClear()},deep:!0},showParticle:{handler(){},immediate:!0},showFeather:{handler(){localStorage.setItem(this.windFeatherCache,this.showFeather),this.handleToggle(),this.$emit("showWindFeather",this.showFeather)},immediate:!0},toggleVersion:{handler(){var a,e,t,o;this.right=(((a=document.getElementsByClassName("right-bar")[0])==null?void 0:a.clientWidth)||0)+10,this.bottom=(e=this.current)!=null&&e.active?(((t=document.getElementsByClassName("active-layers")[0])==null?void 0:t.clientHeight)||0)+148:(((o=document.getElementsByClassName("active-layers")[0])==null?void 0:o.clientHeight)||0)+110},immediate:!0}},methods:{handleParticle(){this.$emit("particle",{particle:!this.showParticle,key:"wind",weight:1})},handleRender(){var a,e,t,o;if(!this.map)setTimeout(()=>{this.handleRender()},500);else if(this.wind){const i=new Date().valueOf();let s=0,n=0,l=this.empty;if((a=this.wind)!=null&&a.active&&(l=(e=this.wind)==null?void 0:e.data),(t=this.map)!=null&&t.getSource(this.source))(o=this.map)==null||o.getSource(this.source).setData(l),n=new Date().valueOf()-(i+s),console.log("[wind] update elapsed: ",n,", total: ",s+=n);else{this.map.addSource(this.source,{type:"geojson",data:l});for(let h=0;h<(this.barbs??[]).length-1;h++){const d=(this.barbs??[])[h]||0,c=(this.barbs??[])[h+1]||0,m=d<10?`00${d}kts`:d<100?`0${d}kts`:`${d}kts`;this.map.addLayer({id:m,type:"symbol",filter:["all",[">=","spd",d],["<","spd",c]],source:this.source,layout:{"symbol-placement":"point","icon-image":m,"icon-size":.14,"icon-offset":[0,-20],"icon-allow-overlap":!0,"icon-rotation-alignment":"map","icon-rotate":{property:"val",stops:[[0,0],[360,360]]}},paint:{"icon-opacity":1,"text-color":"#222"}},this.beforeLayer)}this.windBarbLoaded=!0,n=new Date().valueOf()-(i+s),console.log("[wind] add elapsed: ",n,", total: ",s+=n)}}},handleToggle(){if(!this.windBarbLoaded)this.handleRender();else for(const a of this.barbs??[]){const e=a<10?`00${a}kts`:a<100?`0${a}kts`:`${a}kts`;this.map.getLayer(e)&&this.map.setLayoutProperty(e,"visibility",this.showFeather?"visible":"none")}},handleClear(){for(const a of this.barbs??[]){const e=a<10?`00${a}kts`:a<100?`0${a}kts`:`${a}kts`;this.map.getLayer(e)&&this.map.removeLayer(e)}this.map.getSource(this.source)&&this.map.removeSource(this.source),this.windBarbLoaded=!1}}},at={key:0};function rt(a,e,t,o,i,s){var n;return(n=t.wind)!=null&&n.active?(r.openBlock(),r.createElementBlock("div",at,[r.createElementVNode("div",{class:"flex-center wind-tool-bars",style:r.normalizeStyle([{position:"absolute"},{right:i.right+"px",bottom:i.bottom+"px"}])},[t.mapProjection==="mercator"?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["item-bar flex-start",t.showParticle?"active":"inactive"]),onClick:e[0]||(e[0]=(...l)=>s.handleParticle&&s.handleParticle(...l))},e[2]||(e[2]=[r.createElementVNode("div",{class:"checkbox"},null,-1),r.createElementVNode("span",null,"Wind Particles",-1)]),2)):r.createCommentVNode("",!0),r.createElementVNode("div",{class:r.normalizeClass(["item-bar flex-start",i.showFeather?"active":"inactive"]),onClick:e[1]||(e[1]=l=>i.showFeather=!i.showFeather)},e[3]||(e[3]=[r.createElementVNode("div",{class:"checkbox"},null,-1),r.createElementVNode("span",null,"Wind Feather",-1)]),2)],4)])):r.createCommentVNode("",!0)}const it=k(tt,[["render",rt]]);class ue{constructor(e){P(this,"map");P(this,"mercator");P(this,"rampColorLayer");P(this,"rampColorSource");P(this,"particleLayer");P(this,"particleSource");P(this,"rampColorCanvas");P(this,"particleCanvas");P(this,"ratio");this.map=e,this.mercator=new Ne,this.rampColorLayer="ramp-color-layer",this.rampColorSource="ramp-color-source",this.particleLayer="particle-layer",this.particleSource="particle-source",this.rampColorCanvas=document.createElement("canvas"),this.particleCanvas=document.createElement("canvas"),this.ratio=window.devicePixelRatio}convertNLng(e,t=0){return e>180?this.convertNLng(e-360,t+1):e<-180?this.convertNLng(e+360,t+1):[e,t]}getBoundLngLat(){const e=this.map.getBounds();return[[e._sw.lng,e._ne.lat],[e._ne.lng,e._ne.lat],[e._ne.lng,e._sw.lat],[e._sw.lng,e._sw.lat]]}getBoundPixel(){const e=this.map.getBounds(),t=this.map.getZoom()+1,o=[e._ne.lng,e._ne.lat],i=[e._sw.lng,e._sw.lat],[s,n]=this.convertNLng(o[0]),[l,h]=this.convertNLng(i[0]),[d,c]=this.mercator.px([s,o[1]],t),[m,u]=this.mercator.px([l,i[1]],t),p=Math.round(this.mercator.size*Math.pow(2,t)*(n+h));return[m,u,d+p,c]}getBoundRange(){const e=this.map.getZoom()+1,t=this.mercator.size*Math.pow(2,e),o=this.getBoundPixel();return[o[0]/t,o[2]/t,o[3]/t,o[1]/t]}getWorldCopy(e,t){const o=2**t,[i,s,n,l]=e.map(c=>~~(c/(o*256))),h=[];for(let c=l;c<=s;c++)for(let m=i;m<=n;m++)h.push([m,c]);return h.map(c=>{const m=2**t*256;return[c[0]*m,c[1]*m,m]})}resize(){let e=this.map.getSource(this.rampColorSource);e.setCoordinates(this.getBoundLngLat()),e=this.map.getSource(this.particleSource),e.setCoordinates(this.getBoundLngLat()),this.rampColorCanvas.width=this.map._canvas.clientWidth,this.rampColorCanvas.height=this.map._canvas.clientHeight,this.particleCanvas.width=this.map._canvas.clientWidth,this.particleCanvas.height=this.map._canvas.clientHeight}toggle(e){const t=this.map.getLayoutProperty(this.rampColorLayer,"visibility"),o=e?"visible":"none";t!==o&&this.map.setLayoutProperty(this.rampColorLayer,"visibility",o)}toggleParticle(e){const t=this.map.getLayoutProperty(this.particleLayer,"visibility"),o=e?"visible":"none";t!==o&&this.map.setLayoutProperty(this.particleLayer,"visibility",o)}}class Z{createShader(e,t,o){const i=e.createShader(t);if(i&&(e.shaderSource(i,o),e.compileShader(i),!e.getShaderParameter(i,e.COMPILE_STATUS)))throw new Error(e.getShaderInfoLog(i)||"error happened while create shader...");return i}createTexture(e,t,o,i,s,n,l){const h=e.createTexture();return e.bindTexture(e.TEXTURE_2D,h),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,o),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,i),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,i),s instanceof Uint8Array?e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n,l,0,e.RGBA,e.UNSIGNED_BYTE,s):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,s),e.bindTexture(e.TEXTURE_2D,null),h}createDataBuffer(e,t,o){if(e){const i=e.createBuffer();return t==="array"?(e.bindBuffer(e.ARRAY_BUFFER,i),o&&e.bufferData(e.ARRAY_BUFFER,o,e.STATIC_DRAW)):t==="element"&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,i),o&&e.bufferData(e.ELEMENT_ARRAY_BUFFER,o,e.STATIC_DRAW)),i}return null}createProgram(e,t,o){const i=e.createProgram(),s=this.createShader(e,e.VERTEX_SHADER,t),n=this.createShader(e,e.FRAGMENT_SHADER,o);if(i&&s&&n&&(e.attachShader(i,s),e.attachShader(i,n),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS)))throw new Error(e.getProgramInfoLog(i)||"error happened while creating ramp color program");return i}createProgramWrapper(e,t,o){const i=this.createProgram(e,t,o);if(i){const s={program:i},n=e.getProgramParameter(i,e.ACTIVE_ATTRIBUTES);for(let h=0;h<n;h++){const d=e.getActiveAttrib(i,h);s[d.name]=e.getAttribLocation(i,d.name)}const l=e.getProgramParameter(i,e.ACTIVE_UNIFORMS);for(let h=0;h<l;h++){const d=e.getActiveUniform(i,h);s[d.name]=e.getUniformLocation(i,d.name)}return s}}setup(e,t,o=!1,i,s){const n=document.createElement("canvas");n.width=256,n.height=1;const l=n.getContext("2d");if(l&&e){const h=l==null?void 0:l.createLinearGradient(0,0,256,0);return t.forEach(([d,c])=>{h.addColorStop(d,c)}),l.fillStyle=h,l.fillRect(0,0,256,1),{canvas:n,texture:this.createTexture(e,e.LINEAR,e.LINEAR,e.CLAMP_TO_EDGE,o?new Uint8Array(l.getImageData(0,0,256,1).data):n,i,s)}}}setupParticle(e,t=1e3){const o=Math.ceil(Math.sqrt(t)),i=o*o,s=new Uint8Array(i*4);for(let c=0;c<s.length;c++)s[c]=Math.floor(Math.random()*256);const n=this.createTexture(e,e.NEAREST,e.NEAREST,e.CLAMP_TO_EDGE,s,o,o),l=this.createTexture(e,e.NEAREST,e.NEAREST,e.CLAMP_TO_EDGE,s,o,o),h=new Float32Array(i);for(let c=0;c<i;c++)h[c]=c;const d=this.createDataBuffer(e,"array",h);return{resolution:o,total:i,texture0:n,texture1:l,indexBuffer:d}}bind(e,t,o){const i=this.createProgram(e,t,o);if(i){const s=this.createDataBuffer(e,"array",void 0),n=e.getAttribLocation(i,"a_position");e.enableVertexAttribArray(n),e.vertexAttribPointer(n,2,e.FLOAT,!1,0,0);const l=new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]);this.createDataBuffer(e,"array",l);const h=e.getAttribLocation(i,"a_texCoord");return e.enableVertexAttribArray(h),e.vertexAttribPointer(h,2,e.FLOAT,!1,0,0),{program:i,aPositionBuffer:s}}return{}}bindParticle(e,t,o,i,s,n){const l=this.createProgramWrapper(e,t,o),h=this.createProgramWrapper(e,i,s),d=this.createProgramWrapper(e,i,n),c=this.createDataBuffer(e,"array",new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1])),m=e.createFramebuffer();return{particle:l,screen:h,update:d,quadBuffer:c,frameBuffer:m}}draw(e,t,o,i,s,n,l){var h,d;if(t&&o){e.resize(),t==null||t.viewport(0,0,(h=t==null?void 0:t.canvas)==null?void 0:h.width,(d=t==null?void 0:t.canvas)==null?void 0:d.height),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT);try{const c=t.getUniformLocation(o,"u_resolution"),m=t.getUniformLocation(o,"u_image"),u=t.getUniformLocation(o,"u_color");if(t.useProgram(o),t.uniform2f(c,t.canvas.width*e.ratio,t.canvas.height*e.ratio),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,i),t.uniform1i(m,0),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,s),t.uniform1i(u,1),l!=null&&l.uvRange&&(l!=null&&l.sRange)){const y=t.getUniformLocation(o,"u_range_u_v"),w=t.getUniformLocation(o,"u_range_s");t.uniform2f(y,l.uvRange[0],l.uvRange[1]),t.uniform2f(w,l.sRange[0],l.sRange[1])}const p=e.getBoundPixel(),b=e.map.getZoom()+1,f=e.getWorldCopy(p,b);for(const y of f){const w=(y[0]-p[0])*e.ratio,g=(y[1]-p[3])*e.ratio,v=y[2]*e.ratio,[_,L,z,N]=[w,v+w,g,v+g],V=new Float32Array([_,z,L,z,_,N,_,N,L,z,L,N]);t.bindBuffer(t.ARRAY_BUFFER,n),t.bufferData(t.ARRAY_BUFFER,V,t.STATIC_DRAW),t.drawArrays(t.TRIANGLES,0,6)}}catch(c){console.log(`render failed...${c}`)}}}drawParticle(e,t,o,i,s){var n,l;t&&(t==null||t.viewport(0,0,(n=t==null?void 0:t.canvas)==null?void 0:n.width,(l=t==null?void 0:t.canvas)==null?void 0:l.height),t.disable(t.DEPTH_TEST),t.disable(t.STENCIL_TEST),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,o),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,i.texture0),this.renderScreen(e,t,i,s),this.updateParticles(e,t,i,s))}renderScreen(e,t,o,i){t.bindFramebuffer(t.FRAMEBUFFER,o.frameBuffer),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,o.screenTexture,0),t.viewport(0,0,t.canvas.width,t.canvas.height),this.renderScreenTexture(t,o.backgroundTexture,o.screen,o.quadBuffer,.95),this.renderParticles(e,t,o,i),t.bindFramebuffer(t.FRAMEBUFFER,null),this.renderScreenTexture(t,o.screenTexture,o.screen,o.quadBuffer,1);const s=o.backgroundTexture;o.backgroundTexture=o.screenTexture,o.screenTexture=s}renderScreenTexture(e,t,o,i,s){e&&(e.useProgram(o.program),e.bindBuffer(e.ARRAY_BUFFER,i),e.enableVertexAttribArray(o.a_pos),e.vertexAttribPointer(o.a_pos,2,e.FLOAT,!1,0,0),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,t),e.uniform1i(o.u_screen,2),e.uniform1f(o.u_opacity,s),e.drawArrays(e.TRIANGLES,0,6))}renderParticles(e,t,o,i){if(t){t.useProgram(o.particle.program),t.bindBuffer(t.ARRAY_BUFFER,o.indexBuffer),t.enableVertexAttribArray(o.particle.a_index),t.vertexAttribPointer(o.particle.a_index,1,t.FLOAT,!1,0,0),t.activeTexture(t.TEXTURE2),t.bindTexture(t.TEXTURE_2D,o.color.texture),t.uniform1i(o.particle.u_factor,0),t.uniform1i(o.particle.u_particles,1),t.uniform1i(o.particle.u_color_ramp,2),t.uniform1f(o.particle.u_particles_resolution,o.resolution*e.ratio),t.uniform1f(o.particle.u_point,e.ratio);const s=e.getBoundRange();t.uniform4f(o.particle.u_viewport,s[0],s[1],s[2],s[3]),t.uniform2f(o.particle.u_factor_min,i.uvRange[0],i.uvRange[0]),t.uniform2f(o.particle.u_factor_max,i.uvRange[1],i.uvRange[1]),t.drawArrays(t.POINTS,0,o.total)}}updateParticles(e,t,o,i){var n,l;if(t){t.bindFramebuffer(t.FRAMEBUFFER,o.frameBuffer),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,o.texture1,0),t.viewport(0,0,o.resolution,o.resolution),t.useProgram(o.update.program),t.bindBuffer(t.ARRAY_BUFFER,o.quadBuffer),t.enableVertexAttribArray(o.update.a_pos),t.vertexAttribPointer(o.update.a_pos,2,t.FLOAT,!1,0,0),t.uniform1i(o.update.u_factor,0),t.uniform1i(o.update.u_particles,1);const h=e.getBoundRange();t.uniform4f(o.update.u_viewport,h[0],h[1],h[2],h[3]),t.uniform1f(o.update.u_rand_seed,Math.random()),t.uniform2f(o.update.u_factor_res,(n=o==null?void 0:o.image)==null?void 0:n.width,(l=o==null?void 0:o.image)==null?void 0:l.height),t.uniform2f(o.update.u_factor_min,i.uvRange[0],i.uvRange[0]),t.uniform2f(o.update.u_factor_max,i.uvRange[1],i.uvRange[1]),t.uniform1f(o.update.u_speed_factor,i.speedFactor*e.ratio),t.uniform1f(o.update.u_drop_rate,i.dropRate),t.uniform1f(o.update.u_drop_rate_bump,i.dropRateBump),t.drawArrays(t.TRIANGLES,0,6)}const s=o.texture0;o.texture0=o.texture1,o.texture1=s}resize(e,t){e.resize();const o=new Uint8Array(t.canvas.width*t.canvas.height*4).fill(0,0,t.canvas.width*t.canvas.height*4),i=this.createTexture(t,t.NEAREST,t.NEAREST,t.CLAMP_TO_EDGE,o,t.canvas.width,t.canvas.height),s=this.createTexture(t,t.NEAREST,t.NEAREST,t.CLAMP_TO_EDGE,o,t.canvas.width,t.canvas.height);return{screenTexture:i,backgroundTexture:s}}async loadImg(e){return new Promise(t=>{const o=new Blob([e],{type:e.type}),i=URL.createObjectURL(o),s=new Image;s.crossOrigin="anonymous",s.src=i,s.onload=()=>t(s)})}}class T{}P(T,"vertexSchema",`
|
|
2
2
|
//canvas 坐标系上的坐标 (x, y)
|
|
3
3
|
attribute vec2 a_position; //像素坐标
|
|
4
4
|
attribute vec2 a_texCoord; //纹理坐标
|