zhihao-ui 1.2.45 → 1.2.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/es/{BaseInfo-VzgiaCKn.js → BaseInfo-D-0T7Xj6.js} +1 -1
  2. package/dist/es/{BaseItem-D1xoWSGo.js → BaseItem-CY9hXXR0.js} +3 -3
  3. package/dist/es/{Button-CNEQmoqP.js → Button-USqLJ-9S.js} +2 -2
  4. package/dist/es/{DatePicker-Dh8sksac.js → DatePicker-C6kyMZ8-.js} +3 -3
  5. package/dist/es/{DetailHeader-CSC9DAQc.js → DetailHeader-BpKX32Ip.js} +3 -3
  6. package/dist/es/{DetailSubTitle-1ZjJAmet.js → DetailSubTitle-Bu8Ke5B0.js} +2 -2
  7. package/dist/es/{Dialog-BuGbBs3k.js → Dialog-Dez6LM1c.js} +3 -3
  8. package/dist/es/{DiyDataTable-BerDffOX.js → DiyDataTable--G4p9NXy.js} +4 -4
  9. package/dist/es/{EditInfoPair-Dx0KRj7O.js → EditInfoPair-BWFgGS2F.js} +3 -3
  10. package/dist/es/{FileWrapper-CS2RTMEV.js → FileWrapper-BN7d5fIh.js} +4 -4
  11. package/dist/es/{Grid-BQYUct2W.js → Grid-Cs3EsKJP.js} +2 -2
  12. package/dist/es/{InfoPair-C3sCcJVT.js → InfoPair-CNgNOqBr.js} +3 -3
  13. package/dist/es/{Input-CcYpobcm.js → Input-BQdnfIM2.js} +3 -3
  14. package/dist/es/{Loading-DCEW1FE_.js → Loading-D44Z_50e.js} +2 -2
  15. package/dist/es/{Map-B_2SojSM.js → Map-DkNn4z7I.js} +954 -919
  16. package/dist/es/{MessageBox-ByLWEDby.js → MessageBox-6Q871-mu.js} +2 -2
  17. package/dist/es/{MoneyInput-DevlnT8p.js → MoneyInput-DdXhvQpn.js} +5 -5
  18. package/dist/es/{PageHeadPanel-C5A4n2ie.js → PageHeadPanel-a3trdcKM.js} +2 -2
  19. package/dist/es/{Table-BoMGydAp.js → Table-B7qziI2U.js} +5 -5
  20. package/dist/es/{ToolTips-6ETyGI4m.js → ToolTips-DhLuEMZP.js} +3 -3
  21. package/dist/es/index.js +23 -23
  22. package/dist/es/{utils-BSQSj8Ii.js → utils-DvDZ3DAF.js} +1 -1
  23. package/dist/es/{vendor-DaYdW1_n.js → vendor-BmuLaCuO.js} +5 -5
  24. package/dist/index.css +1 -1
  25. package/dist/types/components/Map/Map.vue.d.ts +4 -1
  26. package/dist/types/components/Map/index.d.ts +9 -3
  27. package/dist/types/components/Map/render/canvasRender/canvasRender.d.ts +2 -1
  28. package/dist/types/components/Map/render/canvasRender/renderCustomOverlay.d.ts +1 -1
  29. package/dist/types/components/Map/render/renderPoint.d.ts +1 -0
  30. package/dist/types/components/Map/render/renderTruck.d.ts +2 -2
  31. package/dist/types/components/Map/utils/transform.d.ts +3 -0
  32. package/dist/umd/index.css +1 -1
  33. package/dist/umd/index.umd.cjs +18 -18
  34. package/package.json +1 -1
@@ -1,14 +1,14 @@
1
- var U = Object.defineProperty;
2
- var z = (e, t, n) => t in e ? U(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var b = (e, t, n) => z(e, typeof t != "symbol" ? t + "" : t, n);
1
+ var j = Object.defineProperty;
2
+ var H = (e, t, n) => t in e ? j(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var b = (e, t, n) => H(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import { defineComponent, inject, useModel, ref, watch, openBlock, createElementBlock, createElementVNode, createVNode, unref, withCtx, Fragment, renderList, toDisplayString, createCommentVNode, mergeModels, nextTick, onMounted, normalizeClass, renderSlot, createBlock, useCssVars, computed, provide } from "vue";
5
- import { p as getArea, q as getLength, V as VectorSource, r as VectorLayer, S as Style, C as CircleStyle, F as Fill, s as Stroke, D as Draw, O as Overlay, u as unByKey, t as ElSelect, v as ElOption, w as getUid, x as fromLonLat, P as Point, y as transform, z as Feature, T as Text, I as Icon, A as Translate, B as toLonLat, i as cloneDeep, G as GeoJSON, W as WebGLPointsLayer, H as Circle, J as transformExtent, h as hooks, L as LineString, K as Polyline, M as getVectorContext, N as buffer, Q as ScaleLine$1, R as MultiPoint, U as getCenter, X as TileLayer, Y as XYZ, Z as Map$1, _ as View } from "./vendor-DaYdW1_n.js";
6
- import { _ as _export_sfc } from "./Button-CNEQmoqP.js";
7
- import { g as getForegroundColor } from "./DatePicker-Dh8sksac.js";
8
- import { w as withInstall } from "./utils-BSQSj8Ii.js";
5
+ import { p as getArea, q as getLength, V as VectorSource, r as VectorLayer, S as Style, C as CircleStyle, F as Fill, s as Stroke, D as Draw, O as Overlay, u as unByKey, t as ElSelect, v as ElOption, w as getUid, x as fromLonLat, P as Point, y as transform, z as Feature, T as Text, I as Icon, A as Translate, B as toLonLat, G as transformExtent, h as hooks, L as LineString, H as Polyline, J as getVectorContext, i as cloneDeep, K as GeoJSON, W as WebGLPointsLayer, M as Circle, N as buffer, Q as ScaleLine$1, R as MultiPoint, U as getCenter, X as TileLayer, Y as XYZ, Z as Map$1, _ as View } from "./vendor-BmuLaCuO.js";
6
+ import { _ as _export_sfc } from "./Button-USqLJ-9S.js";
7
+ import { g as getForegroundColor } from "./DatePicker-C6kyMZ8-.js";
8
+ import { w as withInstall } from "./utils-DvDZ3DAF.js";
9
9
  var BaseMapType = /* @__PURE__ */ ((e) => (e[e.vector = 0] = "vector", e[e.satellite = 1] = "satellite", e))(BaseMapType || {}), SEARCH_TYPE = /* @__PURE__ */ ((e) => (e[e.SEARCH_SHIP = 0] = "SEARCH_SHIP", e[e.SEARCH_PORT = 1] = "SEARCH_PORT", e[e.SEARCH_CUSTOM = 2] = "SEARCH_CUSTOM", e))(SEARCH_TYPE || {}), COPY_RIGHT_TYPE = /* @__PURE__ */ ((e) => (e[e.HORIZONTAL = 0] = "HORIZONTAL", e[e.VERTICAL = 1] = "VERTICAL", e))(COPY_RIGHT_TYPE || {}), CAR_COLOR = /* @__PURE__ */ ((e) => (e[e.BLUE = 1] = "BLUE", e[e.YELLOW = 2] = "YELLOW", e[e.Y_GREEN = 3] = "Y_GREEN", e))(CAR_COLOR || {}), DEVICE_TYPE = /* @__PURE__ */ ((e) => (e[e.HOST = 1] = "HOST", e[e.TALK = 2] = "TALK", e[e.STORAGE = 3] = "STORAGE", e[e.INTERNET = 4] = "INTERNET", e[e.CAMERA = 5] = "CAMERA", e[e.LOAD = 6] = "LOAD", e))(DEVICE_TYPE || {}), LENGTH_UNIT = /* @__PURE__ */ ((e) => (e[e.M = 1] = "M", e[e.KM = 2] = "KM", e[e.NM = 3] = "NM", e))(LENGTH_UNIT || {}), SWITCH_BTN = /* @__PURE__ */ ((e) => (e.Camera = "camera", e.Mobile = "mobile", e.WaterGauge = "waterGauge", e))(SWITCH_BTN || {}), SHIP_SAIL_STATUS = /* @__PURE__ */ ((e) => (e[e.发动机使用中 = 0] = "发动机使用中", e[e.锚泊 = 1] = "锚泊", e[e.未操作 = 2] = "未操作", e[e.操纵能力受限 = 3] = "操纵能力受限", e[e.吃水受限 = 4] = "吃水受限", e[e.系泊 = 5] = "系泊", e[e.搁浅 = 6] = "搁浅", e[e.从事捕捞 = 7] = "从事捕捞", e[e.航行中 = 8] = "航行中", e[e.留作将来修正导航状态 = 9] = "留作将来修正导航状态", e[e.高速船留用 = 10] = "高速船留用", e[e.机动船尾推作业 = 11] = "机动船尾推作业", e[e.机动船顶推或侧推作业 = 12] = "机动船顶推或侧推作业", e[e.飞翼船留用 = 13] = "飞翼船留用", e[e.现行的 = 14] = "现行的", e[e.未定义 = 15] = "未定义", e))(SHIP_SAIL_STATUS || {});
10
10
  class ShipMapData {
11
- constructor(t, n, o, i, r, l, c, s, m, d, u, f, p, y, h, g, k, T, I, F, V, P, v, L) {
11
+ constructor(t, n, o, i, r, l, c, s, d, u, m, f, p, y, h, v, M, S, V, C, P, x, g, w) {
12
12
  b(this, "id");
13
13
  // mmsi
14
14
  b(this, "mmsi");
@@ -50,7 +50,7 @@ class ShipMapData {
50
50
  b(this, "existWaterGauge");
51
51
  b(this, "selected");
52
52
  b(this, "blinkColors");
53
- this.id = t, this.mmsi = n, this.fill = o, this.shipType = i, this.name = r, this.length = l, this.breadth = c, this.lon = s, this.lat = m, this.createdAt = d, this.speed = u, this.from = f, this.sailStatus = p, this.hdg = y, this.cog = h, this.posType = g, this.type = k, this.angle = T, this.leftIconColor = I, this.existDevice = F, this.existMobile = V, this.existWaterGauge = P, this.selected = v, this.blinkColors = L;
53
+ this.id = t, this.mmsi = n, this.fill = o, this.shipType = i, this.name = r, this.length = l, this.breadth = c, this.lon = s, this.lat = d, this.createdAt = u, this.speed = m, this.from = f, this.sailStatus = p, this.hdg = y, this.cog = h, this.posType = v, this.type = M, this.angle = S, this.leftIconColor = V, this.existDevice = C, this.existMobile = P, this.existWaterGauge = x, this.selected = g, this.blinkColors = w;
54
54
  }
55
55
  }
56
56
  const formatLength = function(e, t) {
@@ -130,10 +130,10 @@ const formatLength = function(e, t) {
130
130
  }),
131
131
  emits: /* @__PURE__ */ mergeModels(["close"], ["update:visible"]),
132
132
  setup(e, { expose: t, emit: n }) {
133
- const o = inject("mapInstance"), i = n, r = useModel(e, "visible"), l = ref("3"), c = ref([]), s = ref(!1), m = new VectorSource();
134
- let d, u, f, p, y;
133
+ const o = inject("mapInstance"), i = n, r = useModel(e, "visible"), l = ref("3"), c = ref([]), s = ref(!1), d = new VectorSource();
134
+ let u, m, f, p, y;
135
135
  const h = new VectorLayer({
136
- source: m,
136
+ source: d,
137
137
  style: {
138
138
  "fill-color": "rgba(255, 255, 255, 0.2)",
139
139
  "stroke-color": "#ffcc33",
@@ -141,20 +141,20 @@ const formatLength = function(e, t) {
141
141
  "circle-radius": 7,
142
142
  "circle-fill-color": "#ffcc33"
143
143
  }
144
- }), g = function(S) {
145
- if (S.dragging)
144
+ }), v = function(k) {
145
+ if (k.dragging)
146
146
  return;
147
- let M = "点击选择起点";
148
- d && (M = "单击继续,双击结束"), u && (u.innerHTML = M, f.setPosition(S.coordinate), u.classList.remove("hidden"));
149
- }, k = () => {
150
- var S, M;
151
- o != null && o.value && ((S = o == null ? void 0 : o.value) == null || S.on("pointermove", g), (M = o == null ? void 0 : o.value) == null || M.getViewport().addEventListener("mouseout", function() {
152
- var C;
153
- (C = u == null ? void 0 : u.classList) == null || C.add("hidden");
147
+ let T = "点击选择起点";
148
+ u && (T = "单击继续,双击结束"), m && (m.innerHTML = T, f.setPosition(k.coordinate), m.classList.remove("hidden"));
149
+ }, M = () => {
150
+ var k, T;
151
+ o != null && o.value && ((k = o == null ? void 0 : o.value) == null || k.on("pointermove", v), (T = o == null ? void 0 : o.value) == null || T.getViewport().addEventListener("mouseout", function() {
152
+ var E;
153
+ (E = m == null ? void 0 : m.classList) == null || E.add("hidden");
154
154
  }), s.value = !0);
155
155
  };
156
- let T;
157
- const I = new Style({
156
+ let S;
157
+ const V = new Style({
158
158
  fill: new Fill({
159
159
  color: "rgba(255, 255, 255, 0.2)"
160
160
  }),
@@ -173,99 +173,99 @@ const formatLength = function(e, t) {
173
173
  })
174
174
  })
175
175
  });
176
- function F() {
177
- var S, M;
176
+ function C() {
177
+ var k, T;
178
178
  if (o != null && o.value) {
179
- if (c.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((C) => {
180
- var E;
181
- (E = C == null ? void 0 : C.parentNode) == null || E.removeChild(C);
182
- }), m.clear(), T) {
183
- const C = o.value.getInteractions().getArray().find((E) => getUid(E) === getUid(T));
184
- C && ((S = o.value) == null || S.removeInteraction(C));
179
+ if (c.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((E) => {
180
+ var I;
181
+ (I = E == null ? void 0 : E.parentNode) == null || I.removeChild(E);
182
+ }), d.clear(), S) {
183
+ const E = o.value.getInteractions().getArray().find((I) => getUid(I) === getUid(S));
184
+ E && ((k = o.value) == null || k.removeInteraction(E));
185
185
  }
186
- (M = o.value) == null || M.removeLayer(h), u != null && u.parentNode && u.parentNode.removeChild(u), p != null && p.parentNode && p.parentNode.removeChild(p);
186
+ (T = o.value) == null || T.removeLayer(h), m != null && m.parentNode && m.parentNode.removeChild(m), p != null && p.parentNode && p.parentNode.removeChild(p);
187
187
  }
188
188
  }
189
- function V() {
190
- var M, C;
191
- F(), (M = o == null ? void 0 : o.value) == null || M.addLayer(h), T = new Draw({
192
- source: m,
189
+ function P() {
190
+ var T, E;
191
+ C(), (T = o == null ? void 0 : o.value) == null || T.addLayer(h), S = new Draw({
192
+ source: d,
193
193
  type: "LineString",
194
194
  style: function() {
195
- return I;
195
+ return V;
196
196
  },
197
197
  // 添加条件函数,判断是否应该触发绘制
198
- condition: function(E) {
199
- return E.originalEvent.target.tagName !== "DIV";
198
+ condition: function(I) {
199
+ return I.originalEvent.target.tagName !== "DIV";
200
200
  }
201
- }), (C = o == null ? void 0 : o.value) == null || C.addInteraction(T), v(), P();
202
- let S;
203
- T.on("drawstart", function(E) {
204
- var N;
205
- d = E.feature;
206
- let x;
207
- S = (N = d.getGeometry()) == null ? void 0 : N.on("change", function(A) {
208
- const $ = A.target;
209
- let R = formatUtils.formatLength($, Number(l.value));
210
- x = $.getLastCoordinate(), p && R && (p.innerHTML = R), y.setPosition(x);
201
+ }), (E = o == null ? void 0 : o.value) == null || E.addInteraction(S), g(), x();
202
+ let k;
203
+ S.on("drawstart", function(I) {
204
+ var $;
205
+ u = I.feature;
206
+ let F;
207
+ k = ($ = u.getGeometry()) == null ? void 0 : $.on("change", function(R) {
208
+ const B = R.target;
209
+ let N = formatUtils.formatLength(B, Number(l.value));
210
+ F = B.getLastCoordinate(), p && N && (p.innerHTML = N), y.setPosition(F);
211
211
  });
212
- }), T.on("drawend", function() {
213
- var E, x;
214
- p && (p.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), p != null && p.innerHTML && (c.value.push(p == null ? void 0 : p.innerHTML), p.innerHTML = `${p.innerHTML}<div class="ol-tooltip-delete-button" data-index="${((E = c.value) == null ? void 0 : E.length) - 1}"><i class="map-iconfont icon-delete"></i></div>`), (x = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || x.addEventListener("click", (N) => {
215
- var $;
216
- N.preventDefault(), N.stopPropagation();
217
- const A = ($ = N.target) == null ? void 0 : $.getAttribute("data-index");
218
- A && L(Number(A));
219
- }), y.setOffset([0, -7]), d = null, p = null, v(), S && unByKey(S);
212
+ }), S.on("drawend", function() {
213
+ var I, F;
214
+ p && (p.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), p != null && p.innerHTML && (c.value.push(p == null ? void 0 : p.innerHTML), p.innerHTML = `${p.innerHTML}<div class="ol-tooltip-delete-button" data-index="${((I = c.value) == null ? void 0 : I.length) - 1}"><i class="map-iconfont icon-delete"></i></div>`), (F = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || F.addEventListener("click", ($) => {
215
+ var B;
216
+ $.preventDefault(), $.stopPropagation();
217
+ const R = (B = $.target) == null ? void 0 : B.getAttribute("data-index");
218
+ R && w(Number(R));
219
+ }), y.setOffset([0, -7]), u = null, p = null, g(), k && unByKey(k);
220
220
  });
221
221
  }
222
- function P() {
223
- var S;
224
- u != null && u.parentNode && u.parentNode.removeChild(u), u = document.createElement("div"), u.className = "ol-tooltip hidden", f = new Overlay({
225
- element: u,
222
+ function x() {
223
+ var k;
224
+ m != null && m.parentNode && m.parentNode.removeChild(m), m = document.createElement("div"), m.className = "ol-tooltip hidden", f = new Overlay({
225
+ element: m,
226
226
  offset: [15, 0],
227
227
  positioning: "center-left"
228
- }), (S = o == null ? void 0 : o.value) == null || S.addOverlay(f);
228
+ }), (k = o == null ? void 0 : o.value) == null || k.addOverlay(f);
229
229
  }
230
- function v() {
231
- var S;
230
+ function g() {
231
+ var k;
232
232
  p != null && p.parentNode && p.parentNode.removeChild(p), p = document.createElement("div"), p.className = "ol-tooltip ol-tooltip-measure", y = new Overlay({
233
233
  element: p,
234
234
  offset: [0, -15],
235
235
  positioning: "bottom-center",
236
236
  stopEvent: !1,
237
237
  insertFirst: !1
238
- }), (S = o == null ? void 0 : o.value) == null || S.addOverlay(y);
238
+ }), (k = o == null ? void 0 : o.value) == null || k.addOverlay(y);
239
239
  }
240
- const L = (S) => {
241
- var E, x;
242
- c.value[S] && c.value.splice(S, 1);
243
- const M = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
244
- M[S] && ((x = (E = M[S]) == null ? void 0 : E.parentNode) == null || x.removeChild(M[S]));
245
- const C = m.getFeatures();
246
- C[S] && m.removeFeature(C[S]);
247
- }, w = () => {
240
+ const w = (k) => {
241
+ var I, F;
242
+ c.value[k] && c.value.splice(k, 1);
243
+ const T = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
244
+ T[k] && ((F = (I = T[k]) == null ? void 0 : I.parentNode) == null || F.removeChild(T[k]));
245
+ const E = d.getFeatures();
246
+ E[k] && d.removeFeature(E[k]);
247
+ }, L = () => {
248
248
  i("close");
249
249
  };
250
250
  return watch(() => r, () => {
251
- r.value && !s.value && (k(), V());
251
+ r.value && !s.value && (M(), P());
252
252
  }, { deep: !0, immediate: !0 }), t({
253
- addInteraction: V,
254
- removeInteraction: F
255
- }), (S, M) => r.value && S.viewMode !== "WxMiniprogram" ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
253
+ addInteraction: P,
254
+ removeInteraction: C
255
+ }), (k, T) => r.value && k.viewMode !== "WxMiniprogram" ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
256
256
  createElementVNode("div", { class: "header" }, [
257
- M[1] || (M[1] = createElementVNode("div", { class: "title" }, "测量", -1)),
257
+ T[1] || (T[1] = createElementVNode("div", { class: "title" }, "测量", -1)),
258
258
  createElementVNode("i", {
259
- onClick: w,
259
+ onClick: L,
260
260
  class: "map-iconfont icon-close"
261
261
  })
262
262
  ]),
263
263
  createElementVNode("div", _hoisted_2$2, [
264
- M[2] || (M[2] = createElementVNode("div", { class: "tips" }, "在地图上点击多个点测量距离,距离单位", -1)),
264
+ T[2] || (T[2] = createElementVNode("div", { class: "tips" }, "在地图上点击多个点测量距离,距离单位", -1)),
265
265
  createVNode(unref(ElSelect), {
266
266
  class: "select-length-unit",
267
267
  modelValue: l.value,
268
- "onUpdate:modelValue": M[0] || (M[0] = (C) => l.value = C)
268
+ "onUpdate:modelValue": T[0] || (T[0] = (E) => l.value = E)
269
269
  }, {
270
270
  default: withCtx(() => [
271
271
  createVNode(unref(ElOption), {
@@ -285,19 +285,19 @@ const formatLength = function(e, t) {
285
285
  }, 8, ["modelValue"])
286
286
  ]),
287
287
  createElementVNode("div", _hoisted_3$1, [
288
- (openBlock(!0), createElementBlock(Fragment, null, renderList(c.value, (C, E) => (openBlock(), createElementBlock("div", {
288
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(c.value, (E, I) => (openBlock(), createElementBlock("div", {
289
289
  class: "measure-history-item",
290
- key: E
290
+ key: I
291
291
  }, [
292
292
  createElementVNode("div", _hoisted_4, [
293
- M[3] || (M[3] = createElementVNode("i", { class: "map-iconfont icon-line" }, null, -1)),
294
- createElementVNode("span", _hoisted_5, "线段" + toDisplayString(E + 1), 1),
295
- createElementVNode("span", _hoisted_6, toDisplayString(C), 1)
293
+ T[3] || (T[3] = createElementVNode("i", { class: "map-iconfont icon-line" }, null, -1)),
294
+ createElementVNode("span", _hoisted_5, "线段" + toDisplayString(I + 1), 1),
295
+ createElementVNode("span", _hoisted_6, toDisplayString(E), 1)
296
296
  ]),
297
297
  createElementVNode("div", {
298
298
  class: "delete-button",
299
- onClick: (x) => L(E)
300
- }, M[4] || (M[4] = [
299
+ onClick: (F) => w(I)
300
+ }, T[4] || (T[4] = [
301
301
  createElementVNode("i", { class: "map-iconfont icon-delete" }, null, -1)
302
302
  ]), 8, _hoisted_7)
303
303
  ]))), 128))
@@ -334,31 +334,31 @@ const formatLength = function(e, t) {
334
334
  // 设置文本背景的内边距
335
335
  })
336
336
  }), renderMarker = (e, t = !0, n = !0) => {
337
- var d;
337
+ var u;
338
338
  if (!mapInstance$8.value || !e || e.split(",").length !== 2) return;
339
339
  const [o, i] = e.split(",").map(Number);
340
340
  marker.value = new Feature({
341
341
  geometry: new Point(fromLonLat([o, i]))
342
342
  });
343
343
  const r = n ? `${o}, ${i}` : "";
344
- (d = marker.value) == null || d.setStyle(createIconStyle(r));
344
+ (u = marker.value) == null || u.setStyle(createIconStyle(r));
345
345
  const l = new VectorSource({
346
346
  features: [marker.value]
347
347
  }), c = new VectorLayer({
348
348
  source: l
349
349
  }), s = mapInstance$8.value.getView();
350
350
  if (mapInstance$8.value.addLayer(c), t) {
351
- const u = new Translate({
351
+ const m = new Translate({
352
352
  layers: [c]
353
353
  });
354
- u.on("translating", function(f) {
354
+ m.on("translating", function(f) {
355
355
  var h;
356
356
  const p = f.features.item(0).getGeometry().getCoordinates(), y = toLonLat(p);
357
357
  markerPosition.value = `${y[0].toFixed(6)}, ${y[1].toFixed(6)}`, (h = marker.value) == null || h.setStyle(createIconStyle(markerPosition.value));
358
- }), mapInstance$8.value.addInteraction(u);
358
+ }), mapInstance$8.value.addInteraction(m);
359
359
  }
360
- const m = new Point([o, i]);
361
- s.setCenter(transform(m.getCoordinates(), projection.data, projection.mercator)), s.setZoom(mapZoom.findShip);
360
+ const d = new Point([o, i]);
361
+ s.setCenter(transform(d.getCoordinates(), projection.data, projection.mercator)), s.setZoom(mapZoom.findShip);
362
362
  }, setMarkerPosition = (e) => {
363
363
  var i, r;
364
364
  if (!mapInstance$8.value) return;
@@ -410,452 +410,65 @@ const formatLength = function(e, t) {
410
410
  }, LOG_DATE_FORMAT = "YYYY-MM-DD HH:mm:ss", DEFAULT_VALUE = "--";
411
411
  ref();
412
412
  const shipsLayer = ref(), largeAmountShipsLayer = ref(), selectShipsLayer = ref(), allShips = ref([]), selectSingleShipData = ref();
413
- ref();
414
- const trucksLayer = ref(), shipTrackLineFeatures = ref([]), trackLineVectorSource = ref(), shipTrackVectorLayer = ref();
415
- ref();
416
- ref();
417
- const shipLabels = ref([]), trackLabels = ref([]), showTrackLayer = ref(!1), allTracks = ref([]), currentTrackId = ref(""), showTrackAnimatMarker = ref(!1), hiddenOrther = ref(!1), showMeasure = ref(!1), getShowMeasure = () => showMeasure.value;
418
- function getIconFont(unicode = "") {
419
- return unicode.indexOf("&amp;") !== -1 && (unicode = unicode.replace("&amp;", "&")), unicode.indexOf("&amp") !== -1 && (unicode = unicode.replace("&amp", "&")), eval('("' + unicode.replace("&#x", "\\u").replace(";", "") + '")');
420
- }
421
- const multiplyPixelRatio = (e) => {
422
- const t = window.devicePixelRatio || 1;
423
- return e.map((n) => n.map((o) => o * t));
424
- }, 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({
425
- text: new Text({
426
- font: "Normal 14px map-iconfont",
427
- text: getIconFont(e),
428
- fill: new Fill({ color: "#fff" }),
429
- offsetY: -14
430
- }),
431
- zIndex: 100
432
- }), getRotation = (e, t, n) => {
433
- function o(u) {
434
- return 180 * (u % (2 * Math.PI)) / Math.PI;
435
- }
436
- function i(u) {
437
- return u % 360 * Math.PI / 180;
438
- }
439
- function r(u) {
440
- if (!u) throw new Error("Coordinate is required");
441
- if (!Array.isArray(u)) {
442
- if (u.type === "Feature" && u.geometry !== null && u.geometry.type === "Point")
443
- return u.geometry.coordinates;
444
- if (u.type === "Point") return u.coordinates;
445
- }
446
- if (Array.isArray(u) && u.length >= 2 && !Array.isArray(u[0]) && !Array.isArray(u[1]))
447
- return u;
448
- throw new Error(
449
- "Coordinate must be GeoJSON Point or an Array of numbers"
450
- );
451
- }
452
- function l(u, f, p = {}) {
453
- if (p.final)
454
- return function(P, v) {
455
- return (l(v, P) + 180) % 360;
456
- }(u, f);
457
- const y = r(u), h = r(f), g = i(y[0]), k = i(h[0]), T = i(y[1]), I = i(h[1]), F = Math.sin(k - g) * Math.cos(I), V = Math.cos(T) * Math.sin(I) - Math.sin(T) * Math.cos(I) * Math.cos(k - g);
458
- return o(Math.atan2(F, V));
459
- }
460
- function c(u) {
461
- return !isNaN(u) && u !== null && !Array.isArray(u);
462
- }
463
- function s(u, f = {}, p = {}) {
464
- return u || console.log("Coordinates are required"), Array.isArray(u) || console.log("Coordinates must be an Array"), u.length < 2 && console.log("Coordinates must be at least 2 numbers long"), (!c(u[0]) || !c(u[1])) && console.log("Coordinates must contain numbers"), m({ type: "Point", coordinates: u }, f, p);
465
- }
466
- function m(u, f = {}, p = {}) {
467
- const y = { type: "Feature" };
468
- return p.id !== void 0 && (y.id = p.id), p.bbox && (y.bbox = p.bbox), y.properties = f || {}, y.geometry = u, y;
469
- }
470
- const d = l(s(e), s(t), n);
471
- return d < 0 ? 360 + d : d;
472
- }, triangleModel = multiplyPixelRatio([
473
- [0, -8],
474
- [5, 8],
475
- [-5, 8]
476
- ]), shipShapeModel = multiplyPixelRatio([
477
- [0, -4.545],
478
- [-0.56, -3.909],
479
- [-1, -2.727],
480
- [-1, 3.636],
481
- [-0.8, 4.545],
482
- [0.8, 4.545],
483
- [1, 3.636],
484
- [1, -2.727],
485
- [0.56, -3.909],
486
- [0, -4.545]
487
- ]), shipDirectPath = {
488
- left: {
489
- 0: [
490
- [0, 0],
491
- [0, -8],
492
- [-4, -8]
493
- ],
494
- 1: [
495
- [0, 0],
496
- [0, -16],
497
- [-6, -16]
498
- ],
499
- 2: [
500
- [0, 0],
501
- [0, -24],
502
- [-8, -24]
503
- ]
504
- },
505
- right: {
506
- 0: [
507
- [0, 0],
508
- [0, -8],
509
- [-4, -8]
510
- ],
511
- 1: [
512
- [0, 0],
513
- [0, -16],
514
- [-6, -16]
515
- ],
516
- 2: [
517
- [0, 0],
518
- [0, -24],
519
- [-8, -24]
520
- ]
521
- },
522
- front: {
523
- 0: [
524
- [0, 0],
525
- [0, -8]
526
- ],
527
- 1: [
528
- [0, 0],
529
- [0, -16]
530
- ],
531
- 2: [
532
- [0, 0],
533
- [0, -24]
534
- ]
535
- }
536
- }, setBlankStyle = () => new Style({
537
- image: new CircleStyle({
538
- radius: 0
539
- })
540
- }), mapInstance$7 = ref(), renderShipStyleSetInstance = (e) => mapInstance$7.value = e, speedCondition = [[1, 10], [10, 20], [20, 1 / 0]], drawShipModelByZoom = { 14: [200, 30], 15: [115, 15], 16: [55, 8], 17: [25, 5], 18: [1, 1] }, setShipStyle = (e, t = !1) => new Style({
541
- renderer: (n, o) => {
542
- n = n;
543
- const i = o.context, r = o.feature.get("data");
544
- if (!r) return;
545
- o.feature.get("index") === 0 && (shipLabels.value = []);
546
- try {
547
- const c = drawShipBody(i, r, n, t);
548
- c && (drawHeading(i, r, c, t), r.selected = e, e && setTimeout(() => {
549
- drawSelectBounds(i, c);
550
- }, 1)), drawShipLabel(i, r, n);
551
- } catch {
552
- return !1;
553
- }
554
- }
555
- }), drawShipBody = (e, t, n, o) => {
556
- if (!mapInstance$7.value) return;
557
- const i = Math.round(Number(mapInstance$7.value.getView().getZoom()));
558
- if (!i) return;
559
- let r = [];
560
- const [l, c] = drawShipModelByZoom[i] || [0, 0], [s, m] = n;
561
- if (i <= mapZoom.shipModelMax && i > mapZoom.shipModelMin && t.length >= l && t.breadth >= c)
562
- r = rotateShapeModel(drawCurrentShipShapeModel(t, i), t.angle).map((u) => {
563
- const [f, p] = u;
564
- return [s + f, m + p];
565
- });
566
- else {
567
- const d = rotateShapeModel(triangleModel, t.angle);
568
- n.length === 2 && (r = d.map((u) => {
569
- const [f, p] = u;
570
- return [s + f, m + p];
571
- }));
572
- }
573
- if (!(r.length > 2)) return !1;
574
- if (t != null && t.length) {
575
- const d = r.length === 3 ? 30 : t.length * 0.4;
576
- e.beginPath(), e.arc(
577
- n[0],
578
- n[1],
579
- d,
580
- 0,
581
- 2 * Math.PI
582
- ), e.fillStyle = "rgba(255, 255, 255, 0.001)", e.fill();
583
- }
584
- e.save(), e.beginPath(), e.moveTo(r[0][0], r[0][1]);
585
- for (let d = 1; d < r.length; d++)
586
- e.lineTo(r[d][0], r[d][1]);
587
- return e.closePath(), e.strokeStyle = o ? "#ff0000" : "#000", e.lineWidth = o ? 2 : 1, e.stroke(), e.fillStyle = t.fill, e.fill(), e.restore(), r;
588
- }, drawHeading = (e, t, n, o) => {
589
- const [i, r] = n[0], l = getShipDirectPath(t);
590
- if (l) {
591
- const c = l.map(function(s) {
592
- const [m, d] = s;
593
- return [m + i, d + r];
594
- });
595
- if (e.save(), e.beginPath(), t.angle > 0) {
596
- e.translate(i, r);
597
- const s = t.angle * Math.PI / 180;
598
- e.rotate(s), e.translate(-i, -r);
599
- }
600
- e.moveTo(i, r);
601
- for (let s = 1; s < c.length; s++) {
602
- const [m, d] = c[s];
603
- e.lineTo(m, d);
604
- }
605
- e.strokeStyle = o ? "#ff0000" : "#000", e.lineWidth = o ? 2 : 1, e.stroke(), e.restore();
606
- }
607
- }, drawSelectBounds = (e, t) => {
608
- let [n, o, i, r] = getPixelFromCoordinate(t);
609
- const l = window.devicePixelRatio || 1, c = 4;
610
- n -= c, o -= c, i += c, r += c, e.save(), e.strokeStyle = "#ff0000", e.lineWidth = 4 * l;
611
- const s = 8 * l;
612
- e.beginPath(), e.moveTo(n + s, r), e.lineTo(n, r), e.lineTo(n, r - s), e.moveTo(n, o + s), e.lineTo(n, o), e.lineTo(n + s, o), e.moveTo(i - s, o), e.lineTo(i, o), e.lineTo(i, o + s), e.moveTo(i, r - s), e.lineTo(i, r), e.lineTo(i - s, r), e.stroke(), e.restore();
613
- }, drawShipLabel = (e, t, n) => {
614
- if (!t.selected && shipLabels.value.find((u) => u.name === t.name)) return;
615
- const [o, i] = n, r = o, l = i, c = t.name;
616
- let s;
617
- t.leftIconColor && (s = { color: t.leftIconColor, icon: "&#xe599;" });
618
- const m = getShipCustomIcon(t), d = {
619
- id: t.id,
620
- center: [r, l],
621
- text: c,
622
- fill: t.fill,
623
- color: "#fff",
624
- textColor: "#000",
625
- bgColor: "#fff",
626
- leftIcon: s,
627
- rightIcons: m,
628
- selected: t.selected,
629
- blinkColors: t.blinkColors,
630
- type: "ShipName"
631
- };
632
- drawLabel(e, d, shipLabels.value);
633
- }, drawCurrentShipShapeModel = (e, t) => {
634
- let n = 0;
635
- 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);
636
- const o = e.length / 4 * n, i = e.breadth * n;
637
- let r = cloneDeep(shipShapeModel);
638
- return r = r.map(([l, c]) => [l * i, c * o]), r;
639
- }, getShipDirectPath = (e) => {
640
- const { speed: t, hdg: n, cog: o } = e;
641
- let i = "", r = null;
642
- if (t && t > 1 && (n !== null && n != 511 && o !== null ? o - n >= 3 ? i = "left" : o - n <= -3 ? i = "right" : i = "front" : i = "front", i && t))
643
- for (let l = 0; l < speedCondition.length; l++) {
644
- const c = speedCondition[l];
645
- if (t >= c[0] && t < c[1]) {
646
- r = shipDirectPath[i][l];
647
- break;
648
- }
649
- }
650
- return r;
651
- }, getShipCustomIcon = (e) => {
652
- const t = [];
653
- return e.existDevice && t.push("&#xe687;"), e.existMobile && t.push("&#xe688;"), e.existWaterGauge && t.push("&#xe686;"), t || [];
654
- }, mapInstance$6 = ref(), renderShipSetInstance = (e) => mapInstance$6.value = e;
655
- let shipsMarkerList = [], shipsVectorSource, largeAmountShipsSource;
656
- const selectedShipData = ref(null), selectedShips = ref([]);
657
- let selectShipsVectorSource;
658
- const renderShips = (e) => {
659
- var n, o, i, r;
660
- if (!mapInstance$6.value || showTrackLayer.value) return;
661
- const t = Math.round(Number(mapInstance$6.value.getView().getZoom()));
662
- if (selectedShipData.value && nextTick(() => {
663
- selectSingleShipMarker(selectedShipData.value);
664
- }).then((l) => {
665
- }), !(!t || t < mapZoom.shipGreenDotMax) && (allShips.value = [...e, ...selectedShips.value], !hiddenOrther.value))
666
- return t >= mapZoom.shipGreenDotMax && t < mapZoom.shipModelMin ? ((n = shipsLayer.value) == null || n.setVisible(!1), (o = largeAmountShipsLayer.value) == null || o.setVisible(!0), renderLargeAmountShips(allShips.value)) : ((i = largeAmountShipsLayer.value) == null || i.setVisible(!1), (r = shipsLayer.value) == null || r.setVisible(!0), renderShipsMarker(allShips.value));
667
- }, renderLargeAmountShips = (e) => {
668
- if (!mapInstance$6.value) return;
669
- const t = e.map((n) => ({
670
- type: "Feature",
671
- geometry: {
672
- type: "Point",
673
- coordinates: [n.lon, n.lat]
674
- },
675
- properties: n
676
- }));
677
- return largeAmountShipsSource == null || largeAmountShipsSource.clear(), largeAmountShipsSource = new VectorSource({
678
- features: new GeoJSON().readFeatures({
679
- type: "FeatureCollection",
680
- features: t
681
- }, {
682
- featureProjection: projection.mercator
683
- })
684
- }), largeAmountShipsLayer.value = new WebGLPointsLayer({
685
- source: largeAmountShipsSource,
686
- style: {
687
- "shape-points": 3,
688
- "shape-radius": 9,
689
- "shape-fill-color": [
690
- "case",
691
- ["==", ["get", "fill"], "#D9001C"],
692
- "#D9001C",
693
- // 如果 fill 是 #D9001C,返回红色
694
- ["==", ["get", "fill"], "#04C900"],
695
- "#04C900",
696
- // 如果 fill 是 #04C900,返回绿色
697
- "#04C900"
698
- // 默认颜色(绿色)
699
- ],
700
- "shape-rotate-with-view": !1,
701
- "shape-rotation": [
702
- "+",
703
- ["get", "cog"],
704
- // 获取 'cog' 属性值
705
- 180
706
- // 将值旋转 180 度
707
- ],
708
- "shape-scale": [0.8, 1.2],
709
- "shape-stroke-color": "#000000",
710
- // 边框颜色为黑色
711
- "shape-stroke-width": 0.5
712
- // 边框宽度为0.5px
713
- }
714
- }), mapInstance$6.value.addLayer(largeAmountShipsLayer.value), largeAmountShipsLayer.value;
715
- }, renderShipsMarker = (e) => {
716
- var n;
717
- if (!mapInstance$6.value) return;
718
- deleteAllShipMarkers();
719
- let t = convertShipMapData(e);
720
- if (t = customFilterShips(t), !!(t != null && t.length))
721
- return t.forEach((o, i) => {
722
- const r = [o.lon, o.lat], l = new Feature({
723
- geometry: new Point(fromLonLat(r))
724
- }), c = 1;
725
- l.set("clickGeometry", new Circle(fromLonLat(r), c)), l.set("data", o), l.set("index", i), l.setStyle(
726
- setShipStyle(!1)
727
- ), shipsMarkerList.push({
728
- ship: o,
729
- lonlat: r,
730
- feature: l
731
- });
732
- }), shipsVectorSource = new VectorSource({
733
- features: shipsMarkerList.map((o) => o.feature)
734
- }), shipsLayer.value = new VectorLayer({
735
- source: shipsVectorSource,
736
- zIndex: 100
737
- }), (n = mapInstance$6.value) == null || n.addLayer(shipsLayer.value), shipsLayer.value;
738
- }, onShipsMarkerHover = () => {
739
- var o;
740
- let e = null, t = 0;
741
- const n = 100;
742
- (o = mapInstance$6.value) == null || o.on("pointermove", function(i) {
743
- var s, m, d, u;
744
- const r = Date.now();
745
- if (r - t < n)
746
- return;
747
- t = r;
748
- const l = (s = mapInstance$6.value) == null ? void 0 : s.forEachFeatureAtPixel(i.pixel, (f) => f), c = (m = mapInstance$6.value) == null ? void 0 : m.getTargetElement();
749
- if (c && (c.style.cursor = l ? "pointer" : ""), e !== l) {
750
- if (e) {
751
- const f = e.get("data");
752
- if (!(f != null && f.mmsi)) return;
753
- e.setStyle(
754
- setShipStyle(((d = selectedShipData.value) == null ? void 0 : d.id) === f.id, !1)
755
- );
756
- }
757
- if (l) {
758
- const f = l.get("data");
759
- if (!(f != null && f.mmsi)) return;
760
- e = l, l.setStyle(
761
- setShipStyle(((u = selectedShipData.value) == null ? void 0 : u.id) === f.id, !0)
762
- );
763
- } else
764
- e = null;
765
- }
766
- });
767
- }, customFilterShips = (e) => {
768
- let t = cloneDeep(e);
769
- return t = t.filter((n) => {
770
- var i;
771
- const o = getFilterItem(n).every(({ btnShow: r, value: l }) => r ? !!l : !0);
772
- return (switchBtnShow.value.camera || switchBtnShow.value.mobile || switchBtnShow.value.waterGauge) && ((i = selectedShipData.value) == null ? void 0 : i.id) === n.id && clearSelectFeature(), o;
773
- }), t;
774
- }, getFilterItem = (e) => [
775
- { btnShow: switchBtnShow.value.camera, value: e == null ? void 0 : e.existDevice },
776
- { btnShow: switchBtnShow.value.mobile, value: e == null ? void 0 : e.existMobile },
777
- { btnShow: switchBtnShow.value.waterGauge, value: e == null ? void 0 : e.existWaterGauge }
778
- ], deleteAllShipMarkers = () => {
779
- shipsMarkerList.forEach((e) => {
780
- e.feature && (shipsVectorSource == null || shipsVectorSource.removeFeature(e.feature));
781
- }), clearAllInterval(), shipsMarkerList = [];
782
- }, selectSingleShipMarker = (e) => {
783
- var r;
784
- if (!mapInstance$6.value) return;
785
- const t = cloneDeep(selectSingleShipData.value);
786
- selectSingleShipData.value = convertShipMapData(e);
787
- const n = [selectSingleShipData.value.lon, selectSingleShipData.value.lat], o = new Feature({
788
- geometry: new Point(fromLonLat(n))
789
- });
790
- o.set("data", selectSingleShipData.value), o.setStyle(
791
- setShipStyle(!0)
792
- ), shipsMarkerList.push({
793
- ship: selectSingleShipData.value,
794
- lonlat: n,
795
- feature: o
796
- }), selectShipsVectorSource == null || selectShipsVectorSource.clear(), selectShipsVectorSource = new VectorSource({
797
- features: [o]
798
- }), selectShipsLayer.value = new VectorLayer({
799
- source: selectShipsVectorSource
800
- }), shipsVectorSource && setVisibleFeatureById(shipsVectorSource, selectSingleShipData.value.id, !0);
801
- const i = (r = shipsLayer.value) == null ? void 0 : r.getSource();
802
- return i && (t && setVisibleFeatureById(i, t.id, !0), setVisibleFeatureById(i, selectSingleShipData.value.id, !1)), mapInstance$6.value.addLayer(selectShipsLayer.value), selectShipsLayer.value.setVisible(!0), selectShipsLayer.value;
803
- }, setVisibleFeatureById = (e, t, n) => {
804
- e && e.forEachFeature((o) => {
805
- const i = o.get("data");
806
- i && i.id === t && o.setStyle(n ? setShipStyle(!1, i.id) : setBlankStyle());
807
- });
808
- }, findShip = (e, t, n = !0) => {
809
- var i, r, l, c, s;
810
- if (!e || !mapInstance$6.value) return;
811
- const o = (l = (r = (i = shipsLayer.value) == null ? void 0 : i.getSource()) == null ? void 0 : r.getFeatures()) == null ? void 0 : l.find((m) => {
812
- var d;
813
- return ((d = m.get("data")) == null ? void 0 : d.id) === e;
814
- });
815
- if (o)
816
- selectedShipData.value = o.get("data");
817
- else if (t && t.lon && t.lat)
818
- selectedShipData.value = t;
819
- else {
820
- console.error("找不到船舶");
821
- return;
413
+ ref();
414
+ const trucksLayer = ref(), shipTrackLineFeatures = ref([]), trackLineVectorSource = ref(), shipTrackVectorLayer = ref();
415
+ ref();
416
+ ref();
417
+ const shipLabels = ref([]), trackLabels = ref([]), showTrackLayer = ref(!1), allTracks = ref([]), currentTrackId = ref(""), showTrackAnimatMarker = ref(!1), hiddenOrther = ref(!1), showMeasure = ref(!1), getShowMeasure = () => showMeasure.value;
418
+ function getIconFont(unicode = "") {
419
+ return unicode.indexOf("&amp;") !== -1 && (unicode = unicode.replace("&amp;", "&")), unicode.indexOf("&amp") !== -1 && (unicode = unicode.replace("&amp", "&")), eval('("' + unicode.replace("&#x", "\\u").replace(";", "") + '")');
420
+ }
421
+ const multiplyPixelRatio = (e) => {
422
+ const t = window.devicePixelRatio || 1;
423
+ return e.map((n) => n.map((o) => o * t));
424
+ }, 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({
425
+ text: new Text({
426
+ font: "Normal 14px map-iconfont",
427
+ text: getIconFont(e),
428
+ fill: new Fill({ color: "#fff" }),
429
+ offsetY: -14
430
+ }),
431
+ zIndex: 100
432
+ }), getRotation = (e, t, n) => {
433
+ function o(m) {
434
+ return 180 * (m % (2 * Math.PI)) / Math.PI;
822
435
  }
823
- if (selectedShips.value.some((m) => {
824
- var d;
825
- return m.id === ((d = selectedShipData.value) == null ? void 0 : d.id);
826
- }) || selectedShips.value.push(selectedShipData.value), n && ((c = selectedShipData.value) != null && c.lon) && ((s = selectedShipData.value) != null && s.lat)) {
827
- const m = mapInstance$6.value.getView(), d = new Point([selectedShipData.value.lon, selectedShipData.value.lat]);
828
- m.setCenter(transform(d.getCoordinates(), projection.data, projection.mercator));
829
- const u = m.getZoom(), f = u < mapZoom.findShipMin ? mapZoom.findShip : u;
830
- m.setZoom(f);
436
+ function i(m) {
437
+ return m % 360 * Math.PI / 180;
831
438
  }
832
- return setTimeout(() => {
833
- t && selectSingleShipMarker(t);
834
- }, 50), o;
835
- }, clearSelectFeature = () => {
836
- var e;
837
- if (selectedShipData.value && shipsVectorSource && selectSingleShipData.value) {
838
- setVisibleFeatureById(shipsVectorSource, selectSingleShipData.value.id, !1);
839
- const t = (e = shipsLayer.value) == null ? void 0 : e.getSource();
840
- t && setVisibleFeatureById(t, selectSingleShipData.value.id, !0);
439
+ function r(m) {
440
+ if (!m) throw new Error("Coordinate is required");
441
+ if (!Array.isArray(m)) {
442
+ if (m.type === "Feature" && m.geometry !== null && m.geometry.type === "Point")
443
+ return m.geometry.coordinates;
444
+ if (m.type === "Point") return m.coordinates;
445
+ }
446
+ if (Array.isArray(m) && m.length >= 2 && !Array.isArray(m[0]) && !Array.isArray(m[1]))
447
+ return m;
448
+ throw new Error(
449
+ "Coordinate must be GeoJSON Point or an Array of numbers"
450
+ );
841
451
  }
842
- selectedShipData.value = null, mapInstance$6.value && (selectShipsVectorSource == null || selectShipsVectorSource.clear(), selectShipsLayer.value = new VectorLayer({
843
- source: selectShipsVectorSource
844
- }), mapInstance$6.value.addLayer(selectShipsLayer.value), selectShipsLayer.value.setVisible(!1));
845
- }, hiddenAllShips = () => {
846
- var e, t;
847
- (e = shipsLayer.value) == null || e.setVisible(!1), (t = largeAmountShipsLayer.value) == null || t.setVisible(!1);
848
- }, switchBtnShow = ref({
849
- // 船舶摄像头过滤开关
850
- [SWITCH_BTN.Camera]: !1,
851
- // 船舶联系方式过滤开关
852
- [SWITCH_BTN.Mobile]: !1,
853
- // 船舶水尺过滤开关
854
- [SWITCH_BTN.WaterGauge]: !1
855
- }), switchFilterItem = (e, t) => {
856
- switchBtnShow.value[e] = t, renderShips(allShips.value);
857
- }, rerenderShip = () => {
858
- renderShips(allShips.value);
452
+ function l(m, f, p = {}) {
453
+ if (p.final)
454
+ return function(x, g) {
455
+ return (l(g, x) + 180) % 360;
456
+ }(m, f);
457
+ const y = r(m), h = r(f), v = i(y[0]), M = i(h[0]), S = i(y[1]), V = i(h[1]), C = Math.sin(M - v) * Math.cos(V), P = Math.cos(S) * Math.sin(V) - Math.sin(S) * Math.cos(V) * Math.cos(M - v);
458
+ return o(Math.atan2(C, P));
459
+ }
460
+ function c(m) {
461
+ return !isNaN(m) && m !== null && !Array.isArray(m);
462
+ }
463
+ function s(m, f = {}, p = {}) {
464
+ return m || console.log("Coordinates are required"), Array.isArray(m) || console.log("Coordinates must be an Array"), m.length < 2 && console.log("Coordinates must be at least 2 numbers long"), (!c(m[0]) || !c(m[1])) && console.log("Coordinates must contain numbers"), d({ type: "Point", coordinates: m }, f, p);
465
+ }
466
+ function d(m, f = {}, p = {}) {
467
+ const y = { type: "Feature" };
468
+ return p.id !== void 0 && (y.id = p.id), p.bbox && (y.bbox = p.bbox), y.properties = f || {}, y.geometry = m, y;
469
+ }
470
+ const u = l(s(e), s(t), n);
471
+ return u < 0 ? 360 + u : u;
859
472
  }, labelAlpha = 0.8, pixelRatio = window.devicePixelRatio || 1, labelFont = `500 ${12 * pixelRatio}px Arial`, labelOutSize = 2 * pixelRatio, labelHeight = 10 * pixelRatio, fillRectRadius = (e, t, n, o, i, r, l = 4) => {
860
473
  e.beginPath(), e.moveTo(t + l, n), e.arcTo(t + o, n, t + o, n + l, l), e.arcTo(t + o, n + i, t + o - l, n + i, l), e.arcTo(t, n + i, t, n + i - l, l), e.arcTo(t, n, t + l, n, l), e.closePath(), e.fillStyle = r, e.fill();
861
474
  }, getPixelFromCoordinate = (e) => {
@@ -871,8 +484,8 @@ const renderShips = (e) => {
871
484
  let t = 0, n = 0, o = 0;
872
485
  const i = e.length;
873
486
  for (let c = 0; c < i - 1; c++) {
874
- const [s, m] = e[c], [d, u] = e[c + 1], f = s * u - d * m;
875
- o += f, t += (s + d) * f, n += (m + u) * f;
487
+ const [s, d] = e[c], [u, m] = e[c + 1], f = s * m - u * d;
488
+ o += f, t += (s + u) * f, n += (d + m) * f;
876
489
  }
877
490
  if (o *= 0.5, o === 0)
878
491
  throw new Error("多边形面积为零");
@@ -881,37 +494,37 @@ const renderShips = (e) => {
881
494
  }, rotateShapeModel = (e, t) => {
882
495
  const [n, o] = calculatePolygonCentroid(e), i = t * Math.PI / 180, r = Math.cos(i), l = Math.sin(i);
883
496
  return e.map(([c, s]) => {
884
- const m = c - n, d = s - o, u = m * r - d * l + n, f = m * l + d * r + o;
885
- return [u, f];
497
+ const d = c - n, u = s - o, m = d * r - u * l + n, f = d * l + u * r + o;
498
+ return [m, f];
886
499
  });
887
500
  }, getTopLeftPoint = (e) => [e[0], e[3]], getBottomLeftPoint = (e) => [e[2], e[3]], getBottomRightPoint = (e) => [e[2], e[1]], getTopRighttPoint = (e) => [e[0], e[1]];
888
501
  function calculateBounds(e, t, n, o, i) {
889
502
  let r, l, c, s;
890
- const m = e[0], d = e[1];
503
+ const d = e[0], u = e[1];
891
504
  switch (t) {
892
505
  case 0:
893
- r = m + i, l = r + n, s = d - i, c = s - o;
506
+ r = d + i, l = r + n, s = u - i, c = s - o;
894
507
  break;
895
508
  case 1:
896
- r = m + i, l = r + n, s = d + o / 2, c = s - o;
509
+ r = d + i, l = r + n, s = u + o / 2, c = s - o;
897
510
  break;
898
511
  case 2:
899
- r = m + i, l = r + n, s = d + i + o, c = s - o;
512
+ r = d + i, l = r + n, s = u + i + o, c = s - o;
900
513
  break;
901
514
  case 3:
902
- r = m - n / 2, l = r + n, s = d + i + o, c = s - o;
515
+ r = d - n / 2, l = r + n, s = u + i + o, c = s - o;
903
516
  break;
904
517
  case 4:
905
- l = m, r = l - n, s = d + i + o, c = s - o;
518
+ l = d, r = l - n, s = u + i + o, c = s - o;
906
519
  break;
907
520
  case 5:
908
- l = m - i, r = l - n, s = d + o / 2, c = s - o;
521
+ l = d - i, r = l - n, s = u + o / 2, c = s - o;
909
522
  break;
910
523
  case 6:
911
- l = m, r = l - n, s = d - i, c = s - o;
524
+ l = d, r = l - n, s = u - i, c = s - o;
912
525
  break;
913
526
  case 7:
914
- r = m - n / 2, l = r + n, s = d - i, c = s - o;
527
+ r = d - n / 2, l = r + n, s = u - i, c = s - o;
915
528
  }
916
529
  if (!(!r || !c || !l || !s))
917
530
  return [Math.min(r, l), Math.min(c, s), Math.max(r, l), Math.max(c, s) + 1];
@@ -954,44 +567,44 @@ function drawLabelBody(e, t, n) {
954
567
  center: l,
955
568
  text: c,
956
569
  leftIcon: s,
957
- shipColor: m,
958
- lineLength: d = 20,
959
- selected: u
570
+ shipColor: d,
571
+ lineLength: u = 20,
572
+ selected: m
960
573
  } = n;
961
574
  e.save(), o && (e.font = o);
962
575
  let f = e.measureText(c).width + 4 * i;
963
- (s || m) && (f += r + 6 * i), e.restore();
964
- let p, y = 20, h = -1, g = r + 3 * i;
965
- if (d)
966
- for (let k = 0; k < 8; k++) {
967
- p = calculateBounds(l, k, f, g, d);
968
- let T = !1;
969
- for (let I = 0; I < t.length; ++I) {
970
- let F = t[I].bounds, V = [
971
- F[0] - y,
972
- F[1] - y,
973
- F[2] + y,
974
- F[3] + y
576
+ (s || d) && (f += r + 6 * i), e.restore();
577
+ let p, y = 20, h = -1, v = r + 3 * i;
578
+ if (u)
579
+ for (let M = 0; M < 8; M++) {
580
+ p = calculateBounds(l, M, f, v, u);
581
+ let S = !1;
582
+ for (let V = 0; V < t.length; ++V) {
583
+ let C = t[V].bounds, P = [
584
+ C[0] - y,
585
+ C[1] - y,
586
+ C[2] + y,
587
+ C[3] + y
975
588
  ];
976
- if (p && isOverlapping(p, V)) {
977
- T = !0;
589
+ if (p && isOverlapping(p, P)) {
590
+ S = !0;
978
591
  break;
979
592
  }
980
593
  }
981
- if (!T) {
982
- h = k;
594
+ if (!S) {
595
+ h = M;
983
596
  break;
984
597
  }
985
598
  }
986
599
  else
987
- h = 0, p = calculateBounds(l, h, f, g, d);
988
- if (u && h === -1 && (h = 0), h === 5 && (h = 0), p && h > -1) {
989
- let k = getBottomLeftPoint(p), T = getTopRighttPoint(p);
600
+ h = 0, p = calculateBounds(l, h, f, v, u);
601
+ if (m && h === -1 && (h = 0), h === 5 && (h = 0), p && h > -1) {
602
+ let M = getBottomLeftPoint(p), S = getTopRighttPoint(p);
990
603
  return {
991
604
  center: l,
992
- x: calculateAnchorPoint(l, h, f, g, d),
993
- l: T,
994
- r: k,
605
+ x: calculateAnchorPoint(l, h, f, v, u),
606
+ l: S,
607
+ r: M,
995
608
  bounds: p,
996
609
  position: h,
997
610
  name: c
@@ -1003,21 +616,21 @@ const drawText = (e, t) => {
1003
616
  if (!e) return;
1004
617
  const { center: n, text: o, textColor: i, leftIcon: r, rightIcons: l, font: c } = t;
1005
618
  e.save(), e.setTransform(1, 0, 0, 1, 0, 0);
1006
- let [s, m] = n;
619
+ let [s, d] = n;
1007
620
  if (r) {
1008
621
  e.font = `${18 * pixelRatio}px map-iconfont`;
1009
- let d = getIconFont(r.icon);
1010
- e.fillStyle = r.color, e.fillText(d, s + labelOutSize - 3 * pixelRatio, m + 2.6 * pixelRatio), s += 23 * pixelRatio;
622
+ let u = getIconFont(r.icon);
623
+ e.fillStyle = r.color, e.fillText(u, s + labelOutSize - 3 * pixelRatio, d + 2.6 * pixelRatio), s += 23 * pixelRatio;
1011
624
  }
1012
625
  if (l != null && l.length) {
1013
626
  e.font = `${12 * pixelRatio}px map-iconfont`, e.fillStyle = "#3370ff";
1014
- const d = e.measureText(o).width + 6 * pixelRatio;
1015
- l.forEach((u, f) => {
1016
- const p = getIconFont(u), y = 20 * pixelRatio * f;
1017
- e.fillText(p, s + d + y, m);
627
+ const u = e.measureText(o).width + 6 * pixelRatio;
628
+ l.forEach((m, f) => {
629
+ const p = getIconFont(m), y = 20 * pixelRatio * f;
630
+ e.fillText(p, s + u + y, d);
1018
631
  });
1019
632
  }
1020
- e.font = c || labelFont, e.fillStyle = i, e.fillText(o, s + 2, m), e.restore();
633
+ e.font = c || labelFont, e.fillStyle = i, e.fillText(o, s + 2, d), e.restore();
1021
634
  }, drawPolygon = (e, t) => {
1022
635
  let {
1023
636
  points: n,
@@ -1027,35 +640,35 @@ const drawText = (e, t) => {
1027
640
  translation: l,
1028
641
  rotation: c,
1029
642
  rotationCenter: s,
1030
- scale: m,
1031
- globalAlpha: d
643
+ scale: d,
644
+ globalAlpha: u
1032
645
  } = t;
1033
- if (d || (d = 1), n && e) {
1034
- e.save(), e.beginPath(), c && c !== 0 && s == null && e.rotate(c), l && e.translate(l[0], l[1]), c && (s != null && s.length) && e.rotate(c), m && e.scale(m, m), e.moveTo(n[0][0], n[0][1]);
1035
- for (let u = 1; u < n.length; u++)
1036
- e.lineTo(n[u][0], n[u][1]);
1037
- r && e.closePath(), o && (e.strokeStyle = o, e.stroke()), i && r && (d && (e.globalAlpha = d), e.fillStyle = i, e.fill()), e.restore();
646
+ if (u || (u = 1), n && e) {
647
+ e.save(), e.beginPath(), c && c !== 0 && s == null && e.rotate(c), l && e.translate(l[0], l[1]), c && (s != null && s.length) && e.rotate(c), d && e.scale(d, d), e.moveTo(n[0][0], n[0][1]);
648
+ for (let m = 1; m < n.length; m++)
649
+ e.lineTo(n[m][0], n[m][1]);
650
+ r && e.closePath(), o && (e.strokeStyle = o, e.stroke()), i && r && (u && (e.globalAlpha = u), e.fillStyle = i, e.fill()), e.restore();
1038
651
  }
1039
- }, intervalIds = {}, drawLabel = (e, t, n) => {
1040
- var u, f, p, y, h, g, k;
1041
- let { center: o, text: i, color: r, textColor: l, bgColor: c, leftIcon: s, rightIcons: m, type: d } = t;
1042
- if (o && i) {
1043
- const T = {
652
+ }, intervalIds = {}, drawLabel = (e, t, n, o) => {
653
+ var f, p, y, h, v, M, S;
654
+ let { center: i, text: r, color: l, textColor: c, bgColor: s, leftIcon: d, rightIcons: u, type: m } = t;
655
+ if (i && r) {
656
+ const V = {
1044
657
  font: labelFont,
1045
658
  labelOutSize,
1046
659
  labelHeight,
1047
- center: o,
1048
- text: i,
1049
- leftIcon: s,
660
+ center: i,
661
+ text: r,
662
+ leftIcon: d,
1050
663
  selected: t.selected
1051
664
  };
1052
- (u = t.blinkColors) != null && u.length && t.fill && (c = t.fill, l = getForegroundColor(t.fill));
1053
- const I = drawLabelBody(e, n, T);
1054
- if (I) {
1055
- const { x: F, bounds: V, l: P } = I, v = [getTopLeftPoint(V), getBottomLeftPoint(V), getBottomRightPoint(V), getTopRighttPoint(V)];
1056
- n.find((E) => E.name === i) || n.push(I), drawPolygon(e, {
1057
- points: [o, F],
1058
- strokeColor: r,
665
+ (f = t.blinkColors) != null && f.length && t.fill && (s = t.fill, c = getForegroundColor(t.fill));
666
+ const C = drawLabelBody(e, n, V);
667
+ if (C) {
668
+ const { x: P, bounds: x, l: g } = C, w = [getTopLeftPoint(x), getBottomLeftPoint(x), getBottomRightPoint(x), getTopRighttPoint(x)];
669
+ n.find((F) => F.name === r) || n.push(C), drawPolygon(e, {
670
+ points: [i, P],
671
+ strokeColor: l,
1059
672
  fillColor: "#000",
1060
673
  shouldClosePath: !0,
1061
674
  translation: void 0,
@@ -1063,46 +676,47 @@ const drawText = (e, t) => {
1063
676
  rotationCenter: void 0,
1064
677
  scale: void 0,
1065
678
  globalAlpha: labelAlpha
1066
- }), m != null && m.length && m.forEach(() => {
1067
- v[1][0] += pixelRatio * 18, v[2][0] += pixelRatio * 18;
679
+ }), u != null && u.length && u.forEach(() => {
680
+ w[1][0] += pixelRatio * 18, w[2][0] += pixelRatio * 18;
1068
681
  });
1069
- const w = {
1070
- points: v,
1071
- strokeColor: r,
1072
- fillColor: c,
682
+ const k = {
683
+ points: w,
684
+ strokeColor: l,
685
+ fillColor: s,
1073
686
  shouldClosePath: !0
1074
- }, [S, M] = P, C = {
1075
- center: [S, M + labelOutSize + labelHeight + 1],
1076
- text: i,
1077
- textColor: l,
1078
- leftIcon: s,
1079
- rightIcons: m,
687
+ }, [T, E] = g, I = {
688
+ center: [T, E + labelOutSize + labelHeight + 1],
689
+ text: r,
690
+ textColor: c,
691
+ leftIcon: d,
692
+ rightIcons: u,
1080
693
  blinkColors: t.blinkColors
1081
694
  };
1082
- if (drawPolygon(e, w), drawText(e, C), t != null && t.blinkColors && t.blinkColors.length > 0) {
1083
- let E = Date.now(), x = 0;
1084
- const N = t.blinkColors;
1085
- !!!((y = (p = (f = selectShipsLayer.value) == null ? void 0 : f.getSource()) == null ? void 0 : p.getFeatures()) != null && y.find(($) => {
1086
- var R;
1087
- return ((R = $.get("data")) == null ? void 0 : R.id) === t.id;
1088
- }) || (k = (g = (h = shipsLayer.value) == null ? void 0 : h.getSource()) == null ? void 0 : g.getFeatures()) != null && k.find(($) => {
1089
- var R;
1090
- return ((R = $.get("data")) == null ? void 0 : R.id) === t.id;
1091
- })) || hiddenOrther.value ? (clearInterval(intervalIds[t.id]), deleteLabelFromArray(n, i)) : (intervalIds[t.id] && clearInterval(intervalIds[t.id]), intervalIds[t.id] = window.setInterval(() => {
1092
- var D, G, _;
1093
- const $ = Date.now();
1094
- $ - E >= 500 && (x = (x + 1) % N.length, E = $, w.fillColor = N[x], drawPolygon(e, w), C.textColor = getForegroundColor(w.fillColor), drawText(e, C));
1095
- const R = shipsMarkerList == null ? void 0 : shipsMarkerList.some((O) => {
1096
- var B;
1097
- return ((B = O.ship) == null ? void 0 : B.id) === t.id;
1098
- }), Z = (_ = (G = (D = shipsLayer.value) == null ? void 0 : D.getSource()) == null ? void 0 : G.getFeatures()) == null ? void 0 : _.some((O) => {
1099
- const B = O.get("data");
1100
- return (B == null ? void 0 : B.id) === t.id;
1101
- });
1102
- !R && !Z && (clearInterval(intervalIds[t.id]), deleteLabelFromArray(n, i));
695
+ if (drawPolygon(e, k), drawText(e, I), t != null && t.blinkColors && t.blinkColors.length > 0) {
696
+ let F = Date.now(), $ = 0;
697
+ const R = t.blinkColors;
698
+ !!!((h = (y = (p = selectShipsLayer.value) == null ? void 0 : p.getSource()) == null ? void 0 : y.getFeatures()) != null && h.find((N) => {
699
+ var A;
700
+ return ((A = N.get("data")) == null ? void 0 : A.id) === t.id;
701
+ }) || (S = (M = (v = shipsLayer.value) == null ? void 0 : v.getSource()) == null ? void 0 : M.getFeatures()) != null && S.find((N) => {
702
+ var A;
703
+ return ((A = N.get("data")) == null ? void 0 : A.id) === t.id;
704
+ })) || hiddenOrther.value ? (clearInterval(intervalIds[t.id]), deleteLabelFromArray(n, r)) : (intervalIds[t.id] && clearInterval(intervalIds[t.id]), intervalIds[t.id] = window.setInterval(() => {
705
+ var _, Z, U;
706
+ const N = Date.now();
707
+ N - F >= 500 && ($ = ($ + 1) % R.length, F = N, k.fillColor = R[$], drawPolygon(e, k), I.textColor = getForegroundColor(k.fillColor), drawText(e, I)), ((U = (Z = (_ = shipsLayer.value) == null ? void 0 : _.getSource()) == null ? void 0 : Z.getFeatures()) == null ? void 0 : U.some((z) => {
708
+ const O = z.get("data");
709
+ if ((O == null ? void 0 : O.id) === t.id) {
710
+ const D = o == null ? void 0 : o.getView().calculateExtent();
711
+ if (!D) return !1;
712
+ const G = fromLonLat([O.lon, O.lat]);
713
+ return G[0] >= D[0] && G[0] <= D[2] && G[1] >= D[1] && G[1] <= D[3];
714
+ }
715
+ return !1;
716
+ })) || (clearInterval(intervalIds[t.id]), deleteLabelFromArray(n, r));
1103
717
  }, 10));
1104
718
  } else
1105
- shipLabels.value.find((x) => x.name === i) && (clearInterval(intervalIds[t.id]), drawPolygon(e, w), drawText(e, C));
719
+ shipLabels.value.find(($) => $.name === r) && (clearInterval(intervalIds[t.id]), drawPolygon(e, k), drawText(e, I));
1106
720
  }
1107
721
  }
1108
722
  return null;
@@ -1136,8 +750,8 @@ function gcj02ToWgs84(e) {
1136
750
  l = 1 - ee * l * l;
1137
751
  const c = Math.sqrt(l);
1138
752
  o = o * 180 / (a * (1 - ee) / (l * c) * PI), i = i * 180 / (a / c * Math.cos(r) * PI);
1139
- const s = n + o, m = t + i;
1140
- return `${(t * 2 - m).toFixed(6)}, ${(n * 2 - s).toFixed(6)}`;
753
+ const s = n + o, d = t + i;
754
+ return `${(t * 2 - d).toFixed(6)}, ${(n * 2 - s).toFixed(6)}`;
1141
755
  }
1142
756
  }
1143
757
  function calculateCirclePoints(e, t) {
@@ -1168,45 +782,54 @@ function mercatorToLonLat(e, t = "lonlat") {
1168
782
  function calculateBoundingBox(e) {
1169
783
  let t = 1 / 0, n = -1 / 0, o = 1 / 0, i = -1 / 0;
1170
784
  e.forEach((h) => {
1171
- const [g, k] = h;
1172
- t = Math.min(t, k), n = Math.max(n, k), o = Math.min(o, g), i = Math.max(i, g);
785
+ const [v, M] = h;
786
+ t = Math.min(t, M), n = Math.max(n, M), o = Math.min(o, v), i = Math.max(i, v);
1173
787
  });
1174
- const r = i - o, l = n - t, c = Math.max(r, l), s = (o + i) / 2, m = (t + n) / 2, d = c / 2, u = s - d, f = s + d, p = m - d, y = m + d;
1175
- return [f, p, u, y];
788
+ const r = i - o, l = n - t, c = Math.max(r, l), s = (o + i) / 2, d = (t + n) / 2, u = c / 2, m = s - u, f = s + u, p = d - u, y = d + u;
789
+ return [f, p, m, y];
1176
790
  }
1177
791
  const transformUtils = {
1178
792
  gcj02ToWgs84,
1179
793
  calculateCirclePoints,
1180
794
  lonLatToMercator,
1181
795
  mercatorToLonLat,
1182
- calculateBoundingBox
1183
- }, mapInstance$5 = ref(), renderTrackStyleSetInstance = (e) => mapInstance$5.value = e, stopIcon = "&#xe6e2;", stopColor = "#E31818", slowIcon = "&#xe703;", slowColor = "#1890FF", dropletsIcon = "&#xe6d2", trackList$1 = ref([]);
796
+ calculateBoundingBox,
797
+ transform
798
+ }, mapInstance$7 = ref(), renderTrackStyleSetInstance = (e) => mapInstance$7.value = e, stopIcon = "&#xe6e2;", stopColor = "#E31818", slowIcon = "&#xe703;", slowColor = "#1890FF", dropletsIcon = "&#xe6d2", trackList$1 = ref([]);
1184
799
  let animationFeature;
1185
800
  const renderTrackLine = (e, t, n) => {
1186
- var r, l, c;
801
+ var l, c, s;
1187
802
  const o = e[t];
1188
803
  if (!o) return;
1189
- allTracks.value[t] = o, trackList$1.value = [], trackList$1.value = o.map((s, m) => (s.center = [s.lon, s.lat], s.centerPoint = transformUtils.lonLatToMercator(s.center), s.id = t, s.index = m, s.time = hooks(s.createdAt).format("YYYY-MM-DD HH:mm:ss"), s));
1190
- const i = trackList$1.value.map((s) => s.centerPoint);
1191
- if (i.length >= 2) {
1192
- const s = new LineString(i), m = new Feature({ geometry: s });
1193
- m.setStyle(
804
+ allTracks.value[t] = o, trackList$1.value = [];
805
+ let i = o;
806
+ o.length > 5e3 ? o.filter((d, u) => u % 5 === 0) : o.length > 4e3 ? o.filter((d, u) => u % 4 === 0) : o.length > 2e3 && o.filter((d, u) => u % 2 === 0), trackList$1.value = i.map((d, u) => {
807
+ if (Number(d.lon) > 180 || Number(d.lat) > 180) {
808
+ const [m, f] = formatUtils.convertSixHundredThousandToLatLng(d.lon, d.lat);
809
+ d.lon = m, d.lat = f;
810
+ }
811
+ return d.center = [d.lon, d.lat], d.centerPoint = transformUtils.lonLatToMercator(d.center), d.id = t, d.index = u, d.time = hooks(d.createdAt).format("YYYY-MM-DD HH:mm:ss"), d;
812
+ });
813
+ const r = trackList$1.value.map((d) => d.centerPoint);
814
+ if (r.length >= 2) {
815
+ const d = new LineString(r), u = new Feature({ geometry: d });
816
+ u.setStyle(
1194
817
  new Style({
1195
818
  stroke: new Stroke({
1196
819
  color: n,
1197
820
  width: 2
1198
821
  })
1199
822
  })
1200
- ), m.setId(t), m.set("type", "line"), (l = (r = shipTrackVectorLayer.value) == null ? void 0 : r.getSource()) == null || l.clear(), shipTrackLineFeatures.value = [];
1201
- const d = shipTrackLineFeatures.value.findIndex((f) => f.getId() === t);
1202
- d >= 0 ? shipTrackLineFeatures.value[d] = m : shipTrackLineFeatures.value.push(m);
1203
- const u = createAnimatedIconFeature(n, i);
823
+ ), u.setId(t), u.set("type", "line"), (c = (l = shipTrackVectorLayer.value) == null ? void 0 : l.getSource()) == null || c.clear(), shipTrackLineFeatures.value = [];
824
+ const m = shipTrackLineFeatures.value.findIndex((p) => p.getId() === t);
825
+ m >= 0 ? shipTrackLineFeatures.value[m] = u : shipTrackLineFeatures.value.push(u);
826
+ const f = createAnimatedIconFeature(n, r);
1204
827
  trackLineVectorSource.value = new VectorSource({
1205
828
  features: [...shipTrackLineFeatures.value]
1206
- }), animationFeature = u, console.log(animationFeature), shipTrackVectorLayer.value = new VectorLayer({
829
+ }), animationFeature = f, console.log(animationFeature), shipTrackVectorLayer.value = new VectorLayer({
1207
830
  source: trackLineVectorSource.value,
1208
831
  zIndex: 102
1209
- }), renderPoint(n), (c = mapInstance$5.value) == null || c.addLayer(shipTrackVectorLayer.value);
832
+ }), renderPoint(n), (s = mapInstance$7.value) == null || s.addLayer(shipTrackVectorLayer.value);
1210
833
  }
1211
834
  }, handlePlay = (e, t) => {
1212
835
  const n = allTracks.value[String(e)];
@@ -1240,8 +863,8 @@ let polyline, linePath, startMarker, position, geoMarker, vectorLayer;
1240
863
  const trackAnimating = ref(!1);
1241
864
  let distance = 0, lastTime = Date.now(), moveFeatureHandler = null;
1242
865
  const moveFeature = (e, t) => {
1243
- var u, f, p;
1244
- const n = Number(50 * t), o = ((u = e.frameState) == null ? void 0 : u.time) ?? Date.now(), i = o - lastTime;
866
+ var m, f, p;
867
+ const n = Number(50 * t), o = ((m = e.frameState) == null ? void 0 : m.time) ?? Date.now(), i = o - lastTime;
1245
868
  if (distance = (distance + n * i / 1e6) % 2, lastTime = o, distance >= 1) {
1246
869
  stopAnimation();
1247
870
  return;
@@ -1252,19 +875,19 @@ const moveFeature = (e, t) => {
1252
875
  distance > 1 ? distance - 0.01 : distance
1253
876
  ), c = linePath.getCoordinateAt(
1254
877
  distance > 1 ? 2 - distance : distance + 0.01
1255
- ), m = getRotation(
878
+ ), d = getRotation(
1256
879
  transformUtils.mercatorToLonLat(l, "array"),
1257
880
  transformUtils.mercatorToLonLat(c, "array")
1258
881
  ) * Math.PI / 180;
1259
- (f = geoMarkerStyle.getText()) == null || f.setRotation(m), position.setCoordinates(r);
1260
- const d = getVectorContext(e);
1261
- d.context_.save(), d.setStyle(geoMarkerStyle), d.drawGeometry(position), d.context_.restore(), (p = mapInstance$5.value) == null || p.render();
882
+ (f = geoMarkerStyle.getText()) == null || f.setRotation(d), position.setCoordinates(r);
883
+ const u = getVectorContext(e);
884
+ u.context_.save(), u.setStyle(geoMarkerStyle), u.drawGeometry(position), u.context_.restore(), (p = mapInstance$7.value) == null || p.render();
1262
885
  }, startAnimation = () => {
1263
886
  var e;
1264
887
  trackAnimating.value = !0, showTrackAnimatMarker.value = !0, lastTime = Date.now(), distance = 0, position = ((e = startMarker.getGeometry()) == null ? void 0 : e.clone()) || new Point([0, 0]), moveFeatureHandler && (vectorLayer == null || vectorLayer.on("postrender", moveFeatureHandler)), geoMarker == null || geoMarker.setGeometry(void 0);
1265
888
  }, stopAnimation = () => {
1266
889
  var e;
1267
- trackAnimating.value && (trackAnimating.value = !1, geoMarker == null || geoMarker.setGeometry(void 0), moveFeatureHandler && vectorLayer && vectorLayer.un("postrender", moveFeatureHandler), vectorLayer && ((e = mapInstance$5.value) == null || e.removeLayer(vectorLayer)), vectorLayer = null, geoMarker = null);
890
+ trackAnimating.value && (trackAnimating.value = !1, geoMarker == null || geoMarker.setGeometry(void 0), moveFeatureHandler && vectorLayer && vectorLayer.un("postrender", moveFeatureHandler), vectorLayer && ((e = mapInstance$7.value) == null || e.removeLayer(vectorLayer)), vectorLayer = null, geoMarker = null);
1268
891
  }, playAnimation = (e, t) => {
1269
892
  var o;
1270
893
  trackAnimating.value && stopAnimation(), polyline = new Polyline({
@@ -1287,42 +910,42 @@ const moveFeature = (e, t) => {
1287
910
  source: new VectorSource({
1288
911
  features: [geoMarker]
1289
912
  })
1290
- }), (o = mapInstance$5.value) == null || o.addLayer(vectorLayer), moveFeatureHandler = (i) => moveFeature(i, t), startAnimation();
913
+ }), (o = mapInstance$7.value) == null || o.addLayer(vectorLayer), moveFeatureHandler = (i) => moveFeature(i, t), startAnimation();
1291
914
  }, renderPoint = (e) => {
1292
- if (!mapInstance$5.value) return;
915
+ if (!mapInstance$7.value) return;
1293
916
  const t = trackList$1.value || [];
1294
917
  if (!(t && t.length > 1)) return [];
1295
918
  const n = { 16: 24, 17: 15, default: 4 }, o = [], i = t.length;
1296
919
  for (let c = 0; c < i; c++) {
1297
920
  t[c].index = c;
1298
- const s = mapInstance$5.value.getPixelFromCoordinate(t[c].centerPoint);
921
+ const s = mapInstance$7.value.getPixelFromCoordinate(t[c].centerPoint);
1299
922
  if (s) {
1300
- let m = s.concat(s);
1301
- m = adjustBounds(m, [20, 20]);
1302
- const d = mapInstance$5.value.getView().getZoom();
1303
- if (!d) return;
1304
- if (d > 15) {
1305
- const f = n[d] || n.default;
1306
- m = adjustBounds(m, [f, f]);
923
+ let d = s.concat(s);
924
+ d = adjustBounds(d, [20, 20]);
925
+ const u = mapInstance$7.value.getView().getZoom();
926
+ if (!u) return;
927
+ if (u > 15) {
928
+ const f = n[u] || n.default;
929
+ d = adjustBounds(d, [f, f]);
1307
930
  }
1308
- let u = !0;
931
+ let m = !0;
1309
932
  if (t[c].state !== "0") {
1310
933
  for (let f = 0; f < o.length; f++)
1311
- if (isOverlapping(m, o[f].bounds)) {
1312
- u = !1;
934
+ if (isOverlapping(d, o[f].bounds)) {
935
+ m = !1;
1313
936
  break;
1314
937
  }
1315
938
  }
1316
- u && (t[c].bounds = m, o.push(t[c]));
939
+ m && (t[c].bounds = d, o.push(t[c]));
1317
940
  }
1318
941
  }
1319
942
  const r = getIconStyle(stopIcon), l = getIconStyle(slowIcon);
1320
943
  o.forEach((c, s) => {
1321
- var u, f;
1322
- const m = new Feature({
944
+ var m, f;
945
+ const d = new Feature({
1323
946
  geometry: new Point(c.centerPoint)
1324
947
  });
1325
- m.set("type", "track_point"), m.set("data", c), m.setStyle([
948
+ d.set("type", "track_point"), d.set("data", c), d.setStyle([
1326
949
  new Style({
1327
950
  // 扩大交互热区
1328
951
  image: new CircleStyle({
@@ -1338,13 +961,13 @@ const moveFeature = (e, t) => {
1338
961
  radius: 3
1339
962
  })
1340
963
  })
1341
- ]), trackLineVectorSource.value.addFeature(m);
1342
- const d = new Feature({
964
+ ]), trackLineVectorSource.value.addFeature(d);
965
+ const u = new Feature({
1343
966
  geometry: new Point(fromLonLat(c.center))
1344
967
  });
1345
- if (d.set("type", "track_label"), d.set("track_label_index", s), d.setStyle(
968
+ if (u.set("type", "track_label"), u.set("track_label_index", s), u.setStyle(
1346
969
  setTrackLabelStyle(c, e)
1347
- ), trackLineVectorSource.value.addFeature(d), typeof c == "object" && c.hasOwnProperty("state")) {
970
+ ), trackLineVectorSource.value.addFeature(u), typeof c == "object" && c.hasOwnProperty("state")) {
1348
971
  const p = new Feature({
1349
972
  geometry: new Point(c.centerPoint)
1350
973
  });
@@ -1357,7 +980,7 @@ const moveFeature = (e, t) => {
1357
980
  }),
1358
981
  zIndex: 99
1359
982
  }), h = [];
1360
- Number(c.state) === 0 ? ((u = y.getText()) == null || u.setFill(new Fill({ color: stopColor })), h.push(r)) : Number(c.state) === 1 && ((f = y.getText()) == null || f.setFill(new Fill({ color: slowColor })), h.push(l)), h.push(y), p.setStyle(h), trackLineVectorSource.value.addFeature(p);
983
+ Number(c.state) === 0 ? ((m = y.getText()) == null || m.setFill(new Fill({ color: stopColor })), h.push(r)) : Number(c.state) === 1 && ((f = y.getText()) == null || f.setFill(new Fill({ color: slowColor })), h.push(l)), h.push(y), p.setStyle(h), trackLineVectorSource.value.addFeature(p);
1361
984
  }
1362
985
  }), renderArrow(o, e), renderIconPoint();
1363
986
  }, renderArrow = (e, t) => {
@@ -1371,74 +994,461 @@ const moveFeature = (e, t) => {
1371
994
  else {
1372
995
  const c = trackList$1.value[Math.floor(l)], s = trackList$1.value[Math.ceil(l)];
1373
996
  if (c && s) {
1374
- const [m, d] = c.centerPoint, [u, f] = s.centerPoint;
1375
- i = [(m + u) / 2, (d + f) / 2];
997
+ const [d, u] = c.centerPoint, [m, f] = s.centerPoint;
998
+ i = [(d + m) / 2, (u + f) / 2];
999
+ }
1000
+ }
1001
+ if (i) {
1002
+ const c = new Feature({
1003
+ geometry: new Point(i)
1004
+ });
1005
+ c.set("type", "track_arrow"), c.setStyle(
1006
+ new Style({
1007
+ text: new Text({
1008
+ font: "700 14px map-iconfont",
1009
+ text: getIconFont("&#xe6bc;"),
1010
+ fill: new Fill({ color: t }),
1011
+ // 设置箭头旋转 角度转为弧度
1012
+ rotation: getRotation(
1013
+ e[o].center,
1014
+ e[o + 1].center
1015
+ ) * (Math.PI / 180)
1016
+ })
1017
+ })
1018
+ ), trackLineVectorSource.value.addFeature(c);
1019
+ }
1020
+ }
1021
+ }, renderIconPoint = () => {
1022
+ const e = "&#xe69b;", t = "#fcdc3f", n = "#ff0000";
1023
+ (trackList$1.value.length < 2 ? [trackList$1.value[0]] : [trackList$1.value[0], trackList$1.value[trackList$1.value.length - 1]]).forEach((i) => {
1024
+ const r = new Feature({
1025
+ geometry: new Point(i.centerPoint)
1026
+ });
1027
+ r.set("type", "track_begin"), r.set("data", i);
1028
+ const l = i.index === 0 && trackList$1.value.length >= 2 ? t : n;
1029
+ r.setStyle(
1030
+ new Style({
1031
+ text: new Text({
1032
+ font: "Normal 14px map-iconfont",
1033
+ text: getIconFont(e),
1034
+ fill: new Fill({ color: l })
1035
+ }),
1036
+ zIndex: 101
1037
+ })
1038
+ ), trackLineVectorSource.value.addFeature(r);
1039
+ });
1040
+ }, setTrackLabelStyle = (e, t) => new Style({
1041
+ renderer: (n, o) => {
1042
+ const i = o.context, c = {
1043
+ id: e.id || "",
1044
+ center: n,
1045
+ text: e.time,
1046
+ color: t,
1047
+ textColor: "#000",
1048
+ bgColor: "rgba(255,255,255,.8)",
1049
+ selected: !0,
1050
+ type: "TrackTime"
1051
+ };
1052
+ drawLabel(i, c, trackLabels.value);
1053
+ }
1054
+ }), triangleModel = multiplyPixelRatio([
1055
+ [0, -8],
1056
+ [5, 8],
1057
+ [-5, 8]
1058
+ ]), shipShapeModel = multiplyPixelRatio([
1059
+ [0, -4.545],
1060
+ [-0.56, -3.909],
1061
+ [-1, -2.727],
1062
+ [-1, 3.636],
1063
+ [-0.8, 4.545],
1064
+ [0.8, 4.545],
1065
+ [1, 3.636],
1066
+ [1, -2.727],
1067
+ [0.56, -3.909],
1068
+ [0, -4.545]
1069
+ ]), shipDirectPath = {
1070
+ left: {
1071
+ 0: [
1072
+ [0, 0],
1073
+ [0, -8],
1074
+ [-4, -8]
1075
+ ],
1076
+ 1: [
1077
+ [0, 0],
1078
+ [0, -16],
1079
+ [-6, -16]
1080
+ ],
1081
+ 2: [
1082
+ [0, 0],
1083
+ [0, -24],
1084
+ [-8, -24]
1085
+ ]
1086
+ },
1087
+ right: {
1088
+ 0: [
1089
+ [0, 0],
1090
+ [0, -8],
1091
+ [-4, -8]
1092
+ ],
1093
+ 1: [
1094
+ [0, 0],
1095
+ [0, -16],
1096
+ [-6, -16]
1097
+ ],
1098
+ 2: [
1099
+ [0, 0],
1100
+ [0, -24],
1101
+ [-8, -24]
1102
+ ]
1103
+ },
1104
+ front: {
1105
+ 0: [
1106
+ [0, 0],
1107
+ [0, -8]
1108
+ ],
1109
+ 1: [
1110
+ [0, 0],
1111
+ [0, -16]
1112
+ ],
1113
+ 2: [
1114
+ [0, 0],
1115
+ [0, -24]
1116
+ ]
1117
+ }
1118
+ }, setBlankStyle = () => new Style({
1119
+ image: new CircleStyle({
1120
+ radius: 0
1121
+ })
1122
+ }), mapInstance$6 = ref(), renderShipStyleSetInstance = (e) => mapInstance$6.value = e, speedCondition = [[1, 10], [10, 20], [20, 1 / 0]], drawShipModelByZoom = { 14: [200, 30], 15: [115, 15], 16: [55, 8], 17: [25, 5], 18: [1, 1] }, setShipStyle = (e, t = !1) => new Style({
1123
+ renderer: (n, o) => {
1124
+ n = n;
1125
+ const i = o.context, r = o.feature.get("data");
1126
+ if (!r) return;
1127
+ o.feature.get("index") === 0 && (shipLabels.value = []);
1128
+ try {
1129
+ const c = drawShipBody(i, r, n, t);
1130
+ c && (drawHeading(i, r, c, t), r.selected = e, e && setTimeout(() => {
1131
+ drawSelectBounds(i, c);
1132
+ }, 1)), drawShipLabel(i, r, n);
1133
+ } catch {
1134
+ return !1;
1135
+ }
1136
+ }
1137
+ }), drawShipBody = (e, t, n, o) => {
1138
+ if (!mapInstance$6.value) return;
1139
+ const i = Math.round(Number(mapInstance$6.value.getView().getZoom()));
1140
+ if (!i) return;
1141
+ let r = [];
1142
+ const [l, c] = drawShipModelByZoom[i] || [0, 0], [s, d] = n;
1143
+ if (i <= mapZoom.shipModelMax && i > mapZoom.shipModelMin && t.length >= l && t.breadth >= c)
1144
+ r = rotateShapeModel(drawCurrentShipShapeModel(t, i), t.angle).map((m) => {
1145
+ const [f, p] = m;
1146
+ return [s + f, d + p];
1147
+ });
1148
+ else {
1149
+ const u = rotateShapeModel(triangleModel, t.angle);
1150
+ n.length === 2 && (r = u.map((m) => {
1151
+ const [f, p] = m;
1152
+ return [s + f, d + p];
1153
+ }));
1154
+ }
1155
+ if (!(r.length > 2)) return !1;
1156
+ if (t != null && t.length) {
1157
+ const u = r.length === 3 ? 30 : t.length * 0.4;
1158
+ e.beginPath(), e.arc(
1159
+ n[0],
1160
+ n[1],
1161
+ u,
1162
+ 0,
1163
+ 2 * Math.PI
1164
+ ), e.fillStyle = "rgba(255, 255, 255, 0.001)", e.fill();
1165
+ }
1166
+ e.save(), e.beginPath(), e.moveTo(r[0][0], r[0][1]);
1167
+ for (let u = 1; u < r.length; u++)
1168
+ e.lineTo(r[u][0], r[u][1]);
1169
+ return e.closePath(), e.strokeStyle = o ? "#ff0000" : "#000", e.lineWidth = o ? 2 : 1, e.stroke(), e.fillStyle = t.fill, e.fill(), e.restore(), r;
1170
+ }, drawHeading = (e, t, n, o) => {
1171
+ const [i, r] = n[0], l = getShipDirectPath(t);
1172
+ if (l) {
1173
+ const c = l.map(function(s) {
1174
+ const [d, u] = s;
1175
+ return [d + i, u + r];
1176
+ });
1177
+ if (e.save(), e.beginPath(), t.angle > 0) {
1178
+ e.translate(i, r);
1179
+ const s = t.angle * Math.PI / 180;
1180
+ e.rotate(s), e.translate(-i, -r);
1181
+ }
1182
+ e.moveTo(i, r);
1183
+ for (let s = 1; s < c.length; s++) {
1184
+ const [d, u] = c[s];
1185
+ e.lineTo(d, u);
1186
+ }
1187
+ e.strokeStyle = o ? "#ff0000" : "#000", e.lineWidth = o ? 2 : 1, e.stroke(), e.restore();
1188
+ }
1189
+ }, drawSelectBounds = (e, t) => {
1190
+ let [n, o, i, r] = getPixelFromCoordinate(t);
1191
+ const l = window.devicePixelRatio || 1, c = 4;
1192
+ n -= c, o -= c, i += c, r += c, e.save(), e.strokeStyle = "#ff0000", e.lineWidth = 4 * l;
1193
+ const s = 8 * l;
1194
+ e.beginPath(), e.moveTo(n + s, r), e.lineTo(n, r), e.lineTo(n, r - s), e.moveTo(n, o + s), e.lineTo(n, o), e.lineTo(n + s, o), e.moveTo(i - s, o), e.lineTo(i, o), e.lineTo(i, o + s), e.moveTo(i, r - s), e.lineTo(i, r), e.lineTo(i - s, r), e.stroke(), e.restore();
1195
+ }, drawShipLabel = (e, t, n) => {
1196
+ if (!t.selected && shipLabels.value.find((m) => m.name === t.name)) return;
1197
+ const [o, i] = n, r = o, l = i, c = t.name;
1198
+ let s;
1199
+ t.leftIconColor && (s = { color: t.leftIconColor, icon: "&#xe599;" });
1200
+ const d = getShipCustomIcon(t), u = {
1201
+ id: t.id,
1202
+ center: [r, l],
1203
+ text: c,
1204
+ fill: t.fill,
1205
+ color: "#fff",
1206
+ textColor: "#000",
1207
+ bgColor: "#fff",
1208
+ leftIcon: s,
1209
+ rightIcons: d,
1210
+ selected: t.selected,
1211
+ blinkColors: t.blinkColors,
1212
+ type: "ShipName"
1213
+ };
1214
+ drawLabel(e, u, shipLabels.value, mapInstance$6.value);
1215
+ }, drawCurrentShipShapeModel = (e, t) => {
1216
+ let n = 0;
1217
+ t <= 14 ? n = 0.058 : t === 15 ? n = 0.12 : t === 16 ? n = 0.22 : t === 17 ? n = 0.435 : t === 18 && (n = 0.857);
1218
+ const o = e.length / 4 * n, i = e.breadth * n;
1219
+ let r = cloneDeep(shipShapeModel);
1220
+ return r = r.map(([l, c]) => [l * i, c * o]), r;
1221
+ }, getShipDirectPath = (e) => {
1222
+ const { speed: t, hdg: n, cog: o } = e;
1223
+ let i = "", r = null;
1224
+ if (t && t > 1 && (n !== null && n != 511 && o !== null ? o - n >= 3 ? i = "left" : o - n <= -3 ? i = "right" : i = "front" : i = "front", i && t))
1225
+ for (let l = 0; l < speedCondition.length; l++) {
1226
+ const c = speedCondition[l];
1227
+ if (t >= c[0] && t < c[1]) {
1228
+ r = shipDirectPath[i][l];
1229
+ break;
1376
1230
  }
1377
1231
  }
1378
- if (i) {
1379
- const c = new Feature({
1380
- geometry: new Point(i)
1232
+ return r;
1233
+ }, getShipCustomIcon = (e) => {
1234
+ const t = [];
1235
+ return e.existDevice && t.push("&#xe687;"), e.existMobile && t.push("&#xe688;"), e.existWaterGauge && t.push("&#xe686;"), t || [];
1236
+ }, mapInstance$5 = ref(), renderShipSetInstance = (e) => mapInstance$5.value = e;
1237
+ let shipsMarkerList = [], shipsVectorSource, largeAmountShipsSource;
1238
+ const selectedShipData = ref(null), selectedShips = ref([]);
1239
+ let selectShipsVectorSource;
1240
+ const renderShips = (e) => {
1241
+ var n, o, i, r;
1242
+ if (!mapInstance$5.value || showTrackLayer.value) return;
1243
+ const t = Math.round(Number(mapInstance$5.value.getView().getZoom()));
1244
+ if (selectedShipData.value && nextTick(() => {
1245
+ selectSingleShipMarker(selectedShipData.value);
1246
+ }).then((l) => {
1247
+ }), !(!t || t < mapZoom.shipGreenDotMax) && (allShips.value = [...e, ...selectedShips.value], !hiddenOrther.value))
1248
+ return t >= mapZoom.shipGreenDotMax && t < mapZoom.shipModelMin ? ((n = shipsLayer.value) == null || n.setVisible(!1), (o = largeAmountShipsLayer.value) == null || o.setVisible(!0), renderLargeAmountShips(allShips.value)) : ((i = largeAmountShipsLayer.value) == null || i.setVisible(!1), (r = shipsLayer.value) == null || r.setVisible(!0), renderShipsMarker(allShips.value));
1249
+ }, renderLargeAmountShips = (e) => {
1250
+ if (!mapInstance$5.value) return;
1251
+ const t = e.map((n) => ({
1252
+ type: "Feature",
1253
+ geometry: {
1254
+ type: "Point",
1255
+ coordinates: [n.lon, n.lat]
1256
+ },
1257
+ properties: n
1258
+ }));
1259
+ return largeAmountShipsSource == null || largeAmountShipsSource.clear(), largeAmountShipsSource = new VectorSource({
1260
+ features: new GeoJSON().readFeatures({
1261
+ type: "FeatureCollection",
1262
+ features: t
1263
+ }, {
1264
+ featureProjection: projection.mercator
1265
+ })
1266
+ }), largeAmountShipsLayer.value = new WebGLPointsLayer({
1267
+ source: largeAmountShipsSource,
1268
+ style: {
1269
+ "shape-points": 3,
1270
+ "shape-radius": 9,
1271
+ "shape-fill-color": [
1272
+ "case",
1273
+ ["==", ["get", "fill"], "#D9001C"],
1274
+ "#D9001C",
1275
+ // 如果 fill 是 #D9001C,返回红色
1276
+ ["==", ["get", "fill"], "#04C900"],
1277
+ "#04C900",
1278
+ // 如果 fill 是 #04C900,返回绿色
1279
+ "#04C900"
1280
+ // 默认颜色(绿色)
1281
+ ],
1282
+ "shape-rotate-with-view": !1,
1283
+ "shape-rotation": [
1284
+ "+",
1285
+ ["get", "cog"],
1286
+ // 获取 'cog' 属性值
1287
+ 180
1288
+ // 将值旋转 180 度
1289
+ ],
1290
+ "shape-scale": [0.8, 1.2],
1291
+ "shape-stroke-color": "#000000",
1292
+ // 边框颜色为黑色
1293
+ "shape-stroke-width": 0.5
1294
+ // 边框宽度为0.5px
1295
+ }
1296
+ }), mapInstance$5.value.addLayer(largeAmountShipsLayer.value), largeAmountShipsLayer.value;
1297
+ }, renderShipsMarker = (e) => {
1298
+ var n;
1299
+ if (!mapInstance$5.value) return;
1300
+ deleteAllShipMarkers();
1301
+ let t = convertShipMapData(e);
1302
+ if (t = customFilterShips(t), !!(t != null && t.length))
1303
+ return t.forEach((o, i) => {
1304
+ const r = [o.lon, o.lat], l = new Feature({
1305
+ geometry: new Point(fromLonLat(r))
1306
+ }), c = 1;
1307
+ l.set("clickGeometry", new Circle(fromLonLat(r), c)), l.set("data", o), l.set("index", i), l.setStyle(
1308
+ setShipStyle(!1)
1309
+ ), shipsMarkerList.push({
1310
+ ship: o,
1311
+ lonlat: r,
1312
+ feature: l
1381
1313
  });
1382
- c.set("type", "track_arrow"), c.setStyle(
1383
- new Style({
1384
- text: new Text({
1385
- font: "700 14px map-iconfont",
1386
- text: getIconFont("&#xe6bc;"),
1387
- fill: new Fill({ color: t }),
1388
- // 设置箭头旋转 角度转为弧度
1389
- rotation: getRotation(
1390
- e[o].center,
1391
- e[o + 1].center
1392
- ) * (Math.PI / 180)
1393
- })
1394
- })
1395
- ), trackLineVectorSource.value.addFeature(c);
1314
+ }), shipsVectorSource = new VectorSource({
1315
+ features: shipsMarkerList.map((o) => o.feature)
1316
+ }), shipsLayer.value = new VectorLayer({
1317
+ source: shipsVectorSource,
1318
+ zIndex: 100
1319
+ }), (n = mapInstance$5.value) == null || n.addLayer(shipsLayer.value), shipsLayer.value;
1320
+ }, onShipsMarkerHover = () => {
1321
+ var o;
1322
+ let e = null, t = 0;
1323
+ const n = 100;
1324
+ (o = mapInstance$5.value) == null || o.on("pointermove", function(i) {
1325
+ var s, d, u, m;
1326
+ const r = Date.now();
1327
+ if (r - t < n)
1328
+ return;
1329
+ t = r;
1330
+ const l = (s = mapInstance$5.value) == null ? void 0 : s.forEachFeatureAtPixel(i.pixel, (f) => f), c = (d = mapInstance$5.value) == null ? void 0 : d.getTargetElement();
1331
+ if (c && (c.style.cursor = l ? "pointer" : ""), e !== l) {
1332
+ if (e) {
1333
+ const f = e.get("data");
1334
+ if (!(f != null && f.mmsi)) return;
1335
+ e.setStyle(
1336
+ setShipStyle(((u = selectedShipData.value) == null ? void 0 : u.id) === f.id, !1)
1337
+ );
1338
+ }
1339
+ if (l) {
1340
+ const f = l.get("data");
1341
+ if (!(f != null && f.mmsi)) return;
1342
+ e = l, l.setStyle(
1343
+ setShipStyle(((m = selectedShipData.value) == null ? void 0 : m.id) === f.id, !0)
1344
+ );
1345
+ } else
1346
+ e = null;
1396
1347
  }
1397
- }
1398
- }, renderIconPoint = () => {
1399
- const e = "&#xe69b;", t = "#fcdc3f", n = "#ff0000";
1400
- (trackList$1.value.length < 2 ? [trackList$1.value[0]] : [trackList$1.value[0], trackList$1.value[trackList$1.value.length - 1]]).forEach((i) => {
1401
- const r = new Feature({
1402
- geometry: new Point(i.centerPoint)
1403
- });
1404
- r.set("type", "track_begin"), r.set("data", i);
1405
- const l = i.index === 0 && trackList$1.value.length >= 2 ? t : n;
1406
- r.setStyle(
1407
- new Style({
1408
- text: new Text({
1409
- font: "Normal 14px map-iconfont",
1410
- text: getIconFont(e),
1411
- fill: new Fill({ color: l })
1412
- }),
1413
- zIndex: 101
1414
- })
1415
- ), trackLineVectorSource.value.addFeature(r);
1416
1348
  });
1417
- }, setTrackLabelStyle = (e, t) => new Style({
1418
- renderer: (n, o) => {
1419
- const i = o.context, c = {
1420
- id: e.id || "",
1421
- center: n,
1422
- text: e.time,
1423
- color: t,
1424
- textColor: "#000",
1425
- bgColor: "rgba(255,255,255,.8)",
1426
- selected: !0,
1427
- type: "TrackTime"
1428
- };
1429
- drawLabel(i, c, trackLabels.value);
1349
+ }, customFilterShips = (e) => {
1350
+ let t = cloneDeep(e);
1351
+ return t = t.filter((n) => {
1352
+ var i;
1353
+ const o = getFilterItem(n).every(({ btnShow: r, value: l }) => r ? !!l : !0);
1354
+ return (switchBtnShow.value.camera || switchBtnShow.value.mobile || switchBtnShow.value.waterGauge) && ((i = selectedShipData.value) == null ? void 0 : i.id) === n.id && clearSelectFeature(), o;
1355
+ }), t;
1356
+ }, getFilterItem = (e) => [
1357
+ { btnShow: switchBtnShow.value.camera, value: e == null ? void 0 : e.existDevice },
1358
+ { btnShow: switchBtnShow.value.mobile, value: e == null ? void 0 : e.existMobile },
1359
+ { btnShow: switchBtnShow.value.waterGauge, value: e == null ? void 0 : e.existWaterGauge }
1360
+ ], deleteAllShipMarkers = () => {
1361
+ shipsMarkerList.forEach((e) => {
1362
+ e.feature && (shipsVectorSource == null || shipsVectorSource.removeFeature(e.feature));
1363
+ }), clearAllInterval(), shipsMarkerList = [];
1364
+ }, selectSingleShipMarker = (e) => {
1365
+ var r;
1366
+ if (!mapInstance$5.value) return;
1367
+ const t = cloneDeep(selectSingleShipData.value);
1368
+ selectSingleShipData.value = convertShipMapData(e);
1369
+ const n = [selectSingleShipData.value.lon, selectSingleShipData.value.lat], o = new Feature({
1370
+ geometry: new Point(fromLonLat(n))
1371
+ });
1372
+ o.set("data", selectSingleShipData.value), o.setStyle(
1373
+ setShipStyle(!0)
1374
+ ), shipsMarkerList.push({
1375
+ ship: selectSingleShipData.value,
1376
+ lonlat: n,
1377
+ feature: o
1378
+ }), selectShipsVectorSource == null || selectShipsVectorSource.clear(), selectShipsVectorSource = new VectorSource({
1379
+ features: [o]
1380
+ }), selectShipsLayer.value = new VectorLayer({
1381
+ source: selectShipsVectorSource
1382
+ }), shipsVectorSource && setVisibleFeatureById(shipsVectorSource, selectSingleShipData.value.id, !0);
1383
+ const i = (r = shipsLayer.value) == null ? void 0 : r.getSource();
1384
+ return i && (t && setVisibleFeatureById(i, t.id, !0), setVisibleFeatureById(i, selectSingleShipData.value.id, !1)), mapInstance$5.value.addLayer(selectShipsLayer.value), selectShipsLayer.value.setVisible(!0), selectShipsLayer.value;
1385
+ }, setVisibleFeatureById = (e, t, n) => {
1386
+ e && e.forEachFeature((o) => {
1387
+ const i = o.get("data");
1388
+ i && i.id === t && o.setStyle(n ? setShipStyle(!1, i.id) : setBlankStyle());
1389
+ });
1390
+ }, findShip = (e, t, n = !0) => {
1391
+ var i, r, l, c, s;
1392
+ if (!e || !mapInstance$5.value) return;
1393
+ const o = (l = (r = (i = shipsLayer.value) == null ? void 0 : i.getSource()) == null ? void 0 : r.getFeatures()) == null ? void 0 : l.find((d) => {
1394
+ var u;
1395
+ return ((u = d.get("data")) == null ? void 0 : u.id) === e;
1396
+ });
1397
+ if (o)
1398
+ selectedShipData.value = o.get("data");
1399
+ else if (t && t.lon && t.lat)
1400
+ selectedShipData.value = t;
1401
+ else {
1402
+ console.error("找不到船舶");
1403
+ return;
1404
+ }
1405
+ if (selectedShips.value.some((d) => {
1406
+ var u;
1407
+ return d.id === ((u = selectedShipData.value) == null ? void 0 : u.id);
1408
+ }) || selectedShips.value.push(selectedShipData.value), n && ((c = selectedShipData.value) != null && c.lon) && ((s = selectedShipData.value) != null && s.lat)) {
1409
+ const d = mapInstance$5.value.getView(), u = new Point([selectedShipData.value.lon, selectedShipData.value.lat]);
1410
+ d.setCenter(transform(u.getCoordinates(), projection.data, projection.mercator));
1411
+ const m = d.getZoom(), f = m < mapZoom.findShipMin ? mapZoom.findShip : m;
1412
+ d.setZoom(f);
1413
+ }
1414
+ return setTimeout(() => {
1415
+ t && selectSingleShipMarker(t);
1416
+ }, 50), o;
1417
+ }, clearSelectFeature = () => {
1418
+ var e;
1419
+ if (selectedShipData.value && shipsVectorSource && selectSingleShipData.value) {
1420
+ setVisibleFeatureById(shipsVectorSource, selectSingleShipData.value.id, !1);
1421
+ const t = (e = shipsLayer.value) == null ? void 0 : e.getSource();
1422
+ t && setVisibleFeatureById(t, selectSingleShipData.value.id, !0);
1430
1423
  }
1431
- }), mapInstance$4 = ref(), renderCustomOverlaySetInstance = (e) => mapInstance$4.value = e, drawCustomContent = (e, t, n, o = "top-left", i = !1) => {
1432
- var d, u;
1424
+ selectedShipData.value = null, mapInstance$5.value && (selectShipsVectorSource == null || selectShipsVectorSource.clear(), selectShipsLayer.value = new VectorLayer({
1425
+ source: selectShipsVectorSource
1426
+ }), mapInstance$5.value.addLayer(selectShipsLayer.value), selectShipsLayer.value.setVisible(!1));
1427
+ }, hiddenAllShips = () => {
1428
+ var e, t;
1429
+ (e = shipsLayer.value) == null || e.setVisible(!1), (t = largeAmountShipsLayer.value) == null || t.setVisible(!1);
1430
+ }, switchBtnShow = ref({
1431
+ // 船舶摄像头过滤开关
1432
+ [SWITCH_BTN.Camera]: !1,
1433
+ // 船舶联系方式过滤开关
1434
+ [SWITCH_BTN.Mobile]: !1,
1435
+ // 船舶水尺过滤开关
1436
+ [SWITCH_BTN.WaterGauge]: !1
1437
+ }), switchFilterItem = (e, t) => {
1438
+ switchBtnShow.value[e] = t, renderShips(allShips.value);
1439
+ }, rerenderShip = () => {
1440
+ renderShips(allShips.value);
1441
+ }, mapInstance$4 = ref(), renderCustomOverlaySetInstance = (e) => mapInstance$4.value = e, drawCustomContent = (e, t, n, o = "top-left", i = !1, r = !0) => {
1442
+ var m, f;
1433
1443
  if (!t || !mapInstance$4.value) return;
1434
- document.querySelectorAll(".truck-custom-content").forEach((f) => {
1435
- var p;
1436
- return (p = f.parentNode) == null ? void 0 : p.removeChild(f);
1444
+ r && document.querySelectorAll(".truck-custom-content").forEach((p) => {
1445
+ var y;
1446
+ return (y = p.parentNode) == null ? void 0 : y.removeChild(p);
1437
1447
  });
1438
- const r = document.createElement("div");
1439
- r.innerHTML = n;
1440
- const l = new Overlay({
1441
- element: r,
1448
+ const l = document.createElement("div");
1449
+ l.innerHTML = n;
1450
+ const c = new Overlay({
1451
+ element: l,
1442
1452
  position: t,
1443
1453
  // 初始位置
1444
1454
  positioning: o,
@@ -1446,55 +1456,55 @@ const moveFeature = (e, t) => {
1446
1456
  // 设置不阻拦事件
1447
1457
  });
1448
1458
  if (i) {
1449
- let f = !1, p = [0, 0], y = [0, 0], h = 0, g = 0;
1450
- r.addEventListener("mousedown", function(k) {
1451
- var I;
1452
- f = !0, h = k.clientX, g = k.clientY;
1453
- const T = (I = mapInstance$4.value) == null ? void 0 : I.getCoordinateFromPixel([k.clientX - 200, k.clientY - 200]);
1454
- T && (p = T), y = [
1455
- k.clientX - r.getBoundingClientRect().left + 160,
1456
- k.clientY - r.getBoundingClientRect().top + 84
1457
- ], k.preventDefault(), console.log(e, h, g);
1458
- }), document.addEventListener("mousemove", function(k) {
1459
- var T;
1460
- if (f) {
1461
- const I = (T = mapInstance$4.value) == null ? void 0 : T.getCoordinateFromPixel([k.clientX - y[0], k.clientY - y[1]]), F = I[0] - p[0], V = I[1] - p[1];
1462
- l.setPosition([p[0] + F, p[1] + V]);
1459
+ let p = !1, y = [0, 0], h = [0, 0], v = 0, M = 0;
1460
+ l.addEventListener("mousedown", function(S) {
1461
+ var C;
1462
+ p = !0, v = S.clientX, M = S.clientY;
1463
+ const V = (C = mapInstance$4.value) == null ? void 0 : C.getCoordinateFromPixel([S.clientX - 200, S.clientY - 200]);
1464
+ V && (y = V), h = [
1465
+ S.clientX - l.getBoundingClientRect().left + 160,
1466
+ S.clientY - l.getBoundingClientRect().top + 84
1467
+ ], S.preventDefault(), console.log(e, v, M);
1468
+ }), document.addEventListener("mousemove", function(S) {
1469
+ var V;
1470
+ if (p) {
1471
+ const C = (V = mapInstance$4.value) == null ? void 0 : V.getCoordinateFromPixel([S.clientX - h[0], S.clientY - h[1]]), P = C[0] - y[0], x = C[1] - y[1];
1472
+ c.setPosition([y[0] + P, y[1] + x]);
1463
1473
  }
1464
1474
  }), document.addEventListener("mouseup", function() {
1465
- f = !1;
1475
+ p = !1;
1466
1476
  });
1467
1477
  }
1468
- (d = mapInstance$4.value) == null || d.addOverlay(l);
1469
- const c = r.querySelector(".close-button");
1470
- c && c.addEventListener("click", () => {
1471
- var f, p;
1472
- (f = mapInstance$4.value) == null || f.removeOverlay(l), (p = r.parentNode) == null || p.removeChild(r);
1478
+ (m = mapInstance$4.value) == null || m.addOverlay(c);
1479
+ const s = l.querySelector(".close-button");
1480
+ s && s.addEventListener("click", () => {
1481
+ var p, y;
1482
+ (p = mapInstance$4.value) == null || p.removeOverlay(c), (y = l.parentNode) == null || y.removeChild(l);
1473
1483
  });
1474
- const s = JSON.parse(JSON.stringify(t)), m = (u = mapInstance$4.value) == null ? void 0 : u.getCoordinateFromPixel(s);
1475
- return l.setPosition(m), l;
1484
+ const d = JSON.parse(JSON.stringify(t)), u = (f = mapInstance$4.value) == null ? void 0 : f.getCoordinateFromPixel(d);
1485
+ return c.setPosition(u), c;
1476
1486
  }, mapInstance$3 = ref(), renderTrackSetInstance = (e) => mapInstance$3.value = e, showTracks = ref([]), trackList = ref([]);
1477
1487
  ref(null);
1478
1488
  const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship") => {
1479
- var d;
1489
+ var u;
1480
1490
  if (console.log(i), nextTick(() => {
1481
1491
  hiddenAllShips();
1482
- }).then((u) => {
1492
+ }).then((m) => {
1483
1493
  }), (t == null ? void 0 : t.length) < 2) {
1484
- ((d = showTracks.value) == null ? void 0 : d.findIndex((u) => u.id === e)) < 0 && showTracks.value.push({ id: e, length: "" });
1494
+ ((u = showTracks.value) == null ? void 0 : u.findIndex((m) => m.id === e)) < 0 && showTracks.value.push({ id: e, length: "" });
1485
1495
  return;
1486
1496
  }
1487
1497
  const r = {};
1488
- t.forEach((u) => {
1489
- u.state ? u.state = Number(u.state) : delete u.state;
1498
+ t.forEach((m) => {
1499
+ m.state ? m.state = Number(m.state) : delete m.state;
1490
1500
  }), trackId.value = e, r[e] = t, trackList.value = t;
1491
1501
  const l = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080", "#ffc0cb", "#800000", "#000080", "#808000"], c = r[e].map(
1492
- (u) => transform([u.lon, u.lat], projection.data, projection.mercator)
1493
- ), s = new LineString(c), m = formatUtils.formatLength(s, o) || "--";
1502
+ (m) => transform([m.lon, m.lat], projection.data, projection.mercator)
1503
+ ), s = new LineString(c), d = formatUtils.formatLength(s, o) || "--";
1494
1504
  nextTick(() => {
1495
1505
  var f, p;
1496
- const u = (f = showTracks.value) == null ? void 0 : f.findIndex((y) => y.id === e);
1497
- u < 0 ? showTracks.value.push({ id: e, length: m }) : showTracks.value[u].length = m, ++cursor.value, cursor.value > l.length && (cursor.value = 0), renderTrackLine(r, e, n), nextTick(() => {
1506
+ const m = (f = showTracks.value) == null ? void 0 : f.findIndex((y) => y.id === e);
1507
+ m < 0 ? showTracks.value.push({ id: e, length: d }) : showTracks.value[m].length = d, ++cursor.value, cursor.value > l.length && (cursor.value = 0), renderTrackLine(r, e, n), nextTick(() => {
1498
1508
  resetTrackView(e);
1499
1509
  }).then(() => {
1500
1510
  }), (p = mapInstance$3.value) == null || p.on("moveend", () => {
@@ -1512,14 +1522,14 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship")
1512
1522
  if (o) {
1513
1523
  const s = o.get("data");
1514
1524
  if (!(s != null && s.time)) return;
1515
- let m = "";
1516
- s != null && s.stayTime && (m = `
1525
+ let d = "";
1526
+ s != null && s.stayTime && (d = `
1517
1527
  <div class="item w-100">
1518
1528
  <div class="item-label">停泊时间约</div>
1519
1529
  <div class="item-item">${formatMinutesToDDHHMM(Number(s.stayTime))}</div>
1520
1530
  </div>
1521
1531
  `);
1522
- const d = `
1532
+ const u = `
1523
1533
  <div class="track-point-popup">
1524
1534
  <div class="item">
1525
1535
  <div class="item-label">状态</div>
@@ -1549,10 +1559,10 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship")
1549
1559
  <div class="item-label">时间</div>
1550
1560
  <div class="item-item">${s.time}</div>
1551
1561
  </div>
1552
- ${m ?? m}
1553
- </div>`, u = (l = mapInstance$3.value) == null ? void 0 : l.getPixelFromCoordinate(n.coordinate);
1554
- if (u) {
1555
- const f = drawCustomContent(s.time, u, d, "top-left");
1562
+ ${d ?? d}
1563
+ </div>`, m = (l = mapInstance$3.value) == null ? void 0 : l.getPixelFromCoordinate(n.coordinate);
1564
+ if (m) {
1565
+ const f = drawCustomContent(s.time, m, u, "top-left");
1556
1566
  f && (e.value = f);
1557
1567
  }
1558
1568
  } else
@@ -1594,13 +1604,13 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship")
1594
1604
  emits: ["switchGreenDot", "switchMapTile"],
1595
1605
  setup(e, { emit: t }) {
1596
1606
  var p, y;
1597
- const n = inject("mapInstance"), o = e, i = t, r = ref(((y = (p = n == null ? void 0 : n.value) == null ? void 0 : p.getView()) == null ? void 0 : y.getZoom()) || mapZoom.default), l = ref(!1), c = ref(null), s = ref(!0), m = () => {
1607
+ const n = inject("mapInstance"), o = e, i = t, r = ref(((y = (p = n == null ? void 0 : n.value) == null ? void 0 : p.getView()) == null ? void 0 : y.getZoom()) || mapZoom.default), l = ref(!1), c = ref(null), s = ref(!0), d = () => {
1598
1608
  o.disableGreenDot || r.value >= mapZoom.shipGreenDotMax || (s.value = !s.value, i("switchGreenDot", s.value));
1599
- }, d = () => {
1600
- i("switchMapTile", o.mapTileMode === BaseMapType.vector ? BaseMapType.satellite : BaseMapType.vector);
1601
1609
  }, u = () => {
1602
- var h, g;
1603
- l.value ? (showMeasure.value = !1, (h = c.value) == null || h.removeInteraction()) : (showMeasure.value = !0, (g = c.value) == null || g.addInteraction()), l.value = !l.value;
1610
+ i("switchMapTile", o.mapTileMode === BaseMapType.vector ? BaseMapType.satellite : BaseMapType.vector);
1611
+ }, m = () => {
1612
+ var h, v;
1613
+ l.value ? (showMeasure.value = !1, (h = c.value) == null || h.removeInteraction()) : (showMeasure.value = !0, (v = c.value) == null || v.addInteraction()), l.value = !l.value;
1604
1614
  }, f = () => {
1605
1615
  var h;
1606
1616
  (h = c.value) == null || h.removeInteraction(), l.value = !1;
@@ -1609,12 +1619,12 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship")
1609
1619
  nextTick(() => {
1610
1620
  var h;
1611
1621
  (h = n == null ? void 0 : n.value) == null || h.on("moveend", () => {
1612
- var k, T;
1613
- const g = (T = (k = n == null ? void 0 : n.value) == null ? void 0 : k.getView()) == null ? void 0 : T.getZoom();
1614
- g && (r.value = g);
1622
+ var M, S;
1623
+ const v = (S = (M = n == null ? void 0 : n.value) == null ? void 0 : M.getView()) == null ? void 0 : S.getZoom();
1624
+ v && (r.value = v);
1615
1625
  });
1616
1626
  });
1617
- }), (h, g) => (openBlock(), createElementBlock(Fragment, null, [
1627
+ }), (h, v) => (openBlock(), createElementBlock(Fragment, null, [
1618
1628
  createElementVNode("div", {
1619
1629
  class: normalizeClass(`tool-panel ${h.viewMode}`)
1620
1630
  }, [
@@ -1623,47 +1633,47 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship")
1623
1633
  h.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
1624
1634
  key: 0,
1625
1635
  class: normalizeClass(["switch-btn", `${l.value && "active"}`]),
1626
- onClick: u
1627
- }, g[5] || (g[5] = [
1636
+ onClick: m
1637
+ }, v[5] || (v[5] = [
1628
1638
  createElementVNode("i", { class: "map-iconfont icon-measure" }, null, -1),
1629
1639
  createElementVNode("div", { class: "button-text" }, "测距", -1)
1630
1640
  ]), 2)) : createCommentVNode("", !0),
1631
1641
  h.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
1632
1642
  key: 1,
1633
1643
  class: normalizeClass(`switch-btn ${s.value && "active"} ${(h.disableGreenDot || r.value >= unref(mapZoom).shipGreenDotMax) && "disabled"}`),
1634
- onClick: m
1635
- }, g[6] || (g[6] = [
1644
+ onClick: d
1645
+ }, v[6] || (v[6] = [
1636
1646
  createElementVNode("i", { class: "map-iconfont icon-ship" }, null, -1),
1637
1647
  createElementVNode("div", { class: "button-text" }, "绿点", -1)
1638
1648
  ]), 2)) : createCommentVNode("", !0),
1639
1649
  h.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
1640
1650
  key: 2,
1641
1651
  class: normalizeClass(`switch-btn ${h.mapTileMode === unref(BaseMapType).satellite && "active"}`),
1642
- onClick: g[0] || (g[0] = (k) => d())
1643
- }, g[7] || (g[7] = [
1652
+ onClick: v[0] || (v[0] = (M) => u())
1653
+ }, v[7] || (v[7] = [
1644
1654
  createElementVNode("i", { class: "map-iconfont icon-space" }, null, -1),
1645
1655
  createElementVNode("div", { class: "button-text" }, "图层", -1)
1646
1656
  ]), 2)) : createCommentVNode("", !0),
1647
1657
  h.vehicleMode === "truck" ? (openBlock(), createElementBlock("div", {
1648
1658
  key: 3,
1649
1659
  class: normalizeClass(`switch-btn ${h.mapTileMode === unref(BaseMapType).satellite && "active"}`),
1650
- onClick: g[1] || (g[1] = (k) => d())
1651
- }, g[8] || (g[8] = [
1660
+ onClick: v[1] || (v[1] = (M) => u())
1661
+ }, v[8] || (v[8] = [
1652
1662
  createElementVNode("i", { class: "map-iconfont icon-space" }, null, -1),
1653
1663
  createElementVNode("div", { class: "button-text" }, "卫星", -1)
1654
1664
  ]), 2)) : createCommentVNode("", !0),
1655
1665
  h.showTrackLayer ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
1656
1666
  createElementVNode("div", {
1657
1667
  class: "switch-btn multiple",
1658
- onClick: g[2] || (g[2] = (k) => unref(playTrack)(unref(currentTrackId), 1))
1659
- }, g[9] || (g[9] = [
1668
+ onClick: v[2] || (v[2] = (M) => unref(playTrack)(unref(currentTrackId), 1))
1669
+ }, v[9] || (v[9] = [
1660
1670
  createElementVNode("i", { class: "map-iconfont icon-play" }, null, -1),
1661
1671
  createElementVNode("div", { class: "button-text" }, "播放轨迹", -1)
1662
1672
  ])),
1663
1673
  createElementVNode("div", {
1664
1674
  class: "switch-btn multiple",
1665
- onClick: g[3] || (g[3] = (k) => unref(resetTrackView)())
1666
- }, g[10] || (g[10] = [
1675
+ onClick: v[3] || (v[3] = (M) => unref(resetTrackView)())
1676
+ }, v[10] || (v[10] = [
1667
1677
  createElementVNode("i", { class: "map-iconfont icon-center" }, null, -1),
1668
1678
  createElementVNode("div", { class: "button-text" }, "轨迹居中", -1)
1669
1679
  ]))
@@ -1674,24 +1684,24 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship")
1674
1684
  h.vehicleMode === "ship" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
1675
1685
  createElementVNode("div", {
1676
1686
  class: normalizeClass(["switch-btn", `${l.value && "active"}`]),
1677
- onClick: u
1678
- }, g[11] || (g[11] = [
1687
+ onClick: m
1688
+ }, v[11] || (v[11] = [
1679
1689
  createElementVNode("i", { class: "map-iconfont icon-measure" }, null, -1),
1680
1690
  createElementVNode("div", { class: "button-text" }, "测距", -1)
1681
1691
  ]), 2),
1682
1692
  h.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
1683
1693
  key: 0,
1684
1694
  class: normalizeClass(`switch-btn ${s.value && "active"} ${(h.disableGreenDot || r.value >= unref(mapZoom).shipGreenDotMax) && "disabled"}`),
1685
- onClick: m
1686
- }, g[12] || (g[12] = [
1695
+ onClick: d
1696
+ }, v[12] || (v[12] = [
1687
1697
  createElementVNode("i", { class: "map-iconfont icon-ship" }, null, -1),
1688
1698
  createElementVNode("div", { class: "button-text" }, "绿点", -1)
1689
1699
  ]), 2)) : createCommentVNode("", !0)
1690
1700
  ], 64)) : createCommentVNode("", !0),
1691
1701
  createElementVNode("div", {
1692
1702
  class: normalizeClass(["switch-btn", { active: h.mapTileMode === unref(BaseMapType).satellite }]),
1693
- onClick: d
1694
- }, g[13] || (g[13] = [
1703
+ onClick: u
1704
+ }, v[13] || (v[13] = [
1695
1705
  createElementVNode("i", { class: "map-iconfont icon-space" }, null, -1),
1696
1706
  createElementVNode("div", { class: "button-text" }, "卫星", -1)
1697
1707
  ]), 2)
@@ -1703,7 +1713,7 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship")
1703
1713
  ref_key: "measureRef",
1704
1714
  ref: c,
1705
1715
  visible: l.value,
1706
- "onUpdate:visible": g[4] || (g[4] = (k) => l.value = k),
1716
+ "onUpdate:visible": v[4] || (v[4] = (M) => l.value = M),
1707
1717
  onClose: f,
1708
1718
  "view-mode": h.viewMode
1709
1719
  }, null, 8, ["visible", "view-mode"])) : createCommentVNode("", !0)
@@ -1791,25 +1801,25 @@ const setTruckStyle = (e, t, n, o) => new Style({
1791
1801
  l.save();
1792
1802
  let c = 1;
1793
1803
  l.scale(c, c);
1794
- let [s, m] = i;
1795
- s = Number(s) / c - 20, m = Number(m) / c;
1796
- const d = s - 70, u = m - 68;
1804
+ let [s, d] = i;
1805
+ s = Number(s) / c - 20, d = Number(d) / c;
1806
+ const u = s - 70, m = d - 68;
1797
1807
  let f = 180;
1798
1808
  const p = 56, y = "#FFFFFF";
1799
1809
  let h = 176;
1800
- const g = 52;
1801
- let k = "#164AFF", T = "#FFFFFF";
1802
- n === CAR_COLOR.YELLOW ? (h = 176, k = "#FFC81E", T = "rgba(0,0,0,0.88)") : n === CAR_COLOR.Y_GREEN && (f = 200, h = 196, k = "#8FED7C", T = "rgba(0,0,0,0.88)"), o != null && o.length && (f += o.length * 56), fillRectRadius(l, d, u, f, p, y), fillRectRadius(l, d + 2, u + 2, h, g, k), n === CAR_COLOR.Y_GREEN && fillRectRadius(l, d + 2, u + 2, 68, g, "#FFC81E"), l.save(), l.restore(), l.fillStyle = T, l.font = "bold 28px Arial", l.textAlign = "left", l.textBaseline = "middle";
1803
- const I = `${t.slice(0, 2) + " · " + t.slice(2)}`;
1804
- if (l.fillText(I, d + 12, u + 32), l.save(), l.restore(), o != null && o.length) {
1805
- const V = l.measureText(I).width + 12;
1806
- let P = 0;
1807
- o.forEach((v) => {
1808
- v === DEVICE_TYPE.CAMERA && (l.drawImage(cameraImage, s - 54 + V + P * 56, m - 64, 50, 50), ++P), v === DEVICE_TYPE.LOAD && (l.drawImage(loadImage, s - 54 + V + P * 56, m - 64, 50, 50), ++P);
1810
+ const v = 52;
1811
+ let M = "#164AFF", S = "#FFFFFF";
1812
+ n === CAR_COLOR.YELLOW ? (h = 176, M = "#FFC81E", S = "rgba(0,0,0,0.88)") : n === CAR_COLOR.Y_GREEN && (f = 200, h = 196, M = "#8FED7C", S = "rgba(0,0,0,0.88)"), o != null && o.length && (f += o.length * 56), fillRectRadius(l, u, m, f, p, y), fillRectRadius(l, u + 2, m + 2, h, v, M), n === CAR_COLOR.Y_GREEN && fillRectRadius(l, u + 2, m + 2, 68, v, "#FFC81E"), l.save(), l.restore(), l.fillStyle = S, l.font = "bold 28px Arial", l.textAlign = "left", l.textBaseline = "middle";
1813
+ const V = `${t.slice(0, 2) + " · " + t.slice(2)}`;
1814
+ if (l.fillText(V, u + 12, m + 32), l.save(), l.restore(), o != null && o.length) {
1815
+ const P = l.measureText(V).width + 12;
1816
+ let x = 0;
1817
+ o.forEach((g) => {
1818
+ g === DEVICE_TYPE.CAMERA && (l.drawImage(cameraImage, s - 54 + P + x * 56, d - 64, 50, 50), ++x), g === DEVICE_TYPE.LOAD && (l.drawImage(loadImage, s - 54 + P + x * 56, d - 64, 50, 50), ++x);
1809
1819
  });
1810
1820
  }
1811
- const F = dotImage$1;
1812
- l.drawImage(F, s + f / 2 - 90, m, 50 / c, 50 / c), l.restore();
1821
+ const C = dotImage$1;
1822
+ l.drawImage(C, s + f / 2 - 90, d, 50 / c, 50 / c), l.restore();
1813
1823
  }
1814
1824
  }), mapInstance$2 = ref(), renderDashboardSetInstance = (e) => mapInstance$2.value = e;
1815
1825
  ref([]);
@@ -1836,19 +1846,19 @@ const renderTrucksMarker = (e) => {
1836
1846
  truckMarkerList.forEach((e) => {
1837
1847
  e.feature && (trucksVectorSource == null || trucksVectorSource.removeFeature(e.feature));
1838
1848
  }), truckMarkerList = [];
1839
- }, mapInstance$1 = ref(), renderTruckSetInstance = (e) => mapInstance$1.value = e, vehicle = ref(null), focusShipData = ref(), currentTruckOverlay = ref(null), findTruck = async (e) => {
1849
+ }, mapInstance$1 = ref(), renderTruckSetInstance = (e) => mapInstance$1.value = e, vehicle = ref(null), focusShipData = ref(), currentTruckOverlay = ref(null), findTruck = async (e, t) => {
1840
1850
  if (!mapInstance$1.value || (focusShipData.value = e, !(e != null && e.lon && (e != null && e.lat)))) return;
1841
- const t = formatUtils.convertSixHundredThousandToLatLng(e.lon, e.lat), n = mapInstance$1.value.getPixelFromCoordinate(transform(t, projection.data, projection.mercator));
1842
- currentTruckOverlay.value = e ? drawTruckIcon(e.vno, n, (e == null ? void 0 : e.drc) ?? "") ?? null : null;
1843
- const o = mapInstance$1.value.getView(), i = new Point(t);
1844
- o.setCenter(transform(i.getCoordinates(), projection.data, projection.mercator));
1851
+ const n = Math.abs(Number(e.lon)) > 180 ? formatUtils.convertSixHundredThousandToLatLng(e.lon, e.lat) : [e.lon, e.lat], o = mapInstance$1.value.getPixelFromCoordinate(transform(n, projection.data, projection.mercator));
1852
+ currentTruckOverlay.value = e ? drawTruckIcon(e.vno, o, (e == null ? void 0 : e.drc) ?? "", t) ?? null : null;
1853
+ const i = mapInstance$1.value.getView(), r = new Point(n);
1854
+ i.setCenter(transform(r.getCoordinates(), projection.data, projection.mercator));
1845
1855
  }, clearAllTruck = () => {
1846
1856
  vehicle.value.clearAllShip();
1847
- }, drawTruckIcon = (e, t, n) => {
1848
- const o = `<div id="${e}" class="ol-custom-content truck-custom-content" style="width: 80px; height: 80px; transform: rotate(${n}deg);">
1857
+ }, drawTruckIcon = (e, t, n, o) => {
1858
+ let i = `<div id="${e}" class="ol-custom-content truck-custom-content" style="width: 80px; height: 80px; transform: rotate(${n}deg);">
1849
1859
  <img src="${CDN_URL}map/car-icon.gif" width="100%" height="100%" />
1850
1860
  </div>`;
1851
- return drawCustomContent(e, t, o, "center-center");
1861
+ return o && (i += o), drawCustomContent(e, t, i, "center-center");
1852
1862
  }, removeTruckIcon = () => {
1853
1863
  var t;
1854
1864
  const e = (t = currentTruckOverlay.value) == null ? void 0 : t.getElement();
@@ -1910,8 +1920,8 @@ let squareLimitError = !1, lineLimitError = !1;
1910
1920
  const validateSquareLimit = (e) => {
1911
1921
  let n = 1 / 0, o = -1 / 0, i = 1 / 0, r = -1 / 0;
1912
1922
  e == null || e.forEach((s) => {
1913
- const m = transform(s, projection.mercator, projection.data), d = m[0], u = m[1];
1914
- n = Math.min(n, u), o = Math.max(o, u), i = Math.min(i, d), r = Math.max(r, d);
1923
+ const d = transform(s, projection.mercator, projection.data), u = d[0], m = d[1];
1924
+ n = Math.min(n, m), o = Math.max(o, m), i = Math.min(i, u), r = Math.max(r, u);
1915
1925
  });
1916
1926
  const l = (o - n) * 111, c = (r - i) * 111;
1917
1927
  squareLimitError = l > 150 || c > 150;
@@ -1929,14 +1939,14 @@ const addInteraction = (e) => {
1929
1939
  draw.on("drawstart", function(i) {
1930
1940
  var r;
1931
1941
  layerState = "drawn", sketch = i.feature, t = (r = sketch.getGeometry()) == null ? void 0 : r.on("change", function(l) {
1932
- const c = l.target, s = formatUtils.formatArea(c, LENGTH_UNIT.NM), d = c.getCoordinates()[0], u = new LineString([d[d.length - 2], d[d.length - 1]]), f = formatUtils.formatLength(u, LENGTH_UNIT.NM);
1933
- if (lineLimitError = Number(getLength(u) / 1e3) > 150, validateSquareLimit(d), measureTooltipElement && s && (measureTooltipElement.innerHTML = `
1942
+ const c = l.target, s = formatUtils.formatArea(c, LENGTH_UNIT.NM), u = c.getCoordinates()[0], m = new LineString([u[u.length - 2], u[u.length - 1]]), f = formatUtils.formatLength(m, LENGTH_UNIT.NM);
1943
+ if (lineLimitError = Number(getLength(m) / 1e3) > 150, validateSquareLimit(u), measureTooltipElement && s && (measureTooltipElement.innerHTML = `
1934
1944
  <span class="text">面积:${s}${lineLimitError || squareLimitError ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
1935
1945
  `), helpTooltipElement && s) {
1936
1946
  let p = "";
1937
1947
  parseFloat(s) > 0 && (p = `
1938
1948
  <div class="text ${squareLimitError ? "error" : ""}">面积:${s}${squareLimitError ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</div>`), helpTooltipElement.innerHTML = `${p}
1939
- <span class="text ${lineLimitError ? "error" : ""}">线段${d.length - 2}:${f}${lineLimitError ? '<span class="error pl-4">超出可以绘画的距离</span>' : ""}</span>
1949
+ <span class="text ${lineLimitError ? "error" : ""}">线段${u.length - 2}:${f}${lineLimitError ? '<span class="error pl-4">超出可以绘画的距离</span>' : ""}</span>
1940
1950
  <div><span class="text">单击继续,双击结束</span></div>
1941
1951
  `;
1942
1952
  }
@@ -2034,17 +2044,20 @@ const setPointStyle = (e, t, n) => {
2034
2044
  const { color: o, url: i, activeUrl: r, activeColor: l } = n;
2035
2045
  return (r || i) && (e ? dotActiveImage.src = CDN_URL + (r || i) : dotImage.src = CDN_URL + (i || r)), new Style({
2036
2046
  renderer: (c, s) => {
2037
- const m = s.context;
2038
- m.save();
2039
- const d = window.devicePixelRatio || 1;
2040
- let [u, f] = c;
2041
- u = Number(u), f = Number(f), m.font = `${12 * d}px Arial`;
2042
- const p = m.measureText(t).width, y = u - p / 2 - (d <= 1 ? 8 : d), h = f + 6 * d, g = p + 4, k = 16 * d, T = e && l || o;
2043
- if (fillRectRadius(m, y, h + 13 * d, g, k, T), m.save(), m.restore(), m.fillStyle = e ? "#FFFFFF" : "#000000", m.textAlign = "center", m.textBaseline = "middle", m.fillText(t, y + (p + 4) / 2, h + 22 * d), m.save(), m.restore(), i || r) {
2044
- const I = e ? dotActiveImage : dotImage;
2045
- m.drawImage(I, u - I.width / 2, f - I.height / 2, 30 * d, 30 * d);
2047
+ const d = s.context;
2048
+ d.save();
2049
+ const u = window.devicePixelRatio || 1;
2050
+ let [m, f] = c;
2051
+ if (m = Number(m), f = Number(f), t) {
2052
+ d.font = `${12 * u}px Arial`;
2053
+ const p = d.measureText(t).width, y = m - p / 2 - (u <= 1 ? 8 : u), h = f + 6 * u, v = p + 4, M = 16 * u, S = e && l || o;
2054
+ fillRectRadius(d, y, h + 13 * u, v, M, S), d.save(), d.restore(), d.fillStyle = e ? "#FFFFFF" : "#000000", d.textAlign = "center", d.textBaseline = "middle", d.fillText(t, y + (p + 4) / 2, h + 22 * u), d.save(), d.restore();
2055
+ }
2056
+ if (i || r) {
2057
+ const p = e ? dotActiveImage : dotImage;
2058
+ d.drawImage(p, m - p.width / 2, f - p.height / 2, 30 * u, 30 * u);
2046
2059
  }
2047
- m.restore();
2060
+ d.restore();
2048
2061
  }
2049
2062
  });
2050
2063
  };
@@ -2066,6 +2079,27 @@ class PointMarkerClass {
2066
2079
  b(this, "pointLayer");
2067
2080
  // 颜色等其他设置
2068
2081
  b(this, "options");
2082
+ // 使用坐标点区域自动缩放地图层级
2083
+ b(this, "resetPointsView", (t) => {
2084
+ var r;
2085
+ if (!this.mapInstance || t.length === 0) return;
2086
+ const n = (r = this.mapInstance) == null ? void 0 : r.getView();
2087
+ if (!n) return;
2088
+ const i = t.map(
2089
+ (l) => transform(l, projection.data, projection.mercator)
2090
+ ).reduce((l, c) => [
2091
+ Math.min(l[0], c[0]),
2092
+ Math.min(l[1], c[1]),
2093
+ Math.max(l[2], c[0]),
2094
+ Math.max(l[3], c[1])
2095
+ ], [1 / 0, 1 / 0, -1 / 0, -1 / 0]);
2096
+ try {
2097
+ const l = buffer(i, Math.max(i[2] - i[0], i[3] - i[1]) * 0.02);
2098
+ n.fit(l);
2099
+ } catch (l) {
2100
+ console.error("Failed to zoom to points:", l);
2101
+ }
2102
+ });
2069
2103
  this.mapInstance = t, this.options = n;
2070
2104
  }
2071
2105
  /**
@@ -2084,7 +2118,7 @@ class PointMarkerClass {
2084
2118
  * pointType
2085
2119
  */
2086
2120
  renderPointMarker(t) {
2087
- if (this.deleteAllPointMarkers(), !this.mapInstance) return;
2121
+ if (!this.mapInstance) return;
2088
2122
  let n = {};
2089
2123
  t.forEach((o) => {
2090
2124
  var r;
@@ -2198,15 +2232,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2198
2232
  setup(e, { expose: t, emit: n }) {
2199
2233
  const o = ref();
2200
2234
  provide("mapInstance", o);
2201
- const i = ref(null), r = ref(null), l = ref(null), c = n, s = e, m = ref(s.zoom || mapZoom.default), d = ref(!1), u = ref(!0), f = ref(!0), p = {
2235
+ const i = ref(null), r = ref(null), l = ref(null), c = n, s = e, d = ref(s.zoom || mapZoom.default), u = ref(!1), m = ref(!0), f = ref(!0), p = {
2202
2236
  tiandituTile: new TileLayer({ source: new XYZ({ url: baseMap.tiandituTile }) }),
2203
2237
  tiandituTileMark: new TileLayer({ source: new XYZ({ url: baseMap.tiandituTileMark }) }),
2204
2238
  tiandituImgTile: new TileLayer({ source: new XYZ({ url: baseMap.tiandituImgTile }), visible: !1 }),
2205
2239
  tiandituImgTileMark: new TileLayer({ source: new XYZ({ url: baseMap.tiandituImgTileMark }), visible: !1 }),
2206
2240
  greenMark: new TileLayer({ source: new XYZ({ url: baseMap.greenTile }) })
2207
2241
  }, y = () => {
2208
- var L, w;
2209
- const v = {
2242
+ var w, L;
2243
+ const g = {
2210
2244
  projection: projection.mercator,
2211
2245
  // 地图投影坐标系
2212
2246
  zoom: s.zoom || (s.vehicleMode === "ship" ? mapZoom.default : mapZoom.truckDefault),
@@ -2234,8 +2268,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2234
2268
  p.tiandituImgTileMark,
2235
2269
  p.greenMark
2236
2270
  ],
2237
- view: new View(v)
2238
- }), h(), (L = r.value) == null || L.setScaleLine(s.vehicleMode === "ship" ? "nautical" : "metric"), (w = o.value) == null || w.on("moveend", I), g(v.zoom < mapZoom.shipGreenDotMax), T(s.vehicleMode === "ship" || s.viewMode === "findShip" ? BaseMapType.satellite : BaseMapType.vector), s.viewMode === "findShip" && s.mmsi && s.shipData && nextTick(() => {
2271
+ view: new View(g)
2272
+ }), h(), (w = r.value) == null || w.setScaleLine(s.vehicleMode === "ship" ? "nautical" : "metric"), (L = o.value) == null || L.on("moveend", V), v(g.zoom < mapZoom.shipGreenDotMax), S(s.vehicleMode === "ship" || s.viewMode === "findShip" ? BaseMapType.satellite : BaseMapType.vector), s.viewMode === "findShip" && s.mmsi && s.shipData && nextTick(() => {
2239
2273
  findShip(String(s.mmsi), s.shipData);
2240
2274
  }), onShipsMarkerHover();
2241
2275
  };
@@ -2244,86 +2278,87 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2244
2278
  });
2245
2279
  const h = () => {
2246
2280
  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));
2247
- }, g = (v) => {
2248
- var L;
2249
- s.vehicleMode !== "ship" && (v = !1), (L = o.value) == null || L.getLayers().forEach((w) => {
2250
- getUid(w) === getUid(p.greenMark) && (w.setVisible(v), u.value = v);
2281
+ }, v = (g) => {
2282
+ var w;
2283
+ s.vehicleMode !== "ship" && (g = !1), (w = o.value) == null || w.getLayers().forEach((L) => {
2284
+ getUid(L) === getUid(p.greenMark) && (L.setVisible(g), m.value = g);
2251
2285
  });
2252
- }, k = ref(BaseMapType.satellite), T = (v) => {
2253
- var L;
2254
- k.value = v, (L = o.value) == null || L.getLayers().forEach((w) => {
2255
- (getUid(w) === getUid(p.tiandituTile) || getUid(w) === getUid(p.tiandituTileMark) || getUid(w) === getUid(p.tiandituImgTile) || getUid(w) === getUid(p.tiandituImgTileMark)) && w.setVisible(!1), (v === BaseMapType.vector && (getUid(w) === getUid(p.tiandituTile) || getUid(w) === getUid(p.tiandituTileMark)) || v === BaseMapType.satellite && (getUid(w) === getUid(p.tiandituImgTile) || getUid(w) === getUid(p.tiandituImgTileMark))) && w.setVisible(!0);
2286
+ }, M = ref(BaseMapType.satellite), S = (g) => {
2287
+ var w;
2288
+ M.value = g, (w = o.value) == null || w.getLayers().forEach((L) => {
2289
+ (getUid(L) === getUid(p.tiandituTile) || getUid(L) === getUid(p.tiandituTileMark) || getUid(L) === getUid(p.tiandituImgTile) || getUid(L) === getUid(p.tiandituImgTileMark)) && L.setVisible(!1), (g === BaseMapType.vector && (getUid(L) === getUid(p.tiandituTile) || getUid(L) === getUid(p.tiandituTileMark)) || g === BaseMapType.satellite && (getUid(L) === getUid(p.tiandituImgTile) || getUid(L) === getUid(p.tiandituImgTileMark))) && L.setVisible(!0);
2256
2290
  });
2257
- }, I = () => {
2258
- const v = o.value.getView(), L = v.getZoom();
2259
- L && F(L);
2260
- const w = v.calculateExtent(o.value.getSize());
2261
- w && L && V(w, L);
2262
- }, F = (v) => {
2263
- var S, M, C, E, x;
2264
- m.value = v, g(v < mapZoom.shipGreenDotMax);
2265
- const L = (S = o.value) == null ? void 0 : S.getLayers(), w = s.vehicleMode === "ship" ? L == null ? void 0 : L.getArray().find((N) => getUid(N) === getUid(p.greenMark)) : void 0;
2266
- showTrackLayer.value ? (f.value = !1, w == null || w.setVisible(!1), (M = shipsLayer.value) == null || M.setVisible(!1), (C = largeAmountShipsLayer.value) == null || C.setVisible(!1)) : !d.value && u.value && v <= mapZoom.shipGreenDotMax ? (f.value = !0, w == null || w.setVisible(!0), (E = shipsLayer.value) == null || E.setVisible(!1), (x = largeAmountShipsLayer.value) == null || x.setVisible(!1)) : (f.value = !1, w == null || w.setVisible(!1)), c("zoomChanged", v);
2267
- }, V = (v, L) => {
2268
- const w = transform([v[0], v[1]], projection.mercator, projection.data), S = transform([v[2], v[3]], projection.mercator, projection.data);
2269
- c("extentChanged", { extent: [w, S], zoom: L });
2291
+ }, V = () => {
2292
+ const g = o.value.getView(), w = g.getZoom();
2293
+ w && C(w);
2294
+ const L = g.calculateExtent(o.value.getSize());
2295
+ L && w && P(L, w);
2296
+ }, C = (g) => {
2297
+ var k, T, E, I, F;
2298
+ d.value = g, v(g < mapZoom.shipGreenDotMax);
2299
+ const w = (k = o.value) == null ? void 0 : k.getLayers(), L = s.vehicleMode === "ship" ? w == null ? void 0 : w.getArray().find(($) => getUid($) === getUid(p.greenMark)) : void 0;
2300
+ showTrackLayer.value ? (f.value = !1, L == null || L.setVisible(!1), (T = shipsLayer.value) == null || T.setVisible(!1), (E = largeAmountShipsLayer.value) == null || E.setVisible(!1)) : !u.value && m.value && g <= mapZoom.shipGreenDotMax ? (f.value = !0, L == null || L.setVisible(!0), (I = shipsLayer.value) == null || I.setVisible(!1), (F = largeAmountShipsLayer.value) == null || F.setVisible(!1)) : (f.value = !1, L == null || L.setVisible(!1)), c("zoomChanged", g);
2301
+ }, P = (g, w) => {
2302
+ const L = transform([g[0], g[1]], projection.mercator, projection.data), k = transform([g[2], g[3]], projection.mercator, projection.data);
2303
+ c("extentChanged", { extent: [L, k], zoom: w });
2270
2304
  };
2271
2305
  return t({
2272
2306
  mapInstance: o,
2273
2307
  initMap: y,
2274
- pointRender: (v, L) => new PointMarkerClass(v, L),
2308
+ pointRender: (g, w) => new PointMarkerClass(g, w),
2275
2309
  renderTrucksMarker,
2276
2310
  renderShip: renderShips,
2277
- renderTrack: (v, L, w) => {
2278
- var S, M;
2279
- currentTrackId.value = v, showTrackLayer.value = !0, d.value = !0, hiddenAllShips(), (M = (S = largeAmountShipsLayer.value) == null ? void 0 : S.getSource()) == null || M.clear(), renderTrack(v, s.vehicleMode === "ship" ? L.reverse() : L, w, LENGTH_UNIT.NM);
2311
+ renderTrack: (g, w, L) => {
2312
+ var k, T;
2313
+ currentTrackId.value = g, showTrackLayer.value = !0, u.value = !0, hiddenAllShips(), (T = (k = largeAmountShipsLayer.value) == null ? void 0 : k.getSource()) == null || T.clear(), renderTrack(g, s.vehicleMode === "ship" ? w.reverse() : w, L, LENGTH_UNIT.NM);
2280
2314
  },
2281
2315
  findTruck,
2282
2316
  removeTruckIcon,
2283
2317
  clearAllTruck,
2284
2318
  closeTrack: () => {
2285
- var v, L;
2286
- showTrackLayer.value = !1, (v = shipTrackVectorLayer.value) == null || v.setVisible(!1), (L = selectShipsLayer.value) == null || L.setVisible(!0), d.value = !1, g(m.value < mapZoom.shipGreenDotMax), allTracks.value = [], stopAnimation();
2319
+ var g, w;
2320
+ showTrackLayer.value = !1, (g = shipTrackVectorLayer.value) == null || g.setVisible(!1), (w = selectShipsLayer.value) == null || w.setVisible(!0), u.value = !1, v(d.value < mapZoom.shipGreenDotMax), allTracks.value = [], stopAnimation();
2287
2321
  },
2288
2322
  closeTruckTrack: () => {
2289
- var v, L;
2290
- showTrackLayer.value = !1, (v = shipTrackVectorLayer.value) == null || v.setVisible(!1), (L = selectShipsLayer.value) == null || L.setVisible(!0), stopAnimation();
2323
+ var g, w;
2324
+ showTrackLayer.value = !1, (g = shipTrackVectorLayer.value) == null || g.setVisible(!1), (w = selectShipsLayer.value) == null || w.setVisible(!0), stopAnimation();
2291
2325
  },
2292
2326
  resetTrackView,
2293
2327
  playTrack,
2294
2328
  clearSelectFeature,
2295
2329
  findShip,
2296
- focusShip: (v, L, w = !0) => {
2297
- var S, M;
2298
- hiddenOrther.value = w, (S = shipsLayer.value) == null || S.setVisible(!w), (M = largeAmountShipsLayer.value) == null || M.setVisible(!1), findShip(v, L);
2330
+ focusShip: (g, w, L = !0) => {
2331
+ var k, T;
2332
+ hiddenOrther.value = L, (k = shipsLayer.value) == null || k.setVisible(!L), (T = largeAmountShipsLayer.value) == null || T.setVisible(!1), findShip(g, w);
2299
2333
  },
2300
2334
  showTracks,
2301
2335
  removeAllTrackLayer,
2302
2336
  switchFilterItem,
2303
2337
  rerenderShip,
2304
- switchGreenDot: () => g(!1),
2338
+ switchGreenDot: () => v(!1),
2305
2339
  zoomTruckIcon,
2306
- renderTruckTrack: (v, L, w) => {
2307
- showTrackLayer.value = !0, renderTrack(v, L, w, LENGTH_UNIT.KM, "truck");
2340
+ renderTruckTrack: (g, w, L) => {
2341
+ showTrackLayer.value = !0, renderTrack(g, w, L, LENGTH_UNIT.KM, "truck");
2308
2342
  },
2343
+ drawCustomContent,
2309
2344
  removerLayer: removeShipTrackLineFeatureByIndex,
2310
2345
  renderMarker,
2311
- setMarkerPosition: (v) => {
2312
- d.value = !0, setMarkerPosition(v);
2346
+ setMarkerPosition: (g) => {
2347
+ u.value = !0, setMarkerPosition(g);
2313
2348
  },
2314
2349
  getZoomAndCenter: () => {
2315
- var M;
2316
- const v = (M = o.value) == null ? void 0 : M.getView();
2317
- if (!v) return null;
2318
- const L = Math.round(Number(v.getZoom())), { lon: w, lat: S } = transformUtils.mercatorToLonLat(v.getCenter());
2319
- return { zoom: L, center: [w, S] };
2350
+ var T;
2351
+ const g = (T = o.value) == null ? void 0 : T.getView();
2352
+ if (!g) return null;
2353
+ const w = Math.round(Number(g.getZoom())), { lon: L, lat: k } = transformUtils.mercatorToLonLat(g.getCenter());
2354
+ return { zoom: w, center: [L, k] };
2320
2355
  },
2321
- setCenter: (v) => {
2322
- var S;
2323
- const L = (S = o.value) == null ? void 0 : S.getView();
2324
- if (!L) return null;
2325
- const w = new Point(v);
2326
- L.setCenter(transform(w.getCoordinates(), projection.data, projection.mercator));
2356
+ setCenter: (g) => {
2357
+ var k;
2358
+ const w = (k = o.value) == null ? void 0 : k.getView();
2359
+ if (!w) return null;
2360
+ const L = new Point(g);
2361
+ w.setCenter(transform(L.getCoordinates(), projection.data, projection.mercator));
2327
2362
  },
2328
2363
  drawPolygonTool,
2329
2364
  setMapInstance: h,
@@ -2338,30 +2373,30 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2338
2373
  transform: transformUtils,
2339
2374
  format: formatUtils
2340
2375
  }
2341
- }), (v, L) => (openBlock(), createElementBlock("div", {
2376
+ }), (g, w) => (openBlock(), createElementBlock("div", {
2342
2377
  class: "map-page map-container",
2343
2378
  ref_key: "pageRef",
2344
2379
  ref: i
2345
2380
  }, [
2346
- L[0] || (L[0] = createElementVNode("div", {
2381
+ w[0] || (w[0] = createElementVNode("div", {
2347
2382
  id: "map",
2348
2383
  class: "map"
2349
2384
  }, null, -1)),
2350
2385
  createVNode(ToolPanel, {
2351
- "vehicle-mode": v.vehicleMode,
2352
- "view-mode": v.viewMode,
2353
- "disable-green-dot": d.value,
2386
+ "vehicle-mode": g.vehicleMode,
2387
+ "view-mode": g.viewMode,
2388
+ "disable-green-dot": u.value,
2354
2389
  "show-track-layer": unref(showTrackLayer),
2355
- "map-tile-mode": k.value,
2356
- onSwitchGreenDot: g,
2357
- onSwitchMapTile: T
2390
+ "map-tile-mode": M.value,
2391
+ onSwitchGreenDot: v,
2392
+ onSwitchMapTile: S
2358
2393
  }, {
2359
2394
  toolPanel: withCtx(() => [
2360
- renderSlot(v.$slots, "toolPanel", {}, void 0, !0)
2395
+ renderSlot(g.$slots, "toolPanel", {}, void 0, !0)
2361
2396
  ]),
2362
2397
  _: 3
2363
2398
  }, 8, ["vehicle-mode", "view-mode", "disable-green-dot", "show-track-layer", "map-tile-mode"]),
2364
- v.viewMode !== "WxMiniprogram" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
2399
+ g.viewMode !== "WxMiniprogram" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
2365
2400
  createVNode(ScaleLine, {
2366
2401
  ref_key: "scaleLineControl",
2367
2402
  ref: r
@@ -2372,12 +2407,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2372
2407
  }, null, 512)
2373
2408
  ], 64)) : createCommentVNode("", !0),
2374
2409
  createVNode(Copyright, {
2375
- type: v.logoType,
2376
- "map-tile": k.value
2410
+ type: g.logoType,
2411
+ "map-tile": M.value
2377
2412
  }, null, 8, ["type", "map-tile"])
2378
2413
  ], 512));
2379
2414
  }
2380
- }), Map = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c9c5f065"]]), ZhMap = withInstall(Map);
2415
+ }), Map = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0cb9105e"]]), ZhMap = withInstall(Map);
2381
2416
  export {
2382
2417
  BaseMapType as B,
2383
2418
  CDN_URL as C,