zhihao-ui 1.3.2 → 1.3.4-5.-alpha.1

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.
Files changed (105) hide show
  1. package/dist/es/{BaseInfo-DZ0pUsfS.js → BaseInfo-Cu3ME-K_.js} +1 -1
  2. package/dist/es/{BaseItem-C_JbnRPH.js → BaseItem-Co7KlYD6.js} +3 -3
  3. package/dist/es/{Button-CydCp4hf.js → Button-Dp3Eoz3O.js} +2 -2
  4. package/dist/es/{DatePicker-C__sA0-h.js → DatePicker-BilQVlgi.js} +3 -3
  5. package/dist/es/{DetailHeader-bEliAoL-.js → DetailHeader-DTHE-pQa.js} +3 -3
  6. package/dist/es/{DetailSubTitle-COsgdEV-.js → DetailSubTitle-BG-q2NNN.js} +2 -2
  7. package/dist/es/{Dialog-D-vnJqtW.js → Dialog-B0N_UsO3.js} +3 -3
  8. package/dist/es/{DiyDataTable-DTMKwxu9.js → DiyDataTable-BQaaClFf.js} +4 -4
  9. package/dist/es/{EditInfoPair-C4vN_b9E.js → EditInfoPair-DwrwCanm.js} +3 -3
  10. package/dist/es/{FileWrapper-D7KcyVg2.js → FileWrapper-BDK8YvRB.js} +4 -4
  11. package/dist/es/{Grid-BE-CLeGr.js → Grid-pVjqXcmJ.js} +2 -2
  12. package/dist/es/{InfoPair-T3_TncEu.js → InfoPair-lu2zDhpQ.js} +3 -3
  13. package/dist/es/{Input-C0UdD80I.js → Input-Du4ztfNG.js} +3 -3
  14. package/dist/es/{Loading-QlWiWU_L.js → Loading-Dc9138dn.js} +2 -2
  15. package/dist/es/Map-DwI7JnW8.js +2272 -0
  16. package/dist/es/{MessageBox-B42XuRHh.js → MessageBox-CJMqwEqr.js} +2 -2
  17. package/dist/es/{MoneyInput-BsulLCsJ.js → MoneyInput-CJxSKPIk.js} +5 -5
  18. package/dist/es/{PageHeadPanel-BlFg_TvH.js → PageHeadPanel-BChW8Tal.js} +2 -2
  19. package/dist/es/{Table-Oo-hQWGa.js → Table-CzNjEPnP.js} +5 -5
  20. package/dist/es/{ToolTips-YgMKfoQ0.js → ToolTips-Y6yG2q7L.js} +6 -6
  21. package/dist/es/index.js +22 -22
  22. package/dist/es/{utils-CU-8DWnA.js → utils-Co2iJhr8.js} +1 -1
  23. package/dist/es/{vendor-1zIwhmRg.js → vendor-Crdostgq.js} +8448 -8040
  24. package/dist/index.css +1 -1
  25. package/dist/types/components/CascaderLoadMore/CascaderLoadMore.vue.d.ts +197 -0
  26. package/dist/types/components/CascaderLoadMore/index.d.ts +369 -0
  27. package/dist/types/components/CascaderLoadMore/types.d.ts +7 -0
  28. package/dist/types/components/Map/Map.vue.d.ts +51 -62
  29. package/dist/types/components/Map/components/copyright.vue.d.ts +36 -0
  30. package/dist/types/components/Map/components/measure.vue.d.ts +23 -0
  31. package/dist/types/components/Map/components/scaleLine.vue.d.ts +2 -1
  32. package/dist/types/components/Map/components/toolPanel.vue.d.ts +40 -0
  33. package/dist/types/components/Map/components/zoomControl.vue.d.ts +13 -1
  34. package/dist/types/components/Map/config/global.d.ts +1 -0
  35. package/dist/types/components/Map/config/index.d.ts +0 -41
  36. package/dist/types/components/Map/config/map.d.ts +0 -3
  37. package/dist/types/components/Map/config.d.ts +32 -0
  38. package/dist/types/components/Map/enum/car.d.ts +5 -0
  39. package/dist/types/components/Map/enum/device.d.ts +8 -0
  40. package/dist/types/components/Map/enum/index.d.ts +5 -0
  41. package/dist/types/components/Map/enum/openLayers.d.ts +10 -0
  42. package/dist/types/components/Map/enum/ship.d.ts +50 -0
  43. package/dist/types/components/Map/function/carTrack.d.ts +7 -14
  44. package/dist/types/components/Map/function/drawLine.d.ts +4 -4
  45. package/dist/types/components/Map/function/drawPolygon.d.ts +6 -3
  46. package/dist/types/components/Map/function/event.d.ts +9 -0
  47. package/dist/types/components/Map/function/layers.d.ts +8 -5
  48. package/dist/types/components/Map/function/map.d.ts +14 -10
  49. package/dist/types/components/Map/function/port.d.ts +7 -7
  50. package/dist/types/components/Map/function/position.d.ts +8 -0
  51. package/dist/types/components/Map/function/props.d.ts +5 -2
  52. package/dist/types/components/Map/function/ship/index.d.ts +13 -7
  53. package/dist/types/components/Map/function/ship/style.d.ts +17 -4
  54. package/dist/types/components/Map/function/shipTrack.d.ts +14 -13
  55. package/dist/types/components/Map/index.d.ts +156 -201
  56. package/dist/types/components/Map/interface/common/BaseEntity.d.ts +29 -0
  57. package/dist/types/components/Map/interface/common/page.d.ts +34 -0
  58. package/dist/types/components/Map/interface/entity/dashboard.d.ts +16 -0
  59. package/dist/types/components/Map/interface/entity/map.d.ts +36 -0
  60. package/dist/types/components/Map/interface/entity/point.d.ts +10 -0
  61. package/dist/types/components/Map/interface/entity/queryLicenseResponse.d.ts +86 -0
  62. package/dist/types/components/Map/interface/entity/render.d.ts +57 -0
  63. package/dist/types/components/Map/interface/entity/ship.d.ts +361 -0
  64. package/dist/types/components/Map/interface/entity/shipInfoVo.d.ts +210 -0
  65. package/dist/types/components/Map/interface/entity/shipMapData.d.ts +27 -0
  66. package/dist/types/components/Map/interface/entity/shipMarker.d.ts +8 -0
  67. package/dist/types/components/Map/interface/entity/shipTrack.d.ts +56 -0
  68. package/dist/types/components/Map/interface/entity/vehicle.d.ts +345 -0
  69. package/dist/types/components/Map/interface/index.d.ts +1 -0
  70. package/dist/types/components/Map/interface/mapProps.d.ts +7 -7
  71. package/dist/types/components/Map/interface/position.d.ts +7 -0
  72. package/dist/types/components/Map/interface/shipInfoVo.d.ts +2 -0
  73. package/dist/types/components/Map/interface/vo/vehicleVo.d.ts +20 -0
  74. package/dist/types/components/Map/meta/index.d.ts +5 -5
  75. package/dist/types/components/Map/render/canvasRender/canvasRender.d.ts +15 -0
  76. package/dist/types/components/Map/render/canvasRender/geometry.d.ts +22 -0
  77. package/dist/types/components/Map/render/canvasRender/renderCustomOverlay.d.ts +5 -0
  78. package/dist/types/components/Map/render/canvasRender/renderPointStyle.d.ts +10 -0
  79. package/dist/types/components/Map/render/canvasRender/renderShipStyle.d.ts +5 -0
  80. package/dist/types/components/Map/render/canvasRender/renderTrackStyle.d.ts +12 -0
  81. package/dist/types/components/Map/render/canvasRender/renderTruckStyle.d.ts +3 -0
  82. package/dist/types/components/Map/render/drawPolygon.d.ts +10 -0
  83. package/dist/types/components/Map/render/renderDashboard.d.ts +12 -0
  84. package/dist/types/components/Map/render/renderMarker.d.ts +7 -0
  85. package/dist/types/components/Map/render/renderPoint.d.ts +80 -0
  86. package/dist/types/components/Map/render/renderShip.d.ts +20 -0
  87. package/dist/types/components/Map/render/renderTrack.d.ts +12 -0
  88. package/dist/types/components/Map/render/renderTruck.d.ts +10 -0
  89. package/dist/types/components/Map/useMap.d.ts +17 -0
  90. package/dist/types/components/Map/utils/common.d.ts +27 -0
  91. package/dist/types/components/Map/utils/cursor.d.ts +3 -2
  92. package/dist/types/components/Map/utils/events.d.ts +4 -2
  93. package/dist/types/components/Map/utils/format.d.ts +10 -0
  94. package/dist/types/components/Map/utils/overlay.d.ts +2 -1
  95. package/dist/types/components/Map/{function → utils}/shipOverlay.d.ts +4 -4
  96. package/dist/types/components/Map/utils/store.d.ts +32 -0
  97. package/dist/types/components/Map/utils/track.d.ts +44 -0
  98. package/dist/types/components/Map/utils/transform.d.ts +44 -0
  99. package/dist/umd/index.css +1 -1
  100. package/dist/umd/index.umd.cjs +91 -101
  101. package/package.json +1 -1
  102. package/dist/es/Map-DMb_YG1p.js +0 -1624
  103. package/dist/types/components/Map/function/label.d.ts +0 -9
  104. package/dist/types/components/Map/function/ship.d.ts +0 -34
  105. package/dist/types/components/Map/function/shipLabel.d.ts +0 -25
@@ -0,0 +1,2272 @@
1
+ import { defineComponent as Ue, openBlock as Ie, createElementBlock as et, createElementVNode as _e, ref as ne, computed as Ze, h as ae, createVNode as Qe, render as Zt, reactive as At, onMounted as Gt, onUnmounted as Wt } from "vue";
2
+ import { S as Yt, M as it, T as Pe, X as Fe, p as ie, V as Ht, q as Bt, t as Xt, h as ht, r as tt, s as qt, u as Se, F as oe, v as _, O as pe, P as te, w as Ve, x as vt, L as Ge, y as jt, z as ct, A as le, B as he, C as ue, D as ke, G as Ye, I as Ce, H as Kt, J as _t, K as Qt, N as Jt, Q as yt, R as We, U as Je, W as at, Y as Ut, Z as It, _ as eo } from "./vendor-Crdostgq.js";
3
+ import { _ as ot } from "./Button-Dp3Eoz3O.js";
4
+ import { w as to } from "./utils-Co2iJhr8.js";
5
+ const oo = { id: "scale-line-container" }, no = /* @__PURE__ */ Ue({
6
+ __name: "scaleLine",
7
+ setup(e, { expose: l }) {
8
+ return l({
9
+ setScaleLine: (s, a) => {
10
+ a || (a = "metric");
11
+ const o = new Yt({
12
+ units: a
13
+ }), f = document.getElementById("scale-line-container");
14
+ f && (o.setTarget(f), s.addControl(o));
15
+ }
16
+ }), (s, a) => (Ie(), et("div", oo));
17
+ }
18
+ }), ro = /* @__PURE__ */ ot(no, [["__scopeId", "data-v-2bc5dee8"]]), lo = { class: "zoom" }, so = /* @__PURE__ */ Ue({
19
+ __name: "zoomControl",
20
+ props: {
21
+ mapInstance: {
22
+ type: Object,
23
+ default: () => null
24
+ }
25
+ },
26
+ setup(e) {
27
+ const l = e;
28
+ console.log("props", l);
29
+ const n = () => {
30
+ console.log("props");
31
+ const { setZoom: a, getZoom: o, getInstall: f } = l.mapInstance.methods;
32
+ if (!f()) return;
33
+ const t = o();
34
+ t && a(t + 1);
35
+ }, s = () => {
36
+ const { setZoom: a, getZoom: o, getInstall: f } = l.mapInstance.methods;
37
+ if (!f()) return;
38
+ const t = o();
39
+ t && a(t - 1);
40
+ };
41
+ return (a, o) => (Ie(), et("div", lo, [
42
+ _e("div", {
43
+ class: "button big-button",
44
+ onClick: n
45
+ }, " + "),
46
+ _e("div", {
47
+ class: "button small-button",
48
+ onClick: s
49
+ }, " - ")
50
+ ]));
51
+ }
52
+ }), io = /* @__PURE__ */ ot(so, [["__scopeId", "data-v-78a81741"]]), Ae = "a6e8f78974f2581f2ca00485b40c948f", U = {
53
+ // 地图默认层级
54
+ default: 13,
55
+ // 地图缩放最小层级
56
+ min: 3,
57
+ // 地图缩放最大层级
58
+ max: 18,
59
+ // 船形图标最小渲染层级
60
+ shipModelMin: 13,
61
+ // 船形图标最小渲染层级
62
+ shipTriggleMin: 16,
63
+ // 船形图标最大渲染层级
64
+ shipModelMax: 18,
65
+ //根据原系统canvas图片转换svg长宽比例计算缩放值
66
+ scaleNum: 0.555
67
+ }, I = {
68
+ // 经纬度 源数据 地理坐标 WGS84
69
+ data: "EPSG:4326",
70
+ // 墨卡托投影坐标 渲染坐标
71
+ mercator: "EPSG:3857"
72
+ }, co = [114.84, 30.52], mt = "https://static.zhihaoscm.cn/", He = 2003750834e-2;
73
+ var xe = ((e) => (e.vectorTile = `https://t0.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${Ae}`, e.vectorTileMark = `https://t0.tianditu.gov.cn/cva_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cva&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${Ae}`, e.satelliteImgTile = `https://t0.tianditu.gov.cn/img_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${Ae}`, e.satelliteImgTileMark = `https://t0.tianditu.gov.cn/cia_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cia&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${Ae}`, e.greenTile = `${mt}/map/tile/{z}/{x}/{y}.png`, e))(xe || {}), Ne = /* @__PURE__ */ ((e) => (e[e.M = 1] = "M", e[e.KM = 2] = "KM", e[e.NM = 3] = "NM", e))(Ne || {}), ee = /* @__PURE__ */ ((e) => (e.PORT = "port", e.SHIP = "ship", e.TRACK = "track", e))(ee || {});
74
+ function ao() {
75
+ const e = ne(), l = () => e.value, n = () => l().getView(), s = () => {
76
+ var g;
77
+ return (g = n()) == null ? void 0 : g.getZoom();
78
+ }, a = (g) => {
79
+ var k;
80
+ (k = n()) == null || k.setZoom(g);
81
+ }, o = (g, k) => {
82
+ var $;
83
+ ($ = n()) == null || $.setCenter(ie([g, k]));
84
+ }, f = () => {
85
+ var k;
86
+ const g = (k = n()) == null ? void 0 : k.getCenter();
87
+ return Xt(g);
88
+ }, x = () => {
89
+ var g;
90
+ return (g = l()) == null ? void 0 : g.getSize();
91
+ }, t = new it(), r = (g, k) => {
92
+ y(k);
93
+ const $ = {
94
+ zoom: k.zoom,
95
+ center: ie(k.center),
96
+ minZoom: U.min,
97
+ maxZoom: U.max,
98
+ constrainResolution: !0,
99
+ enableRotation: !1,
100
+ multiWorld: !0
101
+ };
102
+ let C = {
103
+ target: g,
104
+ controls: Bt({
105
+ zoom: !1
106
+ }),
107
+ layers: [
108
+ t.get("vectorTile"),
109
+ t.get("vectorTileMark"),
110
+ t.get("satelliteImgTile"),
111
+ t.get("satelliteImgTileMark")
112
+ ],
113
+ view: new Ht($)
114
+ };
115
+ const z = new it(C);
116
+ e.value = z;
117
+ }, y = (g) => {
118
+ t.set("vectorTile", new Pe({
119
+ source: new Fe({ url: xe.vectorTile }),
120
+ visible: g.layerType === "vector",
121
+ zIndex: 0,
122
+ preload: 1,
123
+ className: "vector"
124
+ })), t.set("vectorTileMark", new Pe({
125
+ source: new Fe({ url: xe.vectorTileMark }),
126
+ visible: g.layerType === "vector",
127
+ zIndex: 1,
128
+ preload: 1,
129
+ className: "vector"
130
+ })), t.set("satelliteImgTile", new Pe({
131
+ source: new Fe({ url: xe.satelliteImgTile }),
132
+ visible: g.layerType === "satellite",
133
+ zIndex: 0,
134
+ preload: 1,
135
+ className: "satellite"
136
+ })), t.set("satelliteImgTileMark", new Pe({
137
+ source: new Fe({ url: xe.satelliteImgTileMark }),
138
+ visible: g.layerType === "satellite",
139
+ zIndex: 1,
140
+ preload: 1,
141
+ className: "satellite"
142
+ })), t.set("greenMark", new Pe({
143
+ source: new Fe({ url: xe.greenTile }),
144
+ visible: g.showGreenLayer,
145
+ zIndex: 2,
146
+ className: "greenTile"
147
+ }));
148
+ };
149
+ return {
150
+ getInstall: l,
151
+ getView: n,
152
+ getZoom: s,
153
+ setZoom: a,
154
+ setCenter: o,
155
+ getCenter: f,
156
+ getSize: x,
157
+ initMap: r,
158
+ setBaseLayerMap: y
159
+ };
160
+ }
161
+ const nt = function(e, l) {
162
+ const n = Number(l) / 6e5;
163
+ return [Number(e) / 6e5, n];
164
+ }, uo = (e, l) => {
165
+ const n = ie(e), s = l * 1e3, a = [
166
+ n[0] - s,
167
+ n[1] - s,
168
+ n[0] + s,
169
+ n[1] + s
170
+ ], o = qt(a, I.mercator, I.data);
171
+ return {
172
+ leftTopPoint: { lng: o[0], lat: o[3] },
173
+ rightTopPoint: { lng: o[2], lat: o[3] },
174
+ rightBottomPoint: { lng: o[2], lat: o[1] },
175
+ leftBottomPoint: { lng: o[0], lat: o[1] }
176
+ };
177
+ }, go = function(e, l) {
178
+ const s = tt(e);
179
+ let a = "";
180
+ switch (console.log(l, Ne), l) {
181
+ case Ne.M:
182
+ a = Math.round(s * 100) / 100 + " m";
183
+ break;
184
+ case Ne.KM:
185
+ a = Math.round(s / 1e3 * 100) / 100 + " km";
186
+ break;
187
+ case Ne.NM:
188
+ a = (Math.round(s / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
189
+ break;
190
+ }
191
+ return a;
192
+ };
193
+ function fo(e) {
194
+ const l = e[0] * He / 180;
195
+ let n = Math.log(Math.tan((90 + e[1]) * Math.PI / 360)) / (Math.PI / 180);
196
+ return n = n * He / 180, [l, n];
197
+ }
198
+ function be(e = "") {
199
+ let l = e.replace(/&?/g, "&");
200
+ return l = l.replace(/&#x([0-9a-fA-F]+);?/g, (n, s) => {
201
+ const a = parseInt(s, 16);
202
+ return String.fromCodePoint(a);
203
+ }), l;
204
+ }
205
+ const dt = (e) => {
206
+ const l = new Se({
207
+ font: "Normal 14px map-iconfont",
208
+ text: be(e),
209
+ fill: new oe({ color: "#fff" }),
210
+ offsetY: -14
211
+ });
212
+ return new _({
213
+ text: l,
214
+ zIndex: 100
215
+ });
216
+ }, ut = (e, l = "lonlat") => {
217
+ const n = { lon: 0, lat: 0 }, s = e[0] / He * 180;
218
+ let a = e[1] / He * 180;
219
+ return a = 180 / Math.PI * (2 * Math.atan(Math.exp(a * Math.PI / 180)) - Math.PI / 2), n.lon = s, n.lat = a, l === "lonlat" ? n : [s, a];
220
+ }, ho = (e) => {
221
+ const l = ht.duration(e, "minutes"), n = Math.floor(l.asDays()), s = l.hours(), a = l.minutes();
222
+ let o = `${String(a).padStart(2, "0")}分`;
223
+ return s !== 0 && (o = `${String(s).padStart(2, "0")}时${o}`), n !== 0 && (o = `${String(n).padStart(2, "0")}天${o}`), o;
224
+ }, vo = (e, l) => {
225
+ let n = null;
226
+ const s = async (y) => {
227
+ if (!e || (console.log("vehicleInfo", y), !(y != null && y.lon && (y != null && y.lat)))) return;
228
+ const g = Math.abs(Number(y.lon)) > 180 ? nt(y.lon, y.lat) : [y.lon, y.lat];
229
+ a(y, ie(g));
230
+ const k = e == null ? void 0 : e.getView(), $ = new te(g);
231
+ k.setCenter(Ve($.getCoordinates(), I.data, I.mercator));
232
+ }, a = (y, g) => {
233
+ const k = `${mt}map/car-icon.gif`;
234
+ n || (n = new pe({
235
+ element: document.createElement("div"),
236
+ positioning: "center-center",
237
+ stopEvent: !1
238
+ // 允许交互事件穿透
239
+ }), e.addOverlay(n));
240
+ const $ = n.getElement();
241
+ $.style.backgroundImage = `url(${k})`, $.style.width = "80px", $.style.height = "80px";
242
+ const C = (y == null ? void 0 : y.drc) || "";
243
+ $.style.transform = `rotate(${C}deg)`, $.style.backgroundSize = "cover", n == null || n.setPosition(g);
244
+ };
245
+ return {
246
+ location: s,
247
+ remove: () => {
248
+ const y = n == null ? void 0 : n.getElement();
249
+ y && (y.innerHTML = "");
250
+ },
251
+ renderTrack: (y, g, k) => {
252
+ l.render(y, g, k, "truck", 1e3);
253
+ },
254
+ setCenter: (y) => {
255
+ l.setCenter(y);
256
+ },
257
+ closeTrack: () => {
258
+ l.close();
259
+ },
260
+ playTrack: (y, g) => {
261
+ l.play(y, g);
262
+ }
263
+ };
264
+ };
265
+ var wt = /* @__PURE__ */ ((e) => (e[e.发动机使用中 = 0] = "发动机使用中", e[e.锚泊 = 1] = "锚泊", e[e.未操作 = 2] = "未操作", e[e.操纵能力受限 = 3] = "操纵能力受限", e[e.吃水受限 = 4] = "吃水受限", e[e.系泊 = 5] = "系泊", e[e.搁浅 = 6] = "搁浅", e[e.从事捕捞 = 7] = "从事捕捞", e[e.航行中 = 8] = "航行中", e[e.留作将来修正导航状态 = 9] = "留作将来修正导航状态", e[e.高速船留用 = 10] = "高速船留用", e[e.机动船尾推作业 = 11] = "机动船尾推作业", e[e.机动船顶推或侧推作业 = 12] = "机动船顶推或侧推作业", e[e.飞翼船留用 = 13] = "飞翼船留用", e[e.现行的 = 14] = "现行的", e[e.未定义 = 15] = "未定义", e))(wt || {}), se = /* @__PURE__ */ ((e) => (e.left = "left", e.right = "right", e.front = "front", e.up = "up", e.down = "down", e.back = "back", e))(se || {});
266
+ const yo = (e) => {
267
+ const l = /* @__PURE__ */ new Map(), n = {};
268
+ let s = null;
269
+ const a = "--";
270
+ let o = null;
271
+ const f = document.createElement("div"), x = new pe({
272
+ element: f,
273
+ positioning: "top-left",
274
+ className: "track-label-popup"
275
+ });
276
+ let t, r, y, g, k, $ = !1, C = Date.now(), z, d = 0, m = null, P = 20;
277
+ const b = 8, V = [], X = (c) => {
278
+ var u;
279
+ for (V.unshift(c); V.length > b; ) {
280
+ const h = V.pop(), p = l.get(h);
281
+ p && ((u = p.getSource()) == null || u.clear(), e == null || e.removeLayer(p), l.delete(h), delete n[h]);
282
+ }
283
+ };
284
+ let G = "";
285
+ const q = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080", "#ffc0cb", "#800000", "#000080", "#808000"], K = vt(async () => {
286
+ if (s && n[s] && l.get(s).getVisible()) {
287
+ console.log("reRenderTrackLine------------"), await Lt(s);
288
+ const c = M(s, n[s]);
289
+ ce(s, c);
290
+ }
291
+ }, 100), N = () => s && n[s] && l.get(s).getVisible(), M = (c, u) => {
292
+ let h = [];
293
+ const p = Math.max(1, Math.floor(u.length / P));
294
+ return h = u.filter((R, S) => S % p === 0).map((R, S) => {
295
+ if (Number(R.lon) > 180 || Number(R.lat) > 180) {
296
+ const [A, Y] = nt(R.lon, R.lat);
297
+ R.lon = A, R.lat = Y;
298
+ }
299
+ return R.center = [R.lon, R.lat], R.centerPoint = fo(R.center), R.time = ht(R.createdAt).format("YYYY-MM-DD HH:mm:ss"), R.id = c, R.index = S, R;
300
+ }), h.filter(
301
+ (R, S, A) => S === A.findIndex(
302
+ (Y) => Math.abs(Y.lon - R.lon) < 1e-6 && Math.abs(Y.lat - R.lat) < 1e-6
303
+ )
304
+ );
305
+ }, i = async (c, u, h, p = "ship", v = 200) => {
306
+ if (!e || JSON.stringify(n[c]) === JSON.stringify(u) && s === c || (u = u == null ? void 0 : u.reverse(), x && p === "ship" && (e != null && e.getOverlays().getArray().includes(x) || e.addOverlay(x)), (u == null ? void 0 : u.length) < 2))
307
+ return;
308
+ X(c), s = c, n[c] = u, P = v;
309
+ const D = Object.keys(n).findIndex((R) => R === c) || 0;
310
+ G = h || q[D > 10 ? 10 : D], await L(), await rt(s);
311
+ }, T = (c) => {
312
+ const u = new ue();
313
+ return new he({
314
+ source: u,
315
+ visible: !1,
316
+ // 默认隐藏
317
+ className: `track-layer-${c}`,
318
+ renderBuffer: 1024,
319
+ properties: { layerType: ee.TRACK },
320
+ zIndex: 10
321
+ });
322
+ }, w = (c) => {
323
+ l.forEach((u, h) => {
324
+ var v;
325
+ const p = h === c;
326
+ u.getVisible() !== p && (u.setVisible(p), e.getLayers().getArray().includes(u) || e.addLayer(u), p || (v = u.getSource()) == null || v.clear());
327
+ }), s = c;
328
+ }, L = async () => {
329
+ const c = s;
330
+ if (!l.has(c)) {
331
+ const D = T(c);
332
+ l.set(c, D);
333
+ }
334
+ await w(c);
335
+ const u = G || "", h = n[c] || [];
336
+ if (!(h && h.length > 1)) return [];
337
+ let p = [];
338
+ p = M(c, h);
339
+ const v = p.map((D) => D.centerPoint);
340
+ p.length >= 2 && await F(c, v, u);
341
+ }, F = (c, u, h) => {
342
+ const p = new Ge(u), v = l.get(c).getSource(), D = v.getFeatureById(c);
343
+ if (D)
344
+ D.setGeometry(p), D.setId(c), D.setStyle(Z(h)), m = D;
345
+ else {
346
+ const R = new le({ geometry: p });
347
+ R.setId(c), R.set("type", "line"), R.setStyle(Z(h)), v.addFeature(R), m = R;
348
+ }
349
+ return m;
350
+ }, Z = (c) => new _({
351
+ stroke: new ke({
352
+ color: c,
353
+ width: 2
354
+ })
355
+ }), W = (c, u, h) => {
356
+ try {
357
+ const p = c == null ? void 0 : c.get("data");
358
+ if (c && p && u === "hover") {
359
+ e.getTargetElement().style.cursor = p ? "pointer" : "";
360
+ const v = H(p), D = h == null ? void 0 : h.coordinate;
361
+ D && (f.querySelector(".popup-content"), f.innerHTML = v, x == null || x.setPosition(D));
362
+ } else
363
+ x && x.setPosition(void 0);
364
+ } catch (p) {
365
+ console.error("handleTrackMapEvent", p);
366
+ }
367
+ }, H = (c) => {
368
+ if (!(c != null && c.time)) return;
369
+ let u = "";
370
+ return c != null && c.stayTime && (u = `
371
+ <div class="item w-100">
372
+ <div class="item-label">停泊时间约</div>
373
+ <div class="item-item">${ho(Number(c.stayTime))}</div>
374
+ </div>
375
+ `), `
376
+ <div class="track-point-popup">
377
+ <div class="item">
378
+ <div class="item-label">状态</div>
379
+ <div class="item-item">${c != null && c.sailStatus ? wt[c.sailStatus] : a}</div>
380
+ </div>
381
+ <div class="item">
382
+ <div class="item-label">航速</div>
383
+ <div class="item-item">${c.speed || a}</div>
384
+ </div>
385
+ <div class="item">
386
+ <div class="item-label">艏向</div>
387
+ <div class="item-item">${c.hdg || a}</div>
388
+ </div>
389
+ <div class="item">
390
+ <div class="item-label">航向</div>
391
+ <div class="item-item">${c.cog || a}</div>
392
+ </div>
393
+ <div class="item">
394
+ <div class="item-label">经度</div>
395
+ <div class="item-item">${c.lon || a}</div>
396
+ </div>
397
+ <div class="item">
398
+ <div class="item-label">纬度</div>
399
+ <div class="item-item">${c.lat || a}</div>
400
+ </div>
401
+ <div class="item w-100">
402
+ <div class="item-label">时间</div>
403
+ <div class="item-item">${c.time}</div>
404
+ </div>
405
+ ${u ?? u}
406
+ </div>`;
407
+ }, O = (c) => {
408
+ const h = c.map((S) => {
409
+ const A = e.getPixelFromCoordinate(ie(S.center));
410
+ return {
411
+ ...S,
412
+ original: S,
413
+ pixel: A,
414
+ distance: 0
415
+ // 先初始化,后续计算
416
+ };
417
+ });
418
+ let p = 0;
419
+ h[0].distance = 0;
420
+ for (let S = 1; S < h.length; S++) {
421
+ const A = h[S - 1].pixel, Y = h[S].pixel, J = Y[0] - A[0], E = Y[1] - A[1];
422
+ p += Math.sqrt(J * J + E * E), h[S].distance = p;
423
+ }
424
+ const v = h.filter(
425
+ (S, A) => A === 0 || A === h.length - 1
426
+ ), D = [];
427
+ for (let S = 0; S < v.length; S++) {
428
+ const A = v[S];
429
+ if (D.push(A), S < v.length - 1) {
430
+ const Y = v[S + 1], J = Y.distance - A.distance, E = Math.floor(J / 100);
431
+ for (let B = 1; B <= E; B++) {
432
+ const j = A.distance + B * 100;
433
+ if (j >= Y.distance) break;
434
+ const Q = re(
435
+ h,
436
+ j
437
+ );
438
+ Q && D.push(Q);
439
+ }
440
+ }
441
+ }
442
+ return Array.from(
443
+ new Map(D.map((S) => [S.distance.toFixed(2), S])).values()
444
+ ).map((S) => ({
445
+ ...S.original,
446
+ // 优先保留原始数据
447
+ ...S,
448
+ // 覆盖坐标等计算属性
449
+ coord: S.coord,
450
+ // 确保使用插值后的坐标
451
+ pixel: S.pixel,
452
+ distance: S.distance
453
+ }));
454
+ };
455
+ function re(c, u) {
456
+ for (let h = 1; h < c.length; h++) {
457
+ const p = c[h - 1], v = c[h];
458
+ if (u >= p.distance && u <= v.distance) {
459
+ const D = (u - p.distance) / (v.distance - p.distance), R = p.pixel[0] + D * (v.pixel[0] - p.pixel[0]), S = p.pixel[1] + D * (v.pixel[1] - p.pixel[1]), A = e == null ? void 0 : e.getCoordinateFromPixel([R, S]);
460
+ return {
461
+ ...p,
462
+ // 继承前一个点的属性(可调整)
463
+ coord: A,
464
+ pixel: [R, S],
465
+ distance: u,
466
+ original: void 0
467
+ // 明确标记为插值生成点
468
+ };
469
+ }
470
+ }
471
+ return null;
472
+ }
473
+ const ce = async (c, u) => {
474
+ const h = O(u);
475
+ console.log("simplifiedPoints", h.length, "list", u.length);
476
+ const p = h.map((S) => de(S)), v = h.map((S) => Mt(S, G)), D = Pt(c, h, u, G);
477
+ l.get(c).getSource().addFeatures([...p, ...v, ...D]);
478
+ }, de = (c) => {
479
+ const u = new le({
480
+ geometry: new te(c.centerPoint),
481
+ data: c
482
+ });
483
+ u.set("type", "track_point"), u.set("trackId", c.id), u.set("data", c);
484
+ let h = [
485
+ ...Tt(c, G)
486
+ ];
487
+ return (c.index === 0 || c.index === n[c.id].length - 1) && (h = [...Ft(c)], u.set("type", "track_begin")), c.state !== void 0 && c.state !== null && (h = [...Et(c)], u.set("type", "track_icon")), u.setStyle(h), u;
488
+ }, Be = window.devicePixelRatio || 1, Me = /* @__PURE__ */ new Map();
489
+ let ge = null, Xe = null;
490
+ function Ct(c, u) {
491
+ const h = `${c}`;
492
+ if (Me.has(h))
493
+ return Me.get(h);
494
+ if (!ge) {
495
+ ge = document.createElement("canvas");
496
+ try {
497
+ Xe = ge.getContext("2d", {
498
+ willReadFrequently: !0
499
+ });
500
+ } catch (st) {
501
+ console.log("e", st), Xe = ge.getContext("2d");
502
+ }
503
+ }
504
+ const p = ge, v = Xe;
505
+ if (!v) return "";
506
+ p.width = 0, p.height = 0;
507
+ const D = 2, R = 8, S = 16, A = window.devicePixelRatio || 1, Y = "500 12px Arial";
508
+ v.font = Y;
509
+ const E = v.measureText(c).width, B = R + E + R, j = D + 14 + D;
510
+ let Q = 0, fe = 0, ye = 0, me = 0, Re = 0, Le = 0, we = 0, Te = 0;
511
+ Q = S + B, fe = S + j, ye = B, me = j, Re = B + S, Le = 0, we = 0, Te = S, p.width = Math.round(Q * A), p.height = Math.round(fe * A), v.scale(A, A), v.clearRect(0, 0, Q, fe), v.beginPath(), v.moveTo(ye, me), v.lineTo(Re, Le), v.strokeStyle = u || "#FFF", v.lineWidth = 1, v.stroke(), v.fillStyle = "#FFF", v.fillRect(we, Te, B, j), v.strokeStyle = u || "#FFF", v.lineWidth = 1, v.strokeRect(we, Te, B, j), v.font = Y, v.textBaseline = "middle";
512
+ const Oe = Te + D / 2 + j / 2;
513
+ v.strokeStyle = "#ffffff", v.lineWidth = 1, v.strokeText(c, we + R, Oe), v.fillStyle = "#000000", v.fillText(c, we + R, Oe);
514
+ const De = p.toDataURL("image/png");
515
+ return Me.set(h, De), De;
516
+ }
517
+ const Mt = (c, u) => {
518
+ const h = Ct(c.time, u), p = new le({
519
+ geometry: new te(c.centerPoint),
520
+ data: c
521
+ });
522
+ p.set("type", "track_point_label");
523
+ const v = new _({
524
+ image: new Ce({
525
+ src: h,
526
+ anchor: [1, 0],
527
+ displacement: [0, 0],
528
+ scale: 1 / Be,
529
+ anchorXUnits: "fraction",
530
+ anchorYUnits: "fraction"
531
+ }),
532
+ zIndex: 100
533
+ });
534
+ return p.setStyle(v), p;
535
+ }, Lt = (c) => {
536
+ const u = l.get(c).getSource();
537
+ u.forEachFeature((h) => {
538
+ h.get("type") !== "line" && u.removeFeature(h);
539
+ });
540
+ }, Tt = (c, u) => [
541
+ new _({
542
+ // 扩大交互热区
543
+ image: new Ye({
544
+ stroke: new ke({ color: "rgba(0, 0, 0, 0.01)", width: 20 }),
545
+ radius: 3
546
+ })
547
+ }),
548
+ // 轨迹点样式
549
+ new _({
550
+ image: new Ye({
551
+ fill: new oe({ color: u }),
552
+ stroke: new ke({ color: "#fff", width: 2 }),
553
+ radius: 3
554
+ })
555
+ })
556
+ // textStyle,
557
+ ], Et = (c) => {
558
+ const u = "#E31818", h = "#1890FF", p = "&#xe6d2", v = new _({
559
+ text: new Se({
560
+ font: "Normal 22px map-iconfont",
561
+ text: be(p),
562
+ offsetY: -10,
563
+ fill: new oe({
564
+ color: Number(c.state) === 0 ? u : Number(c.state) === 1 ? h : ""
565
+ })
566
+ }),
567
+ zIndex: 99
568
+ }), R = dt("&#xe6e2;"), A = dt("&#xe703;"), Y = [];
569
+ return Number(c.state) === 0 ? Y.push(R) : Number(c.state) === 1 && Y.push(A), Y.push(v), Y;
570
+ }, Pt = (c, u, h, p) => {
571
+ const v = u || [], D = u.length;
572
+ D || (v.push(h[0]), v.push(h[h.length - 1]));
573
+ const R = new Set(u.map((A) => `${A.centerPoint[0]},${A.centerPoint[1]}`)), S = [];
574
+ for (let A = 0; A < D - 1; A++) {
575
+ let Y;
576
+ const J = u[A], E = (u[A + 1].index + J.index) / 2;
577
+ if (E % 2 === 0)
578
+ Y = h[E].centerPoint;
579
+ else {
580
+ const B = h[Math.floor(E)], j = h[Math.ceil(E)];
581
+ if (B && j) {
582
+ const [Q, fe] = B.centerPoint, [ye, me] = j.centerPoint;
583
+ Y = [(Q + ye) / 2, (fe + me) / 2];
584
+ }
585
+ }
586
+ if (Y) {
587
+ const B = `${Y[0]},${Y[1]}`;
588
+ if (!R.has(B)) {
589
+ const j = new le({
590
+ geometry: new te(Y)
591
+ });
592
+ j.set("type", "track_arrow"), j.setStyle(
593
+ new _({
594
+ text: new Se({
595
+ font: "700 12px map-iconfont",
596
+ text: be("&#xe6bc;"),
597
+ fill: new oe({ color: p }),
598
+ rotation: lt(
599
+ u[A].center,
600
+ u[A + 1].center
601
+ ) * (Math.PI / 180)
602
+ })
603
+ })
604
+ ), S.push(j), R.add(B);
605
+ }
606
+ }
607
+ }
608
+ return S;
609
+ }, rt = (c) => {
610
+ var D, R;
611
+ const u = e.getView(), h = (D = l == null ? void 0 : l.get(c)) == null ? void 0 : D.getSource(), p = m || (c ? h == null ? void 0 : h.getFeatureById(c) : null);
612
+ if (!p) return;
613
+ const v = (R = p == null ? void 0 : p.getGeometry()) == null ? void 0 : R.getExtent();
614
+ if (!v || v[0] === v[2] || v[1] === v[3]) {
615
+ console.warn("Invalid track extent");
616
+ return;
617
+ }
618
+ try {
619
+ const S = v[2] - v[0], A = v[3] - v[1], Y = 1e-4;
620
+ if (S < Y || A < Y) {
621
+ const E = [(v[0] + v[2]) / 2, (v[1] + v[3]) / 2];
622
+ u.setCenter(E);
623
+ return;
624
+ }
625
+ const J = jt(v, Math.max(S, A) * 0.1);
626
+ u.fit(J, {
627
+ maxZoom: U.max,
628
+ padding: [30, 30, 30, 30]
629
+ // 添加边距
630
+ });
631
+ } catch (S) {
632
+ console.error("setTrackViewCenter error:", S);
633
+ }
634
+ }, Ft = (c) => {
635
+ const u = "&#xe69b;", v = c.index === 0 ? "#fcdc3f" : "#ff0000";
636
+ return [new _({
637
+ text: new Se({
638
+ font: "Normal 14px map-iconfont",
639
+ text: be(u),
640
+ fill: new oe({ color: v })
641
+ }),
642
+ zIndex: 101
643
+ })];
644
+ }, St = () => {
645
+ console.log("清除所有的轨迹-----"), ze(), l.forEach((u) => {
646
+ var h;
647
+ (h = u.getSource()) == null || h.clear(), e == null || e.removeLayer(u);
648
+ }), Object.keys(n).forEach((u) => {
649
+ l.delete(u), delete n[u];
650
+ });
651
+ }, Nt = (c) => {
652
+ const u = l.get(c || s);
653
+ u == null || u.setVisible(!1);
654
+ const h = e.getOverlays().getArray();
655
+ for (let p = 0; p < h.length; ) {
656
+ const v = h[p];
657
+ v.get("class") === "track-label-overlay" ? (v.setPosition(void 0), v.dispose()) : p++;
658
+ }
659
+ ze();
660
+ }, Rt = (c, u = Ne.NM) => {
661
+ const h = {
662
+ id: c,
663
+ length: "--"
664
+ }, v = (n[c] || []).map(
665
+ (R) => Ve([R.lon, R.lat], I.data, I.mercator)
666
+ ), D = new Ge(v);
667
+ return h.length = go(D, u) || "--", h;
668
+ }, $t = (c, u) => {
669
+ Vt(String(c), u);
670
+ }, Vt = (c, u) => {
671
+ const h = n[String(c)], p = h == null ? void 0 : h.map((v) => [v.lon, v.lat]);
672
+ p && Dt(p, u);
673
+ }, qe = new _({
674
+ text: new Se({
675
+ font: "700 20px map-iconfont",
676
+ text: be("&#xe657;"),
677
+ fill: new oe({ color: "#ff0000" }),
678
+ rotation: 0
679
+ // 初始旋转角度
680
+ })
681
+ }), zt = (c, u) => {
682
+ var E, B;
683
+ const h = Number(50 * u), p = ((E = c.frameState) == null ? void 0 : E.time) ?? Date.now(), v = p - C;
684
+ if (d = (d + h * v / 1e6) % 2, C = p, d >= 1) {
685
+ ze();
686
+ return;
687
+ }
688
+ const D = r.getCoordinateAt(
689
+ d > 1 ? 2 - d : d
690
+ ), R = r.getCoordinateAt(
691
+ d > 1 ? d - 0.01 : d
692
+ ), S = r.getCoordinateAt(
693
+ d > 1 ? 2 - d : d + 0.01
694
+ ), Y = lt(
695
+ ut(R, "array"),
696
+ ut(S, "array")
697
+ ) * Math.PI / 180;
698
+ (B = qe.getText()) == null || B.setRotation(Y), g.setCoordinates(D);
699
+ const J = Kt(c);
700
+ J.setStyle(qe), J.drawGeometry(g), e == null || e.render();
701
+ }, Ot = () => {
702
+ var c;
703
+ $ = !0, C = Date.now(), d = 0, g = ((c = y.getGeometry()) == null ? void 0 : c.clone()) || new te([0, 0]), o && (z == null || z.on("postrender", o)), k == null || k.setGeometry(void 0);
704
+ }, ze = () => {
705
+ $ && ($ = !1, k == null || k.setGeometry(void 0), o && z && z.un("postrender", o), z && (e == null || e.removeLayer(z)), z = null, k = null);
706
+ }, Dt = (c, u) => {
707
+ $ && ze(), t = new ct({
708
+ factor: 1e6
709
+ }).writeGeometry(new Ge(c)), r = new ct({
710
+ factor: 1e6
711
+ }).readGeometry(t, {
712
+ dataProjection: I.data,
713
+ featureProjection: I.mercator
714
+ }), y = new le({
715
+ type: "icon",
716
+ geometry: new te(r.getFirstCoordinate())
717
+ });
718
+ const h = y.getGeometry();
719
+ g = h ? h.clone() : new te([0, 0]), k = new le({
720
+ type: "geoMarker",
721
+ style: qe,
722
+ geometry: g
723
+ }), z = new he({
724
+ source: new ue({
725
+ features: [k]
726
+ })
727
+ }), e == null || e.addLayer(z), o = (p) => zt(p, u), Ot();
728
+ }, lt = (c, u, h) => {
729
+ function p(E) {
730
+ return 180 * (E % (2 * Math.PI)) / Math.PI;
731
+ }
732
+ function v(E) {
733
+ return E % 360 * Math.PI / 180;
734
+ }
735
+ function D(E) {
736
+ var B;
737
+ if (!E) throw new Error("Coordinate is required");
738
+ if (!Array.isArray(E)) {
739
+ if ((E == null ? void 0 : E.type) === "Feature" && (E == null ? void 0 : E.geometry) !== null && ((B = E == null ? void 0 : E.geometry) == null ? void 0 : B.type) === "Point")
740
+ return E == null ? void 0 : E.geometry.coordinates;
741
+ if (E.type === "Point") return (E == null ? void 0 : E.coordinates) || [];
742
+ }
743
+ if (Array.isArray(E) && E.length >= 2 && !Array.isArray(E[0]) && !Array.isArray(E[1]))
744
+ return E;
745
+ throw new Error(
746
+ "Coordinate must be GeoJSON Point or an Array of numbers"
747
+ );
748
+ }
749
+ function R(E, B, j = {}) {
750
+ if (j.final)
751
+ return function(Oe, De) {
752
+ return (R(De, Oe) + 180) % 360;
753
+ }(E, B);
754
+ const Q = D(E), fe = D(B), ye = v(Q[0]), me = v(fe[0]), Re = v(Q[1]), Le = v(fe[1]), we = Math.sin(me - ye) * Math.cos(Le), Te = Math.cos(Re) * Math.sin(Le) - Math.sin(Re) * Math.cos(Le) * Math.cos(me - ye);
755
+ return p(Math.atan2(we, Te));
756
+ }
757
+ function S(E) {
758
+ return !isNaN(E) && E !== null && !Array.isArray(E);
759
+ }
760
+ function A(E, B = {}, j = {}) {
761
+ return E || console.log("Coordinates are required"), Array.isArray(E) || console.log("Coordinates must be an Array"), E.length < 2 && console.log("Coordinates must be at least 2 numbers long"), (!S(E[0]) || !S(E[1])) && console.log("Coordinates must contain numbers"), Y({ type: "Point", coordinates: E }, B, j);
762
+ }
763
+ function Y(E, B = {}, j = {}) {
764
+ const Q = {
765
+ type: "Feature",
766
+ id: "",
767
+ properties: {},
768
+ bbox: {},
769
+ geometry: {}
770
+ };
771
+ return j.id !== void 0 && (Q.id = j.id), j.bbox && (Q.bbox = j.bbox), Q.properties = B, Q.geometry = E, Q;
772
+ }
773
+ const J = R(A(c), A(u), h);
774
+ return J < 0 ? 360 + J : J;
775
+ };
776
+ return {
777
+ render: i,
778
+ remove: St,
779
+ play: $t,
780
+ setCenter: rt,
781
+ close: Nt,
782
+ getLength: Rt,
783
+ handleTrackMapEvent: W,
784
+ reRenderTrackLine: K,
785
+ getTrackStatus: N
786
+ };
787
+ };
788
+ function mo(e) {
789
+ console.log("useShipOverlay", e);
790
+ const l = ne(null), n = Ze(() => ({
791
+ "--overlay-color": "#FFF",
792
+ "--bg-color1": e.colors && e.colors[0] ? e.colors[0] : "#ffffff",
793
+ // 默认第一个颜色
794
+ "--bg-color2": e.colors && e.colors[1] ? e.colors[1] : "#ffffff",
795
+ "--bg-color": "#ffffff",
796
+ position: "relative",
797
+ "pointer-events": "none"
798
+ })), s = Ze(() => {
799
+ var f;
800
+ return {
801
+ position: "relative",
802
+ "border-radius": "1px",
803
+ "background-color": "var(--content-bg)",
804
+ color: "#000",
805
+ padding: "2px 5px 2px 0px",
806
+ font: "500 Normal 12px",
807
+ "font-size": "12px",
808
+ "box-shadow": "0 2px 10px rgba(0, 0, 0, 0.2)",
809
+ "white-space": "nowrap",
810
+ border: "1px solid #FFF",
811
+ "pointer-events": "auto",
812
+ // 'transition': 'background-color 0.5s ease, border 0.5s ease',
813
+ "z-index": "1",
814
+ display: "flex",
815
+ "align-items": "center",
816
+ animation: e.selected ? e.colors && ((f = e.colors) == null ? void 0 : f.length) >= 2 ? "blink-dual 2s ease-in-out infinite" : "blink-single 1.5s ease-in-out infinite" : "none"
817
+ // "animation": props.selected ? 'blink 1.5s ease-in-out infinite' : 'none', // 动画开关
818
+ };
819
+ }), a = Ze(() => ({
820
+ width: "14px",
821
+ height: "14px",
822
+ margin: "1px 5px 1px 1px",
823
+ "background-color": "var(--attention-bg)"
824
+ })), o = Ze(() => ({
825
+ position: "absolute",
826
+ top: "0px",
827
+ color: "var(--overlay-color)",
828
+ "pointer-events": "none",
829
+ transform: "translateY(-1px)",
830
+ "z-index": "0",
831
+ width: "20px",
832
+ height: "20px",
833
+ overflow: "visible",
834
+ left: "-20px"
835
+ }));
836
+ return () => ae("div", {
837
+ ref: l,
838
+ class: "ship-overlay-container",
839
+ style: n.value
840
+ }, [
841
+ ae(
842
+ "div",
843
+ {
844
+ class: "ship-overlay-content",
845
+ style: s.value
846
+ },
847
+ [
848
+ ae("div", {
849
+ style: e.selected ? a.value : {}
850
+ }, ""),
851
+ ae("div", {
852
+ class: "text",
853
+ style: {
854
+ fontSize: "12px",
855
+ fontWeight: 500,
856
+ fontFamily: "Arial"
857
+ }
858
+ }, e.name || "未命名船舶"),
859
+ ae("div", {
860
+ class: "icons",
861
+ style: {
862
+ color: "#3370ff"
863
+ }
864
+ }, [
865
+ e.existDevice ? ae("i", {
866
+ class: "map-iconfont icon-camera",
867
+ style: {
868
+ fontSize: "12px"
869
+ }
870
+ }) : "",
871
+ e.existMobile ? ae("i", {
872
+ class: "map-iconfont icon-tele",
873
+ style: {
874
+ fontSize: "12px"
875
+ }
876
+ }) : "",
877
+ e.existWaterGauge ? ae("i", {
878
+ class: "map-iconfont icon-ruler",
879
+ style: {
880
+ fontSize: "12px"
881
+ }
882
+ }) : ""
883
+ ])
884
+ ]
885
+ ),
886
+ ae("svg", {
887
+ class: "ship-overlay-line",
888
+ style: o.value,
889
+ viewBox: "0 0 20 20",
890
+ xmlns: "http://www.w3.org/2000/svg"
891
+ }, [
892
+ ae("line", {
893
+ x1: "0",
894
+ y1: "20",
895
+ x2: "20",
896
+ y2: "4",
897
+ stroke: "white",
898
+ "stroke-width": "1"
899
+ })
900
+ ])
901
+ ]);
902
+ }
903
+ const wo = (e) => {
904
+ const { spd: l, hdg: n, cog: s } = e;
905
+ return l ? n !== null && +n != 511 && s !== null ? s - +n >= 3 ? se.right : s - +n <= -3 ? se.left : se.front : se.front : "";
906
+ }, Ee = (e, l) => {
907
+ const { shipData: n } = l.getProperties(), s = xt(e), a = bt(e, n, s);
908
+ return xo(l, a, s);
909
+ }, xt = (e) => {
910
+ const l = e == null ? void 0 : e.getView().getZoom();
911
+ return l && l <= U.shipModelMax && l >= U.shipTriggleMin ? "ship" : "triangle";
912
+ }, bt = (e, l, n) => {
913
+ if (n === "ship") {
914
+ const { len: s, wid: a } = l, o = 97, f = 20, t = 1 / (e == null ? void 0 : e.getView().getResolution()), r = s * t / o, y = a * t / f, g = Math.min(r, y);
915
+ return g < 0.2 ? 0.2 : g > 2 ? 2 : g;
916
+ }
917
+ return U.scaleNum;
918
+ }, xo = (e, l, n) => {
919
+ const { color: s, direct: a, isHighlight: o, shipData: f } = e.getProperties(), x = ((f == null ? void 0 : f.cog) - 90 + 360) % 360;
920
+ return new _({
921
+ image: new Ce({
922
+ src: t(),
923
+ scale: l || U.scaleNum,
924
+ anchor: [0.5, 0.5],
925
+ rotation: x * Math.PI / 180,
926
+ rotateWithView: !1
927
+ })
928
+ });
929
+ function t() {
930
+ return `data:image/svg+xml;utf8,${encodeURIComponent(r())}`;
931
+ }
932
+ function r() {
933
+ switch (n) {
934
+ case "triangle":
935
+ return `<svg width="41" height="24" viewBox="0 0 41 24" fill="none" xmlns="http://www.w3.org/2000/svg">
936
+ <path d="M30.8843 12.6777L2.21343 21.7067C1.75559 21.8509 1.28947 21.509 1.28947 21.029L1.28947 2.97103C1.28947 2.49102 1.75558 2.14913 2.21342 2.29331L30.8843 11.3223C31.5471 11.531 31.5471 12.469 30.8843 12.6777Z"
937
+ fill="${s}" stroke="${o ? "#FF2424" : "black"}" stroke-width="${o ? "2" : "0.578947"}" />
938
+ <!--path船航向左边或者向前-->
939
+ ${a === se.left && `<path d="M30 12L40 12L40 8" stroke="${o ? "#FF2424" : "black"}" stroke-width="2"/>`}
940
+ <!--path船航向右边-->
941
+ ${a === se.right && `<path d="M30 12L40 12L40 16" stroke="${o ? "#FF2424" : "black"}" stroke-width="2"/>`}
942
+ <!--path黑线无左右-->
943
+ ${a === se.front && `<path d="M30 12L40 12" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
944
+ </svg>
945
+ `;
946
+ case "ship":
947
+ return `<svg width="97" height="20" viewBox="0 0 97 20" fill="none" xmlns="http://www.w3.org/2000/svg">
948
+ <path d="M0.289474 17.3433L0.289474 2.65655C0.289474 2.28572 0.574654 1.97725 0.944343 1.9482L22.0544 0.289473L67.5204 0.289473C67.6295 0.289473 67.7372 0.314613 67.835 0.362943L86.0565 9.3629C86.5844 9.6236 86.5844 10.3763 86.0565 10.637L67.835 19.6371C67.7372 19.6854 67.6295 19.7105 67.5203 19.7105L22.0544 19.7105L0.944343 18.0517C0.574653 18.0226 0.289474 17.7142 0.289474 17.3433Z"
949
+ fill="${s}" stroke="${o ? "#FF2424" : "black"}" stroke-width="${o ? "4" : "0.578947"}"/>
950
+ ${a === se.left && `<path d="M86 10L96 10L96 6" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
951
+ ${a === se.right && `<path d="M86 10L96 10L96 14" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
952
+ ${a === se.front && `<path d="M86 10L96 10" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
953
+ </svg>
954
+ `;
955
+ default:
956
+ return "";
957
+ }
958
+ }
959
+ }, bo = (e, l) => {
960
+ const n = xt(e), s = bt(e, l, n), a = n === "ship" ? 109 : 49, o = `
961
+ <svg xmlns="http://www.w3.org/2000/svg" width="${a}" height="${a}" viewBox="0 0 49 49" fill="none">
962
+ <path d="M1.99982 46.9998L1.99982 1.99982L46.9998 1.99982L46.9998 46.9998L1.99982 46.9998Z" fill="#FF2424" fill-opacity="0.2"/>
963
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M19.9998 0.5V3.5L3.49976 3.5V20H0.499756V0.500002L19.9998 0.5ZM45.4998 3.5H28.9998V0.5H48.4998V20H45.4998V3.5ZM48.4998 29L48.4998 48.5H28.9998V45.5H45.4998L45.4998 29H48.4998ZM3.49976 45.5L3.49976 29H0.499756L0.499758 48.5L19.9998 48.5V45.5L3.49976 45.5Z" fill="#FF2424"/>
964
+ </svg>
965
+ `;
966
+ return new _({
967
+ image: new Ce({
968
+ src: `data:image/svg+xml;utf8,${encodeURIComponent(o)}`,
969
+ scale: s,
970
+ anchorXUnits: "fraction",
971
+ anchorYUnits: "fraction"
972
+ })
973
+ });
974
+ };
975
+ function ko(e, l, n, s) {
976
+ if (l) {
977
+ const a = new pe({
978
+ element: n,
979
+ positioning: "top-left",
980
+ id: "label-" + (s == null ? void 0 : s.id),
981
+ offset: [20, -20],
982
+ autoPan: !1,
983
+ position: l,
984
+ className: s != null && s.blinking ? "ship-label-overlay-blinking" : "ship-label-overlay"
985
+ });
986
+ a.set("class", "zh-map-ship-overlay"), e.addOverlay(a);
987
+ }
988
+ }
989
+ const po = (e, l) => {
990
+ const { lon: n, lat: s, blinking: a } = l, o = kt(l);
991
+ n && s && ko(e, ie([n, s]), o, { ...l, blinking: a });
992
+ }, kt = (e) => {
993
+ const l = document.createElement("div");
994
+ l.className = "ship-overlay-box", l.style.position = "relative";
995
+ const { lon: n, lat: s, blinking: a, blinkingColors: o, name: f } = e, x = Qe({
996
+ setup() {
997
+ return mo({
998
+ position: [n + 2e-3, s + 2e-3],
999
+ selected: a,
1000
+ name: f,
1001
+ colors: o || [],
1002
+ existDevice: e == null ? void 0 : e.existDevice,
1003
+ existMobile: e == null ? void 0 : e.existMobile,
1004
+ existWaterGauge: e == null ? void 0 : e.existWaterGauge
1005
+ });
1006
+ }
1007
+ });
1008
+ return Zt(x, l), l;
1009
+ }, gt = (e) => {
1010
+ const l = [];
1011
+ return e.existDevice && l.push("&#xe687;"), e.existMobile && l.push("&#xe688;"), e.existWaterGauge && l.push("&#xe686;"), l;
1012
+ };
1013
+ function Co() {
1014
+ const e = [
1015
+ "left-top",
1016
+ "left-middle",
1017
+ "left-bottom",
1018
+ "right-top",
1019
+ "right-middle",
1020
+ "right-bottom"
1021
+ ];
1022
+ return e[Math.floor(Math.random() * e.length)];
1023
+ }
1024
+ const Mo = window.devicePixelRatio || 1, je = /* @__PURE__ */ new Map();
1025
+ let $e = null, Ke = null;
1026
+ function Lo(e, l, n = "left-bottom", s = 10) {
1027
+ const a = `${e}-${l.join(",")}-${n}-${s}`;
1028
+ if (je.has(a))
1029
+ return je.get(a);
1030
+ if (!$e) {
1031
+ $e = document.createElement("canvas");
1032
+ try {
1033
+ Ke = $e.getContext("2d", {
1034
+ willReadFrequently: !0
1035
+ });
1036
+ } catch (Z) {
1037
+ console.log("e", Z), Ke = $e.getContext("2d");
1038
+ }
1039
+ }
1040
+ const o = $e, f = Ke;
1041
+ if (!f) return "";
1042
+ o.width = 0, o.height = 0;
1043
+ const x = 2, t = 4, r = 16, y = window.devicePixelRatio || 1, g = "500 12px Arial", k = "12px map-iconfont";
1044
+ f.font = g;
1045
+ const C = f.measureText(e).width;
1046
+ f.font = k;
1047
+ const z = l.map((Z) => ({ width: f.measureText(be(Z)).width, height: 14 })), d = z.reduce((Z, W) => Z + W.width, 0), m = l.length * s, P = t + C + d + m + t, b = x + 14 + x * 2;
1048
+ let V, X, G = 0, q = 0, K = 0, N = 0, M = 0, i = 0;
1049
+ switch (V = r + P, n) {
1050
+ case "right-top":
1051
+ X = r + b, G = 0, q = r + b, K = r, N = 0, M = r, i = 0;
1052
+ break;
1053
+ case "right-middle":
1054
+ X = b, G = 0, q = b / 2, K = r, N = b / 2, M = r, i = 0;
1055
+ break;
1056
+ case "right-bottom":
1057
+ X = r + b, G = 0, q = 0, K = r, N = r, M = r, i = r;
1058
+ break;
1059
+ case "left-top":
1060
+ X = r + b, G = P, q = r, K = P + r, N = b + r, M = 0, i = 0;
1061
+ break;
1062
+ case "left-middle":
1063
+ X = b, G = P, q = b / 2, K = P + r, N = b / 2, M = 0, i = 0;
1064
+ break;
1065
+ case "left-bottom":
1066
+ X = r + b, G = P, q = b, K = P + r, N = 0, M = 0, i = r;
1067
+ break;
1068
+ }
1069
+ X = X + x, o.width = Math.round(V * y), o.height = Math.round(X * y), f.scale(y, y), f.clearRect(0, 0, V, X), f.beginPath(), f.moveTo(G, q), f.lineTo(K, N), f.strokeStyle = "#FFF", f.lineWidth = 1, f.stroke(), f.fillStyle = "#FFF", f.fillRect(M, i, P, b), f.font = g, f.textBaseline = "middle";
1070
+ const T = i + x / 2 + b / 2;
1071
+ f.strokeStyle = "#ffffff", f.lineWidth = 1, f.strokeText(e, M + t, T), f.fillStyle = "#000000", f.fillText(e, M + t, T), f.font = k, f.fillStyle = "#3370ff";
1072
+ let w = M + t + C + s;
1073
+ const L = i + b / 2;
1074
+ l.length > 0 && l.forEach((Z, W) => {
1075
+ f.fillText(be(Z), w, L), w += z[W].width + s;
1076
+ });
1077
+ const F = o.toDataURL("image/png");
1078
+ return je.set(a, F), F;
1079
+ }
1080
+ const ft = (e, l) => {
1081
+ const { name: n, rightIcons: s } = e.getProperties(), a = l !== 1 ? Co() : "right-top", o = Lo(n, s, a);
1082
+ let f = [0, 0];
1083
+ switch (a) {
1084
+ case "right-top":
1085
+ f = [0, 1];
1086
+ break;
1087
+ case "right-middle":
1088
+ f = [0, 0.5];
1089
+ break;
1090
+ case "right-bottom":
1091
+ f = [0, 0];
1092
+ break;
1093
+ case "left-top":
1094
+ f = [1, 1];
1095
+ break;
1096
+ case "left-middle":
1097
+ f = [1, 0.5];
1098
+ break;
1099
+ case "left-bottom":
1100
+ f = [1, 0];
1101
+ break;
1102
+ }
1103
+ return new _({
1104
+ image: new Ce({
1105
+ src: o,
1106
+ anchor: f,
1107
+ displacement: [0, 0],
1108
+ scale: 1 / Mo,
1109
+ anchorXUnits: "fraction",
1110
+ anchorYUnits: "fraction"
1111
+ })
1112
+ });
1113
+ }, To = (e) => {
1114
+ let l = null, n = null;
1115
+ const s = new ue(), a = new _t({
1116
+ source: s,
1117
+ className: "zh-map--ship-layer",
1118
+ renderBuffer: 300,
1119
+ zIndex: 101,
1120
+ properties: { layerType: ee.SHIP }
1121
+ }), o = new ue(), f = new he({
1122
+ source: o,
1123
+ className: "zh-map--ship-label-layer",
1124
+ zIndex: 102,
1125
+ updateWhileInteracting: !1,
1126
+ updateWhileAnimating: !1,
1127
+ declutter: !0
1128
+ }), x = new ue(), t = new he({
1129
+ source: x,
1130
+ className: "zh-map--ship-selected-layer",
1131
+ zIndex: 999
1132
+ });
1133
+ e == null || e.addLayer(a), e == null || e.addLayer(f), e == null || e.addLayer(t);
1134
+ let r = null, y = "", g = {}, k = {};
1135
+ const $ = (i) => {
1136
+ if (!i || !e) return;
1137
+ const T = (n == null ? void 0 : n.id) || (l == null ? void 0 : l.get("id"));
1138
+ if (n) {
1139
+ const w = i.filter((L) => L.id === T);
1140
+ w.length === 0 ? i.push(n) : n = w[0];
1141
+ }
1142
+ m(), M(i), z();
1143
+ }, C = (i) => {
1144
+ var O;
1145
+ const T = (n == null ? void 0 : n.id) || (l == null ? void 0 : l.get("id")), w = ie([i == null ? void 0 : i.lon, i == null ? void 0 : i.lat]), L = ((O = k[i.id]) == null ? void 0 : O.blinkColors) || [], Z = L[L.length - 1] || i.fill || "#04C900", W = wo(i), H = new le({
1146
+ geometry: new te(w),
1147
+ // 船舶数据
1148
+ shipData: i,
1149
+ id: i.id,
1150
+ name: i.cnname || i.enname || i.name || i.id || "未命名船舶",
1151
+ selected: i.id === T,
1152
+ // 图标
1153
+ rightIcons: gt(i),
1154
+ // 船舶颜色
1155
+ color: Z,
1156
+ // 船艏向的方向
1157
+ direct: W,
1158
+ // 高亮
1159
+ isHighlight: !1
1160
+ });
1161
+ return H.set("clickGeometry", new Jt(w)), H;
1162
+ }, z = () => {
1163
+ if (n && e && n) {
1164
+ x.getFeatures().length > 0 && x.clear();
1165
+ const i = ie([n == null ? void 0 : n.lon, n == null ? void 0 : n.lat]), T = new le({
1166
+ geometry: new te(i),
1167
+ id: n.id
1168
+ });
1169
+ T.setStyle(bo(e, n)), x.addFeature(T);
1170
+ }
1171
+ }, d = (i) => {
1172
+ if (i === "start") {
1173
+ const T = () => {
1174
+ const w = x.getFeatures();
1175
+ s.getFeatures().forEach((L) => {
1176
+ var Z, W;
1177
+ const F = Ee(e, L);
1178
+ if (L.setStyle(F), L.get("id") === (n == null ? void 0 : n.id) && w && w[0]) {
1179
+ const H = w[0], O = H == null ? void 0 : H.getStyle();
1180
+ if (O && (O != null && O.getImage())) {
1181
+ const re = (Z = F.getImage()) == null ? void 0 : Z.getScale();
1182
+ re && ((W = O.getImage()) == null || W.setScale(re));
1183
+ }
1184
+ }
1185
+ }), r = requestAnimationFrame(T);
1186
+ };
1187
+ T();
1188
+ }
1189
+ i === "end" && r && (cancelAnimationFrame(r), r = null);
1190
+ }, m = () => {
1191
+ e && s && (P(), s.clear(), o.clear(), x.clear(), d("end"));
1192
+ }, P = (i) => {
1193
+ const T = e.getOverlays().getArray().filter((w) => w.get("class") == "zh-map-ship-overlay");
1194
+ if (T && T.length > 0) {
1195
+ for (let w = 0; w < T.length; w++)
1196
+ if (T[w].get("class") !== "ship-overlay-selected") {
1197
+ const L = T[w];
1198
+ console.log("overlay---", L), L.setPosition(void 0), e.removeOverlay(L), L.dispose();
1199
+ }
1200
+ }
1201
+ }, b = (i, T) => {
1202
+ g = i, k = T;
1203
+ const w = e.getOverlays().getArray(), L = s.getFeatures();
1204
+ for (const F in g) {
1205
+ const Z = g[F], W = w.find((O) => (O == null ? void 0 : O.getId()) === "label-" + F), H = L.find((O) => F === O.get("id"));
1206
+ if (W && H) {
1207
+ const O = T[F].blinkColors || [], { shipData: re, name: ce, color: de } = H.getProperties();
1208
+ H.set("blinking", Z), O[(O == null ? void 0 : O.length) - 1] && de !== O[(O == null ? void 0 : O.length) - 1] && (H.set("color", O[(O == null ? void 0 : O.length) - 1] || ""), H.setStyle(Ee(e, H)));
1209
+ const Be = {
1210
+ ...re,
1211
+ blinking: Z,
1212
+ blinkingColors: O || [],
1213
+ name: ce + "(" + T[F].shipState + ")"
1214
+ }, Me = W.getElement(), ge = kt(Be);
1215
+ Me && Me !== ge && W.setElement(ge);
1216
+ }
1217
+ }
1218
+ }, V = (i) => {
1219
+ if (!e) return;
1220
+ const T = s.getFeatures(), w = o.getFeatures(), L = l ? l.get("id") : "", F = T.filter((O) => O.get("id") !== L), Z = w == null ? void 0 : w.filter((O) => O.get("id") !== L), W = /* @__PURE__ */ new Map();
1221
+ i.forEach((O) => {
1222
+ W.set(O.id, !0);
1223
+ });
1224
+ const H = e.getOverlays().getArray();
1225
+ F.forEach((O) => {
1226
+ const re = O.get("id");
1227
+ if (!W.has(re))
1228
+ O.setStyle([]);
1229
+ else {
1230
+ const de = O.getStyle();
1231
+ (de == null ? void 0 : de.length) == 0 && O.setStyle(Ee(e, O));
1232
+ }
1233
+ const ce = H.find((de) => de.getId() === "label-" + re);
1234
+ ce && ce.setPosition(void 0);
1235
+ }), Z.forEach((O) => {
1236
+ const re = O.get("id");
1237
+ if (!W.has(re))
1238
+ O.setStyle([]);
1239
+ else {
1240
+ const ce = O.getStyle();
1241
+ (ce == null ? void 0 : ce.length) == 0 && O.setStyle(ft(O, i.length));
1242
+ }
1243
+ });
1244
+ }, X = (i) => {
1245
+ if (i) {
1246
+ console.log("选中", i);
1247
+ const T = s.getFeatures().find((L) => L.get("id") === i.id), w = o.getFeatures().find((L) => L.get("id") === i.id);
1248
+ T && (l = T), w && w.set("selected", !0), n = i, z();
1249
+ } else
1250
+ console.log("取消选中"), n = null, l = null, K();
1251
+ }, G = Qt((i, T, w) => {
1252
+ try {
1253
+ if (i) {
1254
+ const L = i.get("shipData"), F = i.get("id");
1255
+ if (e.getTargetElement().style.cursor = F ? "pointer" : "", T === "click" && (X(L), w && w(F)), T === "hover") {
1256
+ y && y !== F && q(), y = F;
1257
+ const Z = s.getFeatures().find((W) => W.get("id") === y);
1258
+ Z == null || Z.set("isHighlight", !0), Z == null || Z.setStyle(Ee(e, Z));
1259
+ }
1260
+ } else
1261
+ e.getTargetElement().style.cursor = "", q();
1262
+ } catch (L) {
1263
+ console.log("handleShipMapEvent", L);
1264
+ }
1265
+ }, 10), q = () => {
1266
+ const i = y ? s.getFeatures().find((T) => T.get("id") === y) : null;
1267
+ y = null, i == null || i.set("isHighlight", !1), i == null || i.setStyle(Ee(e, i));
1268
+ }, K = () => {
1269
+ try {
1270
+ x.clear();
1271
+ } catch (i) {
1272
+ console.log(i);
1273
+ }
1274
+ }, N = (i, T) => {
1275
+ const w = ie([i == null ? void 0 : i.lon, i == null ? void 0 : i.lat]), L = new le({
1276
+ geometry: new te(w),
1277
+ name: i.cnname || i.enname || i.name || i.id || "未命名船舶",
1278
+ // 图标
1279
+ rightIcons: gt(i),
1280
+ selected: (i == null ? void 0 : i.id) === (n == null ? void 0 : n.id),
1281
+ shipData: i
1282
+ });
1283
+ L.set("id", i.id);
1284
+ const F = ft(L, T);
1285
+ return L.setStyle(F), L;
1286
+ }, M = (i) => {
1287
+ const T = e.getView().getZoom();
1288
+ i.forEach((w) => {
1289
+ const L = C(w);
1290
+ if (L.setStyle(Ee(e, L)), s.addFeature(L), (n == null ? void 0 : n.id) == w.id || T && T >= U.shipModelMin)
1291
+ if (g[w.id]) {
1292
+ if (w.id && k[w == null ? void 0 : w.id]) {
1293
+ const F = k[w == null ? void 0 : w.id] || {}, Z = (F == null ? void 0 : F.blinkColors) || [], W = (F == null ? void 0 : F.shipState) || "", H = (w.cnname || w.enname || w.name || w.id || "未命名船舶") + "(" + W + ")", O = {
1294
+ ...w,
1295
+ name: H,
1296
+ blinking: g[w.id],
1297
+ blinkingColors: Z || []
1298
+ };
1299
+ po(e, O);
1300
+ }
1301
+ } else {
1302
+ const F = N(w, i.length);
1303
+ o.addFeature(F);
1304
+ }
1305
+ });
1306
+ };
1307
+ return {
1308
+ render: $,
1309
+ selected: X,
1310
+ filter: V,
1311
+ blinking: b,
1312
+ clear: m,
1313
+ handleShipMapEvent: G,
1314
+ changeShipScale: d
1315
+ };
1316
+ }, Eo = (e) => {
1317
+ const l = () => e == null ? void 0 : e.getLayers(), n = ne("vector"), s = () => n.value, a = (t) => {
1318
+ n.value = t;
1319
+ const r = l();
1320
+ r && (r == null || r.getArray().forEach((y) => {
1321
+ (y.className_ === "vector" || y.className_ === "satellite") && y.setVisible(y.className_ === t);
1322
+ }));
1323
+ }, o = ne(!1);
1324
+ return {
1325
+ getLayers: l,
1326
+ getGreenTileVisible: () => o.value,
1327
+ setGreenTileVisible: (t) => {
1328
+ if (t !== o.value) {
1329
+ if (t) {
1330
+ const r = l();
1331
+ if (!r.getArray().find((g) => g.className_ === "greenTile")) {
1332
+ const g = new Pe({
1333
+ source: new Fe({ url: xe.greenTile }),
1334
+ visible: t,
1335
+ zIndex: 2,
1336
+ className: "greenTile"
1337
+ });
1338
+ r.push(g);
1339
+ }
1340
+ } else {
1341
+ const r = l(), y = r.getArray().find((g) => g.className_ === "greenTile");
1342
+ y && r.remove(y);
1343
+ }
1344
+ o.value = t;
1345
+ }
1346
+ },
1347
+ getShowLayerType: s,
1348
+ setShowLayerType: a
1349
+ };
1350
+ }, Po = () => {
1351
+ const e = ne();
1352
+ return {
1353
+ setProps: (s) => {
1354
+ e.value = s;
1355
+ },
1356
+ getProps: () => e.value
1357
+ };
1358
+ }, Fo = (e) => {
1359
+ const l = "zh-map-location-layer";
1360
+ let n, s, a = null, o = null;
1361
+ const f = (C) => {
1362
+ if (!(!C || C.length === 0)) {
1363
+ if (s || (s = new ue()), s.clear(), o) {
1364
+ const z = C.find((d) => d.id === o.id);
1365
+ z ? o = z : C.push(o);
1366
+ }
1367
+ C.forEach((z) => {
1368
+ x(z);
1369
+ }), n || (n = new he({
1370
+ className: l,
1371
+ source: s,
1372
+ zIndex: 100
1373
+ }), e == null || e.addLayer(n));
1374
+ }
1375
+ }, x = (C) => {
1376
+ const z = e == null ? void 0 : e.getView().getZoom(), [d, m] = C.latLon.split(","), P = new le({
1377
+ geometry: new te(ie([Number(d), Number(m)]))
1378
+ });
1379
+ P.setStyle(t(C, z, C.id === (o == null ? void 0 : o.id))), P.set("loactionData", C), s.addFeature(P);
1380
+ }, t = (C, z, d) => {
1381
+ const m = {
1382
+ image: new Ce({
1383
+ src: d && C.selectedPath || C.defaultPath,
1384
+ scale: 0.5 * z / 10
1385
+ })
1386
+ };
1387
+ return C.name && (m.text = new Se({
1388
+ text: C.name,
1389
+ font: "12px sans-serif",
1390
+ fill: new oe({
1391
+ color: "#000000"
1392
+ }),
1393
+ backgroundFill: new oe({
1394
+ color: "#FFFFFF"
1395
+ }),
1396
+ offsetY: 30
1397
+ })), new _(m);
1398
+ }, r = () => {
1399
+ if (a) {
1400
+ const C = a.get("loactionData").id;
1401
+ s.getFeatures().forEach((z) => {
1402
+ z.get("loactionData").id !== C && s.removeFeature(z);
1403
+ });
1404
+ } else
1405
+ s.clear();
1406
+ }, y = () => {
1407
+ var m;
1408
+ const C = a.get("loactionData"), z = (m = e == null ? void 0 : e.getView()) == null ? void 0 : m.getZoom();
1409
+ s.getFeatures().forEach((P) => {
1410
+ P.get("loactionData").id === C.id && (P == null || P.setStyle(t(C, z, !1)));
1411
+ }), o = null, a = null;
1412
+ }, g = (C) => {
1413
+ C ? (k(), $(C)) : clearSelectedPort();
1414
+ }, k = () => {
1415
+ var C;
1416
+ if (a) {
1417
+ const z = a.get("loactionData"), d = (C = e == null ? void 0 : e.getView()) == null ? void 0 : C.getZoom();
1418
+ a.setStyle(t(z, d, !1));
1419
+ }
1420
+ }, $ = (C) => {
1421
+ const z = s.getFeatures();
1422
+ o = C, a = z.find((d) => d.get("loactionData").id === C.id);
1423
+ };
1424
+ return {
1425
+ render: f,
1426
+ selected: g,
1427
+ clearSelected: y,
1428
+ clear: r
1429
+ };
1430
+ }, So = (e) => {
1431
+ e.getInteractions().forEach((l) => {
1432
+ l instanceof yt && l.setActive(!1);
1433
+ });
1434
+ }, No = (e) => {
1435
+ e.getInteractions().forEach((l) => {
1436
+ l instanceof yt && l.setActive(!0);
1437
+ });
1438
+ }, ve = (e, l) => {
1439
+ const n = e.getViewport();
1440
+ n && (n.style.cursor = l);
1441
+ }, Ro = (e, l) => {
1442
+ const n = ne([]), s = ne("km"), a = (N) => {
1443
+ s.value = N;
1444
+ };
1445
+ let o;
1446
+ const f = ne(!1), x = () => {
1447
+ ve(e, "crosshair"), y(), So(e), e.on("pointermove", $), e.getViewport().addEventListener("mouseout", () => {
1448
+ o && o.classList.add("hidden");
1449
+ }), z(), f.value = !0;
1450
+ };
1451
+ let t, r;
1452
+ const y = () => {
1453
+ t = new ue(), r = new he({
1454
+ source: t,
1455
+ zIndex: 1e3,
1456
+ style: {
1457
+ "fill-color": "rgba(255, 255, 255, 0.2)",
1458
+ "stroke-color": "#ffcc33",
1459
+ "stroke-width": 2,
1460
+ "circle-radius": 7,
1461
+ "circle-fill-color": "#ffcc33"
1462
+ }
1463
+ }), e == null || e.addLayer(r);
1464
+ };
1465
+ let g, k;
1466
+ const $ = (N) => {
1467
+ if (N.dragging)
1468
+ return;
1469
+ let M = "点击选择起点";
1470
+ g && (M = "单击继续,双击结束"), o && (o.innerHTML = M, k.setPosition(N.coordinate), o.classList.remove("hidden"));
1471
+ };
1472
+ let C;
1473
+ const z = () => {
1474
+ C = new We({
1475
+ source: t,
1476
+ type: "LineString",
1477
+ style: new _({
1478
+ fill: new oe({
1479
+ color: "rgba(255, 255, 255, 0.2)"
1480
+ }),
1481
+ stroke: new ke({
1482
+ color: "rgba(255,204,51)",
1483
+ lineDash: [10, 10],
1484
+ width: 2
1485
+ }),
1486
+ image: new Ye({
1487
+ radius: 5,
1488
+ stroke: new ke({
1489
+ color: "rgba(0, 0, 0, 0.7)"
1490
+ }),
1491
+ fill: new oe({
1492
+ color: "rgba(255, 255, 255, 0.2)"
1493
+ })
1494
+ })
1495
+ }),
1496
+ // 添加条件函数,判断是否应该出发点绘制
1497
+ condition: (M) => M.originalEvent.target.tagName !== "DIV"
1498
+ }), e == null || e.addInteraction(C), b(), V();
1499
+ let N;
1500
+ C.on("drawstart", function(M) {
1501
+ var T;
1502
+ g = M.feature, g.set("randomId", d());
1503
+ let i;
1504
+ N = (T = g.getGeometry()) == null ? void 0 : T.on("change", function(w) {
1505
+ const L = w.target, F = pt(L, s.value);
1506
+ i = L.getLastCoordinate(), m && F && (m.innerHTML = F), P.setPosition(i);
1507
+ });
1508
+ }), C.on("drawend", function() {
1509
+ var M, i, T;
1510
+ if (m && (m.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), m != null && m.innerHTML) {
1511
+ const w = (g == null ? void 0 : g.get("randomId")) || d();
1512
+ n.value.push({ id: w, value: m == null ? void 0 : m.innerHTML }), m.innerHTML = `${m.innerHTML}<div class="ol-tooltip-delete-button" data-id="${w}"><i class="map-iconfont icon-delete"></i></div>`;
1513
+ }
1514
+ (M = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || M.addEventListener("click", (w) => {
1515
+ var F;
1516
+ w.preventDefault(), w.stopPropagation();
1517
+ const L = (F = w.target) == null ? void 0 : F.getAttribute("data-id");
1518
+ L && G(L);
1519
+ }), P.setOffset([0, -7]), g = null, m = null, b(), N && Je(N), (T = (i = l.getProps()) == null ? void 0 : i.lineDrawEnd) == null || T.call(i, n.value);
1520
+ });
1521
+ }, d = () => Math.random().toString(36).substring(2, 9);
1522
+ let m, P;
1523
+ const b = () => {
1524
+ m != null && m.parentNode && m.parentNode.removeChild(m), m = document.createElement("div"), m.className = "ol-tooltip ol-tooltip-measure", P = new pe({
1525
+ element: m,
1526
+ offset: [0, -15],
1527
+ positioning: "bottom-center",
1528
+ stopEvent: !1,
1529
+ insertFirst: !1
1530
+ }), e == null || e.addOverlay(P);
1531
+ }, V = () => {
1532
+ o != null && o.parentNode && o.parentNode.removeChild(o), o = document.createElement("div"), o.className = "ol-tooltip hidden", k = new pe({
1533
+ element: o,
1534
+ offset: [15, 0],
1535
+ positioning: "center-left"
1536
+ }), e == null || e.addOverlay(k);
1537
+ }, X = () => {
1538
+ n.value.forEach((N, M) => {
1539
+ var w, L;
1540
+ const i = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
1541
+ i[M] && ((L = (w = i[M]) == null ? void 0 : w.parentNode) == null || L.removeChild(i[M]));
1542
+ const T = t.getFeatures();
1543
+ T[M] && t.removeFeature(T[M]);
1544
+ }), q(), No(e), f.value = !1, ve(e, "grab");
1545
+ }, G = (N) => {
1546
+ var i, T, w, L;
1547
+ const M = n.value.findIndex((F) => F.id === N);
1548
+ if (M !== -1) {
1549
+ n.value.splice(M, 1);
1550
+ const F = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
1551
+ F[M] && ((T = (i = F[M]) == null ? void 0 : i.parentNode) == null || T.removeChild(F[M]));
1552
+ const Z = t.getFeatures();
1553
+ Z[M] && t.removeFeature(Z[M]);
1554
+ }
1555
+ (L = (w = l.getProps()) == null ? void 0 : w.lineDrawEnd) == null || L.call(w, n.value);
1556
+ }, q = () => {
1557
+ if (n.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((N) => {
1558
+ var M;
1559
+ (M = N == null ? void 0 : N.parentNode) == null || M.removeChild(N);
1560
+ }), t == null || t.clear(), C) {
1561
+ const N = e.getInteractions().getArray().find((M) => at(M) === at(C));
1562
+ N && e.removeInteraction(N);
1563
+ }
1564
+ e.removeLayer(r), o != null && o.parentNode && o.parentNode.removeChild(o), m != null && m.parentNode && m.parentNode.removeChild(m);
1565
+ };
1566
+ return {
1567
+ open: x,
1568
+ close: X,
1569
+ deleteLine: G,
1570
+ setUnit: a,
1571
+ getState: () => f.value
1572
+ };
1573
+ }, pt = (e, l) => {
1574
+ const s = tt(e);
1575
+ let a = "";
1576
+ switch (l) {
1577
+ case "m":
1578
+ a = `${Math.round(s * 100) / 100} m`;
1579
+ break;
1580
+ case "km":
1581
+ a = `${Math.round(s / 1e3 * 100) / 100} km`;
1582
+ break;
1583
+ case "nm":
1584
+ a = (Math.round(s / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
1585
+ break;
1586
+ }
1587
+ return a;
1588
+ }, $o = (e, l) => {
1589
+ let n, s, a = "close";
1590
+ const o = () => {
1591
+ q(), a = "open", f(), ve(e, "crosshair");
1592
+ }, f = () => {
1593
+ r(), P(), X(), C();
1594
+ };
1595
+ let x = null, t = null;
1596
+ const r = () => {
1597
+ if (x && t) return;
1598
+ const N = new ue(), M = new he({
1599
+ source: N,
1600
+ style: new _({
1601
+ stroke: new ke({
1602
+ color: "#fbcc33",
1603
+ width: 2
1604
+ })
1605
+ }),
1606
+ zIndex: 1e3
1607
+ });
1608
+ x = M, t = N, e.on("pointermove", g), e.addLayer(M), e.on(["dblclick"], function(i) {
1609
+ k && (i.stopPropagation(), i.preventDefault());
1610
+ });
1611
+ };
1612
+ let y;
1613
+ const g = (N) => {
1614
+ if (N.dragging) return;
1615
+ const M = y ? "单击继续,双击结束" : "点击选择起点";
1616
+ b && (b.innerHTML = M, V.setPosition(N.coordinate));
1617
+ };
1618
+ let k, $ = !1;
1619
+ const C = () => {
1620
+ if (n) {
1621
+ b != null && b.parentNode && b.parentNode.removeChild(b);
1622
+ const N = n.getGeometry();
1623
+ if (!N) return;
1624
+ const M = z(N, "nm");
1625
+ d && (d.innerHTML = `
1626
+ <span class="text">面积:${M}${$ ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
1627
+ `), d && (d.innerHTML += '<span class="delete-icon" ><i class="map-iconfont icon-delete" /></div>');
1628
+ const i = N.getCoordinates(), T = i[0][i[0].length - 2];
1629
+ if (m.setPosition(T), x) {
1630
+ const L = x.getSource();
1631
+ L && n && (L.clear(), L.addFeature(n));
1632
+ }
1633
+ setTimeout(() => {
1634
+ var L;
1635
+ (L = document.querySelector(".delete-icon")) == null || L.addEventListener("click", () => {
1636
+ var F, Z;
1637
+ console.log("delete"), G(), (Z = (F = l.getProps()) == null ? void 0 : F.areaDrawEnd) == null || Z.call(F, []);
1638
+ });
1639
+ }, 0);
1640
+ const w = It(n.getGeometry().getExtent());
1641
+ e == null || e.getView().setCenter(w);
1642
+ return;
1643
+ }
1644
+ k = new We({
1645
+ type: "Polygon",
1646
+ source: t,
1647
+ trace: !0,
1648
+ style: [new _({
1649
+ stroke: new ke({
1650
+ color: "rgba(255, 255, 255, 1)",
1651
+ width: 1.5,
1652
+ lineDash: [10, 10]
1653
+ }),
1654
+ fill: new oe({
1655
+ color: "rgba(255, 255, 255, 0.25)"
1656
+ })
1657
+ }), new _({
1658
+ image: new Ye({
1659
+ radius: 5,
1660
+ fill: new oe({
1661
+ color: "rgb(51,112,255, 1)"
1662
+ })
1663
+ }),
1664
+ geometry: function(N) {
1665
+ const M = N.getGeometry().getCoordinates();
1666
+ return new eo(M);
1667
+ }
1668
+ })]
1669
+ }), e == null || e.addInteraction(k), k.on("drawstart", (N) => {
1670
+ var M;
1671
+ y = N.feature, s = (M = y.getGeometry()) == null ? void 0 : M.on("change", (i) => {
1672
+ const T = i.target, w = z(T, "nm"), F = T.getCoordinates()[0], Z = new Ge([F[F.length - 2], F[F.length - 1]]), W = pt(Z, "nm");
1673
+ if ($ = Number(tt(Z) / 1e3) > 150, !w) return;
1674
+ const H = '<span class="error pl-4">超出可以绘画的距离</span>';
1675
+ d && (d.innerHTML = `
1676
+ <div class="text">
1677
+ 面积:${w}
1678
+ ${$ ? H : ""}
1679
+ </div>
1680
+ `), b && (b.innerHTML = `
1681
+ <div class="text">
1682
+ 面积:${w}
1683
+ </div>
1684
+ <div class="text ${$ ? "error" : ""}">
1685
+ 线段 ${F.length - 2}: ${W}
1686
+ ${$ ? H : ""}
1687
+
1688
+ </div>
1689
+ <div>
1690
+ <span class="text">单击继续,双击结束</span>
1691
+ </div>
1692
+ `);
1693
+ });
1694
+ }), k.on("drawend", (N) => {
1695
+ var w, L, F, Z;
1696
+ if (!N.feature.getGeometry()) return;
1697
+ d && !n && (d.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), n = N.feature, m.setOffset([10, 0]);
1698
+ const i = N.feature.getGeometry().getCoordinates(), T = i[0][i[0].length - 2];
1699
+ if (m.setPosition(T), b != null && b.parentNode && b.parentNode.removeChild(b), (w = l.getProps()) != null && w.areaDrawEnd) {
1700
+ const W = i[0].map((H) => Ve(H, I.mercator, I.data));
1701
+ (F = (L = l.getProps()) == null ? void 0 : L.areaDrawEnd) == null || F.call(L, W);
1702
+ }
1703
+ k && (k.setActive(!1), e == null || e.removeInteraction(k), (e == null ? void 0 : e.getInteractions()).forEach((H) => {
1704
+ H instanceof We && (H.setActive(!1), e == null || e.removeInteraction(H));
1705
+ })), s && Je(s), (Z = document.querySelector(".delete-icon")) == null || Z.addEventListener("click", () => {
1706
+ var W, H;
1707
+ G(), (H = (W = l.getProps()) == null ? void 0 : W.areaDrawEnd) == null || H.call(W, []);
1708
+ });
1709
+ });
1710
+ }, z = (N, M) => {
1711
+ const i = Ut(N);
1712
+ switch (M) {
1713
+ case "km":
1714
+ return i > 1e4 ? Math.round(i / 1e6 * 100) / 100 + " km<sup>2</sup>" : Math.round(i * 100) / 100 + " m<sup>2</sup>";
1715
+ case "nm":
1716
+ return i > 1e4 ? Math.round(i / 1e6 / Math.pow(1.852, 2) * 100) / 100 + " nm<sup>2</sup>" : Math.round(i * 100) / 100 + " m<sup>2</sup>";
1717
+ }
1718
+ };
1719
+ let d, m;
1720
+ const P = () => {
1721
+ d != null && d.parentNode && d.parentNode.removeChild(d), d = document.createElement("div"), d.style.display = "flex", d.className = "ol-tooltip ol-tooltip-draw-polygon", m = new pe({
1722
+ element: d,
1723
+ offset: [0, -15],
1724
+ positioning: "bottom-center",
1725
+ stopEvent: !1,
1726
+ insertFirst: !1
1727
+ }), e == null || e.addOverlay(m);
1728
+ };
1729
+ let b, V;
1730
+ const X = () => {
1731
+ b != null && b.parentNode && b.parentNode.removeChild(b), b = document.createElement("div"), b.className = "ol-tooltip ol-help-tooltip", V = new pe({
1732
+ element: b,
1733
+ offset: [15, 0],
1734
+ positioning: "center-left"
1735
+ }), e == null || e.addOverlay(V);
1736
+ }, G = () => {
1737
+ n = null, o();
1738
+ }, q = () => {
1739
+ a = "close", e.un("pointermove", g), y = null, k && (k.abortDrawing(), console.log("abortDrawing"), k.setActive(!1), (e == null ? void 0 : e.getInteractions()).forEach((M) => {
1740
+ M instanceof We && (M.setActive(!1), e == null || e.removeInteraction(M));
1741
+ }), k = null), s && Je(s), s = void 0, t == null || t.clear(), t = null, x && e.getAllLayers().includes(x) && (e.removeLayer(x), x = null), b != null && b.parentElement && (b.innerHTML = "", b.parentElement.removeChild(b), b = null), d != null && d.parentElement && (d.innerHTML = "", d.parentElement.removeChild(d), d = null), V && e.removeOverlay(V), m && e.removeOverlay(m), ve(e, "grab");
1742
+ };
1743
+ return {
1744
+ open: o,
1745
+ close: q,
1746
+ reset: G,
1747
+ getState: () => a
1748
+ };
1749
+ }, Vo = "zh-map-port-layer", zo = (e) => {
1750
+ const l = new ue(), n = new he({
1751
+ className: Vo,
1752
+ source: l,
1753
+ zIndex: 100,
1754
+ updateWhileInteracting: !0,
1755
+ updateWhileAnimating: !0,
1756
+ properties: { layerType: ee.PORT }
1757
+ });
1758
+ e == null || e.addLayer(n);
1759
+ let s = null, a = null;
1760
+ const o = (d, m = !0) => {
1761
+ if (!d || d.length === 0) return;
1762
+ if (l.clear(), a) {
1763
+ const b = d.find((V) => V.id === (a == null ? void 0 : a.id));
1764
+ b ? a = b : d.push(a);
1765
+ }
1766
+ const P = [];
1767
+ d.forEach((b) => {
1768
+ const [V, X] = b.latLon.split(","), G = new le({
1769
+ geometry: new te(ie([Number(V), Number(X)])),
1770
+ portData: b,
1771
+ id: b.id,
1772
+ select: b.id === (a == null ? void 0 : a.id),
1773
+ showTitle: b.id === (a == null ? void 0 : a.id) || m
1774
+ }), q = y(G);
1775
+ G.setStyle(q), P.push(G);
1776
+ }), l.addFeatures(P);
1777
+ };
1778
+ let f = null, x = null;
1779
+ const t = /* @__PURE__ */ new Map(), r = (d, m) => {
1780
+ f || (f = document.createElement("canvas"), x = f.getContext("2d", {
1781
+ willReadFrequently: !0
1782
+ }));
1783
+ const P = `${d}-${m}`;
1784
+ if (t.has(P))
1785
+ return t.get(P);
1786
+ const b = f, V = x;
1787
+ if (!V) return "";
1788
+ b.width = 0, b.height = 0;
1789
+ const X = 2, G = 8, q = window.devicePixelRatio || 1, K = "12px sans-serif";
1790
+ V.font = K;
1791
+ const M = V.measureText(d).width, i = G + M + G, T = X + 12 + X * 2;
1792
+ b.width = Math.round(i * q), b.height = Math.round(T * q), V.scale(q, q), V.clearRect(0, 0, i, T), V.fillStyle = m ? "#F32D2D" : "#FFF", V.beginPath(), V.roundRect(0, 0, i, T, 4), V.fill(), V.font = K, V.textBaseline = "middle";
1793
+ const w = T / 2;
1794
+ V.strokeStyle = m ? "#000" : "#ffffff", V.lineWidth = 1, V.strokeText(d, G, w), V.fillStyle = m ? "#FFF" : "#000000", V.fillText(d, G, w);
1795
+ const L = b.toDataURL("image/png");
1796
+ return t.set(P, L), L;
1797
+ }, y = (d) => {
1798
+ const { select: m, showTitle: P } = d.getProperties(), b = (M) => `<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
1799
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M22.6563 44.9304C22.5453 44.8844 22.4445 44.817 22.3595 44.7321C22.3595 44.7321 9.36986 31.7424 9.32952 31.6913C7.09059 29.0791 5.64794 25.8802 5.17255 22.4736C4.69716 19.0671 5.20896 15.5957 6.64728 12.471C8.08561 9.34625 10.3902 6.69909 13.2878 4.84325C16.1855 2.98741 19.5548 2.00068 22.9965 2C26.4381 1.99932 29.8078 2.98473 32.7062 4.83943C35.6046 6.69414 37.9102 9.34039 39.3498 12.4646C40.7893 15.5888 41.3025 19.0599 40.8284 22.4666C40.3544 25.8734 38.913 29.0729 36.6751 31.686C36.6401 31.737 23.6531 44.7321 23.6531 44.7321C23.5682 44.817 23.4674 44.8844 23.3564 44.9304C23.2454 44.9763 23.1265 45 23.0063 45C22.8862 45 22.7673 44.9763 22.6563 44.9304Z" fill="${M}"/>
1800
+ <g clip-path="url(#clip0_10059_122082)">
1801
+ <path d="M34.8624 22.8687L32.5874 25.6313L33.4812 25.7125C33.4812 25.7125 30.5562 28.0687 27.9562 28.2312C25.3562 28.3937 24.1374 24.9 24.1374 24.9V19.1312H27.6312V17.425H24.2999V15.15C25.7624 14.6625 26.7374 13.2812 26.7374 11.6562C26.7374 9.625 25.1124 8 23.0812 8H22.9999C20.9687 8 19.3437 9.625 19.3437 11.6562C19.3437 13.2812 20.3999 14.6625 21.7812 15.15V17.425H18.4499V19.1312H21.9437V24.9C21.9437 24.9 20.6437 28.3125 18.0437 28.2312C15.4437 28.0687 12.5187 25.7125 12.5187 25.7125L13.4124 25.6313L11.0562 22.8687L10.2437 26.2812L11.2187 26.0375C11.2187 26.0375 13.1687 29.5313 16.1749 30.8313C19.1812 32.2125 22.1874 33.9187 22.8374 34C23.4874 33.9187 26.4937 32.2125 29.4187 30.8313C32.3437 29.45 34.3749 26.0375 34.3749 26.0375L35.3499 26.2812L34.8624 22.8687ZM23.0812 13.6875C21.9437 13.6875 21.0499 12.7937 21.0499 11.6562C21.0499 10.6 21.9437 9.70625 22.9999 9.70625H23.0812C24.1374 9.70625 25.0312 10.6 25.0312 11.6562C25.1124 12.7937 24.1374 13.6875 23.0812 13.6875Z" fill="white"/>
1802
+ </g>
1803
+ <defs>
1804
+ <clipPath id="clip0_10059_122082">
1805
+ <rect width="26" height="26" fill="white" transform="translate(10 8)"/>
1806
+ </clipPath>
1807
+ </defs>
1808
+ </svg>
1809
+ `, V = () => `data:image/svg+xml;utf8,${encodeURIComponent(b(m ? "#F32D2D" : "#3370FF"))}`, X = e.getView().getZoom(), G = d.get("portData"), q = window.devicePixelRatio || 1, K = new _({
1810
+ image: new Ce({
1811
+ src: V(),
1812
+ scale: 0.5 * X / 10
1813
+ }),
1814
+ zIndex: m ? 110 : 100
1815
+ }), N = new _({
1816
+ image: new Ce({
1817
+ src: r(G.shortName, m),
1818
+ anchor: [0.5, 0.5],
1819
+ displacement: [0, -30],
1820
+ scale: 1 / q,
1821
+ anchorXUnits: "fraction",
1822
+ anchorYUnits: "fraction"
1823
+ }),
1824
+ zIndex: m ? 110 : 100
1825
+ // text: new Text({
1826
+ // text: port.shortName,
1827
+ // font: '12px sans-serif',
1828
+ // fill: new Fill({
1829
+ // color: select ? "#ffffff" : "#000000"
1830
+ // }),
1831
+ // backgroundFill: new Fill({
1832
+ // color: "#FFF",
1833
+ // }),
1834
+ // offsetY: 30,
1835
+ // }),
1836
+ });
1837
+ return !P && !m ? K : [K, N];
1838
+ }, g = () => {
1839
+ if (l)
1840
+ if (s) {
1841
+ console.log("清除非选中的港口");
1842
+ const d = s.get("portData").id;
1843
+ l.getFeatures().forEach((m) => {
1844
+ m.get("portData").id !== d && l.removeFeature(m);
1845
+ });
1846
+ } else
1847
+ console.log("清除所有港口", l), l == null || l.clear();
1848
+ }, k = (d) => {
1849
+ if (l) {
1850
+ if (!d)
1851
+ return $();
1852
+ (s == null ? void 0 : s.get("portData").id) !== d.id && ($(), C(d));
1853
+ }
1854
+ }, $ = () => {
1855
+ var d;
1856
+ if (s) {
1857
+ const m = s == null ? void 0 : s.get("portData"), P = (d = l.getFeatures()) == null ? void 0 : d.find((b) => b.get("portData").id === m.id);
1858
+ P && (P.set("select", !1), P.setStyle(y(P)), s = null, a = null);
1859
+ }
1860
+ }, C = (d) => {
1861
+ if (!l) return;
1862
+ const m = l.getFeatures();
1863
+ a = d, s = m.find((P) => P.get("portData").id === d.id), s && (s.set("select", !0), s.setStyle(y(s)));
1864
+ };
1865
+ return {
1866
+ render: o,
1867
+ clear: g,
1868
+ selected: k,
1869
+ handlePortHover: (d) => {
1870
+ d && d.get("portData") ? ve(e, "pointer") : ve(e, "grab");
1871
+ }
1872
+ };
1873
+ }, Oo = (e, l, n, s, a, o, f) => {
1874
+ const x = e.getInstall();
1875
+ x.on("moveend", () => {
1876
+ var g, k;
1877
+ try {
1878
+ const $ = e.getZoom();
1879
+ (k = (g = l.getProps()).mapMoveEnd) == null || k.call(g, $), $ >= U.min && $ <= U.max && n.reRenderTrackLine(), $ >= U.shipTriggleMin && $ <= U.max && s.changeShipScale("end");
1880
+ } catch ($) {
1881
+ console.log("moveend---catch", $);
1882
+ }
1883
+ });
1884
+ const t = {
1885
+ [ee.PORT]: null,
1886
+ [ee.SHIP]: null,
1887
+ [ee.TRACK]: null
1888
+ }, r = (g, k, $) => {
1889
+ switch (ve(x, "pointer"), g) {
1890
+ case ee.SHIP:
1891
+ s == null || s.handleShipMapEvent(k, "hover");
1892
+ break;
1893
+ case ee.PORT:
1894
+ break;
1895
+ case ee.TRACK:
1896
+ n == null || n.handleTrackMapEvent(k, "hover", $);
1897
+ break;
1898
+ }
1899
+ }, y = (g) => {
1900
+ switch (ve(x, "grab"), g) {
1901
+ case ee.PORT:
1902
+ break;
1903
+ case ee.SHIP:
1904
+ s == null || s.handleShipMapEvent(null, "hover");
1905
+ break;
1906
+ case ee.TRACK:
1907
+ n == null || n.handleTrackMapEvent(null, "hover");
1908
+ break;
1909
+ }
1910
+ };
1911
+ x.on("pointermove", (g) => {
1912
+ if (!x.getView().getAnimating())
1913
+ try {
1914
+ let k = !1;
1915
+ const $ = x.getLayers().getArray().filter((C) => C.get("layerType"));
1916
+ $ && $.length > 0 && $.forEach((C) => {
1917
+ if (k) return;
1918
+ const z = x == null ? void 0 : x.getEventPixel(g.originalEvent), d = C == null ? void 0 : C.get("layerType"), m = x == null ? void 0 : x.forEachFeatureAtPixel(z, (P) => P, {
1919
+ layerFilter: (P) => P === C,
1920
+ // 严格图层过滤
1921
+ hitTolerance: 5
1922
+ });
1923
+ m !== t[d] && (t[d] && y(d, t[d]), t[d] = m, m && (r(d, m, g), k = !0));
1924
+ });
1925
+ } catch (k) {
1926
+ console.log("pointermove----", k);
1927
+ }
1928
+ }), x.on("movestart", () => {
1929
+ try {
1930
+ const g = x == null ? void 0 : x.getView().getZoom();
1931
+ g && g <= U.shipModelMax && g >= U.shipTriggleMin && s.changeShipScale("start");
1932
+ } catch (g) {
1933
+ console.log("movestart---catch", g);
1934
+ }
1935
+ }), x.on("click", vt((g) => {
1936
+ if (f.getState() !== "open" && !x.getView().getAnimating())
1937
+ try {
1938
+ let k = !1;
1939
+ const $ = x.getLayers().getArray().filter((C) => C.get("layerType"));
1940
+ $ && $.length > 0 && $.forEach((C) => {
1941
+ var m, P, b;
1942
+ if (k) return;
1943
+ const z = x == null ? void 0 : x.getEventPixel(g.originalEvent), d = x == null ? void 0 : x.forEachFeatureAtPixel(z, (V) => {
1944
+ if (V.get("shipData") || V.get("portData"))
1945
+ return V;
1946
+ }, {
1947
+ layerFilter: (V) => V === C,
1948
+ // 严格图层过滤
1949
+ hitTolerance: 10
1950
+ });
1951
+ if (d) {
1952
+ if (d != null && d.get("shipData"))
1953
+ console.log("trackManager.getTrackStatus()---", n.getTrackStatus()), n.getTrackStatus() || s.handleShipMapEvent(d, "click", (m = l.getProps()) == null ? void 0 : m.selectShip);
1954
+ else if (d != null && d.get("portData")) {
1955
+ const V = d == null ? void 0 : d.get("portData");
1956
+ a.selected(V), (b = (P = l.getProps()) == null ? void 0 : P.selectPort) == null || b.call(P, V);
1957
+ }
1958
+ k = !0, g.preventDefault(), g.stopPropagation();
1959
+ }
1960
+ });
1961
+ } catch (k) {
1962
+ console.log("pointermove----", k);
1963
+ }
1964
+ }, 150));
1965
+ }, Do = () => {
1966
+ const e = At([]);
1967
+ return {
1968
+ createInstance: (s, a) => {
1969
+ const o = ao();
1970
+ o.initMap(s, a);
1971
+ const f = o.getInstall(), x = Eo(f), t = Po();
1972
+ t.setProps(a), x.setShowLayerType(a.layerType), x.setGreenTileVisible(a.showGreenLayer);
1973
+ const r = yo(f), y = vo(f, r), g = To(f), k = Fo(f), $ = Ro(f, t), C = $o(f, t), z = zo(f);
1974
+ Oo(o, t, r, g, z, $, C);
1975
+ const d = () => {
1976
+ const P = f.getView().calculateExtent(o.getSize()), b = Ve([P[0], P[1]], I.mercator, I.data), V = Ve([P[2], P[3]], I.mercator, I.data);
1977
+ return [b[0], b[1], V[0], V[1]];
1978
+ }, m = {
1979
+ id: Symbol("map-instance"),
1980
+ innerMap: null,
1981
+ map: o.getInstall(),
1982
+ destroy: () => {
1983
+ e.splice(e.indexOf(m), 1);
1984
+ },
1985
+ methods: {
1986
+ ...o,
1987
+ layer: x,
1988
+ ship: g,
1989
+ track: r,
1990
+ carTrack: y,
1991
+ port: {
1992
+ render: z.render,
1993
+ clear: z.clear,
1994
+ selected: z.selected
1995
+ },
1996
+ position: k,
1997
+ drawLine: $,
1998
+ drawPolygon: C,
1999
+ // 子模块
2000
+ utils: {
2001
+ getCalculateExtent: d,
2002
+ convertSixHundredThousandToLatLng: nt,
2003
+ calculateCirclePoints: uo
2004
+ }
2005
+ }
2006
+ };
2007
+ return e.push(m), m;
2008
+ },
2009
+ destroyInstance: (s) => {
2010
+ const a = e.findIndex((o) => o.id === s);
2011
+ a > -1 && (e[a].destroy(), e.splice(a, 1));
2012
+ },
2013
+ destroyAll: () => {
2014
+ e.forEach((s) => s.destroy()), e.splice(0, e.length);
2015
+ },
2016
+ getAllInstances: () => [...e]
2017
+ };
2018
+ }, Zo = { class: "zh-map-box" }, Ao = /* @__PURE__ */ Ue({
2019
+ __name: "Map",
2020
+ props: {
2021
+ zoom: { default: U.default },
2022
+ center: { default: co },
2023
+ layerType: { default: "vector" },
2024
+ showGreenLayer: { type: Boolean, default: !1 },
2025
+ showScale: { type: Boolean, default: !0 },
2026
+ scaleLineUnit: { default: "metric" },
2027
+ mapMoveEnd: { type: Function, default: () => {
2028
+ } },
2029
+ lineDrawEnd: {},
2030
+ areaDrawEnd: { type: Function, default: () => {
2031
+ } },
2032
+ selectShip: { type: Function, default: () => {
2033
+ } },
2034
+ selectPort: { type: Function, default: () => {
2035
+ } }
2036
+ },
2037
+ setup(e, { expose: l }) {
2038
+ const n = ne(), s = ne(), a = Do(), o = ne(), f = e, x = ne({
2039
+ getInstall() {
2040
+ }
2041
+ });
2042
+ return Gt(() => {
2043
+ var t;
2044
+ o.value = a.createInstance(n.value, f), x.value = o.value.methods, (t = s.value) == null || t.setScaleLine(o.value.map, f.scaleLineUnit);
2045
+ }), Wt(() => {
2046
+ var t, r;
2047
+ a.destroyInstance((t = o == null ? void 0 : o.value) == null ? void 0 : t.id), (r = o.value) == null || r.destroy();
2048
+ }), l({
2049
+ getZoom: () => {
2050
+ var t;
2051
+ return (t = o.value) == null ? void 0 : t.methods.getZoom();
2052
+ },
2053
+ setZoom: (t) => {
2054
+ var r;
2055
+ return (r = o.value) == null ? void 0 : r.methods.setZoom(t);
2056
+ },
2057
+ getInstall: () => {
2058
+ var t;
2059
+ return (t = o.value) == null ? void 0 : t.methods.getInstall();
2060
+ },
2061
+ getView: () => {
2062
+ var t;
2063
+ return (t = o.value) == null ? void 0 : t.methods.getView();
2064
+ },
2065
+ setCenter: (t, r) => {
2066
+ var y;
2067
+ return (y = o.value) == null ? void 0 : y.methods.setCenter(t, r);
2068
+ },
2069
+ getSize: () => {
2070
+ var t;
2071
+ return (t = o.value) == null ? void 0 : t.methods.getSize();
2072
+ },
2073
+ getCenter: (t, r) => {
2074
+ var y;
2075
+ return (y = o.value) == null ? void 0 : y.methods.getCenter();
2076
+ },
2077
+ layer: {
2078
+ setGreenTileVisible: (t) => {
2079
+ var r;
2080
+ return (r = o.value) == null ? void 0 : r.methods.layer.setGreenTileVisible(t);
2081
+ },
2082
+ getGreenTileVisible: () => {
2083
+ var t;
2084
+ return (t = o.value) == null ? void 0 : t.methods.layer.getGreenTileVisible();
2085
+ },
2086
+ getShowLayerType: () => {
2087
+ var t;
2088
+ return (t = o.value) == null ? void 0 : t.methods.layer.getShowLayerType();
2089
+ },
2090
+ setShowLayerType: (t) => {
2091
+ var r;
2092
+ return (r = o.value) == null ? void 0 : r.methods.layer.setShowLayerType(t);
2093
+ }
2094
+ },
2095
+ ship: {
2096
+ render: (...t) => {
2097
+ var r;
2098
+ return (r = o.value) == null ? void 0 : r.methods.ship.render(...t);
2099
+ },
2100
+ selected: (...t) => {
2101
+ var r;
2102
+ return (r = o.value) == null ? void 0 : r.methods.ship.selected(...t);
2103
+ },
2104
+ filter: (...t) => {
2105
+ var r;
2106
+ return (r = o.value) == null ? void 0 : r.methods.ship.filter(...t);
2107
+ },
2108
+ blinking: (...t) => {
2109
+ var r;
2110
+ return (r = o.value) == null ? void 0 : r.methods.ship.blinking(...t);
2111
+ },
2112
+ clear: () => {
2113
+ var t;
2114
+ return (t = o.value) == null ? void 0 : t.methods.ship.clear();
2115
+ }
2116
+ },
2117
+ track: {
2118
+ render: (...t) => {
2119
+ var r;
2120
+ return (r = o.value) == null ? void 0 : r.methods.track.render(...t);
2121
+ },
2122
+ remove: (...t) => {
2123
+ var r;
2124
+ return (r = o.value) == null ? void 0 : r.methods.track.remove(...t);
2125
+ },
2126
+ play: (...t) => {
2127
+ var r;
2128
+ return (r = o.value) == null ? void 0 : r.methods.track.play(...t);
2129
+ },
2130
+ setCenter: (...t) => {
2131
+ var r;
2132
+ return (r = o.value) == null ? void 0 : r.methods.track.setCenter(...t);
2133
+ },
2134
+ close: (...t) => {
2135
+ var r;
2136
+ return (r = o.value) == null ? void 0 : r.methods.track.close(...t);
2137
+ },
2138
+ getLength: (...t) => {
2139
+ var r;
2140
+ return (r = o.value) == null ? void 0 : r.methods.track.getLength(...t);
2141
+ }
2142
+ },
2143
+ carTrack: {
2144
+ location: (...t) => {
2145
+ var r;
2146
+ return (r = o.value) == null ? void 0 : r.methods.carTrack.location(...t);
2147
+ },
2148
+ remove: (...t) => {
2149
+ var r;
2150
+ return (r = o.value) == null ? void 0 : r.methods.carTrack.remove(...t);
2151
+ },
2152
+ renderTrack: (...t) => {
2153
+ var r;
2154
+ return (r = o.value) == null ? void 0 : r.methods.carTrack.renderTrack(...t);
2155
+ },
2156
+ setCenter: (...t) => {
2157
+ var r;
2158
+ return (r = o.value) == null ? void 0 : r.methods.carTrack.setCenter(...t);
2159
+ },
2160
+ closeTrack: () => {
2161
+ var t;
2162
+ return (t = o.value) == null ? void 0 : t.methods.carTrack.closeTrack();
2163
+ },
2164
+ playTrack: (...t) => {
2165
+ var r;
2166
+ return (r = o.value) == null ? void 0 : r.methods.carTrack.playTrack(...t);
2167
+ }
2168
+ },
2169
+ port: {
2170
+ render: (t, r) => {
2171
+ var y;
2172
+ return (y = o.value) == null ? void 0 : y.methods.port.render(t, r);
2173
+ },
2174
+ clear: () => {
2175
+ var t;
2176
+ return (t = o.value) == null ? void 0 : t.methods.port.clear();
2177
+ },
2178
+ selected: (t) => {
2179
+ var r;
2180
+ return (r = o.value) == null ? void 0 : r.methods.port.selected(t);
2181
+ }
2182
+ },
2183
+ position: {
2184
+ render: (...t) => {
2185
+ var r;
2186
+ return (r = o.value) == null ? void 0 : r.methods.position.render(...t);
2187
+ },
2188
+ selected: (...t) => {
2189
+ var r;
2190
+ return (r = o.value) == null ? void 0 : r.methods.position.selected(...t);
2191
+ },
2192
+ clearSelected: (...t) => {
2193
+ var r;
2194
+ return (r = o.value) == null ? void 0 : r.methods.position.clearSelected(...t);
2195
+ },
2196
+ clear: () => {
2197
+ var t;
2198
+ return (t = o.value) == null ? void 0 : t.methods.position.clear();
2199
+ }
2200
+ },
2201
+ drawLine: {
2202
+ open: () => {
2203
+ var t;
2204
+ return (t = o.value) == null ? void 0 : t.methods.drawLine.open();
2205
+ },
2206
+ close: () => {
2207
+ var t;
2208
+ return (t = o.value) == null ? void 0 : t.methods.drawLine.close();
2209
+ },
2210
+ deleteLine: (t) => {
2211
+ var r;
2212
+ return (r = o.value) == null ? void 0 : r.methods.drawLine.deleteLine(t);
2213
+ },
2214
+ setUnit: (t) => {
2215
+ var r;
2216
+ return (r = o.value) == null ? void 0 : r.methods.drawLine.setUnit(t);
2217
+ },
2218
+ getState: () => {
2219
+ var t;
2220
+ return (t = o.value) == null ? void 0 : t.methods.drawLine.getState();
2221
+ }
2222
+ },
2223
+ drawPolygon: {
2224
+ open: () => {
2225
+ var t;
2226
+ return (t = o.value) == null ? void 0 : t.methods.drawPolygon.open();
2227
+ },
2228
+ close: () => {
2229
+ var t;
2230
+ return (t = o.value) == null ? void 0 : t.methods.drawPolygon.close();
2231
+ },
2232
+ reset: () => {
2233
+ var t;
2234
+ return (t = o.value) == null ? void 0 : t.methods.drawPolygon.reset();
2235
+ }
2236
+ },
2237
+ // 子模块
2238
+ utils: {
2239
+ getCalculateExtent: (...t) => {
2240
+ var r;
2241
+ return (r = o.value) == null ? void 0 : r.methods.utils.getCalculateExtent(...t);
2242
+ },
2243
+ convertSixHundredThousandToLatLng: (...t) => {
2244
+ var r;
2245
+ return (r = o.value) == null ? void 0 : r.methods.utils.convertSixHundredThousandToLatLng(...t);
2246
+ },
2247
+ calculateCirclePoints: (t, r) => {
2248
+ var y;
2249
+ return (y = o.value) == null ? void 0 : y.methods.utils.calculateCirclePoints(t, r);
2250
+ }
2251
+ }
2252
+ }), (t, r) => (Ie(), et("div", Zo, [
2253
+ _e("div", {
2254
+ id: "map",
2255
+ ref_key: "zhMapRef",
2256
+ ref: n,
2257
+ class: "zh-map"
2258
+ }, null, 512),
2259
+ Qe(ro, {
2260
+ ref_key: "scaleLineRef",
2261
+ ref: s
2262
+ }, null, 512),
2263
+ Qe(io, {
2264
+ ref: "zoomControlRef",
2265
+ "map-instance": o.value
2266
+ }, null, 8, ["map-instance"])
2267
+ ]));
2268
+ }
2269
+ }), Go = /* @__PURE__ */ ot(Ao, [["__scopeId", "data-v-1fa3c6fd"]]), Xo = to(Go);
2270
+ export {
2271
+ Xo as Z
2272
+ };