zhihao-ui 1.3.16 → 1.3.17

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.
@@ -4,16 +4,16 @@ import { _ as _export_sfc } from "./Button-CGndQwez.js";
4
4
  import { w as withInstall } from "./utils-D2wHR1YB.js";
5
5
  const _hoisted_1$2 = { id: "scale-line-container" }, _sfc_main$2 = /* @__PURE__ */ defineComponent({
6
6
  __name: "scaleLine",
7
- setup(e, { expose: n }) {
8
- return n({
9
- setScaleLine: (s, a) => {
7
+ setup(e, { expose: s }) {
8
+ return s({
9
+ setScaleLine: (n, a) => {
10
10
  a || (a = "metric");
11
11
  const o = new ScaleLine$1({
12
12
  units: a
13
- }), y = document.getElementById("scale-line-container");
14
- y && (o.setTarget(y), s.addControl(o));
13
+ }), m = document.getElementById("scale-line-container");
14
+ m && (o.setTarget(m), n.addControl(o));
15
15
  }
16
- }), (s, a) => (openBlock(), createElementBlock("div", _hoisted_1$2));
16
+ }), (n, a) => (openBlock(), createElementBlock("div", _hoisted_1$2));
17
17
  }
18
18
  }), ScaleLine = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-2bc5dee8"]]), _hoisted_1$1 = { class: "zoom" }, _sfc_main$1 = /* @__PURE__ */ defineComponent({
19
19
  __name: "zoomControl",
@@ -24,17 +24,17 @@ const _hoisted_1$2 = { id: "scale-line-container" }, _sfc_main$2 = /* @__PURE__
24
24
  }
25
25
  },
26
26
  setup(e) {
27
- const n = e;
28
- console.log("props", n);
27
+ const s = e;
28
+ console.log("props", s);
29
29
  const l = () => {
30
30
  console.log("props");
31
- const { setZoom: a, getZoom: o, getInstall: y } = n.mapInstance.methods;
32
- if (!y()) return;
31
+ const { setZoom: a, getZoom: o, getInstall: m } = s.mapInstance.methods;
32
+ if (!m()) return;
33
33
  const t = o();
34
34
  t && a(t + 1);
35
- }, s = () => {
36
- const { setZoom: a, getZoom: o, getInstall: y } = n.mapInstance.methods;
37
- if (!y()) return;
35
+ }, n = () => {
36
+ const { setZoom: a, getZoom: o, getInstall: m } = s.mapInstance.methods;
37
+ if (!m()) return;
38
38
  const t = o();
39
39
  t && a(t - 1);
40
40
  };
@@ -45,7 +45,7 @@ const _hoisted_1$2 = { id: "scale-line-container" }, _sfc_main$2 = /* @__PURE__
45
45
  }, " + "),
46
46
  createElementVNode("div", {
47
47
  class: "button small-button",
48
- onClick: s
48
+ onClick: n
49
49
  }, " - ")
50
50
  ]));
51
51
  }
@@ -72,34 +72,34 @@ const _hoisted_1$2 = { id: "scale-line-container" }, _sfc_main$2 = /* @__PURE__
72
72
  }, MAP_DEFAULT_CENTER = [114.84, 30.52], CDN_URL = "https://static.zhihaoscm.cn/", equatorialCircumference = 2003750834e-2;
73
73
  var BASE_MAP_LINK = ((e) => (e.vectorTile = `https://t0.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${TIAN_DI_TU_KEY}`, e.vectorTileMark = `https://t0.tianditu.gov.cn/cva_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cva&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${TIAN_DI_TU_KEY}`, e.satelliteImgTile = `https://t0.tianditu.gov.cn/img_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${TIAN_DI_TU_KEY}`, e.satelliteImgTileMark = `https://t0.tianditu.gov.cn/cia_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cia&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${TIAN_DI_TU_KEY}`, e.greenTile = `${CDN_URL}/map/tile/{z}/{x}/{y}.png`, e))(BASE_MAP_LINK || {}), LENGTH_UNIT = /* @__PURE__ */ ((e) => (e[e.M = 1] = "M", e[e.KM = 2] = "KM", e[e.NM = 3] = "NM", e))(LENGTH_UNIT || {});
74
74
  function useMapInitializer() {
75
- const e = ref(), n = () => e.value, l = () => n().getView(), s = () => {
76
- var m;
77
- return (m = l()) == null ? void 0 : m.getZoom();
78
- }, a = (m) => {
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
- }, y = () => {
85
- var N;
86
- const m = (N = l()) == null ? void 0 : N.getCenter();
87
- return toLonLat(m);
88
- }, T = () => {
89
- var m;
90
- return (m = n()) == null ? void 0 : m.getSize();
91
- }, t = new Map$2(), r = (m, N) => {
92
- g(N);
93
- const D = {
94
- zoom: N.zoom,
95
- center: fromLonLat(N.center),
75
+ const e = ref(), s = () => e.value, l = () => s().getView(), n = () => {
76
+ var v;
77
+ return (v = l()) == null ? void 0 : v.getZoom();
78
+ }, a = (v) => {
79
+ var P;
80
+ (P = l()) == null || P.setZoom(v);
81
+ }, o = (v, P) => {
82
+ var O;
83
+ (O = l()) == null || O.setCenter(fromLonLat([v, P]));
84
+ }, m = () => {
85
+ var P;
86
+ const v = (P = l()) == null ? void 0 : P.getCenter();
87
+ return toLonLat(v);
88
+ }, L = () => {
89
+ var v;
90
+ return (v = s()) == null ? void 0 : v.getSize();
91
+ }, t = new Map$2(), r = (v, P) => {
92
+ w(P);
93
+ const O = {
94
+ zoom: P.zoom,
95
+ center: fromLonLat(P.center),
96
96
  minZoom: MAP_ZOOM.min,
97
97
  maxZoom: MAP_ZOOM.max,
98
98
  constrainResolution: !0,
99
99
  enableRotation: !1,
100
100
  multiWorld: !0
101
- }, v = new Map$2({
102
- target: m,
101
+ }, f = new Map$2({
102
+ target: v,
103
103
  controls: defaults({
104
104
  zoom: !1
105
105
  }),
@@ -109,62 +109,62 @@ function useMapInitializer() {
109
109
  t.get("satelliteImgTile"),
110
110
  t.get("satelliteImgTileMark")
111
111
  ],
112
- view: new View(D)
112
+ view: new View(O)
113
113
  });
114
- e.value = v;
115
- }, g = (m) => {
114
+ e.value = f;
115
+ }, w = (v) => {
116
116
  t.set("vectorTile", new TileLayer({
117
117
  source: new XYZ({ url: BASE_MAP_LINK.vectorTile }),
118
- visible: m.layerType === "vector",
118
+ visible: v.layerType === "vector",
119
119
  zIndex: 0,
120
120
  preload: 1,
121
121
  className: "vector"
122
122
  })), t.set("vectorTileMark", new TileLayer({
123
123
  source: new XYZ({ url: BASE_MAP_LINK.vectorTileMark }),
124
- visible: m.layerType === "vector",
124
+ visible: v.layerType === "vector",
125
125
  zIndex: 1,
126
126
  preload: 1,
127
127
  className: "vector"
128
128
  })), t.set("satelliteImgTile", new TileLayer({
129
129
  source: new XYZ({ url: BASE_MAP_LINK.satelliteImgTile }),
130
- visible: m.layerType === "satellite",
130
+ visible: v.layerType === "satellite",
131
131
  zIndex: 0,
132
132
  preload: 1,
133
133
  className: "satellite"
134
134
  })), t.set("satelliteImgTileMark", new TileLayer({
135
135
  source: new XYZ({ url: BASE_MAP_LINK.satelliteImgTileMark }),
136
- visible: m.layerType === "satellite",
136
+ visible: v.layerType === "satellite",
137
137
  zIndex: 1,
138
138
  preload: 1,
139
139
  className: "satellite"
140
140
  })), t.set("greenMark", new TileLayer({
141
141
  source: new XYZ({ url: BASE_MAP_LINK.greenTile }),
142
- visible: m.showGreenLayer,
142
+ visible: v.showGreenLayer,
143
143
  zIndex: 2,
144
144
  className: "greenTile"
145
145
  }));
146
146
  };
147
147
  return {
148
- getInstall: n,
148
+ getInstall: s,
149
149
  getView: l,
150
- getZoom: s,
150
+ getZoom: n,
151
151
  setZoom: a,
152
152
  setCenter: o,
153
- getCenter: y,
154
- getSize: T,
153
+ getCenter: m,
154
+ getSize: L,
155
155
  initMap: r,
156
- setBaseLayerMap: g
156
+ setBaseLayerMap: w
157
157
  };
158
158
  }
159
- const convertSixHundredThousandToLatLng = function(e, n) {
160
- const l = Number(n) / 6e5;
159
+ const convertSixHundredThousandToLatLng = function(e, s) {
160
+ const l = Number(s) / 6e5;
161
161
  return [Number(e) / 6e5, l];
162
- }, calculateCirclePoints = (e, n) => {
163
- const l = fromLonLat(e), s = n * 1e3, a = [
164
- l[0] - s,
165
- l[1] - s,
166
- l[0] + s,
167
- l[1] + s
162
+ }, calculateCirclePoints = (e, s) => {
163
+ const l = fromLonLat(e), n = s * 1e3, a = [
164
+ l[0] - n,
165
+ l[1] - n,
166
+ l[0] + n,
167
+ l[1] + n
168
168
  ], o = transformExtent(a, projection.mercator, projection.data);
169
169
  return {
170
170
  leftTopPoint: { lng: o[0], lat: o[3] },
@@ -172,134 +172,134 @@ const convertSixHundredThousandToLatLng = function(e, n) {
172
172
  rightBottomPoint: { lng: o[2], lat: o[1] },
173
173
  leftBottomPoint: { lng: o[0], lat: o[1] }
174
174
  };
175
- }, formatLength = function(e, n) {
176
- const s = getLength(e);
175
+ }, formatLength = function(e, s) {
176
+ const n = getLength(e);
177
177
  let a = "";
178
- switch (console.log(n, LENGTH_UNIT), n) {
178
+ switch (console.log(s, LENGTH_UNIT), s) {
179
179
  case LENGTH_UNIT.M:
180
- a = Math.round(s * 100) / 100 + " m";
180
+ a = Math.round(n * 100) / 100 + " m";
181
181
  break;
182
182
  case LENGTH_UNIT.KM:
183
- a = Math.round(s / 1e3 * 100) / 100 + " km";
183
+ a = Math.round(n / 1e3 * 100) / 100 + " km";
184
184
  break;
185
185
  case LENGTH_UNIT.NM:
186
- a = (Math.round(s / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
186
+ a = (Math.round(n / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
187
187
  break;
188
188
  }
189
189
  return a;
190
190
  };
191
191
  function lonLatToMercator(e) {
192
- const n = e[0] * equatorialCircumference / 180;
192
+ const s = e[0] * equatorialCircumference / 180;
193
193
  let l = Math.log(Math.tan((90 + e[1]) * Math.PI / 360)) / (Math.PI / 180);
194
- return l = l * equatorialCircumference / 180, [n, l];
194
+ return l = l * equatorialCircumference / 180, [s, l];
195
195
  }
196
196
  function getIconFont(unicode = "") {
197
197
  return unicode.indexOf("&") !== -1 && (unicode = unicode.replace("&", "&")), unicode.indexOf("&amp") !== -1 && (unicode = unicode.replace("&amp", "&")), eval('("' + unicode.replace("&#x", "\\u").replace(";", "") + '")');
198
198
  }
199
199
  const getIconStyle = (e) => {
200
- const n = new Text({
200
+ const s = new Text({
201
201
  font: "Normal 14px map-iconfont",
202
202
  text: getIconFont(e),
203
203
  fill: new Fill({ color: "#fff" }),
204
204
  offsetY: -14
205
205
  });
206
206
  return new Style({
207
- text: n,
207
+ text: s,
208
208
  zIndex: 100
209
209
  });
210
- }, mercatorToLonLat = (e, n = "lonlat") => {
211
- const l = { lon: 0, lat: 0 }, s = e[0] / equatorialCircumference * 180;
210
+ }, mercatorToLonLat = (e, s = "lonlat") => {
211
+ const l = { lon: 0, lat: 0 }, n = e[0] / equatorialCircumference * 180;
212
212
  let a = e[1] / equatorialCircumference * 180;
213
- return a = 180 / Math.PI * (2 * Math.atan(Math.exp(a * Math.PI / 180)) - Math.PI / 2), l.lon = s, l.lat = a, n === "lonlat" ? l : [s, a];
213
+ return a = 180 / Math.PI * (2 * Math.atan(Math.exp(a * Math.PI / 180)) - Math.PI / 2), l.lon = n, l.lat = a, s === "lonlat" ? l : [n, a];
214
214
  }, formatMinutesToDDHHMM = (e) => {
215
- const n = hooks.duration(e, "minutes"), l = Math.floor(n.asDays()), s = n.hours(), a = n.minutes();
215
+ const s = hooks.duration(e, "minutes"), l = Math.floor(s.asDays()), n = s.hours(), a = s.minutes();
216
216
  let o = `${String(a).padStart(2, "0")}分`;
217
- return s !== 0 && (o = `${String(s).padStart(2, "0")}时${o}`), l !== 0 && (o = `${String(l).padStart(2, "0")}天${o}`), o;
218
- }, useCarTrackManager = (e, n) => {
217
+ return n !== 0 && (o = `${String(n).padStart(2, "0")}时${o}`), l !== 0 && (o = `${String(l).padStart(2, "0")}天${o}`), o;
218
+ }, useCarTrackManager = (e, s) => {
219
219
  let l = null;
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`;
220
+ const n = async (w) => {
221
+ if (!e || (console.log("vehicleInfo", w), !(w != null && w.lon && (w != null && w.lat)))) return;
222
+ const v = Math.abs(Number(w.lon)) > 180 ? convertSixHundredThousandToLatLng(w.lon, w.lat) : [w.lon, w.lat];
223
+ a(w, fromLonLat(v));
224
+ const P = e == null ? void 0 : e.getView(), O = new Point(v);
225
+ P.setCenter(transform(O.getCoordinates(), projection.data, projection.mercator));
226
+ }, a = (w, v) => {
227
+ const P = `${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 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);
234
+ const O = l.getElement();
235
+ O.style.backgroundImage = `url(${P})`, O.style.width = "80px", O.style.height = "80px";
236
+ const f = (w == null ? void 0 : w.drc) || "";
237
+ O.style.transform = `rotate(${f}deg)`, O.style.backgroundSize = "cover", l == null || l.setPosition(v);
238
238
  };
239
239
  return {
240
- location: s,
240
+ location: n,
241
241
  remove: () => {
242
- const g = l == null ? void 0 : l.getElement();
243
- g && (g.innerHTML = "");
242
+ const w = l == null ? void 0 : l.getElement();
243
+ w && (w.innerHTML = "");
244
244
  },
245
- renderTrack: (g, m, N) => {
246
- n.render(g, m, N, "truck", 1e3);
245
+ renderTrack: (w, v, P) => {
246
+ s.render(w, v, P, "truck", 1e3);
247
247
  },
248
- setCenter: (g) => {
249
- n.setCenter(g);
248
+ setCenter: (w) => {
249
+ s.setCenter(w);
250
250
  },
251
251
  closeTrack: () => {
252
- n.close();
252
+ s.close();
253
253
  },
254
- playTrack: (g, m) => {
255
- n.play(g, m);
254
+ playTrack: (w, v) => {
255
+ s.play(w, v);
256
256
  }
257
257
  };
258
258
  };
259
259
  var 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 || {}), SHIP_DIRECT = /* @__PURE__ */ ((e) => (e.left = "left", e.right = "right", e.front = "front", e.up = "up", e.down = "down", e.back = "back", e))(SHIP_DIRECT || {});
260
260
  const useTrackManager = (e) => {
261
- const n = /* @__PURE__ */ new Map(), l = {};
262
- let s = null;
261
+ const s = /* @__PURE__ */ new Map(), l = {};
262
+ let n = null;
263
263
  const a = "--";
264
264
  let o = null;
265
- const y = document.createElement("div"), T = new Overlay({
266
- element: y,
265
+ const m = document.createElement("div"), L = new Overlay({
266
+ element: m,
267
267
  positioning: "top-left",
268
268
  stopEvent: !1,
269
269
  className: "track-label-popup"
270
270
  });
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) => {
271
+ let t, r, w, v, P, O = !1, f = Date.now(), y, F = 0, E = null, T = 20, G = !1;
272
+ const q = 5, W = [], Q = (i) => {
273
273
  var c;
274
- for (Q.unshift(i); Q.length > Y; ) {
275
- const d = Q.pop(), w = n.get(d);
276
- w && ((c = w.getSource()) == null || c.clear(), e == null || e.removeLayer(w), n.delete(d), delete l[d]);
274
+ for (W.unshift(i); W.length > q; ) {
275
+ const d = W.pop(), p = s.get(d);
276
+ p && ((c = p.getSource()) == null || c.clear(), e == null || e.removeLayer(p), s.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"], E = debounce(() => {
281
- if (s && l[s] && n.get(s).getVisible() && Z) {
280
+ const x = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080", "#ffc0cb", "#800000", "#000080", "#808000"], g = debounce(() => {
281
+ if (n && l[n] && s.get(n).getVisible() && G) {
282
282
  console.log("reRenderTrackLine------------");
283
- const i = cloneDeep(S(s, l[s]));
284
- ce(s, i);
283
+ const i = cloneDeep(M(n, l[n]));
284
+ ce(n, i);
285
285
  }
286
- }, 300), S = (i, c) => {
286
+ }, 300), M = (i, c) => {
287
287
  let d = [];
288
- const w = Math.max(1, Math.floor(c.length / C));
289
- return d = c.filter((b, _) => _ % w === 0).map((b, _) => {
290
- if (Number(b.lon) > 180 || Number(b.lat) > 180) {
291
- const [V, A] = convertSixHundredThousandToLatLng(b.lon, b.lat);
292
- b.lon = V, b.lat = A;
288
+ const p = Math.max(1, Math.floor(c.length / T));
289
+ return d = c.filter((k, _) => _ % p === 0).map((k, _) => {
290
+ if (Number(k.lon) > 180 || Number(k.lat) > 180) {
291
+ const [N, z] = convertSixHundredThousandToLatLng(k.lon, k.lat);
292
+ k.lon = N, k.lat = z;
293
293
  }
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;
294
+ return k.center = [k.lon, k.lat], k.centerPoint = lonLatToMercator(k.center), k.time = hooks(k.createdAt).format("YYYY-MM-DD HH:mm:ss"), k.id = i, k.index = _, k;
295
295
  }), d;
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))
296
+ }, V = async (i, c, d, p = "ship", b = 200) => {
297
+ if (!e || (c = c == null ? void 0 : c.reverse(), L && p === "ship" && (e != null && e.getOverlays().getArray().includes(L) || e.addOverlay(L)), (c == null ? void 0 : c.length) < 2))
298
298
  return;
299
- H(i), s = i, l[i] = c, C = x;
300
- const b = Object.keys(l).findIndex((_) => _ === i) || 0;
301
- u = d || L[b > 10 ? 10 : b], Z = !0, await z(), await ne(s);
302
- }, O = (i) => {
299
+ Q(i), n = i, l[i] = c, T = b;
300
+ const k = Object.keys(l).findIndex((_) => _ === i) || 0;
301
+ u = d || x[k > 10 ? 10 : k], G = !0, await R(), await ne(n);
302
+ }, D = (i) => {
303
303
  const c = new VectorSource();
304
304
  return new VectorLayer({
305
305
  source: c,
@@ -310,46 +310,46 @@ const useTrackManager = (e) => {
310
310
  // 增大渲染缓冲区
311
311
  });
312
312
  }, $ = (i) => {
313
- n.forEach((c, d) => {
314
- var x;
315
- const w = d === i;
316
- c.getVisible() !== w && (c.setVisible(w), e.getLayers().getArray().includes(c) || e.addLayer(c), w || (x = c.getSource()) == null || x.clear());
317
- }), s = i;
318
- }, z = async () => {
319
- const i = s;
320
- if (!n.has(i)) {
321
- const b = O(i);
322
- n.set(i, b);
313
+ s.forEach((c, d) => {
314
+ var b;
315
+ const p = d === i;
316
+ c.getVisible() !== p && (c.setVisible(p), e.getLayers().getArray().includes(c) || e.addLayer(c), p || (b = c.getSource()) == null || b.clear());
317
+ }), n = i;
318
+ }, R = async () => {
319
+ const i = n;
320
+ if (!s.has(i)) {
321
+ const k = D(i);
322
+ s.set(i, k);
323
323
  }
324
324
  await $(i);
325
325
  const c = u || "", d = l[i] || [];
326
326
  if (!(d && d.length > 1)) return [];
327
- let w = [];
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
- if (b)
334
- b.setGeometry(w), b.setId(i), b.setStyle(R(d)), p = b;
327
+ let p = [];
328
+ p = M(i, d);
329
+ const b = p.map((k) => k.centerPoint);
330
+ p.length >= 2 && await S(i, b, c);
331
+ }, S = (i, c, d) => {
332
+ const p = new LineString(c), b = s.get(i).getSource(), k = b.getFeatureById(i);
333
+ if (k)
334
+ k.setGeometry(p), k.setId(i), k.setStyle(A(d)), E = k;
335
335
  else {
336
- const _ = new Feature({ geometry: w });
337
- _.setId(i), _.set("type", "line"), _.setStyle(R(d)), x.addFeature(_), p = _;
336
+ const _ = new Feature({ geometry: p });
337
+ _.setId(i), _.set("type", "line"), _.setStyle(A(d)), b.addFeature(_), E = _;
338
338
  }
339
- return p;
340
- }, R = (i) => new Style({
339
+ return E;
340
+ }, A = (i) => new Style({
341
341
  stroke: new Stroke({
342
342
  color: i,
343
343
  width: 2
344
344
  })
345
- }), j = (i, c, d) => {
346
- const w = i == null ? void 0 : i.get("trackId");
347
- if (i && w && c === "hover") {
348
- e.getTargetElement().style.cursor = w ? "pointer" : "";
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(_));
345
+ }), X = (i, c, d) => {
346
+ const p = i == null ? void 0 : i.get("trackId");
347
+ if (i && p && c === "hover") {
348
+ e.getTargetElement().style.cursor = p ? "pointer" : "";
349
+ const b = i.get("data"), k = K(b), _ = d == null ? void 0 : d.coordinate;
350
+ _ && (m.querySelector(".popup-content"), m.innerHTML = k, L == null || L.setPosition(_));
351
351
  } else
352
- T && T.setPosition(void 0);
352
+ L && L.setPosition(void 0);
353
353
  }, K = (i) => {
354
354
  if (!(i != null && i.time)) return;
355
355
  let c = "";
@@ -391,63 +391,63 @@ const useTrackManager = (e) => {
391
391
  ${c ?? c}
392
392
  </div>`;
393
393
  }, ie = (i) => {
394
- const d = i.map((V) => {
395
- const A = e.getPixelFromCoordinate(fromLonLat(V.center));
394
+ const d = i.map((N) => {
395
+ const z = e.getPixelFromCoordinate(fromLonLat(N.center));
396
396
  return {
397
- ...V,
398
- original: V,
399
- pixel: A,
397
+ ...N,
398
+ original: N,
399
+ pixel: z,
400
400
  distance: 0
401
401
  // 先初始化,后续计算
402
402
  };
403
403
  });
404
- let w = 0;
404
+ let p = 0;
405
405
  d[0].distance = 0;
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;
406
+ for (let N = 1; N < d.length; N++) {
407
+ const z = d[N - 1].pixel, H = d[N].pixel, Y = H[0] - z[0], C = H[1] - z[1];
408
+ p += Math.sqrt(Y * Y + C * C), d[N].distance = p;
409
409
  }
410
- const x = d.filter(
411
- (V, A) => A === 0 || A === d.length - 1
412
- ), b = [];
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
- for (let G = 1; G <= k; G++) {
418
- const q = A.distance + G * 100;
419
- if (q >= B.distance) break;
420
- const X = ae(
410
+ const b = d.filter(
411
+ (N, z) => z === 0 || z === d.length - 1
412
+ ), k = [];
413
+ for (let N = 0; N < b.length; N++) {
414
+ const z = b[N];
415
+ if (k.push(z), N < b.length - 1) {
416
+ const H = b[N + 1], Y = H.distance - z.distance, C = Math.floor(Y / 100);
417
+ for (let Z = 1; Z <= C; Z++) {
418
+ const B = z.distance + Z * 100;
419
+ if (B >= H.distance) break;
420
+ const j = ae(
421
421
  d,
422
- q
422
+ B
423
423
  );
424
- X && b.push(X);
424
+ j && k.push(j);
425
425
  }
426
426
  }
427
427
  }
428
428
  return Array.from(
429
- new Map(b.map((V) => [V.distance.toFixed(2), V])).values()
430
- ).map((V) => ({
431
- ...V.original,
429
+ new Map(k.map((N) => [N.distance.toFixed(2), N])).values()
430
+ ).map((N) => ({
431
+ ...N.original,
432
432
  // 优先保留原始数据
433
- ...V,
433
+ ...N,
434
434
  // 覆盖坐标等计算属性
435
- coord: V.coord,
435
+ coord: N.coord,
436
436
  // 确保使用插值后的坐标
437
- pixel: V.pixel,
438
- distance: V.distance
437
+ pixel: N.pixel,
438
+ distance: N.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], 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]);
443
+ const p = i[d - 1], b = i[d];
444
+ if (c >= p.distance && c <= b.distance) {
445
+ const k = (c - p.distance) / (b.distance - p.distance), _ = p.pixel[0] + k * (b.pixel[0] - p.pixel[0]), N = p.pixel[1] + k * (b.pixel[1] - p.pixel[1]), z = e == null ? void 0 : e.getCoordinateFromPixel([_, N]);
446
446
  return {
447
- ...w,
447
+ ...p,
448
448
  // 继承前一个点的属性(可调整)
449
- coord: A,
450
- pixel: [_, V],
449
+ coord: z,
450
+ pixel: [_, N],
451
451
  distance: c,
452
452
  original: void 0
453
453
  // 明确标记为插值生成点
@@ -458,9 +458,9 @@ const useTrackManager = (e) => {
458
458
  }
459
459
  const ce = async (i, c) => {
460
460
  await re(), await ge(i);
461
- const d = ie(c), w = d.map((b) => de(b));
462
- n.get(i).getSource().addFeatures(w), me(i, d, c, u), d.forEach((b) => {
463
- const _ = ue(i, u, b);
461
+ const d = ie(c), p = d.map((k) => de(k));
462
+ s.get(i).getSource().addFeatures(p), he(i, d, c, u), d.forEach((k) => {
463
+ const _ = ue(i, u, k);
464
464
  e.addOverlay(_);
465
465
  });
466
466
  }, de = (i) => {
@@ -472,10 +472,10 @@ 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 = [...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;
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;
476
476
  }, ue = (i, c, d) => {
477
- const w = document.createElement("div");
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 = `
477
+ const p = document.createElement("div");
478
+ p.className = "track-overlay-label", p.style.position = "relative", p.style.backgroundColor = "rgba(255,255,255,0.8)", p.style.border = `1px solid ${c}`, p.style.fontSize = "12px", p.innerHTML = `
479
479
  <span>${d.time}</span>
480
480
  <svg
481
481
  style="position: absolute;left: -20px;top: 0;"
@@ -488,22 +488,22 @@ const useTrackManager = (e) => {
488
488
  stroke="${c}"
489
489
  stroke-width="1" />
490
490
  `;
491
- const x = new Overlay({
492
- element: w,
491
+ const b = new Overlay({
492
+ element: p,
493
493
  position: fromLonLat(d.center),
494
494
  positioning: "top-left",
495
495
  offset: [20, -20],
496
496
  stopEvent: !1,
497
497
  className: "track-label-time-overlay"
498
498
  });
499
- return x.set("class", "track-label-overlay"), x.set("trackId", i), x;
499
+ return b.set("class", "track-label-overlay"), b.set("trackId", i), b;
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) => {
503
503
  d.setPosition(void 0), d.dispose();
504
504
  });
505
505
  }, ge = (i) => {
506
- const c = n.get(i).getSource();
506
+ const c = s.get(i).getSource();
507
507
  c.forEachFeature((d) => {
508
508
  d.get("type") !== "line" && c.removeFeature(d);
509
509
  });
@@ -525,107 +525,107 @@ const useTrackManager = (e) => {
525
525
  })
526
526
  // textStyle,
527
527
  ]), ye = (i) => {
528
- const c = "#E31818", d = "#1890FF", w = "&#xe6d2", x = new Style({
528
+ const c = "#E31818", d = "#1890FF", p = "&#xe6d2", b = new Style({
529
529
  text: new Text({
530
530
  font: "Normal 22px map-iconfont",
531
- text: getIconFont(w),
531
+ text: getIconFont(p),
532
532
  offsetY: -10,
533
533
  fill: new Fill({
534
534
  color: Number(i.state) === 0 ? c : Number(i.state) === 1 ? d : ""
535
535
  })
536
536
  }),
537
537
  zIndex: 99
538
- }), _ = getIconStyle("&#xe6e2;"), A = getIconStyle("&#xe703;"), B = [];
539
- return Number(i.state) === 0 ? B.push(_) : Number(i.state) === 1 && B.push(A), B.push(x), B;
540
- }, me = (i, c, d, w) => {
541
- const x = c || [], b = c.length;
542
- b || (x.push(d[0]), x.push(d[d.length - 1]));
538
+ }), _ = getIconStyle("&#xe6e2;"), z = getIconStyle("&#xe703;"), H = [];
539
+ return Number(i.state) === 0 ? H.push(_) : Number(i.state) === 1 && H.push(z), H.push(b), H;
540
+ }, he = (i, c, d, p) => {
541
+ const b = c || [], k = c.length;
542
+ k || (b.push(d[0]), b.push(d[d.length - 1]));
543
543
  const _ = [];
544
- for (let A = 0; A < b - 1; A++) {
545
- let B;
546
- const W = c[A], k = (c[A + 1].index + W.index) / 2;
547
- if (k % 2 === 0)
548
- B = d[k].centerPoint;
544
+ for (let z = 0; z < k - 1; z++) {
545
+ let H;
546
+ const Y = c[z], C = (c[z + 1].index + Y.index) / 2;
547
+ if (C % 2 === 0)
548
+ H = d[C].centerPoint;
549
549
  else {
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];
550
+ const Z = d[Math.floor(C)], B = d[Math.ceil(C)];
551
+ if (Z && B) {
552
+ const [j, J] = Z.centerPoint, [I, ee] = B.centerPoint;
553
+ H = [(j + I) / 2, (J + ee) / 2];
554
554
  }
555
555
  }
556
- if (B) {
557
- const G = new Feature({
558
- geometry: new Point(B)
556
+ if (H) {
557
+ const Z = new Feature({
558
+ geometry: new Point(H)
559
559
  });
560
- G.set("type", "track_arrow"), G.setStyle(
560
+ Z.set("type", "track_arrow"), Z.setStyle(
561
561
  new Style({
562
562
  text: new Text({
563
563
  font: "700 12px map-iconfont",
564
564
  text: getIconFont("&#xe6bc;"),
565
- fill: new Fill({ color: w }),
565
+ fill: new Fill({ color: p }),
566
566
  // 设置箭头旋转 角度转为弧度
567
567
  rotation: le(
568
- c[A].center,
569
- c[A + 1].center
568
+ c[z].center,
569
+ c[z + 1].center
570
570
  ) * (Math.PI / 180)
571
571
  })
572
572
  })
573
- ), _.push(G);
573
+ ), _.push(Z);
574
574
  }
575
575
  }
576
- const V = n.get(i).getSource();
577
- V == null || V.addFeatures(_);
576
+ const N = s.get(i).getSource();
577
+ N == null || N.addFeatures(_);
578
578
  }, ne = (i) => {
579
- var b, _;
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
- if (!w) return;
582
- const x = (_ = w == null ? void 0 : w.getGeometry()) == null ? void 0 : _.getExtent();
583
- if (x != null && x.length)
579
+ var k, _;
580
+ const c = e.getView(), d = (k = s == null ? void 0 : s.get(i)) == null ? void 0 : k.getSource(), p = E || (i ? d == null ? void 0 : d.getFeatureById(i) : null);
581
+ if (!p) return;
582
+ const b = (_ = p == null ? void 0 : p.getGeometry()) == null ? void 0 : _.getExtent();
583
+ if (b != null && b.length)
584
584
  try {
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);
585
+ const N = buffer(b, Math.max(b[2] - b[0], b[3] - b[1]) * 0.02);
586
+ c.fit(N);
587
+ } catch (N) {
588
+ console.log(N);
589
589
  }
590
- }, he = (i) => {
591
- const c = "&#xe69b;", x = i.index === 0 ? "#fcdc3f" : "#ff0000";
590
+ }, ve = (i) => {
591
+ const c = "&#xe69b;", b = 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: x })
596
+ fill: new Fill({ color: b })
597
597
  }),
598
598
  zIndex: 101
599
599
  })];
600
- }, ve = () => {
601
- console.log("清除所有的轨迹-----"), U(), n.forEach((c) => {
600
+ }, me = () => {
601
+ console.log("清除所有的轨迹-----"), U(), s.forEach((c) => {
602
602
  var d;
603
603
  (d = c.getSource()) == null || d.clear(), e == null || e.removeLayer(c);
604
604
  }), Object.keys(l).forEach((c) => {
605
- n.delete(c), delete l[c];
606
- }), Z = !1, re();
605
+ s.delete(c), delete l[c];
606
+ }), G = !1, re();
607
607
  }, we = (i) => {
608
- const c = n.get(i || s);
608
+ const c = s.get(i || n);
609
609
  c == null || c.setVisible(!1);
610
610
  const d = e.getOverlays().getArray();
611
- for (let w = 0; w < d.length; ) {
612
- const x = d[w];
613
- x.get("class") === "track-label-overlay" ? (x.setPosition(void 0), e.removeOverlay(x)) : w++;
611
+ for (let p = 0; p < d.length; ) {
612
+ const b = d[p];
613
+ b.get("class") === "track-label-overlay" ? (b.setPosition(void 0), e.removeOverlay(b)) : p++;
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
- }, x = (l[i] || []).map(
620
+ }, b = (l[i] || []).map(
621
621
  (_) => transform([_.lon, _.lat], projection.data, projection.mercator)
622
- ), b = new LineString(x);
623
- return d.length = formatLength(b, c) || "--", d;
622
+ ), k = new LineString(b);
623
+ return d.length = formatLength(k, 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((x) => [x.lon, x.lat]);
628
- w && ke(w, c);
627
+ const d = l[String(i)], p = d == null ? void 0 : d.map((b) => [b.lon, b.lat]);
628
+ p && ke(p, c);
629
629
  }, te = new Style({
630
630
  text: new Text({
631
631
  font: "700 20px map-iconfont",
@@ -635,120 +635,120 @@ const useTrackManager = (e) => {
635
635
  // 初始旋转角度
636
636
  })
637
637
  }), Me = (i, c) => {
638
- var k, G;
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) {
638
+ var C, Z;
639
+ const d = Number(50 * c), p = ((C = i.frameState) == null ? void 0 : C.time) ?? Date.now(), b = p - f;
640
+ if (F = (F + d * b / 1e6) % 2, f = p, F >= 1) {
641
641
  U();
642
642
  return;
643
643
  }
644
- const b = r.getCoordinateAt(
645
- P > 1 ? 2 - P : P
644
+ const k = r.getCoordinateAt(
645
+ F > 1 ? 2 - F : F
646
646
  ), _ = r.getCoordinateAt(
647
- P > 1 ? P - 0.01 : P
648
- ), V = r.getCoordinateAt(
649
- P > 1 ? 2 - P : P + 0.01
650
- ), B = le(
647
+ F > 1 ? F - 0.01 : F
648
+ ), N = r.getCoordinateAt(
649
+ F > 1 ? 2 - F : F + 0.01
650
+ ), H = le(
651
651
  mercatorToLonLat(_, "array"),
652
- mercatorToLonLat(V, "array")
652
+ mercatorToLonLat(N, "array")
653
653
  ) * Math.PI / 180;
654
- (G = te.getText()) == null || G.setRotation(B), m.setCoordinates(b);
655
- const W = getVectorContext(i);
656
- W.setStyle(te), W.drawGeometry(m), e == null || e.render();
654
+ (Z = te.getText()) == null || Z.setRotation(H), v.setCoordinates(k);
655
+ const Y = getVectorContext(i);
656
+ Y.setStyle(te), Y.drawGeometry(v), e == null || e.render();
657
657
  }, be = () => {
658
658
  var i;
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);
659
+ O = !0, f = Date.now(), F = 0, v = ((i = w.getGeometry()) == null ? void 0 : i.clone()) || new Point([0, 0]), o && (y == null || y.on("postrender", o)), P == null || P.setGeometry(void 0);
660
660
  }, U = () => {
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);
661
+ O && (O = !1, P == null || P.setGeometry(void 0), o && y && y.un("postrender", o), y && (e == null || e.removeLayer(y)), y = null, P = null);
662
662
  }, ke = (i, c) => {
663
- D && U(), t = new Polyline({
663
+ O && 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
- }), g = new Feature({
670
+ }), w = new Feature({
671
671
  type: "icon",
672
672
  geometry: new Point(r.getFirstCoordinate())
673
673
  });
674
- const d = g.getGeometry();
675
- m = d ? d.clone() : new Point([0, 0]), N = new Feature({
674
+ const d = w.getGeometry();
675
+ v = d ? d.clone() : new Point([0, 0]), P = new Feature({
676
676
  type: "geoMarker",
677
677
  style: te,
678
- geometry: m
679
- }), f = new VectorLayer({
678
+ geometry: v
679
+ }), y = new VectorLayer({
680
680
  source: new VectorSource({
681
- features: [N]
681
+ features: [P]
682
682
  })
683
- }), e == null || e.addLayer(f), o = (w) => Me(w, c), be();
683
+ }), e == null || e.addLayer(y), o = (p) => Me(p, c), be();
684
684
  }, le = (i, c, d) => {
685
- function w(k) {
686
- return 180 * (k % (2 * Math.PI)) / Math.PI;
685
+ function p(C) {
686
+ return 180 * (C % (2 * Math.PI)) / Math.PI;
687
687
  }
688
- function x(k) {
689
- return k % 360 * Math.PI / 180;
688
+ function b(C) {
689
+ return C % 360 * Math.PI / 180;
690
690
  }
691
- function b(k) {
692
- var G;
693
- if (!k) throw new Error("Coordinate is required");
694
- if (!Array.isArray(k)) {
695
- if ((k == null ? void 0 : k.type) === "Feature" && (k == null ? void 0 : k.geometry) !== null && ((G = k == null ? void 0 : k.geometry) == null ? void 0 : G.type) === "Point")
696
- return k == null ? void 0 : k.geometry.coordinates;
697
- if (k.type === "Point") return (k == null ? void 0 : k.coordinates) || [];
691
+ function k(C) {
692
+ var Z;
693
+ if (!C) throw new Error("Coordinate is required");
694
+ if (!Array.isArray(C)) {
695
+ if ((C == null ? void 0 : C.type) === "Feature" && (C == null ? void 0 : C.geometry) !== null && ((Z = C == null ? void 0 : C.geometry) == null ? void 0 : Z.type) === "Point")
696
+ return C == null ? void 0 : C.geometry.coordinates;
697
+ if (C.type === "Point") return (C == null ? void 0 : C.coordinates) || [];
698
698
  }
699
- if (Array.isArray(k) && k.length >= 2 && !Array.isArray(k[0]) && !Array.isArray(k[1]))
700
- return k;
699
+ if (Array.isArray(C) && C.length >= 2 && !Array.isArray(C[0]) && !Array.isArray(C[1]))
700
+ return C;
701
701
  throw new Error(
702
702
  "Coordinate must be GeoJSON Point or an Array of numbers"
703
703
  );
704
704
  }
705
- function _(k, G, q = {}) {
706
- if (q.final)
705
+ function _(C, Z, B = {}) {
706
+ if (B.final)
707
707
  return function(Te, Se) {
708
708
  return (_(Se, Te) + 180) % 360;
709
- }(k, G);
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
- return w(Math.atan2(Ce, Ee));
709
+ }(C, Z);
710
+ const j = k(C), J = k(Z), I = b(j[0]), ee = b(J[0]), se = b(j[1]), oe = b(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
+ return p(Math.atan2(Ce, Ee));
712
712
  }
713
- function V(k) {
714
- return !isNaN(k) && k !== null && !Array.isArray(k);
713
+ function N(C) {
714
+ return !isNaN(C) && C !== null && !Array.isArray(C);
715
715
  }
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);
716
+ function z(C, Z = {}, B = {}) {
717
+ return C || console.log("Coordinates are required"), Array.isArray(C) || console.log("Coordinates must be an Array"), C.length < 2 && console.log("Coordinates must be at least 2 numbers long"), (!N(C[0]) || !N(C[1])) && console.log("Coordinates must contain numbers"), H({ type: "Point", coordinates: C }, Z, B);
718
718
  }
719
- function B(k, G = {}, q = {}) {
720
- const X = {
719
+ function H(C, Z = {}, B = {}) {
720
+ const j = {
721
721
  type: "Feature",
722
722
  id: "",
723
723
  properties: {},
724
724
  bbox: {},
725
725
  geometry: {}
726
726
  };
727
- return q.id !== void 0 && (X.id = q.id), q.bbox && (X.bbox = q.bbox), X.properties = G, X.geometry = k, X;
727
+ return B.id !== void 0 && (j.id = B.id), B.bbox && (j.bbox = B.bbox), j.properties = Z, j.geometry = C, j;
728
728
  }
729
- const W = _(A(i), A(c), d);
730
- return W < 0 ? 360 + W : W;
729
+ const Y = _(z(i), z(c), d);
730
+ return Y < 0 ? 360 + Y : Y;
731
731
  };
732
732
  return {
733
- render: M,
734
- remove: ve,
733
+ render: V,
734
+ remove: me,
735
735
  play: Le,
736
736
  setCenter: ne,
737
737
  close: we,
738
738
  getLength: pe,
739
- handleTrackMapEvent: j,
740
- reRenderTrackLine: E
739
+ handleTrackMapEvent: X,
740
+ reRenderTrackLine: g
741
741
  };
742
742
  };
743
743
  function useShipOverlay(e) {
744
- const n = ref(null);
744
+ const s = ref(null);
745
745
  ref(null);
746
746
  const l = computed(() => ({
747
747
  "--overlay-color": e.color || "#FFF",
748
748
  "--bg-color": e.selected ? e.color : "#ffffff",
749
749
  position: "relative",
750
750
  "pointer-events": "none"
751
- })), s = computed(() => ({
751
+ })), n = computed(() => ({
752
752
  position: "relative",
753
753
  "border-radius": "1px",
754
754
  "background-color": "var(--bg-color)",
@@ -784,7 +784,7 @@ function useShipOverlay(e) {
784
784
  left: "-20px"
785
785
  }));
786
786
  return () => h("div", {
787
- ref: n,
787
+ ref: s,
788
788
  class: "ship-overlay-container",
789
789
  style: l.value
790
790
  }, [
@@ -792,7 +792,7 @@ function useShipOverlay(e) {
792
792
  "div",
793
793
  {
794
794
  class: "ship-overlay-content",
795
- style: s.value
795
+ style: n.value
796
796
  },
797
797
  [
798
798
  h("div", {
@@ -849,43 +849,43 @@ function useShipOverlay(e) {
849
849
  ]);
850
850
  }
851
851
  ref([]);
852
- function addOverlay(e, n, l, s) {
853
- if (n) {
852
+ function addOverlay(e, s, l, n) {
853
+ if (s) {
854
854
  const a = new Overlay({
855
855
  element: l,
856
856
  positioning: "top-left",
857
- id: "label-" + (s == null ? void 0 : s.id),
857
+ id: "label-" + (n == null ? void 0 : n.id),
858
858
  offset: [20, -20],
859
859
  autoPan: !1,
860
- position: n,
861
- className: s.blinking ? "ship-label-overlay-blinking" : "ship-label-overlay"
860
+ position: s,
861
+ className: n.blinking ? "ship-label-overlay-blinking" : "ship-label-overlay"
862
862
  });
863
863
  a.set("class", "zh-map-ship-overlay"), e.addOverlay(a);
864
864
  }
865
865
  }
866
866
  const getShipDirectPath = (e) => {
867
- const { spd: n, hdg: l, cog: s } = e;
868
- return n ? l !== null && +l != 511 && s !== null ? s - +l >= 3 ? SHIP_DIRECT.right : s - +l <= -3 ? SHIP_DIRECT.left : SHIP_DIRECT.front : SHIP_DIRECT.front : "";
869
- }, createShipStyle = (e, n) => {
870
- const { shipData: l } = n.getProperties(), s = getShipType(e), a = getShipScale(e, l, s);
871
- return initShipStyle(n, a, s);
867
+ const { spd: s, hdg: l, cog: n } = e;
868
+ return s ? l !== null && +l != 511 && n !== null ? n - +l >= 3 ? SHIP_DIRECT.right : n - +l <= -3 ? SHIP_DIRECT.left : SHIP_DIRECT.front : SHIP_DIRECT.front : "";
869
+ }, createShipStyle = (e, s) => {
870
+ const { shipData: l } = s.getProperties(), n = getShipType(e), a = getShipScale(e, l, n);
871
+ return initShipStyle(s, a, n);
872
872
  }, getShipType = (e) => {
873
- const n = e == null ? void 0 : e.getView().getZoom();
874
- return n <= MAP_ZOOM.shipModelMax && n >= MAP_ZOOM.shipTriggleMin ? "ship" : "triangle";
875
- }, getShipScale = (e, n, l) => {
873
+ const s = e == null ? void 0 : e.getView().getZoom();
874
+ return s <= MAP_ZOOM.shipModelMax && s >= MAP_ZOOM.shipTriggleMin ? "ship" : "triangle";
875
+ }, getShipScale = (e, s, 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, g = a * t / y;
878
- return Math.max(r, g);
877
+ const { len: n, wid: a } = s, o = 97, m = 20, t = 1 / (e == null ? void 0 : e.getView().getResolution()), r = n * t / o, w = a * t / m;
878
+ return Math.max(r, w);
879
879
  }
880
880
  return MAP_ZOOM.scaleNum;
881
- }, initShipStyle = (e, n, l) => {
882
- const { color: s, direct: a, isHighlight: o, shipData: y } = e.getProperties(), T = ((y == null ? void 0 : y.cog) - 90 + 360) % 360;
881
+ }, initShipStyle = (e, s, l) => {
882
+ const { color: n, direct: a, isHighlight: o, shipData: m } = e.getProperties(), L = ((m == null ? void 0 : m.cog) - 90 + 360) % 360;
883
883
  return new Style({
884
884
  image: new Icon({
885
885
  src: t(),
886
- scale: n || MAP_ZOOM.scaleNum,
886
+ scale: s || MAP_ZOOM.scaleNum,
887
887
  anchor: [0.5, 0.5],
888
- rotation: T * Math.PI / 180,
888
+ rotation: L * Math.PI / 180,
889
889
  rotateWithView: !1
890
890
  })
891
891
  });
@@ -897,7 +897,7 @@ const getShipDirectPath = (e) => {
897
897
  case "triangle":
898
898
  return `<svg width="41" height="24" viewBox="0 0 41 24" fill="none" xmlns="http://www.w3.org/2000/svg">
899
899
  <path d="M30.8843 12.6777L2.21343 21.7067C1.75559 21.8509 1.28947 21.509 1.28947 21.029L1.28947 2.97103C1.28947 2.49102 1.75558 2.14913 2.21342 2.29331L30.8843 11.3223C31.5471 11.531 31.5471 12.469 30.8843 12.6777Z"
900
- fill="${s}" stroke="${o ? "#FF2424" : "black"}" stroke-width="${o ? "2" : "0.578947"}" />
900
+ fill="${n}" stroke="${o ? "#FF2424" : "black"}" stroke-width="${o ? "2" : "0.578947"}" />
901
901
  <!--path船航向左边或者向前-->
902
902
  ${a === SHIP_DIRECT.left && `<path d="M30 12L40 12L40 8" stroke="${o ? "#FF2424" : "black"}" stroke-width="2"/>`}
903
903
  <!--path船航向右边-->
@@ -909,7 +909,7 @@ const getShipDirectPath = (e) => {
909
909
  case "ship":
910
910
  return `<svg width="97" height="20" viewBox="0 0 97 20" fill="none" xmlns="http://www.w3.org/2000/svg">
911
911
  <path d="M0.289474 17.3433L0.289474 2.65655C0.289474 2.28572 0.574654 1.97725 0.944343 1.9482L22.0544 0.289473L67.5204 0.289473C67.6295 0.289473 67.7372 0.314613 67.835 0.362943L86.0565 9.3629C86.5844 9.6236 86.5844 10.3763 86.0565 10.637L67.835 19.6371C67.7372 19.6854 67.6295 19.7105 67.5203 19.7105L22.0544 19.7105L0.944343 18.0517C0.574653 18.0226 0.289474 17.7142 0.289474 17.3433Z"
912
- fill="${s}" stroke="${o ? "#FF2424" : "black"}" stroke-width="${o ? "4" : "0.578947"}"/>
912
+ fill="${n}" stroke="${o ? "#FF2424" : "black"}" stroke-width="${o ? "4" : "0.578947"}"/>
913
913
  ${a === SHIP_DIRECT.left && `<path d="M86 10L96 10L96 6" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
914
914
  ${a === SHIP_DIRECT.right && `<path d="M86 10L96 10L96 14" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
915
915
  ${a === SHIP_DIRECT.front && `<path d="M86 10L96 10" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
@@ -919,53 +919,53 @@ const getShipDirectPath = (e) => {
919
919
  return "";
920
920
  }
921
921
  }
922
- }, selectedShipStyle = (e, n) => {
923
- const l = selectedShipElement(e, n), s = n.id, { lon: a, lat: o } = n, y = new Overlay({
922
+ }, selectedShipStyle = (e, s) => {
923
+ const l = selectedShipElement(e, s), n = s.id, { lon: a, lat: o } = s, m = new Overlay({
924
924
  element: l,
925
925
  position: fromLonLat([a, o]),
926
- id: "selected-" + s,
926
+ id: "selected-" + n,
927
927
  positioning: "center-center",
928
928
  offset: [0, 5],
929
929
  className: "ship-selected-overlay"
930
930
  });
931
- return y.set("class", "ship-overlay-selected"), y;
932
- }, selectedShipElement = (e, n) => {
933
- const l = getShipType(e), s = getShipScale(e, n, l), a = l === "ship" ? 109 : 49, o = `
934
- <svg style="transform:scale(${s});" xmlns="http://www.w3.org/2000/svg" width="${a}" height="${a}" viewBox="0 0 49 49" fill="none">
931
+ return m.set("class", "ship-overlay-selected"), m;
932
+ }, selectedShipElement = (e, s) => {
933
+ const l = getShipType(e), n = getShipScale(e, s, l), a = l === "ship" ? 109 : 49, o = `
934
+ <svg style="transform:scale(${n});" xmlns="http://www.w3.org/2000/svg" width="${a}" height="${a}" viewBox="0 0 49 49" fill="none">
935
935
  <path d="M1.99982 46.9998L1.99982 1.99982L46.9998 1.99982L46.9998 46.9998L1.99982 46.9998Z" fill="#FF2424" fill-opacity="0.2"/>
936
936
  <path fill-rule="evenodd" clip-rule="evenodd" d="M19.9998 0.5V3.5L3.49976 3.5V20H0.499756V0.500002L19.9998 0.5ZM45.4998 3.5H28.9998V0.5H48.4998V20H45.4998V3.5ZM48.4998 29L48.4998 48.5H28.9998V45.5H45.4998L45.4998 29H48.4998ZM3.49976 45.5L3.49976 29H0.499756L0.499758 48.5L19.9998 48.5V45.5L3.49976 45.5Z" fill="#FF2424"/>
937
937
  </svg>
938
- `, y = document.createElement("div");
939
- return y.className = "ship-overlay-selected", y.innerHTML = o, y;
940
- }, createLabelStyle = (e, n) => {
941
- const { shipData: l, blinking: s } = n.getProperties(), { lon: a, lat: o } = l, y = createLabelElement(n);
942
- a && o && addOverlay(e, fromLonLat([a, o]), y, { ...l, blinking: s });
938
+ `, m = document.createElement("div");
939
+ return m.className = "ship-overlay-selected", m.innerHTML = o, m;
940
+ }, createLabelStyle = (e, s) => {
941
+ const { shipData: l, blinking: n } = s.getProperties(), { lon: a, lat: o } = l, m = createLabelElement(s);
942
+ a && o && addOverlay(e, fromLonLat([a, o]), m, { ...l, blinking: n });
943
943
  }, createLabelElement = (e) => {
944
- const n = document.createElement("div");
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: T, lat: t } = s, r = createVNode({
944
+ const s = document.createElement("div");
945
+ s.className = "ship-overlay-box", s.style.position = "relative";
946
+ const l = e.getProperties(), { shipData: n, blinking: a, blinkingColor: o, name: m } = l, { lon: L, lat: t } = n, r = createVNode({
947
947
  setup() {
948
948
  return useShipOverlay({
949
949
  selected: a,
950
- name: y,
950
+ name: m,
951
951
  color: o,
952
- existDevice: s == null ? void 0 : s.existDevice,
953
- existMobile: s == null ? void 0 : s.existMobile,
954
- existWaterGauge: s == null ? void 0 : s.existWaterGauge
952
+ existDevice: n == null ? void 0 : n.existDevice,
953
+ existMobile: n == null ? void 0 : n.existMobile,
954
+ existWaterGauge: n == null ? void 0 : n.existWaterGauge
955
955
  });
956
956
  }
957
957
  });
958
- return render(r, n), n;
958
+ return render(r, s), s;
959
959
  }, getRightIcons = (e) => {
960
- const n = [];
961
- return e.existDevice && n.push("&#xe687;"), e.existMobile && n.push("&#xe688;"), e.existWaterGauge && n.push("&#xe686;"), n;
960
+ const s = [];
961
+ return e.existDevice && s.push("&#xe687;"), e.existMobile && s.push("&#xe688;"), e.existWaterGauge && s.push("&#xe686;"), s;
962
962
  }, createLabelFeatureStyle = (e) => {
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>
963
+ const { name: s, rightIcons: l } = e.getProperties(), n = `${s} ${l.map((w) => getIconFont(w)).join(" ")} `, a = [20, -20], m = -Math.atan2(-a[1], a[0]), L = Math.sqrt(a[0] ** 2 + a[1] ** 2), t = `<svg viewBox="0 0 ${L + 10} 20" width="${L + 10}" height="20" xmlns="http://www.w3.org/2000/svg" >
964
+ <line x1="0" y1="0" x2="${10 + L}" y2="10" stroke="white" stroke-width="1"></line>
965
965
  </svg>`;
966
966
  return [new Style({
967
967
  text: new Text({
968
- text: s,
968
+ text: n,
969
969
  fill: new Fill({ color: "#000000" }),
970
970
  stroke: new Stroke({ color: "#ffffff", width: 1 }),
971
971
  font: "Normal 12px map-iconfont",
@@ -978,18 +978,18 @@ const getShipDirectPath = (e) => {
978
978
  src: `data:image/svg+xml;utf8,${encodeURIComponent(t)}`,
979
979
  displacement: [16, -10],
980
980
  anchor: [0.5, 0.5],
981
- rotation: y,
981
+ rotation: m,
982
982
  rotateWithView: !1
983
983
  })
984
984
  })];
985
985
  }, useShipManager = (e) => {
986
- let n = null, l = null;
987
- const s = new VectorSource(), a = new VectorImageLayer({
988
- source: s,
986
+ let s = null, l = null;
987
+ const n = new VectorSource(), a = new VectorImageLayer({
988
+ source: n,
989
989
  className: "zh-map--ship-layer",
990
990
  renderBuffer: 300,
991
991
  zIndex: 101
992
- }), o = new VectorSource(), y = new VectorLayer({
992
+ }), o = new VectorSource(), m = new VectorLayer({
993
993
  source: o,
994
994
  className: "zh-map--ship-label-layer",
995
995
  zIndex: 102,
@@ -997,24 +997,24 @@ const getShipDirectPath = (e) => {
997
997
  updateWhileAnimating: !1,
998
998
  declutter: !0
999
999
  });
1000
- e == null || e.addLayer(a), e == null || e.addLayer(y);
1001
- let T = "", t = {}, r = {};
1002
- const g = (u) => {
1000
+ e == null || e.addLayer(a), e == null || e.addLayer(m);
1001
+ let L = "", t = {}, r = {};
1002
+ const w = (u) => {
1003
1003
  if (!u || !e) return;
1004
- const L = (l == null ? void 0 : l.id) || (n == null ? void 0 : n.get("id"));
1004
+ const x = (l == null ? void 0 : l.id) || (s == null ? void 0 : s.get("id"));
1005
1005
  if (l) {
1006
- const E = u.filter((S) => S.id === L);
1007
- E.length === 0 ? u.push(l) : l = E[0];
1006
+ const g = u.filter((M) => M.id === x);
1007
+ g.length === 0 ? u.push(l) : l = g[0];
1008
1008
  }
1009
- D(), v(!0), H(u), N();
1010
- }, m = (u) => {
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),
1009
+ O(), f(!0), Q(u), P();
1010
+ }, v = (u) => {
1011
+ const x = (l == null ? void 0 : l.id) || (s == null ? void 0 : s.get("id")), g = fromLonLat([u == null ? void 0 : u.lon, u == null ? void 0 : u.lat]), M = u.fill || "#04C900", V = getShipDirectPath(u), D = new Feature({
1012
+ geometry: new Point(g),
1013
1013
  // 船舶数据
1014
1014
  shipData: u,
1015
1015
  id: u.id,
1016
1016
  name: u.cnname || "未命名船舶",
1017
- selected: u.id === L,
1017
+ selected: u.id === x,
1018
1018
  // 图标
1019
1019
  rightIcons: getRightIcons(u),
1020
1020
  // 是否闪烁
@@ -1022,207 +1022,207 @@ const getShipDirectPath = (e) => {
1022
1022
  // 闪烁颜色
1023
1023
  blinkingColor: r[u.id] || "",
1024
1024
  // 船舶颜色
1025
- color: S,
1025
+ color: M,
1026
1026
  // 船艏向的方向
1027
- direct: M,
1027
+ direct: V,
1028
1028
  // shipType,
1029
1029
  // scale:scaleNum,
1030
1030
  // rotation,
1031
1031
  // 高亮
1032
1032
  isHighlight: !1
1033
1033
  });
1034
- return O.set("clickGeometry", new Circle(E)), O;
1035
- }, N = async () => {
1034
+ return D.set("clickGeometry", new Circle(g)), D;
1035
+ }, P = async () => {
1036
1036
  if (!l || !e) return;
1037
- let L = e.getOverlays().getArray().find((E) => E.get("class") == "ship-overlay-selected");
1038
- if (console.log("selectedOverlay----------", L), L) {
1039
- const E = selectedShipElement(e, l);
1040
- await L.setElement(E), await L.setPosition(fromLonLat([l.lon, l.lat]));
1037
+ let x = e.getOverlays().getArray().find((g) => g.get("class") == "ship-overlay-selected");
1038
+ if (console.log("selectedOverlay----------", x), x) {
1039
+ const g = selectedShipElement(e, l);
1040
+ await x.setElement(g), await x.setPosition(fromLonLat([l.lon, l.lat]));
1041
1041
  } else
1042
- L = selectedShipStyle(e, l), L && e.addOverlay(L);
1042
+ x = selectedShipStyle(e, l), x && e.addOverlay(x);
1043
1043
  setTimeout(() => {
1044
- var E;
1045
- L && ((E = L.get("element")) != null && E.parentElement) && (L.get("element").parentElement.style.display = "block");
1044
+ var g;
1045
+ x && ((g = x.get("element")) != null && g.parentElement) && (x.get("element").parentElement.style.display = "block");
1046
1046
  }, 20);
1047
- }, D = () => {
1048
- e && s && (s.clear(), o.clear(), v());
1049
- }, v = (u) => {
1050
- const L = e.getOverlays().getArray().filter((E) => E.get("class") == "zh-map-ship-overlay");
1051
- if (L && L.length > 0) {
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();
1047
+ }, O = () => {
1048
+ e && n && (n.clear(), o.clear(), f());
1049
+ }, f = (u) => {
1050
+ const x = e.getOverlays().getArray().filter((g) => g.get("class") == "zh-map-ship-overlay");
1051
+ if (x && x.length > 0) {
1052
+ for (let g = 0; g < x.length; g++)
1053
+ if (!u && x[g].get("class") !== "ship-overlay-selected") {
1054
+ const M = x[g];
1055
+ M.setPosition(void 0), e.removeOverlay(M), M.dispose();
1056
1056
  }
1057
1057
  }
1058
- }, f = (u, L) => {
1059
- t = u, r = L;
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));
1058
+ }, y = (u, x) => {
1059
+ t = u, r = x;
1060
+ const g = e.getOverlays().getArray(), M = n.getFeatures();
1061
+ for (const V in t) {
1062
+ const D = t[V], $ = g.find((S) => S.getId() === "label-" + V), R = M.find((S) => V === S.get("id"));
1063
+ if ($ && R) {
1064
+ R.set("blinking", D), R.set("blinkingColor", r[V] || "");
1065
+ const S = $.getElement(), A = createLabelElement(R), X = A.querySelector(".ship-overlay-line"), K = S == null ? void 0 : S.querySelector(".ship-overlay-line");
1066
+ S && S !== A && (K && X && X.replaceWith(K), $.setElement(A));
1067
1067
  }
1068
1068
  }
1069
- }, P = (u) => {
1069
+ }, F = (u) => {
1070
1070
  if (!e) return;
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);
1071
+ const x = n.getFeatures(), g = o.getFeatures(), M = s ? s.get("id") : "", V = x.filter((S) => S.get("id") !== M), D = g == null ? void 0 : g.filter((S) => S.get("id") !== M), $ = /* @__PURE__ */ new Map();
1072
+ u.forEach((S) => {
1073
+ $.set(S.id, !0);
1074
1074
  });
1075
- const z = e.getOverlays().getArray();
1076
- M.forEach((F) => {
1077
- const R = F.get("id");
1078
- if (!$.has(R))
1079
- F.setStyle([]);
1075
+ const R = e.getOverlays().getArray();
1076
+ V.forEach((S) => {
1077
+ const A = S.get("id");
1078
+ if (!$.has(A))
1079
+ S.setStyle([]);
1080
1080
  else {
1081
- const K = F.getStyle();
1082
- (K == null ? void 0 : K.length) == 0 && F.setStyle(createShipStyle(e, F));
1081
+ const K = S.getStyle();
1082
+ (K == null ? void 0 : K.length) == 0 && S.setStyle(createShipStyle(e, S));
1083
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([]);
1084
+ const X = R.find((K) => K.getId() === "label-" + A);
1085
+ X && X.setPosition(void 0);
1086
+ }), D.forEach((S) => {
1087
+ const A = S.get("id");
1088
+ if (!$.has(A))
1089
+ S.setStyle([]);
1090
1090
  else {
1091
- const j = F.getStyle();
1092
- (j == null ? void 0 : j.length) == 0 && F.setStyle(createLabelFeatureStyle(F));
1091
+ const X = S.getStyle();
1092
+ (X == null ? void 0 : X.length) == 0 && S.setStyle(createLabelFeatureStyle(S));
1093
1093
  }
1094
1094
  });
1095
- }, p = (u) => {
1095
+ }, E = (u) => {
1096
1096
  if (u) {
1097
1097
  console.log("选中", u);
1098
- const L = s.getFeatures().find((E) => E.get("id") === u.id);
1099
- L && (n = L), l = u, N();
1098
+ const x = n.getFeatures().find((g) => g.get("id") === u.id);
1099
+ x && (s = x), l = u, P();
1100
1100
  } else
1101
- console.log("取消选中"), l = null, n = null, Y();
1102
- }, C = debounce((u, L, E) => {
1101
+ console.log("取消选中"), l = null, s = null, q();
1102
+ }, T = debounce((u, x, g) => {
1103
1103
  if (u) {
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));
1104
+ const M = u.get("shipData"), V = u.get("id");
1105
+ if (e.getTargetElement().style.cursor = V ? "pointer" : "", x === "click" && (E(M), g && g(V)), x === "hover") {
1106
+ L && L !== V && G(), L = V;
1107
+ const D = n.getFeatures().find(($) => $.get("id") === L);
1108
+ D == null || D.set("isHighlight", !0), D == null || D.setStyle(createShipStyle(e, D));
1109
1109
  }
1110
1110
  } else
1111
- e.getTargetElement().style.cursor = "", Z();
1112
- }, 10), Z = () => {
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));
1115
- }, Y = () => {
1111
+ e.getTargetElement().style.cursor = "", G();
1112
+ }, 10), G = () => {
1113
+ const u = L ? n.getFeatures().find((x) => x.get("id") === L) : null;
1114
+ L = null, u == null || u.set("isHighlight", !1), u == null || u.setStyle(createShipStyle(e, u));
1115
+ }, q = () => {
1116
1116
  try {
1117
- const L = e.getOverlays().getArray().find((E) => E.get("class") == "ship-overlay-selected");
1118
- L && L.setPosition(void 0);
1117
+ const x = e.getOverlays().getArray().find((g) => g.get("class") == "ship-overlay-selected");
1118
+ x && x.setPosition(void 0);
1119
1119
  } catch (u) {
1120
1120
  console.log(u);
1121
1121
  }
1122
- }, Q = (u) => {
1123
- const L = fromLonLat([u == null ? void 0 : u.lon, u == null ? void 0 : u.lat]), E = new Feature({
1124
- geometry: new Point(L),
1122
+ }, W = (u) => {
1123
+ const x = fromLonLat([u == null ? void 0 : u.lon, u == null ? void 0 : u.lat]), g = new Feature({
1124
+ geometry: new Point(x),
1125
1125
  name: u.cnname || "未命名船舶",
1126
1126
  // 图标
1127
1127
  rightIcons: getRightIcons(u)
1128
1128
  });
1129
- E.set("id", u.id);
1130
- const S = createLabelFeatureStyle(E);
1131
- return E.setStyle(S), E;
1132
- }, H = (u) => {
1133
- const L = e.getView().getZoom();
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);
1129
+ g.set("id", u.id);
1130
+ const M = createLabelFeatureStyle(g);
1131
+ return g.setStyle(M), g;
1132
+ }, Q = (u) => {
1133
+ const x = e.getView().getZoom();
1134
+ u.forEach((g) => {
1135
+ const M = v(g);
1136
+ if (M.setStyle(createShipStyle(e, M)), n.addFeature(M), (l == null ? void 0 : l.id) == g.id || x >= MAP_ZOOM.shipModelMin)
1137
+ if (t[g.id])
1138
+ createLabelStyle(e, M);
1139
1139
  else {
1140
- const M = Q(E);
1141
- o.addFeature(M);
1140
+ const V = W(g);
1141
+ o.addFeature(V);
1142
1142
  }
1143
1143
  });
1144
1144
  };
1145
1145
  return {
1146
- render: g,
1147
- selected: p,
1148
- filter: P,
1149
- blinking: f,
1150
- clear: D,
1151
- handleShipMapEvent: C
1146
+ render: w,
1147
+ selected: E,
1148
+ filter: F,
1149
+ blinking: y,
1150
+ clear: O,
1151
+ handleShipMapEvent: T
1152
1152
  };
1153
1153
  }, useLayerManager = (e) => {
1154
- const n = () => e == null ? void 0 : e.getLayers(), l = ref("vector"), s = () => l.value, a = (t) => {
1154
+ const s = () => e == null ? void 0 : e.getLayers(), l = ref("vector"), n = () => l.value, a = (t) => {
1155
1155
  l.value = t;
1156
- const r = n();
1157
- r && (r == null || r.getArray().forEach((g) => {
1158
- (g.className_ === "vector" || g.className_ === "satellite") && g.setVisible(g.className_ === t);
1156
+ const r = s();
1157
+ r && (r == null || r.getArray().forEach((w) => {
1158
+ (w.className_ === "vector" || w.className_ === "satellite") && w.setVisible(w.className_ === t);
1159
1159
  }));
1160
1160
  }, o = ref(!1);
1161
1161
  return {
1162
- getLayers: n,
1162
+ getLayers: s,
1163
1163
  getGreenTileVisible: () => o.value,
1164
1164
  setGreenTileVisible: (t) => {
1165
1165
  if (t !== o.value) {
1166
1166
  if (t) {
1167
- const r = n();
1168
- if (!r.getArray().find((m) => m.className_ === "greenTile")) {
1169
- const m = new TileLayer({
1167
+ const r = s();
1168
+ if (!r.getArray().find((v) => v.className_ === "greenTile")) {
1169
+ const v = new TileLayer({
1170
1170
  source: new XYZ({ url: BASE_MAP_LINK.greenTile }),
1171
1171
  visible: t,
1172
1172
  zIndex: 2,
1173
1173
  className: "greenTile"
1174
1174
  });
1175
- r.push(m);
1175
+ r.push(v);
1176
1176
  }
1177
1177
  } else {
1178
- const r = n(), g = r.getArray().find((m) => m.className_ === "greenTile");
1179
- g && r.remove(g);
1178
+ const r = s(), w = r.getArray().find((v) => v.className_ === "greenTile");
1179
+ w && r.remove(w);
1180
1180
  }
1181
1181
  o.value = t;
1182
1182
  }
1183
1183
  },
1184
- getShowLayerType: s,
1184
+ getShowLayerType: n,
1185
1185
  setShowLayerType: a
1186
1186
  };
1187
1187
  }, usePropsManager = () => {
1188
1188
  const e = ref();
1189
1189
  return {
1190
- setProps: (s) => {
1191
- e.value = s;
1190
+ setProps: (n) => {
1191
+ e.value = n;
1192
1192
  },
1193
1193
  getProps: () => e.value
1194
1194
  };
1195
1195
  }, usePositionManager = (e) => {
1196
- const n = "zh-map-location-layer";
1197
- let l, s, a = null, o = null;
1198
- const y = (v) => {
1199
- if (!(!v || v.length === 0)) {
1200
- if (s || (s = new VectorSource()), s.clear(), o) {
1201
- const f = v.find((P) => P.id === o.id);
1202
- f ? o = f : v.push(o);
1196
+ const s = "zh-map-location-layer";
1197
+ let l, n, a = null, o = null;
1198
+ const m = (f) => {
1199
+ if (!(!f || f.length === 0)) {
1200
+ if (n || (n = new VectorSource()), n.clear(), o) {
1201
+ const y = f.find((F) => F.id === o.id);
1202
+ y ? o = y : f.push(o);
1203
1203
  }
1204
- v.forEach((f) => {
1205
- T(f);
1204
+ f.forEach((y) => {
1205
+ L(y);
1206
1206
  }), l || (l = new VectorLayer({
1207
- className: n,
1208
- source: s,
1207
+ className: s,
1208
+ source: n,
1209
1209
  zIndex: 100
1210
1210
  }), e == null || e.addLayer(l));
1211
1211
  }
1212
- }, T = (v) => {
1213
- const f = getZoom(), [P, p] = v.latLon.split(","), C = new Feature({
1214
- geometry: new Point(fromLonLat([Number(P), Number(p)]))
1212
+ }, L = (f) => {
1213
+ const y = getZoom(), [F, E] = f.latLon.split(","), T = new Feature({
1214
+ geometry: new Point(fromLonLat([Number(F), Number(E)]))
1215
1215
  });
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) => {
1218
- const p = {
1216
+ T.setStyle(t(f, y, f.id === (o == null ? void 0 : o.id))), T.set("loactionData", f), n.addFeature(T);
1217
+ }, t = (f, y, F) => {
1218
+ const E = {
1219
1219
  image: new Icon({
1220
- src: P && v.selectedPath || v.defaultPath,
1221
- scale: 0.5 * f / 10
1220
+ src: F && f.selectedPath || f.defaultPath,
1221
+ scale: 0.5 * y / 10
1222
1222
  })
1223
1223
  };
1224
- return v.name && (p.text = new Text({
1225
- text: v.name,
1224
+ return f.name && (E.text = new Text({
1225
+ text: f.name,
1226
1226
  font: "12px sans-serif",
1227
1227
  fill: new Fill({
1228
1228
  color: "#000000"
@@ -1231,57 +1231,60 @@ const getShipDirectPath = (e) => {
1231
1231
  color: "#FFFFFF"
1232
1232
  }),
1233
1233
  offsetY: 30
1234
- })), new Style(p);
1234
+ })), new Style(E);
1235
1235
  }, r = () => {
1236
1236
  if (a) {
1237
- const v = a.get("loactionData").id;
1238
- s.getFeatures().forEach((f) => {
1239
- f.get("loactionData").id !== v && s.removeFeature(f);
1237
+ const f = a.get("loactionData").id;
1238
+ n.getFeatures().forEach((y) => {
1239
+ y.get("loactionData").id !== f && n.removeFeature(y);
1240
1240
  });
1241
1241
  } else
1242
- s.clear();
1243
- }, g = () => {
1244
- const v = a.get("loactionData"), f = getZoom();
1245
- s.getFeatures().forEach((p) => {
1246
- p.get("loactionData").id === v.id && (p == null || p.setStyle(t(v, f, !1)));
1242
+ n.clear();
1243
+ }, w = () => {
1244
+ const f = a.get("loactionData"), y = getZoom();
1245
+ n.getFeatures().forEach((E) => {
1246
+ E.get("loactionData").id === f.id && (E == null || E.setStyle(t(f, y, !1)));
1247
1247
  }), o = null, a = null;
1248
- }, m = (v) => {
1249
- v ? (N(), D(v)) : clearSelectedPort();
1250
- }, N = () => {
1248
+ }, v = (f) => {
1249
+ f ? (P(), O(f)) : clearSelectedPort();
1250
+ }, P = () => {
1251
1251
  if (a) {
1252
- const v = a.get("loactionData"), f = getZoom();
1253
- a.setStyle(t(v, f, !1));
1252
+ const f = a.get("loactionData"), y = getZoom();
1253
+ a.setStyle(t(f, y, !1));
1254
1254
  }
1255
- }, D = (v) => {
1256
- const f = s.getFeatures();
1257
- o = v, a = f.find((P) => P.get("loactionData").id === v.id);
1255
+ }, O = (f) => {
1256
+ const y = n.getFeatures();
1257
+ o = f, a = y.find((F) => F.get("loactionData").id === f.id);
1258
1258
  };
1259
1259
  return {
1260
- render: y,
1261
- selected: m,
1262
- clearSelected: g,
1260
+ render: m,
1261
+ selected: v,
1262
+ clearSelected: w,
1263
1263
  clear: r
1264
1264
  };
1265
1265
  }, disableDoubleClickZoom = (e) => {
1266
- e.getInteractions().forEach((n) => {
1267
- n instanceof DoubleClickZoom && n.setActive(!1);
1266
+ e.getInteractions().forEach((s) => {
1267
+ s instanceof DoubleClickZoom && s.setActive(!1);
1268
1268
  });
1269
1269
  }, enableDoubleClickZoom = (e) => {
1270
- e.getInteractions().forEach((n) => {
1271
- n instanceof DoubleClickZoom && n.setActive(!0);
1270
+ e.getInteractions().forEach((s) => {
1271
+ s instanceof DoubleClickZoom && s.setActive(!0);
1272
1272
  });
1273
- }, useDrawLineManager = (e, n) => {
1274
- const l = ref([]), s = ref("km"), a = (S) => {
1275
- s.value = S;
1273
+ }, changeCursor = (e, s) => {
1274
+ const l = e.getViewport();
1275
+ l && (l.style.cursor = s);
1276
+ }, useDrawLineManager = (e, s) => {
1277
+ const l = ref([]), n = ref("km"), a = (g) => {
1278
+ n.value = g;
1276
1279
  };
1277
1280
  let o;
1278
- const y = ref(!1), T = () => {
1279
- g(), disableDoubleClickZoom(e), v("pointer"), e.on("pointermove", D), e.getViewport().addEventListener("mouseout", () => {
1281
+ const m = ref(!1), L = () => {
1282
+ w(), disableDoubleClickZoom(e), changeCursor(e, "crosshair"), e.on("pointermove", O), e.getViewport().addEventListener("mouseout", () => {
1280
1283
  o && o.classList.add("hidden");
1281
- }), P(), y.value = !0;
1284
+ }), y(), m.value = !0;
1282
1285
  };
1283
1286
  let t, r;
1284
- const g = () => {
1287
+ const w = () => {
1285
1288
  t = new VectorSource(), r = new VectorLayer({
1286
1289
  source: t,
1287
1290
  zIndex: 1e3,
@@ -1294,18 +1297,15 @@ const getShipDirectPath = (e) => {
1294
1297
  }
1295
1298
  }), e == null || e.addLayer(r);
1296
1299
  };
1297
- let m, N;
1298
- const D = (S) => {
1299
- if (S.dragging)
1300
+ let v, P;
1301
+ const O = (g) => {
1302
+ if (g.dragging)
1300
1303
  return;
1301
1304
  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);
1305
+ v && (M = "单击继续,双击结束"), o && (o.innerHTML = M, P.setPosition(g.coordinate), o.classList.remove("hidden"));
1306
1306
  };
1307
1307
  let f;
1308
- const P = () => {
1308
+ const y = () => {
1309
1309
  f = new Draw({
1310
1310
  source: t,
1311
1311
  type: "LineString",
@@ -1330,108 +1330,108 @@ const getShipDirectPath = (e) => {
1330
1330
  }),
1331
1331
  // 添加条件函数,判断是否应该出发点绘制
1332
1332
  condition: (M) => M.originalEvent.target.tagName !== "DIV"
1333
- }), e == null || e.addInteraction(f), Y(), Q();
1334
- let S;
1333
+ }), e == null || e.addInteraction(f), G(), q();
1334
+ let g;
1335
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);
1336
+ var D;
1337
+ v = M.feature, v.set("randomId", F());
1338
+ let V;
1339
+ g = (D = v.getGeometry()) == null ? void 0 : D.on("change", function($) {
1340
+ const R = $.target, S = computedDistance(R, n.value);
1341
+ V = R.getLastCoordinate(), E && S && (E.innerHTML = S), T.setPosition(V);
1342
1342
  });
1343
1343
  }), f.on("drawend", function() {
1344
- var M, O, $;
1345
- if (C && (C.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), C != null && C.innerHTML) {
1346
- const z = (m == null ? void 0 : m.get("randomId")) || p();
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>`;
1344
+ var M, V, D;
1345
+ if (E && (E.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), E != null && E.innerHTML) {
1346
+ const $ = (v == null ? void 0 : v.get("randomId")) || F();
1347
+ l.value.push({ id: $, value: E == null ? void 0 : E.innerHTML }), E.innerHTML = `${E.innerHTML}<div class="ol-tooltip-delete-button" data-id="${$}"><i class="map-iconfont icon-delete"></i></div>`;
1348
1348
  }
1349
- (M = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || M.addEventListener("click", (z) => {
1350
- var R;
1351
- z.preventDefault(), z.stopPropagation();
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);
1349
+ (M = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || M.addEventListener("click", ($) => {
1350
+ var S;
1351
+ $.preventDefault(), $.stopPropagation();
1352
+ const R = (S = $.target) == null ? void 0 : S.getAttribute("data-id");
1353
+ R && Q(R);
1354
+ }), T.setOffset([0, -7]), v = null, E = null, G(), g && unByKey(g), (D = (V = s.getProps()) == null ? void 0 : V.lineDrawEnd) == null || D.call(V, l.value);
1355
1355
  });
1356
- }, p = () => Math.random().toString(36).substring(2, 9);
1357
- let C, Z;
1358
- const Y = () => {
1359
- C != null && C.parentNode && C.parentNode.removeChild(C), C = document.createElement("div"), C.className = "ol-tooltip ol-tooltip-measure", Z = new Overlay({
1360
- element: C,
1356
+ }, F = () => Math.random().toString(36).substring(2, 9);
1357
+ let E, T;
1358
+ const G = () => {
1359
+ E != null && E.parentNode && E.parentNode.removeChild(E), E = document.createElement("div"), E.className = "ol-tooltip ol-tooltip-measure", T = new Overlay({
1360
+ element: E,
1361
1361
  offset: [0, -15],
1362
1362
  positioning: "bottom-center",
1363
1363
  stopEvent: !1,
1364
1364
  insertFirst: !1
1365
- }), e == null || e.addOverlay(Z);
1366
- }, Q = () => {
1367
- o != null && o.parentNode && o.parentNode.removeChild(o), o = document.createElement("div"), o.className = "ol-tooltip hidden", N = new Overlay({
1365
+ }), e == null || e.addOverlay(T);
1366
+ }, q = () => {
1367
+ o != null && o.parentNode && o.parentNode.removeChild(o), o = document.createElement("div"), o.className = "ol-tooltip hidden", P = new Overlay({
1368
1368
  element: o,
1369
1369
  offset: [15, 0],
1370
1370
  positioning: "center-left"
1371
- }), e == null || e.addOverlay(N);
1372
- }, H = () => {
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);
1371
+ }), e == null || e.addOverlay(P);
1372
+ }, W = () => {
1373
+ l.value.forEach((g, M) => {
1374
+ var $, R;
1375
+ const V = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
1376
+ V[M] && ((R = ($ = V[M]) == null ? void 0 : $.parentNode) == null || R.removeChild(V[M]));
1377
+ const D = t.getFeatures();
1378
+ D[M] && t.removeFeature(D[M]);
1379
+ }), u(), enableDoubleClickZoom(e), m.value = !1;
1380
+ }, Q = (g) => {
1381
+ var V, D, $, R;
1382
+ const M = l.value.findIndex((S) => S.id === g);
1383
1383
  if (M !== -1) {
1384
1384
  l.value.splice(M, 1);
1385
- const R = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
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]);
1385
+ const S = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
1386
+ S[M] && ((D = (V = S[M]) == null ? void 0 : V.parentNode) == null || D.removeChild(S[M]));
1387
+ const A = t.getFeatures();
1388
+ A[M] && t.removeFeature(A[M]);
1389
1389
  }
1390
- (F = (z = n.getProps()) == null ? void 0 : z.lineDrawEnd) == null || F.call(z, l.value);
1391
- }, L = () => {
1392
- if (l.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((S) => {
1390
+ (R = ($ = s.getProps()) == null ? void 0 : $.lineDrawEnd) == null || R.call($, l.value);
1391
+ }, u = () => {
1392
+ if (l.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((g) => {
1393
1393
  var M;
1394
- (M = S == null ? void 0 : S.parentNode) == null || M.removeChild(S);
1394
+ (M = g == null ? void 0 : g.parentNode) == null || M.removeChild(g);
1395
1395
  }), t.clear(), f) {
1396
- const S = e.getInteractions().getArray().find((M) => getUid(M) === getUid(f));
1397
- S && e.removeInteraction(S);
1396
+ const g = e.getInteractions().getArray().find((M) => getUid(M) === getUid(f));
1397
+ g && e.removeInteraction(g);
1398
1398
  }
1399
- e.removeLayer(r), o != null && o.parentNode && o.parentNode.removeChild(o), C != null && C.parentNode && C.parentNode.removeChild(C);
1399
+ e.removeLayer(r), o != null && o.parentNode && o.parentNode.removeChild(o), E != null && E.parentNode && E.parentNode.removeChild(E);
1400
1400
  };
1401
1401
  return {
1402
- open: T,
1403
- close: H,
1404
- deleteLine: u,
1402
+ open: L,
1403
+ close: W,
1404
+ deleteLine: Q,
1405
1405
  setUnit: a,
1406
- getState: () => y.value
1406
+ getState: () => m.value
1407
1407
  };
1408
- }, computedDistance = (e, n) => {
1409
- const s = getLength(e);
1408
+ }, computedDistance = (e, s) => {
1409
+ const n = getLength(e);
1410
1410
  let a = "";
1411
- switch (n) {
1411
+ switch (s) {
1412
1412
  case "m":
1413
- a = `${Math.round(s * 100) / 100} m`;
1413
+ a = `${Math.round(n * 100) / 100} m`;
1414
1414
  break;
1415
1415
  case "km":
1416
- a = `${Math.round(s / 1e3 * 100) / 100} km`;
1416
+ a = `${Math.round(n / 1e3 * 100) / 100} km`;
1417
1417
  break;
1418
1418
  case "nm":
1419
- a = `${Math.round(s / 1.852 * 100) / 100} nm`;
1419
+ a = `${Math.round(n / 1.852 * 100) / 100} nm`;
1420
1420
  break;
1421
1421
  }
1422
1422
  return a;
1423
- }, useDrawPolygonManager = (e, n) => {
1424
- let l;
1425
- const s = () => {
1426
- a();
1427
- }, a = () => {
1428
- T(), P(), Z(), N();
1423
+ }, useDrawPolygonManager = (e, s) => {
1424
+ let l, n;
1425
+ const a = () => {
1426
+ o(), changeCursor(e, "crosshair");
1427
+ }, o = () => {
1428
+ t(), E(), q(), O();
1429
1429
  };
1430
- let o = null, y = null;
1431
- const T = () => {
1432
- if (o || y) return;
1433
- const H = new VectorSource(), u = new VectorLayer({
1434
- source: H,
1430
+ let m = null, L = null;
1431
+ const t = () => {
1432
+ if (m && L) return;
1433
+ const u = new VectorSource(), x = new VectorLayer({
1434
+ source: u,
1435
1435
  style: new Style({
1436
1436
  stroke: new Stroke({
1437
1437
  color: "#fbcc33",
@@ -1439,45 +1439,45 @@ const getShipDirectPath = (e) => {
1439
1439
  })
1440
1440
  })
1441
1441
  });
1442
- o = u, y = H, e.on("pointermove", r), e.addLayer(u), e.on(["dblclick"], function(L) {
1443
- g && (L.stopPropagation(), L.preventDefault());
1442
+ m = x, L = u, e.on("pointermove", w), e.addLayer(x), e.on(["dblclick"], function(g) {
1443
+ v && (g.stopPropagation(), g.preventDefault());
1444
1444
  });
1445
1445
  };
1446
- let t;
1447
- const r = (H) => {
1448
- if (H.dragging) return;
1449
- const u = t ? "单击继续,双击结束" : "点击选择起点";
1450
- p && (p.innerHTML = u, C.setPosition(H.coordinate));
1446
+ let r;
1447
+ const w = (u) => {
1448
+ if (u.dragging) return;
1449
+ const x = r ? "单击继续,双击结束" : "点击选择起点";
1450
+ T && (T.innerHTML = x, G.setPosition(u.coordinate));
1451
1451
  };
1452
- let g, m = !1;
1453
- const N = () => {
1452
+ let v, P = !1;
1453
+ const O = () => {
1454
1454
  if (l) {
1455
- p != null && p.parentNode && p.parentNode.removeChild(p);
1455
+ T != null && T.parentNode && T.parentNode.removeChild(T);
1456
1456
  const u = l.getGeometry();
1457
1457
  if (!u) return;
1458
- const L = D(u, "nm");
1459
- v && (v.innerHTML = `
1460
- <span class="text">面积:${L}${m ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
1461
- `), v && (v.innerHTML += '<span class="delete-icon" ><i class="map-iconfont icon-delete" /></div>');
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));
1458
+ const x = f(u, "nm");
1459
+ y && (y.innerHTML = `
1460
+ <span class="text">面积:${x}${P ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
1461
+ `), y && (y.innerHTML += '<span class="delete-icon" ><i class="map-iconfont icon-delete" /></div>');
1462
+ const g = u.getCoordinates(), M = g[0][g[0].length - 2];
1463
+ if (F.setPosition(M), m) {
1464
+ const D = m.getSource();
1465
+ D && l && (D.clear(), D.addFeature(l));
1466
1466
  }
1467
1467
  setTimeout(() => {
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($, []);
1468
+ var D;
1469
+ (D = document.querySelector(".delete-icon")) == null || D.addEventListener("click", () => {
1470
+ var $, R;
1471
+ console.log("delete"), W(), (R = ($ = s.getProps()) == null ? void 0 : $.areaDrawEnd) == null || R.call($, []);
1472
1472
  });
1473
1473
  }, 0);
1474
- const M = getCenter(l.getGeometry().getExtent());
1475
- e == null || e.getView().setCenter(M);
1474
+ const V = getCenter(l.getGeometry().getExtent());
1475
+ e == null || e.getView().setCenter(V);
1476
1476
  return;
1477
1477
  }
1478
- g = new Draw({
1478
+ v = new Draw({
1479
1479
  type: "Polygon",
1480
- source: y,
1480
+ source: L,
1481
1481
  trace: !0,
1482
1482
  style: [new Style({
1483
1483
  stroke: new Stroke({
@@ -1496,30 +1496,28 @@ const getShipDirectPath = (e) => {
1496
1496
  })
1497
1497
  }),
1498
1498
  geometry: function(u) {
1499
- const L = u.getGeometry().getCoordinates();
1500
- return new MultiPoint(L);
1499
+ const x = u.getGeometry().getCoordinates();
1500
+ return new MultiPoint(x);
1501
1501
  }
1502
1502
  })]
1503
- }), e == null || e.addInteraction(g);
1504
- let H;
1505
- g.on("drawstart", (u) => {
1506
- var L;
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;
1510
- const R = '<span class="error pl-4">超出可以绘画的距离</span>';
1511
- v && (v.innerHTML = `
1503
+ }), e == null || e.addInteraction(v), v.on("drawstart", (u) => {
1504
+ var x;
1505
+ r = u.feature, n = (x = r.getGeometry()) == null ? void 0 : x.on("change", (g) => {
1506
+ const M = g.target, V = f(M, "nm"), $ = M.getCoordinates()[0], R = new LineString([$[$.length - 2], $[$.length - 1]]), S = computedDistance(R, "nm");
1507
+ if (P = Number(getLength(R) / 1e3) > 150, !V) return;
1508
+ const A = '<span class="error pl-4">超出可以绘画的距离</span>';
1509
+ y && (y.innerHTML = `
1512
1510
  <div class="text">
1513
- 面积:${M}
1514
- ${m ? R : ""}
1511
+ 面积:${V}
1512
+ ${P ? A : ""}
1515
1513
  </div>
1516
- `), p && (p.innerHTML = `
1514
+ `), T && (T.innerHTML = `
1517
1515
  <div class="text">
1518
- 面积:${M}
1516
+ 面积:${V}
1519
1517
  </div>
1520
- <div class="text ${m ? "error" : ""}">
1521
- 线段 ${$.length - 2}: ${F}
1522
- ${m ? R : ""}
1518
+ <div class="text ${P ? "error" : ""}">
1519
+ 线段 ${$.length - 2}: ${S}
1520
+ ${P ? A : ""}
1523
1521
 
1524
1522
  </div>
1525
1523
  <div>
@@ -1527,85 +1525,85 @@ const getShipDirectPath = (e) => {
1527
1525
  </div>
1528
1526
  `);
1529
1527
  });
1530
- }), g.on("drawend", (u) => {
1531
- var M, O, $, z;
1528
+ }), v.on("drawend", (u) => {
1529
+ var V, D, $, R;
1532
1530
  if (!u.feature.getGeometry()) return;
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);
1531
+ l = u.feature, y && (y.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), F.setOffset([10, 0]);
1532
+ const g = u.feature.getGeometry().getCoordinates(), M = g[0][g[0].length - 2];
1533
+ if (F.setPosition(M), T != null && T.parentNode && T.parentNode.removeChild(T), (V = s.getProps()) != null && V.areaDrawEnd) {
1534
+ const S = g[0].map((A) => transform(A, projection.mercator, projection.data));
1535
+ ($ = (D = s.getProps()) == null ? void 0 : D.areaDrawEnd) == null || $.call(D, S);
1538
1536
  }
1539
- g && (g.setActive(!1), e == null || e.removeInteraction(g), (e == null ? void 0 : e.getInteractions()).forEach((R) => {
1540
- R instanceof Draw && (R.setActive(!1), e == null || e.removeInteraction(R));
1541
- })), H && unByKey(H), (z = document.querySelector(".delete-icon")) == null || z.addEventListener("click", () => {
1542
- var F, R;
1543
- Y(), (R = (F = n.getProps()) == null ? void 0 : F.areaDrawEnd) == null || R.call(F, []);
1537
+ v && (v.setActive(!1), e == null || e.removeInteraction(v), (e == null ? void 0 : e.getInteractions()).forEach((A) => {
1538
+ A instanceof Draw && (A.setActive(!1), e == null || e.removeInteraction(A));
1539
+ })), n && unByKey(n), (R = document.querySelector(".delete-icon")) == null || R.addEventListener("click", () => {
1540
+ var S, A;
1541
+ W(), (A = (S = s.getProps()) == null ? void 0 : S.areaDrawEnd) == null || A.call(S, []);
1544
1542
  });
1545
1543
  });
1546
- }, D = (H, u) => {
1547
- const L = getArea(H);
1548
- switch (u) {
1544
+ }, f = (u, x) => {
1545
+ const g = getArea(u);
1546
+ switch (x) {
1549
1547
  case "km":
1550
- return L > 1e4 ? Math.round(L / 1e6 * 100) / 100 + " km<sup>2</sup>" : Math.round(L * 100) / 100 + " m<sup>2</sup>";
1548
+ return g > 1e4 ? Math.round(g / 1e6 * 100) / 100 + " km<sup>2</sup>" : Math.round(g * 100) / 100 + " m<sup>2</sup>";
1551
1549
  case "nm":
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>";
1550
+ return g > 1e4 ? Math.round(g / 1e6 / Math.pow(1.852, 2) * 100) / 100 + " nm<sup>2</sup>" : Math.round(g * 100) / 100 + " m<sup>2</sup>";
1553
1551
  }
1554
1552
  };
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({
1558
- element: v,
1553
+ let y, F;
1554
+ const E = () => {
1555
+ y != null && y.parentNode && y.parentNode.removeChild(y), y = document.createElement("div"), y.style.display = "flex", y.className = "ol-tooltip ol-tooltip-draw-polygon", F = new Overlay({
1556
+ element: y,
1559
1557
  offset: [0, -15],
1560
1558
  positioning: "bottom-center",
1561
1559
  stopEvent: !1,
1562
1560
  insertFirst: !1
1563
- }), e == null || e.addOverlay(f);
1561
+ }), e == null || e.addOverlay(F);
1564
1562
  };
1565
- let p, C;
1566
- const Z = () => {
1567
- p != null && p.parentNode && p.parentNode.removeChild(p), p = document.createElement("div"), p.className = "ol-tooltip ol-help-tooltip", C = new Overlay({
1568
- element: p,
1563
+ let T, G;
1564
+ const q = () => {
1565
+ T != null && T.parentNode && T.parentNode.removeChild(T), T = document.createElement("div"), T.className = "ol-tooltip ol-help-tooltip", G = new Overlay({
1566
+ element: T,
1569
1567
  offset: [15, 0],
1570
1568
  positioning: "center-left"
1571
- }), e == null || e.addOverlay(C);
1572
- }, Y = () => {
1573
- y == null || y.clear(), l = null, P(), Z(), N();
1569
+ }), e == null || e.addOverlay(G);
1570
+ }, W = () => {
1571
+ L == null || L.clear(), l = null, E(), q(), O();
1574
1572
  };
1575
1573
  return {
1576
- open: s,
1574
+ open: a,
1577
1575
  close: () => {
1578
- y == null || y.clear(), y = null, o && (e.removeLayer(o), o = null), t = null, g && (g = null, e.getInteractions().forEach((H) => {
1579
- H instanceof Draw && e.removeInteraction(H);
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);
1576
+ L == null || L.clear(), L = null, m && (e.removeLayer(m), m = null), r = null, v && (v.setActive(!1), (e == null ? void 0 : e.getInteractions()).forEach((x) => {
1577
+ x instanceof Draw && (x.setActive(!1), e == null || e.removeInteraction(x));
1578
+ }), v = null), n && unByKey(n), T != null && T.parentElement && T.parentElement.removeChild(T), y != null && y.parentElement && y.parentElement.removeChild(y), G && e.removeOverlay(G), F && e.removeOverlay(F), changeCursor(e, "pointer");
1581
1579
  },
1582
- reset: Y
1580
+ reset: W
1583
1581
  };
1584
1582
  }, PORT_LAYER_CLASS_NAME = "zh-map-port-layer", usePortManager = (e) => {
1585
- const n = e.getInstall();
1586
- let l, s, a = null, o = null;
1587
- const y = (f) => {
1583
+ const s = e.getInstall();
1584
+ let l, n, a = null, o = null;
1585
+ const m = (f) => {
1588
1586
  if (!(!f || f.length === 0)) {
1589
- if (s || (s = new VectorSource()), s.clear(), o) {
1590
- const P = f.find((p) => p.id === o.id);
1591
- P ? o = P : f.push(o);
1587
+ if (n || (n = new VectorSource()), n.clear(), o) {
1588
+ const y = f.find((F) => F.id === o.id);
1589
+ y ? o = y : f.push(o);
1592
1590
  }
1593
- f.forEach((P) => {
1594
- T(P);
1591
+ f.forEach((y) => {
1592
+ L(y);
1595
1593
  }), l || (l = new VectorLayer({
1596
1594
  className: PORT_LAYER_CLASS_NAME,
1597
- source: s,
1595
+ source: n,
1598
1596
  zIndex: 100
1599
- }), n.addLayer(l));
1597
+ }), s.addLayer(l));
1600
1598
  }
1601
- }, T = (f) => {
1602
- const P = e.getZoom(), [p, C] = f.latLon.split(","), Z = new Feature({
1603
- geometry: new Point(fromLonLat([Number(p), Number(C)]))
1599
+ }, L = (f) => {
1600
+ const y = e.getZoom(), [F, E] = f.latLon.split(","), T = new Feature({
1601
+ geometry: new Point(fromLonLat([Number(F), Number(E)]))
1604
1602
  });
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) => {
1607
- const C = (Y) => `<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
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}"/>
1603
+ T.setStyle(t(f, y, f.id === (o == null ? void 0 : o.id))), T.set("portData", f), n.addFeature(T);
1604
+ }, t = (f, y, F) => {
1605
+ const E = (G) => `<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
1606
+ <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="${G}"/>
1609
1607
  <g clip-path="url(#clip0_10059_122082)">
1610
1608
  <path d="M34.8624 22.8687L32.5874 25.6313L33.4812 25.7125C33.4812 25.7125 30.5562 28.0687 27.9562 28.2312C25.3562 28.3937 24.1374 24.9 24.1374 24.9V19.1312H27.6312V17.425H24.2999V15.15C25.7624 14.6625 26.7374 13.2812 26.7374 11.6562C26.7374 9.625 25.1124 8 23.0812 8H22.9999C20.9687 8 19.3437 9.625 19.3437 11.6562C19.3437 13.2812 20.3999 14.6625 21.7812 15.15V17.425H18.4499V19.1312H21.9437V24.9C21.9437 24.9 20.6437 28.3125 18.0437 28.2312C15.4437 28.0687 12.5187 25.7125 12.5187 25.7125L13.4124 25.6313L11.0562 22.8687L10.2437 26.2812L11.2187 26.0375C11.2187 26.0375 13.1687 29.5313 16.1749 30.8313C19.1812 32.2125 22.1874 33.9187 22.8374 34C23.4874 33.9187 26.4937 32.2125 29.4187 30.8313C32.3437 29.45 34.3749 26.0375 34.3749 26.0375L35.3499 26.2812L34.8624 22.8687ZM23.0812 13.6875C21.9437 13.6875 21.0499 12.7937 21.0499 11.6562C21.0499 10.6 21.9437 9.70625 22.9999 9.70625H23.0812C24.1374 9.70625 25.0312 10.6 25.0312 11.6562C25.1124 12.7937 24.1374 13.6875 23.0812 13.6875Z" fill="white"/>
1611
1609
  </g>
@@ -1615,138 +1613,136 @@ const getShipDirectPath = (e) => {
1615
1613
  </clipPath>
1616
1614
  </defs>
1617
1615
  </svg>
1618
- `, Z = () => `data:image/svg+xml;utf8,${encodeURIComponent(C(p ? "#FF5733" : "#3370FF"))}`;
1616
+ `, T = () => `data:image/svg+xml;utf8,${encodeURIComponent(E(F ? "#FF5733" : "#3370FF"))}`;
1619
1617
  return new Style({
1620
1618
  text: new Text({
1621
1619
  text: f.shortName,
1622
1620
  font: "12px sans-serif",
1623
1621
  fill: new Fill({
1624
- color: p ? "#ffffff" : "#000000"
1622
+ color: F ? "#ffffff" : "#000000"
1625
1623
  }),
1626
1624
  backgroundFill: new Fill({
1627
- color: p ? "#FF5733" : "#FFFFFF"
1625
+ color: F ? "#FF5733" : "#FFFFFF"
1628
1626
  }),
1629
1627
  offsetY: 30
1630
1628
  }),
1631
1629
  image: new Icon({
1632
- src: Z(),
1633
- scale: 0.5 * P / 10
1634
- })
1630
+ src: T(),
1631
+ scale: 0.5 * y / 10
1632
+ }),
1633
+ zIndex: F ? 110 : 100
1635
1634
  });
1636
1635
  }, r = () => {
1637
1636
  if (a) {
1638
1637
  console.log("清除非选中的港口");
1639
1638
  const f = a.get("portData").id;
1640
- s.getFeatures().forEach((P) => {
1641
- P.get("portData").id !== f && s.removeFeature(P);
1639
+ n.getFeatures().forEach((y) => {
1640
+ y.get("portData").id !== f && n.removeFeature(y);
1642
1641
  });
1643
1642
  } else
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)));
1649
- }), o = null, a = null;
1650
- }, m = (f) => {
1651
- f ? (N(), D(f)) : g();
1652
- }, N = () => {
1643
+ console.log("清除所有港口", n), n == null || n.clear();
1644
+ }, w = (f) => {
1645
+ if (!f)
1646
+ return v();
1647
+ (a == null ? void 0 : a.get("portData").id) !== f.id && (v(), P(f));
1648
+ }, v = () => {
1653
1649
  if (a) {
1654
- const f = a == null ? void 0 : a.get("portData"), P = e.getZoom();
1655
- a.setStyle(t(f, P, !1));
1650
+ const f = a == null ? void 0 : a.get("portData"), y = e.getZoom();
1651
+ a.setStyle(t(f, y, !1));
1656
1652
  }
1657
- }, D = (f) => {
1658
- const P = s.getFeatures();
1659
- o = f, a = P.find((p) => p.get("portData").id === f.id);
1653
+ }, P = (f) => {
1654
+ const y = n.getFeatures();
1655
+ o = f, a = y.find((F) => F.get("portData").id === f.id), a.setStyle(t(f, e.getZoom(), !0));
1660
1656
  };
1661
1657
  return {
1662
- render: y,
1658
+ render: m,
1663
1659
  clear: r,
1664
- selected: m,
1660
+ selected: w,
1665
1661
  handlePortHover: (f) => {
1666
- const P = n == null ? void 0 : n.getTargetElement();
1667
- f && f.get("portData") && P && (P.style.cursor = "pointer");
1662
+ const y = s == null ? void 0 : s.getTargetElement();
1663
+ f && f.get("portData") && y && (y.style.cursor = "pointer");
1668
1664
  }
1669
1665
  };
1670
- }, useEventManager = (e, n, l, s, a, o) => {
1671
- const y = e.getInstall();
1672
- y.on("moveend", () => {
1666
+ }, useEventManager = (e, s, l, n, a, o) => {
1667
+ const m = e.getInstall();
1668
+ m.on("moveend", () => {
1673
1669
  var t, 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);
1679
- }), y.on("movestart", () => {
1670
+ const L = e.getZoom();
1671
+ (r = (t = s.getProps()).mapMoveEnd) == null || r.call(t, L), l.reRenderTrackLine();
1672
+ }), m.on("pointermove", (L) => {
1673
+ const t = m.getEventPixel(L.originalEvent), r = m.forEachFeatureAtPixel(t, (w) => w);
1674
+ n.handleShipMapEvent(r, "hover"), l.handleTrackMapEvent(r, "hover", L), r && a.handlePortHover(r);
1675
+ }), m.on("movestart", () => {
1680
1676
  console.log("movestart-----------------------");
1681
- }), y.on("click", debounce((T) => {
1682
- var g, m, N;
1677
+ }), m.on("click", debounce((L) => {
1678
+ var w, v, P;
1683
1679
  if (console.log("1", o.getState()), o.getState()) return;
1684
- const t = y.getEventPixel(T.originalEvent), r = y.forEachFeatureAtPixel(
1680
+ const t = m.getEventPixel(L.originalEvent), r = m.forEachFeatureAtPixel(
1685
1681
  t,
1686
- (D) => {
1687
- if (D != null && D.get("shipData") || D != null && D.get("portData"))
1688
- return D;
1682
+ (O) => {
1683
+ if (O != null && O.get("shipData") || O != null && O.get("portData"))
1684
+ return O;
1689
1685
  }
1690
1686
  );
1691
1687
  if (console.log("2", r), !!r) {
1692
- if (T.preventDefault(), T.stopPropagation(), r.get("shipData"))
1693
- s.handleShipMapEvent(r, "click", (g = n.getProps()) == null ? void 0 : g.selectShip);
1688
+ if (L.preventDefault(), L.stopPropagation(), r.get("shipData"))
1689
+ n.handleShipMapEvent(r, "click", (w = s.getProps()) == null ? void 0 : w.selectShip);
1694
1690
  else if (r.get("portData")) {
1695
- const D = r.get("portData");
1696
- a.selected(D), (N = (m = n.getProps()) == null ? void 0 : m.selectPort) == null || N.call(m, D);
1691
+ const O = r.get("portData");
1692
+ a.selected(O), (P = (v = s.getProps()) == null ? void 0 : v.selectPort) == null || P.call(v, O);
1697
1693
  }
1698
1694
  }
1699
1695
  }, 150));
1700
1696
  }, useMapController = () => {
1701
1697
  const e = reactive([]);
1702
1698
  return {
1703
- createInstance: (s, a) => {
1699
+ createInstance: (n, a) => {
1704
1700
  const o = useMapInitializer();
1705
- o.initMap(s, a);
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 = () => {
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);
1712
- return [Z[0], Z[1], Y[0], Y[1]];
1713
- }, p = {
1701
+ o.initMap(n, a);
1702
+ const m = o.getInstall(), L = useLayerManager(m), t = usePropsManager();
1703
+ t.setProps(a), L.setShowLayerType(a.layerType), L.setGreenTileVisible(a.showGreenLayer);
1704
+ const r = useTrackManager(m), w = useCarTrackManager(m, r), v = useShipManager(m), P = usePositionManager(m), O = useDrawLineManager(m, t), f = useDrawPolygonManager(m, t), y = usePortManager(o);
1705
+ useEventManager(o, t, r, v, y, O);
1706
+ const F = () => {
1707
+ const T = m.getView().calculateExtent(o.getSize()), G = transform([T[0], T[1]], projection.mercator, projection.data), q = transform([T[2], T[3]], projection.mercator, projection.data);
1708
+ return [G[0], G[1], q[0], q[1]];
1709
+ }, E = {
1714
1710
  id: Symbol("map-instance"),
1715
1711
  innerMap: null,
1716
1712
  map: o.getInstall(),
1717
1713
  destroy: () => {
1718
- e.splice(e.indexOf(p), 1);
1714
+ e.splice(e.indexOf(E), 1);
1719
1715
  },
1720
1716
  methods: {
1721
1717
  ...o,
1722
- layer: T,
1723
- ship: m,
1718
+ layer: L,
1719
+ ship: v,
1724
1720
  track: r,
1725
- carTrack: g,
1721
+ carTrack: w,
1726
1722
  port: {
1727
- render: f.render,
1728
- clear: f.clear,
1729
- selected: f.selected
1723
+ render: y.render,
1724
+ clear: y.clear,
1725
+ selected: y.selected
1730
1726
  },
1731
- position: N,
1732
- drawLine: D,
1733
- drawPolygon: v,
1727
+ position: P,
1728
+ drawLine: O,
1729
+ drawPolygon: f,
1734
1730
  // 子模块
1735
1731
  utils: {
1736
- getCalculateExtent: P,
1732
+ getCalculateExtent: F,
1737
1733
  convertSixHundredThousandToLatLng,
1738
1734
  calculateCirclePoints
1739
1735
  }
1740
1736
  }
1741
1737
  };
1742
- return e.push(p), p;
1738
+ return e.push(E), E;
1743
1739
  },
1744
- destroyInstance: (s) => {
1745
- const a = e.findIndex((o) => o.id === s);
1740
+ destroyInstance: (n) => {
1741
+ const a = e.findIndex((o) => o.id === n);
1746
1742
  a > -1 && (e[a].destroy(), e.splice(a, 1));
1747
1743
  },
1748
1744
  destroyAll: () => {
1749
- e.forEach((s) => s.destroy()), e.splice(0, e.length);
1745
+ e.forEach((n) => n.destroy()), e.splice(0, e.length);
1750
1746
  },
1751
1747
  getAllInstances: () => [...e]
1752
1748
  };
@@ -1769,18 +1765,18 @@ const getShipDirectPath = (e) => {
1769
1765
  selectPort: { type: Function, default: () => {
1770
1766
  } }
1771
1767
  },
1772
- setup(e, { expose: n }) {
1773
- const l = ref(), s = ref(), a = useMapController(), o = ref(), y = e, T = ref({
1768
+ setup(e, { expose: s }) {
1769
+ const l = ref(), n = ref(), a = useMapController(), o = ref(), m = e, L = ref({
1774
1770
  getInstall() {
1775
1771
  }
1776
1772
  });
1777
1773
  return onMounted(() => {
1778
1774
  var t;
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);
1775
+ o.value = a.createInstance(l.value, m), console.log(" instance.value?.methods", o.value.map), L.value = o.value.methods, (t = n.value) == null || t.setScaleLine(o.value.map, m.scaleLineUnit);
1780
1776
  }), onUnmounted(() => {
1781
1777
  var t, r;
1782
1778
  a.destroyInstance((t = o == null ? void 0 : o.value) == null ? void 0 : t.id), (r = o.value) == null || r.destroy();
1783
- }), n({
1779
+ }), s({
1784
1780
  getZoom: () => {
1785
1781
  var t;
1786
1782
  return (t = o.value) == null ? void 0 : t.methods.getZoom();
@@ -1798,16 +1794,16 @@ const getShipDirectPath = (e) => {
1798
1794
  return (t = o.value) == null ? void 0 : t.methods.getView();
1799
1795
  },
1800
1796
  setCenter: (t, r) => {
1801
- var g;
1802
- return (g = o.value) == null ? void 0 : g.methods.setCenter(t, r);
1797
+ var w;
1798
+ return (w = o.value) == null ? void 0 : w.methods.setCenter(t, r);
1803
1799
  },
1804
1800
  getSize: () => {
1805
1801
  var t;
1806
1802
  return (t = o.value) == null ? void 0 : t.methods.getSize();
1807
1803
  },
1808
1804
  getCenter: (t, r) => {
1809
- var g;
1810
- return (g = o.value) == null ? void 0 : g.methods.getCenter();
1805
+ var w;
1806
+ return (w = o.value) == null ? void 0 : w.methods.getCenter();
1811
1807
  },
1812
1808
  layer: {
1813
1809
  setGreenTileVisible: (t) => {
@@ -1980,8 +1976,8 @@ const getShipDirectPath = (e) => {
1980
1976
  return (r = o.value) == null ? void 0 : r.methods.utils.convertSixHundredThousandToLatLng(...t);
1981
1977
  },
1982
1978
  calculateCirclePoints: (t, r) => {
1983
- var g;
1984
- return (g = o.value) == null ? void 0 : g.methods.utils.calculateCirclePoints(t, r);
1979
+ var w;
1980
+ return (w = o.value) == null ? void 0 : w.methods.utils.calculateCirclePoints(t, r);
1985
1981
  }
1986
1982
  }
1987
1983
  }), (t, r) => (openBlock(), createElementBlock("div", _hoisted_1, [
@@ -1993,7 +1989,7 @@ const getShipDirectPath = (e) => {
1993
1989
  }, null, 512),
1994
1990
  createVNode(ScaleLine, {
1995
1991
  ref_key: "scaleLineRef",
1996
- ref: s
1992
+ ref: n
1997
1993
  }, null, 512),
1998
1994
  createVNode(ZoomControl, {
1999
1995
  ref: "zoomControlRef",