zhihao-ui 1.2.47 → 1.2.49

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 (34) hide show
  1. package/dist/es/{BaseInfo-D-0T7Xj6.js → BaseInfo-VzgiaCKn.js} +1 -1
  2. package/dist/es/{BaseItem-CY9hXXR0.js → BaseItem-D1xoWSGo.js} +3 -3
  3. package/dist/es/{Button-USqLJ-9S.js → Button-CNEQmoqP.js} +2 -2
  4. package/dist/es/{DatePicker-C6kyMZ8-.js → DatePicker-Dh8sksac.js} +3 -3
  5. package/dist/es/{DetailHeader-BpKX32Ip.js → DetailHeader-CSC9DAQc.js} +3 -3
  6. package/dist/es/{DetailSubTitle-Bu8Ke5B0.js → DetailSubTitle-1ZjJAmet.js} +2 -2
  7. package/dist/es/{Dialog-Dez6LM1c.js → Dialog-BuGbBs3k.js} +3 -3
  8. package/dist/es/{DiyDataTable--G4p9NXy.js → DiyDataTable-BerDffOX.js} +4 -4
  9. package/dist/es/{EditInfoPair-BWFgGS2F.js → EditInfoPair-Dx0KRj7O.js} +3 -3
  10. package/dist/es/{FileWrapper-BN7d5fIh.js → FileWrapper-CS2RTMEV.js} +4 -4
  11. package/dist/es/{Grid-Cs3EsKJP.js → Grid-BQYUct2W.js} +2 -2
  12. package/dist/es/{InfoPair-CNgNOqBr.js → InfoPair-C3sCcJVT.js} +3 -3
  13. package/dist/es/{Input-BQdnfIM2.js → Input-CcYpobcm.js} +3 -3
  14. package/dist/es/{Loading-D44Z_50e.js → Loading-DCEW1FE_.js} +2 -2
  15. package/dist/es/{Map-DkNn4z7I.js → Map-FGjTLjM5.js} +1418 -1367
  16. package/dist/es/{MessageBox-6Q871-mu.js → MessageBox-ByLWEDby.js} +2 -2
  17. package/dist/es/{MoneyInput-DdXhvQpn.js → MoneyInput-DevlnT8p.js} +5 -5
  18. package/dist/es/{PageHeadPanel-a3trdcKM.js → PageHeadPanel-C5A4n2ie.js} +2 -2
  19. package/dist/es/{Table-B7qziI2U.js → Table-BoMGydAp.js} +5 -5
  20. package/dist/es/{ToolTips-DhLuEMZP.js → ToolTips-6ETyGI4m.js} +3 -3
  21. package/dist/es/index.js +23 -23
  22. package/dist/es/{utils-DvDZ3DAF.js → utils-BSQSj8Ii.js} +1 -1
  23. package/dist/es/{vendor-BmuLaCuO.js → vendor-DaYdW1_n.js} +5 -5
  24. package/dist/index.css +1 -1
  25. package/dist/types/components/Map/Map.vue.d.ts +3 -0
  26. package/dist/types/components/Map/index.d.ts +12 -0
  27. package/dist/types/components/Map/interface/entity/render.d.ts +8 -0
  28. package/dist/types/components/Map/render/canvasRender/canvasRender.d.ts +2 -0
  29. package/dist/types/components/Map/render/canvasRender/renderPointStyle.d.ts +2 -0
  30. package/dist/types/components/Map/render/canvasRender/renderShipStyle.d.ts +1 -1
  31. package/dist/types/components/Map/render/renderShip.d.ts +1 -0
  32. package/dist/umd/index.css +1 -1
  33. package/dist/umd/index.umd.cjs +16 -16
  34. package/package.json +1 -1
@@ -1,14 +1,14 @@
1
- var j = Object.defineProperty;
2
- var H = (e, t, n) => t in e ? j(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var b = (e, t, n) => H(e, typeof t != "symbol" ? t + "" : t, n);
1
+ var D = Object.defineProperty;
2
+ var G = (e, t, n) => t in e ? D(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var b = (e, t, n) => G(e, typeof t != "symbol" ? t + "" : t, n);
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 getUid, x as fromLonLat, P as Point, y as transform, z as Feature, T as Text, I as Icon, A as Translate, B as toLonLat, G as transformExtent, h as hooks, L as LineString, H as Polyline, J as getVectorContext, i as cloneDeep, K as GeoJSON, W as WebGLPointsLayer, M as Circle, N as buffer, Q as ScaleLine$1, R as MultiPoint, U as getCenter, X as TileLayer, Y as XYZ, Z as Map$1, _ as View } from "./vendor-BmuLaCuO.js";
6
- import { _ as _export_sfc } from "./Button-USqLJ-9S.js";
7
- import { g as getForegroundColor } from "./DatePicker-C6kyMZ8-.js";
8
- import { w as withInstall } from "./utils-DvDZ3DAF.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 getUid, x as fromLonLat, P as Point, y as transform, z as Feature, T as Text, I as Icon, A as Translate, B as toLonLat, i as cloneDeep, G as GeoJSON, W as WebGLPointsLayer, H as Circle, J as transformExtent, h as hooks, L as LineString, K as Polyline, M as getVectorContext, N as buffer, Q as ScaleLine$1, R as MultiPoint, U as getCenter, X as TileLayer, Y as XYZ, Z as Map$1, _ as View } from "./vendor-DaYdW1_n.js";
6
+ import { _ as _export_sfc } from "./Button-CNEQmoqP.js";
7
+ import { g as getForegroundColor } from "./DatePicker-Dh8sksac.js";
8
+ import { w as withInstall } from "./utils-BSQSj8Ii.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, n, o, i, r, l, c, s, d, u, m, f, p, y, h, v, M, S, V, C, P, x, g, w) {
11
+ constructor(t, n, o, r, i, l, c, s, m, d, u, h, p, f, v, g, L, S, I, F, x, P, $, y) {
12
12
  b(this, "id");
13
13
  // mmsi
14
14
  b(this, "mmsi");
@@ -50,40 +50,40 @@ class ShipMapData {
50
50
  b(this, "existWaterGauge");
51
51
  b(this, "selected");
52
52
  b(this, "blinkColors");
53
- this.id = t, this.mmsi = n, this.fill = o, this.shipType = i, this.name = r, this.length = l, this.breadth = c, this.lon = s, this.lat = d, this.createdAt = u, this.speed = m, this.from = f, this.sailStatus = p, this.hdg = y, this.cog = h, this.posType = v, this.type = M, this.angle = S, this.leftIconColor = V, this.existDevice = C, this.existMobile = P, this.existWaterGauge = x, this.selected = g, this.blinkColors = w;
53
+ this.id = t, this.mmsi = n, this.fill = o, this.shipType = r, this.name = i, this.length = l, this.breadth = c, this.lon = s, this.lat = m, this.createdAt = d, this.speed = u, this.from = h, this.sailStatus = p, this.hdg = f, this.cog = v, this.posType = g, this.type = L, this.angle = S, this.leftIconColor = I, this.existDevice = F, this.existMobile = x, this.existWaterGauge = P, this.selected = $, this.blinkColors = y;
54
54
  }
55
55
  }
56
56
  const formatLength = function(e, t) {
57
57
  const o = getLength(e);
58
- let i = "";
58
+ let r = "";
59
59
  switch (t) {
60
60
  case LENGTH_UNIT.M:
61
- i = Math.round(o * 100) / 100 + " m";
61
+ r = Math.round(o * 100) / 100 + " m";
62
62
  break;
63
63
  case LENGTH_UNIT.KM:
64
- i = Math.round(o / 1e3 * 100) / 100 + " km";
64
+ r = Math.round(o / 1e3 * 100) / 100 + " km";
65
65
  break;
66
66
  case LENGTH_UNIT.NM:
67
- i = (Math.round(o / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
67
+ r = (Math.round(o / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
68
68
  break;
69
69
  }
70
- return i;
70
+ return r;
71
71
  }, convertSixHundredThousandToLatLng = function(e, t) {
72
72
  const n = Number(t) / 6e5;
73
73
  return [Number(e) / 6e5, n];
74
74
  }, formatArea = (e, t) => {
75
75
  const o = getArea(e);
76
- let i;
76
+ let r;
77
77
  switch (t) {
78
78
  case LENGTH_UNIT.KM:
79
- o > 1e4 ? i = Math.round(o / 1e6 * 100) / 100 + " km<sup>2</sup>" : i = Math.round(o * 100) / 100 + " m<sup>2</sup>";
79
+ o > 1e4 ? r = Math.round(o / 1e6 * 100) / 100 + " km<sup>2</sup>" : r = Math.round(o * 100) / 100 + " m<sup>2</sup>";
80
80
  break;
81
81
  case LENGTH_UNIT.NM:
82
- const r = Math.pow(1.852, 2);
83
- o > 1e4 ? i = Math.round(o / 1e6 / r * 100) / 100 + " nm<sup>2</sup>" : i = Math.round(o * 100) / 100 + " m<sup>2</sup>";
82
+ const i = Math.pow(1.852, 2);
83
+ o > 1e4 ? r = Math.round(o / 1e6 / i * 100) / 100 + " nm<sup>2</sup>" : r = Math.round(o * 100) / 100 + " m<sup>2</sup>";
84
84
  break;
85
85
  }
86
- return i;
86
+ return r;
87
87
  }, convertShipMapData = (e) => {
88
88
  const t = (n) => new ShipMapData(
89
89
  n.id,
@@ -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: n }) {
133
- const o = inject("mapInstance"), i = n, r = useModel(e, "visible"), l = ref("3"), c = ref([]), s = ref(!1), d = new VectorSource();
134
- let u, m, f, p, y;
135
- const h = new VectorLayer({
136
- source: d,
133
+ const o = inject("mapInstance"), r = n, i = useModel(e, "visible"), l = ref("3"), c = ref([]), s = ref(!1), m = new VectorSource();
134
+ let d, u, h, p, f;
135
+ const v = new VectorLayer({
136
+ source: m,
137
137
  style: {
138
138
  "fill-color": "rgba(255, 255, 255, 0.2)",
139
139
  "stroke-color": "#ffcc33",
@@ -141,20 +141,20 @@ const formatLength = function(e, t) {
141
141
  "circle-radius": 7,
142
142
  "circle-fill-color": "#ffcc33"
143
143
  }
144
- }), v = function(k) {
145
- if (k.dragging)
144
+ }), g = function(M) {
145
+ if (M.dragging)
146
146
  return;
147
147
  let T = "点击选择起点";
148
- u && (T = "单击继续,双击结束"), m && (m.innerHTML = T, f.setPosition(k.coordinate), m.classList.remove("hidden"));
149
- }, M = () => {
150
- var k, T;
151
- o != null && o.value && ((k = o == null ? void 0 : o.value) == null || k.on("pointermove", v), (T = o == null ? void 0 : o.value) == null || T.getViewport().addEventListener("mouseout", function() {
152
- var E;
153
- (E = m == null ? void 0 : m.classList) == null || E.add("hidden");
148
+ d && (T = "单击继续,双击结束"), u && (u.innerHTML = T, h.setPosition(M.coordinate), u.classList.remove("hidden"));
149
+ }, L = () => {
150
+ var M, T;
151
+ o != null && o.value && ((M = o == null ? void 0 : o.value) == null || M.on("pointermove", g), (T = o == null ? void 0 : o.value) == null || T.getViewport().addEventListener("mouseout", function() {
152
+ var C;
153
+ (C = u == null ? void 0 : u.classList) == null || C.add("hidden");
154
154
  }), s.value = !0);
155
155
  };
156
156
  let S;
157
- const V = new Style({
157
+ const I = new Style({
158
158
  fill: new Fill({
159
159
  color: "rgba(255, 255, 255, 0.2)"
160
160
  }),
@@ -173,90 +173,97 @@ const formatLength = function(e, t) {
173
173
  })
174
174
  })
175
175
  });
176
- function C() {
177
- var k, T;
176
+ function F() {
177
+ var M, T;
178
178
  if (o != null && o.value) {
179
- if (c.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((E) => {
180
- var I;
181
- (I = E == null ? void 0 : E.parentNode) == null || I.removeChild(E);
182
- }), d.clear(), S) {
183
- const E = o.value.getInteractions().getArray().find((I) => getUid(I) === getUid(S));
184
- E && ((k = o.value) == null || k.removeInteraction(E));
179
+ if (c.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((C) => {
180
+ var V;
181
+ (V = C == null ? void 0 : C.parentNode) == null || V.removeChild(C);
182
+ }), m.clear(), S) {
183
+ const C = o.value.getInteractions().getArray().find((V) => getUid(V) === getUid(S));
184
+ C && ((M = o.value) == null || M.removeInteraction(C));
185
185
  }
186
- (T = o.value) == null || T.removeLayer(h), m != null && m.parentNode && m.parentNode.removeChild(m), p != null && p.parentNode && p.parentNode.removeChild(p);
186
+ (T = o.value) == null || T.removeLayer(v), u != null && u.parentNode && u.parentNode.removeChild(u), p != null && p.parentNode && p.parentNode.removeChild(p);
187
187
  }
188
188
  }
189
- function P() {
190
- var T, E;
191
- C(), (T = o == null ? void 0 : o.value) == null || T.addLayer(h), S = new Draw({
192
- source: d,
189
+ function x() {
190
+ var T, C;
191
+ F(), (T = o == null ? void 0 : o.value) == null || T.addLayer(v), S = new Draw({
192
+ source: m,
193
193
  type: "LineString",
194
194
  style: function() {
195
- return V;
195
+ return I;
196
196
  },
197
197
  // 添加条件函数,判断是否应该触发绘制
198
- condition: function(I) {
199
- return I.originalEvent.target.tagName !== "DIV";
198
+ condition: function(V) {
199
+ return V.originalEvent.target.tagName !== "DIV";
200
200
  }
201
- }), (E = o == null ? void 0 : o.value) == null || E.addInteraction(S), g(), x();
202
- let k;
203
- S.on("drawstart", function(I) {
204
- var $;
205
- u = I.feature;
206
- let F;
207
- k = ($ = u.getGeometry()) == null ? void 0 : $.on("change", function(R) {
208
- const B = R.target;
209
- let N = formatUtils.formatLength(B, Number(l.value));
210
- F = B.getLastCoordinate(), p && N && (p.innerHTML = N), y.setPosition(F);
201
+ }), (C = o == null ? void 0 : o.value) == null || C.addInteraction(S), $(), P();
202
+ let M;
203
+ S.on("drawstart", function(V) {
204
+ var N;
205
+ d = V.feature, d.set("randomId", k());
206
+ let E;
207
+ M = (N = d.getGeometry()) == null ? void 0 : N.on("change", function(B) {
208
+ const O = B.target;
209
+ let R = formatUtils.formatLength(O, Number(l.value));
210
+ E = O.getLastCoordinate(), p && R && (p.innerHTML = R), f.setPosition(E);
211
211
  });
212
212
  }), S.on("drawend", function() {
213
- var I, F;
214
- 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="${((I = c.value) == null ? void 0 : I.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", ($) => {
213
+ var V;
214
+ if (p && (p.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), p != null && p.innerHTML) {
215
+ const E = (d == null ? void 0 : d.get("randomId")) || k();
216
+ c.value.push({ id: E, value: p == null ? void 0 : p.innerHTML }), p.innerHTML = `${p.innerHTML}<div class="ol-tooltip-delete-button" data-id="${E}"><i class="map-iconfont icon-delete"></i></div>`;
217
+ }
218
+ (V = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || V.addEventListener("click", (E) => {
215
219
  var B;
216
- $.preventDefault(), $.stopPropagation();
217
- const R = (B = $.target) == null ? void 0 : B.getAttribute("data-index");
218
- R && w(Number(R));
219
- }), y.setOffset([0, -7]), u = null, p = null, g(), k && unByKey(k);
220
+ E.preventDefault(), E.stopPropagation();
221
+ const N = (B = E.target) == null ? void 0 : B.getAttribute("data-id");
222
+ N && y(N);
223
+ }), f.setOffset([0, -7]), d = null, p = null, $(), M && unByKey(M);
220
224
  });
221
225
  }
222
- function x() {
223
- var k;
224
- m != null && m.parentNode && m.parentNode.removeChild(m), m = document.createElement("div"), m.className = "ol-tooltip hidden", f = new Overlay({
225
- element: m,
226
+ function P() {
227
+ var M;
228
+ u != null && u.parentNode && u.parentNode.removeChild(u), u = document.createElement("div"), u.className = "ol-tooltip hidden", h = new Overlay({
229
+ element: u,
226
230
  offset: [15, 0],
227
231
  positioning: "center-left"
228
- }), (k = o == null ? void 0 : o.value) == null || k.addOverlay(f);
232
+ }), (M = o == null ? void 0 : o.value) == null || M.addOverlay(h);
229
233
  }
230
- function g() {
231
- var k;
232
- p != null && p.parentNode && p.parentNode.removeChild(p), p = document.createElement("div"), p.className = "ol-tooltip ol-tooltip-measure", y = new Overlay({
234
+ function $() {
235
+ var M;
236
+ p != null && p.parentNode && p.parentNode.removeChild(p), p = document.createElement("div"), p.className = "ol-tooltip ol-tooltip-measure", f = new Overlay({
233
237
  element: p,
234
238
  offset: [0, -15],
235
239
  positioning: "bottom-center",
236
240
  stopEvent: !1,
237
241
  insertFirst: !1
238
- }), (k = o == null ? void 0 : o.value) == null || k.addOverlay(y);
242
+ }), (M = o == null ? void 0 : o.value) == null || M.addOverlay(f);
239
243
  }
240
- const w = (k) => {
241
- var I, F;
242
- c.value[k] && c.value.splice(k, 1);
243
- const T = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
244
- T[k] && ((F = (I = T[k]) == null ? void 0 : I.parentNode) == null || F.removeChild(T[k]));
245
- const E = d.getFeatures();
246
- E[k] && d.removeFeature(E[k]);
247
- }, L = () => {
248
- i("close");
249
- };
250
- return watch(() => r, () => {
251
- r.value && !s.value && (M(), P());
244
+ const y = (M) => {
245
+ var C, V;
246
+ const T = c.value.findIndex((E) => E.id === M);
247
+ if (T !== -1) {
248
+ c.value.splice(T, 1);
249
+ const E = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
250
+ E[T] && ((V = (C = E[T]) == null ? void 0 : C.parentNode) == null || V.removeChild(E[T]));
251
+ const N = m.getFeatures();
252
+ N[T] && m.removeFeature(N[T]);
253
+ }
254
+ }, w = () => {
255
+ r("close");
256
+ }, k = () => Math.random().toString(36).substring(2, 9);
257
+ return watch(() => i, () => {
258
+ i.value && !s.value && (L(), x());
252
259
  }, { deep: !0, immediate: !0 }), t({
253
- addInteraction: P,
254
- removeInteraction: C
255
- }), (k, T) => r.value && k.viewMode !== "WxMiniprogram" ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
260
+ addInteraction: x,
261
+ removeInteraction: F
262
+ }), (M, T) => i.value && M.viewMode !== "WxMiniprogram" ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
256
263
  createElementVNode("div", { class: "header" }, [
257
264
  T[1] || (T[1] = createElementVNode("div", { class: "title" }, "测量", -1)),
258
265
  createElementVNode("i", {
259
- onClick: L,
266
+ onClick: w,
260
267
  class: "map-iconfont icon-close"
261
268
  })
262
269
  ]),
@@ -265,7 +272,7 @@ const formatLength = function(e, t) {
265
272
  createVNode(unref(ElSelect), {
266
273
  class: "select-length-unit",
267
274
  modelValue: l.value,
268
- "onUpdate:modelValue": T[0] || (T[0] = (E) => l.value = E)
275
+ "onUpdate:modelValue": T[0] || (T[0] = (C) => l.value = C)
269
276
  }, {
270
277
  default: withCtx(() => [
271
278
  createVNode(unref(ElOption), {
@@ -285,18 +292,18 @@ const formatLength = function(e, t) {
285
292
  }, 8, ["modelValue"])
286
293
  ]),
287
294
  createElementVNode("div", _hoisted_3$1, [
288
- (openBlock(!0), createElementBlock(Fragment, null, renderList(c.value, (E, I) => (openBlock(), createElementBlock("div", {
295
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(c.value, (C, V) => (openBlock(), createElementBlock("div", {
289
296
  class: "measure-history-item",
290
- key: I
297
+ key: C.id
291
298
  }, [
292
299
  createElementVNode("div", _hoisted_4, [
293
300
  T[3] || (T[3] = createElementVNode("i", { class: "map-iconfont icon-line" }, null, -1)),
294
- createElementVNode("span", _hoisted_5, "线段" + toDisplayString(I + 1), 1),
295
- createElementVNode("span", _hoisted_6, toDisplayString(E), 1)
301
+ createElementVNode("span", _hoisted_5, "线段" + toDisplayString(V + 1), 1),
302
+ createElementVNode("span", _hoisted_6, toDisplayString(C.value), 1)
296
303
  ]),
297
304
  createElementVNode("div", {
298
305
  class: "delete-button",
299
- onClick: (F) => w(I)
306
+ onClick: (E) => y(C.id)
300
307
  }, T[4] || (T[4] = [
301
308
  createElementVNode("i", { class: "map-iconfont icon-delete" }, null, -1)
302
309
  ]), 8, _hoisted_7)
@@ -304,7 +311,7 @@ const formatLength = function(e, t) {
304
311
  ])
305
312
  ])) : createCommentVNode("", !0);
306
313
  }
307
- }), Measure = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-9b1d2f55"]]), mapInstance$8 = ref(), renderMarkerSetInstance = (e) => mapInstance$8.value = e, markerPosition = ref(""), marker = ref(), createIconStyle = (e) => new Style({
314
+ }), Measure = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-f04be643"]]), mapInstance$8 = ref(), renderMarkerSetInstance = (e) => mapInstance$8.value = e, markerPosition = ref(""), marker = ref(), createIconStyle = (e) => new Style({
308
315
  image: new Icon({
309
316
  src: CDN_URL + "map/poi-marker-default.png",
310
317
  anchor: [0.5, 1]
@@ -334,36 +341,36 @@ const formatLength = function(e, t) {
334
341
  // 设置文本背景的内边距
335
342
  })
336
343
  }), renderMarker = (e, t = !0, n = !0) => {
337
- var u;
344
+ var d;
338
345
  if (!mapInstance$8.value || !e || e.split(",").length !== 2) return;
339
- const [o, i] = e.split(",").map(Number);
346
+ const [o, r] = e.split(",").map(Number);
340
347
  marker.value = new Feature({
341
- geometry: new Point(fromLonLat([o, i]))
348
+ geometry: new Point(fromLonLat([o, r]))
342
349
  });
343
- const r = n ? `${o}, ${i}` : "";
344
- (u = marker.value) == null || u.setStyle(createIconStyle(r));
350
+ const i = n ? `${o}, ${r}` : "";
351
+ (d = marker.value) == null || d.setStyle(createIconStyle(i));
345
352
  const l = new VectorSource({
346
353
  features: [marker.value]
347
354
  }), c = new VectorLayer({
348
355
  source: l
349
356
  }), s = mapInstance$8.value.getView();
350
357
  if (mapInstance$8.value.addLayer(c), t) {
351
- const m = new Translate({
358
+ const u = new Translate({
352
359
  layers: [c]
353
360
  });
354
- m.on("translating", function(f) {
355
- var h;
356
- const p = f.features.item(0).getGeometry().getCoordinates(), y = toLonLat(p);
357
- markerPosition.value = `${y[0].toFixed(6)}, ${y[1].toFixed(6)}`, (h = marker.value) == null || h.setStyle(createIconStyle(markerPosition.value));
358
- }), mapInstance$8.value.addInteraction(m);
361
+ u.on("translating", function(h) {
362
+ var v;
363
+ const p = h.features.item(0).getGeometry().getCoordinates(), f = toLonLat(p);
364
+ markerPosition.value = `${f[0].toFixed(6)}, ${f[1].toFixed(6)}`, (v = marker.value) == null || v.setStyle(createIconStyle(markerPosition.value));
365
+ }), mapInstance$8.value.addInteraction(u);
359
366
  }
360
- const d = new Point([o, i]);
361
- s.setCenter(transform(d.getCoordinates(), projection.data, projection.mercator)), s.setZoom(mapZoom.findShip);
367
+ const m = new Point([o, r]);
368
+ s.setCenter(transform(m.getCoordinates(), projection.data, projection.mercator)), s.setZoom(mapZoom.findShip);
362
369
  }, setMarkerPosition = (e) => {
363
- var i, r;
370
+ var r, i;
364
371
  if (!mapInstance$8.value) return;
365
372
  const t = mapInstance$8.value.getView(), n = e.split(",").map(Number);
366
- (r = (i = marker.value) == null ? void 0 : i.getGeometry()) == null || r.setCoordinates(fromLonLat([n[0], n[1]]));
373
+ (i = (r = marker.value) == null ? void 0 : r.getGeometry()) == null || i.setCoordinates(fromLonLat([n[0], n[1]]));
367
374
  const o = new Point([n[0], n[1]]);
368
375
  t.setCenter(transform(o.getCoordinates(), projection.data, projection.mercator)), t.setZoom(mapZoom.markerPosition);
369
376
  }, CDN_URL = "https://static.zhihaoscm.cn/", tiandituKey = "a6e8f78974f2581f2ca00485b40c948f", zhongkeKey = "15c81cc0a191a232e0a0ca1a51c3ca81", baseMap = {
@@ -430,1020 +437,1061 @@ const multiplyPixelRatio = (e) => {
430
437
  }),
431
438
  zIndex: 100
432
439
  }), getRotation = (e, t, n) => {
433
- function o(m) {
434
- return 180 * (m % (2 * Math.PI)) / Math.PI;
440
+ function o(u) {
441
+ return 180 * (u % (2 * Math.PI)) / Math.PI;
435
442
  }
436
- function i(m) {
437
- return m % 360 * Math.PI / 180;
443
+ function r(u) {
444
+ return u % 360 * Math.PI / 180;
438
445
  }
439
- function r(m) {
440
- if (!m) throw new Error("Coordinate is required");
441
- if (!Array.isArray(m)) {
442
- if (m.type === "Feature" && m.geometry !== null && m.geometry.type === "Point")
443
- return m.geometry.coordinates;
444
- if (m.type === "Point") return m.coordinates;
446
+ function i(u) {
447
+ if (!u) throw new Error("Coordinate is required");
448
+ if (!Array.isArray(u)) {
449
+ if (u.type === "Feature" && u.geometry !== null && u.geometry.type === "Point")
450
+ return u.geometry.coordinates;
451
+ if (u.type === "Point") return u.coordinates;
445
452
  }
446
- if (Array.isArray(m) && m.length >= 2 && !Array.isArray(m[0]) && !Array.isArray(m[1]))
447
- return m;
453
+ if (Array.isArray(u) && u.length >= 2 && !Array.isArray(u[0]) && !Array.isArray(u[1]))
454
+ return u;
448
455
  throw new Error(
449
456
  "Coordinate must be GeoJSON Point or an Array of numbers"
450
457
  );
451
458
  }
452
- function l(m, f, p = {}) {
459
+ function l(u, h, p = {}) {
453
460
  if (p.final)
454
- return function(x, g) {
455
- return (l(g, x) + 180) % 360;
456
- }(m, f);
457
- const y = r(m), h = r(f), v = i(y[0]), M = i(h[0]), S = i(y[1]), V = i(h[1]), C = Math.sin(M - v) * Math.cos(V), P = Math.cos(S) * Math.sin(V) - Math.sin(S) * Math.cos(V) * Math.cos(M - v);
458
- return o(Math.atan2(C, P));
461
+ return function(P, $) {
462
+ return (l($, P) + 180) % 360;
463
+ }(u, h);
464
+ const f = i(u), v = i(h), g = r(f[0]), L = r(v[0]), S = r(f[1]), I = r(v[1]), F = Math.sin(L - g) * Math.cos(I), x = Math.cos(S) * Math.sin(I) - Math.sin(S) * Math.cos(I) * Math.cos(L - g);
465
+ return o(Math.atan2(F, x));
459
466
  }
460
- function c(m) {
461
- return !isNaN(m) && m !== null && !Array.isArray(m);
467
+ function c(u) {
468
+ return !isNaN(u) && u !== null && !Array.isArray(u);
462
469
  }
463
- function s(m, f = {}, p = {}) {
464
- return m || console.log("Coordinates are required"), Array.isArray(m) || console.log("Coordinates must be an Array"), m.length < 2 && console.log("Coordinates must be at least 2 numbers long"), (!c(m[0]) || !c(m[1])) && console.log("Coordinates must contain numbers"), d({ type: "Point", coordinates: m }, f, p);
470
+ function s(u, h = {}, p = {}) {
471
+ 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"), m({ type: "Point", coordinates: u }, h, p);
465
472
  }
466
- function d(m, f = {}, p = {}) {
467
- const y = { type: "Feature" };
468
- return p.id !== void 0 && (y.id = p.id), p.bbox && (y.bbox = p.bbox), y.properties = f || {}, y.geometry = m, y;
473
+ function m(u, h = {}, p = {}) {
474
+ const f = { type: "Feature" };
475
+ return p.id !== void 0 && (f.id = p.id), p.bbox && (f.bbox = p.bbox), f.properties = h || {}, f.geometry = u, f;
469
476
  }
470
- const u = l(s(e), s(t), n);
471
- return u < 0 ? 360 + u : u;
472
- }, labelAlpha = 0.8, pixelRatio = window.devicePixelRatio || 1, labelFont = `500 ${12 * pixelRatio}px Arial`, labelOutSize = 2 * pixelRatio, labelHeight = 10 * pixelRatio, fillRectRadius = (e, t, n, o, i, r, l = 4) => {
473
- e.beginPath(), e.moveTo(t + l, n), e.arcTo(t + o, n, t + o, n + l, l), e.arcTo(t + o, n + i, t + o - l, n + i, l), e.arcTo(t, n + i, t, n + i - l, l), e.arcTo(t, n, t + l, n, l), e.closePath(), e.fillStyle = r, e.fill();
474
- }, getPixelFromCoordinate = (e) => {
475
- if (!e || e.length === 0)
476
- throw new Error("Points array is empty or invalid.");
477
- let t = 1 / 0, n = 1 / 0, o = -1 / 0, i = -1 / 0;
478
- for (const [r, l] of e)
479
- r < t && (t = r), l < n && (n = l), r > o && (o = r), l > i && (i = l);
480
- return [t, n, o, i];
481
- }, calculatePolygonCentroid = (e) => {
482
- if (!Array.isArray(e) || e.length < 3)
483
- throw new Error("A polygon must have at least 3 coordinates.");
484
- let t = 0, n = 0, o = 0;
485
- const i = e.length;
486
- for (let c = 0; c < i - 1; c++) {
487
- const [s, d] = e[c], [u, m] = e[c + 1], f = s * m - u * d;
488
- o += f, t += (s + u) * f, n += (d + m) * f;
477
+ const d = l(s(e), s(t), n);
478
+ return d < 0 ? 360 + d : d;
479
+ }, triangleModel = multiplyPixelRatio([
480
+ [0, -8],
481
+ [5, 8],
482
+ [-5, 8]
483
+ ]), shipShapeModel = multiplyPixelRatio([
484
+ [0, -4.545],
485
+ [-0.56, -3.909],
486
+ [-1, -2.727],
487
+ [-1, 3.636],
488
+ [-0.8, 4.545],
489
+ [0.8, 4.545],
490
+ [1, 3.636],
491
+ [1, -2.727],
492
+ [0.56, -3.909],
493
+ [0, -4.545]
494
+ ]), shipDirectPath = {
495
+ left: {
496
+ 0: [
497
+ [0, 0],
498
+ [0, -8],
499
+ [-4, -8]
500
+ ],
501
+ 1: [
502
+ [0, 0],
503
+ [0, -16],
504
+ [-6, -16]
505
+ ],
506
+ 2: [
507
+ [0, 0],
508
+ [0, -24],
509
+ [-8, -24]
510
+ ]
511
+ },
512
+ right: {
513
+ 0: [
514
+ [0, 0],
515
+ [0, -8],
516
+ [-4, -8]
517
+ ],
518
+ 1: [
519
+ [0, 0],
520
+ [0, -16],
521
+ [-6, -16]
522
+ ],
523
+ 2: [
524
+ [0, 0],
525
+ [0, -24],
526
+ [-8, -24]
527
+ ]
528
+ },
529
+ front: {
530
+ 0: [
531
+ [0, 0],
532
+ [0, -8]
533
+ ],
534
+ 1: [
535
+ [0, 0],
536
+ [0, -16]
537
+ ],
538
+ 2: [
539
+ [0, 0],
540
+ [0, -24]
541
+ ]
489
542
  }
490
- if (o *= 0.5, o === 0)
491
- throw new Error("多边形面积为零");
492
- const r = t / (6 * o), l = n / (6 * o);
493
- return [r, l];
494
- }, rotateShapeModel = (e, t) => {
495
- const [n, o] = calculatePolygonCentroid(e), i = t * Math.PI / 180, r = Math.cos(i), l = Math.sin(i);
496
- return e.map(([c, s]) => {
497
- const d = c - n, u = s - o, m = d * r - u * l + n, f = d * l + u * r + o;
498
- return [m, f];
543
+ }, setBlankStyle = () => new Style({
544
+ image: new CircleStyle({
545
+ radius: 0
546
+ })
547
+ }), isMapMoving = ref(!1), mapInstance$7 = ref(), renderShipStyleSetInstance = (e) => {
548
+ mapInstance$7.value = e, e.on("movestart", () => {
549
+ isMapMoving.value = !0;
550
+ }), e.on("moveend", () => {
551
+ isMapMoving.value = !1, e.render();
499
552
  });
500
- }, getTopLeftPoint = (e) => [e[0], e[3]], getBottomLeftPoint = (e) => [e[2], e[3]], getBottomRightPoint = (e) => [e[2], e[1]], getTopRighttPoint = (e) => [e[0], e[1]];
501
- function calculateBounds(e, t, n, o, i) {
502
- let r, l, c, s;
503
- const d = e[0], u = e[1];
504
- switch (t) {
505
- case 0:
506
- r = d + i, l = r + n, s = u - i, c = s - o;
507
- break;
508
- case 1:
509
- r = d + i, l = r + n, s = u + o / 2, c = s - o;
510
- break;
511
- case 2:
512
- r = d + i, l = r + n, s = u + i + o, c = s - o;
513
- break;
514
- case 3:
515
- r = d - n / 2, l = r + n, s = u + i + o, c = s - o;
516
- break;
517
- case 4:
518
- l = d, r = l - n, s = u + i + o, c = s - o;
519
- break;
520
- case 5:
521
- l = d - i, r = l - n, s = u + o / 2, c = s - o;
522
- break;
523
- case 6:
524
- l = d, r = l - n, s = u - i, c = s - o;
525
- break;
526
- case 7:
527
- r = d - n / 2, l = r + n, s = u - i, c = s - o;
528
- }
529
- if (!(!r || !c || !l || !s))
530
- return [Math.min(r, l), Math.min(c, s), Math.max(r, l), Math.max(c, s) + 1];
531
- }
532
- function calculateAnchorPoint(e, t, n = 70, o = 20, i = 20) {
533
- const r = [0, 0];
534
- switch (t) {
535
- case 0:
536
- r[0] = e[0] + i, r[1] = e[1] - i - o / 2;
537
- break;
538
- case 1:
539
- r[0] = e[0] + i, r[1] = e[1];
540
- break;
541
- case 2:
542
- r[0] = e[0] + i, r[1] = e[1] + i + o / 2;
543
- break;
544
- case 3:
545
- r[0] = e[0], r[1] = e[1] + i + o / 4;
546
- break;
547
- case 4:
548
- r[0] = Math.max(e[0] - i, e[0] - n / 2), r[1] = e[1] + i + o / 4;
549
- break;
550
- case 5:
551
- r[0] = e[0] - i, r[1] = e[1];
552
- break;
553
- case 6:
554
- r[0] = Math.max(e[0] - i, e[0] - n / 2), r[1] = e[1] - i - o / 4;
555
- break;
556
- case 7:
557
- r[0] = e[0], r[1] = e[1] - i - o / 4;
558
- }
559
- return r;
560
- }
561
- function drawLabelBody(e, t, n) {
562
- if (!e) return;
563
- const {
564
- font: o,
565
- labelOutSize: i = 2,
566
- labelHeight: r,
567
- center: l,
568
- text: c,
569
- leftIcon: s,
570
- shipColor: d,
571
- lineLength: u = 20,
572
- selected: m
573
- } = n;
574
- e.save(), o && (e.font = o);
575
- let f = e.measureText(c).width + 4 * i;
576
- (s || d) && (f += r + 6 * i), e.restore();
577
- let p, y = 20, h = -1, v = r + 3 * i;
578
- if (u)
579
- for (let M = 0; M < 8; M++) {
580
- p = calculateBounds(l, M, f, v, u);
581
- let S = !1;
582
- for (let V = 0; V < t.length; ++V) {
583
- let C = t[V].bounds, P = [
584
- C[0] - y,
585
- C[1] - y,
586
- C[2] + y,
587
- C[3] + y
588
- ];
589
- if (p && isOverlapping(p, P)) {
590
- S = !0;
591
- break;
592
- }
593
- }
594
- if (!S) {
595
- h = M;
596
- break;
597
- }
553
+ }, 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({
554
+ renderer: (n, o) => {
555
+ n = n;
556
+ const r = o.context, i = o.feature.get("data");
557
+ if (!i) return;
558
+ o.feature.get("index") === 0 && (shipLabels.value = []);
559
+ try {
560
+ const c = drawShipBody(r, i, n, t);
561
+ c && (drawHeading(r, i, c, t), i.selected = e, !isMapMoving.value && e && setTimeout(() => {
562
+ drawSelectBounds(r, c);
563
+ }, 1)), drawShipLabel(r, i, n);
564
+ } catch {
565
+ return !1;
598
566
  }
599
- else
600
- h = 0, p = calculateBounds(l, h, f, v, u);
601
- if (m && h === -1 && (h = 0), h === 5 && (h = 0), p && h > -1) {
602
- let M = getBottomLeftPoint(p), S = getTopRighttPoint(p);
603
- return {
604
- center: l,
605
- x: calculateAnchorPoint(l, h, f, v, u),
606
- l: S,
607
- r: M,
608
- bounds: p,
609
- position: h,
610
- name: c
611
- };
612
- } else
613
- return null;
614
- }
615
- const drawText = (e, t) => {
616
- if (!e) return;
617
- const { center: n, text: o, textColor: i, leftIcon: r, rightIcons: l, font: c } = t;
618
- e.save(), e.setTransform(1, 0, 0, 1, 0, 0);
619
- let [s, d] = n;
620
- if (r) {
621
- e.font = `${18 * pixelRatio}px map-iconfont`;
622
- let u = getIconFont(r.icon);
623
- e.fillStyle = r.color, e.fillText(u, s + labelOutSize - 3 * pixelRatio, d + 2.6 * pixelRatio), s += 23 * pixelRatio;
624
567
  }
625
- if (l != null && l.length) {
626
- e.font = `${12 * pixelRatio}px map-iconfont`, e.fillStyle = "#3370ff";
627
- const u = e.measureText(o).width + 6 * pixelRatio;
628
- l.forEach((m, f) => {
629
- const p = getIconFont(m), y = 20 * pixelRatio * f;
630
- e.fillText(p, s + u + y, d);
568
+ }), drawShipBody = (e, t, n, o) => {
569
+ if (!mapInstance$7.value) return;
570
+ const r = Math.round(Number(mapInstance$7.value.getView().getZoom()));
571
+ if (!r) return;
572
+ let i = [];
573
+ const [l, c] = drawShipModelByZoom[r] || [0, 0], [s, m] = n;
574
+ if (r <= mapZoom.shipModelMax && r > mapZoom.shipModelMin && t.length >= l && t.breadth >= c)
575
+ i = rotateShapeModel(drawCurrentShipShapeModel(t, r), t.angle).map((u) => {
576
+ const [h, p] = u;
577
+ return [s + h, m + p];
631
578
  });
579
+ else {
580
+ const d = rotateShapeModel(triangleModel, t.angle);
581
+ n.length === 2 && (i = d.map((u) => {
582
+ const [h, p] = u;
583
+ return [s + h, m + p];
584
+ }));
632
585
  }
633
- e.font = c || labelFont, e.fillStyle = i, e.fillText(o, s + 2, d), e.restore();
634
- }, drawPolygon = (e, t) => {
635
- let {
636
- points: n,
637
- strokeColor: o,
638
- fillColor: i,
639
- shouldClosePath: r,
640
- translation: l,
641
- rotation: c,
642
- rotationCenter: s,
643
- scale: d,
644
- globalAlpha: u
645
- } = t;
646
- if (u || (u = 1), n && e) {
647
- e.save(), e.beginPath(), c && c !== 0 && s == null && e.rotate(c), l && e.translate(l[0], l[1]), c && (s != null && s.length) && e.rotate(c), d && e.scale(d, d), e.moveTo(n[0][0], n[0][1]);
648
- for (let m = 1; m < n.length; m++)
649
- e.lineTo(n[m][0], n[m][1]);
650
- r && e.closePath(), o && (e.strokeStyle = o, e.stroke()), i && r && (u && (e.globalAlpha = u), e.fillStyle = i, e.fill()), e.restore();
586
+ if (!(i.length > 2)) return !1;
587
+ if (t != null && t.length) {
588
+ const d = i.length === 3 ? 30 : t.length * 0.4;
589
+ e.beginPath(), e.arc(
590
+ n[0],
591
+ n[1],
592
+ d,
593
+ 0,
594
+ 2 * Math.PI
595
+ ), e.fillStyle = "rgba(255, 255, 255, 0.001)", e.fill();
651
596
  }
652
- }, intervalIds = {}, drawLabel = (e, t, n, o) => {
653
- var f, p, y, h, v, M, S;
654
- let { center: i, text: r, color: l, textColor: c, bgColor: s, leftIcon: d, rightIcons: u, type: m } = t;
655
- if (i && r) {
656
- const V = {
657
- font: labelFont,
658
- labelOutSize,
659
- labelHeight,
660
- center: i,
661
- text: r,
662
- leftIcon: d,
663
- selected: t.selected
664
- };
665
- (f = t.blinkColors) != null && f.length && t.fill && (s = t.fill, c = getForegroundColor(t.fill));
666
- const C = drawLabelBody(e, n, V);
667
- if (C) {
668
- const { x: P, bounds: x, l: g } = C, w = [getTopLeftPoint(x), getBottomLeftPoint(x), getBottomRightPoint(x), getTopRighttPoint(x)];
669
- n.find((F) => F.name === r) || n.push(C), drawPolygon(e, {
670
- points: [i, P],
671
- strokeColor: l,
672
- fillColor: "#000",
673
- shouldClosePath: !0,
674
- translation: void 0,
675
- rotation: void 0,
676
- rotationCenter: void 0,
677
- scale: void 0,
678
- globalAlpha: labelAlpha
679
- }), u != null && u.length && u.forEach(() => {
680
- w[1][0] += pixelRatio * 18, w[2][0] += pixelRatio * 18;
681
- });
682
- const k = {
683
- points: w,
684
- strokeColor: l,
685
- fillColor: s,
686
- shouldClosePath: !0
687
- }, [T, E] = g, I = {
688
- center: [T, E + labelOutSize + labelHeight + 1],
689
- text: r,
690
- textColor: c,
691
- leftIcon: d,
692
- rightIcons: u,
693
- blinkColors: t.blinkColors
694
- };
695
- if (drawPolygon(e, k), drawText(e, I), t != null && t.blinkColors && t.blinkColors.length > 0) {
696
- let F = Date.now(), $ = 0;
697
- const R = t.blinkColors;
698
- !!!((h = (y = (p = selectShipsLayer.value) == null ? void 0 : p.getSource()) == null ? void 0 : y.getFeatures()) != null && h.find((N) => {
699
- var A;
700
- return ((A = N.get("data")) == null ? void 0 : A.id) === t.id;
701
- }) || (S = (M = (v = shipsLayer.value) == null ? void 0 : v.getSource()) == null ? void 0 : M.getFeatures()) != null && S.find((N) => {
702
- var A;
703
- return ((A = N.get("data")) == null ? void 0 : A.id) === t.id;
704
- })) || hiddenOrther.value ? (clearInterval(intervalIds[t.id]), deleteLabelFromArray(n, r)) : (intervalIds[t.id] && clearInterval(intervalIds[t.id]), intervalIds[t.id] = window.setInterval(() => {
705
- var _, Z, U;
706
- const N = Date.now();
707
- N - F >= 500 && ($ = ($ + 1) % R.length, F = N, k.fillColor = R[$], drawPolygon(e, k), I.textColor = getForegroundColor(k.fillColor), drawText(e, I)), ((U = (Z = (_ = shipsLayer.value) == null ? void 0 : _.getSource()) == null ? void 0 : Z.getFeatures()) == null ? void 0 : U.some((z) => {
708
- const O = z.get("data");
709
- if ((O == null ? void 0 : O.id) === t.id) {
710
- const D = o == null ? void 0 : o.getView().calculateExtent();
711
- if (!D) return !1;
712
- const G = fromLonLat([O.lon, O.lat]);
713
- return G[0] >= D[0] && G[0] <= D[2] && G[1] >= D[1] && G[1] <= D[3];
714
- }
715
- return !1;
716
- })) || (clearInterval(intervalIds[t.id]), deleteLabelFromArray(n, r));
717
- }, 10));
718
- } else
719
- shipLabels.value.find(($) => $.name === r) && (clearInterval(intervalIds[t.id]), drawPolygon(e, k), drawText(e, I));
597
+ e.save(), e.beginPath(), e.moveTo(i[0][0], i[0][1]);
598
+ for (let d = 1; d < i.length; d++)
599
+ e.lineTo(i[d][0], i[d][1]);
600
+ return e.closePath(), e.strokeStyle = o ? "#ff0000" : "#000", e.lineWidth = o ? 2 : 1, e.stroke(), e.fillStyle = t.fill, e.fill(), e.restore(), i;
601
+ }, drawHeading = (e, t, n, o) => {
602
+ const [r, i] = n[0], l = getShipDirectPath(t);
603
+ if (l) {
604
+ const c = l.map(function(s) {
605
+ const [m, d] = s;
606
+ return [m + r, d + i];
607
+ });
608
+ if (e.save(), e.beginPath(), t.angle > 0) {
609
+ e.translate(r, i);
610
+ const s = t.angle * Math.PI / 180;
611
+ e.rotate(s), e.translate(-r, -i);
720
612
  }
613
+ e.moveTo(r, i);
614
+ for (let s = 1; s < c.length; s++) {
615
+ const [m, d] = c[s];
616
+ e.lineTo(m, d);
617
+ }
618
+ e.strokeStyle = o ? "#ff0000" : "#000", e.lineWidth = o ? 2 : 1, e.stroke(), e.restore();
721
619
  }
722
- return null;
723
- }, clearAllInterval = () => {
724
- Object.keys(intervalIds).forEach((e) => {
725
- clearInterval(e);
726
- });
727
- }, deleteLabelFromArray = (e, t) => {
728
- const n = e.findIndex((o) => o.name === t);
729
- n !== -1 && e.splice(n, 1);
730
- }, PI = Math.PI, a = 6378245, ee = 0.006693421622965943;
731
- function transformLat(e, t) {
732
- let n = -100 + 2 * e + 3 * t + 0.2 * t * t + 0.1 * e * t + 0.2 * Math.sqrt(Math.abs(e));
733
- return n += (20 * Math.sin(6 * e * PI) + 20 * Math.sin(2 * e * PI)) * 2 / 3, n += (20 * Math.sin(t * PI) + 40 * Math.sin(t / 3 * PI)) * 2 / 3, n += (160 * Math.sin(t / 12 * PI) + 320 * Math.sin(t * PI / 30)) * 2 / 3, n;
734
- }
735
- function transformLng(e, t) {
736
- let n = 300 + e + 2 * t + 0.1 * e * e + 0.1 * e * t + 0.1 * Math.sqrt(Math.abs(e));
737
- return n += (20 * Math.sin(6 * e * PI) + 20 * Math.sin(2 * e * PI)) * 2 / 3, n += (20 * Math.sin(e * PI) + 40 * Math.sin(e / 3 * PI)) * 2 / 3, n += (150 * Math.sin(e / 12 * PI) + 300 * Math.sin(e / 30 * PI)) * 2 / 3, n;
738
- }
739
- function outOfChina(e, t) {
740
- return !(e > 73.66 && e < 135.05 && t > 3.86 && t < 53.55);
741
- }
742
- function gcj02ToWgs84(e) {
743
- const [t, n] = e.split(",").map(Number);
744
- if (outOfChina(t, n))
745
- return `${t.toFixed(6)}, ${n.toFixed(6)}`;
746
- {
747
- let o = transformLat(t - 105, n - 35), i = transformLng(t - 105, n - 35);
748
- const r = n / 180 * PI;
749
- let l = Math.sin(r);
750
- l = 1 - ee * l * l;
751
- const c = Math.sqrt(l);
752
- o = o * 180 / (a * (1 - ee) / (l * c) * PI), i = i * 180 / (a / c * Math.cos(r) * PI);
753
- const s = n + o, d = t + i;
754
- return `${(t * 2 - d).toFixed(6)}, ${(n * 2 - s).toFixed(6)}`;
755
- }
756
- }
757
- function calculateCirclePoints(e, t) {
758
- const n = fromLonLat(e), o = t * 1e3, i = [
759
- n[0] - o,
760
- n[1] - o,
761
- n[0] + o,
762
- n[1] + o
763
- ], r = transformExtent(i, projection.mercator, projection.data);
764
- return {
765
- leftTopPoint: { lng: r[0], lat: r[3] },
766
- rightTopPoint: { lng: r[2], lat: r[3] },
767
- rightBottomPoint: { lng: r[2], lat: r[1] },
768
- leftBottomPoint: { lng: r[0], lat: r[1] }
769
- };
770
- }
771
- const equatorialCircumference = 2003750834e-2;
772
- function lonLatToMercator(e) {
773
- const t = e[0] * equatorialCircumference / 180;
774
- let n = Math.log(Math.tan((90 + e[1]) * Math.PI / 360)) / (Math.PI / 180);
775
- return n = n * equatorialCircumference / 180, [t, n];
776
- }
777
- function mercatorToLonLat(e, t = "lonlat") {
778
- const n = { lon: 0, lat: 0 }, o = e[0] / equatorialCircumference * 180;
779
- let i = e[1] / equatorialCircumference * 180;
780
- return i = 180 / Math.PI * (2 * Math.atan(Math.exp(i * Math.PI / 180)) - Math.PI / 2), n.lon = o, n.lat = i, t === "lonlat" ? n : [o, i];
781
- }
782
- function calculateBoundingBox(e) {
783
- let t = 1 / 0, n = -1 / 0, o = 1 / 0, i = -1 / 0;
784
- e.forEach((h) => {
785
- const [v, M] = h;
786
- t = Math.min(t, M), n = Math.max(n, M), o = Math.min(o, v), i = Math.max(i, v);
787
- });
788
- const r = i - o, l = n - t, c = Math.max(r, l), s = (o + i) / 2, d = (t + n) / 2, u = c / 2, m = s - u, f = s + u, p = d - u, y = d + u;
789
- return [f, p, m, y];
790
- }
791
- const transformUtils = {
792
- gcj02ToWgs84,
793
- calculateCirclePoints,
794
- lonLatToMercator,
795
- mercatorToLonLat,
796
- calculateBoundingBox,
797
- transform
798
- }, mapInstance$7 = ref(), renderTrackStyleSetInstance = (e) => mapInstance$7.value = e, stopIcon = "&#xe6e2;", stopColor = "#E31818", slowIcon = "&#xe703;", slowColor = "#1890FF", dropletsIcon = "&#xe6d2", trackList$1 = ref([]);
799
- let animationFeature;
800
- const renderTrackLine = (e, t, n) => {
801
- var l, c, s;
802
- const o = e[t];
803
- if (!o) return;
804
- allTracks.value[t] = o, trackList$1.value = [];
805
- let i = o;
806
- o.length > 5e3 ? o.filter((d, u) => u % 5 === 0) : o.length > 4e3 ? o.filter((d, u) => u % 4 === 0) : o.length > 2e3 && o.filter((d, u) => u % 2 === 0), trackList$1.value = i.map((d, u) => {
807
- if (Number(d.lon) > 180 || Number(d.lat) > 180) {
808
- const [m, f] = formatUtils.convertSixHundredThousandToLatLng(d.lon, d.lat);
809
- d.lon = m, d.lat = f;
620
+ }, drawSelectBounds = (e, t) => {
621
+ let [n, o, r, i] = getPixelFromCoordinate(t);
622
+ const l = window.devicePixelRatio || 1, c = 4;
623
+ n -= c, o -= c, r += c, i += c, e.save(), e.strokeStyle = "#ff0000", e.lineWidth = 4 * l;
624
+ const s = 8 * l;
625
+ e.beginPath(), e.moveTo(n + s, i), e.lineTo(n, i), e.lineTo(n, i - s), e.moveTo(n, o + s), e.lineTo(n, o), e.lineTo(n + s, o), e.moveTo(r - s, o), e.lineTo(r, o), e.lineTo(r, o + s), e.moveTo(r, i - s), e.lineTo(r, i), e.lineTo(r - s, i), e.stroke(), e.restore();
626
+ }, drawShipLabel = (e, t, n) => {
627
+ if (!t.selected && shipLabels.value.find((u) => u.name === t.name)) return;
628
+ const [o, r] = n, i = o, l = r, c = t.name;
629
+ let s;
630
+ t.leftIconColor && (s = { color: t.leftIconColor, icon: "&#xe599;" });
631
+ const m = getShipCustomIcon(t), d = {
632
+ id: t.id,
633
+ center: [i, l],
634
+ text: c,
635
+ fill: t.fill,
636
+ color: "#fff",
637
+ textColor: "#000",
638
+ bgColor: "#fff",
639
+ leftIcon: s,
640
+ rightIcons: m,
641
+ selected: t.selected,
642
+ blinkColors: t.blinkColors,
643
+ type: "ShipName"
644
+ };
645
+ drawLabel(e, d, shipLabels.value, mapInstance$7.value);
646
+ }, drawCurrentShipShapeModel = (e, t) => {
647
+ let n = 0;
648
+ t <= 14 ? n = 0.058 : t === 15 ? n = 0.12 : t === 16 ? n = 0.22 : t === 17 ? n = 0.435 : t === 18 && (n = 0.857);
649
+ const o = e.length / 4 * n, r = e.breadth * n;
650
+ let i = cloneDeep(shipShapeModel);
651
+ return i = i.map(([l, c]) => [l * r, c * o]), i;
652
+ }, getShipDirectPath = (e) => {
653
+ const { speed: t, hdg: n, cog: o } = e;
654
+ let r = "", i = null;
655
+ if (t && t > 1 && (n !== null && n != 511 && o !== null ? o - n >= 3 ? r = "left" : o - n <= -3 ? r = "right" : r = "front" : r = "front", r && t))
656
+ for (let l = 0; l < speedCondition.length; l++) {
657
+ const c = speedCondition[l];
658
+ if (t >= c[0] && t < c[1]) {
659
+ i = shipDirectPath[r][l];
660
+ break;
661
+ }
810
662
  }
811
- return d.center = [d.lon, d.lat], d.centerPoint = transformUtils.lonLatToMercator(d.center), d.id = t, d.index = u, d.time = hooks(d.createdAt).format("YYYY-MM-DD HH:mm:ss"), d;
812
- });
813
- const r = trackList$1.value.map((d) => d.centerPoint);
814
- if (r.length >= 2) {
815
- const d = new LineString(r), u = new Feature({ geometry: d });
816
- u.setStyle(
817
- new Style({
818
- stroke: new Stroke({
819
- color: n,
820
- width: 2
821
- })
822
- })
823
- ), u.setId(t), u.set("type", "line"), (c = (l = shipTrackVectorLayer.value) == null ? void 0 : l.getSource()) == null || c.clear(), shipTrackLineFeatures.value = [];
824
- const m = shipTrackLineFeatures.value.findIndex((p) => p.getId() === t);
825
- m >= 0 ? shipTrackLineFeatures.value[m] = u : shipTrackLineFeatures.value.push(u);
826
- const f = createAnimatedIconFeature(n, r);
827
- trackLineVectorSource.value = new VectorSource({
828
- features: [...shipTrackLineFeatures.value]
829
- }), animationFeature = f, console.log(animationFeature), shipTrackVectorLayer.value = new VectorLayer({
830
- source: trackLineVectorSource.value,
831
- zIndex: 102
832
- }), renderPoint(n), (s = mapInstance$7.value) == null || s.addLayer(shipTrackVectorLayer.value);
833
- }
834
- }, handlePlay = (e, t) => {
835
- const n = allTracks.value[String(e)];
836
- playAnimation(n.map((o) => [o.lon, o.lat]), t);
837
- }, removeShipTrackLineFeatureByIndex = (e, t) => {
838
- e >= 0 && e < shipTrackLineFeatures.value.length && (shipTrackLineFeatures.value.splice(e, 1), delete allTracks.value[t]), trackLineVectorSource.value = new VectorSource({
839
- features: [...shipTrackLineFeatures.value]
840
- }), shipTrackVectorLayer.value && shipTrackVectorLayer.value.setSource(trackLineVectorSource.value);
841
- }, createAnimatedIconFeature = (e, t) => {
842
- const n = new Feature({
843
- geometry: new Point(fromLonLat([t[0][0], t[0][1]]))
844
- // 初始位置
845
- }), o = new Style({
846
- text: new Text({
847
- font: "700 14px map-iconfont",
848
- text: getIconFont("&#xe6bc;"),
849
- fill: new Fill({ color: e })
663
+ return i;
664
+ }, getShipCustomIcon = (e) => {
665
+ const t = [];
666
+ return e.existDevice && t.push("&#xe687;"), e.existMobile && t.push("&#xe688;"), e.existWaterGauge && t.push("&#xe686;"), t || [];
667
+ }, mapInstance$6 = ref(), renderShipSetInstance = (e) => mapInstance$6.value = e;
668
+ let shipsMarkerList = [], shipsVectorSource, largeAmountShipsSource;
669
+ const selectedShipData = ref(null), selectedShips = ref([]);
670
+ let selectShipsVectorSource;
671
+ const renderShips = (e) => {
672
+ var r, i, l, c;
673
+ if (!mapInstance$6.value || showTrackLayer.value) return;
674
+ const t = e.reduce((s, m) => (s.some((d) => d.id === m.id) || s.push(m), s), []), n = Math.round(Number(mapInstance$6.value.getView().getZoom()));
675
+ if (selectedShipData.value && nextTick(() => {
676
+ selectSingleShipMarker(selectedShipData.value);
677
+ }).then((s) => {
678
+ }), !n || n < mapZoom.shipGreenDotMax) return;
679
+ const o = [...t, ...selectedShips.value].reduce((s, m) => (s.some((d) => d.id === m.id) || s.push(m), s), []);
680
+ if (allShips.value.forEach((s) => {
681
+ var m;
682
+ !o.some((d) => d.id === s.id) && ((m = s.blinkColors) != null && m.length) && checkBlinkLabelExist(mapInstance$6.value, shipLabels.value, s.id);
683
+ }), allShips.value = o, !hiddenOrther.value)
684
+ return n >= mapZoom.shipGreenDotMax && n < mapZoom.shipModelMin ? ((r = shipsLayer.value) == null || r.setVisible(!1), (i = largeAmountShipsLayer.value) == null || i.setVisible(!0), renderLargeAmountShips(allShips.value)) : ((l = largeAmountShipsLayer.value) == null || l.setVisible(!1), (c = shipsLayer.value) == null || c.setVisible(!0), renderShipsMarker(allShips.value));
685
+ }, renderLargeAmountShips = (e) => {
686
+ if (!mapInstance$6.value) return;
687
+ const t = e.map((n) => ({
688
+ type: "Feature",
689
+ geometry: {
690
+ type: "Point",
691
+ coordinates: [n.lon, n.lat]
692
+ },
693
+ properties: n
694
+ }));
695
+ return largeAmountShipsSource == null || largeAmountShipsSource.clear(), largeAmountShipsSource = new VectorSource({
696
+ features: new GeoJSON().readFeatures({
697
+ type: "FeatureCollection",
698
+ features: t
699
+ }, {
700
+ featureProjection: projection.mercator
850
701
  })
702
+ }), largeAmountShipsLayer.value = new WebGLPointsLayer({
703
+ source: largeAmountShipsSource,
704
+ style: {
705
+ "shape-points": 3,
706
+ "shape-radius": 9,
707
+ "shape-fill-color": [
708
+ "case",
709
+ ["==", ["get", "fill"], "#D9001C"],
710
+ "#D9001C",
711
+ // 如果 fill 是 #D9001C,返回红色
712
+ ["==", ["get", "fill"], "#04C900"],
713
+ "#04C900",
714
+ // 如果 fill 是 #04C900,返回绿色
715
+ "#04C900"
716
+ // 默认颜色(绿色)
717
+ ],
718
+ "shape-rotate-with-view": !1,
719
+ "shape-rotation": [
720
+ "+",
721
+ ["get", "cog"],
722
+ // 获取 'cog' 属性值
723
+ 180
724
+ // 将值旋转 180 度
725
+ ],
726
+ "shape-scale": [0.8, 1.2],
727
+ "shape-stroke-color": "#000000",
728
+ // 边框颜色为黑色
729
+ "shape-stroke-width": 0.5
730
+ // 边框宽度为0.5px
731
+ }
732
+ }), mapInstance$6.value.addLayer(largeAmountShipsLayer.value), largeAmountShipsLayer.value;
733
+ }, renderShipsMarker = (e) => {
734
+ var n;
735
+ if (!mapInstance$6.value) return;
736
+ deleteAllShipMarkers();
737
+ let t = convertShipMapData(e);
738
+ if (t = customFilterShips(t), !!(t != null && t.length))
739
+ return t.forEach((o, r) => {
740
+ const i = [o.lon, o.lat], l = new Feature({
741
+ geometry: new Point(fromLonLat(i))
742
+ }), c = 1;
743
+ l.set("clickGeometry", new Circle(fromLonLat(i), c)), l.set("data", o), l.set("index", r), l.setStyle(
744
+ setShipStyle(!1)
745
+ ), shipsMarkerList.push({
746
+ ship: o,
747
+ lonlat: i,
748
+ feature: l
749
+ });
750
+ }), shipsVectorSource = new VectorSource({
751
+ features: shipsMarkerList.map((o) => o.feature)
752
+ }), shipsLayer.value = new VectorLayer({
753
+ source: shipsVectorSource,
754
+ zIndex: 100
755
+ }), (n = mapInstance$6.value) == null || n.addLayer(shipsLayer.value), shipsLayer.value;
756
+ }, onShipsMarkerHover = () => {
757
+ var o;
758
+ let e = null, t = 0;
759
+ const n = 100;
760
+ (o = mapInstance$6.value) == null || o.on("pointermove", function(r) {
761
+ var s, m, d, u;
762
+ const i = Date.now();
763
+ if (i - t < n)
764
+ return;
765
+ t = i;
766
+ const l = (s = mapInstance$6.value) == null ? void 0 : s.forEachFeatureAtPixel(r.pixel, (h) => h), c = (m = mapInstance$6.value) == null ? void 0 : m.getTargetElement();
767
+ if (c && (c.style.cursor = l ? "pointer" : ""), e !== l) {
768
+ if (e) {
769
+ const h = e.get("data");
770
+ if (!(h != null && h.mmsi)) return;
771
+ e.setStyle(
772
+ setShipStyle(((d = selectedShipData.value) == null ? void 0 : d.id) === h.id, !1)
773
+ );
774
+ }
775
+ if (l) {
776
+ const h = l.get("data");
777
+ if (!(h != null && h.mmsi)) return;
778
+ e = l, l.setStyle(
779
+ setShipStyle(((u = selectedShipData.value) == null ? void 0 : u.id) === h.id, !0)
780
+ );
781
+ } else
782
+ e = null;
783
+ }
851
784
  });
852
- return n.setStyle(o), n;
853
- }, geoMarkerStyle = new Style({
854
- text: new Text({
855
- font: "700 20px map-iconfont",
856
- text: getIconFont("&#xe657;"),
857
- fill: new Fill({ color: "#ff0000" }),
858
- rotation: 0
859
- // 初始旋转角度
860
- })
861
- });
862
- let polyline, linePath, startMarker, position, geoMarker, vectorLayer;
863
- const trackAnimating = ref(!1);
864
- let distance = 0, lastTime = Date.now(), moveFeatureHandler = null;
865
- const moveFeature = (e, t) => {
866
- var m, f, p;
867
- const n = Number(50 * t), o = ((m = e.frameState) == null ? void 0 : m.time) ?? Date.now(), i = o - lastTime;
868
- if (distance = (distance + n * i / 1e6) % 2, lastTime = o, distance >= 1) {
869
- stopAnimation();
785
+ }, customFilterShips = (e) => {
786
+ let t = cloneDeep(e);
787
+ return t = t.filter((n) => {
788
+ var r;
789
+ const o = getFilterItem(n).every(({ btnShow: i, value: l }) => i ? !!l : !0);
790
+ return (switchBtnShow.value.camera || switchBtnShow.value.mobile || switchBtnShow.value.waterGauge) && ((r = selectedShipData.value) == null ? void 0 : r.id) === n.id && clearSelectFeature(), o;
791
+ }), t;
792
+ }, getFilterItem = (e) => [
793
+ { btnShow: switchBtnShow.value.camera, value: e == null ? void 0 : e.existDevice },
794
+ { btnShow: switchBtnShow.value.mobile, value: e == null ? void 0 : e.existMobile },
795
+ { btnShow: switchBtnShow.value.waterGauge, value: e == null ? void 0 : e.existWaterGauge }
796
+ ], deleteAllShipMarkers = () => {
797
+ shipsMarkerList.forEach((e) => {
798
+ e.feature && (shipsVectorSource == null || shipsVectorSource.removeFeature(e.feature));
799
+ }), clearAllInterval(), shipsMarkerList = [];
800
+ }, selectSingleShipMarker = (e) => {
801
+ var i;
802
+ if (!mapInstance$6.value) return;
803
+ const t = cloneDeep(selectSingleShipData.value);
804
+ selectSingleShipData.value = convertShipMapData(e);
805
+ const n = [selectSingleShipData.value.lon, selectSingleShipData.value.lat], o = new Feature({
806
+ geometry: new Point(fromLonLat(n))
807
+ });
808
+ o.set("data", selectSingleShipData.value), o.setStyle(
809
+ setShipStyle(!0)
810
+ ), shipsMarkerList.push({
811
+ ship: selectSingleShipData.value,
812
+ lonlat: n,
813
+ feature: o
814
+ }), selectShipsVectorSource == null || selectShipsVectorSource.clear(), selectShipsVectorSource = new VectorSource({
815
+ features: [o]
816
+ }), selectShipsLayer.value = new VectorLayer({
817
+ source: selectShipsVectorSource
818
+ }), shipsVectorSource && setVisibleFeatureById(shipsVectorSource, selectSingleShipData.value.id, !0);
819
+ const r = (i = shipsLayer.value) == null ? void 0 : i.getSource();
820
+ return r && (t && setVisibleFeatureById(r, t.id, !0), setVisibleFeatureById(r, selectSingleShipData.value.id, !1)), mapInstance$6.value.addLayer(selectShipsLayer.value), selectShipsLayer.value.setVisible(!0), selectShipsLayer.value;
821
+ }, setVisibleFeatureById = (e, t, n) => {
822
+ e && e.forEachFeature((o) => {
823
+ const r = o.get("data");
824
+ r && r.id === t && o.setStyle(n ? setShipStyle(!1, r.id) : setBlankStyle());
825
+ });
826
+ }, findShip = (e, t, n = !0) => {
827
+ var r, i, l, c, s;
828
+ if (!e || !mapInstance$6.value) return;
829
+ const o = (l = (i = (r = shipsLayer.value) == null ? void 0 : r.getSource()) == null ? void 0 : i.getFeatures()) == null ? void 0 : l.find((m) => {
830
+ var d;
831
+ return ((d = m.get("data")) == null ? void 0 : d.id) === e;
832
+ });
833
+ if (o)
834
+ selectedShipData.value = o.get("data");
835
+ else if (t && t.lon && t.lat)
836
+ selectedShipData.value = t;
837
+ else {
838
+ console.error("找不到船舶");
870
839
  return;
871
840
  }
872
- const r = linePath.getCoordinateAt(
873
- distance > 1 ? 2 - distance : distance
874
- ), l = linePath.getCoordinateAt(
875
- distance > 1 ? distance - 0.01 : distance
876
- ), c = linePath.getCoordinateAt(
877
- distance > 1 ? 2 - distance : distance + 0.01
878
- ), d = getRotation(
879
- transformUtils.mercatorToLonLat(l, "array"),
880
- transformUtils.mercatorToLonLat(c, "array")
881
- ) * Math.PI / 180;
882
- (f = geoMarkerStyle.getText()) == null || f.setRotation(d), position.setCoordinates(r);
883
- const u = getVectorContext(e);
884
- u.context_.save(), u.setStyle(geoMarkerStyle), u.drawGeometry(position), u.context_.restore(), (p = mapInstance$7.value) == null || p.render();
885
- }, startAnimation = () => {
886
- var e;
887
- 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);
888
- }, stopAnimation = () => {
841
+ if (selectedShips.value.some((m) => {
842
+ var d;
843
+ return m.id === ((d = selectedShipData.value) == null ? void 0 : d.id);
844
+ }) || selectedShips.value.push(selectedShipData.value), n && ((c = selectedShipData.value) != null && c.lon) && ((s = selectedShipData.value) != null && s.lat)) {
845
+ const m = mapInstance$6.value.getView(), d = new Point([selectedShipData.value.lon, selectedShipData.value.lat]);
846
+ m.setCenter(transform(d.getCoordinates(), projection.data, projection.mercator));
847
+ const u = m.getZoom(), h = u < mapZoom.findShipMin ? mapZoom.findShip : u;
848
+ m.setZoom(h);
849
+ }
850
+ return setTimeout(() => {
851
+ t && selectSingleShipMarker(t);
852
+ }, 50), o;
853
+ }, clearSelectFeature = () => {
889
854
  var e;
890
- trackAnimating.value && (trackAnimating.value = !1, geoMarker == null || geoMarker.setGeometry(void 0), moveFeatureHandler && vectorLayer && vectorLayer.un("postrender", moveFeatureHandler), vectorLayer && ((e = mapInstance$7.value) == null || e.removeLayer(vectorLayer)), vectorLayer = null, geoMarker = null);
891
- }, playAnimation = (e, t) => {
892
- var o;
893
- trackAnimating.value && stopAnimation(), polyline = new Polyline({
894
- factor: 1e6
895
- }).writeGeometry(new LineString(e)), linePath = new Polyline({
896
- factor: 1e6
897
- }).readGeometry(polyline, {
898
- dataProjection: projection.data,
899
- featureProjection: projection.mercator
900
- }), startMarker = new Feature({
901
- type: "icon",
902
- geometry: new Point(linePath.getFirstCoordinate())
903
- });
904
- const n = startMarker.getGeometry();
905
- position = n ? n.clone() : new Point([0, 0]), geoMarker = new Feature({
906
- type: "geoMarker",
907
- style: geoMarkerStyle,
908
- geometry: position
909
- }), vectorLayer = new VectorLayer({
910
- source: new VectorSource({
911
- features: [geoMarker]
912
- })
913
- }), (o = mapInstance$7.value) == null || o.addLayer(vectorLayer), moveFeatureHandler = (i) => moveFeature(i, t), startAnimation();
914
- }, renderPoint = (e) => {
915
- if (!mapInstance$7.value) return;
916
- const t = trackList$1.value || [];
917
- if (!(t && t.length > 1)) return [];
918
- const n = { 16: 24, 17: 15, default: 4 }, o = [], i = t.length;
919
- for (let c = 0; c < i; c++) {
920
- t[c].index = c;
921
- const s = mapInstance$7.value.getPixelFromCoordinate(t[c].centerPoint);
922
- if (s) {
923
- let d = s.concat(s);
924
- d = adjustBounds(d, [20, 20]);
925
- const u = mapInstance$7.value.getView().getZoom();
926
- if (!u) return;
927
- if (u > 15) {
928
- const f = n[u] || n.default;
929
- d = adjustBounds(d, [f, f]);
930
- }
931
- let m = !0;
932
- if (t[c].state !== "0") {
933
- for (let f = 0; f < o.length; f++)
934
- if (isOverlapping(d, o[f].bounds)) {
935
- m = !1;
936
- break;
937
- }
938
- }
939
- m && (t[c].bounds = d, o.push(t[c]));
940
- }
855
+ if (selectedShipData.value && shipsVectorSource && selectSingleShipData.value) {
856
+ setVisibleFeatureById(shipsVectorSource, selectSingleShipData.value.id, !1);
857
+ const t = (e = shipsLayer.value) == null ? void 0 : e.getSource();
858
+ t && setVisibleFeatureById(t, selectSingleShipData.value.id, !0);
941
859
  }
942
- const r = getIconStyle(stopIcon), l = getIconStyle(slowIcon);
943
- o.forEach((c, s) => {
944
- var m, f;
945
- const d = new Feature({
946
- geometry: new Point(c.centerPoint)
947
- });
948
- d.set("type", "track_point"), d.set("data", c), d.setStyle([
949
- new Style({
950
- // 扩大交互热区
951
- image: new CircleStyle({
952
- stroke: new Stroke({ color: "rgba(0, 0, 0, 0.01)", width: 20 }),
953
- radius: 3
954
- })
955
- }),
956
- new Style({
957
- // 轨迹点样式
958
- image: new CircleStyle({
959
- fill: new Fill({ color: e }),
960
- stroke: new Stroke({ color: "#fff", width: 2 }),
961
- radius: 3
962
- })
963
- })
964
- ]), trackLineVectorSource.value.addFeature(d);
965
- const u = new Feature({
966
- geometry: new Point(fromLonLat(c.center))
967
- });
968
- if (u.set("type", "track_label"), u.set("track_label_index", s), u.setStyle(
969
- setTrackLabelStyle(c, e)
970
- ), trackLineVectorSource.value.addFeature(u), typeof c == "object" && c.hasOwnProperty("state")) {
971
- const p = new Feature({
972
- geometry: new Point(c.centerPoint)
973
- });
974
- p.set("type", "track_icon");
975
- const y = new Style({
976
- text: new Text({
977
- font: "Normal 22px map-iconfont",
978
- text: getIconFont(dropletsIcon),
979
- offsetY: -10
980
- }),
981
- zIndex: 99
982
- }), h = [];
983
- Number(c.state) === 0 ? ((m = y.getText()) == null || m.setFill(new Fill({ color: stopColor })), h.push(r)) : Number(c.state) === 1 && ((f = y.getText()) == null || f.setFill(new Fill({ color: slowColor })), h.push(l)), h.push(y), p.setStyle(h), trackLineVectorSource.value.addFeature(p);
984
- }
985
- }), renderArrow(o, e), renderIconPoint();
986
- }, renderArrow = (e, t) => {
987
- const n = e.length;
988
- n || (e.push(trackList$1.value[0]), e.push(trackList$1.value[trackList$1.value.length - 1]));
989
- for (let o = 0; o < n - 1; o++) {
990
- let i;
991
- const r = e[o], l = (e[o + 1].index + r.index) / 2;
992
- if (l % 2 === 0)
993
- i = trackList$1.value[l].centerPoint;
994
- else {
995
- const c = trackList$1.value[Math.floor(l)], s = trackList$1.value[Math.ceil(l)];
996
- if (c && s) {
997
- const [d, u] = c.centerPoint, [m, f] = s.centerPoint;
998
- i = [(d + m) / 2, (u + f) / 2];
999
- }
1000
- }
1001
- if (i) {
1002
- const c = new Feature({
1003
- geometry: new Point(i)
1004
- });
1005
- c.set("type", "track_arrow"), c.setStyle(
1006
- new Style({
1007
- text: new Text({
1008
- font: "700 14px map-iconfont",
1009
- text: getIconFont("&#xe6bc;"),
1010
- fill: new Fill({ color: t }),
1011
- // 设置箭头旋转 角度转为弧度
1012
- rotation: getRotation(
1013
- e[o].center,
1014
- e[o + 1].center
1015
- ) * (Math.PI / 180)
1016
- })
1017
- })
1018
- ), trackLineVectorSource.value.addFeature(c);
1019
- }
860
+ selectedShipData.value = null, selectedShips.value = [], mapInstance$6.value && (selectShipsVectorSource == null || selectShipsVectorSource.clear(), selectShipsLayer.value = new VectorLayer({
861
+ source: selectShipsVectorSource
862
+ }), mapInstance$6.value.addLayer(selectShipsLayer.value), selectShipsLayer.value.setVisible(!1));
863
+ }, hiddenAllShips = () => {
864
+ var e, t;
865
+ (e = shipsLayer.value) == null || e.setVisible(!1), (t = largeAmountShipsLayer.value) == null || t.setVisible(!1), clearAllInterval();
866
+ }, switchBtnShow = ref({
867
+ // 船舶摄像头过滤开关
868
+ [SWITCH_BTN.Camera]: !1,
869
+ // 船舶联系方式过滤开关
870
+ [SWITCH_BTN.Mobile]: !1,
871
+ // 船舶水尺过滤开关
872
+ [SWITCH_BTN.WaterGauge]: !1
873
+ }), switchFilterItem = (e, t) => {
874
+ switchBtnShow.value[e] = t, renderShips(allShips.value);
875
+ }, rerenderShip = () => {
876
+ renderShips(allShips.value);
877
+ }, clearShipData = (e = !0) => {
878
+ shipsVectorSource == null || shipsVectorSource.clear(), shipsMarkerList = [], e && (selectShipsVectorSource == null || selectShipsVectorSource.clear());
879
+ }, labelAlpha = 0.8, pixelRatio = window.devicePixelRatio || 1, labelFont = `500 ${12 * pixelRatio}px Arial`, labelOutSize = 2 * pixelRatio, labelHeight = 10 * pixelRatio, fillRectRadius = (e, t, n, o, r, i, l = 4) => {
880
+ e.beginPath(), e.moveTo(t + l, n), e.arcTo(t + o, n, t + o, n + l, l), e.arcTo(t + o, n + r, t + o - l, n + r, l), e.arcTo(t, n + r, t, n + r - l, l), e.arcTo(t, n, t + l, n, l), e.closePath(), e.fillStyle = i, e.fill();
881
+ }, getPixelFromCoordinate = (e) => {
882
+ if (!e || e.length === 0)
883
+ throw new Error("Points array is empty or invalid.");
884
+ let t = 1 / 0, n = 1 / 0, o = -1 / 0, r = -1 / 0;
885
+ for (const [i, l] of e)
886
+ i < t && (t = i), l < n && (n = l), i > o && (o = i), l > r && (r = l);
887
+ return [t, n, o, r];
888
+ }, calculatePolygonCentroid = (e) => {
889
+ if (!Array.isArray(e) || e.length < 3)
890
+ throw new Error("A polygon must have at least 3 coordinates.");
891
+ let t = 0, n = 0, o = 0;
892
+ const r = e.length;
893
+ for (let c = 0; c < r - 1; c++) {
894
+ const [s, m] = e[c], [d, u] = e[c + 1], h = s * u - d * m;
895
+ o += h, t += (s + d) * h, n += (m + u) * h;
1020
896
  }
1021
- }, renderIconPoint = () => {
1022
- const e = "&#xe69b;", t = "#fcdc3f", n = "#ff0000";
1023
- (trackList$1.value.length < 2 ? [trackList$1.value[0]] : [trackList$1.value[0], trackList$1.value[trackList$1.value.length - 1]]).forEach((i) => {
1024
- const r = new Feature({
1025
- geometry: new Point(i.centerPoint)
1026
- });
1027
- r.set("type", "track_begin"), r.set("data", i);
1028
- const l = i.index === 0 && trackList$1.value.length >= 2 ? t : n;
1029
- r.setStyle(
1030
- new Style({
1031
- text: new Text({
1032
- font: "Normal 14px map-iconfont",
1033
- text: getIconFont(e),
1034
- fill: new Fill({ color: l })
1035
- }),
1036
- zIndex: 101
1037
- })
1038
- ), trackLineVectorSource.value.addFeature(r);
897
+ if (o *= 0.5, o === 0)
898
+ throw new Error("多边形面积为零");
899
+ const i = t / (6 * o), l = n / (6 * o);
900
+ return [i, l];
901
+ }, rotateShapeModel = (e, t) => {
902
+ const [n, o] = calculatePolygonCentroid(e), r = t * Math.PI / 180, i = Math.cos(r), l = Math.sin(r);
903
+ return e.map(([c, s]) => {
904
+ const m = c - n, d = s - o, u = m * i - d * l + n, h = m * l + d * i + o;
905
+ return [u, h];
1039
906
  });
1040
- }, setTrackLabelStyle = (e, t) => new Style({
1041
- renderer: (n, o) => {
1042
- const i = o.context, c = {
1043
- id: e.id || "",
1044
- center: n,
1045
- text: e.time,
1046
- color: t,
1047
- textColor: "#000",
1048
- bgColor: "rgba(255,255,255,.8)",
1049
- selected: !0,
1050
- type: "TrackTime"
1051
- };
1052
- drawLabel(i, c, trackLabels.value);
907
+ }, getTopLeftPoint = (e) => [e[0], e[3]], getBottomLeftPoint = (e) => [e[2], e[3]], getBottomRightPoint = (e) => [e[2], e[1]], getTopRighttPoint = (e) => [e[0], e[1]];
908
+ function calculateBounds(e, t, n, o, r) {
909
+ let i, l, c, s;
910
+ const m = e[0], d = e[1];
911
+ switch (t) {
912
+ case 0:
913
+ i = m + r, l = i + n, s = d - r, c = s - o;
914
+ break;
915
+ case 1:
916
+ i = m + r, l = i + n, s = d + o / 2, c = s - o;
917
+ break;
918
+ case 2:
919
+ i = m + r, l = i + n, s = d + r + o, c = s - o;
920
+ break;
921
+ case 3:
922
+ i = m - n / 2, l = i + n, s = d + r + o, c = s - o;
923
+ break;
924
+ case 4:
925
+ l = m, i = l - n, s = d + r + o, c = s - o;
926
+ break;
927
+ case 5:
928
+ l = m - r, i = l - n, s = d + o / 2, c = s - o;
929
+ break;
930
+ case 6:
931
+ l = m, i = l - n, s = d - r, c = s - o;
932
+ break;
933
+ case 7:
934
+ i = m - n / 2, l = i + n, s = d - r, c = s - o;
1053
935
  }
1054
- }), triangleModel = multiplyPixelRatio([
1055
- [0, -8],
1056
- [5, 8],
1057
- [-5, 8]
1058
- ]), shipShapeModel = multiplyPixelRatio([
1059
- [0, -4.545],
1060
- [-0.56, -3.909],
1061
- [-1, -2.727],
1062
- [-1, 3.636],
1063
- [-0.8, 4.545],
1064
- [0.8, 4.545],
1065
- [1, 3.636],
1066
- [1, -2.727],
1067
- [0.56, -3.909],
1068
- [0, -4.545]
1069
- ]), shipDirectPath = {
1070
- left: {
1071
- 0: [
1072
- [0, 0],
1073
- [0, -8],
1074
- [-4, -8]
1075
- ],
1076
- 1: [
1077
- [0, 0],
1078
- [0, -16],
1079
- [-6, -16]
1080
- ],
1081
- 2: [
1082
- [0, 0],
1083
- [0, -24],
1084
- [-8, -24]
1085
- ]
1086
- },
1087
- right: {
1088
- 0: [
1089
- [0, 0],
1090
- [0, -8],
1091
- [-4, -8]
1092
- ],
1093
- 1: [
1094
- [0, 0],
1095
- [0, -16],
1096
- [-6, -16]
1097
- ],
1098
- 2: [
1099
- [0, 0],
1100
- [0, -24],
1101
- [-8, -24]
1102
- ]
1103
- },
1104
- front: {
1105
- 0: [
1106
- [0, 0],
1107
- [0, -8]
1108
- ],
1109
- 1: [
1110
- [0, 0],
1111
- [0, -16]
1112
- ],
1113
- 2: [
1114
- [0, 0],
1115
- [0, -24]
1116
- ]
936
+ if (!(!i || !c || !l || !s))
937
+ return [Math.min(i, l), Math.min(c, s), Math.max(i, l), Math.max(c, s) + 1];
938
+ }
939
+ function calculateAnchorPoint(e, t, n = 70, o = 20, r = 20) {
940
+ const i = [0, 0];
941
+ switch (t) {
942
+ case 0:
943
+ i[0] = e[0] + r, i[1] = e[1] - r - o / 2;
944
+ break;
945
+ case 1:
946
+ i[0] = e[0] + r, i[1] = e[1];
947
+ break;
948
+ case 2:
949
+ i[0] = e[0] + r, i[1] = e[1] + r + o / 2;
950
+ break;
951
+ case 3:
952
+ i[0] = e[0], i[1] = e[1] + r + o / 4;
953
+ break;
954
+ case 4:
955
+ i[0] = Math.max(e[0] - r, e[0] - n / 2), i[1] = e[1] + r + o / 4;
956
+ break;
957
+ case 5:
958
+ i[0] = e[0] - r, i[1] = e[1];
959
+ break;
960
+ case 6:
961
+ i[0] = Math.max(e[0] - r, e[0] - n / 2), i[1] = e[1] - r - o / 4;
962
+ break;
963
+ case 7:
964
+ i[0] = e[0], i[1] = e[1] - r - o / 4;
1117
965
  }
1118
- }, setBlankStyle = () => new Style({
1119
- image: new CircleStyle({
1120
- radius: 0
1121
- })
1122
- }), 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({
1123
- renderer: (n, o) => {
1124
- n = n;
1125
- const i = o.context, r = o.feature.get("data");
1126
- if (!r) return;
1127
- o.feature.get("index") === 0 && (shipLabels.value = []);
1128
- try {
1129
- const c = drawShipBody(i, r, n, t);
1130
- c && (drawHeading(i, r, c, t), r.selected = e, e && setTimeout(() => {
1131
- drawSelectBounds(i, c);
1132
- }, 1)), drawShipLabel(i, r, n);
1133
- } catch {
1134
- return !1;
966
+ return i;
967
+ }
968
+ function drawLabelBody(e, t, n) {
969
+ if (!e) return;
970
+ const {
971
+ font: o,
972
+ labelOutSize: r = 2,
973
+ labelHeight: i,
974
+ center: l,
975
+ text: c,
976
+ id: s,
977
+ leftIcon: m,
978
+ shipColor: d,
979
+ lineLength: u = 20,
980
+ selected: h
981
+ } = n;
982
+ e.save(), o && (e.font = o);
983
+ let p = e.measureText(c).width + 4 * r;
984
+ (m || d) && (p += i + 6 * r), e.restore();
985
+ let f, v = 20, g = -1, L = i + 3 * r;
986
+ if (u)
987
+ for (let S = 0; S < 8; S++) {
988
+ f = calculateBounds(l, S, p, L, u);
989
+ let I = !1;
990
+ for (let F = 0; F < t.length; ++F) {
991
+ let x = t[F].bounds, P = [
992
+ x[0] - v,
993
+ x[1] - v,
994
+ x[2] + v,
995
+ x[3] + v
996
+ ];
997
+ if (f && isOverlapping(f, P)) {
998
+ I = !0;
999
+ break;
1000
+ }
1001
+ }
1002
+ if (!I) {
1003
+ g = S;
1004
+ break;
1005
+ }
1135
1006
  }
1007
+ else
1008
+ g = 0, f = calculateBounds(l, g, p, L, u);
1009
+ if (h && g === -1 && (g = 0), f && g > -1) {
1010
+ let S = getBottomLeftPoint(f), I = getTopRighttPoint(f);
1011
+ return {
1012
+ center: l,
1013
+ x: calculateAnchorPoint(l, g, p, L, u),
1014
+ l: I,
1015
+ r: S,
1016
+ bounds: f,
1017
+ position: g,
1018
+ name: c,
1019
+ id: s
1020
+ };
1021
+ } else
1022
+ return null;
1023
+ }
1024
+ const drawText = (e, t) => {
1025
+ if (!e) return;
1026
+ const { center: n, text: o, textColor: r, leftIcon: i, rightIcons: l, font: c } = t;
1027
+ e.save(), e.setTransform(1, 0, 0, 1, 0, 0);
1028
+ let [s, m] = n;
1029
+ if (i) {
1030
+ e.font = `${18 * pixelRatio}px map-iconfont`;
1031
+ let d = getIconFont(i.icon);
1032
+ e.fillStyle = i.color, e.fillText(d, s + labelOutSize - 3 * pixelRatio, m + 2.6 * pixelRatio), s += 23 * pixelRatio;
1136
1033
  }
1137
- }), drawShipBody = (e, t, n, o) => {
1138
- if (!mapInstance$6.value) return;
1139
- const i = Math.round(Number(mapInstance$6.value.getView().getZoom()));
1140
- if (!i) return;
1141
- let r = [];
1142
- const [l, c] = drawShipModelByZoom[i] || [0, 0], [s, d] = n;
1143
- if (i <= mapZoom.shipModelMax && i > mapZoom.shipModelMin && t.length >= l && t.breadth >= c)
1144
- r = rotateShapeModel(drawCurrentShipShapeModel(t, i), t.angle).map((m) => {
1145
- const [f, p] = m;
1146
- return [s + f, d + p];
1034
+ if (l != null && l.length) {
1035
+ e.font = `${12 * pixelRatio}px map-iconfont`, e.fillStyle = "#3370ff";
1036
+ const d = e.measureText(o).width + 6 * pixelRatio;
1037
+ l.forEach((u, h) => {
1038
+ const p = getIconFont(u), f = 20 * pixelRatio * h;
1039
+ e.fillText(p, s + d + f, m);
1147
1040
  });
1148
- else {
1149
- const u = rotateShapeModel(triangleModel, t.angle);
1150
- n.length === 2 && (r = u.map((m) => {
1151
- const [f, p] = m;
1152
- return [s + f, d + p];
1153
- }));
1154
1041
  }
1155
- if (!(r.length > 2)) return !1;
1156
- if (t != null && t.length) {
1157
- const u = r.length === 3 ? 30 : t.length * 0.4;
1158
- e.beginPath(), e.arc(
1159
- n[0],
1160
- n[1],
1161
- u,
1162
- 0,
1163
- 2 * Math.PI
1164
- ), e.fillStyle = "rgba(255, 255, 255, 0.001)", e.fill();
1042
+ e.font = c || labelFont, e.fillStyle = r, e.fillText(o, s + 2, m), e.restore();
1043
+ }, drawPolygon = (e, t) => {
1044
+ let {
1045
+ points: n,
1046
+ strokeColor: o,
1047
+ fillColor: r,
1048
+ shouldClosePath: i,
1049
+ translation: l,
1050
+ rotation: c,
1051
+ rotationCenter: s,
1052
+ scale: m,
1053
+ globalAlpha: d
1054
+ } = t;
1055
+ if (d || (d = 1), n && e) {
1056
+ e.save(), e.beginPath(), c && c !== 0 && s == null && e.rotate(c), l && e.translate(l[0], l[1]), c && (s != null && s.length) && e.rotate(c), m && e.scale(m, m), e.moveTo(n[0][0], n[0][1]);
1057
+ for (let u = 1; u < n.length; u++)
1058
+ e.lineTo(n[u][0], n[u][1]);
1059
+ i && e.closePath(), o && (e.strokeStyle = o, e.stroke()), r && i && (d && (e.globalAlpha = d), e.fillStyle = r, e.fill()), e.restore();
1165
1060
  }
1166
- e.save(), e.beginPath(), e.moveTo(r[0][0], r[0][1]);
1167
- for (let u = 1; u < r.length; u++)
1168
- e.lineTo(r[u][0], r[u][1]);
1169
- return e.closePath(), e.strokeStyle = o ? "#ff0000" : "#000", e.lineWidth = o ? 2 : 1, e.stroke(), e.fillStyle = t.fill, e.fill(), e.restore(), r;
1170
- }, drawHeading = (e, t, n, o) => {
1171
- const [i, r] = n[0], l = getShipDirectPath(t);
1172
- if (l) {
1173
- const c = l.map(function(s) {
1174
- const [d, u] = s;
1175
- return [d + i, u + r];
1176
- });
1177
- if (e.save(), e.beginPath(), t.angle > 0) {
1178
- e.translate(i, r);
1179
- const s = t.angle * Math.PI / 180;
1180
- e.rotate(s), e.translate(-i, -r);
1061
+ }, intervalIds = {}, drawLabel = (e, t, n, o) => {
1062
+ var p, f, v, g, L, S, I;
1063
+ let { center: r, id: i, text: l, color: c, textColor: s, bgColor: m, leftIcon: d, rightIcons: u, type: h } = t;
1064
+ if (r && l) {
1065
+ const F = {
1066
+ font: labelFont,
1067
+ labelOutSize,
1068
+ labelHeight,
1069
+ center: r,
1070
+ text: l,
1071
+ id: i,
1072
+ leftIcon: d,
1073
+ selected: t.selected
1074
+ };
1075
+ (p = t.blinkColors) != null && p.length && t.fill && (m = t.fill, s = getForegroundColor(t.fill));
1076
+ const x = drawLabelBody(e, n, F);
1077
+ if (x) {
1078
+ const { x: P, bounds: $, l: y } = x, w = [getTopLeftPoint($), getBottomLeftPoint($), getBottomRightPoint($), getTopRighttPoint($)];
1079
+ n.find((E) => E.name === l) || n.push(x), drawPolygon(e, {
1080
+ points: [r, P],
1081
+ strokeColor: c,
1082
+ fillColor: "#000",
1083
+ shouldClosePath: !0,
1084
+ translation: void 0,
1085
+ rotation: void 0,
1086
+ rotationCenter: void 0,
1087
+ scale: void 0,
1088
+ globalAlpha: labelAlpha
1089
+ }), u != null && u.length && u.forEach(() => {
1090
+ w[1][0] += pixelRatio * 18, w[2][0] += pixelRatio * 18;
1091
+ });
1092
+ const M = {
1093
+ points: w,
1094
+ strokeColor: c,
1095
+ fillColor: m,
1096
+ shouldClosePath: !0
1097
+ }, [T, C] = y, V = {
1098
+ center: [T, C + labelOutSize + labelHeight + 1],
1099
+ text: l,
1100
+ textColor: s,
1101
+ leftIcon: d,
1102
+ rightIcons: u,
1103
+ blinkColors: t.blinkColors
1104
+ };
1105
+ if (drawPolygon(e, M), drawText(e, V), t != null && t.blinkColors && t.blinkColors.length > 0) {
1106
+ let E = Date.now(), N = 0;
1107
+ const B = t.blinkColors;
1108
+ !!!((g = (v = (f = selectShipsLayer.value) == null ? void 0 : f.getSource()) == null ? void 0 : v.getFeatures()) != null && g.find((R) => {
1109
+ var A;
1110
+ return ((A = R.get("data")) == null ? void 0 : A.id) === t.id;
1111
+ }) || (I = (S = (L = shipsLayer.value) == null ? void 0 : L.getSource()) == null ? void 0 : S.getFeatures()) != null && I.find((R) => {
1112
+ var A;
1113
+ return ((A = R.get("data")) == null ? void 0 : A.id) === t.id;
1114
+ })) || hiddenOrther.value ? (clearInterval(intervalIds[t.id]), deleteLabelFromArray(n, t.id)) : (intervalIds[t.id] && clearInterval(intervalIds[t.id]), intervalIds[t.id] = window.setInterval(() => {
1115
+ const R = Date.now();
1116
+ R - E >= 500 && (N = (N + 1) % B.length, E = R, M.fillColor = B[N], drawPolygon(e, M), V.textColor = getForegroundColor(M.fillColor), drawText(e, V)), checkBlinkLabelExist(o, n, t.id);
1117
+ }, 500));
1118
+ } else
1119
+ shipLabels.value.find((N) => N.name === l) && (clearInterval(intervalIds[t.id]), drawPolygon(e, M), drawText(e, V));
1181
1120
  }
1182
- e.moveTo(i, r);
1183
- for (let s = 1; s < c.length; s++) {
1184
- const [d, u] = c[s];
1185
- e.lineTo(d, u);
1121
+ }
1122
+ return null;
1123
+ }, checkBlinkLabelExist = (e, t, n) => {
1124
+ var l, c, s, m, d, u, h;
1125
+ const o = shipsMarkerList == null ? void 0 : shipsMarkerList.some((p) => {
1126
+ var f, v, g;
1127
+ return ((f = p.ship) == null ? void 0 : f.id) === n && ((g = (v = p.ship) == null ? void 0 : v.blinkColors) == null ? void 0 : g.length) > 0;
1128
+ }), r = [
1129
+ ...((c = (l = shipsLayer.value) == null ? void 0 : l.getSource()) == null ? void 0 : c.getFeatures()) || [],
1130
+ ...((m = (s = selectShipsLayer.value) == null ? void 0 : s.getSource()) == null ? void 0 : m.getFeatures()) || []
1131
+ ].some((p) => {
1132
+ const f = p.get("data");
1133
+ if ((f == null ? void 0 : f.id) === n) {
1134
+ const v = e == null ? void 0 : e.getView().calculateExtent();
1135
+ if (!v) return !1;
1136
+ const g = fromLonLat([f.lon, f.lat]);
1137
+ return g[0] >= v[0] && g[0] <= v[2] && g[1] >= v[1] && g[1] <= v[3];
1186
1138
  }
1187
- e.strokeStyle = o ? "#ff0000" : "#000", e.lineWidth = o ? 2 : 1, e.stroke(), e.restore();
1139
+ return !1;
1140
+ }), i = (u = (d = trackLineVectorSource.value) == null ? void 0 : d.getFeatures()) == null ? void 0 : u.some((p) => {
1141
+ const f = p.get("data");
1142
+ return (f == null ? void 0 : f.id) === n;
1143
+ });
1144
+ (!((h = shipsLayer.value) != null && h.getVisible()) || !i && (!r || !o)) && (clearInterval(intervalIds[n]), deleteLabelFromArray(e, t, n));
1145
+ }, clearAllInterval = () => {
1146
+ Object.keys(intervalIds).forEach((e) => {
1147
+ clearInterval(e);
1148
+ });
1149
+ }, deleteLabelFromArray = (e, t, n) => {
1150
+ var r, i, l, c, s, m, d, u;
1151
+ const o = t.findIndex((h) => h.id === n);
1152
+ if (o !== -1) {
1153
+ t.splice(o, 1);
1154
+ const h = (i = (r = shipsLayer.value) == null ? void 0 : r.getSource()) == null ? void 0 : i.getFeatures().find((f) => {
1155
+ var v;
1156
+ return ((v = f.get("data")) == null ? void 0 : v.id) === n;
1157
+ });
1158
+ h && ((c = (l = shipsLayer.value) == null ? void 0 : l.getSource()) == null || c.removeFeature(h));
1159
+ const p = (m = (s = selectShipsLayer.value) == null ? void 0 : s.getSource()) == null ? void 0 : m.getFeatures().find((f) => {
1160
+ var v;
1161
+ return ((v = f.get("data")) == null ? void 0 : v.id) === n;
1162
+ });
1163
+ p && ((u = (d = selectShipsLayer.value) == null ? void 0 : d.getSource()) == null || u.removeFeature(p)), e && e.render();
1188
1164
  }
1189
- }, drawSelectBounds = (e, t) => {
1190
- let [n, o, i, r] = getPixelFromCoordinate(t);
1191
- const l = window.devicePixelRatio || 1, c = 4;
1192
- n -= c, o -= c, i += c, r += c, e.save(), e.strokeStyle = "#ff0000", e.lineWidth = 4 * l;
1193
- const s = 8 * l;
1194
- e.beginPath(), e.moveTo(n + s, r), e.lineTo(n, r), e.lineTo(n, r - s), e.moveTo(n, o + s), e.lineTo(n, o), e.lineTo(n + s, o), e.moveTo(i - s, o), e.lineTo(i, o), e.lineTo(i, o + s), e.moveTo(i, r - s), e.lineTo(i, r), e.lineTo(i - s, r), e.stroke(), e.restore();
1195
- }, drawShipLabel = (e, t, n) => {
1196
- if (!t.selected && shipLabels.value.find((m) => m.name === t.name)) return;
1197
- const [o, i] = n, r = o, l = i, c = t.name;
1198
- let s;
1199
- t.leftIconColor && (s = { color: t.leftIconColor, icon: "&#xe599;" });
1200
- const d = getShipCustomIcon(t), u = {
1201
- id: t.id,
1202
- center: [r, l],
1203
- text: c,
1204
- fill: t.fill,
1205
- color: "#fff",
1206
- textColor: "#000",
1207
- bgColor: "#fff",
1208
- leftIcon: s,
1209
- rightIcons: d,
1210
- selected: t.selected,
1211
- blinkColors: t.blinkColors,
1212
- type: "ShipName"
1165
+ }, PI = Math.PI, a = 6378245, ee = 0.006693421622965943;
1166
+ function transformLat(e, t) {
1167
+ let n = -100 + 2 * e + 3 * t + 0.2 * t * t + 0.1 * e * t + 0.2 * Math.sqrt(Math.abs(e));
1168
+ return n += (20 * Math.sin(6 * e * PI) + 20 * Math.sin(2 * e * PI)) * 2 / 3, n += (20 * Math.sin(t * PI) + 40 * Math.sin(t / 3 * PI)) * 2 / 3, n += (160 * Math.sin(t / 12 * PI) + 320 * Math.sin(t * PI / 30)) * 2 / 3, n;
1169
+ }
1170
+ function transformLng(e, t) {
1171
+ let n = 300 + e + 2 * t + 0.1 * e * e + 0.1 * e * t + 0.1 * Math.sqrt(Math.abs(e));
1172
+ return n += (20 * Math.sin(6 * e * PI) + 20 * Math.sin(2 * e * PI)) * 2 / 3, n += (20 * Math.sin(e * PI) + 40 * Math.sin(e / 3 * PI)) * 2 / 3, n += (150 * Math.sin(e / 12 * PI) + 300 * Math.sin(e / 30 * PI)) * 2 / 3, n;
1173
+ }
1174
+ function outOfChina(e, t) {
1175
+ return !(e > 73.66 && e < 135.05 && t > 3.86 && t < 53.55);
1176
+ }
1177
+ function gcj02ToWgs84(e) {
1178
+ const [t, n] = e.split(",").map(Number);
1179
+ if (outOfChina(t, n))
1180
+ return `${t.toFixed(6)}, ${n.toFixed(6)}`;
1181
+ {
1182
+ let o = transformLat(t - 105, n - 35), r = transformLng(t - 105, n - 35);
1183
+ const i = n / 180 * PI;
1184
+ let l = Math.sin(i);
1185
+ l = 1 - ee * l * l;
1186
+ const c = Math.sqrt(l);
1187
+ o = o * 180 / (a * (1 - ee) / (l * c) * PI), r = r * 180 / (a / c * Math.cos(i) * PI);
1188
+ const s = n + o, m = t + r;
1189
+ return `${(t * 2 - m).toFixed(6)}, ${(n * 2 - s).toFixed(6)}`;
1190
+ }
1191
+ }
1192
+ function calculateCirclePoints(e, t) {
1193
+ const n = fromLonLat(e), o = t * 1e3, r = [
1194
+ n[0] - o,
1195
+ n[1] - o,
1196
+ n[0] + o,
1197
+ n[1] + o
1198
+ ], i = transformExtent(r, projection.mercator, projection.data);
1199
+ return {
1200
+ leftTopPoint: { lng: i[0], lat: i[3] },
1201
+ rightTopPoint: { lng: i[2], lat: i[3] },
1202
+ rightBottomPoint: { lng: i[2], lat: i[1] },
1203
+ leftBottomPoint: { lng: i[0], lat: i[1] }
1213
1204
  };
1214
- drawLabel(e, u, shipLabels.value, mapInstance$6.value);
1215
- }, drawCurrentShipShapeModel = (e, t) => {
1216
- let n = 0;
1217
- t <= 14 ? n = 0.058 : t === 15 ? n = 0.12 : t === 16 ? n = 0.22 : t === 17 ? n = 0.435 : t === 18 && (n = 0.857);
1218
- const o = e.length / 4 * n, i = e.breadth * n;
1219
- let r = cloneDeep(shipShapeModel);
1220
- return r = r.map(([l, c]) => [l * i, c * o]), r;
1221
- }, getShipDirectPath = (e) => {
1222
- const { speed: t, hdg: n, cog: o } = e;
1223
- let i = "", r = null;
1224
- if (t && t > 1 && (n !== null && n != 511 && o !== null ? o - n >= 3 ? i = "left" : o - n <= -3 ? i = "right" : i = "front" : i = "front", i && t))
1225
- for (let l = 0; l < speedCondition.length; l++) {
1226
- const c = speedCondition[l];
1227
- if (t >= c[0] && t < c[1]) {
1228
- r = shipDirectPath[i][l];
1229
- break;
1230
- }
1205
+ }
1206
+ const equatorialCircumference = 2003750834e-2;
1207
+ function lonLatToMercator(e) {
1208
+ const t = e[0] * equatorialCircumference / 180;
1209
+ let n = Math.log(Math.tan((90 + e[1]) * Math.PI / 360)) / (Math.PI / 180);
1210
+ return n = n * equatorialCircumference / 180, [t, n];
1211
+ }
1212
+ function mercatorToLonLat(e, t = "lonlat") {
1213
+ const n = { lon: 0, lat: 0 }, o = e[0] / equatorialCircumference * 180;
1214
+ let r = e[1] / equatorialCircumference * 180;
1215
+ return r = 180 / Math.PI * (2 * Math.atan(Math.exp(r * Math.PI / 180)) - Math.PI / 2), n.lon = o, n.lat = r, t === "lonlat" ? n : [o, r];
1216
+ }
1217
+ function calculateBoundingBox(e) {
1218
+ let t = 1 / 0, n = -1 / 0, o = 1 / 0, r = -1 / 0;
1219
+ e.forEach((v) => {
1220
+ const [g, L] = v;
1221
+ t = Math.min(t, L), n = Math.max(n, L), o = Math.min(o, g), r = Math.max(r, g);
1222
+ });
1223
+ const i = r - o, l = n - t, c = Math.max(i, l), s = (o + r) / 2, m = (t + n) / 2, d = c / 2, u = s - d, h = s + d, p = m - d, f = m + d;
1224
+ return [h, p, u, f];
1225
+ }
1226
+ const transformUtils = {
1227
+ gcj02ToWgs84,
1228
+ calculateCirclePoints,
1229
+ lonLatToMercator,
1230
+ mercatorToLonLat,
1231
+ calculateBoundingBox,
1232
+ transform
1233
+ }, mapInstance$5 = ref(), renderTrackStyleSetInstance = (e) => mapInstance$5.value = e, stopIcon = "&#xe6e2;", stopColor = "#E31818", slowIcon = "&#xe703;", slowColor = "#1890FF", dropletsIcon = "&#xe6d2", trackList$1 = ref([]);
1234
+ let animationFeature;
1235
+ const renderTrackLine = (e, t, n) => {
1236
+ var l, c, s;
1237
+ const o = e[t];
1238
+ if (!o) return;
1239
+ allTracks.value[t] = o, trackList$1.value = [];
1240
+ let r = o;
1241
+ o.length > 5e3 ? o.filter((m, d) => d % 5 === 0) : o.length > 4e3 ? o.filter((m, d) => d % 4 === 0) : o.length > 2e3 && o.filter((m, d) => d % 2 === 0), trackList$1.value = r.map((m, d) => {
1242
+ if (Number(m.lon) > 180 || Number(m.lat) > 180) {
1243
+ const [u, h] = formatUtils.convertSixHundredThousandToLatLng(m.lon, m.lat);
1244
+ m.lon = u, m.lat = h;
1231
1245
  }
1232
- return r;
1233
- }, getShipCustomIcon = (e) => {
1234
- const t = [];
1235
- return e.existDevice && t.push("&#xe687;"), e.existMobile && t.push("&#xe688;"), e.existWaterGauge && t.push("&#xe686;"), t || [];
1236
- }, mapInstance$5 = ref(), renderShipSetInstance = (e) => mapInstance$5.value = e;
1237
- let shipsMarkerList = [], shipsVectorSource, largeAmountShipsSource;
1238
- const selectedShipData = ref(null), selectedShips = ref([]);
1239
- let selectShipsVectorSource;
1240
- const renderShips = (e) => {
1241
- var n, o, i, r;
1242
- if (!mapInstance$5.value || showTrackLayer.value) return;
1243
- const t = Math.round(Number(mapInstance$5.value.getView().getZoom()));
1244
- if (selectedShipData.value && nextTick(() => {
1245
- selectSingleShipMarker(selectedShipData.value);
1246
- }).then((l) => {
1247
- }), !(!t || t < mapZoom.shipGreenDotMax) && (allShips.value = [...e, ...selectedShips.value], !hiddenOrther.value))
1248
- return t >= mapZoom.shipGreenDotMax && t < mapZoom.shipModelMin ? ((n = shipsLayer.value) == null || n.setVisible(!1), (o = largeAmountShipsLayer.value) == null || o.setVisible(!0), renderLargeAmountShips(allShips.value)) : ((i = largeAmountShipsLayer.value) == null || i.setVisible(!1), (r = shipsLayer.value) == null || r.setVisible(!0), renderShipsMarker(allShips.value));
1249
- }, renderLargeAmountShips = (e) => {
1250
- if (!mapInstance$5.value) return;
1251
- const t = e.map((n) => ({
1252
- type: "Feature",
1253
- geometry: {
1254
- type: "Point",
1255
- coordinates: [n.lon, n.lat]
1256
- },
1257
- properties: n
1258
- }));
1259
- return largeAmountShipsSource == null || largeAmountShipsSource.clear(), largeAmountShipsSource = new VectorSource({
1260
- features: new GeoJSON().readFeatures({
1261
- type: "FeatureCollection",
1262
- features: t
1263
- }, {
1264
- featureProjection: projection.mercator
1246
+ return m.center = [m.lon, m.lat], m.centerPoint = transformUtils.lonLatToMercator(m.center), m.id = t, m.index = d, m.time = hooks(m.createdAt).format("YYYY-MM-DD HH:mm:ss"), m;
1247
+ });
1248
+ const i = trackList$1.value.map((m) => m.centerPoint);
1249
+ if (i.length >= 2) {
1250
+ const m = new LineString(i), d = new Feature({ geometry: m });
1251
+ d.setStyle(
1252
+ new Style({
1253
+ stroke: new Stroke({
1254
+ color: n,
1255
+ width: 2
1256
+ })
1257
+ })
1258
+ ), d.setId(t), d.set("type", "line"), (c = (l = shipTrackVectorLayer.value) == null ? void 0 : l.getSource()) == null || c.clear(), shipTrackLineFeatures.value = [];
1259
+ const u = shipTrackLineFeatures.value.findIndex((p) => p.getId() === t);
1260
+ u >= 0 ? shipTrackLineFeatures.value[u] = d : shipTrackLineFeatures.value.push(d);
1261
+ const h = createAnimatedIconFeature(n, i);
1262
+ trackLineVectorSource.value = new VectorSource({
1263
+ features: [...shipTrackLineFeatures.value]
1264
+ }), animationFeature = h, console.log(animationFeature), shipTrackVectorLayer.value = new VectorLayer({
1265
+ source: trackLineVectorSource.value,
1266
+ zIndex: 102
1267
+ }), renderPoint(n), (s = mapInstance$5.value) == null || s.addLayer(shipTrackVectorLayer.value);
1268
+ }
1269
+ }, handlePlay = (e, t) => {
1270
+ const n = allTracks.value[String(e)];
1271
+ playAnimation(n.map((o) => [o.lon, o.lat]), t);
1272
+ }, removeShipTrackLineFeatureByIndex = (e, t) => {
1273
+ e >= 0 && e < shipTrackLineFeatures.value.length && (shipTrackLineFeatures.value.splice(e, 1), delete allTracks.value[t]), trackLineVectorSource.value = new VectorSource({
1274
+ features: [...shipTrackLineFeatures.value]
1275
+ }), shipTrackVectorLayer.value && shipTrackVectorLayer.value.setSource(trackLineVectorSource.value);
1276
+ }, createAnimatedIconFeature = (e, t) => {
1277
+ const n = new Feature({
1278
+ geometry: new Point(fromLonLat([t[0][0], t[0][1]]))
1279
+ // 初始位置
1280
+ }), o = new Style({
1281
+ text: new Text({
1282
+ font: "700 14px map-iconfont",
1283
+ text: getIconFont("&#xe6bc;"),
1284
+ fill: new Fill({ color: e })
1285
+ })
1286
+ });
1287
+ return n.setStyle(o), n;
1288
+ }, geoMarkerStyle = new Style({
1289
+ text: new Text({
1290
+ font: "700 20px map-iconfont",
1291
+ text: getIconFont("&#xe657;"),
1292
+ fill: new Fill({ color: "#ff0000" }),
1293
+ rotation: 0
1294
+ // 初始旋转角度
1295
+ })
1296
+ });
1297
+ let polyline, linePath, startMarker, position, geoMarker, vectorLayer;
1298
+ const trackAnimating = ref(!1);
1299
+ let distance = 0, lastTime = Date.now(), moveFeatureHandler = null;
1300
+ const moveFeature = (e, t) => {
1301
+ var u, h, p;
1302
+ const n = Number(50 * t), o = ((u = e.frameState) == null ? void 0 : u.time) ?? Date.now(), r = o - lastTime;
1303
+ if (distance = (distance + n * r / 1e6) % 2, lastTime = o, distance >= 1) {
1304
+ stopAnimation();
1305
+ return;
1306
+ }
1307
+ const i = linePath.getCoordinateAt(
1308
+ distance > 1 ? 2 - distance : distance
1309
+ ), l = linePath.getCoordinateAt(
1310
+ distance > 1 ? distance - 0.01 : distance
1311
+ ), c = linePath.getCoordinateAt(
1312
+ distance > 1 ? 2 - distance : distance + 0.01
1313
+ ), m = getRotation(
1314
+ transformUtils.mercatorToLonLat(l, "array"),
1315
+ transformUtils.mercatorToLonLat(c, "array")
1316
+ ) * Math.PI / 180;
1317
+ (h = geoMarkerStyle.getText()) == null || h.setRotation(m), position.setCoordinates(i);
1318
+ const d = getVectorContext(e);
1319
+ d.context_.save(), d.setStyle(geoMarkerStyle), d.drawGeometry(position), d.context_.restore(), (p = mapInstance$5.value) == null || p.render();
1320
+ }, startAnimation = () => {
1321
+ var e;
1322
+ 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);
1323
+ }, stopAnimation = () => {
1324
+ var e;
1325
+ 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);
1326
+ }, playAnimation = (e, t) => {
1327
+ var o;
1328
+ trackAnimating.value && stopAnimation(), polyline = new Polyline({
1329
+ factor: 1e6
1330
+ }).writeGeometry(new LineString(e)), linePath = new Polyline({
1331
+ factor: 1e6
1332
+ }).readGeometry(polyline, {
1333
+ dataProjection: projection.data,
1334
+ featureProjection: projection.mercator
1335
+ }), startMarker = new Feature({
1336
+ type: "icon",
1337
+ geometry: new Point(linePath.getFirstCoordinate())
1338
+ });
1339
+ const n = startMarker.getGeometry();
1340
+ position = n ? n.clone() : new Point([0, 0]), geoMarker = new Feature({
1341
+ type: "geoMarker",
1342
+ style: geoMarkerStyle,
1343
+ geometry: position
1344
+ }), vectorLayer = new VectorLayer({
1345
+ source: new VectorSource({
1346
+ features: [geoMarker]
1265
1347
  })
1266
- }), largeAmountShipsLayer.value = new WebGLPointsLayer({
1267
- source: largeAmountShipsSource,
1268
- style: {
1269
- "shape-points": 3,
1270
- "shape-radius": 9,
1271
- "shape-fill-color": [
1272
- "case",
1273
- ["==", ["get", "fill"], "#D9001C"],
1274
- "#D9001C",
1275
- // 如果 fill 是 #D9001C,返回红色
1276
- ["==", ["get", "fill"], "#04C900"],
1277
- "#04C900",
1278
- // 如果 fill 是 #04C900,返回绿色
1279
- "#04C900"
1280
- // 默认颜色(绿色)
1281
- ],
1282
- "shape-rotate-with-view": !1,
1283
- "shape-rotation": [
1284
- "+",
1285
- ["get", "cog"],
1286
- // 获取 'cog' 属性值
1287
- 180
1288
- // 将值旋转 180 度
1289
- ],
1290
- "shape-scale": [0.8, 1.2],
1291
- "shape-stroke-color": "#000000",
1292
- // 边框颜色为黑色
1293
- "shape-stroke-width": 0.5
1294
- // 边框宽度为0.5px
1295
- }
1296
- }), mapInstance$5.value.addLayer(largeAmountShipsLayer.value), largeAmountShipsLayer.value;
1297
- }, renderShipsMarker = (e) => {
1298
- var n;
1348
+ }), (o = mapInstance$5.value) == null || o.addLayer(vectorLayer), moveFeatureHandler = (r) => moveFeature(r, t), startAnimation();
1349
+ }, renderPoint = (e) => {
1299
1350
  if (!mapInstance$5.value) return;
1300
- deleteAllShipMarkers();
1301
- let t = convertShipMapData(e);
1302
- if (t = customFilterShips(t), !!(t != null && t.length))
1303
- return t.forEach((o, i) => {
1304
- const r = [o.lon, o.lat], l = new Feature({
1305
- geometry: new Point(fromLonLat(r))
1306
- }), c = 1;
1307
- l.set("clickGeometry", new Circle(fromLonLat(r), c)), l.set("data", o), l.set("index", i), l.setStyle(
1308
- setShipStyle(!1)
1309
- ), shipsMarkerList.push({
1310
- ship: o,
1311
- lonlat: r,
1312
- feature: l
1313
- });
1314
- }), shipsVectorSource = new VectorSource({
1315
- features: shipsMarkerList.map((o) => o.feature)
1316
- }), shipsLayer.value = new VectorLayer({
1317
- source: shipsVectorSource,
1318
- zIndex: 100
1319
- }), (n = mapInstance$5.value) == null || n.addLayer(shipsLayer.value), shipsLayer.value;
1320
- }, onShipsMarkerHover = () => {
1321
- var o;
1322
- let e = null, t = 0;
1323
- const n = 100;
1324
- (o = mapInstance$5.value) == null || o.on("pointermove", function(i) {
1325
- var s, d, u, m;
1326
- const r = Date.now();
1327
- if (r - t < n)
1328
- return;
1329
- t = r;
1330
- const l = (s = mapInstance$5.value) == null ? void 0 : s.forEachFeatureAtPixel(i.pixel, (f) => f), c = (d = mapInstance$5.value) == null ? void 0 : d.getTargetElement();
1331
- if (c && (c.style.cursor = l ? "pointer" : ""), e !== l) {
1332
- if (e) {
1333
- const f = e.get("data");
1334
- if (!(f != null && f.mmsi)) return;
1335
- e.setStyle(
1336
- setShipStyle(((u = selectedShipData.value) == null ? void 0 : u.id) === f.id, !1)
1337
- );
1351
+ const t = trackList$1.value || [];
1352
+ if (!(t && t.length > 1)) return [];
1353
+ const n = { 16: 24, 17: 15, default: 4 }, o = [], r = t.length;
1354
+ for (let c = 0; c < r; c++) {
1355
+ t[c].index = c;
1356
+ const s = mapInstance$5.value.getPixelFromCoordinate(t[c].centerPoint);
1357
+ if (s) {
1358
+ let m = s.concat(s);
1359
+ m = adjustBounds(m, [20, 20]);
1360
+ const d = mapInstance$5.value.getView().getZoom();
1361
+ if (!d) return;
1362
+ if (d > 15) {
1363
+ const h = n[d] || n.default;
1364
+ m = adjustBounds(m, [h, h]);
1338
1365
  }
1339
- if (l) {
1340
- const f = l.get("data");
1341
- if (!(f != null && f.mmsi)) return;
1342
- e = l, l.setStyle(
1343
- setShipStyle(((m = selectedShipData.value) == null ? void 0 : m.id) === f.id, !0)
1344
- );
1345
- } else
1346
- e = null;
1366
+ let u = !0;
1367
+ if (t[c].state !== "0") {
1368
+ for (let h = 0; h < o.length; h++)
1369
+ if (isOverlapping(m, o[h].bounds)) {
1370
+ u = !1;
1371
+ break;
1372
+ }
1373
+ }
1374
+ u && (t[c].bounds = m, o.push(t[c]));
1347
1375
  }
1348
- });
1349
- }, customFilterShips = (e) => {
1350
- let t = cloneDeep(e);
1351
- return t = t.filter((n) => {
1352
- var i;
1353
- const o = getFilterItem(n).every(({ btnShow: r, value: l }) => r ? !!l : !0);
1354
- return (switchBtnShow.value.camera || switchBtnShow.value.mobile || switchBtnShow.value.waterGauge) && ((i = selectedShipData.value) == null ? void 0 : i.id) === n.id && clearSelectFeature(), o;
1355
- }), t;
1356
- }, getFilterItem = (e) => [
1357
- { btnShow: switchBtnShow.value.camera, value: e == null ? void 0 : e.existDevice },
1358
- { btnShow: switchBtnShow.value.mobile, value: e == null ? void 0 : e.existMobile },
1359
- { btnShow: switchBtnShow.value.waterGauge, value: e == null ? void 0 : e.existWaterGauge }
1360
- ], deleteAllShipMarkers = () => {
1361
- shipsMarkerList.forEach((e) => {
1362
- e.feature && (shipsVectorSource == null || shipsVectorSource.removeFeature(e.feature));
1363
- }), clearAllInterval(), shipsMarkerList = [];
1364
- }, selectSingleShipMarker = (e) => {
1365
- var r;
1366
- if (!mapInstance$5.value) return;
1367
- const t = cloneDeep(selectSingleShipData.value);
1368
- selectSingleShipData.value = convertShipMapData(e);
1369
- const n = [selectSingleShipData.value.lon, selectSingleShipData.value.lat], o = new Feature({
1370
- geometry: new Point(fromLonLat(n))
1371
- });
1372
- o.set("data", selectSingleShipData.value), o.setStyle(
1373
- setShipStyle(!0)
1374
- ), shipsMarkerList.push({
1375
- ship: selectSingleShipData.value,
1376
- lonlat: n,
1377
- feature: o
1378
- }), selectShipsVectorSource == null || selectShipsVectorSource.clear(), selectShipsVectorSource = new VectorSource({
1379
- features: [o]
1380
- }), selectShipsLayer.value = new VectorLayer({
1381
- source: selectShipsVectorSource
1382
- }), shipsVectorSource && setVisibleFeatureById(shipsVectorSource, selectSingleShipData.value.id, !0);
1383
- const i = (r = shipsLayer.value) == null ? void 0 : r.getSource();
1384
- return i && (t && setVisibleFeatureById(i, t.id, !0), setVisibleFeatureById(i, selectSingleShipData.value.id, !1)), mapInstance$5.value.addLayer(selectShipsLayer.value), selectShipsLayer.value.setVisible(!0), selectShipsLayer.value;
1385
- }, setVisibleFeatureById = (e, t, n) => {
1386
- e && e.forEachFeature((o) => {
1387
- const i = o.get("data");
1388
- i && i.id === t && o.setStyle(n ? setShipStyle(!1, i.id) : setBlankStyle());
1389
- });
1390
- }, findShip = (e, t, n = !0) => {
1391
- var i, r, l, c, s;
1392
- if (!e || !mapInstance$5.value) return;
1393
- const o = (l = (r = (i = shipsLayer.value) == null ? void 0 : i.getSource()) == null ? void 0 : r.getFeatures()) == null ? void 0 : l.find((d) => {
1394
- var u;
1395
- return ((u = d.get("data")) == null ? void 0 : u.id) === e;
1396
- });
1397
- if (o)
1398
- selectedShipData.value = o.get("data");
1399
- else if (t && t.lon && t.lat)
1400
- selectedShipData.value = t;
1401
- else {
1402
- console.error("找不到船舶");
1403
- return;
1404
1376
  }
1405
- if (selectedShips.value.some((d) => {
1406
- var u;
1407
- return d.id === ((u = selectedShipData.value) == null ? void 0 : u.id);
1408
- }) || selectedShips.value.push(selectedShipData.value), n && ((c = selectedShipData.value) != null && c.lon) && ((s = selectedShipData.value) != null && s.lat)) {
1409
- const d = mapInstance$5.value.getView(), u = new Point([selectedShipData.value.lon, selectedShipData.value.lat]);
1410
- d.setCenter(transform(u.getCoordinates(), projection.data, projection.mercator));
1411
- const m = d.getZoom(), f = m < mapZoom.findShipMin ? mapZoom.findShip : m;
1412
- d.setZoom(f);
1377
+ const i = getIconStyle(stopIcon), l = getIconStyle(slowIcon);
1378
+ o.forEach((c, s) => {
1379
+ var u, h;
1380
+ const m = new Feature({
1381
+ geometry: new Point(c.centerPoint)
1382
+ });
1383
+ m.set("type", "track_point"), m.set("data", c), m.setStyle([
1384
+ new Style({
1385
+ // 扩大交互热区
1386
+ image: new CircleStyle({
1387
+ stroke: new Stroke({ color: "rgba(0, 0, 0, 0.01)", width: 20 }),
1388
+ radius: 3
1389
+ })
1390
+ }),
1391
+ new Style({
1392
+ // 轨迹点样式
1393
+ image: new CircleStyle({
1394
+ fill: new Fill({ color: e }),
1395
+ stroke: new Stroke({ color: "#fff", width: 2 }),
1396
+ radius: 3
1397
+ })
1398
+ })
1399
+ ]), trackLineVectorSource.value.addFeature(m);
1400
+ const d = new Feature({
1401
+ geometry: new Point(fromLonLat(c.center))
1402
+ });
1403
+ if (d.set("type", "track_label"), d.set("track_label_index", s), d.setStyle(
1404
+ setTrackLabelStyle(c, e)
1405
+ ), trackLineVectorSource.value.addFeature(d), typeof c == "object" && c.hasOwnProperty("state")) {
1406
+ const p = new Feature({
1407
+ geometry: new Point(c.centerPoint)
1408
+ });
1409
+ p.set("type", "track_icon");
1410
+ const f = new Style({
1411
+ text: new Text({
1412
+ font: "Normal 22px map-iconfont",
1413
+ text: getIconFont(dropletsIcon),
1414
+ offsetY: -10
1415
+ }),
1416
+ zIndex: 99
1417
+ }), v = [];
1418
+ Number(c.state) === 0 ? ((u = f.getText()) == null || u.setFill(new Fill({ color: stopColor })), v.push(i)) : Number(c.state) === 1 && ((h = f.getText()) == null || h.setFill(new Fill({ color: slowColor })), v.push(l)), v.push(f), p.setStyle(v), trackLineVectorSource.value.addFeature(p);
1419
+ }
1420
+ }), renderArrow(o, e), renderIconPoint();
1421
+ }, renderArrow = (e, t) => {
1422
+ const n = e.length;
1423
+ n || (e.push(trackList$1.value[0]), e.push(trackList$1.value[trackList$1.value.length - 1]));
1424
+ for (let o = 0; o < n - 1; o++) {
1425
+ let r;
1426
+ const i = e[o], l = (e[o + 1].index + i.index) / 2;
1427
+ if (l % 2 === 0)
1428
+ r = trackList$1.value[l].centerPoint;
1429
+ else {
1430
+ const c = trackList$1.value[Math.floor(l)], s = trackList$1.value[Math.ceil(l)];
1431
+ if (c && s) {
1432
+ const [m, d] = c.centerPoint, [u, h] = s.centerPoint;
1433
+ r = [(m + u) / 2, (d + h) / 2];
1434
+ }
1435
+ }
1436
+ if (r) {
1437
+ const c = new Feature({
1438
+ geometry: new Point(r)
1439
+ });
1440
+ c.set("type", "track_arrow"), c.setStyle(
1441
+ new Style({
1442
+ text: new Text({
1443
+ font: "700 14px map-iconfont",
1444
+ text: getIconFont("&#xe6bc;"),
1445
+ fill: new Fill({ color: t }),
1446
+ // 设置箭头旋转 角度转为弧度
1447
+ rotation: getRotation(
1448
+ e[o].center,
1449
+ e[o + 1].center
1450
+ ) * (Math.PI / 180)
1451
+ })
1452
+ })
1453
+ ), trackLineVectorSource.value.addFeature(c);
1454
+ }
1413
1455
  }
1414
- return setTimeout(() => {
1415
- t && selectSingleShipMarker(t);
1416
- }, 50), o;
1417
- }, clearSelectFeature = () => {
1418
- var e;
1419
- if (selectedShipData.value && shipsVectorSource && selectSingleShipData.value) {
1420
- setVisibleFeatureById(shipsVectorSource, selectSingleShipData.value.id, !1);
1421
- const t = (e = shipsLayer.value) == null ? void 0 : e.getSource();
1422
- t && setVisibleFeatureById(t, selectSingleShipData.value.id, !0);
1456
+ }, renderIconPoint = () => {
1457
+ const e = "&#xe69b;", t = "#fcdc3f", n = "#ff0000";
1458
+ (trackList$1.value.length < 2 ? [trackList$1.value[0]] : [trackList$1.value[0], trackList$1.value[trackList$1.value.length - 1]]).forEach((r) => {
1459
+ const i = new Feature({
1460
+ geometry: new Point(r.centerPoint)
1461
+ });
1462
+ i.set("type", "track_begin"), i.set("data", r);
1463
+ const l = r.index === 0 && trackList$1.value.length >= 2 ? t : n;
1464
+ i.setStyle(
1465
+ new Style({
1466
+ text: new Text({
1467
+ font: "Normal 14px map-iconfont",
1468
+ text: getIconFont(e),
1469
+ fill: new Fill({ color: l })
1470
+ }),
1471
+ zIndex: 101
1472
+ })
1473
+ ), trackLineVectorSource.value.addFeature(i);
1474
+ });
1475
+ }, setTrackLabelStyle = (e, t) => new Style({
1476
+ renderer: (n, o) => {
1477
+ const r = o.context, c = {
1478
+ id: e.id || "",
1479
+ center: n,
1480
+ text: e.time,
1481
+ color: t,
1482
+ textColor: "#000",
1483
+ bgColor: "rgba(255,255,255,.8)",
1484
+ selected: !0,
1485
+ type: "TrackTime"
1486
+ };
1487
+ drawLabel(r, c, trackLabels.value);
1423
1488
  }
1424
- selectedShipData.value = null, mapInstance$5.value && (selectShipsVectorSource == null || selectShipsVectorSource.clear(), selectShipsLayer.value = new VectorLayer({
1425
- source: selectShipsVectorSource
1426
- }), mapInstance$5.value.addLayer(selectShipsLayer.value), selectShipsLayer.value.setVisible(!1));
1427
- }, hiddenAllShips = () => {
1428
- var e, t;
1429
- (e = shipsLayer.value) == null || e.setVisible(!1), (t = largeAmountShipsLayer.value) == null || t.setVisible(!1);
1430
- }, switchBtnShow = ref({
1431
- // 船舶摄像头过滤开关
1432
- [SWITCH_BTN.Camera]: !1,
1433
- // 船舶联系方式过滤开关
1434
- [SWITCH_BTN.Mobile]: !1,
1435
- // 船舶水尺过滤开关
1436
- [SWITCH_BTN.WaterGauge]: !1
1437
- }), switchFilterItem = (e, t) => {
1438
- switchBtnShow.value[e] = t, renderShips(allShips.value);
1439
- }, rerenderShip = () => {
1440
- renderShips(allShips.value);
1441
- }, mapInstance$4 = ref(), renderCustomOverlaySetInstance = (e) => mapInstance$4.value = e, drawCustomContent = (e, t, n, o = "top-left", i = !1, r = !0) => {
1442
- var m, f;
1489
+ }), mapInstance$4 = ref(), renderCustomOverlaySetInstance = (e) => mapInstance$4.value = e, drawCustomContent = (e, t, n, o = "top-left", r = !1, i = !0) => {
1490
+ var u, h;
1443
1491
  if (!t || !mapInstance$4.value) return;
1444
- r && document.querySelectorAll(".truck-custom-content").forEach((p) => {
1445
- var y;
1446
- return (y = p.parentNode) == null ? void 0 : y.removeChild(p);
1492
+ i && document.querySelectorAll(".truck-custom-content").forEach((p) => {
1493
+ var f;
1494
+ return (f = p.parentNode) == null ? void 0 : f.removeChild(p);
1447
1495
  });
1448
1496
  const l = document.createElement("div");
1449
1497
  l.innerHTML = n;
@@ -1452,63 +1500,63 @@ const renderShips = (e) => {
1452
1500
  position: t,
1453
1501
  // 初始位置
1454
1502
  positioning: o,
1455
- stopEvent: i
1503
+ stopEvent: r
1456
1504
  // 设置不阻拦事件
1457
1505
  });
1458
- if (i) {
1459
- let p = !1, y = [0, 0], h = [0, 0], v = 0, M = 0;
1506
+ if (r) {
1507
+ let p = !1, f = [0, 0], v = [0, 0], g = 0, L = 0;
1460
1508
  l.addEventListener("mousedown", function(S) {
1461
- var C;
1462
- p = !0, v = S.clientX, M = S.clientY;
1463
- const V = (C = mapInstance$4.value) == null ? void 0 : C.getCoordinateFromPixel([S.clientX - 200, S.clientY - 200]);
1464
- V && (y = V), h = [
1509
+ var F;
1510
+ p = !0, g = S.clientX, L = S.clientY;
1511
+ const I = (F = mapInstance$4.value) == null ? void 0 : F.getCoordinateFromPixel([S.clientX - 200, S.clientY - 200]);
1512
+ I && (f = I), v = [
1465
1513
  S.clientX - l.getBoundingClientRect().left + 160,
1466
1514
  S.clientY - l.getBoundingClientRect().top + 84
1467
- ], S.preventDefault(), console.log(e, v, M);
1515
+ ], S.preventDefault(), console.log(e, g, L);
1468
1516
  }), document.addEventListener("mousemove", function(S) {
1469
- var V;
1517
+ var I;
1470
1518
  if (p) {
1471
- const C = (V = mapInstance$4.value) == null ? void 0 : V.getCoordinateFromPixel([S.clientX - h[0], S.clientY - h[1]]), P = C[0] - y[0], x = C[1] - y[1];
1472
- c.setPosition([y[0] + P, y[1] + x]);
1519
+ const F = (I = mapInstance$4.value) == null ? void 0 : I.getCoordinateFromPixel([S.clientX - v[0], S.clientY - v[1]]), x = F[0] - f[0], P = F[1] - f[1];
1520
+ c.setPosition([f[0] + x, f[1] + P]);
1473
1521
  }
1474
1522
  }), document.addEventListener("mouseup", function() {
1475
1523
  p = !1;
1476
1524
  });
1477
1525
  }
1478
- (m = mapInstance$4.value) == null || m.addOverlay(c);
1526
+ (u = mapInstance$4.value) == null || u.addOverlay(c);
1479
1527
  const s = l.querySelector(".close-button");
1480
1528
  s && s.addEventListener("click", () => {
1481
- var p, y;
1482
- (p = mapInstance$4.value) == null || p.removeOverlay(c), (y = l.parentNode) == null || y.removeChild(l);
1529
+ var p, f;
1530
+ (p = mapInstance$4.value) == null || p.removeOverlay(c), (f = l.parentNode) == null || f.removeChild(l);
1483
1531
  });
1484
- const d = JSON.parse(JSON.stringify(t)), u = (f = mapInstance$4.value) == null ? void 0 : f.getCoordinateFromPixel(d);
1485
- return c.setPosition(u), c;
1532
+ const m = JSON.parse(JSON.stringify(t)), d = (h = mapInstance$4.value) == null ? void 0 : h.getCoordinateFromPixel(m);
1533
+ return c.setPosition(d), c;
1486
1534
  }, mapInstance$3 = ref(), renderTrackSetInstance = (e) => mapInstance$3.value = e, showTracks = ref([]), trackList = ref([]);
1487
1535
  ref(null);
1488
- const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship") => {
1489
- var u;
1490
- if (console.log(i), nextTick(() => {
1491
- hiddenAllShips();
1492
- }).then((m) => {
1536
+ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, r = "ship") => {
1537
+ var d;
1538
+ if (console.log(r), nextTick(() => {
1539
+ hiddenAllShips(), clearShipData(!1);
1540
+ }).then((u) => {
1493
1541
  }), (t == null ? void 0 : t.length) < 2) {
1494
- ((u = showTracks.value) == null ? void 0 : u.findIndex((m) => m.id === e)) < 0 && showTracks.value.push({ id: e, length: "" });
1542
+ ((d = showTracks.value) == null ? void 0 : d.findIndex((u) => u.id === e)) < 0 && showTracks.value.push({ id: e, length: "" });
1495
1543
  return;
1496
1544
  }
1497
- const r = {};
1498
- t.forEach((m) => {
1499
- m.state ? m.state = Number(m.state) : delete m.state;
1500
- }), trackId.value = e, r[e] = t, trackList.value = t;
1501
- const l = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080", "#ffc0cb", "#800000", "#000080", "#808000"], c = r[e].map(
1502
- (m) => transform([m.lon, m.lat], projection.data, projection.mercator)
1503
- ), s = new LineString(c), d = formatUtils.formatLength(s, o) || "--";
1545
+ const i = {};
1546
+ t.forEach((u) => {
1547
+ u.state ? u.state = Number(u.state) : delete u.state;
1548
+ }), trackId.value = e, i[e] = t, trackList.value = t;
1549
+ const l = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080", "#ffc0cb", "#800000", "#000080", "#808000"], c = i[e].map(
1550
+ (u) => transform([u.lon, u.lat], projection.data, projection.mercator)
1551
+ ), s = new LineString(c), m = formatUtils.formatLength(s, o) || "--";
1504
1552
  nextTick(() => {
1505
- var f, p;
1506
- const m = (f = showTracks.value) == null ? void 0 : f.findIndex((y) => y.id === e);
1507
- m < 0 ? showTracks.value.push({ id: e, length: d }) : showTracks.value[m].length = d, ++cursor.value, cursor.value > l.length && (cursor.value = 0), renderTrackLine(r, e, n), nextTick(() => {
1553
+ var h, p;
1554
+ const u = (h = showTracks.value) == null ? void 0 : h.findIndex((f) => f.id === e);
1555
+ u < 0 ? showTracks.value.push({ id: e, length: m }) : showTracks.value[u].length = m, ++cursor.value, cursor.value > l.length && (cursor.value = 0), renderTrackLine(i, e, n), nextTick(() => {
1508
1556
  resetTrackView(e);
1509
1557
  }).then(() => {
1510
1558
  }), (p = mapInstance$3.value) == null || p.on("moveend", () => {
1511
- showTrackLayer.value && (trackLabels.value = [], renderTrackLine(r, e, n));
1559
+ showTrackLayer.value && (trackLabels.value = [], renderTrackLine(i, e, n));
1512
1560
  }), renderTrackPointPopup();
1513
1561
  }).then(() => {
1514
1562
  });
@@ -1516,20 +1564,20 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship")
1516
1564
  var t;
1517
1565
  const e = ref(null);
1518
1566
  (t = mapInstance$3.value) == null || t.on("pointermove", (n) => {
1519
- var i, r, l, c;
1520
- e.value && ((i = mapInstance$3.value) == null || i.removeOverlay(e.value));
1521
- const o = (r = mapInstance$3.value) == null ? void 0 : r.forEachFeatureAtPixel(n.pixel, (s) => s);
1567
+ var r, i, l, c;
1568
+ e.value && ((r = mapInstance$3.value) == null || r.removeOverlay(e.value));
1569
+ const o = (i = mapInstance$3.value) == null ? void 0 : i.forEachFeatureAtPixel(n.pixel, (s) => s);
1522
1570
  if (o) {
1523
1571
  const s = o.get("data");
1524
1572
  if (!(s != null && s.time)) return;
1525
- let d = "";
1526
- s != null && s.stayTime && (d = `
1573
+ let m = "";
1574
+ s != null && s.stayTime && (m = `
1527
1575
  <div class="item w-100">
1528
1576
  <div class="item-label">停泊时间约</div>
1529
1577
  <div class="item-item">${formatMinutesToDDHHMM(Number(s.stayTime))}</div>
1530
1578
  </div>
1531
1579
  `);
1532
- const u = `
1580
+ const d = `
1533
1581
  <div class="track-point-popup">
1534
1582
  <div class="item">
1535
1583
  <div class="item-label">状态</div>
@@ -1559,11 +1607,11 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship")
1559
1607
  <div class="item-label">时间</div>
1560
1608
  <div class="item-item">${s.time}</div>
1561
1609
  </div>
1562
- ${d ?? d}
1563
- </div>`, m = (l = mapInstance$3.value) == null ? void 0 : l.getPixelFromCoordinate(n.coordinate);
1564
- if (m) {
1565
- const f = drawCustomContent(s.time, m, u, "top-left");
1566
- f && (e.value = f);
1610
+ ${m ?? m}
1611
+ </div>`, u = (l = mapInstance$3.value) == null ? void 0 : l.getPixelFromCoordinate(n.coordinate);
1612
+ if (u) {
1613
+ const h = drawCustomContent(s.time, u, d, "top-left");
1614
+ h && (e.value = h);
1567
1615
  }
1568
1616
  } else
1569
1617
  e.value && ((c = mapInstance$3.value) == null || c.removeOverlay(e.value));
@@ -1574,21 +1622,21 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship")
1574
1622
  }, playTrack = (e, t) => {
1575
1623
  handlePlay(String(e), t);
1576
1624
  }, resetTrackView = (e) => {
1577
- var i;
1578
- const t = mapInstance$3.value.getView(), n = e ? shipTrackLineFeatures.value.find((r) => r.getId() === e) : shipTrackLineFeatures.value[0];
1625
+ var r;
1626
+ const t = mapInstance$3.value.getView(), n = e ? shipTrackLineFeatures.value.find((i) => i.getId() === e) : shipTrackLineFeatures.value[0];
1579
1627
  if (!n) return;
1580
- const o = (i = n == null ? void 0 : n.getGeometry()) == null ? void 0 : i.getExtent();
1628
+ const o = (r = n == null ? void 0 : n.getGeometry()) == null ? void 0 : r.getExtent();
1581
1629
  if (o != null && o.length)
1582
1630
  try {
1583
- const r = buffer(o, Math.max(o[2] - o[0], o[3] - o[1]) * 0.02);
1584
- t.fit(r);
1585
- } catch (r) {
1586
- console.log(r);
1631
+ const i = buffer(o, Math.max(o[2] - o[0], o[3] - o[1]) * 0.02);
1632
+ t.fit(i);
1633
+ } catch (i) {
1634
+ console.log(i);
1587
1635
  }
1588
1636
  }, formatMinutesToDDHHMM = (e) => {
1589
- const t = hooks.duration(e, "minutes"), n = Math.floor(t.asDays()), o = t.hours(), i = t.minutes();
1590
- let r = `${String(i).padStart(2, "0")}分`;
1591
- return o !== 0 && (r = `${String(o).padStart(2, "0")}时${r}`), n !== 0 && (r = `${String(n).padStart(2, "0")}天${r}`), r;
1637
+ const t = hooks.duration(e, "minutes"), n = Math.floor(t.asDays()), o = t.hours(), r = t.minutes();
1638
+ let i = `${String(r).padStart(2, "0")}分`;
1639
+ return o !== 0 && (i = `${String(o).padStart(2, "0")}时${i}`), n !== 0 && (i = `${String(n).padStart(2, "0")}天${i}`), i;
1592
1640
  }, _hoisted_1$3 = {
1593
1641
  key: 0,
1594
1642
  class: "more-tool-panel"
@@ -1603,105 +1651,105 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship")
1603
1651
  },
1604
1652
  emits: ["switchGreenDot", "switchMapTile"],
1605
1653
  setup(e, { emit: t }) {
1606
- var p, y;
1607
- const n = inject("mapInstance"), o = e, i = t, r = ref(((y = (p = n == null ? void 0 : n.value) == null ? void 0 : p.getView()) == null ? void 0 : y.getZoom()) || mapZoom.default), l = ref(!1), c = ref(null), s = ref(!0), d = () => {
1608
- o.disableGreenDot || r.value >= mapZoom.shipGreenDotMax || (s.value = !s.value, i("switchGreenDot", s.value));
1654
+ var p, f;
1655
+ const n = inject("mapInstance"), o = e, r = t, i = ref(((f = (p = n == null ? void 0 : n.value) == null ? void 0 : p.getView()) == null ? void 0 : f.getZoom()) || mapZoom.default), l = ref(!1), c = ref(null), s = ref(!0), m = () => {
1656
+ o.disableGreenDot || i.value >= mapZoom.shipGreenDotMax || (s.value = !s.value, r("switchGreenDot", s.value));
1657
+ }, d = () => {
1658
+ r("switchMapTile", o.mapTileMode === BaseMapType.vector ? BaseMapType.satellite : BaseMapType.vector);
1609
1659
  }, u = () => {
1610
- i("switchMapTile", o.mapTileMode === BaseMapType.vector ? BaseMapType.satellite : BaseMapType.vector);
1611
- }, m = () => {
1612
- var h, v;
1613
- l.value ? (showMeasure.value = !1, (h = c.value) == null || h.removeInteraction()) : (showMeasure.value = !0, (v = c.value) == null || v.addInteraction()), l.value = !l.value;
1614
- }, f = () => {
1615
- var h;
1616
- (h = c.value) == null || h.removeInteraction(), l.value = !1;
1660
+ var v, g;
1661
+ l.value ? (showMeasure.value = !1, (v = c.value) == null || v.removeInteraction()) : (showMeasure.value = !0, (g = c.value) == null || g.addInteraction()), l.value = !l.value;
1662
+ }, h = () => {
1663
+ var v;
1664
+ (v = c.value) == null || v.removeInteraction(), l.value = !1;
1617
1665
  };
1618
1666
  return onMounted(() => {
1619
1667
  nextTick(() => {
1620
- var h;
1621
- (h = n == null ? void 0 : n.value) == null || h.on("moveend", () => {
1622
- var M, S;
1623
- const v = (S = (M = n == null ? void 0 : n.value) == null ? void 0 : M.getView()) == null ? void 0 : S.getZoom();
1624
- v && (r.value = v);
1668
+ var v;
1669
+ (v = n == null ? void 0 : n.value) == null || v.on("moveend", () => {
1670
+ var L, S;
1671
+ const g = (S = (L = n == null ? void 0 : n.value) == null ? void 0 : L.getView()) == null ? void 0 : S.getZoom();
1672
+ g && (i.value = g);
1625
1673
  });
1626
1674
  });
1627
- }), (h, v) => (openBlock(), createElementBlock(Fragment, null, [
1675
+ }), (v, g) => (openBlock(), createElementBlock(Fragment, null, [
1628
1676
  createElementVNode("div", {
1629
- class: normalizeClass(`tool-panel ${h.viewMode}`)
1677
+ class: normalizeClass(`tool-panel ${v.viewMode}`)
1630
1678
  }, [
1631
- h.viewMode === "WxMiniprogram" ? (openBlock(), createElementBlock("div", _hoisted_1$3, [
1679
+ v.viewMode === "WxMiniprogram" ? (openBlock(), createElementBlock("div", _hoisted_1$3, [
1632
1680
  createElementVNode("div", _hoisted_2$1, [
1633
- h.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
1681
+ v.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
1634
1682
  key: 0,
1635
1683
  class: normalizeClass(["switch-btn", `${l.value && "active"}`]),
1636
- onClick: m
1637
- }, v[5] || (v[5] = [
1684
+ onClick: u
1685
+ }, g[5] || (g[5] = [
1638
1686
  createElementVNode("i", { class: "map-iconfont icon-measure" }, null, -1),
1639
1687
  createElementVNode("div", { class: "button-text" }, "测距", -1)
1640
1688
  ]), 2)) : createCommentVNode("", !0),
1641
- h.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
1689
+ v.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
1642
1690
  key: 1,
1643
- class: normalizeClass(`switch-btn ${s.value && "active"} ${(h.disableGreenDot || r.value >= unref(mapZoom).shipGreenDotMax) && "disabled"}`),
1644
- onClick: d
1645
- }, v[6] || (v[6] = [
1691
+ class: normalizeClass(`switch-btn ${s.value && "active"} ${(v.disableGreenDot || i.value >= unref(mapZoom).shipGreenDotMax) && "disabled"}`),
1692
+ onClick: m
1693
+ }, g[6] || (g[6] = [
1646
1694
  createElementVNode("i", { class: "map-iconfont icon-ship" }, null, -1),
1647
1695
  createElementVNode("div", { class: "button-text" }, "绿点", -1)
1648
1696
  ]), 2)) : createCommentVNode("", !0),
1649
- h.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
1697
+ v.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
1650
1698
  key: 2,
1651
- class: normalizeClass(`switch-btn ${h.mapTileMode === unref(BaseMapType).satellite && "active"}`),
1652
- onClick: v[0] || (v[0] = (M) => u())
1653
- }, v[7] || (v[7] = [
1699
+ class: normalizeClass(`switch-btn ${v.mapTileMode === unref(BaseMapType).satellite && "active"}`),
1700
+ onClick: g[0] || (g[0] = (L) => d())
1701
+ }, g[7] || (g[7] = [
1654
1702
  createElementVNode("i", { class: "map-iconfont icon-space" }, null, -1),
1655
1703
  createElementVNode("div", { class: "button-text" }, "图层", -1)
1656
1704
  ]), 2)) : createCommentVNode("", !0),
1657
- h.vehicleMode === "truck" ? (openBlock(), createElementBlock("div", {
1705
+ v.vehicleMode === "truck" ? (openBlock(), createElementBlock("div", {
1658
1706
  key: 3,
1659
- class: normalizeClass(`switch-btn ${h.mapTileMode === unref(BaseMapType).satellite && "active"}`),
1660
- onClick: v[1] || (v[1] = (M) => u())
1661
- }, v[8] || (v[8] = [
1707
+ class: normalizeClass(`switch-btn ${v.mapTileMode === unref(BaseMapType).satellite && "active"}`),
1708
+ onClick: g[1] || (g[1] = (L) => d())
1709
+ }, g[8] || (g[8] = [
1662
1710
  createElementVNode("i", { class: "map-iconfont icon-space" }, null, -1),
1663
1711
  createElementVNode("div", { class: "button-text" }, "卫星", -1)
1664
1712
  ]), 2)) : createCommentVNode("", !0),
1665
- h.showTrackLayer ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
1713
+ v.showTrackLayer ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
1666
1714
  createElementVNode("div", {
1667
1715
  class: "switch-btn multiple",
1668
- onClick: v[2] || (v[2] = (M) => unref(playTrack)(unref(currentTrackId), 1))
1669
- }, v[9] || (v[9] = [
1716
+ onClick: g[2] || (g[2] = (L) => unref(playTrack)(unref(currentTrackId), 1))
1717
+ }, g[9] || (g[9] = [
1670
1718
  createElementVNode("i", { class: "map-iconfont icon-play" }, null, -1),
1671
1719
  createElementVNode("div", { class: "button-text" }, "播放轨迹", -1)
1672
1720
  ])),
1673
1721
  createElementVNode("div", {
1674
1722
  class: "switch-btn multiple",
1675
- onClick: v[3] || (v[3] = (M) => unref(resetTrackView)())
1676
- }, v[10] || (v[10] = [
1723
+ onClick: g[3] || (g[3] = (L) => unref(resetTrackView)())
1724
+ }, g[10] || (g[10] = [
1677
1725
  createElementVNode("i", { class: "map-iconfont icon-center" }, null, -1),
1678
1726
  createElementVNode("div", { class: "button-text" }, "轨迹居中", -1)
1679
1727
  ]))
1680
1728
  ], 64)) : createCommentVNode("", !0),
1681
- renderSlot(h.$slots, "toolPanel", {}, void 0, !0)
1729
+ renderSlot(v.$slots, "toolPanel", {}, void 0, !0)
1682
1730
  ])
1683
1731
  ])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
1684
- h.vehicleMode === "ship" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
1732
+ v.vehicleMode === "ship" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
1685
1733
  createElementVNode("div", {
1686
1734
  class: normalizeClass(["switch-btn", `${l.value && "active"}`]),
1687
- onClick: m
1688
- }, v[11] || (v[11] = [
1735
+ onClick: u
1736
+ }, g[11] || (g[11] = [
1689
1737
  createElementVNode("i", { class: "map-iconfont icon-measure" }, null, -1),
1690
1738
  createElementVNode("div", { class: "button-text" }, "测距", -1)
1691
1739
  ]), 2),
1692
- h.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
1740
+ v.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
1693
1741
  key: 0,
1694
- class: normalizeClass(`switch-btn ${s.value && "active"} ${(h.disableGreenDot || r.value >= unref(mapZoom).shipGreenDotMax) && "disabled"}`),
1695
- onClick: d
1696
- }, v[12] || (v[12] = [
1742
+ class: normalizeClass(`switch-btn ${s.value && "active"} ${(v.disableGreenDot || i.value >= unref(mapZoom).shipGreenDotMax) && "disabled"}`),
1743
+ onClick: m
1744
+ }, g[12] || (g[12] = [
1697
1745
  createElementVNode("i", { class: "map-iconfont icon-ship" }, null, -1),
1698
1746
  createElementVNode("div", { class: "button-text" }, "绿点", -1)
1699
1747
  ]), 2)) : createCommentVNode("", !0)
1700
1748
  ], 64)) : createCommentVNode("", !0),
1701
1749
  createElementVNode("div", {
1702
- class: normalizeClass(["switch-btn", { active: h.mapTileMode === unref(BaseMapType).satellite }]),
1703
- onClick: u
1704
- }, v[13] || (v[13] = [
1750
+ class: normalizeClass(["switch-btn", { active: v.mapTileMode === unref(BaseMapType).satellite }]),
1751
+ onClick: d
1752
+ }, g[13] || (g[13] = [
1705
1753
  createElementVNode("i", { class: "map-iconfont icon-space" }, null, -1),
1706
1754
  createElementVNode("div", { class: "button-text" }, "卫星", -1)
1707
1755
  ]), 2)
@@ -1713,9 +1761,9 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship")
1713
1761
  ref_key: "measureRef",
1714
1762
  ref: c,
1715
1763
  visible: l.value,
1716
- "onUpdate:visible": v[4] || (v[4] = (M) => l.value = M),
1717
- onClose: f,
1718
- "view-mode": h.viewMode
1764
+ "onUpdate:visible": g[4] || (g[4] = (L) => l.value = L),
1765
+ onClose: h,
1766
+ "view-mode": v.viewMode
1719
1767
  }, null, 8, ["visible", "view-mode"])) : createCommentVNode("", !0)
1720
1768
  ])
1721
1769
  ], 64));
@@ -1725,15 +1773,15 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship")
1725
1773
  setup(e, { expose: t }) {
1726
1774
  const n = inject("mapInstance");
1727
1775
  return t({
1728
- setScaleLine: (i) => {
1776
+ setScaleLine: (r) => {
1729
1777
  var c;
1730
- i || (i = "metric");
1731
- const r = new ScaleLine$1({
1732
- units: i
1778
+ r || (r = "metric");
1779
+ const i = new ScaleLine$1({
1780
+ units: r
1733
1781
  }), l = document.getElementById("scale-line-container");
1734
- l && (r.setTarget(l), (c = n == null ? void 0 : n.value) == null || c.addControl(r));
1782
+ l && (i.setTarget(l), (c = n == null ? void 0 : n.value) == null || c.addControl(i));
1735
1783
  }
1736
- }), (i, r) => (openBlock(), createElementBlock("div", _hoisted_1$2));
1784
+ }), (r, i) => (openBlock(), createElementBlock("div", _hoisted_1$2));
1737
1785
  }
1738
1786
  }), ScaleLine = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-d666f80d"]]), _hoisted_1$1 = { class: "zoom" }, _sfc_main$2 = /* @__PURE__ */ defineComponent({
1739
1787
  __name: "zoomControl",
@@ -1745,14 +1793,14 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship")
1745
1793
  setup(e) {
1746
1794
  const t = inject("mapInstance"), n = () => {
1747
1795
  if (!t.value) return;
1748
- const i = t.value.getView(), r = i.getZoom();
1749
- r && i.setZoom(r + 1);
1796
+ const r = t.value.getView(), i = r.getZoom();
1797
+ i && r.setZoom(i + 1);
1750
1798
  }, o = () => {
1751
1799
  if (!t.value) return;
1752
- const i = t.value.getView(), r = i.getZoom();
1753
- r && i.setZoom(r - 1);
1800
+ const r = t.value.getView(), i = r.getZoom();
1801
+ i && r.setZoom(i - 1);
1754
1802
  };
1755
- return (i, r) => (openBlock(), createElementBlock("div", _hoisted_1$1, [
1803
+ return (r, i) => (openBlock(), createElementBlock("div", _hoisted_1$1, [
1756
1804
  createElementVNode("div", {
1757
1805
  onClick: n,
1758
1806
  class: "button big-button"
@@ -1770,11 +1818,11 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship")
1770
1818
  mapTile: { default: BaseMapType.satellite }
1771
1819
  },
1772
1820
  setup(e) {
1773
- useCssVars((r) => ({
1774
- ae2bbc28: i.value
1821
+ useCssVars((i) => ({
1822
+ "0d38823b": r.value
1775
1823
  }));
1776
- const t = e, n = computed(() => t.type === COPY_RIGHT_TYPE.HORIZONTAL ? "map/tdt-copyright-h.svg" : `map/tdt-copyright-v${t.mapTile === BaseMapType.satellite ? "-w" : ""}.svg`), o = computed(() => t.type === COPY_RIGHT_TYPE.HORIZONTAL ? "400px" : "168px"), i = computed(() => t.type === COPY_RIGHT_TYPE.HORIZONTAL ? "auto auto 0 5px" : "0 auto auto 5px");
1777
- return (r, l) => (openBlock(), createElementBlock("div", _hoisted_1, [
1824
+ const t = e, n = computed(() => t.type === COPY_RIGHT_TYPE.HORIZONTAL ? `map/tdt-copyright-h${t.mapTile === BaseMapType.satellite ? "-w" : ""}.svg` : `map/tdt-copyright-v${t.mapTile === BaseMapType.satellite ? "-w" : ""}.svg`), o = computed(() => t.type === COPY_RIGHT_TYPE.HORIZONTAL ? "400px" : "168px"), r = computed(() => t.type === COPY_RIGHT_TYPE.HORIZONTAL ? "auto auto 0 5px" : "0 auto auto 5px");
1825
+ return (i, l) => (openBlock(), createElementBlock("div", _hoisted_1, [
1778
1826
  createElementVNode("img", {
1779
1827
  src: unref(CDN_URL) + n.value,
1780
1828
  width: o.value,
@@ -1783,12 +1831,12 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship")
1783
1831
  }, null, 8, _hoisted_2)
1784
1832
  ]));
1785
1833
  }
1786
- }), Copyright = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-ff542401"]]), dotImage$1 = new Image();
1787
- dotImage$1.src = `${CDN_URL}/map/truck-dot.svg`;
1788
- dotImage$1.crossOrigin = "anonymous";
1789
- const dotActiveImage$1 = new Image();
1790
- dotActiveImage$1.src = `${CDN_URL}/map/truck-dot-active.svg`;
1791
- dotActiveImage$1.crossOrigin = "anonymous";
1834
+ }), Copyright = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-15a296ba"]]), dotImage = new Image();
1835
+ dotImage.src = `${CDN_URL}/map/truck-dot.svg`;
1836
+ dotImage.crossOrigin = "anonymous";
1837
+ const dotActiveImage = new Image();
1838
+ dotActiveImage.src = `${CDN_URL}/map/truck-dot-active.svg`;
1839
+ dotActiveImage.crossOrigin = "anonymous";
1792
1840
  const cameraImage = new Image();
1793
1841
  cameraImage.src = `${CDN_URL}/map/map-camera.svg`;
1794
1842
  cameraImage.crossOrigin = "anonymous";
@@ -1796,30 +1844,30 @@ const loadImage = new Image();
1796
1844
  loadImage.src = `${CDN_URL}/map/map-load.svg`;
1797
1845
  loadImage.crossOrigin = "anonymous";
1798
1846
  const setTruckStyle = (e, t, n, o) => new Style({
1799
- renderer: (i, r) => {
1800
- const l = r.context;
1847
+ renderer: (r, i) => {
1848
+ const l = i.context;
1801
1849
  l.save();
1802
1850
  let c = 1;
1803
1851
  l.scale(c, c);
1804
- let [s, d] = i;
1805
- s = Number(s) / c - 20, d = Number(d) / c;
1806
- const u = s - 70, m = d - 68;
1807
- let f = 180;
1808
- const p = 56, y = "#FFFFFF";
1809
- let h = 176;
1810
- const v = 52;
1811
- let M = "#164AFF", S = "#FFFFFF";
1812
- n === CAR_COLOR.YELLOW ? (h = 176, M = "#FFC81E", S = "rgba(0,0,0,0.88)") : n === CAR_COLOR.Y_GREEN && (f = 200, h = 196, M = "#8FED7C", S = "rgba(0,0,0,0.88)"), o != null && o.length && (f += o.length * 56), fillRectRadius(l, u, m, f, p, y), fillRectRadius(l, u + 2, m + 2, h, v, M), n === CAR_COLOR.Y_GREEN && fillRectRadius(l, u + 2, m + 2, 68, v, "#FFC81E"), l.save(), l.restore(), l.fillStyle = S, l.font = "bold 28px Arial", l.textAlign = "left", l.textBaseline = "middle";
1813
- const V = `${t.slice(0, 2) + " · " + t.slice(2)}`;
1814
- if (l.fillText(V, u + 12, m + 32), l.save(), l.restore(), o != null && o.length) {
1815
- const P = l.measureText(V).width + 12;
1816
- let x = 0;
1817
- o.forEach((g) => {
1818
- g === DEVICE_TYPE.CAMERA && (l.drawImage(cameraImage, s - 54 + P + x * 56, d - 64, 50, 50), ++x), g === DEVICE_TYPE.LOAD && (l.drawImage(loadImage, s - 54 + P + x * 56, d - 64, 50, 50), ++x);
1852
+ let [s, m] = r;
1853
+ s = Number(s) / c - 20, m = Number(m) / c;
1854
+ const d = s - 70, u = m - 68;
1855
+ let h = 180;
1856
+ const p = 56, f = "#FFFFFF";
1857
+ let v = 176;
1858
+ const g = 52;
1859
+ let L = "#164AFF", S = "#FFFFFF";
1860
+ n === CAR_COLOR.YELLOW ? (v = 176, L = "#FFC81E", S = "rgba(0,0,0,0.88)") : n === CAR_COLOR.Y_GREEN && (h = 200, v = 196, L = "#8FED7C", S = "rgba(0,0,0,0.88)"), o != null && o.length && (h += o.length * 56), fillRectRadius(l, d, u, h, p, f), fillRectRadius(l, d + 2, u + 2, v, g, L), n === CAR_COLOR.Y_GREEN && fillRectRadius(l, d + 2, u + 2, 68, g, "#FFC81E"), l.save(), l.restore(), l.fillStyle = S, l.font = "bold 28px Arial", l.textAlign = "left", l.textBaseline = "middle";
1861
+ const I = `${t.slice(0, 2) + " · " + t.slice(2)}`;
1862
+ if (l.fillText(I, d + 12, u + 32), l.save(), l.restore(), o != null && o.length) {
1863
+ const x = l.measureText(I).width + 12;
1864
+ let P = 0;
1865
+ o.forEach(($) => {
1866
+ $ === DEVICE_TYPE.CAMERA && (l.drawImage(cameraImage, s - 54 + x + P * 56, m - 64, 50, 50), ++P), $ === DEVICE_TYPE.LOAD && (l.drawImage(loadImage, s - 54 + x + P * 56, m - 64, 50, 50), ++P);
1819
1867
  });
1820
1868
  }
1821
- const C = dotImage$1;
1822
- l.drawImage(C, s + f / 2 - 90, d, 50 / c, 50 / c), l.restore();
1869
+ const F = dotImage;
1870
+ l.drawImage(F, s + h / 2 - 90, m, 50 / c, 50 / c), l.restore();
1823
1871
  }
1824
1872
  }), mapInstance$2 = ref(), renderDashboardSetInstance = (e) => mapInstance$2.value = e;
1825
1873
  ref([]);
@@ -1850,29 +1898,29 @@ const renderTrucksMarker = (e) => {
1850
1898
  if (!mapInstance$1.value || (focusShipData.value = e, !(e != null && e.lon && (e != null && e.lat)))) return;
1851
1899
  const n = Math.abs(Number(e.lon)) > 180 ? formatUtils.convertSixHundredThousandToLatLng(e.lon, e.lat) : [e.lon, e.lat], o = mapInstance$1.value.getPixelFromCoordinate(transform(n, projection.data, projection.mercator));
1852
1900
  currentTruckOverlay.value = e ? drawTruckIcon(e.vno, o, (e == null ? void 0 : e.drc) ?? "", t) ?? null : null;
1853
- const i = mapInstance$1.value.getView(), r = new Point(n);
1854
- i.setCenter(transform(r.getCoordinates(), projection.data, projection.mercator));
1901
+ const r = mapInstance$1.value.getView(), i = new Point(n);
1902
+ r.setCenter(transform(i.getCoordinates(), projection.data, projection.mercator));
1855
1903
  }, clearAllTruck = () => {
1856
1904
  vehicle.value.clearAllShip();
1857
1905
  }, drawTruckIcon = (e, t, n, o) => {
1858
- let i = `<div id="${e}" class="ol-custom-content truck-custom-content" style="width: 80px; height: 80px; transform: rotate(${n}deg);">
1906
+ let r = `<div id="${e}" class="ol-custom-content truck-custom-content" style="width: 80px; height: 80px; transform: rotate(${n}deg);">
1859
1907
  <img src="${CDN_URL}map/car-icon.gif" width="100%" height="100%" />
1860
1908
  </div>`;
1861
- return o && (i += o), drawCustomContent(e, t, i, "center-center");
1909
+ return o && (r += o), drawCustomContent(e, t, r, "center-center");
1862
1910
  }, removeTruckIcon = () => {
1863
1911
  var t;
1864
1912
  const e = (t = currentTruckOverlay.value) == null ? void 0 : t.getElement();
1865
1913
  e && (e.innerHTML = "");
1866
1914
  }, zoomTruckIcon = () => {
1867
- var r;
1915
+ var i;
1868
1916
  if (!mapInstance$1.value) return;
1869
1917
  const e = mapInstance$1.value.getView().getZoom(), t = 120, n = 60;
1870
1918
  function o(l) {
1871
1919
  return l < 14 ? n : l >= 14 && l <= 18 ? Math.round((l - 14) * (t - n) / 4 + n) : t;
1872
1920
  }
1873
- const i = o(e);
1874
- (r = document.querySelectorAll(".truck-custom-content")) == null || r.forEach((l) => {
1875
- l.style.width = `${i}px`, l.style.height = `${i}px`;
1921
+ const r = o(e);
1922
+ (i = document.querySelectorAll(".truck-custom-content")) == null || i.forEach((l) => {
1923
+ l.style.width = `${r}px`, l.style.height = `${r}px`;
1876
1924
  });
1877
1925
  }, mapInstance = ref(), drawPolygonSetInstance = (e) => mapInstance.value = e;
1878
1926
  let layerState = "drawn", drawnState = "undrawn";
@@ -1918,12 +1966,12 @@ function createHelpTooltip() {
1918
1966
  }
1919
1967
  let squareLimitError = !1, lineLimitError = !1;
1920
1968
  const validateSquareLimit = (e) => {
1921
- let n = 1 / 0, o = -1 / 0, i = 1 / 0, r = -1 / 0;
1969
+ let n = 1 / 0, o = -1 / 0, r = 1 / 0, i = -1 / 0;
1922
1970
  e == null || e.forEach((s) => {
1923
- const d = transform(s, projection.mercator, projection.data), u = d[0], m = d[1];
1924
- n = Math.min(n, m), o = Math.max(o, m), i = Math.min(i, u), r = Math.max(r, u);
1971
+ const m = transform(s, projection.mercator, projection.data), d = m[0], u = m[1];
1972
+ n = Math.min(n, u), o = Math.max(o, u), r = Math.min(r, d), i = Math.max(i, d);
1925
1973
  });
1926
- const l = (o - n) * 111, c = (r - i) * 111;
1974
+ const l = (o - n) * 111, c = (i - r) * 111;
1927
1975
  squareLimitError = l > 150 || c > 150;
1928
1976
  };
1929
1977
  let storeFeature, callbackFunction = null;
@@ -1936,40 +1984,40 @@ const addInteraction = (e) => {
1936
1984
  style: [drawPolygonStyle.drawing, circleStyle]
1937
1985
  }), (o = mapInstance.value) == null || o.addInteraction(draw), createMeasureTooltip(), createHelpTooltip();
1938
1986
  let t;
1939
- draw.on("drawstart", function(i) {
1940
- var r;
1941
- layerState = "drawn", sketch = i.feature, t = (r = sketch.getGeometry()) == null ? void 0 : r.on("change", function(l) {
1942
- const c = l.target, s = formatUtils.formatArea(c, LENGTH_UNIT.NM), u = c.getCoordinates()[0], m = new LineString([u[u.length - 2], u[u.length - 1]]), f = formatUtils.formatLength(m, LENGTH_UNIT.NM);
1943
- if (lineLimitError = Number(getLength(m) / 1e3) > 150, validateSquareLimit(u), measureTooltipElement && s && (measureTooltipElement.innerHTML = `
1987
+ draw.on("drawstart", function(r) {
1988
+ var i;
1989
+ layerState = "drawn", sketch = r.feature, t = (i = sketch.getGeometry()) == null ? void 0 : i.on("change", function(l) {
1990
+ const c = l.target, s = formatUtils.formatArea(c, LENGTH_UNIT.NM), d = c.getCoordinates()[0], u = new LineString([d[d.length - 2], d[d.length - 1]]), h = formatUtils.formatLength(u, LENGTH_UNIT.NM);
1991
+ if (lineLimitError = Number(getLength(u) / 1e3) > 150, validateSquareLimit(d), measureTooltipElement && s && (measureTooltipElement.innerHTML = `
1944
1992
  <span class="text">面积:${s}${lineLimitError || squareLimitError ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
1945
1993
  `), helpTooltipElement && s) {
1946
1994
  let p = "";
1947
1995
  parseFloat(s) > 0 && (p = `
1948
1996
  <div class="text ${squareLimitError ? "error" : ""}">面积:${s}${squareLimitError ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</div>`), helpTooltipElement.innerHTML = `${p}
1949
- <span class="text ${lineLimitError ? "error" : ""}">线段${u.length - 2}:${f}${lineLimitError ? '<span class="error pl-4">超出可以绘画的距离</span>' : ""}</span>
1997
+ <span class="text ${lineLimitError ? "error" : ""}">线段${d.length - 2}:${h}${lineLimitError ? '<span class="error pl-4">超出可以绘画的距离</span>' : ""}</span>
1950
1998
  <div><span class="text">单击继续,双击结束</span></div>
1951
1999
  `;
1952
2000
  }
1953
2001
  }), drawnState = "drawing";
1954
- }), draw.on("drawend", function(i) {
1955
- if (i.feature.getGeometry()) {
1956
- storeFeature = i.feature;
1957
- const r = endFn(i.feature);
1958
- r != null && r.length && callbackFunction && callbackFunction(r);
2002
+ }), draw.on("drawend", function(r) {
2003
+ if (r.feature.getGeometry()) {
2004
+ storeFeature = r.feature;
2005
+ const i = endFn(r.feature);
2006
+ i != null && i.length && callbackFunction && callbackFunction(i);
1959
2007
  }
1960
2008
  if (sketch = null, measureTooltipElement = null, createMeasureTooltip(), t && unByKey(t), drawnState = "drawend", draw && mapInstance.value) {
1961
- const r = mapInstance.value.getInteractions().getArray().find((l) => getUid(l) === getUid(draw));
1962
- r && mapInstance.value.removeInteraction(r), helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement);
2009
+ const i = mapInstance.value.getInteractions().getArray().find((l) => getUid(l) === getUid(draw));
2010
+ i && mapInstance.value.removeInteraction(i), helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement);
1963
2011
  }
1964
2012
  });
1965
2013
  }, removeInteraction = () => {
1966
2014
  var e, t, n;
1967
2015
  if (mapInstance.value) {
1968
2016
  if (document.querySelectorAll(".ol-tooltip.ol-tooltip-draw-polygon").forEach((o) => {
1969
- var i;
1970
- (i = o == null ? void 0 : o.parentNode) == null || i.removeChild(o);
2017
+ var r;
2018
+ (r = o == null ? void 0 : o.parentNode) == null || r.removeChild(o);
1971
2019
  }), 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) {
1972
- const o = mapInstance.value.getInteractions().getArray().find((i) => getUid(i) === getUid(draw));
2020
+ const o = mapInstance.value.getInteractions().getArray().find((r) => getUid(r) === getUid(draw));
1973
2021
  o && ((n = mapInstance.value) == null || n.removeInteraction(o));
1974
2022
  }
1975
2023
  drawnState = "undrawn", layerState = "destroyed";
@@ -1977,15 +2025,15 @@ const addInteraction = (e) => {
1977
2025
  }, endFn = (e) => {
1978
2026
  var t, n, o;
1979
2027
  if (e.getGeometry()) {
1980
- const i = [], l = e.getGeometry().getCoordinates();
2028
+ const r = [], l = e.getGeometry().getCoordinates();
1981
2029
  (t = l[0]) == null || t.forEach((s) => {
1982
- i.push(transform(s, projection.mercator, projection.data));
2030
+ r.push(transform(s, projection.mercator, projection.data));
1983
2031
  });
1984
2032
  const c = l[0][l[0].length - 2];
1985
2033
  if (c && measureTooltip.setPosition(c), measureTooltip.setOffset([10, 0]), measureTooltipElement && (measureTooltipElement.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), (n = document.querySelector(".delete-icon")) == null || n.addEventListener("click", () => {
1986
2034
  reset();
1987
2035
  }), !lineLimitError && !squareLimitError)
1988
- return i;
2036
+ return r;
1989
2037
  draw && ((o = mapInstance.value) == null || o.removeInteraction(draw)), helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement);
1990
2038
  }
1991
2039
  }, initFeature = (e) => {
@@ -1993,12 +2041,12 @@ const addInteraction = (e) => {
1993
2041
  if (e && (callbackFunction = e), layerState = "drawn", storeFeature) {
1994
2042
  const o = storeFeature.getGeometry();
1995
2043
  if (!o) return;
1996
- const i = formatUtils.formatArea(o, LENGTH_UNIT.NM);
2044
+ const r = formatUtils.formatArea(o, LENGTH_UNIT.NM);
1997
2045
  measureTooltipElement && (measureTooltipElement.innerHTML = `
1998
- <span class="text">面积:${i}${lineLimitError || squareLimitError ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
2046
+ <span class="text">面积:${r}${lineLimitError || squareLimitError ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
1999
2047
  `), (t = drawVector.getSource()) == null || t.addFeature(storeFeature);
2000
- const r = endFn(storeFeature);
2001
- r != null && r.length && callbackFunction && callbackFunction(r);
2048
+ const i = endFn(storeFeature);
2049
+ i != null && i.length && callbackFunction && callbackFunction(i);
2002
2050
  const l = getCenter(storeFeature.getGeometry().getExtent());
2003
2051
  (n = mapInstance.value) == null || n.getView().setCenter(l);
2004
2052
  }
@@ -2036,28 +2084,28 @@ const addInteraction = (e) => {
2036
2084
  removeInteraction,
2037
2085
  initFeature,
2038
2086
  reset
2039
- }, dotImage = new Image();
2040
- dotImage.crossOrigin = "anonymous";
2041
- const dotActiveImage = new Image();
2042
- dotActiveImage.crossOrigin = "anonymous";
2043
- const setPointStyle = (e, t, n) => {
2044
- const { color: o, url: i, activeUrl: r, activeColor: l } = n;
2045
- return (r || i) && (e ? dotActiveImage.src = CDN_URL + (r || i) : dotImage.src = CDN_URL + (i || r)), new Style({
2046
- renderer: (c, s) => {
2047
- const d = s.context;
2048
- d.save();
2049
- const u = window.devicePixelRatio || 1;
2050
- let [m, f] = c;
2051
- if (m = Number(m), f = Number(f), t) {
2052
- d.font = `${12 * u}px Arial`;
2053
- const p = d.measureText(t).width, y = m - p / 2 - (u <= 1 ? 8 : u), h = f + 6 * u, v = p + 4, M = 16 * u, S = e && l || o;
2054
- fillRectRadius(d, y, h + 13 * u, v, M, S), d.save(), d.restore(), d.fillStyle = e ? "#FFFFFF" : "#000000", d.textAlign = "center", d.textBaseline = "middle", d.fillText(t, y + (p + 4) / 2, h + 22 * u), d.save(), d.restore();
2087
+ }, setPointStyle = (e, t, n) => {
2088
+ const o = new Image();
2089
+ o.crossOrigin = "anonymous";
2090
+ const r = new Image();
2091
+ r.crossOrigin = "anonymous";
2092
+ const { color: i, url: l, activeUrl: c, activeColor: s, imgWidth: m, imgHeight: d } = n;
2093
+ return (c || l) && (e ? r.src = CDN_URL + (c || l) : o.src = CDN_URL + (l || c)), new Style({
2094
+ renderer: (u, h) => {
2095
+ const p = h.context;
2096
+ p.save();
2097
+ const f = window.devicePixelRatio || 1;
2098
+ let [v, g] = u;
2099
+ if (v = Number(v), g = Number(g), t) {
2100
+ p.font = `${12 * f}px Arial`;
2101
+ const L = p.measureText(t).width, S = v - L / 2 - (f <= 1 ? 8 : f), I = g + 6 * f, F = L + 4, x = 16 * f, P = e && s || i;
2102
+ fillRectRadius(p, S, I + (f <= 1 ? 6 : 13 * f), F, x, P), p.save(), p.restore(), p.fillStyle = e ? "#FFFFFF" : "#000000", p.textAlign = "center", p.textBaseline = "middle", p.fillText(t, S + (L + 4) / 2, I + (f <= 1 ? 16 : 22 * f)), p.save(), p.restore();
2055
2103
  }
2056
- if (i || r) {
2057
- const p = e ? dotActiveImage : dotImage;
2058
- d.drawImage(p, m - p.width / 2, f - p.height / 2, 30 * u, 30 * u);
2104
+ if (l || c) {
2105
+ const L = e ? r : o;
2106
+ p.drawImage(L, v - (m || L.width) / 2, g - (d || L.height) / 2, 30 * f, 30 * f);
2059
2107
  }
2060
- d.restore();
2108
+ p.restore();
2061
2109
  }
2062
2110
  });
2063
2111
  };
@@ -2081,11 +2129,11 @@ class PointMarkerClass {
2081
2129
  b(this, "options");
2082
2130
  // 使用坐标点区域自动缩放地图层级
2083
2131
  b(this, "resetPointsView", (t) => {
2084
- var r;
2132
+ var i;
2085
2133
  if (!this.mapInstance || t.length === 0) return;
2086
- const n = (r = this.mapInstance) == null ? void 0 : r.getView();
2134
+ const n = (i = this.mapInstance) == null ? void 0 : i.getView();
2087
2135
  if (!n) return;
2088
- const i = t.map(
2136
+ const r = t.map(
2089
2137
  (l) => transform(l, projection.data, projection.mercator)
2090
2138
  ).reduce((l, c) => [
2091
2139
  Math.min(l[0], c[0]),
@@ -2094,7 +2142,7 @@ class PointMarkerClass {
2094
2142
  Math.max(l[3], c[1])
2095
2143
  ], [1 / 0, 1 / 0, -1 / 0, -1 / 0]);
2096
2144
  try {
2097
- const l = buffer(i, Math.max(i[2] - i[0], i[3] - i[1]) * 0.02);
2145
+ const l = buffer(r, Math.max(r[2] - r[0], r[3] - r[1]) * 0.02);
2098
2146
  n.fit(l);
2099
2147
  } catch (l) {
2100
2148
  console.error("Failed to zoom to points:", l);
@@ -2121,9 +2169,9 @@ class PointMarkerClass {
2121
2169
  if (!this.mapInstance) return;
2122
2170
  let n = {};
2123
2171
  t.forEach((o) => {
2124
- var r;
2125
- const i = [o.lon, o.lat];
2126
- if (((r = this.highlightPoint) == null ? void 0 : r.id) === o.id)
2172
+ var i;
2173
+ const r = [o.lon, o.lat];
2174
+ if (((i = this.highlightPoint) == null ? void 0 : i.id) === o.id)
2127
2175
  n = {
2128
2176
  id: o.id,
2129
2177
  name: o.name,
@@ -2131,7 +2179,7 @@ class PointMarkerClass {
2131
2179
  pointType: o.pointType
2132
2180
  };
2133
2181
  else {
2134
- const l = this.getFeature(o, i);
2182
+ const l = this.getFeature(o, r);
2135
2183
  this.pointMarkerList.push({
2136
2184
  id: o.id,
2137
2185
  name: o.name,
@@ -2182,23 +2230,23 @@ class PointMarkerClass {
2182
2230
  */
2183
2231
  highlightPointMarker(t) {
2184
2232
  if (!this.mapInstance) return;
2185
- const { id: n, name: o, fullName: i, lon: r, lat: l, pointType: c } = t, s = [Number(r), Number(l)];
2233
+ const { id: n, name: o, fullName: r, lon: i, lat: l, pointType: c } = t, s = [Number(i), Number(l)];
2186
2234
  this.highlightPoint = {
2187
2235
  id: n,
2188
2236
  name: o,
2189
- fullName: i,
2237
+ fullName: r,
2190
2238
  lonlat: s,
2191
2239
  pointType: c
2192
2240
  }, this.setPointCenter(s);
2193
2241
  }
2194
2242
  // 获取feature
2195
2243
  getFeature(t, n) {
2196
- var i;
2244
+ var r;
2197
2245
  const o = new Feature({
2198
2246
  geometry: new Point(fromLonLat(n))
2199
2247
  });
2200
2248
  return o.set("data", t), o.setStyle(
2201
- setPointStyle(((i = this.highlightPoint) == null ? void 0 : i.id) === t.id, t.name, this.options)
2249
+ setPointStyle(((r = this.highlightPoint) == null ? void 0 : r.id) === t.id, t.name, this.options)
2202
2250
  ), o;
2203
2251
  }
2204
2252
  /**
@@ -2211,10 +2259,10 @@ class PointMarkerClass {
2211
2259
  */
2212
2260
  setPointCenter(t, n = { customZoom: mapZoom.findShip, type: 1 }) {
2213
2261
  if (!this.mapInstance) return;
2214
- const { customZoom: o = mapZoom.findShip, type: i = 1 } = n, r = this.mapInstance.getView(), l = r.getZoom();
2215
- (i === 1 || l > o && i === 2 || l < o && i === 3) && r.setZoom(o);
2262
+ const { customZoom: o = mapZoom.findShip, type: r = 1 } = n, i = this.mapInstance.getView(), l = i.getZoom();
2263
+ (r === 1 || l > o && r === 2 || l < o && r === 3) && i.setZoom(o);
2216
2264
  const c = new Point(t);
2217
- r.setCenter(transform(c.getCoordinates(), projection.data, projection.mercator));
2265
+ i.setCenter(transform(c.getCoordinates(), projection.data, projection.mercator));
2218
2266
  }
2219
2267
  }
2220
2268
  const _sfc_main = /* @__PURE__ */ defineComponent({
@@ -2226,21 +2274,22 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2226
2274
  viewMode: {},
2227
2275
  mmsi: {},
2228
2276
  shipData: {},
2229
- logoType: {}
2277
+ logoType: {},
2278
+ showToolPanel: { type: Boolean }
2230
2279
  },
2231
2280
  emits: ["zoomChanged", "extentChanged"],
2232
2281
  setup(e, { expose: t, emit: n }) {
2233
2282
  const o = ref();
2234
2283
  provide("mapInstance", o);
2235
- const i = ref(null), r = ref(null), l = ref(null), c = n, s = e, d = ref(s.zoom || mapZoom.default), u = ref(!1), m = ref(!0), f = ref(!0), p = {
2284
+ const r = ref(null), i = ref(null), l = ref(null), c = n, s = e, m = ref(s.zoom || mapZoom.default), d = ref(!1), u = ref(!0), h = ref(!0), p = ref(!0), f = {
2236
2285
  tiandituTile: new TileLayer({ source: new XYZ({ url: baseMap.tiandituTile }) }),
2237
2286
  tiandituTileMark: new TileLayer({ source: new XYZ({ url: baseMap.tiandituTileMark }) }),
2238
2287
  tiandituImgTile: new TileLayer({ source: new XYZ({ url: baseMap.tiandituImgTile }), visible: !1 }),
2239
2288
  tiandituImgTileMark: new TileLayer({ source: new XYZ({ url: baseMap.tiandituImgTileMark }), visible: !1 }),
2240
2289
  greenMark: new TileLayer({ source: new XYZ({ url: baseMap.greenTile }) })
2241
- }, y = () => {
2242
- var w, L;
2243
- const g = {
2290
+ }, v = () => {
2291
+ var w, k;
2292
+ const y = {
2244
2293
  projection: projection.mercator,
2245
2294
  // 地图投影坐标系
2246
2295
  zoom: s.zoom || (s.vehicleMode === "ship" ? mapZoom.default : mapZoom.truckDefault),
@@ -2262,106 +2311,107 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2262
2311
  // 对应页面里 id 为 map 的元素
2263
2312
  layers: [
2264
2313
  // 图层
2265
- p.tiandituTile,
2266
- p.tiandituTileMark,
2267
- p.tiandituImgTile,
2268
- p.tiandituImgTileMark,
2269
- p.greenMark
2314
+ f.tiandituTile,
2315
+ f.tiandituTileMark,
2316
+ f.tiandituImgTile,
2317
+ f.tiandituImgTileMark,
2318
+ f.greenMark
2270
2319
  ],
2271
- view: new View(g)
2272
- }), h(), (w = r.value) == null || w.setScaleLine(s.vehicleMode === "ship" ? "nautical" : "metric"), (L = o.value) == null || L.on("moveend", V), v(g.zoom < mapZoom.shipGreenDotMax), S(s.vehicleMode === "ship" || s.viewMode === "findShip" ? BaseMapType.satellite : BaseMapType.vector), s.viewMode === "findShip" && s.mmsi && s.shipData && nextTick(() => {
2320
+ view: new View(y)
2321
+ }), g(), s.showToolPanel === void 0 ? p.value = !0 : p.value = s.showToolPanel, (w = i.value) == null || w.setScaleLine(s.vehicleMode === "ship" ? "nautical" : "metric"), (k = o.value) == null || k.on("moveend", F), L(y.zoom < mapZoom.shipGreenDotMax), I(s.vehicleMode === "ship" || s.viewMode === "findShip" ? BaseMapType.satellite : BaseMapType.vector), s.viewMode === "findShip" && s.mmsi && s.shipData && nextTick(() => {
2273
2322
  findShip(String(s.mmsi), s.shipData);
2274
2323
  }), onShipsMarkerHover();
2275
2324
  };
2276
2325
  onMounted(() => {
2277
- y();
2326
+ v();
2278
2327
  });
2279
- const h = () => {
2328
+ const g = () => {
2280
2329
  o.value && (renderCustomOverlaySetInstance(o.value), renderTruckSetInstance(o.value), drawPolygonSetInstance(o.value), renderShipStyleSetInstance(o.value), renderTrackStyleSetInstance(o.value), renderDashboardSetInstance(o.value), renderMarkerSetInstance(o.value), renderShipSetInstance(o.value), renderTrackSetInstance(o.value));
2281
- }, v = (g) => {
2330
+ }, L = (y) => {
2282
2331
  var w;
2283
- s.vehicleMode !== "ship" && (g = !1), (w = o.value) == null || w.getLayers().forEach((L) => {
2284
- getUid(L) === getUid(p.greenMark) && (L.setVisible(g), m.value = g);
2332
+ s.vehicleMode !== "ship" && (y = !1), (w = o.value) == null || w.getLayers().forEach((k) => {
2333
+ getUid(k) === getUid(f.greenMark) && (k.setVisible(y), u.value = y);
2285
2334
  });
2286
- }, M = ref(BaseMapType.satellite), S = (g) => {
2335
+ }, S = ref(BaseMapType.satellite), I = (y) => {
2287
2336
  var w;
2288
- M.value = g, (w = o.value) == null || w.getLayers().forEach((L) => {
2289
- (getUid(L) === getUid(p.tiandituTile) || getUid(L) === getUid(p.tiandituTileMark) || getUid(L) === getUid(p.tiandituImgTile) || getUid(L) === getUid(p.tiandituImgTileMark)) && L.setVisible(!1), (g === BaseMapType.vector && (getUid(L) === getUid(p.tiandituTile) || getUid(L) === getUid(p.tiandituTileMark)) || g === BaseMapType.satellite && (getUid(L) === getUid(p.tiandituImgTile) || getUid(L) === getUid(p.tiandituImgTileMark))) && L.setVisible(!0);
2337
+ S.value = y, (w = o.value) == null || w.getLayers().forEach((k) => {
2338
+ (getUid(k) === getUid(f.tiandituTile) || getUid(k) === getUid(f.tiandituTileMark) || getUid(k) === getUid(f.tiandituImgTile) || getUid(k) === getUid(f.tiandituImgTileMark)) && k.setVisible(!1), (y === BaseMapType.vector && (getUid(k) === getUid(f.tiandituTile) || getUid(k) === getUid(f.tiandituTileMark)) || y === BaseMapType.satellite && (getUid(k) === getUid(f.tiandituImgTile) || getUid(k) === getUid(f.tiandituImgTileMark))) && k.setVisible(!0);
2290
2339
  });
2291
- }, V = () => {
2292
- const g = o.value.getView(), w = g.getZoom();
2293
- w && C(w);
2294
- const L = g.calculateExtent(o.value.getSize());
2295
- L && w && P(L, w);
2296
- }, C = (g) => {
2297
- var k, T, E, I, F;
2298
- d.value = g, v(g < mapZoom.shipGreenDotMax);
2299
- const w = (k = o.value) == null ? void 0 : k.getLayers(), L = s.vehicleMode === "ship" ? w == null ? void 0 : w.getArray().find(($) => getUid($) === getUid(p.greenMark)) : void 0;
2300
- showTrackLayer.value ? (f.value = !1, L == null || L.setVisible(!1), (T = shipsLayer.value) == null || T.setVisible(!1), (E = largeAmountShipsLayer.value) == null || E.setVisible(!1)) : !u.value && m.value && g <= mapZoom.shipGreenDotMax ? (f.value = !0, L == null || L.setVisible(!0), (I = shipsLayer.value) == null || I.setVisible(!1), (F = largeAmountShipsLayer.value) == null || F.setVisible(!1)) : (f.value = !1, L == null || L.setVisible(!1)), c("zoomChanged", g);
2301
- }, P = (g, w) => {
2302
- const L = transform([g[0], g[1]], projection.mercator, projection.data), k = transform([g[2], g[3]], projection.mercator, projection.data);
2303
- c("extentChanged", { extent: [L, k], zoom: w });
2340
+ }, F = () => {
2341
+ const y = o.value.getView(), w = y.getZoom();
2342
+ w && x(w);
2343
+ const k = y.calculateExtent(o.value.getSize());
2344
+ k && w && P(k, w);
2345
+ }, x = (y) => {
2346
+ var M, T, C, V, E;
2347
+ m.value = y, L(y < mapZoom.shipGreenDotMax);
2348
+ const w = (M = o.value) == null ? void 0 : M.getLayers(), k = s.vehicleMode === "ship" ? w == null ? void 0 : w.getArray().find((N) => getUid(N) === getUid(f.greenMark)) : void 0;
2349
+ showTrackLayer.value ? (h.value = !1, k == null || k.setVisible(!1), (T = shipsLayer.value) == null || T.setVisible(!1), (C = largeAmountShipsLayer.value) == null || C.setVisible(!1)) : !d.value && u.value && y <= mapZoom.shipGreenDotMax ? (h.value = !0, k == null || k.setVisible(!0), (V = shipsLayer.value) == null || V.setVisible(!1), (E = largeAmountShipsLayer.value) == null || E.setVisible(!1)) : (h.value = !1, k == null || k.setVisible(!1)), c("zoomChanged", y);
2350
+ }, P = (y, w) => {
2351
+ const k = transform([y[0], y[1]], projection.mercator, projection.data), M = transform([y[2], y[3]], projection.mercator, projection.data);
2352
+ c("extentChanged", { extent: [k, M], zoom: w });
2304
2353
  };
2305
2354
  return t({
2306
2355
  mapInstance: o,
2307
- initMap: y,
2308
- pointRender: (g, w) => new PointMarkerClass(g, w),
2356
+ initMap: v,
2357
+ pointRender: (y, w) => new PointMarkerClass(y, w),
2309
2358
  renderTrucksMarker,
2310
2359
  renderShip: renderShips,
2311
- renderTrack: (g, w, L) => {
2312
- var k, T;
2313
- currentTrackId.value = g, showTrackLayer.value = !0, u.value = !0, hiddenAllShips(), (T = (k = largeAmountShipsLayer.value) == null ? void 0 : k.getSource()) == null || T.clear(), renderTrack(g, s.vehicleMode === "ship" ? w.reverse() : w, L, LENGTH_UNIT.NM);
2360
+ renderTrack: (y, w, k) => {
2361
+ var M, T;
2362
+ currentTrackId.value = y, showTrackLayer.value = !0, d.value = !0, hiddenAllShips(), (T = (M = largeAmountShipsLayer.value) == null ? void 0 : M.getSource()) == null || T.clear(), renderTrack(y, s.vehicleMode === "ship" ? w.reverse() : w, k, LENGTH_UNIT.NM);
2314
2363
  },
2315
2364
  findTruck,
2316
2365
  removeTruckIcon,
2317
2366
  clearAllTruck,
2318
2367
  closeTrack: () => {
2319
- var g, w;
2320
- showTrackLayer.value = !1, (g = shipTrackVectorLayer.value) == null || g.setVisible(!1), (w = selectShipsLayer.value) == null || w.setVisible(!0), u.value = !1, v(d.value < mapZoom.shipGreenDotMax), allTracks.value = [], stopAnimation();
2368
+ var y, w;
2369
+ showTrackLayer.value = !1, (y = shipTrackVectorLayer.value) == null || y.setVisible(!1), (w = selectShipsLayer.value) == null || w.setVisible(!0), d.value = !1, L(m.value < mapZoom.shipGreenDotMax), allTracks.value = [], stopAnimation();
2321
2370
  },
2322
2371
  closeTruckTrack: () => {
2323
- var g, w;
2324
- showTrackLayer.value = !1, (g = shipTrackVectorLayer.value) == null || g.setVisible(!1), (w = selectShipsLayer.value) == null || w.setVisible(!0), stopAnimation();
2372
+ var y, w;
2373
+ showTrackLayer.value = !1, (y = shipTrackVectorLayer.value) == null || y.setVisible(!1), (w = selectShipsLayer.value) == null || w.setVisible(!0), stopAnimation();
2325
2374
  },
2326
2375
  resetTrackView,
2327
2376
  playTrack,
2328
2377
  clearSelectFeature,
2329
2378
  findShip,
2330
- focusShip: (g, w, L = !0) => {
2331
- var k, T;
2332
- hiddenOrther.value = L, (k = shipsLayer.value) == null || k.setVisible(!L), (T = largeAmountShipsLayer.value) == null || T.setVisible(!1), findShip(g, w);
2379
+ focusShip: (y, w, k = !0) => {
2380
+ var M, T;
2381
+ hiddenOrther.value = k, (M = shipsLayer.value) == null || M.setVisible(!k), (T = largeAmountShipsLayer.value) == null || T.setVisible(!1), findShip(y, w);
2333
2382
  },
2383
+ clearShipData,
2334
2384
  showTracks,
2335
2385
  removeAllTrackLayer,
2336
2386
  switchFilterItem,
2337
2387
  rerenderShip,
2338
- switchGreenDot: () => v(!1),
2388
+ switchGreenDot: () => L(!1),
2339
2389
  zoomTruckIcon,
2340
- renderTruckTrack: (g, w, L) => {
2341
- showTrackLayer.value = !0, renderTrack(g, w, L, LENGTH_UNIT.KM, "truck");
2390
+ renderTruckTrack: (y, w, k) => {
2391
+ showTrackLayer.value = !0, renderTrack(y, w, k, LENGTH_UNIT.KM, "truck");
2342
2392
  },
2343
2393
  drawCustomContent,
2344
2394
  removerLayer: removeShipTrackLineFeatureByIndex,
2345
2395
  renderMarker,
2346
- setMarkerPosition: (g) => {
2347
- u.value = !0, setMarkerPosition(g);
2396
+ setMarkerPosition: (y) => {
2397
+ d.value = !0, setMarkerPosition(y);
2348
2398
  },
2349
2399
  getZoomAndCenter: () => {
2350
2400
  var T;
2351
- const g = (T = o.value) == null ? void 0 : T.getView();
2352
- if (!g) return null;
2353
- const w = Math.round(Number(g.getZoom())), { lon: L, lat: k } = transformUtils.mercatorToLonLat(g.getCenter());
2354
- return { zoom: w, center: [L, k] };
2401
+ const y = (T = o.value) == null ? void 0 : T.getView();
2402
+ if (!y) return null;
2403
+ const w = Math.round(Number(y.getZoom())), { lon: k, lat: M } = transformUtils.mercatorToLonLat(y.getCenter());
2404
+ return { zoom: w, center: [k, M] };
2355
2405
  },
2356
- setCenter: (g) => {
2357
- var k;
2358
- const w = (k = o.value) == null ? void 0 : k.getView();
2406
+ setCenter: (y) => {
2407
+ var M;
2408
+ const w = (M = o.value) == null ? void 0 : M.getView();
2359
2409
  if (!w) return null;
2360
- const L = new Point(g);
2361
- w.setCenter(transform(L.getCoordinates(), projection.data, projection.mercator));
2410
+ const k = new Point(y);
2411
+ w.setCenter(transform(k.getCoordinates(), projection.data, projection.mercator));
2362
2412
  },
2363
2413
  drawPolygonTool,
2364
- setMapInstance: h,
2414
+ setMapInstance: g,
2365
2415
  store: {
2366
2416
  getShowMeasure: getShowMeasure()
2367
2417
  },
@@ -2373,33 +2423,34 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2373
2423
  transform: transformUtils,
2374
2424
  format: formatUtils
2375
2425
  }
2376
- }), (g, w) => (openBlock(), createElementBlock("div", {
2426
+ }), (y, w) => (openBlock(), createElementBlock("div", {
2377
2427
  class: "map-page map-container",
2378
2428
  ref_key: "pageRef",
2379
- ref: i
2429
+ ref: r
2380
2430
  }, [
2381
2431
  w[0] || (w[0] = createElementVNode("div", {
2382
2432
  id: "map",
2383
2433
  class: "map"
2384
2434
  }, null, -1)),
2385
- createVNode(ToolPanel, {
2386
- "vehicle-mode": g.vehicleMode,
2387
- "view-mode": g.viewMode,
2388
- "disable-green-dot": u.value,
2435
+ p.value ? (openBlock(), createBlock(ToolPanel, {
2436
+ key: 0,
2437
+ "vehicle-mode": y.vehicleMode,
2438
+ "view-mode": y.viewMode,
2439
+ "disable-green-dot": d.value,
2389
2440
  "show-track-layer": unref(showTrackLayer),
2390
- "map-tile-mode": M.value,
2391
- onSwitchGreenDot: v,
2392
- onSwitchMapTile: S
2441
+ "map-tile-mode": S.value,
2442
+ onSwitchGreenDot: L,
2443
+ onSwitchMapTile: I
2393
2444
  }, {
2394
2445
  toolPanel: withCtx(() => [
2395
- renderSlot(g.$slots, "toolPanel", {}, void 0, !0)
2446
+ renderSlot(y.$slots, "toolPanel", {}, void 0, !0)
2396
2447
  ]),
2397
2448
  _: 3
2398
- }, 8, ["vehicle-mode", "view-mode", "disable-green-dot", "show-track-layer", "map-tile-mode"]),
2399
- g.viewMode !== "WxMiniprogram" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
2449
+ }, 8, ["vehicle-mode", "view-mode", "disable-green-dot", "show-track-layer", "map-tile-mode"])) : createCommentVNode("", !0),
2450
+ y.viewMode !== "WxMiniprogram" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2400
2451
  createVNode(ScaleLine, {
2401
2452
  ref_key: "scaleLineControl",
2402
- ref: r
2453
+ ref: i
2403
2454
  }, null, 512),
2404
2455
  createVNode(ZoomControl, {
2405
2456
  ref_key: "zoomControl",
@@ -2407,12 +2458,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2407
2458
  }, null, 512)
2408
2459
  ], 64)) : createCommentVNode("", !0),
2409
2460
  createVNode(Copyright, {
2410
- type: g.logoType,
2411
- "map-tile": M.value
2461
+ type: y.logoType,
2462
+ "map-tile": S.value
2412
2463
  }, null, 8, ["type", "map-tile"])
2413
2464
  ], 512));
2414
2465
  }
2415
- }), Map = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0cb9105e"]]), ZhMap = withInstall(Map);
2466
+ }), Map = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-b6c57705"]]), ZhMap = withInstall(Map);
2416
2467
  export {
2417
2468
  BaseMapType as B,
2418
2469
  CDN_URL as C,