zhihao-ui 1.3.44-alpha.1 → 1.3.44

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