zhihao-ui 1.3.2 → 1.3.4

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 (44) hide show
  1. package/dist/es/{BaseInfo-DZ0pUsfS.js → BaseInfo-CB5pi10k.js} +1 -1
  2. package/dist/es/{BaseItem-C_JbnRPH.js → BaseItem-DbPihwWe.js} +3 -3
  3. package/dist/es/{Button-CydCp4hf.js → Button-CJChwHqo.js} +2 -2
  4. package/dist/es/{DatePicker-C__sA0-h.js → DatePicker-Bi2YRkEQ.js} +3 -3
  5. package/dist/es/{DetailHeader-bEliAoL-.js → DetailHeader-Cg9d2H5f.js} +3 -3
  6. package/dist/es/{DetailSubTitle-COsgdEV-.js → DetailSubTitle-B9uSbcqf.js} +2 -2
  7. package/dist/es/{Dialog-D-vnJqtW.js → Dialog-ChaUWYYq.js} +3 -3
  8. package/dist/es/{DiyDataTable-DTMKwxu9.js → DiyDataTable-efSdnkmN.js} +4 -4
  9. package/dist/es/{EditInfoPair-C4vN_b9E.js → EditInfoPair-aOPlWuK8.js} +3 -3
  10. package/dist/es/{FileWrapper-D7KcyVg2.js → FileWrapper-COcVCdaZ.js} +4 -4
  11. package/dist/es/{Grid-BE-CLeGr.js → Grid-C3UnYvww.js} +2 -2
  12. package/dist/es/{InfoPair-T3_TncEu.js → InfoPair-IXHMv1Kk.js} +3 -3
  13. package/dist/es/{Input-C0UdD80I.js → Input-B7Evxgt1.js} +3 -3
  14. package/dist/es/{Loading-QlWiWU_L.js → Loading-BakBqvVD.js} +2 -2
  15. package/dist/es/{Map-DMb_YG1p.js → Map-jdOYsS3c.js} +555 -615
  16. package/dist/es/{MessageBox-B42XuRHh.js → MessageBox-PjdMGQ7t.js} +2 -2
  17. package/dist/es/{MoneyInput-BsulLCsJ.js → MoneyInput-BNU6fyAq.js} +7 -7
  18. package/dist/es/{PageHeadPanel-BlFg_TvH.js → PageHeadPanel-CMbeIqJT.js} +2 -2
  19. package/dist/es/{Table-Oo-hQWGa.js → Table-NPgbmzKK.js} +5 -5
  20. package/dist/es/{ToolTips-YgMKfoQ0.js → ToolTips-CvmvEbTS.js} +5 -5
  21. package/dist/es/index.js +22 -22
  22. package/dist/es/{utils-CU-8DWnA.js → utils-BoEvcCS_.js} +1 -1
  23. package/dist/es/{vendor-1zIwhmRg.js → vendor-Tp_GZLnZ.js} +35 -33
  24. package/dist/index.css +1 -1
  25. package/dist/types/components/Map/Map.vue.d.ts +12 -16
  26. package/dist/types/components/Map/config/global.d.ts +1 -0
  27. package/dist/types/components/Map/config/index.d.ts +0 -41
  28. package/dist/types/components/Map/config/map.d.ts +0 -3
  29. package/dist/types/components/Map/function/drawPolygon.d.ts +1 -1
  30. package/dist/types/components/Map/function/port.d.ts +1 -2
  31. package/dist/types/components/Map/function/ship/index.d.ts +22 -0
  32. package/dist/types/components/Map/function/ship/style.d.ts +6 -0
  33. package/dist/types/components/Map/function/shipTrack.d.ts +5 -1
  34. package/dist/types/components/Map/index.d.ts +36 -48
  35. package/dist/types/components/Map/meta/index.d.ts +0 -5
  36. package/dist/types/components/Map/utils/overlay.d.ts +2 -1
  37. package/dist/types/components/Map/utils/track.d.ts +42 -0
  38. package/dist/types/components/Map/utils/util.d.ts +42 -0
  39. package/dist/umd/index.css +1 -1
  40. package/dist/umd/index.umd.cjs +16 -14
  41. package/package.json +1 -1
  42. package/dist/types/components/Map/function/label.d.ts +0 -9
  43. package/dist/types/components/Map/function/ship.d.ts +0 -34
  44. package/dist/types/components/Map/function/shipLabel.d.ts +0 -25
@@ -1,7 +1,7 @@
1
+ import { T as Text, F as Fill, S as Style, p as fromLonLat, t as transformExtent, q as getLength, R as RBush$1, O as Overlay, I as Icon, V as VectorSource, r as VectorLayer, s as debounce, i as cloneDeep, u as Feature, P as Point, h as hooks, L as LineString, v as Stroke, C as CircleStyle, w as transform, x as buffer, y as Polyline, z as getVectorContext, D as DoubleClickZoom, A as Draw, B as unByKey, G as getUid, M as Map$2, H as TileLayer, X as XYZ, J as View, K as defaults, N as toLonLat, Q as ScaleLine$1, U as getArea, W as getCenter$1, Y as MultiPoint } from "./vendor-Tp_GZLnZ.js";
1
2
  import { ref, computed, watch, onMounted, onBeforeUnmount, h, nextTick, createVNode, render, defineComponent, openBlock, createElementBlock, inject, createElementVNode, Fragment } from "vue";
2
- import { T as Text, F as Fill, S as Style, p as fromLonLat, t as transformExtent, q as getLength, R as RBush$1, O as Overlay, I as Icon, V as VectorSource, r as VectorLayer, s as debounce, i as cloneDeep, u as Feature, P as Point, h as hooks, L as LineString, v as Stroke, C as CircleStyle, w as Polyline, x as buffer, y as transform, z as getVectorContext, D as DoubleClickZoom, A as Draw, B as unByKey, G as getUid, M as Map$2, H as TileLayer, X as XYZ, J as View, K as toLonLat, N as ScaleLine$1, Q as MultiPoint, U as getArea } from "./vendor-1zIwhmRg.js";
3
- import { _ as _export_sfc } from "./Button-CydCp4hf.js";
4
- import { w as withInstall } from "./utils-CU-8DWnA.js";
3
+ import { _ as _export_sfc } from "./Button-CJChwHqo.js";
4
+ import { w as withInstall } from "./utils-BoEvcCS_.js";
5
5
  const TIAN_DI_TU_KEY = "a6e8f78974f2581f2ca00485b40c948f", MAP_ZOOM = {
6
6
  // 地图默认层级
7
7
  default: 13,
@@ -20,39 +20,44 @@ const TIAN_DI_TU_KEY = "a6e8f78974f2581f2ca00485b40c948f", MAP_ZOOM = {
20
20
  data: "EPSG:4326",
21
21
  // 墨卡托投影坐标 渲染坐标
22
22
  mercator: "EPSG:3857"
23
- }, MAP_DEFAULT_CENTER = [114.84, 30.52], CDN_URL = "https://static.zhihaoscm.cn/", calculateCirclePoints = (e, t) => {
24
- const o = fromLonLat(e), n = t * 1e3, r = [
25
- o[0] - n,
26
- o[1] - n,
27
- o[0] + n,
28
- o[1] + n
29
- ], a = transformExtent(r, projection.mercator, projection.data);
23
+ }, MAP_DEFAULT_CENTER = [114.84, 30.52], CDN_URL = "https://static.zhihaoscm.cn/", equatorialCircumference = 2003750834e-2;
24
+ var BASE_MAP_LINK = ((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=${TIAN_DI_TU_KEY}`, 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=${TIAN_DI_TU_KEY}`, 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=${TIAN_DI_TU_KEY}`, 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=${TIAN_DI_TU_KEY}`, e.greenTile = `${CDN_URL}/map/tile/{z}/{x}/{y}.png`, e))(BASE_MAP_LINK || {}), LENGTH_UNIT = /* @__PURE__ */ ((e) => (e[e.M = 1] = "M", e[e.KM = 2] = "KM", e[e.NM = 3] = "NM", e))(LENGTH_UNIT || {}), SHIP_SAIL_STATUS = /* @__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))(SHIP_SAIL_STATUS || {}), SHIP_DIRECT = /* @__PURE__ */ ((e) => (e.left = "left", e.right = "right", e.front = "front", e.up = "up", e.down = "down", e.back = "back", e))(SHIP_DIRECT || {});
25
+ const convertSixHundredThousandToLatLng = function(e, t) {
26
+ const n = Number(t) / 6e5;
27
+ return [Number(e) / 6e5, n];
28
+ }, calculateCirclePoints = (e, t) => {
29
+ const n = fromLonLat(e), o = t * 1e3, r = [
30
+ n[0] - o,
31
+ n[1] - o,
32
+ n[0] + o,
33
+ n[1] + o
34
+ ], l = transformExtent(r, projection.mercator, projection.data);
30
35
  return {
31
- leftTopPoint: { lng: a[0], lat: a[3] },
32
- rightTopPoint: { lng: a[2], lat: a[3] },
33
- rightBottomPoint: { lng: a[2], lat: a[1] },
34
- leftBottomPoint: { lng: a[0], lat: a[1] }
36
+ leftTopPoint: { lng: l[0], lat: l[3] },
37
+ rightTopPoint: { lng: l[2], lat: l[3] },
38
+ rightBottomPoint: { lng: l[2], lat: l[1] },
39
+ leftBottomPoint: { lng: l[0], lat: l[1] }
35
40
  };
36
41
  }, formatLength = function(e, t) {
37
- const n = getLength(e);
42
+ const o = getLength(e);
38
43
  let r = "";
39
- switch (t) {
44
+ switch (console.log(t, LENGTH_UNIT), t) {
40
45
  case LENGTH_UNIT.M:
41
- r = Math.round(n * 100) / 100 + " m";
46
+ r = Math.round(o * 100) / 100 + " m";
42
47
  break;
43
48
  case LENGTH_UNIT.KM:
44
- r = Math.round(n / 1e3 * 100) / 100 + " km";
49
+ r = Math.round(o / 1e3 * 100) / 100 + " km";
45
50
  break;
46
51
  case LENGTH_UNIT.NM:
47
- r = (Math.round(n / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
52
+ r = (Math.round(o / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
48
53
  break;
49
54
  }
50
55
  return r;
51
- }, equatorialCircumference = 2003750834e-2;
56
+ };
52
57
  function lonLatToMercator(e) {
53
58
  const t = e[0] * equatorialCircumference / 180;
54
- let o = Math.log(Math.tan((90 + e[1]) * Math.PI / 360)) / (Math.PI / 180);
55
- return o = o * equatorialCircumference / 180, [t, o];
59
+ let n = Math.log(Math.tan((90 + e[1]) * Math.PI / 360)) / (Math.PI / 180);
60
+ return n = n * equatorialCircumference / 180, [t, n];
56
61
  }
57
62
  function getIconFont(unicode = "") {
58
63
  return unicode.indexOf("&") !== -1 && (unicode = unicode.replace("&", "&")), unicode.indexOf("&amp") !== -1 && (unicode = unicode.replace("&amp", "&")), eval('("' + unicode.replace("&#x", "\\u").replace(";", "") + '")');
@@ -68,21 +73,18 @@ const getIconStyle = (e) => {
68
73
  text: t,
69
74
  zIndex: 100
70
75
  });
71
- }, adjustBounds = (e, t) => t.length === 2 ? [e[0] - t[0], e[1] - t[1], e[2] + t[0], e[3] + t[1]] : [e[0] + t[0], e[1] + t[1], e[2] + t[2], e[3] + t[3]], isOverlapping$1 = (e, t) => e[0] <= t[2] && e[2] >= t[0] && e[1] <= t[3] && e[3] >= t[1], mercatorToLonLat = (e, t = "lonlat") => {
72
- const o = { lon: 0, lat: 0 }, n = e[0] / equatorialCircumference * 180;
76
+ }, mercatorToLonLat = (e, t = "lonlat") => {
77
+ const n = { lon: 0, lat: 0 }, o = e[0] / equatorialCircumference * 180;
73
78
  let r = e[1] / equatorialCircumference * 180;
74
- return r = 180 / Math.PI * (2 * Math.atan(Math.exp(r * Math.PI / 180)) - Math.PI / 2), o.lon = n, o.lat = r, t === "lonlat" ? o : [n, r];
75
- };
76
- var BASE_MAP_LINK = ((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=${TIAN_DI_TU_KEY}`, 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=${TIAN_DI_TU_KEY}`, 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=${TIAN_DI_TU_KEY}`, 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=${TIAN_DI_TU_KEY}`, e.greenTile = `${CDN_URL}/map/tile/{z}/{x}/{y}.png`, e))(BASE_MAP_LINK || {}), LENGTH_UNIT = /* @__PURE__ */ ((e) => (e[e.M = 1] = "M", e[e.KM = 2] = "KM", e[e.NM = 3] = "NM", e))(LENGTH_UNIT || {});
77
- const getRightIcons = (e) => {
79
+ return r = 180 / Math.PI * (2 * Math.atan(Math.exp(r * Math.PI / 180)) - Math.PI / 2), n.lon = o, n.lat = r, t === "lonlat" ? n : [o, r];
80
+ }, adjustBounds = (e, t) => t.length === 2 ? [e[0] - t[0], e[1] - t[1], e[2] + t[0], e[3] + t[1]] : [e[0] + t[0], e[1] + t[1], e[2] + t[2], e[3] + t[3]], isOverlapping$1 = (e, t) => e[0] <= t[2] && e[2] >= t[0] && e[1] <= t[3] && e[3] >= t[1], getRightIcons = (e) => {
78
81
  const t = [];
79
82
  return e.existDevice && t.push("&#xe687;"), e.existMobile && t.push("&#xe688;"), e.existWaterGauge && t.push("&#xe686;"), t;
80
83
  };
81
84
  new RBush$1();
82
- var SHIP_SAIL_STATUS = /* @__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))(SHIP_SAIL_STATUS || {}), SHIP_DIRECT = /* @__PURE__ */ ((e) => (e.left = "left", e.right = "right", e.front = "front", e.up = "up", e.down = "down", e.back = "back", e))(SHIP_DIRECT || {});
83
85
  function useShipOverlay(e) {
84
- const t = ref(null), o = ref(null), n = computed(() => ({
85
- "--overlay-color": e.color,
86
+ const t = ref(null), n = ref(null), o = computed(() => ({
87
+ "--overlay-color": e.color || "#FFF",
86
88
  "--bg-color": e.selected ? e.color : "#ffffff",
87
89
  position: "relative",
88
90
  "pointer-events": "none"
@@ -101,26 +103,12 @@ function useShipOverlay(e) {
101
103
  "z-index": "1",
102
104
  display: "flex",
103
105
  "align-items": "center"
104
- })), a = computed(() => ({
106
+ })), l = computed(() => ({
105
107
  width: "14px",
106
108
  height: "14px",
107
109
  margin: "1px 5px 1px 1px",
108
110
  "background-color": "var(--bg-color)"
109
- })), l = computed(() => ({
110
- // 'position': 'absolute',
111
- // 'background': '#FFF',
112
- // 'height': '1px',
113
- // 'color': 'var(--overlay-color)',
114
- // .connection-line::before {
115
- // content: '';
116
- // position: absolute;
117
- // width: var(--length);
118
- // height: 100%;
119
- // transform: rotate(var(--angle));
120
- // transform-origin: left center;
121
- // left: var(--start-x);
122
- // top: var(--start-y);
123
- // }
111
+ })), a = computed(() => ({
124
112
  position: "absolute",
125
113
  top: "0px",
126
114
  color: "var(--overlay-color)",
@@ -131,32 +119,32 @@ function useShipOverlay(e) {
131
119
  height: "20px",
132
120
  overflow: "visible"
133
121
  }));
134
- let i = null;
122
+ let s = null;
135
123
  const c = () => {
136
- d(), i = window.setInterval(() => {
124
+ d(), s = window.setInterval(() => {
137
125
  if (t.value) {
138
- const s = t.value.querySelector(".ship-overlay-content");
139
- s && s.style && (s.style.backgroundColor = e.color, s.style.color = "#FFF", setTimeout(() => {
140
- s && s.style && (s.style.backgroundColor = "#ffffff", s.style.color = "#000");
126
+ const i = t.value.querySelector(".ship-overlay-content");
127
+ i && i.style && (i.style.backgroundColor = e.color, i.style.color = "#FFF", setTimeout(() => {
128
+ i && i.style && (i.style.backgroundColor = "#ffffff", i.style.color = "#000");
141
129
  }, 500));
142
130
  }
143
131
  }, 1e3);
144
132
  }, d = () => {
145
- i && (clearInterval(i), i = null);
146
- }, u = () => {
147
- o.value && o.value.setPosition(fromLonLat(e.position));
133
+ s && (clearInterval(s), s = null);
134
+ }, p = () => {
135
+ n.value && n.value.setPosition(fromLonLat(e.position));
148
136
  };
149
- return watch(() => e.selected, (s) => {
150
- s ? c() : d();
137
+ return watch(() => e.selected, (i) => {
138
+ i ? c() : d();
151
139
  }, { immediate: !0 }), watch(() => e.position, () => {
152
- u();
140
+ p();
153
141
  }, { deep: !0 }), onMounted(() => {
154
142
  }), onBeforeUnmount(() => {
155
143
  d();
156
144
  }), () => h("div", {
157
145
  ref: t,
158
146
  class: "ship-overlay-container",
159
- style: n.value
147
+ style: o.value
160
148
  }, [
161
149
  h(
162
150
  "div",
@@ -166,7 +154,7 @@ function useShipOverlay(e) {
166
154
  },
167
155
  [
168
156
  h("div", {
169
- style: e.selected ? a.value : {}
157
+ style: e.selected ? l.value : {}
170
158
  }, ""),
171
159
  h("div", {
172
160
  class: "text"
@@ -198,13 +186,9 @@ function useShipOverlay(e) {
198
186
  ])
199
187
  ]
200
188
  ),
201
- // h('div',{
202
- // class: 'ship-overlay-line',
203
- // style: lineStyle.value,
204
- // })
205
189
  h("svg", {
206
190
  class: "ship-overlay-line",
207
- style: l.value,
191
+ style: a.value,
208
192
  viewBox: "0 0 20 20",
209
193
  xmlns: "http://www.w3.org/2000/svg"
210
194
  }, [
@@ -255,72 +239,72 @@ function isOverlapping(e, t) {
255
239
  return !(e.right < t.left || e.left > t.right || e.bottom < t.top || e.top > t.bottom);
256
240
  }
257
241
  function calculateBestPosition(e, t) {
258
- const o = existingOverlays.value.filter((n) => n !== e).map((n) => {
242
+ const n = existingOverlays.value.filter((o) => o !== e).map((o) => {
259
243
  var r;
260
- return (r = n.getElement()) == null ? void 0 : r.getBoundingClientRect();
261
- }).filter((n) => n !== void 0);
262
- for (const n of POSITION_PRIORITY) {
263
- e.setPositioning(n.positioning), e.setOffset(n.offset), e.setPosition(t);
244
+ return (r = o.getElement()) == null ? void 0 : r.getBoundingClientRect();
245
+ }).filter((o) => o !== void 0);
246
+ for (const o of POSITION_PRIORITY) {
247
+ e.setPositioning(o.positioning), e.setOffset(o.offset), e.setPosition(t);
264
248
  const r = e.getElement();
265
249
  if (!r) continue;
266
250
  r.offsetHeight;
267
- const a = r.getBoundingClientRect();
268
- if (!o.some(
269
- (i) => isOverlapping(a, i)
251
+ const l = r.getBoundingClientRect();
252
+ if (!n.some(
253
+ (s) => isOverlapping(l, s)
270
254
  ))
271
255
  break;
272
256
  }
273
257
  }
274
- function addOverlay(e, t, o, n) {
258
+ function addOverlay(e, t, n, o) {
275
259
  const r = new Overlay({
276
- element: o,
260
+ element: n,
277
261
  positioning: "top-left",
278
- id: "label-" + n,
262
+ id: "label-" + (o == null ? void 0 : o.id),
279
263
  offset: [0, 0],
280
264
  autoPan: !1,
281
- className: "ship-label-overlay"
265
+ className: o.blinking ? "ship-label-overlay-blinking" : "ship-label-overlay"
282
266
  });
283
267
  r.set("class", "zh-map-ship-overlay"), e.addOverlay(r), existingOverlays.value.push(r), nextTick(async () => {
284
268
  await calculateBestPosition(r, t), setLinePath(r);
285
269
  });
286
270
  }
287
271
  function setLinePath(e) {
288
- const t = e.getElement(), o = t == null ? void 0 : t.querySelector(".ship-overlay-line"), n = e.getPositioning(), r = e.getOffset();
289
- o && n === "top-right" && (o.style.right = "-20px"), o && n === "top-left" && (o.style.left = "-20px");
290
- const a = POSITION_PRIORITY.filter((i) => i.positioning === n && i.offset === r), l = t == null ? void 0 : t.querySelector(".ship-overlay-line line");
291
- if (a.length > 0) {
292
- const { x1: i, y1: c, x2: d, y2: u } = a[0].line;
293
- l && (l.setAttribute("x1", i), l.setAttribute("y1", c), l.setAttribute("x2", d), l.setAttribute("y2", u));
272
+ const t = e.getElement(), n = t == null ? void 0 : t.querySelector(".ship-overlay-line"), o = e.getPositioning(), r = e.getOffset();
273
+ n && o === "top-right" && (n.style.right = "-20px"), n && o === "top-left" && (n.style.left = "-20px");
274
+ const l = POSITION_PRIORITY.filter((s) => s.positioning === o && s.offset === r), a = t == null ? void 0 : t.querySelector(".ship-overlay-line line");
275
+ if (l.length > 0) {
276
+ const { x1: s, y1: c, x2: d, y2: p } = l[0].line;
277
+ a && (a.setAttribute("x1", s), a.setAttribute("y1", c), a.setAttribute("x2", d), a.setAttribute("y2", p));
294
278
  }
295
279
  }
296
280
  function removeLabelOverlay(e) {
297
- existingOverlays.value = [], e.getOverlays().getArray().filter((n) => n.get("class") === "zh-map-ship-overlay").forEach((n) => {
298
- n.setPosition(void 0), n.setElement(void 0), e.removeOverlay(n), n.dispose();
281
+ existingOverlays.value = [], e.getOverlays().getArray().filter((o) => o.get("class") === "zh-map-ship-overlay").forEach((o) => {
282
+ o.setPosition(void 0), o.setElement(void 0), e.removeOverlay(o), o.dispose();
299
283
  });
300
284
  }
301
285
  const getShipDirectPath = (e) => {
302
- const { spd: t, hdg: o, cog: n } = e;
303
- return t ? o !== null && +o != 511 && n !== null ? n - +o >= 3 ? SHIP_DIRECT.right : n - +o <= -3 ? SHIP_DIRECT.left : SHIP_DIRECT.front : SHIP_DIRECT.front : "";
286
+ const { spd: t, hdg: n, cog: o } = e;
287
+ return t ? n !== null && +n != 511 && o !== null ? o - +n >= 3 ? SHIP_DIRECT.right : o - +n <= -3 ? SHIP_DIRECT.left : SHIP_DIRECT.front : SHIP_DIRECT.front : "";
304
288
  }, createShipStyle = (e) => {
305
- const { shipData: t } = e.getProperties(), o = getShipType(), n = getShipScale(t, o);
306
- return initShipStyle(e, n, o);
289
+ const { shipData: t } = e.getProperties(), n = getShipType(), o = getShipScale(t, n);
290
+ return initShipStyle(e, o, n);
307
291
  }, getShipType = () => {
308
292
  const e = getZoom();
309
293
  return e <= MAP_ZOOM.shipModelMax && e >= MAP_ZOOM.shipTriggleMin ? "ship" : "triangle";
310
294
  }, getShipScale = (e, t) => {
311
295
  if (t === "ship") {
312
- const { len: o, wid: n } = e, r = 97, a = 20, i = 1 / getView().getResolution(), c = o * i / r, d = n * i / a;
296
+ const { len: n, wid: o } = e, r = 97, l = 20, s = 1 / getView().getResolution(), c = n * s / r, d = o * s / l;
313
297
  return Math.max(c, d);
314
298
  }
315
299
  return MAP_ZOOM.scaleNum;
316
- }, initShipStyle = (e, t, o) => {
317
- const { color: n, direct: r, isHighlight: a, shipData: l } = e.getProperties(), i = (l.cog - 90 + 360) % 360;
300
+ }, initShipStyle = (e, t, n) => {
301
+ const { color: o, direct: r, isHighlight: l, shipData: a } = e.getProperties(), s = (a.cog - 90 + 360) % 360;
318
302
  return new Style({
319
303
  image: new Icon({
320
304
  src: c(),
321
305
  scale: t || MAP_ZOOM.scaleNum,
322
306
  anchor: [0.5, 0.5],
323
- rotation: i * Math.PI / 180,
307
+ rotation: s * Math.PI / 180,
324
308
  rotateWithView: !1
325
309
  })
326
310
  });
@@ -328,26 +312,26 @@ const getShipDirectPath = (e) => {
328
312
  return `data:image/svg+xml;utf8,${encodeURIComponent(d())}`;
329
313
  }
330
314
  function d() {
331
- switch (o) {
315
+ switch (n) {
332
316
  case "triangle":
333
317
  return `<svg width="41" height="24" viewBox="0 0 41 24" fill="none" xmlns="http://www.w3.org/2000/svg">
334
318
  <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"
335
- fill="${n}" stroke="${a ? "#FF2424" : "black"}" stroke-width="${a ? "2" : "0.578947"}" />
319
+ fill="${o}" stroke="${l ? "#FF2424" : "black"}" stroke-width="${l ? "2" : "0.578947"}" />
336
320
  <!--path船航向左边或者向前-->
337
- ${r === SHIP_DIRECT.left && `<path d="M30 12L40 12L40 8" stroke="${a ? "#FF2424" : "black"}" stroke-width="2"/>`}
321
+ ${r === SHIP_DIRECT.left && `<path d="M30 12L40 12L40 8" stroke="${l ? "#FF2424" : "black"}" stroke-width="2"/>`}
338
322
  <!--path船航向右边-->
339
- ${r === SHIP_DIRECT.right && `<path d="M30 12L40 12L40 16" stroke="${a ? "#FF2424" : "black"}" stroke-width="2"/>`}
323
+ ${r === SHIP_DIRECT.right && `<path d="M30 12L40 12L40 16" stroke="${l ? "#FF2424" : "black"}" stroke-width="2"/>`}
340
324
  <!--path黑线无左右-->
341
- ${r === SHIP_DIRECT.front && `<path d="M30 12L40 12" stroke="${a ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
325
+ ${r === SHIP_DIRECT.front && `<path d="M30 12L40 12" stroke="${l ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
342
326
  </svg>
343
327
  `;
344
328
  case "ship":
345
329
  return `<svg width="97" height="20" viewBox="0 0 97 20" fill="none" xmlns="http://www.w3.org/2000/svg">
346
330
  <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"
347
- fill="${n}" stroke="${a ? "#FF2424" : "black"}" stroke-width="${a ? "4" : "0.578947"}"/>
348
- ${r === SHIP_DIRECT.left && `<path d="M86 10L96 10L96 6" stroke="${a ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
349
- ${r === SHIP_DIRECT.right && `<path d="M86 10L96 10L96 14" stroke="${a ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
350
- ${r === SHIP_DIRECT.front && `<path d="M86 10L96 10" stroke="${a ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
331
+ fill="${o}" stroke="${l ? "#FF2424" : "black"}" stroke-width="${l ? "4" : "0.578947"}"/>
332
+ ${r === SHIP_DIRECT.left && `<path d="M86 10L96 10L96 6" stroke="${l ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
333
+ ${r === SHIP_DIRECT.right && `<path d="M86 10L96 10L96 14" stroke="${l ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
334
+ ${r === SHIP_DIRECT.front && `<path d="M86 10L96 10" stroke="${l ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
351
335
  </svg>
352
336
  `;
353
337
  default:
@@ -355,39 +339,43 @@ const getShipDirectPath = (e) => {
355
339
  }
356
340
  }
357
341
  }, selectedShipStyle = (e) => {
358
- const t = getShipType(), o = getShipScale(e, t), n = e.id, r = t === "ship" ? 109 : 49, a = `
359
- <svg style="transform:scale(${o});" xmlns="http://www.w3.org/2000/svg" width="${r}" height="${r}" viewBox="0 0 49 49" fill="none">
360
- <path d="M1.99982 46.9998L1.99982 1.99982L46.9998 1.99982L46.9998 46.9998L1.99982 46.9998Z" fill="#FF2424" fill-opacity="0.2"/>
361
- <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"/>
362
- </svg>
363
- `, l = document.createElement("div");
364
- l.className = "ship-overlay-selected", l.innerHTML = a;
365
- const { lon: i, lat: c } = e, d = new Overlay({
366
- element: l,
367
- position: fromLonLat([i, c]),
342
+ const t = selectedShipElement(e), n = e.id, { lon: o, lat: r } = e, l = new Overlay({
343
+ element: t,
344
+ position: fromLonLat([o, r]),
368
345
  id: "selected-" + n,
369
346
  positioning: "center-center",
370
347
  offset: [0, 5],
371
348
  className: "ship-selected-overlay"
372
349
  });
373
- return d.set("class", "ship-overlay-selected"), d;
350
+ return l.set("class", "ship-overlay-selected"), l;
351
+ }, selectedShipElement = (e) => {
352
+ const t = getShipType(), n = getShipScale(e, t), o = t === "ship" ? 109 : 49, r = `
353
+ <svg style="transform:scale(${n});" xmlns="http://www.w3.org/2000/svg" width="${o}" height="${o}" viewBox="0 0 49 49" fill="none">
354
+ <path d="M1.99982 46.9998L1.99982 1.99982L46.9998 1.99982L46.9998 46.9998L1.99982 46.9998Z" fill="#FF2424" fill-opacity="0.2"/>
355
+ <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"/>
356
+ </svg>
357
+ `, l = document.createElement("div");
358
+ return l.className = "ship-overlay-selected", l.innerHTML = r, l;
374
359
  }, createLabelStyle = (e) => {
375
- const t = getInstall(), o = document.createElement("div");
376
- o.className = "ship-overlay-box", o.style.zIndex = "9", o.style.position = "relative";
377
- const n = e.getProperties(), { shipData: r, blinking: a, blinkingColor: l, name: i } = n, { lon: c, lat: d } = r, u = createVNode({
360
+ const t = getInstall(), { shipData: n, blinking: o } = e.getProperties(), { lon: r, lat: l } = n, a = createLabelElement(e);
361
+ addOverlay(t, fromLonLat([r, l]), a, { ...n, blinking: o });
362
+ }, createLabelElement = (e) => {
363
+ const t = document.createElement("div");
364
+ t.className = "ship-overlay-box", t.style.position = "relative";
365
+ const n = e.getProperties(), { shipData: o, blinking: r, blinkingColor: l, name: a } = n, { lon: s, lat: c } = o, d = createVNode({
378
366
  setup() {
379
367
  return useShipOverlay({
380
- position: [c + 2e-3, d + 2e-3],
381
- selected: a,
382
- name: i,
368
+ position: [s + 2e-3, c + 2e-3],
369
+ selected: r,
370
+ name: a,
383
371
  color: l,
384
- existDevice: r == null ? void 0 : r.existDevice,
385
- existMobile: r == null ? void 0 : r.existMobile,
386
- existWaterGauge: r == null ? void 0 : r.existWaterGauge
372
+ existDevice: o == null ? void 0 : o.existDevice,
373
+ existMobile: o == null ? void 0 : o.existMobile,
374
+ existWaterGauge: o == null ? void 0 : o.existWaterGauge
387
375
  });
388
376
  }
389
377
  });
390
- render(u, o), addOverlay(t, fromLonLat([c, d]), o, r.id);
378
+ return render(d, t), t;
391
379
  };
392
380
  let selectedShipFeature = null, selectedShip = null;
393
381
  const shipsSource = new VectorSource(), shipsLayer = new VectorLayer({
@@ -404,104 +392,139 @@ const renderShipList = (e) => {
404
392
  const t = getInstall();
405
393
  if (!t) return;
406
394
  t.getLayers().getArray().includes(shipsLayer) || t.addLayer(shipsLayer);
407
- const o = (selectedShip == null ? void 0 : selectedShip.id) || (selectedShipFeature == null ? void 0 : selectedShipFeature.get("id"));
395
+ const n = (selectedShip == null ? void 0 : selectedShip.id) || (selectedShipFeature == null ? void 0 : selectedShipFeature.get("id"));
408
396
  removeLabelOverlay(t), removeSelectedOverlay(), shipsSource && shipsSource.clear();
409
- const n = [];
397
+ const o = [];
410
398
  if (selectedShip) {
411
- const r = e.filter((a) => a.id === o);
399
+ const r = e.filter((l) => l.id === n);
412
400
  r.length === 0 ? e.push(selectedShip) : selectedShip = r[0];
413
401
  }
414
402
  e.forEach((r) => {
415
- const a = fromLonLat([r.lon, r.lat]), l = new Feature({
416
- geometry: new Point(a),
417
- // 船舶数据
418
- shipData: r,
419
- id: r.id,
420
- name: r.cnname || "未命名船舶",
421
- selected: r.id === o,
422
- // 图标
423
- rightIcons: getRightIcons(r),
424
- // 是否闪烁
425
- blinking: attentionShips[r.id] || !1,
426
- // 闪烁颜色
427
- blinkingColor: attentionShipsColor[r.id] || "",
428
- // 船舶颜色
429
- color: r.fill || "#04C900",
430
- // 船艏向的方向
431
- direct: getShipDirectPath(r),
432
- // 高亮
433
- isHighlight: !1
434
- });
435
- l.setStyle(createShipStyle(l)), n.push(l), createLabelStyle(l);
436
- }), shipsSource.addFeatures(n), setTimeout(() => {
437
- if (selectedShip) {
438
- const r = selectedShipStyle(selectedShip);
439
- t.addOverlay(r);
440
- }
441
- }, 500);
403
+ const l = createShipFetature(r);
404
+ o.push(l), createLabelStyle(l);
405
+ }), shipsSource.addFeatures(o), handleChangeSelected();
406
+ }, createShipFetature = (e) => {
407
+ const t = (selectedShip == null ? void 0 : selectedShip.id) || (selectedShipFeature == null ? void 0 : selectedShipFeature.get("id")), n = fromLonLat([e.lon, e.lat]), o = new Feature({
408
+ geometry: new Point(n),
409
+ // 船舶数据
410
+ shipData: e,
411
+ id: e.id,
412
+ name: e.cnname || "未命名船舶",
413
+ selected: e.id === t,
414
+ // 图标
415
+ rightIcons: getRightIcons(e),
416
+ // 是否闪烁
417
+ blinking: attentionShips[e.id] || !1,
418
+ // 闪烁颜色
419
+ blinkingColor: attentionShipsColor[e.id] || "",
420
+ // 船舶颜色
421
+ color: e.fill || "#04C900",
422
+ // 船艏向的方向
423
+ direct: getShipDirectPath(e),
424
+ // 高亮
425
+ isHighlight: !1
426
+ });
427
+ return o.setStyle(createShipStyle(o)), o;
428
+ }, handleChangeSelected = () => {
429
+ var r;
430
+ if (!selectedShip) return;
431
+ const e = getInstall();
432
+ if (!e) return;
433
+ const n = cloneDeep(e.getOverlays().getArray()).find((l) => l.get("class") == "ship-overlay-selected");
434
+ console.log("selectedOverlay-----------", n);
435
+ let o = n;
436
+ if (o) {
437
+ const l = selectedShipElement(selectedShip);
438
+ o.setElement(l), o.setPosition(fromLonLat([selectedShip.lon, selectedShip.lat])), o.get("element").style.visibility = "visible";
439
+ } else
440
+ o = selectedShipStyle(selectedShip), e.addOverlay(o);
441
+ o && ((r = o.get("element")) != null && r.parentElement) && (o.get("element").parentElement.style.display = "block");
442
442
  }, clearShipList = () => {
443
443
  const e = getInstall();
444
444
  if (!e || !shipsSource) return;
445
445
  const t = (selectedShip == null ? void 0 : selectedShip.id) || "";
446
- shipsSource.getFeatures().forEach((n) => {
447
- n.get("shipData").shipId !== t && shipsSource.removeFeature(n);
446
+ shipsSource.getFeatures().forEach((o) => {
447
+ o.get("shipData").shipId !== t && shipsSource.removeFeature(o);
448
448
  });
449
- const o = e.getOverlays().getArray();
450
- cloneDeep(o).map((n) => {
451
- (n.getId() !== "label-" + t || n.getId() !== "selected-" + t) && (n.setPosition(void 0), n.setElement(void 0), e.removeOverlay(n), n.dispose());
449
+ const n = e.getOverlays().getArray();
450
+ cloneDeep(n).map((o) => {
451
+ (o.getId() !== "label-" + t || o.getId() !== "selected-" + t) && (o.setPosition(void 0), e.removeOverlay(o), o.dispose());
452
452
  });
453
453
  }, renderShipBlink = (e, t) => {
454
+ const n = getInstall();
454
455
  attentionShips = e, attentionShipsColor = t;
456
+ const o = cloneDeep(n.getOverlays().getArray()), r = cloneDeep(shipsSource.getFeatures());
457
+ for (const l in attentionShips) {
458
+ const a = attentionShips[l], s = o.find((d) => d.getId() === "label-" + l), c = r.find((d) => l === d.get("id"));
459
+ if (s && c) {
460
+ c.set("blinking", a), c.set("blinkingColor", attentionShipsColor[l] || "");
461
+ const d = s.getElement(), p = createLabelElement(c), i = p.querySelector(".ship-overlay-line"), u = d == null ? void 0 : d.querySelector(".ship-overlay-line");
462
+ d && d !== p && (u && i && i.replaceWith(u), s.setElement(p));
463
+ }
464
+ }
455
465
  }, filterShipShow = (e) => {
456
- if (!getInstall()) return;
457
- const o = shipsSource.getFeatures(), n = selectedShipFeature ? selectedShipFeature.get("id") : "", r = o.filter((l) => l.getId() !== n), a = /* @__PURE__ */ new Map();
458
- e.forEach((l) => {
459
- a.set(l.id, !0);
460
- }), r.forEach((l) => {
461
- const i = l.get("id");
462
- if (!a.has(i))
463
- l.setStyle([]);
466
+ const t = getInstall();
467
+ if (!t) return;
468
+ const n = shipsSource.getFeatures(), o = selectedShipFeature ? selectedShipFeature.get("id") : "", r = n.filter((s) => s.get("id") !== o), l = /* @__PURE__ */ new Map();
469
+ e.forEach((s) => {
470
+ l.set(s.id, !0);
471
+ });
472
+ const a = cloneDeep(t.getOverlays().getArray());
473
+ r.forEach((s) => {
474
+ const c = s.get("id"), d = a.find((p) => p.getId() === "label-" + c);
475
+ if (!l.has(c))
476
+ s.setStyle([]), d && (d.get("element").style.visibility = "hidden");
464
477
  else {
465
- const c = l.getStyle();
466
- (c == null ? void 0 : c.length) == 0 && l.setStyle(createShipStyle(l));
478
+ d && (d.get("element").style.visibility = "visible");
479
+ const p = s.getStyle();
480
+ (p == null ? void 0 : p.length) == 0 && s.setStyle(createShipStyle(s));
467
481
  }
468
482
  });
469
483
  }, renderShipSelected = (e) => {
470
484
  if (e) {
471
485
  console.log("选中", e);
472
- const t = shipsSource.getFeatures().find((o) => o.get("id") === e.id);
486
+ const t = shipsSource.getFeatures().find((n) => n.get("id") === e.id);
473
487
  t && (selectedShipFeature = t), selectedShip = e;
474
488
  } else
475
- console.log("取消选中"), removeSelectedOverlay();
476
- }, handleShipMapEvent = debounce((e, t, o) => {
477
- const n = getInstall();
489
+ console.log("取消选中"), selectedShip = null, removeSelectedOverlay();
490
+ }, renderShipSelectedChange = () => {
491
+ console.log("selectedShip------------------", selectedShip);
492
+ const e = shipsSource.getFeatures().find((t) => t.get("id") === (selectedShip == null ? void 0 : selectedShip.id));
493
+ if (console.log("hasShipFetature------------------", e), e)
494
+ e == null || e.setStyle(createShipStyle(e)), createLabelStyle(e);
495
+ else {
496
+ const t = createShipFetature(selectedShip);
497
+ shipsSource.addFeature(t), createLabelStyle(t);
498
+ }
499
+ handleChangeSelected();
500
+ }, handleShipMapEvent = debounce((e, t, n) => {
501
+ const o = getInstall();
478
502
  if (e) {
479
- const r = e.get("shipData"), a = e.get("id");
480
- if (n.getTargetElement().style.cursor = a ? "pointer" : "", t === "click" && (renderShipSelected(r), o && o(a)), t === "hover") {
481
- hoveredShipId && hoveredShipId !== a && clearHoverHight(), hoveredShipId = a;
482
- const l = shipsSource.getFeatures().find((i) => i.get("id") === hoveredShipId);
483
- l == null || l.set("isHighlight", !0), l == null || l.setStyle(createShipStyle(l));
503
+ const r = e.get("shipData"), l = e.get("id");
504
+ if (o.getTargetElement().style.cursor = l ? "pointer" : "", t === "click" && (renderShipSelected(r), n && n(l)), t === "hover") {
505
+ hoveredShipId && hoveredShipId !== l && clearHoverHight(), hoveredShipId = l;
506
+ const a = shipsSource.getFeatures().find((s) => s.get("id") === hoveredShipId);
507
+ a == null || a.set("isHighlight", !0), a == null || a.setStyle(createShipStyle(a));
484
508
  }
485
509
  } else
486
- n.getTargetElement().style.cursor = "", clearHoverHight();
510
+ o.getTargetElement().style.cursor = "", clearHoverHight();
487
511
  }, 10), clearHoverHight = () => {
488
512
  const e = hoveredShipId ? shipsSource.getFeatures().find((t) => t.get("id") === hoveredShipId) : null;
489
513
  hoveredShipId = null, e == null || e.set("isHighlight", !1), e == null || e.setStyle(createShipStyle(e));
490
514
  }, removeSelectedOverlay = () => {
491
- const e = getInstall();
492
- e.getOverlays().getArray().filter((n) => n.get("class") == "ship-overlay-selected").forEach((n) => {
493
- n.setPosition(void 0), n.setElement(void 0), e.removeOverlay(n), n.dispose();
494
- });
495
- }, convertSixHundredThousandToLatLng = function(e, t) {
496
- const o = Number(t) / 6e5;
497
- return [Number(e) / 6e5, o];
515
+ try {
516
+ const e = getInstall(), n = cloneDeep(e.getOverlays().getArray()).find((o) => o.get("class") == "ship-overlay-selected");
517
+ n && n.get("element") && (n.get("element").style.visibility = "hidden");
518
+ } catch (e) {
519
+ console.log(e);
520
+ }
498
521
  }, stopIcon = "&#xe6e2;", stopColor = "#E31818", slowIcon = "&#xe703;", slowColor = "#1890FF", dropletsIcon = "&#xe6d2", DEFAULT_VALUE = "--";
499
522
  let moveFeatureHandler = null;
500
523
  const stopIconStyle = getIconStyle(stopIcon), slowIconStyle = getIconStyle(slowIcon), popupEle = document.createElement("div"), popupOverlay = new Overlay({
501
524
  element: popupEle,
502
525
  positioning: "top-left",
503
526
  stopEvent: !1,
504
- className: "track-label-overlay"
527
+ className: "track-label-popup"
505
528
  });
506
529
  let polyline, linePath, startMarker, position, geoMarker, trackAnimating = !1, lastTime = Date.now(), vectorLayer$3, distance = 0, thresholdNum = 20;
507
530
  const routesSource = new VectorSource(), routeLayer = new VectorLayer({
@@ -509,57 +532,47 @@ const routesSource = new VectorSource(), routeLayer = new VectorLayer({
509
532
  className: "zh-map--track-layer",
510
533
  zIndex: 102
511
534
  });
512
- let routeFeatures = [], showTracks = [], allTracks = {}, trackId = "", trackColor = "", trackList = [], mapInstance$1 = null;
535
+ let routeFeatures = [], allTracks = {}, trackId = "", trackColor = "", trackList = [], mapInstance$1 = null, isClosing = !1;
513
536
  const reRenderTrackLine = () => {
514
- mapInstance$1 = getInstall(), handlerRenderLine();
515
- }, renderTrackLine = async (e, t, o, n = LENGTH_UNIT.NM, r = "ship", a = 200) => {
516
- if (mapInstance$1 = getInstall(), !mapInstance$1) return;
517
- if (routeLayer == null || routeLayer.setVisible(!0), t = t == null ? void 0 : t.reverse(), popupOverlay && r === "ship" && (mapInstance$1 != null && mapInstance$1.getOverlays().getArray().includes(popupOverlay) || mapInstance$1.addOverlay(popupOverlay)), clearShipList(), (t == null ? void 0 : t.length) < 2) {
518
- (showTracks == null ? void 0 : showTracks.findIndex((s) => s.id === e)) < 0 && showTracks.push({ id: e, length: "" });
519
- return;
520
- }
521
- const l = {};
522
- t.forEach((s) => {
523
- s.state ? s.state = Number(s.state) : delete s.state;
524
- }), trackId = e, l[e] = t, trackList = t;
525
- const i = l[e].map(
526
- (s) => transform([s.lon, s.lat], projection.data, projection.mercator)
527
- ), c = new LineString(i), d = formatLength(c, n) || "--", u = showTracks == null ? void 0 : showTracks.findIndex((s) => s.id === e);
528
- u < 0 ? showTracks.push({ id: e, length: d }) : showTracks[u].length = d, allTracks[e] = t, trackList = [], trackColor = o, thresholdNum = a, await handlerRenderLine(), await setTrackViewCenter(trackId);
537
+ mapInstance$1 = getInstall(), isClosing || handlerRenderLine();
538
+ }, renderTrackLine = async (e, t, n, o = "ship", r = 200) => {
539
+ mapInstance$1 = getInstall(), mapInstance$1 && (routeLayer == null || routeLayer.setVisible(!0), t = t == null ? void 0 : t.reverse(), popupOverlay && o === "ship" && (mapInstance$1 != null && mapInstance$1.getOverlays().getArray().includes(popupOverlay) || mapInstance$1.addOverlay(popupOverlay)), renderShipSelectedChange(), isClosing = !1, !((t == null ? void 0 : t.length) < 2) && (t.forEach((l) => {
540
+ l.state ? l.state = Number(l.state) : delete l.state;
541
+ }), trackId = e, trackList = t, allTracks[e] = t, trackList = [], trackColor = n, thresholdNum = r, await handlerRenderLine(), await setTrackViewCenter(trackId)));
529
542
  }, handlerRenderLine = async () => {
530
- const e = trackColor || "", t = trackId, o = allTracks[trackId] || [], n = thresholdNum || 200, r = Math.max(1, Math.floor(o.length / n));
531
- trackList = o.filter((i, c) => c % r === 0).map((i, c) => {
532
- if (Number(i.lon) > 180 || Number(i.lat) > 180) {
533
- const [d, u] = convertSixHundredThousandToLatLng(i.lon, i.lat);
534
- i.lon = d, i.lat = u;
543
+ const e = trackColor || "", t = trackId, n = allTracks[trackId] || [], o = thresholdNum || 200, r = Math.max(1, Math.floor(n.length / o));
544
+ trackList = n.filter((s, c) => c % r === 0).map((s, c) => {
545
+ if (Number(s.lon) > 180 || Number(s.lat) > 180) {
546
+ const [d, p] = convertSixHundredThousandToLatLng(s.lon, s.lat);
547
+ s.lon = d, s.lat = p;
535
548
  }
536
- return i.center = [i.lon, i.lat], i.centerPoint = lonLatToMercator(i.center), i.id = t, i.index = c, i.time = hooks(i.createdAt).format("YYYY-MM-DD HH:mm:ss"), i;
549
+ return s.center = [s.lon, s.lat], s.centerPoint = lonLatToMercator(s.center), s.id = t, s.index = c, s.time = hooks(s.createdAt).format("YYYY-MM-DD HH:mm:ss"), s;
537
550
  });
538
- const l = trackList.map((i) => i.centerPoint);
539
- l.length >= 2 && (mapInstance$1 == null || mapInstance$1.addLayer(routeLayer), await createTrackLineFeature(t, l, e));
540
- }, createTrackLineFeature = (e, t, o) => {
541
- var l;
542
- const n = new LineString(t), r = new Feature({ geometry: n });
543
- r.setStyle(createTrackLineStyle(o)), r.setId(e), r.set("type", "line"), (l = routeLayer == null ? void 0 : routeLayer.getSource()) == null || l.clear(), removeAllLabel(), routeFeatures = [];
544
- const a = routeFeatures.findIndex((i) => i.getId() === e);
545
- a >= 0 ? routeFeatures[a] = r : routeFeatures.push(r), routesSource.addFeatures([...routeFeatures]), createPointFeature(o);
551
+ const a = trackList.map((s) => s.centerPoint);
552
+ a.length >= 2 && (mapInstance$1 == null || mapInstance$1.addLayer(routeLayer), await createTrackLineFeature(t, a, e));
553
+ }, createTrackLineFeature = (e, t, n) => {
554
+ var a;
555
+ const o = new LineString(t), r = new Feature({ geometry: o });
556
+ r.setStyle(createTrackLineStyle(n)), r.setId(e), r.set("type", "line"), (a = routeLayer == null ? void 0 : routeLayer.getSource()) == null || a.clear(), removeAllLabel(), routeFeatures = [];
557
+ const l = routeFeatures.findIndex((s) => s.getId() === e);
558
+ l >= 0 ? routeFeatures[l] = r : routeFeatures.push(r), routesSource.addFeatures([...routeFeatures]), createPointFeature(n);
546
559
  }, createTrackLineStyle = (e) => new Style({
547
560
  stroke: new Stroke({
548
561
  color: e,
549
562
  width: 2
550
563
  })
551
- }), handleTrackMapEvent = (e, t, o) => {
552
- const n = e == null ? void 0 : e.get("trackId");
553
- if (e && n && t === "hover") {
554
- mapInstance$1.getTargetElement().style.cursor = n ? "pointer" : "";
555
- const r = e.get("data"), a = renderTrackPointHtml(r), l = o == null ? void 0 : o.coordinate;
556
- l && (popupEle.querySelector(".popup-content"), popupEle.innerHTML = a, popupOverlay == null || popupOverlay.setPosition(l));
564
+ }), handleTrackMapEvent = (e, t, n) => {
565
+ const o = e == null ? void 0 : e.get("trackId");
566
+ if (e && o && t === "hover") {
567
+ mapInstance$1.getTargetElement().style.cursor = o ? "pointer" : "";
568
+ const r = e.get("data"), l = renderTrackPointHtml(r), a = n == null ? void 0 : n.coordinate;
569
+ a && (popupEle.querySelector(".popup-content"), popupEle.innerHTML = l, popupOverlay == null || popupOverlay.setPosition(a));
557
570
  } else
558
571
  popupOverlay && popupOverlay.setPosition(void 0);
559
572
  }, formatMinutesToDDHHMM = (e) => {
560
- const t = hooks.duration(e, "minutes"), o = Math.floor(t.asDays()), n = t.hours(), r = t.minutes();
561
- let a = `${String(r).padStart(2, "0")}分`;
562
- return n !== 0 && (a = `${String(n).padStart(2, "0")}时${a}`), o !== 0 && (a = `${String(o).padStart(2, "0")}天${a}`), a;
573
+ const t = hooks.duration(e, "minutes"), n = Math.floor(t.asDays()), o = t.hours(), r = t.minutes();
574
+ let l = `${String(r).padStart(2, "0")}分`;
575
+ return o !== 0 && (l = `${String(o).padStart(2, "0")}时${l}`), n !== 0 && (l = `${String(n).padStart(2, "0")}天${l}`), l;
563
576
  }, renderTrackPointHtml = (e) => {
564
577
  if (!(e != null && e.time)) return;
565
578
  let t = "";
@@ -603,44 +616,44 @@ const reRenderTrackLine = () => {
603
616
  }, createPointFeature = (e) => {
604
617
  const t = trackList || [];
605
618
  if (!(t && t.length > 1)) return [];
606
- const o = { 16: 24, 17: 15, default: 4 }, n = [], r = t.length;
607
- for (let l = 0; l < r; l++) {
608
- t[l].index = l;
609
- const i = mapInstance$1 == null ? void 0 : mapInstance$1.getPixelFromCoordinate(t[l].centerPoint);
610
- if (i) {
611
- let c = i.concat(i);
619
+ const n = { 16: 24, 17: 15, default: 4 }, o = [], r = t.length;
620
+ for (let a = 0; a < r; a++) {
621
+ t[a].index = a;
622
+ const s = mapInstance$1 == null ? void 0 : mapInstance$1.getPixelFromCoordinate(t[a].centerPoint);
623
+ if (s) {
624
+ let c = s.concat(s);
612
625
  c = adjustBounds(c, [20, 20]);
613
626
  const d = mapInstance$1 == null ? void 0 : mapInstance$1.getView().getZoom();
614
627
  if (!d) return;
615
628
  if (d > 15) {
616
- const s = o[d] || o.default;
617
- c = adjustBounds(c, [s, s]);
629
+ const i = n[d] || n.default;
630
+ c = adjustBounds(c, [i, i]);
618
631
  }
619
- let u = !0;
620
- if (t[l].state !== "0") {
621
- for (let s = 0; s < n.length; s++)
622
- if (isOverlapping$1(c, n[s].bounds)) {
623
- u = !1;
632
+ let p = !0;
633
+ if (t[a].state !== "0") {
634
+ for (let i = 0; i < o.length; i++)
635
+ if (isOverlapping$1(c, o[i].bounds)) {
636
+ p = !1;
624
637
  break;
625
638
  }
626
639
  }
627
- u && (t[l].bounds = c, n.push(t[l]));
640
+ p && (t[a].bounds = c, o.push(t[a]));
628
641
  }
629
642
  }
630
- const a = [];
631
- n.forEach((l) => {
632
- const i = new Feature({
633
- geometry: new Point(l.centerPoint),
634
- time: l.time
643
+ const l = [];
644
+ o.forEach((a) => {
645
+ const s = new Feature({
646
+ geometry: new Point(a.centerPoint),
647
+ time: a.time
635
648
  });
636
- i.set("type", "track_point"), i.set("trackId", l.id), i.set("data", l), i.setStyle(createPointStyle(e)), a.push(i), typeof l == "object" && Object.prototype.hasOwnProperty.call(l, "state") && createIconFeature(l);
637
- }), routesSource.addFeatures(a), a.forEach((l) => {
638
- const i = l.getProperties().data, c = createPointLabelOverlay(e, i);
649
+ s.set("type", "track_point"), s.set("trackId", a.id), s.set("data", a), s.setStyle(createPointStyle(e)), l.push(s), typeof a == "object" && Object.prototype.hasOwnProperty.call(a, "state") && createIconFeature(a);
650
+ }), routesSource.addFeatures(l), l.forEach((a) => {
651
+ const s = a.getProperties().data, c = createPointLabelOverlay(e, s);
639
652
  mapInstance$1 == null || mapInstance$1.addOverlay(c);
640
- }), createArrowFetaure(n, e), createIconPointFeature();
653
+ }), createArrowFetaure(o, e), createIconPointFeature();
641
654
  }, createPointLabelOverlay = (e, t) => {
642
- const o = document.createElement("div");
643
- o.className = "track-overlay-label", o.style.position = "relative", o.style.backgroundColor = "rgba(255,255,255,0.8)", o.style.border = `1px solid ${e}`, o.style.fontSize = "12px", o.innerHTML = `
655
+ const n = document.createElement("div");
656
+ n.className = "track-overlay-label", n.style.position = "relative", n.style.backgroundColor = "rgba(255,255,255,0.8)", n.style.border = `1px solid ${e}`, n.style.fontSize = "12px", n.innerHTML = `
644
657
  <span>${t.time}</span>
645
658
  <svg
646
659
  style="position: absolute;left: -20px;top: 0;"
@@ -653,18 +666,19 @@ const reRenderTrackLine = () => {
653
666
  stroke="${e}"
654
667
  stroke-width="1" />
655
668
  `;
656
- const n = new Overlay({
657
- element: o,
669
+ const o = new Overlay({
670
+ element: n,
658
671
  position: fromLonLat(t.center),
659
672
  positioning: "top-left",
660
673
  offset: [20, -20],
674
+ stopEvent: !1,
661
675
  className: "track-label-time-overlay"
662
676
  });
663
- return n.set("class", "track-label-overlay"), n;
677
+ return o.set("class", "track-label-overlay"), o;
664
678
  }, removeAllLabel = () => {
665
- const e = mapInstance$1 == null ? void 0 : mapInstance$1.getOverlays().getArray(), t = e == null ? void 0 : e.filter((o) => o.get("class") === "track-label-overlay");
666
- t && t.length > 0 && t.forEach((o) => {
667
- o.setPosition(void 0), o.setElement(void 0), mapInstance$1 == null || mapInstance$1.removeOverlay(o), o.dispose();
679
+ const e = cloneDeep(mapInstance$1 == null ? void 0 : mapInstance$1.getOverlays().getArray()), t = e == null ? void 0 : e.filter((n) => n.get("class") === "track-label-overlay");
680
+ t && t.length > 0 && t.forEach((n) => {
681
+ n.setPosition(void 0), n.setElement(void 0), mapInstance$1 == null || mapInstance$1.removeOverlay(n), n.dispose();
668
682
  });
669
683
  }, createPointStyle = (e) => [
670
684
  new Style({
@@ -682,101 +696,6 @@ const reRenderTrackLine = () => {
682
696
  radius: 3
683
697
  })
684
698
  })
685
- //
686
- // //文本框样式
687
- // new Style({
688
- // text: new Text({
689
- // text: point.time,
690
- // font: `500 ${labelConfig.fontSize}px ${labelConfig.fontFamily}`,
691
- // textAlign: 'left',
692
- // textBaseline: 'middle',
693
- // fill: new Fill({ color: labelConfig.textColor }),
694
- // backgroundFill: new Fill({
695
- // color: labelConfig.bgColor,
696
- // }),
697
- // backgroundStroke: new Stroke({
698
- // color: trackColor,
699
- // width: 0.5
700
- // }),
701
- // padding: labelConfig.padding,
702
- // offsetX: textX - boxTopLeft[0], // 转换为相对偏移
703
- // offsetY: textY - boxTopLeft[1],
704
- // }),
705
- // zIndex:99,
706
- // }),
707
- // 连接线样式
708
- // new Style({
709
- // geometry: lineGeom, // 明确指定几何图形
710
- // stroke: new Stroke({
711
- // color: trackColor,
712
- // width: Math.max(1, 1 / resolution),
713
- // width: 1
714
- // }),
715
- // zIndex: 1 // 确保在点和信息框之间
716
- // }),
717
- //
718
- // // 信息框背景
719
- // new Style({
720
- // geometry: boxGeom,
721
- // fill: new Fill({
722
- // color: labelConfig.bgColor
723
- // }),
724
- // stroke: new Stroke({
725
- // color: trackColor,
726
- // width: Math.max(0.5, 0.5 / resolution)
727
- // }),
728
- // zIndex: 2
729
- // }),
730
- // 文本样式
731
- // new Style({
732
- // geometry: new Point([textX, textY]),
733
- // text: new Text({
734
- // text: timeText,
735
- // font: `${labelConfig.fontSize}px ${labelConfig.fontFamily}`,
736
- // fill: new Fill({ color: labelConfig.textColor }),
737
- // textAlign: 'left',
738
- // textBaseline: 'middle',
739
- // offsetX: 0,
740
- // offsetY: 0,
741
- // scale: Math.max(1, 1 / resolution),
742
- // // backgroundFill: new Fill({
743
- // // color: labelConfig.bgColor,
744
- // // }),
745
- // // backgroundStroke: new Stroke({
746
- // // color: trackColor,
747
- // // width: 0.5
748
- // // }),
749
- // padding: labelConfig.padding,
750
- // }),
751
- // zIndex: 3
752
- // })
753
- // new Style({
754
- // geometry: lineGeom,
755
- // stroke: new Stroke({
756
- // color: trackColor,
757
- // width: 1
758
- // })
759
- // }),
760
- // 信息框样式(使用固定像素值的Text样式)
761
- // new Style({
762
- // text: new Text({
763
- // text: timeText,
764
- // font: `${FONT_SIZE}px Arial`,
765
- // fill: new Fill({ color: '#333' }),
766
- // backgroundFill: new Fill({
767
- // color: 'rgba(255, 255, 255, 0.9)'
768
- // }),
769
- // backgroundStroke: new Stroke({
770
- // color: 'rgba(0, 0, 0, 0.5)',
771
- // width: 1
772
- // }),
773
- // padding: BOX_PADDING,
774
- // offsetX: BOX_LEFT_OFFSET, // 固定30像素右偏移
775
- // offsetY: -boxHeight, // 固定向上偏移框高度
776
- // textAlign: 'left',
777
- // textBaseline: 'top'
778
- // })
779
- // })
780
699
  ], createIconFeature = (e) => {
781
700
  const t = new Feature({
782
701
  //point.centerPoint
@@ -784,7 +703,7 @@ const reRenderTrackLine = () => {
784
703
  time: e.time
785
704
  });
786
705
  t.set("type", "track_icon");
787
- const o = new Style({
706
+ const n = new Style({
788
707
  text: new Text({
789
708
  font: "Normal 22px map-iconfont",
790
709
  text: getIconFont(dropletsIcon),
@@ -794,26 +713,26 @@ const reRenderTrackLine = () => {
794
713
  })
795
714
  }),
796
715
  zIndex: 99
797
- }), n = [];
798
- Number(e.state) === 0 ? n.push(stopIconStyle) : Number(e.state) === 1 && n.push(slowIconStyle), n.push(o), t.setStyle(n), routesSource.addFeature(t);
716
+ }), o = [];
717
+ Number(e.state) === 0 ? o.push(stopIconStyle) : Number(e.state) === 1 && o.push(slowIconStyle), o.push(n), t.setStyle(o), routesSource.addFeature(t);
799
718
  }, createArrowFetaure = (e, t) => {
800
- const o = e || [], n = e.length;
801
- n || (o.push(trackList[0]), o.push(trackList[trackList.length - 1]));
802
- for (let r = 0; r < n - 1; r++) {
803
- let a;
804
- const l = e[r], i = (e[r + 1].index + l.index) / 2;
805
- if (i % 2 === 0)
806
- a = trackList[i].centerPoint;
719
+ const n = e || [], o = e.length;
720
+ o || (n.push(trackList[0]), n.push(trackList[trackList.length - 1]));
721
+ for (let r = 0; r < o - 1; r++) {
722
+ let l;
723
+ const a = e[r], s = (e[r + 1].index + a.index) / 2;
724
+ if (s % 2 === 0)
725
+ l = trackList[s].centerPoint;
807
726
  else {
808
- const c = trackList[Math.floor(i)], d = trackList[Math.ceil(i)];
727
+ const c = trackList[Math.floor(s)], d = trackList[Math.ceil(s)];
809
728
  if (c && d) {
810
- const [u, s] = c.centerPoint, [p, m] = d.centerPoint;
811
- a = [(u + p) / 2, (s + m) / 2];
729
+ const [p, i] = c.centerPoint, [u, m] = d.centerPoint;
730
+ l = [(p + u) / 2, (i + m) / 2];
812
731
  }
813
732
  }
814
- if (a) {
733
+ if (l) {
815
734
  const c = new Feature({
816
- geometry: new Point(a)
735
+ geometry: new Point(l)
817
736
  });
818
737
  c.set("type", "track_arrow"), c.setStyle(
819
738
  new Style({
@@ -833,34 +752,34 @@ const reRenderTrackLine = () => {
833
752
  }
834
753
  }, setTrackViewCenter = (e) => {
835
754
  var r;
836
- const t = mapInstance$1.getView(), o = e ? routeFeatures.find((a) => a.getId() === e) : routeFeatures[0];
837
- if (!o) return;
838
- const n = (r = o == null ? void 0 : o.getGeometry()) == null ? void 0 : r.getExtent();
839
- if (n != null && n.length)
755
+ const t = mapInstance$1.getView(), n = e ? routeFeatures.find((l) => l.getId() === e) : routeFeatures[0];
756
+ if (!n) return;
757
+ const o = (r = n == null ? void 0 : n.getGeometry()) == null ? void 0 : r.getExtent();
758
+ if (o != null && o.length)
840
759
  try {
841
- const a = buffer(n, Math.max(n[2] - n[0], n[3] - n[1]) * 0.02);
842
- t.fit(a);
843
- } catch (a) {
844
- console.log(a);
760
+ const l = buffer(o, Math.max(o[2] - o[0], o[3] - o[1]) * 0.02);
761
+ t.fit(l);
762
+ } catch (l) {
763
+ console.log(l);
845
764
  }
846
765
  }, createIconPointFeature = () => {
847
- const e = "&#xe69b;", t = "#fcdc3f", o = "#ff0000";
766
+ const e = "&#xe69b;", t = "#fcdc3f", n = "#ff0000";
848
767
  (trackList.length < 2 ? [trackList[0]] : [trackList[0], trackList[trackList.length - 1]]).forEach((r) => {
849
- const a = new Feature({
768
+ const l = new Feature({
850
769
  geometry: new Point(r.centerPoint)
851
770
  });
852
- a.set("type", "track_begin"), a.set("data", r);
853
- const l = r.index === 0 && trackList.length >= 2 ? t : o;
854
- a.setStyle(
771
+ l.set("type", "track_begin"), l.set("data", r);
772
+ const a = r.index === 0 && trackList.length >= 2 ? t : n;
773
+ l.setStyle(
855
774
  new Style({
856
775
  text: new Text({
857
776
  font: "Normal 14px map-iconfont",
858
777
  text: getIconFont(e),
859
- fill: new Fill({ color: l })
778
+ fill: new Fill({ color: a })
860
779
  }),
861
780
  zIndex: 101
862
781
  })
863
- ), routesSource.addFeature(a);
782
+ ), routesSource.addFeature(l);
864
783
  });
865
784
  }, geoMarkerStyle = new Style({
866
785
  text: new Text({
@@ -873,32 +792,44 @@ const reRenderTrackLine = () => {
873
792
  }), playShipTrack = (e, t) => {
874
793
  handlePlay(String(e), t);
875
794
  }, removeAllTrackLayer = () => {
876
- showTracks = [], allTracks = {}, routesSource == null || routesSource.clear();
795
+ allTracks = {}, routesSource == null || routesSource.clear(), stopAnimation(), isClosing = !0;
877
796
  }, closeTrack = (e = !1) => {
878
- routeLayer == null || routeLayer.setVisible(!1), e && removeAllTrackLayer(), stopAnimation();
797
+ routeLayer == null || routeLayer.setVisible(!1);
798
+ const t = getInstall();
799
+ cloneDeep(t.getOverlays().getArray()).forEach((o) => {
800
+ o.get("class") === "track-label-overlay" && (o.setPosition(void 0), t.removeOverlay(o), o.dispose());
801
+ }), e && removeAllTrackLayer(), stopAnimation(), isClosing = !0;
802
+ }, getTrackLength = (e, t = LENGTH_UNIT.NM) => {
803
+ const n = {
804
+ id: e,
805
+ length: "--"
806
+ }, r = (allTracks[e] || []).map(
807
+ (a) => transform([a.lon, a.lat], projection.data, projection.mercator)
808
+ ), l = new LineString(r);
809
+ return n.length = formatLength(l, t) || "--", console.log("showTracks", n), n;
879
810
  }, handlePlay = (e, t) => {
880
- const o = allTracks[String(e)];
881
- playAnimation(o == null ? void 0 : o.map((n) => [n.lon, n.lat]), t);
811
+ const n = allTracks[String(e)], o = n == null ? void 0 : n.map((r) => [r.lon, r.lat]);
812
+ o && playAnimation(o, t);
882
813
  }, moveFeature = (e, t) => {
883
- var s, p;
884
- const o = Number(50 * t), n = ((s = e.frameState) == null ? void 0 : s.time) ?? Date.now(), r = n - lastTime;
885
- if (distance = (distance + o * r / 1e6) % 2, lastTime = n, distance >= 1) {
814
+ var i, u;
815
+ const n = Number(50 * t), o = ((i = e.frameState) == null ? void 0 : i.time) ?? Date.now(), r = o - lastTime;
816
+ if (distance = (distance + n * r / 1e6) % 2, lastTime = o, distance >= 1) {
886
817
  stopAnimation();
887
818
  return;
888
819
  }
889
- const a = linePath.getCoordinateAt(
820
+ const l = linePath.getCoordinateAt(
890
821
  distance > 1 ? 2 - distance : distance
891
- ), l = linePath.getCoordinateAt(
822
+ ), a = linePath.getCoordinateAt(
892
823
  distance > 1 ? distance - 0.01 : distance
893
- ), i = linePath.getCoordinateAt(
824
+ ), s = linePath.getCoordinateAt(
894
825
  distance > 1 ? 2 - distance : distance + 0.01
895
826
  ), d = getRotation(
896
- mercatorToLonLat(l, "array"),
897
- mercatorToLonLat(i, "array")
827
+ mercatorToLonLat(a, "array"),
828
+ mercatorToLonLat(s, "array")
898
829
  ) * Math.PI / 180;
899
- (p = geoMarkerStyle.getText()) == null || p.setRotation(d), position.setCoordinates(a);
900
- const u = getVectorContext(e);
901
- u.setStyle(geoMarkerStyle), u.drawGeometry(position), mapInstance$1 == null || mapInstance$1.render();
830
+ (u = geoMarkerStyle.getText()) == null || u.setRotation(d), position.setCoordinates(l);
831
+ const p = getVectorContext(e);
832
+ p.setStyle(geoMarkerStyle), p.drawGeometry(position), mapInstance$1 == null || mapInstance$1.render();
902
833
  }, startAnimation = () => {
903
834
  var e;
904
835
  trackAnimating = !0, lastTime = Date.now(), distance = 0, position = ((e = startMarker.getGeometry()) == null ? void 0 : e.clone()) || new Point([0, 0]), moveFeatureHandler && (vectorLayer$3 == null || vectorLayer$3.on("postrender", moveFeatureHandler)), geoMarker == null || geoMarker.setGeometry(void 0);
@@ -916,8 +847,8 @@ const reRenderTrackLine = () => {
916
847
  type: "icon",
917
848
  geometry: new Point(linePath.getFirstCoordinate())
918
849
  });
919
- const o = startMarker.getGeometry();
920
- position = o ? o.clone() : new Point([0, 0]), geoMarker = new Feature({
850
+ const n = startMarker.getGeometry();
851
+ position = n ? n.clone() : new Point([0, 0]), geoMarker = new Feature({
921
852
  type: "geoMarker",
922
853
  style: geoMarkerStyle,
923
854
  geometry: position
@@ -925,43 +856,43 @@ const reRenderTrackLine = () => {
925
856
  source: new VectorSource({
926
857
  features: [geoMarker]
927
858
  })
928
- }), mapInstance$1 == null || mapInstance$1.addLayer(vectorLayer$3), moveFeatureHandler = (n) => moveFeature(n, t), startAnimation();
929
- }, getRotation = (e, t, o) => {
930
- function n(s) {
931
- return 180 * (s % (2 * Math.PI)) / Math.PI;
859
+ }), mapInstance$1 == null || mapInstance$1.addLayer(vectorLayer$3), moveFeatureHandler = (o) => moveFeature(o, t), startAnimation();
860
+ }, getRotation = (e, t, n) => {
861
+ function o(i) {
862
+ return 180 * (i % (2 * Math.PI)) / Math.PI;
932
863
  }
933
- function r(s) {
934
- return s % 360 * Math.PI / 180;
864
+ function r(i) {
865
+ return i % 360 * Math.PI / 180;
935
866
  }
936
- function a(s) {
937
- var p;
938
- if (!s) throw new Error("Coordinate is required");
939
- if (!Array.isArray(s)) {
940
- if ((s == null ? void 0 : s.type) === "Feature" && (s == null ? void 0 : s.geometry) !== null && ((p = s == null ? void 0 : s.geometry) == null ? void 0 : p.type) === "Point")
941
- return s == null ? void 0 : s.geometry.coordinates;
942
- if (s.type === "Point") return (s == null ? void 0 : s.coordinates) || [];
867
+ function l(i) {
868
+ var u;
869
+ if (!i) throw new Error("Coordinate is required");
870
+ if (!Array.isArray(i)) {
871
+ if ((i == null ? void 0 : i.type) === "Feature" && (i == null ? void 0 : i.geometry) !== null && ((u = i == null ? void 0 : i.geometry) == null ? void 0 : u.type) === "Point")
872
+ return i == null ? void 0 : i.geometry.coordinates;
873
+ if (i.type === "Point") return (i == null ? void 0 : i.coordinates) || [];
943
874
  }
944
- if (Array.isArray(s) && s.length >= 2 && !Array.isArray(s[0]) && !Array.isArray(s[1]))
945
- return s;
875
+ if (Array.isArray(i) && i.length >= 2 && !Array.isArray(i[0]) && !Array.isArray(i[1]))
876
+ return i;
946
877
  throw new Error(
947
878
  "Coordinate must be GeoJSON Point or an Array of numbers"
948
879
  );
949
880
  }
950
- function l(s, p, m = {}) {
881
+ function a(i, u, m = {}) {
951
882
  if (m.final)
952
- return function(k, M) {
953
- return (l(M, k) + 180) % 360;
954
- }(s, p);
955
- const g = a(s), y = a(p), v = r(g[0]), w = r(y[0]), L = r(g[1]), f = r(y[1]), T = Math.sin(w - v) * Math.cos(f), E = Math.cos(L) * Math.sin(f) - Math.sin(L) * Math.cos(f) * Math.cos(w - v);
956
- return n(Math.atan2(T, E));
883
+ return function(S, I) {
884
+ return (a(I, S) + 180) % 360;
885
+ }(i, u);
886
+ const g = l(i), y = l(u), v = r(g[0]), L = r(y[0]), w = r(g[1]), f = r(y[1]), E = Math.sin(L - v) * Math.cos(f), T = Math.cos(w) * Math.sin(f) - Math.sin(w) * Math.cos(f) * Math.cos(L - v);
887
+ return o(Math.atan2(E, T));
957
888
  }
958
- function i(s) {
959
- return !isNaN(s) && s !== null && !Array.isArray(s);
889
+ function s(i) {
890
+ return !isNaN(i) && i !== null && !Array.isArray(i);
960
891
  }
961
- function c(s, p = {}, m = {}) {
962
- return s || console.log("Coordinates are required"), Array.isArray(s) || console.log("Coordinates must be an Array"), s.length < 2 && console.log("Coordinates must be at least 2 numbers long"), (!i(s[0]) || !i(s[1])) && console.log("Coordinates must contain numbers"), d({ type: "Point", coordinates: s }, p, m);
892
+ function c(i, u = {}, m = {}) {
893
+ return i || console.log("Coordinates are required"), Array.isArray(i) || console.log("Coordinates must be an Array"), i.length < 2 && console.log("Coordinates must be at least 2 numbers long"), (!s(i[0]) || !s(i[1])) && console.log("Coordinates must contain numbers"), d({ type: "Point", coordinates: i }, u, m);
963
894
  }
964
- function d(s, p = {}, m = {}) {
895
+ function d(i, u = {}, m = {}) {
965
896
  const g = {
966
897
  type: "Feature",
967
898
  id: "",
@@ -969,30 +900,35 @@ const reRenderTrackLine = () => {
969
900
  bbox: {},
970
901
  geometry: {}
971
902
  };
972
- return m.id !== void 0 && (g.id = m.id), m.bbox && (g.bbox = m.bbox), g.properties = p, g.geometry = s, g;
903
+ return m.id !== void 0 && (g.id = m.id), m.bbox && (g.bbox = m.bbox), g.properties = u, g.geometry = i, g;
973
904
  }
974
- const u = l(c(e), c(t), o);
975
- return u < 0 ? 360 + u : u;
905
+ const p = a(c(e), c(t), n);
906
+ return p < 0 ? 360 + p : p;
976
907
  }, PORT_LAYER_CLASS_NAME = "zh-map-port-layer";
977
908
  let vectorLayer$2, vectorSource$2;
978
909
  const renderPortList = (e) => {
979
- var o;
980
- if (!e || e.length === 0) return;
981
- const t = getZoom();
982
- vectorSource$2 || (vectorSource$2 = new VectorSource()), e.forEach((n) => {
983
- if ((selectedPortFeature == null ? void 0 : selectedPortFeature.get("portData").id) === n.id) return;
984
- const [r, a] = n.latLon.split(","), l = new Feature({
985
- geometry: new Point(fromLonLat([Number(r), Number(a)]))
986
- });
987
- l.setStyle(setPortStyle(n, t, !1)), l.set("portData", n), vectorSource$2.addFeature(l);
988
- }), vectorLayer$2 || (vectorLayer$2 = new VectorLayer({
989
- className: PORT_LAYER_CLASS_NAME,
990
- source: vectorSource$2,
991
- zIndex: 100
992
- }), (o = getInstall()) == null || o.addLayer(vectorLayer$2));
993
- }, setPortStyle = (e, t, o) => {
994
- const n = (a) => `<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
995
- <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="${a}"/>
910
+ var t;
911
+ if (!(!e || e.length === 0)) {
912
+ if (vectorSource$2 || (vectorSource$2 = new VectorSource()), vectorSource$2.clear(), selectedPortData) {
913
+ const n = e.find((o) => o.id === selectedPortData.id);
914
+ n ? selectedPortData = n : e.push(selectedPortData);
915
+ }
916
+ e.forEach((n) => {
917
+ renderPortPoint(n);
918
+ }), vectorLayer$2 || (vectorLayer$2 = new VectorLayer({
919
+ className: PORT_LAYER_CLASS_NAME,
920
+ source: vectorSource$2,
921
+ zIndex: 100
922
+ }), (t = getInstall()) == null || t.addLayer(vectorLayer$2));
923
+ }
924
+ }, renderPortPoint = (e) => {
925
+ const t = getZoom(), [n, o] = e.latLon.split(","), r = new Feature({
926
+ geometry: new Point(fromLonLat([Number(n), Number(o)]))
927
+ });
928
+ r.setStyle(setPortStyle(e, t, e.id === (selectedPortData == null ? void 0 : selectedPortData.id))), r.set("portData", e), vectorSource$2.addFeature(r);
929
+ }, setPortStyle = (e, t, n) => {
930
+ const o = (l) => `<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
931
+ <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="${l}"/>
996
932
  <g clip-path="url(#clip0_10059_122082)">
997
933
  <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"/>
998
934
  </g>
@@ -1002,16 +938,16 @@ const renderPortList = (e) => {
1002
938
  </clipPath>
1003
939
  </defs>
1004
940
  </svg>
1005
- `, r = () => `data:image/svg+xml;utf8,${encodeURIComponent(n(o ? "#FF5733" : "#3370FF"))}`;
941
+ `, r = () => `data:image/svg+xml;utf8,${encodeURIComponent(o(n ? "#FF5733" : "#3370FF"))}`;
1006
942
  return new Style({
1007
943
  text: new Text({
1008
944
  text: e.shortName,
1009
945
  font: "12px sans-serif",
1010
946
  fill: new Fill({
1011
- color: o ? "#ffffff" : "#000000"
947
+ color: n ? "#ffffff" : "#000000"
1012
948
  }),
1013
949
  backgroundFill: new Fill({
1014
- color: o ? "#FF5733" : "#FFFFFF"
950
+ color: n ? "#FF5733" : "#FFFFFF"
1015
951
  }),
1016
952
  offsetY: 30
1017
953
  }),
@@ -1029,21 +965,26 @@ const renderPortList = (e) => {
1029
965
  });
1030
966
  } else
1031
967
  console.log("清除所有港口"), vectorSource$2.clear();
968
+ }, clearSelectedPort = () => {
969
+ const e = selectedPortFeature.get("portData"), t = getZoom();
970
+ vectorSource$2.getFeatures().forEach((o) => {
971
+ o.get("portData").id === e.id && (o == null || o.setStyle(setPortStyle(e, t, !1)));
972
+ }), selectedPortData = null, selectedPortFeature = null;
1032
973
  };
1033
- let selectedPortFeature = null;
974
+ let selectedPortFeature = null, selectedPortData = null;
1034
975
  const selectedPort = (e) => {
1035
- clearPrevSelectedPort(), addSelectedPortStyle(e);
976
+ e ? (clearPrevSelectedPort(), addSelectedPortStyle(e)) : clearSelectedPort();
1036
977
  }, clearPrevSelectedPort = () => {
1037
978
  if (selectedPortFeature) {
1038
979
  const e = selectedPortFeature.get("portData"), t = getZoom();
1039
980
  selectedPortFeature.setStyle(setPortStyle(e, t, !1));
1040
981
  }
1041
982
  }, addSelectedPortStyle = (e) => {
1042
- const t = e.get("portData"), o = getZoom();
1043
- selectedPortFeature = e, e.setStyle(setPortStyle(t, o, !0));
983
+ const t = vectorSource$2.getFeatures();
984
+ selectedPortData = e, selectedPortFeature = t.find((n) => n.get("portData").id === e.id);
1044
985
  }, handlePortHover = (e) => {
1045
- const t = getInstall(), o = t.forEachFeatureAtPixel(e, (n) => n);
1046
- o && o.get("portData") && (t.getTargetElement().style.cursor = "pointer");
986
+ const t = getInstall(), n = t.forEachFeatureAtPixel(e, (o) => o);
987
+ n && n.get("portData") && (t.getTargetElement().style.cursor = "pointer");
1047
988
  }, disableDoubleClickZoom = () => {
1048
989
  getInstall().getInteractions().forEach((t) => {
1049
990
  t instanceof DoubleClickZoom && t.setActive(!1);
@@ -1117,25 +1058,25 @@ const addInteraction = () => {
1117
1058
  }), getInstall().addInteraction(draw$1), createMeasureTooltip$1(), createHelpTooltip$1();
1118
1059
  let e;
1119
1060
  draw$1.on("drawstart", function(t) {
1120
- var n;
1061
+ var o;
1121
1062
  sketch$1 = t.feature, sketch$1.set("randomId", generateRandomId());
1122
- let o;
1123
- e = (n = sketch$1.getGeometry()) == null ? void 0 : n.on("change", function(r) {
1124
- const a = r.target, l = computedDistance(a, unit.value);
1125
- o = a.getLastCoordinate(), measureTooltipElement$1 && l && (measureTooltipElement$1.innerHTML = l), measureTooltip$1.setPosition(o);
1063
+ let n;
1064
+ e = (o = sketch$1.getGeometry()) == null ? void 0 : o.on("change", function(r) {
1065
+ const l = r.target, a = computedDistance(l, unit.value);
1066
+ n = l.getLastCoordinate(), measureTooltipElement$1 && a && (measureTooltipElement$1.innerHTML = a), measureTooltip$1.setPosition(n);
1126
1067
  });
1127
1068
  }), draw$1.on("drawend", function() {
1128
- var t, o, n;
1069
+ var t, n, o;
1129
1070
  if (measureTooltipElement$1 && (measureTooltipElement$1.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), measureTooltipElement$1 != null && measureTooltipElement$1.innerHTML) {
1130
1071
  const r = (sketch$1 == null ? void 0 : sketch$1.get("randomId")) || generateRandomId();
1131
1072
  measureHistory.value.push({ id: r, value: measureTooltipElement$1 == null ? void 0 : measureTooltipElement$1.innerHTML }), measureTooltipElement$1.innerHTML = `${measureTooltipElement$1.innerHTML}<div class="ol-tooltip-delete-button" data-id="${r}"><i class="map-iconfont icon-delete"></i></div>`;
1132
1073
  }
1133
1074
  (t = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || t.addEventListener("click", (r) => {
1134
- var l;
1075
+ var a;
1135
1076
  r.preventDefault(), r.stopPropagation();
1136
- const a = (l = r.target) == null ? void 0 : l.getAttribute("data-id");
1137
- a && deleteLine(a);
1138
- }), measureTooltip$1.setOffset([0, -7]), sketch$1 = null, measureTooltipElement$1 = null, createMeasureTooltip$1(), e && unByKey(e), (o = getProps()) != null && o.lineDrawEnd && ((n = getProps()) == null || n.lineDrawEnd(measureHistory.value));
1077
+ const l = (a = r.target) == null ? void 0 : a.getAttribute("data-id");
1078
+ l && deleteLine(l);
1079
+ }), measureTooltip$1.setOffset([0, -7]), sketch$1 = null, measureTooltipElement$1 = null, createMeasureTooltip$1(), e && unByKey(e), (n = getProps()) != null && n.lineDrawEnd && ((o = getProps()) == null || o.lineDrawEnd(measureHistory.value));
1139
1080
  });
1140
1081
  }, generateRandomId = () => Math.random().toString(36).substring(2, 9);
1141
1082
  let measureTooltipElement$1, measureTooltip$1;
@@ -1155,46 +1096,46 @@ const createMeasureTooltip$1 = () => {
1155
1096
  }), getInstall().addOverlay(helpTooltip);
1156
1097
  }, close$1 = () => {
1157
1098
  measureHistory.value.forEach((e, t) => {
1158
- var r, a;
1159
- const o = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
1160
- o[t] && ((a = (r = o[t]) == null ? void 0 : r.parentNode) == null || a.removeChild(o[t]));
1161
- const n = vectorSource$1.getFeatures();
1162
- n[t] && vectorSource$1.removeFeature(n[t]);
1099
+ var r, l;
1100
+ const n = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
1101
+ n[t] && ((l = (r = n[t]) == null ? void 0 : r.parentNode) == null || l.removeChild(n[t]));
1102
+ const o = vectorSource$1.getFeatures();
1103
+ o[t] && vectorSource$1.removeFeature(o[t]);
1163
1104
  }), removeInteraction(), enableDoubleClickZoom(), state.value = !1;
1164
1105
  }, deleteLine = (e) => {
1165
- var o, n, r, a;
1166
- const t = measureHistory.value.findIndex((l) => l.id === e);
1106
+ var n, o, r, l;
1107
+ const t = measureHistory.value.findIndex((a) => a.id === e);
1167
1108
  if (t !== -1) {
1168
1109
  measureHistory.value.splice(t, 1);
1169
- const l = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
1170
- l[t] && ((n = (o = l[t]) == null ? void 0 : o.parentNode) == null || n.removeChild(l[t]));
1171
- const i = vectorSource$1.getFeatures();
1172
- i[t] && vectorSource$1.removeFeature(i[t]);
1110
+ const a = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
1111
+ a[t] && ((o = (n = a[t]) == null ? void 0 : n.parentNode) == null || o.removeChild(a[t]));
1112
+ const s = vectorSource$1.getFeatures();
1113
+ s[t] && vectorSource$1.removeFeature(s[t]);
1173
1114
  }
1174
- (r = getProps()) != null && r.lineDrawEnd && ((a = getProps()) == null || a.lineDrawEnd(measureHistory.value));
1115
+ (r = getProps()) != null && r.lineDrawEnd && ((l = getProps()) == null || l.lineDrawEnd(measureHistory.value));
1175
1116
  }, computedDistance = (e, t) => {
1176
- const n = getLength(e);
1117
+ const o = getLength(e);
1177
1118
  let r = "";
1178
1119
  switch (t) {
1179
1120
  case "m":
1180
- r = `${Math.round(n * 100) / 100} m`;
1121
+ r = `${Math.round(o * 100) / 100} m`;
1181
1122
  break;
1182
1123
  case "km":
1183
- r = `${Math.round(n / 1e3 * 100) / 100} km`;
1124
+ r = `${Math.round(o / 1e3 * 100) / 100} km`;
1184
1125
  break;
1185
1126
  case "nm":
1186
- r = `${Math.round(n / 1.852 * 100) / 100} nm`;
1127
+ r = `${Math.round(o / 1.852 * 100) / 100} nm`;
1187
1128
  break;
1188
1129
  }
1189
1130
  return r;
1190
1131
  }, removeInteraction = () => {
1191
1132
  measureHistory.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((t) => {
1192
- var o;
1193
- (o = t == null ? void 0 : t.parentNode) == null || o.removeChild(t);
1133
+ var n;
1134
+ (n = t == null ? void 0 : t.parentNode) == null || n.removeChild(t);
1194
1135
  }), vectorSource$1.clear();
1195
1136
  const e = getInstall();
1196
1137
  if (draw$1) {
1197
- const t = e.getInteractions().getArray().find((o) => getUid(o) === getUid(draw$1));
1138
+ const t = e.getInteractions().getArray().find((n) => getUid(n) === getUid(draw$1));
1198
1139
  t && e.removeInteraction(t);
1199
1140
  }
1200
1141
  e.removeLayer(vectorLayer$1), helpTooltipElement$1 != null && helpTooltipElement$1.parentNode && helpTooltipElement$1.parentNode.removeChild(helpTooltipElement$1), measureTooltipElement$1 != null && measureTooltipElement$1.parentNode && measureTooltipElement$1.parentNode.removeChild(measureTooltipElement$1);
@@ -1211,8 +1152,8 @@ const createMeasureTooltip$1 = () => {
1211
1152
  var t;
1212
1153
  (t = getView()) == null || t.setZoom(e);
1213
1154
  }, setCenter = (e, t) => {
1214
- var o;
1215
- (o = getView()) == null || o.setCenter(fromLonLat([e, t]));
1155
+ var n;
1156
+ (n = getView()) == null || n.setCenter(fromLonLat([e, t]));
1216
1157
  }, getCenter = () => {
1217
1158
  var t;
1218
1159
  const e = (t = getView()) == null ? void 0 : t.getCenter();
@@ -1230,8 +1171,11 @@ const createMeasureTooltip$1 = () => {
1230
1171
  constrainResolution: !0,
1231
1172
  enableRotation: !1,
1232
1173
  multiWorld: !0
1233
- }, o = new Map$2({
1174
+ }, n = new Map$2({
1234
1175
  target: "map",
1176
+ controls: defaults({
1177
+ zoom: !1
1178
+ }),
1235
1179
  layers: [
1236
1180
  BASE_LAYER_MAP.get("vectorTile"),
1237
1181
  BASE_LAYER_MAP.get("vectorTileMark"),
@@ -1240,7 +1184,7 @@ const createMeasureTooltip$1 = () => {
1240
1184
  ],
1241
1185
  view: new View(t)
1242
1186
  });
1243
- mapInstance.value = o, setBaseMapEvent(o, e);
1187
+ mapInstance.value = n, setBaseMapEvent(n, e);
1244
1188
  }, setBaseLayerMap = (e) => {
1245
1189
  BASE_LAYER_MAP.set("vectorTile", new TileLayer({
1246
1190
  source: new XYZ({ url: BASE_MAP_LINK.vectorTile }),
@@ -1274,27 +1218,29 @@ const createMeasureTooltip$1 = () => {
1274
1218
  }));
1275
1219
  }, setBaseMapEvent = (e, t) => {
1276
1220
  e.on("moveend", () => {
1277
- var n;
1278
- const o = getZoom();
1279
- (n = t.mapMoveEnd) == null || n.call(t, o), reRenderTrackLine();
1280
- }), e.on("pointermove", (o) => {
1281
- const n = e.getEventPixel(o.originalEvent), r = e.forEachFeatureAtPixel(n, (a) => a);
1282
- handleShipMapEvent(r, "hover"), r && (handleTrackMapEvent(r, "hover", o), handlePortHover(n));
1283
- }), e.on("click", debounce((o) => {
1221
+ var o;
1222
+ const n = getZoom();
1223
+ (o = t.mapMoveEnd) == null || o.call(t, n), reRenderTrackLine();
1224
+ }), e.on("pointermove", (n) => {
1225
+ const o = e.getEventPixel(n.originalEvent), r = e.forEachFeatureAtPixel(o, (l) => l);
1226
+ handleShipMapEvent(r, "hover"), handleTrackMapEvent(r, "hover", n), r && handlePortHover(o);
1227
+ }), e.on("movestart", () => {
1228
+ removeSelectedOverlay();
1229
+ }), e.on("click", debounce((n) => {
1284
1230
  if (console.log("1", drawLine.getState()), drawLine.getState()) return;
1285
- const n = e.getEventPixel(o.originalEvent), r = e.forEachFeatureAtPixel(
1286
- n,
1287
- (a) => {
1288
- if (a != null && a.get("shipData") || a != null && a.get("portData"))
1289
- return a;
1231
+ const o = e.getEventPixel(n.originalEvent), r = e.forEachFeatureAtPixel(
1232
+ o,
1233
+ (l) => {
1234
+ if (l != null && l.get("shipData") || l != null && l.get("portData"))
1235
+ return l;
1290
1236
  }
1291
1237
  );
1292
1238
  if (console.log("2", r), !!r) {
1293
- if (o.preventDefault(), o.stopPropagation(), r.get("shipData"))
1239
+ if (n.preventDefault(), n.stopPropagation(), r.get("shipData"))
1294
1240
  handleShipMapEvent(r, "click", t == null ? void 0 : t.selectShip);
1295
1241
  else if (r.get("portData")) {
1296
- const a = r.get("portData");
1297
- selectedPort(r), t == null || t.selectPort(String(a == null ? void 0 : a.id));
1242
+ const l = r.get("portData");
1243
+ selectedPort(l), t == null || t.selectPort(l);
1298
1244
  }
1299
1245
  }
1300
1246
  }, 150));
@@ -1302,39 +1248,39 @@ const createMeasureTooltip$1 = () => {
1302
1248
  __name: "scaleLine",
1303
1249
  setup(e, { expose: t }) {
1304
1250
  return t({
1305
- setScaleLine: (n) => {
1306
- n || (n = "metric");
1251
+ setScaleLine: (o) => {
1252
+ o || (o = "metric");
1307
1253
  const r = new ScaleLine$1({
1308
- units: n
1309
- }), a = document.getElementById("scale-line-container");
1310
- a && (r.setTarget(a), getInstall().addControl(r));
1254
+ units: o
1255
+ }), l = document.getElementById("scale-line-container");
1256
+ l && (r.setTarget(l), getInstall().addControl(r));
1311
1257
  }
1312
- }), (n, r) => (openBlock(), createElementBlock("div", _hoisted_1$1));
1258
+ }), (o, r) => (openBlock(), createElementBlock("div", _hoisted_1$1));
1313
1259
  }
1314
1260
  }), ScaleLine = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-31ff8293"]]), _hoisted_1 = { class: "zoom" }, _sfc_main$1 = /* @__PURE__ */ defineComponent({
1315
1261
  __name: "zoomControl",
1316
1262
  setup(e) {
1317
- const t = inject("mapInstance"), o = () => {
1263
+ const t = inject("mapInstance"), n = () => {
1318
1264
  if (t != null && t.value) {
1319
1265
  const r = getZoom();
1320
1266
  if (!r) return;
1321
1267
  setZoom(r + 1);
1322
1268
  }
1323
- }, n = () => {
1269
+ }, o = () => {
1324
1270
  if (t != null && t.value) {
1325
1271
  const r = getZoom();
1326
1272
  if (!r) return;
1327
1273
  setZoom(r - 1);
1328
1274
  }
1329
1275
  };
1330
- return (r, a) => (openBlock(), createElementBlock("div", _hoisted_1, [
1276
+ return (r, l) => (openBlock(), createElementBlock("div", _hoisted_1, [
1331
1277
  createElementVNode("div", {
1332
1278
  class: "button big-button",
1333
- onClick: o
1279
+ onClick: n
1334
1280
  }, " + "),
1335
1281
  createElementVNode("div", {
1336
1282
  class: "button small-button",
1337
- onClick: n
1283
+ onClick: o
1338
1284
  }, " - ")
1339
1285
  ]));
1340
1286
  }
@@ -1344,30 +1290,34 @@ const createMeasureTooltip$1 = () => {
1344
1290
  }, layerType = ref("vector"), getShowLayerType = () => layerType.value, setShowLayerType = (e) => {
1345
1291
  layerType.value = e;
1346
1292
  const t = getLayers();
1347
- t && t.getArray().forEach((o) => {
1348
- o.setVisible(o.className_ === e);
1293
+ t && t.getArray().forEach((n) => {
1294
+ n.setVisible(n.className_ === e);
1349
1295
  });
1350
1296
  }, showGreenTile = ref(), getGreenTileVisible = () => showGreenTile.value, setGreenTileVisible = (e) => {
1351
1297
  if (e !== showGreenTile.value) {
1352
1298
  if (e) {
1353
1299
  const t = getLayers();
1354
- if (!t.getArray().find((n) => n.className_ === "greenTile")) {
1355
- const n = new TileLayer({
1300
+ if (!t.getArray().find((o) => o.className_ === "greenTile")) {
1301
+ const o = new TileLayer({
1356
1302
  source: new XYZ({ url: BASE_MAP_LINK.greenTile }),
1357
1303
  visible: e,
1358
1304
  zIndex: 2,
1359
1305
  className: "greenTile"
1360
1306
  });
1361
- t.push(n);
1307
+ t.push(o);
1362
1308
  }
1363
1309
  } else {
1364
- const t = getLayers(), o = t.getArray().find((n) => n.className_ === "greenTile");
1365
- o && t.remove(o);
1310
+ const t = getLayers(), n = t.getArray().find((o) => o.className_ === "greenTile");
1311
+ n && t.remove(n);
1366
1312
  }
1367
1313
  showGreenTile.value = e;
1368
1314
  }
1369
- }, open = () => {
1370
- initLayer(), initDraw(), createMeasureTooltip(), createHelpTooltip();
1315
+ };
1316
+ let storeFeature;
1317
+ const open = () => {
1318
+ init();
1319
+ }, init = () => {
1320
+ initLayer(), createMeasureTooltip(), createHelpTooltip(), initDraw();
1371
1321
  };
1372
1322
  let vectorLayer = null, vectorSource = null;
1373
1323
  const initLayer = () => {
@@ -1382,9 +1332,9 @@ const initLayer = () => {
1382
1332
  })
1383
1333
  });
1384
1334
  vectorLayer = t, vectorSource = e;
1385
- const o = getInstall();
1386
- o.on("pointermove", pointerMoveHandler), o.addLayer(t), o.on(["dblclick"], function(n) {
1387
- draw && (n.stopPropagation(), n.preventDefault());
1335
+ const n = getInstall();
1336
+ n.on("pointermove", pointerMoveHandler), n.addLayer(t), n.on(["dblclick"], function(o) {
1337
+ draw && (o.stopPropagation(), o.preventDefault());
1388
1338
  });
1389
1339
  };
1390
1340
  let sketch;
@@ -1393,9 +1343,32 @@ const pointerMoveHandler = (e) => {
1393
1343
  const t = sketch ? "单击继续,双击结束" : "点击选择起点";
1394
1344
  helpTooltipElement && (helpTooltipElement.innerHTML = t, tipOverlay.setPosition(e.coordinate));
1395
1345
  };
1396
- let draw;
1346
+ let draw, lineLimitError = !1;
1397
1347
  const initDraw = () => {
1398
- let e = !1;
1348
+ if (storeFeature) {
1349
+ helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement);
1350
+ const t = storeFeature.getGeometry();
1351
+ if (!t) return;
1352
+ const n = computedArea(t, "nm");
1353
+ measureTooltipElement && (measureTooltipElement.innerHTML = `
1354
+ <span class="text">面积:${n}${lineLimitError ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
1355
+ `), measureTooltipElement && (measureTooltipElement.innerHTML += '<span class="delete-icon" ><i class="map-iconfont icon-delete" /></div>');
1356
+ const o = t.getCoordinates(), r = o[0][o[0].length - 2];
1357
+ if (measureTooltip.setPosition(r), vectorLayer) {
1358
+ const a = vectorLayer.getSource();
1359
+ a && storeFeature && (a.clear(), a.addFeature(storeFeature));
1360
+ }
1361
+ setTimeout(() => {
1362
+ var a;
1363
+ (a = document.querySelector(".delete-icon")) == null || a.addEventListener("click", () => {
1364
+ var s;
1365
+ console.log("delete"), reset(), (s = getProps()) == null || s.areaDrawEnd([]);
1366
+ });
1367
+ }, 0);
1368
+ const l = getCenter$1(storeFeature.getGeometry().getExtent());
1369
+ getInstall().getView().setCenter(l);
1370
+ return;
1371
+ }
1399
1372
  draw = new Draw({
1400
1373
  type: "Polygon",
1401
1374
  source: vectorSource,
@@ -1416,31 +1389,31 @@ const initDraw = () => {
1416
1389
  color: "rgb(51,112,255, 1)"
1417
1390
  })
1418
1391
  }),
1419
- geometry: function(o) {
1420
- const n = o.getGeometry().getCoordinates();
1392
+ geometry: function(t) {
1393
+ const n = t.getGeometry().getCoordinates();
1421
1394
  return new MultiPoint(n);
1422
1395
  }
1423
1396
  })]
1424
1397
  }), getInstall().addInteraction(draw);
1425
- let t;
1426
- draw.on("drawstart", (o) => {
1398
+ let e;
1399
+ draw.on("drawstart", (t) => {
1427
1400
  var n;
1428
- sketch = o.feature, t = (n = sketch.getGeometry()) == null ? void 0 : n.on("change", (r) => {
1429
- const a = r.target, l = computedArea(a, "nm"), c = a.getCoordinates()[0], d = new LineString([c[c.length - 2], c[c.length - 1]]), u = computedDistance(d, "nm");
1430
- if (e = Number(getLength(d) / 1e3) > 150, !l) return;
1431
- const s = '<span class="error pl-4">超出可以绘画的距离</span>';
1401
+ sketch = t.feature, e = (n = sketch.getGeometry()) == null ? void 0 : n.on("change", (o) => {
1402
+ const r = o.target, l = computedArea(r, "nm"), s = r.getCoordinates()[0], c = new LineString([s[s.length - 2], s[s.length - 1]]), d = computedDistance(c, "nm");
1403
+ if (lineLimitError = Number(getLength(c) / 1e3) > 150, !l) return;
1404
+ const p = '<span class="error pl-4">超出可以绘画的距离</span>';
1432
1405
  measureTooltipElement && (measureTooltipElement.innerHTML = `
1433
1406
  <div class="text">
1434
1407
  面积:${l}
1435
- ${e ? s : ""}
1408
+ ${lineLimitError ? p : ""}
1436
1409
  </div>
1437
1410
  `), helpTooltipElement && (helpTooltipElement.innerHTML = `
1438
1411
  <div class="text">
1439
1412
  面积:${l}
1440
1413
  </div>
1441
- <div class="text ${e ? "error" : ""}">
1442
- 线段 ${c.length - 2}: ${u}
1443
- ${e ? s : ""}
1414
+ <div class="text ${lineLimitError ? "error" : ""}">
1415
+ 线段 ${s.length - 2}: ${d}
1416
+ ${lineLimitError ? p : ""}
1444
1417
 
1445
1418
  </div>
1446
1419
  <div>
@@ -1448,24 +1421,30 @@ const initDraw = () => {
1448
1421
  </div>
1449
1422
  `);
1450
1423
  });
1451
- }), draw.on("drawend", (o) => {
1452
- var l, i, c;
1453
- if (!o.feature.getGeometry()) return;
1454
- measureTooltipElement && (measureTooltipElement.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), measureTooltip.setOffset([10, 0]);
1455
- const r = o.feature.getGeometry().getCoordinates(), a = r[0][r[0].length - 2];
1456
- measureTooltip.setPosition(a), helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement), (l = getProps()) != null && l.areaDrawEnd && ((i = getProps()) == null || i.areaDrawEnd(r)), draw && (draw.setActive(!1), getInstall().removeInteraction(draw), getInstall().getInteractions().forEach((u) => {
1457
- u instanceof Draw && (u.setActive(!1), getInstall().removeInteraction(u));
1458
- })), t && unByKey(t), (c = document.querySelector(".delete-icon")) == null || c.addEventListener("click", () => {
1459
- reset();
1424
+ }), draw.on("drawend", (t) => {
1425
+ var l, a, s;
1426
+ if (!t.feature.getGeometry()) return;
1427
+ storeFeature = t.feature, measureTooltipElement && (measureTooltipElement.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), measureTooltip.setOffset([10, 0]);
1428
+ const n = t.feature.getGeometry(), o = n.getCoordinates(), r = o[0][o[0].length - 2];
1429
+ if (measureTooltip.setPosition(r), helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement), (l = getProps()) != null && l.areaDrawEnd) {
1430
+ n.getInteriorPoint().getCoordinates();
1431
+ const c = o[0].map((d) => transform(d, projection.mercator, projection.data));
1432
+ (a = getProps()) == null || a.areaDrawEnd(c);
1433
+ }
1434
+ draw && (draw.setActive(!1), getInstall().removeInteraction(draw), getInstall().getInteractions().forEach((d) => {
1435
+ d instanceof Draw && (d.setActive(!1), getInstall().removeInteraction(d));
1436
+ })), e && unByKey(e), (s = document.querySelector(".delete-icon")) == null || s.addEventListener("click", () => {
1437
+ var c;
1438
+ reset(), (c = getProps()) == null || c.areaDrawEnd([]);
1460
1439
  });
1461
1440
  });
1462
1441
  }, computedArea = (e, t) => {
1463
- const o = getArea(e);
1442
+ const n = getArea(e);
1464
1443
  switch (t) {
1465
1444
  case "km":
1466
- return o > 1e4 ? Math.round(o / 1e6 * 100) / 100 + " km<sup>2</sup>" : Math.round(o * 100) / 100 + " m<sup>2</sup>";
1445
+ return n > 1e4 ? Math.round(n / 1e6 * 100) / 100 + " km<sup>2</sup>" : Math.round(n * 100) / 100 + " m<sup>2</sup>";
1467
1446
  case "nm":
1468
- return o > 1e4 ? Math.round(o / 1e6 / Math.pow(1.852, 2) * 100) / 100 + " nm<sup>2</sup>" : Math.round(o * 100) / 100 + " m<sup>2</sup>";
1447
+ return n > 1e4 ? Math.round(n / 1e6 / Math.pow(1.852, 2) * 100) / 100 + " nm<sup>2</sup>" : Math.round(n * 100) / 100 + " m<sup>2</sup>";
1469
1448
  }
1470
1449
  };
1471
1450
  let measureTooltipElement, measureTooltip;
@@ -1473,68 +1452,29 @@ const createMeasureTooltip = () => {
1473
1452
  measureTooltipElement != null && measureTooltipElement.parentNode && measureTooltipElement.parentNode.removeChild(measureTooltipElement), measureTooltipElement = document.createElement("div"), measureTooltipElement.style.display = "flex", measureTooltipElement.className = "ol-tooltip ol-tooltip-draw-polygon", measureTooltip = new Overlay({
1474
1453
  element: measureTooltipElement,
1475
1454
  offset: [0, -15],
1476
- positioning: "bottom-center"
1477
- // stopEvent: false,
1478
- // insertFirst: false
1455
+ positioning: "bottom-center",
1456
+ stopEvent: !1,
1457
+ insertFirst: !1
1479
1458
  }), getInstall().addOverlay(measureTooltip);
1480
1459
  };
1481
1460
  let helpTooltipElement, tipOverlay;
1482
1461
  const createHelpTooltip = () => {
1483
- helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement), helpTooltipElement = document.createElement("div"), helpTooltipElement.className = "ol-tooltip ol-help-tooltip hidden", tipOverlay = new Overlay({
1462
+ helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement), helpTooltipElement = document.createElement("div"), helpTooltipElement.className = "ol-tooltip ol-help-tooltip", tipOverlay = new Overlay({
1484
1463
  element: helpTooltipElement,
1485
1464
  offset: [15, 0],
1486
1465
  positioning: "center-left"
1487
1466
  }), getInstall().addOverlay(tipOverlay);
1488
1467
  }, reset = () => {
1489
- var e;
1490
- vectorSource == null || vectorSource.clear(), draw == null || draw.setActive(!0), (e = measureTooltipElement == null ? void 0 : measureTooltipElement.parentNode) == null || e.removeChild(measureTooltipElement), measureTooltip.setPosition(void 0), createMeasureTooltip(), createHelpTooltip(), getInstall().removeOverlay(tipOverlay), getInstall().removeOverlay(measureTooltip), initDraw();
1468
+ vectorSource == null || vectorSource.clear(), storeFeature = null, createMeasureTooltip(), createHelpTooltip(), initDraw();
1491
1469
  }, close = () => {
1492
- vectorSource == null || vectorSource.clear(), vectorSource = null;
1493
1470
  const e = getInstall();
1494
- vectorLayer && (e.removeLayer(vectorLayer), vectorLayer = null), sketch = null, draw && (e.removeInteraction(draw), draw = null);
1471
+ vectorSource == null || vectorSource.clear(), vectorSource = null, vectorLayer && (e.removeLayer(vectorLayer), vectorLayer = null), sketch = null, draw && (draw = null, e.getInteractions().forEach((t) => {
1472
+ t instanceof Draw && e.removeInteraction(t);
1473
+ })), helpTooltipElement != null && helpTooltipElement.parentElement && helpTooltipElement.parentElement.removeChild(helpTooltipElement), measureTooltipElement != null && measureTooltipElement.parentElement && measureTooltipElement.parentElement.removeChild(measureTooltipElement), tipOverlay && e.removeOverlay(tipOverlay), measureTooltip && e.removeOverlay(measureTooltip);
1495
1474
  }, drawPolygon = {
1496
1475
  open,
1497
- reset,
1498
- close
1499
- };
1500
- let currentTruckOverlay = null;
1501
- const locationTruck = async (e) => {
1502
- const t = getInstall();
1503
- if (!t || (console.log("vehicleInfo", e), !(e != null && e.lon && (e != null && e.lat)))) return;
1504
- const o = Math.abs(Number(e.lon)) > 180 ? convertSixHundredThousandToLatLng(e.lon, e.lat) : [e.lon, e.lat];
1505
- drawTruckIcon(e, fromLonLat(o));
1506
- const n = t.getView(), r = new Point(o);
1507
- n.setCenter(transform(r.getCoordinates(), projection.data, projection.mercator));
1508
- }, drawTruckIcon = (e, t) => {
1509
- const o = getInstall(), n = `${CDN_URL}map/car-icon.gif`;
1510
- currentTruckOverlay || (currentTruckOverlay = new Overlay({
1511
- element: document.createElement("div"),
1512
- positioning: "center-center",
1513
- stopEvent: !1
1514
- // 允许交互事件穿透
1515
- }), o.addOverlay(currentTruckOverlay));
1516
- const r = currentTruckOverlay.getElement();
1517
- r.style.backgroundImage = `url(${n})`, r.style.width = "80px", r.style.height = "80px";
1518
- const a = (e == null ? void 0 : e.drc) || "";
1519
- r.style.transform = `rotate(${a}deg)`, r.style.backgroundSize = "cover", currentTruckOverlay == null || currentTruckOverlay.setPosition(t);
1520
- }, renderTruckTrack = (e, t, o, n = 1e3) => {
1521
- renderTrackLine(e, t, o, LENGTH_UNIT.KM, "truck", n);
1522
- }, closeTruckTrack = () => {
1523
- closeTrack();
1524
- }, removeTruckIcon = () => {
1525
- const e = currentTruckOverlay == null ? void 0 : currentTruckOverlay.getElement();
1526
- e && (e.innerHTML = "");
1527
- }, resetTrackView = (e) => {
1528
- setTrackViewCenter(e);
1529
- }, playTrack = (e, t) => {
1530
- playShipTrack(e, t);
1531
- }, carTrack = {
1532
- locationTruck,
1533
- renderTruckTrack,
1534
- removeTruckIcon,
1535
- closeTruckTrack,
1536
- resetTrackView,
1537
- playTrack
1476
+ close,
1477
+ reset
1538
1478
  }, _sfc_main = /* @__PURE__ */ defineComponent({
1539
1479
  __name: "Map",
1540
1480
  props: {
@@ -1555,10 +1495,10 @@ const locationTruck = async (e) => {
1555
1495
  } }
1556
1496
  },
1557
1497
  setup(e, { expose: t }) {
1558
- const o = ref(), n = ref(), r = e;
1498
+ const n = ref(), o = ref(), r = e;
1559
1499
  return console.log(r), onMounted(() => {
1560
- var l;
1561
- initMap(r), setProps(r), setShowLayerType(r.layerType), setGreenTileVisible(r.showGreenLayer), (l = n.value) == null || l.setScaleLine(r.scaleLineUnit);
1500
+ var a;
1501
+ initMap(r), setProps(r), setShowLayerType(r.layerType), setGreenTileVisible(r.showGreenLayer), (a = o.value) == null || a.setScaleLine(r.scaleLineUnit);
1562
1502
  }), t({
1563
1503
  getInstall,
1564
1504
  getZoom,
@@ -1580,12 +1520,12 @@ const locationTruck = async (e) => {
1580
1520
  clear: clearShipList
1581
1521
  },
1582
1522
  track: {
1583
- renderTrackLine,
1584
- handleTrackMapEvent,
1585
- removeAllTrackLayer,
1586
- playShipTrack,
1587
- setTrackViewCenter,
1588
- closeTrack
1523
+ render: renderTrackLine,
1524
+ remove: removeAllTrackLayer,
1525
+ play: playShipTrack,
1526
+ setCenter: setTrackViewCenter,
1527
+ close: closeTrack,
1528
+ getLength: getTrackLength
1589
1529
  },
1590
1530
  port: {
1591
1531
  render: renderPortList,
@@ -1595,30 +1535,30 @@ const locationTruck = async (e) => {
1595
1535
  drawLine,
1596
1536
  // 绘制矩形
1597
1537
  drawPolygon,
1598
- carTrack,
1538
+ carTrack: {},
1599
1539
  utils: {
1600
1540
  getCalculateExtent: () => {
1601
- const l = getView().calculateExtent(getSize()), i = transform([l[0], l[1]], projection.mercator, projection.data), c = transform([l[2], l[3]], projection.mercator, projection.data);
1602
- return [i[0], i[1], c[0], c[1]];
1541
+ const a = getView().calculateExtent(getSize()), s = transform([a[0], a[1]], projection.mercator, projection.data), c = transform([a[2], a[3]], projection.mercator, projection.data);
1542
+ return [s[0], s[1], c[0], c[1]];
1603
1543
  },
1604
1544
  convertSixHundredThousandToLatLng,
1605
1545
  calculateCirclePoints
1606
1546
  }
1607
- }), (l, i) => (openBlock(), createElementBlock(Fragment, null, [
1547
+ }), (a, s) => (openBlock(), createElementBlock(Fragment, null, [
1608
1548
  createElementVNode("div", {
1609
1549
  id: "map",
1610
1550
  ref_key: "zhMapRef",
1611
- ref: o,
1551
+ ref: n,
1612
1552
  class: "zh-map"
1613
1553
  }, null, 512),
1614
1554
  createVNode(ScaleLine, {
1615
1555
  ref_key: "scaleLineRef",
1616
- ref: n
1556
+ ref: o
1617
1557
  }, null, 512),
1618
1558
  createVNode(ZoomControl, { ref: "zoomControlRef" }, null, 512)
1619
1559
  ], 64));
1620
1560
  }
1621
- }), Map$1 = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-6a8d9fff"]]), ZhMap = withInstall(Map$1);
1561
+ }), Map$1 = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ba6106d4"]]), ZhMap = withInstall(Map$1);
1622
1562
  export {
1623
1563
  ZhMap as Z
1624
1564
  };