zhihao-ui 1.3.58-alpha.5 → 1.3.58-alpha.6
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.
- package/dist/es/Map-CAbB_F9P.js +2888 -0
- package/dist/es/index.js +1 -1
- package/dist/index.css +1 -1
- package/dist/types/components/Map/Map.vue.d.ts +1 -1
- package/dist/types/components/Map/index.d.ts +3 -3
- package/dist/umd/index.css +1 -1
- package/dist/umd/index.umd.cjs +31 -31
- package/package.json +1 -1
- package/dist/es/Map-CBBbglOg.js +0 -2800
|
@@ -0,0 +1,2888 @@
|
|
|
1
|
+
var _t = Object.defineProperty;
|
|
2
|
+
var Kt = (e, n, i) => n in e ? _t(e, n, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[n] = i;
|
|
3
|
+
var Ge = (e, n, i) => Kt(e, typeof n != "symbol" ? n + "" : n, i);
|
|
4
|
+
import { defineComponent as ut, openBlock as gt, createElementBlock as ft, createElementVNode as ct, ref as ye, computed as Qe, h as be, createVNode as at, render as jt, reactive as Jt, onMounted as Qt, onUnmounted as Ut } from "vue";
|
|
5
|
+
import { S as It, M as Ct, T as Oe, X as Ae, t as ie, V as eo, u as to, D as ht, v as Rt, j as $t, w as yt, x as oo, y as We, F as ue, z as re, O as pe, P as de, A as Xe, B as vt, L as $e, G as no, H as kt, I as ce, J as we, K as ve, N as Le, Q as et, R as Ce, U as ro, W as io, Y as lo, Z as Nt, _ as Ie, $ as dt, a0 as Lt, a1 as so, a2 as co, a3 as ao, a4 as pt } from "./vendor-MMWA2y7U.js";
|
|
6
|
+
import { _ as mt } from "./Button-B2Z_WKdq.js";
|
|
7
|
+
import { w as uo } from "./utils-vqG84sMo.js";
|
|
8
|
+
const go = { id: "scale-line-container" }, fo = /* @__PURE__ */ ut({
|
|
9
|
+
__name: "scaleLine",
|
|
10
|
+
setup(e, { expose: n }) {
|
|
11
|
+
return n({
|
|
12
|
+
setScaleLine: (o, c) => {
|
|
13
|
+
c || (c = "metric");
|
|
14
|
+
const d = new It({
|
|
15
|
+
units: c
|
|
16
|
+
}), l = document.getElementById("scale-line-container");
|
|
17
|
+
l && (d.setTarget(l), o.addControl(d));
|
|
18
|
+
}
|
|
19
|
+
}), (o, c) => (gt(), ft("div", go));
|
|
20
|
+
}
|
|
21
|
+
}), ho = /* @__PURE__ */ mt(fo, [["__scopeId", "data-v-2bc5dee8"]]), yo = { class: "zoom" }, vo = /* @__PURE__ */ ut({
|
|
22
|
+
__name: "zoomControl",
|
|
23
|
+
props: {
|
|
24
|
+
mapInstance: {
|
|
25
|
+
type: Object,
|
|
26
|
+
default: () => null
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
setup(e) {
|
|
30
|
+
const n = e;
|
|
31
|
+
console.log("props", n);
|
|
32
|
+
const i = () => {
|
|
33
|
+
console.log("props");
|
|
34
|
+
const { setZoom: c, getZoom: d, getInstall: l } = n.mapInstance.methods;
|
|
35
|
+
if (!l()) return;
|
|
36
|
+
const M = d();
|
|
37
|
+
M && c(M + 1);
|
|
38
|
+
}, o = () => {
|
|
39
|
+
const { setZoom: c, getZoom: d, getInstall: l } = n.mapInstance.methods;
|
|
40
|
+
if (!l()) return;
|
|
41
|
+
const M = d();
|
|
42
|
+
M && c(M - 1);
|
|
43
|
+
};
|
|
44
|
+
return (c, d) => (gt(), ft("div", yo, [
|
|
45
|
+
ct("div", {
|
|
46
|
+
class: "button big-button",
|
|
47
|
+
onClick: i
|
|
48
|
+
}, " + "),
|
|
49
|
+
ct("div", {
|
|
50
|
+
class: "button small-button",
|
|
51
|
+
onClick: o
|
|
52
|
+
}, " - ")
|
|
53
|
+
]));
|
|
54
|
+
}
|
|
55
|
+
}), mo = /* @__PURE__ */ mt(vo, [["__scopeId", "data-v-78a81741"]]), Ue = "a6e8f78974f2581f2ca00485b40c948f", fe = {
|
|
56
|
+
// 地图默认层级
|
|
57
|
+
default: 13,
|
|
58
|
+
// 地图缩放最小层级
|
|
59
|
+
min: 3,
|
|
60
|
+
// 地图缩放最大层级
|
|
61
|
+
max: 18,
|
|
62
|
+
// 船形图标最小渲染层级
|
|
63
|
+
shipModelMin: 13,
|
|
64
|
+
// 船形图标最小渲染层级
|
|
65
|
+
shipTriggleMin: 16,
|
|
66
|
+
// 船形图标最大渲染层级
|
|
67
|
+
shipModelMax: 18,
|
|
68
|
+
//根据原系统canvas图片转换svg长宽比例计算缩放值
|
|
69
|
+
scaleNum: 0.555
|
|
70
|
+
}, ge = {
|
|
71
|
+
// 经纬度 源数据 地理坐标 WGS84
|
|
72
|
+
data: "EPSG:4326",
|
|
73
|
+
// 墨卡托投影坐标 渲染坐标
|
|
74
|
+
mercator: "EPSG:3857"
|
|
75
|
+
}, wo = [114.84, 30.52], zt = "https://static.zhihaoscm.cn/", tt = 2003750834e-2;
|
|
76
|
+
var Fe = ((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=${Ue}`, 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=${Ue}`, 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=${Ue}`, 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=${Ue}`, e.greenTile = `${zt}/map/tile/{z}/{x}/{y}.png`, e))(Fe || {}), He = /* @__PURE__ */ ((e) => (e[e.M = 1] = "M", e[e.KM = 2] = "KM", e[e.NM = 3] = "NM", e))(He || {}), se = /* @__PURE__ */ ((e) => (e.PORT = "port", e.SHIP = "ship", e.TRACK = "track", e.DELETE = "delete", e.PATH = "path", e))(se || {});
|
|
77
|
+
function xo() {
|
|
78
|
+
const e = ye(), n = ye(!0), i = () => e.value, o = () => i().getView(), c = (g) => {
|
|
79
|
+
n.value = g;
|
|
80
|
+
}, d = () => n.value, l = () => {
|
|
81
|
+
var g;
|
|
82
|
+
return (g = o()) == null ? void 0 : g.getZoom();
|
|
83
|
+
}, S = (g) => {
|
|
84
|
+
var a;
|
|
85
|
+
(a = o()) == null || a.setZoom(g);
|
|
86
|
+
}, M = (g, a) => {
|
|
87
|
+
var u;
|
|
88
|
+
(u = o()) == null || u.setCenter(ie([g, a]));
|
|
89
|
+
}, y = () => {
|
|
90
|
+
var a;
|
|
91
|
+
const g = (a = o()) == null ? void 0 : a.getCenter();
|
|
92
|
+
return Rt(g);
|
|
93
|
+
}, t = () => {
|
|
94
|
+
var g;
|
|
95
|
+
return (g = i()) == null ? void 0 : g.getSize();
|
|
96
|
+
}, r = () => {
|
|
97
|
+
const g = window.navigator.userAgent, a = /iPad|iPhone|iPod/.test(g), u = /Safari/.test(g) && !/CriOS/.test(g), h = /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(g);
|
|
98
|
+
return a && (u || h);
|
|
99
|
+
}, $ = new Ct(), D = (g, a) => {
|
|
100
|
+
R(a);
|
|
101
|
+
const u = {
|
|
102
|
+
zoom: a.zoom,
|
|
103
|
+
center: ie(a.center),
|
|
104
|
+
minZoom: fe.min,
|
|
105
|
+
maxZoom: fe.max,
|
|
106
|
+
constrainResolution: !0,
|
|
107
|
+
enableRotation: !1,
|
|
108
|
+
multiWorld: !0
|
|
109
|
+
};
|
|
110
|
+
let h = {
|
|
111
|
+
target: g,
|
|
112
|
+
controls: to({
|
|
113
|
+
zoom: !1
|
|
114
|
+
}),
|
|
115
|
+
layers: [
|
|
116
|
+
$.get("vectorTile"),
|
|
117
|
+
$.get("vectorTileMark"),
|
|
118
|
+
$.get("satelliteImgTile"),
|
|
119
|
+
$.get("satelliteImgTileMark")
|
|
120
|
+
],
|
|
121
|
+
view: new eo(u)
|
|
122
|
+
};
|
|
123
|
+
const v = new Ct(h);
|
|
124
|
+
if (r()) {
|
|
125
|
+
const x = new ht({
|
|
126
|
+
handleEvent: function(m) {
|
|
127
|
+
if (m.type === "dblclick") {
|
|
128
|
+
console.log("IOS Browser---dblclick"), m.originalEvent.preventDefault();
|
|
129
|
+
const E = v.getView(), I = E.getZoom();
|
|
130
|
+
return E.setZoom(I + 1), !1;
|
|
131
|
+
}
|
|
132
|
+
return !0;
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
v.addInteraction(x);
|
|
136
|
+
}
|
|
137
|
+
e.value = v;
|
|
138
|
+
}, R = (g) => {
|
|
139
|
+
$.set("vectorTile", new Oe({
|
|
140
|
+
source: new Ae({ url: Fe.vectorTile }),
|
|
141
|
+
visible: g.layerType === "vector",
|
|
142
|
+
zIndex: 0,
|
|
143
|
+
preload: 1,
|
|
144
|
+
className: "vector"
|
|
145
|
+
})), $.set("vectorTileMark", new Oe({
|
|
146
|
+
source: new Ae({ url: Fe.vectorTileMark }),
|
|
147
|
+
visible: g.layerType === "vector",
|
|
148
|
+
zIndex: 1,
|
|
149
|
+
preload: 1,
|
|
150
|
+
className: "vector"
|
|
151
|
+
})), $.set("satelliteImgTile", new Oe({
|
|
152
|
+
source: new Ae({ url: Fe.satelliteImgTile }),
|
|
153
|
+
visible: g.layerType === "satellite",
|
|
154
|
+
zIndex: 0,
|
|
155
|
+
preload: 1,
|
|
156
|
+
className: "satellite"
|
|
157
|
+
})), $.set("satelliteImgTileMark", new Oe({
|
|
158
|
+
source: new Ae({ url: Fe.satelliteImgTileMark }),
|
|
159
|
+
visible: g.layerType === "satellite",
|
|
160
|
+
zIndex: 1,
|
|
161
|
+
preload: 1,
|
|
162
|
+
className: "satellite"
|
|
163
|
+
})), $.set("greenMark", new Oe({
|
|
164
|
+
source: new Ae({ url: Fe.greenTile }),
|
|
165
|
+
visible: g.showGreenLayer,
|
|
166
|
+
zIndex: 2,
|
|
167
|
+
className: "greenTile"
|
|
168
|
+
}));
|
|
169
|
+
};
|
|
170
|
+
return {
|
|
171
|
+
getInstall: i,
|
|
172
|
+
getView: o,
|
|
173
|
+
getZoom: l,
|
|
174
|
+
setZoom: S,
|
|
175
|
+
setCenter: M,
|
|
176
|
+
getCenter: y,
|
|
177
|
+
getSize: t,
|
|
178
|
+
initMap: D,
|
|
179
|
+
setBaseLayerMap: R,
|
|
180
|
+
setMapClick: c,
|
|
181
|
+
getMapClick: d
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
const wt = function(e, n) {
|
|
185
|
+
const i = Number(n) / 6e5;
|
|
186
|
+
return [Number(e) / 6e5, i];
|
|
187
|
+
}, bo = (e, n) => {
|
|
188
|
+
const i = ie(e), o = n * 1e3, c = [
|
|
189
|
+
i[0] - o,
|
|
190
|
+
i[1] - o,
|
|
191
|
+
i[0] + o,
|
|
192
|
+
i[1] + o
|
|
193
|
+
], d = oo(c, ge.mercator, ge.data);
|
|
194
|
+
return {
|
|
195
|
+
leftTopPoint: { lng: d[0], lat: d[3] },
|
|
196
|
+
rightTopPoint: { lng: d[2], lat: d[3] },
|
|
197
|
+
rightBottomPoint: { lng: d[2], lat: d[1] },
|
|
198
|
+
leftBottomPoint: { lng: d[0], lat: d[1] }
|
|
199
|
+
};
|
|
200
|
+
}, Co = function(e, n) {
|
|
201
|
+
const o = yt(e);
|
|
202
|
+
let c = "";
|
|
203
|
+
switch (console.log(n, He), n) {
|
|
204
|
+
case He.M:
|
|
205
|
+
c = Math.round(o * 100) / 100 + " m";
|
|
206
|
+
break;
|
|
207
|
+
case He.KM:
|
|
208
|
+
c = Math.round(o / 1e3 * 100) / 100 + " km";
|
|
209
|
+
break;
|
|
210
|
+
case He.NM:
|
|
211
|
+
c = (Math.round(o / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
return c;
|
|
215
|
+
};
|
|
216
|
+
function ko(e) {
|
|
217
|
+
const n = e[0] * tt / 180;
|
|
218
|
+
let i = Math.log(Math.tan((90 + e[1]) * Math.PI / 360)) / (Math.PI / 180);
|
|
219
|
+
return i = i * tt / 180, [n, i];
|
|
220
|
+
}
|
|
221
|
+
function Re(e = "") {
|
|
222
|
+
let n = e.replace(/&?/g, "&");
|
|
223
|
+
return n = n.replace(/&#x([0-9a-fA-F]+);?/g, (i, o) => {
|
|
224
|
+
const c = parseInt(o, 16);
|
|
225
|
+
return String.fromCodePoint(c);
|
|
226
|
+
}), n;
|
|
227
|
+
}
|
|
228
|
+
const Mt = (e) => {
|
|
229
|
+
const n = new We({
|
|
230
|
+
font: "Normal 14px map-iconfont",
|
|
231
|
+
text: Re(e),
|
|
232
|
+
fill: new ue({ color: "#fff" }),
|
|
233
|
+
offsetY: -14
|
|
234
|
+
});
|
|
235
|
+
return new re({
|
|
236
|
+
text: n,
|
|
237
|
+
zIndex: 100
|
|
238
|
+
});
|
|
239
|
+
}, Pt = (e, n = "lonlat") => {
|
|
240
|
+
const i = { lon: 0, lat: 0 }, o = e[0] / tt * 180;
|
|
241
|
+
let c = e[1] / tt * 180;
|
|
242
|
+
return c = 180 / Math.PI * (2 * Math.atan(Math.exp(c * Math.PI / 180)) - Math.PI / 2), i.lon = o, i.lat = c, n === "lonlat" ? i : [o, c];
|
|
243
|
+
}, Lo = (e) => {
|
|
244
|
+
const n = $t.duration(e, "minutes"), i = Math.floor(n.asDays()), o = n.hours(), c = n.minutes();
|
|
245
|
+
let d = `${String(c).padStart(2, "0")}分`;
|
|
246
|
+
return o !== 0 && (d = `${String(o).padStart(2, "0")}时${d}`), i !== 0 && (d = `${String(i).padStart(2, "0")}天${d}`), d;
|
|
247
|
+
}, po = (e, n) => {
|
|
248
|
+
let i = null;
|
|
249
|
+
const o = async (t) => {
|
|
250
|
+
if (!e || (console.log("vehicleInfo", t), !(t != null && t.lon && (t != null && t.lat)))) return;
|
|
251
|
+
const r = Math.abs(Number(t.lon)) > 180 ? wt(t.lon, t.lat) : [t.lon, t.lat];
|
|
252
|
+
c(t, ie(r));
|
|
253
|
+
const $ = e == null ? void 0 : e.getView(), D = new de(r);
|
|
254
|
+
$.setCenter(Xe(D.getCoordinates(), ge.data, ge.mercator));
|
|
255
|
+
}, c = (t, r) => {
|
|
256
|
+
const $ = `${zt}map/car-icon.gif`;
|
|
257
|
+
i || (i = new pe({
|
|
258
|
+
element: document.createElement("div"),
|
|
259
|
+
positioning: "center-center",
|
|
260
|
+
stopEvent: !1
|
|
261
|
+
// 允许交互事件穿透
|
|
262
|
+
}), e.addOverlay(i));
|
|
263
|
+
const D = i.getElement();
|
|
264
|
+
D.style.backgroundImage = `url(${$})`, D.style.width = "80px", D.style.height = "80px";
|
|
265
|
+
const R = (t == null ? void 0 : t.drc) || "";
|
|
266
|
+
D.style.transform = `rotate(${R}deg)`, D.style.backgroundSize = "cover", i == null || i.setPosition(r);
|
|
267
|
+
};
|
|
268
|
+
return {
|
|
269
|
+
location: o,
|
|
270
|
+
remove: () => {
|
|
271
|
+
const t = i == null ? void 0 : i.getElement();
|
|
272
|
+
t && (t.innerHTML = "");
|
|
273
|
+
},
|
|
274
|
+
renderTrack: (t, r, $) => {
|
|
275
|
+
n.render(t, r, $, "truck", 1e3);
|
|
276
|
+
},
|
|
277
|
+
setCenter: (t) => {
|
|
278
|
+
n.setCenter(t);
|
|
279
|
+
},
|
|
280
|
+
closeTrack: () => {
|
|
281
|
+
n.close();
|
|
282
|
+
},
|
|
283
|
+
playTrack: (t, r) => {
|
|
284
|
+
n.play(t, r);
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
};
|
|
288
|
+
var Vt = /* @__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))(Vt || {}), me = /* @__PURE__ */ ((e) => (e.left = "left", e.right = "right", e.front = "front", e.up = "up", e.down = "down", e.back = "back", e))(me || {});
|
|
289
|
+
const Mo = (e) => {
|
|
290
|
+
const n = /* @__PURE__ */ new Map(), i = {};
|
|
291
|
+
let o = null;
|
|
292
|
+
const c = "--";
|
|
293
|
+
let d = null;
|
|
294
|
+
const l = document.createElement("div"), S = new pe({
|
|
295
|
+
element: l,
|
|
296
|
+
positioning: "top-left",
|
|
297
|
+
className: "track-label-popup"
|
|
298
|
+
});
|
|
299
|
+
let M, y, t, r, $, D = !1, R = Date.now(), g, a = 0, u = null, h = 20;
|
|
300
|
+
const v = 8, x = [], m = (f) => {
|
|
301
|
+
var b;
|
|
302
|
+
for (x.unshift(f); x.length > v; ) {
|
|
303
|
+
const k = x.pop(), T = n.get(k);
|
|
304
|
+
T && ((b = T.getSource()) == null || b.clear(), e == null || e.removeLayer(T), n.delete(k), delete i[k]);
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
let E = "";
|
|
308
|
+
const I = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080", "#ffc0cb", "#800000", "#000080", "#808000"], oe = vt(async () => {
|
|
309
|
+
if (o && i[o] && n.get(o).getVisible()) {
|
|
310
|
+
console.log("reRenderTrackLine------------"), await he(o);
|
|
311
|
+
const f = Z(o, i[o]);
|
|
312
|
+
C(o, f);
|
|
313
|
+
}
|
|
314
|
+
}, 100), K = () => o && i[o] && n.get(o).getVisible(), Z = (f, b) => {
|
|
315
|
+
let k = [];
|
|
316
|
+
const T = Math.max(1, Math.floor(b.length / h));
|
|
317
|
+
return k = b.filter((O, V) => V % T === 0).map((O, V) => {
|
|
318
|
+
if (Number(O.lon) > 180 || Number(O.lat) > 180) {
|
|
319
|
+
const [_, Q] = wt(O.lon, O.lat);
|
|
320
|
+
O.lon = _, O.lat = Q;
|
|
321
|
+
}
|
|
322
|
+
return O.center = [O.lon, O.lat], O.centerPoint = ko(O.center), O.time = $t(O.createdAt).format("YYYY-MM-DD HH:mm:ss"), O.id = f, O.index = V, O;
|
|
323
|
+
}), k.filter(
|
|
324
|
+
(O, V, _) => V === _.findIndex(
|
|
325
|
+
(Q) => Math.abs(Q.lon - O.lon) < 1e-6 && Math.abs(Q.lat - O.lat) < 1e-6
|
|
326
|
+
)
|
|
327
|
+
);
|
|
328
|
+
}, W = async (f, b, k, T = "ship", L = 200) => {
|
|
329
|
+
if (!e || JSON.stringify(i[f]) === JSON.stringify(b) && o === f || (b = b == null ? void 0 : b.reverse(), S && T === "ship" && (e != null && e.getOverlays().getArray().includes(S) || e.addOverlay(S)), (b == null ? void 0 : b.length) < 2))
|
|
330
|
+
return;
|
|
331
|
+
m(f), o = f, i[f] = b, h = L;
|
|
332
|
+
const X = Object.keys(i).findIndex((O) => O === f) || 0;
|
|
333
|
+
E = k || I[X > 10 ? 10 : X], await U(), await Ze(o);
|
|
334
|
+
}, G = (f) => {
|
|
335
|
+
const b = new ve();
|
|
336
|
+
return new we({
|
|
337
|
+
source: b,
|
|
338
|
+
visible: !1,
|
|
339
|
+
// 默认隐藏
|
|
340
|
+
className: `track-layer-${f}`,
|
|
341
|
+
renderBuffer: 1024,
|
|
342
|
+
properties: { layerType: se.TRACK },
|
|
343
|
+
zIndex: 10
|
|
344
|
+
});
|
|
345
|
+
}, Y = (f) => {
|
|
346
|
+
n.forEach((b, k) => {
|
|
347
|
+
var L;
|
|
348
|
+
const T = k === f;
|
|
349
|
+
b.getVisible() !== T && (b.setVisible(T), e.getLayers().getArray().includes(b) || e.addLayer(b), T || (L = b.getSource()) == null || L.clear());
|
|
350
|
+
}), o = f;
|
|
351
|
+
}, U = async () => {
|
|
352
|
+
const f = o;
|
|
353
|
+
if (!n.has(f)) {
|
|
354
|
+
const X = G(f);
|
|
355
|
+
n.set(f, X);
|
|
356
|
+
}
|
|
357
|
+
await Y(f);
|
|
358
|
+
const b = E || "", k = i[f] || [];
|
|
359
|
+
if (!(k && k.length > 1)) return [];
|
|
360
|
+
let T = [];
|
|
361
|
+
T = Z(f, k);
|
|
362
|
+
const L = T.map((X) => X.centerPoint);
|
|
363
|
+
T.length >= 2 && await p(f, L, b);
|
|
364
|
+
}, p = (f, b, k) => {
|
|
365
|
+
const T = new $e(b), L = n.get(f).getSource(), X = L.getFeatureById(f);
|
|
366
|
+
if (X)
|
|
367
|
+
X.setGeometry(T), X.setId(f), X.setStyle(w(k)), u = X;
|
|
368
|
+
else {
|
|
369
|
+
const O = new ce({ geometry: T });
|
|
370
|
+
O.setId(f), O.set("type", "line"), O.setStyle(w(k)), L.addFeature(O), u = O;
|
|
371
|
+
}
|
|
372
|
+
return u;
|
|
373
|
+
}, w = (f) => new re({
|
|
374
|
+
stroke: new Le({
|
|
375
|
+
color: f,
|
|
376
|
+
width: 2
|
|
377
|
+
})
|
|
378
|
+
}), F = (f, b, k) => {
|
|
379
|
+
try {
|
|
380
|
+
const T = f == null ? void 0 : f.get("data");
|
|
381
|
+
if (f && T && b === "hover") {
|
|
382
|
+
e.getTargetElement().style.cursor = T ? "pointer" : "";
|
|
383
|
+
const L = q(T), X = k == null ? void 0 : k.coordinate;
|
|
384
|
+
X && (l.querySelector(".popup-content"), l.innerHTML = L, S == null || S.setPosition(X));
|
|
385
|
+
} else
|
|
386
|
+
S && S.setPosition(void 0);
|
|
387
|
+
} catch (T) {
|
|
388
|
+
console.error("handleTrackMapEvent", T);
|
|
389
|
+
}
|
|
390
|
+
}, q = (f) => {
|
|
391
|
+
if (!(f != null && f.time)) return;
|
|
392
|
+
let b = "";
|
|
393
|
+
return f != null && f.stayTime && (b = `
|
|
394
|
+
<div class="item w-100">
|
|
395
|
+
<div class="item-label">停泊时间约</div>
|
|
396
|
+
<div class="item-item">${Lo(Number(f.stayTime))}</div>
|
|
397
|
+
</div>
|
|
398
|
+
`), `
|
|
399
|
+
<div class="track-point-popup">
|
|
400
|
+
<div class="item">
|
|
401
|
+
<div class="item-label">状态</div>
|
|
402
|
+
<div class="item-item">${f != null && f.sailStatus ? Vt[f.sailStatus] : c}</div>
|
|
403
|
+
</div>
|
|
404
|
+
<div class="item">
|
|
405
|
+
<div class="item-label">航速</div>
|
|
406
|
+
<div class="item-item">${f.speed || c}</div>
|
|
407
|
+
</div>
|
|
408
|
+
<div class="item">
|
|
409
|
+
<div class="item-label">艏向</div>
|
|
410
|
+
<div class="item-item">${f.hdg || c}</div>
|
|
411
|
+
</div>
|
|
412
|
+
<div class="item">
|
|
413
|
+
<div class="item-label">航向</div>
|
|
414
|
+
<div class="item-item">${f.cog || c}</div>
|
|
415
|
+
</div>
|
|
416
|
+
<div class="item">
|
|
417
|
+
<div class="item-label">经度</div>
|
|
418
|
+
<div class="item-item">${f.lon || c}</div>
|
|
419
|
+
</div>
|
|
420
|
+
<div class="item">
|
|
421
|
+
<div class="item-label">纬度</div>
|
|
422
|
+
<div class="item-item">${f.lat || c}</div>
|
|
423
|
+
</div>
|
|
424
|
+
<div class="item w-100">
|
|
425
|
+
<div class="item-label">时间</div>
|
|
426
|
+
<div class="item-item">${f.time}</div>
|
|
427
|
+
</div>
|
|
428
|
+
${b ?? b}
|
|
429
|
+
</div>`;
|
|
430
|
+
}, j = (f) => {
|
|
431
|
+
const k = f.map((V) => {
|
|
432
|
+
const _ = e.getPixelFromCoordinate(ie(V.center));
|
|
433
|
+
return {
|
|
434
|
+
...V,
|
|
435
|
+
original: V,
|
|
436
|
+
pixel: _,
|
|
437
|
+
distance: 0
|
|
438
|
+
// 先初始化,后续计算
|
|
439
|
+
};
|
|
440
|
+
});
|
|
441
|
+
let T = 0;
|
|
442
|
+
k[0].distance = 0;
|
|
443
|
+
for (let V = 1; V < k.length; V++) {
|
|
444
|
+
const _ = k[V - 1].pixel, Q = k[V].pixel, ae = Q[0] - _[0], N = Q[1] - _[1];
|
|
445
|
+
T += Math.sqrt(ae * ae + N * N), k[V].distance = T;
|
|
446
|
+
}
|
|
447
|
+
const L = k.filter(
|
|
448
|
+
(V, _) => _ === 0 || _ === k.length - 1
|
|
449
|
+
), X = [];
|
|
450
|
+
for (let V = 0; V < L.length; V++) {
|
|
451
|
+
const _ = L[V];
|
|
452
|
+
if (X.push(_), V < L.length - 1) {
|
|
453
|
+
const Q = L[V + 1], ae = Q.distance - _.distance, N = Math.floor(ae / 100);
|
|
454
|
+
for (let ee = 1; ee <= N; ee++) {
|
|
455
|
+
const ne = _.distance + ee * 100;
|
|
456
|
+
if (ne >= Q.distance) break;
|
|
457
|
+
const le = s(
|
|
458
|
+
k,
|
|
459
|
+
ne
|
|
460
|
+
);
|
|
461
|
+
le && X.push(le);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
return Array.from(
|
|
466
|
+
new Map(X.map((V) => [V.distance.toFixed(2), V])).values()
|
|
467
|
+
).map((V) => ({
|
|
468
|
+
...V.original,
|
|
469
|
+
// 优先保留原始数据
|
|
470
|
+
...V,
|
|
471
|
+
// 覆盖坐标等计算属性
|
|
472
|
+
coord: V.coord,
|
|
473
|
+
// 确保使用插值后的坐标
|
|
474
|
+
pixel: V.pixel,
|
|
475
|
+
distance: V.distance
|
|
476
|
+
}));
|
|
477
|
+
};
|
|
478
|
+
function s(f, b) {
|
|
479
|
+
for (let k = 1; k < f.length; k++) {
|
|
480
|
+
const T = f[k - 1], L = f[k];
|
|
481
|
+
if (b >= T.distance && b <= L.distance) {
|
|
482
|
+
const X = (b - T.distance) / (L.distance - T.distance), O = T.pixel[0] + X * (L.pixel[0] - T.pixel[0]), V = T.pixel[1] + X * (L.pixel[1] - T.pixel[1]), _ = e == null ? void 0 : e.getCoordinateFromPixel([O, V]);
|
|
483
|
+
return {
|
|
484
|
+
...T,
|
|
485
|
+
// 继承前一个点的属性(可调整)
|
|
486
|
+
coord: _,
|
|
487
|
+
pixel: [O, V],
|
|
488
|
+
distance: b,
|
|
489
|
+
original: void 0
|
|
490
|
+
// 明确标记为插值生成点
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
return null;
|
|
495
|
+
}
|
|
496
|
+
const C = async (f, b) => {
|
|
497
|
+
const k = j(b);
|
|
498
|
+
console.log("simplifiedPoints", k.length, "list", b.length);
|
|
499
|
+
const T = k.map((V) => P(V)), L = k.map((V) => H(V, E)), X = rt(f, k, b, E);
|
|
500
|
+
n.get(f).getSource().addFeatures([...T, ...L, ...X]);
|
|
501
|
+
}, P = (f) => {
|
|
502
|
+
const b = new ce({
|
|
503
|
+
geometry: new de(f.centerPoint),
|
|
504
|
+
data: f
|
|
505
|
+
});
|
|
506
|
+
b.set("type", "track_point"), b.set("trackId", f.id), b.set("data", f);
|
|
507
|
+
let k = [
|
|
508
|
+
...xe(f, E)
|
|
509
|
+
];
|
|
510
|
+
return (f.index === 0 || f.index === i[f.id].length - 1) && (k = [..._e(f)], b.set("type", "track_begin")), f.state !== void 0 && f.state !== null && (k = [...ke(f)], b.set("type", "track_icon")), b.setStyle(k), b;
|
|
511
|
+
}, z = window.devicePixelRatio || 1, A = /* @__PURE__ */ new Map();
|
|
512
|
+
let B = null, te = null;
|
|
513
|
+
function J(f, b) {
|
|
514
|
+
const k = `${f}`;
|
|
515
|
+
if (A.has(k))
|
|
516
|
+
return A.get(k);
|
|
517
|
+
if (!B) {
|
|
518
|
+
B = document.createElement("canvas");
|
|
519
|
+
try {
|
|
520
|
+
te = B.getContext("2d", {
|
|
521
|
+
willReadFrequently: !0
|
|
522
|
+
});
|
|
523
|
+
} catch (bt) {
|
|
524
|
+
console.log("e", bt), te = B.getContext("2d");
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
const T = B, L = te;
|
|
528
|
+
if (!L) return "";
|
|
529
|
+
T.width = 0, T.height = 0;
|
|
530
|
+
const X = 2, O = 8, V = 16, _ = window.devicePixelRatio || 1, Q = "500 12px Arial";
|
|
531
|
+
L.font = Q;
|
|
532
|
+
const N = L.measureText(f).width, ee = O + N + O, ne = X + 14 + X;
|
|
533
|
+
let le = 0, Me = 0, Ee = 0, Te = 0, De = 0, Ne = 0, Se = 0, ze = 0;
|
|
534
|
+
le = V + ee, Me = V + ne, Ee = ee, Te = ne, De = ee + V, Ne = 0, Se = 0, ze = V, T.width = Math.round(le * _), T.height = Math.round(Me * _), L.scale(_, _), L.clearRect(0, 0, le, Me), L.beginPath(), L.moveTo(Ee, Te), L.lineTo(De, Ne), L.strokeStyle = b || "#FFF", L.lineWidth = 1, L.stroke(), L.fillStyle = "#FFF", L.fillRect(Se, ze, ee, ne), L.strokeStyle = b || "#FFF", L.lineWidth = 1, L.strokeRect(Se, ze, ee, ne), L.font = Q, L.textBaseline = "middle";
|
|
535
|
+
const je = ze + X / 2 + ne / 2;
|
|
536
|
+
L.strokeStyle = "#ffffff", L.lineWidth = 1, L.strokeText(f, Se + O, je), L.fillStyle = "#000000", L.fillText(f, Se + O, je);
|
|
537
|
+
const Je = T.toDataURL("image/png");
|
|
538
|
+
return A.set(k, Je), Je;
|
|
539
|
+
}
|
|
540
|
+
const H = (f, b) => {
|
|
541
|
+
const k = J(f.time, b), T = new ce({
|
|
542
|
+
geometry: new de(f.centerPoint),
|
|
543
|
+
data: f
|
|
544
|
+
});
|
|
545
|
+
T.set("type", "track_point_label");
|
|
546
|
+
const L = new re({
|
|
547
|
+
image: new Ce({
|
|
548
|
+
src: k,
|
|
549
|
+
anchor: [1, 0],
|
|
550
|
+
displacement: [0, 0],
|
|
551
|
+
scale: 1 / z,
|
|
552
|
+
anchorXUnits: "fraction",
|
|
553
|
+
anchorYUnits: "fraction"
|
|
554
|
+
}),
|
|
555
|
+
zIndex: 100
|
|
556
|
+
});
|
|
557
|
+
return T.setStyle(L), T;
|
|
558
|
+
}, he = (f) => {
|
|
559
|
+
const b = n.get(f).getSource();
|
|
560
|
+
b.forEachFeature((k) => {
|
|
561
|
+
k.get("type") !== "line" && b.removeFeature(k);
|
|
562
|
+
});
|
|
563
|
+
}, xe = (f, b) => [
|
|
564
|
+
new re({
|
|
565
|
+
// 扩大交互热区
|
|
566
|
+
image: new et({
|
|
567
|
+
stroke: new Le({ color: "rgba(0, 0, 0, 0.01)", width: 20 }),
|
|
568
|
+
radius: 3
|
|
569
|
+
})
|
|
570
|
+
}),
|
|
571
|
+
// 轨迹点样式
|
|
572
|
+
new re({
|
|
573
|
+
image: new et({
|
|
574
|
+
fill: new ue({ color: b }),
|
|
575
|
+
stroke: new Le({ color: "#fff", width: 2 }),
|
|
576
|
+
radius: 3
|
|
577
|
+
})
|
|
578
|
+
})
|
|
579
|
+
// textStyle,
|
|
580
|
+
], ke = (f) => {
|
|
581
|
+
const b = "#E31818", k = "#1890FF", T = "", L = new re({
|
|
582
|
+
text: new We({
|
|
583
|
+
font: "Normal 22px map-iconfont",
|
|
584
|
+
text: Re(T),
|
|
585
|
+
offsetY: -10,
|
|
586
|
+
fill: new ue({
|
|
587
|
+
color: Number(f.state) === 0 ? b : Number(f.state) === 1 ? k : ""
|
|
588
|
+
})
|
|
589
|
+
}),
|
|
590
|
+
zIndex: 99
|
|
591
|
+
}), O = Mt(""), _ = Mt(""), Q = [];
|
|
592
|
+
return Number(f.state) === 0 ? Q.push(O) : Number(f.state) === 1 && Q.push(_), Q.push(L), Q;
|
|
593
|
+
}, rt = (f, b, k, T) => {
|
|
594
|
+
const L = b || [], X = b.length;
|
|
595
|
+
X || (L.push(k[0]), L.push(k[k.length - 1]));
|
|
596
|
+
const O = new Set(b.map((_) => `${_.centerPoint[0]},${_.centerPoint[1]}`)), V = [];
|
|
597
|
+
for (let _ = 0; _ < X - 1; _++) {
|
|
598
|
+
let Q;
|
|
599
|
+
const ae = b[_], N = (b[_ + 1].index + ae.index) / 2;
|
|
600
|
+
if (N % 2 === 0)
|
|
601
|
+
Q = k[N].centerPoint;
|
|
602
|
+
else {
|
|
603
|
+
const ee = k[Math.floor(N)], ne = k[Math.ceil(N)];
|
|
604
|
+
if (ee && ne) {
|
|
605
|
+
const [le, Me] = ee.centerPoint, [Ee, Te] = ne.centerPoint;
|
|
606
|
+
Q = [(le + Ee) / 2, (Me + Te) / 2];
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
if (Q) {
|
|
610
|
+
const ee = `${Q[0]},${Q[1]}`;
|
|
611
|
+
if (!O.has(ee)) {
|
|
612
|
+
const ne = new ce({
|
|
613
|
+
geometry: new de(Q)
|
|
614
|
+
});
|
|
615
|
+
ne.set("type", "track_arrow"), ne.setStyle(
|
|
616
|
+
new re({
|
|
617
|
+
text: new We({
|
|
618
|
+
font: "700 12px map-iconfont",
|
|
619
|
+
text: Re(""),
|
|
620
|
+
fill: new ue({ color: T }),
|
|
621
|
+
rotation: xt(
|
|
622
|
+
b[_].center,
|
|
623
|
+
b[_ + 1].center
|
|
624
|
+
) * (Math.PI / 180)
|
|
625
|
+
})
|
|
626
|
+
})
|
|
627
|
+
), V.push(ne), O.add(ee);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
return V;
|
|
632
|
+
}, Ze = (f) => {
|
|
633
|
+
var X, O;
|
|
634
|
+
const b = e.getView(), k = (X = n == null ? void 0 : n.get(f)) == null ? void 0 : X.getSource(), T = u || (f ? k == null ? void 0 : k.getFeatureById(f) : null);
|
|
635
|
+
if (!T) return;
|
|
636
|
+
const L = (O = T == null ? void 0 : T.getGeometry()) == null ? void 0 : O.getExtent();
|
|
637
|
+
if (!L || L[0] === L[2] || L[1] === L[3]) {
|
|
638
|
+
console.warn("Invalid track extent");
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
try {
|
|
642
|
+
const V = L[2] - L[0], _ = L[3] - L[1], Q = 1e-4;
|
|
643
|
+
if (V < Q || _ < Q) {
|
|
644
|
+
const N = [(L[0] + L[2]) / 2, (L[1] + L[3]) / 2];
|
|
645
|
+
b.setCenter(N);
|
|
646
|
+
return;
|
|
647
|
+
}
|
|
648
|
+
const ae = no(L, Math.max(V, _) * 0.1);
|
|
649
|
+
b.fit(ae, {
|
|
650
|
+
maxZoom: fe.max,
|
|
651
|
+
padding: [30, 30, 30, 30]
|
|
652
|
+
// 添加边距
|
|
653
|
+
});
|
|
654
|
+
} catch (V) {
|
|
655
|
+
console.error("setTrackViewCenter error:", V);
|
|
656
|
+
}
|
|
657
|
+
}, _e = (f) => {
|
|
658
|
+
const b = "", L = f.index === 0 ? "#fcdc3f" : "#ff0000";
|
|
659
|
+
return [new re({
|
|
660
|
+
text: new We({
|
|
661
|
+
font: "Normal 14px map-iconfont",
|
|
662
|
+
text: Re(b),
|
|
663
|
+
fill: new ue({ color: L })
|
|
664
|
+
}),
|
|
665
|
+
zIndex: 101
|
|
666
|
+
})];
|
|
667
|
+
}, Ht = () => {
|
|
668
|
+
console.log("清除所有的轨迹-----"), Ke(), n.forEach((b) => {
|
|
669
|
+
var k;
|
|
670
|
+
(k = b.getSource()) == null || k.clear(), e == null || e.removeLayer(b);
|
|
671
|
+
}), Object.keys(i).forEach((b) => {
|
|
672
|
+
n.delete(b), delete i[b];
|
|
673
|
+
});
|
|
674
|
+
}, Zt = (f) => {
|
|
675
|
+
const b = n.get(f || o);
|
|
676
|
+
b == null || b.setVisible(!1);
|
|
677
|
+
const k = e.getOverlays().getArray();
|
|
678
|
+
for (let T = 0; T < k.length; ) {
|
|
679
|
+
const L = k[T];
|
|
680
|
+
L.get("class") === "track-label-overlay" ? (L.setPosition(void 0), L.dispose()) : T++;
|
|
681
|
+
}
|
|
682
|
+
Ke();
|
|
683
|
+
}, Dt = (f, b = He.NM) => {
|
|
684
|
+
const k = {
|
|
685
|
+
id: f,
|
|
686
|
+
length: "--"
|
|
687
|
+
}, L = (i[f] || []).map(
|
|
688
|
+
(O) => Xe([O.lon, O.lat], ge.data, ge.mercator)
|
|
689
|
+
), X = new $e(L);
|
|
690
|
+
return k.length = Co(X, b) || "--", k;
|
|
691
|
+
}, Gt = (f, b) => {
|
|
692
|
+
Yt(String(f), b);
|
|
693
|
+
}, Yt = (f, b) => {
|
|
694
|
+
const k = i[String(f)], T = k == null ? void 0 : k.map((L) => [L.lon, L.lat]);
|
|
695
|
+
T && Xt(T, b);
|
|
696
|
+
}, it = new re({
|
|
697
|
+
text: new We({
|
|
698
|
+
font: "700 20px map-iconfont",
|
|
699
|
+
text: Re(""),
|
|
700
|
+
fill: new ue({ color: "#ff0000" }),
|
|
701
|
+
rotation: 0
|
|
702
|
+
// 初始旋转角度
|
|
703
|
+
})
|
|
704
|
+
}), Bt = (f, b) => {
|
|
705
|
+
var N, ee;
|
|
706
|
+
const k = Number(50 * b), T = ((N = f.frameState) == null ? void 0 : N.time) ?? Date.now(), L = T - R;
|
|
707
|
+
if (a = (a + k * L / 1e6) % 2, R = T, a >= 1) {
|
|
708
|
+
Ke();
|
|
709
|
+
return;
|
|
710
|
+
}
|
|
711
|
+
const X = y.getCoordinateAt(
|
|
712
|
+
a > 1 ? 2 - a : a
|
|
713
|
+
), O = y.getCoordinateAt(
|
|
714
|
+
a > 1 ? a - 0.01 : a
|
|
715
|
+
), V = y.getCoordinateAt(
|
|
716
|
+
a > 1 ? 2 - a : a + 0.01
|
|
717
|
+
), Q = xt(
|
|
718
|
+
Pt(O, "array"),
|
|
719
|
+
Pt(V, "array")
|
|
720
|
+
) * Math.PI / 180;
|
|
721
|
+
(ee = it.getText()) == null || ee.setRotation(Q), r.setCoordinates(X);
|
|
722
|
+
const ae = ro(f);
|
|
723
|
+
ae.setStyle(it), ae.drawGeometry(r), e == null || e.render();
|
|
724
|
+
}, qt = () => {
|
|
725
|
+
var f;
|
|
726
|
+
D = !0, R = Date.now(), a = 0, r = ((f = t.getGeometry()) == null ? void 0 : f.clone()) || new de([0, 0]), d && (g == null || g.on("postrender", d)), $ == null || $.setGeometry(void 0);
|
|
727
|
+
}, Ke = () => {
|
|
728
|
+
D && (D = !1, $ == null || $.setGeometry(void 0), d && g && g.un("postrender", d), g && (e == null || e.removeLayer(g)), g = null, $ = null);
|
|
729
|
+
}, Xt = (f, b) => {
|
|
730
|
+
D && Ke(), M = new kt({
|
|
731
|
+
factor: 1e6
|
|
732
|
+
}).writeGeometry(new $e(f)), y = new kt({
|
|
733
|
+
factor: 1e6
|
|
734
|
+
}).readGeometry(M, {
|
|
735
|
+
dataProjection: ge.data,
|
|
736
|
+
featureProjection: ge.mercator
|
|
737
|
+
}), t = new ce({
|
|
738
|
+
type: "icon",
|
|
739
|
+
geometry: new de(y.getFirstCoordinate())
|
|
740
|
+
});
|
|
741
|
+
const k = t.getGeometry();
|
|
742
|
+
r = k ? k.clone() : new de([0, 0]), $ = new ce({
|
|
743
|
+
type: "geoMarker",
|
|
744
|
+
style: it,
|
|
745
|
+
geometry: r
|
|
746
|
+
}), g = new we({
|
|
747
|
+
source: new ve({
|
|
748
|
+
features: [$]
|
|
749
|
+
})
|
|
750
|
+
}), e == null || e.addLayer(g), d = (T) => Bt(T, b), qt();
|
|
751
|
+
}, xt = (f, b, k) => {
|
|
752
|
+
function T(N) {
|
|
753
|
+
return 180 * (N % (2 * Math.PI)) / Math.PI;
|
|
754
|
+
}
|
|
755
|
+
function L(N) {
|
|
756
|
+
return N % 360 * Math.PI / 180;
|
|
757
|
+
}
|
|
758
|
+
function X(N) {
|
|
759
|
+
var ee;
|
|
760
|
+
if (!N) throw new Error("Coordinate is required");
|
|
761
|
+
if (!Array.isArray(N)) {
|
|
762
|
+
if ((N == null ? void 0 : N.type) === "Feature" && (N == null ? void 0 : N.geometry) !== null && ((ee = N == null ? void 0 : N.geometry) == null ? void 0 : ee.type) === "Point")
|
|
763
|
+
return N == null ? void 0 : N.geometry.coordinates;
|
|
764
|
+
if (N.type === "Point") return (N == null ? void 0 : N.coordinates) || [];
|
|
765
|
+
}
|
|
766
|
+
if (Array.isArray(N) && N.length >= 2 && !Array.isArray(N[0]) && !Array.isArray(N[1]))
|
|
767
|
+
return N;
|
|
768
|
+
throw new Error(
|
|
769
|
+
"Coordinate must be GeoJSON Point or an Array of numbers"
|
|
770
|
+
);
|
|
771
|
+
}
|
|
772
|
+
function O(N, ee, ne = {}) {
|
|
773
|
+
if (ne.final)
|
|
774
|
+
return function(je, Je) {
|
|
775
|
+
return (O(Je, je) + 180) % 360;
|
|
776
|
+
}(N, ee);
|
|
777
|
+
const le = X(N), Me = X(ee), Ee = L(le[0]), Te = L(Me[0]), De = L(le[1]), Ne = L(Me[1]), Se = Math.sin(Te - Ee) * Math.cos(Ne), ze = Math.cos(De) * Math.sin(Ne) - Math.sin(De) * Math.cos(Ne) * Math.cos(Te - Ee);
|
|
778
|
+
return T(Math.atan2(Se, ze));
|
|
779
|
+
}
|
|
780
|
+
function V(N) {
|
|
781
|
+
return !isNaN(N) && N !== null && !Array.isArray(N);
|
|
782
|
+
}
|
|
783
|
+
function _(N, ee = {}, ne = {}) {
|
|
784
|
+
return N || console.log("Coordinates are required"), Array.isArray(N) || console.log("Coordinates must be an Array"), N.length < 2 && console.log("Coordinates must be at least 2 numbers long"), (!V(N[0]) || !V(N[1])) && console.log("Coordinates must contain numbers"), Q({ type: "Point", coordinates: N }, ee, ne);
|
|
785
|
+
}
|
|
786
|
+
function Q(N, ee = {}, ne = {}) {
|
|
787
|
+
const le = {
|
|
788
|
+
type: "Feature",
|
|
789
|
+
id: "",
|
|
790
|
+
properties: {},
|
|
791
|
+
bbox: {},
|
|
792
|
+
geometry: {}
|
|
793
|
+
};
|
|
794
|
+
return ne.id !== void 0 && (le.id = ne.id), ne.bbox && (le.bbox = ne.bbox), le.properties = ee, le.geometry = N, le;
|
|
795
|
+
}
|
|
796
|
+
const ae = O(_(f), _(b), k);
|
|
797
|
+
return ae < 0 ? 360 + ae : ae;
|
|
798
|
+
};
|
|
799
|
+
return {
|
|
800
|
+
render: W,
|
|
801
|
+
remove: Ht,
|
|
802
|
+
play: Gt,
|
|
803
|
+
setCenter: Ze,
|
|
804
|
+
close: Zt,
|
|
805
|
+
getLength: Dt,
|
|
806
|
+
handleTrackMapEvent: F,
|
|
807
|
+
reRenderTrackLine: oe,
|
|
808
|
+
getTrackStatus: K
|
|
809
|
+
};
|
|
810
|
+
}, Po = () => {
|
|
811
|
+
const e = ye();
|
|
812
|
+
return {
|
|
813
|
+
setProps: (o) => {
|
|
814
|
+
e.value = o;
|
|
815
|
+
},
|
|
816
|
+
getProps: () => e.value
|
|
817
|
+
};
|
|
818
|
+
};
|
|
819
|
+
function Eo(e) {
|
|
820
|
+
const n = ye(null), i = Qe(() => ({
|
|
821
|
+
"--overlay-color": "#FFF",
|
|
822
|
+
"--bg-color1": e.colors && e.colors[0] ? e.colors[0] : "#ffffff",
|
|
823
|
+
// 默认第一个颜色
|
|
824
|
+
"--bg-color2": e.colors && e.colors[1] ? e.colors[1] : "#ffffff",
|
|
825
|
+
"--bg-color": "#ffffff",
|
|
826
|
+
position: "relative",
|
|
827
|
+
"pointer-events": "none"
|
|
828
|
+
})), o = Qe(() => {
|
|
829
|
+
var l;
|
|
830
|
+
return {
|
|
831
|
+
position: "relative",
|
|
832
|
+
"border-radius": "1px",
|
|
833
|
+
"background-color": "var(--content-bg)",
|
|
834
|
+
color: "#000",
|
|
835
|
+
padding: "2px 5px 2px 0px",
|
|
836
|
+
font: "500 Normal 12px",
|
|
837
|
+
"font-size": "12px",
|
|
838
|
+
"box-shadow": "0 2px 10px rgba(0, 0, 0, 0.2)",
|
|
839
|
+
"white-space": "nowrap",
|
|
840
|
+
border: "1px solid #FFF",
|
|
841
|
+
"pointer-events": "auto",
|
|
842
|
+
// 'transition': 'background-color 0.5s ease, border 0.5s ease',
|
|
843
|
+
"z-index": "1",
|
|
844
|
+
display: "flex",
|
|
845
|
+
"align-items": "center",
|
|
846
|
+
animation: e.selected ? e.colors && ((l = e.colors) == null ? void 0 : l.length) >= 2 ? "blink-dual 2s ease-in-out infinite" : "blink-single 1.5s ease-in-out infinite" : "none"
|
|
847
|
+
// "animation": props.selected ? 'blink 1.5s ease-in-out infinite' : 'none', // 动画开关
|
|
848
|
+
};
|
|
849
|
+
}), c = Qe(() => ({
|
|
850
|
+
width: "14px",
|
|
851
|
+
height: "14px",
|
|
852
|
+
margin: "1px 5px 1px 1px",
|
|
853
|
+
"background-color": "var(--attention-bg)"
|
|
854
|
+
})), d = Qe(() => ({
|
|
855
|
+
position: "absolute",
|
|
856
|
+
top: "0px",
|
|
857
|
+
color: "var(--overlay-color)",
|
|
858
|
+
"pointer-events": "none",
|
|
859
|
+
transform: "translateY(-1px)",
|
|
860
|
+
"z-index": "0",
|
|
861
|
+
width: "20px",
|
|
862
|
+
height: "20px",
|
|
863
|
+
overflow: "visible",
|
|
864
|
+
left: "-20px"
|
|
865
|
+
}));
|
|
866
|
+
return () => be("div", {
|
|
867
|
+
ref: n,
|
|
868
|
+
class: "ship-overlay-container",
|
|
869
|
+
"data-id": e.id,
|
|
870
|
+
style: i.value
|
|
871
|
+
}, [
|
|
872
|
+
be(
|
|
873
|
+
"div",
|
|
874
|
+
{
|
|
875
|
+
class: "ship-overlay-content",
|
|
876
|
+
style: o.value,
|
|
877
|
+
"data-id": e.id
|
|
878
|
+
},
|
|
879
|
+
[
|
|
880
|
+
be("div", {
|
|
881
|
+
"data-id": e.id,
|
|
882
|
+
style: e.selected ? c.value : {}
|
|
883
|
+
}, ""),
|
|
884
|
+
be("div", {
|
|
885
|
+
class: "text",
|
|
886
|
+
"data-id": e.id,
|
|
887
|
+
style: {
|
|
888
|
+
fontSize: "12px",
|
|
889
|
+
fontWeight: 500,
|
|
890
|
+
fontFamily: "Arial"
|
|
891
|
+
}
|
|
892
|
+
}, e.name || "未命名船舶"),
|
|
893
|
+
be("div", {
|
|
894
|
+
class: "icons",
|
|
895
|
+
"data-id": e.id,
|
|
896
|
+
style: {
|
|
897
|
+
color: "#3370ff",
|
|
898
|
+
marginLeft: "6px"
|
|
899
|
+
}
|
|
900
|
+
}, [
|
|
901
|
+
e.existDevice ? be("i", {
|
|
902
|
+
class: "map-iconfont icon-camera",
|
|
903
|
+
"data-id": e.id,
|
|
904
|
+
style: {
|
|
905
|
+
fontSize: "12px",
|
|
906
|
+
marginRight: "6px"
|
|
907
|
+
}
|
|
908
|
+
}) : "",
|
|
909
|
+
e.existMobile ? be("i", {
|
|
910
|
+
"data-id": e.id,
|
|
911
|
+
class: "map-iconfont icon-tele",
|
|
912
|
+
style: {
|
|
913
|
+
fontSize: "12px",
|
|
914
|
+
marginRight: "6px"
|
|
915
|
+
}
|
|
916
|
+
}) : "",
|
|
917
|
+
e.existWaterGauge ? be("i", {
|
|
918
|
+
"data-id": e.id,
|
|
919
|
+
class: "map-iconfont icon-ruler",
|
|
920
|
+
style: {
|
|
921
|
+
fontSize: "12px",
|
|
922
|
+
marginRight: "6px"
|
|
923
|
+
}
|
|
924
|
+
}) : ""
|
|
925
|
+
])
|
|
926
|
+
]
|
|
927
|
+
),
|
|
928
|
+
be("svg", {
|
|
929
|
+
class: "ship-overlay-line",
|
|
930
|
+
style: d.value,
|
|
931
|
+
viewBox: "0 0 20 20",
|
|
932
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
933
|
+
}, [
|
|
934
|
+
be("line", {
|
|
935
|
+
x1: "0",
|
|
936
|
+
y1: "20",
|
|
937
|
+
x2: "20",
|
|
938
|
+
y2: "4",
|
|
939
|
+
stroke: "white",
|
|
940
|
+
"stroke-width": "1"
|
|
941
|
+
})
|
|
942
|
+
])
|
|
943
|
+
]);
|
|
944
|
+
}
|
|
945
|
+
const Ot = (e) => {
|
|
946
|
+
const { spd: n, hdg: i, cog: o } = e;
|
|
947
|
+
return n ? i !== null && +i != 511 && o !== null ? o - +i >= 3 ? me.right : o - +i <= -3 ? me.left : me.front : me.front : "";
|
|
948
|
+
};
|
|
949
|
+
function To(e, n) {
|
|
950
|
+
const { isHighlight: i, shipData: o, color: c } = e.getProperties(), d = ot(n), l = nt(n, o, d), S = ((o == null ? void 0 : o.cog) - 90 + 360) % 360, M = Ot(o);
|
|
951
|
+
return {
|
|
952
|
+
featureId: o.id,
|
|
953
|
+
shipType: d,
|
|
954
|
+
isHighlight: !!i,
|
|
955
|
+
scale: l,
|
|
956
|
+
fill: c,
|
|
957
|
+
deg: S,
|
|
958
|
+
direct: M
|
|
959
|
+
};
|
|
960
|
+
}
|
|
961
|
+
const Be = /* @__PURE__ */ new Map();
|
|
962
|
+
function So(e) {
|
|
963
|
+
return `${e.featureId}_${e.shipType}_${e.isHighlight}_${e.scale}_${e.fill}_${e.deg}_${e.direct}`;
|
|
964
|
+
}
|
|
965
|
+
const Ve = (e, n) => {
|
|
966
|
+
const i = To(n, e), o = So(i);
|
|
967
|
+
if (Be.has(o))
|
|
968
|
+
return Be.get(o);
|
|
969
|
+
const { shipData: c } = n.getProperties(), d = ot(e), l = nt(e, c, d), S = Fo(n, l, d);
|
|
970
|
+
return Be.set(o, S), S;
|
|
971
|
+
}, ot = (e) => {
|
|
972
|
+
const n = e == null ? void 0 : e.getView().getZoom();
|
|
973
|
+
return n && n <= fe.shipModelMax && n >= fe.shipTriggleMin ? "ship" : "triangle";
|
|
974
|
+
};
|
|
975
|
+
let Et = null;
|
|
976
|
+
const nt = (e, n, i) => {
|
|
977
|
+
if (i === "triangle")
|
|
978
|
+
return fe.scaleNum;
|
|
979
|
+
const o = e == null ? void 0 : e.getView().getResolution();
|
|
980
|
+
if (Et === o && i === "triangle")
|
|
981
|
+
return fe.scaleNum;
|
|
982
|
+
if (Et = o, i === "ship") {
|
|
983
|
+
const { len: c, wid: d } = n, l = 97, S = 20, M = 1 / o, y = c * M / l, t = d * M / S, r = Math.min(y, t);
|
|
984
|
+
return Math.max(0.2, Math.min(2, r));
|
|
985
|
+
}
|
|
986
|
+
return fe.scaleNum;
|
|
987
|
+
}, Fo = (e, n, i) => {
|
|
988
|
+
const { color: o, direct: c, isHighlight: d, shipData: l } = e.getProperties(), S = ((l == null ? void 0 : l.cog) - 90 + 360) % 360;
|
|
989
|
+
return new re({
|
|
990
|
+
image: new Ce({
|
|
991
|
+
src: M(),
|
|
992
|
+
scale: n || fe.scaleNum,
|
|
993
|
+
anchor: [0.5, 0.5],
|
|
994
|
+
rotation: S * Math.PI / 180,
|
|
995
|
+
rotateWithView: !1
|
|
996
|
+
})
|
|
997
|
+
});
|
|
998
|
+
function M() {
|
|
999
|
+
return `data:image/svg+xml;utf8,${encodeURIComponent(y())}`;
|
|
1000
|
+
}
|
|
1001
|
+
function y() {
|
|
1002
|
+
switch (i) {
|
|
1003
|
+
case "triangle":
|
|
1004
|
+
return `<svg width="41" height="24" viewBox="0 0 41 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1005
|
+
<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"
|
|
1006
|
+
fill="${o}" stroke="${d ? "#FF2424" : "black"}" stroke-width="${d ? "2" : "0.578947"}" />
|
|
1007
|
+
<!--path船航向左边或者向前-->
|
|
1008
|
+
${c === me.left && `<path d="M30 12L40 12L40 8" stroke="${d ? "#FF2424" : "black"}" stroke-width="2"/>`}
|
|
1009
|
+
<!--path船航向右边-->
|
|
1010
|
+
${c === me.right && `<path d="M30 12L40 12L40 16" stroke="${d ? "#FF2424" : "black"}" stroke-width="2"/>`}
|
|
1011
|
+
<!--path黑线无左右-->
|
|
1012
|
+
${c === me.front && `<path d="M30 12L40 12" stroke="${d ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
1013
|
+
</svg>
|
|
1014
|
+
`;
|
|
1015
|
+
case "ship":
|
|
1016
|
+
return `<svg width="97" height="20" viewBox="0 0 97 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1017
|
+
<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"
|
|
1018
|
+
fill="${o}" stroke="${d ? "#FF2424" : "black"}" stroke-width="${d ? "4" : "0.578947"}"/>
|
|
1019
|
+
${c === me.left && `<path d="M86 10L96 10L96 6" stroke="${d ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
1020
|
+
${c === me.right && `<path d="M86 10L96 10L96 14" stroke="${d ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
1021
|
+
${c === me.front && `<path d="M86 10L96 10" stroke="${d ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
1022
|
+
</svg>
|
|
1023
|
+
`;
|
|
1024
|
+
default:
|
|
1025
|
+
return "";
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
}, qe = /* @__PURE__ */ new Map();
|
|
1029
|
+
function Ro(e, n) {
|
|
1030
|
+
const i = ot(n), o = nt(n, e, i);
|
|
1031
|
+
return `${i}_${o}_${i === "ship" ? 109 : 49}`;
|
|
1032
|
+
}
|
|
1033
|
+
const Tt = (e, n) => {
|
|
1034
|
+
const i = Ro(n, e);
|
|
1035
|
+
if (qe.has(i))
|
|
1036
|
+
return qe.get(i);
|
|
1037
|
+
const o = ot(e), c = nt(e, n, o), d = o === "ship" ? 109 : 49, l = `
|
|
1038
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="${d}" height="${d}" viewBox="0 0 49 49" fill="none">
|
|
1039
|
+
<path d="M1.99982 46.9998L1.99982 1.99982L46.9998 1.99982L46.9998 46.9998L1.99982 46.9998Z" fill="#FF2424" fill-opacity="0.2"/>
|
|
1040
|
+
<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"/>
|
|
1041
|
+
</svg>
|
|
1042
|
+
`, S = new re({
|
|
1043
|
+
image: new Ce({
|
|
1044
|
+
src: `data:image/svg+xml;utf8,${encodeURIComponent(l)}`,
|
|
1045
|
+
scale: c,
|
|
1046
|
+
anchorXUnits: "fraction",
|
|
1047
|
+
anchorYUnits: "fraction"
|
|
1048
|
+
})
|
|
1049
|
+
});
|
|
1050
|
+
return qe.set(i, S), S;
|
|
1051
|
+
};
|
|
1052
|
+
function $o(e, n, i, o) {
|
|
1053
|
+
if (n) {
|
|
1054
|
+
const c = new pe({
|
|
1055
|
+
element: i,
|
|
1056
|
+
positioning: "top-left",
|
|
1057
|
+
id: "label-" + (o == null ? void 0 : o.id),
|
|
1058
|
+
offset: [20, -20],
|
|
1059
|
+
autoPan: !1,
|
|
1060
|
+
position: n,
|
|
1061
|
+
stopEvent: !1,
|
|
1062
|
+
className: o != null && o.blinking ? "ship-label-overlay-blinking" : "ship-label-overlay"
|
|
1063
|
+
});
|
|
1064
|
+
c.set("class", "zh-map-ship-overlay"), e.addOverlay(c);
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
const No = (e, n) => {
|
|
1068
|
+
const { lon: i, lat: o, blinking: c } = n, d = At(n);
|
|
1069
|
+
i && o && $o(e, ie([i, o]), d, { ...n, blinking: c });
|
|
1070
|
+
}, At = (e) => {
|
|
1071
|
+
const n = document.createElement("div");
|
|
1072
|
+
n.className = "ship-overlay-box", n.style.position = "relative";
|
|
1073
|
+
const { lon: i, lat: o, blinking: c, blinkingColors: d, name: l } = e, S = at({
|
|
1074
|
+
setup() {
|
|
1075
|
+
return Eo({
|
|
1076
|
+
id: e == null ? void 0 : e.id,
|
|
1077
|
+
selected: c,
|
|
1078
|
+
name: l,
|
|
1079
|
+
colors: d || [],
|
|
1080
|
+
existDevice: e == null ? void 0 : e.existDevice,
|
|
1081
|
+
existMobile: e == null ? void 0 : e.existMobile,
|
|
1082
|
+
existWaterGauge: e == null ? void 0 : e.existWaterGauge
|
|
1083
|
+
});
|
|
1084
|
+
}
|
|
1085
|
+
});
|
|
1086
|
+
return jt(S, n), n;
|
|
1087
|
+
}, St = (e) => {
|
|
1088
|
+
const n = [];
|
|
1089
|
+
return e.existDevice && n.push(""), e.existMobile && n.push(""), e.existWaterGauge && n.push(""), n;
|
|
1090
|
+
};
|
|
1091
|
+
function zo() {
|
|
1092
|
+
const e = [
|
|
1093
|
+
"left-top",
|
|
1094
|
+
"left-middle",
|
|
1095
|
+
"left-bottom",
|
|
1096
|
+
"right-top",
|
|
1097
|
+
"right-middle",
|
|
1098
|
+
"right-bottom"
|
|
1099
|
+
];
|
|
1100
|
+
return e[Math.floor(Math.random() * e.length)];
|
|
1101
|
+
}
|
|
1102
|
+
const Vo = window.devicePixelRatio || 1, lt = /* @__PURE__ */ new Map();
|
|
1103
|
+
let Ye = null, st = null;
|
|
1104
|
+
function Oo(e, n, i = "left-bottom", o = 10) {
|
|
1105
|
+
const c = `${e}-${n.join(",")}-${i}-${o}`;
|
|
1106
|
+
if (lt.has(c))
|
|
1107
|
+
return lt.get(c);
|
|
1108
|
+
if (!Ye) {
|
|
1109
|
+
Ye = document.createElement("canvas");
|
|
1110
|
+
try {
|
|
1111
|
+
st = Ye.getContext("2d", {
|
|
1112
|
+
willReadFrequently: !0
|
|
1113
|
+
});
|
|
1114
|
+
} catch {
|
|
1115
|
+
st = Ye.getContext("2d");
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
const d = Ye, l = st;
|
|
1119
|
+
if (!l) return "";
|
|
1120
|
+
d.width = 0, d.height = 0;
|
|
1121
|
+
const S = 2, M = 4, y = 16, t = window.devicePixelRatio || 1, r = "500 12px Arial", $ = "12px map-iconfont";
|
|
1122
|
+
l.font = r;
|
|
1123
|
+
const R = l.measureText(e).width;
|
|
1124
|
+
l.font = $;
|
|
1125
|
+
const g = n.map((w) => ({ width: l.measureText(Re(w)).width, height: 14 })), a = g.reduce((w, F) => w + F.width, 0), u = n.length * o, h = M + R + a + u + M, v = S + 14 + S * 2;
|
|
1126
|
+
let x, m, E = 0, I = 0, oe = 0, K = 0, Z = 0, W = 0;
|
|
1127
|
+
switch (x = y + h, i) {
|
|
1128
|
+
case "right-top":
|
|
1129
|
+
m = y + v, E = 0, I = y + v, oe = y, K = 0, Z = y, W = 0;
|
|
1130
|
+
break;
|
|
1131
|
+
case "right-middle":
|
|
1132
|
+
m = v, E = 0, I = v / 2, oe = y, K = v / 2, Z = y, W = 0;
|
|
1133
|
+
break;
|
|
1134
|
+
case "right-bottom":
|
|
1135
|
+
m = y + v, E = 0, I = 0, oe = y, K = y, Z = y, W = y;
|
|
1136
|
+
break;
|
|
1137
|
+
case "left-top":
|
|
1138
|
+
m = y + v, E = h, I = y, oe = h + y, K = v + y, Z = 0, W = 0;
|
|
1139
|
+
break;
|
|
1140
|
+
case "left-middle":
|
|
1141
|
+
m = v, E = h, I = v / 2, oe = h + y, K = v / 2, Z = 0, W = 0;
|
|
1142
|
+
break;
|
|
1143
|
+
case "left-bottom":
|
|
1144
|
+
m = y + v, E = h, I = v, oe = h + y, K = 0, Z = 0, W = y;
|
|
1145
|
+
break;
|
|
1146
|
+
}
|
|
1147
|
+
m = m + S, d.width = Math.round(x * t), d.height = Math.round(m * t), l.scale(t, t), l.clearRect(0, 0, x, m), l.beginPath(), l.moveTo(E, I), l.lineTo(oe, K), l.strokeStyle = "#FFF", l.lineWidth = 1, l.stroke(), l.fillStyle = "#FFF", l.fillRect(Z, W, h, v), l.font = r, l.textBaseline = "middle";
|
|
1148
|
+
const G = W + S / 2 + v / 2;
|
|
1149
|
+
l.strokeStyle = "#ffffff", l.lineWidth = 1, l.strokeText(e, Z + M, G), l.fillStyle = "#000000", l.fillText(e, Z + M, G), l.font = $, l.fillStyle = "#3370ff";
|
|
1150
|
+
let Y = Z + M + R + o;
|
|
1151
|
+
const U = W + v / 2;
|
|
1152
|
+
n.length > 0 && n.forEach((w, F) => {
|
|
1153
|
+
l.fillText(Re(w), Y, U), Y += g[F].width + o;
|
|
1154
|
+
});
|
|
1155
|
+
const p = d.toDataURL("image/png");
|
|
1156
|
+
return lt.set(c, p), p;
|
|
1157
|
+
}
|
|
1158
|
+
const Ft = (e, n) => {
|
|
1159
|
+
const { name: i, rightIcons: o, selected: c } = e.getProperties(), d = n !== 1 ? zo() : "right-top", l = Oo(i, o, d);
|
|
1160
|
+
let S = [0, 0];
|
|
1161
|
+
switch (d) {
|
|
1162
|
+
case "right-top":
|
|
1163
|
+
S = [0, 1];
|
|
1164
|
+
break;
|
|
1165
|
+
case "right-middle":
|
|
1166
|
+
S = [0, 0.5];
|
|
1167
|
+
break;
|
|
1168
|
+
case "right-bottom":
|
|
1169
|
+
S = [0, 0];
|
|
1170
|
+
break;
|
|
1171
|
+
case "left-top":
|
|
1172
|
+
S = [1, 1];
|
|
1173
|
+
break;
|
|
1174
|
+
case "left-middle":
|
|
1175
|
+
S = [1, 0.5];
|
|
1176
|
+
break;
|
|
1177
|
+
case "left-bottom":
|
|
1178
|
+
S = [1, 0];
|
|
1179
|
+
break;
|
|
1180
|
+
}
|
|
1181
|
+
return new re({
|
|
1182
|
+
image: new Ce({
|
|
1183
|
+
src: l,
|
|
1184
|
+
anchor: S,
|
|
1185
|
+
displacement: [0, 0],
|
|
1186
|
+
scale: 1 / Vo,
|
|
1187
|
+
anchorXUnits: "fraction",
|
|
1188
|
+
anchorYUnits: "fraction"
|
|
1189
|
+
}),
|
|
1190
|
+
zIndex: c ? 100 : 10
|
|
1191
|
+
});
|
|
1192
|
+
}, Ao = (e, n) => {
|
|
1193
|
+
let i = null, o = null;
|
|
1194
|
+
const c = new ve(), d = new io({
|
|
1195
|
+
source: c,
|
|
1196
|
+
className: "zh-map--ship-layer",
|
|
1197
|
+
renderBuffer: 300,
|
|
1198
|
+
zIndex: 101,
|
|
1199
|
+
properties: { layerType: se.SHIP }
|
|
1200
|
+
}), l = new ve(), S = new we({
|
|
1201
|
+
source: l,
|
|
1202
|
+
className: "zh-map--ship-label-layer",
|
|
1203
|
+
zIndex: 102,
|
|
1204
|
+
updateWhileInteracting: !1,
|
|
1205
|
+
updateWhileAnimating: !1,
|
|
1206
|
+
properties: { layerType: se.SHIP },
|
|
1207
|
+
declutter: !0
|
|
1208
|
+
}), M = new ve(), y = new we({
|
|
1209
|
+
source: M,
|
|
1210
|
+
className: "zh-map--ship-selected-layer",
|
|
1211
|
+
zIndex: 999
|
|
1212
|
+
});
|
|
1213
|
+
e == null || e.addLayer(d), e == null || e.addLayer(S), e == null || e.addLayer(y);
|
|
1214
|
+
let t = null, r = null, $ = null, D = "", R = {}, g = {};
|
|
1215
|
+
const a = (s) => {
|
|
1216
|
+
if (!s || !e) return;
|
|
1217
|
+
const C = (o == null ? void 0 : o.id) || (i == null ? void 0 : i.get("id"));
|
|
1218
|
+
if (o) {
|
|
1219
|
+
const P = s.filter((z) => z.id === C);
|
|
1220
|
+
P.length === 0 ? s.push(o) : o = P[0];
|
|
1221
|
+
}
|
|
1222
|
+
E(), w(s), x(), u(s);
|
|
1223
|
+
}, u = (s) => {
|
|
1224
|
+
Array.from(Be.keys()).forEach((C) => {
|
|
1225
|
+
const P = C.split("_")[0];
|
|
1226
|
+
s.find((A) => A.id === P) || Be.delete(C);
|
|
1227
|
+
});
|
|
1228
|
+
}, h = () => {
|
|
1229
|
+
Array.from(qe.keys()).forEach((s) => {
|
|
1230
|
+
qe.delete(s);
|
|
1231
|
+
});
|
|
1232
|
+
}, v = (s) => {
|
|
1233
|
+
var H;
|
|
1234
|
+
const C = (o == null ? void 0 : o.id) || (i == null ? void 0 : i.get("id")), P = ie([s == null ? void 0 : s.lon, s == null ? void 0 : s.lat]), z = ((H = g[s.id]) == null ? void 0 : H.blinkColors) || [], B = z[z.length - 1] || s.fill || "#04C900", te = Ot(s), J = new ce({
|
|
1235
|
+
geometry: new de(P),
|
|
1236
|
+
// 船舶数据
|
|
1237
|
+
shipData: s,
|
|
1238
|
+
id: s.id,
|
|
1239
|
+
name: s.cnname || s.enname || s.name || s.id || "未命名船舶",
|
|
1240
|
+
selected: s.id === C,
|
|
1241
|
+
// 图标
|
|
1242
|
+
rightIcons: St(s),
|
|
1243
|
+
// 船舶颜色
|
|
1244
|
+
color: B,
|
|
1245
|
+
// 船艏向的方向
|
|
1246
|
+
direct: te,
|
|
1247
|
+
// 高亮
|
|
1248
|
+
isHighlight: !1
|
|
1249
|
+
});
|
|
1250
|
+
return J.set("clickGeometry", new Nt(P)), J;
|
|
1251
|
+
}, x = () => {
|
|
1252
|
+
if (o && e && o) {
|
|
1253
|
+
M.getFeatures().length > 0 && M.clear();
|
|
1254
|
+
const s = ie([o == null ? void 0 : o.lon, o == null ? void 0 : o.lat]), C = new ce({
|
|
1255
|
+
geometry: new de(s),
|
|
1256
|
+
id: o.id
|
|
1257
|
+
});
|
|
1258
|
+
C.setStyle(Tt(e, o)), M.addFeature(C);
|
|
1259
|
+
}
|
|
1260
|
+
}, m = () => {
|
|
1261
|
+
const s = c.getFeatures(), C = 100;
|
|
1262
|
+
let P = 0;
|
|
1263
|
+
const z = () => {
|
|
1264
|
+
const te = Math.min(P + C, s.length);
|
|
1265
|
+
for (; P < te; P++) {
|
|
1266
|
+
const J = s[P], H = Ve(e, J);
|
|
1267
|
+
J.setStyle(H);
|
|
1268
|
+
}
|
|
1269
|
+
P < s.length && requestAnimationFrame(z);
|
|
1270
|
+
};
|
|
1271
|
+
z();
|
|
1272
|
+
const B = M.getFeatures()[0];
|
|
1273
|
+
if (B && o) {
|
|
1274
|
+
const te = Tt(e, o);
|
|
1275
|
+
B.setStyle(te);
|
|
1276
|
+
}
|
|
1277
|
+
}, E = () => {
|
|
1278
|
+
e && c && (I(), c.clear(), l.clear(), M.clear());
|
|
1279
|
+
}, I = () => {
|
|
1280
|
+
const s = e.getOverlays().getArray().filter((C) => C.get("class") == "zh-map-ship-overlay");
|
|
1281
|
+
if (s && s.length > 0)
|
|
1282
|
+
for (let C = 0; C < s.length; C++) {
|
|
1283
|
+
const P = s[C];
|
|
1284
|
+
P.setPosition(void 0), e.removeOverlay(P), P.dispose();
|
|
1285
|
+
}
|
|
1286
|
+
}, oe = (s, C) => {
|
|
1287
|
+
R = s, g = C;
|
|
1288
|
+
const P = e.getOverlays().getArray(), z = c.getFeatures();
|
|
1289
|
+
for (const A in R) {
|
|
1290
|
+
const B = R[A], te = P.find((H) => (H == null ? void 0 : H.getId()) === "label-" + A), J = z.find((H) => A === H.get("id"));
|
|
1291
|
+
if (te && J) {
|
|
1292
|
+
const H = C[A].blinkColors || [], { shipData: he, name: xe, color: ke } = J.getProperties();
|
|
1293
|
+
J.set("blinking", B), H[(H == null ? void 0 : H.length) - 1] && ke !== H[(H == null ? void 0 : H.length) - 1] && (J.set("color", H[(H == null ? void 0 : H.length) - 1] || ""), J.setStyle(Ve(e, J)));
|
|
1294
|
+
const rt = {
|
|
1295
|
+
...he,
|
|
1296
|
+
blinking: B,
|
|
1297
|
+
blinkingColors: H || [],
|
|
1298
|
+
name: xe + "(" + C[A].shipState + ")"
|
|
1299
|
+
}, Ze = te.getElement(), _e = At(rt);
|
|
1300
|
+
Ze && Ze !== _e && te.setElement(_e);
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
}, K = (s) => {
|
|
1304
|
+
if (!e) return;
|
|
1305
|
+
const C = c.getFeatures(), P = l.getFeatures(), z = i ? i.get("id") : "", A = C.filter((H) => H.get("id") !== z), B = P == null ? void 0 : P.filter((H) => H.get("id") !== z), te = /* @__PURE__ */ new Map();
|
|
1306
|
+
s.forEach((H) => {
|
|
1307
|
+
te.set(H.id, !0);
|
|
1308
|
+
});
|
|
1309
|
+
const J = e.getOverlays().getArray();
|
|
1310
|
+
A.forEach((H) => {
|
|
1311
|
+
const he = H.get("id");
|
|
1312
|
+
if (!te.has(he))
|
|
1313
|
+
H.setStyle([]);
|
|
1314
|
+
else {
|
|
1315
|
+
const ke = H.getStyle();
|
|
1316
|
+
(ke == null ? void 0 : ke.length) == 0 && H.setStyle(Ve(e, H));
|
|
1317
|
+
}
|
|
1318
|
+
const xe = J.find((ke) => ke.getId() === "label-" + he);
|
|
1319
|
+
xe && xe.setPosition(void 0);
|
|
1320
|
+
}), B.forEach((H) => {
|
|
1321
|
+
const he = H.get("id");
|
|
1322
|
+
if (!te.has(he))
|
|
1323
|
+
H.setStyle([]);
|
|
1324
|
+
else {
|
|
1325
|
+
const xe = H.getStyle();
|
|
1326
|
+
(xe == null ? void 0 : xe.length) == 0 && H.setStyle(Ft(H, s.length));
|
|
1327
|
+
}
|
|
1328
|
+
});
|
|
1329
|
+
}, Z = (s) => {
|
|
1330
|
+
if (s) {
|
|
1331
|
+
console.log("选中", s);
|
|
1332
|
+
const C = c.getFeatures().find((z) => z.get("id") === s.id), P = l.getFeatures().find((z) => z.get("id") === s.id);
|
|
1333
|
+
C && (i = C), P && P.set("selected", !0), o = s, x();
|
|
1334
|
+
} else
|
|
1335
|
+
console.log("取消选中"), o = null, i = null, U(), h();
|
|
1336
|
+
}, W = (s, C, P) => {
|
|
1337
|
+
r = s, $ = C, t = P;
|
|
1338
|
+
}, G = lo((s, C, P) => {
|
|
1339
|
+
try {
|
|
1340
|
+
if (s) {
|
|
1341
|
+
const z = s.get("shipData"), A = s.get("id");
|
|
1342
|
+
if (C === "click" && (Z(z), P && P(A)), C === "hover") {
|
|
1343
|
+
D && D !== A && Y(), D = A;
|
|
1344
|
+
const B = c.getFeatures().find((te) => te.get("id") === D);
|
|
1345
|
+
B == null || B.set("isHighlight", !0), B == null || B.setStyle(Ve(e, B));
|
|
1346
|
+
}
|
|
1347
|
+
} else
|
|
1348
|
+
Y();
|
|
1349
|
+
} catch (z) {
|
|
1350
|
+
console.log("handleShipMapEvent", z);
|
|
1351
|
+
}
|
|
1352
|
+
}, 10), Y = () => {
|
|
1353
|
+
const s = D ? c.getFeatures().find((C) => C.get("id") === D) : null;
|
|
1354
|
+
D = null, s == null || s.set("isHighlight", !1), s == null || s.setStyle(Ve(e, s));
|
|
1355
|
+
}, U = () => {
|
|
1356
|
+
try {
|
|
1357
|
+
M.clear();
|
|
1358
|
+
} catch (s) {
|
|
1359
|
+
console.log(s);
|
|
1360
|
+
}
|
|
1361
|
+
}, p = (s, C) => {
|
|
1362
|
+
const P = ie([s == null ? void 0 : s.lon, s == null ? void 0 : s.lat]), z = new ce({
|
|
1363
|
+
geometry: new de(P),
|
|
1364
|
+
name: s.cnname || s.enname || s.name || s.id || "未命名船舶",
|
|
1365
|
+
// 图标
|
|
1366
|
+
rightIcons: St(s),
|
|
1367
|
+
selected: (s == null ? void 0 : s.id) === (o == null ? void 0 : o.id),
|
|
1368
|
+
shipData: s
|
|
1369
|
+
});
|
|
1370
|
+
z.set("id", s.id);
|
|
1371
|
+
const A = Ft(z, C);
|
|
1372
|
+
return z.setStyle(A), z;
|
|
1373
|
+
}, w = (s) => {
|
|
1374
|
+
const C = e.getView().getZoom(), P = [], z = [];
|
|
1375
|
+
s.forEach((J) => {
|
|
1376
|
+
const H = v(J);
|
|
1377
|
+
H.setStyle(Ve(e, H)), c.addFeature(H), R[J.id] && P.push(J), (o == null ? void 0 : o.id) == J.id && (o = J), !R[J.id] && (o == null ? void 0 : o.id) !== J.id && z.push(J);
|
|
1378
|
+
}), ($ !== null ? $ : (o == null ? void 0 : o.id) && R[o == null ? void 0 : o.id] || C && C >= fe.shipModelMin) && P.map((J) => {
|
|
1379
|
+
j(J);
|
|
1380
|
+
}), o && (t !== null ? t : !0) && !R[o == null ? void 0 : o.id] && F(o, s), (r !== null ? r : C && C >= fe.shipModelMin) && z.map((J) => {
|
|
1381
|
+
F(J, s);
|
|
1382
|
+
});
|
|
1383
|
+
}, F = (s, C) => {
|
|
1384
|
+
const P = p(s, C.length);
|
|
1385
|
+
l.addFeature(P);
|
|
1386
|
+
}, q = (s) => {
|
|
1387
|
+
var P;
|
|
1388
|
+
const C = c.getFeatures().find((z) => z.get("id") === s);
|
|
1389
|
+
G(C, "click", (P = n.getProps()) == null ? void 0 : P.selectShip);
|
|
1390
|
+
}, j = (s) => {
|
|
1391
|
+
var C;
|
|
1392
|
+
if (s.id && g[s == null ? void 0 : s.id]) {
|
|
1393
|
+
const P = g[s == null ? void 0 : s.id] || {}, z = (P == null ? void 0 : P.blinkColors) || [], A = (P == null ? void 0 : P.shipState) || "", B = (s.cnname || s.enname || s.name || s.id || "未命名船舶") + "(" + A + ")", te = {
|
|
1394
|
+
...s,
|
|
1395
|
+
name: B,
|
|
1396
|
+
blinking: R[s.id],
|
|
1397
|
+
blinkingColors: z || []
|
|
1398
|
+
};
|
|
1399
|
+
No(e, te), (C = document.querySelector(".ship-label-overlay-blinking")) == null || C.addEventListener("click", (J) => {
|
|
1400
|
+
var he;
|
|
1401
|
+
const H = (he = J.target) == null ? void 0 : he.getAttribute("data-id");
|
|
1402
|
+
console.log(H), J.preventDefault(), q(H);
|
|
1403
|
+
});
|
|
1404
|
+
}
|
|
1405
|
+
};
|
|
1406
|
+
return {
|
|
1407
|
+
render: a,
|
|
1408
|
+
selected: Z,
|
|
1409
|
+
filter: K,
|
|
1410
|
+
blinking: oe,
|
|
1411
|
+
clear: E,
|
|
1412
|
+
setLableStatus: W,
|
|
1413
|
+
handleShipMapEvent: G,
|
|
1414
|
+
changeShipScale: m
|
|
1415
|
+
};
|
|
1416
|
+
}, Wo = (e) => {
|
|
1417
|
+
const n = () => e == null ? void 0 : e.getLayers(), i = ye("vector"), o = () => i.value, c = (M) => {
|
|
1418
|
+
i.value = M;
|
|
1419
|
+
const y = n();
|
|
1420
|
+
y && (y == null || y.getArray().forEach((t) => {
|
|
1421
|
+
(t.className_ === "vector" || t.className_ === "satellite") && t.setVisible(t.className_ === M);
|
|
1422
|
+
}));
|
|
1423
|
+
}, d = ye(!1);
|
|
1424
|
+
return {
|
|
1425
|
+
getLayers: n,
|
|
1426
|
+
getGreenTileVisible: () => d.value,
|
|
1427
|
+
setGreenTileVisible: (M) => {
|
|
1428
|
+
if (M !== d.value) {
|
|
1429
|
+
if (M) {
|
|
1430
|
+
const y = n();
|
|
1431
|
+
if (!y.getArray().find((r) => r.className_ === "greenTile")) {
|
|
1432
|
+
const r = new Oe({
|
|
1433
|
+
source: new Ae({ url: Fe.greenTile }),
|
|
1434
|
+
visible: M,
|
|
1435
|
+
zIndex: 2,
|
|
1436
|
+
className: "greenTile"
|
|
1437
|
+
});
|
|
1438
|
+
y.push(r);
|
|
1439
|
+
}
|
|
1440
|
+
} else {
|
|
1441
|
+
const y = n(), t = y.getArray().find((r) => r.className_ === "greenTile");
|
|
1442
|
+
t && y.remove(t);
|
|
1443
|
+
}
|
|
1444
|
+
d.value = M;
|
|
1445
|
+
}
|
|
1446
|
+
},
|
|
1447
|
+
getShowLayerType: o,
|
|
1448
|
+
setShowLayerType: c
|
|
1449
|
+
};
|
|
1450
|
+
}, Ho = (e) => {
|
|
1451
|
+
const n = "zh-map-location-layer";
|
|
1452
|
+
let i;
|
|
1453
|
+
const o = new ve();
|
|
1454
|
+
let c = null, d = null;
|
|
1455
|
+
const l = (a) => {
|
|
1456
|
+
if (!(!a || a.length === 0)) {
|
|
1457
|
+
if (o.clear(), d) {
|
|
1458
|
+
const u = a.find((h) => h.id === (d == null ? void 0 : d.id));
|
|
1459
|
+
u ? d = u : a.push(d);
|
|
1460
|
+
}
|
|
1461
|
+
a.forEach((u) => {
|
|
1462
|
+
S(u);
|
|
1463
|
+
}), i || (i = new we({
|
|
1464
|
+
className: n,
|
|
1465
|
+
source: o,
|
|
1466
|
+
zIndex: 100
|
|
1467
|
+
}), e == null || e.addLayer(i));
|
|
1468
|
+
}
|
|
1469
|
+
}, S = (a) => {
|
|
1470
|
+
const u = e == null ? void 0 : e.getView().getZoom(), [h, v] = a.latLon.split(","), x = new ce({
|
|
1471
|
+
geometry: new de(ie([Number(h), Number(v)]))
|
|
1472
|
+
});
|
|
1473
|
+
x.setStyle(M(a, u, a.id === (d == null ? void 0 : d.id))), x.set("loactionData", a), o.addFeature(x);
|
|
1474
|
+
}, M = (a, u, h) => {
|
|
1475
|
+
let v = {
|
|
1476
|
+
src: h && a.selectedPath || a.defaultPath
|
|
1477
|
+
};
|
|
1478
|
+
a != null && a.width && (a != null && a.height) ? v = {
|
|
1479
|
+
...v,
|
|
1480
|
+
width: a.width,
|
|
1481
|
+
height: a.height
|
|
1482
|
+
} : v = {
|
|
1483
|
+
...v,
|
|
1484
|
+
scale: 0.5 * u / 10
|
|
1485
|
+
};
|
|
1486
|
+
let x = {
|
|
1487
|
+
image: new Ce(v)
|
|
1488
|
+
};
|
|
1489
|
+
return a.name && (x = {
|
|
1490
|
+
...x,
|
|
1491
|
+
text: new We({
|
|
1492
|
+
text: a.name,
|
|
1493
|
+
font: "12px sans-serif",
|
|
1494
|
+
fill: new ue({
|
|
1495
|
+
color: "#000000"
|
|
1496
|
+
}),
|
|
1497
|
+
backgroundFill: new ue({
|
|
1498
|
+
color: "#FFFFFF"
|
|
1499
|
+
}),
|
|
1500
|
+
offsetY: 30
|
|
1501
|
+
})
|
|
1502
|
+
}), new re(x);
|
|
1503
|
+
}, y = () => {
|
|
1504
|
+
if (c) {
|
|
1505
|
+
const a = c.get("loactionData").id;
|
|
1506
|
+
o.getFeatures().forEach((u) => {
|
|
1507
|
+
u.get("loactionData").id !== a && o.removeFeature(u);
|
|
1508
|
+
});
|
|
1509
|
+
} else
|
|
1510
|
+
o.clear();
|
|
1511
|
+
}, t = () => {
|
|
1512
|
+
var v;
|
|
1513
|
+
const a = c == null ? void 0 : c.get("loactionData"), u = (v = e == null ? void 0 : e.getView()) == null ? void 0 : v.getZoom();
|
|
1514
|
+
o.getFeatures().forEach((x) => {
|
|
1515
|
+
x.get("loactionData").id === a.id && (x == null || x.setStyle(M(a, u, !1)));
|
|
1516
|
+
}), d = null, c = null;
|
|
1517
|
+
}, r = (a) => {
|
|
1518
|
+
a ? ($(), D(a)) : t();
|
|
1519
|
+
}, $ = () => {
|
|
1520
|
+
var a;
|
|
1521
|
+
if (c) {
|
|
1522
|
+
const u = c.get("loactionData"), h = (a = e == null ? void 0 : e.getView()) == null ? void 0 : a.getZoom();
|
|
1523
|
+
c.setStyle(M(u, h, !1));
|
|
1524
|
+
}
|
|
1525
|
+
}, D = (a) => {
|
|
1526
|
+
const u = o.getFeatures();
|
|
1527
|
+
d = a, c = u.find((h) => h.get("loactionData").id === a.id);
|
|
1528
|
+
};
|
|
1529
|
+
return {
|
|
1530
|
+
render: l,
|
|
1531
|
+
renderHtml: (a, u, h, v) => {
|
|
1532
|
+
const x = document.createElement("div");
|
|
1533
|
+
x.innerHTML = h;
|
|
1534
|
+
let m = {
|
|
1535
|
+
element: x,
|
|
1536
|
+
// 覆盖层的DOM元素
|
|
1537
|
+
positioning: "top-center",
|
|
1538
|
+
// 相对于位置点的定位
|
|
1539
|
+
stopEvent: !1,
|
|
1540
|
+
// 是否阻止事件传播
|
|
1541
|
+
offset: [0, -20],
|
|
1542
|
+
id: "position-" + a
|
|
1543
|
+
};
|
|
1544
|
+
v && (m = {
|
|
1545
|
+
...m,
|
|
1546
|
+
...v
|
|
1547
|
+
});
|
|
1548
|
+
const E = new pe(m);
|
|
1549
|
+
E.setPosition(ie(u)), e.addOverlay(E);
|
|
1550
|
+
},
|
|
1551
|
+
removeHtml: (a) => {
|
|
1552
|
+
const u = e.getOverlays().getArray().find((h) => h.getId() === "position-" + a);
|
|
1553
|
+
u && (u.setPosition(void 0), e.removeOverlay(u));
|
|
1554
|
+
},
|
|
1555
|
+
selected: r,
|
|
1556
|
+
clearSelected: t,
|
|
1557
|
+
clear: y
|
|
1558
|
+
};
|
|
1559
|
+
}, Zo = (e) => {
|
|
1560
|
+
e.getInteractions().forEach((n) => {
|
|
1561
|
+
n instanceof ht && n.setActive(!1);
|
|
1562
|
+
});
|
|
1563
|
+
}, Do = (e) => {
|
|
1564
|
+
e.getInteractions().forEach((n) => {
|
|
1565
|
+
n instanceof ht && n.setActive(!0);
|
|
1566
|
+
});
|
|
1567
|
+
}, Pe = (e, n) => {
|
|
1568
|
+
const i = e.getViewport();
|
|
1569
|
+
i && (i.style.cursor = n);
|
|
1570
|
+
}, Go = (e, n) => {
|
|
1571
|
+
const i = ye([]), o = ye("km"), c = (K) => {
|
|
1572
|
+
o.value = K;
|
|
1573
|
+
};
|
|
1574
|
+
let d, l = "close";
|
|
1575
|
+
const S = () => {
|
|
1576
|
+
Pe(e, "crosshair"), t(), Zo(e), e.on("pointermove", D), e.getViewport().addEventListener("mouseout", () => {
|
|
1577
|
+
d && d.classList.add("hidden");
|
|
1578
|
+
}), g(), l = "open";
|
|
1579
|
+
};
|
|
1580
|
+
let M, y;
|
|
1581
|
+
const t = () => {
|
|
1582
|
+
M = new ve(), y = new we({
|
|
1583
|
+
source: M,
|
|
1584
|
+
zIndex: 1e3,
|
|
1585
|
+
style: {
|
|
1586
|
+
"fill-color": "rgba(255, 255, 255, 0.2)",
|
|
1587
|
+
"stroke-color": "#ffcc33",
|
|
1588
|
+
"stroke-width": 2,
|
|
1589
|
+
"circle-radius": 7,
|
|
1590
|
+
"circle-fill-color": "#ffcc33"
|
|
1591
|
+
}
|
|
1592
|
+
}), e == null || e.addLayer(y);
|
|
1593
|
+
};
|
|
1594
|
+
let r, $;
|
|
1595
|
+
const D = (K) => {
|
|
1596
|
+
if (K.dragging)
|
|
1597
|
+
return;
|
|
1598
|
+
let Z = "点击选择起点";
|
|
1599
|
+
r && (Z = "单击继续,双击结束"), d && (d.innerHTML = Z, $.setPosition(K.coordinate), d.classList.remove("hidden"));
|
|
1600
|
+
};
|
|
1601
|
+
let R;
|
|
1602
|
+
const g = () => {
|
|
1603
|
+
R = new Ie({
|
|
1604
|
+
source: M,
|
|
1605
|
+
type: "LineString",
|
|
1606
|
+
style: new re({
|
|
1607
|
+
fill: new ue({
|
|
1608
|
+
color: "rgba(255, 255, 255, 0.2)"
|
|
1609
|
+
}),
|
|
1610
|
+
stroke: new Le({
|
|
1611
|
+
color: "rgba(255,204,51)",
|
|
1612
|
+
lineDash: [10, 10],
|
|
1613
|
+
width: 2
|
|
1614
|
+
}),
|
|
1615
|
+
image: new et({
|
|
1616
|
+
radius: 5,
|
|
1617
|
+
stroke: new Le({
|
|
1618
|
+
color: "rgba(0, 0, 0, 0.7)"
|
|
1619
|
+
}),
|
|
1620
|
+
fill: new ue({
|
|
1621
|
+
color: "rgba(255, 255, 255, 0.2)"
|
|
1622
|
+
})
|
|
1623
|
+
})
|
|
1624
|
+
}),
|
|
1625
|
+
// 添加条件函数,判断是否应该出发点绘制
|
|
1626
|
+
condition: (Z) => Z.originalEvent.target.className !== "ol-tooltip-measure"
|
|
1627
|
+
}), e == null || e.addInteraction(R), v(), x();
|
|
1628
|
+
let K;
|
|
1629
|
+
R.on("drawstart", function(Z) {
|
|
1630
|
+
var G;
|
|
1631
|
+
r = Z.feature, r.set("randomId", a());
|
|
1632
|
+
let W;
|
|
1633
|
+
K = (G = r.getGeometry()) == null ? void 0 : G.on("change", function(Y) {
|
|
1634
|
+
const U = Y.target, p = Wt(U, o.value);
|
|
1635
|
+
W = U.getLastCoordinate(), u && p && (u.innerHTML = p), h.setPosition(W);
|
|
1636
|
+
});
|
|
1637
|
+
}), R.on("drawend", function() {
|
|
1638
|
+
var Z, W, G;
|
|
1639
|
+
if (u && (u.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), u != null && u.innerHTML) {
|
|
1640
|
+
const Y = (r == null ? void 0 : r.get("randomId")) || a();
|
|
1641
|
+
i.value.push({ id: Y, value: u == null ? void 0 : u.innerHTML }), u.innerHTML = `${u.innerHTML}<div class="ol-tooltip-delete-button" data-id="${Y}"><i class="map-iconfont icon-delete"></i></div>`;
|
|
1642
|
+
}
|
|
1643
|
+
(Z = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || Z.addEventListener("click", (Y) => {
|
|
1644
|
+
var p;
|
|
1645
|
+
Y.preventDefault(), Y.stopPropagation();
|
|
1646
|
+
const U = (p = Y.target) == null ? void 0 : p.getAttribute("data-id");
|
|
1647
|
+
U && E(U);
|
|
1648
|
+
}), h.setOffset([0, -7]), r = null, u = null, v(), K && dt(K), (G = (W = n.getProps()) == null ? void 0 : W.lineDrawEnd) == null || G.call(W, i.value);
|
|
1649
|
+
});
|
|
1650
|
+
}, a = () => Math.random().toString(36).substring(2, 9);
|
|
1651
|
+
let u, h;
|
|
1652
|
+
const v = () => {
|
|
1653
|
+
u != null && u.parentNode && u.parentNode.removeChild(u), u = document.createElement("div"), u.className = "ol-tooltip ol-tooltip-measure", h = new pe({
|
|
1654
|
+
element: u,
|
|
1655
|
+
offset: [0, -15],
|
|
1656
|
+
positioning: "bottom-center",
|
|
1657
|
+
stopEvent: !1,
|
|
1658
|
+
insertFirst: !1
|
|
1659
|
+
}), e == null || e.addOverlay(h);
|
|
1660
|
+
}, x = () => {
|
|
1661
|
+
d != null && d.parentNode && d.parentNode.removeChild(d), d = document.createElement("div"), d.className = "ol-tooltip hidden", $ = new pe({
|
|
1662
|
+
element: d,
|
|
1663
|
+
offset: [15, 0],
|
|
1664
|
+
positioning: "center-left",
|
|
1665
|
+
stopEvent: !1
|
|
1666
|
+
}), e == null || e.addOverlay($);
|
|
1667
|
+
}, m = () => {
|
|
1668
|
+
i.value.forEach((K, Z) => {
|
|
1669
|
+
var Y, U;
|
|
1670
|
+
const W = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1671
|
+
W[Z] && ((U = (Y = W[Z]) == null ? void 0 : Y.parentNode) == null || U.removeChild(W[Z]));
|
|
1672
|
+
const G = M.getFeatures();
|
|
1673
|
+
G[Z] && M.removeFeature(G[Z]);
|
|
1674
|
+
}), I(), Do(e), l = "close", Pe(e, "grab");
|
|
1675
|
+
}, E = (K) => {
|
|
1676
|
+
var W, G, Y, U;
|
|
1677
|
+
const Z = i.value.findIndex((p) => p.id === K);
|
|
1678
|
+
if (Z !== -1) {
|
|
1679
|
+
i.value.splice(Z, 1);
|
|
1680
|
+
const p = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1681
|
+
p[Z] && ((G = (W = p[Z]) == null ? void 0 : W.parentNode) == null || G.removeChild(p[Z]));
|
|
1682
|
+
const w = M.getFeatures();
|
|
1683
|
+
w[Z] && M.removeFeature(w[Z]);
|
|
1684
|
+
}
|
|
1685
|
+
(U = (Y = n.getProps()) == null ? void 0 : Y.lineDrawEnd) == null || U.call(Y, i.value);
|
|
1686
|
+
}, I = () => {
|
|
1687
|
+
if (i.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((K) => {
|
|
1688
|
+
var Z;
|
|
1689
|
+
(Z = K == null ? void 0 : K.parentNode) == null || Z.removeChild(K);
|
|
1690
|
+
}), M == null || M.clear(), R) {
|
|
1691
|
+
const K = e.getInteractions().getArray().find((Z) => Lt(Z) === Lt(R));
|
|
1692
|
+
K && e.removeInteraction(K);
|
|
1693
|
+
}
|
|
1694
|
+
e.removeLayer(y), d != null && d.parentNode && d.parentNode.removeChild(d), u != null && u.parentNode && u.parentNode.removeChild(u);
|
|
1695
|
+
};
|
|
1696
|
+
return {
|
|
1697
|
+
open: S,
|
|
1698
|
+
close: m,
|
|
1699
|
+
deleteLine: E,
|
|
1700
|
+
setUnit: c,
|
|
1701
|
+
getState: () => l
|
|
1702
|
+
};
|
|
1703
|
+
}, Wt = (e, n) => {
|
|
1704
|
+
const o = yt(e);
|
|
1705
|
+
let c = "";
|
|
1706
|
+
switch (n) {
|
|
1707
|
+
case "m":
|
|
1708
|
+
c = `${Math.round(o * 100) / 100} m`;
|
|
1709
|
+
break;
|
|
1710
|
+
case "km":
|
|
1711
|
+
c = `${Math.round(o / 1e3 * 100) / 100} km`;
|
|
1712
|
+
break;
|
|
1713
|
+
case "nm":
|
|
1714
|
+
c = (Math.round(o / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
|
|
1715
|
+
break;
|
|
1716
|
+
}
|
|
1717
|
+
return c;
|
|
1718
|
+
}, Yo = (e, n) => {
|
|
1719
|
+
let i, o, c = "close", d = "area", l;
|
|
1720
|
+
const S = (W, G) => {
|
|
1721
|
+
d = W, l = G, K(), c = "open", M(), Pe(e, "crosshair");
|
|
1722
|
+
}, M = () => {
|
|
1723
|
+
r(), x(), I(), a();
|
|
1724
|
+
};
|
|
1725
|
+
let y = null, t = null;
|
|
1726
|
+
const r = () => {
|
|
1727
|
+
if (y && t) return;
|
|
1728
|
+
const W = new ve(), G = new we({
|
|
1729
|
+
source: W,
|
|
1730
|
+
style: new re({
|
|
1731
|
+
stroke: new Le({
|
|
1732
|
+
color: "#fbcc33",
|
|
1733
|
+
width: 2
|
|
1734
|
+
})
|
|
1735
|
+
}),
|
|
1736
|
+
zIndex: 1e3
|
|
1737
|
+
});
|
|
1738
|
+
y = G, t = W, e.on("pointermove", D), e.addLayer(G), e.on(["dblclick"], function(Y) {
|
|
1739
|
+
R && (Y.stopPropagation(), Y.preventDefault());
|
|
1740
|
+
});
|
|
1741
|
+
};
|
|
1742
|
+
let $;
|
|
1743
|
+
const D = (W) => {
|
|
1744
|
+
if (W.dragging) return;
|
|
1745
|
+
const G = $ ? "单击继续,双击结束" : "点击选择起点";
|
|
1746
|
+
m && (m.innerHTML = G, E.setPosition(W.coordinate));
|
|
1747
|
+
};
|
|
1748
|
+
let R, g = !1;
|
|
1749
|
+
const a = () => {
|
|
1750
|
+
if (i) {
|
|
1751
|
+
m != null && m.parentNode && m.parentNode.removeChild(m);
|
|
1752
|
+
const G = i.getGeometry();
|
|
1753
|
+
if (!G) return;
|
|
1754
|
+
const Y = u(G, "nm");
|
|
1755
|
+
h && (h.innerHTML = `
|
|
1756
|
+
<span class="text">面积:${Y}${g ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
|
|
1757
|
+
`), h && (h.innerHTML += '<span class="delete-icon" ><i class="map-iconfont icon-delete" /></div>');
|
|
1758
|
+
const U = G.getCoordinates(), p = U[0][U[0].length - 2];
|
|
1759
|
+
if (v.setPosition(p), y) {
|
|
1760
|
+
const F = y.getSource();
|
|
1761
|
+
F && i && (F.clear(), F.addFeature(i));
|
|
1762
|
+
}
|
|
1763
|
+
setTimeout(() => {
|
|
1764
|
+
var F;
|
|
1765
|
+
(F = document.querySelector(".delete-icon")) == null || F.addEventListener("click", () => {
|
|
1766
|
+
var q, j;
|
|
1767
|
+
oe(), (j = (q = n.getProps()) == null ? void 0 : q.areaDrawEnd) == null || j.call(q, []);
|
|
1768
|
+
});
|
|
1769
|
+
}, 0);
|
|
1770
|
+
const w = co(i.getGeometry().getExtent());
|
|
1771
|
+
e == null || e.getView().setCenter(w);
|
|
1772
|
+
return;
|
|
1773
|
+
}
|
|
1774
|
+
const W = {
|
|
1775
|
+
type: "Polygon",
|
|
1776
|
+
trace: !0,
|
|
1777
|
+
style: [new re({
|
|
1778
|
+
stroke: new Le({
|
|
1779
|
+
color: "rgba(255, 255, 255, 1)",
|
|
1780
|
+
width: 1.5,
|
|
1781
|
+
lineDash: [10, 10]
|
|
1782
|
+
}),
|
|
1783
|
+
fill: new ue({
|
|
1784
|
+
color: "rgba(255, 255, 255, 0.25)"
|
|
1785
|
+
})
|
|
1786
|
+
}), new re({
|
|
1787
|
+
image: new et({
|
|
1788
|
+
radius: 5,
|
|
1789
|
+
fill: new ue({
|
|
1790
|
+
color: "rgb(51,112,255, 1)"
|
|
1791
|
+
})
|
|
1792
|
+
}),
|
|
1793
|
+
geometry: function(G) {
|
|
1794
|
+
const Y = G.getGeometry().getCoordinates();
|
|
1795
|
+
return new ao(Y);
|
|
1796
|
+
}
|
|
1797
|
+
})]
|
|
1798
|
+
};
|
|
1799
|
+
d !== "fence" && (W.source = t), R = new Ie(W), e == null || e.addInteraction(R), R.on("drawstart", (G) => {
|
|
1800
|
+
var Y;
|
|
1801
|
+
$ = G.feature, o = (Y = $.getGeometry()) == null ? void 0 : Y.on("change", (U) => {
|
|
1802
|
+
const p = U.target, w = u(p, "nm"), q = p.getCoordinates()[0], j = new $e([q[q.length - 2], q[q.length - 1]]), s = Wt(j, "nm");
|
|
1803
|
+
if (g = Number(yt(j) / 1e3) > 150, !w) return;
|
|
1804
|
+
const C = '<span class="error pl-4">超出可以绘画的距离</span>';
|
|
1805
|
+
h && (h.innerHTML = `
|
|
1806
|
+
<div class="text">
|
|
1807
|
+
面积:${w}
|
|
1808
|
+
${g ? C : ""}
|
|
1809
|
+
</div>
|
|
1810
|
+
`), m && (m.innerHTML = `
|
|
1811
|
+
<div class="text">
|
|
1812
|
+
面积:${w}
|
|
1813
|
+
</div>
|
|
1814
|
+
<div class="text ${g ? "error" : ""}">
|
|
1815
|
+
线段 ${q.length - 2}: ${s}
|
|
1816
|
+
${g ? C : ""}
|
|
1817
|
+
</div>
|
|
1818
|
+
<div>
|
|
1819
|
+
<span class="text">单击继续,双击结束</span>
|
|
1820
|
+
</div>
|
|
1821
|
+
`);
|
|
1822
|
+
});
|
|
1823
|
+
}), R.on("drawend", (G) => {
|
|
1824
|
+
var s, C, P, z;
|
|
1825
|
+
const Y = G.feature.getGeometry();
|
|
1826
|
+
if (!Y) return;
|
|
1827
|
+
const w = Y.getCoordinates()[0].map((A) => Rt(A)).map((A) => ({
|
|
1828
|
+
lng: A[0],
|
|
1829
|
+
lat: A[1]
|
|
1830
|
+
}));
|
|
1831
|
+
if (d === "fence")
|
|
1832
|
+
return console.log("polygonPoints--------------", w), l && l(w), w;
|
|
1833
|
+
h && !i && (h.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), i = G.feature, v.setOffset([10, 0]);
|
|
1834
|
+
const q = G.feature.getGeometry().getCoordinates(), j = q[0][q[0].length - 2];
|
|
1835
|
+
if (v.setPosition(j), m != null && m.parentNode && m.parentNode.removeChild(m), (s = n.getProps()) != null && s.areaDrawEnd) {
|
|
1836
|
+
const A = q[0].map((B) => Xe(B, ge.mercator, ge.data));
|
|
1837
|
+
(P = (C = n.getProps()) == null ? void 0 : C.areaDrawEnd) == null || P.call(C, A);
|
|
1838
|
+
}
|
|
1839
|
+
R && (R.setActive(!1), e == null || e.removeInteraction(R), (e == null ? void 0 : e.getInteractions()).forEach((B) => {
|
|
1840
|
+
B instanceof Ie && (B.setActive(!1), e == null || e.removeInteraction(B));
|
|
1841
|
+
})), o && dt(o), (z = document.querySelector(".delete-icon")) == null || z.addEventListener("click", () => {
|
|
1842
|
+
var A, B;
|
|
1843
|
+
oe(), (B = (A = n.getProps()) == null ? void 0 : A.areaDrawEnd) == null || B.call(A, []);
|
|
1844
|
+
});
|
|
1845
|
+
});
|
|
1846
|
+
}, u = (W, G) => {
|
|
1847
|
+
const Y = so(W);
|
|
1848
|
+
switch (G) {
|
|
1849
|
+
case "km":
|
|
1850
|
+
return Y > 1e4 ? Math.round(Y / 1e6 * 100) / 100 + " km<sup>2</sup>" : Math.round(Y * 100) / 100 + " m<sup>2</sup>";
|
|
1851
|
+
case "nm": {
|
|
1852
|
+
if (Y < 0.01)
|
|
1853
|
+
return "0 nm<sup>2</sup>";
|
|
1854
|
+
const U = Y / (1852 * 1852);
|
|
1855
|
+
return U >= 0.01 ? Math.round(U * 100, 2) / 100 + " nm<sup>2</sup>" : Y >= 1 ? Math.round(Y * 100, 2) / 100 + " m<sup>2</sup>" : Math.round(Y * 1e4, 2) / 100 + " cm<sup>2</sup>";
|
|
1856
|
+
}
|
|
1857
|
+
}
|
|
1858
|
+
};
|
|
1859
|
+
let h, v;
|
|
1860
|
+
const x = () => {
|
|
1861
|
+
h != null && h.parentNode && h.parentNode.removeChild(h), h = document.createElement("div"), h.style.display = "flex", h.className = "ol-tooltip ol-tooltip-draw-polygon", v = new pe({
|
|
1862
|
+
element: h,
|
|
1863
|
+
offset: [0, -15],
|
|
1864
|
+
positioning: "bottom-center",
|
|
1865
|
+
stopEvent: !1,
|
|
1866
|
+
insertFirst: !1
|
|
1867
|
+
}), e == null || e.addOverlay(v);
|
|
1868
|
+
};
|
|
1869
|
+
let m, E;
|
|
1870
|
+
const I = () => {
|
|
1871
|
+
m != null && m.parentNode && (m.parentNode.removeChild(m), m.parentNode.addEventListener("click", (W) => {
|
|
1872
|
+
W.preventDefault(), W.stopPropagation();
|
|
1873
|
+
})), m = document.createElement("div"), m.className = "ol-tooltip ol-help-tooltip pointer-none", E = new pe({
|
|
1874
|
+
element: m,
|
|
1875
|
+
offset: [15, 0],
|
|
1876
|
+
positioning: "center-left",
|
|
1877
|
+
stopEvent: !1
|
|
1878
|
+
}), e == null || e.addOverlay(E);
|
|
1879
|
+
}, oe = () => {
|
|
1880
|
+
i = null, S();
|
|
1881
|
+
}, K = () => {
|
|
1882
|
+
c = "close", e.un("pointermove", D), $ = null, R && (R.abortDrawing(), console.log("abortDrawing"), R.setActive(!1), (e == null ? void 0 : e.getInteractions()).forEach((G) => {
|
|
1883
|
+
G instanceof Ie && (G.setActive(!1), e == null || e.removeInteraction(G));
|
|
1884
|
+
}), R = null), o && dt(o), o = void 0, t == null || t.clear(), t = null, y && e.getAllLayers().includes(y) && (e.removeLayer(y), y = null), m != null && m.parentElement && (m.innerHTML = "", m.parentElement.removeChild(m), m = null), h != null && h.parentElement && (h.innerHTML = "", h.parentElement.removeChild(h), h = null), E && e.removeOverlay(E), v && e.removeOverlay(v), Pe(e, "grab");
|
|
1885
|
+
};
|
|
1886
|
+
return {
|
|
1887
|
+
open: S,
|
|
1888
|
+
close: K,
|
|
1889
|
+
reset: oe,
|
|
1890
|
+
getState: () => c
|
|
1891
|
+
};
|
|
1892
|
+
}, Bo = "zh-map-port-layer", qo = (e) => {
|
|
1893
|
+
const n = new ve(), i = new we({
|
|
1894
|
+
className: Bo,
|
|
1895
|
+
source: n,
|
|
1896
|
+
zIndex: 100,
|
|
1897
|
+
updateWhileInteracting: !0,
|
|
1898
|
+
updateWhileAnimating: !0,
|
|
1899
|
+
properties: { layerType: se.PORT }
|
|
1900
|
+
});
|
|
1901
|
+
e == null || e.addLayer(i);
|
|
1902
|
+
let o = null, c = null;
|
|
1903
|
+
const d = (a, u = !0) => {
|
|
1904
|
+
if (!a || a.length === 0) return;
|
|
1905
|
+
if (n.clear(), c) {
|
|
1906
|
+
const v = a.find((x) => x.id === (c == null ? void 0 : c.id));
|
|
1907
|
+
v ? c = v : a.push(c);
|
|
1908
|
+
}
|
|
1909
|
+
const h = [];
|
|
1910
|
+
a.forEach((v) => {
|
|
1911
|
+
const [x, m] = v.latLon.split(","), E = new ce({
|
|
1912
|
+
geometry: new de(ie([Number(x), Number(m)])),
|
|
1913
|
+
portData: v,
|
|
1914
|
+
id: v.id,
|
|
1915
|
+
select: v.id === (c == null ? void 0 : c.id),
|
|
1916
|
+
showTitle: v.id === (c == null ? void 0 : c.id) || u
|
|
1917
|
+
}), I = t(E);
|
|
1918
|
+
E.setStyle(I), h.push(E);
|
|
1919
|
+
}), n.addFeatures(h);
|
|
1920
|
+
};
|
|
1921
|
+
let l = null, S = null;
|
|
1922
|
+
const M = /* @__PURE__ */ new Map(), y = (a, u) => {
|
|
1923
|
+
l || (l = document.createElement("canvas"), S = l.getContext("2d", {
|
|
1924
|
+
willReadFrequently: !0
|
|
1925
|
+
}));
|
|
1926
|
+
const h = `${a}-${u}`;
|
|
1927
|
+
if (M.has(h))
|
|
1928
|
+
return M.get(h);
|
|
1929
|
+
const v = l, x = S;
|
|
1930
|
+
if (!x) return "";
|
|
1931
|
+
v.width = 0, v.height = 0;
|
|
1932
|
+
const m = 2, E = 8, I = window.devicePixelRatio || 1, oe = "12px sans-serif";
|
|
1933
|
+
x.font = oe;
|
|
1934
|
+
const Z = x.measureText(a).width, W = E + Z + E, G = m + 12 + m * 2;
|
|
1935
|
+
v.width = Math.round(W * I), v.height = Math.round(G * I), x.scale(I, I), x.clearRect(0, 0, W, G), x.fillStyle = u ? "#F32D2D" : "#FFF", x.beginPath(), x.roundRect(0, 0, W, G, 4), x.fill(), x.font = oe, x.textBaseline = "middle";
|
|
1936
|
+
const Y = G / 2;
|
|
1937
|
+
x.strokeStyle = u ? "#000" : "#ffffff", x.lineWidth = 1, x.strokeText(a, E, Y), x.fillStyle = u ? "#FFF" : "#000000", x.fillText(a, E, Y);
|
|
1938
|
+
const U = v.toDataURL("image/png");
|
|
1939
|
+
return M.set(h, U), U;
|
|
1940
|
+
}, t = (a) => {
|
|
1941
|
+
const { select: u, showTitle: h } = a.getProperties(), v = (Z) => `<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1942
|
+
<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}"/>
|
|
1943
|
+
<g clip-path="url(#clip0_10059_122082)">
|
|
1944
|
+
<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"/>
|
|
1945
|
+
</g>
|
|
1946
|
+
<defs>
|
|
1947
|
+
<clipPath id="clip0_10059_122082">
|
|
1948
|
+
<rect width="26" height="26" fill="white" transform="translate(10 8)"/>
|
|
1949
|
+
</clipPath>
|
|
1950
|
+
</defs>
|
|
1951
|
+
</svg>
|
|
1952
|
+
`, x = () => `data:image/svg+xml;utf8,${encodeURIComponent(v(u ? "#F32D2D" : "#3370FF"))}`, m = e.getView().getZoom(), E = a.get("portData"), I = window.devicePixelRatio || 1, oe = new re({
|
|
1953
|
+
image: new Ce({
|
|
1954
|
+
src: x(),
|
|
1955
|
+
scale: 0.5 * m / 10
|
|
1956
|
+
}),
|
|
1957
|
+
zIndex: u ? 110 : 100
|
|
1958
|
+
}), K = new re({
|
|
1959
|
+
image: new Ce({
|
|
1960
|
+
src: y(E.shortName, u),
|
|
1961
|
+
anchor: [0.5, 0.5],
|
|
1962
|
+
displacement: [0, -30],
|
|
1963
|
+
scale: 1 / I,
|
|
1964
|
+
anchorXUnits: "fraction",
|
|
1965
|
+
anchorYUnits: "fraction"
|
|
1966
|
+
}),
|
|
1967
|
+
zIndex: u ? 110 : 100
|
|
1968
|
+
// text: new Text({
|
|
1969
|
+
// text: port.shortName,
|
|
1970
|
+
// font: '12px sans-serif',
|
|
1971
|
+
// fill: new Fill({
|
|
1972
|
+
// color: select ? "#ffffff" : "#000000"
|
|
1973
|
+
// }),
|
|
1974
|
+
// backgroundFill: new Fill({
|
|
1975
|
+
// color: "#FFF",
|
|
1976
|
+
// }),
|
|
1977
|
+
// offsetY: 30,
|
|
1978
|
+
// }),
|
|
1979
|
+
});
|
|
1980
|
+
return !h && !u ? oe : [oe, K];
|
|
1981
|
+
}, r = () => {
|
|
1982
|
+
if (n)
|
|
1983
|
+
if (o) {
|
|
1984
|
+
console.log("清除非选中的港口");
|
|
1985
|
+
const a = o.get("portData").id;
|
|
1986
|
+
n.getFeatures().forEach((u) => {
|
|
1987
|
+
u.get("portData").id !== a && n.removeFeature(u);
|
|
1988
|
+
});
|
|
1989
|
+
} else
|
|
1990
|
+
console.log("清除所有港口", n), n == null || n.clear();
|
|
1991
|
+
}, $ = (a) => {
|
|
1992
|
+
if (n) {
|
|
1993
|
+
if (!a)
|
|
1994
|
+
return D();
|
|
1995
|
+
(o == null ? void 0 : o.get("portData").id) !== a.id && (D(), R(a));
|
|
1996
|
+
}
|
|
1997
|
+
}, D = () => {
|
|
1998
|
+
var a;
|
|
1999
|
+
if (o) {
|
|
2000
|
+
const u = o == null ? void 0 : o.get("portData"), h = (a = n.getFeatures()) == null ? void 0 : a.find((v) => v.get("portData").id === u.id);
|
|
2001
|
+
h && (h.set("select", !1), h.setStyle(t(h)), o = null, c = null);
|
|
2002
|
+
}
|
|
2003
|
+
}, R = (a) => {
|
|
2004
|
+
if (!n) return;
|
|
2005
|
+
const u = n.getFeatures();
|
|
2006
|
+
c = a, o = u.find((h) => h.get("portData").id === a.id), o && (o.set("select", !0), o.setStyle(t(o)));
|
|
2007
|
+
};
|
|
2008
|
+
return {
|
|
2009
|
+
render: d,
|
|
2010
|
+
clear: r,
|
|
2011
|
+
selected: $,
|
|
2012
|
+
handlePortHover: (a) => {
|
|
2013
|
+
a && a.get("portData") ? Pe(e, "pointer") : Pe(e, "grab");
|
|
2014
|
+
}
|
|
2015
|
+
};
|
|
2016
|
+
}, Xo = (e) => {
|
|
2017
|
+
const n = new we({
|
|
2018
|
+
source: new ve(),
|
|
2019
|
+
zIndex: 99
|
|
2020
|
+
}), i = new we({
|
|
2021
|
+
source: new ve(),
|
|
2022
|
+
properties: { layerType: se.DELETE },
|
|
2023
|
+
zIndex: 99
|
|
2024
|
+
}), o = '<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M512 0a512 512 0 1 0 512 512A512 512 0 0 0 512 0z m241.28 673.066667a56.96 56.96 0 0 1-80.213333 80.213333L512 592.213333l-161.066667 161.066667a56.96 56.96 0 0 1-80.213333-80.213333L431.786667 512l-161.066667-161.066667a56.96 56.96 0 0 1 80.213333-80.213333L512 431.786667l161.066667-161.066667a56.96 56.96 0 0 1 80.213333 80.213333L592.213333 512z" fill="#000000a6" ></path></svg>';
|
|
2025
|
+
e.addLayer(n), e.addLayer(i);
|
|
2026
|
+
const c = (g) => new re({
|
|
2027
|
+
fill: new ue({
|
|
2028
|
+
color: (g == null ? void 0 : g.fillColor) || "#e8f2ff99"
|
|
2029
|
+
}),
|
|
2030
|
+
stroke: new Le({
|
|
2031
|
+
color: (g == null ? void 0 : g.stokeColor) || "#1c5bffcc",
|
|
2032
|
+
width: 1.5,
|
|
2033
|
+
lineDash: [4, 4]
|
|
2034
|
+
})
|
|
2035
|
+
});
|
|
2036
|
+
function d(g) {
|
|
2037
|
+
const a = g.getCoordinates()[0];
|
|
2038
|
+
let u = -1 / 0, h = [];
|
|
2039
|
+
for (const x of a)
|
|
2040
|
+
x[0] > u ? (u = x[0], h = [x]) : x[0] === u && h.push(x);
|
|
2041
|
+
let v = h[0];
|
|
2042
|
+
for (const x of h)
|
|
2043
|
+
x[1] > v[1] && (v = x);
|
|
2044
|
+
return v;
|
|
2045
|
+
}
|
|
2046
|
+
function l(g, a) {
|
|
2047
|
+
const u = Math.PI / 4;
|
|
2048
|
+
return [
|
|
2049
|
+
g[0] + a * Math.cos(u),
|
|
2050
|
+
g[1] + a * Math.sin(u)
|
|
2051
|
+
];
|
|
2052
|
+
}
|
|
2053
|
+
const S = () => new re({
|
|
2054
|
+
image: new Ce({
|
|
2055
|
+
src: `data:image/svg+xml;utf8,${encodeURIComponent(o)}`,
|
|
2056
|
+
anchor: [0.5, 0.5],
|
|
2057
|
+
anchorXUnits: "fraction",
|
|
2058
|
+
anchorYUnits: "fraction",
|
|
2059
|
+
offset: [0, 0]
|
|
2060
|
+
})
|
|
2061
|
+
}), M = (g) => {
|
|
2062
|
+
var v;
|
|
2063
|
+
let a;
|
|
2064
|
+
const u = (v = g.coordinates) == null ? void 0 : v.map((x) => ie([x.lng, x.lat]));
|
|
2065
|
+
if (g != null && g.radius)
|
|
2066
|
+
a = l(u[0], g.radius);
|
|
2067
|
+
else {
|
|
2068
|
+
const x = new pt([u]), m = x.getExtent(), E = [m[2], m[3]];
|
|
2069
|
+
a = E, x.intersectsCoordinate(E) || (a = d(x));
|
|
2070
|
+
}
|
|
2071
|
+
return new ce({
|
|
2072
|
+
geometry: new de(a),
|
|
2073
|
+
id: "poly-delete-" + g.id,
|
|
2074
|
+
polygonData: g
|
|
2075
|
+
});
|
|
2076
|
+
}, y = (g, a) => {
|
|
2077
|
+
var x, m;
|
|
2078
|
+
const u = (x = g.coordinates) == null ? void 0 : x.map((E) => ie([E.lng, E.lat])), h = new pt([u]), v = new ce({
|
|
2079
|
+
geometry: h,
|
|
2080
|
+
id: g.id
|
|
2081
|
+
});
|
|
2082
|
+
console.log(v), v.setStyle(c(a)), (m = n.getSource()) == null || m.addFeature(v), g.isEdit && t(g);
|
|
2083
|
+
}, t = (g) => {
|
|
2084
|
+
var u;
|
|
2085
|
+
const a = M(g);
|
|
2086
|
+
a.setStyle(S()), (u = i.getSource()) == null || u.addFeature(a);
|
|
2087
|
+
};
|
|
2088
|
+
function r(g, a) {
|
|
2089
|
+
var x;
|
|
2090
|
+
const u = ie([g.coordinates[0].lng, g.coordinates[0].lat]), h = new Nt(
|
|
2091
|
+
u,
|
|
2092
|
+
g.radius
|
|
2093
|
+
// 半径(米)
|
|
2094
|
+
), v = new ce({
|
|
2095
|
+
geometry: h,
|
|
2096
|
+
id: g.id
|
|
2097
|
+
});
|
|
2098
|
+
v.setStyle(c(a)), (x = n.getSource()) == null || x.addFeature(v), g.isEdit && t(g);
|
|
2099
|
+
}
|
|
2100
|
+
return {
|
|
2101
|
+
createPolygon: y,
|
|
2102
|
+
createCircle: r,
|
|
2103
|
+
deletePolygon: (g) => {
|
|
2104
|
+
var h, v, x, m;
|
|
2105
|
+
const a = (h = n.getSource()) == null ? void 0 : h.getFeatures().find((E) => E.getProperties().id === g), u = (v = i.getSource()) == null ? void 0 : v.getFeatures().find((E) => E.getProperties().id === "poly-delete-" + g);
|
|
2106
|
+
(x = n.getSource()) == null || x.removeFeature(a), (m = i.getSource()) == null || m.removeFeature(u);
|
|
2107
|
+
},
|
|
2108
|
+
updatePolygon: (g) => {
|
|
2109
|
+
var a;
|
|
2110
|
+
g.isEdit ? t(g) : (a = i.getSource()) == null || a.getFeatures().forEach((u) => {
|
|
2111
|
+
u.id === "poly-delete-" + g.id && !g.isEdit && i.getSource().removeFeature(u);
|
|
2112
|
+
});
|
|
2113
|
+
},
|
|
2114
|
+
clear: () => {
|
|
2115
|
+
var g, a;
|
|
2116
|
+
(g = n.getSource()) == null || g.clear(), (a = i.getSource()) == null || a.clear();
|
|
2117
|
+
}
|
|
2118
|
+
};
|
|
2119
|
+
};
|
|
2120
|
+
class _o {
|
|
2121
|
+
constructor(n, i) {
|
|
2122
|
+
Ge(this, "animationId", null);
|
|
2123
|
+
Ge(this, "interval", 500);
|
|
2124
|
+
// 闪烁间隔(ms)
|
|
2125
|
+
Ge(this, "routeLayer");
|
|
2126
|
+
Ge(this, "routeOverlay");
|
|
2127
|
+
this.routeLayer = n, this.routeOverlay = i;
|
|
2128
|
+
}
|
|
2129
|
+
start() {
|
|
2130
|
+
if (this.animationId) return;
|
|
2131
|
+
let n = 0;
|
|
2132
|
+
const i = (o) => {
|
|
2133
|
+
o - n >= this.interval && (this.toggleVisibility(), n = o), this.animationId = requestAnimationFrame(i);
|
|
2134
|
+
};
|
|
2135
|
+
this.animationId = requestAnimationFrame(i);
|
|
2136
|
+
}
|
|
2137
|
+
stop() {
|
|
2138
|
+
this.animationId && (cancelAnimationFrame(this.animationId), this.animationId = null), this.routeLayer.forEach((n) => {
|
|
2139
|
+
n.setVisible(!0);
|
|
2140
|
+
}), this.routeOverlay.forEach((n) => {
|
|
2141
|
+
n.getElement().style.visibility = "visible";
|
|
2142
|
+
});
|
|
2143
|
+
}
|
|
2144
|
+
toggleVisibility() {
|
|
2145
|
+
this.routeLayer.forEach((n) => {
|
|
2146
|
+
const i = n.getVisible();
|
|
2147
|
+
n.setVisible(!i);
|
|
2148
|
+
}), this.routeOverlay.forEach((n) => {
|
|
2149
|
+
var i;
|
|
2150
|
+
n.getElement().style.visibility = ((i = n.getElement()) == null ? void 0 : i.style.visibility) !== "hidden" ? "hidden" : "visible";
|
|
2151
|
+
});
|
|
2152
|
+
}
|
|
2153
|
+
}
|
|
2154
|
+
const Ko = (e) => {
|
|
2155
|
+
const n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), o = {};
|
|
2156
|
+
let c = null;
|
|
2157
|
+
const d = 10, l = [];
|
|
2158
|
+
let S = null, M = {
|
|
2159
|
+
arrowInterval: 100,
|
|
2160
|
+
pathColor: "#0091FF",
|
|
2161
|
+
pathWidth: 12,
|
|
2162
|
+
pathStrokeWidth: 1,
|
|
2163
|
+
pathStrokeColor: "transparent",
|
|
2164
|
+
arrowDensity: 1,
|
|
2165
|
+
arrowHeight: 10,
|
|
2166
|
+
arrowAngle: 60,
|
|
2167
|
+
arrowColor: "#fff",
|
|
2168
|
+
arrowImgSize: 10,
|
|
2169
|
+
arrowWidth: 4,
|
|
2170
|
+
vehicleImg: void 0,
|
|
2171
|
+
vehicleImgWidth: 80,
|
|
2172
|
+
vehicleImgHeight: 80,
|
|
2173
|
+
vehicleImgOpacity: 1
|
|
2174
|
+
}, y = {
|
|
2175
|
+
pointWidth: 40,
|
|
2176
|
+
pointHeight: 40,
|
|
2177
|
+
anchor: [0.5, 1],
|
|
2178
|
+
rotation: 0,
|
|
2179
|
+
zIndex: 99
|
|
2180
|
+
};
|
|
2181
|
+
const t = (p) => {
|
|
2182
|
+
var w, F;
|
|
2183
|
+
for (l.unshift(p); l.length > d; ) {
|
|
2184
|
+
const q = l.pop(), j = n.get(q), s = i.get(q);
|
|
2185
|
+
j && ((w = j.getSource()) == null || w.clear(), e == null || e.removeLayer(j), n.delete(q), delete o[q]), s && ((F = s.getSource()) == null || F.clear(), e == null || e.removeLayer(s), s.delete(q));
|
|
2186
|
+
}
|
|
2187
|
+
}, r = async (p, w, F, q) => {
|
|
2188
|
+
e && (JSON.stringify(o[p]) === JSON.stringify(w) && c === p || (w = w == null ? void 0 : w.reverse(), !((w == null ? void 0 : w.length) < 2) && (t(p), c = p, o[p] = w, F && (M = Object.assign(M, F)), q && (y = Object.assign(y, q)), await D())));
|
|
2189
|
+
}, $ = vt(async () => {
|
|
2190
|
+
Object.keys(o).map((p) => {
|
|
2191
|
+
h(p);
|
|
2192
|
+
});
|
|
2193
|
+
}, 100), D = async () => {
|
|
2194
|
+
const p = c;
|
|
2195
|
+
if (!n.has(p)) {
|
|
2196
|
+
const w = R(`line-layer-${p}`);
|
|
2197
|
+
n.set(p, w), e.getLayers().getArray().includes(w) || e == null || e.addLayer(w);
|
|
2198
|
+
}
|
|
2199
|
+
if (!i.has(p)) {
|
|
2200
|
+
const w = R(`point-layer-${p}`);
|
|
2201
|
+
i.set(p, w), e.getLayers().getArray().includes(w) || e == null || e.addLayer(w);
|
|
2202
|
+
}
|
|
2203
|
+
g();
|
|
2204
|
+
}, R = (p) => {
|
|
2205
|
+
const w = new ve();
|
|
2206
|
+
return new we({
|
|
2207
|
+
source: w,
|
|
2208
|
+
className: p,
|
|
2209
|
+
renderBuffer: 1024,
|
|
2210
|
+
zIndex: 10,
|
|
2211
|
+
properties: { layerType: se.PATH }
|
|
2212
|
+
});
|
|
2213
|
+
};
|
|
2214
|
+
function g() {
|
|
2215
|
+
const p = c, w = n.get(p).getSource();
|
|
2216
|
+
w.clear();
|
|
2217
|
+
const q = o[c].map((C) => ie(C.coordinate)), j = new $e(q), s = new ce({
|
|
2218
|
+
type: "route",
|
|
2219
|
+
geometry: j,
|
|
2220
|
+
pathData: c
|
|
2221
|
+
});
|
|
2222
|
+
s.setStyle(a()), w.addFeature(s), h(c), m("https://static.zhihaoscm.cn/map/car-icon.gif"), K(c);
|
|
2223
|
+
}
|
|
2224
|
+
function a() {
|
|
2225
|
+
return new re({
|
|
2226
|
+
fill: new ue({
|
|
2227
|
+
color: M.pathStrokeColor,
|
|
2228
|
+
width: M.pathStrokeWidth
|
|
2229
|
+
}),
|
|
2230
|
+
stroke: new Le({
|
|
2231
|
+
color: M.pathColor,
|
|
2232
|
+
width: M.pathWidth
|
|
2233
|
+
})
|
|
2234
|
+
});
|
|
2235
|
+
}
|
|
2236
|
+
function u(p) {
|
|
2237
|
+
const w = x();
|
|
2238
|
+
return new re({
|
|
2239
|
+
image: new Ce({
|
|
2240
|
+
img: x(),
|
|
2241
|
+
imgSize: [w.width, w.height],
|
|
2242
|
+
rotation: p,
|
|
2243
|
+
displacement: [0, 0],
|
|
2244
|
+
rotateWithView: !1
|
|
2245
|
+
})
|
|
2246
|
+
});
|
|
2247
|
+
}
|
|
2248
|
+
function h(p) {
|
|
2249
|
+
const w = p, F = n.get(w).getSource(), j = o[w].map((P) => ie(P.coordinate));
|
|
2250
|
+
F.getFeatures().forEach((P) => {
|
|
2251
|
+
P.getProperties().type === "arrow" && F.removeFeature(P);
|
|
2252
|
+
});
|
|
2253
|
+
const s = new $e(j);
|
|
2254
|
+
v(
|
|
2255
|
+
s,
|
|
2256
|
+
M.arrowInterval
|
|
2257
|
+
).forEach((P) => {
|
|
2258
|
+
const z = new ce({
|
|
2259
|
+
geometry: new de(P.coordinate),
|
|
2260
|
+
type: "arrow",
|
|
2261
|
+
rotation: P.rotation
|
|
2262
|
+
});
|
|
2263
|
+
z.setStyle(u(P.rotation)), F.addFeature(z);
|
|
2264
|
+
});
|
|
2265
|
+
}
|
|
2266
|
+
function v(p, w) {
|
|
2267
|
+
const F = p.getCoordinates(), q = [];
|
|
2268
|
+
if (F.length < 2) return q;
|
|
2269
|
+
const j = F.map((P) => e.getPixelFromCoordinate(P));
|
|
2270
|
+
let s = 0, C = j[0];
|
|
2271
|
+
for (let P = 1; P < j.length; P++) {
|
|
2272
|
+
const z = j[P], A = [
|
|
2273
|
+
z[0] - C[0],
|
|
2274
|
+
z[1] - C[1]
|
|
2275
|
+
], B = Math.sqrt(A[0] ** 2 + A[1] ** 2), te = Math.atan2(A[1], A[0]), J = [
|
|
2276
|
+
A[0] / B,
|
|
2277
|
+
A[1] / B
|
|
2278
|
+
];
|
|
2279
|
+
for (; s + w <= B; ) {
|
|
2280
|
+
s += w;
|
|
2281
|
+
const H = [
|
|
2282
|
+
C[0] + J[0] * s,
|
|
2283
|
+
C[1] + J[1] * s
|
|
2284
|
+
], he = e.getCoordinateFromPixel(H);
|
|
2285
|
+
q.push({
|
|
2286
|
+
coordinate: he,
|
|
2287
|
+
rotation: te
|
|
2288
|
+
});
|
|
2289
|
+
}
|
|
2290
|
+
s -= B, C = z;
|
|
2291
|
+
}
|
|
2292
|
+
return q;
|
|
2293
|
+
}
|
|
2294
|
+
function x() {
|
|
2295
|
+
const p = {
|
|
2296
|
+
color: M.arrowColor,
|
|
2297
|
+
lineWidth: M.arrowWidth,
|
|
2298
|
+
arrowHeight: M.arrowHeight,
|
|
2299
|
+
angle: M.arrowAngle
|
|
2300
|
+
};
|
|
2301
|
+
if (p.angle >= 180 || p.angle <= 0)
|
|
2302
|
+
throw new Error("箭头夹角取值范围为0-180");
|
|
2303
|
+
const w = p.arrowHeight / 2, F = 1 / Math.tan(p.angle * Math.PI / 360), q = Math.ceil(F * w), j = q + p.lineWidth, s = document.createElement("canvas");
|
|
2304
|
+
s.width = j, s.height = p.arrowHeight;
|
|
2305
|
+
const C = s.getContext("2d");
|
|
2306
|
+
return C.fillStyle = p.color, C.strokeStyle = p.color, C.beginPath(), C.lineTo(0, 0), C.lineTo(p.lineWidth, 0), C.lineTo(j, w), C.lineTo(p.lineWidth, p.arrowHeight), C.lineTo(0, p.arrowHeight), C.lineTo(q, w), C.closePath(), C.fill(), s;
|
|
2307
|
+
}
|
|
2308
|
+
function m(p, w = 1 / 3, F = [60, 60]) {
|
|
2309
|
+
const s = o[c].map((J) => ie(J.coordinate)), C = new $e(s), P = E(C, w), z = I(C, P), A = document.createElement("div");
|
|
2310
|
+
A.className = "dynamic-icon-container", A.style.width = `${F[0]}px`, A.style.height = `${F[1]}px`;
|
|
2311
|
+
const B = document.createElement("img");
|
|
2312
|
+
B.src = p, B.style.width = "100%", B.style.height = "100%", B.style.transform = `rotate(${z}deg)`, B.style.transformOrigin = "center center", A.appendChild(B);
|
|
2313
|
+
const te = new pe({
|
|
2314
|
+
position: P,
|
|
2315
|
+
positioning: "center-center",
|
|
2316
|
+
element: A,
|
|
2317
|
+
stopEvent: !1
|
|
2318
|
+
// 允许事件穿透
|
|
2319
|
+
});
|
|
2320
|
+
te.set("type", "blinkimage"), e == null || e.addOverlay(te);
|
|
2321
|
+
}
|
|
2322
|
+
function E(p, w) {
|
|
2323
|
+
const F = p.getCoordinates(), j = p.getLength() * w;
|
|
2324
|
+
let s = 0;
|
|
2325
|
+
for (let C = 0; C < F.length - 1; C++) {
|
|
2326
|
+
const P = F[C], z = F[C + 1], A = Math.sqrt(
|
|
2327
|
+
Math.pow(z[0] - P[0], 2) + Math.pow(z[1] - P[1], 2)
|
|
2328
|
+
);
|
|
2329
|
+
if (s + A >= j) {
|
|
2330
|
+
const B = (j - s) / A;
|
|
2331
|
+
return [
|
|
2332
|
+
P[0] + (z[0] - P[0]) * B,
|
|
2333
|
+
P[1] + (z[1] - P[1]) * B
|
|
2334
|
+
];
|
|
2335
|
+
}
|
|
2336
|
+
s += A;
|
|
2337
|
+
}
|
|
2338
|
+
return F[F.length - 1];
|
|
2339
|
+
}
|
|
2340
|
+
function I(p, w) {
|
|
2341
|
+
const F = p.getCoordinates(), q = 1e-4;
|
|
2342
|
+
for (let C = 0; C < F.length - 1; C++) {
|
|
2343
|
+
const P = F[C], z = F[C + 1];
|
|
2344
|
+
if (oe(w, P, z, q))
|
|
2345
|
+
return Math.atan2(
|
|
2346
|
+
z[1] - P[1],
|
|
2347
|
+
z[0] - P[0]
|
|
2348
|
+
);
|
|
2349
|
+
}
|
|
2350
|
+
const j = F[F.length - 2], s = F[F.length - 1];
|
|
2351
|
+
return Math.atan2(
|
|
2352
|
+
s[1] - j[1],
|
|
2353
|
+
s[0] - j[0]
|
|
2354
|
+
);
|
|
2355
|
+
}
|
|
2356
|
+
function oe(p, w, F, q) {
|
|
2357
|
+
const j = (p[1] - w[1]) * (F[0] - w[0]) - (p[0] - w[0]) * (F[1] - w[1]);
|
|
2358
|
+
if (Math.abs(j) > q) return !1;
|
|
2359
|
+
const s = (p[0] - w[0]) * (F[0] - w[0]) + (p[1] - w[1]) * (F[1] - w[1]);
|
|
2360
|
+
if (s < 0) return !1;
|
|
2361
|
+
const C = Math.pow(F[0] - w[0], 2) + Math.pow(F[1] - w[1], 2);
|
|
2362
|
+
return s <= C;
|
|
2363
|
+
}
|
|
2364
|
+
function K(p) {
|
|
2365
|
+
const w = p, F = o[w], q = i.get(w).getSource(), j = [];
|
|
2366
|
+
F.forEach((s) => {
|
|
2367
|
+
if (s.img && s.coordinate) {
|
|
2368
|
+
const C = new de(ie(s.coordinate)), P = new ce(C), z = `data:image/svg+xml;utf8,${encodeURIComponent(s.img)}`;
|
|
2369
|
+
P.setStyle(new re({
|
|
2370
|
+
image: new Ce({
|
|
2371
|
+
src: z,
|
|
2372
|
+
width: y.pointWidth || 40,
|
|
2373
|
+
height: y.pointHeight || 40,
|
|
2374
|
+
anchor: y.anchor || [0.5, 1],
|
|
2375
|
+
rotation: y.rotation || 0
|
|
2376
|
+
}),
|
|
2377
|
+
zIndex: y.zIndex || 10
|
|
2378
|
+
})), j.push(P);
|
|
2379
|
+
}
|
|
2380
|
+
}), q.addFeatures(j);
|
|
2381
|
+
}
|
|
2382
|
+
const Z = (p) => {
|
|
2383
|
+
console.log("handleClick", p), W(p);
|
|
2384
|
+
};
|
|
2385
|
+
function W(p) {
|
|
2386
|
+
var F;
|
|
2387
|
+
G();
|
|
2388
|
+
const w = (F = e.getOverlays().getArray()) == null ? void 0 : F.filter((q) => q.get("type") === "blinkimage");
|
|
2389
|
+
S = new _o([n.get(p), i.get(p)], w), S.start();
|
|
2390
|
+
}
|
|
2391
|
+
function G() {
|
|
2392
|
+
S && (S.stop(), S = null);
|
|
2393
|
+
}
|
|
2394
|
+
return {
|
|
2395
|
+
reRenderLine: $,
|
|
2396
|
+
handleClick: Z,
|
|
2397
|
+
render: r,
|
|
2398
|
+
blinking: W,
|
|
2399
|
+
clear: () => {
|
|
2400
|
+
n.forEach((w) => {
|
|
2401
|
+
var F;
|
|
2402
|
+
(F = w.getSource()) == null || F.clear(), e == null || e.removeLayer(w);
|
|
2403
|
+
}), i.forEach((w) => {
|
|
2404
|
+
var F;
|
|
2405
|
+
(F = w.getSource()) == null || F.clear(), e == null || e.removeLayer(w);
|
|
2406
|
+
}), Object.keys(o).forEach((w) => {
|
|
2407
|
+
n.delete(w), i.delete(w), delete o[w];
|
|
2408
|
+
});
|
|
2409
|
+
},
|
|
2410
|
+
close: (p) => {
|
|
2411
|
+
const w = n.get(p || c);
|
|
2412
|
+
w == null || w.setVisible(!1);
|
|
2413
|
+
}
|
|
2414
|
+
};
|
|
2415
|
+
}, jo = (e, n, i, o, c, d, l, S, M) => {
|
|
2416
|
+
const y = e.getInstall();
|
|
2417
|
+
y.on("moveend", () => {
|
|
2418
|
+
var D, R;
|
|
2419
|
+
try {
|
|
2420
|
+
const g = e.getZoom();
|
|
2421
|
+
(R = (D = n.getProps()).mapMoveEnd) == null || R.call(D, g), g >= fe.min && g <= fe.max && i.reRenderTrackLine(), M.reRenderLine(), o.changeShipScale("end");
|
|
2422
|
+
} catch (g) {
|
|
2423
|
+
console.log("moveend---catch", g);
|
|
2424
|
+
}
|
|
2425
|
+
});
|
|
2426
|
+
const t = {
|
|
2427
|
+
[se.PORT]: null,
|
|
2428
|
+
[se.SHIP]: null,
|
|
2429
|
+
[se.TRACK]: null,
|
|
2430
|
+
[se.DELETE]: null
|
|
2431
|
+
}, r = (D, R, g) => {
|
|
2432
|
+
switch (D) {
|
|
2433
|
+
case se.SHIP:
|
|
2434
|
+
o == null || o.handleShipMapEvent(R, "hover");
|
|
2435
|
+
break;
|
|
2436
|
+
case se.PORT:
|
|
2437
|
+
break;
|
|
2438
|
+
case se.TRACK:
|
|
2439
|
+
i == null || i.handleTrackMapEvent(R, "hover", g);
|
|
2440
|
+
break;
|
|
2441
|
+
}
|
|
2442
|
+
}, $ = (D) => {
|
|
2443
|
+
switch (D) {
|
|
2444
|
+
case se.PORT:
|
|
2445
|
+
break;
|
|
2446
|
+
case se.SHIP:
|
|
2447
|
+
o == null || o.handleShipMapEvent(null, "hover");
|
|
2448
|
+
break;
|
|
2449
|
+
case se.TRACK:
|
|
2450
|
+
i == null || i.handleTrackMapEvent(null, "hover");
|
|
2451
|
+
break;
|
|
2452
|
+
}
|
|
2453
|
+
};
|
|
2454
|
+
y.on("pointermove", (D) => {
|
|
2455
|
+
if (l.getState() !== "open" && d.getState() !== "open" && e.getMapClick() && !y.getView().getAnimating())
|
|
2456
|
+
try {
|
|
2457
|
+
let R = !1, g = !1;
|
|
2458
|
+
const a = y.getLayers().getArray().filter((u) => u.get("layerType"));
|
|
2459
|
+
try {
|
|
2460
|
+
a && a.length > 0 && a.forEach((u) => {
|
|
2461
|
+
if (g) return;
|
|
2462
|
+
const h = y == null ? void 0 : y.getEventPixel(D.originalEvent), v = u == null ? void 0 : u.get("layerType"), x = y == null ? void 0 : y.forEachFeatureAtPixel(h, (m) => m, {
|
|
2463
|
+
layerFilter: (m) => m === u,
|
|
2464
|
+
// 严格图层过滤
|
|
2465
|
+
hitTolerance: 5
|
|
2466
|
+
});
|
|
2467
|
+
x !== t[v] && (t[v] && $(v, t[v]), t[v] = x, x && (r(v, x, D), g = !0)), x && (R = !0);
|
|
2468
|
+
}), R ? Pe(y, "pointer") : Pe(y, "grab");
|
|
2469
|
+
} catch (u) {
|
|
2470
|
+
console.log("pointermove----", u);
|
|
2471
|
+
}
|
|
2472
|
+
} catch (R) {
|
|
2473
|
+
console.log("pointermove----", R);
|
|
2474
|
+
}
|
|
2475
|
+
}), y.on("click", vt((D) => {
|
|
2476
|
+
if (l.getState() !== "open" && d.getState() !== "open" && e.getMapClick() && !y.getView().getAnimating())
|
|
2477
|
+
try {
|
|
2478
|
+
let R = !1;
|
|
2479
|
+
const g = y.getLayers().getArray().filter((a) => a.get("layerType"));
|
|
2480
|
+
g && g.length > 0 && g.forEach((a) => {
|
|
2481
|
+
var u, h, v;
|
|
2482
|
+
if (!R)
|
|
2483
|
+
try {
|
|
2484
|
+
const x = y == null ? void 0 : y.getEventPixel(D.originalEvent), m = y == null ? void 0 : y.forEachFeatureAtPixel(x, (E) => {
|
|
2485
|
+
if (E.get("shipData") || E.get("portData") || E.get("polygonData") || E.get("pathData"))
|
|
2486
|
+
return E;
|
|
2487
|
+
}, {
|
|
2488
|
+
layerFilter: (E) => E === a,
|
|
2489
|
+
// 严格图层过滤
|
|
2490
|
+
hitTolerance: 10
|
|
2491
|
+
});
|
|
2492
|
+
if (console.log("clickFeature", m), m) {
|
|
2493
|
+
if (m != null && m.get("shipData"))
|
|
2494
|
+
i.getTrackStatus() || o.handleShipMapEvent(m, "click", (u = n.getProps()) == null ? void 0 : u.selectShip);
|
|
2495
|
+
else if (m != null && m.get("portData")) {
|
|
2496
|
+
const E = m == null ? void 0 : m.get("portData");
|
|
2497
|
+
c.selected(E), (v = (h = n.getProps()) == null ? void 0 : h.selectPort) == null || v.call(h, E);
|
|
2498
|
+
} else if (m != null && m.get("polygonData")) {
|
|
2499
|
+
const E = m.get("polygonData");
|
|
2500
|
+
S.deletePolygon(E == null ? void 0 : E.id);
|
|
2501
|
+
} else if (m != null && m.get("pathData")) {
|
|
2502
|
+
const E = m.get("pathData");
|
|
2503
|
+
M.handleClick(E);
|
|
2504
|
+
}
|
|
2505
|
+
R = !0;
|
|
2506
|
+
}
|
|
2507
|
+
} catch (x) {
|
|
2508
|
+
console.log("click--", x);
|
|
2509
|
+
}
|
|
2510
|
+
});
|
|
2511
|
+
} catch (R) {
|
|
2512
|
+
console.log("click----", R);
|
|
2513
|
+
}
|
|
2514
|
+
}, 150)), y.getView().on("change:resolution", () => {
|
|
2515
|
+
o.changeShipScale();
|
|
2516
|
+
});
|
|
2517
|
+
}, Jo = () => {
|
|
2518
|
+
const e = Jt([]);
|
|
2519
|
+
return {
|
|
2520
|
+
createInstance: (o, c) => {
|
|
2521
|
+
const d = xo();
|
|
2522
|
+
d.initMap(o, c);
|
|
2523
|
+
const l = d.getInstall(), S = Wo(l), M = Po();
|
|
2524
|
+
M.setProps(c), S.setShowLayerType(c.layerType), S.setGreenTileVisible(c.showGreenLayer);
|
|
2525
|
+
const y = Mo(l), t = po(l, y), r = Ao(l, M), $ = Ho(l), D = Go(l, M), R = Yo(l, M), g = qo(l), a = Xo(l), u = Ko(l);
|
|
2526
|
+
jo(d, M, y, r, g, D, R, a, u);
|
|
2527
|
+
const h = () => {
|
|
2528
|
+
const x = l.getView().calculateExtent(d.getSize()), m = Xe([x[0], x[1]], ge.mercator, ge.data), E = Xe([x[2], x[3]], ge.mercator, ge.data);
|
|
2529
|
+
return [m[0], m[1], E[0], E[1]];
|
|
2530
|
+
}, v = {
|
|
2531
|
+
id: Symbol("map-instance"),
|
|
2532
|
+
innerMap: null,
|
|
2533
|
+
map: d.getInstall(),
|
|
2534
|
+
destroy: () => {
|
|
2535
|
+
e.splice(e.indexOf(v), 1);
|
|
2536
|
+
},
|
|
2537
|
+
methods: {
|
|
2538
|
+
...d,
|
|
2539
|
+
layer: S,
|
|
2540
|
+
ship: r,
|
|
2541
|
+
track: y,
|
|
2542
|
+
carTrack: t,
|
|
2543
|
+
port: {
|
|
2544
|
+
render: g.render,
|
|
2545
|
+
clear: g.clear,
|
|
2546
|
+
selected: g.selected
|
|
2547
|
+
},
|
|
2548
|
+
position: $,
|
|
2549
|
+
drawLine: D,
|
|
2550
|
+
drawPolygon: R,
|
|
2551
|
+
renderPolygon: a,
|
|
2552
|
+
pathLine: u,
|
|
2553
|
+
// 子模块
|
|
2554
|
+
utils: {
|
|
2555
|
+
getCalculateExtent: h,
|
|
2556
|
+
convertSixHundredThousandToLatLng: wt,
|
|
2557
|
+
calculateCirclePoints: bo
|
|
2558
|
+
}
|
|
2559
|
+
}
|
|
2560
|
+
};
|
|
2561
|
+
return e.push(v), v;
|
|
2562
|
+
},
|
|
2563
|
+
destroyInstance: (o) => {
|
|
2564
|
+
const c = e.findIndex((d) => d.id === o);
|
|
2565
|
+
c > -1 && (e[c].destroy(), e.splice(c, 1));
|
|
2566
|
+
},
|
|
2567
|
+
destroyAll: () => {
|
|
2568
|
+
e.forEach((o) => o.destroy()), e.splice(0, e.length);
|
|
2569
|
+
},
|
|
2570
|
+
getAllInstances: () => [...e]
|
|
2571
|
+
};
|
|
2572
|
+
}, Qo = { class: "zh-map-box" }, Uo = /* @__PURE__ */ ut({
|
|
2573
|
+
__name: "Map",
|
|
2574
|
+
props: {
|
|
2575
|
+
zoom: { default: fe.default },
|
|
2576
|
+
center: { default: wo },
|
|
2577
|
+
layerType: { default: "vector" },
|
|
2578
|
+
showGreenLayer: { type: Boolean, default: !1 },
|
|
2579
|
+
showScale: { type: Boolean, default: !0 },
|
|
2580
|
+
scaleLineUnit: { default: "metric" },
|
|
2581
|
+
mapMoveEnd: { type: Function, default: () => {
|
|
2582
|
+
} },
|
|
2583
|
+
lineDrawEnd: {},
|
|
2584
|
+
areaDrawEnd: { type: Function, default: () => {
|
|
2585
|
+
} },
|
|
2586
|
+
selectShip: { type: Function, default: () => {
|
|
2587
|
+
} },
|
|
2588
|
+
selectPort: { type: Function, default: () => {
|
|
2589
|
+
} }
|
|
2590
|
+
},
|
|
2591
|
+
setup(e, { expose: n }) {
|
|
2592
|
+
function i() {
|
|
2593
|
+
return new Promise((t) => {
|
|
2594
|
+
document.fonts ? document.fonts.load("12px map-iconfont").then(t) : setTimeout(t, 300);
|
|
2595
|
+
});
|
|
2596
|
+
}
|
|
2597
|
+
i();
|
|
2598
|
+
const o = ye(), c = ye(), d = Jo(), l = ye(), S = e, M = ye({
|
|
2599
|
+
getInstall() {
|
|
2600
|
+
}
|
|
2601
|
+
});
|
|
2602
|
+
Qt(() => {
|
|
2603
|
+
var t;
|
|
2604
|
+
l.value = d.createInstance(o.value, S), M.value = l.value.methods, (t = c.value) == null || t.setScaleLine(l.value.map, S.scaleLineUnit), window.addEventListener("nativeDoubleTap", function() {
|
|
2605
|
+
y();
|
|
2606
|
+
});
|
|
2607
|
+
});
|
|
2608
|
+
function y() {
|
|
2609
|
+
var r, $;
|
|
2610
|
+
let t = (r = l.value) == null ? void 0 : r.methods.getZoom();
|
|
2611
|
+
($ = l.value) == null || $.methods.setZoom(t + 1);
|
|
2612
|
+
}
|
|
2613
|
+
return Ut(() => {
|
|
2614
|
+
var t, r;
|
|
2615
|
+
d.destroyInstance((t = l == null ? void 0 : l.value) == null ? void 0 : t.id), (r = l.value) == null || r.destroy();
|
|
2616
|
+
}), n({
|
|
2617
|
+
getZoom: () => {
|
|
2618
|
+
var t;
|
|
2619
|
+
return (t = l.value) == null ? void 0 : t.methods.getZoom();
|
|
2620
|
+
},
|
|
2621
|
+
setZoom: (t) => {
|
|
2622
|
+
var r;
|
|
2623
|
+
return (r = l.value) == null ? void 0 : r.methods.setZoom(t);
|
|
2624
|
+
},
|
|
2625
|
+
getInstall: () => {
|
|
2626
|
+
var t;
|
|
2627
|
+
return (t = l.value) == null ? void 0 : t.methods.getInstall();
|
|
2628
|
+
},
|
|
2629
|
+
setMapClick: (...t) => {
|
|
2630
|
+
var r;
|
|
2631
|
+
return (r = l.value) == null ? void 0 : r.methods.setMapClick(...t);
|
|
2632
|
+
},
|
|
2633
|
+
getMapClick: () => {
|
|
2634
|
+
var t;
|
|
2635
|
+
return (t = l.value) == null ? void 0 : t.methods.getMapClick();
|
|
2636
|
+
},
|
|
2637
|
+
getView: () => {
|
|
2638
|
+
var t;
|
|
2639
|
+
return (t = l.value) == null ? void 0 : t.methods.getView();
|
|
2640
|
+
},
|
|
2641
|
+
setCenter: (t, r) => {
|
|
2642
|
+
var $;
|
|
2643
|
+
return ($ = l.value) == null ? void 0 : $.methods.setCenter(t, r);
|
|
2644
|
+
},
|
|
2645
|
+
getSize: () => {
|
|
2646
|
+
var t;
|
|
2647
|
+
return (t = l.value) == null ? void 0 : t.methods.getSize();
|
|
2648
|
+
},
|
|
2649
|
+
getCenter: () => {
|
|
2650
|
+
var t;
|
|
2651
|
+
return (t = l.value) == null ? void 0 : t.methods.getCenter();
|
|
2652
|
+
},
|
|
2653
|
+
layer: {
|
|
2654
|
+
setGreenTileVisible: (t) => {
|
|
2655
|
+
var r;
|
|
2656
|
+
return (r = l.value) == null ? void 0 : r.methods.layer.setGreenTileVisible(t);
|
|
2657
|
+
},
|
|
2658
|
+
getGreenTileVisible: () => {
|
|
2659
|
+
var t;
|
|
2660
|
+
return (t = l.value) == null ? void 0 : t.methods.layer.getGreenTileVisible();
|
|
2661
|
+
},
|
|
2662
|
+
getShowLayerType: () => {
|
|
2663
|
+
var t;
|
|
2664
|
+
return (t = l.value) == null ? void 0 : t.methods.layer.getShowLayerType();
|
|
2665
|
+
},
|
|
2666
|
+
setShowLayerType: (t) => {
|
|
2667
|
+
var r;
|
|
2668
|
+
return (r = l.value) == null ? void 0 : r.methods.layer.setShowLayerType(t);
|
|
2669
|
+
}
|
|
2670
|
+
},
|
|
2671
|
+
ship: {
|
|
2672
|
+
render: (...t) => {
|
|
2673
|
+
var r;
|
|
2674
|
+
return (r = l.value) == null ? void 0 : r.methods.ship.render(...t);
|
|
2675
|
+
},
|
|
2676
|
+
selected: (...t) => {
|
|
2677
|
+
var r;
|
|
2678
|
+
return (r = l.value) == null ? void 0 : r.methods.ship.selected(...t);
|
|
2679
|
+
},
|
|
2680
|
+
filter: (...t) => {
|
|
2681
|
+
var r;
|
|
2682
|
+
return (r = l.value) == null ? void 0 : r.methods.ship.filter(...t);
|
|
2683
|
+
},
|
|
2684
|
+
blinking: (...t) => {
|
|
2685
|
+
var r;
|
|
2686
|
+
return (r = l.value) == null ? void 0 : r.methods.ship.blinking(...t);
|
|
2687
|
+
},
|
|
2688
|
+
clear: () => {
|
|
2689
|
+
var t;
|
|
2690
|
+
return (t = l.value) == null ? void 0 : t.methods.ship.clear();
|
|
2691
|
+
},
|
|
2692
|
+
setLableStatus: (...t) => {
|
|
2693
|
+
var r;
|
|
2694
|
+
return (r = l.value) == null ? void 0 : r.methods.ship.setLableStatus(...t);
|
|
2695
|
+
}
|
|
2696
|
+
},
|
|
2697
|
+
track: {
|
|
2698
|
+
render: (...t) => {
|
|
2699
|
+
var r;
|
|
2700
|
+
return (r = l.value) == null ? void 0 : r.methods.track.render(...t);
|
|
2701
|
+
},
|
|
2702
|
+
remove: (...t) => {
|
|
2703
|
+
var r;
|
|
2704
|
+
return (r = l.value) == null ? void 0 : r.methods.track.remove(...t);
|
|
2705
|
+
},
|
|
2706
|
+
play: (...t) => {
|
|
2707
|
+
var r;
|
|
2708
|
+
return (r = l.value) == null ? void 0 : r.methods.track.play(...t);
|
|
2709
|
+
},
|
|
2710
|
+
setCenter: (...t) => {
|
|
2711
|
+
var r;
|
|
2712
|
+
return (r = l.value) == null ? void 0 : r.methods.track.setCenter(...t);
|
|
2713
|
+
},
|
|
2714
|
+
close: (...t) => {
|
|
2715
|
+
var r;
|
|
2716
|
+
return (r = l.value) == null ? void 0 : r.methods.track.close(...t);
|
|
2717
|
+
},
|
|
2718
|
+
getLength: (...t) => {
|
|
2719
|
+
var r;
|
|
2720
|
+
return (r = l.value) == null ? void 0 : r.methods.track.getLength(...t);
|
|
2721
|
+
}
|
|
2722
|
+
},
|
|
2723
|
+
carTrack: {
|
|
2724
|
+
location: (...t) => {
|
|
2725
|
+
var r;
|
|
2726
|
+
return (r = l.value) == null ? void 0 : r.methods.carTrack.location(...t);
|
|
2727
|
+
},
|
|
2728
|
+
remove: (...t) => {
|
|
2729
|
+
var r;
|
|
2730
|
+
return (r = l.value) == null ? void 0 : r.methods.carTrack.remove(...t);
|
|
2731
|
+
},
|
|
2732
|
+
renderTrack: (...t) => {
|
|
2733
|
+
var r;
|
|
2734
|
+
return (r = l.value) == null ? void 0 : r.methods.carTrack.renderTrack(...t);
|
|
2735
|
+
},
|
|
2736
|
+
setCenter: (...t) => {
|
|
2737
|
+
var r;
|
|
2738
|
+
return (r = l.value) == null ? void 0 : r.methods.carTrack.setCenter(...t);
|
|
2739
|
+
},
|
|
2740
|
+
closeTrack: () => {
|
|
2741
|
+
var t;
|
|
2742
|
+
return (t = l.value) == null ? void 0 : t.methods.carTrack.closeTrack();
|
|
2743
|
+
},
|
|
2744
|
+
playTrack: (...t) => {
|
|
2745
|
+
var r;
|
|
2746
|
+
return (r = l.value) == null ? void 0 : r.methods.carTrack.playTrack(...t);
|
|
2747
|
+
}
|
|
2748
|
+
},
|
|
2749
|
+
port: {
|
|
2750
|
+
render: (t, r) => {
|
|
2751
|
+
var $;
|
|
2752
|
+
return ($ = l.value) == null ? void 0 : $.methods.port.render(t, r);
|
|
2753
|
+
},
|
|
2754
|
+
clear: () => {
|
|
2755
|
+
var t;
|
|
2756
|
+
return (t = l.value) == null ? void 0 : t.methods.port.clear();
|
|
2757
|
+
},
|
|
2758
|
+
selected: (t) => {
|
|
2759
|
+
var r;
|
|
2760
|
+
return (r = l.value) == null ? void 0 : r.methods.port.selected(t);
|
|
2761
|
+
}
|
|
2762
|
+
},
|
|
2763
|
+
position: {
|
|
2764
|
+
render: (...t) => {
|
|
2765
|
+
var r;
|
|
2766
|
+
return (r = l.value) == null ? void 0 : r.methods.position.render(...t);
|
|
2767
|
+
},
|
|
2768
|
+
selected: (...t) => {
|
|
2769
|
+
var r;
|
|
2770
|
+
return (r = l.value) == null ? void 0 : r.methods.position.selected(...t);
|
|
2771
|
+
},
|
|
2772
|
+
clearSelected: (...t) => {
|
|
2773
|
+
var r;
|
|
2774
|
+
return (r = l.value) == null ? void 0 : r.methods.position.clearSelected(...t);
|
|
2775
|
+
},
|
|
2776
|
+
clear: () => {
|
|
2777
|
+
var t;
|
|
2778
|
+
return (t = l.value) == null ? void 0 : t.methods.position.clear();
|
|
2779
|
+
},
|
|
2780
|
+
renderHtml: (...t) => {
|
|
2781
|
+
var r;
|
|
2782
|
+
return (r = l.value) == null ? void 0 : r.methods.position.renderHtml(...t);
|
|
2783
|
+
},
|
|
2784
|
+
removeHtml: (...t) => {
|
|
2785
|
+
var r;
|
|
2786
|
+
return (r = l.value) == null ? void 0 : r.methods.position.removeHtml(...t);
|
|
2787
|
+
}
|
|
2788
|
+
},
|
|
2789
|
+
drawLine: {
|
|
2790
|
+
open: () => {
|
|
2791
|
+
var t;
|
|
2792
|
+
return (t = l.value) == null ? void 0 : t.methods.drawLine.open();
|
|
2793
|
+
},
|
|
2794
|
+
close: () => {
|
|
2795
|
+
var t;
|
|
2796
|
+
return (t = l.value) == null ? void 0 : t.methods.drawLine.close();
|
|
2797
|
+
},
|
|
2798
|
+
deleteLine: (t) => {
|
|
2799
|
+
var r;
|
|
2800
|
+
return (r = l.value) == null ? void 0 : r.methods.drawLine.deleteLine(t);
|
|
2801
|
+
},
|
|
2802
|
+
setUnit: (t) => {
|
|
2803
|
+
var r;
|
|
2804
|
+
return (r = l.value) == null ? void 0 : r.methods.drawLine.setUnit(t);
|
|
2805
|
+
},
|
|
2806
|
+
getState: () => {
|
|
2807
|
+
var t;
|
|
2808
|
+
return (t = l.value) == null ? void 0 : t.methods.drawLine.getState();
|
|
2809
|
+
}
|
|
2810
|
+
},
|
|
2811
|
+
drawPolygon: {
|
|
2812
|
+
open: (...t) => {
|
|
2813
|
+
var r;
|
|
2814
|
+
return (r = l.value) == null ? void 0 : r.methods.drawPolygon.open(...t);
|
|
2815
|
+
},
|
|
2816
|
+
close: () => {
|
|
2817
|
+
var t;
|
|
2818
|
+
return (t = l.value) == null ? void 0 : t.methods.drawPolygon.close();
|
|
2819
|
+
},
|
|
2820
|
+
reset: () => {
|
|
2821
|
+
var t;
|
|
2822
|
+
return (t = l.value) == null ? void 0 : t.methods.drawPolygon.reset();
|
|
2823
|
+
}
|
|
2824
|
+
},
|
|
2825
|
+
pathLine: {
|
|
2826
|
+
render: (...t) => {
|
|
2827
|
+
var r;
|
|
2828
|
+
return (r = l.value) == null ? void 0 : r.methods.pathLine.render(...t);
|
|
2829
|
+
},
|
|
2830
|
+
blinking: (...t) => {
|
|
2831
|
+
var r;
|
|
2832
|
+
return (r = l.value) == null ? void 0 : r.methods.pathLine.blinking(...t);
|
|
2833
|
+
}
|
|
2834
|
+
},
|
|
2835
|
+
renderPolygon: {
|
|
2836
|
+
createPolygon: (...t) => {
|
|
2837
|
+
var r;
|
|
2838
|
+
return (r = l.value) == null ? void 0 : r.methods.renderPolygon.createPolygon(...t);
|
|
2839
|
+
},
|
|
2840
|
+
createCircle: (...t) => {
|
|
2841
|
+
var r;
|
|
2842
|
+
return (r = l.value) == null ? void 0 : r.methods.renderPolygon.createCircle(...t);
|
|
2843
|
+
},
|
|
2844
|
+
updatePolygon: (...t) => {
|
|
2845
|
+
var r;
|
|
2846
|
+
return (r = l.value) == null ? void 0 : r.methods.renderPolygon.updatePolygon(...t);
|
|
2847
|
+
},
|
|
2848
|
+
clear: () => {
|
|
2849
|
+
var t;
|
|
2850
|
+
return (t = l.value) == null ? void 0 : t.methods.renderPolygon.clear();
|
|
2851
|
+
}
|
|
2852
|
+
},
|
|
2853
|
+
// 子模块
|
|
2854
|
+
utils: {
|
|
2855
|
+
getCalculateExtent: (...t) => {
|
|
2856
|
+
var r;
|
|
2857
|
+
return (r = l.value) == null ? void 0 : r.methods.utils.getCalculateExtent(...t);
|
|
2858
|
+
},
|
|
2859
|
+
convertSixHundredThousandToLatLng: (...t) => {
|
|
2860
|
+
var r;
|
|
2861
|
+
return (r = l.value) == null ? void 0 : r.methods.utils.convertSixHundredThousandToLatLng(...t);
|
|
2862
|
+
},
|
|
2863
|
+
calculateCirclePoints: (t, r) => {
|
|
2864
|
+
var $;
|
|
2865
|
+
return ($ = l.value) == null ? void 0 : $.methods.utils.calculateCirclePoints(t, r);
|
|
2866
|
+
}
|
|
2867
|
+
}
|
|
2868
|
+
}), (t, r) => (gt(), ft("div", Qo, [
|
|
2869
|
+
ct("div", {
|
|
2870
|
+
id: "map",
|
|
2871
|
+
ref_key: "zhMapRef",
|
|
2872
|
+
ref: o,
|
|
2873
|
+
class: "zh-map"
|
|
2874
|
+
}, null, 512),
|
|
2875
|
+
at(ho, {
|
|
2876
|
+
ref_key: "scaleLineRef",
|
|
2877
|
+
ref: c
|
|
2878
|
+
}, null, 512),
|
|
2879
|
+
at(mo, {
|
|
2880
|
+
ref: "zoomControlRef",
|
|
2881
|
+
"map-instance": l.value
|
|
2882
|
+
}, null, 8, ["map-instance"])
|
|
2883
|
+
]));
|
|
2884
|
+
}
|
|
2885
|
+
}), Io = /* @__PURE__ */ mt(Uo, [["__scopeId", "data-v-bb25afd0"]]), ln = uo(Io);
|
|
2886
|
+
export {
|
|
2887
|
+
ln as Z
|
|
2888
|
+
};
|