zhihao-ui 1.3.15 → 1.3.16

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.
@@ -76,23 +76,23 @@ function useMapInitializer() {
76
76
  var m;
77
77
  return (m = l()) == null ? void 0 : m.getZoom();
78
78
  }, a = (m) => {
79
- var F;
80
- (F = l()) == null || F.setZoom(m);
81
- }, o = (m, F) => {
82
- var V;
83
- (V = l()) == null || V.setCenter(fromLonLat([m, F]));
79
+ var N;
80
+ (N = l()) == null || N.setZoom(m);
81
+ }, o = (m, N) => {
82
+ var D;
83
+ (D = l()) == null || D.setCenter(fromLonLat([m, N]));
84
84
  }, y = () => {
85
- var F;
86
- const m = (F = l()) == null ? void 0 : F.getCenter();
85
+ var N;
86
+ const m = (N = l()) == null ? void 0 : N.getCenter();
87
87
  return toLonLat(m);
88
- }, E = () => {
88
+ }, T = () => {
89
89
  var m;
90
90
  return (m = n()) == null ? void 0 : m.getSize();
91
- }, t = new Map$2(), r = (m, F) => {
92
- f(F);
93
- const V = {
94
- zoom: F.zoom,
95
- center: fromLonLat(F.center),
91
+ }, t = new Map$2(), r = (m, N) => {
92
+ g(N);
93
+ const D = {
94
+ zoom: N.zoom,
95
+ center: fromLonLat(N.center),
96
96
  minZoom: MAP_ZOOM.min,
97
97
  maxZoom: MAP_ZOOM.max,
98
98
  constrainResolution: !0,
@@ -109,10 +109,10 @@ function useMapInitializer() {
109
109
  t.get("satelliteImgTile"),
110
110
  t.get("satelliteImgTileMark")
111
111
  ],
112
- view: new View(V)
112
+ view: new View(D)
113
113
  });
114
114
  e.value = v;
115
- }, f = (m) => {
115
+ }, g = (m) => {
116
116
  t.set("vectorTile", new TileLayer({
117
117
  source: new XYZ({ url: BASE_MAP_LINK.vectorTile }),
118
118
  visible: m.layerType === "vector",
@@ -151,9 +151,9 @@ function useMapInitializer() {
151
151
  setZoom: a,
152
152
  setCenter: o,
153
153
  getCenter: y,
154
- getSize: E,
154
+ getSize: T,
155
155
  initMap: r,
156
- setBaseLayerMap: f
156
+ setBaseLayerMap: g
157
157
  };
158
158
  }
159
159
  const convertSixHundredThousandToLatLng = function(e, n) {
@@ -217,42 +217,42 @@ const getIconStyle = (e) => {
217
217
  return s !== 0 && (o = `${String(s).padStart(2, "0")}时${o}`), l !== 0 && (o = `${String(l).padStart(2, "0")}天${o}`), o;
218
218
  }, useCarTrackManager = (e, n) => {
219
219
  let l = null;
220
- const s = async (f) => {
221
- if (!e || (console.log("vehicleInfo", f), !(f != null && f.lon && (f != null && f.lat)))) return;
222
- const m = Math.abs(Number(f.lon)) > 180 ? convertSixHundredThousandToLatLng(f.lon, f.lat) : [f.lon, f.lat];
223
- a(f, fromLonLat(m));
224
- const F = e == null ? void 0 : e.getView(), V = new Point(m);
225
- F.setCenter(transform(V.getCoordinates(), projection.data, projection.mercator));
226
- }, a = (f, m) => {
227
- const F = `${CDN_URL}map/car-icon.gif`;
220
+ const s = async (g) => {
221
+ if (!e || (console.log("vehicleInfo", g), !(g != null && g.lon && (g != null && g.lat)))) return;
222
+ const m = Math.abs(Number(g.lon)) > 180 ? convertSixHundredThousandToLatLng(g.lon, g.lat) : [g.lon, g.lat];
223
+ a(g, fromLonLat(m));
224
+ const N = e == null ? void 0 : e.getView(), D = new Point(m);
225
+ N.setCenter(transform(D.getCoordinates(), projection.data, projection.mercator));
226
+ }, a = (g, m) => {
227
+ const N = `${CDN_URL}map/car-icon.gif`;
228
228
  l || (l = new Overlay({
229
229
  element: document.createElement("div"),
230
230
  positioning: "center-center",
231
231
  stopEvent: !1
232
232
  // 允许交互事件穿透
233
233
  }), e.addOverlay(l));
234
- const V = l.getElement();
235
- V.style.backgroundImage = `url(${F})`, V.style.width = "80px", V.style.height = "80px";
236
- const v = (f == null ? void 0 : f.drc) || "";
237
- V.style.transform = `rotate(${v}deg)`, V.style.backgroundSize = "cover", l == null || l.setPosition(m);
234
+ const D = l.getElement();
235
+ D.style.backgroundImage = `url(${N})`, D.style.width = "80px", D.style.height = "80px";
236
+ const v = (g == null ? void 0 : g.drc) || "";
237
+ D.style.transform = `rotate(${v}deg)`, D.style.backgroundSize = "cover", l == null || l.setPosition(m);
238
238
  };
239
239
  return {
240
240
  location: s,
241
241
  remove: () => {
242
- const f = l == null ? void 0 : l.getElement();
243
- f && (f.innerHTML = "");
242
+ const g = l == null ? void 0 : l.getElement();
243
+ g && (g.innerHTML = "");
244
244
  },
245
- renderTrack: (f, m, F) => {
246
- n.render(f, m, F, "truck", 1e3);
245
+ renderTrack: (g, m, N) => {
246
+ n.render(g, m, N, "truck", 1e3);
247
247
  },
248
- setCenter: (f) => {
249
- n.setCenter(f);
248
+ setCenter: (g) => {
249
+ n.setCenter(g);
250
250
  },
251
251
  closeTrack: () => {
252
252
  n.close();
253
253
  },
254
- playTrack: (f, m) => {
255
- n.play(f, m);
254
+ playTrack: (g, m) => {
255
+ n.play(g, m);
256
256
  }
257
257
  };
258
258
  };
@@ -262,44 +262,44 @@ const useTrackManager = (e) => {
262
262
  let s = null;
263
263
  const a = "--";
264
264
  let o = null;
265
- const y = document.createElement("div"), E = new Overlay({
265
+ const y = document.createElement("div"), T = new Overlay({
266
266
  element: y,
267
267
  positioning: "top-left",
268
268
  stopEvent: !1,
269
269
  className: "track-label-popup"
270
270
  });
271
- let t, r, f, m, F, V = !1, v = Date.now(), g, T = 0, p = null, C = 20, Z = !1;
272
- const Y = 5, X = [], H = (i) => {
271
+ let t, r, g, m, N, D = !1, v = Date.now(), f, P = 0, p = null, C = 20, Z = !1;
272
+ const Y = 5, Q = [], H = (i) => {
273
273
  var c;
274
- for (X.unshift(i); X.length > Y; ) {
275
- const d = X.pop(), w = n.get(d);
274
+ for (Q.unshift(i); Q.length > Y; ) {
275
+ const d = Q.pop(), w = n.get(d);
276
276
  w && ((c = w.getSource()) == null || c.clear(), e == null || e.removeLayer(w), n.delete(d), delete l[d]);
277
277
  }
278
278
  };
279
279
  let u = "";
280
- const L = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080", "#ffc0cb", "#800000", "#000080", "#808000"], S = debounce(() => {
280
+ const L = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080", "#ffc0cb", "#800000", "#000080", "#808000"], E = debounce(() => {
281
281
  if (s && l[s] && n.get(s).getVisible() && Z) {
282
282
  console.log("reRenderTrackLine------------");
283
- const i = cloneDeep(P(s, l[s]));
283
+ const i = cloneDeep(S(s, l[s]));
284
284
  ce(s, i);
285
285
  }
286
- }, 300), P = (i, c) => {
286
+ }, 300), S = (i, c) => {
287
287
  let d = [];
288
288
  const w = Math.max(1, Math.floor(c.length / C));
289
289
  return d = c.filter((b, _) => _ % w === 0).map((b, _) => {
290
290
  if (Number(b.lon) > 180 || Number(b.lat) > 180) {
291
- const [O, A] = convertSixHundredThousandToLatLng(b.lon, b.lat);
292
- b.lon = O, b.lat = A;
291
+ const [V, A] = convertSixHundredThousandToLatLng(b.lon, b.lat);
292
+ b.lon = V, b.lat = A;
293
293
  }
294
294
  return b.center = [b.lon, b.lat], b.centerPoint = lonLatToMercator(b.center), b.time = hooks(b.createdAt).format("YYYY-MM-DD HH:mm:ss"), b.id = i, b.index = _, b;
295
295
  }), d;
296
- }, x = async (i, c, d, w = "ship", M = 200) => {
297
- if (!e || (c = c == null ? void 0 : c.reverse(), E && w === "ship" && (e != null && e.getOverlays().getArray().includes(E) || e.addOverlay(E)), (c == null ? void 0 : c.length) < 2))
296
+ }, M = async (i, c, d, w = "ship", x = 200) => {
297
+ if (!e || (c = c == null ? void 0 : c.reverse(), T && w === "ship" && (e != null && e.getOverlays().getArray().includes(T) || e.addOverlay(T)), (c == null ? void 0 : c.length) < 2))
298
298
  return;
299
- H(i), s = i, l[i] = c, C = M;
299
+ H(i), s = i, l[i] = c, C = x;
300
300
  const b = Object.keys(l).findIndex((_) => _ === i) || 0;
301
301
  u = d || L[b > 10 ? 10 : b], Z = !0, await z(), await ne(s);
302
- }, N = (i) => {
302
+ }, O = (i) => {
303
303
  const c = new VectorSource();
304
304
  return new VectorLayer({
305
305
  source: c,
@@ -309,32 +309,32 @@ const useTrackManager = (e) => {
309
309
  renderBuffer: 1024
310
310
  // 增大渲染缓冲区
311
311
  });
312
- }, D = (i) => {
312
+ }, $ = (i) => {
313
313
  n.forEach((c, d) => {
314
- var M;
314
+ var x;
315
315
  const w = d === i;
316
- c.getVisible() !== w && (c.setVisible(w), e.getLayers().getArray().includes(c) || e.addLayer(c), w || (M = c.getSource()) == null || M.clear());
316
+ c.getVisible() !== w && (c.setVisible(w), e.getLayers().getArray().includes(c) || e.addLayer(c), w || (x = c.getSource()) == null || x.clear());
317
317
  }), s = i;
318
318
  }, z = async () => {
319
319
  const i = s;
320
320
  if (!n.has(i)) {
321
- const b = N(i);
321
+ const b = O(i);
322
322
  n.set(i, b);
323
323
  }
324
- await D(i);
324
+ await $(i);
325
325
  const c = u || "", d = l[i] || [];
326
326
  if (!(d && d.length > 1)) return [];
327
327
  let w = [];
328
- w = P(i, d);
329
- const M = w.map((b) => b.centerPoint);
330
- w.length >= 2 && await $(i, M, c);
331
- }, $ = (i, c, d) => {
332
- const w = new LineString(c), M = n.get(i).getSource(), b = M.getFeatureById(i);
328
+ w = S(i, d);
329
+ const x = w.map((b) => b.centerPoint);
330
+ w.length >= 2 && await F(i, x, c);
331
+ }, F = (i, c, d) => {
332
+ const w = new LineString(c), x = n.get(i).getSource(), b = x.getFeatureById(i);
333
333
  if (b)
334
334
  b.setGeometry(w), b.setId(i), b.setStyle(R(d)), p = b;
335
335
  else {
336
336
  const _ = new Feature({ geometry: w });
337
- _.setId(i), _.set("type", "line"), _.setStyle(R(d)), M.addFeature(_), p = _;
337
+ _.setId(i), _.set("type", "line"), _.setStyle(R(d)), x.addFeature(_), p = _;
338
338
  }
339
339
  return p;
340
340
  }, R = (i) => new Style({
@@ -342,15 +342,15 @@ const useTrackManager = (e) => {
342
342
  color: i,
343
343
  width: 2
344
344
  })
345
- }), K = (i, c, d) => {
345
+ }), j = (i, c, d) => {
346
346
  const w = i == null ? void 0 : i.get("trackId");
347
347
  if (i && w && c === "hover") {
348
348
  e.getTargetElement().style.cursor = w ? "pointer" : "";
349
- const M = i.get("data"), b = Q(M), _ = d == null ? void 0 : d.coordinate;
350
- _ && (y.querySelector(".popup-content"), y.innerHTML = b, E == null || E.setPosition(_));
349
+ const x = i.get("data"), b = K(x), _ = d == null ? void 0 : d.coordinate;
350
+ _ && (y.querySelector(".popup-content"), y.innerHTML = b, T == null || T.setPosition(_));
351
351
  } else
352
- E && E.setPosition(void 0);
353
- }, Q = (i) => {
352
+ T && T.setPosition(void 0);
353
+ }, K = (i) => {
354
354
  if (!(i != null && i.time)) return;
355
355
  let c = "";
356
356
  return i != null && i.stayTime && (c = `
@@ -391,11 +391,11 @@ const useTrackManager = (e) => {
391
391
  ${c ?? c}
392
392
  </div>`;
393
393
  }, ie = (i) => {
394
- const d = i.map((O) => {
395
- const A = e.getPixelFromCoordinate(fromLonLat(O.center));
394
+ const d = i.map((V) => {
395
+ const A = e.getPixelFromCoordinate(fromLonLat(V.center));
396
396
  return {
397
- ...O,
398
- original: O,
397
+ ...V,
398
+ original: V,
399
399
  pixel: A,
400
400
  distance: 0
401
401
  // 先初始化,后续计算
@@ -403,51 +403,51 @@ const useTrackManager = (e) => {
403
403
  });
404
404
  let w = 0;
405
405
  d[0].distance = 0;
406
- for (let O = 1; O < d.length; O++) {
407
- const A = d[O - 1].pixel, B = d[O].pixel, q = B[0] - A[0], k = B[1] - A[1];
408
- w += Math.sqrt(q * q + k * k), d[O].distance = w;
406
+ for (let V = 1; V < d.length; V++) {
407
+ const A = d[V - 1].pixel, B = d[V].pixel, W = B[0] - A[0], k = B[1] - A[1];
408
+ w += Math.sqrt(W * W + k * k), d[V].distance = w;
409
409
  }
410
- const M = d.filter(
411
- (O, A) => A === 0 || A === d.length - 1
410
+ const x = d.filter(
411
+ (V, A) => A === 0 || A === d.length - 1
412
412
  ), b = [];
413
- for (let O = 0; O < M.length; O++) {
414
- const A = M[O];
415
- if (b.push(A), O < M.length - 1) {
416
- const B = M[O + 1], q = B.distance - A.distance, k = Math.floor(q / 100);
413
+ for (let V = 0; V < x.length; V++) {
414
+ const A = x[V];
415
+ if (b.push(A), V < x.length - 1) {
416
+ const B = x[V + 1], W = B.distance - A.distance, k = Math.floor(W / 100);
417
417
  for (let G = 1; G <= k; G++) {
418
- const j = A.distance + G * 100;
419
- if (j >= B.distance) break;
420
- const W = ae(
418
+ const q = A.distance + G * 100;
419
+ if (q >= B.distance) break;
420
+ const X = ae(
421
421
  d,
422
- j
422
+ q
423
423
  );
424
- W && b.push(W);
424
+ X && b.push(X);
425
425
  }
426
426
  }
427
427
  }
428
428
  return Array.from(
429
- new Map(b.map((O) => [O.distance.toFixed(2), O])).values()
430
- ).map((O) => ({
431
- ...O.original,
429
+ new Map(b.map((V) => [V.distance.toFixed(2), V])).values()
430
+ ).map((V) => ({
431
+ ...V.original,
432
432
  // 优先保留原始数据
433
- ...O,
433
+ ...V,
434
434
  // 覆盖坐标等计算属性
435
- coord: O.coord,
435
+ coord: V.coord,
436
436
  // 确保使用插值后的坐标
437
- pixel: O.pixel,
438
- distance: O.distance
437
+ pixel: V.pixel,
438
+ distance: V.distance
439
439
  }));
440
440
  };
441
441
  function ae(i, c) {
442
442
  for (let d = 1; d < i.length; d++) {
443
- const w = i[d - 1], M = i[d];
444
- if (c >= w.distance && c <= M.distance) {
445
- const b = (c - w.distance) / (M.distance - w.distance), _ = w.pixel[0] + b * (M.pixel[0] - w.pixel[0]), O = w.pixel[1] + b * (M.pixel[1] - w.pixel[1]), A = e == null ? void 0 : e.getCoordinateFromPixel([_, O]);
443
+ const w = i[d - 1], x = i[d];
444
+ if (c >= w.distance && c <= x.distance) {
445
+ const b = (c - w.distance) / (x.distance - w.distance), _ = w.pixel[0] + b * (x.pixel[0] - w.pixel[0]), V = w.pixel[1] + b * (x.pixel[1] - w.pixel[1]), A = e == null ? void 0 : e.getCoordinateFromPixel([_, V]);
446
446
  return {
447
447
  ...w,
448
448
  // 继承前一个点的属性(可调整)
449
449
  coord: A,
450
- pixel: [_, O],
450
+ pixel: [_, V],
451
451
  distance: c,
452
452
  original: void 0
453
453
  // 明确标记为插值生成点
@@ -472,7 +472,7 @@ const useTrackManager = (e) => {
472
472
  let d = [
473
473
  ...fe(i, u)
474
474
  ];
475
- return (i.index === 0 || i.index === l[i.id].length - 1) && (d = [...ve(i)], c.set("type", "track_begin")), i.state !== void 0 && i.state !== null && (d = [...ye(i)], c.set("type", "track_icon")), c.setStyle(d), c;
475
+ return (i.index === 0 || i.index === l[i.id].length - 1) && (d = [...he(i)], c.set("type", "track_begin")), i.state !== void 0 && i.state !== null && (d = [...ye(i)], c.set("type", "track_icon")), c.setStyle(d), c;
476
476
  }, ue = (i, c, d) => {
477
477
  const w = document.createElement("div");
478
478
  w.className = "track-overlay-label", w.style.position = "relative", w.style.backgroundColor = "rgba(255,255,255,0.8)", w.style.border = `1px solid ${c}`, w.style.fontSize = "12px", w.innerHTML = `
@@ -488,7 +488,7 @@ const useTrackManager = (e) => {
488
488
  stroke="${c}"
489
489
  stroke-width="1" />
490
490
  `;
491
- const M = new Overlay({
491
+ const x = new Overlay({
492
492
  element: w,
493
493
  position: fromLonLat(d.center),
494
494
  positioning: "top-left",
@@ -496,7 +496,7 @@ const useTrackManager = (e) => {
496
496
  stopEvent: !1,
497
497
  className: "track-label-time-overlay"
498
498
  });
499
- return M.set("class", "track-label-overlay"), M.set("trackId", i), M;
499
+ return x.set("class", "track-label-overlay"), x.set("trackId", i), x;
500
500
  }, re = () => {
501
501
  const i = e == null ? void 0 : e.getOverlays().getArray(), c = i == null ? void 0 : i.filter((d) => d.get("class") === "track-label-overlay");
502
502
  c && c.length > 0 && c.forEach((d) => {
@@ -525,7 +525,7 @@ const useTrackManager = (e) => {
525
525
  })
526
526
  // textStyle,
527
527
  ]), ye = (i) => {
528
- const c = "#E31818", d = "#1890FF", w = "&#xe6d2", M = new Style({
528
+ const c = "#E31818", d = "#1890FF", w = "&#xe6d2", x = new Style({
529
529
  text: new Text({
530
530
  font: "Normal 22px map-iconfont",
531
531
  text: getIconFont(w),
@@ -536,21 +536,21 @@ const useTrackManager = (e) => {
536
536
  }),
537
537
  zIndex: 99
538
538
  }), _ = getIconStyle("&#xe6e2;"), A = getIconStyle("&#xe703;"), B = [];
539
- return Number(i.state) === 0 ? B.push(_) : Number(i.state) === 1 && B.push(A), B.push(M), B;
539
+ return Number(i.state) === 0 ? B.push(_) : Number(i.state) === 1 && B.push(A), B.push(x), B;
540
540
  }, me = (i, c, d, w) => {
541
- const M = c || [], b = c.length;
542
- b || (M.push(d[0]), M.push(d[d.length - 1]));
541
+ const x = c || [], b = c.length;
542
+ b || (x.push(d[0]), x.push(d[d.length - 1]));
543
543
  const _ = [];
544
544
  for (let A = 0; A < b - 1; A++) {
545
545
  let B;
546
- const q = c[A], k = (c[A + 1].index + q.index) / 2;
546
+ const W = c[A], k = (c[A + 1].index + W.index) / 2;
547
547
  if (k % 2 === 0)
548
548
  B = d[k].centerPoint;
549
549
  else {
550
- const G = d[Math.floor(k)], j = d[Math.ceil(k)];
551
- if (G && j) {
552
- const [W, J] = G.centerPoint, [I, ee] = j.centerPoint;
553
- B = [(W + I) / 2, (J + ee) / 2];
550
+ const G = d[Math.floor(k)], q = d[Math.ceil(k)];
551
+ if (G && q) {
552
+ const [X, J] = G.centerPoint, [I, ee] = q.centerPoint;
553
+ B = [(X + I) / 2, (J + ee) / 2];
554
554
  }
555
555
  }
556
556
  if (B) {
@@ -573,31 +573,31 @@ const useTrackManager = (e) => {
573
573
  ), _.push(G);
574
574
  }
575
575
  }
576
- const O = n.get(i).getSource();
577
- O == null || O.addFeatures(_);
576
+ const V = n.get(i).getSource();
577
+ V == null || V.addFeatures(_);
578
578
  }, ne = (i) => {
579
579
  var b, _;
580
580
  const c = e.getView(), d = (b = n == null ? void 0 : n.get(i)) == null ? void 0 : b.getSource(), w = p || (i ? d == null ? void 0 : d.getFeatureById(i) : null);
581
581
  if (!w) return;
582
- const M = (_ = w == null ? void 0 : w.getGeometry()) == null ? void 0 : _.getExtent();
583
- if (M != null && M.length)
582
+ const x = (_ = w == null ? void 0 : w.getGeometry()) == null ? void 0 : _.getExtent();
583
+ if (x != null && x.length)
584
584
  try {
585
- const O = buffer(M, Math.max(M[2] - M[0], M[3] - M[1]) * 0.02);
586
- c.fit(O);
587
- } catch (O) {
588
- console.log(O);
585
+ const V = buffer(x, Math.max(x[2] - x[0], x[3] - x[1]) * 0.02);
586
+ c.fit(V);
587
+ } catch (V) {
588
+ console.log(V);
589
589
  }
590
- }, ve = (i) => {
591
- const c = "&#xe69b;", M = i.index === 0 ? "#fcdc3f" : "#ff0000";
590
+ }, he = (i) => {
591
+ const c = "&#xe69b;", x = i.index === 0 ? "#fcdc3f" : "#ff0000";
592
592
  return [new Style({
593
593
  text: new Text({
594
594
  font: "Normal 14px map-iconfont",
595
595
  text: getIconFont(c),
596
- fill: new Fill({ color: M })
596
+ fill: new Fill({ color: x })
597
597
  }),
598
598
  zIndex: 101
599
599
  })];
600
- }, he = () => {
600
+ }, ve = () => {
601
601
  console.log("清除所有的轨迹-----"), U(), n.forEach((c) => {
602
602
  var d;
603
603
  (d = c.getSource()) == null || d.clear(), e == null || e.removeLayer(c);
@@ -609,22 +609,22 @@ const useTrackManager = (e) => {
609
609
  c == null || c.setVisible(!1);
610
610
  const d = e.getOverlays().getArray();
611
611
  for (let w = 0; w < d.length; ) {
612
- const M = d[w];
613
- M.get("class") === "track-label-overlay" ? (M.setPosition(void 0), e.removeOverlay(M)) : w++;
612
+ const x = d[w];
613
+ x.get("class") === "track-label-overlay" ? (x.setPosition(void 0), e.removeOverlay(x)) : w++;
614
614
  }
615
615
  U();
616
616
  }, pe = (i, c = LENGTH_UNIT.NM) => {
617
617
  const d = {
618
618
  id: i,
619
619
  length: "--"
620
- }, M = (l[i] || []).map(
620
+ }, x = (l[i] || []).map(
621
621
  (_) => transform([_.lon, _.lat], projection.data, projection.mercator)
622
- ), b = new LineString(M);
622
+ ), b = new LineString(x);
623
623
  return d.length = formatLength(b, c) || "--", d;
624
624
  }, Le = (i, c) => {
625
625
  xe(String(i), c);
626
626
  }, xe = (i, c) => {
627
- const d = l[String(i)], w = d == null ? void 0 : d.map((M) => [M.lon, M.lat]);
627
+ const d = l[String(i)], w = d == null ? void 0 : d.map((x) => [x.lon, x.lat]);
628
628
  w && ke(w, c);
629
629
  }, te = new Style({
630
630
  text: new Text({
@@ -636,56 +636,56 @@ const useTrackManager = (e) => {
636
636
  })
637
637
  }), Me = (i, c) => {
638
638
  var k, G;
639
- const d = Number(50 * c), w = ((k = i.frameState) == null ? void 0 : k.time) ?? Date.now(), M = w - v;
640
- if (T = (T + d * M / 1e6) % 2, v = w, T >= 1) {
639
+ const d = Number(50 * c), w = ((k = i.frameState) == null ? void 0 : k.time) ?? Date.now(), x = w - v;
640
+ if (P = (P + d * x / 1e6) % 2, v = w, P >= 1) {
641
641
  U();
642
642
  return;
643
643
  }
644
644
  const b = r.getCoordinateAt(
645
- T > 1 ? 2 - T : T
645
+ P > 1 ? 2 - P : P
646
646
  ), _ = r.getCoordinateAt(
647
- T > 1 ? T - 0.01 : T
648
- ), O = r.getCoordinateAt(
649
- T > 1 ? 2 - T : T + 0.01
647
+ P > 1 ? P - 0.01 : P
648
+ ), V = r.getCoordinateAt(
649
+ P > 1 ? 2 - P : P + 0.01
650
650
  ), B = le(
651
651
  mercatorToLonLat(_, "array"),
652
- mercatorToLonLat(O, "array")
652
+ mercatorToLonLat(V, "array")
653
653
  ) * Math.PI / 180;
654
654
  (G = te.getText()) == null || G.setRotation(B), m.setCoordinates(b);
655
- const q = getVectorContext(i);
656
- q.setStyle(te), q.drawGeometry(m), e == null || e.render();
655
+ const W = getVectorContext(i);
656
+ W.setStyle(te), W.drawGeometry(m), e == null || e.render();
657
657
  }, be = () => {
658
658
  var i;
659
- V = !0, v = Date.now(), T = 0, m = ((i = f.getGeometry()) == null ? void 0 : i.clone()) || new Point([0, 0]), o && (g == null || g.on("postrender", o)), F == null || F.setGeometry(void 0);
659
+ D = !0, v = Date.now(), P = 0, m = ((i = g.getGeometry()) == null ? void 0 : i.clone()) || new Point([0, 0]), o && (f == null || f.on("postrender", o)), N == null || N.setGeometry(void 0);
660
660
  }, U = () => {
661
- V && (V = !1, F == null || F.setGeometry(void 0), o && g && g.un("postrender", o), g && (e == null || e.removeLayer(g)), g = null, F = null);
661
+ D && (D = !1, N == null || N.setGeometry(void 0), o && f && f.un("postrender", o), f && (e == null || e.removeLayer(f)), f = null, N = null);
662
662
  }, ke = (i, c) => {
663
- V && U(), t = new Polyline({
663
+ D && U(), t = new Polyline({
664
664
  factor: 1e6
665
665
  }).writeGeometry(new LineString(i)), r = new Polyline({
666
666
  factor: 1e6
667
667
  }).readGeometry(t, {
668
668
  dataProjection: projection.data,
669
669
  featureProjection: projection.mercator
670
- }), f = new Feature({
670
+ }), g = new Feature({
671
671
  type: "icon",
672
672
  geometry: new Point(r.getFirstCoordinate())
673
673
  });
674
- const d = f.getGeometry();
675
- m = d ? d.clone() : new Point([0, 0]), F = new Feature({
674
+ const d = g.getGeometry();
675
+ m = d ? d.clone() : new Point([0, 0]), N = new Feature({
676
676
  type: "geoMarker",
677
677
  style: te,
678
678
  geometry: m
679
- }), g = new VectorLayer({
679
+ }), f = new VectorLayer({
680
680
  source: new VectorSource({
681
- features: [F]
681
+ features: [N]
682
682
  })
683
- }), e == null || e.addLayer(g), o = (w) => Me(w, c), be();
683
+ }), e == null || e.addLayer(f), o = (w) => Me(w, c), be();
684
684
  }, le = (i, c, d) => {
685
685
  function w(k) {
686
686
  return 180 * (k % (2 * Math.PI)) / Math.PI;
687
687
  }
688
- function M(k) {
688
+ function x(k) {
689
689
  return k % 360 * Math.PI / 180;
690
690
  }
691
691
  function b(k) {
@@ -702,42 +702,42 @@ const useTrackManager = (e) => {
702
702
  "Coordinate must be GeoJSON Point or an Array of numbers"
703
703
  );
704
704
  }
705
- function _(k, G, j = {}) {
706
- if (j.final)
705
+ function _(k, G, q = {}) {
706
+ if (q.final)
707
707
  return function(Te, Se) {
708
708
  return (_(Se, Te) + 180) % 360;
709
709
  }(k, G);
710
- const W = b(k), J = b(G), I = M(W[0]), ee = M(J[0]), se = M(W[1]), oe = M(J[1]), Ce = Math.sin(ee - I) * Math.cos(oe), Ee = Math.cos(se) * Math.sin(oe) - Math.sin(se) * Math.cos(oe) * Math.cos(ee - I);
710
+ const X = b(k), J = b(G), I = x(X[0]), ee = x(J[0]), se = x(X[1]), oe = x(J[1]), Ce = Math.sin(ee - I) * Math.cos(oe), Ee = Math.cos(se) * Math.sin(oe) - Math.sin(se) * Math.cos(oe) * Math.cos(ee - I);
711
711
  return w(Math.atan2(Ce, Ee));
712
712
  }
713
- function O(k) {
713
+ function V(k) {
714
714
  return !isNaN(k) && k !== null && !Array.isArray(k);
715
715
  }
716
- function A(k, G = {}, j = {}) {
717
- return k || console.log("Coordinates are required"), Array.isArray(k) || console.log("Coordinates must be an Array"), k.length < 2 && console.log("Coordinates must be at least 2 numbers long"), (!O(k[0]) || !O(k[1])) && console.log("Coordinates must contain numbers"), B({ type: "Point", coordinates: k }, G, j);
716
+ function A(k, G = {}, q = {}) {
717
+ return k || console.log("Coordinates are required"), Array.isArray(k) || console.log("Coordinates must be an Array"), k.length < 2 && console.log("Coordinates must be at least 2 numbers long"), (!V(k[0]) || !V(k[1])) && console.log("Coordinates must contain numbers"), B({ type: "Point", coordinates: k }, G, q);
718
718
  }
719
- function B(k, G = {}, j = {}) {
720
- const W = {
719
+ function B(k, G = {}, q = {}) {
720
+ const X = {
721
721
  type: "Feature",
722
722
  id: "",
723
723
  properties: {},
724
724
  bbox: {},
725
725
  geometry: {}
726
726
  };
727
- return j.id !== void 0 && (W.id = j.id), j.bbox && (W.bbox = j.bbox), W.properties = G, W.geometry = k, W;
727
+ return q.id !== void 0 && (X.id = q.id), q.bbox && (X.bbox = q.bbox), X.properties = G, X.geometry = k, X;
728
728
  }
729
- const q = _(A(i), A(c), d);
730
- return q < 0 ? 360 + q : q;
729
+ const W = _(A(i), A(c), d);
730
+ return W < 0 ? 360 + W : W;
731
731
  };
732
732
  return {
733
- render: x,
734
- remove: he,
733
+ render: M,
734
+ remove: ve,
735
735
  play: Le,
736
736
  setCenter: ne,
737
737
  close: we,
738
738
  getLength: pe,
739
- handleTrackMapEvent: K,
740
- reRenderTrackLine: S
739
+ handleTrackMapEvent: j,
740
+ reRenderTrackLine: E
741
741
  };
742
742
  };
743
743
  function useShipOverlay(e) {
@@ -874,18 +874,18 @@ const getShipDirectPath = (e) => {
874
874
  return n <= MAP_ZOOM.shipModelMax && n >= MAP_ZOOM.shipTriggleMin ? "ship" : "triangle";
875
875
  }, getShipScale = (e, n, l) => {
876
876
  if (l === "ship") {
877
- const { len: s, wid: a } = n, o = 97, y = 20, t = 1 / (e == null ? void 0 : e.getView().getResolution()), r = s * t / o, f = a * t / y;
878
- return Math.max(r, f);
877
+ const { len: s, wid: a } = n, o = 97, y = 20, t = 1 / (e == null ? void 0 : e.getView().getResolution()), r = s * t / o, g = a * t / y;
878
+ return Math.max(r, g);
879
879
  }
880
880
  return MAP_ZOOM.scaleNum;
881
881
  }, initShipStyle = (e, n, l) => {
882
- const { color: s, direct: a, isHighlight: o, shipData: y } = e.getProperties(), E = ((y == null ? void 0 : y.cog) - 90 + 360) % 360;
882
+ const { color: s, direct: a, isHighlight: o, shipData: y } = e.getProperties(), T = ((y == null ? void 0 : y.cog) - 90 + 360) % 360;
883
883
  return new Style({
884
884
  image: new Icon({
885
885
  src: t(),
886
886
  scale: n || MAP_ZOOM.scaleNum,
887
887
  anchor: [0.5, 0.5],
888
- rotation: E * Math.PI / 180,
888
+ rotation: T * Math.PI / 180,
889
889
  rotateWithView: !1
890
890
  })
891
891
  });
@@ -943,7 +943,7 @@ const getShipDirectPath = (e) => {
943
943
  }, createLabelElement = (e) => {
944
944
  const n = document.createElement("div");
945
945
  n.className = "ship-overlay-box", n.style.position = "relative";
946
- const l = e.getProperties(), { shipData: s, blinking: a, blinkingColor: o, name: y } = l, { lon: E, lat: t } = s, r = createVNode({
946
+ const l = e.getProperties(), { shipData: s, blinking: a, blinkingColor: o, name: y } = l, { lon: T, lat: t } = s, r = createVNode({
947
947
  setup() {
948
948
  return useShipOverlay({
949
949
  selected: a,
@@ -960,8 +960,8 @@ const getShipDirectPath = (e) => {
960
960
  const n = [];
961
961
  return e.existDevice && n.push("&#xe687;"), e.existMobile && n.push("&#xe688;"), e.existWaterGauge && n.push("&#xe686;"), n;
962
962
  }, createLabelFeatureStyle = (e) => {
963
- const { name: n, rightIcons: l } = e.getProperties(), s = `${n} ${l.map((f) => getIconFont(f)).join(" ")} `, a = [20, -20], y = -Math.atan2(-a[1], a[0]), E = Math.sqrt(a[0] ** 2 + a[1] ** 2), t = `<svg viewBox="0 0 ${E + 10} 20" width="${E + 10}" height="20" xmlns="http://www.w3.org/2000/svg" >
964
- <line x1="0" y1="0" x2="${10 + E}" y2="10" stroke="white" stroke-width="1"></line>
963
+ const { name: n, rightIcons: l } = e.getProperties(), s = `${n} ${l.map((g) => getIconFont(g)).join(" ")} `, a = [20, -20], y = -Math.atan2(-a[1], a[0]), T = Math.sqrt(a[0] ** 2 + a[1] ** 2), t = `<svg viewBox="0 0 ${T + 10} 20" width="${T + 10}" height="20" xmlns="http://www.w3.org/2000/svg" >
964
+ <line x1="0" y1="0" x2="${10 + T}" y2="10" stroke="white" stroke-width="1"></line>
965
965
  </svg>`;
966
966
  return [new Style({
967
967
  text: new Text({
@@ -998,18 +998,18 @@ const getShipDirectPath = (e) => {
998
998
  declutter: !0
999
999
  });
1000
1000
  e == null || e.addLayer(a), e == null || e.addLayer(y);
1001
- let E = "", t = {}, r = {};
1002
- const f = (u) => {
1001
+ let T = "", t = {}, r = {};
1002
+ const g = (u) => {
1003
1003
  if (!u || !e) return;
1004
1004
  const L = (l == null ? void 0 : l.id) || (n == null ? void 0 : n.get("id"));
1005
1005
  if (l) {
1006
- const S = u.filter((P) => P.id === L);
1007
- S.length === 0 ? u.push(l) : l = S[0];
1006
+ const E = u.filter((S) => S.id === L);
1007
+ E.length === 0 ? u.push(l) : l = E[0];
1008
1008
  }
1009
- V(), v(!0), H(u), F();
1009
+ D(), v(!0), H(u), N();
1010
1010
  }, m = (u) => {
1011
- const L = (l == null ? void 0 : l.id) || (n == null ? void 0 : n.get("id")), S = fromLonLat([u == null ? void 0 : u.lon, u == null ? void 0 : u.lat]), P = u.fill || "#04C900", x = getShipDirectPath(u), N = new Feature({
1012
- geometry: new Point(S),
1011
+ const L = (l == null ? void 0 : l.id) || (n == null ? void 0 : n.get("id")), E = fromLonLat([u == null ? void 0 : u.lon, u == null ? void 0 : u.lat]), S = u.fill || "#04C900", M = getShipDirectPath(u), O = new Feature({
1012
+ geometry: new Point(E),
1013
1013
  // 船舶数据
1014
1014
  shipData: u,
1015
1015
  id: u.id,
@@ -1022,131 +1022,140 @@ const getShipDirectPath = (e) => {
1022
1022
  // 闪烁颜色
1023
1023
  blinkingColor: r[u.id] || "",
1024
1024
  // 船舶颜色
1025
- color: P,
1025
+ color: S,
1026
1026
  // 船艏向的方向
1027
- direct: x,
1027
+ direct: M,
1028
1028
  // shipType,
1029
1029
  // scale:scaleNum,
1030
1030
  // rotation,
1031
1031
  // 高亮
1032
1032
  isHighlight: !1
1033
1033
  });
1034
- return N.set("clickGeometry", new Circle(S)), N;
1035
- }, F = async () => {
1034
+ return O.set("clickGeometry", new Circle(E)), O;
1035
+ }, N = async () => {
1036
1036
  if (!l || !e) return;
1037
- let L = e.getOverlays().getArray().find((S) => S.get("class") == "ship-overlay-selected");
1037
+ let L = e.getOverlays().getArray().find((E) => E.get("class") == "ship-overlay-selected");
1038
1038
  if (console.log("selectedOverlay----------", L), L) {
1039
- const S = selectedShipElement(e, l);
1040
- await L.setElement(S), await L.setPosition(fromLonLat([l.lon, l.lat]));
1039
+ const E = selectedShipElement(e, l);
1040
+ await L.setElement(E), await L.setPosition(fromLonLat([l.lon, l.lat]));
1041
1041
  } else
1042
1042
  L = selectedShipStyle(e, l), L && e.addOverlay(L);
1043
1043
  setTimeout(() => {
1044
- var S;
1045
- L && ((S = L.get("element")) != null && S.parentElement) && (L.get("element").parentElement.style.display = "block");
1044
+ var E;
1045
+ L && ((E = L.get("element")) != null && E.parentElement) && (L.get("element").parentElement.style.display = "block");
1046
1046
  }, 20);
1047
- }, V = () => {
1047
+ }, D = () => {
1048
1048
  e && s && (s.clear(), o.clear(), v());
1049
1049
  }, v = (u) => {
1050
- const L = e.getOverlays().getArray().filter((S) => S.get("class") == "zh-map-ship-overlay");
1050
+ const L = e.getOverlays().getArray().filter((E) => E.get("class") == "zh-map-ship-overlay");
1051
1051
  if (L && L.length > 0) {
1052
- for (let S = 0; S < L.length; S++)
1053
- if (!u && L[S].get("class") !== "ship-overlay-selected") {
1054
- const P = L[S];
1055
- P.setPosition(void 0), e.removeOverlay(P), P.dispose();
1052
+ for (let E = 0; E < L.length; E++)
1053
+ if (!u && L[E].get("class") !== "ship-overlay-selected") {
1054
+ const S = L[E];
1055
+ S.setPosition(void 0), e.removeOverlay(S), S.dispose();
1056
1056
  }
1057
1057
  }
1058
- }, g = (u, L) => {
1058
+ }, f = (u, L) => {
1059
1059
  t = u, r = L;
1060
- const S = e.getOverlays().getArray(), P = s.getFeatures();
1061
- for (const x in t) {
1062
- const N = t[x], D = S.find(($) => $.getId() === "label-" + x), z = P.find(($) => x === $.get("id"));
1063
- if (D && z) {
1064
- z.set("blinking", N), z.set("blinkingColor", r[x] || "");
1065
- const $ = D.getElement(), R = createLabelElement(z), K = R.querySelector(".ship-overlay-line"), Q = $ == null ? void 0 : $.querySelector(".ship-overlay-line");
1066
- $ && $ !== R && (Q && K && K.replaceWith(Q), D.setElement(R));
1060
+ const E = e.getOverlays().getArray(), S = s.getFeatures();
1061
+ for (const M in t) {
1062
+ const O = t[M], $ = E.find((F) => F.getId() === "label-" + M), z = S.find((F) => M === F.get("id"));
1063
+ if ($ && z) {
1064
+ z.set("blinking", O), z.set("blinkingColor", r[M] || "");
1065
+ const F = $.getElement(), R = createLabelElement(z), j = R.querySelector(".ship-overlay-line"), K = F == null ? void 0 : F.querySelector(".ship-overlay-line");
1066
+ F && F !== R && (K && j && j.replaceWith(K), $.setElement(R));
1067
1067
  }
1068
1068
  }
1069
- }, T = (u) => {
1069
+ }, P = (u) => {
1070
1070
  if (!e) return;
1071
- const L = s.getFeatures(), S = n ? n.get("id") : "", P = L.filter((D) => D.get("id") !== S), x = /* @__PURE__ */ new Map();
1072
- u.forEach((D) => {
1073
- x.set(D.id, !0);
1071
+ const L = s.getFeatures(), E = o.getFeatures(), S = n ? n.get("id") : "", M = L.filter((F) => F.get("id") !== S), O = E == null ? void 0 : E.filter((F) => F.get("id") !== S), $ = /* @__PURE__ */ new Map();
1072
+ u.forEach((F) => {
1073
+ $.set(F.id, !0);
1074
1074
  });
1075
- const N = e.getOverlays().getArray();
1076
- P.forEach((D) => {
1077
- const z = D.get("id"), $ = N.find((R) => R.getId() === "label-" + z);
1078
- if (!x.has(z))
1079
- D.setStyle([]), $ && ($.get("element").style.visibility = "hidden");
1075
+ const z = e.getOverlays().getArray();
1076
+ M.forEach((F) => {
1077
+ const R = F.get("id");
1078
+ if (!$.has(R))
1079
+ F.setStyle([]);
1080
1080
  else {
1081
- $ && ($.get("element").style.visibility = "visible");
1082
- const R = D.getStyle();
1083
- (R == null ? void 0 : R.length) == 0 && D.setStyle(createShipStyle(e, D));
1081
+ const K = F.getStyle();
1082
+ (K == null ? void 0 : K.length) == 0 && F.setStyle(createShipStyle(e, F));
1083
+ }
1084
+ const j = z.find((K) => K.getId() === "label-" + R);
1085
+ j && j.setPosition(void 0);
1086
+ }), O.forEach((F) => {
1087
+ const R = F.get("id");
1088
+ if (!$.has(R))
1089
+ F.setStyle([]);
1090
+ else {
1091
+ const j = F.getStyle();
1092
+ (j == null ? void 0 : j.length) == 0 && F.setStyle(createLabelFeatureStyle(F));
1084
1093
  }
1085
1094
  });
1086
1095
  }, p = (u) => {
1087
1096
  if (u) {
1088
1097
  console.log("选中", u);
1089
- const L = s.getFeatures().find((S) => S.get("id") === u.id);
1090
- L && (n = L), l = u, F();
1098
+ const L = s.getFeatures().find((E) => E.get("id") === u.id);
1099
+ L && (n = L), l = u, N();
1091
1100
  } else
1092
1101
  console.log("取消选中"), l = null, n = null, Y();
1093
- }, C = debounce((u, L, S) => {
1102
+ }, C = debounce((u, L, E) => {
1094
1103
  if (u) {
1095
- const P = u.get("shipData"), x = u.get("id");
1096
- if (e.getTargetElement().style.cursor = x ? "pointer" : "", L === "click" && (p(P), S && S(x)), L === "hover") {
1097
- E && E !== x && Z(), E = x;
1098
- const N = s.getFeatures().find((D) => D.get("id") === E);
1099
- N == null || N.set("isHighlight", !0), N == null || N.setStyle(createShipStyle(e, N));
1104
+ const S = u.get("shipData"), M = u.get("id");
1105
+ if (e.getTargetElement().style.cursor = M ? "pointer" : "", L === "click" && (p(S), E && E(M)), L === "hover") {
1106
+ T && T !== M && Z(), T = M;
1107
+ const O = s.getFeatures().find(($) => $.get("id") === T);
1108
+ O == null || O.set("isHighlight", !0), O == null || O.setStyle(createShipStyle(e, O));
1100
1109
  }
1101
1110
  } else
1102
1111
  e.getTargetElement().style.cursor = "", Z();
1103
1112
  }, 10), Z = () => {
1104
- const u = E ? s.getFeatures().find((L) => L.get("id") === E) : null;
1105
- E = null, u == null || u.set("isHighlight", !1), u == null || u.setStyle(createShipStyle(e, u));
1113
+ const u = T ? s.getFeatures().find((L) => L.get("id") === T) : null;
1114
+ T = null, u == null || u.set("isHighlight", !1), u == null || u.setStyle(createShipStyle(e, u));
1106
1115
  }, Y = () => {
1107
1116
  try {
1108
- const L = e.getOverlays().getArray().find((S) => S.get("class") == "ship-overlay-selected");
1117
+ const L = e.getOverlays().getArray().find((E) => E.get("class") == "ship-overlay-selected");
1109
1118
  L && L.setPosition(void 0);
1110
1119
  } catch (u) {
1111
1120
  console.log(u);
1112
1121
  }
1113
- }, X = (u) => {
1114
- const L = fromLonLat([u == null ? void 0 : u.lon, u == null ? void 0 : u.lat]), S = new Feature({
1122
+ }, Q = (u) => {
1123
+ const L = fromLonLat([u == null ? void 0 : u.lon, u == null ? void 0 : u.lat]), E = new Feature({
1115
1124
  geometry: new Point(L),
1116
1125
  name: u.cnname || "未命名船舶",
1117
1126
  // 图标
1118
1127
  rightIcons: getRightIcons(u)
1119
1128
  });
1120
- S.set("id", u.id);
1121
- const P = createLabelFeatureStyle(S);
1122
- return S.setStyle(P), S;
1129
+ E.set("id", u.id);
1130
+ const S = createLabelFeatureStyle(E);
1131
+ return E.setStyle(S), E;
1123
1132
  }, H = (u) => {
1124
1133
  const L = e.getView().getZoom();
1125
- u.forEach((S) => {
1126
- const P = m(S);
1127
- if (P.setStyle(createShipStyle(e, P)), s.addFeature(P), (l == null ? void 0 : l.id) == S.id || L >= MAP_ZOOM.shipModelMin)
1128
- if (t[S.id])
1129
- createLabelStyle(e, P);
1134
+ u.forEach((E) => {
1135
+ const S = m(E);
1136
+ if (S.setStyle(createShipStyle(e, S)), s.addFeature(S), (l == null ? void 0 : l.id) == E.id || L >= MAP_ZOOM.shipModelMin)
1137
+ if (t[E.id])
1138
+ createLabelStyle(e, S);
1130
1139
  else {
1131
- const x = X(S);
1132
- o.addFeature(x);
1140
+ const M = Q(E);
1141
+ o.addFeature(M);
1133
1142
  }
1134
1143
  });
1135
1144
  };
1136
1145
  return {
1137
- render: f,
1146
+ render: g,
1138
1147
  selected: p,
1139
- filter: T,
1140
- blinking: g,
1141
- clear: V,
1148
+ filter: P,
1149
+ blinking: f,
1150
+ clear: D,
1142
1151
  handleShipMapEvent: C
1143
1152
  };
1144
1153
  }, useLayerManager = (e) => {
1145
1154
  const n = () => e == null ? void 0 : e.getLayers(), l = ref("vector"), s = () => l.value, a = (t) => {
1146
1155
  l.value = t;
1147
1156
  const r = n();
1148
- r && (r == null || r.getArray().forEach((f) => {
1149
- (f.className_ === "vector" || f.className_ === "satellite") && f.setVisible(f.className_ === t);
1157
+ r && (r == null || r.getArray().forEach((g) => {
1158
+ (g.className_ === "vector" || g.className_ === "satellite") && g.setVisible(g.className_ === t);
1150
1159
  }));
1151
1160
  }, o = ref(!1);
1152
1161
  return {
@@ -1166,8 +1175,8 @@ const getShipDirectPath = (e) => {
1166
1175
  r.push(m);
1167
1176
  }
1168
1177
  } else {
1169
- const r = n(), f = r.getArray().find((m) => m.className_ === "greenTile");
1170
- f && r.remove(f);
1178
+ const r = n(), g = r.getArray().find((m) => m.className_ === "greenTile");
1179
+ g && r.remove(g);
1171
1180
  }
1172
1181
  o.value = t;
1173
1182
  }
@@ -1189,27 +1198,27 @@ const getShipDirectPath = (e) => {
1189
1198
  const y = (v) => {
1190
1199
  if (!(!v || v.length === 0)) {
1191
1200
  if (s || (s = new VectorSource()), s.clear(), o) {
1192
- const g = v.find((T) => T.id === o.id);
1193
- g ? o = g : v.push(o);
1201
+ const f = v.find((P) => P.id === o.id);
1202
+ f ? o = f : v.push(o);
1194
1203
  }
1195
- v.forEach((g) => {
1196
- E(g);
1204
+ v.forEach((f) => {
1205
+ T(f);
1197
1206
  }), l || (l = new VectorLayer({
1198
1207
  className: n,
1199
1208
  source: s,
1200
1209
  zIndex: 100
1201
1210
  }), e == null || e.addLayer(l));
1202
1211
  }
1203
- }, E = (v) => {
1204
- const g = getZoom(), [T, p] = v.latLon.split(","), C = new Feature({
1205
- geometry: new Point(fromLonLat([Number(T), Number(p)]))
1212
+ }, T = (v) => {
1213
+ const f = getZoom(), [P, p] = v.latLon.split(","), C = new Feature({
1214
+ geometry: new Point(fromLonLat([Number(P), Number(p)]))
1206
1215
  });
1207
- C.setStyle(t(v, g, v.id === (o == null ? void 0 : o.id))), C.set("loactionData", v), s.addFeature(C);
1208
- }, t = (v, g, T) => {
1216
+ C.setStyle(t(v, f, v.id === (o == null ? void 0 : o.id))), C.set("loactionData", v), s.addFeature(C);
1217
+ }, t = (v, f, P) => {
1209
1218
  const p = {
1210
1219
  image: new Icon({
1211
- src: T && v.selectedPath || v.defaultPath,
1212
- scale: 0.5 * g / 10
1220
+ src: P && v.selectedPath || v.defaultPath,
1221
+ scale: 0.5 * f / 10
1213
1222
  })
1214
1223
  };
1215
1224
  return v.name && (p.text = new Text({
@@ -1226,53 +1235,53 @@ const getShipDirectPath = (e) => {
1226
1235
  }, r = () => {
1227
1236
  if (a) {
1228
1237
  const v = a.get("loactionData").id;
1229
- s.getFeatures().forEach((g) => {
1230
- g.get("loactionData").id !== v && s.removeFeature(g);
1238
+ s.getFeatures().forEach((f) => {
1239
+ f.get("loactionData").id !== v && s.removeFeature(f);
1231
1240
  });
1232
1241
  } else
1233
1242
  s.clear();
1234
- }, f = () => {
1235
- const v = a.get("loactionData"), g = getZoom();
1243
+ }, g = () => {
1244
+ const v = a.get("loactionData"), f = getZoom();
1236
1245
  s.getFeatures().forEach((p) => {
1237
- p.get("loactionData").id === v.id && (p == null || p.setStyle(t(v, g, !1)));
1246
+ p.get("loactionData").id === v.id && (p == null || p.setStyle(t(v, f, !1)));
1238
1247
  }), o = null, a = null;
1239
1248
  }, m = (v) => {
1240
- v ? (F(), V(v)) : clearSelectedPort();
1241
- }, F = () => {
1249
+ v ? (N(), D(v)) : clearSelectedPort();
1250
+ }, N = () => {
1242
1251
  if (a) {
1243
- const v = a.get("loactionData"), g = getZoom();
1244
- a.setStyle(t(v, g, !1));
1252
+ const v = a.get("loactionData"), f = getZoom();
1253
+ a.setStyle(t(v, f, !1));
1245
1254
  }
1246
- }, V = (v) => {
1247
- const g = s.getFeatures();
1248
- o = v, a = g.find((T) => T.get("loactionData").id === v.id);
1255
+ }, D = (v) => {
1256
+ const f = s.getFeatures();
1257
+ o = v, a = f.find((P) => P.get("loactionData").id === v.id);
1249
1258
  };
1250
1259
  return {
1251
1260
  render: y,
1252
1261
  selected: m,
1253
- clearSelected: f,
1262
+ clearSelected: g,
1254
1263
  clear: r
1255
1264
  };
1256
- }, disableDoubleClickZoom = () => {
1257
- getInstall().getInteractions().forEach((n) => {
1265
+ }, disableDoubleClickZoom = (e) => {
1266
+ e.getInteractions().forEach((n) => {
1258
1267
  n instanceof DoubleClickZoom && n.setActive(!1);
1259
1268
  });
1260
- }, enableDoubleClickZoom = () => {
1261
- getInstall().getInteractions().forEach((n) => {
1269
+ }, enableDoubleClickZoom = (e) => {
1270
+ e.getInteractions().forEach((n) => {
1262
1271
  n instanceof DoubleClickZoom && n.setActive(!0);
1263
1272
  });
1264
1273
  }, useDrawLineManager = (e, n) => {
1265
- const l = ref([]), s = ref("km"), a = (P) => {
1266
- s.value = P;
1274
+ const l = ref([]), s = ref("km"), a = (S) => {
1275
+ s.value = S;
1267
1276
  };
1268
1277
  let o;
1269
- const y = ref(!1), E = () => {
1270
- f(), disableDoubleClickZoom(), v("pointer"), e.on("pointermove", V), e.getViewport().addEventListener("mouseout", () => {
1278
+ const y = ref(!1), T = () => {
1279
+ g(), disableDoubleClickZoom(e), v("pointer"), e.on("pointermove", D), e.getViewport().addEventListener("mouseout", () => {
1271
1280
  o && o.classList.add("hidden");
1272
- }), T(), y.value = !0;
1281
+ }), P(), y.value = !0;
1273
1282
  };
1274
1283
  let t, r;
1275
- const f = () => {
1284
+ const g = () => {
1276
1285
  t = new VectorSource(), r = new VectorLayer({
1277
1286
  source: t,
1278
1287
  zIndex: 1e3,
@@ -1285,19 +1294,19 @@ const getShipDirectPath = (e) => {
1285
1294
  }
1286
1295
  }), e == null || e.addLayer(r);
1287
1296
  };
1288
- let m, F;
1289
- const V = (P) => {
1290
- if (P.dragging)
1297
+ let m, N;
1298
+ const D = (S) => {
1299
+ if (S.dragging)
1291
1300
  return;
1292
- let x = "点击选择起点";
1293
- m && (x = "单击继续,双击结束"), o && (o.innerHTML = x, F.setPosition(P.coordinate), o.classList.remove("hidden"));
1294
- }, v = (P) => {
1295
- const x = e == null ? void 0 : e.getTargetElement();
1296
- x && (x.style.cursor = P);
1301
+ let M = "点击选择起点";
1302
+ m && (M = "单击继续,双击结束"), o && (o.innerHTML = M, N.setPosition(S.coordinate), o.classList.remove("hidden"));
1303
+ }, v = (S) => {
1304
+ const M = e == null ? void 0 : e.getTargetElement();
1305
+ M && (M.style.cursor = S);
1297
1306
  };
1298
- let g;
1299
- const T = () => {
1300
- g = new Draw({
1307
+ let f;
1308
+ const P = () => {
1309
+ f = new Draw({
1301
1310
  source: t,
1302
1311
  type: "LineString",
1303
1312
  style: new Style({
@@ -1320,29 +1329,29 @@ const getShipDirectPath = (e) => {
1320
1329
  })
1321
1330
  }),
1322
1331
  // 添加条件函数,判断是否应该出发点绘制
1323
- condition: (x) => x.originalEvent.target.tagName !== "DIV"
1324
- }), e == null || e.addInteraction(g), Y(), X();
1325
- let P;
1326
- g.on("drawstart", function(x) {
1327
- var D;
1328
- m = x.feature, m.set("randomId", p());
1329
- let N;
1330
- P = (D = m.getGeometry()) == null ? void 0 : D.on("change", function(z) {
1331
- const $ = z.target, R = computedDistance($, s.value);
1332
- N = $.getLastCoordinate(), C && R && (C.innerHTML = R), Z.setPosition(N);
1332
+ condition: (M) => M.originalEvent.target.tagName !== "DIV"
1333
+ }), e == null || e.addInteraction(f), Y(), Q();
1334
+ let S;
1335
+ f.on("drawstart", function(M) {
1336
+ var $;
1337
+ m = M.feature, m.set("randomId", p());
1338
+ let O;
1339
+ S = ($ = m.getGeometry()) == null ? void 0 : $.on("change", function(z) {
1340
+ const F = z.target, R = computedDistance(F, s.value);
1341
+ O = F.getLastCoordinate(), C && R && (C.innerHTML = R), Z.setPosition(O);
1333
1342
  });
1334
- }), g.on("drawend", function() {
1335
- var x, N, D;
1343
+ }), f.on("drawend", function() {
1344
+ var M, O, $;
1336
1345
  if (C && (C.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), C != null && C.innerHTML) {
1337
1346
  const z = (m == null ? void 0 : m.get("randomId")) || p();
1338
1347
  l.value.push({ id: z, value: C == null ? void 0 : C.innerHTML }), C.innerHTML = `${C.innerHTML}<div class="ol-tooltip-delete-button" data-id="${z}"><i class="map-iconfont icon-delete"></i></div>`;
1339
1348
  }
1340
- (x = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || x.addEventListener("click", (z) => {
1349
+ (M = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || M.addEventListener("click", (z) => {
1341
1350
  var R;
1342
1351
  z.preventDefault(), z.stopPropagation();
1343
- const $ = (R = z.target) == null ? void 0 : R.getAttribute("data-id");
1344
- $ && u($);
1345
- }), Z.setOffset([0, -7]), m = null, C = null, Y(), P && unByKey(P), (D = (N = n.getProps()) == null ? void 0 : N.lineDrawEnd) == null || D.call(N, l.value);
1352
+ const F = (R = z.target) == null ? void 0 : R.getAttribute("data-id");
1353
+ F && u(F);
1354
+ }), Z.setOffset([0, -7]), m = null, C = null, Y(), S && unByKey(S), ($ = (O = n.getProps()) == null ? void 0 : O.lineDrawEnd) == null || $.call(O, l.value);
1346
1355
  });
1347
1356
  }, p = () => Math.random().toString(36).substring(2, 9);
1348
1357
  let C, Z;
@@ -1354,43 +1363,43 @@ const getShipDirectPath = (e) => {
1354
1363
  stopEvent: !1,
1355
1364
  insertFirst: !1
1356
1365
  }), e == null || e.addOverlay(Z);
1357
- }, X = () => {
1358
- o != null && o.parentNode && o.parentNode.removeChild(o), o = document.createElement("div"), o.className = "ol-tooltip hidden", F = new Overlay({
1366
+ }, Q = () => {
1367
+ o != null && o.parentNode && o.parentNode.removeChild(o), o = document.createElement("div"), o.className = "ol-tooltip hidden", N = new Overlay({
1359
1368
  element: o,
1360
1369
  offset: [15, 0],
1361
1370
  positioning: "center-left"
1362
- }), e == null || e.addOverlay(F);
1371
+ }), e == null || e.addOverlay(N);
1363
1372
  }, H = () => {
1364
- l.value.forEach((P, x) => {
1365
- var z, $;
1366
- const N = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
1367
- N[x] && (($ = (z = N[x]) == null ? void 0 : z.parentNode) == null || $.removeChild(N[x]));
1368
- const D = t.getFeatures();
1369
- D[x] && t.removeFeature(D[x]);
1370
- }), L(), enableDoubleClickZoom(), y.value = !1;
1371
- }, u = (P) => {
1372
- var N, D, z, $;
1373
- const x = l.value.findIndex((R) => R.id === P);
1374
- if (x !== -1) {
1375
- l.value.splice(x, 1);
1373
+ l.value.forEach((S, M) => {
1374
+ var z, F;
1375
+ const O = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
1376
+ O[M] && ((F = (z = O[M]) == null ? void 0 : z.parentNode) == null || F.removeChild(O[M]));
1377
+ const $ = t.getFeatures();
1378
+ $[M] && t.removeFeature($[M]);
1379
+ }), L(), enableDoubleClickZoom(e), y.value = !1;
1380
+ }, u = (S) => {
1381
+ var O, $, z, F;
1382
+ const M = l.value.findIndex((R) => R.id === S);
1383
+ if (M !== -1) {
1384
+ l.value.splice(M, 1);
1376
1385
  const R = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
1377
- R[x] && ((D = (N = R[x]) == null ? void 0 : N.parentNode) == null || D.removeChild(R[x]));
1378
- const K = t.getFeatures();
1379
- K[x] && t.removeFeature(K[x]);
1386
+ R[M] && (($ = (O = R[M]) == null ? void 0 : O.parentNode) == null || $.removeChild(R[M]));
1387
+ const j = t.getFeatures();
1388
+ j[M] && t.removeFeature(j[M]);
1380
1389
  }
1381
- ($ = (z = n.getProps()) == null ? void 0 : z.lineDrawEnd) == null || $.call(z, l.value);
1390
+ (F = (z = n.getProps()) == null ? void 0 : z.lineDrawEnd) == null || F.call(z, l.value);
1382
1391
  }, L = () => {
1383
- if (l.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((P) => {
1384
- var x;
1385
- (x = P == null ? void 0 : P.parentNode) == null || x.removeChild(P);
1386
- }), t.clear(), g) {
1387
- const P = e.getInteractions().getArray().find((x) => getUid(x) === getUid(g));
1388
- P && e.removeInteraction(P);
1392
+ if (l.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((S) => {
1393
+ var M;
1394
+ (M = S == null ? void 0 : S.parentNode) == null || M.removeChild(S);
1395
+ }), t.clear(), f) {
1396
+ const S = e.getInteractions().getArray().find((M) => getUid(M) === getUid(f));
1397
+ S && e.removeInteraction(S);
1389
1398
  }
1390
1399
  e.removeLayer(r), o != null && o.parentNode && o.parentNode.removeChild(o), C != null && C.parentNode && C.parentNode.removeChild(C);
1391
1400
  };
1392
1401
  return {
1393
- open: E,
1402
+ open: T,
1394
1403
  close: H,
1395
1404
  deleteLine: u,
1396
1405
  setUnit: a,
@@ -1416,10 +1425,10 @@ const getShipDirectPath = (e) => {
1416
1425
  const s = () => {
1417
1426
  a();
1418
1427
  }, a = () => {
1419
- E(), T(), Z(), F();
1428
+ T(), P(), Z(), N();
1420
1429
  };
1421
1430
  let o = null, y = null;
1422
- const E = () => {
1431
+ const T = () => {
1423
1432
  if (o || y) return;
1424
1433
  const H = new VectorSource(), u = new VectorLayer({
1425
1434
  source: H,
@@ -1431,7 +1440,7 @@ const getShipDirectPath = (e) => {
1431
1440
  })
1432
1441
  });
1433
1442
  o = u, y = H, e.on("pointermove", r), e.addLayer(u), e.on(["dblclick"], function(L) {
1434
- f && (L.stopPropagation(), L.preventDefault());
1443
+ g && (L.stopPropagation(), L.preventDefault());
1435
1444
  });
1436
1445
  };
1437
1446
  let t;
@@ -1440,33 +1449,33 @@ const getShipDirectPath = (e) => {
1440
1449
  const u = t ? "单击继续,双击结束" : "点击选择起点";
1441
1450
  p && (p.innerHTML = u, C.setPosition(H.coordinate));
1442
1451
  };
1443
- let f, m = !1;
1444
- const F = () => {
1452
+ let g, m = !1;
1453
+ const N = () => {
1445
1454
  if (l) {
1446
1455
  p != null && p.parentNode && p.parentNode.removeChild(p);
1447
1456
  const u = l.getGeometry();
1448
1457
  if (!u) return;
1449
- const L = V(u, "nm");
1458
+ const L = D(u, "nm");
1450
1459
  v && (v.innerHTML = `
1451
1460
  <span class="text">面积:${L}${m ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
1452
1461
  `), v && (v.innerHTML += '<span class="delete-icon" ><i class="map-iconfont icon-delete" /></div>');
1453
- const S = u.getCoordinates(), P = S[0][S[0].length - 2];
1454
- if (g.setPosition(P), o) {
1455
- const N = o.getSource();
1456
- N && l && (N.clear(), N.addFeature(l));
1462
+ const E = u.getCoordinates(), S = E[0][E[0].length - 2];
1463
+ if (f.setPosition(S), o) {
1464
+ const O = o.getSource();
1465
+ O && l && (O.clear(), O.addFeature(l));
1457
1466
  }
1458
1467
  setTimeout(() => {
1459
- var N;
1460
- (N = document.querySelector(".delete-icon")) == null || N.addEventListener("click", () => {
1461
- var D, z;
1462
- console.log("delete"), Y(), (z = (D = n.getProps()) == null ? void 0 : D.areaDrawEnd) == null || z.call(D, []);
1468
+ var O;
1469
+ (O = document.querySelector(".delete-icon")) == null || O.addEventListener("click", () => {
1470
+ var $, z;
1471
+ console.log("delete"), Y(), (z = ($ = n.getProps()) == null ? void 0 : $.areaDrawEnd) == null || z.call($, []);
1463
1472
  });
1464
1473
  }, 0);
1465
- const x = getCenter(l.getGeometry().getExtent());
1466
- e == null || e.getView().setCenter(x);
1474
+ const M = getCenter(l.getGeometry().getExtent());
1475
+ e == null || e.getView().setCenter(M);
1467
1476
  return;
1468
1477
  }
1469
- f = new Draw({
1478
+ g = new Draw({
1470
1479
  type: "Polygon",
1471
1480
  source: y,
1472
1481
  trace: !0,
@@ -1491,25 +1500,25 @@ const getShipDirectPath = (e) => {
1491
1500
  return new MultiPoint(L);
1492
1501
  }
1493
1502
  })]
1494
- }), e == null || e.addInteraction(f);
1503
+ }), e == null || e.addInteraction(g);
1495
1504
  let H;
1496
- f.on("drawstart", (u) => {
1505
+ g.on("drawstart", (u) => {
1497
1506
  var L;
1498
- t = u.feature, H = (L = t.getGeometry()) == null ? void 0 : L.on("change", (S) => {
1499
- const P = S.target, x = V(P, "nm"), D = P.getCoordinates()[0], z = new LineString([D[D.length - 2], D[D.length - 1]]), $ = computedDistance(z, "nm");
1500
- if (m = Number(getLength(z) / 1e3) > 150, !x) return;
1507
+ t = u.feature, H = (L = t.getGeometry()) == null ? void 0 : L.on("change", (E) => {
1508
+ const S = E.target, M = D(S, "nm"), $ = S.getCoordinates()[0], z = new LineString([$[$.length - 2], $[$.length - 1]]), F = computedDistance(z, "nm");
1509
+ if (m = Number(getLength(z) / 1e3) > 150, !M) return;
1501
1510
  const R = '<span class="error pl-4">超出可以绘画的距离</span>';
1502
1511
  v && (v.innerHTML = `
1503
1512
  <div class="text">
1504
- 面积:${x}
1513
+ 面积:${M}
1505
1514
  ${m ? R : ""}
1506
1515
  </div>
1507
1516
  `), p && (p.innerHTML = `
1508
1517
  <div class="text">
1509
- 面积:${x}
1518
+ 面积:${M}
1510
1519
  </div>
1511
1520
  <div class="text ${m ? "error" : ""}">
1512
- 线段 ${D.length - 2}: ${$}
1521
+ 线段 ${$.length - 2}: ${F}
1513
1522
  ${m ? R : ""}
1514
1523
 
1515
1524
  </div>
@@ -1518,23 +1527,23 @@ const getShipDirectPath = (e) => {
1518
1527
  </div>
1519
1528
  `);
1520
1529
  });
1521
- }), f.on("drawend", (u) => {
1522
- var x, N, D, z;
1530
+ }), g.on("drawend", (u) => {
1531
+ var M, O, $, z;
1523
1532
  if (!u.feature.getGeometry()) return;
1524
- l = u.feature, v && (v.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), g.setOffset([10, 0]);
1525
- const S = u.feature.getGeometry().getCoordinates(), P = S[0][S[0].length - 2];
1526
- if (g.setPosition(P), p != null && p.parentNode && p.parentNode.removeChild(p), (x = n.getProps()) != null && x.areaDrawEnd) {
1527
- const $ = S[0].map((R) => transform(R, projection.mercator, projection.data));
1528
- (D = (N = n.getProps()) == null ? void 0 : N.areaDrawEnd) == null || D.call(N, $);
1533
+ l = u.feature, v && (v.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), f.setOffset([10, 0]);
1534
+ const E = u.feature.getGeometry().getCoordinates(), S = E[0][E[0].length - 2];
1535
+ if (f.setPosition(S), p != null && p.parentNode && p.parentNode.removeChild(p), (M = n.getProps()) != null && M.areaDrawEnd) {
1536
+ const F = E[0].map((R) => transform(R, projection.mercator, projection.data));
1537
+ ($ = (O = n.getProps()) == null ? void 0 : O.areaDrawEnd) == null || $.call(O, F);
1529
1538
  }
1530
- f && (f.setActive(!1), e == null || e.removeInteraction(f), (e == null ? void 0 : e.getInteractions()).forEach((R) => {
1539
+ g && (g.setActive(!1), e == null || e.removeInteraction(g), (e == null ? void 0 : e.getInteractions()).forEach((R) => {
1531
1540
  R instanceof Draw && (R.setActive(!1), e == null || e.removeInteraction(R));
1532
1541
  })), H && unByKey(H), (z = document.querySelector(".delete-icon")) == null || z.addEventListener("click", () => {
1533
- var $, R;
1534
- Y(), (R = ($ = n.getProps()) == null ? void 0 : $.areaDrawEnd) == null || R.call($, []);
1542
+ var F, R;
1543
+ Y(), (R = (F = n.getProps()) == null ? void 0 : F.areaDrawEnd) == null || R.call(F, []);
1535
1544
  });
1536
1545
  });
1537
- }, V = (H, u) => {
1546
+ }, D = (H, u) => {
1538
1547
  const L = getArea(H);
1539
1548
  switch (u) {
1540
1549
  case "km":
@@ -1543,15 +1552,15 @@ const getShipDirectPath = (e) => {
1543
1552
  return L > 1e4 ? Math.round(L / 1e6 / Math.pow(1.852, 2) * 100) / 100 + " nm<sup>2</sup>" : Math.round(L * 100) / 100 + " m<sup>2</sup>";
1544
1553
  }
1545
1554
  };
1546
- let v, g;
1547
- const T = () => {
1548
- v != null && v.parentNode && v.parentNode.removeChild(v), v = document.createElement("div"), v.style.display = "flex", v.className = "ol-tooltip ol-tooltip-draw-polygon", g = new Overlay({
1555
+ let v, f;
1556
+ const P = () => {
1557
+ v != null && v.parentNode && v.parentNode.removeChild(v), v = document.createElement("div"), v.style.display = "flex", v.className = "ol-tooltip ol-tooltip-draw-polygon", f = new Overlay({
1549
1558
  element: v,
1550
1559
  offset: [0, -15],
1551
1560
  positioning: "bottom-center",
1552
1561
  stopEvent: !1,
1553
1562
  insertFirst: !1
1554
- }), e == null || e.addOverlay(g);
1563
+ }), e == null || e.addOverlay(f);
1555
1564
  };
1556
1565
  let p, C;
1557
1566
  const Z = () => {
@@ -1561,40 +1570,40 @@ const getShipDirectPath = (e) => {
1561
1570
  positioning: "center-left"
1562
1571
  }), e == null || e.addOverlay(C);
1563
1572
  }, Y = () => {
1564
- y == null || y.clear(), l = null, T(), Z(), F();
1573
+ y == null || y.clear(), l = null, P(), Z(), N();
1565
1574
  };
1566
1575
  return {
1567
1576
  open: s,
1568
1577
  close: () => {
1569
- y == null || y.clear(), y = null, o && (e.removeLayer(o), o = null), t = null, f && (f = null, e.getInteractions().forEach((H) => {
1578
+ y == null || y.clear(), y = null, o && (e.removeLayer(o), o = null), t = null, g && (g = null, e.getInteractions().forEach((H) => {
1570
1579
  H instanceof Draw && e.removeInteraction(H);
1571
- })), p != null && p.parentElement && p.parentElement.removeChild(p), v != null && v.parentElement && v.parentElement.removeChild(v), C && e.removeOverlay(C), g && e.removeOverlay(g);
1580
+ })), p != null && p.parentElement && p.parentElement.removeChild(p), v != null && v.parentElement && v.parentElement.removeChild(v), C && e.removeOverlay(C), f && e.removeOverlay(f);
1572
1581
  },
1573
1582
  reset: Y
1574
1583
  };
1575
1584
  }, PORT_LAYER_CLASS_NAME = "zh-map-port-layer", usePortManager = (e) => {
1576
1585
  const n = e.getInstall();
1577
1586
  let l, s, a = null, o = null;
1578
- const y = (g) => {
1579
- if (!(!g || g.length === 0)) {
1587
+ const y = (f) => {
1588
+ if (!(!f || f.length === 0)) {
1580
1589
  if (s || (s = new VectorSource()), s.clear(), o) {
1581
- const T = g.find((p) => p.id === o.id);
1582
- T ? o = T : g.push(o);
1590
+ const P = f.find((p) => p.id === o.id);
1591
+ P ? o = P : f.push(o);
1583
1592
  }
1584
- g.forEach((T) => {
1585
- E(T);
1593
+ f.forEach((P) => {
1594
+ T(P);
1586
1595
  }), l || (l = new VectorLayer({
1587
1596
  className: PORT_LAYER_CLASS_NAME,
1588
1597
  source: s,
1589
1598
  zIndex: 100
1590
1599
  }), n.addLayer(l));
1591
1600
  }
1592
- }, E = (g) => {
1593
- const T = e.getZoom(), [p, C] = g.latLon.split(","), Z = new Feature({
1601
+ }, T = (f) => {
1602
+ const P = e.getZoom(), [p, C] = f.latLon.split(","), Z = new Feature({
1594
1603
  geometry: new Point(fromLonLat([Number(p), Number(C)]))
1595
1604
  });
1596
- Z.setStyle(t(g, T, g.id === (o == null ? void 0 : o.id))), Z.set("portData", g), s.addFeature(Z);
1597
- }, t = (g, T, p) => {
1605
+ Z.setStyle(t(f, P, f.id === (o == null ? void 0 : o.id))), Z.set("portData", f), s.addFeature(Z);
1606
+ }, t = (f, P, p) => {
1598
1607
  const C = (Y) => `<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
1599
1608
  <path fill-rule="evenodd" clip-rule="evenodd" d="M22.6563 44.9304C22.5453 44.8844 22.4445 44.817 22.3595 44.7321C22.3595 44.7321 9.36986 31.7424 9.32952 31.6913C7.09059 29.0791 5.64794 25.8802 5.17255 22.4736C4.69716 19.0671 5.20896 15.5957 6.64728 12.471C8.08561 9.34625 10.3902 6.69909 13.2878 4.84325C16.1855 2.98741 19.5548 2.00068 22.9965 2C26.4381 1.99932 29.8078 2.98473 32.7062 4.83943C35.6046 6.69414 37.9102 9.34039 39.3498 12.4646C40.7893 15.5888 41.3025 19.0599 40.8284 22.4666C40.3544 25.8734 38.913 29.0729 36.6751 31.686C36.6401 31.737 23.6531 44.7321 23.6531 44.7321C23.5682 44.817 23.4674 44.8844 23.3564 44.9304C23.2454 44.9763 23.1265 45 23.0063 45C22.8862 45 22.7673 44.9763 22.6563 44.9304Z" fill="${Y}"/>
1600
1609
  <g clip-path="url(#clip0_10059_122082)">
@@ -1609,7 +1618,7 @@ const getShipDirectPath = (e) => {
1609
1618
  `, Z = () => `data:image/svg+xml;utf8,${encodeURIComponent(C(p ? "#FF5733" : "#3370FF"))}`;
1610
1619
  return new Style({
1611
1620
  text: new Text({
1612
- text: g.shortName,
1621
+ text: f.shortName,
1613
1622
  font: "12px sans-serif",
1614
1623
  fill: new Fill({
1615
1624
  color: p ? "#ffffff" : "#000000"
@@ -1621,70 +1630,70 @@ const getShipDirectPath = (e) => {
1621
1630
  }),
1622
1631
  image: new Icon({
1623
1632
  src: Z(),
1624
- scale: 0.5 * T / 10
1633
+ scale: 0.5 * P / 10
1625
1634
  })
1626
1635
  });
1627
1636
  }, r = () => {
1628
1637
  if (a) {
1629
1638
  console.log("清除非选中的港口");
1630
- const g = a.get("portData").id;
1631
- s.getFeatures().forEach((T) => {
1632
- T.get("portData").id !== g && s.removeFeature(T);
1639
+ const f = a.get("portData").id;
1640
+ s.getFeatures().forEach((P) => {
1641
+ P.get("portData").id !== f && s.removeFeature(P);
1633
1642
  });
1634
1643
  } else
1635
- console.log("清除所有港口"), s.clear();
1636
- }, f = () => {
1637
- const g = a == null ? void 0 : a.get("portData"), T = e.getZoom();
1638
- g && s.getFeatures().forEach((C) => {
1639
- C.get("portData").id === g.id && (C == null || C.setStyle(t(g, T, !1)));
1644
+ console.log("清除所有港口", s), s.clear();
1645
+ }, g = () => {
1646
+ const f = a == null ? void 0 : a.get("portData"), P = e.getZoom();
1647
+ f && s.getFeatures().forEach((C) => {
1648
+ C.get("portData").id === f.id && (C == null || C.setStyle(t(f, P, !1)));
1640
1649
  }), o = null, a = null;
1641
- }, m = (g) => {
1642
- g ? (F(), V(g)) : f();
1643
- }, F = () => {
1650
+ }, m = (f) => {
1651
+ f ? (N(), D(f)) : g();
1652
+ }, N = () => {
1644
1653
  if (a) {
1645
- const g = a == null ? void 0 : a.get("portData"), T = e.getZoom();
1646
- a.setStyle(t(g, T, !1));
1654
+ const f = a == null ? void 0 : a.get("portData"), P = e.getZoom();
1655
+ a.setStyle(t(f, P, !1));
1647
1656
  }
1648
- }, V = (g) => {
1649
- const T = s.getFeatures();
1650
- o = g, a = T.find((p) => p.get("portData").id === g.id);
1657
+ }, D = (f) => {
1658
+ const P = s.getFeatures();
1659
+ o = f, a = P.find((p) => p.get("portData").id === f.id);
1651
1660
  };
1652
1661
  return {
1653
1662
  render: y,
1654
1663
  clear: r,
1655
1664
  selected: m,
1656
- handlePortHover: (g) => {
1657
- const T = n == null ? void 0 : n.getTargetElement();
1658
- g && g.get("portData") && T && (T.style.cursor = "pointer");
1665
+ handlePortHover: (f) => {
1666
+ const P = n == null ? void 0 : n.getTargetElement();
1667
+ f && f.get("portData") && P && (P.style.cursor = "pointer");
1659
1668
  }
1660
1669
  };
1661
1670
  }, useEventManager = (e, n, l, s, a, o) => {
1662
1671
  const y = e.getInstall();
1663
1672
  y.on("moveend", () => {
1664
1673
  var t, r;
1665
- const E = e.getZoom();
1666
- (r = (t = n.getProps()).mapMoveEnd) == null || r.call(t, E), l.reRenderTrackLine();
1667
- }), y.on("pointermove", (E) => {
1668
- const t = y.getEventPixel(E.originalEvent), r = y.forEachFeatureAtPixel(t, (f) => f);
1669
- s.handleShipMapEvent(r, "hover"), l.handleTrackMapEvent(r, "hover", E), r && a.handlePortHover(r);
1674
+ const T = e.getZoom();
1675
+ (r = (t = n.getProps()).mapMoveEnd) == null || r.call(t, T), l.reRenderTrackLine();
1676
+ }), y.on("pointermove", (T) => {
1677
+ const t = y.getEventPixel(T.originalEvent), r = y.forEachFeatureAtPixel(t, (g) => g);
1678
+ s.handleShipMapEvent(r, "hover"), l.handleTrackMapEvent(r, "hover", T), r && a.handlePortHover(r);
1670
1679
  }), y.on("movestart", () => {
1671
1680
  console.log("movestart-----------------------");
1672
- }), y.on("click", debounce((E) => {
1673
- var f, m, F;
1681
+ }), y.on("click", debounce((T) => {
1682
+ var g, m, N;
1674
1683
  if (console.log("1", o.getState()), o.getState()) return;
1675
- const t = y.getEventPixel(E.originalEvent), r = y.forEachFeatureAtPixel(
1684
+ const t = y.getEventPixel(T.originalEvent), r = y.forEachFeatureAtPixel(
1676
1685
  t,
1677
- (V) => {
1678
- if (V != null && V.get("shipData") || V != null && V.get("portData"))
1679
- return V;
1686
+ (D) => {
1687
+ if (D != null && D.get("shipData") || D != null && D.get("portData"))
1688
+ return D;
1680
1689
  }
1681
1690
  );
1682
1691
  if (console.log("2", r), !!r) {
1683
- if (E.preventDefault(), E.stopPropagation(), r.get("shipData"))
1684
- s.handleShipMapEvent(r, "click", (f = n.getProps()) == null ? void 0 : f.selectShip);
1692
+ if (T.preventDefault(), T.stopPropagation(), r.get("shipData"))
1693
+ s.handleShipMapEvent(r, "click", (g = n.getProps()) == null ? void 0 : g.selectShip);
1685
1694
  else if (r.get("portData")) {
1686
- const V = r.get("portData");
1687
- a.selected(V), (F = (m = n.getProps()) == null ? void 0 : m.selectPort) == null || F.call(m, V);
1695
+ const D = r.get("portData");
1696
+ a.selected(D), (N = (m = n.getProps()) == null ? void 0 : m.selectPort) == null || N.call(m, D);
1688
1697
  }
1689
1698
  }
1690
1699
  }, 150));
@@ -1694,11 +1703,11 @@ const getShipDirectPath = (e) => {
1694
1703
  createInstance: (s, a) => {
1695
1704
  const o = useMapInitializer();
1696
1705
  o.initMap(s, a);
1697
- const y = o.getInstall(), E = useLayerManager(y), t = usePropsManager();
1698
- t.setProps(a), E.setShowLayerType(a.layerType), E.setGreenTileVisible(a.showGreenLayer);
1699
- const r = useTrackManager(y), f = useCarTrackManager(y, r), m = useShipManager(y), F = usePositionManager(y), V = useDrawLineManager(y, t), v = useDrawPolygonManager(y, t), g = usePortManager(o);
1700
- useEventManager(o, t, r, m, g, V);
1701
- const T = () => {
1706
+ const y = o.getInstall(), T = useLayerManager(y), t = usePropsManager();
1707
+ t.setProps(a), T.setShowLayerType(a.layerType), T.setGreenTileVisible(a.showGreenLayer);
1708
+ const r = useTrackManager(y), g = useCarTrackManager(y, r), m = useShipManager(y), N = usePositionManager(y), D = useDrawLineManager(y, t), v = useDrawPolygonManager(y, t), f = usePortManager(o);
1709
+ useEventManager(o, t, r, m, f, D);
1710
+ const P = () => {
1702
1711
  const C = y.getView().calculateExtent(o.getSize()), Z = transform([C[0], C[1]], projection.mercator, projection.data), Y = transform([C[2], C[3]], projection.mercator, projection.data);
1703
1712
  return [Z[0], Z[1], Y[0], Y[1]];
1704
1713
  }, p = {
@@ -1710,21 +1719,21 @@ const getShipDirectPath = (e) => {
1710
1719
  },
1711
1720
  methods: {
1712
1721
  ...o,
1713
- layer: E,
1722
+ layer: T,
1714
1723
  ship: m,
1715
1724
  track: r,
1716
- carTrack: f,
1725
+ carTrack: g,
1717
1726
  port: {
1718
- render: g.render,
1719
- clear: g.clear,
1720
- selected: g.selected
1727
+ render: f.render,
1728
+ clear: f.clear,
1729
+ selected: f.selected
1721
1730
  },
1722
- position: F,
1723
- drawLine: V,
1731
+ position: N,
1732
+ drawLine: D,
1724
1733
  drawPolygon: v,
1725
1734
  // 子模块
1726
1735
  utils: {
1727
- getCalculateExtent: T,
1736
+ getCalculateExtent: P,
1728
1737
  convertSixHundredThousandToLatLng,
1729
1738
  calculateCirclePoints
1730
1739
  }
@@ -1761,13 +1770,13 @@ const getShipDirectPath = (e) => {
1761
1770
  } }
1762
1771
  },
1763
1772
  setup(e, { expose: n }) {
1764
- const l = ref(), s = ref(), a = useMapController(), o = ref(), y = e, E = ref({
1773
+ const l = ref(), s = ref(), a = useMapController(), o = ref(), y = e, T = ref({
1765
1774
  getInstall() {
1766
1775
  }
1767
1776
  });
1768
1777
  return onMounted(() => {
1769
1778
  var t;
1770
- o.value = a.createInstance(l.value, y), console.log(" instance.value?.methods", o.value.map), E.value = o.value.methods, (t = s.value) == null || t.setScaleLine(o.value.map, y.scaleLineUnit);
1779
+ o.value = a.createInstance(l.value, y), console.log(" instance.value?.methods", o.value.map), T.value = o.value.methods, (t = s.value) == null || t.setScaleLine(o.value.map, y.scaleLineUnit);
1771
1780
  }), onUnmounted(() => {
1772
1781
  var t, r;
1773
1782
  a.destroyInstance((t = o == null ? void 0 : o.value) == null ? void 0 : t.id), (r = o.value) == null || r.destroy();
@@ -1789,16 +1798,16 @@ const getShipDirectPath = (e) => {
1789
1798
  return (t = o.value) == null ? void 0 : t.methods.getView();
1790
1799
  },
1791
1800
  setCenter: (t, r) => {
1792
- var f;
1793
- return (f = o.value) == null ? void 0 : f.methods.setCenter(t, r);
1801
+ var g;
1802
+ return (g = o.value) == null ? void 0 : g.methods.setCenter(t, r);
1794
1803
  },
1795
1804
  getSize: () => {
1796
1805
  var t;
1797
1806
  return (t = o.value) == null ? void 0 : t.methods.getSize();
1798
1807
  },
1799
1808
  getCenter: (t, r) => {
1800
- var f;
1801
- return (f = o.value) == null ? void 0 : f.methods.getCenter();
1809
+ var g;
1810
+ return (g = o.value) == null ? void 0 : g.methods.getCenter();
1802
1811
  },
1803
1812
  layer: {
1804
1813
  setGreenTileVisible: (t) => {
@@ -1883,9 +1892,9 @@ const getShipDirectPath = (e) => {
1883
1892
  var r;
1884
1893
  return (r = o.value) == null ? void 0 : r.methods.carTrack.setCenter(...t);
1885
1894
  },
1886
- closeTrack: (...t) => {
1887
- var r;
1888
- return (r = o.value) == null ? void 0 : r.methods.carTrack.closeTrack(...t);
1895
+ closeTrack: () => {
1896
+ var t;
1897
+ return (t = o.value) == null ? void 0 : t.methods.carTrack.closeTrack();
1889
1898
  },
1890
1899
  playTrack: (...t) => {
1891
1900
  var r;
@@ -1962,17 +1971,17 @@ const getShipDirectPath = (e) => {
1962
1971
  },
1963
1972
  // 子模块
1964
1973
  utils: {
1965
- getCalculateExtent: () => {
1966
- var t;
1967
- return (t = o.value) == null ? void 0 : t.methods.utils.getCalculateExtent();
1974
+ getCalculateExtent: (...t) => {
1975
+ var r;
1976
+ return (r = o.value) == null ? void 0 : r.methods.utils.getCalculateExtent(...t);
1968
1977
  },
1969
- convertSixHundredThousandToLatLng: () => {
1970
- var t;
1971
- return (t = o.value) == null ? void 0 : t.methods.utils.convertSixHundredThousandToLatLng();
1978
+ convertSixHundredThousandToLatLng: (...t) => {
1979
+ var r;
1980
+ return (r = o.value) == null ? void 0 : r.methods.utils.convertSixHundredThousandToLatLng(...t);
1972
1981
  },
1973
- calculateCirclePoints: () => {
1974
- var t;
1975
- return (t = o.value) == null ? void 0 : t.methods.utils.calculateCirclePoints();
1982
+ calculateCirclePoints: (t, r) => {
1983
+ var g;
1984
+ return (g = o.value) == null ? void 0 : g.methods.utils.calculateCirclePoints(t, r);
1976
1985
  }
1977
1986
  }
1978
1987
  }), (t, r) => (openBlock(), createElementBlock("div", _hoisted_1, [
@@ -1992,7 +2001,7 @@ const getShipDirectPath = (e) => {
1992
2001
  }, null, 8, ["map-instance"])
1993
2002
  ]));
1994
2003
  }
1995
- }), Map$1 = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-9b3c0151"]]), ZhMap = withInstall(Map$1);
2004
+ }), Map$1 = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-117d7b5a"]]), ZhMap = withInstall(Map$1);
1996
2005
  export {
1997
2006
  ZhMap as Z
1998
2007
  };