zhihao-ui 1.3.23 → 1.3.24

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.
@@ -0,0 +1,2110 @@
1
+ import { defineComponent, openBlock, createElementBlock, createElementVNode, ref, computed, h, createVNode, render, reactive, onMounted, onUnmounted } from "vue";
2
+ import { S as ScaleLine$1, M as Map$2, T as TileLayer, X as XYZ, p as fromLonLat, V as View, q as defaults, t as toLonLat, h as hooks, r as getLength, s as transformExtent, u as Text, F as Fill, v as Style, O as Overlay, P as Point, w as transform, x as debounce, L as LineString, y as buffer, z as Polyline, A as Feature, B as VectorLayer, C as VectorSource, D as Stroke, i as cloneDeep, G as CircleStyle, H as getVectorContext, I as Icon, J as VectorImageLayer, K as Circle, N as DoubleClickZoom, Q as Draw, R as unByKey, U as getUid, W as getArea, Y as getCenter, Z as MultiPoint } from "./vendor-D2mv9LHk.js";
3
+ import { _ as _export_sfc } from "./Button-CGndQwez.js";
4
+ import { w as withInstall } from "./utils-D2wHR1YB.js";
5
+ const _hoisted_1$2 = { id: "scale-line-container" }, _sfc_main$2 = /* @__PURE__ */ defineComponent({
6
+ __name: "scaleLine",
7
+ setup(e, { expose: l }) {
8
+ return l({
9
+ setScaleLine: (i, c) => {
10
+ c || (c = "metric");
11
+ const o = new ScaleLine$1({
12
+ units: c
13
+ }), y = document.getElementById("scale-line-container");
14
+ y && (o.setTarget(y), i.addControl(o));
15
+ }
16
+ }), (i, c) => (openBlock(), createElementBlock("div", _hoisted_1$2));
17
+ }
18
+ }), ScaleLine = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-2bc5dee8"]]), _hoisted_1$1 = { class: "zoom" }, _sfc_main$1 = /* @__PURE__ */ defineComponent({
19
+ __name: "zoomControl",
20
+ props: {
21
+ mapInstance: {
22
+ type: Object,
23
+ default: () => null
24
+ }
25
+ },
26
+ setup(e) {
27
+ const l = e;
28
+ console.log("props", l);
29
+ const n = () => {
30
+ console.log("props");
31
+ const { setZoom: c, getZoom: o, getInstall: y } = l.mapInstance.methods;
32
+ if (!y()) return;
33
+ const t = o();
34
+ t && c(t + 1);
35
+ }, i = () => {
36
+ const { setZoom: c, getZoom: o, getInstall: y } = l.mapInstance.methods;
37
+ if (!y()) return;
38
+ const t = o();
39
+ t && c(t - 1);
40
+ };
41
+ return (c, o) => (openBlock(), createElementBlock("div", _hoisted_1$1, [
42
+ createElementVNode("div", {
43
+ class: "button big-button",
44
+ onClick: n
45
+ }, " + "),
46
+ createElementVNode("div", {
47
+ class: "button small-button",
48
+ onClick: i
49
+ }, " - ")
50
+ ]));
51
+ }
52
+ }), ZoomControl = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-c39c3075"]]), TIAN_DI_TU_KEY = "a6e8f78974f2581f2ca00485b40c948f", MAP_ZOOM = {
53
+ // 地图默认层级
54
+ default: 13,
55
+ // 地图缩放最小层级
56
+ min: 3,
57
+ // 地图缩放最大层级
58
+ max: 18,
59
+ // 船形图标最小渲染层级
60
+ shipModelMin: 13,
61
+ // 船形图标最小渲染层级
62
+ shipTriggleMin: 16,
63
+ // 船形图标最大渲染层级
64
+ shipModelMax: 18,
65
+ //根据原系统canvas图片转换svg长宽比例计算缩放值
66
+ scaleNum: 0.555
67
+ }, projection = {
68
+ // 经纬度 源数据 地理坐标 WGS84
69
+ data: "EPSG:4326",
70
+ // 墨卡托投影坐标 渲染坐标
71
+ mercator: "EPSG:3857"
72
+ }, MAP_DEFAULT_CENTER = [114.84, 30.52], CDN_URL = "https://static.zhihaoscm.cn/", equatorialCircumference = 2003750834e-2;
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
+ function useMapInitializer() {
75
+ const e = ref(), l = () => e.value, n = () => l().getView(), i = () => {
76
+ var m;
77
+ return (m = n()) == null ? void 0 : m.getZoom();
78
+ }, c = (m) => {
79
+ var F;
80
+ (F = n()) == null || F.setZoom(m);
81
+ }, o = (m, F) => {
82
+ var N;
83
+ (N = n()) == null || N.setCenter(fromLonLat([m, F]));
84
+ }, y = () => {
85
+ var F;
86
+ const m = (F = n()) == null ? void 0 : F.getCenter();
87
+ return toLonLat(m);
88
+ }, M = () => {
89
+ var m;
90
+ return (m = l()) == null ? void 0 : m.getSize();
91
+ }, t = new Map$2(), r = (m, F) => {
92
+ p(F);
93
+ const N = {
94
+ zoom: F.zoom,
95
+ center: fromLonLat(F.center),
96
+ minZoom: MAP_ZOOM.min,
97
+ maxZoom: MAP_ZOOM.max,
98
+ constrainResolution: !0,
99
+ enableRotation: !1,
100
+ multiWorld: !0
101
+ }, v = new Map$2({
102
+ target: m,
103
+ controls: defaults({
104
+ zoom: !1
105
+ }),
106
+ layers: [
107
+ t.get("vectorTile"),
108
+ t.get("vectorTileMark"),
109
+ t.get("satelliteImgTile"),
110
+ t.get("satelliteImgTileMark")
111
+ ],
112
+ view: new View(N)
113
+ });
114
+ e.value = v;
115
+ }, p = (m) => {
116
+ t.set("vectorTile", new TileLayer({
117
+ source: new XYZ({ url: BASE_MAP_LINK.vectorTile }),
118
+ visible: m.layerType === "vector",
119
+ zIndex: 0,
120
+ preload: 1,
121
+ className: "vector"
122
+ })), t.set("vectorTileMark", new TileLayer({
123
+ source: new XYZ({ url: BASE_MAP_LINK.vectorTileMark }),
124
+ visible: m.layerType === "vector",
125
+ zIndex: 1,
126
+ preload: 1,
127
+ className: "vector"
128
+ })), t.set("satelliteImgTile", new TileLayer({
129
+ source: new XYZ({ url: BASE_MAP_LINK.satelliteImgTile }),
130
+ visible: m.layerType === "satellite",
131
+ zIndex: 0,
132
+ preload: 1,
133
+ className: "satellite"
134
+ })), t.set("satelliteImgTileMark", new TileLayer({
135
+ source: new XYZ({ url: BASE_MAP_LINK.satelliteImgTileMark }),
136
+ visible: m.layerType === "satellite",
137
+ zIndex: 1,
138
+ preload: 1,
139
+ className: "satellite"
140
+ })), t.set("greenMark", new TileLayer({
141
+ source: new XYZ({ url: BASE_MAP_LINK.greenTile }),
142
+ visible: m.showGreenLayer,
143
+ zIndex: 2,
144
+ className: "greenTile"
145
+ }));
146
+ };
147
+ return {
148
+ getInstall: l,
149
+ getView: n,
150
+ getZoom: i,
151
+ setZoom: c,
152
+ setCenter: o,
153
+ getCenter: y,
154
+ getSize: M,
155
+ initMap: r,
156
+ setBaseLayerMap: p
157
+ };
158
+ }
159
+ const convertSixHundredThousandToLatLng = function(e, l) {
160
+ const n = Number(l) / 6e5;
161
+ return [Number(e) / 6e5, n];
162
+ }, calculateCirclePoints = (e, l) => {
163
+ const n = fromLonLat(e), i = l * 1e3, c = [
164
+ n[0] - i,
165
+ n[1] - i,
166
+ n[0] + i,
167
+ n[1] + i
168
+ ], o = transformExtent(c, projection.mercator, projection.data);
169
+ return {
170
+ leftTopPoint: { lng: o[0], lat: o[3] },
171
+ rightTopPoint: { lng: o[2], lat: o[3] },
172
+ rightBottomPoint: { lng: o[2], lat: o[1] },
173
+ leftBottomPoint: { lng: o[0], lat: o[1] }
174
+ };
175
+ }, formatLength = function(e, l) {
176
+ const i = getLength(e);
177
+ let c = "";
178
+ switch (console.log(l, LENGTH_UNIT), l) {
179
+ case LENGTH_UNIT.M:
180
+ c = Math.round(i * 100) / 100 + " m";
181
+ break;
182
+ case LENGTH_UNIT.KM:
183
+ c = Math.round(i / 1e3 * 100) / 100 + " km";
184
+ break;
185
+ case LENGTH_UNIT.NM:
186
+ c = (Math.round(i / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
187
+ break;
188
+ }
189
+ return c;
190
+ };
191
+ function lonLatToMercator(e) {
192
+ const l = e[0] * equatorialCircumference / 180;
193
+ let n = Math.log(Math.tan((90 + e[1]) * Math.PI / 360)) / (Math.PI / 180);
194
+ return n = n * equatorialCircumference / 180, [l, n];
195
+ }
196
+ function getIconFont(unicode = "") {
197
+ return unicode.indexOf("&") !== -1 && (unicode = unicode.replace("&", "&")), unicode.indexOf("&amp") !== -1 && (unicode = unicode.replace("&amp", "&")), eval('("' + unicode.replace("&#x", "\\u").replace(";", "") + '")');
198
+ }
199
+ const getIconStyle = (e) => {
200
+ const l = new Text({
201
+ font: "Normal 14px map-iconfont",
202
+ text: getIconFont(e),
203
+ fill: new Fill({ color: "#fff" }),
204
+ offsetY: -14
205
+ });
206
+ return new Style({
207
+ text: l,
208
+ zIndex: 100
209
+ });
210
+ }, mercatorToLonLat = (e, l = "lonlat") => {
211
+ const n = { lon: 0, lat: 0 }, i = e[0] / equatorialCircumference * 180;
212
+ let c = e[1] / equatorialCircumference * 180;
213
+ return c = 180 / Math.PI * (2 * Math.atan(Math.exp(c * Math.PI / 180)) - Math.PI / 2), n.lon = i, n.lat = c, l === "lonlat" ? n : [i, c];
214
+ }, formatMinutesToDDHHMM = (e) => {
215
+ const l = hooks.duration(e, "minutes"), n = Math.floor(l.asDays()), i = l.hours(), c = l.minutes();
216
+ let o = `${String(c).padStart(2, "0")}分`;
217
+ return i !== 0 && (o = `${String(i).padStart(2, "0")}时${o}`), n !== 0 && (o = `${String(n).padStart(2, "0")}天${o}`), o;
218
+ }, useCarTrackManager = (e, l) => {
219
+ let n = null;
220
+ const i = async (p) => {
221
+ if (!e || (console.log("vehicleInfo", p), !(p != null && p.lon && (p != null && p.lat)))) return;
222
+ const m = Math.abs(Number(p.lon)) > 180 ? convertSixHundredThousandToLatLng(p.lon, p.lat) : [p.lon, p.lat];
223
+ c(p, fromLonLat(m));
224
+ const F = e == null ? void 0 : e.getView(), N = new Point(m);
225
+ F.setCenter(transform(N.getCoordinates(), projection.data, projection.mercator));
226
+ }, c = (p, m) => {
227
+ const F = `${CDN_URL}map/car-icon.gif`;
228
+ n || (n = new Overlay({
229
+ element: document.createElement("div"),
230
+ positioning: "center-center",
231
+ stopEvent: !1
232
+ // 允许交互事件穿透
233
+ }), e.addOverlay(n));
234
+ const N = n.getElement();
235
+ N.style.backgroundImage = `url(${F})`, N.style.width = "80px", N.style.height = "80px";
236
+ const v = (p == null ? void 0 : p.drc) || "";
237
+ N.style.transform = `rotate(${v}deg)`, N.style.backgroundSize = "cover", n == null || n.setPosition(m);
238
+ };
239
+ return {
240
+ location: i,
241
+ remove: () => {
242
+ const p = n == null ? void 0 : n.getElement();
243
+ p && (p.innerHTML = "");
244
+ },
245
+ renderTrack: (p, m, F) => {
246
+ l.render(p, m, F, "truck", 1e3);
247
+ },
248
+ setCenter: (p) => {
249
+ l.setCenter(p);
250
+ },
251
+ closeTrack: () => {
252
+ l.close();
253
+ },
254
+ playTrack: (p, m) => {
255
+ l.play(p, m);
256
+ }
257
+ };
258
+ };
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
+ const useTrackManager = (e) => {
261
+ const l = /* @__PURE__ */ new Map(), n = {};
262
+ let i = null;
263
+ const c = "--";
264
+ let o = null;
265
+ const y = document.createElement("div"), M = new Overlay({
266
+ element: y,
267
+ positioning: "top-left",
268
+ stopEvent: !1,
269
+ className: "track-label-popup"
270
+ });
271
+ let t, r, p, m, F, N = !1, v = Date.now(), w, C = 0, b = null, L = 20, Z = !1;
272
+ const B = 5, Y = [], j = (s) => {
273
+ var d;
274
+ for (Y.unshift(s); Y.length > B; ) {
275
+ const g = Y.pop(), x = l.get(g);
276
+ x && ((d = x.getSource()) == null || d.clear(), e == null || e.removeLayer(x), l.delete(g), delete n[g]);
277
+ }
278
+ };
279
+ let $ = "";
280
+ const z = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080", "#ffc0cb", "#800000", "#000080", "#808000"], a = debounce(() => {
281
+ if (i && n[i] && l.get(i).getVisible() && Z) {
282
+ console.log("reRenderTrackLine------------");
283
+ const s = cloneDeep(u(i, n[i]));
284
+ le(i, s);
285
+ }
286
+ }, 300), u = (s, d) => {
287
+ let g = [];
288
+ const x = Math.max(1, Math.floor(d.length / L));
289
+ return g = d.filter((T, R) => R % x === 0).map((T, R) => {
290
+ if (Number(T.lon) > 180 || Number(T.lat) > 180) {
291
+ const [V, G] = convertSixHundredThousandToLatLng(T.lon, T.lat);
292
+ T.lon = V, T.lat = G;
293
+ }
294
+ return T.center = [T.lon, T.lat], T.centerPoint = lonLatToMercator(T.center), T.time = hooks(T.createdAt).format("YYYY-MM-DD HH:mm:ss"), T.id = s, T.index = R, T;
295
+ }), g;
296
+ }, f = async (s, d, g, x = "ship", E = 200) => {
297
+ if (console.log("renderTrackLine--------", s, d, g), !e || JSON.stringify(n[s]) === JSON.stringify(d) && i === s || (d = d == null ? void 0 : d.reverse(), M && x === "ship" && (e != null && e.getOverlays().getArray().includes(M) || e.addOverlay(M)), (d == null ? void 0 : d.length) < 2))
298
+ return;
299
+ j(s), i = s, n[s] = d, L = E;
300
+ const T = Object.keys(n).findIndex((R) => R === s) || 0;
301
+ $ = g || z[T > 10 ? 10 : T], Z = !0, await O(), await ce(i);
302
+ }, P = (s) => {
303
+ const d = new VectorSource();
304
+ return new VectorLayer({
305
+ source: d,
306
+ visible: !1,
307
+ // 默认隐藏
308
+ className: `track-layer-${s}`,
309
+ renderBuffer: 1024
310
+ // 增大渲染缓冲区
311
+ });
312
+ }, k = (s) => {
313
+ l.forEach((d, g) => {
314
+ var E;
315
+ const x = g === s;
316
+ d.getVisible() !== x && (d.setVisible(x), e.getLayers().getArray().includes(d) || e.addLayer(d), x || (E = d.getSource()) == null || E.clear());
317
+ }), i = s;
318
+ }, O = async () => {
319
+ const s = i;
320
+ if (!l.has(s)) {
321
+ const T = P(s);
322
+ l.set(s, T);
323
+ }
324
+ await k(s);
325
+ const d = $ || "", g = n[s] || [];
326
+ if (!(g && g.length > 1)) return [];
327
+ let x = [];
328
+ x = u(s, g);
329
+ const E = x.map((T) => T.centerPoint);
330
+ x.length >= 2 && await D(s, E, d);
331
+ }, D = (s, d, g) => {
332
+ const x = new LineString(d), E = l.get(s).getSource(), T = E.getFeatureById(s);
333
+ if (T)
334
+ T.setGeometry(x), T.setId(s), T.setStyle(A(g)), b = T;
335
+ else {
336
+ const R = new Feature({ geometry: x });
337
+ R.setId(s), R.set("type", "line"), R.setStyle(A(g)), E.addFeature(R), b = R;
338
+ }
339
+ return b;
340
+ }, A = (s) => new Style({
341
+ stroke: new Stroke({
342
+ color: s,
343
+ width: 2
344
+ })
345
+ }), _ = (s, d, g) => {
346
+ const x = s == null ? void 0 : s.get("trackId");
347
+ if (s && x && d === "hover") {
348
+ e.getTargetElement().style.cursor = x ? "pointer" : "";
349
+ const E = s.get("data"), T = J(E), R = g == null ? void 0 : g.coordinate;
350
+ R && (y.querySelector(".popup-content"), y.innerHTML = T, M == null || M.setPosition(R));
351
+ } else
352
+ M && M.setPosition(void 0);
353
+ }, J = (s) => {
354
+ if (!(s != null && s.time)) return;
355
+ let d = "";
356
+ return s != null && s.stayTime && (d = `
357
+ <div class="item w-100">
358
+ <div class="item-label">停泊时间约</div>
359
+ <div class="item-item">${formatMinutesToDDHHMM(Number(s.stayTime))}</div>
360
+ </div>
361
+ `), `
362
+ <div class="track-point-popup">
363
+ <div class="item">
364
+ <div class="item-label">状态</div>
365
+ <div class="item-item">${s != null && s.sailStatus ? SHIP_SAIL_STATUS[s.sailStatus] : c}</div>
366
+ </div>
367
+ <div class="item">
368
+ <div class="item-label">航速</div>
369
+ <div class="item-item">${s.speed || c}</div>
370
+ </div>
371
+ <div class="item">
372
+ <div class="item-label">艏向</div>
373
+ <div class="item-item">${s.hdg || c}</div>
374
+ </div>
375
+ <div class="item">
376
+ <div class="item-label">航向</div>
377
+ <div class="item-item">${s.cog || c}</div>
378
+ </div>
379
+ <div class="item">
380
+ <div class="item-label">经度</div>
381
+ <div class="item-item">${s.lon || c}</div>
382
+ </div>
383
+ <div class="item">
384
+ <div class="item-label">纬度</div>
385
+ <div class="item-item">${s.lat || c}</div>
386
+ </div>
387
+ <div class="item w-100">
388
+ <div class="item-label">时间</div>
389
+ <div class="item-item">${s.time}</div>
390
+ </div>
391
+ ${d ?? d}
392
+ </div>`;
393
+ }, Q = (s) => {
394
+ const g = s.map((V) => {
395
+ const G = e.getPixelFromCoordinate(fromLonLat(V.center));
396
+ return {
397
+ ...V,
398
+ original: V,
399
+ pixel: G,
400
+ distance: 0
401
+ // 先初始化,后续计算
402
+ };
403
+ });
404
+ let x = 0;
405
+ g[0].distance = 0;
406
+ for (let V = 1; V < g.length; V++) {
407
+ const G = g[V - 1].pixel, W = g[V].pixel, q = W[0] - G[0], S = W[1] - G[1];
408
+ x += Math.sqrt(q * q + S * S), g[V].distance = x;
409
+ }
410
+ const E = g.filter(
411
+ (V, G) => G === 0 || G === g.length - 1
412
+ ), T = [];
413
+ for (let V = 0; V < E.length; V++) {
414
+ const G = E[V];
415
+ if (T.push(G), V < E.length - 1) {
416
+ const W = E[V + 1], q = W.distance - G.distance, S = Math.floor(q / 100);
417
+ for (let H = 1; H <= S; H++) {
418
+ const X = G.distance + H * 100;
419
+ if (X >= W.distance) break;
420
+ const K = U(
421
+ g,
422
+ X
423
+ );
424
+ K && T.push(K);
425
+ }
426
+ }
427
+ }
428
+ return Array.from(
429
+ new Map(T.map((V) => [V.distance.toFixed(2), V])).values()
430
+ ).map((V) => ({
431
+ ...V.original,
432
+ // 优先保留原始数据
433
+ ...V,
434
+ // 覆盖坐标等计算属性
435
+ coord: V.coord,
436
+ // 确保使用插值后的坐标
437
+ pixel: V.pixel,
438
+ distance: V.distance
439
+ }));
440
+ };
441
+ function U(s, d) {
442
+ for (let g = 1; g < s.length; g++) {
443
+ const x = s[g - 1], E = s[g];
444
+ if (d >= x.distance && d <= E.distance) {
445
+ const T = (d - x.distance) / (E.distance - x.distance), R = x.pixel[0] + T * (E.pixel[0] - x.pixel[0]), V = x.pixel[1] + T * (E.pixel[1] - x.pixel[1]), G = e == null ? void 0 : e.getCoordinateFromPixel([R, V]);
446
+ return {
447
+ ...x,
448
+ // 继承前一个点的属性(可调整)
449
+ coord: G,
450
+ pixel: [R, V],
451
+ distance: d,
452
+ original: void 0
453
+ // 明确标记为插值生成点
454
+ };
455
+ }
456
+ }
457
+ return null;
458
+ }
459
+ const le = async (s, d) => {
460
+ await ae(), await ge(s);
461
+ const g = Q(d), x = g.map((T) => I(T));
462
+ l.get(s).getSource().addFeatures(x), he(s, g, d, $), g.forEach((T) => {
463
+ const R = ee(s, $, T);
464
+ e.addOverlay(R);
465
+ });
466
+ }, I = (s) => {
467
+ const d = new Feature({
468
+ geometry: new Point(s.centerPoint),
469
+ data: s
470
+ });
471
+ d.set("type", "track_point"), d.set("trackId", s.id), d.set("data", s);
472
+ let g = [
473
+ ...fe(s, $)
474
+ ];
475
+ return (s.index === 0 || s.index === n[s.id].length - 1) && (g = [...me(s)], d.set("type", "track_begin")), s.state !== void 0 && s.state !== null && (g = [...ye(s)], d.set("type", "track_icon")), d.setStyle(g), d;
476
+ }, ee = (s, d, g) => {
477
+ const x = document.createElement("div");
478
+ x.className = "track-overlay-label", x.style.position = "relative", x.style.backgroundColor = "rgba(255,255,255,0.8)", x.style.border = `1px solid ${d}`, x.style.fontSize = "12px", x.innerHTML = `
479
+ <span>${g.time}</span>
480
+ <svg
481
+ style="position: absolute;left: -20px;top: 0;"
482
+ viewBox="0 0 20 20"
483
+ xmlns="http://www.w3.org/2000/svg"
484
+ width="20"
485
+ height="20">
486
+ <line x1="0" y1="20"
487
+ x2="20" y2="0"
488
+ stroke="${d}"
489
+ stroke-width="1" />
490
+ `;
491
+ const E = new Overlay({
492
+ element: x,
493
+ position: fromLonLat(g.center),
494
+ positioning: "top-left",
495
+ offset: [20, -20],
496
+ stopEvent: !1,
497
+ className: "track-label-time-overlay"
498
+ });
499
+ return E.set("class", "track-label-overlay"), E.set("trackId", s), E;
500
+ }, ae = () => {
501
+ const s = e == null ? void 0 : e.getOverlays().getArray(), d = s == null ? void 0 : s.filter((g) => g.get("class") === "track-label-overlay");
502
+ d && d.length > 0 && d.forEach((g) => {
503
+ g.setPosition(void 0), g.dispose();
504
+ });
505
+ }, ge = (s) => {
506
+ const d = l.get(s).getSource();
507
+ d.forEachFeature((g) => {
508
+ g.get("type") !== "line" && d.removeFeature(g);
509
+ });
510
+ }, fe = (s, d) => (`${s.time}`, [
511
+ new Style({
512
+ // 扩大交互热区
513
+ image: new CircleStyle({
514
+ stroke: new Stroke({ color: "rgba(0, 0, 0, 0.01)", width: 20 }),
515
+ radius: 3
516
+ })
517
+ }),
518
+ // 轨迹点样式
519
+ new Style({
520
+ image: new CircleStyle({
521
+ fill: new Fill({ color: d }),
522
+ stroke: new Stroke({ color: "#fff", width: 2 }),
523
+ radius: 3
524
+ })
525
+ })
526
+ // textStyle,
527
+ ]), ye = (s) => {
528
+ const d = "#E31818", g = "#1890FF", x = "&#xe6d2", E = new Style({
529
+ text: new Text({
530
+ font: "Normal 22px map-iconfont",
531
+ text: getIconFont(x),
532
+ offsetY: -10,
533
+ fill: new Fill({
534
+ color: Number(s.state) === 0 ? d : Number(s.state) === 1 ? g : ""
535
+ })
536
+ }),
537
+ zIndex: 99
538
+ }), R = getIconStyle("&#xe6e2;"), G = getIconStyle("&#xe703;"), W = [];
539
+ return Number(s.state) === 0 ? W.push(R) : Number(s.state) === 1 && W.push(G), W.push(E), W;
540
+ }, he = (s, d, g, x) => {
541
+ const E = d || [], T = d.length;
542
+ T || (E.push(g[0]), E.push(g[g.length - 1]));
543
+ const R = [];
544
+ for (let G = 0; G < T - 1; G++) {
545
+ let W;
546
+ const q = d[G], S = (d[G + 1].index + q.index) / 2;
547
+ if (S % 2 === 0)
548
+ W = g[S].centerPoint;
549
+ else {
550
+ const H = g[Math.floor(S)], X = g[Math.ceil(S)];
551
+ if (H && X) {
552
+ const [K, oe] = H.centerPoint, [re, ne] = X.centerPoint;
553
+ W = [(K + re) / 2, (oe + ne) / 2];
554
+ }
555
+ }
556
+ if (W) {
557
+ const H = new Feature({
558
+ geometry: new Point(W)
559
+ });
560
+ H.set("type", "track_arrow"), H.setStyle(
561
+ new Style({
562
+ text: new Text({
563
+ font: "700 12px map-iconfont",
564
+ text: getIconFont("&#xe6bc;"),
565
+ fill: new Fill({ color: x }),
566
+ // 设置箭头旋转 角度转为弧度
567
+ rotation: de(
568
+ d[G].center,
569
+ d[G + 1].center
570
+ ) * (Math.PI / 180)
571
+ })
572
+ })
573
+ ), R.push(H);
574
+ }
575
+ }
576
+ const V = l.get(s).getSource();
577
+ V == null || V.addFeatures(R);
578
+ }, ce = (s) => {
579
+ var T, R;
580
+ const d = e.getView(), g = (T = l == null ? void 0 : l.get(s)) == null ? void 0 : T.getSource(), x = b || (s ? g == null ? void 0 : g.getFeatureById(s) : null);
581
+ if (!x) return;
582
+ const E = (R = x == null ? void 0 : x.getGeometry()) == null ? void 0 : R.getExtent();
583
+ if (E != null && E.length)
584
+ try {
585
+ const V = buffer(E, Math.max(E[2] - E[0], E[3] - E[1]) * 0.02);
586
+ d.fit(V);
587
+ } catch (V) {
588
+ console.log(V);
589
+ }
590
+ }, me = (s) => {
591
+ const d = "&#xe69b;", E = s.index === 0 ? "#fcdc3f" : "#ff0000";
592
+ return [new Style({
593
+ text: new Text({
594
+ font: "Normal 14px map-iconfont",
595
+ text: getIconFont(d),
596
+ fill: new Fill({ color: E })
597
+ }),
598
+ zIndex: 101
599
+ })];
600
+ }, ve = () => {
601
+ console.log("清除所有的轨迹-----"), te(), l.forEach((d) => {
602
+ var g;
603
+ (g = d.getSource()) == null || g.clear(), e == null || e.removeLayer(d);
604
+ }), Object.keys(n).forEach((d) => {
605
+ l.delete(d), delete n[d];
606
+ }), Z = !1, ae();
607
+ }, we = (s) => {
608
+ const d = l.get(s || i);
609
+ d == null || d.setVisible(!1);
610
+ const g = e.getOverlays().getArray();
611
+ for (let x = 0; x < g.length; ) {
612
+ const E = g[x];
613
+ E.get("class") === "track-label-overlay" ? (E.setPosition(void 0), e.removeOverlay(E)) : x++;
614
+ }
615
+ te();
616
+ }, pe = (s, d = LENGTH_UNIT.NM) => {
617
+ const g = {
618
+ id: s,
619
+ length: "--"
620
+ }, E = (n[s] || []).map(
621
+ (R) => transform([R.lon, R.lat], projection.data, projection.mercator)
622
+ ), T = new LineString(E);
623
+ return g.length = formatLength(T, d) || "--", g;
624
+ }, Le = (s, d) => {
625
+ xe(String(s), d);
626
+ }, xe = (s, d) => {
627
+ const g = n[String(s)], x = g == null ? void 0 : g.map((E) => [E.lon, E.lat]);
628
+ x && ke(x, d);
629
+ }, ie = new Style({
630
+ text: new Text({
631
+ font: "700 20px map-iconfont",
632
+ text: getIconFont("&#xe657;"),
633
+ fill: new Fill({ color: "#ff0000" }),
634
+ rotation: 0
635
+ // 初始旋转角度
636
+ })
637
+ }), Me = (s, d) => {
638
+ var S, H;
639
+ const g = Number(50 * d), x = ((S = s.frameState) == null ? void 0 : S.time) ?? Date.now(), E = x - v;
640
+ if (C = (C + g * E / 1e6) % 2, v = x, C >= 1) {
641
+ te();
642
+ return;
643
+ }
644
+ const T = r.getCoordinateAt(
645
+ C > 1 ? 2 - C : C
646
+ ), R = r.getCoordinateAt(
647
+ C > 1 ? C - 0.01 : C
648
+ ), V = r.getCoordinateAt(
649
+ C > 1 ? 2 - C : C + 0.01
650
+ ), W = de(
651
+ mercatorToLonLat(R, "array"),
652
+ mercatorToLonLat(V, "array")
653
+ ) * Math.PI / 180;
654
+ (H = ie.getText()) == null || H.setRotation(W), m.setCoordinates(T);
655
+ const q = getVectorContext(s);
656
+ q.setStyle(ie), q.drawGeometry(m), e == null || e.render();
657
+ }, be = () => {
658
+ var s;
659
+ N = !0, v = Date.now(), C = 0, m = ((s = p.getGeometry()) == null ? void 0 : s.clone()) || new Point([0, 0]), o && (w == null || w.on("postrender", o)), F == null || F.setGeometry(void 0);
660
+ }, te = () => {
661
+ N && (N = !1, F == null || F.setGeometry(void 0), o && w && w.un("postrender", o), w && (e == null || e.removeLayer(w)), w = null, F = null);
662
+ }, ke = (s, d) => {
663
+ N && te(), t = new Polyline({
664
+ factor: 1e6
665
+ }).writeGeometry(new LineString(s)), r = new Polyline({
666
+ factor: 1e6
667
+ }).readGeometry(t, {
668
+ dataProjection: projection.data,
669
+ featureProjection: projection.mercator
670
+ }), p = new Feature({
671
+ type: "icon",
672
+ geometry: new Point(r.getFirstCoordinate())
673
+ });
674
+ const g = p.getGeometry();
675
+ m = g ? g.clone() : new Point([0, 0]), F = new Feature({
676
+ type: "geoMarker",
677
+ style: ie,
678
+ geometry: m
679
+ }), w = new VectorLayer({
680
+ source: new VectorSource({
681
+ features: [F]
682
+ })
683
+ }), e == null || e.addLayer(w), o = (x) => Me(x, d), be();
684
+ }, de = (s, d, g) => {
685
+ function x(S) {
686
+ return 180 * (S % (2 * Math.PI)) / Math.PI;
687
+ }
688
+ function E(S) {
689
+ return S % 360 * Math.PI / 180;
690
+ }
691
+ function T(S) {
692
+ var H;
693
+ if (!S) throw new Error("Coordinate is required");
694
+ if (!Array.isArray(S)) {
695
+ if ((S == null ? void 0 : S.type) === "Feature" && (S == null ? void 0 : S.geometry) !== null && ((H = S == null ? void 0 : S.geometry) == null ? void 0 : H.type) === "Point")
696
+ return S == null ? void 0 : S.geometry.coordinates;
697
+ if (S.type === "Point") return (S == null ? void 0 : S.coordinates) || [];
698
+ }
699
+ if (Array.isArray(S) && S.length >= 2 && !Array.isArray(S[0]) && !Array.isArray(S[1]))
700
+ return S;
701
+ throw new Error(
702
+ "Coordinate must be GeoJSON Point or an Array of numbers"
703
+ );
704
+ }
705
+ function R(S, H, X = {}) {
706
+ if (X.final)
707
+ return function(Te, Se) {
708
+ return (R(Se, Te) + 180) % 360;
709
+ }(S, H);
710
+ const K = T(S), oe = T(H), re = E(K[0]), ne = E(oe[0]), ue = E(K[1]), se = E(oe[1]), Ce = Math.sin(ne - re) * Math.cos(se), Ee = Math.cos(ue) * Math.sin(se) - Math.sin(ue) * Math.cos(se) * Math.cos(ne - re);
711
+ return x(Math.atan2(Ce, Ee));
712
+ }
713
+ function V(S) {
714
+ return !isNaN(S) && S !== null && !Array.isArray(S);
715
+ }
716
+ function G(S, H = {}, X = {}) {
717
+ return S || console.log("Coordinates are required"), Array.isArray(S) || console.log("Coordinates must be an Array"), S.length < 2 && console.log("Coordinates must be at least 2 numbers long"), (!V(S[0]) || !V(S[1])) && console.log("Coordinates must contain numbers"), W({ type: "Point", coordinates: S }, H, X);
718
+ }
719
+ function W(S, H = {}, X = {}) {
720
+ const K = {
721
+ type: "Feature",
722
+ id: "",
723
+ properties: {},
724
+ bbox: {},
725
+ geometry: {}
726
+ };
727
+ return X.id !== void 0 && (K.id = X.id), X.bbox && (K.bbox = X.bbox), K.properties = H, K.geometry = S, K;
728
+ }
729
+ const q = R(G(s), G(d), g);
730
+ return q < 0 ? 360 + q : q;
731
+ };
732
+ return {
733
+ render: f,
734
+ remove: ve,
735
+ play: Le,
736
+ setCenter: ce,
737
+ close: we,
738
+ getLength: pe,
739
+ handleTrackMapEvent: _,
740
+ reRenderTrackLine: a
741
+ };
742
+ };
743
+ function useShipOverlay(e) {
744
+ console.log("useShipOverlay", e);
745
+ const l = ref(null), n = computed(() => ({
746
+ "--overlay-color": "#FFF",
747
+ "--bg-color1": e.colors && e.colors[0] ? e.colors[0] : "#ffffff",
748
+ // 默认第一个颜色
749
+ "--bg-color2": e.colors && e.colors[1] ? e.colors[1] : "#ffffff",
750
+ "--bg-color": "#ffffff",
751
+ position: "relative",
752
+ "pointer-events": "none"
753
+ })), i = computed(() => {
754
+ var y;
755
+ return {
756
+ position: "relative",
757
+ "border-radius": "1px",
758
+ "background-color": "var(--content-bg)",
759
+ color: "#000",
760
+ padding: "2px 5px 2px 0px",
761
+ font: "500 Normal 12px",
762
+ "font-size": "12px",
763
+ "box-shadow": "0 2px 10px rgba(0, 0, 0, 0.2)",
764
+ "white-space": "nowrap",
765
+ border: "1px solid #FFF",
766
+ "pointer-events": "auto",
767
+ // 'transition': 'background-color 0.5s ease, border 0.5s ease',
768
+ "z-index": "1",
769
+ display: "flex",
770
+ "align-items": "center",
771
+ animation: e.selected ? e.colors && ((y = e.colors) == null ? void 0 : y.length) >= 2 ? "blink-dual 2s ease-in-out infinite" : "blink-single 1.5s ease-in-out infinite" : "none"
772
+ // "animation": props.selected ? 'blink 1.5s ease-in-out infinite' : 'none', // 动画开关
773
+ };
774
+ }), c = computed(() => ({
775
+ width: "14px",
776
+ height: "14px",
777
+ margin: "1px 5px 1px 1px",
778
+ "background-color": "var(--attention-bg)"
779
+ })), o = computed(() => ({
780
+ position: "absolute",
781
+ top: "0px",
782
+ color: "var(--overlay-color)",
783
+ "pointer-events": "none",
784
+ transform: "translateY(-1px)",
785
+ "z-index": "0",
786
+ width: "20px",
787
+ height: "20px",
788
+ overflow: "visible",
789
+ left: "-20px"
790
+ }));
791
+ return () => h("div", {
792
+ ref: l,
793
+ class: "ship-overlay-container",
794
+ style: n.value
795
+ }, [
796
+ h(
797
+ "div",
798
+ {
799
+ class: "ship-overlay-content",
800
+ style: i.value
801
+ },
802
+ [
803
+ h("div", {
804
+ style: e.selected ? c.value : {}
805
+ }, ""),
806
+ h("div", {
807
+ class: "text",
808
+ style: {
809
+ fontSize: "12px",
810
+ fontWeight: 500,
811
+ fontFamily: "Arial"
812
+ }
813
+ }, e.name || "未命名船舶"),
814
+ h("div", {
815
+ class: "icons",
816
+ style: {
817
+ color: "#3370ff"
818
+ }
819
+ }, [
820
+ e.existDevice ? h("i", {
821
+ class: "map-iconfont icon-camera",
822
+ style: {
823
+ fontSize: "12px"
824
+ }
825
+ }) : "",
826
+ e.existMobile ? h("i", {
827
+ class: "map-iconfont icon-tele",
828
+ style: {
829
+ fontSize: "12px"
830
+ }
831
+ }) : "",
832
+ e.existWaterGauge ? h("i", {
833
+ class: "map-iconfont icon-ruler",
834
+ style: {
835
+ fontSize: "12px"
836
+ }
837
+ }) : ""
838
+ ])
839
+ ]
840
+ ),
841
+ h("svg", {
842
+ class: "ship-overlay-line",
843
+ style: o.value,
844
+ viewBox: "0 0 20 20",
845
+ xmlns: "http://www.w3.org/2000/svg"
846
+ }, [
847
+ h("line", {
848
+ x1: "0",
849
+ y1: "20",
850
+ x2: "20",
851
+ y2: "4",
852
+ stroke: "white",
853
+ "stroke-width": "1"
854
+ })
855
+ ])
856
+ ]);
857
+ }
858
+ ref([]);
859
+ function addOverlay(e, l, n, i) {
860
+ if (l) {
861
+ const c = new Overlay({
862
+ element: n,
863
+ positioning: "top-left",
864
+ id: "label-" + (i == null ? void 0 : i.id),
865
+ offset: [20, -20],
866
+ autoPan: !1,
867
+ position: l,
868
+ className: i.blinking ? "ship-label-overlay-blinking" : "ship-label-overlay"
869
+ });
870
+ c.set("class", "zh-map-ship-overlay"), e.addOverlay(c);
871
+ }
872
+ }
873
+ const getShipDirectPath = (e) => {
874
+ const { spd: l, hdg: n, cog: i } = e;
875
+ return l ? n !== null && +n != 511 && i !== null ? i - +n >= 3 ? SHIP_DIRECT.right : i - +n <= -3 ? SHIP_DIRECT.left : SHIP_DIRECT.front : SHIP_DIRECT.front : "";
876
+ }, createShipStyle = (e, l) => {
877
+ const { shipData: n } = l.getProperties(), i = getShipType(e), c = getShipScale(e, n, i);
878
+ return initShipStyle(l, c, i);
879
+ }, getShipType = (e) => {
880
+ const l = e == null ? void 0 : e.getView().getZoom();
881
+ return l <= MAP_ZOOM.shipModelMax && l >= MAP_ZOOM.shipTriggleMin ? "ship" : "triangle";
882
+ }, getShipScale = (e, l, n) => {
883
+ if (n === "ship") {
884
+ const { len: i, wid: c } = l, o = 97, y = 20, t = 1 / (e == null ? void 0 : e.getView().getResolution()), r = i * t / o, p = c * t / y, m = Math.min(r, p);
885
+ return m < 0.2 ? 0.2 : m > 2 ? 2 : m;
886
+ }
887
+ return MAP_ZOOM.scaleNum;
888
+ }, initShipStyle = (e, l, n) => {
889
+ const { color: i, direct: c, isHighlight: o, shipData: y } = e.getProperties(), M = ((y == null ? void 0 : y.cog) - 90 + 360) % 360;
890
+ return new Style({
891
+ image: new Icon({
892
+ src: t(),
893
+ scale: l || MAP_ZOOM.scaleNum,
894
+ anchor: [0.5, 0.5],
895
+ rotation: M * Math.PI / 180,
896
+ rotateWithView: !1
897
+ })
898
+ });
899
+ function t() {
900
+ return `data:image/svg+xml;utf8,${encodeURIComponent(r())}`;
901
+ }
902
+ function r() {
903
+ switch (n) {
904
+ case "triangle":
905
+ return `<svg width="41" height="24" viewBox="0 0 41 24" fill="none" xmlns="http://www.w3.org/2000/svg">
906
+ <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"
907
+ fill="${i}" stroke="${o ? "#FF2424" : "black"}" stroke-width="${o ? "2" : "0.578947"}" />
908
+ <!--path船航向左边或者向前-->
909
+ ${c === SHIP_DIRECT.left && `<path d="M30 12L40 12L40 8" stroke="${o ? "#FF2424" : "black"}" stroke-width="2"/>`}
910
+ <!--path船航向右边-->
911
+ ${c === SHIP_DIRECT.right && `<path d="M30 12L40 12L40 16" stroke="${o ? "#FF2424" : "black"}" stroke-width="2"/>`}
912
+ <!--path黑线无左右-->
913
+ ${c === SHIP_DIRECT.front && `<path d="M30 12L40 12" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
914
+ </svg>
915
+ `;
916
+ case "ship":
917
+ return `<svg width="97" height="20" viewBox="0 0 97 20" fill="none" xmlns="http://www.w3.org/2000/svg">
918
+ <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"
919
+ fill="${i}" stroke="${o ? "#FF2424" : "black"}" stroke-width="${o ? "4" : "0.578947"}"/>
920
+ ${c === SHIP_DIRECT.left && `<path d="M86 10L96 10L96 6" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
921
+ ${c === SHIP_DIRECT.right && `<path d="M86 10L96 10L96 14" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
922
+ ${c === SHIP_DIRECT.front && `<path d="M86 10L96 10" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
923
+ </svg>
924
+ `;
925
+ default:
926
+ return "";
927
+ }
928
+ }
929
+ }, selectedShipStyle = (e, l) => {
930
+ const n = selectedShipElement(e, l), i = l.id, { lon: c, lat: o } = l, y = new Overlay({
931
+ element: n,
932
+ position: fromLonLat([c, o]),
933
+ id: "selected-" + i,
934
+ positioning: "center-center",
935
+ offset: [0, 5],
936
+ className: "ship-selected-overlay"
937
+ });
938
+ return y.set("class", "ship-overlay-selected"), y;
939
+ }, selectedShipElement = (e, l) => {
940
+ const n = getShipType(e), i = getShipScale(e, l, n), c = n === "ship" ? 109 : 49, o = `
941
+ <svg style="transform:scale(${i});" xmlns="http://www.w3.org/2000/svg" width="${c}" height="${c}" viewBox="0 0 49 49" fill="none">
942
+ <path d="M1.99982 46.9998L1.99982 1.99982L46.9998 1.99982L46.9998 46.9998L1.99982 46.9998Z" fill="#FF2424" fill-opacity="0.2"/>
943
+ <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"/>
944
+ </svg>
945
+ `, y = document.createElement("div");
946
+ return y.className = "ship-overlay-selected", y.innerHTML = o, y;
947
+ }, createLabelStyle = (e, l) => {
948
+ const { lon: n, lat: i, blinking: c } = l, o = createLabelElement(l);
949
+ n && i && addOverlay(e, fromLonLat([n, i]), o, { ...l, blinking: c });
950
+ }, createLabelElement = (e) => {
951
+ const l = document.createElement("div");
952
+ l.className = "ship-overlay-box", l.style.position = "relative";
953
+ const { lon: n, lat: i, blinking: c, blinkingColors: o, name: y } = e, M = createVNode({
954
+ setup() {
955
+ return useShipOverlay({
956
+ position: [n + 2e-3, i + 2e-3],
957
+ selected: c,
958
+ name: y,
959
+ colors: o || [],
960
+ existDevice: e == null ? void 0 : e.existDevice,
961
+ existMobile: e == null ? void 0 : e.existMobile,
962
+ existWaterGauge: e == null ? void 0 : e.existWaterGauge
963
+ });
964
+ }
965
+ });
966
+ return render(M, l), l;
967
+ }, getRightIcons = (e) => {
968
+ const l = [];
969
+ return e.existDevice && l.push("&#xe687;"), e.existMobile && l.push("&#xe688;"), e.existWaterGauge && l.push("&#xe686;"), l;
970
+ };
971
+ function getRandomLineDirection() {
972
+ const e = [
973
+ "left-top",
974
+ "left-middle",
975
+ "left-bottom",
976
+ "right-top",
977
+ "right-middle",
978
+ "right-bottom"
979
+ ];
980
+ return e[Math.floor(Math.random() * e.length)];
981
+ }
982
+ const devicePixelRatio = window.devicePixelRatio || 1;
983
+ function generateBase64Icon(e, l, n = "left-bottom", i = 2) {
984
+ const c = document.createElement("canvas"), o = c.getContext("2d");
985
+ if (!o) return "";
986
+ const y = 2, M = 8, t = 16, r = window.devicePixelRatio || 1, p = "500 12px Arial", m = "14px map-iconfont";
987
+ o.font = p;
988
+ const N = o.measureText(e).width;
989
+ o.font = m;
990
+ const v = l.map((k) => ({ width: o.measureText(getIconFont(k)).width, height: 14 })), w = v.reduce((k, O) => k + O.width, 0), C = (l.length - 1) * i, b = M + N + w + C + M, L = y + 14 + y * 2;
991
+ let Z, B, Y = 0, j = 0, $ = 0, z = 0, a = 0, u = 0;
992
+ switch (Z = t + b, n) {
993
+ case "right-top":
994
+ B = t + L, Y = 0, j = t + L, $ = t, z = 0, a = t, u = 0;
995
+ break;
996
+ case "right-middle":
997
+ B = L, Y = 0, j = L / 2, $ = t, z = L / 2, a = t, u = 0;
998
+ break;
999
+ case "right-bottom":
1000
+ B = t + L, Y = 0, j = 0, $ = t, z = t, a = t, u = t;
1001
+ break;
1002
+ case "left-top":
1003
+ B = t + L, Y = b, j = t, $ = b + t, z = L + t, a = 0, u = 0;
1004
+ break;
1005
+ case "left-middle":
1006
+ B = L, Y = b, j = L / 2, $ = b + t, z = L / 2, a = 0, u = 0;
1007
+ break;
1008
+ case "left-bottom":
1009
+ B = t + L, Y = b, j = L, $ = b + t, z = 0, a = 0, u = t;
1010
+ break;
1011
+ }
1012
+ c.width = Math.round(Z * r), c.height = Math.round(B * r), o.scale(r, r), o.clearRect(0, 0, Z, B), o.beginPath(), o.moveTo(Y, j), o.lineTo($, z), o.strokeStyle = "#FFF", o.lineWidth = 1, o.stroke(), o.fillStyle = "#FFF", o.fillRect(a, u, b, L), o.font = p, o.textBaseline = "middle";
1013
+ const f = u + y + L / 2;
1014
+ o.strokeStyle = "#ffffff", o.lineWidth = 1, o.strokeText(e, a + M, f), o.fillStyle = "#000000", o.fillText(e, a + M, f), o.font = m, o.fillStyle = "#3370ff";
1015
+ let P = a + M + N + i;
1016
+ return l.length > 0 && l.forEach((k, O) => {
1017
+ const D = u + y + L / 2;
1018
+ o.fillText(getIconFont(k), P, D), P += v[O].width + i;
1019
+ }), c.toDataURL("image/png");
1020
+ }
1021
+ const createLabelFeatureStyle = (e) => {
1022
+ const { name: l, rightIcons: n, selected: i } = e.getProperties(), c = getRandomLineDirection(), o = generateBase64Icon(l, n, c);
1023
+ let y = [0, 0];
1024
+ switch (c) {
1025
+ case "right-top":
1026
+ y = [0, 1];
1027
+ break;
1028
+ case "right-middle":
1029
+ y = [0, 0.5];
1030
+ break;
1031
+ case "right-bottom":
1032
+ y = [0, 0];
1033
+ break;
1034
+ case "left-top":
1035
+ y = [1, 1];
1036
+ break;
1037
+ case "left-middle":
1038
+ y = [1, 0.5];
1039
+ break;
1040
+ case "left-bottom":
1041
+ y = [1, 0];
1042
+ break;
1043
+ }
1044
+ return new Style({
1045
+ image: new Icon({
1046
+ src: o,
1047
+ anchor: y,
1048
+ displacement: [0, 0],
1049
+ scale: 1 / devicePixelRatio,
1050
+ anchorXUnits: "fraction",
1051
+ anchorYUnits: "fraction"
1052
+ }),
1053
+ zIndex: i ? 100 : 10
1054
+ });
1055
+ }, useShipManager = (e) => {
1056
+ let l = null, n = null;
1057
+ const i = new VectorSource(), c = new VectorImageLayer({
1058
+ source: i,
1059
+ className: "zh-map--ship-layer",
1060
+ renderBuffer: 300,
1061
+ zIndex: 101
1062
+ }), o = new VectorSource(), y = new VectorLayer({
1063
+ source: o,
1064
+ className: "zh-map--ship-label-layer",
1065
+ zIndex: 102,
1066
+ updateWhileInteracting: !1,
1067
+ updateWhileAnimating: !1,
1068
+ declutter: !0
1069
+ });
1070
+ e == null || e.addLayer(c), e == null || e.addLayer(y);
1071
+ let M = null, t = "", r = {}, p = {};
1072
+ const m = (a) => {
1073
+ if (!a || !e) return;
1074
+ const u = (n == null ? void 0 : n.id) || (l == null ? void 0 : l.get("id"));
1075
+ if (n) {
1076
+ const f = a.filter((P) => P.id === u);
1077
+ f.length === 0 ? a.push(n) : n = f[0];
1078
+ }
1079
+ w(), C(!0), z(a), N();
1080
+ }, F = (a) => {
1081
+ var _;
1082
+ const u = (n == null ? void 0 : n.id) || (l == null ? void 0 : l.get("id")), f = fromLonLat([a == null ? void 0 : a.lon, a == null ? void 0 : a.lat]), P = ((_ = p[a.id]) == null ? void 0 : _.blinkColors) || [], O = P[P.length - 1] || a.fill || "#04C900", D = getShipDirectPath(a), A = new Feature({
1083
+ geometry: new Point(f),
1084
+ // 船舶数据
1085
+ shipData: a,
1086
+ id: a.id,
1087
+ name: a.cnname || a.enname || a.id || "未命名船舶",
1088
+ selected: a.id === u,
1089
+ // 图标
1090
+ rightIcons: getRightIcons(a),
1091
+ // 是否闪烁
1092
+ // blinking: attentionShips[ship.id] || false,
1093
+ // // 闪烁颜色
1094
+ // blinkingColor: attentionShipsColor[ship.id].blinkColors || '',
1095
+ // 船舶颜色
1096
+ color: O,
1097
+ // 船艏向的方向
1098
+ direct: D,
1099
+ // 高亮
1100
+ isHighlight: !1
1101
+ });
1102
+ return A.set("clickGeometry", new Circle(f)), A;
1103
+ }, N = async () => {
1104
+ if (!n || !e) return;
1105
+ let u = e.getOverlays().getArray().find((f) => f.get("class") == "ship-overlay-selected");
1106
+ if (console.log("selectedOverlay----------", u), u) {
1107
+ const f = selectedShipElement(e, n);
1108
+ await u.setElement(f), await u.setPosition(fromLonLat([n.lon, n.lat]));
1109
+ } else
1110
+ u = selectedShipStyle(e, n), u && e.addOverlay(u);
1111
+ setTimeout(() => {
1112
+ var f;
1113
+ u && ((f = u.get("element")) != null && f.parentElement) && (u.get("element").parentElement.style.display = "block");
1114
+ }, 20);
1115
+ }, v = (a) => {
1116
+ if (a === "start") {
1117
+ const u = () => {
1118
+ i.getFeatures().forEach((f) => {
1119
+ f.setStyle(createShipStyle(e, f));
1120
+ }), M = requestAnimationFrame(u);
1121
+ };
1122
+ u();
1123
+ } else
1124
+ M && (cancelAnimationFrame(M), M = null);
1125
+ }, w = () => {
1126
+ e && i && (i.clear(), o.clear(), C());
1127
+ }, C = (a) => {
1128
+ const u = e.getOverlays().getArray().filter((f) => f.get("class") == "zh-map-ship-overlay");
1129
+ if (u && u.length > 0) {
1130
+ for (let f = 0; f < u.length; f++)
1131
+ if (!a && u[f].get("class") !== "ship-overlay-selected") {
1132
+ const P = u[f];
1133
+ P.setPosition(void 0), e.removeOverlay(P), P.dispose();
1134
+ }
1135
+ }
1136
+ }, b = (a, u) => {
1137
+ r = a, p = u, console.log("attentionShips", r, "attentionShipsColor", u);
1138
+ const f = e.getOverlays().getArray(), P = i.getFeatures();
1139
+ for (const k in r) {
1140
+ const O = r[k], D = f.find((_) => _.getId() === "label-" + k), A = P.find((_) => k === _.get("id"));
1141
+ if (D && A) {
1142
+ const _ = u[k].blinkColors || [], { shipData: J, name: Q, color: U } = A == null ? void 0 : A.getProperties();
1143
+ A.set("blinking", O), _[(_ == null ? void 0 : _.length) - 1] && U !== _[(_ == null ? void 0 : _.length) - 1] && (A.set("color", _[(_ == null ? void 0 : _.length) - 1] || ""), A.setStyle(createShipStyle(e, A)));
1144
+ const le = {
1145
+ ...J,
1146
+ blinking: O,
1147
+ blinkingColors: _ || [],
1148
+ name: Q + "(" + u[k].shipState + ")"
1149
+ }, I = D.getElement(), ee = createLabelElement(le);
1150
+ I && I !== ee && D.setElement(ee);
1151
+ }
1152
+ }
1153
+ }, L = (a) => {
1154
+ if (!e) return;
1155
+ const u = i.getFeatures(), f = o.getFeatures(), P = l ? l.get("id") : "", k = u.filter((_) => _.get("id") !== P), O = f == null ? void 0 : f.filter((_) => _.get("id") !== P), D = /* @__PURE__ */ new Map();
1156
+ a.forEach((_) => {
1157
+ D.set(_.id, !0);
1158
+ });
1159
+ const A = e.getOverlays().getArray();
1160
+ k.forEach((_) => {
1161
+ const J = _.get("id");
1162
+ if (!D.has(J))
1163
+ _.setStyle([]);
1164
+ else {
1165
+ const U = _.getStyle();
1166
+ (U == null ? void 0 : U.length) == 0 && _.setStyle(createShipStyle(e, _));
1167
+ }
1168
+ const Q = A.find((U) => U.getId() === "label-" + J);
1169
+ Q && Q.setPosition(void 0);
1170
+ }), console.log(O), O.forEach((_) => {
1171
+ const J = _.get("id");
1172
+ if (!D.has(J))
1173
+ _.setStyle([]);
1174
+ else {
1175
+ const Q = _.getStyle();
1176
+ (Q == null ? void 0 : Q.length) == 0 && _.setStyle(createLabelFeatureStyle(_));
1177
+ }
1178
+ });
1179
+ }, Z = (a) => {
1180
+ if (a) {
1181
+ console.log("选中", a);
1182
+ const u = i.getFeatures().find((P) => P.get("id") === a.id), f = o.getFeatures().find((P) => P.get("id") === a.id);
1183
+ u && (l = u), f && f.set("selected", !0), n = a, N();
1184
+ } else
1185
+ console.log("取消选中"), n = null, l = null, j();
1186
+ }, B = debounce((a, u, f) => {
1187
+ if (a) {
1188
+ const P = a.get("shipData"), k = a.get("id");
1189
+ if (e.getTargetElement().style.cursor = k ? "pointer" : "", u === "click" && (Z(P), f && f(k)), u === "hover") {
1190
+ t && t !== k && Y(), t = k;
1191
+ const O = i.getFeatures().find((D) => D.get("id") === t);
1192
+ O == null || O.set("isHighlight", !0), O == null || O.setStyle(createShipStyle(e, O));
1193
+ }
1194
+ } else
1195
+ e.getTargetElement().style.cursor = "", Y();
1196
+ }, 10), Y = () => {
1197
+ const a = t ? i.getFeatures().find((u) => u.get("id") === t) : null;
1198
+ t = null, a == null || a.set("isHighlight", !1), a == null || a.setStyle(createShipStyle(e, a));
1199
+ }, j = () => {
1200
+ try {
1201
+ const u = e.getOverlays().getArray().find((f) => f.get("class") == "ship-overlay-selected");
1202
+ u && u.setPosition(void 0);
1203
+ } catch (a) {
1204
+ console.log(a);
1205
+ }
1206
+ }, $ = (a) => {
1207
+ const u = fromLonLat([a == null ? void 0 : a.lon, a == null ? void 0 : a.lat]), f = new Feature({
1208
+ geometry: new Point(u),
1209
+ name: a.cnname || a.enname || a.id || "未命名船舶",
1210
+ // 图标
1211
+ rightIcons: getRightIcons(a),
1212
+ selected: (a == null ? void 0 : a.id) === (n == null ? void 0 : n.id),
1213
+ shipData: a
1214
+ });
1215
+ f.set("id", a.id);
1216
+ const P = createLabelFeatureStyle(f);
1217
+ return f.setStyle(P), f;
1218
+ }, z = (a) => {
1219
+ const u = e.getView().getZoom();
1220
+ a.forEach((f) => {
1221
+ const P = F(f);
1222
+ if (P.setStyle(createShipStyle(e, P)), i.addFeature(P), (n == null ? void 0 : n.id) == f.id || u >= MAP_ZOOM.shipModelMin)
1223
+ if (r[f.id]) {
1224
+ if (f.id && p[f == null ? void 0 : f.id]) {
1225
+ const k = p[f == null ? void 0 : f.id] || {}, O = (k == null ? void 0 : k.blinkColors) || [], D = (k == null ? void 0 : k.shipState) || "", A = (f.cnname || f.enname || f.id || "未命名船舶") + "(" + D + ")", _ = {
1226
+ ...f,
1227
+ name: A,
1228
+ blinking: r[f.id],
1229
+ blinkingColors: O || []
1230
+ };
1231
+ createLabelStyle(e, _);
1232
+ }
1233
+ } else {
1234
+ const k = $(f);
1235
+ o.addFeature(k);
1236
+ }
1237
+ });
1238
+ };
1239
+ return {
1240
+ render: m,
1241
+ selected: Z,
1242
+ filter: L,
1243
+ blinking: b,
1244
+ clear: w,
1245
+ handleShipMapEvent: B,
1246
+ changeShipScale: v
1247
+ };
1248
+ }, useLayerManager = (e) => {
1249
+ const l = () => e == null ? void 0 : e.getLayers(), n = ref("vector"), i = () => n.value, c = (t) => {
1250
+ n.value = t;
1251
+ const r = l();
1252
+ r && (r == null || r.getArray().forEach((p) => {
1253
+ (p.className_ === "vector" || p.className_ === "satellite") && p.setVisible(p.className_ === t);
1254
+ }));
1255
+ }, o = ref(!1);
1256
+ return {
1257
+ getLayers: l,
1258
+ getGreenTileVisible: () => o.value,
1259
+ setGreenTileVisible: (t) => {
1260
+ if (t !== o.value) {
1261
+ if (t) {
1262
+ const r = l();
1263
+ if (!r.getArray().find((m) => m.className_ === "greenTile")) {
1264
+ const m = new TileLayer({
1265
+ source: new XYZ({ url: BASE_MAP_LINK.greenTile }),
1266
+ visible: t,
1267
+ zIndex: 2,
1268
+ className: "greenTile"
1269
+ });
1270
+ r.push(m);
1271
+ }
1272
+ } else {
1273
+ const r = l(), p = r.getArray().find((m) => m.className_ === "greenTile");
1274
+ p && r.remove(p);
1275
+ }
1276
+ o.value = t;
1277
+ }
1278
+ },
1279
+ getShowLayerType: i,
1280
+ setShowLayerType: c
1281
+ };
1282
+ }, usePropsManager = () => {
1283
+ const e = ref();
1284
+ return {
1285
+ setProps: (i) => {
1286
+ e.value = i;
1287
+ },
1288
+ getProps: () => e.value
1289
+ };
1290
+ }, usePositionManager = (e) => {
1291
+ const l = "zh-map-location-layer";
1292
+ let n, i, c = null, o = null;
1293
+ const y = (v) => {
1294
+ if (!(!v || v.length === 0)) {
1295
+ if (i || (i = new VectorSource()), i.clear(), o) {
1296
+ const w = v.find((C) => C.id === o.id);
1297
+ w ? o = w : v.push(o);
1298
+ }
1299
+ v.forEach((w) => {
1300
+ M(w);
1301
+ }), n || (n = new VectorLayer({
1302
+ className: l,
1303
+ source: i,
1304
+ zIndex: 100
1305
+ }), e == null || e.addLayer(n));
1306
+ }
1307
+ }, M = (v) => {
1308
+ const w = e == null ? void 0 : e.getView().getZoom(), [C, b] = v.latLon.split(","), L = new Feature({
1309
+ geometry: new Point(fromLonLat([Number(C), Number(b)]))
1310
+ });
1311
+ L.setStyle(t(v, w, v.id === (o == null ? void 0 : o.id))), L.set("loactionData", v), i.addFeature(L);
1312
+ }, t = (v, w, C) => {
1313
+ const b = {
1314
+ image: new Icon({
1315
+ src: C && v.selectedPath || v.defaultPath,
1316
+ scale: 0.5 * w / 10
1317
+ })
1318
+ };
1319
+ return v.name && (b.text = new Text({
1320
+ text: v.name,
1321
+ font: "12px sans-serif",
1322
+ fill: new Fill({
1323
+ color: "#000000"
1324
+ }),
1325
+ backgroundFill: new Fill({
1326
+ color: "#FFFFFF"
1327
+ }),
1328
+ offsetY: 30
1329
+ })), new Style(b);
1330
+ }, r = () => {
1331
+ if (c) {
1332
+ const v = c.get("loactionData").id;
1333
+ i.getFeatures().forEach((w) => {
1334
+ w.get("loactionData").id !== v && i.removeFeature(w);
1335
+ });
1336
+ } else
1337
+ i.clear();
1338
+ }, p = () => {
1339
+ var b;
1340
+ const v = c.get("loactionData"), w = (b = e == null ? void 0 : e.getView()) == null ? void 0 : b.getZoom();
1341
+ i.getFeatures().forEach((L) => {
1342
+ L.get("loactionData").id === v.id && (L == null || L.setStyle(t(v, w, !1)));
1343
+ }), o = null, c = null;
1344
+ }, m = (v) => {
1345
+ v ? (F(), N(v)) : clearSelectedPort();
1346
+ }, F = () => {
1347
+ var v;
1348
+ if (c) {
1349
+ const w = c.get("loactionData"), C = (v = e == null ? void 0 : e.getView()) == null ? void 0 : v.getZoom();
1350
+ c.setStyle(t(w, C, !1));
1351
+ }
1352
+ }, N = (v) => {
1353
+ const w = i.getFeatures();
1354
+ o = v, c = w.find((C) => C.get("loactionData").id === v.id);
1355
+ };
1356
+ return {
1357
+ render: y,
1358
+ selected: m,
1359
+ clearSelected: p,
1360
+ clear: r
1361
+ };
1362
+ }, disableDoubleClickZoom = (e) => {
1363
+ e.getInteractions().forEach((l) => {
1364
+ l instanceof DoubleClickZoom && l.setActive(!1);
1365
+ });
1366
+ }, enableDoubleClickZoom = (e) => {
1367
+ e.getInteractions().forEach((l) => {
1368
+ l instanceof DoubleClickZoom && l.setActive(!0);
1369
+ });
1370
+ }, changeCursor = (e, l) => {
1371
+ const n = e.getViewport();
1372
+ n && (n.style.cursor = l);
1373
+ }, useDrawLineManager = (e, l) => {
1374
+ const n = ref([]), i = ref("km"), c = (a) => {
1375
+ i.value = a;
1376
+ };
1377
+ let o;
1378
+ const y = ref(!1), M = () => {
1379
+ changeCursor(e, "crosshair"), p(), disableDoubleClickZoom(e), e.on("pointermove", N), e.getViewport().addEventListener("mouseout", () => {
1380
+ o && o.classList.add("hidden");
1381
+ }), w(), y.value = !0;
1382
+ };
1383
+ let t, r;
1384
+ const p = () => {
1385
+ t = new VectorSource(), r = new VectorLayer({
1386
+ source: t,
1387
+ zIndex: 1e3,
1388
+ style: {
1389
+ "fill-color": "rgba(255, 255, 255, 0.2)",
1390
+ "stroke-color": "#ffcc33",
1391
+ "stroke-width": 2,
1392
+ "circle-radius": 7,
1393
+ "circle-fill-color": "#ffcc33"
1394
+ }
1395
+ }), e == null || e.addLayer(r);
1396
+ };
1397
+ let m, F;
1398
+ const N = (a) => {
1399
+ if (a.dragging)
1400
+ return;
1401
+ let u = "点击选择起点";
1402
+ m && (u = "单击继续,双击结束"), o && (o.innerHTML = u, F.setPosition(a.coordinate), o.classList.remove("hidden"));
1403
+ };
1404
+ let v;
1405
+ const w = () => {
1406
+ v = new Draw({
1407
+ source: t,
1408
+ type: "LineString",
1409
+ style: new Style({
1410
+ fill: new Fill({
1411
+ color: "rgba(255, 255, 255, 0.2)"
1412
+ }),
1413
+ stroke: new Stroke({
1414
+ color: "rgba(255,204,51)",
1415
+ lineDash: [10, 10],
1416
+ width: 2
1417
+ }),
1418
+ image: new CircleStyle({
1419
+ radius: 5,
1420
+ stroke: new Stroke({
1421
+ color: "rgba(0, 0, 0, 0.7)"
1422
+ }),
1423
+ fill: new Fill({
1424
+ color: "rgba(255, 255, 255, 0.2)"
1425
+ })
1426
+ })
1427
+ }),
1428
+ // 添加条件函数,判断是否应该出发点绘制
1429
+ condition: (u) => u.originalEvent.target.tagName !== "DIV"
1430
+ }), e == null || e.addInteraction(v), Z(), B();
1431
+ let a;
1432
+ v.on("drawstart", function(u) {
1433
+ var P;
1434
+ m = u.feature, m.set("randomId", C());
1435
+ let f;
1436
+ a = (P = m.getGeometry()) == null ? void 0 : P.on("change", function(k) {
1437
+ const O = k.target, D = computedDistance(O, i.value);
1438
+ f = O.getLastCoordinate(), b && D && (b.innerHTML = D), L.setPosition(f);
1439
+ });
1440
+ }), v.on("drawend", function() {
1441
+ var u, f, P;
1442
+ if (b && (b.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), b != null && b.innerHTML) {
1443
+ const k = (m == null ? void 0 : m.get("randomId")) || C();
1444
+ n.value.push({ id: k, value: b == null ? void 0 : b.innerHTML }), b.innerHTML = `${b.innerHTML}<div class="ol-tooltip-delete-button" data-id="${k}"><i class="map-iconfont icon-delete"></i></div>`;
1445
+ }
1446
+ (u = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || u.addEventListener("click", (k) => {
1447
+ var D;
1448
+ k.preventDefault(), k.stopPropagation();
1449
+ const O = (D = k.target) == null ? void 0 : D.getAttribute("data-id");
1450
+ O && j(O);
1451
+ }), L.setOffset([0, -7]), m = null, b = null, Z(), a && unByKey(a), (P = (f = l.getProps()) == null ? void 0 : f.lineDrawEnd) == null || P.call(f, n.value);
1452
+ });
1453
+ }, C = () => Math.random().toString(36).substring(2, 9);
1454
+ let b, L;
1455
+ const Z = () => {
1456
+ b != null && b.parentNode && b.parentNode.removeChild(b), b = document.createElement("div"), b.className = "ol-tooltip ol-tooltip-measure", L = new Overlay({
1457
+ element: b,
1458
+ offset: [0, -15],
1459
+ positioning: "bottom-center",
1460
+ stopEvent: !1,
1461
+ insertFirst: !1
1462
+ }), e == null || e.addOverlay(L);
1463
+ }, B = () => {
1464
+ o != null && o.parentNode && o.parentNode.removeChild(o), o = document.createElement("div"), o.className = "ol-tooltip hidden", F = new Overlay({
1465
+ element: o,
1466
+ offset: [15, 0],
1467
+ positioning: "center-left"
1468
+ }), e == null || e.addOverlay(F);
1469
+ }, Y = () => {
1470
+ n.value.forEach((a, u) => {
1471
+ var k, O;
1472
+ const f = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
1473
+ f[u] && ((O = (k = f[u]) == null ? void 0 : k.parentNode) == null || O.removeChild(f[u]));
1474
+ const P = t.getFeatures();
1475
+ P[u] && t.removeFeature(P[u]);
1476
+ }), $(), enableDoubleClickZoom(e), y.value = !1, changeCursor(e, "pointer");
1477
+ }, j = (a) => {
1478
+ var f, P, k, O;
1479
+ const u = n.value.findIndex((D) => D.id === a);
1480
+ if (u !== -1) {
1481
+ n.value.splice(u, 1);
1482
+ const D = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
1483
+ D[u] && ((P = (f = D[u]) == null ? void 0 : f.parentNode) == null || P.removeChild(D[u]));
1484
+ const A = t.getFeatures();
1485
+ A[u] && t.removeFeature(A[u]);
1486
+ }
1487
+ (O = (k = l.getProps()) == null ? void 0 : k.lineDrawEnd) == null || O.call(k, n.value);
1488
+ }, $ = () => {
1489
+ if (n.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((a) => {
1490
+ var u;
1491
+ (u = a == null ? void 0 : a.parentNode) == null || u.removeChild(a);
1492
+ }), t.clear(), v) {
1493
+ const a = e.getInteractions().getArray().find((u) => getUid(u) === getUid(v));
1494
+ a && e.removeInteraction(a);
1495
+ }
1496
+ e.removeLayer(r), o != null && o.parentNode && o.parentNode.removeChild(o), b != null && b.parentNode && b.parentNode.removeChild(b);
1497
+ };
1498
+ return {
1499
+ open: M,
1500
+ close: Y,
1501
+ deleteLine: j,
1502
+ setUnit: c,
1503
+ getState: () => y.value
1504
+ };
1505
+ }, computedDistance = (e, l) => {
1506
+ const i = getLength(e);
1507
+ let c = "";
1508
+ switch (l) {
1509
+ case "m":
1510
+ c = `${Math.round(i * 100) / 100} m`;
1511
+ break;
1512
+ case "km":
1513
+ c = `${Math.round(i / 1e3 * 100) / 100} km`;
1514
+ break;
1515
+ case "nm":
1516
+ c = (Math.round(i / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
1517
+ break;
1518
+ }
1519
+ return c;
1520
+ }, useDrawPolygonManager = (e, l) => {
1521
+ let n, i;
1522
+ const c = () => {
1523
+ o(), changeCursor(e, "crosshair");
1524
+ }, o = () => {
1525
+ t(), b(), B(), N();
1526
+ };
1527
+ let y = null, M = null;
1528
+ const t = () => {
1529
+ if (y && M) return;
1530
+ const $ = new VectorSource(), z = new VectorLayer({
1531
+ source: $,
1532
+ style: new Style({
1533
+ stroke: new Stroke({
1534
+ color: "#fbcc33",
1535
+ width: 2
1536
+ })
1537
+ })
1538
+ });
1539
+ y = z, M = $, e.on("pointermove", p), e.addLayer(z), e.on(["dblclick"], function(a) {
1540
+ m && (a.stopPropagation(), a.preventDefault());
1541
+ });
1542
+ };
1543
+ let r;
1544
+ const p = ($) => {
1545
+ if ($.dragging) return;
1546
+ const z = r ? "单击继续,双击结束" : "点击选择起点";
1547
+ L && (L.innerHTML = z, Z.setPosition($.coordinate));
1548
+ };
1549
+ let m, F = !1;
1550
+ const N = () => {
1551
+ if (n) {
1552
+ L != null && L.parentNode && L.parentNode.removeChild(L);
1553
+ const $ = n.getGeometry();
1554
+ if (!$) return;
1555
+ const z = v($, "nm");
1556
+ w && (w.innerHTML = `
1557
+ <span class="text">面积:${z}${F ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
1558
+ `), w && (w.innerHTML += '<span class="delete-icon" ><i class="map-iconfont icon-delete" /></div>');
1559
+ const a = $.getCoordinates(), u = a[0][a[0].length - 2];
1560
+ if (C.setPosition(u), y) {
1561
+ const P = y.getSource();
1562
+ P && n && (P.clear(), P.addFeature(n));
1563
+ }
1564
+ setTimeout(() => {
1565
+ var P;
1566
+ (P = document.querySelector(".delete-icon")) == null || P.addEventListener("click", () => {
1567
+ var k, O;
1568
+ console.log("delete"), Y(), (O = (k = l.getProps()) == null ? void 0 : k.areaDrawEnd) == null || O.call(k, []);
1569
+ });
1570
+ }, 0);
1571
+ const f = getCenter(n.getGeometry().getExtent());
1572
+ e == null || e.getView().setCenter(f);
1573
+ return;
1574
+ }
1575
+ m = new Draw({
1576
+ type: "Polygon",
1577
+ source: M,
1578
+ trace: !0,
1579
+ style: [new Style({
1580
+ stroke: new Stroke({
1581
+ color: "rgba(255, 255, 255, 1)",
1582
+ width: 1.5,
1583
+ lineDash: [10, 10]
1584
+ }),
1585
+ fill: new Fill({
1586
+ color: "rgba(255, 255, 255, 0.25)"
1587
+ })
1588
+ }), new Style({
1589
+ image: new CircleStyle({
1590
+ radius: 5,
1591
+ fill: new Fill({
1592
+ color: "rgb(51,112,255, 1)"
1593
+ })
1594
+ }),
1595
+ geometry: function($) {
1596
+ const z = $.getGeometry().getCoordinates();
1597
+ return new MultiPoint(z);
1598
+ }
1599
+ })]
1600
+ }), e == null || e.addInteraction(m), m.on("drawstart", ($) => {
1601
+ var z;
1602
+ r = $.feature, i = (z = r.getGeometry()) == null ? void 0 : z.on("change", (a) => {
1603
+ const u = a.target, f = v(u, "nm"), k = u.getCoordinates()[0], O = new LineString([k[k.length - 2], k[k.length - 1]]), D = computedDistance(O, "nm");
1604
+ if (F = Number(getLength(O) / 1e3) > 150, !f) return;
1605
+ const A = '<span class="error pl-4">超出可以绘画的距离</span>';
1606
+ w && (w.innerHTML = `
1607
+ <div class="text">
1608
+ 面积:${f}
1609
+ ${F ? A : ""}
1610
+ </div>
1611
+ `), L && (L.innerHTML = `
1612
+ <div class="text">
1613
+ 面积:${f}
1614
+ </div>
1615
+ <div class="text ${F ? "error" : ""}">
1616
+ 线段 ${k.length - 2}: ${D}
1617
+ ${F ? A : ""}
1618
+
1619
+ </div>
1620
+ <div>
1621
+ <span class="text">单击继续,双击结束</span>
1622
+ </div>
1623
+ `);
1624
+ });
1625
+ }), m.on("drawend", ($) => {
1626
+ var f, P, k, O;
1627
+ if (!$.feature.getGeometry()) return;
1628
+ n = $.feature, w && (w.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), C.setOffset([10, 0]);
1629
+ const a = $.feature.getGeometry().getCoordinates(), u = a[0][a[0].length - 2];
1630
+ if (C.setPosition(u), L != null && L.parentNode && L.parentNode.removeChild(L), (f = l.getProps()) != null && f.areaDrawEnd) {
1631
+ const D = a[0].map((A) => transform(A, projection.mercator, projection.data));
1632
+ (k = (P = l.getProps()) == null ? void 0 : P.areaDrawEnd) == null || k.call(P, D);
1633
+ }
1634
+ m && (m.setActive(!1), e == null || e.removeInteraction(m), (e == null ? void 0 : e.getInteractions()).forEach((A) => {
1635
+ A instanceof Draw && (A.setActive(!1), e == null || e.removeInteraction(A));
1636
+ })), i && unByKey(i), (O = document.querySelector(".delete-icon")) == null || O.addEventListener("click", () => {
1637
+ var D, A;
1638
+ Y(), (A = (D = l.getProps()) == null ? void 0 : D.areaDrawEnd) == null || A.call(D, []);
1639
+ });
1640
+ });
1641
+ }, v = ($, z) => {
1642
+ const a = getArea($);
1643
+ switch (z) {
1644
+ case "km":
1645
+ return a > 1e4 ? Math.round(a / 1e6 * 100) / 100 + " km<sup>2</sup>" : Math.round(a * 100) / 100 + " m<sup>2</sup>";
1646
+ case "nm":
1647
+ return a > 1e4 ? Math.round(a / 1e6 / Math.pow(1.852, 2) * 100) / 100 + " nm<sup>2</sup>" : Math.round(a * 100) / 100 + " m<sup>2</sup>";
1648
+ }
1649
+ };
1650
+ let w, C;
1651
+ const b = () => {
1652
+ w != null && w.parentNode && w.parentNode.removeChild(w), w = document.createElement("div"), w.style.display = "flex", w.className = "ol-tooltip ol-tooltip-draw-polygon", C = new Overlay({
1653
+ element: w,
1654
+ offset: [0, -15],
1655
+ positioning: "bottom-center",
1656
+ stopEvent: !1,
1657
+ insertFirst: !1
1658
+ }), e == null || e.addOverlay(C);
1659
+ };
1660
+ let L, Z;
1661
+ const B = () => {
1662
+ L != null && L.parentNode && L.parentNode.removeChild(L), L = document.createElement("div"), L.className = "ol-tooltip ol-help-tooltip", Z = new Overlay({
1663
+ element: L,
1664
+ offset: [15, 0],
1665
+ positioning: "center-left"
1666
+ }), e == null || e.addOverlay(Z);
1667
+ }, Y = () => {
1668
+ M == null || M.clear(), n = null, b(), B(), N();
1669
+ };
1670
+ return {
1671
+ open: c,
1672
+ close: () => {
1673
+ M == null || M.clear(), M = null, y && (e.removeLayer(y), y = null), r = null, m && (m.setActive(!1), (e == null ? void 0 : e.getInteractions()).forEach((z) => {
1674
+ z instanceof Draw && (z.setActive(!1), e == null || e.removeInteraction(z));
1675
+ }), m = null), i && unByKey(i), L != null && L.parentElement && L.parentElement.removeChild(L), w != null && w.parentElement && w.parentElement.removeChild(w), Z && e.removeOverlay(Z), C && e.removeOverlay(C), changeCursor(e, "pointer");
1676
+ },
1677
+ reset: Y
1678
+ };
1679
+ }, PORT_LAYER_CLASS_NAME = "zh-map-port-layer", usePortManager = (e) => {
1680
+ const l = e.getInstall();
1681
+ let n, i, c = null, o = null;
1682
+ const y = (v, w = !0) => {
1683
+ if (!(!v || v.length === 0)) {
1684
+ if (i || (i = new VectorSource()), i.clear(), o) {
1685
+ const C = v.find((b) => b.id === o.id);
1686
+ C ? o = C : v.push(o);
1687
+ }
1688
+ v.forEach((C) => {
1689
+ M(C, w);
1690
+ }), n || (n = new VectorLayer({
1691
+ className: PORT_LAYER_CLASS_NAME,
1692
+ source: i,
1693
+ zIndex: 100
1694
+ }), l.addLayer(n));
1695
+ }
1696
+ }, M = (v, w = !0) => {
1697
+ const C = e.getZoom(), [b, L] = v.latLon.split(","), Z = new Feature({
1698
+ geometry: new Point(fromLonLat([Number(b), Number(L)]))
1699
+ });
1700
+ Z.setStyle(t(v, C, v.id === (o == null ? void 0 : o.id), w)), Z.set("portData", v), i.addFeature(Z);
1701
+ }, t = (v, w, C, b = !0) => {
1702
+ const L = (B) => `<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
1703
+ <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="${B}"/>
1704
+ <g clip-path="url(#clip0_10059_122082)">
1705
+ <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"/>
1706
+ </g>
1707
+ <defs>
1708
+ <clipPath id="clip0_10059_122082">
1709
+ <rect width="26" height="26" fill="white" transform="translate(10 8)"/>
1710
+ </clipPath>
1711
+ </defs>
1712
+ </svg>
1713
+ `, Z = () => `data:image/svg+xml;utf8,${encodeURIComponent(L(C ? "#FF5733" : "#3370FF"))}`;
1714
+ return !b && !C ? new Style({
1715
+ image: new Icon({
1716
+ src: Z(),
1717
+ scale: 0.5 * w / 10
1718
+ }),
1719
+ zIndex: C ? 110 : 100
1720
+ }) : new Style({
1721
+ text: new Text({
1722
+ text: v.shortName,
1723
+ font: "12px sans-serif",
1724
+ fill: new Fill({
1725
+ color: C ? "#ffffff" : "#000000"
1726
+ }),
1727
+ backgroundFill: new Fill({
1728
+ color: C ? "#FF5733" : "#FFFFFF"
1729
+ }),
1730
+ offsetY: 30
1731
+ }),
1732
+ image: new Icon({
1733
+ src: Z(),
1734
+ scale: 0.5 * w / 10
1735
+ }),
1736
+ zIndex: C ? 110 : 100
1737
+ });
1738
+ }, r = () => {
1739
+ if (c) {
1740
+ console.log("清除非选中的港口");
1741
+ const v = c.get("portData").id;
1742
+ i.getFeatures().forEach((w) => {
1743
+ w.get("portData").id !== v && i.removeFeature(w);
1744
+ });
1745
+ } else
1746
+ console.log("清除所有港口", i), i == null || i.clear();
1747
+ }, p = (v) => {
1748
+ if (!v)
1749
+ return m();
1750
+ (c == null ? void 0 : c.get("portData").id) !== v.id && (m(), F(v));
1751
+ }, m = () => {
1752
+ if (c) {
1753
+ const v = c == null ? void 0 : c.get("portData"), w = e.getZoom();
1754
+ i.getFeatures().forEach((b) => {
1755
+ b.get("portData").id === v.id && (b.setStyle(t(b.get("portData"), w, !1)), c = null);
1756
+ });
1757
+ }
1758
+ }, F = (v) => {
1759
+ const w = i.getFeatures();
1760
+ o = v, c = w.find((C) => C.get("portData").id === v.id), c == null || c.setStyle(t(v, e.getZoom(), !0));
1761
+ };
1762
+ return {
1763
+ render: y,
1764
+ clear: r,
1765
+ selected: p,
1766
+ handlePortHover: (v) => {
1767
+ const w = l == null ? void 0 : l.getTargetElement();
1768
+ v && v.get("portData") && w && (w.style.cursor = "pointer");
1769
+ }
1770
+ };
1771
+ }, useEventManager = (e, l, n, i, c, o) => {
1772
+ const y = e.getInstall();
1773
+ y.on("moveend", () => {
1774
+ var t, r;
1775
+ const M = e.getZoom();
1776
+ (r = (t = l.getProps()).mapMoveEnd) == null || r.call(t, M), n.reRenderTrackLine(), M <= MAP_ZOOM.shipModelMax && M >= MAP_ZOOM.shipTriggleMin && i.changeShipScale("end");
1777
+ }), y.on("pointermove", (M) => {
1778
+ const t = y.getEventPixel(M.originalEvent), r = y.forEachFeatureAtPixel(t, (p) => p);
1779
+ i.handleShipMapEvent(r, "hover"), n.handleTrackMapEvent(r, "hover", M), r && c.handlePortHover(r);
1780
+ }), y.on("movestart", () => {
1781
+ console.log("movestart-----------------------");
1782
+ const M = y.getView().getZoom();
1783
+ M <= MAP_ZOOM.shipModelMax && M >= MAP_ZOOM.shipTriggleMin && i.changeShipScale("start");
1784
+ }), y.on("click", debounce((M) => {
1785
+ var p, m, F;
1786
+ if (console.log("1", o.getState()), o.getState()) return;
1787
+ const t = y.getEventPixel(M.originalEvent), r = y.forEachFeatureAtPixel(
1788
+ t,
1789
+ (N) => {
1790
+ if (N != null && N.get("shipData") || N != null && N.get("portData"))
1791
+ return N;
1792
+ }
1793
+ );
1794
+ if (console.log("2", r), !!r) {
1795
+ if (M.preventDefault(), M.stopPropagation(), r.get("shipData"))
1796
+ i.handleShipMapEvent(r, "click", (p = l.getProps()) == null ? void 0 : p.selectShip);
1797
+ else if (r.get("portData")) {
1798
+ const N = r.get("portData");
1799
+ c.selected(N), (F = (m = l.getProps()) == null ? void 0 : m.selectPort) == null || F.call(m, N);
1800
+ }
1801
+ }
1802
+ }, 150));
1803
+ }, useMapController = () => {
1804
+ const e = reactive([]);
1805
+ return {
1806
+ createInstance: (i, c) => {
1807
+ const o = useMapInitializer();
1808
+ o.initMap(i, c);
1809
+ const y = o.getInstall(), M = useLayerManager(y), t = usePropsManager();
1810
+ t.setProps(c), M.setShowLayerType(c.layerType), M.setGreenTileVisible(c.showGreenLayer);
1811
+ const r = useTrackManager(y), p = useCarTrackManager(y, r), m = useShipManager(y), F = usePositionManager(y), N = useDrawLineManager(y, t), v = useDrawPolygonManager(y, t), w = usePortManager(o);
1812
+ useEventManager(o, t, r, m, w, N);
1813
+ const C = () => {
1814
+ const L = y.getView().calculateExtent(o.getSize()), Z = transform([L[0], L[1]], projection.mercator, projection.data), B = transform([L[2], L[3]], projection.mercator, projection.data);
1815
+ return [Z[0], Z[1], B[0], B[1]];
1816
+ }, b = {
1817
+ id: Symbol("map-instance"),
1818
+ innerMap: null,
1819
+ map: o.getInstall(),
1820
+ destroy: () => {
1821
+ e.splice(e.indexOf(b), 1);
1822
+ },
1823
+ methods: {
1824
+ ...o,
1825
+ layer: M,
1826
+ ship: m,
1827
+ track: r,
1828
+ carTrack: p,
1829
+ port: {
1830
+ render: w.render,
1831
+ clear: w.clear,
1832
+ selected: w.selected
1833
+ },
1834
+ position: F,
1835
+ drawLine: N,
1836
+ drawPolygon: v,
1837
+ // 子模块
1838
+ utils: {
1839
+ getCalculateExtent: C,
1840
+ convertSixHundredThousandToLatLng,
1841
+ calculateCirclePoints
1842
+ }
1843
+ }
1844
+ };
1845
+ return e.push(b), b;
1846
+ },
1847
+ destroyInstance: (i) => {
1848
+ const c = e.findIndex((o) => o.id === i);
1849
+ c > -1 && (e[c].destroy(), e.splice(c, 1));
1850
+ },
1851
+ destroyAll: () => {
1852
+ e.forEach((i) => i.destroy()), e.splice(0, e.length);
1853
+ },
1854
+ getAllInstances: () => [...e]
1855
+ };
1856
+ }, _hoisted_1 = { class: "zh-map-box" }, _sfc_main = /* @__PURE__ */ defineComponent({
1857
+ __name: "Map",
1858
+ props: {
1859
+ zoom: { default: MAP_ZOOM.default },
1860
+ center: { default: MAP_DEFAULT_CENTER },
1861
+ layerType: { default: "vector" },
1862
+ showGreenLayer: { type: Boolean, default: !1 },
1863
+ showScale: { type: Boolean, default: !0 },
1864
+ scaleLineUnit: { default: "metric" },
1865
+ mapMoveEnd: { type: Function, default: () => {
1866
+ } },
1867
+ lineDrawEnd: {},
1868
+ areaDrawEnd: { type: Function, default: () => {
1869
+ } },
1870
+ selectShip: { type: Function, default: () => {
1871
+ } },
1872
+ selectPort: { type: Function, default: () => {
1873
+ } }
1874
+ },
1875
+ setup(e, { expose: l }) {
1876
+ const n = ref(), i = ref(), c = useMapController(), o = ref(), y = e, M = ref({
1877
+ getInstall() {
1878
+ }
1879
+ });
1880
+ return onMounted(() => {
1881
+ var t;
1882
+ o.value = c.createInstance(n.value, y), M.value = o.value.methods, (t = i.value) == null || t.setScaleLine(o.value.map, y.scaleLineUnit);
1883
+ }), onUnmounted(() => {
1884
+ var t, r;
1885
+ c.destroyInstance((t = o == null ? void 0 : o.value) == null ? void 0 : t.id), (r = o.value) == null || r.destroy();
1886
+ }), l({
1887
+ getZoom: () => {
1888
+ var t;
1889
+ return (t = o.value) == null ? void 0 : t.methods.getZoom();
1890
+ },
1891
+ setZoom: (t) => {
1892
+ var r;
1893
+ return (r = o.value) == null ? void 0 : r.methods.setZoom(t);
1894
+ },
1895
+ getInstall: () => {
1896
+ var t;
1897
+ return (t = o.value) == null ? void 0 : t.methods.getInstall();
1898
+ },
1899
+ getView: () => {
1900
+ var t;
1901
+ return (t = o.value) == null ? void 0 : t.methods.getView();
1902
+ },
1903
+ setCenter: (t, r) => {
1904
+ var p;
1905
+ return (p = o.value) == null ? void 0 : p.methods.setCenter(t, r);
1906
+ },
1907
+ getSize: () => {
1908
+ var t;
1909
+ return (t = o.value) == null ? void 0 : t.methods.getSize();
1910
+ },
1911
+ getCenter: (t, r) => {
1912
+ var p;
1913
+ return (p = o.value) == null ? void 0 : p.methods.getCenter();
1914
+ },
1915
+ layer: {
1916
+ setGreenTileVisible: (t) => {
1917
+ var r;
1918
+ return (r = o.value) == null ? void 0 : r.methods.layer.setGreenTileVisible(t);
1919
+ },
1920
+ getGreenTileVisible: () => {
1921
+ var t;
1922
+ return (t = o.value) == null ? void 0 : t.methods.layer.getGreenTileVisible();
1923
+ },
1924
+ getShowLayerType: () => {
1925
+ var t;
1926
+ return (t = o.value) == null ? void 0 : t.methods.layer.getShowLayerType();
1927
+ },
1928
+ setShowLayerType: (t) => {
1929
+ var r;
1930
+ return (r = o.value) == null ? void 0 : r.methods.layer.setShowLayerType(t);
1931
+ }
1932
+ },
1933
+ ship: {
1934
+ render: (...t) => {
1935
+ var r;
1936
+ return (r = o.value) == null ? void 0 : r.methods.ship.render(...t);
1937
+ },
1938
+ selected: (...t) => {
1939
+ var r;
1940
+ return (r = o.value) == null ? void 0 : r.methods.ship.selected(...t);
1941
+ },
1942
+ filter: (...t) => {
1943
+ var r;
1944
+ return (r = o.value) == null ? void 0 : r.methods.ship.filter(...t);
1945
+ },
1946
+ blinking: (...t) => {
1947
+ var r;
1948
+ return (r = o.value) == null ? void 0 : r.methods.ship.blinking(...t);
1949
+ },
1950
+ clear: () => {
1951
+ var t;
1952
+ return (t = o.value) == null ? void 0 : t.methods.ship.clear();
1953
+ }
1954
+ },
1955
+ track: {
1956
+ render: (...t) => {
1957
+ var r;
1958
+ return (r = o.value) == null ? void 0 : r.methods.track.render(...t);
1959
+ },
1960
+ remove: (...t) => {
1961
+ var r;
1962
+ return (r = o.value) == null ? void 0 : r.methods.track.remove(...t);
1963
+ },
1964
+ play: (...t) => {
1965
+ var r;
1966
+ return (r = o.value) == null ? void 0 : r.methods.track.play(...t);
1967
+ },
1968
+ setCenter: (...t) => {
1969
+ var r;
1970
+ return (r = o.value) == null ? void 0 : r.methods.track.setCenter(...t);
1971
+ },
1972
+ close: (...t) => {
1973
+ var r;
1974
+ return (r = o.value) == null ? void 0 : r.methods.track.close(...t);
1975
+ },
1976
+ getLength: (...t) => {
1977
+ var r;
1978
+ return (r = o.value) == null ? void 0 : r.methods.track.getLength(...t);
1979
+ }
1980
+ },
1981
+ carTrack: {
1982
+ location: (...t) => {
1983
+ var r;
1984
+ return (r = o.value) == null ? void 0 : r.methods.carTrack.location(...t);
1985
+ },
1986
+ remove: (...t) => {
1987
+ var r;
1988
+ return (r = o.value) == null ? void 0 : r.methods.carTrack.remove(...t);
1989
+ },
1990
+ renderTrack: (...t) => {
1991
+ var r;
1992
+ return (r = o.value) == null ? void 0 : r.methods.carTrack.renderTrack(...t);
1993
+ },
1994
+ setCenter: (...t) => {
1995
+ var r;
1996
+ return (r = o.value) == null ? void 0 : r.methods.carTrack.setCenter(...t);
1997
+ },
1998
+ closeTrack: () => {
1999
+ var t;
2000
+ return (t = o.value) == null ? void 0 : t.methods.carTrack.closeTrack();
2001
+ },
2002
+ playTrack: (...t) => {
2003
+ var r;
2004
+ return (r = o.value) == null ? void 0 : r.methods.carTrack.playTrack(...t);
2005
+ }
2006
+ },
2007
+ port: {
2008
+ render: (t, r) => {
2009
+ var p;
2010
+ return (p = o.value) == null ? void 0 : p.methods.port.render(t, r);
2011
+ },
2012
+ clear: () => {
2013
+ var t;
2014
+ return (t = o.value) == null ? void 0 : t.methods.port.clear();
2015
+ },
2016
+ selected: (t) => {
2017
+ var r;
2018
+ return (r = o.value) == null ? void 0 : r.methods.port.selected(t);
2019
+ }
2020
+ },
2021
+ position: {
2022
+ render: (...t) => {
2023
+ var r;
2024
+ return (r = o.value) == null ? void 0 : r.methods.position.render(...t);
2025
+ },
2026
+ selected: (...t) => {
2027
+ var r;
2028
+ return (r = o.value) == null ? void 0 : r.methods.position.selected(...t);
2029
+ },
2030
+ clearSelected: (...t) => {
2031
+ var r;
2032
+ return (r = o.value) == null ? void 0 : r.methods.position.clearSelected(...t);
2033
+ },
2034
+ clear: () => {
2035
+ var t;
2036
+ return (t = o.value) == null ? void 0 : t.methods.position.clear();
2037
+ }
2038
+ },
2039
+ drawLine: {
2040
+ open: () => {
2041
+ var t;
2042
+ return (t = o.value) == null ? void 0 : t.methods.drawLine.open();
2043
+ },
2044
+ close: () => {
2045
+ var t;
2046
+ return (t = o.value) == null ? void 0 : t.methods.drawLine.close();
2047
+ },
2048
+ deleteLine: (t) => {
2049
+ var r;
2050
+ return (r = o.value) == null ? void 0 : r.methods.drawLine.deleteLine(t);
2051
+ },
2052
+ setUnit: (t) => {
2053
+ var r;
2054
+ return (r = o.value) == null ? void 0 : r.methods.drawLine.setUnit(t);
2055
+ },
2056
+ getState: () => {
2057
+ var t;
2058
+ return (t = o.value) == null ? void 0 : t.methods.drawLine.getState();
2059
+ }
2060
+ },
2061
+ drawPolygon: {
2062
+ open: () => {
2063
+ var t;
2064
+ return (t = o.value) == null ? void 0 : t.methods.drawPolygon.open();
2065
+ },
2066
+ close: () => {
2067
+ var t;
2068
+ return (t = o.value) == null ? void 0 : t.methods.drawPolygon.close();
2069
+ },
2070
+ reset: () => {
2071
+ var t;
2072
+ return (t = o.value) == null ? void 0 : t.methods.drawPolygon.reset();
2073
+ }
2074
+ },
2075
+ // 子模块
2076
+ utils: {
2077
+ getCalculateExtent: (...t) => {
2078
+ var r;
2079
+ return (r = o.value) == null ? void 0 : r.methods.utils.getCalculateExtent(...t);
2080
+ },
2081
+ convertSixHundredThousandToLatLng: (...t) => {
2082
+ var r;
2083
+ return (r = o.value) == null ? void 0 : r.methods.utils.convertSixHundredThousandToLatLng(...t);
2084
+ },
2085
+ calculateCirclePoints: (t, r) => {
2086
+ var p;
2087
+ return (p = o.value) == null ? void 0 : p.methods.utils.calculateCirclePoints(t, r);
2088
+ }
2089
+ }
2090
+ }), (t, r) => (openBlock(), createElementBlock("div", _hoisted_1, [
2091
+ createElementVNode("div", {
2092
+ id: "map",
2093
+ ref_key: "zhMapRef",
2094
+ ref: n,
2095
+ class: "zh-map"
2096
+ }, null, 512),
2097
+ createVNode(ScaleLine, {
2098
+ ref_key: "scaleLineRef",
2099
+ ref: i
2100
+ }, null, 512),
2101
+ createVNode(ZoomControl, {
2102
+ ref: "zoomControlRef",
2103
+ "map-instance": o.value
2104
+ }, null, 8, ["map-instance"])
2105
+ ]));
2106
+ }
2107
+ }), Map$1 = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-5724a05d"]]), ZhMap = withInstall(Map$1);
2108
+ export {
2109
+ ZhMap as Z
2110
+ };