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