zhihao-ui 1.3.3 → 1.3.4-5.-alpha.2

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 (99) hide show
  1. package/dist/es/{BaseInfo-BqJWKOdd.js → BaseInfo-Cu3ME-K_.js} +1 -1
  2. package/dist/es/{BaseItem-BQbkTxt9.js → BaseItem-Co7KlYD6.js} +3 -3
  3. package/dist/es/{Button-1UUC8v6b.js → Button-Dp3Eoz3O.js} +2 -2
  4. package/dist/es/{DatePicker-ByP3ZkhE.js → DatePicker-BilQVlgi.js} +3 -3
  5. package/dist/es/{DetailHeader-CnZCthjX.js → DetailHeader-DTHE-pQa.js} +3 -3
  6. package/dist/es/{DetailSubTitle-COQCdb8X.js → DetailSubTitle-BG-q2NNN.js} +2 -2
  7. package/dist/es/{Dialog-DFQIVnQP.js → Dialog-B0N_UsO3.js} +3 -3
  8. package/dist/es/{DiyDataTable-D0gTwPB4.js → DiyDataTable-BQaaClFf.js} +4 -4
  9. package/dist/es/{EditInfoPair-CZpQKhX6.js → EditInfoPair-DwrwCanm.js} +3 -3
  10. package/dist/es/{FileWrapper-C9Cqt-L8.js → FileWrapper-BDK8YvRB.js} +4 -4
  11. package/dist/es/{Grid-CfwiS54k.js → Grid-pVjqXcmJ.js} +2 -2
  12. package/dist/es/{InfoPair-ZKRxEmIC.js → InfoPair-lu2zDhpQ.js} +3 -3
  13. package/dist/es/{Input-CloA0e6h.js → Input-Du4ztfNG.js} +3 -3
  14. package/dist/es/{Loading-BXtzvylk.js → Loading-Dc9138dn.js} +2 -2
  15. package/dist/es/Map-BsyX-AAm.js +2273 -0
  16. package/dist/es/{MessageBox-BNOuww77.js → MessageBox-CJMqwEqr.js} +2 -2
  17. package/dist/es/{MoneyInput-CuHL7bEc.js → MoneyInput-CJxSKPIk.js} +8 -8
  18. package/dist/es/{PageHeadPanel-BroYHTD8.js → PageHeadPanel-BChW8Tal.js} +2 -2
  19. package/dist/es/{Table-DFGzUqS3.js → Table-CzNjEPnP.js} +5 -5
  20. package/dist/es/{ToolTips-BBi5iPOb.js → ToolTips-Y6yG2q7L.js} +6 -6
  21. package/dist/es/index.js +22 -22
  22. package/dist/es/{utils-BbOeFn3W.js → utils-Co2iJhr8.js} +3 -3
  23. package/dist/es/{vendor-D-B7bNnH.js → vendor-Crdostgq.js} +8448 -8041
  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 +119 -0
  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.d.ts +32 -0
  35. package/dist/types/components/Map/enum/car.d.ts +5 -0
  36. package/dist/types/components/Map/enum/device.d.ts +8 -0
  37. package/dist/types/components/Map/enum/index.d.ts +5 -0
  38. package/dist/types/components/Map/enum/openLayers.d.ts +10 -0
  39. package/dist/types/components/Map/enum/ship.d.ts +50 -0
  40. package/dist/types/components/Map/function/carTrack.d.ts +7 -14
  41. package/dist/types/components/Map/function/drawLine.d.ts +4 -4
  42. package/dist/types/components/Map/function/drawPolygon.d.ts +5 -2
  43. package/dist/types/components/Map/function/event.d.ts +9 -0
  44. package/dist/types/components/Map/function/layers.d.ts +8 -5
  45. package/dist/types/components/Map/function/map.d.ts +14 -10
  46. package/dist/types/components/Map/function/port.d.ts +7 -6
  47. package/dist/types/components/Map/function/position.d.ts +8 -0
  48. package/dist/types/components/Map/function/props.d.ts +5 -2
  49. package/dist/types/components/Map/function/ship/index.d.ts +13 -29
  50. package/dist/types/components/Map/function/ship/style.d.ts +13 -6
  51. package/dist/types/components/Map/function/shipTrack.d.ts +14 -20
  52. package/dist/types/components/Map/index.d.ts +373 -0
  53. package/dist/types/components/Map/interface/common/BaseEntity.d.ts +29 -0
  54. package/dist/types/components/Map/interface/common/page.d.ts +34 -0
  55. package/dist/types/components/Map/interface/entity/dashboard.d.ts +16 -0
  56. package/dist/types/components/Map/interface/entity/map.d.ts +36 -0
  57. package/dist/types/components/Map/interface/entity/point.d.ts +10 -0
  58. package/dist/types/components/Map/interface/entity/queryLicenseResponse.d.ts +86 -0
  59. package/dist/types/components/Map/interface/entity/render.d.ts +57 -0
  60. package/dist/types/components/Map/interface/entity/ship.d.ts +361 -0
  61. package/dist/types/components/Map/interface/entity/shipInfoVo.d.ts +210 -0
  62. package/dist/types/components/Map/interface/entity/shipMapData.d.ts +27 -0
  63. package/dist/types/components/Map/interface/entity/shipMarker.d.ts +8 -0
  64. package/dist/types/components/Map/interface/entity/shipTrack.d.ts +56 -0
  65. package/dist/types/components/Map/interface/entity/vehicle.d.ts +345 -0
  66. package/dist/types/components/Map/interface/index.d.ts +1 -0
  67. package/dist/types/components/Map/interface/mapProps.d.ts +7 -7
  68. package/dist/types/components/Map/interface/position.d.ts +7 -0
  69. package/dist/types/components/Map/interface/shipInfoVo.d.ts +2 -0
  70. package/dist/types/components/Map/interface/vo/vehicleVo.d.ts +20 -0
  71. package/dist/types/components/Map/meta/index.d.ts +5 -0
  72. package/dist/types/components/Map/render/canvasRender/canvasRender.d.ts +15 -0
  73. package/dist/types/components/Map/render/canvasRender/geometry.d.ts +22 -0
  74. package/dist/types/components/Map/render/canvasRender/renderCustomOverlay.d.ts +5 -0
  75. package/dist/types/components/Map/render/canvasRender/renderPointStyle.d.ts +10 -0
  76. package/dist/types/components/Map/render/canvasRender/renderShipStyle.d.ts +5 -0
  77. package/dist/types/components/Map/render/canvasRender/renderTrackStyle.d.ts +12 -0
  78. package/dist/types/components/Map/render/canvasRender/renderTruckStyle.d.ts +3 -0
  79. package/dist/types/components/Map/render/drawPolygon.d.ts +10 -0
  80. package/dist/types/components/Map/render/renderDashboard.d.ts +12 -0
  81. package/dist/types/components/Map/render/renderMarker.d.ts +7 -0
  82. package/dist/types/components/Map/render/renderPoint.d.ts +80 -0
  83. package/dist/types/components/Map/render/renderShip.d.ts +20 -0
  84. package/dist/types/components/Map/render/renderTrack.d.ts +12 -0
  85. package/dist/types/components/Map/render/renderTruck.d.ts +10 -0
  86. package/dist/types/components/Map/useMap.d.ts +17 -0
  87. package/dist/types/components/Map/utils/common.d.ts +27 -0
  88. package/dist/types/components/Map/utils/cursor.d.ts +3 -2
  89. package/dist/types/components/Map/utils/events.d.ts +4 -2
  90. package/dist/types/components/Map/utils/format.d.ts +10 -0
  91. package/dist/types/components/Map/{function → utils}/shipOverlay.d.ts +4 -4
  92. package/dist/types/components/Map/utils/store.d.ts +32 -0
  93. package/dist/types/components/Map/utils/track.d.ts +44 -0
  94. package/dist/types/components/Map/utils/transform.d.ts +44 -0
  95. package/dist/umd/index.css +1 -1
  96. package/dist/umd/index.umd.cjs +91 -103
  97. package/package.json +1 -1
  98. package/dist/es/Map-Ce0s7g5Z.js +0 -1700
  99. package/dist/types/components/Map/utils/util.d.ts +0 -42
@@ -0,0 +1,2273 @@
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
+ }), w = document.getElementById("scale-line-container");
14
+ w && (o.setTarget(w), 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: w } = l.mapInstance.methods;
32
+ if (!w()) return;
33
+ const t = o();
34
+ t && a(t + 1);
35
+ }, s = () => {
36
+ const { setZoom: a, getZoom: o, getInstall: w } = l.mapInstance.methods;
37
+ if (!w()) 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
+ }, w = () => {
85
+ var k;
86
+ const g = (k = n()) == null ? void 0 : k.getCenter();
87
+ return Xt(g);
88
+ }, h = () => {
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: w,
156
+ getSize: h,
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 w = document.createElement("div"), h = new pe({
272
+ element: w,
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 f = V.pop(), p = l.get(f);
281
+ p && ((u = p.getSource()) == null || u.clear(), e == null || e.removeLayer(p), l.delete(f), delete n[f]);
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 f = [];
293
+ const p = Math.max(1, Math.floor(u.length / P));
294
+ return f = 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
+ }), f.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, f, p = "ship", v = 200) => {
306
+ if (!e || JSON.stringify(n[c]) === JSON.stringify(u) && s === c || (u = u == null ? void 0 : u.reverse(), h && p === "ship" && (e != null && e.getOverlays().getArray().includes(h) || e.addOverlay(h)), (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 = f || 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
+ }, x = (c) => {
323
+ l.forEach((u, f) => {
324
+ var v;
325
+ const p = f === 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 x(c);
335
+ const u = G || "", f = n[c] || [];
336
+ if (!(f && f.length > 1)) return [];
337
+ let p = [];
338
+ p = M(c, f);
339
+ const v = p.map((D) => D.centerPoint);
340
+ p.length >= 2 && await F(c, v, u);
341
+ }, F = (c, u, f) => {
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(f)), m = D;
345
+ else {
346
+ const R = new le({ geometry: p });
347
+ R.setId(c), R.set("type", "line"), R.setStyle(Z(f)), 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, f) => {
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 = f == null ? void 0 : f.coordinate;
361
+ D && (w.querySelector(".popup-content"), w.innerHTML = v, h == null || h.setPosition(D));
362
+ } else
363
+ h && h.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 f = 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
+ f[0].distance = 0;
420
+ for (let S = 1; S < f.length; S++) {
421
+ const A = f[S - 1].pixel, Y = f[S].pixel, J = Y[0] - A[0], E = Y[1] - A[1];
422
+ p += Math.sqrt(J * J + E * E), f[S].distance = p;
423
+ }
424
+ const v = f.filter(
425
+ (S, A) => A === 0 || A === f.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
+ f,
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 f = 1; f < c.length; f++) {
457
+ const p = c[f - 1], v = c[f];
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 f = O(u);
475
+ console.log("simplifiedPoints", f.length, "list", u.length);
476
+ const p = f.map((S) => de(S)), v = f.map((S) => Mt(S, G)), D = Pt(c, f, 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 f = [
485
+ ...Tt(c, G)
486
+ ];
487
+ return (c.index === 0 || c.index === n[c.id].length - 1) && (f = [...Ft(c)], u.set("type", "track_begin")), c.state !== void 0 && c.state !== null && (f = [...Et(c)], u.set("type", "track_icon")), u.setStyle(f), u;
488
+ }, Be = window.devicePixelRatio || 1, Me = /* @__PURE__ */ new Map();
489
+ let ge = null, Xe = null;
490
+ function Ct(c, u) {
491
+ const f = `${c}`;
492
+ if (Me.has(f))
493
+ return Me.get(f);
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(f, De), De;
516
+ }
517
+ const Mt = (c, u) => {
518
+ const f = 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: f,
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((f) => {
538
+ f.get("type") !== "line" && u.removeFeature(f);
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", f = "#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 ? f : ""
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, f, p) => {
571
+ const v = u || [], D = u.length;
572
+ D || (v.push(f[0]), v.push(f[f.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 = f[E].centerPoint;
579
+ else {
580
+ const B = f[Math.floor(E)], j = f[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(), f = (D = l == null ? void 0 : l.get(c)) == null ? void 0 : D.getSource(), p = m || (c ? f == null ? void 0 : f.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 f;
647
+ (f = u.getSource()) == null || f.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 f = e.getOverlays().getArray();
655
+ for (let p = 0; p < f.length; ) {
656
+ const v = f[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 f = {
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 f.length = go(D, u) || "--", f;
668
+ }, $t = (c, u) => {
669
+ Vt(String(c), u);
670
+ }, Vt = (c, u) => {
671
+ const f = n[String(c)], p = f == null ? void 0 : f.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 f = Number(50 * u), p = ((E = c.frameState) == null ? void 0 : E.time) ?? Date.now(), v = p - C;
684
+ if (d = (d + f * 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 f = y.getGeometry();
719
+ g = f ? f.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, f) => {
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), f);
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 w;
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 && ((w = e.colors) == null ? void 0 : w.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, w = 20, t = 1 / (e == null ? void 0 : e.getView().getResolution()), r = s * t / o, y = a * t / w, 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: w } = e.getProperties(), h = ((w == null ? void 0 : w.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: h * 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: w } = e, h = Qe({
996
+ setup() {
997
+ return mo({
998
+ position: [n + 2e-3, s + 2e-3],
999
+ selected: a,
1000
+ name: w,
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(h, 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, w = Ke;
1041
+ if (!w) return "";
1042
+ o.width = 0, o.height = 0;
1043
+ const h = 2, t = 4, r = 16, y = window.devicePixelRatio || 1, g = "500 12px Arial", k = "12px map-iconfont";
1044
+ w.font = g;
1045
+ const C = w.measureText(e).width;
1046
+ w.font = k;
1047
+ const z = l.map((Z) => ({ width: w.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 = h + 14 + h * 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 + h, o.width = Math.round(V * y), o.height = Math.round(X * y), w.scale(y, y), w.clearRect(0, 0, V, X), w.beginPath(), w.moveTo(G, q), w.lineTo(K, N), w.strokeStyle = "#FFF", w.lineWidth = 1, w.stroke(), w.fillStyle = "#FFF", w.fillRect(M, i, P, b), w.font = g, w.textBaseline = "middle";
1070
+ const T = i + h / 2 + b / 2;
1071
+ w.strokeStyle = "#ffffff", w.lineWidth = 1, w.strokeText(e, M + t, T), w.fillStyle = "#000000", w.fillText(e, M + t, T), w.font = k, w.fillStyle = "#3370ff";
1072
+ let x = M + t + C + s;
1073
+ const L = i + b / 2;
1074
+ l.length > 0 && l.forEach((Z, W) => {
1075
+ w.fillText(be(Z), x, L), x += 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, selected: a } = e.getProperties(), o = l !== 1 ? Co() : "right-top", w = Lo(n, s, o);
1082
+ let h = [0, 0];
1083
+ switch (o) {
1084
+ case "right-top":
1085
+ h = [0, 1];
1086
+ break;
1087
+ case "right-middle":
1088
+ h = [0, 0.5];
1089
+ break;
1090
+ case "right-bottom":
1091
+ h = [0, 0];
1092
+ break;
1093
+ case "left-top":
1094
+ h = [1, 1];
1095
+ break;
1096
+ case "left-middle":
1097
+ h = [1, 0.5];
1098
+ break;
1099
+ case "left-bottom":
1100
+ h = [1, 0];
1101
+ break;
1102
+ }
1103
+ return new _({
1104
+ image: new Ce({
1105
+ src: w,
1106
+ anchor: h,
1107
+ displacement: [0, 0],
1108
+ scale: 1 / Mo,
1109
+ anchorXUnits: "fraction",
1110
+ anchorYUnits: "fraction"
1111
+ }),
1112
+ zIndex: a ? 100 : 10
1113
+ });
1114
+ }, To = (e) => {
1115
+ let l = null, n = null;
1116
+ const s = new ue(), a = new _t({
1117
+ source: s,
1118
+ className: "zh-map--ship-layer",
1119
+ renderBuffer: 300,
1120
+ zIndex: 101,
1121
+ properties: { layerType: ee.SHIP }
1122
+ }), o = new ue(), w = new he({
1123
+ source: o,
1124
+ className: "zh-map--ship-label-layer",
1125
+ zIndex: 102,
1126
+ updateWhileInteracting: !1,
1127
+ updateWhileAnimating: !1,
1128
+ declutter: !0
1129
+ }), h = new ue(), t = new he({
1130
+ source: h,
1131
+ className: "zh-map--ship-selected-layer",
1132
+ zIndex: 999
1133
+ });
1134
+ e == null || e.addLayer(a), e == null || e.addLayer(w), e == null || e.addLayer(t);
1135
+ let r = null, y = "", g = {}, k = {};
1136
+ const $ = (i) => {
1137
+ if (!i || !e) return;
1138
+ const T = (n == null ? void 0 : n.id) || (l == null ? void 0 : l.get("id"));
1139
+ if (n) {
1140
+ const x = i.filter((L) => L.id === T);
1141
+ x.length === 0 ? i.push(n) : n = x[0];
1142
+ }
1143
+ m(), M(i), z();
1144
+ }, C = (i) => {
1145
+ var O;
1146
+ const T = (n == null ? void 0 : n.id) || (l == null ? void 0 : l.get("id")), x = 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({
1147
+ geometry: new te(x),
1148
+ // 船舶数据
1149
+ shipData: i,
1150
+ id: i.id,
1151
+ name: i.cnname || i.enname || i.name || i.id || "未命名船舶",
1152
+ selected: i.id === T,
1153
+ // 图标
1154
+ rightIcons: gt(i),
1155
+ // 船舶颜色
1156
+ color: Z,
1157
+ // 船艏向的方向
1158
+ direct: W,
1159
+ // 高亮
1160
+ isHighlight: !1
1161
+ });
1162
+ return H.set("clickGeometry", new Jt(x)), H;
1163
+ }, z = () => {
1164
+ if (n && e && n) {
1165
+ h.getFeatures().length > 0 && h.clear();
1166
+ const i = ie([n == null ? void 0 : n.lon, n == null ? void 0 : n.lat]), T = new le({
1167
+ geometry: new te(i),
1168
+ id: n.id
1169
+ });
1170
+ T.setStyle(bo(e, n)), h.addFeature(T);
1171
+ }
1172
+ }, d = (i) => {
1173
+ if (i === "start") {
1174
+ const T = () => {
1175
+ const x = h.getFeatures();
1176
+ s.getFeatures().forEach((L) => {
1177
+ var Z, W;
1178
+ const F = Ee(e, L);
1179
+ if (L.setStyle(F), L.get("id") === (n == null ? void 0 : n.id) && x && x[0]) {
1180
+ const H = x[0], O = H == null ? void 0 : H.getStyle();
1181
+ if (O && (O != null && O.getImage())) {
1182
+ const re = (Z = F.getImage()) == null ? void 0 : Z.getScale();
1183
+ re && ((W = O.getImage()) == null || W.setScale(re));
1184
+ }
1185
+ }
1186
+ }), r = requestAnimationFrame(T);
1187
+ };
1188
+ T();
1189
+ }
1190
+ i === "end" && r && (cancelAnimationFrame(r), r = null);
1191
+ }, m = () => {
1192
+ e && s && (P(), s.clear(), o.clear(), h.clear(), d("end"));
1193
+ }, P = (i) => {
1194
+ const T = e.getOverlays().getArray().filter((x) => x.get("class") == "zh-map-ship-overlay");
1195
+ if (T && T.length > 0) {
1196
+ for (let x = 0; x < T.length; x++)
1197
+ if (T[x].get("class") !== "ship-overlay-selected") {
1198
+ const L = T[x];
1199
+ console.log("overlay---", L), L.setPosition(void 0), e.removeOverlay(L), L.dispose();
1200
+ }
1201
+ }
1202
+ }, b = (i, T) => {
1203
+ g = i, k = T;
1204
+ const x = e.getOverlays().getArray(), L = s.getFeatures();
1205
+ for (const F in g) {
1206
+ const Z = g[F], W = x.find((O) => (O == null ? void 0 : O.getId()) === "label-" + F), H = L.find((O) => F === O.get("id"));
1207
+ if (W && H) {
1208
+ const O = T[F].blinkColors || [], { shipData: re, name: ce, color: de } = H.getProperties();
1209
+ 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)));
1210
+ const Be = {
1211
+ ...re,
1212
+ blinking: Z,
1213
+ blinkingColors: O || [],
1214
+ name: ce + "(" + T[F].shipState + ")"
1215
+ }, Me = W.getElement(), ge = kt(Be);
1216
+ Me && Me !== ge && W.setElement(ge);
1217
+ }
1218
+ }
1219
+ }, V = (i) => {
1220
+ if (!e) return;
1221
+ const T = s.getFeatures(), x = o.getFeatures(), L = l ? l.get("id") : "", F = T.filter((O) => O.get("id") !== L), Z = x == null ? void 0 : x.filter((O) => O.get("id") !== L), W = /* @__PURE__ */ new Map();
1222
+ i.forEach((O) => {
1223
+ W.set(O.id, !0);
1224
+ });
1225
+ const H = e.getOverlays().getArray();
1226
+ F.forEach((O) => {
1227
+ const re = O.get("id");
1228
+ if (!W.has(re))
1229
+ O.setStyle([]);
1230
+ else {
1231
+ const de = O.getStyle();
1232
+ (de == null ? void 0 : de.length) == 0 && O.setStyle(Ee(e, O));
1233
+ }
1234
+ const ce = H.find((de) => de.getId() === "label-" + re);
1235
+ ce && ce.setPosition(void 0);
1236
+ }), Z.forEach((O) => {
1237
+ const re = O.get("id");
1238
+ if (!W.has(re))
1239
+ O.setStyle([]);
1240
+ else {
1241
+ const ce = O.getStyle();
1242
+ (ce == null ? void 0 : ce.length) == 0 && O.setStyle(ft(O, i.length));
1243
+ }
1244
+ });
1245
+ }, X = (i) => {
1246
+ if (i) {
1247
+ console.log("选中", i);
1248
+ const T = s.getFeatures().find((L) => L.get("id") === i.id), x = o.getFeatures().find((L) => L.get("id") === i.id);
1249
+ T && (l = T), x && x.set("selected", !0), n = i, z();
1250
+ } else
1251
+ console.log("取消选中"), n = null, l = null, K();
1252
+ }, G = Qt((i, T, x) => {
1253
+ try {
1254
+ if (i) {
1255
+ const L = i.get("shipData"), F = i.get("id");
1256
+ if (e.getTargetElement().style.cursor = F ? "pointer" : "", T === "click" && (X(L), x && x(F)), T === "hover") {
1257
+ y && y !== F && q(), y = F;
1258
+ const Z = s.getFeatures().find((W) => W.get("id") === y);
1259
+ Z == null || Z.set("isHighlight", !0), Z == null || Z.setStyle(Ee(e, Z));
1260
+ }
1261
+ } else
1262
+ e.getTargetElement().style.cursor = "", q();
1263
+ } catch (L) {
1264
+ console.log("handleShipMapEvent", L);
1265
+ }
1266
+ }, 10), q = () => {
1267
+ const i = y ? s.getFeatures().find((T) => T.get("id") === y) : null;
1268
+ y = null, i == null || i.set("isHighlight", !1), i == null || i.setStyle(Ee(e, i));
1269
+ }, K = () => {
1270
+ try {
1271
+ h.clear();
1272
+ } catch (i) {
1273
+ console.log(i);
1274
+ }
1275
+ }, N = (i, T) => {
1276
+ const x = ie([i == null ? void 0 : i.lon, i == null ? void 0 : i.lat]), L = new le({
1277
+ geometry: new te(x),
1278
+ name: i.cnname || i.enname || i.name || i.id || "未命名船舶",
1279
+ // 图标
1280
+ rightIcons: gt(i),
1281
+ selected: (i == null ? void 0 : i.id) === (n == null ? void 0 : n.id),
1282
+ shipData: i
1283
+ });
1284
+ L.set("id", i.id);
1285
+ const F = ft(L, T);
1286
+ return L.setStyle(F), L;
1287
+ }, M = (i) => {
1288
+ const T = e.getView().getZoom();
1289
+ i.forEach((x) => {
1290
+ const L = C(x);
1291
+ if (L.setStyle(Ee(e, L)), s.addFeature(L), (n == null ? void 0 : n.id) == x.id || T && T >= U.shipModelMin)
1292
+ if (g[x.id]) {
1293
+ if (x.id && k[x == null ? void 0 : x.id]) {
1294
+ const F = k[x == null ? void 0 : x.id] || {}, Z = (F == null ? void 0 : F.blinkColors) || [], W = (F == null ? void 0 : F.shipState) || "", H = (x.cnname || x.enname || x.name || x.id || "未命名船舶") + "(" + W + ")", O = {
1295
+ ...x,
1296
+ name: H,
1297
+ blinking: g[x.id],
1298
+ blinkingColors: Z || []
1299
+ };
1300
+ po(e, O);
1301
+ }
1302
+ } else {
1303
+ const F = N(x, i.length);
1304
+ o.addFeature(F);
1305
+ }
1306
+ });
1307
+ };
1308
+ return {
1309
+ render: $,
1310
+ selected: X,
1311
+ filter: V,
1312
+ blinking: b,
1313
+ clear: m,
1314
+ handleShipMapEvent: G,
1315
+ changeShipScale: d
1316
+ };
1317
+ }, Eo = (e) => {
1318
+ const l = () => e == null ? void 0 : e.getLayers(), n = ne("vector"), s = () => n.value, a = (t) => {
1319
+ n.value = t;
1320
+ const r = l();
1321
+ r && (r == null || r.getArray().forEach((y) => {
1322
+ (y.className_ === "vector" || y.className_ === "satellite") && y.setVisible(y.className_ === t);
1323
+ }));
1324
+ }, o = ne(!1);
1325
+ return {
1326
+ getLayers: l,
1327
+ getGreenTileVisible: () => o.value,
1328
+ setGreenTileVisible: (t) => {
1329
+ if (t !== o.value) {
1330
+ if (t) {
1331
+ const r = l();
1332
+ if (!r.getArray().find((g) => g.className_ === "greenTile")) {
1333
+ const g = new Pe({
1334
+ source: new Fe({ url: xe.greenTile }),
1335
+ visible: t,
1336
+ zIndex: 2,
1337
+ className: "greenTile"
1338
+ });
1339
+ r.push(g);
1340
+ }
1341
+ } else {
1342
+ const r = l(), y = r.getArray().find((g) => g.className_ === "greenTile");
1343
+ y && r.remove(y);
1344
+ }
1345
+ o.value = t;
1346
+ }
1347
+ },
1348
+ getShowLayerType: s,
1349
+ setShowLayerType: a
1350
+ };
1351
+ }, Po = () => {
1352
+ const e = ne();
1353
+ return {
1354
+ setProps: (s) => {
1355
+ e.value = s;
1356
+ },
1357
+ getProps: () => e.value
1358
+ };
1359
+ }, Fo = (e) => {
1360
+ const l = "zh-map-location-layer";
1361
+ let n, s, a = null, o = null;
1362
+ const w = (C) => {
1363
+ if (!(!C || C.length === 0)) {
1364
+ if (s || (s = new ue()), s.clear(), o) {
1365
+ const z = C.find((d) => d.id === o.id);
1366
+ z ? o = z : C.push(o);
1367
+ }
1368
+ C.forEach((z) => {
1369
+ h(z);
1370
+ }), n || (n = new he({
1371
+ className: l,
1372
+ source: s,
1373
+ zIndex: 100
1374
+ }), e == null || e.addLayer(n));
1375
+ }
1376
+ }, h = (C) => {
1377
+ const z = e == null ? void 0 : e.getView().getZoom(), [d, m] = C.latLon.split(","), P = new le({
1378
+ geometry: new te(ie([Number(d), Number(m)]))
1379
+ });
1380
+ P.setStyle(t(C, z, C.id === (o == null ? void 0 : o.id))), P.set("loactionData", C), s.addFeature(P);
1381
+ }, t = (C, z, d) => {
1382
+ const m = {
1383
+ image: new Ce({
1384
+ src: d && C.selectedPath || C.defaultPath,
1385
+ scale: 0.5 * z / 10
1386
+ })
1387
+ };
1388
+ return C.name && (m.text = new Se({
1389
+ text: C.name,
1390
+ font: "12px sans-serif",
1391
+ fill: new oe({
1392
+ color: "#000000"
1393
+ }),
1394
+ backgroundFill: new oe({
1395
+ color: "#FFFFFF"
1396
+ }),
1397
+ offsetY: 30
1398
+ })), new _(m);
1399
+ }, r = () => {
1400
+ if (a) {
1401
+ const C = a.get("loactionData").id;
1402
+ s.getFeatures().forEach((z) => {
1403
+ z.get("loactionData").id !== C && s.removeFeature(z);
1404
+ });
1405
+ } else
1406
+ s.clear();
1407
+ }, y = () => {
1408
+ var m;
1409
+ const C = a.get("loactionData"), z = (m = e == null ? void 0 : e.getView()) == null ? void 0 : m.getZoom();
1410
+ s.getFeatures().forEach((P) => {
1411
+ P.get("loactionData").id === C.id && (P == null || P.setStyle(t(C, z, !1)));
1412
+ }), o = null, a = null;
1413
+ }, g = (C) => {
1414
+ C ? (k(), $(C)) : clearSelectedPort();
1415
+ }, k = () => {
1416
+ var C;
1417
+ if (a) {
1418
+ const z = a.get("loactionData"), d = (C = e == null ? void 0 : e.getView()) == null ? void 0 : C.getZoom();
1419
+ a.setStyle(t(z, d, !1));
1420
+ }
1421
+ }, $ = (C) => {
1422
+ const z = s.getFeatures();
1423
+ o = C, a = z.find((d) => d.get("loactionData").id === C.id);
1424
+ };
1425
+ return {
1426
+ render: w,
1427
+ selected: g,
1428
+ clearSelected: y,
1429
+ clear: r
1430
+ };
1431
+ }, So = (e) => {
1432
+ e.getInteractions().forEach((l) => {
1433
+ l instanceof yt && l.setActive(!1);
1434
+ });
1435
+ }, No = (e) => {
1436
+ e.getInteractions().forEach((l) => {
1437
+ l instanceof yt && l.setActive(!0);
1438
+ });
1439
+ }, ve = (e, l) => {
1440
+ const n = e.getViewport();
1441
+ n && (n.style.cursor = l);
1442
+ }, Ro = (e, l) => {
1443
+ const n = ne([]), s = ne("km"), a = (N) => {
1444
+ s.value = N;
1445
+ };
1446
+ let o;
1447
+ const w = ne(!1), h = () => {
1448
+ ve(e, "crosshair"), y(), So(e), e.on("pointermove", $), e.getViewport().addEventListener("mouseout", () => {
1449
+ o && o.classList.add("hidden");
1450
+ }), z(), w.value = !0;
1451
+ };
1452
+ let t, r;
1453
+ const y = () => {
1454
+ t = new ue(), r = new he({
1455
+ source: t,
1456
+ zIndex: 1e3,
1457
+ style: {
1458
+ "fill-color": "rgba(255, 255, 255, 0.2)",
1459
+ "stroke-color": "#ffcc33",
1460
+ "stroke-width": 2,
1461
+ "circle-radius": 7,
1462
+ "circle-fill-color": "#ffcc33"
1463
+ }
1464
+ }), e == null || e.addLayer(r);
1465
+ };
1466
+ let g, k;
1467
+ const $ = (N) => {
1468
+ if (N.dragging)
1469
+ return;
1470
+ let M = "点击选择起点";
1471
+ g && (M = "单击继续,双击结束"), o && (o.innerHTML = M, k.setPosition(N.coordinate), o.classList.remove("hidden"));
1472
+ };
1473
+ let C;
1474
+ const z = () => {
1475
+ C = new We({
1476
+ source: t,
1477
+ type: "LineString",
1478
+ style: new _({
1479
+ fill: new oe({
1480
+ color: "rgba(255, 255, 255, 0.2)"
1481
+ }),
1482
+ stroke: new ke({
1483
+ color: "rgba(255,204,51)",
1484
+ lineDash: [10, 10],
1485
+ width: 2
1486
+ }),
1487
+ image: new Ye({
1488
+ radius: 5,
1489
+ stroke: new ke({
1490
+ color: "rgba(0, 0, 0, 0.7)"
1491
+ }),
1492
+ fill: new oe({
1493
+ color: "rgba(255, 255, 255, 0.2)"
1494
+ })
1495
+ })
1496
+ }),
1497
+ // 添加条件函数,判断是否应该出发点绘制
1498
+ condition: (M) => M.originalEvent.target.tagName !== "DIV"
1499
+ }), e == null || e.addInteraction(C), b(), V();
1500
+ let N;
1501
+ C.on("drawstart", function(M) {
1502
+ var T;
1503
+ g = M.feature, g.set("randomId", d());
1504
+ let i;
1505
+ N = (T = g.getGeometry()) == null ? void 0 : T.on("change", function(x) {
1506
+ const L = x.target, F = pt(L, s.value);
1507
+ i = L.getLastCoordinate(), m && F && (m.innerHTML = F), P.setPosition(i);
1508
+ });
1509
+ }), C.on("drawend", function() {
1510
+ var M, i, T;
1511
+ if (m && (m.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), m != null && m.innerHTML) {
1512
+ const x = (g == null ? void 0 : g.get("randomId")) || d();
1513
+ n.value.push({ id: x, value: m == null ? void 0 : m.innerHTML }), m.innerHTML = `${m.innerHTML}<div class="ol-tooltip-delete-button" data-id="${x}"><i class="map-iconfont icon-delete"></i></div>`;
1514
+ }
1515
+ (M = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || M.addEventListener("click", (x) => {
1516
+ var F;
1517
+ x.preventDefault(), x.stopPropagation();
1518
+ const L = (F = x.target) == null ? void 0 : F.getAttribute("data-id");
1519
+ L && G(L);
1520
+ }), 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);
1521
+ });
1522
+ }, d = () => Math.random().toString(36).substring(2, 9);
1523
+ let m, P;
1524
+ const b = () => {
1525
+ m != null && m.parentNode && m.parentNode.removeChild(m), m = document.createElement("div"), m.className = "ol-tooltip ol-tooltip-measure", P = new pe({
1526
+ element: m,
1527
+ offset: [0, -15],
1528
+ positioning: "bottom-center",
1529
+ stopEvent: !1,
1530
+ insertFirst: !1
1531
+ }), e == null || e.addOverlay(P);
1532
+ }, V = () => {
1533
+ o != null && o.parentNode && o.parentNode.removeChild(o), o = document.createElement("div"), o.className = "ol-tooltip hidden", k = new pe({
1534
+ element: o,
1535
+ offset: [15, 0],
1536
+ positioning: "center-left"
1537
+ }), e == null || e.addOverlay(k);
1538
+ }, X = () => {
1539
+ n.value.forEach((N, M) => {
1540
+ var x, L;
1541
+ const i = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
1542
+ i[M] && ((L = (x = i[M]) == null ? void 0 : x.parentNode) == null || L.removeChild(i[M]));
1543
+ const T = t.getFeatures();
1544
+ T[M] && t.removeFeature(T[M]);
1545
+ }), q(), No(e), w.value = !1, ve(e, "grab");
1546
+ }, G = (N) => {
1547
+ var i, T, x, L;
1548
+ const M = n.value.findIndex((F) => F.id === N);
1549
+ if (M !== -1) {
1550
+ n.value.splice(M, 1);
1551
+ const F = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
1552
+ F[M] && ((T = (i = F[M]) == null ? void 0 : i.parentNode) == null || T.removeChild(F[M]));
1553
+ const Z = t.getFeatures();
1554
+ Z[M] && t.removeFeature(Z[M]);
1555
+ }
1556
+ (L = (x = l.getProps()) == null ? void 0 : x.lineDrawEnd) == null || L.call(x, n.value);
1557
+ }, q = () => {
1558
+ if (n.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((N) => {
1559
+ var M;
1560
+ (M = N == null ? void 0 : N.parentNode) == null || M.removeChild(N);
1561
+ }), t == null || t.clear(), C) {
1562
+ const N = e.getInteractions().getArray().find((M) => at(M) === at(C));
1563
+ N && e.removeInteraction(N);
1564
+ }
1565
+ e.removeLayer(r), o != null && o.parentNode && o.parentNode.removeChild(o), m != null && m.parentNode && m.parentNode.removeChild(m);
1566
+ };
1567
+ return {
1568
+ open: h,
1569
+ close: X,
1570
+ deleteLine: G,
1571
+ setUnit: a,
1572
+ getState: () => w.value
1573
+ };
1574
+ }, pt = (e, l) => {
1575
+ const s = tt(e);
1576
+ let a = "";
1577
+ switch (l) {
1578
+ case "m":
1579
+ a = `${Math.round(s * 100) / 100} m`;
1580
+ break;
1581
+ case "km":
1582
+ a = `${Math.round(s / 1e3 * 100) / 100} km`;
1583
+ break;
1584
+ case "nm":
1585
+ a = (Math.round(s / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
1586
+ break;
1587
+ }
1588
+ return a;
1589
+ }, $o = (e, l) => {
1590
+ let n, s, a = "close";
1591
+ const o = () => {
1592
+ q(), a = "open", w(), ve(e, "crosshair");
1593
+ }, w = () => {
1594
+ r(), P(), X(), C();
1595
+ };
1596
+ let h = null, t = null;
1597
+ const r = () => {
1598
+ if (h && t) return;
1599
+ const N = new ue(), M = new he({
1600
+ source: N,
1601
+ style: new _({
1602
+ stroke: new ke({
1603
+ color: "#fbcc33",
1604
+ width: 2
1605
+ })
1606
+ }),
1607
+ zIndex: 1e3
1608
+ });
1609
+ h = M, t = N, e.on("pointermove", g), e.addLayer(M), e.on(["dblclick"], function(i) {
1610
+ k && (i.stopPropagation(), i.preventDefault());
1611
+ });
1612
+ };
1613
+ let y;
1614
+ const g = (N) => {
1615
+ if (N.dragging) return;
1616
+ const M = y ? "单击继续,双击结束" : "点击选择起点";
1617
+ b && (b.innerHTML = M, V.setPosition(N.coordinate));
1618
+ };
1619
+ let k, $ = !1;
1620
+ const C = () => {
1621
+ if (n) {
1622
+ b != null && b.parentNode && b.parentNode.removeChild(b);
1623
+ const N = n.getGeometry();
1624
+ if (!N) return;
1625
+ const M = z(N, "nm");
1626
+ d && (d.innerHTML = `
1627
+ <span class="text">面积:${M}${$ ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
1628
+ `), d && (d.innerHTML += '<span class="delete-icon" ><i class="map-iconfont icon-delete" /></div>');
1629
+ const i = N.getCoordinates(), T = i[0][i[0].length - 2];
1630
+ if (m.setPosition(T), h) {
1631
+ const L = h.getSource();
1632
+ L && n && (L.clear(), L.addFeature(n));
1633
+ }
1634
+ setTimeout(() => {
1635
+ var L;
1636
+ (L = document.querySelector(".delete-icon")) == null || L.addEventListener("click", () => {
1637
+ var F, Z;
1638
+ console.log("delete"), G(), (Z = (F = l.getProps()) == null ? void 0 : F.areaDrawEnd) == null || Z.call(F, []);
1639
+ });
1640
+ }, 0);
1641
+ const x = It(n.getGeometry().getExtent());
1642
+ e == null || e.getView().setCenter(x);
1643
+ return;
1644
+ }
1645
+ k = new We({
1646
+ type: "Polygon",
1647
+ source: t,
1648
+ trace: !0,
1649
+ style: [new _({
1650
+ stroke: new ke({
1651
+ color: "rgba(255, 255, 255, 1)",
1652
+ width: 1.5,
1653
+ lineDash: [10, 10]
1654
+ }),
1655
+ fill: new oe({
1656
+ color: "rgba(255, 255, 255, 0.25)"
1657
+ })
1658
+ }), new _({
1659
+ image: new Ye({
1660
+ radius: 5,
1661
+ fill: new oe({
1662
+ color: "rgb(51,112,255, 1)"
1663
+ })
1664
+ }),
1665
+ geometry: function(N) {
1666
+ const M = N.getGeometry().getCoordinates();
1667
+ return new eo(M);
1668
+ }
1669
+ })]
1670
+ }), e == null || e.addInteraction(k), k.on("drawstart", (N) => {
1671
+ var M;
1672
+ y = N.feature, s = (M = y.getGeometry()) == null ? void 0 : M.on("change", (i) => {
1673
+ const T = i.target, x = z(T, "nm"), F = T.getCoordinates()[0], Z = new Ge([F[F.length - 2], F[F.length - 1]]), W = pt(Z, "nm");
1674
+ if ($ = Number(tt(Z) / 1e3) > 150, !x) return;
1675
+ const H = '<span class="error pl-4">超出可以绘画的距离</span>';
1676
+ d && (d.innerHTML = `
1677
+ <div class="text">
1678
+ 面积:${x}
1679
+ ${$ ? H : ""}
1680
+ </div>
1681
+ `), b && (b.innerHTML = `
1682
+ <div class="text">
1683
+ 面积:${x}
1684
+ </div>
1685
+ <div class="text ${$ ? "error" : ""}">
1686
+ 线段 ${F.length - 2}: ${W}
1687
+ ${$ ? H : ""}
1688
+
1689
+ </div>
1690
+ <div>
1691
+ <span class="text">单击继续,双击结束</span>
1692
+ </div>
1693
+ `);
1694
+ });
1695
+ }), k.on("drawend", (N) => {
1696
+ var x, L, F, Z;
1697
+ if (!N.feature.getGeometry()) return;
1698
+ d && !n && (d.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), n = N.feature, m.setOffset([10, 0]);
1699
+ const i = N.feature.getGeometry().getCoordinates(), T = i[0][i[0].length - 2];
1700
+ if (m.setPosition(T), b != null && b.parentNode && b.parentNode.removeChild(b), (x = l.getProps()) != null && x.areaDrawEnd) {
1701
+ const W = i[0].map((H) => Ve(H, I.mercator, I.data));
1702
+ (F = (L = l.getProps()) == null ? void 0 : L.areaDrawEnd) == null || F.call(L, W);
1703
+ }
1704
+ k && (k.setActive(!1), e == null || e.removeInteraction(k), (e == null ? void 0 : e.getInteractions()).forEach((H) => {
1705
+ H instanceof We && (H.setActive(!1), e == null || e.removeInteraction(H));
1706
+ })), s && Je(s), (Z = document.querySelector(".delete-icon")) == null || Z.addEventListener("click", () => {
1707
+ var W, H;
1708
+ G(), (H = (W = l.getProps()) == null ? void 0 : W.areaDrawEnd) == null || H.call(W, []);
1709
+ });
1710
+ });
1711
+ }, z = (N, M) => {
1712
+ const i = Ut(N);
1713
+ switch (M) {
1714
+ case "km":
1715
+ return i > 1e4 ? Math.round(i / 1e6 * 100) / 100 + " km<sup>2</sup>" : Math.round(i * 100) / 100 + " m<sup>2</sup>";
1716
+ case "nm":
1717
+ 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>";
1718
+ }
1719
+ };
1720
+ let d, m;
1721
+ const P = () => {
1722
+ 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({
1723
+ element: d,
1724
+ offset: [0, -15],
1725
+ positioning: "bottom-center",
1726
+ stopEvent: !1,
1727
+ insertFirst: !1
1728
+ }), e == null || e.addOverlay(m);
1729
+ };
1730
+ let b, V;
1731
+ const X = () => {
1732
+ b != null && b.parentNode && b.parentNode.removeChild(b), b = document.createElement("div"), b.className = "ol-tooltip ol-help-tooltip", V = new pe({
1733
+ element: b,
1734
+ offset: [15, 0],
1735
+ positioning: "center-left"
1736
+ }), e == null || e.addOverlay(V);
1737
+ }, G = () => {
1738
+ n = null, o();
1739
+ }, q = () => {
1740
+ 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) => {
1741
+ M instanceof We && (M.setActive(!1), e == null || e.removeInteraction(M));
1742
+ }), k = null), s && Je(s), s = void 0, t == null || t.clear(), t = null, h && e.getAllLayers().includes(h) && (e.removeLayer(h), h = 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");
1743
+ };
1744
+ return {
1745
+ open: o,
1746
+ close: q,
1747
+ reset: G,
1748
+ getState: () => a
1749
+ };
1750
+ }, Vo = "zh-map-port-layer", zo = (e) => {
1751
+ const l = new ue(), n = new he({
1752
+ className: Vo,
1753
+ source: l,
1754
+ zIndex: 100,
1755
+ updateWhileInteracting: !0,
1756
+ updateWhileAnimating: !0,
1757
+ properties: { layerType: ee.PORT }
1758
+ });
1759
+ e == null || e.addLayer(n);
1760
+ let s = null, a = null;
1761
+ const o = (d, m = !0) => {
1762
+ if (!d || d.length === 0) return;
1763
+ if (l.clear(), a) {
1764
+ const b = d.find((V) => V.id === (a == null ? void 0 : a.id));
1765
+ b ? a = b : d.push(a);
1766
+ }
1767
+ const P = [];
1768
+ d.forEach((b) => {
1769
+ const [V, X] = b.latLon.split(","), G = new le({
1770
+ geometry: new te(ie([Number(V), Number(X)])),
1771
+ portData: b,
1772
+ id: b.id,
1773
+ select: b.id === (a == null ? void 0 : a.id),
1774
+ showTitle: b.id === (a == null ? void 0 : a.id) || m
1775
+ }), q = y(G);
1776
+ G.setStyle(q), P.push(G);
1777
+ }), l.addFeatures(P);
1778
+ };
1779
+ let w = null, h = null;
1780
+ const t = /* @__PURE__ */ new Map(), r = (d, m) => {
1781
+ w || (w = document.createElement("canvas"), h = w.getContext("2d", {
1782
+ willReadFrequently: !0
1783
+ }));
1784
+ const P = `${d}-${m}`;
1785
+ if (t.has(P))
1786
+ return t.get(P);
1787
+ const b = w, V = h;
1788
+ if (!V) return "";
1789
+ b.width = 0, b.height = 0;
1790
+ const X = 2, G = 8, q = window.devicePixelRatio || 1, K = "12px sans-serif";
1791
+ V.font = K;
1792
+ const M = V.measureText(d).width, i = G + M + G, T = X + 12 + X * 2;
1793
+ 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";
1794
+ const x = T / 2;
1795
+ V.strokeStyle = m ? "#000" : "#ffffff", V.lineWidth = 1, V.strokeText(d, G, x), V.fillStyle = m ? "#FFF" : "#000000", V.fillText(d, G, x);
1796
+ const L = b.toDataURL("image/png");
1797
+ return t.set(P, L), L;
1798
+ }, y = (d) => {
1799
+ 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">
1800
+ <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}"/>
1801
+ <g clip-path="url(#clip0_10059_122082)">
1802
+ <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"/>
1803
+ </g>
1804
+ <defs>
1805
+ <clipPath id="clip0_10059_122082">
1806
+ <rect width="26" height="26" fill="white" transform="translate(10 8)"/>
1807
+ </clipPath>
1808
+ </defs>
1809
+ </svg>
1810
+ `, 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 _({
1811
+ image: new Ce({
1812
+ src: V(),
1813
+ scale: 0.5 * X / 10
1814
+ }),
1815
+ zIndex: m ? 110 : 100
1816
+ }), N = new _({
1817
+ image: new Ce({
1818
+ src: r(G.shortName, m),
1819
+ anchor: [0.5, 0.5],
1820
+ displacement: [0, -30],
1821
+ scale: 1 / q,
1822
+ anchorXUnits: "fraction",
1823
+ anchorYUnits: "fraction"
1824
+ }),
1825
+ zIndex: m ? 110 : 100
1826
+ // text: new Text({
1827
+ // text: port.shortName,
1828
+ // font: '12px sans-serif',
1829
+ // fill: new Fill({
1830
+ // color: select ? "#ffffff" : "#000000"
1831
+ // }),
1832
+ // backgroundFill: new Fill({
1833
+ // color: "#FFF",
1834
+ // }),
1835
+ // offsetY: 30,
1836
+ // }),
1837
+ });
1838
+ return !P && !m ? K : [K, N];
1839
+ }, g = () => {
1840
+ if (l)
1841
+ if (s) {
1842
+ console.log("清除非选中的港口");
1843
+ const d = s.get("portData").id;
1844
+ l.getFeatures().forEach((m) => {
1845
+ m.get("portData").id !== d && l.removeFeature(m);
1846
+ });
1847
+ } else
1848
+ console.log("清除所有港口", l), l == null || l.clear();
1849
+ }, k = (d) => {
1850
+ if (l) {
1851
+ if (!d)
1852
+ return $();
1853
+ (s == null ? void 0 : s.get("portData").id) !== d.id && ($(), C(d));
1854
+ }
1855
+ }, $ = () => {
1856
+ var d;
1857
+ if (s) {
1858
+ 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);
1859
+ P && (P.set("select", !1), P.setStyle(y(P)), s = null, a = null);
1860
+ }
1861
+ }, C = (d) => {
1862
+ if (!l) return;
1863
+ const m = l.getFeatures();
1864
+ a = d, s = m.find((P) => P.get("portData").id === d.id), s && (s.set("select", !0), s.setStyle(y(s)));
1865
+ };
1866
+ return {
1867
+ render: o,
1868
+ clear: g,
1869
+ selected: k,
1870
+ handlePortHover: (d) => {
1871
+ d && d.get("portData") ? ve(e, "pointer") : ve(e, "grab");
1872
+ }
1873
+ };
1874
+ }, Oo = (e, l, n, s, a, o, w) => {
1875
+ const h = e.getInstall();
1876
+ h.on("moveend", () => {
1877
+ var g, k;
1878
+ try {
1879
+ const $ = e.getZoom();
1880
+ (k = (g = l.getProps()).mapMoveEnd) == null || k.call(g, $), $ >= U.min && $ <= U.max && n.reRenderTrackLine(), $ >= U.shipTriggleMin && $ <= U.max && s.changeShipScale("end");
1881
+ } catch ($) {
1882
+ console.log("moveend---catch", $);
1883
+ }
1884
+ });
1885
+ const t = {
1886
+ [ee.PORT]: null,
1887
+ [ee.SHIP]: null,
1888
+ [ee.TRACK]: null
1889
+ }, r = (g, k, $) => {
1890
+ switch (ve(h, "pointer"), g) {
1891
+ case ee.SHIP:
1892
+ s == null || s.handleShipMapEvent(k, "hover");
1893
+ break;
1894
+ case ee.PORT:
1895
+ break;
1896
+ case ee.TRACK:
1897
+ n == null || n.handleTrackMapEvent(k, "hover", $);
1898
+ break;
1899
+ }
1900
+ }, y = (g) => {
1901
+ switch (ve(h, "grab"), g) {
1902
+ case ee.PORT:
1903
+ break;
1904
+ case ee.SHIP:
1905
+ s == null || s.handleShipMapEvent(null, "hover");
1906
+ break;
1907
+ case ee.TRACK:
1908
+ n == null || n.handleTrackMapEvent(null, "hover");
1909
+ break;
1910
+ }
1911
+ };
1912
+ h.on("pointermove", (g) => {
1913
+ if (!h.getView().getAnimating())
1914
+ try {
1915
+ let k = !1;
1916
+ const $ = h.getLayers().getArray().filter((C) => C.get("layerType"));
1917
+ $ && $.length > 0 && $.forEach((C) => {
1918
+ if (k) return;
1919
+ const z = h == null ? void 0 : h.getEventPixel(g.originalEvent), d = C == null ? void 0 : C.get("layerType"), m = h == null ? void 0 : h.forEachFeatureAtPixel(z, (P) => P, {
1920
+ layerFilter: (P) => P === C,
1921
+ // 严格图层过滤
1922
+ hitTolerance: 5
1923
+ });
1924
+ m !== t[d] && (t[d] && y(d, t[d]), t[d] = m, m && (r(d, m, g), k = !0));
1925
+ });
1926
+ } catch (k) {
1927
+ console.log("pointermove----", k);
1928
+ }
1929
+ }), h.on("movestart", () => {
1930
+ try {
1931
+ const g = h == null ? void 0 : h.getView().getZoom();
1932
+ g && g <= U.shipModelMax && g >= U.shipTriggleMin && s.changeShipScale("start");
1933
+ } catch (g) {
1934
+ console.log("movestart---catch", g);
1935
+ }
1936
+ }), h.on("click", vt((g) => {
1937
+ if (w.getState() !== "open" && !h.getView().getAnimating())
1938
+ try {
1939
+ let k = !1;
1940
+ const $ = h.getLayers().getArray().filter((C) => C.get("layerType"));
1941
+ $ && $.length > 0 && $.forEach((C) => {
1942
+ var m, P, b;
1943
+ if (k) return;
1944
+ const z = h == null ? void 0 : h.getEventPixel(g.originalEvent), d = h == null ? void 0 : h.forEachFeatureAtPixel(z, (V) => {
1945
+ if (V.get("shipData") || V.get("portData"))
1946
+ return V;
1947
+ }, {
1948
+ layerFilter: (V) => V === C,
1949
+ // 严格图层过滤
1950
+ hitTolerance: 10
1951
+ });
1952
+ if (d) {
1953
+ if (d != null && d.get("shipData"))
1954
+ console.log("trackManager.getTrackStatus()---", n.getTrackStatus()), n.getTrackStatus() || s.handleShipMapEvent(d, "click", (m = l.getProps()) == null ? void 0 : m.selectShip);
1955
+ else if (d != null && d.get("portData")) {
1956
+ const V = d == null ? void 0 : d.get("portData");
1957
+ a.selected(V), (b = (P = l.getProps()) == null ? void 0 : P.selectPort) == null || b.call(P, V);
1958
+ }
1959
+ k = !0, g.preventDefault(), g.stopPropagation();
1960
+ }
1961
+ });
1962
+ } catch (k) {
1963
+ console.log("pointermove----", k);
1964
+ }
1965
+ }, 150));
1966
+ }, Do = () => {
1967
+ const e = At([]);
1968
+ return {
1969
+ createInstance: (s, a) => {
1970
+ const o = ao();
1971
+ o.initMap(s, a);
1972
+ const w = o.getInstall(), h = Eo(w), t = Po();
1973
+ t.setProps(a), h.setShowLayerType(a.layerType), h.setGreenTileVisible(a.showGreenLayer);
1974
+ const r = yo(w), y = vo(w, r), g = To(w), k = Fo(w), $ = Ro(w, t), C = $o(w, t), z = zo(w);
1975
+ Oo(o, t, r, g, z, $, C);
1976
+ const d = () => {
1977
+ const P = w.getView().calculateExtent(o.getSize()), b = Ve([P[0], P[1]], I.mercator, I.data), V = Ve([P[2], P[3]], I.mercator, I.data);
1978
+ return [b[0], b[1], V[0], V[1]];
1979
+ }, m = {
1980
+ id: Symbol("map-instance"),
1981
+ innerMap: null,
1982
+ map: o.getInstall(),
1983
+ destroy: () => {
1984
+ e.splice(e.indexOf(m), 1);
1985
+ },
1986
+ methods: {
1987
+ ...o,
1988
+ layer: h,
1989
+ ship: g,
1990
+ track: r,
1991
+ carTrack: y,
1992
+ port: {
1993
+ render: z.render,
1994
+ clear: z.clear,
1995
+ selected: z.selected
1996
+ },
1997
+ position: k,
1998
+ drawLine: $,
1999
+ drawPolygon: C,
2000
+ // 子模块
2001
+ utils: {
2002
+ getCalculateExtent: d,
2003
+ convertSixHundredThousandToLatLng: nt,
2004
+ calculateCirclePoints: uo
2005
+ }
2006
+ }
2007
+ };
2008
+ return e.push(m), m;
2009
+ },
2010
+ destroyInstance: (s) => {
2011
+ const a = e.findIndex((o) => o.id === s);
2012
+ a > -1 && (e[a].destroy(), e.splice(a, 1));
2013
+ },
2014
+ destroyAll: () => {
2015
+ e.forEach((s) => s.destroy()), e.splice(0, e.length);
2016
+ },
2017
+ getAllInstances: () => [...e]
2018
+ };
2019
+ }, Zo = { class: "zh-map-box" }, Ao = /* @__PURE__ */ Ue({
2020
+ __name: "Map",
2021
+ props: {
2022
+ zoom: { default: U.default },
2023
+ center: { default: co },
2024
+ layerType: { default: "vector" },
2025
+ showGreenLayer: { type: Boolean, default: !1 },
2026
+ showScale: { type: Boolean, default: !0 },
2027
+ scaleLineUnit: { default: "metric" },
2028
+ mapMoveEnd: { type: Function, default: () => {
2029
+ } },
2030
+ lineDrawEnd: {},
2031
+ areaDrawEnd: { type: Function, default: () => {
2032
+ } },
2033
+ selectShip: { type: Function, default: () => {
2034
+ } },
2035
+ selectPort: { type: Function, default: () => {
2036
+ } }
2037
+ },
2038
+ setup(e, { expose: l }) {
2039
+ const n = ne(), s = ne(), a = Do(), o = ne(), w = e, h = ne({
2040
+ getInstall() {
2041
+ }
2042
+ });
2043
+ return Gt(() => {
2044
+ var t;
2045
+ o.value = a.createInstance(n.value, w), h.value = o.value.methods, (t = s.value) == null || t.setScaleLine(o.value.map, w.scaleLineUnit);
2046
+ }), Wt(() => {
2047
+ var t, r;
2048
+ a.destroyInstance((t = o == null ? void 0 : o.value) == null ? void 0 : t.id), (r = o.value) == null || r.destroy();
2049
+ }), l({
2050
+ getZoom: () => {
2051
+ var t;
2052
+ return (t = o.value) == null ? void 0 : t.methods.getZoom();
2053
+ },
2054
+ setZoom: (t) => {
2055
+ var r;
2056
+ return (r = o.value) == null ? void 0 : r.methods.setZoom(t);
2057
+ },
2058
+ getInstall: () => {
2059
+ var t;
2060
+ return (t = o.value) == null ? void 0 : t.methods.getInstall();
2061
+ },
2062
+ getView: () => {
2063
+ var t;
2064
+ return (t = o.value) == null ? void 0 : t.methods.getView();
2065
+ },
2066
+ setCenter: (t, r) => {
2067
+ var y;
2068
+ return (y = o.value) == null ? void 0 : y.methods.setCenter(t, r);
2069
+ },
2070
+ getSize: () => {
2071
+ var t;
2072
+ return (t = o.value) == null ? void 0 : t.methods.getSize();
2073
+ },
2074
+ getCenter: (t, r) => {
2075
+ var y;
2076
+ return (y = o.value) == null ? void 0 : y.methods.getCenter();
2077
+ },
2078
+ layer: {
2079
+ setGreenTileVisible: (t) => {
2080
+ var r;
2081
+ return (r = o.value) == null ? void 0 : r.methods.layer.setGreenTileVisible(t);
2082
+ },
2083
+ getGreenTileVisible: () => {
2084
+ var t;
2085
+ return (t = o.value) == null ? void 0 : t.methods.layer.getGreenTileVisible();
2086
+ },
2087
+ getShowLayerType: () => {
2088
+ var t;
2089
+ return (t = o.value) == null ? void 0 : t.methods.layer.getShowLayerType();
2090
+ },
2091
+ setShowLayerType: (t) => {
2092
+ var r;
2093
+ return (r = o.value) == null ? void 0 : r.methods.layer.setShowLayerType(t);
2094
+ }
2095
+ },
2096
+ ship: {
2097
+ render: (...t) => {
2098
+ var r;
2099
+ return (r = o.value) == null ? void 0 : r.methods.ship.render(...t);
2100
+ },
2101
+ selected: (...t) => {
2102
+ var r;
2103
+ return (r = o.value) == null ? void 0 : r.methods.ship.selected(...t);
2104
+ },
2105
+ filter: (...t) => {
2106
+ var r;
2107
+ return (r = o.value) == null ? void 0 : r.methods.ship.filter(...t);
2108
+ },
2109
+ blinking: (...t) => {
2110
+ var r;
2111
+ return (r = o.value) == null ? void 0 : r.methods.ship.blinking(...t);
2112
+ },
2113
+ clear: () => {
2114
+ var t;
2115
+ return (t = o.value) == null ? void 0 : t.methods.ship.clear();
2116
+ }
2117
+ },
2118
+ track: {
2119
+ render: (...t) => {
2120
+ var r;
2121
+ return (r = o.value) == null ? void 0 : r.methods.track.render(...t);
2122
+ },
2123
+ remove: (...t) => {
2124
+ var r;
2125
+ return (r = o.value) == null ? void 0 : r.methods.track.remove(...t);
2126
+ },
2127
+ play: (...t) => {
2128
+ var r;
2129
+ return (r = o.value) == null ? void 0 : r.methods.track.play(...t);
2130
+ },
2131
+ setCenter: (...t) => {
2132
+ var r;
2133
+ return (r = o.value) == null ? void 0 : r.methods.track.setCenter(...t);
2134
+ },
2135
+ close: (...t) => {
2136
+ var r;
2137
+ return (r = o.value) == null ? void 0 : r.methods.track.close(...t);
2138
+ },
2139
+ getLength: (...t) => {
2140
+ var r;
2141
+ return (r = o.value) == null ? void 0 : r.methods.track.getLength(...t);
2142
+ }
2143
+ },
2144
+ carTrack: {
2145
+ location: (...t) => {
2146
+ var r;
2147
+ return (r = o.value) == null ? void 0 : r.methods.carTrack.location(...t);
2148
+ },
2149
+ remove: (...t) => {
2150
+ var r;
2151
+ return (r = o.value) == null ? void 0 : r.methods.carTrack.remove(...t);
2152
+ },
2153
+ renderTrack: (...t) => {
2154
+ var r;
2155
+ return (r = o.value) == null ? void 0 : r.methods.carTrack.renderTrack(...t);
2156
+ },
2157
+ setCenter: (...t) => {
2158
+ var r;
2159
+ return (r = o.value) == null ? void 0 : r.methods.carTrack.setCenter(...t);
2160
+ },
2161
+ closeTrack: () => {
2162
+ var t;
2163
+ return (t = o.value) == null ? void 0 : t.methods.carTrack.closeTrack();
2164
+ },
2165
+ playTrack: (...t) => {
2166
+ var r;
2167
+ return (r = o.value) == null ? void 0 : r.methods.carTrack.playTrack(...t);
2168
+ }
2169
+ },
2170
+ port: {
2171
+ render: (t, r) => {
2172
+ var y;
2173
+ return (y = o.value) == null ? void 0 : y.methods.port.render(t, r);
2174
+ },
2175
+ clear: () => {
2176
+ var t;
2177
+ return (t = o.value) == null ? void 0 : t.methods.port.clear();
2178
+ },
2179
+ selected: (t) => {
2180
+ var r;
2181
+ return (r = o.value) == null ? void 0 : r.methods.port.selected(t);
2182
+ }
2183
+ },
2184
+ position: {
2185
+ render: (...t) => {
2186
+ var r;
2187
+ return (r = o.value) == null ? void 0 : r.methods.position.render(...t);
2188
+ },
2189
+ selected: (...t) => {
2190
+ var r;
2191
+ return (r = o.value) == null ? void 0 : r.methods.position.selected(...t);
2192
+ },
2193
+ clearSelected: (...t) => {
2194
+ var r;
2195
+ return (r = o.value) == null ? void 0 : r.methods.position.clearSelected(...t);
2196
+ },
2197
+ clear: () => {
2198
+ var t;
2199
+ return (t = o.value) == null ? void 0 : t.methods.position.clear();
2200
+ }
2201
+ },
2202
+ drawLine: {
2203
+ open: () => {
2204
+ var t;
2205
+ return (t = o.value) == null ? void 0 : t.methods.drawLine.open();
2206
+ },
2207
+ close: () => {
2208
+ var t;
2209
+ return (t = o.value) == null ? void 0 : t.methods.drawLine.close();
2210
+ },
2211
+ deleteLine: (t) => {
2212
+ var r;
2213
+ return (r = o.value) == null ? void 0 : r.methods.drawLine.deleteLine(t);
2214
+ },
2215
+ setUnit: (t) => {
2216
+ var r;
2217
+ return (r = o.value) == null ? void 0 : r.methods.drawLine.setUnit(t);
2218
+ },
2219
+ getState: () => {
2220
+ var t;
2221
+ return (t = o.value) == null ? void 0 : t.methods.drawLine.getState();
2222
+ }
2223
+ },
2224
+ drawPolygon: {
2225
+ open: () => {
2226
+ var t;
2227
+ return (t = o.value) == null ? void 0 : t.methods.drawPolygon.open();
2228
+ },
2229
+ close: () => {
2230
+ var t;
2231
+ return (t = o.value) == null ? void 0 : t.methods.drawPolygon.close();
2232
+ },
2233
+ reset: () => {
2234
+ var t;
2235
+ return (t = o.value) == null ? void 0 : t.methods.drawPolygon.reset();
2236
+ }
2237
+ },
2238
+ // 子模块
2239
+ utils: {
2240
+ getCalculateExtent: (...t) => {
2241
+ var r;
2242
+ return (r = o.value) == null ? void 0 : r.methods.utils.getCalculateExtent(...t);
2243
+ },
2244
+ convertSixHundredThousandToLatLng: (...t) => {
2245
+ var r;
2246
+ return (r = o.value) == null ? void 0 : r.methods.utils.convertSixHundredThousandToLatLng(...t);
2247
+ },
2248
+ calculateCirclePoints: (t, r) => {
2249
+ var y;
2250
+ return (y = o.value) == null ? void 0 : y.methods.utils.calculateCirclePoints(t, r);
2251
+ }
2252
+ }
2253
+ }), (t, r) => (Ie(), et("div", Zo, [
2254
+ _e("div", {
2255
+ id: "map",
2256
+ ref_key: "zhMapRef",
2257
+ ref: n,
2258
+ class: "zh-map"
2259
+ }, null, 512),
2260
+ Qe(ro, {
2261
+ ref_key: "scaleLineRef",
2262
+ ref: s
2263
+ }, null, 512),
2264
+ Qe(io, {
2265
+ ref: "zoomControlRef",
2266
+ "map-instance": o.value
2267
+ }, null, 8, ["map-instance"])
2268
+ ]));
2269
+ }
2270
+ }), Go = /* @__PURE__ */ ot(Ao, [["__scopeId", "data-v-1fa3c6fd"]]), Xo = to(Go);
2271
+ export {
2272
+ Xo as Z
2273
+ };