zhihao-ui 1.3.39 → 1.3.41

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