zhihao-ui 1.2.36 → 1.2.38

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 (40) hide show
  1. package/dist/es/{BaseInfo-C4sgm12k.js → BaseInfo-BjqSNfhB.js} +1 -1
  2. package/dist/es/{BaseItem-DwoIxH38.js → BaseItem-Da1CQtVm.js} +3 -3
  3. package/dist/es/{Button-BbUxF68h.js → Button-CKHqdHWj.js} +2 -2
  4. package/dist/es/{DatePicker-BkfvEDok.js → DatePicker-BOkpRWph.js} +3 -3
  5. package/dist/es/{DetailHeader-CmvLT5jU.js → DetailHeader-CL5Fin_g.js} +3 -3
  6. package/dist/es/{DetailSubTitle-BXjqx7Gl.js → DetailSubTitle-Derdb7AV.js} +2 -2
  7. package/dist/es/{Dialog-CiO2p3lS.js → Dialog-CGN6pFzA.js} +3 -3
  8. package/dist/es/{DiyDataTable-02Fvx4gj.js → DiyDataTable-CUbUe8NL.js} +4 -4
  9. package/dist/es/{EditInfoPair-2lOiJK1x.js → EditInfoPair-Dd_u_yvQ.js} +3 -3
  10. package/dist/es/{FileWrapper-oSb83fz-.js → FileWrapper-CGoXaXk9.js} +4 -4
  11. package/dist/es/{Grid-CHKAGBr9.js → Grid-Dr8kPvc8.js} +2 -2
  12. package/dist/es/{InfoPair-CDbyplp2.js → InfoPair-B2VzU1pL.js} +3 -3
  13. package/dist/es/{Input-CWfFyiHL.js → Input-DbqCWZ3K.js} +3 -3
  14. package/dist/es/{Loading-nlPpGN-L.js → Loading-Dimy_7_w.js} +2 -2
  15. package/dist/es/{Map-DngWgfIX.js → Map-BM9UCaCC.js} +1190 -1150
  16. package/dist/es/{MessageBox-DJR9qhIT.js → MessageBox-B54tNjcZ.js} +2 -2
  17. package/dist/es/{MoneyInput-BGmF3L2m.js → MoneyInput-uw4tR9WE.js} +8 -8
  18. package/dist/es/{PageHeadPanel-Bw6wb6jF.js → PageHeadPanel-CgR9a7c6.js} +2 -2
  19. package/dist/es/{Table-D8EshRWb.js → Table-BdySjJta.js} +5 -5
  20. package/dist/es/{ToolTips-Beib4mGU.js → ToolTips-BHQkWmMR.js} +6 -6
  21. package/dist/es/index.js +23 -23
  22. package/dist/es/{utils-hD_p7bGY.js → utils-DUHqvTHl.js} +1 -1
  23. package/dist/es/{vendor-Bonn9k5m.js → vendor-B7FHttiN.js} +229 -228
  24. package/dist/index.css +1 -1
  25. package/dist/types/components/Map/components/scaleLine.vue.d.ts +2 -2
  26. package/dist/types/components/Map/components/toolPanel.vue.d.ts +2 -2
  27. package/dist/types/components/Map/interface/entity/render.d.ts +1 -1
  28. package/dist/types/components/Map/render/canvasRender/renderCustomOverlay.d.ts +3 -3
  29. package/dist/types/components/Map/render/canvasRender/renderShipStyle.d.ts +1 -2
  30. package/dist/types/components/Map/render/canvasRender/renderTrackStyle.d.ts +1 -2
  31. package/dist/types/components/Map/render/drawPolygon.d.ts +1 -2
  32. package/dist/types/components/Map/render/renderDashboard.d.ts +1 -2
  33. package/dist/types/components/Map/render/renderMarker.d.ts +1 -1
  34. package/dist/types/components/Map/render/renderShip.d.ts +4 -5
  35. package/dist/types/components/Map/render/renderTrack.d.ts +1 -1
  36. package/dist/types/components/Map/render/renderTruck.d.ts +1 -2
  37. package/dist/types/components/Map/utils/store.d.ts +3 -2
  38. package/dist/umd/index.css +1 -1
  39. package/dist/umd/index.umd.cjs +18 -18
  40. package/package.json +1 -1
@@ -1,14 +1,14 @@
1
- var B = Object.defineProperty;
2
- var _ = (e, t, o) => t in e ? B(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
3
- var I = (e, t, o) => _(e, typeof t != "symbol" ? t + "" : t, o);
1
+ var U = Object.defineProperty;
2
+ var z = (e, t, o) => t in e ? U(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
3
+ var I = (e, t, o) => z(e, typeof t != "symbol" ? t + "" : t, o);
4
4
  import { defineComponent, inject, useModel, ref, watch, openBlock, createElementBlock, createElementVNode, createVNode, unref, withCtx, Fragment, renderList, toDisplayString, createCommentVNode, mergeModels, nextTick, onMounted, normalizeClass, renderSlot, createBlock, useCssVars, computed, provide } from "vue";
5
- import { p as getArea, q as getLength, V as VectorSource, r as VectorLayer, S as Style, C as CircleStyle, F as Fill, s as Stroke, D as Draw, O as Overlay, u as unByKey, t as ElSelect, v as ElOption, w as fromLonLat, P as Point, x as transform, y as Feature, T as Text, I as Icon, z as Translate, A as toLonLat, B as transformExtent, h as hooks, L as LineString, G as Polyline, H as getVectorContext, i as cloneDeep, J as GeoJSON, W as WebGLPointsLayer, K as Circle, M as buffer, N as ScaleLine$1, Q as MultiPoint, R as getCenter, U as TileLayer, X as XYZ, Y as Map$1, Z as View } from "./vendor-Bonn9k5m.js";
6
- import { _ as _export_sfc } from "./Button-BbUxF68h.js";
7
- import { g as getForegroundColor } from "./DatePicker-BkfvEDok.js";
8
- import { w as withInstall } from "./utils-hD_p7bGY.js";
5
+ import { p as getArea, q as getLength, V as VectorSource, r as VectorLayer, S as Style, C as CircleStyle, F as Fill, s as Stroke, D as Draw, O as Overlay, u as unByKey, t as ElSelect, v as ElOption, w as fromLonLat, P as Point, x as transform, y as Feature, T as Text, I as Icon, z as Translate, A as toLonLat, i as cloneDeep, G as GeoJSON, W as WebGLPointsLayer, B as Circle, H as transformExtent, h as hooks, L as LineString, J as Polyline, K as getVectorContext, M as buffer, N as ScaleLine$1, Q as MultiPoint, R as getUid, U as getCenter, X as TileLayer, Y as XYZ, Z as Map$1, _ as View } from "./vendor-B7FHttiN.js";
6
+ import { _ as _export_sfc } from "./Button-CKHqdHWj.js";
7
+ import { g as getForegroundColor } from "./DatePicker-BOkpRWph.js";
8
+ import { w as withInstall } from "./utils-DUHqvTHl.js";
9
9
  var BaseMapType = /* @__PURE__ */ ((e) => (e[e.vector = 0] = "vector", e[e.satellite = 1] = "satellite", e))(BaseMapType || {}), SEARCH_TYPE = /* @__PURE__ */ ((e) => (e[e.SEARCH_SHIP = 0] = "SEARCH_SHIP", e[e.SEARCH_PORT = 1] = "SEARCH_PORT", e[e.SEARCH_CUSTOM = 2] = "SEARCH_CUSTOM", e))(SEARCH_TYPE || {}), COPY_RIGHT_TYPE = /* @__PURE__ */ ((e) => (e[e.HORIZONTAL = 0] = "HORIZONTAL", e[e.VERTICAL = 1] = "VERTICAL", e))(COPY_RIGHT_TYPE || {}), CAR_COLOR = /* @__PURE__ */ ((e) => (e[e.BLUE = 1] = "BLUE", e[e.YELLOW = 2] = "YELLOW", e[e.Y_GREEN = 3] = "Y_GREEN", e))(CAR_COLOR || {}), DEVICE_TYPE = /* @__PURE__ */ ((e) => (e[e.HOST = 1] = "HOST", e[e.TALK = 2] = "TALK", e[e.STORAGE = 3] = "STORAGE", e[e.INTERNET = 4] = "INTERNET", e[e.CAMERA = 5] = "CAMERA", e[e.LOAD = 6] = "LOAD", e))(DEVICE_TYPE || {}), LENGTH_UNIT = /* @__PURE__ */ ((e) => (e[e.M = 1] = "M", e[e.KM = 2] = "KM", e[e.NM = 3] = "NM", e))(LENGTH_UNIT || {}), SWITCH_BTN = /* @__PURE__ */ ((e) => (e.Camera = "camera", e.Mobile = "mobile", e.WaterGauge = "waterGauge", e))(SWITCH_BTN || {}), 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 || {});
10
10
  class ShipMapData {
11
- constructor(t, o, n, l, r, i, c, s, d, m, u, f, p, w, h, g, T, M, b, V, P, x, v, y) {
11
+ constructor(t, o, n, l, r, i, c, s, m, u, d, f, p, y, h, g, k, M, b, x, F, P, v, L) {
12
12
  I(this, "id");
13
13
  // mmsi
14
14
  I(this, "mmsi");
@@ -50,7 +50,7 @@ class ShipMapData {
50
50
  I(this, "existWaterGauge");
51
51
  I(this, "selected");
52
52
  I(this, "blinkColors");
53
- this.id = t, this.mmsi = o, this.fill = n, this.shipType = l, this.name = r, this.length = i, this.breadth = c, this.lon = s, this.lat = d, this.createdAt = m, this.speed = u, this.from = f, this.sailStatus = p, this.hdg = w, this.cog = h, this.posType = g, this.type = T, this.angle = M, this.leftIconColor = b, this.existDevice = V, this.existMobile = P, this.existWaterGauge = x, this.selected = v, this.blinkColors = y;
53
+ this.id = t, this.mmsi = o, this.fill = n, this.shipType = l, this.name = r, this.length = i, this.breadth = c, this.lon = s, this.lat = m, this.createdAt = u, this.speed = d, this.from = f, this.sailStatus = p, this.hdg = y, this.cog = h, this.posType = g, this.type = k, this.angle = M, this.leftIconColor = b, this.existDevice = x, this.existMobile = F, this.existWaterGauge = P, this.selected = v, this.blinkColors = L;
54
54
  }
55
55
  }
56
56
  const formatLength = function(e, t) {
@@ -130,10 +130,10 @@ const formatLength = function(e, t) {
130
130
  }),
131
131
  emits: /* @__PURE__ */ mergeModels(["close"], ["update:visible"]),
132
132
  setup(e, { expose: t, emit: o }) {
133
- const n = inject("mapInstance"), l = o, r = useModel(e, "visible"), i = ref("3"), c = ref([]), s = ref(!1), d = new VectorSource();
134
- let m, u, f, p, w;
133
+ const n = inject("mapInstance"), l = o, r = useModel(e, "visible"), i = ref("3"), c = ref([]), s = ref(!1), m = new VectorSource();
134
+ let u, d, f, p, y;
135
135
  const h = new VectorLayer({
136
- source: d,
136
+ source: m,
137
137
  style: {
138
138
  "fill-color": "rgba(255, 255, 255, 0.2)",
139
139
  "stroke-color": "#ffcc33",
@@ -141,15 +141,15 @@ const formatLength = function(e, t) {
141
141
  "circle-radius": 7,
142
142
  "circle-fill-color": "#ffcc33"
143
143
  }
144
- }), g = function(k) {
145
- if (k.dragging)
144
+ }), g = function(S) {
145
+ if (S.dragging)
146
146
  return;
147
- let S = "点击选择起点";
148
- m && (S = "单击继续,双击结束"), u && (u.innerHTML = S, f.setPosition(k.coordinate), u.classList.remove("hidden"));
149
- }, T = () => {
147
+ let T = "点击选择起点";
148
+ u && (T = "单击继续,双击结束"), d && (d.innerHTML = T, f.setPosition(S.coordinate), d.classList.remove("hidden"));
149
+ }, k = () => {
150
150
  n.value && (n.value.on("pointermove", g), n.value.getViewport().addEventListener("mouseout", function() {
151
- var k;
152
- (k = u == null ? void 0 : u.classList) == null || k.add("hidden");
151
+ var S;
152
+ (S = d == null ? void 0 : d.classList) == null || S.add("hidden");
153
153
  }), s.value = !0);
154
154
  };
155
155
  let M;
@@ -172,95 +172,95 @@ const formatLength = function(e, t) {
172
172
  })
173
173
  })
174
174
  });
175
- function V() {
176
- var k, S;
175
+ function x() {
176
+ var S, T;
177
177
  if (n.value) {
178
178
  if (c.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((E) => {
179
179
  var C;
180
180
  (C = E == null ? void 0 : E.parentNode) == null || C.removeChild(E);
181
- }), d.clear(), M) {
181
+ }), m.clear(), M) {
182
182
  const E = n.value.getInteractions().getArray().find((C) => C.ol_uid === M.ol_uid);
183
- E && ((k = n.value) == null || k.removeInteraction(E));
183
+ E && ((S = n.value) == null || S.removeInteraction(E));
184
184
  }
185
- (S = n.value) == null || S.removeLayer(h), u != null && u.parentNode && u.parentNode.removeChild(u), p != null && p.parentNode && p.parentNode.removeChild(p);
185
+ (T = n.value) == null || T.removeLayer(h), d != null && d.parentNode && d.parentNode.removeChild(d), p != null && p.parentNode && p.parentNode.removeChild(p);
186
186
  }
187
187
  }
188
- function P() {
189
- var S, E;
190
- V(), (S = n.value) == null || S.addLayer(h), M = new Draw({
191
- source: d,
188
+ function F() {
189
+ var T, E;
190
+ x(), (T = n.value) == null || T.addLayer(h), M = new Draw({
191
+ source: m,
192
192
  type: "LineString",
193
193
  style: function() {
194
194
  return b;
195
195
  }
196
- }), (E = n.value) == null || E.addInteraction(M), v(), x();
197
- let k;
196
+ }), (E = n.value) == null || E.addInteraction(M), v(), P();
197
+ let S;
198
198
  M.on("drawstart", function(C) {
199
- var $;
200
- m = C.feature;
201
- let F;
202
- k = ($ = m.getGeometry()) == null ? void 0 : $.on("change", function(R) {
203
- const A = R.target;
204
- let N = formatUtils.formatLength(A, Number(i.value));
205
- F = A.getLastCoordinate(), p && N && (p.innerHTML = N), w.setPosition(F);
199
+ var N;
200
+ u = C.feature;
201
+ let V;
202
+ S = (N = u.getGeometry()) == null ? void 0 : N.on("change", function(A) {
203
+ const $ = A.target;
204
+ let R = formatUtils.formatLength($, Number(i.value));
205
+ V = $.getLastCoordinate(), p && R && (p.innerHTML = R), y.setPosition(V);
206
206
  });
207
207
  }), M.on("drawend", function() {
208
- var C, F;
209
- p && (p.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), p != null && p.innerHTML && (c.value.push(p == null ? void 0 : p.innerHTML), p.innerHTML = `${p.innerHTML}<div class="ol-tooltip-delete-button" data-index="${((C = c.value) == null ? void 0 : C.length) - 1}"><i class="map-iconfont icon-delete"></i></div>`), (F = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || F.addEventListener("click", ($) => {
210
- var A;
211
- $.preventDefault(), $.stopPropagation();
212
- const R = (A = $.target) == null ? void 0 : A.getAttribute("data-index");
213
- R && y(Number(R));
214
- }), w.setOffset([0, -7]), m = null, p = null, v(), k && unByKey(k);
208
+ var C, V;
209
+ p && (p.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), p != null && p.innerHTML && (c.value.push(p == null ? void 0 : p.innerHTML), p.innerHTML = `${p.innerHTML}<div class="ol-tooltip-delete-button" data-index="${((C = c.value) == null ? void 0 : C.length) - 1}"><i class="map-iconfont icon-delete"></i></div>`), (V = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || V.addEventListener("click", (N) => {
210
+ var $;
211
+ N.preventDefault(), N.stopPropagation();
212
+ const A = ($ = N.target) == null ? void 0 : $.getAttribute("data-index");
213
+ A && L(Number(A));
214
+ }), y.setOffset([0, -7]), u = null, p = null, v(), S && unByKey(S);
215
215
  });
216
216
  }
217
- function x() {
218
- var k;
219
- u != null && u.parentNode && u.parentNode.removeChild(u), u = document.createElement("div"), u.className = "ol-tooltip hidden", f = new Overlay({
220
- element: u,
217
+ function P() {
218
+ var S;
219
+ d != null && d.parentNode && d.parentNode.removeChild(d), d = document.createElement("div"), d.className = "ol-tooltip hidden", f = new Overlay({
220
+ element: d,
221
221
  offset: [15, 0],
222
222
  positioning: "center-left"
223
- }), (k = n.value) == null || k.addOverlay(f);
223
+ }), (S = n.value) == null || S.addOverlay(f);
224
224
  }
225
225
  function v() {
226
- var k;
227
- p != null && p.parentNode && p.parentNode.removeChild(p), p = document.createElement("div"), p.className = "ol-tooltip ol-tooltip-measure", w = new Overlay({
226
+ var S;
227
+ p != null && p.parentNode && p.parentNode.removeChild(p), p = document.createElement("div"), p.className = "ol-tooltip ol-tooltip-measure", y = new Overlay({
228
228
  element: p,
229
229
  offset: [0, -15],
230
230
  positioning: "bottom-center",
231
231
  stopEvent: !1,
232
232
  insertFirst: !1
233
- }), (k = n.value) == null || k.addOverlay(w);
233
+ }), (S = n.value) == null || S.addOverlay(y);
234
234
  }
235
- const y = (k) => {
236
- var C, F;
237
- c.value[k] && c.value.splice(k, 1);
238
- const S = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
239
- S[k] && ((F = (C = S[k]) == null ? void 0 : C.parentNode) == null || F.removeChild(S[k]));
240
- const E = d.getFeatures();
241
- E[k] && d.removeFeature(E[k]);
242
- }, L = () => {
235
+ const L = (S) => {
236
+ var C, V;
237
+ c.value[S] && c.value.splice(S, 1);
238
+ const T = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
239
+ T[S] && ((V = (C = T[S]) == null ? void 0 : C.parentNode) == null || V.removeChild(T[S]));
240
+ const E = m.getFeatures();
241
+ E[S] && m.removeFeature(E[S]);
242
+ }, w = () => {
243
243
  l("close");
244
244
  };
245
245
  return watch(() => r, () => {
246
- r.value && !s.value && (T(), P());
246
+ r.value && !s.value && (k(), F());
247
247
  }, { deep: !0, immediate: !0 }), t({
248
- addInteraction: P,
249
- removeInteraction: V
250
- }), (k, S) => r.value && k.viewMode !== "WxMiniprogram" ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
248
+ addInteraction: F,
249
+ removeInteraction: x
250
+ }), (S, T) => r.value && S.viewMode !== "WxMiniprogram" ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
251
251
  createElementVNode("div", { class: "header" }, [
252
- S[1] || (S[1] = createElementVNode("div", { class: "title" }, "测量", -1)),
252
+ T[1] || (T[1] = createElementVNode("div", { class: "title" }, "测量", -1)),
253
253
  createElementVNode("i", {
254
- onClick: L,
254
+ onClick: w,
255
255
  class: "map-iconfont icon-close"
256
256
  })
257
257
  ]),
258
258
  createElementVNode("div", _hoisted_2$2, [
259
- S[2] || (S[2] = createElementVNode("div", { class: "tips" }, "在地图上点击多个点测量距离,距离单位", -1)),
259
+ T[2] || (T[2] = createElementVNode("div", { class: "tips" }, "在地图上点击多个点测量距离,距离单位", -1)),
260
260
  createVNode(unref(ElSelect), {
261
261
  class: "select-length-unit",
262
262
  modelValue: i.value,
263
- "onUpdate:modelValue": S[0] || (S[0] = (E) => i.value = E)
263
+ "onUpdate:modelValue": T[0] || (T[0] = (E) => i.value = E)
264
264
  }, {
265
265
  default: withCtx(() => [
266
266
  createVNode(unref(ElOption), {
@@ -285,14 +285,14 @@ const formatLength = function(e, t) {
285
285
  key: C
286
286
  }, [
287
287
  createElementVNode("div", _hoisted_4, [
288
- S[3] || (S[3] = createElementVNode("i", { class: "map-iconfont icon-line" }, null, -1)),
288
+ T[3] || (T[3] = createElementVNode("i", { class: "map-iconfont icon-line" }, null, -1)),
289
289
  createElementVNode("span", _hoisted_5, "线段" + toDisplayString(C + 1), 1),
290
290
  createElementVNode("span", _hoisted_6, toDisplayString(E), 1)
291
291
  ]),
292
292
  createElementVNode("div", {
293
293
  class: "delete-button",
294
- onClick: (F) => y(C)
295
- }, S[4] || (S[4] = [
294
+ onClick: (V) => L(C)
295
+ }, T[4] || (T[4] = [
296
296
  createElementVNode("i", { class: "map-iconfont icon-delete" }, null, -1)
297
297
  ]), 8, _hoisted_7)
298
298
  ]))), 128))
@@ -329,31 +329,31 @@ const formatLength = function(e, t) {
329
329
  // 设置文本背景的内边距
330
330
  })
331
331
  }), renderMarker = (e, t = !0, o = !0) => {
332
- var m;
332
+ var u;
333
333
  if (!mapInstance$8.value || !e || e.split(",").length !== 2) return;
334
334
  const [n, l] = e.split(",").map(Number);
335
335
  marker.value = new Feature({
336
336
  geometry: new Point(fromLonLat([n, l]))
337
337
  });
338
338
  const r = o ? `${n}, ${l}` : "";
339
- (m = marker.value) == null || m.setStyle(createIconStyle(r));
339
+ (u = marker.value) == null || u.setStyle(createIconStyle(r));
340
340
  const i = new VectorSource({
341
341
  features: [marker.value]
342
342
  }), c = new VectorLayer({
343
343
  source: i
344
344
  }), s = mapInstance$8.value.getView();
345
345
  if (mapInstance$8.value.addLayer(c), t) {
346
- const u = new Translate({
346
+ const d = new Translate({
347
347
  layers: [c]
348
348
  });
349
- u.on("translating", function(f) {
349
+ d.on("translating", function(f) {
350
350
  var h;
351
- const p = f.features.item(0).getGeometry().getCoordinates(), w = toLonLat(p);
352
- markerPosition.value = `${w[0].toFixed(6)}, ${w[1].toFixed(6)}`, (h = marker.value) == null || h.setStyle(createIconStyle(markerPosition.value));
353
- }), mapInstance$8.value.addInteraction(u);
351
+ const p = f.features.item(0).getGeometry().getCoordinates(), y = toLonLat(p);
352
+ markerPosition.value = `${y[0].toFixed(6)}, ${y[1].toFixed(6)}`, (h = marker.value) == null || h.setStyle(createIconStyle(markerPosition.value));
353
+ }), mapInstance$8.value.addInteraction(d);
354
354
  }
355
- const d = new Point([n, l]);
356
- s.setCenter(transform(d.getCoordinates(), projection.data, projection.mercator)), s.setZoom(mapZoom.findShip);
355
+ const m = new Point([n, l]);
356
+ s.setCenter(transform(m.getCoordinates(), projection.data, projection.mercator)), s.setZoom(mapZoom.findShip);
357
357
  }, setMarkerPosition = (e) => {
358
358
  var l, r;
359
359
  if (!mapInstance$8.value) return;
@@ -425,975 +425,1011 @@ const multiplyPixelRatio = (e) => {
425
425
  }),
426
426
  zIndex: 100
427
427
  }), getRotation = (e, t, o) => {
428
- function n(u) {
429
- return 180 * (u % (2 * Math.PI)) / Math.PI;
428
+ function n(d) {
429
+ return 180 * (d % (2 * Math.PI)) / Math.PI;
430
430
  }
431
- function l(u) {
432
- return u % 360 * Math.PI / 180;
431
+ function l(d) {
432
+ return d % 360 * Math.PI / 180;
433
433
  }
434
- function r(u) {
435
- if (!u) throw new Error("Coordinate is required");
436
- if (!Array.isArray(u)) {
437
- if (u.type === "Feature" && u.geometry !== null && u.geometry.type === "Point")
438
- return u.geometry.coordinates;
439
- if (u.type === "Point") return u.coordinates;
434
+ function r(d) {
435
+ if (!d) throw new Error("Coordinate is required");
436
+ if (!Array.isArray(d)) {
437
+ if (d.type === "Feature" && d.geometry !== null && d.geometry.type === "Point")
438
+ return d.geometry.coordinates;
439
+ if (d.type === "Point") return d.coordinates;
440
440
  }
441
- if (Array.isArray(u) && u.length >= 2 && !Array.isArray(u[0]) && !Array.isArray(u[1]))
442
- return u;
441
+ if (Array.isArray(d) && d.length >= 2 && !Array.isArray(d[0]) && !Array.isArray(d[1]))
442
+ return d;
443
443
  throw new Error(
444
444
  "Coordinate must be GeoJSON Point or an Array of numbers"
445
445
  );
446
446
  }
447
- function i(u, f, p = {}) {
447
+ function i(d, f, p = {}) {
448
448
  if (p.final)
449
- return function(x, v) {
450
- return (i(v, x) + 180) % 360;
451
- }(u, f);
452
- const w = r(u), h = r(f), g = l(w[0]), T = l(h[0]), M = l(w[1]), b = l(h[1]), V = Math.sin(T - g) * Math.cos(b), P = Math.cos(M) * Math.sin(b) - Math.sin(M) * Math.cos(b) * Math.cos(T - g);
453
- return n(Math.atan2(V, P));
449
+ return function(P, v) {
450
+ return (i(v, P) + 180) % 360;
451
+ }(d, f);
452
+ const y = r(d), h = r(f), g = l(y[0]), k = l(h[0]), M = l(y[1]), b = l(h[1]), x = Math.sin(k - g) * Math.cos(b), F = Math.cos(M) * Math.sin(b) - Math.sin(M) * Math.cos(b) * Math.cos(k - g);
453
+ return n(Math.atan2(x, F));
454
454
  }
455
- function c(u) {
456
- return !isNaN(u) && u !== null && !Array.isArray(u);
455
+ function c(d) {
456
+ return !isNaN(d) && d !== null && !Array.isArray(d);
457
457
  }
458
- function s(u, f = {}, p = {}) {
459
- return u || console.log("Coordinates are required"), Array.isArray(u) || console.log("Coordinates must be an Array"), u.length < 2 && console.log("Coordinates must be at least 2 numbers long"), (!c(u[0]) || !c(u[1])) && console.log("Coordinates must contain numbers"), d({ type: "Point", coordinates: u }, f, p);
458
+ function s(d, f = {}, p = {}) {
459
+ return d || console.log("Coordinates are required"), Array.isArray(d) || console.log("Coordinates must be an Array"), d.length < 2 && console.log("Coordinates must be at least 2 numbers long"), (!c(d[0]) || !c(d[1])) && console.log("Coordinates must contain numbers"), m({ type: "Point", coordinates: d }, f, p);
460
460
  }
461
- function d(u, f = {}, p = {}) {
462
- const w = { type: "Feature" };
463
- return p.id !== void 0 && (w.id = p.id), p.bbox && (w.bbox = p.bbox), w.properties = f || {}, w.geometry = u, w;
461
+ function m(d, f = {}, p = {}) {
462
+ const y = { type: "Feature" };
463
+ return p.id !== void 0 && (y.id = p.id), p.bbox && (y.bbox = p.bbox), y.properties = f || {}, y.geometry = d, y;
464
464
  }
465
- const m = i(s(e), s(t), o);
466
- return m < 0 ? 360 + m : m;
467
- }, labelAlpha = 0.8, pixelRatio = window.devicePixelRatio || 1, labelFont = `500 ${12 * pixelRatio}px Arial`, labelOutSize = 2 * pixelRatio, labelHeight = 10 * pixelRatio, fillRectRadius = (e, t, o, n, l, r, i = 4) => {
468
- e.beginPath(), e.moveTo(t + i, o), e.arcTo(t + n, o, t + n, o + i, i), e.arcTo(t + n, o + l, t + n - i, o + l, i), e.arcTo(t, o + l, t, o + l - i, i), e.arcTo(t, o, t + i, o, i), e.closePath(), e.fillStyle = r, e.fill();
469
- }, getPixelFromCoordinate = (e) => {
470
- if (!e || e.length === 0)
471
- throw new Error("Points array is empty or invalid.");
472
- let t = 1 / 0, o = 1 / 0, n = -1 / 0, l = -1 / 0;
473
- for (const [r, i] of e)
474
- r < t && (t = r), i < o && (o = i), r > n && (n = r), i > l && (l = i);
475
- return [t, o, n, l];
476
- }, calculatePolygonCentroid = (e) => {
477
- if (!Array.isArray(e) || e.length < 3)
478
- throw new Error("A polygon must have at least 3 coordinates.");
479
- let t = 0, o = 0, n = 0;
480
- const l = e.length;
481
- for (let c = 0; c < l - 1; c++) {
482
- const [s, d] = e[c], [m, u] = e[c + 1], f = s * u - m * d;
483
- n += f, t += (s + m) * f, o += (d + u) * f;
465
+ const u = i(s(e), s(t), o);
466
+ return u < 0 ? 360 + u : u;
467
+ }, triangleModel = multiplyPixelRatio([
468
+ [0, -8],
469
+ [5, 8],
470
+ [-5, 8]
471
+ ]), shipShapeModel = multiplyPixelRatio([
472
+ [0, -4.545],
473
+ [-0.56, -3.909],
474
+ [-1, -2.727],
475
+ [-1, 3.636],
476
+ [-0.8, 4.545],
477
+ [0.8, 4.545],
478
+ [1, 3.636],
479
+ [1, -2.727],
480
+ [0.56, -3.909],
481
+ [0, -4.545]
482
+ ]), shipDirectPath = {
483
+ left: {
484
+ 0: [
485
+ [0, 0],
486
+ [0, -8],
487
+ [-4, -8]
488
+ ],
489
+ 1: [
490
+ [0, 0],
491
+ [0, -16],
492
+ [-6, -16]
493
+ ],
494
+ 2: [
495
+ [0, 0],
496
+ [0, -24],
497
+ [-8, -24]
498
+ ]
499
+ },
500
+ right: {
501
+ 0: [
502
+ [0, 0],
503
+ [0, -8],
504
+ [-4, -8]
505
+ ],
506
+ 1: [
507
+ [0, 0],
508
+ [0, -16],
509
+ [-6, -16]
510
+ ],
511
+ 2: [
512
+ [0, 0],
513
+ [0, -24],
514
+ [-8, -24]
515
+ ]
516
+ },
517
+ front: {
518
+ 0: [
519
+ [0, 0],
520
+ [0, -8]
521
+ ],
522
+ 1: [
523
+ [0, 0],
524
+ [0, -16]
525
+ ],
526
+ 2: [
527
+ [0, 0],
528
+ [0, -24]
529
+ ]
484
530
  }
485
- if (n *= 0.5, n === 0)
486
- throw new Error("多边形面积为零");
487
- const r = t / (6 * n), i = o / (6 * n);
488
- return [r, i];
489
- }, rotateShapeModel = (e, t) => {
490
- const [o, n] = calculatePolygonCentroid(e), l = t * Math.PI / 180, r = Math.cos(l), i = Math.sin(l);
491
- return e.map(([c, s]) => {
492
- const d = c - o, m = s - n, u = d * r - m * i + o, f = d * i + m * r + n;
493
- return [u, f];
494
- });
495
- }, getTopLeftPoint = (e) => [e[0], e[3]], getBottomLeftPoint = (e) => [e[2], e[3]], getBottomRightPoint = (e) => [e[2], e[1]], getTopRighttPoint = (e) => [e[0], e[1]];
496
- function calculateBounds(e, t, o, n, l) {
497
- let r, i, c, s;
498
- const d = e[0], m = e[1];
499
- switch (t) {
500
- case 0:
501
- r = d + l, i = r + o, s = m - l, c = s - n;
502
- break;
503
- case 1:
504
- r = d + l, i = r + o, s = m + n / 2, c = s - n;
505
- break;
506
- case 2:
507
- r = d + l, i = r + o, s = m + l + n, c = s - n;
508
- break;
509
- case 3:
510
- r = d - o / 2, i = r + o, s = m + l + n, c = s - n;
511
- break;
512
- case 4:
513
- i = d, r = i - o, s = m + l + n, c = s - n;
514
- break;
515
- case 5:
516
- i = d - l, r = i - o, s = m + n / 2, c = s - n;
517
- break;
518
- case 6:
519
- i = d, r = i - o, s = m - l, c = s - n;
520
- break;
521
- case 7:
522
- r = d - o / 2, i = r + o, s = m - l, c = s - n;
531
+ }, setBlankStyle = () => new Style({
532
+ image: new CircleStyle({
533
+ radius: 0
534
+ })
535
+ }), mapInstance$7 = ref(), renderShipStyleSetInstance = (e) => mapInstance$7.value = e, speedCondition = [[1, 10], [10, 20], [20, 1 / 0]], drawShipModelByZoom = { 14: [200, 30], 15: [115, 15], 16: [55, 8], 17: [25, 5], 18: [1, 1] }, setShipStyle = (e, t = !1) => new Style({
536
+ renderer: (o, n) => {
537
+ o = o;
538
+ const l = n.context, r = n.feature.get("data");
539
+ if (!r) return;
540
+ n.feature.get("index") === 0 && (shipLabels.value = []);
541
+ try {
542
+ const c = drawShipBody(l, r, o, t);
543
+ c && (drawHeading(l, r, c, t), r.selected = e, e && setTimeout(() => {
544
+ drawSelectBounds(l, c);
545
+ }, 50)), drawShipLabel(l, r, o);
546
+ } catch {
547
+ return !1;
548
+ }
523
549
  }
524
- if (!(!r || !c || !i || !s))
525
- return [Math.min(r, i), Math.min(c, s), Math.max(r, i), Math.max(c, s) + 1];
526
- }
527
- function calculateAnchorPoint(e, t, o = 70, n = 20, l = 20) {
528
- const r = [0, 0];
529
- switch (t) {
530
- case 0:
531
- r[0] = e[0] + l, r[1] = e[1] - l - n / 2;
532
- break;
533
- case 1:
534
- r[0] = e[0] + l, r[1] = e[1];
535
- break;
536
- case 2:
537
- r[0] = e[0] + l, r[1] = e[1] + l + n / 2;
538
- break;
539
- case 3:
540
- r[0] = e[0], r[1] = e[1] + l + n / 4;
541
- break;
542
- case 4:
543
- r[0] = Math.max(e[0] - l, e[0] - o / 2), r[1] = e[1] + l + n / 4;
544
- break;
545
- case 5:
546
- r[0] = e[0] - l, r[1] = e[1];
547
- break;
548
- case 6:
549
- r[0] = Math.max(e[0] - l, e[0] - o / 2), r[1] = e[1] - l - n / 4;
550
- break;
551
- case 7:
552
- r[0] = e[0], r[1] = e[1] - l - n / 4;
550
+ }), drawShipBody = (e, t, o, n) => {
551
+ if (!mapInstance$7.value) return;
552
+ const l = Math.round(Number(mapInstance$7.value.getView().getZoom()));
553
+ if (!l) return;
554
+ let r = [];
555
+ const [i, c] = drawShipModelByZoom[l] || [0, 0], [s, m] = o;
556
+ if (l <= mapZoom.shipModelMax && l > mapZoom.shipModelMin && t.length >= i && t.breadth >= c)
557
+ r = rotateShapeModel(drawCurrentShipShapeModel(t, l), t.angle).map((d) => {
558
+ const [f, p] = d;
559
+ return [s + f, m + p];
560
+ });
561
+ else {
562
+ const u = rotateShapeModel(triangleModel, t.angle);
563
+ o.length === 2 && (r = u.map((d) => {
564
+ const [f, p] = d;
565
+ return [s + f, m + p];
566
+ }));
553
567
  }
554
- return r;
555
- }
556
- function drawLabelBody(e, t, o) {
557
- if (!e) return;
558
- const {
559
- font: n,
560
- labelOutSize: l = 2,
561
- labelHeight: r,
562
- center: i,
568
+ if (!(r.length > 2)) return !1;
569
+ if (t != null && t.length) {
570
+ const u = r.length === 3 ? 30 : t.length * 0.4;
571
+ e.beginPath(), e.arc(
572
+ o[0],
573
+ o[1],
574
+ u,
575
+ 0,
576
+ 2 * Math.PI
577
+ ), e.fillStyle = "rgba(255, 255, 255, 0.001)", e.fill();
578
+ }
579
+ e.save(), e.beginPath(), e.moveTo(r[0][0], r[0][1]);
580
+ for (let u = 1; u < r.length; u++)
581
+ e.lineTo(r[u][0], r[u][1]);
582
+ return e.closePath(), e.strokeStyle = n ? "#ff0000" : "#000", e.lineWidth = n ? 2 : 1, e.stroke(), e.fillStyle = t.fill, e.fill(), e.restore(), r;
583
+ }, drawHeading = (e, t, o, n) => {
584
+ const [l, r] = o[0], i = getShipDirectPath(t);
585
+ if (i) {
586
+ const c = i.map(function(s) {
587
+ const [m, u] = s;
588
+ return [m + l, u + r];
589
+ });
590
+ if (e.save(), e.beginPath(), t.angle > 0) {
591
+ e.translate(l, r);
592
+ const s = t.angle * Math.PI / 180;
593
+ e.rotate(s), e.translate(-l, -r);
594
+ }
595
+ e.moveTo(l, r);
596
+ for (let s = 1; s < c.length; s++) {
597
+ const [m, u] = c[s];
598
+ e.lineTo(m, u);
599
+ }
600
+ e.strokeStyle = n ? "#ff0000" : "#000", e.lineWidth = n ? 2 : 1, e.stroke(), e.restore();
601
+ }
602
+ }, drawSelectBounds = (e, t) => {
603
+ let [o, n, l, r] = getPixelFromCoordinate(t);
604
+ const i = 4;
605
+ o -= i, n -= i, l += i, r += i, e.save(), e.strokeStyle = "#ff0000", e.lineWidth = 4;
606
+ const c = 8;
607
+ e.beginPath(), e.moveTo(o + c, r), e.lineTo(o, r), e.lineTo(o, r - c), e.moveTo(o, n + c), e.lineTo(o, n), e.lineTo(o + c, n), e.moveTo(l - c, n), e.lineTo(l, n), e.lineTo(l, n + c), e.moveTo(l, r - c), e.lineTo(l, r), e.lineTo(l - c, r), e.stroke(), e.restore();
608
+ }, drawShipLabel = (e, t, o) => {
609
+ if (!t.selected && shipLabels.value.find((d) => d.name === t.name)) return;
610
+ const [n, l] = o, r = n, i = l, c = t.name;
611
+ let s;
612
+ t.leftIconColor && (s = { color: t.leftIconColor, icon: "&#xe599;" });
613
+ const m = getShipCustomIcon(t), u = {
614
+ id: t.id,
615
+ center: [r, i],
563
616
  text: c,
617
+ fill: t.fill,
618
+ color: "#fff",
619
+ textColor: "#000",
620
+ bgColor: "#fff",
564
621
  leftIcon: s,
565
- shipColor: d,
566
- lineLength: m = 20,
567
- selected: u
568
- } = o;
569
- e.save(), n && (e.font = n);
570
- let f = e.measureText(c).width + 4 * l;
571
- (s || d) && (f += r + 6 * l), e.restore();
572
- let p, w = 20, h = -1, g = r + 3 * l;
573
- if (m)
574
- for (let T = 0; T < 8; T++) {
575
- p = calculateBounds(i, T, f, g, m);
576
- let M = !1;
577
- for (let b = 0; b < t.length; ++b) {
578
- let V = t[b].bounds, P = [
579
- V[0] - w,
580
- V[1] - w,
581
- V[2] + w,
582
- V[3] + w
583
- ];
584
- if (p && isOverlapping(p, P)) {
585
- M = !0;
586
- break;
587
- }
588
- }
589
- if (!M) {
590
- h = T;
622
+ rightIcons: m,
623
+ selected: t.selected,
624
+ blinkColors: t.blinkColors,
625
+ type: "ShipName"
626
+ };
627
+ drawLabel(e, u, shipLabels.value);
628
+ }, drawCurrentShipShapeModel = (e, t) => {
629
+ let o = 0;
630
+ t <= 14 ? o = 0.058 : t === 15 ? o = 0.12 : t === 16 ? o = 0.22 : t === 17 ? o = 0.435 : t === 18 && (o = 0.857);
631
+ const n = e.length / 4 * o, l = e.breadth * o;
632
+ let r = cloneDeep(shipShapeModel);
633
+ return r = r.map(([i, c]) => [i * l, c * n]), r;
634
+ }, getShipDirectPath = (e) => {
635
+ const { speed: t, hdg: o, cog: n } = e;
636
+ let l = "", r = null;
637
+ if (t && t > 1 && (o !== null && o != 511 && n !== null ? n - o >= 3 ? l = "left" : n - o <= -3 ? l = "right" : l = "front" : l = "front", l && t))
638
+ for (let i = 0; i < speedCondition.length; i++) {
639
+ const c = speedCondition[i];
640
+ if (t >= c[0] && t < c[1]) {
641
+ r = shipDirectPath[l][i];
591
642
  break;
592
643
  }
593
644
  }
594
- else
595
- h = 0, p = calculateBounds(i, h, f, g, m);
596
- if (u && h === -1 && (h = 0), p && h > -1) {
597
- let T = getBottomLeftPoint(p), M = getTopRighttPoint(p);
598
- return {
599
- center: i,
600
- x: calculateAnchorPoint(i, h, f, g, m),
601
- l: M,
602
- r: T,
603
- bounds: p,
604
- position: h,
605
- name: c
606
- };
607
- } else
608
- return null;
609
- }
610
- const drawText = (e, t) => {
611
- if (!e) return;
612
- const { center: o, text: n, textColor: l, leftIcon: r, rightIcons: i, font: c } = t;
613
- e.save(), e.setTransform(1, 0, 0, 1, 0, 0);
614
- let [s, d] = o;
615
- if (r) {
616
- e.font = `${20 * pixelRatio}px map-iconfont`;
617
- let m = getIconFont(r.icon);
618
- e.fillStyle = r.color, e.fillText(m, s + labelOutSize - 3.2 * pixelRatio, d + 3.2 * pixelRatio), s += 23 * pixelRatio;
619
- }
620
- if (i != null && i.length) {
621
- e.font = `${12 * pixelRatio}px map-iconfont`, e.fillStyle = "#3370ff";
622
- const m = e.measureText(n).width + 3 * pixelRatio;
623
- i.forEach((u, f) => {
624
- const p = getIconFont(u), w = 20 * pixelRatio * f;
625
- e.fillText(p, s + m + w, d);
626
- });
627
- }
628
- e.font = c || labelFont, e.fillStyle = l, e.fillText(n, s + 2, d), e.restore();
629
- }, drawPolygon = (e, t) => {
630
- let {
631
- points: o,
632
- strokeColor: n,
633
- fillColor: l,
634
- shouldClosePath: r,
635
- translation: i,
636
- rotation: c,
637
- rotationCenter: s,
638
- scale: d,
639
- globalAlpha: m
640
- } = t;
641
- if (m || (m = 1), o && e) {
642
- e.save(), e.beginPath(), c && c !== 0 && s == null && e.rotate(c), i && e.translate(i[0], i[1]), c && (s != null && s.length) && e.rotate(c), d && e.scale(d, d), e.moveTo(o[0][0], o[0][1]);
643
- for (let u = 1; u < o.length; u++)
644
- e.lineTo(o[u][0], o[u][1]);
645
- r && e.closePath(), n && (e.strokeStyle = n, e.stroke()), l && r && (m && (e.globalAlpha = m), e.fillStyle = l, e.fill()), e.restore();
646
- }
647
- }, intervalId = [], drawLabel = (e, t, o) => {
648
- var u, f, p, w, h, g, T, M;
649
- let { center: n, text: l, color: r, textColor: i, bgColor: c, leftIcon: s, rightIcons: d, type: m } = t;
650
- if (n && l) {
651
- const b = {
652
- font: labelFont,
653
- labelOutSize,
654
- labelHeight,
655
- center: n,
656
- text: l,
657
- leftIcon: s,
658
- selected: t.selected
659
- };
660
- (u = t.blinkColors) != null && u.length && (c = t.fill, i = getForegroundColor(t.fill));
661
- const V = drawLabelBody(e, o, b);
662
- if (V) {
663
- const { x: P, bounds: x, l: v } = V, y = [getTopLeftPoint(x), getBottomLeftPoint(x), getBottomRightPoint(x), getTopRighttPoint(x)];
664
- o.find((F) => F.name === l) || o.push(V), drawPolygon(e, {
665
- points: [n, P],
666
- strokeColor: r,
667
- fillColor: "#000",
668
- shouldClosePath: !0,
669
- translation: void 0,
670
- rotation: void 0,
671
- rotationCenter: void 0,
672
- scale: void 0,
673
- globalAlpha: labelAlpha
674
- }), d != null && d.length && d.forEach(() => {
675
- y[1][0] += 20, y[2][0] += 20;
645
+ return r;
646
+ }, getShipCustomIcon = (e) => {
647
+ const t = [];
648
+ return e.existDevice && t.push("&#xe687;"), e.existMobile && t.push("&#xe688;"), e.existWaterGauge && t.push("&#xe686;"), t || [];
649
+ }, mapInstance$6 = ref(), renderShipSetInstance = (e) => mapInstance$6.value = e;
650
+ let shipsMarkerList = [], shipsVectorSource, largeAmountShipsSource;
651
+ const selectedShipData = ref(null), selectedShips = ref([]);
652
+ let selectShipsVectorSource;
653
+ const renderShips = (e) => {
654
+ var o, n, l, r;
655
+ if (!mapInstance$6.value || showTrackLayer.value) return;
656
+ const t = Math.round(Number(mapInstance$6.value.getView().getZoom()));
657
+ if (selectedShipData.value && nextTick(() => {
658
+ selectSingleShipMarker(selectedShipData.value);
659
+ }).then((i) => {
660
+ }), !(!t || t < mapZoom.shipGreenDotMax) && (allShips.value = [...e, ...selectedShips.value], !hiddenOrther.value))
661
+ return t >= mapZoom.shipGreenDotMax && t < mapZoom.shipModelMin ? ((o = shipsLayer.value) == null || o.setVisible(!1), (n = largeAmountShipsLayer.value) == null || n.setVisible(!0), renderLargeAmountShips(allShips.value)) : ((l = largeAmountShipsLayer.value) == null || l.setVisible(!1), (r = shipsLayer.value) == null || r.setVisible(!0), renderShipsMarker(allShips.value));
662
+ }, renderLargeAmountShips = (e) => {
663
+ if (!mapInstance$6.value) return;
664
+ const t = e.map((o) => ({
665
+ type: "Feature",
666
+ geometry: {
667
+ type: "Point",
668
+ coordinates: [o.lon, o.lat]
669
+ },
670
+ properties: o
671
+ }));
672
+ return largeAmountShipsSource == null || largeAmountShipsSource.clear(), largeAmountShipsSource = new VectorSource({
673
+ features: new GeoJSON().readFeatures({
674
+ type: "FeatureCollection",
675
+ features: t
676
+ }, {
677
+ featureProjection: projection.mercator
678
+ })
679
+ }), largeAmountShipsLayer.value = new WebGLPointsLayer({
680
+ source: largeAmountShipsSource,
681
+ style: {
682
+ "shape-points": 3,
683
+ "shape-radius": 9,
684
+ "shape-fill-color": [
685
+ "case",
686
+ ["==", ["get", "fill"], "#D9001C"],
687
+ "#D9001C",
688
+ // 如果 fill 是 #D9001C,返回红色
689
+ ["==", ["get", "fill"], "#04C900"],
690
+ "#04C900",
691
+ // 如果 fill 是 #04C900,返回绿色
692
+ "#04C900"
693
+ // 默认颜色(绿色)
694
+ ],
695
+ "shape-rotate-with-view": !1,
696
+ "shape-rotation": [
697
+ "+",
698
+ ["get", "cog"],
699
+ // 获取 'cog' 属性值
700
+ 180
701
+ // 将值旋转 180
702
+ ],
703
+ "shape-scale": [0.8, 1.2],
704
+ "shape-stroke-color": "#000000",
705
+ // 边框颜色为黑色
706
+ "shape-stroke-width": 0.5
707
+ // 边框宽度为0.5px
708
+ }
709
+ }), mapInstance$6.value.addLayer(largeAmountShipsLayer.value), largeAmountShipsLayer.value;
710
+ }, renderShipsMarker = (e) => {
711
+ var o;
712
+ if (!mapInstance$6.value) return;
713
+ deleteAllShipMarkers();
714
+ let t = convertShipMapData(e);
715
+ if (t = customFilterShips(t), !!(t != null && t.length))
716
+ return t.forEach((n, l) => {
717
+ const r = [n.lon, n.lat], i = new Feature({
718
+ geometry: new Point(fromLonLat(r))
719
+ }), c = 1;
720
+ i.set("clickGeometry", new Circle(fromLonLat(r), c)), i.set("data", n), i.set("index", l), i.setStyle(
721
+ setShipStyle(!1)
722
+ ), shipsMarkerList.push({
723
+ ship: n,
724
+ lonlat: r,
725
+ feature: i
676
726
  });
677
- const k = {
678
- points: y,
679
- strokeColor: r,
680
- fillColor: c,
681
- shouldClosePath: !0
682
- }, [S, E] = v, C = {
683
- center: [S, E + labelOutSize + labelHeight + 1],
684
- text: l,
685
- textColor: i,
686
- leftIcon: s,
687
- rightIcons: d,
688
- blinkColors: t.blinkColors
689
- };
690
- if (drawPolygon(e, k), drawText(e, C), ((f = t == null ? void 0 : t.blinkColors) == null ? void 0 : f.length) > 0) {
691
- let F = Date.now(), $ = 0;
692
- const R = [];
693
- t.blinkColors.forEach((N) => {
694
- R.push(N), R.push("white");
695
- });
696
- const A = !!((h = (w = (p = selectShipsLayer.value) == null ? void 0 : p.getSource()) == null ? void 0 : w.getFeatures()) != null && h.find((N) => {
697
- var O;
698
- return ((O = N.get("data")) == null ? void 0 : O.id) === t.id;
699
- }) || (M = (T = (g = shipsLayer.value) == null ? void 0 : g.getSource()) == null ? void 0 : T.getFeatures()) != null && M.find((N) => {
700
- var O;
701
- return ((O = N.get("data")) == null ? void 0 : O.id) === t.id;
702
- }));
703
- !A || hiddenOrther.value ? (clearInterval(intervalId[t.id]), deleteLabelFromArray(o, l)) : (intervalId[t.id] && clearInterval(intervalId[t.id]), intervalId[t.id] = setInterval(() => {
704
- const N = Date.now();
705
- N - F >= 500 && ($ = ($ + 1) % R.length, F = N, k.fillColor = R[$], drawPolygon(e, k), C.textColor = getForegroundColor(k.fillColor), drawText(e, C), (!A || hiddenOrther.value) && (clearInterval(intervalId[t.id]), deleteLabelFromArray(o, l)));
706
- }, 10));
727
+ }), shipsVectorSource = new VectorSource({
728
+ features: shipsMarkerList.map((n) => n.feature)
729
+ }), shipsLayer.value = new VectorLayer({
730
+ source: shipsVectorSource,
731
+ zIndex: 100
732
+ }), (o = mapInstance$6.value) == null || o.addLayer(shipsLayer.value), shipsLayer.value;
733
+ }, onShipsMarkerHover = () => {
734
+ var n;
735
+ let e = null, t = 0;
736
+ const o = 100;
737
+ (n = mapInstance$6.value) == null || n.on("pointermove", function(l) {
738
+ var s, m;
739
+ const r = Date.now();
740
+ if (r - t < o)
741
+ return;
742
+ t = r;
743
+ const i = (s = mapInstance$6.value) == null ? void 0 : s.forEachFeatureAtPixel(l.pixel, (u) => u), c = (m = mapInstance$6.value) == null ? void 0 : m.getTargetElement();
744
+ if (c && (c.style.cursor = i ? "pointer" : ""), e !== i) {
745
+ if (e) {
746
+ const u = e.get("data");
747
+ if (!(u != null && u.mmsi)) return;
748
+ e.setStyle(
749
+ setShipStyle(!1, !1)
750
+ );
751
+ }
752
+ if (i) {
753
+ const u = i.get("data");
754
+ if (!(u != null && u.mmsi)) return;
755
+ e = i, i.setStyle(
756
+ setShipStyle(!1, !0)
757
+ );
707
758
  } else
708
- shipLabels.value.find(($) => $.name === l) && (clearInterval(intervalId[t.id]), drawPolygon(e, k), drawText(e, C));
759
+ e = null;
709
760
  }
710
- }
711
- return null;
712
- }, clearAllInterval = () => {
713
- Object.keys(intervalId).forEach((e) => {
714
- clearInterval(e);
715
761
  });
716
- }, deleteLabelFromArray = (e, t) => {
717
- const o = e.findIndex((n) => n.name === t);
718
- o !== -1 && e.splice(o, 1);
719
- }, PI = Math.PI, a = 6378245, ee = 0.006693421622965943;
720
- function transformLat(e, t) {
721
- let o = -100 + 2 * e + 3 * t + 0.2 * t * t + 0.1 * e * t + 0.2 * Math.sqrt(Math.abs(e));
722
- return o += (20 * Math.sin(6 * e * PI) + 20 * Math.sin(2 * e * PI)) * 2 / 3, o += (20 * Math.sin(t * PI) + 40 * Math.sin(t / 3 * PI)) * 2 / 3, o += (160 * Math.sin(t / 12 * PI) + 320 * Math.sin(t * PI / 30)) * 2 / 3, o;
723
- }
724
- function transformLng(e, t) {
725
- let o = 300 + e + 2 * t + 0.1 * e * e + 0.1 * e * t + 0.1 * Math.sqrt(Math.abs(e));
726
- return o += (20 * Math.sin(6 * e * PI) + 20 * Math.sin(2 * e * PI)) * 2 / 3, o += (20 * Math.sin(e * PI) + 40 * Math.sin(e / 3 * PI)) * 2 / 3, o += (150 * Math.sin(e / 12 * PI) + 300 * Math.sin(e / 30 * PI)) * 2 / 3, o;
727
- }
728
- function outOfChina(e, t) {
729
- return !(e > 73.66 && e < 135.05 && t > 3.86 && t < 53.55);
730
- }
731
- function gcj02ToWgs84(e) {
732
- const [t, o] = e.split(",").map(Number);
733
- if (outOfChina(t, o))
734
- return `${t.toFixed(6)}, ${o.toFixed(6)}`;
735
- {
736
- let n = transformLat(t - 105, o - 35), l = transformLng(t - 105, o - 35);
737
- const r = o / 180 * PI;
738
- let i = Math.sin(r);
739
- i = 1 - ee * i * i;
740
- const c = Math.sqrt(i);
741
- n = n * 180 / (a * (1 - ee) / (i * c) * PI), l = l * 180 / (a / c * Math.cos(r) * PI);
742
- const s = o + n, d = t + l;
743
- return `${(t * 2 - d).toFixed(6)}, ${(o * 2 - s).toFixed(6)}`;
744
- }
745
- }
746
- function calculateCirclePoints(e, t) {
747
- const o = fromLonLat(e), n = t * 1e3, l = [
748
- o[0] - n,
749
- o[1] - n,
750
- o[0] + n,
751
- o[1] + n
752
- ], r = transformExtent(l, projection.mercator, projection.data);
753
- return {
754
- leftTopPoint: { lng: r[0], lat: r[3] },
755
- rightTopPoint: { lng: r[2], lat: r[3] },
756
- rightBottomPoint: { lng: r[2], lat: r[1] },
757
- leftBottomPoint: { lng: r[0], lat: r[1] }
758
- };
759
- }
760
- const equatorialCircumference = 2003750834e-2;
761
- function lonLatToMercator(e) {
762
- const t = e[0] * equatorialCircumference / 180;
763
- let o = Math.log(Math.tan((90 + e[1]) * Math.PI / 360)) / (Math.PI / 180);
764
- return o = o * equatorialCircumference / 180, [t, o];
765
- }
766
- function mercatorToLonLat(e, t = "lonlat") {
767
- const o = { lon: 0, lat: 0 }, n = e[0] / equatorialCircumference * 180;
768
- let l = e[1] / equatorialCircumference * 180;
769
- return l = 180 / Math.PI * (2 * Math.atan(Math.exp(l * Math.PI / 180)) - Math.PI / 2), o.lon = n, o.lat = l, t === "lonlat" ? o : [n, l];
770
- }
771
- function calculateBoundingBox(e) {
772
- let t = 1 / 0, o = -1 / 0, n = 1 / 0, l = -1 / 0;
773
- e.forEach((h) => {
774
- const [g, T] = h;
775
- t = Math.min(t, T), o = Math.max(o, T), n = Math.min(n, g), l = Math.max(l, g);
762
+ }, customFilterShips = (e) => {
763
+ let t = cloneDeep(e);
764
+ return t = t.filter((o) => {
765
+ var l;
766
+ const n = getFilterItem(o).every(({ btnShow: r, value: i }) => r ? !!i : !0);
767
+ return (switchBtnShow.value.camera || switchBtnShow.value.mobile || switchBtnShow.value.waterGauge) && ((l = selectedShipData.value) == null ? void 0 : l.id) === o.id && clearSelectFeature(), n;
768
+ }), t;
769
+ }, getFilterItem = (e) => [
770
+ { btnShow: switchBtnShow.value.camera, value: e == null ? void 0 : e.existDevice },
771
+ { btnShow: switchBtnShow.value.mobile, value: e == null ? void 0 : e.existMobile },
772
+ { btnShow: switchBtnShow.value.waterGauge, value: e == null ? void 0 : e.existWaterGauge }
773
+ ], deleteAllShipMarkers = () => {
774
+ shipsMarkerList.forEach((e) => {
775
+ e.feature && (shipsVectorSource == null || shipsVectorSource.removeFeature(e.feature));
776
+ }), clearAllInterval(), shipsMarkerList = [];
777
+ }, selectSingleShipMarker = (e) => {
778
+ var r;
779
+ if (!mapInstance$6.value) return;
780
+ const t = cloneDeep(selectSingleShipData.value);
781
+ selectSingleShipData.value = convertShipMapData(e);
782
+ const o = [selectSingleShipData.value.lon, selectSingleShipData.value.lat], n = new Feature({
783
+ geometry: new Point(fromLonLat(o))
776
784
  });
777
- const r = l - n, i = o - t, c = Math.max(r, i), s = (n + l) / 2, d = (t + o) / 2, m = c / 2, u = s - m, f = s + m, p = d - m, w = d + m;
778
- return [f, p, u, w];
779
- }
780
- const transformUtils = {
781
- gcj02ToWgs84,
782
- calculateCirclePoints,
783
- lonLatToMercator,
784
- mercatorToLonLat,
785
- calculateBoundingBox
786
- }, mapInstance$7 = ref(), renderTrackStyleSetInstance = (e) => mapInstance$7.value = e, stopIcon = "&#xe6e2;", stopColor = "#E31818", slowIcon = "&#xe703;", slowColor = "#1890FF", dropletsIcon = "&#xe6d2", trackList$1 = ref([]), renderTrackLine = (e, t, o) => {
787
- var r, i, c;
788
- const n = e[t];
789
- if (!n) return;
790
- allTracks.value[t] = n, trackList$1.value = [], trackList$1.value = n.map((s, d) => (s.center = [s.lon, s.lat], s.centerPoint = transformUtils.lonLatToMercator(s.center), s.id = t, s.index = d, s.time = hooks(s.createdAt).format("YYYY-MM-DD HH:mm:ss"), s));
791
- const l = trackList$1.value.map((s) => s.centerPoint);
792
- if (l.length >= 2) {
793
- const s = new LineString(l), d = new Feature({ geometry: s });
794
- d.setStyle(
795
- new Style({
796
- stroke: new Stroke({
797
- color: o,
798
- width: 2
799
- })
800
- })
801
- ), d.setId(t), d.set("type", "line"), (i = (r = shipTrackVectorLayer.value) == null ? void 0 : r.getSource()) == null || i.clear(), shipTrackLineFeatures.value = [];
802
- const m = shipTrackLineFeatures.value.findIndex((u) => u.getId() === t);
803
- m >= 0 ? shipTrackLineFeatures.value[m] = d : shipTrackLineFeatures.value.push(d), createAnimatedIconFeature(o, l), trackLineVectorSource.value = new VectorSource({
804
- features: [...shipTrackLineFeatures.value]
805
- }), shipTrackVectorLayer.value = new VectorLayer({
806
- source: trackLineVectorSource.value
807
- }), renderPoint(o), (c = mapInstance$7.value) == null || c.addLayer(shipTrackVectorLayer.value);
808
- }
809
- }, handlePlay = (e, t) => {
810
- const o = allTracks.value[String(e)];
811
- playAnimation(o.map((n) => [n.lon, n.lat]), t);
812
- }, removeShipTrackLineFeatureByIndex = (e, t) => {
813
- e >= 0 && e < shipTrackLineFeatures.value.length && (shipTrackLineFeatures.value.splice(e, 1), delete allTracks.value[t]), trackLineVectorSource.value = new VectorSource({
814
- features: [...shipTrackLineFeatures.value]
815
- }), shipTrackVectorLayer.value && shipTrackVectorLayer.value.setSource(trackLineVectorSource.value);
816
- }, createAnimatedIconFeature = (e, t) => {
817
- const o = new Feature({
818
- geometry: new Point(fromLonLat([t[0][0], t[0][1]]))
819
- // 初始位置
820
- }), n = new Style({
821
- text: new Text({
822
- font: "700 14px map-iconfont",
823
- text: getIconFont("&#xe6bc;"),
824
- fill: new Fill({ color: e })
825
- })
785
+ n.set("data", selectSingleShipData.value), n.setStyle(
786
+ setShipStyle(!0)
787
+ ), shipsMarkerList.push({
788
+ ship: selectSingleShipData.value,
789
+ lonlat: o,
790
+ feature: n
791
+ }), selectShipsVectorSource == null || selectShipsVectorSource.clear(), selectShipsVectorSource = new VectorSource({
792
+ features: [n]
793
+ }), selectShipsLayer.value = new VectorLayer({
794
+ source: selectShipsVectorSource
795
+ }), shipsVectorSource && setVisibleFeatureById(shipsVectorSource, selectSingleShipData.value.id, !0);
796
+ const l = (r = shipsLayer.value) == null ? void 0 : r.getSource();
797
+ return l && (t && setVisibleFeatureById(l, t.id, !0), setVisibleFeatureById(l, selectSingleShipData.value.id, !1)), mapInstance$6.value.addLayer(selectShipsLayer.value), selectShipsLayer.value.setVisible(!0), selectShipsLayer.value;
798
+ }, setVisibleFeatureById = (e, t, o) => {
799
+ e && e.forEachFeature((n) => {
800
+ const l = n.get("data");
801
+ l && l.id === t && n.setStyle(o ? setShipStyle(!1, l.id) : setBlankStyle());
826
802
  });
827
- return o.setStyle(n), o;
828
- }, geoMarkerStyle = new Style({
829
- text: new Text({
830
- font: "700 20px map-iconfont",
831
- text: getIconFont("&#xe657;"),
832
- fill: new Fill({ color: "#ff0000" }),
833
- rotation: 0
834
- // 初始旋转角度
835
- })
836
- });
837
- let polyline, linePath, startMarker, position, geoMarker, vectorLayer;
838
- const trackAnimating = ref(!1);
839
- let distance = 0, lastTime = Date.now(), moveFeatureHandler = null;
840
- const moveFeature = (e, t) => {
841
- var u, f;
842
- const o = Number(50 * t), n = e.frameState.time, l = n - lastTime;
843
- if (distance = (distance + o * l / 1e6) % 2, lastTime = n, distance >= 1) {
844
- stopAnimation();
803
+ }, findShip = (e, t, o = !0) => {
804
+ var l, r, i, c, s;
805
+ if (!e || !mapInstance$6.value) return;
806
+ const n = (i = (r = (l = shipsLayer.value) == null ? void 0 : l.getSource()) == null ? void 0 : r.getFeatures()) == null ? void 0 : i.find((m) => {
807
+ var u;
808
+ return ((u = m.get("data")) == null ? void 0 : u.id) === e;
809
+ });
810
+ if (n)
811
+ selectedShipData.value = n.get("data");
812
+ else if (t)
813
+ selectedShipData.value = t;
814
+ else {
815
+ console.error("找不到船舶");
845
816
  return;
846
817
  }
847
- const r = linePath.getCoordinateAt(
848
- distance > 1 ? 2 - distance : distance
849
- ), i = linePath.getCoordinateAt(
850
- distance > 1 ? distance - 0.01 : distance
851
- ), c = linePath.getCoordinateAt(
852
- distance > 1 ? 2 - distance : distance + 0.01
853
- ), d = getRotation(transformUtils.mercatorToLonLat(i, "array"), transformUtils.mercatorToLonLat(c, "array")) * Math.PI / 180;
854
- (u = geoMarkerStyle.getText()) == null || u.setRotation(d), position.setCoordinates(r);
855
- const m = getVectorContext(e);
856
- m.context_.save(), m.setStyle(geoMarkerStyle), m.drawGeometry(position), m.context_.restore(), (f = mapInstance$7.value) == null || f.render();
857
- }, startAnimation = () => {
858
- trackAnimating.value = !0, showTrackAnimatMarker.value = !0, lastTime = Date.now(), distance = 0, position = startMarker.getGeometry().clone(), vectorLayer.on("postrender", moveFeatureHandler), geoMarker.setGeometry(null);
859
- }, stopAnimation = () => {
818
+ if (selectedShips.value.some((m) => {
819
+ var u;
820
+ return m.id === ((u = selectedShipData.value) == null ? void 0 : u.id);
821
+ }) || selectedShips.value.push(selectedShipData.value), o && ((c = selectedShipData.value) != null && c.lon) && ((s = selectedShipData.value) != null && s.lat)) {
822
+ const m = mapInstance$6.value.getView(), u = new Point([selectedShipData.value.lon, selectedShipData.value.lat]);
823
+ m.setCenter(transform(u.getCoordinates(), projection.data, projection.mercator));
824
+ const d = m.getZoom(), f = d < mapZoom.findShipMin ? mapZoom.findShip : d;
825
+ m.setZoom(f);
826
+ }
827
+ return setTimeout(() => {
828
+ t && selectSingleShipMarker(t);
829
+ }, 50), n;
830
+ }, clearSelectFeature = () => {
860
831
  var e;
861
- trackAnimating.value && (trackAnimating.value = !1, geoMarker.setGeometry(null), vectorLayer.un("postrender", moveFeatureHandler), (e = mapInstance$7.value) == null || e.removeLayer(vectorLayer), vectorLayer = null, geoMarker = null);
862
- }, playAnimation = (e, t) => {
863
- var o;
864
- trackAnimating.value && stopAnimation(), polyline = new Polyline({
865
- factor: 1e6
866
- }).writeGeometry(new LineString(e)), linePath = new Polyline({
867
- factor: 1e6
868
- }).readGeometry(polyline, {
869
- dataProjection: projection.data,
870
- featureProjection: projection.mercator
871
- }), startMarker = new Feature({
872
- type: "icon",
873
- geometry: new Point(linePath.getFirstCoordinate())
874
- }), position = startMarker.getGeometry().clone(), geoMarker = new Feature({
875
- type: "geoMarker",
876
- style: geoMarkerStyle,
877
- geometry: position
878
- }), vectorLayer = new VectorLayer({
879
- source: new VectorSource({
880
- features: [geoMarker]
881
- })
882
- }), (o = mapInstance$7.value) == null || o.addLayer(vectorLayer), moveFeatureHandler = (n) => moveFeature(n, t), startAnimation();
883
- }, renderPoint = (e) => {
884
- if (!mapInstance$7.value) return;
885
- const t = trackList$1.value || [];
886
- if (!(t && t.length > 1)) return [];
887
- const o = { 16: 24, 17: 15, default: 4 }, n = [], l = t.length;
888
- for (let c = 0; c < l; c++) {
889
- t[c].index = c;
890
- const s = mapInstance$7.value.getPixelFromCoordinate(t[c].centerPoint);
891
- if (s) {
892
- let d = s.concat(s);
893
- d = adjustBounds(d, [20, 20]);
894
- const m = mapInstance$7.value.getView().getZoom();
895
- if (!m) return;
896
- if (m > 15) {
897
- const f = o[m] || o.default;
898
- d = adjustBounds(d, [f, f]);
832
+ if (selectedShipData.value && shipsVectorSource && selectSingleShipData.value) {
833
+ setVisibleFeatureById(shipsVectorSource, selectSingleShipData.value.id, !1);
834
+ const t = (e = shipsLayer.value) == null ? void 0 : e.getSource();
835
+ t && setVisibleFeatureById(t, selectSingleShipData.value.id, !0);
836
+ }
837
+ selectedShipData.value = null, mapInstance$6.value && (selectShipsVectorSource == null || selectShipsVectorSource.clear(), selectShipsLayer.value = new VectorLayer({
838
+ source: selectShipsVectorSource
839
+ }), mapInstance$6.value.addLayer(selectShipsLayer.value), selectShipsLayer.value.setVisible(!1));
840
+ }, hiddenAllShips = () => {
841
+ var e, t;
842
+ (e = shipsLayer.value) == null || e.setVisible(!1), (t = largeAmountShipsLayer.value) == null || t.setVisible(!1);
843
+ }, switchBtnShow = ref({
844
+ // 船舶摄像头过滤开关
845
+ [SWITCH_BTN.Camera]: !1,
846
+ // 船舶联系方式过滤开关
847
+ [SWITCH_BTN.Mobile]: !1,
848
+ // 船舶水尺过滤开关
849
+ [SWITCH_BTN.WaterGauge]: !1
850
+ }), switchFilterItem = (e, t) => {
851
+ switchBtnShow.value[e] = t, renderShips(allShips.value);
852
+ }, rerenderShip = () => {
853
+ renderShips(allShips.value);
854
+ }, labelAlpha = 0.8, pixelRatio = window.devicePixelRatio || 1, labelFont = `500 ${12 * pixelRatio}px Arial`, labelOutSize = 2 * pixelRatio, labelHeight = 10 * pixelRatio, fillRectRadius = (e, t, o, n, l, r, i = 4) => {
855
+ e.beginPath(), e.moveTo(t + i, o), e.arcTo(t + n, o, t + n, o + i, i), e.arcTo(t + n, o + l, t + n - i, o + l, i), e.arcTo(t, o + l, t, o + l - i, i), e.arcTo(t, o, t + i, o, i), e.closePath(), e.fillStyle = r, e.fill();
856
+ }, getPixelFromCoordinate = (e) => {
857
+ if (!e || e.length === 0)
858
+ throw new Error("Points array is empty or invalid.");
859
+ let t = 1 / 0, o = 1 / 0, n = -1 / 0, l = -1 / 0;
860
+ for (const [r, i] of e)
861
+ r < t && (t = r), i < o && (o = i), r > n && (n = r), i > l && (l = i);
862
+ return [t, o, n, l];
863
+ }, calculatePolygonCentroid = (e) => {
864
+ if (!Array.isArray(e) || e.length < 3)
865
+ throw new Error("A polygon must have at least 3 coordinates.");
866
+ let t = 0, o = 0, n = 0;
867
+ const l = e.length;
868
+ for (let c = 0; c < l - 1; c++) {
869
+ const [s, m] = e[c], [u, d] = e[c + 1], f = s * d - u * m;
870
+ n += f, t += (s + u) * f, o += (m + d) * f;
871
+ }
872
+ if (n *= 0.5, n === 0)
873
+ throw new Error("多边形面积为零");
874
+ const r = t / (6 * n), i = o / (6 * n);
875
+ return [r, i];
876
+ }, rotateShapeModel = (e, t) => {
877
+ const [o, n] = calculatePolygonCentroid(e), l = t * Math.PI / 180, r = Math.cos(l), i = Math.sin(l);
878
+ return e.map(([c, s]) => {
879
+ const m = c - o, u = s - n, d = m * r - u * i + o, f = m * i + u * r + n;
880
+ return [d, f];
881
+ });
882
+ }, getTopLeftPoint = (e) => [e[0], e[3]], getBottomLeftPoint = (e) => [e[2], e[3]], getBottomRightPoint = (e) => [e[2], e[1]], getTopRighttPoint = (e) => [e[0], e[1]];
883
+ function calculateBounds(e, t, o, n, l) {
884
+ let r, i, c, s;
885
+ const m = e[0], u = e[1];
886
+ switch (t) {
887
+ case 0:
888
+ r = m + l, i = r + o, s = u - l, c = s - n;
889
+ break;
890
+ case 1:
891
+ r = m + l, i = r + o, s = u + n / 2, c = s - n;
892
+ break;
893
+ case 2:
894
+ r = m + l, i = r + o, s = u + l + n, c = s - n;
895
+ break;
896
+ case 3:
897
+ r = m - o / 2, i = r + o, s = u + l + n, c = s - n;
898
+ break;
899
+ case 4:
900
+ i = m, r = i - o, s = u + l + n, c = s - n;
901
+ break;
902
+ case 5:
903
+ i = m - l, r = i - o, s = u + n / 2, c = s - n;
904
+ break;
905
+ case 6:
906
+ i = m, r = i - o, s = u - l, c = s - n;
907
+ break;
908
+ case 7:
909
+ r = m - o / 2, i = r + o, s = u - l, c = s - n;
910
+ }
911
+ if (!(!r || !c || !i || !s))
912
+ return [Math.min(r, i), Math.min(c, s), Math.max(r, i), Math.max(c, s) + 1];
913
+ }
914
+ function calculateAnchorPoint(e, t, o = 70, n = 20, l = 20) {
915
+ const r = [0, 0];
916
+ switch (t) {
917
+ case 0:
918
+ r[0] = e[0] + l, r[1] = e[1] - l - n / 2;
919
+ break;
920
+ case 1:
921
+ r[0] = e[0] + l, r[1] = e[1];
922
+ break;
923
+ case 2:
924
+ r[0] = e[0] + l, r[1] = e[1] + l + n / 2;
925
+ break;
926
+ case 3:
927
+ r[0] = e[0], r[1] = e[1] + l + n / 4;
928
+ break;
929
+ case 4:
930
+ r[0] = Math.max(e[0] - l, e[0] - o / 2), r[1] = e[1] + l + n / 4;
931
+ break;
932
+ case 5:
933
+ r[0] = e[0] - l, r[1] = e[1];
934
+ break;
935
+ case 6:
936
+ r[0] = Math.max(e[0] - l, e[0] - o / 2), r[1] = e[1] - l - n / 4;
937
+ break;
938
+ case 7:
939
+ r[0] = e[0], r[1] = e[1] - l - n / 4;
940
+ }
941
+ return r;
942
+ }
943
+ function drawLabelBody(e, t, o) {
944
+ if (!e) return;
945
+ const {
946
+ font: n,
947
+ labelOutSize: l = 2,
948
+ labelHeight: r,
949
+ center: i,
950
+ text: c,
951
+ leftIcon: s,
952
+ shipColor: m,
953
+ lineLength: u = 20,
954
+ selected: d
955
+ } = o;
956
+ e.save(), n && (e.font = n);
957
+ let f = e.measureText(c).width + 4 * l;
958
+ (s || m) && (f += r + 6 * l), e.restore();
959
+ let p, y = 20, h = -1, g = r + 3 * l;
960
+ if (u)
961
+ for (let k = 0; k < 8; k++) {
962
+ p = calculateBounds(i, k, f, g, u);
963
+ let M = !1;
964
+ for (let b = 0; b < t.length; ++b) {
965
+ let x = t[b].bounds, F = [
966
+ x[0] - y,
967
+ x[1] - y,
968
+ x[2] + y,
969
+ x[3] + y
970
+ ];
971
+ if (p && isOverlapping(p, F)) {
972
+ M = !0;
973
+ break;
974
+ }
899
975
  }
900
- let u = !0;
901
- if (t[c].state !== "0") {
902
- for (let f = 0; f < n.length; f++)
903
- if (isOverlapping(d, n[f].bounds)) {
904
- u = !1;
905
- break;
906
- }
976
+ if (!M) {
977
+ h = k;
978
+ break;
907
979
  }
908
- u && (t[c].bounds = d, n.push(t[c]));
909
980
  }
981
+ else
982
+ h = 0, p = calculateBounds(i, h, f, g, u);
983
+ if (d && h === -1 && (h = 0), p && h > -1) {
984
+ let k = getBottomLeftPoint(p), M = getTopRighttPoint(p);
985
+ return {
986
+ center: i,
987
+ x: calculateAnchorPoint(i, h, f, g, u),
988
+ l: M,
989
+ r: k,
990
+ bounds: p,
991
+ position: h,
992
+ name: c
993
+ };
994
+ } else
995
+ return null;
996
+ }
997
+ const drawText = (e, t) => {
998
+ if (!e) return;
999
+ const { center: o, text: n, textColor: l, leftIcon: r, rightIcons: i, font: c } = t;
1000
+ e.save(), e.setTransform(1, 0, 0, 1, 0, 0);
1001
+ let [s, m] = o;
1002
+ if (r) {
1003
+ e.font = `${18 * pixelRatio}px map-iconfont`;
1004
+ let u = getIconFont(r.icon);
1005
+ e.fillStyle = r.color, e.fillText(u, s + labelOutSize - 3 * pixelRatio, m + 2.6 * pixelRatio), s += 23 * pixelRatio;
910
1006
  }
911
- const r = getIconStyle(stopIcon), i = getIconStyle(slowIcon);
912
- n.forEach((c, s) => {
913
- var u, f;
914
- const d = new Feature({
915
- geometry: new Point(c.centerPoint)
916
- });
917
- d.set("type", "track_point"), d.set("data", c), d.setStyle([
918
- new Style({
919
- // 扩大交互热区
920
- image: new CircleStyle({
921
- stroke: new Stroke({ color: "rgba(0, 0, 0, 0.01)", width: 20 }),
922
- radius: 3
923
- })
924
- }),
925
- new Style({
926
- // 轨迹点样式
927
- image: new CircleStyle({
928
- fill: new Fill({ color: e }),
929
- stroke: new Stroke({ color: "#fff", width: 2 }),
930
- radius: 3
931
- })
932
- })
933
- ]), trackLineVectorSource.value.addFeature(d);
934
- const m = new Feature({
935
- geometry: new Point(fromLonLat(c.center))
1007
+ if (i != null && i.length) {
1008
+ e.font = `${12 * pixelRatio}px map-iconfont`, e.fillStyle = "#3370ff";
1009
+ const u = e.measureText(n).width + 6 * pixelRatio;
1010
+ i.forEach((d, f) => {
1011
+ const p = getIconFont(d), y = 20 * pixelRatio * f;
1012
+ e.fillText(p, s + u + y, m);
936
1013
  });
937
- if (m.set("type", "track_label"), m.set("track_label_index", s), m.setStyle(
938
- setTrackLabelStyle(c, e)
939
- ), trackLineVectorSource.value.addFeature(m), typeof c == "object" && c.hasOwnProperty("state")) {
940
- const p = new Feature({
941
- geometry: new Point(c.centerPoint)
1014
+ }
1015
+ e.font = c || labelFont, e.fillStyle = l, e.fillText(n, s + 2, m), e.restore();
1016
+ }, drawPolygon = (e, t) => {
1017
+ let {
1018
+ points: o,
1019
+ strokeColor: n,
1020
+ fillColor: l,
1021
+ shouldClosePath: r,
1022
+ translation: i,
1023
+ rotation: c,
1024
+ rotationCenter: s,
1025
+ scale: m,
1026
+ globalAlpha: u
1027
+ } = t;
1028
+ if (u || (u = 1), o && e) {
1029
+ e.save(), e.beginPath(), c && c !== 0 && s == null && e.rotate(c), i && e.translate(i[0], i[1]), c && (s != null && s.length) && e.rotate(c), m && e.scale(m, m), e.moveTo(o[0][0], o[0][1]);
1030
+ for (let d = 1; d < o.length; d++)
1031
+ e.lineTo(o[d][0], o[d][1]);
1032
+ r && e.closePath(), n && (e.strokeStyle = n, e.stroke()), l && r && (u && (e.globalAlpha = u), e.fillStyle = l, e.fill()), e.restore();
1033
+ }
1034
+ }, intervalIds = {}, drawLabel = (e, t, o) => {
1035
+ var d, f, p, y, h, g, k;
1036
+ let { center: n, text: l, color: r, textColor: i, bgColor: c, leftIcon: s, rightIcons: m, type: u } = t;
1037
+ if (n && l) {
1038
+ const M = {
1039
+ font: labelFont,
1040
+ labelOutSize,
1041
+ labelHeight,
1042
+ center: n,
1043
+ text: l,
1044
+ leftIcon: s,
1045
+ selected: t.selected
1046
+ };
1047
+ (d = t.blinkColors) != null && d.length && t.fill && (c = t.fill, i = getForegroundColor(t.fill));
1048
+ const b = drawLabelBody(e, o, M);
1049
+ if (b) {
1050
+ const { x, bounds: F, l: P } = b, v = [getTopLeftPoint(F), getBottomLeftPoint(F), getBottomRightPoint(F), getTopRighttPoint(F)];
1051
+ o.find((C) => C.name === l) || o.push(b), drawPolygon(e, {
1052
+ points: [n, x],
1053
+ strokeColor: r,
1054
+ fillColor: "#000",
1055
+ shouldClosePath: !0,
1056
+ translation: void 0,
1057
+ rotation: void 0,
1058
+ rotationCenter: void 0,
1059
+ scale: void 0,
1060
+ globalAlpha: labelAlpha
1061
+ }), m != null && m.length && m.forEach((C, V) => {
1062
+ v[1][0] += 34 + V * 2, v[2][0] += 34 + V * 2;
942
1063
  });
943
- p.set("type", "track_icon");
944
- const w = new Style({
945
- text: new Text({
946
- font: "Normal 22px map-iconfont",
947
- text: getIconFont(dropletsIcon),
948
- offsetY: -10
949
- }),
950
- zIndex: 99
951
- }), h = [];
952
- Number(c.state) === 0 ? ((u = w.getText()) == null || u.setFill(new Fill({ color: stopColor })), h.push(r)) : Number(c.state) === 1 && ((f = w.getText()) == null || f.setFill(new Fill({ color: slowColor })), h.push(i)), h.push(w), p.setStyle(h), trackLineVectorSource.value.addFeature(p);
953
- }
954
- }), renderArrow(n, e), renderIconPoint();
955
- }, renderArrow = (e, t) => {
956
- const o = e.length;
957
- o || (e.push(trackList$1.value[0]), e.push(trackList$1.value[trackList$1.value.length - 1]));
958
- for (let n = 0; n < o - 1; n++) {
959
- let l;
960
- const r = e[n], i = (e[n + 1].index + r.index) / 2;
961
- if (i % 2 === 0)
962
- l = trackList$1.value[i].centerPoint;
963
- else {
964
- const c = trackList$1.value[Math.floor(i)], s = trackList$1.value[Math.ceil(i)];
965
- if (c && s) {
966
- const [d, m] = c.centerPoint, [u, f] = s.centerPoint;
967
- l = [(d + u) / 2, (m + f) / 2];
968
- }
969
- }
970
- if (l) {
971
- const c = new Feature({
972
- geometry: new Point(l)
973
- });
974
- c.set("type", "track_arrow"), c.setStyle(
975
- new Style({
976
- text: new Text({
977
- font: "700 14px map-iconfont",
978
- text: getIconFont("&#xe6bc;"),
979
- fill: new Fill({ color: t }),
980
- // 设置箭头旋转 角度转为弧度
981
- rotation: getRotation(
982
- e[n].center,
983
- e[n + 1].center
984
- ) * (Math.PI / 180)
985
- })
986
- })
987
- ), trackLineVectorSource.value.addFeature(c);
1064
+ const w = {
1065
+ points: v,
1066
+ strokeColor: r,
1067
+ fillColor: c,
1068
+ shouldClosePath: !0
1069
+ }, [S, T] = P, E = {
1070
+ center: [S, T + labelOutSize + labelHeight + 1],
1071
+ text: l,
1072
+ textColor: i,
1073
+ leftIcon: s,
1074
+ rightIcons: m,
1075
+ blinkColors: t.blinkColors
1076
+ };
1077
+ if (drawPolygon(e, w), drawText(e, E), t != null && t.blinkColors && t.blinkColors.length > 0) {
1078
+ let C = Date.now(), V = 0;
1079
+ const N = t.blinkColors;
1080
+ !!!((y = (p = (f = selectShipsLayer.value) == null ? void 0 : f.getSource()) == null ? void 0 : p.getFeatures()) != null && y.find(($) => {
1081
+ var R;
1082
+ return ((R = $.get("data")) == null ? void 0 : R.id) === t.id;
1083
+ }) || (k = (g = (h = shipsLayer.value) == null ? void 0 : h.getSource()) == null ? void 0 : g.getFeatures()) != null && k.find(($) => {
1084
+ var R;
1085
+ return ((R = $.get("data")) == null ? void 0 : R.id) === t.id;
1086
+ })) || hiddenOrther.value ? (clearInterval(intervalIds[t.id]), deleteLabelFromArray(o, l)) : (intervalIds[t.id] && clearInterval(intervalIds[t.id]), intervalIds[t.id] = window.setInterval(() => {
1087
+ var D, G, _;
1088
+ const $ = Date.now();
1089
+ $ - C >= 500 && (V = (V + 1) % N.length, C = $, w.fillColor = N[V], drawPolygon(e, w), E.textColor = getForegroundColor(w.fillColor), drawText(e, E));
1090
+ const R = shipsMarkerList == null ? void 0 : shipsMarkerList.some((O) => {
1091
+ var B;
1092
+ return ((B = O.ship) == null ? void 0 : B.id) === t.id;
1093
+ }), Z = (_ = (G = (D = shipsLayer.value) == null ? void 0 : D.getSource()) == null ? void 0 : G.getFeatures()) == null ? void 0 : _.some((O) => {
1094
+ const B = O.get("data");
1095
+ return (B == null ? void 0 : B.id) === t.id;
1096
+ });
1097
+ !R && !Z && (clearInterval(intervalIds[t.id]), deleteLabelFromArray(o, l));
1098
+ }, 10));
1099
+ } else
1100
+ shipLabels.value.find((V) => V.name === l) && (clearInterval(intervalIds[t.id]), drawPolygon(e, w), drawText(e, E));
988
1101
  }
989
1102
  }
990
- }, renderIconPoint = () => {
991
- const e = "&#xe69b;", t = "#fcdc3f", o = "#ff0000";
992
- (trackList$1.value.length < 2 ? [trackList$1.value[0]] : [trackList$1.value[0], trackList$1.value[trackList$1.value.length - 1]]).forEach((l) => {
993
- const r = new Feature({
994
- geometry: new Point(l.centerPoint)
995
- });
996
- r.set("type", "track_begin"), r.set("data", l);
997
- const i = l.index === 0 && trackList$1.value.length >= 2 ? t : o;
998
- r.setStyle(
999
- new Style({
1000
- text: new Text({
1001
- font: "Normal 14px map-iconfont",
1002
- text: getIconFont(e),
1003
- fill: new Fill({ color: i })
1004
- }),
1005
- zIndex: 101
1006
- })
1007
- ), trackLineVectorSource.value.addFeature(r);
1103
+ return null;
1104
+ }, clearAllInterval = () => {
1105
+ Object.keys(intervalIds).forEach((e) => {
1106
+ clearInterval(e);
1008
1107
  });
1009
- }, setTrackLabelStyle = (e, t) => new Style({
1010
- renderer: (o, n) => {
1011
- const l = n.context, c = {
1012
- center: o,
1013
- text: e.time,
1014
- color: t,
1015
- textColor: "#000",
1016
- bgColor: "rgba(255,255,255,.8)",
1017
- selected: !0,
1018
- type: "TrackTime"
1019
- };
1020
- drawLabel(l, c, trackLabels.value);
1108
+ }, deleteLabelFromArray = (e, t) => {
1109
+ const o = e.findIndex((n) => n.name === t);
1110
+ o !== -1 && e.splice(o, 1);
1111
+ }, PI = Math.PI, a = 6378245, ee = 0.006693421622965943;
1112
+ function transformLat(e, t) {
1113
+ let o = -100 + 2 * e + 3 * t + 0.2 * t * t + 0.1 * e * t + 0.2 * Math.sqrt(Math.abs(e));
1114
+ return o += (20 * Math.sin(6 * e * PI) + 20 * Math.sin(2 * e * PI)) * 2 / 3, o += (20 * Math.sin(t * PI) + 40 * Math.sin(t / 3 * PI)) * 2 / 3, o += (160 * Math.sin(t / 12 * PI) + 320 * Math.sin(t * PI / 30)) * 2 / 3, o;
1115
+ }
1116
+ function transformLng(e, t) {
1117
+ let o = 300 + e + 2 * t + 0.1 * e * e + 0.1 * e * t + 0.1 * Math.sqrt(Math.abs(e));
1118
+ return o += (20 * Math.sin(6 * e * PI) + 20 * Math.sin(2 * e * PI)) * 2 / 3, o += (20 * Math.sin(e * PI) + 40 * Math.sin(e / 3 * PI)) * 2 / 3, o += (150 * Math.sin(e / 12 * PI) + 300 * Math.sin(e / 30 * PI)) * 2 / 3, o;
1119
+ }
1120
+ function outOfChina(e, t) {
1121
+ return !(e > 73.66 && e < 135.05 && t > 3.86 && t < 53.55);
1122
+ }
1123
+ function gcj02ToWgs84(e) {
1124
+ const [t, o] = e.split(",").map(Number);
1125
+ if (outOfChina(t, o))
1126
+ return `${t.toFixed(6)}, ${o.toFixed(6)}`;
1127
+ {
1128
+ let n = transformLat(t - 105, o - 35), l = transformLng(t - 105, o - 35);
1129
+ const r = o / 180 * PI;
1130
+ let i = Math.sin(r);
1131
+ i = 1 - ee * i * i;
1132
+ const c = Math.sqrt(i);
1133
+ n = n * 180 / (a * (1 - ee) / (i * c) * PI), l = l * 180 / (a / c * Math.cos(r) * PI);
1134
+ const s = o + n, m = t + l;
1135
+ return `${(t * 2 - m).toFixed(6)}, ${(o * 2 - s).toFixed(6)}`;
1021
1136
  }
1022
- }), triangleModel = multiplyPixelRatio([
1023
- [0, -8],
1024
- [5, 8],
1025
- [-5, 8]
1026
- ]), shipShapeModel = multiplyPixelRatio([
1027
- [0, -4.545],
1028
- [-0.56, -3.909],
1029
- [-1, -2.727],
1030
- [-1, 3.636],
1031
- [-0.8, 4.545],
1032
- [0.8, 4.545],
1033
- [1, 3.636],
1034
- [1, -2.727],
1035
- [0.56, -3.909],
1036
- [0, -4.545]
1037
- ]), shipDirectPath = {
1038
- left: {
1039
- 0: [
1040
- [0, 0],
1041
- [0, -8],
1042
- [-4, -8]
1043
- ],
1044
- 1: [
1045
- [0, 0],
1046
- [0, -16],
1047
- [-6, -16]
1048
- ],
1049
- 2: [
1050
- [0, 0],
1051
- [0, -24],
1052
- [-8, -24]
1053
- ]
1054
- },
1055
- right: {
1056
- 0: [
1057
- [0, 0],
1058
- [0, -8],
1059
- [-4, -8]
1060
- ],
1061
- 1: [
1062
- [0, 0],
1063
- [0, -16],
1064
- [-6, -16]
1065
- ],
1066
- 2: [
1067
- [0, 0],
1068
- [0, -24],
1069
- [-8, -24]
1070
- ]
1071
- },
1072
- front: {
1073
- 0: [
1074
- [0, 0],
1075
- [0, -8]
1076
- ],
1077
- 1: [
1078
- [0, 0],
1079
- [0, -16]
1080
- ],
1081
- 2: [
1082
- [0, 0],
1083
- [0, -24]
1084
- ]
1137
+ }
1138
+ function calculateCirclePoints(e, t) {
1139
+ const o = fromLonLat(e), n = t * 1e3, l = [
1140
+ o[0] - n,
1141
+ o[1] - n,
1142
+ o[0] + n,
1143
+ o[1] + n
1144
+ ], r = transformExtent(l, projection.mercator, projection.data);
1145
+ return {
1146
+ leftTopPoint: { lng: r[0], lat: r[3] },
1147
+ rightTopPoint: { lng: r[2], lat: r[3] },
1148
+ rightBottomPoint: { lng: r[2], lat: r[1] },
1149
+ leftBottomPoint: { lng: r[0], lat: r[1] }
1150
+ };
1151
+ }
1152
+ const equatorialCircumference = 2003750834e-2;
1153
+ function lonLatToMercator(e) {
1154
+ const t = e[0] * equatorialCircumference / 180;
1155
+ let o = Math.log(Math.tan((90 + e[1]) * Math.PI / 360)) / (Math.PI / 180);
1156
+ return o = o * equatorialCircumference / 180, [t, o];
1157
+ }
1158
+ function mercatorToLonLat(e, t = "lonlat") {
1159
+ const o = { lon: 0, lat: 0 }, n = e[0] / equatorialCircumference * 180;
1160
+ let l = e[1] / equatorialCircumference * 180;
1161
+ return l = 180 / Math.PI * (2 * Math.atan(Math.exp(l * Math.PI / 180)) - Math.PI / 2), o.lon = n, o.lat = l, t === "lonlat" ? o : [n, l];
1162
+ }
1163
+ function calculateBoundingBox(e) {
1164
+ let t = 1 / 0, o = -1 / 0, n = 1 / 0, l = -1 / 0;
1165
+ e.forEach((h) => {
1166
+ const [g, k] = h;
1167
+ t = Math.min(t, k), o = Math.max(o, k), n = Math.min(n, g), l = Math.max(l, g);
1168
+ });
1169
+ const r = l - n, i = o - t, c = Math.max(r, i), s = (n + l) / 2, m = (t + o) / 2, u = c / 2, d = s - u, f = s + u, p = m - u, y = m + u;
1170
+ return [f, p, d, y];
1171
+ }
1172
+ const transformUtils = {
1173
+ gcj02ToWgs84,
1174
+ calculateCirclePoints,
1175
+ lonLatToMercator,
1176
+ mercatorToLonLat,
1177
+ calculateBoundingBox
1178
+ }, mapInstance$5 = ref(), renderTrackStyleSetInstance = (e) => mapInstance$5.value = e, stopIcon = "&#xe6e2;", stopColor = "#E31818", slowIcon = "&#xe703;", slowColor = "#1890FF", dropletsIcon = "&#xe6d2", trackList$1 = ref([]);
1179
+ let animationFeature;
1180
+ const renderTrackLine = (e, t, o) => {
1181
+ var r, i, c;
1182
+ const n = e[t];
1183
+ if (!n) return;
1184
+ allTracks.value[t] = n, trackList$1.value = [], trackList$1.value = n.map((s, m) => (s.center = [s.lon, s.lat], s.centerPoint = transformUtils.lonLatToMercator(s.center), s.id = t, s.index = m, s.time = hooks(s.createdAt).format("YYYY-MM-DD HH:mm:ss"), s));
1185
+ const l = trackList$1.value.map((s) => s.centerPoint);
1186
+ if (l.length >= 2) {
1187
+ const s = new LineString(l), m = new Feature({ geometry: s });
1188
+ m.setStyle(
1189
+ new Style({
1190
+ stroke: new Stroke({
1191
+ color: o,
1192
+ width: 2
1193
+ })
1194
+ })
1195
+ ), m.setId(t), m.set("type", "line"), (i = (r = shipTrackVectorLayer.value) == null ? void 0 : r.getSource()) == null || i.clear(), shipTrackLineFeatures.value = [];
1196
+ const u = shipTrackLineFeatures.value.findIndex((f) => f.getId() === t);
1197
+ u >= 0 ? shipTrackLineFeatures.value[u] = m : shipTrackLineFeatures.value.push(m);
1198
+ const d = createAnimatedIconFeature(o, l);
1199
+ trackLineVectorSource.value = new VectorSource({
1200
+ features: [...shipTrackLineFeatures.value]
1201
+ }), animationFeature = d, console.log(animationFeature), shipTrackVectorLayer.value = new VectorLayer({
1202
+ source: trackLineVectorSource.value,
1203
+ zIndex: 102
1204
+ }), renderPoint(o), (c = mapInstance$5.value) == null || c.addLayer(shipTrackVectorLayer.value);
1085
1205
  }
1086
- }, setBlankStyle = () => new Style({
1087
- image: new CircleStyle({
1088
- radius: 0
1206
+ }, handlePlay = (e, t) => {
1207
+ const o = allTracks.value[String(e)];
1208
+ playAnimation(o.map((n) => [n.lon, n.lat]), t);
1209
+ }, removeShipTrackLineFeatureByIndex = (e, t) => {
1210
+ e >= 0 && e < shipTrackLineFeatures.value.length && (shipTrackLineFeatures.value.splice(e, 1), delete allTracks.value[t]), trackLineVectorSource.value = new VectorSource({
1211
+ features: [...shipTrackLineFeatures.value]
1212
+ }), shipTrackVectorLayer.value && shipTrackVectorLayer.value.setSource(trackLineVectorSource.value);
1213
+ }, createAnimatedIconFeature = (e, t) => {
1214
+ const o = new Feature({
1215
+ geometry: new Point(fromLonLat([t[0][0], t[0][1]]))
1216
+ // 初始位置
1217
+ }), n = new Style({
1218
+ text: new Text({
1219
+ font: "700 14px map-iconfont",
1220
+ text: getIconFont("&#xe6bc;"),
1221
+ fill: new Fill({ color: e })
1222
+ })
1223
+ });
1224
+ return o.setStyle(n), o;
1225
+ }, geoMarkerStyle = new Style({
1226
+ text: new Text({
1227
+ font: "700 20px map-iconfont",
1228
+ text: getIconFont("&#xe657;"),
1229
+ fill: new Fill({ color: "#ff0000" }),
1230
+ rotation: 0
1231
+ // 初始旋转角度
1089
1232
  })
1090
- }), mapInstance$6 = ref(), renderShipStyleSetInstance = (e) => mapInstance$6.value = e, speedCondition = [[1, 10], [10, 20], [20, 1 / 0]], drawShipModelByZoom = { 14: [200, 30], 15: [115, 15], 16: [55, 8], 17: [25, 5], 18: [1, 1] }, setShipStyle = (e, t = !1) => new Style({
1091
- renderer: (o, n) => {
1092
- const l = n.context, r = n.feature.get("data");
1093
- if (!r) return;
1094
- if (r != null && r.length) {
1095
- const c = r.length / 2;
1096
- l.beginPath(), l.arc(
1097
- o[0],
1098
- o[1],
1099
- c,
1100
- 0,
1101
- 2 * Math.PI
1102
- ), l.fillStyle = "rgba(0, 0, 0, 0.01)", l.fill();
1103
- }
1104
- n.feature.get("index") === 0 && (shipLabels.value = []);
1105
- try {
1106
- const c = drawShipBody(l, r, o, t);
1107
- c && (drawHeading(l, r, c, t), r.selected = e, e && setTimeout(() => {
1108
- drawSelectBounds(l, c);
1109
- }, 50)), drawShipLabel(l, r, o);
1110
- } catch {
1111
- return !1;
1112
- }
1113
- }
1114
- }), drawShipBody = (e, t, o, n) => {
1115
- if (!mapInstance$6.value) return;
1116
- const l = Math.round(Number(mapInstance$6.value.getView().getZoom()));
1117
- if (!l) return;
1118
- let r = [];
1119
- const [i, c] = drawShipModelByZoom[l] || [0, 0], [s, d] = o;
1120
- if (l <= mapZoom.shipModelMax && l > mapZoom.shipModelMin && t.length >= i && t.breadth >= c)
1121
- r = rotateShapeModel(drawCurrentShipShapeModel(t, l), t.angle).map((u) => {
1122
- const [f, p] = u;
1123
- return [s + f, d + p];
1124
- });
1125
- else {
1126
- const m = rotateShapeModel(triangleModel, t.angle);
1127
- o.length === 2 && (r = m.map((u) => {
1128
- const [f, p] = u;
1129
- return [s + f, d + p];
1130
- }));
1131
- }
1132
- if (!(r.length > 2)) return !1;
1133
- e.save(), e.beginPath(), e.moveTo(r[0][0], r[0][1]);
1134
- for (let m = 1; m < r.length; m++)
1135
- e.lineTo(r[m][0], r[m][1]);
1136
- return e.closePath(), e.strokeStyle = n ? "#ff0000" : "#000", e.lineWidth = n ? 2 : 1, e.stroke(), e.fillStyle = t.fill, e.fill(), e.restore(), r;
1137
- }, drawHeading = (e, t, o, n) => {
1138
- const [l, r] = o[0], i = getShipDirectPath(t);
1139
- if (i) {
1140
- const c = i.map(function(s) {
1141
- const [d, m] = s;
1142
- return [d + l, m + r];
1143
- });
1144
- if (e.save(), e.beginPath(), t.angle > 0) {
1145
- e.translate(l, r);
1146
- const s = t.angle * Math.PI / 180;
1147
- e.rotate(s), e.translate(-l, -r);
1148
- }
1149
- e.moveTo(l, r);
1150
- for (let s = 1; s < c.length; s++) {
1151
- const [d, m] = c[s];
1152
- e.lineTo(d, m);
1153
- }
1154
- e.strokeStyle = n ? "#ff0000" : "#000", e.lineWidth = n ? 2 : 1, e.stroke(), e.restore();
1233
+ });
1234
+ let polyline, linePath, startMarker, position, geoMarker, vectorLayer;
1235
+ const trackAnimating = ref(!1);
1236
+ let distance = 0, lastTime = Date.now(), moveFeatureHandler = null;
1237
+ const moveFeature = (e, t) => {
1238
+ var d, f, p;
1239
+ const o = Number(50 * t), n = ((d = e.frameState) == null ? void 0 : d.time) ?? Date.now(), l = n - lastTime;
1240
+ if (distance = (distance + o * l / 1e6) % 2, lastTime = n, distance >= 1) {
1241
+ stopAnimation();
1242
+ return;
1155
1243
  }
1156
- }, drawSelectBounds = (e, t) => {
1157
- let [o, n, l, r] = getPixelFromCoordinate(t);
1158
- const i = 4;
1159
- o -= i, n -= i, l += i, r += i, e.save(), e.strokeStyle = "#ff0000", e.lineWidth = 4;
1160
- const c = 8;
1161
- e.beginPath(), e.moveTo(o + c, r), e.lineTo(o, r), e.lineTo(o, r - c), e.moveTo(o, n + c), e.lineTo(o, n), e.lineTo(o + c, n), e.moveTo(l - c, n), e.lineTo(l, n), e.lineTo(l, n + c), e.moveTo(l, r - c), e.lineTo(l, r), e.lineTo(l - c, r), e.stroke(), e.restore();
1162
- }, drawShipLabel = (e, t, o) => {
1163
- if (!t.selected && shipLabels.value.find((u) => u.name === t.name)) return;
1164
- const [n, l] = o, r = n - 0, i = l - 0, c = t.name;
1165
- let s;
1166
- t.leftIconColor && (s = { color: t.leftIconColor, icon: "&#xe599;" });
1167
- const d = getShipCustomIcon(t), m = {
1168
- id: t.id,
1169
- center: [r, i],
1170
- text: c,
1171
- fill: t.fill,
1172
- color: "#fff",
1173
- textColor: "#000",
1174
- bgColor: "#fff",
1175
- leftIcon: s,
1176
- rightIcons: d,
1177
- selected: t.selected,
1178
- blinkColors: t.blinkColors,
1179
- type: "ShipName"
1180
- };
1181
- drawLabel(e, m, shipLabels.value);
1182
- }, drawCurrentShipShapeModel = (e, t) => {
1183
- let o = 0;
1184
- t <= 14 ? o = 0.058 : t === 15 ? o = 0.12 : t === 16 ? o = 0.22 : t === 17 ? o = 0.435 : t === 18 && (o = 0.857);
1185
- const n = e.length / 4 * o, l = e.breadth * o;
1186
- let r = cloneDeep(shipShapeModel);
1187
- return r = r.map(([i, c]) => [i * l, c * n]), r;
1188
- }, getShipDirectPath = (e) => {
1189
- const { speed: t, hdg: o, cog: n } = e;
1190
- let l = "", r = null;
1191
- if (t && t > 1 && (o !== null && o != 511 && n !== null ? n - o >= 3 ? l = "left" : n - o <= -3 ? l = "right" : l = "front" : l = "front", l && t))
1192
- for (const i in speedCondition) {
1193
- const c = speedCondition[i];
1194
- if (t >= c[0] && t < c[1]) {
1195
- r = shipDirectPath[l][i];
1196
- break;
1197
- }
1198
- }
1199
- return r;
1200
- }, getShipCustomIcon = (e) => {
1201
- const t = [];
1202
- return e.existDevice && t.push("&#xe687;"), e.existMobile && t.push("&#xe688;"), e.existWaterGauge && t.push("&#xe686;"), t || [];
1203
- }, mapInstance$5 = ref(), renderShipSetInstance = (e) => mapInstance$5.value = e;
1204
- let shipsMarkerList = [], shipsVectorSource, largeAmountShipsSource;
1205
- const selectedShipData = ref(null);
1206
- let selectShipsVectorSource;
1207
- const renderShips = (e) => {
1208
- var o, n, l, r;
1209
- if (!mapInstance$5.value || showTrackLayer.value) return;
1210
- const t = Math.round(Number(mapInstance$5.value.getView().getZoom()));
1211
- if (selectedShipData.value && nextTick(() => {
1212
- selectSingleShipMarker(selectedShipData.value);
1213
- }).then((i) => {
1214
- }), !(!t || t < mapZoom.shipGreenDotMax) && (allShips.value = e, !hiddenOrther.value))
1215
- return t >= mapZoom.shipGreenDotMax && t < mapZoom.shipModelMin ? ((o = shipsLayer.value) == null || o.setVisible(!1), (n = largeAmountShipsLayer.value) == null || n.setVisible(!0), renderLargeAmountShips(e)) : ((l = largeAmountShipsLayer.value) == null || l.setVisible(!1), (r = shipsLayer.value) == null || r.setVisible(!0), renderShipsMarker(e));
1216
- }, renderLargeAmountShips = (e) => {
1217
- if (!mapInstance$5.value) return;
1218
- const t = e.map((o) => ({
1219
- type: "Feature",
1220
- geometry: {
1221
- type: "Point",
1222
- coordinates: [o.lon, o.lat]
1223
- },
1224
- properties: o
1225
- }));
1226
- return largeAmountShipsSource == null || largeAmountShipsSource.clear(), largeAmountShipsSource = new VectorSource({
1227
- features: new GeoJSON().readFeatures({
1228
- type: "FeatureCollection",
1229
- features: t
1230
- }, {
1231
- featureProjection: projection.mercator
1244
+ const r = linePath.getCoordinateAt(
1245
+ distance > 1 ? 2 - distance : distance
1246
+ ), i = linePath.getCoordinateAt(
1247
+ distance > 1 ? distance - 0.01 : distance
1248
+ ), c = linePath.getCoordinateAt(
1249
+ distance > 1 ? 2 - distance : distance + 0.01
1250
+ ), m = getRotation(
1251
+ transformUtils.mercatorToLonLat(i, "array"),
1252
+ transformUtils.mercatorToLonLat(c, "array")
1253
+ ) * Math.PI / 180;
1254
+ (f = geoMarkerStyle.getText()) == null || f.setRotation(m), position.setCoordinates(r);
1255
+ const u = getVectorContext(e);
1256
+ u.context_.save(), u.setStyle(geoMarkerStyle), u.drawGeometry(position), u.context_.restore(), (p = mapInstance$5.value) == null || p.render();
1257
+ }, startAnimation = () => {
1258
+ var e;
1259
+ trackAnimating.value = !0, showTrackAnimatMarker.value = !0, lastTime = Date.now(), distance = 0, position = ((e = startMarker.getGeometry()) == null ? void 0 : e.clone()) || new Point([0, 0]), moveFeatureHandler && (vectorLayer == null || vectorLayer.on("postrender", moveFeatureHandler)), geoMarker == null || geoMarker.setGeometry(void 0);
1260
+ }, stopAnimation = () => {
1261
+ var e;
1262
+ trackAnimating.value && (trackAnimating.value = !1, geoMarker == null || geoMarker.setGeometry(void 0), moveFeatureHandler && vectorLayer && vectorLayer.un("postrender", moveFeatureHandler), vectorLayer && ((e = mapInstance$5.value) == null || e.removeLayer(vectorLayer)), vectorLayer = null, geoMarker = null);
1263
+ }, playAnimation = (e, t) => {
1264
+ var n;
1265
+ trackAnimating.value && stopAnimation(), polyline = new Polyline({
1266
+ factor: 1e6
1267
+ }).writeGeometry(new LineString(e)), linePath = new Polyline({
1268
+ factor: 1e6
1269
+ }).readGeometry(polyline, {
1270
+ dataProjection: projection.data,
1271
+ featureProjection: projection.mercator
1272
+ }), startMarker = new Feature({
1273
+ type: "icon",
1274
+ geometry: new Point(linePath.getFirstCoordinate())
1275
+ });
1276
+ const o = startMarker.getGeometry();
1277
+ position = o ? o.clone() : new Point([0, 0]), geoMarker = new Feature({
1278
+ type: "geoMarker",
1279
+ style: geoMarkerStyle,
1280
+ geometry: position
1281
+ }), vectorLayer = new VectorLayer({
1282
+ source: new VectorSource({
1283
+ features: [geoMarker]
1232
1284
  })
1233
- }), largeAmountShipsLayer.value = new WebGLPointsLayer({
1234
- source: largeAmountShipsSource,
1235
- style: {
1236
- "shape-points": 3,
1237
- "shape-radius": 9,
1238
- "shape-fill-color": [
1239
- "case",
1240
- ["==", ["get", "fill"], "#D9001C"],
1241
- "#D9001C",
1242
- // 如果 fill 是 #D9001C,返回红色
1243
- ["==", ["get", "fill"], "#04C900"],
1244
- "#04C900",
1245
- // 如果 fill 是 #04C900,返回绿色
1246
- "#04C900"
1247
- // 默认颜色(绿色)
1248
- ],
1249
- "shape-rotate-with-view": !1,
1250
- "shape-rotation": [
1251
- "+",
1252
- ["get", "cog"],
1253
- // 获取 'cog' 属性值
1254
- 180
1255
- // 将值旋转 180 度
1256
- ],
1257
- "shape-scale": [0.8, 1.2],
1258
- "shape-stroke-color": "#000000",
1259
- // 边框颜色为黑色
1260
- "shape-stroke-width": 0.5
1261
- // 边框宽度为0.5px
1262
- }
1263
- }), mapInstance$5.value.addLayer(largeAmountShipsLayer.value), largeAmountShipsLayer.value;
1264
- }, renderShipsMarker = (e) => {
1265
- var o;
1285
+ }), (n = mapInstance$5.value) == null || n.addLayer(vectorLayer), moveFeatureHandler = (l) => moveFeature(l, t), startAnimation();
1286
+ }, renderPoint = (e) => {
1266
1287
  if (!mapInstance$5.value) return;
1267
- deleteAllShipMarkers();
1268
- let t = convertShipMapData(e);
1269
- if (t = customFilterShips(t), !!(t != null && t.length))
1270
- return t.forEach((n, l) => {
1271
- const r = [n.lon, n.lat], i = new Feature({
1272
- geometry: new Point(fromLonLat(r))
1273
- }), c = 1;
1274
- i.set("clickGeometry", new Circle(fromLonLat(r), c)), i.set("data", n), i.set("index", l), i.setStyle(
1275
- setShipStyle(!1)
1276
- ), shipsMarkerList.push({
1277
- ship: n,
1278
- lonlat: r,
1279
- feature: i
1288
+ const t = trackList$1.value || [];
1289
+ if (!(t && t.length > 1)) return [];
1290
+ const o = { 16: 24, 17: 15, default: 4 }, n = [], l = t.length;
1291
+ for (let c = 0; c < l; c++) {
1292
+ t[c].index = c;
1293
+ const s = mapInstance$5.value.getPixelFromCoordinate(t[c].centerPoint);
1294
+ if (s) {
1295
+ let m = s.concat(s);
1296
+ m = adjustBounds(m, [20, 20]);
1297
+ const u = mapInstance$5.value.getView().getZoom();
1298
+ if (!u) return;
1299
+ if (u > 15) {
1300
+ const f = o[u] || o.default;
1301
+ m = adjustBounds(m, [f, f]);
1302
+ }
1303
+ let d = !0;
1304
+ if (t[c].state !== "0") {
1305
+ for (let f = 0; f < n.length; f++)
1306
+ if (isOverlapping(m, n[f].bounds)) {
1307
+ d = !1;
1308
+ break;
1309
+ }
1310
+ }
1311
+ d && (t[c].bounds = m, n.push(t[c]));
1312
+ }
1313
+ }
1314
+ const r = getIconStyle(stopIcon), i = getIconStyle(slowIcon);
1315
+ n.forEach((c, s) => {
1316
+ var d, f;
1317
+ const m = new Feature({
1318
+ geometry: new Point(c.centerPoint)
1319
+ });
1320
+ m.set("type", "track_point"), m.set("data", c), m.setStyle([
1321
+ new Style({
1322
+ // 扩大交互热区
1323
+ image: new CircleStyle({
1324
+ stroke: new Stroke({ color: "rgba(0, 0, 0, 0.01)", width: 20 }),
1325
+ radius: 3
1326
+ })
1327
+ }),
1328
+ new Style({
1329
+ // 轨迹点样式
1330
+ image: new CircleStyle({
1331
+ fill: new Fill({ color: e }),
1332
+ stroke: new Stroke({ color: "#fff", width: 2 }),
1333
+ radius: 3
1334
+ })
1335
+ })
1336
+ ]), trackLineVectorSource.value.addFeature(m);
1337
+ const u = new Feature({
1338
+ geometry: new Point(fromLonLat(c.center))
1339
+ });
1340
+ if (u.set("type", "track_label"), u.set("track_label_index", s), u.setStyle(
1341
+ setTrackLabelStyle(c, e)
1342
+ ), trackLineVectorSource.value.addFeature(u), typeof c == "object" && c.hasOwnProperty("state")) {
1343
+ const p = new Feature({
1344
+ geometry: new Point(c.centerPoint)
1280
1345
  });
1281
- }), shipsVectorSource = new VectorSource({
1282
- features: shipsMarkerList.map((n) => n.feature)
1283
- }), shipsLayer.value = new VectorLayer({
1284
- source: shipsVectorSource,
1285
- zIndex: 100
1286
- }), (o = mapInstance$5.value) == null || o.addLayer(shipsLayer.value), shipsLayer.value;
1287
- }, onShipsMarkerHover = () => {
1288
- var t;
1289
- let e = null;
1290
- (t = mapInstance$5.value) == null || t.on("pointermove", function(o) {
1291
- var l;
1292
- const n = (l = mapInstance$5.value) == null ? void 0 : l.forEachFeatureAtPixel(o.pixel, (r) => r);
1293
- if (e) {
1294
- const r = e.get("data");
1295
- if (!(r != null && r.mmsi)) return;
1296
- e.setStyle(
1297
- setShipStyle(!1, !1)
1298
- );
1346
+ p.set("type", "track_icon");
1347
+ const y = new Style({
1348
+ text: new Text({
1349
+ font: "Normal 22px map-iconfont",
1350
+ text: getIconFont(dropletsIcon),
1351
+ offsetY: -10
1352
+ }),
1353
+ zIndex: 99
1354
+ }), h = [];
1355
+ Number(c.state) === 0 ? ((d = y.getText()) == null || d.setFill(new Fill({ color: stopColor })), h.push(r)) : Number(c.state) === 1 && ((f = y.getText()) == null || f.setFill(new Fill({ color: slowColor })), h.push(i)), h.push(y), p.setStyle(h), trackLineVectorSource.value.addFeature(p);
1299
1356
  }
1300
- if (n) {
1301
- const r = n.get("data");
1302
- if (!(r != null && r.mmsi)) return;
1303
- e = n, n.setStyle(
1304
- setShipStyle(!1, !0)
1305
- );
1357
+ }), renderArrow(n, e), renderIconPoint();
1358
+ }, renderArrow = (e, t) => {
1359
+ const o = e.length;
1360
+ o || (e.push(trackList$1.value[0]), e.push(trackList$1.value[trackList$1.value.length - 1]));
1361
+ for (let n = 0; n < o - 1; n++) {
1362
+ let l;
1363
+ const r = e[n], i = (e[n + 1].index + r.index) / 2;
1364
+ if (i % 2 === 0)
1365
+ l = trackList$1.value[i].centerPoint;
1366
+ else {
1367
+ const c = trackList$1.value[Math.floor(i)], s = trackList$1.value[Math.ceil(i)];
1368
+ if (c && s) {
1369
+ const [m, u] = c.centerPoint, [d, f] = s.centerPoint;
1370
+ l = [(m + d) / 2, (u + f) / 2];
1371
+ }
1372
+ }
1373
+ if (l) {
1374
+ const c = new Feature({
1375
+ geometry: new Point(l)
1376
+ });
1377
+ c.set("type", "track_arrow"), c.setStyle(
1378
+ new Style({
1379
+ text: new Text({
1380
+ font: "700 14px map-iconfont",
1381
+ text: getIconFont("&#xe6bc;"),
1382
+ fill: new Fill({ color: t }),
1383
+ // 设置箭头旋转 角度转为弧度
1384
+ rotation: getRotation(
1385
+ e[n].center,
1386
+ e[n + 1].center
1387
+ ) * (Math.PI / 180)
1388
+ })
1389
+ })
1390
+ ), trackLineVectorSource.value.addFeature(c);
1306
1391
  }
1307
- });
1308
- }, customFilterShips = (e) => {
1309
- let t = cloneDeep(e);
1310
- return t = t.filter((o) => {
1311
- var l;
1312
- const n = getFilterItem(o).every(({ btnShow: r, value: i }) => r ? !!i : !0);
1313
- return (switchBtnShow.value.camera || switchBtnShow.value.mobile || switchBtnShow.value.waterGauge) && ((l = selectedShipData.value) == null ? void 0 : l.id) === o.id && clearSelectFeature(), n;
1314
- }), t;
1315
- }, getFilterItem = (e) => [
1316
- { btnShow: switchBtnShow.value.camera, value: e == null ? void 0 : e.existDevice },
1317
- { btnShow: switchBtnShow.value.mobile, value: e == null ? void 0 : e.existMobile },
1318
- { btnShow: switchBtnShow.value.waterGauge, value: e == null ? void 0 : e.existWaterGauge }
1319
- ], deleteAllShipMarkers = () => {
1320
- shipsMarkerList.forEach((e) => {
1321
- e.feature && (shipsVectorSource == null || shipsVectorSource.removeFeature(e.feature));
1322
- }), clearAllInterval(), shipsMarkerList = [];
1323
- }, selectSingleShipMarker = (e) => {
1324
- var r;
1325
- if (!mapInstance$5.value) return;
1326
- const t = cloneDeep(selectSingleShipData.value);
1327
- selectSingleShipData.value = convertShipMapData(e);
1328
- const o = [selectSingleShipData.value.lon, selectSingleShipData.value.lat], n = new Feature({
1329
- geometry: new Point(fromLonLat(o))
1330
- });
1331
- n.set("data", selectSingleShipData.value), n.setStyle(
1332
- setShipStyle(!0)
1333
- ), shipsMarkerList.push({
1334
- ship: selectSingleShipData.value,
1335
- lonlat: o,
1336
- feature: n
1337
- }), selectShipsVectorSource == null || selectShipsVectorSource.clear(), selectShipsVectorSource = new VectorSource({
1338
- features: [n]
1339
- }), selectShipsLayer.value = new VectorLayer({
1340
- source: selectShipsVectorSource
1341
- }), setVisibleFeatureById(shipsVectorSource, selectSingleShipData.value.id, !0);
1342
- const l = (r = shipsLayer.value) == null ? void 0 : r.getSource();
1343
- return l && (t && setVisibleFeatureById(l, t.id, !0), setVisibleFeatureById(l, selectSingleShipData.value.id, !1)), mapInstance$5.value.addLayer(selectShipsLayer.value), selectShipsLayer.value.setVisible(!0), selectShipsLayer.value;
1344
- }, setVisibleFeatureById = (e, t, o) => {
1345
- e && e.forEachFeature((n) => {
1346
- const l = n.get("data");
1347
- l && l.id === t && n.setStyle(o ? setShipStyle(!1, l.id) : setBlankStyle());
1348
- });
1349
- }, findShip = (e, t, o = !0) => {
1350
- var l, r, i, c, s;
1351
- if (!e || !mapInstance$5.value) return;
1352
- const n = (i = (r = (l = shipsLayer.value) == null ? void 0 : l.getSource()) == null ? void 0 : r.getFeatures()) == null ? void 0 : i.find((d) => {
1353
- var m;
1354
- return ((m = d.get("data")) == null ? void 0 : m.id) === e;
1355
- });
1356
- if (n ? selectedShipData.value = n.get("data") : t && (selectedShipData.value = t), !t) {
1357
- console.error("找不到船舶");
1358
- return;
1359
- }
1360
- if (o && ((c = selectedShipData.value) != null && c.lon) && ((s = selectedShipData.value) != null && s.lat)) {
1361
- const d = mapInstance$5.value.getView(), m = new Point([selectedShipData.value.lon, selectedShipData.value.lat]);
1362
- d.setCenter(transform(m.getCoordinates(), projection.data, projection.mercator));
1363
- const u = d.getZoom(), f = u < mapZoom.findShipMin ? mapZoom.findShip : u;
1364
- d.setZoom(f);
1365
1392
  }
1366
- return setTimeout(() => {
1367
- selectSingleShipMarker(t);
1368
- }, 50), n;
1369
- }, clearSelectFeature = () => {
1370
- var e;
1371
- if (selectedShipData.value) {
1372
- setVisibleFeatureById(shipsVectorSource, selectSingleShipData.value.id, !1);
1373
- const t = (e = shipsLayer.value) == null ? void 0 : e.getSource();
1374
- t && setVisibleFeatureById(t, selectSingleShipData.value.id, !0);
1393
+ }, renderIconPoint = () => {
1394
+ const e = "&#xe69b;", t = "#fcdc3f", o = "#ff0000";
1395
+ (trackList$1.value.length < 2 ? [trackList$1.value[0]] : [trackList$1.value[0], trackList$1.value[trackList$1.value.length - 1]]).forEach((l) => {
1396
+ const r = new Feature({
1397
+ geometry: new Point(l.centerPoint)
1398
+ });
1399
+ r.set("type", "track_begin"), r.set("data", l);
1400
+ const i = l.index === 0 && trackList$1.value.length >= 2 ? t : o;
1401
+ r.setStyle(
1402
+ new Style({
1403
+ text: new Text({
1404
+ font: "Normal 14px map-iconfont",
1405
+ text: getIconFont(e),
1406
+ fill: new Fill({ color: i })
1407
+ }),
1408
+ zIndex: 101
1409
+ })
1410
+ ), trackLineVectorSource.value.addFeature(r);
1411
+ });
1412
+ }, setTrackLabelStyle = (e, t) => new Style({
1413
+ renderer: (o, n) => {
1414
+ const l = n.context, c = {
1415
+ id: e.id || "",
1416
+ center: o,
1417
+ text: e.time,
1418
+ color: t,
1419
+ textColor: "#000",
1420
+ bgColor: "rgba(255,255,255,.8)",
1421
+ selected: !0,
1422
+ type: "TrackTime"
1423
+ };
1424
+ drawLabel(l, c, trackLabels.value);
1375
1425
  }
1376
- selectedShipData.value = null, mapInstance$5.value && (selectShipsVectorSource == null || selectShipsVectorSource.clear(), selectShipsLayer.value = new VectorLayer({
1377
- source: selectShipsVectorSource
1378
- }), mapInstance$5.value.addLayer(selectShipsLayer.value), selectShipsLayer.value.setVisible(!1));
1379
- }, hiddenAllShips = () => {
1380
- var e, t;
1381
- (e = shipsLayer.value) == null || e.setVisible(!1), (t = largeAmountShipsLayer.value) == null || t.setVisible(!1);
1382
- }, switchBtnShow = ref({
1383
- // 船舶摄像头过滤开关
1384
- [SWITCH_BTN.Camera]: !1,
1385
- // 船舶联系方式过滤开关
1386
- [SWITCH_BTN.Mobile]: !1,
1387
- // 船舶水尺过滤开关
1388
- [SWITCH_BTN.WaterGauge]: !1
1389
- }), switchFilterItem = (e, t) => {
1390
- switchBtnShow.value[e] = t, renderShips(allShips.value);
1391
- }, rerenderShip = () => {
1392
- renderShips(allShips.value);
1393
- }, mapInstance$4 = ref(), renderCustomOverlaySetInstance = (e) => mapInstance$4.value = e, drawCustomContent = (e, t, o, n = "top-left", l = !1) => {
1394
- var m, u;
1426
+ }), mapInstance$4 = ref(), renderCustomOverlaySetInstance = (e) => mapInstance$4.value = e, drawCustomContent = (e, t, o, n = "top-left", l = !1) => {
1427
+ var u, d;
1395
1428
  if (!t || !mapInstance$4.value) return;
1396
- document.querySelectorAll(".truck-custom-content").forEach((f) => f.parentNode.removeChild(f));
1429
+ document.querySelectorAll(".truck-custom-content").forEach((f) => {
1430
+ var p;
1431
+ return (p = f.parentNode) == null ? void 0 : p.removeChild(f);
1432
+ });
1397
1433
  const r = document.createElement("div");
1398
1434
  r.innerHTML = o;
1399
1435
  const i = new Overlay({
@@ -1405,53 +1441,55 @@ const renderShips = (e) => {
1405
1441
  // 设置不阻拦事件
1406
1442
  });
1407
1443
  if (l) {
1408
- let f = !1, p = [0, 0], w = [0, 0];
1409
- r.addEventListener("mousedown", function(h) {
1410
- var g;
1411
- f = !0, h.clientX, h.clientY, p = (g = mapInstance$4.value) == null ? void 0 : g.getCoordinateFromPixel([h.clientX - 200, h.clientY - 200]), w = [
1412
- h.clientX - r.getBoundingClientRect().left + 160,
1413
- h.clientY - r.getBoundingClientRect().top + 84
1414
- ], h.preventDefault();
1415
- }), document.addEventListener("mousemove", function(h) {
1416
- var g;
1444
+ let f = !1, p = [0, 0], y = [0, 0], h = 0, g = 0;
1445
+ r.addEventListener("mousedown", function(k) {
1446
+ var b;
1447
+ f = !0, h = k.clientX, g = k.clientY;
1448
+ const M = (b = mapInstance$4.value) == null ? void 0 : b.getCoordinateFromPixel([k.clientX - 200, k.clientY - 200]);
1449
+ M && (p = M), y = [
1450
+ k.clientX - r.getBoundingClientRect().left + 160,
1451
+ k.clientY - r.getBoundingClientRect().top + 84
1452
+ ], k.preventDefault(), console.log(e, h, g);
1453
+ }), document.addEventListener("mousemove", function(k) {
1454
+ var M;
1417
1455
  if (f) {
1418
- const T = (g = mapInstance$4.value) == null ? void 0 : g.getCoordinateFromPixel([h.clientX - w[0], h.clientY - w[1]]), M = T[0] - p[0], b = T[1] - p[1];
1419
- i.setPosition([p[0] + M, p[1] + b]);
1456
+ const b = (M = mapInstance$4.value) == null ? void 0 : M.getCoordinateFromPixel([k.clientX - y[0], k.clientY - y[1]]), x = b[0] - p[0], F = b[1] - p[1];
1457
+ i.setPosition([p[0] + x, p[1] + F]);
1420
1458
  }
1421
1459
  }), document.addEventListener("mouseup", function() {
1422
1460
  f = !1;
1423
1461
  });
1424
1462
  }
1425
- (m = mapInstance$4.value) == null || m.addOverlay(i);
1463
+ (u = mapInstance$4.value) == null || u.addOverlay(i);
1426
1464
  const c = r.querySelector(".close-button");
1427
1465
  c && c.addEventListener("click", () => {
1428
1466
  var f, p;
1429
1467
  (f = mapInstance$4.value) == null || f.removeOverlay(i), (p = r.parentNode) == null || p.removeChild(r);
1430
1468
  });
1431
- const s = JSON.parse(JSON.stringify(t)), d = (u = mapInstance$4.value) == null ? void 0 : u.getCoordinateFromPixel(s);
1432
- return i.setPosition(d), i;
1469
+ const s = JSON.parse(JSON.stringify(t)), m = (d = mapInstance$4.value) == null ? void 0 : d.getCoordinateFromPixel(s);
1470
+ return i.setPosition(m), i;
1433
1471
  }, mapInstance$3 = ref(), renderTrackSetInstance = (e) => mapInstance$3.value = e, showTracks = ref([]), trackList = ref([]);
1434
1472
  ref(null);
1435
1473
  const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, l = "ship") => {
1436
- var m;
1437
- if (nextTick(() => {
1474
+ var u;
1475
+ if (console.log(l), nextTick(() => {
1438
1476
  hiddenAllShips();
1439
- }).then((u) => {
1477
+ }).then((d) => {
1440
1478
  }), (t == null ? void 0 : t.length) < 2) {
1441
- ((m = showTracks.value) == null ? void 0 : m.findIndex((u) => u.id === e)) < 0 && showTracks.value.push({ id: e, length: "" });
1479
+ ((u = showTracks.value) == null ? void 0 : u.findIndex((d) => d.id === e)) < 0 && showTracks.value.push({ id: e, length: "" });
1442
1480
  return;
1443
1481
  }
1444
1482
  const r = {};
1445
- t.forEach((u) => {
1446
- u.state ? u.state = Number(u.state) : delete u.state;
1483
+ t.forEach((d) => {
1484
+ d.state ? d.state = Number(d.state) : delete d.state;
1447
1485
  }), trackId.value = e, r[e] = t, trackList.value = t;
1448
1486
  const i = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080", "#ffc0cb", "#800000", "#000080", "#808000"], c = r[e].map(
1449
- (u) => transform([u.lon, u.lat], projection.data, projection.mercator)
1450
- ), s = new LineString(c), d = formatUtils.formatLength(s, n) || "--";
1487
+ (d) => transform([d.lon, d.lat], projection.data, projection.mercator)
1488
+ ), s = new LineString(c), m = formatUtils.formatLength(s, n) || "--";
1451
1489
  nextTick(() => {
1452
1490
  var f, p;
1453
- const u = (f = showTracks.value) == null ? void 0 : f.findIndex((w) => w.id === e);
1454
- u < 0 ? showTracks.value.push({ id: e, length: d }) : showTracks.value[u].length = d, ++cursor.value, cursor.value > i.length && (cursor.value = 0), renderTrackLine(r, e, o), nextTick(() => {
1491
+ const d = (f = showTracks.value) == null ? void 0 : f.findIndex((y) => y.id === e);
1492
+ d < 0 ? showTracks.value.push({ id: e, length: m }) : showTracks.value[d].length = m, ++cursor.value, cursor.value > i.length && (cursor.value = 0), renderTrackLine(r, e, o), nextTick(() => {
1455
1493
  resetTrackView(e);
1456
1494
  }).then(() => {
1457
1495
  }), (p = mapInstance$3.value) == null || p.on("moveend", () => {
@@ -1469,18 +1507,18 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, l = "ship")
1469
1507
  if (n) {
1470
1508
  const s = n.get("data");
1471
1509
  if (!(s != null && s.time)) return;
1472
- let d = "";
1473
- s != null && s.stayTime && (d = `
1510
+ let m = "";
1511
+ s != null && s.stayTime && (m = `
1474
1512
  <div class="item w-100">
1475
1513
  <div class="item-label">停泊时间约</div>
1476
1514
  <div class="item-item">${formatMinutesToDDHHMM(Number(s.stayTime))}</div>
1477
1515
  </div>
1478
1516
  `);
1479
- const m = `
1517
+ const u = `
1480
1518
  <div class="track-point-popup">
1481
1519
  <div class="item">
1482
1520
  <div class="item-label">状态</div>
1483
- <div class="item-item">${s != null && s.sailStatus ? SHIP_SAIL_STATUS[String(s.sailStatus)] : DEFAULT_VALUE}</div>
1521
+ <div class="item-item">${s != null && s.sailStatus ? SHIP_SAIL_STATUS[s.sailStatus] : DEFAULT_VALUE}</div>
1484
1522
  </div>
1485
1523
  <div class="item">
1486
1524
  <div class="item-label">航速</div>
@@ -1506,11 +1544,14 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, l = "ship")
1506
1544
  <div class="item-label">时间</div>
1507
1545
  <div class="item-item">${s.time}</div>
1508
1546
  </div>
1509
- ${d ?? d}
1510
- </div>`, u = (i = mapInstance$3.value) == null ? void 0 : i.getPixelFromCoordinate(o.coordinate);
1511
- e.value = drawCustomContent(s.time, u, m, "left-top");
1547
+ ${m ?? m}
1548
+ </div>`, d = (i = mapInstance$3.value) == null ? void 0 : i.getPixelFromCoordinate(o.coordinate);
1549
+ if (d) {
1550
+ const f = drawCustomContent(s.time, d, u, "top-left");
1551
+ f && (e.value = f);
1552
+ }
1512
1553
  } else
1513
- (c = mapInstance$3.value) == null || c.removeOverlay(e.value);
1554
+ e.value && ((c = mapInstance$3.value) == null || c.removeOverlay(e.value));
1514
1555
  });
1515
1556
  }, removeAllTrackLayer = () => {
1516
1557
  var e;
@@ -1531,8 +1572,8 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, l = "ship")
1531
1572
  }
1532
1573
  }, formatMinutesToDDHHMM = (e) => {
1533
1574
  const t = hooks.duration(e, "minutes"), o = Math.floor(t.asDays()), n = t.hours(), l = t.minutes();
1534
- let r = `${String(n).padStart(2, "0")}时${String(l).padStart(2, "0")}分`;
1535
- return o !== 0 && (r = `${String(o).padStart(2, "0")}天${r}`), r;
1575
+ let r = `${String(l).padStart(2, "0")}分`;
1576
+ return n !== 0 && (r = `${String(n).padStart(2, "0")}时${r}`), o !== 0 && (r = `${String(o).padStart(2, "0")}天${r}`), r;
1536
1577
  }, _hoisted_1$3 = {
1537
1578
  key: 0,
1538
1579
  class: "more-tool-panel"
@@ -1547,12 +1588,12 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, l = "ship")
1547
1588
  },
1548
1589
  emits: ["switchGreenDot", "switchMapTile"],
1549
1590
  setup(e, { emit: t }) {
1550
- var p, w;
1551
- const o = inject("mapInstance"), n = e, l = t, r = ref(((w = (p = o.value) == null ? void 0 : p.getView()) == null ? void 0 : w.getZoom()) || mapZoom.default), i = ref(!1), c = ref(null), s = ref(!0), d = () => {
1591
+ var p, y;
1592
+ const o = inject("mapInstance"), n = e, l = t, r = ref(((y = (p = o.value) == null ? void 0 : p.getView()) == null ? void 0 : y.getZoom()) || mapZoom.default), i = ref(!1), c = ref(null), s = ref(!0), m = () => {
1552
1593
  n.disableGreenDot || r.value >= mapZoom.shipGreenDotMax || (s.value = !s.value, l("switchGreenDot", s.value));
1553
- }, m = () => {
1554
- l("switchMapTile", n.mapTileMode === BaseMapType.vector ? BaseMapType.satellite : BaseMapType.vector);
1555
1594
  }, u = () => {
1595
+ l("switchMapTile", n.mapTileMode === BaseMapType.vector ? BaseMapType.satellite : BaseMapType.vector);
1596
+ }, d = () => {
1556
1597
  var h, g;
1557
1598
  i.value ? (h = c.value) == null || h.removeInteraction() : (g = c.value) == null || g.addInteraction(), i.value = !i.value;
1558
1599
  }, f = () => {
@@ -1563,8 +1604,8 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, l = "ship")
1563
1604
  nextTick(() => {
1564
1605
  var h;
1565
1606
  (h = o.value) == null || h.on("moveend", () => {
1566
- var T, M;
1567
- const g = (M = (T = o.value) == null ? void 0 : T.getView()) == null ? void 0 : M.getZoom();
1607
+ var k, M;
1608
+ const g = (M = (k = o.value) == null ? void 0 : k.getView()) == null ? void 0 : M.getZoom();
1568
1609
  g && (r.value = g);
1569
1610
  });
1570
1611
  });
@@ -1577,7 +1618,7 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, l = "ship")
1577
1618
  h.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
1578
1619
  key: 0,
1579
1620
  class: normalizeClass(["switch-btn", `${i.value && "active"}`]),
1580
- onClick: u
1621
+ onClick: d
1581
1622
  }, g[5] || (g[5] = [
1582
1623
  createElementVNode("i", { class: "map-iconfont icon-measure" }, null, -1),
1583
1624
  createElementVNode("div", { class: "button-text" }, "测距", -1)
@@ -1585,7 +1626,7 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, l = "ship")
1585
1626
  h.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
1586
1627
  key: 1,
1587
1628
  class: normalizeClass(`switch-btn ${s.value && "active"} ${(h.disableGreenDot || r.value >= unref(mapZoom).shipGreenDotMax) && "disabled"}`),
1588
- onClick: d
1629
+ onClick: m
1589
1630
  }, g[6] || (g[6] = [
1590
1631
  createElementVNode("i", { class: "map-iconfont icon-ship" }, null, -1),
1591
1632
  createElementVNode("div", { class: "button-text" }, "绿点", -1)
@@ -1593,7 +1634,7 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, l = "ship")
1593
1634
  h.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
1594
1635
  key: 2,
1595
1636
  class: normalizeClass(`switch-btn ${h.mapTileMode === unref(BaseMapType).satellite && "active"}`),
1596
- onClick: g[0] || (g[0] = (T) => m())
1637
+ onClick: g[0] || (g[0] = (k) => u())
1597
1638
  }, g[7] || (g[7] = [
1598
1639
  createElementVNode("i", { class: "map-iconfont icon-space" }, null, -1),
1599
1640
  createElementVNode("div", { class: "button-text" }, "图层", -1)
@@ -1601,7 +1642,7 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, l = "ship")
1601
1642
  h.vehicleMode === "truck" ? (openBlock(), createElementBlock("div", {
1602
1643
  key: 3,
1603
1644
  class: normalizeClass(`switch-btn ${h.mapTileMode === unref(BaseMapType).satellite && "active"}`),
1604
- onClick: g[1] || (g[1] = (T) => m())
1645
+ onClick: g[1] || (g[1] = (k) => u())
1605
1646
  }, g[8] || (g[8] = [
1606
1647
  createElementVNode("i", { class: "map-iconfont icon-space" }, null, -1),
1607
1648
  createElementVNode("div", { class: "button-text" }, "卫星", -1)
@@ -1609,14 +1650,14 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, l = "ship")
1609
1650
  h.showTrackLayer ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
1610
1651
  createElementVNode("div", {
1611
1652
  class: "switch-btn multiple",
1612
- onClick: g[2] || (g[2] = (T) => unref(playTrack)(unref(currentTrackId), 1))
1653
+ onClick: g[2] || (g[2] = (k) => unref(playTrack)(unref(currentTrackId), 1))
1613
1654
  }, g[9] || (g[9] = [
1614
1655
  createElementVNode("i", { class: "map-iconfont icon-play" }, null, -1),
1615
1656
  createElementVNode("div", { class: "button-text" }, "播放轨迹", -1)
1616
1657
  ])),
1617
1658
  createElementVNode("div", {
1618
1659
  class: "switch-btn multiple",
1619
- onClick: g[3] || (g[3] = (T) => unref(resetTrackView)())
1660
+ onClick: g[3] || (g[3] = (k) => unref(resetTrackView)())
1620
1661
  }, g[10] || (g[10] = [
1621
1662
  createElementVNode("i", { class: "map-iconfont icon-center" }, null, -1),
1622
1663
  createElementVNode("div", { class: "button-text" }, "轨迹居中", -1)
@@ -1628,7 +1669,7 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, l = "ship")
1628
1669
  h.vehicleMode === "ship" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
1629
1670
  createElementVNode("div", {
1630
1671
  class: normalizeClass(["switch-btn", `${i.value && "active"}`]),
1631
- onClick: u
1672
+ onClick: d
1632
1673
  }, g[11] || (g[11] = [
1633
1674
  createElementVNode("i", { class: "map-iconfont icon-measure" }, null, -1),
1634
1675
  createElementVNode("div", { class: "button-text" }, "测距", -1)
@@ -1636,7 +1677,7 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, l = "ship")
1636
1677
  h.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
1637
1678
  key: 0,
1638
1679
  class: normalizeClass(`switch-btn ${s.value && "active"} ${(h.disableGreenDot || r.value >= unref(mapZoom).shipGreenDotMax) && "disabled"}`),
1639
- onClick: d
1680
+ onClick: m
1640
1681
  }, g[12] || (g[12] = [
1641
1682
  createElementVNode("i", { class: "map-iconfont icon-ship" }, null, -1),
1642
1683
  createElementVNode("div", { class: "button-text" }, "绿点", -1)
@@ -1644,7 +1685,7 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, l = "ship")
1644
1685
  ], 64)) : createCommentVNode("", !0),
1645
1686
  createElementVNode("div", {
1646
1687
  class: normalizeClass(["switch-btn", { active: h.mapTileMode === unref(BaseMapType).satellite }]),
1647
- onClick: m
1688
+ onClick: u
1648
1689
  }, g[13] || (g[13] = [
1649
1690
  createElementVNode("i", { class: "map-iconfont icon-space" }, null, -1),
1650
1691
  createElementVNode("div", { class: "button-text" }, "卫星", -1)
@@ -1657,28 +1698,29 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, l = "ship")
1657
1698
  ref_key: "measureRef",
1658
1699
  ref: c,
1659
1700
  visible: i.value,
1660
- "onUpdate:visible": g[4] || (g[4] = (T) => i.value = T),
1701
+ "onUpdate:visible": g[4] || (g[4] = (k) => i.value = k),
1661
1702
  onClose: f,
1662
1703
  "view-mode": h.viewMode
1663
1704
  }, null, 8, ["visible", "view-mode"])) : createCommentVNode("", !0)
1664
1705
  ])
1665
1706
  ], 64));
1666
1707
  }
1667
- }), ToolPanel = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-ef931f65"]]), _hoisted_1$2 = { id: "scale-line-container" }, _sfc_main$3 = /* @__PURE__ */ defineComponent({
1708
+ }), ToolPanel = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-458187f4"]]), _hoisted_1$2 = { id: "scale-line-container" }, _sfc_main$3 = /* @__PURE__ */ defineComponent({
1668
1709
  __name: "scaleLine",
1669
1710
  setup(e, { expose: t }) {
1670
1711
  const o = inject("mapInstance");
1671
1712
  return t({
1672
1713
  setScaleLine: (l) => {
1673
1714
  var c;
1715
+ l || (l = "metric");
1674
1716
  const r = new ScaleLine$1({
1675
- units: l || "metric"
1717
+ units: l
1676
1718
  }), i = document.getElementById("scale-line-container");
1677
- i && (r.setTarget(i), (c = o.value) == null || c.addControl(r));
1719
+ i && (r.setTarget(i), (c = o == null ? void 0 : o.value) == null || c.addControl(r));
1678
1720
  }
1679
1721
  }), (l, r) => (openBlock(), createElementBlock("div", _hoisted_1$2));
1680
1722
  }
1681
- }), ScaleLine = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-8c27b246"]]), _hoisted_1$1 = { class: "zoom" }, _sfc_main$2 = /* @__PURE__ */ defineComponent({
1723
+ }), ScaleLine = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-d666f80d"]]), _hoisted_1$1 = { class: "zoom" }, _sfc_main$2 = /* @__PURE__ */ defineComponent({
1682
1724
  __name: "zoomControl",
1683
1725
  props: {
1684
1726
  map: {
@@ -1743,25 +1785,25 @@ const setTruckStyle = (e, t, o, n) => new Style({
1743
1785
  i.save();
1744
1786
  let c = 1;
1745
1787
  i.scale(c, c);
1746
- let [s, d] = l;
1747
- s = s / c - 20, d = d / c;
1748
- const m = s - 70, u = d - 68;
1788
+ let [s, m] = l;
1789
+ s = Number(s) / c - 20, m = Number(m) / c;
1790
+ const u = s - 70, d = m - 68;
1749
1791
  let f = 180;
1750
- const p = 56, w = "#FFFFFF";
1792
+ const p = 56, y = "#FFFFFF";
1751
1793
  let h = 176;
1752
1794
  const g = 52;
1753
- let T = "#164AFF", M = "#FFFFFF";
1754
- o === CAR_COLOR.YELLOW ? (h = 176, T = "#FFC81E", M = "rgba(0,0,0,0.88)") : o === CAR_COLOR.Y_GREEN && (f = 200, h = 196, T = "#8FED7C", M = "rgba(0,0,0,0.88)"), n != null && n.length && (f += n.length * 56), fillRectRadius(i, m, u, f, p, w), fillRectRadius(i, m + 2, u + 2, h, g, T), o === CAR_COLOR.Y_GREEN && fillRectRadius(i, m + 2, u + 2, 68, g, "#FFC81E"), i.save(), i.restore(), i.fillStyle = M, i.font = "bold 28px Arial", i.textAlign = "left", i.textBaseline = "middle";
1795
+ let k = "#164AFF", M = "#FFFFFF";
1796
+ o === CAR_COLOR.YELLOW ? (h = 176, k = "#FFC81E", M = "rgba(0,0,0,0.88)") : o === CAR_COLOR.Y_GREEN && (f = 200, h = 196, k = "#8FED7C", M = "rgba(0,0,0,0.88)"), n != null && n.length && (f += n.length * 56), fillRectRadius(i, u, d, f, p, y), fillRectRadius(i, u + 2, d + 2, h, g, k), o === CAR_COLOR.Y_GREEN && fillRectRadius(i, u + 2, d + 2, 68, g, "#FFC81E"), i.save(), i.restore(), i.fillStyle = M, i.font = "bold 28px Arial", i.textAlign = "left", i.textBaseline = "middle";
1755
1797
  const b = `${t.slice(0, 2) + " · " + t.slice(2)}`;
1756
- if (i.fillText(b, m + 12, u + 32), i.save(), i.restore(), n != null && n.length) {
1757
- const P = i.measureText(b).width + 12;
1758
- let x = 0;
1798
+ if (i.fillText(b, u + 12, d + 32), i.save(), i.restore(), n != null && n.length) {
1799
+ const F = i.measureText(b).width + 12;
1800
+ let P = 0;
1759
1801
  n.forEach((v) => {
1760
- v === DEVICE_TYPE.CAMERA && (i.drawImage(cameraImage, s - 54 + P + x * 56, d - 64, 50, 50), ++x), v === DEVICE_TYPE.LOAD && (i.drawImage(loadImage, s - 54 + P + x * 56, d - 64, 50, 50), ++x);
1802
+ v === DEVICE_TYPE.CAMERA && (i.drawImage(cameraImage, s - 54 + F + P * 56, m - 64, 50, 50), ++P), v === DEVICE_TYPE.LOAD && (i.drawImage(loadImage, s - 54 + F + P * 56, m - 64, 50, 50), ++P);
1761
1803
  });
1762
1804
  }
1763
- const V = dotImage$1;
1764
- i.drawImage(V, s + f / 2 - 90, d, 50 / c, 50 / c), i.restore();
1805
+ const x = dotImage$1;
1806
+ i.drawImage(x, s + f / 2 - 90, m, 50 / c, 50 / c), i.restore();
1765
1807
  }
1766
1808
  }), mapInstance$2 = ref(), renderDashboardSetInstance = (e) => mapInstance$2.value = e;
1767
1809
  ref([]);
@@ -1773,7 +1815,7 @@ const renderTrucksMarker = (e) => {
1773
1815
  geometry: new Point(fromLonLat(o))
1774
1816
  });
1775
1817
  n.set("data", t), n.setStyle(
1776
- setTruckStyle(!1, t.vno, t == null ? void 0 : t.vclColor, t == null ? void 0 : t.icons)
1818
+ setTruckStyle(!1, t.vno, t.vclColor ?? 0, t.icons ?? [])
1777
1819
  ), truckMarkerList.push({
1778
1820
  name: t.vno,
1779
1821
  lonlat: o,
@@ -1789,10 +1831,9 @@ const renderTrucksMarker = (e) => {
1789
1831
  e.feature && (trucksVectorSource == null || trucksVectorSource.removeFeature(e.feature));
1790
1832
  }), truckMarkerList = [];
1791
1833
  }, mapInstance$1 = ref(), renderTruckSetInstance = (e) => mapInstance$1.value = e, vehicle = ref(null), focusShipData = ref(), currentTruckOverlay = ref(null), findTruck = async (e) => {
1792
- if (!mapInstance$1.value) return;
1793
- focusShipData.value = e;
1834
+ if (!mapInstance$1.value || (focusShipData.value = e, !(e != null && e.lon && (e != null && e.lat)))) return;
1794
1835
  const t = formatUtils.convertSixHundredThousandToLatLng(e.lon, e.lat), o = mapInstance$1.value.getPixelFromCoordinate(transform(t, projection.data, projection.mercator));
1795
- currentTruckOverlay.value = drawTruckIcon(e.vno, o, e == null ? void 0 : e.drc);
1836
+ currentTruckOverlay.value = e ? drawTruckIcon(e.vno, o, (e == null ? void 0 : e.drc) ?? "") ?? null : null;
1796
1837
  const n = mapInstance$1.value.getView(), l = new Point(t);
1797
1838
  n.setCenter(transform(l.getCoordinates(), projection.data, projection.mercator));
1798
1839
  }, clearAllTruck = () => {
@@ -1863,8 +1904,8 @@ let squareLimitError = !1, lineLimitError = !1;
1863
1904
  const validateSquareLimit = (e) => {
1864
1905
  let o = 1 / 0, n = -1 / 0, l = 1 / 0, r = -1 / 0;
1865
1906
  e == null || e.forEach((s) => {
1866
- const d = transform(s, projection.mercator, projection.data), m = d[0], u = d[1];
1867
- o = Math.min(o, u), n = Math.max(n, u), l = Math.min(l, m), r = Math.max(r, m);
1907
+ const m = transform(s, projection.mercator, projection.data), u = m[0], d = m[1];
1908
+ o = Math.min(o, d), n = Math.max(n, d), l = Math.min(l, u), r = Math.max(r, u);
1868
1909
  });
1869
1910
  const i = (n - o) * 111, c = (r - l) * 111;
1870
1911
  squareLimitError = i > 150 || c > 150;
@@ -1882,28 +1923,27 @@ const addInteraction = (e) => {
1882
1923
  draw.on("drawstart", function(l) {
1883
1924
  var r;
1884
1925
  layerState = "drawn", sketch = l.feature, t = (r = sketch.getGeometry()) == null ? void 0 : r.on("change", function(i) {
1885
- const c = i.target, s = formatUtils.formatArea(c, LENGTH_UNIT.NM), m = c.getCoordinates()[0], u = new LineString([m[m.length - 2], m[m.length - 1]]), f = formatUtils.formatLength(u, LENGTH_UNIT.NM);
1886
- if (lineLimitError = Number(getLength(u) / 1e3) > 150, validateSquareLimit(m), measureTooltipElement && s && (measureTooltipElement.innerHTML = `
1926
+ const c = i.target, s = formatUtils.formatArea(c, LENGTH_UNIT.NM), u = c.getCoordinates()[0], d = new LineString([u[u.length - 2], u[u.length - 1]]), f = formatUtils.formatLength(d, LENGTH_UNIT.NM);
1927
+ if (lineLimitError = Number(getLength(d) / 1e3) > 150, validateSquareLimit(u), measureTooltipElement && s && (measureTooltipElement.innerHTML = `
1887
1928
  <span class="text">面积:${s}${lineLimitError || squareLimitError ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
1888
1929
  `), helpTooltipElement && s) {
1889
1930
  let p = "";
1890
1931
  parseFloat(s) > 0 && (p = `
1891
1932
  <div class="text ${squareLimitError ? "error" : ""}">面积:${s}${squareLimitError ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</div>`), helpTooltipElement.innerHTML = `${p}
1892
- <span class="text ${lineLimitError ? "error" : ""}">线段${m.length - 2}:${f}${lineLimitError ? '<span class="error pl-4">超出可以绘画的距离</span>' : ""}</span>
1933
+ <span class="text ${lineLimitError ? "error" : ""}">线段${u.length - 2}:${f}${lineLimitError ? '<span class="error pl-4">超出可以绘画的距离</span>' : ""}</span>
1893
1934
  <div><span class="text">单击继续,双击结束</span></div>
1894
1935
  `;
1895
1936
  }
1896
1937
  }), drawnState = "drawing";
1897
1938
  }), draw.on("drawend", function(l) {
1898
- var r;
1899
1939
  if (l.feature.getGeometry()) {
1900
1940
  storeFeature = l.feature;
1901
- const i = endFn(l.feature);
1902
- i != null && i.length && callbackFunction && callbackFunction(i);
1941
+ const r = endFn(l.feature);
1942
+ r != null && r.length && callbackFunction && callbackFunction(r);
1903
1943
  }
1904
- if (sketch = null, measureTooltipElement = null, createMeasureTooltip(), t && unByKey(t), drawnState = "drawend", draw) {
1905
- const i = mapInstance.value.getInteractions().getArray().find((c) => c.ol_uid === draw.ol_uid);
1906
- i && ((r = mapInstance.value) == null || r.removeInteraction(i)), helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement);
1944
+ if (sketch = null, measureTooltipElement = null, createMeasureTooltip(), t && unByKey(t), drawnState = "drawend", draw && mapInstance.value) {
1945
+ const r = mapInstance.value.getInteractions().getArray().find((i) => getUid(i) === getUid(draw));
1946
+ r && mapInstance.value.removeInteraction(r), helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement);
1907
1947
  }
1908
1948
  });
1909
1949
  }, removeInteraction = () => {
@@ -1913,7 +1953,7 @@ const addInteraction = (e) => {
1913
1953
  var l;
1914
1954
  (l = n == null ? void 0 : n.parentNode) == null || l.removeChild(n);
1915
1955
  }), source.clear(), (e = mapInstance.value) == null || e.removeLayer(drawVector), helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement), ((t = mapInstance.value) == null ? void 0 : t.getTargetElement()).style.cursor = "", document.querySelector("#map").style.cursor = "", draw) {
1916
- const n = mapInstance.value.getInteractions().getArray().find((l) => l.ol_uid === draw.ol_uid);
1956
+ const n = mapInstance.value.getInteractions().getArray().find((l) => getUid(l) === getUid(draw));
1917
1957
  n && ((o = mapInstance.value) == null || o.removeInteraction(n));
1918
1958
  }
1919
1959
  drawnState = "undrawn", layerState = "destroyed";
@@ -1970,7 +2010,7 @@ const addInteraction = (e) => {
1970
2010
  }), mapInstance.value.on("pointermove", pointerMoveHandler), mapInstance.value.getViewport().addEventListener("mouseout", function() {
1971
2011
  var e;
1972
2012
  (e = helpTooltipElement == null ? void 0 : helpTooltipElement.classList) == null || e.add("hidden");
1973
- }), mapInstance.value.on("dblclick", function(e) {
2013
+ }), mapInstance.value.on(["dblclick"], function(e) {
1974
2014
  drawnState !== "undrawn" && (e.stopPropagation(), e.preventDefault());
1975
2015
  }));
1976
2016
  }, reset = () => {
@@ -1988,18 +2028,17 @@ const setPointStyle = (e, t, o) => {
1988
2028
  const { color: n, url: l, activeUrl: r, activeColor: i } = o;
1989
2029
  return (r || l) && (e ? dotActiveImage.src = CDN_URL + (r || l) : dotImage.src = CDN_URL + (l || r)), new Style({
1990
2030
  renderer: (c, s) => {
1991
- const d = s.context;
1992
- d.save();
1993
- const m = 1;
1994
- d.scale(m, m);
1995
- let [u, f] = c;
1996
- u = u / m, f = f / m, d.font = "12px Arial";
1997
- const p = d.measureText(t).width, w = u - p / 2, h = f - 10, g = p + 4, T = 20, M = e && i || n;
1998
- if (fillRectRadius(d, w, h + 30, g, T, M), d.save(), d.restore(), d.fillStyle = e ? "#FFFFFF" : "#000000", d.textAlign = "center", d.textBaseline = "middle", d.fillText(t, w + (p + 4) / 2, h + 41), d.save(), d.restore(), l || r) {
2031
+ const m = s.context;
2032
+ m.save();
2033
+ const u = window.devicePixelRatio || 1;
2034
+ let [d, f] = c;
2035
+ d = Number(d), f = Number(f), m.font = `${12 * u}px Arial`;
2036
+ const p = m.measureText(t).width, y = d - p / 2 + 6, h = f + 6 * u, g = p + 4, k = 16 * u, M = e && i || n;
2037
+ if (fillRectRadius(m, y, h + 30, g, k, M), m.save(), m.restore(), m.fillStyle = e ? "#FFFFFF" : "#000000", m.textAlign = "center", m.textBaseline = "middle", m.fillText(t, y + (p + 4) / 2, h + 24 * u), m.save(), m.restore(), l || r) {
1999
2038
  const b = e ? dotActiveImage : dotImage;
2000
- d.drawImage(b, u - b.width / 2, f - b.height / 2, 40 / m, 40 / m);
2039
+ m.drawImage(b, d - b.width / 2, f - b.height / 2, 30 * u, 30 * u);
2001
2040
  }
2002
- d.restore();
2041
+ m.restore();
2003
2042
  }
2004
2043
  });
2005
2044
  };
@@ -2153,13 +2192,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2153
2192
  setup(e, { expose: t, emit: o }) {
2154
2193
  const n = ref();
2155
2194
  provide("mapInstance", n);
2156
- const l = ref(null), r = ref(null), i = ref(null), c = o, s = e, d = ref(s.zoom || mapZoom.default), m = ref(!1), u = ref(!0), f = ref(!0);
2157
- let p;
2158
- ((v) => {
2159
- v[v.tiandituTile = new TileLayer({ source: new XYZ({ url: baseMap.tiandituTile }) })] = "tiandituTile", v[v.tiandituTileMark = new TileLayer({ source: new XYZ({ url: baseMap.tiandituTileMark }) })] = "tiandituTileMark", v[v.tiandituImgTile = new TileLayer({ source: new XYZ({ url: baseMap.tiandituImgTile }), visible: !1 })] = "tiandituImgTile", v[v.tiandituImgTileMark = new TileLayer({ source: new XYZ({ url: baseMap.tiandituImgTileMark }), visible: !1 })] = "tiandituImgTileMark", v[v.greenMark = new TileLayer({ source: new XYZ({ url: baseMap.greenTile }) })] = "greenMark";
2160
- })(p || (p = {}));
2161
- const w = () => {
2162
- var y, L;
2195
+ const l = ref(null), r = ref(null), i = ref(null), c = o, s = e, m = ref(s.zoom || mapZoom.default), u = ref(!1), d = ref(!0), f = ref(!0), p = {
2196
+ tiandituTile: new TileLayer({ source: new XYZ({ url: baseMap.tiandituTile }) }),
2197
+ tiandituTileMark: new TileLayer({ source: new XYZ({ url: baseMap.tiandituTileMark }) }),
2198
+ tiandituImgTile: new TileLayer({ source: new XYZ({ url: baseMap.tiandituImgTile }), visible: !1 }),
2199
+ tiandituImgTileMark: new TileLayer({ source: new XYZ({ url: baseMap.tiandituImgTileMark }), visible: !1 }),
2200
+ greenMark: new TileLayer({ source: new XYZ({ url: baseMap.greenTile }) })
2201
+ }, y = () => {
2202
+ var L, w;
2163
2203
  const v = {
2164
2204
  projection: projection.mercator,
2165
2205
  // 地图投影坐标系
@@ -2189,67 +2229,67 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2189
2229
  p.greenMark
2190
2230
  ],
2191
2231
  view: new View(v)
2192
- }), h(), (y = r.value) == null || y.setScaleLine(s.vehicleMode === "ship" && "nautical"), (L = n.value) == null || L.on("moveend", b), g(v.zoom < mapZoom.shipGreenDotMax), M(s.vehicleMode === "ship" || s.viewMode === "findShip" ? BaseMapType.satellite : BaseMapType.vector), s.viewMode === "findShip" && s.mmsi && s.shipData && nextTick(() => {
2232
+ }), h(), (L = r.value) == null || L.setScaleLine(s.vehicleMode === "ship" ? "nautical" : "metric"), (w = n.value) == null || w.on("moveend", b), g(v.zoom < mapZoom.shipGreenDotMax), M(s.vehicleMode === "ship" || s.viewMode === "findShip" ? BaseMapType.satellite : BaseMapType.vector), s.viewMode === "findShip" && s.mmsi && s.shipData && nextTick(() => {
2193
2233
  findShip(String(s.mmsi), s.shipData);
2194
2234
  }), onShipsMarkerHover();
2195
2235
  };
2196
2236
  onMounted(() => {
2197
- w();
2237
+ y();
2198
2238
  });
2199
2239
  const h = () => {
2200
2240
  n.value && (renderCustomOverlaySetInstance(n.value), renderTruckSetInstance(n.value), drawPolygonSetInstance(n.value), renderShipStyleSetInstance(n.value), renderTrackStyleSetInstance(n.value), renderDashboardSetInstance(n.value), renderMarkerSetInstance(n.value), renderShipSetInstance(n.value), renderTrackSetInstance(n.value));
2201
2241
  }, g = (v) => {
2202
- var y;
2203
- s.vehicleMode !== "ship" && (v = !1), (y = n.value) == null || y.getLayers().forEach((L) => {
2204
- L.ol_uid === p.greenMark.ol_uid && (L.setVisible(v), u.value = v);
2242
+ var L;
2243
+ s.vehicleMode !== "ship" && (v = !1), (L = n.value) == null || L.getLayers().forEach((w) => {
2244
+ getUid(w) === getUid(p.greenMark) && (w.setVisible(v), d.value = v);
2205
2245
  });
2206
- }, T = ref(BaseMapType.satellite), M = (v) => {
2207
- var y;
2208
- T.value = v, (y = n.value) == null || y.getLayers().forEach((L) => {
2209
- (L.ol_uid === p.tiandituTile.ol_uid || L.ol_uid === p.tiandituTileMark.ol_uid || L.ol_uid === p.tiandituImgTile.ol_uid || L.ol_uid === p.tiandituImgTileMark.ol_uid) && L.setVisible(!1), (v === BaseMapType.vector && (L.ol_uid === p.tiandituTile.ol_uid || L.ol_uid === p.tiandituTileMark.ol_uid) || v === BaseMapType.satellite && (L.ol_uid === p.tiandituImgTile.ol_uid || L.ol_uid === p.tiandituImgTileMark.ol_uid)) && L.setVisible(!0);
2246
+ }, k = ref(BaseMapType.satellite), M = (v) => {
2247
+ var L;
2248
+ k.value = v, (L = n.value) == null || L.getLayers().forEach((w) => {
2249
+ (getUid(w) === getUid(p.tiandituTile) || getUid(w) === getUid(p.tiandituTileMark) || getUid(w) === getUid(p.tiandituImgTile) || getUid(w) === getUid(p.tiandituImgTileMark)) && w.setVisible(!1), (v === BaseMapType.vector && (getUid(w) === getUid(p.tiandituTile) || getUid(w) === getUid(p.tiandituTileMark)) || v === BaseMapType.satellite && (getUid(w) === getUid(p.tiandituImgTile) || getUid(w) === getUid(p.tiandituImgTileMark))) && w.setVisible(!0);
2210
2250
  });
2211
2251
  }, b = () => {
2212
- const v = n.value.getView(), y = v.getZoom();
2213
- y && V(y);
2214
- const L = v.calculateExtent(n.value.getSize());
2215
- L && y && P(L, y);
2216
- }, V = (v) => {
2217
- var k, S, E, C, F;
2218
- d.value = v, g(v < mapZoom.shipGreenDotMax);
2219
- const y = (k = n.value) == null ? void 0 : k.getLayers(), L = s.vehicleMode === "ship" ? y == null ? void 0 : y.getArray().find(($) => $.ol_uid === p.greenMark.ol_uid) : void 0;
2220
- showTrackLayer.value ? (f.value = !1, L == null || L.setVisible(!1), (S = shipsLayer.value) == null || S.setVisible(!1), (E = largeAmountShipsLayer.value) == null || E.setVisible(!1)) : !m.value && u.value && v <= mapZoom.shipGreenDotMax ? (f.value = !0, L == null || L.setVisible(!0), (C = shipsLayer.value) == null || C.setVisible(!1), (F = largeAmountShipsLayer.value) == null || F.setVisible(!1)) : (f.value = !1, L == null || L.setVisible(!1)), c("zoomChanged", v);
2221
- }, P = (v, y) => {
2222
- const L = transform([v[0], v[1]], projection.mercator, projection.data), k = transform([v[2], v[3]], projection.mercator, projection.data);
2223
- c("extentChanged", { extent: [L, k], zoom: y });
2252
+ const v = n.value.getView(), L = v.getZoom();
2253
+ L && x(L);
2254
+ const w = v.calculateExtent(n.value.getSize());
2255
+ w && L && F(w, L);
2256
+ }, x = (v) => {
2257
+ var S, T, E, C, V;
2258
+ m.value = v, g(v < mapZoom.shipGreenDotMax);
2259
+ const L = (S = n.value) == null ? void 0 : S.getLayers(), w = s.vehicleMode === "ship" ? L == null ? void 0 : L.getArray().find((N) => getUid(N) === getUid(p.greenMark)) : void 0;
2260
+ showTrackLayer.value ? (f.value = !1, w == null || w.setVisible(!1), (T = shipsLayer.value) == null || T.setVisible(!1), (E = largeAmountShipsLayer.value) == null || E.setVisible(!1)) : !u.value && d.value && v <= mapZoom.shipGreenDotMax ? (f.value = !0, w == null || w.setVisible(!0), (C = shipsLayer.value) == null || C.setVisible(!1), (V = largeAmountShipsLayer.value) == null || V.setVisible(!1)) : (f.value = !1, w == null || w.setVisible(!1)), c("zoomChanged", v);
2261
+ }, F = (v, L) => {
2262
+ const w = transform([v[0], v[1]], projection.mercator, projection.data), S = transform([v[2], v[3]], projection.mercator, projection.data);
2263
+ c("extentChanged", { extent: [w, S], zoom: L });
2224
2264
  };
2225
2265
  return t({
2226
2266
  mapInstance: n,
2227
- initMap: w,
2228
- pointRender: (v, y) => new PointMarkerClass(v, y),
2267
+ initMap: y,
2268
+ pointRender: (v, L) => new PointMarkerClass(v, L),
2229
2269
  renderTrucksMarker,
2230
2270
  renderShip: renderShips,
2231
- renderTrack: (v, y, L) => {
2232
- var k, S;
2233
- currentTrackId.value = v, showTrackLayer.value = !0, m.value = !0, hiddenAllShips(), (S = (k = largeAmountShipsLayer.value) == null ? void 0 : k.getSource()) == null || S.clear(), renderTrack(v, s.vehicleMode === "ship" ? y.reverse() : y, L, LENGTH_UNIT.NM);
2271
+ renderTrack: (v, L, w) => {
2272
+ var S, T;
2273
+ currentTrackId.value = v, showTrackLayer.value = !0, u.value = !0, hiddenAllShips(), (T = (S = largeAmountShipsLayer.value) == null ? void 0 : S.getSource()) == null || T.clear(), renderTrack(v, s.vehicleMode === "ship" ? L.reverse() : L, w, LENGTH_UNIT.NM);
2234
2274
  },
2235
2275
  findTruck,
2236
2276
  removeTruckIcon,
2237
2277
  clearAllTruck,
2238
2278
  closeTrack: () => {
2239
- var v, y;
2240
- showTrackLayer.value = !1, (v = shipTrackVectorLayer.value) == null || v.setVisible(!1), (y = selectShipsLayer.value) == null || y.setVisible(!0), m.value = !1, g(d.value < mapZoom.shipGreenDotMax), allTracks.value = [], stopAnimation();
2279
+ var v, L;
2280
+ showTrackLayer.value = !1, (v = shipTrackVectorLayer.value) == null || v.setVisible(!1), (L = selectShipsLayer.value) == null || L.setVisible(!0), u.value = !1, g(m.value < mapZoom.shipGreenDotMax), allTracks.value = [], stopAnimation();
2241
2281
  },
2242
2282
  closeTruckTrack: () => {
2243
- var v, y;
2244
- showTrackLayer.value = !1, (v = shipTrackVectorLayer.value) == null || v.setVisible(!1), (y = selectShipsLayer.value) == null || y.setVisible(!0), stopAnimation();
2283
+ var v, L;
2284
+ showTrackLayer.value = !1, (v = shipTrackVectorLayer.value) == null || v.setVisible(!1), (L = selectShipsLayer.value) == null || L.setVisible(!0), stopAnimation();
2245
2285
  },
2246
2286
  resetTrackView,
2247
2287
  playTrack,
2248
2288
  clearSelectFeature,
2249
2289
  findShip,
2250
- focusShip: (v, y, L = !0) => {
2251
- var k, S;
2252
- hiddenOrther.value = L, (k = shipsLayer.value) == null || k.setVisible(!L), (S = largeAmountShipsLayer.value) == null || S.setVisible(!1), findShip(v, y);
2290
+ focusShip: (v, L, w = !0) => {
2291
+ var S, T;
2292
+ hiddenOrther.value = w, (S = shipsLayer.value) == null || S.setVisible(!w), (T = largeAmountShipsLayer.value) == null || T.setVisible(!1), findShip(v, L);
2253
2293
  },
2254
2294
  showTracks,
2255
2295
  removeAllTrackLayer,
@@ -2257,27 +2297,27 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2257
2297
  rerenderShip,
2258
2298
  switchGreenDot: () => g(!1),
2259
2299
  zoomTruckIcon,
2260
- renderTruckTrack: (v, y, L) => {
2261
- showTrackLayer.value = !0, renderTrack(v, y, L, LENGTH_UNIT.KM, "truck");
2300
+ renderTruckTrack: (v, L, w) => {
2301
+ showTrackLayer.value = !0, renderTrack(v, L, w, LENGTH_UNIT.KM, "truck");
2262
2302
  },
2263
2303
  removerLayer: removeShipTrackLineFeatureByIndex,
2264
2304
  renderMarker,
2265
2305
  setMarkerPosition: (v) => {
2266
- m.value = !0, setMarkerPosition(v);
2306
+ u.value = !0, setMarkerPosition(v);
2267
2307
  },
2268
2308
  getZoomAndCenter: () => {
2269
- var S;
2270
- const v = (S = n.value) == null ? void 0 : S.getView();
2309
+ var T;
2310
+ const v = (T = n.value) == null ? void 0 : T.getView();
2271
2311
  if (!v) return null;
2272
- const y = Math.round(Number(v.getZoom())), { lon: L, lat: k } = transformUtils.mercatorToLonLat(v.getCenter());
2273
- return { zoom: y, center: [L, k] };
2312
+ const L = Math.round(Number(v.getZoom())), { lon: w, lat: S } = transformUtils.mercatorToLonLat(v.getCenter());
2313
+ return { zoom: L, center: [w, S] };
2274
2314
  },
2275
2315
  setCenter: (v) => {
2276
- var k;
2277
- const y = (k = n.value) == null ? void 0 : k.getView();
2278
- if (!y) return null;
2279
- const L = new Point(v);
2280
- y.setCenter(transform(L.getCoordinates(), projection.data, projection.mercator));
2316
+ var S;
2317
+ const L = (S = n.value) == null ? void 0 : S.getView();
2318
+ if (!L) return null;
2319
+ const w = new Point(v);
2320
+ L.setCenter(transform(w.getCoordinates(), projection.data, projection.mercator));
2281
2321
  },
2282
2322
  drawPolygonTool,
2283
2323
  setMapInstance: h,
@@ -2289,21 +2329,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2289
2329
  transform: transformUtils,
2290
2330
  format: formatUtils
2291
2331
  }
2292
- }), (v, y) => (openBlock(), createElementBlock("div", {
2332
+ }), (v, L) => (openBlock(), createElementBlock("div", {
2293
2333
  class: "map-page map-container",
2294
2334
  ref_key: "pageRef",
2295
2335
  ref: l
2296
2336
  }, [
2297
- y[0] || (y[0] = createElementVNode("div", {
2337
+ L[0] || (L[0] = createElementVNode("div", {
2298
2338
  id: "map",
2299
2339
  class: "map"
2300
2340
  }, null, -1)),
2301
2341
  createVNode(ToolPanel, {
2302
2342
  "vehicle-mode": v.vehicleMode,
2303
2343
  "view-mode": v.viewMode,
2304
- "disable-green-dot": m.value,
2344
+ "disable-green-dot": u.value,
2305
2345
  "show-track-layer": unref(showTrackLayer),
2306
- "map-tile-mode": T.value,
2346
+ "map-tile-mode": k.value,
2307
2347
  onSwitchGreenDot: g,
2308
2348
  onSwitchMapTile: M
2309
2349
  }, {
@@ -2324,11 +2364,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2324
2364
  ], 64)) : createCommentVNode("", !0),
2325
2365
  createVNode(Copyright, {
2326
2366
  type: v.logoType,
2327
- "map-tile": T.value
2367
+ "map-tile": k.value
2328
2368
  }, null, 8, ["type", "map-tile"])
2329
2369
  ], 512));
2330
2370
  }
2331
- }), Map = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-79369628"]]), ZhMap = withInstall(Map);
2371
+ }), Map = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-be15323e"]]), ZhMap = withInstall(Map);
2332
2372
  export {
2333
2373
  BaseMapType as B,
2334
2374
  CDN_URL as C,