zhihao-ui 1.3.17 → 1.3.18

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