zhihao-ui 1.2.34 → 1.2.36

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