zhihao-ui 1.3.40 → 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 Se, 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 Me, x as ze, L as $e, y as Wt, z as ot, A as ie, B as he, C as de, D as fe, i as Yt, G as Oe, H as Bt, I as pe, J as qt, K as Ht, N as at, Q as Ve, 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: (l, c) => {
10
- c || (c = "metric");
11
- const o = new Rt({
12
- units: c
13
- }), d = document.getElementById("scale-line-container");
14
- d && (o.setTarget(d), l.addControl(o));
15
- }
16
- }), (l, c) => (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 s = () => {
30
- console.log("props");
31
- const { setZoom: c, getZoom: o, getInstall: d } = n.mapInstance.methods;
32
- if (!d()) return;
33
- const t = o();
34
- t && c(t + 1);
35
- }, l = () => {
36
- const { setZoom: c, getZoom: o, getInstall: d } = n.mapInstance.methods;
37
- if (!d()) return;
38
- const t = o();
39
- t && c(t - 1);
40
- };
41
- return (c, o) => (Xe(), je("div", It, [
42
- Ye("div", {
43
- class: "button big-button",
44
- onClick: s
45
- }, " + "),
46
- Ye("div", {
47
- class: "button small-button",
48
- onClick: l
49
- }, " - ")
50
- ]));
51
- }
52
- }), to = /* @__PURE__ */ Je(eo, [["__scopeId", "data-v-c39c3075"]]), Ne = "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/", Re = 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=${Ne}`, 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=${Ne}`, 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=${Ne}`, 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=${Ne}`, 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, s = () => n().getView(), l = () => {
76
- var x;
77
- return (x = s()) == null ? void 0 : x.getZoom();
78
- }, c = (x) => {
79
- var L;
80
- (L = s()) == null || L.setZoom(x);
81
- }, o = (x, L) => {
82
- var $;
83
- ($ = s()) == null || $.setCenter(U([x, L]));
84
- }, d = () => {
85
- var L;
86
- const x = (L = s()) == 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 T = {
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(T);
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: s,
152
- getZoom: l,
153
- setZoom: c,
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 s = Number(n) / 6e5;
163
- return [Number(e) / 6e5, s];
164
- }, no = (e, n) => {
165
- const s = U(e), l = n * 1e3, c = [
166
- s[0] - l,
167
- s[1] - l,
168
- s[0] + l,
169
- s[1] + l
170
- ], o = At(c, 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 l = Qe(e);
179
- let c = "";
180
- switch (console.log(n, xe), n) {
181
- case xe.M:
182
- c = Math.round(l * 100) / 100 + " m";
183
- break;
184
- case xe.KM:
185
- c = Math.round(l / 1e3 * 100) / 100 + " km";
186
- break;
187
- case xe.NM:
188
- c = (Math.round(l / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
189
- break;
190
- }
191
- return c;
192
- };
193
- function so(e) {
194
- const n = e[0] * Re / 180;
195
- let s = Math.log(Math.tan((90 + e[1]) * Math.PI / 360)) / (Math.PI / 180);
196
- return s = s * Re / 180, [n, s];
197
- }
198
- function ge(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 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 s = { lon: 0, lat: 0 }, l = e[0] / Re * 180;
218
- let c = e[1] / Re * 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
- }, io = (e) => {
221
- const n = ct.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
- }, co = (e, n) => {
225
- let s = null;
226
- const l = 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
- c(w, U(x));
230
- const L = e == null ? void 0 : e.getView(), $ = new le(x);
231
- L.setCenter(Me($.getCoordinates(), J.data, J.mercator));
232
- }, c = (w, x) => {
233
- const L = `${dt}map/car-icon.gif`;
234
- s || (s = new ce({
235
- element: document.createElement("div"),
236
- positioning: "center-center",
237
- stopEvent: !1
238
- // 允许交互事件穿透
239
- }), e.addOverlay(s));
240
- const $ = s.getElement();
241
- $.style.backgroundImage = `url(${L})`, $.style.width = "80px", $.style.height = "80px";
242
- const T = (w == null ? void 0 : w.drc) || "";
243
- $.style.transform = `rotate(${T}deg)`, $.style.backgroundSize = "cover", s == null || s.setPosition(x);
244
- };
245
- return {
246
- location: l,
247
- remove: () => {
248
- const w = s == null ? void 0 : s.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(), s = {};
268
- let l = null;
269
- const c = "--";
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, T = Date.now(), g, p = 0, M = null, f = 20;
277
- const O = 8, Y = [], A = (a) => {
278
- var u;
279
- for (Y.unshift(a); Y.length > O; ) {
280
- const v = Y.pop(), b = n.get(v);
281
- b && ((u = b.getSource()) == null || u.clear(), e == null || e.removeLayer(b), n.delete(v), delete s[v]);
282
- }
283
- };
284
- let B = "";
285
- const R = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080", "#ffc0cb", "#800000", "#000080", "#808000"], Z = ze(() => {
286
- if (l && s[l] && n.get(l).getVisible()) {
287
- console.log("reRenderTrackLine------------");
288
- const a = Yt(F(l, s[l]));
289
- re(l, a);
290
- }
291
- }, 300), F = (a, u) => {
292
- let v = [];
293
- const b = Math.max(1, Math.floor(u.length / f));
294
- return v = u.filter((E, G) => G % b === 0).map((E, G) => {
295
- if (Number(E.lon) > 180 || Number(E.lat) > 180) {
296
- const [V, W] = Ke(E.lon, E.lat);
297
- E.lon = V, E.lat = W;
298
- }
299
- return E.center = [E.lon, E.lat], E.centerPoint = so(E.center), E.time = ct(E.createdAt).format("YYYY-MM-DD HH:mm:ss"), E.id = a, E.index = G, E;
300
- }), v;
301
- }, i = async (a, u, v, b = "ship", C = 200) => {
302
- if (!e || JSON.stringify(s[a]) === JSON.stringify(u) && l === a || (u = u == null ? void 0 : u.reverse(), m && b === "ship" && (e != null && e.getOverlays().getArray().includes(m) || e.addOverlay(m)), (u == null ? void 0 : u.length) < 2))
303
- return;
304
- A(a), l = a, s[a] = u, f = C;
305
- const E = Object.keys(s).findIndex((G) => G === a) || 0;
306
- B = v || R[E > 10 ? 10 : E], await k(), await Ue(l);
307
- }, y = (a) => {
308
- const u = new de();
309
- return new he({
310
- source: u,
311
- visible: !1,
312
- // 默认隐藏
313
- className: `track-layer-${a}`,
314
- renderBuffer: 1024
315
- // 增大渲染缓冲区
316
- });
317
- }, h = (a) => {
318
- n.forEach((u, v) => {
319
- var C;
320
- const b = v === a;
321
- u.getVisible() !== b && (u.setVisible(b), e.getLayers().getArray().includes(u) || e.addLayer(u), b || (C = u.getSource()) == null || C.clear());
322
- }), l = a;
323
- }, k = async () => {
324
- const a = l;
325
- if (!n.has(a)) {
326
- const E = y(a);
327
- n.set(a, E);
328
- }
329
- await h(a);
330
- const u = B || "", v = s[a] || [];
331
- if (!(v && v.length > 1)) return [];
332
- let b = [];
333
- b = F(a, v);
334
- const C = b.map((E) => E.centerPoint);
335
- b.length >= 2 && await S(a, C, u);
336
- }, S = (a, u, v) => {
337
- const b = new $e(u), C = n.get(a).getSource(), E = C.getFeatureById(a);
338
- if (E)
339
- E.setGeometry(b), E.setId(a), E.setStyle(N(v)), M = E;
340
- else {
341
- const G = new ie({ geometry: b });
342
- G.setId(a), G.set("type", "line"), G.setStyle(N(v)), C.addFeature(G), M = G;
343
- }
344
- return M;
345
- }, N = (a) => new j({
346
- stroke: new fe({
347
- color: a,
348
- width: 2
349
- })
350
- }), D = (a, u, v) => {
351
- try {
352
- const b = a == null ? void 0 : a.get("data");
353
- if (console.log("trackId-data", b), a && b && u === "hover") {
354
- e.getTargetElement().style.cursor = b ? "pointer" : "";
355
- const C = X(b), E = v == null ? void 0 : v.coordinate;
356
- E && (d.querySelector(".popup-content"), d.innerHTML = C, m == null || m.setPosition(E));
357
- } else
358
- m && m.setPosition(void 0);
359
- } catch (b) {
360
- console.error("handleTrackMapEvent", b);
361
- }
362
- }, X = (a) => {
363
- if (!(a != null && a.time)) return;
364
- let u = "";
365
- return a != null && a.stayTime && (u = `
366
- <div class="item w-100">
367
- <div class="item-label">停泊时间约</div>
368
- <div class="item-item">${io(Number(a.stayTime))}</div>
369
- </div>
370
- `), `
371
- <div class="track-point-popup">
372
- <div class="item">
373
- <div class="item-label">状态</div>
374
- <div class="item-item">${a != null && a.sailStatus ? ut[a.sailStatus] : c}</div>
375
- </div>
376
- <div class="item">
377
- <div class="item-label">航速</div>
378
- <div class="item-item">${a.speed || c}</div>
379
- </div>
380
- <div class="item">
381
- <div class="item-label">艏向</div>
382
- <div class="item-item">${a.hdg || c}</div>
383
- </div>
384
- <div class="item">
385
- <div class="item-label">航向</div>
386
- <div class="item-item">${a.cog || c}</div>
387
- </div>
388
- <div class="item">
389
- <div class="item-label">经度</div>
390
- <div class="item-item">${a.lon || c}</div>
391
- </div>
392
- <div class="item">
393
- <div class="item-label">纬度</div>
394
- <div class="item-item">${a.lat || c}</div>
395
- </div>
396
- <div class="item w-100">
397
- <div class="item-label">时间</div>
398
- <div class="item-item">${a.time}</div>
399
- </div>
400
- ${u ?? u}
401
- </div>`;
402
- }, z = (a) => {
403
- const v = a.map((V) => {
404
- const W = e.getPixelFromCoordinate(U(V.center));
405
- return {
406
- ...V,
407
- original: V,
408
- pixel: W,
409
- distance: 0
410
- // 先初始化,后续计算
411
- };
412
- });
413
- let b = 0;
414
- v[0].distance = 0;
415
- for (let V = 1; V < v.length; V++) {
416
- const W = v[V - 1].pixel, H = v[V].pixel, K = H[0] - W[0], P = H[1] - W[1];
417
- b += Math.sqrt(K * K + P * P), v[V].distance = b;
418
- }
419
- const C = v.filter(
420
- (V, W) => W === 0 || W === v.length - 1
421
- ), E = [];
422
- for (let V = 0; V < C.length; V++) {
423
- const W = C[V];
424
- if (E.push(W), V < C.length - 1) {
425
- const H = C[V + 1], K = H.distance - W.distance, P = Math.floor(K / 100);
426
- for (let q = 1; q <= P; q++) {
427
- const Q = W.distance + q * 100;
428
- if (Q >= H.distance) break;
429
- const _ = ae(
430
- v,
431
- Q
432
- );
433
- _ && E.push(_);
434
- }
435
- }
436
- }
437
- return Array.from(
438
- new Map(E.map((V) => [V.distance.toFixed(2), V])).values()
439
- ).map((V) => ({
440
- ...V.original,
441
- // 优先保留原始数据
442
- ...V,
443
- // 覆盖坐标等计算属性
444
- coord: V.coord,
445
- // 确保使用插值后的坐标
446
- pixel: V.pixel,
447
- distance: V.distance
448
- }));
449
- };
450
- function ae(a, u) {
451
- for (let v = 1; v < a.length; v++) {
452
- const b = a[v - 1], C = a[v];
453
- if (u >= b.distance && u <= C.distance) {
454
- const E = (u - b.distance) / (C.distance - b.distance), G = b.pixel[0] + E * (C.pixel[0] - b.pixel[0]), V = b.pixel[1] + E * (C.pixel[1] - b.pixel[1]), W = e == null ? void 0 : e.getCoordinateFromPixel([G, V]);
455
- return {
456
- ...b,
457
- // 继承前一个点的属性(可调整)
458
- coord: W,
459
- pixel: [G, V],
460
- distance: u,
461
- original: void 0
462
- // 明确标记为插值生成点
463
- };
464
- }
465
- }
466
- return null;
467
- }
468
- const re = async (a, u) => {
469
- await be(), await Le(a);
470
- const v = z(u), b = v.map((E) => se(E));
471
- n.get(a).getSource().addFeatures(b), wt(a, v, u, B), v.forEach((E) => {
472
- const G = Ze(a, B, E);
473
- e.addOverlay(G);
474
- });
475
- }, se = (a) => {
476
- const u = new ie({
477
- geometry: new le(a.centerPoint),
478
- data: a
479
- });
480
- u.set("type", "track_point"), u.set("trackId", a.id), u.set("data", a);
481
- let v = [
482
- ...yt(a, B)
483
- ];
484
- return (a.index === 0 || a.index === s[a.id].length - 1) && (v = [...xt(a)], u.set("type", "track_begin")), a.state !== void 0 && a.state !== null && (v = [...mt(a)], u.set("type", "track_icon")), u.setStyle(v), u;
485
- }, Ze = (a, u, v) => {
486
- const b = document.createElement("div");
487
- b.className = "track-overlay-label", b.style.position = "relative", b.style.backgroundColor = "rgba(255,255,255,0.8)", b.style.border = `1px solid ${u}`, b.style.fontSize = "12px", b.innerHTML = `
488
- <span>${v.time}</span>
489
- <svg
490
- style="position: absolute;right: -20px;top: 0;"
491
- viewBox="0 0 20 20"
492
- xmlns="http://www.w3.org/2000/svg"
493
- width="20"
494
- height="20">
495
- <line x1="-20" y1="0"
496
- x2="20" y2="20"
497
- stroke="${u}"
498
- stroke-width="1" />
499
- `;
500
- const C = new ce({
501
- element: b,
502
- position: U(v.center),
503
- positioning: "top-right",
504
- offset: [-20, -20],
505
- stopEvent: !1,
506
- className: "track-label-time-overlay"
507
- });
508
- return C.set("class", "track-label-overlay"), C.set("trackId", a), C;
509
- }, be = () => {
510
- const a = e == null ? void 0 : e.getOverlays().getArray(), u = a == null ? void 0 : a.filter((v) => v.get("class") === "track-label-overlay");
511
- u && u.length > 0 && u.forEach((v) => {
512
- v.setPosition(void 0), v.dispose();
513
- });
514
- }, Le = (a) => {
515
- const u = n.get(a).getSource();
516
- u.forEachFeature((v) => {
517
- v.get("type") !== "line" && u.removeFeature(v);
518
- });
519
- }, yt = (a, u) => [
520
- new j({
521
- // 扩大交互热区
522
- image: new Oe({
523
- stroke: new fe({ color: "rgba(0, 0, 0, 0.01)", width: 20 }),
524
- radius: 3
525
- })
526
- }),
527
- // 轨迹点样式
528
- new j({
529
- image: new Oe({
530
- fill: new I({ color: u }),
531
- stroke: new fe({ color: "#fff", width: 2 }),
532
- radius: 3
533
- })
534
- })
535
- // textStyle,
536
- ], mt = (a) => {
537
- const u = "#E31818", v = "#1890FF", b = "&#xe6d2", C = new j({
538
- text: new we({
539
- font: "Normal 22px map-iconfont",
540
- text: ge(b),
541
- offsetY: -10,
542
- fill: new I({
543
- color: Number(a.state) === 0 ? u : Number(a.state) === 1 ? v : ""
544
- })
545
- }),
546
- zIndex: 99
547
- }), G = nt("&#xe6e2;"), W = nt("&#xe703;"), H = [];
548
- return Number(a.state) === 0 ? H.push(G) : Number(a.state) === 1 && H.push(W), H.push(C), H;
549
- }, wt = (a, u, v, b) => {
550
- const C = u || [], E = u.length;
551
- E || (C.push(v[0]), C.push(v[v.length - 1]));
552
- const G = [];
553
- for (let W = 0; W < E - 1; W++) {
554
- let H;
555
- const K = u[W], P = (u[W + 1].index + K.index) / 2;
556
- if (P % 2 === 0)
557
- H = v[P].centerPoint;
558
- else {
559
- const q = v[Math.floor(P)], Q = v[Math.ceil(P)];
560
- if (q && Q) {
561
- const [_, Te] = q.centerPoint, [Fe, Pe] = Q.centerPoint;
562
- H = [(_ + Fe) / 2, (Te + Pe) / 2];
563
- }
564
- }
565
- if (H) {
566
- const q = new ie({
567
- geometry: new le(H)
568
- });
569
- q.set("type", "track_arrow"), q.setStyle(
570
- new j({
571
- text: new we({
572
- font: "700 12px map-iconfont",
573
- text: ge("&#xe6bc;"),
574
- fill: new I({ color: b }),
575
- // 设置箭头旋转 角度转为弧度
576
- rotation: Ie(
577
- u[W].center,
578
- u[W + 1].center
579
- ) * (Math.PI / 180)
580
- })
581
- })
582
- ), G.push(q);
583
- }
584
- }
585
- const V = n.get(a).getSource();
586
- V == null || V.addFeatures(G);
587
- }, Ue = (a) => {
588
- var E, G;
589
- const u = e.getView(), v = (E = n == null ? void 0 : n.get(a)) == null ? void 0 : E.getSource(), b = M || (a ? v == null ? void 0 : v.getFeatureById(a) : null);
590
- if (!b) return;
591
- const C = (G = b == null ? void 0 : b.getGeometry()) == null ? void 0 : G.getExtent();
592
- if (C != null && C.length)
593
- try {
594
- const V = Wt(C, Math.max(C[2] - C[0], C[3] - C[1]) * 0.02);
595
- u.fit(V);
596
- } catch (V) {
597
- console.log(V);
598
- }
599
- }, xt = (a) => {
600
- const u = "&#xe69b;", C = a.index === 0 ? "#fcdc3f" : "#ff0000";
601
- return [new j({
602
- text: new we({
603
- font: "Normal 14px map-iconfont",
604
- text: ge(u),
605
- fill: new I({ color: C })
606
- }),
607
- zIndex: 101
608
- })];
609
- }, bt = () => {
610
- console.log("清除所有的轨迹-----"), Ee(), n.forEach((u) => {
611
- var v;
612
- (v = u.getSource()) == null || v.clear(), e == null || e.removeLayer(u);
613
- }), Object.keys(s).forEach((u) => {
614
- n.delete(u), delete s[u];
615
- }), be();
616
- }, kt = (a) => {
617
- const u = n.get(a || l);
618
- u == null || u.setVisible(!1);
619
- const v = e.getOverlays().getArray();
620
- for (let b = 0; b < v.length; ) {
621
- const C = v[b];
622
- C.get("class") === "track-label-overlay" ? (C.setPosition(void 0), e.removeOverlay(C)) : b++;
623
- }
624
- Ee();
625
- }, Mt = (a, u = xe.NM) => {
626
- const v = {
627
- id: a,
628
- length: "--"
629
- }, C = (s[a] || []).map(
630
- (G) => Me([G.lon, G.lat], J.data, J.mercator)
631
- ), E = new $e(C);
632
- return v.length = lo(E, u) || "--", v;
633
- }, pt = (a, u) => {
634
- Ct(String(a), u);
635
- }, Ct = (a, u) => {
636
- const v = s[String(a)], b = v == null ? void 0 : v.map((C) => [C.lon, C.lat]);
637
- b && Tt(b, u);
638
- }, De = new j({
639
- text: new we({
640
- font: "700 20px map-iconfont",
641
- text: ge("&#xe657;"),
642
- fill: new I({ color: "#ff0000" }),
643
- rotation: 0
644
- // 初始旋转角度
645
- })
646
- }), Lt = (a, u) => {
647
- var P, q;
648
- const v = Number(50 * u), b = ((P = a.frameState) == null ? void 0 : P.time) ?? Date.now(), C = b - T;
649
- if (p = (p + v * C / 1e6) % 2, T = b, p >= 1) {
650
- Ee();
651
- return;
652
- }
653
- const E = r.getCoordinateAt(
654
- p > 1 ? 2 - p : p
655
- ), G = r.getCoordinateAt(
656
- p > 1 ? p - 0.01 : p
657
- ), V = r.getCoordinateAt(
658
- p > 1 ? 2 - p : p + 0.01
659
- ), H = Ie(
660
- lt(G, "array"),
661
- lt(V, "array")
662
- ) * Math.PI / 180;
663
- (q = De.getText()) == null || q.setRotation(H), x.setCoordinates(E);
664
- const K = Bt(a);
665
- K.setStyle(De), K.drawGeometry(x), e == null || e.render();
666
- }, Et = () => {
667
- var a;
668
- $ = !0, T = Date.now(), p = 0, x = ((a = w.getGeometry()) == null ? void 0 : a.clone()) || new le([0, 0]), o && (g == null || g.on("postrender", o)), L == null || L.setGeometry(void 0);
669
- }, Ee = () => {
670
- $ && ($ = !1, L == null || L.setGeometry(void 0), o && g && g.un("postrender", o), g && (e == null || e.removeLayer(g)), g = null, L = null);
671
- }, Tt = (a, u) => {
672
- $ && Ee(), t = new ot({
673
- factor: 1e6
674
- }).writeGeometry(new $e(a)), r = new ot({
675
- factor: 1e6
676
- }).readGeometry(t, {
677
- dataProjection: J.data,
678
- featureProjection: J.mercator
679
- }), w = new ie({
680
- type: "icon",
681
- geometry: new le(r.getFirstCoordinate())
682
- });
683
- const v = w.getGeometry();
684
- x = v ? v.clone() : new le([0, 0]), L = new ie({
685
- type: "geoMarker",
686
- style: De,
687
- geometry: x
688
- }), g = new he({
689
- source: new de({
690
- features: [L]
691
- })
692
- }), e == null || e.addLayer(g), o = (b) => Lt(b, u), Et();
693
- }, Ie = (a, u, v) => {
694
- function b(P) {
695
- return 180 * (P % (2 * Math.PI)) / Math.PI;
696
- }
697
- function C(P) {
698
- return P % 360 * Math.PI / 180;
699
- }
700
- function E(P) {
701
- var q;
702
- if (!P) throw new Error("Coordinate is required");
703
- if (!Array.isArray(P)) {
704
- 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")
705
- return P == null ? void 0 : P.geometry.coordinates;
706
- if (P.type === "Point") return (P == null ? void 0 : P.coordinates) || [];
707
- }
708
- if (Array.isArray(P) && P.length >= 2 && !Array.isArray(P[0]) && !Array.isArray(P[1]))
709
- return P;
710
- throw new Error(
711
- "Coordinate must be GeoJSON Point or an Array of numbers"
712
- );
713
- }
714
- function G(P, q, Q = {}) {
715
- if (Q.final)
716
- return function(St, Nt) {
717
- return (G(Nt, St) + 180) % 360;
718
- }(P, q);
719
- const _ = E(P), Te = E(q), Fe = C(_[0]), Pe = C(Te[0]), et = C(_[1]), Ge = C(Te[1]), Ft = Math.sin(Pe - Fe) * Math.cos(Ge), Pt = Math.cos(et) * Math.sin(Ge) - Math.sin(et) * Math.cos(Ge) * Math.cos(Pe - Fe);
720
- return b(Math.atan2(Ft, Pt));
721
- }
722
- function V(P) {
723
- return !isNaN(P) && P !== null && !Array.isArray(P);
724
- }
725
- function W(P, q = {}, Q = {}) {
726
- 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);
727
- }
728
- function H(P, q = {}, Q = {}) {
729
- const _ = {
730
- type: "Feature",
731
- id: "",
732
- properties: {},
733
- bbox: {},
734
- geometry: {}
735
- };
736
- return Q.id !== void 0 && (_.id = Q.id), Q.bbox && (_.bbox = Q.bbox), _.properties = q, _.geometry = P, _;
737
- }
738
- const K = G(W(a), W(u), v);
739
- return K < 0 ? 360 + K : K;
740
- };
741
- return {
742
- render: i,
743
- remove: bt,
744
- play: pt,
745
- setCenter: Ue,
746
- close: kt,
747
- getLength: Mt,
748
- handleTrackMapEvent: D,
749
- reRenderTrackLine: Z
750
- };
751
- };
752
- function uo(e) {
753
- console.log("useShipOverlay", e);
754
- const n = ee(null), s = Se(() => ({
755
- "--overlay-color": "#FFF",
756
- "--bg-color1": e.colors && e.colors[0] ? e.colors[0] : "#ffffff",
757
- // 默认第一个颜色
758
- "--bg-color2": e.colors && e.colors[1] ? e.colors[1] : "#ffffff",
759
- "--bg-color": "#ffffff",
760
- position: "relative",
761
- "pointer-events": "none"
762
- })), l = Se(() => {
763
- var d;
764
- return {
765
- position: "relative",
766
- "border-radius": "1px",
767
- "background-color": "var(--content-bg)",
768
- color: "#000",
769
- padding: "2px 5px 2px 0px",
770
- font: "500 Normal 12px",
771
- "font-size": "12px",
772
- "box-shadow": "0 2px 10px rgba(0, 0, 0, 0.2)",
773
- "white-space": "nowrap",
774
- border: "1px solid #FFF",
775
- "pointer-events": "auto",
776
- // 'transition': 'background-color 0.5s ease, border 0.5s ease',
777
- "z-index": "1",
778
- display: "flex",
779
- "align-items": "center",
780
- 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"
781
- // "animation": props.selected ? 'blink 1.5s ease-in-out infinite' : 'none', // 动画开关
782
- };
783
- }), c = Se(() => ({
784
- width: "14px",
785
- height: "14px",
786
- margin: "1px 5px 1px 1px",
787
- "background-color": "var(--attention-bg)"
788
- })), o = Se(() => ({
789
- position: "absolute",
790
- top: "0px",
791
- color: "var(--overlay-color)",
792
- "pointer-events": "none",
793
- transform: "translateY(-1px)",
794
- "z-index": "0",
795
- width: "20px",
796
- height: "20px",
797
- overflow: "visible",
798
- left: "-20px"
799
- }));
800
- return () => ne("div", {
801
- ref: n,
802
- class: "ship-overlay-container",
803
- style: s.value
804
- }, [
805
- ne(
806
- "div",
807
- {
808
- class: "ship-overlay-content",
809
- style: l.value
810
- },
811
- [
812
- ne("div", {
813
- style: e.selected ? c.value : {}
814
- }, ""),
815
- ne("div", {
816
- class: "text",
817
- style: {
818
- fontSize: "12px",
819
- fontWeight: 500,
820
- fontFamily: "Arial"
821
- }
822
- }, e.name || "未命名船舶"),
823
- ne("div", {
824
- class: "icons",
825
- style: {
826
- color: "#3370ff"
827
- }
828
- }, [
829
- e.existDevice ? ne("i", {
830
- class: "map-iconfont icon-camera",
831
- style: {
832
- fontSize: "12px"
833
- }
834
- }) : "",
835
- e.existMobile ? ne("i", {
836
- class: "map-iconfont icon-tele",
837
- style: {
838
- fontSize: "12px"
839
- }
840
- }) : "",
841
- e.existWaterGauge ? ne("i", {
842
- class: "map-iconfont icon-ruler",
843
- style: {
844
- fontSize: "12px"
845
- }
846
- }) : ""
847
- ])
848
- ]
849
- ),
850
- ne("svg", {
851
- class: "ship-overlay-line",
852
- style: o.value,
853
- viewBox: "0 0 20 20",
854
- xmlns: "http://www.w3.org/2000/svg"
855
- }, [
856
- ne("line", {
857
- x1: "0",
858
- y1: "20",
859
- x2: "20",
860
- y2: "4",
861
- stroke: "white",
862
- "stroke-width": "1"
863
- })
864
- ])
865
- ]);
866
- }
867
- const go = (e) => {
868
- const { spd: n, hdg: s, cog: l } = e;
869
- return n ? s !== null && +s != 511 && l !== null ? l - +s >= 3 ? oe.right : l - +s <= -3 ? oe.left : oe.front : oe.front : "";
870
- }, ve = (e, n) => {
871
- const { shipData: s } = n.getProperties(), l = gt(e), c = _e(e, s, l);
872
- return fo(n, c, l);
873
- }, gt = (e) => {
874
- const n = e == null ? void 0 : e.getView().getZoom();
875
- return n <= te.shipModelMax && n >= te.shipTriggleMin ? "ship" : "triangle";
876
- }, _e = (e, n, s) => {
877
- if (s === "ship") {
878
- const { len: l, wid: c } = n, o = 97, d = 20, t = 1 / (e == null ? void 0 : e.getView().getResolution()), r = l * t / o, w = c * t / d, x = Math.min(r, w);
879
- return x < 0.2 ? 0.2 : x > 2 ? 2 : x;
880
- }
881
- return te.scaleNum;
882
- }, fo = (e, n, s) => {
883
- const { color: l, direct: c, isHighlight: o, shipData: d } = e.getProperties(), m = ((d == null ? void 0 : d.cog) - 90 + 360) % 360;
884
- return new j({
885
- image: new pe({
886
- src: t(),
887
- scale: n || te.scaleNum,
888
- anchor: [0.5, 0.5],
889
- rotation: m * Math.PI / 180,
890
- rotateWithView: !1
891
- })
892
- });
893
- function t() {
894
- return `data:image/svg+xml;utf8,${encodeURIComponent(r())}`;
895
- }
896
- function r() {
897
- switch (s) {
898
- case "triangle":
899
- return `<svg width="41" height="24" viewBox="0 0 41 24" fill="none" xmlns="http://www.w3.org/2000/svg">
900
- <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"
901
- fill="${l}" stroke="${o ? "#FF2424" : "black"}" stroke-width="${o ? "2" : "0.578947"}" />
902
- <!--path船航向左边或者向前-->
903
- ${c === oe.left && `<path d="M30 12L40 12L40 8" stroke="${o ? "#FF2424" : "black"}" stroke-width="2"/>`}
904
- <!--path船航向右边-->
905
- ${c === oe.right && `<path d="M30 12L40 12L40 16" stroke="${o ? "#FF2424" : "black"}" stroke-width="2"/>`}
906
- <!--path黑线无左右-->
907
- ${c === oe.front && `<path d="M30 12L40 12" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
908
- </svg>
909
- `;
910
- case "ship":
911
- return `<svg width="97" height="20" viewBox="0 0 97 20" fill="none" xmlns="http://www.w3.org/2000/svg">
912
- <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"
913
- fill="${l}" stroke="${o ? "#FF2424" : "black"}" stroke-width="${o ? "4" : "0.578947"}"/>
914
- ${c === oe.left && `<path d="M86 10L96 10L96 6" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
915
- ${c === oe.right && `<path d="M86 10L96 10L96 14" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
916
- ${c === oe.front && `<path d="M86 10L96 10" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
917
- </svg>
918
- `;
919
- default:
920
- return "";
921
- }
922
- }
923
- }, ho = (e, n) => {
924
- const s = ft(e, n), l = n.id, { lon: c, lat: o } = n, d = new ce({
925
- element: s,
926
- position: U([c, o]),
927
- id: "selected-" + l,
928
- positioning: "center-center",
929
- offset: [0, 5],
930
- className: "ship-selected-overlay"
931
- });
932
- return d.set("class", "ship-overlay-selected"), d;
933
- }, ft = (e, n) => {
934
- const s = gt(e), l = _e(e, n, s), c = s === "ship" ? 109 : 49, o = `
935
- <svg style="transform:scale(${l});" xmlns="http://www.w3.org/2000/svg" width="${c}" height="${c}" viewBox="0 0 49 49" fill="none">
936
- <path d="M1.99982 46.9998L1.99982 1.99982L46.9998 1.99982L46.9998 46.9998L1.99982 46.9998Z" fill="#FF2424" fill-opacity="0.2"/>
937
- <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"/>
938
- </svg>
939
- `, d = document.createElement("div");
940
- return d.className = "ship-overlay-selected", d.innerHTML = o, d;
941
- };
942
- function vo(e, n, s, l) {
943
- if (n) {
944
- const c = new ce({
945
- element: s,
946
- positioning: "top-left",
947
- id: "label-" + (l == null ? void 0 : l.id),
948
- offset: [20, -20],
949
- autoPan: !1,
950
- position: n,
951
- className: l.blinking ? "ship-label-overlay-blinking" : "ship-label-overlay"
952
- });
953
- c.set("class", "zh-map-ship-overlay"), e.addOverlay(c);
954
- }
955
- }
956
- const yo = (e, n) => {
957
- const { lon: s, lat: l, blinking: c } = n, o = ht(n);
958
- s && l && vo(e, U([s, l]), o, { ...n, blinking: c });
959
- }, ht = (e) => {
960
- const n = document.createElement("div");
961
- n.className = "ship-overlay-box", n.style.position = "relative";
962
- const { lon: s, lat: l, blinking: c, blinkingColors: o, name: d } = e, m = Be({
963
- setup() {
964
- return uo({
965
- position: [s + 2e-3, l + 2e-3],
966
- selected: c,
967
- name: d,
968
- colors: o || [],
969
- existDevice: e == null ? void 0 : e.existDevice,
970
- existMobile: e == null ? void 0 : e.existMobile,
971
- existWaterGauge: e == null ? void 0 : e.existWaterGauge
972
- });
973
- }
974
- });
975
- return $t(m, n), n;
976
- }, st = (e) => {
977
- const n = [];
978
- return e.existDevice && n.push("&#xe687;"), e.existMobile && n.push("&#xe688;"), e.existWaterGauge && n.push("&#xe686;"), n;
979
- };
980
- function mo() {
981
- const e = [
982
- "left-top",
983
- "left-middle",
984
- "left-bottom",
985
- "right-top",
986
- "right-middle",
987
- "right-bottom"
988
- ];
989
- return e[Math.floor(Math.random() * e.length)];
990
- }
991
- const wo = window.devicePixelRatio || 1, Ae = /* @__PURE__ */ new Map();
992
- let ke = null, We = null;
993
- function xo(e, n, s = "left-bottom", l = 2) {
994
- const c = `${e}-${n.join(",")}-${s}-${l}`;
995
- if (Ae.has(c))
996
- return Ae.get(c);
997
- if (!ke) {
998
- ke = document.createElement("canvas");
999
- try {
1000
- We = ke.getContext("2d", {
1001
- willReadFrequently: !0
1002
- });
1003
- } catch {
1004
- We = ke.getContext("2d");
1005
- }
1006
- }
1007
- const o = ke, d = We;
1008
- if (!d) return "";
1009
- o.width = 0, o.height = 0;
1010
- const m = 2, t = 8, r = 16, w = window.devicePixelRatio || 1, x = "500 12px Arial", L = "14px map-iconfont";
1011
- d.font = x;
1012
- const T = d.measureText(e).width;
1013
- d.font = L;
1014
- const g = n.map((N) => ({ width: d.measureText(ge(N)).width, height: 14 })), p = g.reduce((N, D) => N + D.width, 0), M = (n.length - 1) * l, f = t + T + p + M + t, O = m + 14 + m;
1015
- let Y, A, B = 0, R = 0, Z = 0, F = 0, i = 0, y = 0;
1016
- switch (Y = r + f, s) {
1017
- case "right-top":
1018
- A = r + O, B = 0, R = r + O, Z = r, F = 0, i = r, y = 0;
1019
- break;
1020
- case "right-middle":
1021
- A = O, B = 0, R = O / 2, Z = r, F = O / 2, i = r, y = 0;
1022
- break;
1023
- case "right-bottom":
1024
- A = r + O, B = 0, R = 0, Z = r, F = r, i = r, y = r;
1025
- break;
1026
- case "left-top":
1027
- A = r + O, B = f, R = r, Z = f + r, F = O + r, i = 0, y = 0;
1028
- break;
1029
- case "left-middle":
1030
- A = O, B = f, R = O / 2, Z = f + r, F = O / 2, i = 0, y = 0;
1031
- break;
1032
- case "left-bottom":
1033
- A = r + O, B = f, R = O, Z = f + r, F = 0, i = 0, y = r;
1034
- break;
1035
- }
1036
- 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(Z, F), d.strokeStyle = "#FFF", d.lineWidth = 1, d.stroke(), d.fillStyle = "#FFF", d.fillRect(i, y, f, O), d.font = x, d.textBaseline = "middle";
1037
- const h = y + m + O / 2;
1038
- d.strokeStyle = "#ffffff", d.lineWidth = 1, d.strokeText(e, i + t, h), d.fillStyle = "#000000", d.fillText(e, i + t, h), d.font = L, d.fillStyle = "#3370ff";
1039
- let k = i + t + T + l;
1040
- n.length > 0 && n.forEach((N, D) => {
1041
- const X = y + m + O / 2;
1042
- d.fillText(ge(N), k, X), k += g[D].width + l;
1043
- });
1044
- const S = o.toDataURL("image/png");
1045
- return Ae.set(c, S), S;
1046
- }
1047
- const it = (e, n) => {
1048
- const { name: s, rightIcons: l, selected: c } = e.getProperties(), o = n !== 1 ? mo() : "right-top", d = xo(s, l, o);
1049
- let m = [0, 0];
1050
- switch (o) {
1051
- case "right-top":
1052
- m = [0, 1];
1053
- break;
1054
- case "right-middle":
1055
- m = [0, 0.5];
1056
- break;
1057
- case "right-bottom":
1058
- m = [0, 0];
1059
- break;
1060
- case "left-top":
1061
- m = [1, 1];
1062
- break;
1063
- case "left-middle":
1064
- m = [1, 0.5];
1065
- break;
1066
- case "left-bottom":
1067
- m = [1, 0];
1068
- break;
1069
- }
1070
- return new j({
1071
- image: new pe({
1072
- src: d,
1073
- anchor: m,
1074
- displacement: [0, 0],
1075
- scale: 1 / wo,
1076
- anchorXUnits: "fraction",
1077
- anchorYUnits: "fraction"
1078
- }),
1079
- zIndex: c ? 100 : 10
1080
- });
1081
- }, bo = (e) => {
1082
- let n = null, s = null;
1083
- const l = new de(), c = new qt({
1084
- source: l,
1085
- className: "zh-map--ship-layer",
1086
- renderBuffer: 300,
1087
- zIndex: 101,
1088
- hitTolerance: 10
1089
- }), o = new de(), d = new he({
1090
- source: o,
1091
- className: "zh-map--ship-label-layer",
1092
- zIndex: 102,
1093
- updateWhileInteracting: !1,
1094
- updateWhileAnimating: !1,
1095
- declutter: !0
1096
- });
1097
- e == null || e.addLayer(c), e == null || e.addLayer(d);
1098
- let m = null, t = "", r = {}, w = {};
1099
- const x = (i) => {
1100
- if (!i || !e) return;
1101
- const y = (s == null ? void 0 : s.id) || (n == null ? void 0 : n.get("id"));
1102
- if (s) {
1103
- const h = i.filter((k) => k.id === y);
1104
- h.length === 0 ? i.push(s) : s = h[0];
1105
- }
1106
- p(), F(i), $();
1107
- }, L = (i) => {
1108
- var z;
1109
- const y = (s == null ? void 0 : s.id) || (n == null ? void 0 : n.get("id")), h = 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", D = go(i), X = new ie({
1110
- geometry: new le(h),
1111
- // 船舶数据
1112
- shipData: i,
1113
- id: i.id,
1114
- name: i.cnname || i.enname || i.name || i.id || "未命名船舶",
1115
- selected: i.id === y,
1116
- // 图标
1117
- rightIcons: st(i),
1118
- // 船舶颜色
1119
- color: N,
1120
- // 船艏向的方向
1121
- direct: D,
1122
- // 高亮
1123
- isHighlight: !1
1124
- });
1125
- return X.set("clickGeometry", new Ht(h)), X;
1126
- }, $ = async () => {
1127
- if (!s || !e) return;
1128
- let y = e.getOverlays().getArray().find((h) => h.get("class") == "ship-overlay-selected");
1129
- if (y) {
1130
- const h = ft(e, s);
1131
- await y.setElement(h), await y.setPosition(U([s.lon, s.lat]));
1132
- } else
1133
- y = ho(e, s), y && e.addOverlay(y);
1134
- setTimeout(() => {
1135
- var h;
1136
- y && ((h = y.get("element")) != null && h.parentElement) && (y.get("element").parentElement.style.display = "block");
1137
- }, 20);
1138
- }, T = (i) => {
1139
- if (i === "start") {
1140
- const y = () => {
1141
- l.getFeatures().forEach((h) => {
1142
- h.setStyle(ve(e, h));
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((h) => h.get("class") == "ship-overlay-selected");
1150
- if (y) {
1151
- const h = y.getElement(), k = _e(e, s, "ship"), S = h.querySelector("svg");
1152
- console.log(S), S && (S.style.transform = `scale(${k})`);
1153
- }
1154
- }, p = () => {
1155
- e && l && (M(), l.clear(), o.clear(), T("end"));
1156
- }, M = (i) => {
1157
- const y = e.getOverlays().getArray().filter((h) => h.get("class") == "zh-map-ship-overlay");
1158
- if (y && y.length > 0) {
1159
- for (let h = 0; h < y.length; h++)
1160
- if (y[h].get("class") !== "ship-overlay-selected") {
1161
- const k = y[h];
1162
- console.log("overlay---", k), k.setPosition(void 0), e.removeOverlay(k), k.dispose();
1163
- }
1164
- }
1165
- }, f = (i, y) => {
1166
- r = i, w = y;
1167
- const h = e.getOverlays().getArray(), k = l.getFeatures();
1168
- for (const S in r) {
1169
- const N = r[S], D = h.find((z) => z.getId() === "label-" + S), X = k.find((z) => S === z.get("id"));
1170
- if (D && 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 = D.getElement(), Le = ht(Ze);
1179
- be && be !== Le && D.setElement(Le);
1180
- }
1181
- }
1182
- }, O = (i) => {
1183
- if (!e) return;
1184
- const y = l.getFeatures(), h = o.getFeatures(), k = n ? n.get("id") : "", S = y.filter((z) => z.get("id") !== k), N = h == null ? void 0 : h.filter((z) => z.get("id") !== k), D = /* @__PURE__ */ new Map();
1185
- i.forEach((z) => {
1186
- D.set(z.id, !0);
1187
- });
1188
- const X = e.getOverlays().getArray();
1189
- S.forEach((z) => {
1190
- const ae = z.get("id");
1191
- if (!D.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
- }), N.forEach((z) => {
1200
- const ae = z.get("id");
1201
- if (!D.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 = l.getFeatures().find((k) => k.get("id") === i.id), h = o.getFeatures().find((k) => k.get("id") === i.id);
1212
- y && (n = y), h && h.set("selected", !0), s = i, $();
1213
- } else
1214
- console.log("取消选中"), s = null, n = null, R();
1215
- }, A = ze((i, y, h) => {
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), h && h(S)), y === "hover") {
1220
- t && t !== S && B(), t = S;
1221
- const N = l.getFeatures().find((D) => D.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 ? l.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((h) => h.get("class") == "ship-overlay-selected");
1235
- y && y.setPosition(void 0);
1236
- } catch (i) {
1237
- console.log(i);
1238
- }
1239
- }, Z = (i, y) => {
1240
- const h = U([i == null ? void 0 : i.lon, i == null ? void 0 : i.lat]), k = new ie({
1241
- geometry: new le(h),
1242
- name: i.cnname || i.enname || i.name || i.id || "未命名船舶",
1243
- // 图标
1244
- rightIcons: st(i),
1245
- selected: (i == null ? void 0 : i.id) === (s == null ? void 0 : s.id),
1246
- shipData: i
1247
- });
1248
- k.set("id", i.id);
1249
- const S = it(k, y);
1250
- return k.setStyle(S), k;
1251
- }, F = (i) => {
1252
- const y = e.getView().getZoom();
1253
- i.forEach((h) => {
1254
- const k = L(h);
1255
- if (k.setStyle(ve(e, k)), l.addFeature(k), (s == null ? void 0 : s.id) == h.id || y >= te.shipModelMin)
1256
- if (r[h.id]) {
1257
- if (h.id && w[h == null ? void 0 : h.id]) {
1258
- const S = w[h == null ? void 0 : h.id] || {}, N = (S == null ? void 0 : S.blinkColors) || [], D = (S == null ? void 0 : S.shipState) || "", X = (h.cnname || h.enname || h.name || h.id || "未命名船舶") + "(" + D + ")", z = {
1259
- ...h,
1260
- name: X,
1261
- blinking: r[h.id],
1262
- blinkingColors: N || []
1263
- };
1264
- yo(e, z);
1265
- }
1266
- } else {
1267
- const S = Z(h, i.length);
1268
- o.addFeature(S);
1269
- }
1270
- });
1271
- };
1272
- return {
1273
- render: x,
1274
- selected: Y,
1275
- filter: O,
1276
- blinking: f,
1277
- clear: p,
1278
- handleShipMapEvent: A,
1279
- changeShipScale: T,
1280
- changeSelectedScale: g
1281
- };
1282
- }, ko = (e) => {
1283
- const n = () => e == null ? void 0 : e.getLayers(), s = ee("vector"), l = () => s.value, c = (t) => {
1284
- s.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: l,
1314
- setShowLayerType: c
1315
- };
1316
- }, Mo = () => {
1317
- const e = ee();
1318
- return {
1319
- setProps: (l) => {
1320
- e.value = l;
1321
- },
1322
- getProps: () => e.value
1323
- };
1324
- }, po = (e) => {
1325
- const n = "zh-map-location-layer";
1326
- let s, l, c = null, o = null;
1327
- const d = (T) => {
1328
- if (!(!T || T.length === 0)) {
1329
- if (l || (l = new de()), l.clear(), o) {
1330
- const g = T.find((p) => p.id === o.id);
1331
- g ? o = g : T.push(o);
1332
- }
1333
- T.forEach((g) => {
1334
- m(g);
1335
- }), s || (s = new he({
1336
- className: n,
1337
- source: l,
1338
- zIndex: 100
1339
- }), e == null || e.addLayer(s));
1340
- }
1341
- }, m = (T) => {
1342
- const g = e == null ? void 0 : e.getView().getZoom(), [p, M] = T.latLon.split(","), f = new ie({
1343
- geometry: new le(U([Number(p), Number(M)]))
1344
- });
1345
- f.setStyle(t(T, g, T.id === (o == null ? void 0 : o.id))), f.set("loactionData", T), l.addFeature(f);
1346
- }, t = (T, g, p) => {
1347
- const M = {
1348
- image: new pe({
1349
- src: p && T.selectedPath || T.defaultPath,
1350
- scale: 0.5 * g / 10
1351
- })
1352
- };
1353
- return T.name && (M.text = new we({
1354
- text: T.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(M);
1364
- }, r = () => {
1365
- if (c) {
1366
- const T = c.get("loactionData").id;
1367
- l.getFeatures().forEach((g) => {
1368
- g.get("loactionData").id !== T && l.removeFeature(g);
1369
- });
1370
- } else
1371
- l.clear();
1372
- }, w = () => {
1373
- var M;
1374
- const T = c.get("loactionData"), g = (M = e == null ? void 0 : e.getView()) == null ? void 0 : M.getZoom();
1375
- l.getFeatures().forEach((f) => {
1376
- f.get("loactionData").id === T.id && (f == null || f.setStyle(t(T, g, !1)));
1377
- }), o = null, c = null;
1378
- }, x = (T) => {
1379
- T ? (L(), $(T)) : clearSelectedPort();
1380
- }, L = () => {
1381
- var T;
1382
- if (c) {
1383
- const g = c.get("loactionData"), p = (T = e == null ? void 0 : e.getView()) == null ? void 0 : T.getZoom();
1384
- c.setStyle(t(g, p, !1));
1385
- }
1386
- }, $ = (T) => {
1387
- const g = l.getFeatures();
1388
- o = T, c = g.find((p) => p.get("loactionData").id === T.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
- }, Ce = (e, n) => {
1405
- const s = e.getViewport();
1406
- s && (s.style.cursor = n);
1407
- }, Eo = (e, n) => {
1408
- const s = ee([]), l = ee("km"), c = (F) => {
1409
- l.value = F;
1410
- };
1411
- let o;
1412
- const d = ee(!1), m = () => {
1413
- Ce(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 $ = (F) => {
1433
- if (F.dragging)
1434
- return;
1435
- let i = "点击选择起点";
1436
- x && (i = "单击继续,双击结束"), o && (o.innerHTML = i, L.setPosition(F.coordinate), o.classList.remove("hidden"));
1437
- };
1438
- let T;
1439
- const g = () => {
1440
- T = new Ve({
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 Oe({
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(T), O(), Y();
1465
- let F;
1466
- T.on("drawstart", function(i) {
1467
- var h;
1468
- x = i.feature, x.set("randomId", p());
1469
- let y;
1470
- F = (h = x.getGeometry()) == null ? void 0 : h.on("change", function(k) {
1471
- const S = k.target, N = vt(S, l.value);
1472
- y = S.getLastCoordinate(), M && N && (M.innerHTML = N), f.setPosition(y);
1473
- });
1474
- }), T.on("drawend", function() {
1475
- var i, y, h;
1476
- if (M && (M.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), M != null && M.innerHTML) {
1477
- const k = (x == null ? void 0 : x.get("randomId")) || p();
1478
- s.value.push({ id: k, value: M == null ? void 0 : M.innerHTML }), M.innerHTML = `${M.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
- }), f.setOffset([0, -7]), x = null, M = null, O(), F && qe(F), (h = (y = n.getProps()) == null ? void 0 : y.lineDrawEnd) == null || h.call(y, s.value);
1486
- });
1487
- }, p = () => Math.random().toString(36).substring(2, 9);
1488
- let M, f;
1489
- const O = () => {
1490
- M != null && M.parentNode && M.parentNode.removeChild(M), M = document.createElement("div"), M.className = "ol-tooltip ol-tooltip-measure", f = new ce({
1491
- element: M,
1492
- offset: [0, -15],
1493
- positioning: "bottom-center",
1494
- stopEvent: !1,
1495
- insertFirst: !1
1496
- }), e == null || e.addOverlay(f);
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
- s.value.forEach((F, 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 h = t.getFeatures();
1509
- h[i] && t.removeFeature(h[i]);
1510
- }), R(), Lo(e), d.value = !1, Ce(e, "pointer");
1511
- }, B = (F) => {
1512
- var y, h, k, S;
1513
- const i = s.value.findIndex((N) => N.id === F);
1514
- if (i !== -1) {
1515
- s.value.splice(i, 1);
1516
- const N = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
1517
- N[i] && ((h = (y = N[i]) == null ? void 0 : y.parentNode) == null || h.removeChild(N[i]));
1518
- const D = t.getFeatures();
1519
- D[i] && t.removeFeature(D[i]);
1520
- }
1521
- (S = (k = n.getProps()) == null ? void 0 : k.lineDrawEnd) == null || S.call(k, s.value);
1522
- }, R = () => {
1523
- if (s.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((F) => {
1524
- var i;
1525
- (i = F == null ? void 0 : F.parentNode) == null || i.removeChild(F);
1526
- }), t == null || t.clear(), T) {
1527
- const F = e.getInteractions().getArray().find((i) => rt(i) === rt(T));
1528
- F && e.removeInteraction(F);
1529
- }
1530
- e.removeLayer(r), o != null && o.parentNode && o.parentNode.removeChild(o), M != null && M.parentNode && M.parentNode.removeChild(M);
1531
- };
1532
- return {
1533
- open: m,
1534
- close: A,
1535
- deleteLine: B,
1536
- setUnit: c,
1537
- getState: () => d.value
1538
- };
1539
- }, vt = (e, n) => {
1540
- const l = Qe(e);
1541
- let c = "";
1542
- switch (n) {
1543
- case "m":
1544
- c = `${Math.round(l * 100) / 100} m`;
1545
- break;
1546
- case "km":
1547
- c = `${Math.round(l / 1e3 * 100) / 100} km`;
1548
- break;
1549
- case "nm":
1550
- c = (Math.round(l / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
1551
- break;
1552
- }
1553
- return c;
1554
- }, To = (e, n) => {
1555
- let s, l;
1556
- const c = () => {
1557
- o(), Ce(e, "crosshair");
1558
- }, o = () => {
1559
- t(), M(), Y(), $();
1560
- };
1561
- let d = null, m = null;
1562
- const t = () => {
1563
- if (d && m) return;
1564
- const R = new de(), Z = new he({
1565
- source: R,
1566
- style: new j({
1567
- stroke: new fe({
1568
- color: "#fbcc33",
1569
- width: 2
1570
- })
1571
- })
1572
- });
1573
- d = Z, m = R, e.on("pointermove", w), e.addLayer(Z), e.on(["dblclick"], function(F) {
1574
- x && (F.stopPropagation(), F.preventDefault());
1575
- });
1576
- };
1577
- let r;
1578
- const w = (R) => {
1579
- if (R.dragging) return;
1580
- const Z = r ? "单击继续,双击结束" : "点击选择起点";
1581
- f && (f.innerHTML = Z, O.setPosition(R.coordinate));
1582
- };
1583
- let x, L = !1;
1584
- const $ = () => {
1585
- if (s) {
1586
- f != null && f.parentNode && f.parentNode.removeChild(f);
1587
- const R = s.getGeometry();
1588
- if (!R) return;
1589
- const Z = T(R, "nm");
1590
- g && (g.innerHTML = `
1591
- <span class="text">面积:${Z}${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 F = R.getCoordinates(), i = F[0][F[0].length - 2];
1594
- if (p.setPosition(i), d) {
1595
- const h = d.getSource();
1596
- h && s && (h.clear(), h.addFeature(s));
1597
- }
1598
- setTimeout(() => {
1599
- var h;
1600
- (h = document.querySelector(".delete-icon")) == null || h.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(s.getGeometry().getExtent());
1606
- e == null || e.getView().setCenter(y);
1607
- return;
1608
- }
1609
- x = new Ve({
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 Oe({
1624
- radius: 5,
1625
- fill: new I({
1626
- color: "rgb(51,112,255, 1)"
1627
- })
1628
- }),
1629
- geometry: function(R) {
1630
- const Z = R.getGeometry().getCoordinates();
1631
- return new Qt(Z);
1632
- }
1633
- })]
1634
- }), e == null || e.addInteraction(x), x.on("drawstart", (R) => {
1635
- var Z;
1636
- r = R.feature, l = (Z = r.getGeometry()) == null ? void 0 : Z.on("change", (F) => {
1637
- const i = F.target, y = T(i, "nm"), k = i.getCoordinates()[0], S = new $e([k[k.length - 2], k[k.length - 1]]), N = vt(S, "nm");
1638
- if (L = Number(Qe(S) / 1e3) > 150, !y) return;
1639
- const D = '<span class="error pl-4">超出可以绘画的距离</span>';
1640
- g && (g.innerHTML = `
1641
- <div class="text">
1642
- 面积:${y}
1643
- ${L ? D : ""}
1644
- </div>
1645
- `), f && (f.innerHTML = `
1646
- <div class="text">
1647
- 面积:${y}
1648
- </div>
1649
- <div class="text ${L ? "error" : ""}">
1650
- 线段 ${k.length - 2}: ${N}
1651
- ${L ? D : ""}
1652
-
1653
- </div>
1654
- <div>
1655
- <span class="text">单击继续,双击结束</span>
1656
- </div>
1657
- `);
1658
- });
1659
- }), x.on("drawend", (R) => {
1660
- var y, h, k, S;
1661
- if (!R.feature.getGeometry()) return;
1662
- g && !s && (g.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), s = R.feature, p.setOffset([10, 0]);
1663
- const F = R.feature.getGeometry().getCoordinates(), i = F[0][F[0].length - 2];
1664
- if (p.setPosition(i), f != null && f.parentNode && f.parentNode.removeChild(f), (y = n.getProps()) != null && y.areaDrawEnd) {
1665
- const N = F[0].map((D) => Me(D, J.mercator, J.data));
1666
- (k = (h = n.getProps()) == null ? void 0 : h.areaDrawEnd) == null || k.call(h, N);
1667
- }
1668
- x && (x.setActive(!1), e == null || e.removeInteraction(x), (e == null ? void 0 : e.getInteractions()).forEach((D) => {
1669
- D instanceof Ve && (D.setActive(!1), e == null || e.removeInteraction(D));
1670
- })), l && qe(l), (S = document.querySelector(".delete-icon")) == null || S.addEventListener("click", () => {
1671
- var N, D;
1672
- A(), (D = (N = n.getProps()) == null ? void 0 : N.areaDrawEnd) == null || D.call(N, []);
1673
- });
1674
- });
1675
- }, T = (R, Z) => {
1676
- const F = Xt(R);
1677
- switch (Z) {
1678
- case "km":
1679
- return F > 1e4 ? Math.round(F / 1e6 * 100) / 100 + " km<sup>2</sup>" : Math.round(F * 100) / 100 + " m<sup>2</sup>";
1680
- case "nm":
1681
- return F > 1e4 ? Math.round(F / 1e6 / Math.pow(1.852, 2) * 100) / 100 + " nm<sup>2</sup>" : Math.round(F * 100) / 100 + " m<sup>2</sup>";
1682
- }
1683
- };
1684
- let g, p;
1685
- const M = () => {
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", p = new ce({
1687
- element: g,
1688
- offset: [0, -15],
1689
- positioning: "bottom-center",
1690
- stopEvent: !1,
1691
- insertFirst: !1
1692
- }), e == null || e.addOverlay(p);
1693
- };
1694
- let f, O;
1695
- const Y = () => {
1696
- f != null && f.parentNode && f.parentNode.removeChild(f), f = document.createElement("div"), f.className = "ol-tooltip ol-help-tooltip", O = new ce({
1697
- element: f,
1698
- offset: [15, 0],
1699
- positioning: "center-left"
1700
- }), e == null || e.addOverlay(O);
1701
- }, A = () => {
1702
- m == null || m.clear(), s = null, M(), Y(), $();
1703
- };
1704
- return {
1705
- open: c,
1706
- close: () => {
1707
- e.un("pointermove", w), r = null, x && (x.setActive(!1), (e == null ? void 0 : e.getInteractions()).forEach((Z) => {
1708
- Z instanceof Ve && (Z.setActive(!1), e == null || e.removeInteraction(Z));
1709
- }), x = null), l && qe(l), l = void 0, m == null || m.clear(), m = null, d && e.getAllLayers().includes(d) && (e.removeLayer(d), d = null), f != null && f.parentElement && (f.innerHTML = "", f.parentElement.removeChild(f), f = null), g != null && g.parentElement && (g.innerHTML = "", g.parentElement.removeChild(g), g = null), O && e.removeOverlay(O), p && e.removeOverlay(p), Ce(e, "pointer");
1710
- },
1711
- reset: A
1712
- };
1713
- }, Fo = "zh-map-port-layer", Po = (e) => {
1714
- const n = new de(), s = new he({
1715
- className: Fo,
1716
- source: n,
1717
- zIndex: 100,
1718
- updateWhileInteracting: !0,
1719
- updateWhileAnimating: !0
1720
- });
1721
- e == null || e.addLayer(s);
1722
- let l = null, c = null;
1723
- const o = (g, p = !0) => {
1724
- if (!g || g.length === 0) return;
1725
- if (n.clear(), c) {
1726
- const f = g.find((O) => O.id === (c == null ? void 0 : c.id));
1727
- f ? c = f : g.push(c);
1728
- }
1729
- const M = [];
1730
- g.forEach((f) => {
1731
- const [O, Y] = f.latLon.split(","), A = new ie({
1732
- geometry: new le(U([Number(O), Number(Y)])),
1733
- portData: f,
1734
- id: f.id,
1735
- select: f.id === (c == null ? void 0 : c.id),
1736
- showTitle: f.id === (c == null ? void 0 : c.id) || p
1737
- }), B = r(A);
1738
- A.setStyle(B), M.push(A);
1739
- }), n.addFeatures(M);
1740
- };
1741
- let d = null, m = null;
1742
- const t = (g, p) => {
1743
- d || (d = document.createElement("canvas"), m = d.getContext("2d", {
1744
- willReadFrequently: !0
1745
- }));
1746
- const M = d, f = m;
1747
- if (!f) return "";
1748
- M.width = 0, M.height = 0;
1749
- const O = 2, Y = 8, A = window.devicePixelRatio || 1, B = "12px sans-serif";
1750
- f.font = B;
1751
- const Z = f.measureText(g).width, F = Y + Z + Y, i = O + 12 + O * 2;
1752
- M.width = Math.round(F * A), M.height = Math.round(i * A), f.scale(A, A), f.clearRect(0, 0, F, i), f.fillStyle = p ? "#FF5733" : "#FFF", f.fillRect(0, 0, F, i), f.font = B, f.textBaseline = "middle";
1753
- const y = i / 2;
1754
- return f.strokeStyle = p ? "#000" : "#ffffff", f.lineWidth = 1, f.strokeText(g, Y, y), f.fillStyle = p ? "#FFF" : "#000000", f.fillText(g, Y, y), M.toDataURL("image/png");
1755
- }, r = (g) => {
1756
- const { select: p, showTitle: M } = g.getProperties(), f = (F) => `<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="${F}"/>
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(f(p ? "#FF5733" : "#3370FF"))}`, Y = e.getView().getZoom(), A = g.get("portData"), B = window.devicePixelRatio || 1, R = new j({
1768
- image: new pe({
1769
- src: O(),
1770
- scale: 0.5 * Y / 10
1771
- }),
1772
- zIndex: p ? 110 : 100
1773
- }), Z = new j({
1774
- image: new pe({
1775
- src: t(A.shortName, p),
1776
- anchor: [0.5, 0.5],
1777
- displacement: [0, -26],
1778
- scale: 1 / B,
1779
- anchorXUnits: "fraction",
1780
- anchorYUnits: "fraction"
1781
- }),
1782
- zIndex: p ? 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 !M && !p ? R : [R, Z];
1796
- }, w = () => {
1797
- if (n)
1798
- if (l) {
1799
- console.log("清除非选中的港口");
1800
- const g = l.get("portData").id;
1801
- n.getFeatures().forEach((p) => {
1802
- p.get("portData").id !== g && n.removeFeature(p);
1803
- });
1804
- } else
1805
- console.log("清除所有港口", n), n == null || n.clear();
1806
- }, x = (g) => {
1807
- if (n) {
1808
- if (!g)
1809
- return L();
1810
- (l == null ? void 0 : l.get("portData").id) !== g.id && (L(), $(g));
1811
- }
1812
- }, L = () => {
1813
- var g;
1814
- if (l) {
1815
- const p = l == null ? void 0 : l.get("portData"), M = (g = n.getFeatures()) == null ? void 0 : g.find((f) => f.get("portData").id === p.id);
1816
- M && (M.set("select", !1), M.setStyle(r(M)), l = null, c = null);
1817
- }
1818
- }, $ = (g) => {
1819
- if (!n) return;
1820
- const p = n.getFeatures();
1821
- c = g, l = p.find((M) => M.get("portData").id === g.id), l && (l.set("select", !0), l.setStyle(r(l)));
1822
- };
1823
- return {
1824
- render: o,
1825
- clear: w,
1826
- selected: x,
1827
- handlePortHover: (g) => {
1828
- const p = e == null ? void 0 : e.getTargetElement();
1829
- console.log("targetElement", p, g), g && g.get("portData") && p && Ce(e, "pointer");
1830
- }
1831
- };
1832
- }, So = (e, n, s, l, c, 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), s.reRenderTrackLine(), l.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
- l == null || l.handleShipMapEvent(r, "hover"), s == null || s.handleTrackMapEvent(r, "hover", m), r && (c == null || c.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 && l.changeShipScale("start");
1855
- } catch (m) {
1856
- console.log("movestart---catch", m);
1857
- }
1858
- }), d.on("click", ze((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
- l.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
- c.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", ze(() => {
1880
- const m = d == null ? void 0 : d.getView().getZoom();
1881
- m && m <= te.shipModelMax && m >= te.shipTriggleMin && l.changeSelectedScale("start");
1882
- }, 10));
1883
- }, No = () => {
1884
- const e = Vt([]);
1885
- return {
1886
- createInstance: (l, c) => {
1887
- const o = ro();
1888
- o.initMap(l, c);
1889
- const d = o.getInstall(), m = ko(d), t = Mo();
1890
- t.setProps(c), m.setShowLayerType(c.layerType), m.setGreenTileVisible(c.showGreenLayer);
1891
- const r = ao(d), w = co(d, r), x = bo(d), L = po(d), $ = Eo(d, t), T = To(d, t), g = Po(d);
1892
- So(o, t, r, x, g, $);
1893
- const p = () => {
1894
- const f = d.getView().calculateExtent(o.getSize()), O = Me([f[0], f[1]], J.mercator, J.data), Y = Me([f[2], f[3]], J.mercator, J.data);
1895
- return [O[0], O[1], Y[0], Y[1]];
1896
- }, M = {
1897
- id: Symbol("map-instance"),
1898
- innerMap: null,
1899
- map: o.getInstall(),
1900
- destroy: () => {
1901
- e.splice(e.indexOf(M), 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: T,
1917
- // 子模块
1918
- utils: {
1919
- getCalculateExtent: p,
1920
- convertSixHundredThousandToLatLng: Ke,
1921
- calculateCirclePoints: no
1922
- }
1923
- }
1924
- };
1925
- return e.push(M), M;
1926
- },
1927
- destroyInstance: (l) => {
1928
- const c = e.findIndex((o) => o.id === l);
1929
- c > -1 && (e[c].destroy(), e.splice(c, 1));
1930
- },
1931
- destroyAll: () => {
1932
- e.forEach((l) => l.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 s = ee(), l = ee(), c = No(), o = ee(), d = e, m = ee({
1957
- getInstall() {
1958
- }
1959
- });
1960
- return zt(() => {
1961
- var t;
1962
- o.value = c.createInstance(s.value, d), m.value = o.value.methods, (t = l.value) == null || t.setScaleLine(o.value.map, d.scaleLineUnit);
1963
- }), Ot(() => {
1964
- var t, r;
1965
- c.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: s,
2175
- class: "zh-map"
2176
- }, null, 512),
2177
- Be(Ut, {
2178
- ref_key: "scaleLineRef",
2179
- ref: l
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
- };