zhihao-ui 1.2.47 → 1.2.48

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