zhihao-ui 1.3.35 → 1.3.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { defineComponent as Ye, openBlock as Be, createElementBlock as qe, createElementVNode as Ge, ref as I, computed as Te, h as ne, createVNode as Ae, render as Pt, reactive as St, onMounted as Nt, onUnmounted as Vt } from "vue";
|
|
2
|
-
import { S as $t, M as Ue, T as me, X as we, p as ee, V as zt, q as Ot, t as Rt, h as lt, r as He, s as Zt, u as ge, F as Q, v as X, O as ce, P as le, w as ke, x as Ne, L as Pe, y as Dt, z as Ie, A as ie, B as
|
|
2
|
+
import { S as $t, M as Ue, T as me, X as we, p as ee, V as zt, q as Ot, t as Rt, h as lt, r as He, s as Zt, u as ge, F as Q, v as X, O as ce, P as le, w as ke, x as Ne, L as Pe, y as Dt, z as Ie, A as ie, B as he, C as de, D as ve, i as Gt, G as Ve, H as At, I as Oe, J as Wt, K as Yt, N as st, Q as Se, R as We, U as et, W as Bt, Y as qt, Z as Ht } from "./vendor-D2mv9LHk.js";
|
|
3
3
|
import { _ as Xe } from "./Button-CGndQwez.js";
|
|
4
4
|
import { w as Xt } from "./utils-D2wHR1YB.js";
|
|
5
5
|
const jt = { id: "scale-line-container" }, Qt = /* @__PURE__ */ Ye({
|
|
6
6
|
__name: "scaleLine",
|
|
7
7
|
setup(e, { expose: r }) {
|
|
8
8
|
return r({
|
|
9
|
-
setScaleLine: (s,
|
|
10
|
-
|
|
9
|
+
setScaleLine: (s, i) => {
|
|
10
|
+
i || (i = "metric");
|
|
11
11
|
const o = new $t({
|
|
12
|
-
units:
|
|
12
|
+
units: i
|
|
13
13
|
}), u = document.getElementById("scale-line-container");
|
|
14
14
|
u && (o.setTarget(u), s.addControl(o));
|
|
15
15
|
}
|
|
16
|
-
}), (s,
|
|
16
|
+
}), (s, i) => (Be(), qe("div", jt));
|
|
17
17
|
}
|
|
18
18
|
}), Jt = /* @__PURE__ */ Xe(Qt, [["__scopeId", "data-v-2bc5dee8"]]), Kt = { class: "zoom" }, _t = /* @__PURE__ */ Ye({
|
|
19
19
|
__name: "zoomControl",
|
|
@@ -28,17 +28,17 @@ const jt = { id: "scale-line-container" }, Qt = /* @__PURE__ */ Ye({
|
|
|
28
28
|
console.log("props", r);
|
|
29
29
|
const l = () => {
|
|
30
30
|
console.log("props");
|
|
31
|
-
const { setZoom:
|
|
31
|
+
const { setZoom: i, getZoom: o, getInstall: u } = r.mapInstance.methods;
|
|
32
32
|
if (!u()) return;
|
|
33
33
|
const t = o();
|
|
34
|
-
t &&
|
|
34
|
+
t && i(t + 1);
|
|
35
35
|
}, s = () => {
|
|
36
|
-
const { setZoom:
|
|
36
|
+
const { setZoom: i, getZoom: o, getInstall: u } = r.mapInstance.methods;
|
|
37
37
|
if (!u()) return;
|
|
38
38
|
const t = o();
|
|
39
|
-
t &&
|
|
39
|
+
t && i(t - 1);
|
|
40
40
|
};
|
|
41
|
-
return (
|
|
41
|
+
return (i, o) => (Be(), qe("div", Kt, [
|
|
42
42
|
Ge("div", {
|
|
43
43
|
class: "button big-button",
|
|
44
44
|
onClick: l
|
|
@@ -75,7 +75,7 @@ function eo() {
|
|
|
75
75
|
const e = I(), r = () => e.value, l = () => r().getView(), s = () => {
|
|
76
76
|
var v;
|
|
77
77
|
return (v = l()) == null ? void 0 : v.getZoom();
|
|
78
|
-
},
|
|
78
|
+
}, i = (v) => {
|
|
79
79
|
var N;
|
|
80
80
|
(N = l()) == null || N.setZoom(v);
|
|
81
81
|
}, o = (v, N) => {
|
|
@@ -85,7 +85,7 @@ function eo() {
|
|
|
85
85
|
var N;
|
|
86
86
|
const v = (N = l()) == null ? void 0 : N.getCenter();
|
|
87
87
|
return Rt(v);
|
|
88
|
-
},
|
|
88
|
+
}, h = () => {
|
|
89
89
|
var v;
|
|
90
90
|
return (v = r()) == null ? void 0 : v.getSize();
|
|
91
91
|
}, t = new Ue(), n = (v, N) => {
|
|
@@ -99,7 +99,7 @@ function eo() {
|
|
|
99
99
|
enableRotation: !1,
|
|
100
100
|
multiWorld: !0
|
|
101
101
|
};
|
|
102
|
-
let
|
|
102
|
+
let y = {
|
|
103
103
|
target: v,
|
|
104
104
|
controls: Ot({
|
|
105
105
|
zoom: !1
|
|
@@ -112,7 +112,7 @@ function eo() {
|
|
|
112
112
|
],
|
|
113
113
|
view: new zt(M)
|
|
114
114
|
};
|
|
115
|
-
const w = new Ue(
|
|
115
|
+
const w = new Ue(y);
|
|
116
116
|
e.value = w;
|
|
117
117
|
}, m = (v) => {
|
|
118
118
|
t.set("vectorTile", new me({
|
|
@@ -150,10 +150,10 @@ function eo() {
|
|
|
150
150
|
getInstall: r,
|
|
151
151
|
getView: l,
|
|
152
152
|
getZoom: s,
|
|
153
|
-
setZoom:
|
|
153
|
+
setZoom: i,
|
|
154
154
|
setCenter: o,
|
|
155
155
|
getCenter: u,
|
|
156
|
-
getSize:
|
|
156
|
+
getSize: h,
|
|
157
157
|
initMap: n,
|
|
158
158
|
setBaseLayerMap: m
|
|
159
159
|
};
|
|
@@ -162,12 +162,12 @@ const je = function(e, r) {
|
|
|
162
162
|
const l = Number(r) / 6e5;
|
|
163
163
|
return [Number(e) / 6e5, l];
|
|
164
164
|
}, to = (e, r) => {
|
|
165
|
-
const l = ee(e), s = r * 1e3,
|
|
165
|
+
const l = ee(e), s = r * 1e3, i = [
|
|
166
166
|
l[0] - s,
|
|
167
167
|
l[1] - s,
|
|
168
168
|
l[0] + s,
|
|
169
169
|
l[1] + s
|
|
170
|
-
], o = Zt(
|
|
170
|
+
], o = Zt(i, K.mercator, K.data);
|
|
171
171
|
return {
|
|
172
172
|
leftTopPoint: { lng: o[0], lat: o[3] },
|
|
173
173
|
rightTopPoint: { lng: o[2], lat: o[3] },
|
|
@@ -176,19 +176,19 @@ const je = function(e, r) {
|
|
|
176
176
|
};
|
|
177
177
|
}, oo = function(e, r) {
|
|
178
178
|
const s = He(e);
|
|
179
|
-
let
|
|
179
|
+
let i = "";
|
|
180
180
|
switch (console.log(r, xe), r) {
|
|
181
181
|
case xe.M:
|
|
182
|
-
|
|
182
|
+
i = Math.round(s * 100) / 100 + " m";
|
|
183
183
|
break;
|
|
184
184
|
case xe.KM:
|
|
185
|
-
|
|
185
|
+
i = Math.round(s / 1e3 * 100) / 100 + " km";
|
|
186
186
|
break;
|
|
187
187
|
case xe.NM:
|
|
188
|
-
|
|
188
|
+
i = (Math.round(s / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
|
|
189
189
|
break;
|
|
190
190
|
}
|
|
191
|
-
return
|
|
191
|
+
return i;
|
|
192
192
|
};
|
|
193
193
|
function ro(e) {
|
|
194
194
|
const r = e[0] * $e / 180;
|
|
@@ -198,8 +198,8 @@ function ro(e) {
|
|
|
198
198
|
function fe(e = "") {
|
|
199
199
|
let r = e.replace(/&?/g, "&");
|
|
200
200
|
return r = r.replace(/&#x([0-9a-fA-F]+);?/g, (l, s) => {
|
|
201
|
-
const
|
|
202
|
-
return String.fromCodePoint(
|
|
201
|
+
const i = parseInt(s, 16);
|
|
202
|
+
return String.fromCodePoint(i);
|
|
203
203
|
}), r;
|
|
204
204
|
}
|
|
205
205
|
const tt = (e) => {
|
|
@@ -215,21 +215,21 @@ const tt = (e) => {
|
|
|
215
215
|
});
|
|
216
216
|
}, ot = (e, r = "lonlat") => {
|
|
217
217
|
const l = { lon: 0, lat: 0 }, s = e[0] / $e * 180;
|
|
218
|
-
let
|
|
219
|
-
return
|
|
218
|
+
let i = e[1] / $e * 180;
|
|
219
|
+
return i = 180 / Math.PI * (2 * Math.atan(Math.exp(i * Math.PI / 180)) - Math.PI / 2), l.lon = s, l.lat = i, r === "lonlat" ? l : [s, i];
|
|
220
220
|
}, no = (e) => {
|
|
221
|
-
const r = lt.duration(e, "minutes"), l = Math.floor(r.asDays()), s = r.hours(),
|
|
222
|
-
let o = `${String(
|
|
221
|
+
const r = lt.duration(e, "minutes"), l = Math.floor(r.asDays()), s = r.hours(), i = r.minutes();
|
|
222
|
+
let o = `${String(i).padStart(2, "0")}分`;
|
|
223
223
|
return s !== 0 && (o = `${String(s).padStart(2, "0")}时${o}`), l !== 0 && (o = `${String(l).padStart(2, "0")}天${o}`), o;
|
|
224
224
|
}, lo = (e, r) => {
|
|
225
225
|
let l = null;
|
|
226
226
|
const s = async (m) => {
|
|
227
227
|
if (!e || (console.log("vehicleInfo", m), !(m != null && m.lon && (m != null && m.lat)))) return;
|
|
228
228
|
const v = Math.abs(Number(m.lon)) > 180 ? je(m.lon, m.lat) : [m.lon, m.lat];
|
|
229
|
-
|
|
229
|
+
i(m, ee(v));
|
|
230
230
|
const N = e == null ? void 0 : e.getView(), M = new le(v);
|
|
231
231
|
N.setCenter(ke(M.getCoordinates(), K.data, K.mercator));
|
|
232
|
-
},
|
|
232
|
+
}, i = (m, v) => {
|
|
233
233
|
const N = `${it}map/car-icon.gif`;
|
|
234
234
|
l || (l = new ce({
|
|
235
235
|
element: document.createElement("div"),
|
|
@@ -239,8 +239,8 @@ const tt = (e) => {
|
|
|
239
239
|
}), e.addOverlay(l));
|
|
240
240
|
const M = l.getElement();
|
|
241
241
|
M.style.backgroundImage = `url(${N})`, M.style.width = "80px", M.style.height = "80px";
|
|
242
|
-
const
|
|
243
|
-
M.style.transform = `rotate(${
|
|
242
|
+
const y = (m == null ? void 0 : m.drc) || "";
|
|
243
|
+
M.style.transform = `rotate(${y}deg)`, M.style.backgroundSize = "cover", l == null || l.setPosition(v);
|
|
244
244
|
};
|
|
245
245
|
return {
|
|
246
246
|
location: s,
|
|
@@ -266,17 +266,17 @@ var ct = /* @__PURE__ */ ((e) => (e[e.发动机使用中 = 0] = "发动机使用
|
|
|
266
266
|
const so = (e) => {
|
|
267
267
|
const r = /* @__PURE__ */ new Map(), l = {};
|
|
268
268
|
let s = null;
|
|
269
|
-
const
|
|
269
|
+
const i = "--";
|
|
270
270
|
let o = null;
|
|
271
|
-
const u = document.createElement("div"),
|
|
271
|
+
const u = document.createElement("div"), h = new ce({
|
|
272
272
|
element: u,
|
|
273
273
|
positioning: "top-left",
|
|
274
274
|
className: "track-label-popup"
|
|
275
275
|
});
|
|
276
|
-
let t, n, m, v, N, M = !1,
|
|
277
|
-
const B = 8, G = [], q = (
|
|
276
|
+
let t, n, m, v, N, M = !1, y = Date.now(), w, L = 0, C = null, b = 20;
|
|
277
|
+
const B = 8, G = [], q = (c) => {
|
|
278
278
|
var d;
|
|
279
|
-
for (G.unshift(
|
|
279
|
+
for (G.unshift(c); G.length > B; ) {
|
|
280
280
|
const f = G.pop(), p = r.get(f);
|
|
281
281
|
p && ((d = p.getSource()) == null || d.clear(), e == null || e.removeLayer(p), r.delete(f), delete l[f]);
|
|
282
282
|
}
|
|
@@ -285,10 +285,10 @@ const so = (e) => {
|
|
|
285
285
|
const R = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080", "#ffc0cb", "#800000", "#000080", "#808000"], Z = Ne(() => {
|
|
286
286
|
if (s && l[s] && r.get(s).getVisible()) {
|
|
287
287
|
console.log("reRenderTrackLine------------");
|
|
288
|
-
const
|
|
289
|
-
re(s,
|
|
288
|
+
const c = Gt(S(s, l[s]));
|
|
289
|
+
re(s, c);
|
|
290
290
|
}
|
|
291
|
-
}, 300), S = (
|
|
291
|
+
}, 300), S = (c, d) => {
|
|
292
292
|
let f = [];
|
|
293
293
|
const p = Math.max(1, Math.floor(d.length / b));
|
|
294
294
|
return f = d.filter((T, O) => O % p === 0).map((T, O) => {
|
|
@@ -296,107 +296,107 @@ const so = (e) => {
|
|
|
296
296
|
const [$, A] = je(T.lon, T.lat);
|
|
297
297
|
T.lon = $, T.lat = A;
|
|
298
298
|
}
|
|
299
|
-
return T.center = [T.lon, T.lat], T.centerPoint = ro(T.center), T.time = lt(T.createdAt).format("YYYY-MM-DD HH:mm:ss"), T.id =
|
|
299
|
+
return T.center = [T.lon, T.lat], T.centerPoint = ro(T.center), T.time = lt(T.createdAt).format("YYYY-MM-DD HH:mm:ss"), T.id = c, T.index = O, T;
|
|
300
300
|
}), f;
|
|
301
|
-
},
|
|
302
|
-
if (!e || JSON.stringify(l[
|
|
301
|
+
}, a = async (c, d, f, p = "ship", E = 200) => {
|
|
302
|
+
if (!e || JSON.stringify(l[c]) === JSON.stringify(d) && s === c || (d = d == null ? void 0 : d.reverse(), h && p === "ship" && (e != null && e.getOverlays().getArray().includes(h) || e.addOverlay(h)), (d == null ? void 0 : d.length) < 2))
|
|
303
303
|
return;
|
|
304
|
-
q(
|
|
305
|
-
const T = Object.keys(l).findIndex((O) => O ===
|
|
304
|
+
q(c), s = c, l[c] = d, b = E;
|
|
305
|
+
const T = Object.keys(l).findIndex((O) => O === c) || 0;
|
|
306
306
|
Y = f || R[T > 10 ? 10 : T], await k(), await Je(s);
|
|
307
|
-
}, x = (
|
|
307
|
+
}, x = (c) => {
|
|
308
308
|
const d = new de();
|
|
309
|
-
return new
|
|
309
|
+
return new he({
|
|
310
310
|
source: d,
|
|
311
311
|
visible: !1,
|
|
312
312
|
// 默认隐藏
|
|
313
|
-
className: `track-layer-${
|
|
313
|
+
className: `track-layer-${c}`,
|
|
314
314
|
renderBuffer: 1024
|
|
315
315
|
// 增大渲染缓冲区
|
|
316
316
|
});
|
|
317
|
-
}, g = (
|
|
317
|
+
}, g = (c) => {
|
|
318
318
|
r.forEach((d, f) => {
|
|
319
319
|
var E;
|
|
320
|
-
const p = f ===
|
|
320
|
+
const p = f === c;
|
|
321
321
|
d.getVisible() !== p && (d.setVisible(p), e.getLayers().getArray().includes(d) || e.addLayer(d), p || (E = d.getSource()) == null || E.clear());
|
|
322
|
-
}), s =
|
|
322
|
+
}), s = c;
|
|
323
323
|
}, k = async () => {
|
|
324
|
-
const
|
|
325
|
-
if (!r.has(
|
|
326
|
-
const T = x(
|
|
327
|
-
r.set(
|
|
324
|
+
const c = s;
|
|
325
|
+
if (!r.has(c)) {
|
|
326
|
+
const T = x(c);
|
|
327
|
+
r.set(c, T);
|
|
328
328
|
}
|
|
329
|
-
await g(
|
|
330
|
-
const d = Y || "", f = l[
|
|
329
|
+
await g(c);
|
|
330
|
+
const d = Y || "", f = l[c] || [];
|
|
331
331
|
if (!(f && f.length > 1)) return [];
|
|
332
332
|
let p = [];
|
|
333
|
-
p = S(
|
|
333
|
+
p = S(c, f);
|
|
334
334
|
const E = p.map((T) => T.centerPoint);
|
|
335
|
-
p.length >= 2 && await F(
|
|
336
|
-
}, F = (
|
|
337
|
-
const p = new Pe(d), E = r.get(
|
|
335
|
+
p.length >= 2 && await F(c, E, d);
|
|
336
|
+
}, F = (c, d, f) => {
|
|
337
|
+
const p = new Pe(d), E = r.get(c).getSource(), T = E.getFeatureById(c);
|
|
338
338
|
if (T)
|
|
339
|
-
T.setGeometry(p), T.setId(
|
|
339
|
+
T.setGeometry(p), T.setId(c), T.setStyle(V(f)), C = T;
|
|
340
340
|
else {
|
|
341
341
|
const O = new ie({ geometry: p });
|
|
342
|
-
O.setId(
|
|
342
|
+
O.setId(c), O.set("type", "line"), O.setStyle(V(f)), E.addFeature(O), C = O;
|
|
343
343
|
}
|
|
344
344
|
return C;
|
|
345
|
-
}, V = (
|
|
345
|
+
}, V = (c) => new X({
|
|
346
346
|
stroke: new ve({
|
|
347
|
-
color:
|
|
347
|
+
color: c,
|
|
348
348
|
width: 2
|
|
349
349
|
})
|
|
350
|
-
}), D = (
|
|
351
|
-
const p =
|
|
352
|
-
if (
|
|
350
|
+
}), D = (c, d, f) => {
|
|
351
|
+
const p = c == null ? void 0 : c.get("trackId");
|
|
352
|
+
if (c && p && d === "hover") {
|
|
353
353
|
e.getTargetElement().style.cursor = p ? "pointer" : "";
|
|
354
|
-
const E =
|
|
355
|
-
O && (u.querySelector(".popup-content"), u.innerHTML = T,
|
|
354
|
+
const E = c.get("data"), T = j(E), O = f == null ? void 0 : f.coordinate;
|
|
355
|
+
O && (u.querySelector(".popup-content"), u.innerHTML = T, h == null || h.setPosition(O));
|
|
356
356
|
} else
|
|
357
|
-
|
|
358
|
-
}, j = (
|
|
359
|
-
if (!(
|
|
357
|
+
h && h.setPosition(void 0);
|
|
358
|
+
}, j = (c) => {
|
|
359
|
+
if (!(c != null && c.time)) return;
|
|
360
360
|
let d = "";
|
|
361
|
-
return
|
|
361
|
+
return c != null && c.stayTime && (d = `
|
|
362
362
|
<div class="item w-100">
|
|
363
363
|
<div class="item-label">停泊时间约</div>
|
|
364
|
-
<div class="item-item">${no(Number(
|
|
364
|
+
<div class="item-item">${no(Number(c.stayTime))}</div>
|
|
365
365
|
</div>
|
|
366
366
|
`), `
|
|
367
367
|
<div class="track-point-popup">
|
|
368
368
|
<div class="item">
|
|
369
369
|
<div class="item-label">状态</div>
|
|
370
|
-
<div class="item-item">${
|
|
370
|
+
<div class="item-item">${c != null && c.sailStatus ? ct[c.sailStatus] : i}</div>
|
|
371
371
|
</div>
|
|
372
372
|
<div class="item">
|
|
373
373
|
<div class="item-label">航速</div>
|
|
374
|
-
<div class="item-item">${
|
|
374
|
+
<div class="item-item">${c.speed || i}</div>
|
|
375
375
|
</div>
|
|
376
376
|
<div class="item">
|
|
377
377
|
<div class="item-label">艏向</div>
|
|
378
|
-
<div class="item-item">${
|
|
378
|
+
<div class="item-item">${c.hdg || i}</div>
|
|
379
379
|
</div>
|
|
380
380
|
<div class="item">
|
|
381
381
|
<div class="item-label">航向</div>
|
|
382
|
-
<div class="item-item">${
|
|
382
|
+
<div class="item-item">${c.cog || i}</div>
|
|
383
383
|
</div>
|
|
384
384
|
<div class="item">
|
|
385
385
|
<div class="item-label">经度</div>
|
|
386
|
-
<div class="item-item">${
|
|
386
|
+
<div class="item-item">${c.lon || i}</div>
|
|
387
387
|
</div>
|
|
388
388
|
<div class="item">
|
|
389
389
|
<div class="item-label">纬度</div>
|
|
390
|
-
<div class="item-item">${
|
|
390
|
+
<div class="item-item">${c.lat || i}</div>
|
|
391
391
|
</div>
|
|
392
392
|
<div class="item w-100">
|
|
393
393
|
<div class="item-label">时间</div>
|
|
394
|
-
<div class="item-item">${
|
|
394
|
+
<div class="item-item">${c.time}</div>
|
|
395
395
|
</div>
|
|
396
396
|
${d ?? d}
|
|
397
397
|
</div>`;
|
|
398
|
-
}, z = (
|
|
399
|
-
const f =
|
|
398
|
+
}, z = (c) => {
|
|
399
|
+
const f = c.map(($) => {
|
|
400
400
|
const A = e.getPixelFromCoordinate(ee($.center));
|
|
401
401
|
return {
|
|
402
402
|
...$,
|
|
@@ -443,9 +443,9 @@ const so = (e) => {
|
|
|
443
443
|
distance: $.distance
|
|
444
444
|
}));
|
|
445
445
|
};
|
|
446
|
-
function ae(
|
|
447
|
-
for (let f = 1; f <
|
|
448
|
-
const p =
|
|
446
|
+
function ae(c, d) {
|
|
447
|
+
for (let f = 1; f < c.length; f++) {
|
|
448
|
+
const p = c[f - 1], E = c[f];
|
|
449
449
|
if (d >= p.distance && d <= E.distance) {
|
|
450
450
|
const T = (d - p.distance) / (E.distance - p.distance), O = p.pixel[0] + T * (E.pixel[0] - p.pixel[0]), $ = p.pixel[1] + T * (E.pixel[1] - p.pixel[1]), A = e == null ? void 0 : e.getCoordinateFromPixel([O, $]);
|
|
451
451
|
return {
|
|
@@ -461,24 +461,24 @@ const so = (e) => {
|
|
|
461
461
|
}
|
|
462
462
|
return null;
|
|
463
463
|
}
|
|
464
|
-
const re = async (
|
|
465
|
-
await be(), await pe(
|
|
464
|
+
const re = async (c, d) => {
|
|
465
|
+
await be(), await pe(c);
|
|
466
466
|
const f = z(d), p = f.map((T) => se(T));
|
|
467
|
-
r.get(
|
|
468
|
-
const O = Re(
|
|
467
|
+
r.get(c).getSource().addFeatures(p), ht(c, f, d, Y), f.forEach((T) => {
|
|
468
|
+
const O = Re(c, Y, T);
|
|
469
469
|
e.addOverlay(O);
|
|
470
470
|
});
|
|
471
|
-
}, se = (
|
|
471
|
+
}, se = (c) => {
|
|
472
472
|
const d = new ie({
|
|
473
|
-
geometry: new le(
|
|
474
|
-
data:
|
|
473
|
+
geometry: new le(c.centerPoint),
|
|
474
|
+
data: c
|
|
475
475
|
});
|
|
476
|
-
d.set("type", "track_point"), d.set("trackId",
|
|
476
|
+
d.set("type", "track_point"), d.set("trackId", c.id), d.set("data", c);
|
|
477
477
|
let f = [
|
|
478
|
-
...ft(
|
|
478
|
+
...ft(c, Y)
|
|
479
479
|
];
|
|
480
|
-
return (
|
|
481
|
-
}, Re = (
|
|
480
|
+
return (c.index === 0 || c.index === l[c.id].length - 1) && (f = [...yt(c)], d.set("type", "track_begin")), c.state !== void 0 && c.state !== null && (f = [...vt(c)], d.set("type", "track_icon")), d.setStyle(f), d;
|
|
481
|
+
}, Re = (c, d, f) => {
|
|
482
482
|
const p = document.createElement("div");
|
|
483
483
|
p.className = "track-overlay-label", p.style.position = "relative", p.style.backgroundColor = "rgba(255,255,255,0.8)", p.style.border = `1px solid ${d}`, p.style.fontSize = "12px", p.innerHTML = `
|
|
484
484
|
<span>${f.time}</span>
|
|
@@ -501,18 +501,18 @@ const so = (e) => {
|
|
|
501
501
|
stopEvent: !1,
|
|
502
502
|
className: "track-label-time-overlay"
|
|
503
503
|
});
|
|
504
|
-
return E.set("class", "track-label-overlay"), E.set("trackId",
|
|
504
|
+
return E.set("class", "track-label-overlay"), E.set("trackId", c), E;
|
|
505
505
|
}, be = () => {
|
|
506
|
-
const
|
|
506
|
+
const c = e == null ? void 0 : e.getOverlays().getArray(), d = c == null ? void 0 : c.filter((f) => f.get("class") === "track-label-overlay");
|
|
507
507
|
d && d.length > 0 && d.forEach((f) => {
|
|
508
508
|
f.setPosition(void 0), f.dispose();
|
|
509
509
|
});
|
|
510
|
-
}, pe = (
|
|
511
|
-
const d = r.get(
|
|
510
|
+
}, pe = (c) => {
|
|
511
|
+
const d = r.get(c).getSource();
|
|
512
512
|
d.forEachFeature((f) => {
|
|
513
513
|
f.get("type") !== "line" && d.removeFeature(f);
|
|
514
514
|
});
|
|
515
|
-
}, ft = (
|
|
515
|
+
}, ft = (c, d) => (`${c.time}`, [
|
|
516
516
|
new X({
|
|
517
517
|
// 扩大交互热区
|
|
518
518
|
image: new Ve({
|
|
@@ -529,20 +529,20 @@ const so = (e) => {
|
|
|
529
529
|
})
|
|
530
530
|
})
|
|
531
531
|
// textStyle,
|
|
532
|
-
]), vt = (
|
|
532
|
+
]), vt = (c) => {
|
|
533
533
|
const d = "#E31818", f = "#1890FF", p = "", E = new X({
|
|
534
534
|
text: new ge({
|
|
535
535
|
font: "Normal 22px map-iconfont",
|
|
536
536
|
text: fe(p),
|
|
537
537
|
offsetY: -10,
|
|
538
538
|
fill: new Q({
|
|
539
|
-
color: Number(
|
|
539
|
+
color: Number(c.state) === 0 ? d : Number(c.state) === 1 ? f : ""
|
|
540
540
|
})
|
|
541
541
|
}),
|
|
542
542
|
zIndex: 99
|
|
543
543
|
}), O = tt(""), A = tt(""), H = [];
|
|
544
|
-
return Number(
|
|
545
|
-
},
|
|
544
|
+
return Number(c.state) === 0 ? H.push(O) : Number(c.state) === 1 && H.push(A), H.push(E), H;
|
|
545
|
+
}, ht = (c, d, f, p) => {
|
|
546
546
|
const E = d || [], T = d.length;
|
|
547
547
|
T || (E.push(f[0]), E.push(f[f.length - 1]));
|
|
548
548
|
const O = [];
|
|
@@ -578,11 +578,11 @@ const so = (e) => {
|
|
|
578
578
|
), O.push(W);
|
|
579
579
|
}
|
|
580
580
|
}
|
|
581
|
-
const $ = r.get(
|
|
581
|
+
const $ = r.get(c).getSource();
|
|
582
582
|
$ == null || $.addFeatures(O);
|
|
583
|
-
}, Je = (
|
|
583
|
+
}, Je = (c) => {
|
|
584
584
|
var T, O;
|
|
585
|
-
const d = e.getView(), f = (T = r == null ? void 0 : r.get(
|
|
585
|
+
const d = e.getView(), f = (T = r == null ? void 0 : r.get(c)) == null ? void 0 : T.getSource(), p = C || (c ? f == null ? void 0 : f.getFeatureById(c) : null);
|
|
586
586
|
if (!p) return;
|
|
587
587
|
const E = (O = p == null ? void 0 : p.getGeometry()) == null ? void 0 : O.getExtent();
|
|
588
588
|
if (E != null && E.length)
|
|
@@ -592,8 +592,8 @@ const so = (e) => {
|
|
|
592
592
|
} catch ($) {
|
|
593
593
|
console.log($);
|
|
594
594
|
}
|
|
595
|
-
},
|
|
596
|
-
const d = "", E =
|
|
595
|
+
}, yt = (c) => {
|
|
596
|
+
const d = "", E = c.index === 0 ? "#fcdc3f" : "#ff0000";
|
|
597
597
|
return [new X({
|
|
598
598
|
text: new ge({
|
|
599
599
|
font: "Normal 14px map-iconfont",
|
|
@@ -609,8 +609,8 @@ const so = (e) => {
|
|
|
609
609
|
}), Object.keys(l).forEach((d) => {
|
|
610
610
|
r.delete(d), delete l[d];
|
|
611
611
|
}), isRender = !1, be();
|
|
612
|
-
}, wt = (
|
|
613
|
-
const d = r.get(
|
|
612
|
+
}, wt = (c) => {
|
|
613
|
+
const d = r.get(c || s);
|
|
614
614
|
d == null || d.setVisible(!1);
|
|
615
615
|
const f = e.getOverlays().getArray();
|
|
616
616
|
for (let p = 0; p < f.length; ) {
|
|
@@ -618,18 +618,18 @@ const so = (e) => {
|
|
|
618
618
|
E.get("class") === "track-label-overlay" ? (E.setPosition(void 0), e.removeOverlay(E)) : p++;
|
|
619
619
|
}
|
|
620
620
|
Me();
|
|
621
|
-
}, xt = (
|
|
621
|
+
}, xt = (c, d = xe.NM) => {
|
|
622
622
|
const f = {
|
|
623
|
-
id:
|
|
623
|
+
id: c,
|
|
624
624
|
length: "--"
|
|
625
|
-
}, E = (l[
|
|
625
|
+
}, E = (l[c] || []).map(
|
|
626
626
|
(O) => ke([O.lon, O.lat], K.data, K.mercator)
|
|
627
627
|
), T = new Pe(E);
|
|
628
628
|
return f.length = oo(T, d) || "--", f;
|
|
629
|
-
}, bt = (
|
|
630
|
-
kt(String(
|
|
631
|
-
}, kt = (
|
|
632
|
-
const f = l[String(
|
|
629
|
+
}, bt = (c, d) => {
|
|
630
|
+
kt(String(c), d);
|
|
631
|
+
}, kt = (c, d) => {
|
|
632
|
+
const f = l[String(c)], p = f == null ? void 0 : f.map((E) => [E.lon, E.lat]);
|
|
633
633
|
p && Ct(p, d);
|
|
634
634
|
}, Ze = new X({
|
|
635
635
|
text: new ge({
|
|
@@ -639,10 +639,10 @@ const so = (e) => {
|
|
|
639
639
|
rotation: 0
|
|
640
640
|
// 初始旋转角度
|
|
641
641
|
})
|
|
642
|
-
}), pt = (
|
|
642
|
+
}), pt = (c, d) => {
|
|
643
643
|
var P, W;
|
|
644
|
-
const f = Number(50 * d), p = ((P =
|
|
645
|
-
if (L = (L + f * E / 1e6) % 2,
|
|
644
|
+
const f = Number(50 * d), p = ((P = c.frameState) == null ? void 0 : P.time) ?? Date.now(), E = p - y;
|
|
645
|
+
if (L = (L + f * E / 1e6) % 2, y = p, L >= 1) {
|
|
646
646
|
Me();
|
|
647
647
|
return;
|
|
648
648
|
}
|
|
@@ -657,17 +657,17 @@ const so = (e) => {
|
|
|
657
657
|
ot($, "array")
|
|
658
658
|
) * Math.PI / 180;
|
|
659
659
|
(W = Ze.getText()) == null || W.setRotation(H), v.setCoordinates(T);
|
|
660
|
-
const _ = At(
|
|
660
|
+
const _ = At(c);
|
|
661
661
|
_.setStyle(Ze), _.drawGeometry(v), e == null || e.render();
|
|
662
662
|
}, Mt = () => {
|
|
663
|
-
var
|
|
664
|
-
M = !0,
|
|
663
|
+
var c;
|
|
664
|
+
M = !0, y = Date.now(), L = 0, v = ((c = m.getGeometry()) == null ? void 0 : c.clone()) || new le([0, 0]), o && (w == null || w.on("postrender", o)), N == null || N.setGeometry(void 0);
|
|
665
665
|
}, Me = () => {
|
|
666
666
|
M && (M = !1, N == null || N.setGeometry(void 0), o && w && w.un("postrender", o), w && (e == null || e.removeLayer(w)), w = null, N = null);
|
|
667
|
-
}, Ct = (
|
|
667
|
+
}, Ct = (c, d) => {
|
|
668
668
|
M && Me(), t = new Ie({
|
|
669
669
|
factor: 1e6
|
|
670
|
-
}).writeGeometry(new Pe(
|
|
670
|
+
}).writeGeometry(new Pe(c)), n = new Ie({
|
|
671
671
|
factor: 1e6
|
|
672
672
|
}).readGeometry(t, {
|
|
673
673
|
dataProjection: K.data,
|
|
@@ -681,12 +681,12 @@ const so = (e) => {
|
|
|
681
681
|
type: "geoMarker",
|
|
682
682
|
style: Ze,
|
|
683
683
|
geometry: v
|
|
684
|
-
}), w = new
|
|
684
|
+
}), w = new he({
|
|
685
685
|
source: new de({
|
|
686
686
|
features: [N]
|
|
687
687
|
})
|
|
688
688
|
}), e == null || e.addLayer(w), o = (p) => pt(p, d), Mt();
|
|
689
|
-
}, Ke = (
|
|
689
|
+
}, Ke = (c, d, f) => {
|
|
690
690
|
function p(P) {
|
|
691
691
|
return 180 * (P % (2 * Math.PI)) / Math.PI;
|
|
692
692
|
}
|
|
@@ -731,11 +731,11 @@ const so = (e) => {
|
|
|
731
731
|
};
|
|
732
732
|
return J.id !== void 0 && (U.id = J.id), J.bbox && (U.bbox = J.bbox), U.properties = W, U.geometry = P, U;
|
|
733
733
|
}
|
|
734
|
-
const _ = O(A(
|
|
734
|
+
const _ = O(A(c), A(d), f);
|
|
735
735
|
return _ < 0 ? 360 + _ : _;
|
|
736
736
|
};
|
|
737
737
|
return {
|
|
738
|
-
render:
|
|
738
|
+
render: a,
|
|
739
739
|
remove: mt,
|
|
740
740
|
play: bt,
|
|
741
741
|
setCenter: Je,
|
|
@@ -776,7 +776,7 @@ function io(e) {
|
|
|
776
776
|
animation: e.selected ? e.colors && ((u = e.colors) == null ? void 0 : u.length) >= 2 ? "blink-dual 2s ease-in-out infinite" : "blink-single 1.5s ease-in-out infinite" : "none"
|
|
777
777
|
// "animation": props.selected ? 'blink 1.5s ease-in-out infinite' : 'none', // 动画开关
|
|
778
778
|
};
|
|
779
|
-
}),
|
|
779
|
+
}), i = Te(() => ({
|
|
780
780
|
width: "14px",
|
|
781
781
|
height: "14px",
|
|
782
782
|
margin: "1px 5px 1px 1px",
|
|
@@ -806,7 +806,7 @@ function io(e) {
|
|
|
806
806
|
},
|
|
807
807
|
[
|
|
808
808
|
ne("div", {
|
|
809
|
-
style: e.selected ?
|
|
809
|
+
style: e.selected ? i.value : {}
|
|
810
810
|
}, ""),
|
|
811
811
|
ne("div", {
|
|
812
812
|
class: "text",
|
|
@@ -863,7 +863,7 @@ function io(e) {
|
|
|
863
863
|
I([]);
|
|
864
864
|
function co(e, r, l, s) {
|
|
865
865
|
if (r) {
|
|
866
|
-
const
|
|
866
|
+
const i = new ce({
|
|
867
867
|
element: l,
|
|
868
868
|
positioning: "top-left",
|
|
869
869
|
id: "label-" + (s == null ? void 0 : s.id),
|
|
@@ -872,32 +872,32 @@ function co(e, r, l, s) {
|
|
|
872
872
|
position: r,
|
|
873
873
|
className: s.blinking ? "ship-label-overlay-blinking" : "ship-label-overlay"
|
|
874
874
|
});
|
|
875
|
-
|
|
875
|
+
i.set("class", "zh-map-ship-overlay"), e.addOverlay(i);
|
|
876
876
|
}
|
|
877
877
|
}
|
|
878
878
|
const ao = (e) => {
|
|
879
879
|
const { spd: r, hdg: l, cog: s } = e;
|
|
880
880
|
return r ? l !== null && +l != 511 && s !== null ? s - +l >= 3 ? oe.right : s - +l <= -3 ? oe.left : oe.front : oe.front : "";
|
|
881
|
-
},
|
|
882
|
-
const { shipData: l } = r.getProperties(), s = at(e),
|
|
883
|
-
return uo(r,
|
|
881
|
+
}, ye = (e, r) => {
|
|
882
|
+
const { shipData: l } = r.getProperties(), s = at(e), i = Qe(e, l, s);
|
|
883
|
+
return uo(r, i, s);
|
|
884
884
|
}, at = (e) => {
|
|
885
885
|
const r = e == null ? void 0 : e.getView().getZoom();
|
|
886
886
|
return r <= te.shipModelMax && r >= te.shipTriggleMin ? "ship" : "triangle";
|
|
887
887
|
}, Qe = (e, r, l) => {
|
|
888
888
|
if (l === "ship") {
|
|
889
|
-
const { len: s, wid:
|
|
889
|
+
const { len: s, wid: i } = r, o = 97, u = 20, t = 1 / (e == null ? void 0 : e.getView().getResolution()), n = s * t / o, m = i * t / u, v = Math.min(n, m);
|
|
890
890
|
return v < 0.2 ? 0.2 : v > 2 ? 2 : v;
|
|
891
891
|
}
|
|
892
892
|
return te.scaleNum;
|
|
893
893
|
}, uo = (e, r, l) => {
|
|
894
|
-
const { color: s, direct:
|
|
894
|
+
const { color: s, direct: i, isHighlight: o, shipData: u } = e.getProperties(), h = ((u == null ? void 0 : u.cog) - 90 + 360) % 360;
|
|
895
895
|
return new X({
|
|
896
896
|
image: new Oe({
|
|
897
897
|
src: t(),
|
|
898
898
|
scale: r || te.scaleNum,
|
|
899
899
|
anchor: [0.5, 0.5],
|
|
900
|
-
rotation:
|
|
900
|
+
rotation: h * Math.PI / 180,
|
|
901
901
|
rotateWithView: !1
|
|
902
902
|
})
|
|
903
903
|
});
|
|
@@ -911,20 +911,20 @@ const ao = (e) => {
|
|
|
911
911
|
<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"
|
|
912
912
|
fill="${s}" stroke="${o ? "#FF2424" : "black"}" stroke-width="${o ? "2" : "0.578947"}" />
|
|
913
913
|
<!--path船航向左边或者向前-->
|
|
914
|
-
${
|
|
914
|
+
${i === oe.left && `<path d="M30 12L40 12L40 8" stroke="${o ? "#FF2424" : "black"}" stroke-width="2"/>`}
|
|
915
915
|
<!--path船航向右边-->
|
|
916
|
-
${
|
|
916
|
+
${i === oe.right && `<path d="M30 12L40 12L40 16" stroke="${o ? "#FF2424" : "black"}" stroke-width="2"/>`}
|
|
917
917
|
<!--path黑线无左右-->
|
|
918
|
-
${
|
|
918
|
+
${i === oe.front && `<path d="M30 12L40 12" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
919
919
|
</svg>
|
|
920
920
|
`;
|
|
921
921
|
case "ship":
|
|
922
922
|
return `<svg width="97" height="20" viewBox="0 0 97 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
923
923
|
<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"
|
|
924
924
|
fill="${s}" stroke="${o ? "#FF2424" : "black"}" stroke-width="${o ? "4" : "0.578947"}"/>
|
|
925
|
-
${
|
|
926
|
-
${
|
|
927
|
-
${
|
|
925
|
+
${i === oe.left && `<path d="M86 10L96 10L96 6" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
926
|
+
${i === oe.right && `<path d="M86 10L96 10L96 14" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
927
|
+
${i === oe.front && `<path d="M86 10L96 10" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
928
928
|
</svg>
|
|
929
929
|
`;
|
|
930
930
|
default:
|
|
@@ -932,9 +932,9 @@ const ao = (e) => {
|
|
|
932
932
|
}
|
|
933
933
|
}
|
|
934
934
|
}, go = (e, r) => {
|
|
935
|
-
const l = dt(e, r), s = r.id, { lon:
|
|
935
|
+
const l = dt(e, r), s = r.id, { lon: i, lat: o } = r, u = new ce({
|
|
936
936
|
element: l,
|
|
937
|
-
position: ee([
|
|
937
|
+
position: ee([i, o]),
|
|
938
938
|
id: "selected-" + s,
|
|
939
939
|
positioning: "center-center",
|
|
940
940
|
offset: [0, 5],
|
|
@@ -942,24 +942,24 @@ const ao = (e) => {
|
|
|
942
942
|
});
|
|
943
943
|
return u.set("class", "ship-overlay-selected"), u;
|
|
944
944
|
}, dt = (e, r) => {
|
|
945
|
-
const l = at(e), s = Qe(e, r, l),
|
|
946
|
-
<svg style="transform:scale(${s});" xmlns="http://www.w3.org/2000/svg" width="${
|
|
945
|
+
const l = at(e), s = Qe(e, r, l), i = l === "ship" ? 109 : 49, o = `
|
|
946
|
+
<svg style="transform:scale(${s});" xmlns="http://www.w3.org/2000/svg" width="${i}" height="${i}" viewBox="0 0 49 49" fill="none">
|
|
947
947
|
<path d="M1.99982 46.9998L1.99982 1.99982L46.9998 1.99982L46.9998 46.9998L1.99982 46.9998Z" fill="#FF2424" fill-opacity="0.2"/>
|
|
948
948
|
<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"/>
|
|
949
949
|
</svg>
|
|
950
950
|
`, u = document.createElement("div");
|
|
951
951
|
return u.className = "ship-overlay-selected", u.innerHTML = o, u;
|
|
952
952
|
}, fo = (e, r) => {
|
|
953
|
-
const { lon: l, lat: s, blinking:
|
|
954
|
-
l && s && co(e, ee([l, s]), o, { ...r, blinking:
|
|
953
|
+
const { lon: l, lat: s, blinking: i } = r, o = ut(r);
|
|
954
|
+
l && s && co(e, ee([l, s]), o, { ...r, blinking: i });
|
|
955
955
|
}, ut = (e) => {
|
|
956
956
|
const r = document.createElement("div");
|
|
957
957
|
r.className = "ship-overlay-box", r.style.position = "relative";
|
|
958
|
-
const { lon: l, lat: s, blinking:
|
|
958
|
+
const { lon: l, lat: s, blinking: i, blinkingColors: o, name: u } = e, h = Ae({
|
|
959
959
|
setup() {
|
|
960
960
|
return io({
|
|
961
961
|
position: [l + 2e-3, s + 2e-3],
|
|
962
|
-
selected:
|
|
962
|
+
selected: i,
|
|
963
963
|
name: u,
|
|
964
964
|
colors: o || [],
|
|
965
965
|
existDevice: e == null ? void 0 : e.existDevice,
|
|
@@ -968,7 +968,7 @@ const ao = (e) => {
|
|
|
968
968
|
});
|
|
969
969
|
}
|
|
970
970
|
});
|
|
971
|
-
return Pt(
|
|
971
|
+
return Pt(h, r), r;
|
|
972
972
|
}, rt = (e) => {
|
|
973
973
|
const r = [];
|
|
974
974
|
return e.existDevice && r.push(""), e.existMobile && r.push(""), e.existWaterGauge && r.push(""), r;
|
|
@@ -984,88 +984,88 @@ function vo() {
|
|
|
984
984
|
];
|
|
985
985
|
return e[Math.floor(Math.random() * e.length)];
|
|
986
986
|
}
|
|
987
|
-
const
|
|
988
|
-
function
|
|
989
|
-
const
|
|
987
|
+
const ho = window.devicePixelRatio || 1;
|
|
988
|
+
function yo(e, r, l = "left-bottom", s = 2) {
|
|
989
|
+
const i = document.createElement("canvas"), o = i.getContext("2d");
|
|
990
990
|
if (!o) return "";
|
|
991
|
-
const u = 2,
|
|
991
|
+
const u = 2, h = 8, t = 16, n = window.devicePixelRatio || 1, m = "500 12px Arial", v = "14px map-iconfont";
|
|
992
992
|
o.font = m;
|
|
993
993
|
const M = o.measureText(e).width;
|
|
994
994
|
o.font = v;
|
|
995
|
-
const
|
|
996
|
-
let B, G, q = 0, Y = 0, R = 0, Z = 0, S = 0,
|
|
995
|
+
const y = r.map((k) => ({ width: o.measureText(fe(k)).width, height: 14 })), w = y.reduce((k, F) => k + F.width, 0), L = (r.length - 1) * s, C = h + M + w + L + h, b = u + 14 + u;
|
|
996
|
+
let B, G, q = 0, Y = 0, R = 0, Z = 0, S = 0, a = 0;
|
|
997
997
|
switch (B = t + C, l) {
|
|
998
998
|
case "right-top":
|
|
999
|
-
G = t + b, q = 0, Y = t + b, R = t, Z = 0, S = t,
|
|
999
|
+
G = t + b, q = 0, Y = t + b, R = t, Z = 0, S = t, a = 0;
|
|
1000
1000
|
break;
|
|
1001
1001
|
case "right-middle":
|
|
1002
|
-
G = b, q = 0, Y = b / 2, R = t, Z = b / 2, S = t,
|
|
1002
|
+
G = b, q = 0, Y = b / 2, R = t, Z = b / 2, S = t, a = 0;
|
|
1003
1003
|
break;
|
|
1004
1004
|
case "right-bottom":
|
|
1005
|
-
G = t + b, q = 0, Y = 0, R = t, Z = t, S = t,
|
|
1005
|
+
G = t + b, q = 0, Y = 0, R = t, Z = t, S = t, a = t;
|
|
1006
1006
|
break;
|
|
1007
1007
|
case "left-top":
|
|
1008
|
-
G = t + b, q = C, Y = t, R = C + t, Z = b + t, S = 0,
|
|
1008
|
+
G = t + b, q = C, Y = t, R = C + t, Z = b + t, S = 0, a = 0;
|
|
1009
1009
|
break;
|
|
1010
1010
|
case "left-middle":
|
|
1011
|
-
G = b, q = C, Y = b / 2, R = C + t, Z = b / 2, S = 0,
|
|
1011
|
+
G = b, q = C, Y = b / 2, R = C + t, Z = b / 2, S = 0, a = 0;
|
|
1012
1012
|
break;
|
|
1013
1013
|
case "left-bottom":
|
|
1014
|
-
G = t + b, q = C, Y = b, R = C + t, Z = 0, S = 0,
|
|
1014
|
+
G = t + b, q = C, Y = b, R = C + t, Z = 0, S = 0, a = t;
|
|
1015
1015
|
break;
|
|
1016
1016
|
}
|
|
1017
|
-
G = G + u,
|
|
1018
|
-
const x =
|
|
1019
|
-
o.strokeStyle = "#ffffff", o.lineWidth = 1, o.strokeText(e, S +
|
|
1020
|
-
let g = S +
|
|
1017
|
+
G = G + u, i.width = Math.round(B * n), i.height = Math.round(G * n), o.scale(n, n), o.clearRect(0, 0, B, G), o.beginPath(), o.moveTo(q, Y), o.lineTo(R, Z), o.strokeStyle = "#FFF", o.lineWidth = 1, o.stroke(), o.fillStyle = "#FFF", o.fillRect(S, a, C, b), o.font = m, o.textBaseline = "middle";
|
|
1018
|
+
const x = a + u + b / 2;
|
|
1019
|
+
o.strokeStyle = "#ffffff", o.lineWidth = 1, o.strokeText(e, S + h, x), o.fillStyle = "#000000", o.fillText(e, S + h, x), o.font = v, o.fillStyle = "#3370ff";
|
|
1020
|
+
let g = S + h + M + s;
|
|
1021
1021
|
return r.length > 0 && r.forEach((k, F) => {
|
|
1022
|
-
const V =
|
|
1023
|
-
o.fillText(fe(k), g, V), g +=
|
|
1024
|
-
}),
|
|
1022
|
+
const V = a + u + b / 2;
|
|
1023
|
+
o.fillText(fe(k), g, V), g += y[F].width + s;
|
|
1024
|
+
}), i.toDataURL("image/png");
|
|
1025
1025
|
}
|
|
1026
1026
|
const nt = (e, r) => {
|
|
1027
|
-
const { name: l, rightIcons: s, selected:
|
|
1028
|
-
let
|
|
1027
|
+
const { name: l, rightIcons: s, selected: i } = e.getProperties(), o = r !== 1 ? vo() : "right-top", u = yo(l, s, o);
|
|
1028
|
+
let h = [0, 0];
|
|
1029
1029
|
switch (o) {
|
|
1030
1030
|
case "right-top":
|
|
1031
|
-
|
|
1031
|
+
h = [0, 1];
|
|
1032
1032
|
break;
|
|
1033
1033
|
case "right-middle":
|
|
1034
|
-
|
|
1034
|
+
h = [0, 0.5];
|
|
1035
1035
|
break;
|
|
1036
1036
|
case "right-bottom":
|
|
1037
|
-
|
|
1037
|
+
h = [0, 0];
|
|
1038
1038
|
break;
|
|
1039
1039
|
case "left-top":
|
|
1040
|
-
|
|
1040
|
+
h = [1, 1];
|
|
1041
1041
|
break;
|
|
1042
1042
|
case "left-middle":
|
|
1043
|
-
|
|
1043
|
+
h = [1, 0.5];
|
|
1044
1044
|
break;
|
|
1045
1045
|
case "left-bottom":
|
|
1046
|
-
|
|
1046
|
+
h = [1, 0];
|
|
1047
1047
|
break;
|
|
1048
1048
|
}
|
|
1049
1049
|
return new X({
|
|
1050
1050
|
image: new Oe({
|
|
1051
1051
|
src: u,
|
|
1052
|
-
anchor:
|
|
1052
|
+
anchor: h,
|
|
1053
1053
|
displacement: [0, 0],
|
|
1054
|
-
scale: 1 /
|
|
1054
|
+
scale: 1 / ho,
|
|
1055
1055
|
anchorXUnits: "fraction",
|
|
1056
1056
|
anchorYUnits: "fraction"
|
|
1057
1057
|
}),
|
|
1058
|
-
zIndex:
|
|
1058
|
+
zIndex: i ? 100 : 10
|
|
1059
1059
|
});
|
|
1060
1060
|
}, mo = (e) => {
|
|
1061
1061
|
let r = null, l = null;
|
|
1062
|
-
const s = new de(),
|
|
1062
|
+
const s = new de(), i = new Wt({
|
|
1063
1063
|
source: s,
|
|
1064
1064
|
className: "zh-map--ship-layer",
|
|
1065
1065
|
renderBuffer: 300,
|
|
1066
1066
|
zIndex: 101,
|
|
1067
1067
|
hitTolerance: 10
|
|
1068
|
-
}), o = new de(), u = new
|
|
1068
|
+
}), o = new de(), u = new he({
|
|
1069
1069
|
source: o,
|
|
1070
1070
|
className: "zh-map--ship-label-layer",
|
|
1071
1071
|
zIndex: 102,
|
|
@@ -1073,27 +1073,27 @@ const nt = (e, r) => {
|
|
|
1073
1073
|
updateWhileAnimating: !1,
|
|
1074
1074
|
declutter: !0
|
|
1075
1075
|
});
|
|
1076
|
-
e == null || e.addLayer(
|
|
1077
|
-
let
|
|
1078
|
-
const v = (
|
|
1079
|
-
if (!
|
|
1076
|
+
e == null || e.addLayer(i), e == null || e.addLayer(u);
|
|
1077
|
+
let h = null, t = "", n = {}, m = {};
|
|
1078
|
+
const v = (a) => {
|
|
1079
|
+
if (!a || !e) return;
|
|
1080
1080
|
const x = (l == null ? void 0 : l.id) || (r == null ? void 0 : r.get("id"));
|
|
1081
1081
|
if (l) {
|
|
1082
|
-
const g =
|
|
1083
|
-
g.length === 0 ?
|
|
1082
|
+
const g = a.filter((k) => k.id === x);
|
|
1083
|
+
g.length === 0 ? a.push(l) : l = g[0];
|
|
1084
1084
|
}
|
|
1085
|
-
L(), C(!0), S(
|
|
1086
|
-
}, N = (
|
|
1085
|
+
L(), C(!0), S(a), M();
|
|
1086
|
+
}, N = (a) => {
|
|
1087
1087
|
var z;
|
|
1088
|
-
const x = (l == null ? void 0 : l.id) || (r == null ? void 0 : r.get("id")), g = ee([
|
|
1088
|
+
const x = (l == null ? void 0 : l.id) || (r == null ? void 0 : r.get("id")), g = ee([a == null ? void 0 : a.lon, a == null ? void 0 : a.lat]), k = ((z = m[a.id]) == null ? void 0 : z.blinkColors) || [], V = k[k.length - 1] || a.fill || "#04C900", D = ao(a), j = new ie({
|
|
1089
1089
|
geometry: new le(g),
|
|
1090
1090
|
// 船舶数据
|
|
1091
|
-
shipData:
|
|
1092
|
-
id:
|
|
1093
|
-
name:
|
|
1094
|
-
selected:
|
|
1091
|
+
shipData: a,
|
|
1092
|
+
id: a.id,
|
|
1093
|
+
name: a.cnname || a.enname || a.name || a.id || "未命名船舶",
|
|
1094
|
+
selected: a.id === x,
|
|
1095
1095
|
// 图标
|
|
1096
|
-
rightIcons: rt(
|
|
1096
|
+
rightIcons: rt(a),
|
|
1097
1097
|
// 是否闪烁
|
|
1098
1098
|
// blinking: attentionShips[ship.id] || false,
|
|
1099
1099
|
// // 闪烁颜色
|
|
@@ -1118,16 +1118,16 @@ const nt = (e, r) => {
|
|
|
1118
1118
|
var g;
|
|
1119
1119
|
x && ((g = x.get("element")) != null && g.parentElement) && (x.get("element").parentElement.style.display = "block");
|
|
1120
1120
|
}, 20);
|
|
1121
|
-
},
|
|
1122
|
-
if (
|
|
1121
|
+
}, y = (a) => {
|
|
1122
|
+
if (a === "start") {
|
|
1123
1123
|
const x = () => {
|
|
1124
1124
|
s.getFeatures().forEach((g) => {
|
|
1125
|
-
g.setStyle(
|
|
1126
|
-
}),
|
|
1125
|
+
g.setStyle(ye(e, g));
|
|
1126
|
+
}), h = requestAnimationFrame(x);
|
|
1127
1127
|
};
|
|
1128
1128
|
x();
|
|
1129
1129
|
}
|
|
1130
|
-
|
|
1130
|
+
a === "end" && h && (cancelAnimationFrame(h), h = null);
|
|
1131
1131
|
}, w = () => {
|
|
1132
1132
|
const x = (e == null ? void 0 : e.getOverlays().getArray()).find((g) => g.get("class") == "ship-overlay-selected");
|
|
1133
1133
|
if (x) {
|
|
@@ -1135,24 +1135,24 @@ const nt = (e, r) => {
|
|
|
1135
1135
|
console.log(F), F && (F.style.transform = `scale(${k})`);
|
|
1136
1136
|
}
|
|
1137
1137
|
}, L = () => {
|
|
1138
|
-
e && s && (s.clear(), o.clear(), C(),
|
|
1139
|
-
}, C = (
|
|
1138
|
+
e && s && (s.clear(), o.clear(), C(), y("end"));
|
|
1139
|
+
}, C = (a) => {
|
|
1140
1140
|
const x = e.getOverlays().getArray().filter((g) => g.get("class") == "zh-map-ship-overlay");
|
|
1141
1141
|
if (x && x.length > 0) {
|
|
1142
1142
|
for (let g = 0; g < x.length; g++)
|
|
1143
|
-
if (!
|
|
1143
|
+
if (!a && x[g].get("class") !== "ship-overlay-selected") {
|
|
1144
1144
|
const k = x[g];
|
|
1145
1145
|
k.setPosition(void 0), e.removeOverlay(k), k.dispose();
|
|
1146
1146
|
}
|
|
1147
1147
|
}
|
|
1148
|
-
}, b = (
|
|
1149
|
-
n =
|
|
1148
|
+
}, b = (a, x) => {
|
|
1149
|
+
n = a, m = x;
|
|
1150
1150
|
const g = e.getOverlays().getArray(), k = s.getFeatures();
|
|
1151
1151
|
for (const F in n) {
|
|
1152
1152
|
const V = n[F], D = g.find((z) => z.getId() === "label-" + F), j = k.find((z) => F === z.get("id"));
|
|
1153
1153
|
if (D && j) {
|
|
1154
1154
|
const z = x[F].blinkColors || [], { shipData: ae, name: re, color: se } = j.getProperties();
|
|
1155
|
-
j.set("blinking", V), z[(z == null ? void 0 : z.length) - 1] && se !== z[(z == null ? void 0 : z.length) - 1] && (j.set("color", z[(z == null ? void 0 : z.length) - 1] || ""), j.setStyle(
|
|
1155
|
+
j.set("blinking", V), z[(z == null ? void 0 : z.length) - 1] && se !== z[(z == null ? void 0 : z.length) - 1] && (j.set("color", z[(z == null ? void 0 : z.length) - 1] || ""), j.setStyle(ye(e, j)));
|
|
1156
1156
|
const Re = {
|
|
1157
1157
|
...ae,
|
|
1158
1158
|
blinking: V,
|
|
@@ -1162,10 +1162,10 @@ const nt = (e, r) => {
|
|
|
1162
1162
|
be && be !== pe && D.setElement(pe);
|
|
1163
1163
|
}
|
|
1164
1164
|
}
|
|
1165
|
-
}, B = (
|
|
1165
|
+
}, B = (a) => {
|
|
1166
1166
|
if (!e) return;
|
|
1167
1167
|
const x = s.getFeatures(), g = o.getFeatures(), k = r ? r.get("id") : "", F = x.filter((z) => z.get("id") !== k), V = g == null ? void 0 : g.filter((z) => z.get("id") !== k), D = /* @__PURE__ */ new Map();
|
|
1168
|
-
|
|
1168
|
+
a.forEach((z) => {
|
|
1169
1169
|
D.set(z.id, !0);
|
|
1170
1170
|
});
|
|
1171
1171
|
const j = e.getOverlays().getArray();
|
|
@@ -1175,7 +1175,7 @@ const nt = (e, r) => {
|
|
|
1175
1175
|
z.setStyle([]);
|
|
1176
1176
|
else {
|
|
1177
1177
|
const se = z.getStyle();
|
|
1178
|
-
(se == null ? void 0 : se.length) == 0 && z.setStyle(
|
|
1178
|
+
(se == null ? void 0 : se.length) == 0 && z.setStyle(ye(e, z));
|
|
1179
1179
|
}
|
|
1180
1180
|
const re = j.find((se) => se.getId() === "label-" + ae);
|
|
1181
1181
|
re && re.setPosition(void 0);
|
|
@@ -1188,21 +1188,21 @@ const nt = (e, r) => {
|
|
|
1188
1188
|
(re == null ? void 0 : re.length) == 0 && z.setStyle(nt(z));
|
|
1189
1189
|
}
|
|
1190
1190
|
});
|
|
1191
|
-
}, G = (
|
|
1192
|
-
if (
|
|
1193
|
-
console.log("选中",
|
|
1194
|
-
const x = s.getFeatures().find((k) => k.get("id") ===
|
|
1195
|
-
x && (r = x), g && g.set("selected", !0), l =
|
|
1191
|
+
}, G = (a) => {
|
|
1192
|
+
if (a) {
|
|
1193
|
+
console.log("选中", a);
|
|
1194
|
+
const x = s.getFeatures().find((k) => k.get("id") === a.id), g = o.getFeatures().find((k) => k.get("id") === a.id);
|
|
1195
|
+
x && (r = x), g && g.set("selected", !0), l = a, M();
|
|
1196
1196
|
} else
|
|
1197
1197
|
console.log("取消选中"), l = null, r = null, R();
|
|
1198
|
-
}, q = Ne((
|
|
1198
|
+
}, q = Ne((a, x, g) => {
|
|
1199
1199
|
try {
|
|
1200
|
-
if (
|
|
1201
|
-
const k =
|
|
1200
|
+
if (a) {
|
|
1201
|
+
const k = a.get("shipData"), F = a.get("id");
|
|
1202
1202
|
if (e.getTargetElement().style.cursor = F ? "pointer" : "", x === "click" && (G(k), g && g(F)), x === "hover") {
|
|
1203
1203
|
t && t !== F && Y(), t = F;
|
|
1204
1204
|
const V = s.getFeatures().find((D) => D.get("id") === t);
|
|
1205
|
-
V == null || V.set("isHighlight", !0), V == null || V.setStyle(
|
|
1205
|
+
V == null || V.set("isHighlight", !0), V == null || V.setStyle(ye(e, V));
|
|
1206
1206
|
}
|
|
1207
1207
|
} else
|
|
1208
1208
|
e.getTargetElement().style.cursor = "", Y();
|
|
@@ -1210,32 +1210,32 @@ const nt = (e, r) => {
|
|
|
1210
1210
|
console.log("handleShipMapEvent", k);
|
|
1211
1211
|
}
|
|
1212
1212
|
}, 10), Y = () => {
|
|
1213
|
-
const
|
|
1214
|
-
t = null,
|
|
1213
|
+
const a = t ? s.getFeatures().find((x) => x.get("id") === t) : null;
|
|
1214
|
+
t = null, a == null || a.set("isHighlight", !1), a == null || a.setStyle(ye(e, a));
|
|
1215
1215
|
}, R = () => {
|
|
1216
1216
|
try {
|
|
1217
1217
|
const x = e.getOverlays().getArray().find((g) => g.get("class") == "ship-overlay-selected");
|
|
1218
1218
|
x && x.setPosition(void 0);
|
|
1219
|
-
} catch (
|
|
1220
|
-
console.log(
|
|
1219
|
+
} catch (a) {
|
|
1220
|
+
console.log(a);
|
|
1221
1221
|
}
|
|
1222
|
-
}, Z = (
|
|
1223
|
-
const g = ee([
|
|
1222
|
+
}, Z = (a, x) => {
|
|
1223
|
+
const g = ee([a == null ? void 0 : a.lon, a == null ? void 0 : a.lat]), k = new ie({
|
|
1224
1224
|
geometry: new le(g),
|
|
1225
|
-
name:
|
|
1225
|
+
name: a.cnname || a.enname || a.name || a.id || "未命名船舶",
|
|
1226
1226
|
// 图标
|
|
1227
|
-
rightIcons: rt(
|
|
1228
|
-
selected: (
|
|
1229
|
-
shipData:
|
|
1227
|
+
rightIcons: rt(a),
|
|
1228
|
+
selected: (a == null ? void 0 : a.id) === (l == null ? void 0 : l.id),
|
|
1229
|
+
shipData: a
|
|
1230
1230
|
});
|
|
1231
|
-
k.set("id",
|
|
1231
|
+
k.set("id", a.id);
|
|
1232
1232
|
const F = nt(k, x);
|
|
1233
1233
|
return k.setStyle(F), k;
|
|
1234
|
-
}, S = (
|
|
1234
|
+
}, S = (a) => {
|
|
1235
1235
|
const x = e.getView().getZoom();
|
|
1236
|
-
|
|
1236
|
+
a.forEach((g) => {
|
|
1237
1237
|
const k = N(g);
|
|
1238
|
-
if (k.setStyle(
|
|
1238
|
+
if (k.setStyle(ye(e, k)), s.addFeature(k), (l == null ? void 0 : l.id) == g.id || x >= te.shipModelMin)
|
|
1239
1239
|
if (n[g.id]) {
|
|
1240
1240
|
if (g.id && m[g == null ? void 0 : g.id]) {
|
|
1241
1241
|
const F = m[g == null ? void 0 : g.id] || {}, V = (F == null ? void 0 : F.blinkColors) || [], D = (F == null ? void 0 : F.shipState) || "", j = (g.cnname || g.enname || g.name || g.id || "未命名船舶") + "(" + D + ")", z = {
|
|
@@ -1247,7 +1247,7 @@ const nt = (e, r) => {
|
|
|
1247
1247
|
fo(e, z);
|
|
1248
1248
|
}
|
|
1249
1249
|
} else {
|
|
1250
|
-
const F = Z(g,
|
|
1250
|
+
const F = Z(g, a.length);
|
|
1251
1251
|
o.addFeature(F);
|
|
1252
1252
|
}
|
|
1253
1253
|
});
|
|
@@ -1259,11 +1259,11 @@ const nt = (e, r) => {
|
|
|
1259
1259
|
blinking: b,
|
|
1260
1260
|
clear: L,
|
|
1261
1261
|
handleShipMapEvent: q,
|
|
1262
|
-
changeShipScale:
|
|
1262
|
+
changeShipScale: y,
|
|
1263
1263
|
changeSelectedScale: w
|
|
1264
1264
|
};
|
|
1265
1265
|
}, wo = (e) => {
|
|
1266
|
-
const r = () => e == null ? void 0 : e.getLayers(), l = I("vector"), s = () => l.value,
|
|
1266
|
+
const r = () => e == null ? void 0 : e.getLayers(), l = I("vector"), s = () => l.value, i = (t) => {
|
|
1267
1267
|
l.value = t;
|
|
1268
1268
|
const n = r();
|
|
1269
1269
|
n && (n == null || n.getArray().forEach((m) => {
|
|
@@ -1294,7 +1294,7 @@ const nt = (e, r) => {
|
|
|
1294
1294
|
}
|
|
1295
1295
|
},
|
|
1296
1296
|
getShowLayerType: s,
|
|
1297
|
-
setShowLayerType:
|
|
1297
|
+
setShowLayerType: i
|
|
1298
1298
|
};
|
|
1299
1299
|
}, xo = () => {
|
|
1300
1300
|
const e = I();
|
|
@@ -1306,35 +1306,35 @@ const nt = (e, r) => {
|
|
|
1306
1306
|
};
|
|
1307
1307
|
}, bo = (e) => {
|
|
1308
1308
|
const r = "zh-map-location-layer";
|
|
1309
|
-
let l, s,
|
|
1310
|
-
const u = (
|
|
1311
|
-
if (!(!
|
|
1309
|
+
let l, s, i = null, o = null;
|
|
1310
|
+
const u = (y) => {
|
|
1311
|
+
if (!(!y || y.length === 0)) {
|
|
1312
1312
|
if (s || (s = new de()), s.clear(), o) {
|
|
1313
|
-
const w =
|
|
1314
|
-
w ? o = w :
|
|
1313
|
+
const w = y.find((L) => L.id === o.id);
|
|
1314
|
+
w ? o = w : y.push(o);
|
|
1315
1315
|
}
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
}), l || (l = new
|
|
1316
|
+
y.forEach((w) => {
|
|
1317
|
+
h(w);
|
|
1318
|
+
}), l || (l = new he({
|
|
1319
1319
|
className: r,
|
|
1320
1320
|
source: s,
|
|
1321
1321
|
zIndex: 100
|
|
1322
1322
|
}), e == null || e.addLayer(l));
|
|
1323
1323
|
}
|
|
1324
|
-
},
|
|
1325
|
-
const w = e == null ? void 0 : e.getView().getZoom(), [L, C] =
|
|
1324
|
+
}, h = (y) => {
|
|
1325
|
+
const w = e == null ? void 0 : e.getView().getZoom(), [L, C] = y.latLon.split(","), b = new ie({
|
|
1326
1326
|
geometry: new le(ee([Number(L), Number(C)]))
|
|
1327
1327
|
});
|
|
1328
|
-
b.setStyle(t(
|
|
1329
|
-
}, t = (
|
|
1328
|
+
b.setStyle(t(y, w, y.id === (o == null ? void 0 : o.id))), b.set("loactionData", y), s.addFeature(b);
|
|
1329
|
+
}, t = (y, w, L) => {
|
|
1330
1330
|
const C = {
|
|
1331
1331
|
image: new Oe({
|
|
1332
|
-
src: L &&
|
|
1332
|
+
src: L && y.selectedPath || y.defaultPath,
|
|
1333
1333
|
scale: 0.5 * w / 10
|
|
1334
1334
|
})
|
|
1335
1335
|
};
|
|
1336
|
-
return
|
|
1337
|
-
text:
|
|
1336
|
+
return y.name && (C.text = new ge({
|
|
1337
|
+
text: y.name,
|
|
1338
1338
|
font: "12px sans-serif",
|
|
1339
1339
|
fill: new Q({
|
|
1340
1340
|
color: "#000000"
|
|
@@ -1345,30 +1345,30 @@ const nt = (e, r) => {
|
|
|
1345
1345
|
offsetY: 30
|
|
1346
1346
|
})), new X(C);
|
|
1347
1347
|
}, n = () => {
|
|
1348
|
-
if (
|
|
1349
|
-
const
|
|
1348
|
+
if (i) {
|
|
1349
|
+
const y = i.get("loactionData").id;
|
|
1350
1350
|
s.getFeatures().forEach((w) => {
|
|
1351
|
-
w.get("loactionData").id !==
|
|
1351
|
+
w.get("loactionData").id !== y && s.removeFeature(w);
|
|
1352
1352
|
});
|
|
1353
1353
|
} else
|
|
1354
1354
|
s.clear();
|
|
1355
1355
|
}, m = () => {
|
|
1356
1356
|
var C;
|
|
1357
|
-
const
|
|
1357
|
+
const y = i.get("loactionData"), w = (C = e == null ? void 0 : e.getView()) == null ? void 0 : C.getZoom();
|
|
1358
1358
|
s.getFeatures().forEach((b) => {
|
|
1359
|
-
b.get("loactionData").id ===
|
|
1360
|
-
}), o = null,
|
|
1361
|
-
}, v = (
|
|
1362
|
-
|
|
1359
|
+
b.get("loactionData").id === y.id && (b == null || b.setStyle(t(y, w, !1)));
|
|
1360
|
+
}), o = null, i = null;
|
|
1361
|
+
}, v = (y) => {
|
|
1362
|
+
y ? (N(), M(y)) : clearSelectedPort();
|
|
1363
1363
|
}, N = () => {
|
|
1364
|
-
var
|
|
1365
|
-
if (
|
|
1366
|
-
const w =
|
|
1367
|
-
|
|
1364
|
+
var y;
|
|
1365
|
+
if (i) {
|
|
1366
|
+
const w = i.get("loactionData"), L = (y = e == null ? void 0 : e.getView()) == null ? void 0 : y.getZoom();
|
|
1367
|
+
i.setStyle(t(w, L, !1));
|
|
1368
1368
|
}
|
|
1369
|
-
}, M = (
|
|
1369
|
+
}, M = (y) => {
|
|
1370
1370
|
const w = s.getFeatures();
|
|
1371
|
-
o =
|
|
1371
|
+
o = y, i = w.find((L) => L.get("loactionData").id === y.id);
|
|
1372
1372
|
};
|
|
1373
1373
|
return {
|
|
1374
1374
|
render: u,
|
|
@@ -1388,18 +1388,18 @@ const nt = (e, r) => {
|
|
|
1388
1388
|
const l = e.getViewport();
|
|
1389
1389
|
l && (l.style.cursor = r);
|
|
1390
1390
|
}, Mo = (e, r) => {
|
|
1391
|
-
const l = I([]), s = I("km"),
|
|
1391
|
+
const l = I([]), s = I("km"), i = (S) => {
|
|
1392
1392
|
s.value = S;
|
|
1393
1393
|
};
|
|
1394
1394
|
let o;
|
|
1395
|
-
const u = I(!1),
|
|
1395
|
+
const u = I(!1), h = () => {
|
|
1396
1396
|
ze(e, "crosshair"), m(), ko(e), e.on("pointermove", M), e.getViewport().addEventListener("mouseout", () => {
|
|
1397
1397
|
o && o.classList.add("hidden");
|
|
1398
1398
|
}), w(), u.value = !0;
|
|
1399
1399
|
};
|
|
1400
1400
|
let t, n;
|
|
1401
1401
|
const m = () => {
|
|
1402
|
-
t = new de(), n = new
|
|
1402
|
+
t = new de(), n = new he({
|
|
1403
1403
|
source: t,
|
|
1404
1404
|
zIndex: 1e3,
|
|
1405
1405
|
style: {
|
|
@@ -1415,12 +1415,12 @@ const nt = (e, r) => {
|
|
|
1415
1415
|
const M = (S) => {
|
|
1416
1416
|
if (S.dragging)
|
|
1417
1417
|
return;
|
|
1418
|
-
let
|
|
1419
|
-
v && (
|
|
1418
|
+
let a = "点击选择起点";
|
|
1419
|
+
v && (a = "单击继续,双击结束"), o && (o.innerHTML = a, N.setPosition(S.coordinate), o.classList.remove("hidden"));
|
|
1420
1420
|
};
|
|
1421
|
-
let
|
|
1421
|
+
let y;
|
|
1422
1422
|
const w = () => {
|
|
1423
|
-
|
|
1423
|
+
y = new Se({
|
|
1424
1424
|
source: t,
|
|
1425
1425
|
type: "LineString",
|
|
1426
1426
|
style: new X({
|
|
@@ -1443,24 +1443,24 @@ const nt = (e, r) => {
|
|
|
1443
1443
|
})
|
|
1444
1444
|
}),
|
|
1445
1445
|
// 添加条件函数,判断是否应该出发点绘制
|
|
1446
|
-
condition: (
|
|
1447
|
-
}), e == null || e.addInteraction(
|
|
1446
|
+
condition: (a) => a.originalEvent.target.tagName !== "DIV"
|
|
1447
|
+
}), e == null || e.addInteraction(y), B(), G();
|
|
1448
1448
|
let S;
|
|
1449
|
-
|
|
1449
|
+
y.on("drawstart", function(a) {
|
|
1450
1450
|
var g;
|
|
1451
|
-
v =
|
|
1451
|
+
v = a.feature, v.set("randomId", L());
|
|
1452
1452
|
let x;
|
|
1453
1453
|
S = (g = v.getGeometry()) == null ? void 0 : g.on("change", function(k) {
|
|
1454
1454
|
const F = k.target, V = gt(F, s.value);
|
|
1455
1455
|
x = F.getLastCoordinate(), C && V && (C.innerHTML = V), b.setPosition(x);
|
|
1456
1456
|
});
|
|
1457
|
-
}),
|
|
1458
|
-
var
|
|
1457
|
+
}), y.on("drawend", function() {
|
|
1458
|
+
var a, x, g;
|
|
1459
1459
|
if (C && (C.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), C != null && C.innerHTML) {
|
|
1460
1460
|
const k = (v == null ? void 0 : v.get("randomId")) || L();
|
|
1461
1461
|
l.value.push({ id: k, value: C == null ? void 0 : C.innerHTML }), C.innerHTML = `${C.innerHTML}<div class="ol-tooltip-delete-button" data-id="${k}"><i class="map-iconfont icon-delete"></i></div>`;
|
|
1462
1462
|
}
|
|
1463
|
-
(
|
|
1463
|
+
(a = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || a.addEventListener("click", (k) => {
|
|
1464
1464
|
var V;
|
|
1465
1465
|
k.preventDefault(), k.stopPropagation();
|
|
1466
1466
|
const F = (V = k.target) == null ? void 0 : V.getAttribute("data-id");
|
|
@@ -1484,67 +1484,67 @@ const nt = (e, r) => {
|
|
|
1484
1484
|
positioning: "center-left"
|
|
1485
1485
|
}), e == null || e.addOverlay(N);
|
|
1486
1486
|
}, q = () => {
|
|
1487
|
-
l.value.forEach((S,
|
|
1487
|
+
l.value.forEach((S, a) => {
|
|
1488
1488
|
var k, F;
|
|
1489
1489
|
const x = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1490
|
-
x[
|
|
1490
|
+
x[a] && ((F = (k = x[a]) == null ? void 0 : k.parentNode) == null || F.removeChild(x[a]));
|
|
1491
1491
|
const g = t.getFeatures();
|
|
1492
|
-
g[
|
|
1492
|
+
g[a] && t.removeFeature(g[a]);
|
|
1493
1493
|
}), R(), po(e), u.value = !1, ze(e, "pointer");
|
|
1494
1494
|
}, Y = (S) => {
|
|
1495
1495
|
var x, g, k, F;
|
|
1496
|
-
const
|
|
1497
|
-
if (
|
|
1498
|
-
l.value.splice(
|
|
1496
|
+
const a = l.value.findIndex((V) => V.id === S);
|
|
1497
|
+
if (a !== -1) {
|
|
1498
|
+
l.value.splice(a, 1);
|
|
1499
1499
|
const V = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1500
|
-
V[
|
|
1500
|
+
V[a] && ((g = (x = V[a]) == null ? void 0 : x.parentNode) == null || g.removeChild(V[a]));
|
|
1501
1501
|
const D = t.getFeatures();
|
|
1502
|
-
D[
|
|
1502
|
+
D[a] && t.removeFeature(D[a]);
|
|
1503
1503
|
}
|
|
1504
1504
|
(F = (k = r.getProps()) == null ? void 0 : k.lineDrawEnd) == null || F.call(k, l.value);
|
|
1505
1505
|
}, R = () => {
|
|
1506
1506
|
if (l.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((S) => {
|
|
1507
|
-
var
|
|
1508
|
-
(
|
|
1509
|
-
}), t == null || t.clear(),
|
|
1510
|
-
const S = e.getInteractions().getArray().find((
|
|
1507
|
+
var a;
|
|
1508
|
+
(a = S == null ? void 0 : S.parentNode) == null || a.removeChild(S);
|
|
1509
|
+
}), t == null || t.clear(), y) {
|
|
1510
|
+
const S = e.getInteractions().getArray().find((a) => et(a) === et(y));
|
|
1511
1511
|
S && e.removeInteraction(S);
|
|
1512
1512
|
}
|
|
1513
1513
|
e.removeLayer(n), o != null && o.parentNode && o.parentNode.removeChild(o), C != null && C.parentNode && C.parentNode.removeChild(C);
|
|
1514
1514
|
};
|
|
1515
1515
|
return {
|
|
1516
|
-
open:
|
|
1516
|
+
open: h,
|
|
1517
1517
|
close: q,
|
|
1518
1518
|
deleteLine: Y,
|
|
1519
|
-
setUnit:
|
|
1519
|
+
setUnit: i,
|
|
1520
1520
|
getState: () => u.value
|
|
1521
1521
|
};
|
|
1522
1522
|
}, gt = (e, r) => {
|
|
1523
1523
|
const s = He(e);
|
|
1524
|
-
let
|
|
1524
|
+
let i = "";
|
|
1525
1525
|
switch (r) {
|
|
1526
1526
|
case "m":
|
|
1527
|
-
|
|
1527
|
+
i = `${Math.round(s * 100) / 100} m`;
|
|
1528
1528
|
break;
|
|
1529
1529
|
case "km":
|
|
1530
|
-
|
|
1530
|
+
i = `${Math.round(s / 1e3 * 100) / 100} km`;
|
|
1531
1531
|
break;
|
|
1532
1532
|
case "nm":
|
|
1533
|
-
|
|
1533
|
+
i = (Math.round(s / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
|
|
1534
1534
|
break;
|
|
1535
1535
|
}
|
|
1536
|
-
return
|
|
1536
|
+
return i;
|
|
1537
1537
|
}, Co = (e, r) => {
|
|
1538
1538
|
let l, s;
|
|
1539
|
-
const
|
|
1539
|
+
const i = () => {
|
|
1540
1540
|
o(), ze(e, "crosshair");
|
|
1541
1541
|
}, o = () => {
|
|
1542
1542
|
t(), C(), G(), M();
|
|
1543
1543
|
};
|
|
1544
|
-
let u = null,
|
|
1544
|
+
let u = null, h = null;
|
|
1545
1545
|
const t = () => {
|
|
1546
|
-
if (u &&
|
|
1547
|
-
const R = new de(), Z = new
|
|
1546
|
+
if (u && h) return;
|
|
1547
|
+
const R = new de(), Z = new he({
|
|
1548
1548
|
source: R,
|
|
1549
1549
|
style: new X({
|
|
1550
1550
|
stroke: new ve({
|
|
@@ -1553,7 +1553,7 @@ const nt = (e, r) => {
|
|
|
1553
1553
|
})
|
|
1554
1554
|
})
|
|
1555
1555
|
});
|
|
1556
|
-
u = Z,
|
|
1556
|
+
u = Z, h = R, e.on("pointermove", m), e.addLayer(Z), e.on(["dblclick"], function(S) {
|
|
1557
1557
|
v && (S.stopPropagation(), S.preventDefault());
|
|
1558
1558
|
});
|
|
1559
1559
|
};
|
|
@@ -1569,12 +1569,12 @@ const nt = (e, r) => {
|
|
|
1569
1569
|
b != null && b.parentNode && b.parentNode.removeChild(b);
|
|
1570
1570
|
const R = l.getGeometry();
|
|
1571
1571
|
if (!R) return;
|
|
1572
|
-
const Z =
|
|
1572
|
+
const Z = y(R, "nm");
|
|
1573
1573
|
w && (w.innerHTML = `
|
|
1574
1574
|
<span class="text">面积:${Z}${N ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
|
|
1575
1575
|
`), w && (w.innerHTML += '<span class="delete-icon" ><i class="map-iconfont icon-delete" /></div>');
|
|
1576
|
-
const S = R.getCoordinates(),
|
|
1577
|
-
if (L.setPosition(
|
|
1576
|
+
const S = R.getCoordinates(), a = S[0][S[0].length - 2];
|
|
1577
|
+
if (L.setPosition(a), u) {
|
|
1578
1578
|
const g = u.getSource();
|
|
1579
1579
|
g && l && (g.clear(), g.addFeature(l));
|
|
1580
1580
|
}
|
|
@@ -1591,7 +1591,7 @@ const nt = (e, r) => {
|
|
|
1591
1591
|
}
|
|
1592
1592
|
v = new Se({
|
|
1593
1593
|
type: "Polygon",
|
|
1594
|
-
source:
|
|
1594
|
+
source: h,
|
|
1595
1595
|
trace: !0,
|
|
1596
1596
|
style: [new X({
|
|
1597
1597
|
stroke: new ve({
|
|
@@ -1617,7 +1617,7 @@ const nt = (e, r) => {
|
|
|
1617
1617
|
}), e == null || e.addInteraction(v), v.on("drawstart", (R) => {
|
|
1618
1618
|
var Z;
|
|
1619
1619
|
n = R.feature, s = (Z = n.getGeometry()) == null ? void 0 : Z.on("change", (S) => {
|
|
1620
|
-
const
|
|
1620
|
+
const a = S.target, x = y(a, "nm"), k = a.getCoordinates()[0], F = new Pe([k[k.length - 2], k[k.length - 1]]), V = gt(F, "nm");
|
|
1621
1621
|
if (N = Number(He(F) / 1e3) > 150, !x) return;
|
|
1622
1622
|
const D = '<span class="error pl-4">超出可以绘画的距离</span>';
|
|
1623
1623
|
w && (w.innerHTML = `
|
|
@@ -1643,8 +1643,8 @@ const nt = (e, r) => {
|
|
|
1643
1643
|
var x, g, k, F;
|
|
1644
1644
|
if (!R.feature.getGeometry()) return;
|
|
1645
1645
|
w && !l && (w.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), l = R.feature, L.setOffset([10, 0]);
|
|
1646
|
-
const S = R.feature.getGeometry().getCoordinates(),
|
|
1647
|
-
if (L.setPosition(
|
|
1646
|
+
const S = R.feature.getGeometry().getCoordinates(), a = S[0][S[0].length - 2];
|
|
1647
|
+
if (L.setPosition(a), b != null && b.parentNode && b.parentNode.removeChild(b), (x = r.getProps()) != null && x.areaDrawEnd) {
|
|
1648
1648
|
const V = S[0].map((D) => ke(D, K.mercator, K.data));
|
|
1649
1649
|
(k = (g = r.getProps()) == null ? void 0 : g.areaDrawEnd) == null || k.call(g, V);
|
|
1650
1650
|
}
|
|
@@ -1655,7 +1655,7 @@ const nt = (e, r) => {
|
|
|
1655
1655
|
q(), (D = (V = r.getProps()) == null ? void 0 : V.areaDrawEnd) == null || D.call(V, []);
|
|
1656
1656
|
});
|
|
1657
1657
|
});
|
|
1658
|
-
},
|
|
1658
|
+
}, y = (R, Z) => {
|
|
1659
1659
|
const S = Bt(R);
|
|
1660
1660
|
switch (Z) {
|
|
1661
1661
|
case "km":
|
|
@@ -1682,19 +1682,19 @@ const nt = (e, r) => {
|
|
|
1682
1682
|
positioning: "center-left"
|
|
1683
1683
|
}), e == null || e.addOverlay(B);
|
|
1684
1684
|
}, q = () => {
|
|
1685
|
-
|
|
1685
|
+
h == null || h.clear(), l = null, C(), G(), M();
|
|
1686
1686
|
};
|
|
1687
1687
|
return {
|
|
1688
|
-
open:
|
|
1688
|
+
open: i,
|
|
1689
1689
|
close: () => {
|
|
1690
|
-
|
|
1690
|
+
h == null || h.clear(), h = null, u && (e.removeLayer(u), u = null), n = null, v && (v.setActive(!1), (e == null ? void 0 : e.getInteractions()).forEach((Z) => {
|
|
1691
1691
|
Z instanceof Se && (Z.setActive(!1), e == null || e.removeInteraction(Z));
|
|
1692
1692
|
}), v = null), s && We(s), b != null && b.parentElement && b.parentElement.removeChild(b), w != null && w.parentElement && w.parentElement.removeChild(w), B && e.removeOverlay(B), L && e.removeOverlay(L), ze(e, "pointer");
|
|
1693
1693
|
},
|
|
1694
1694
|
reset: q
|
|
1695
1695
|
};
|
|
1696
1696
|
}, Lo = "zh-map-port-layer", Eo = (e) => {
|
|
1697
|
-
const r = new de(), l = new
|
|
1697
|
+
const r = new de(), l = new he({
|
|
1698
1698
|
className: Lo,
|
|
1699
1699
|
source: r,
|
|
1700
1700
|
zIndex: 100,
|
|
@@ -1702,27 +1702,27 @@ const nt = (e, r) => {
|
|
|
1702
1702
|
updateWhileAnimating: !1
|
|
1703
1703
|
});
|
|
1704
1704
|
e == null || e.addLayer(l);
|
|
1705
|
-
let s = null,
|
|
1706
|
-
const o = (M,
|
|
1705
|
+
let s = null, i = null;
|
|
1706
|
+
const o = (M, y = !0) => {
|
|
1707
1707
|
if (!(!M || M.length === 0)) {
|
|
1708
|
-
if (r.clear(),
|
|
1709
|
-
const w = M.find((L) => L.id ===
|
|
1710
|
-
w ?
|
|
1708
|
+
if (r.clear(), i) {
|
|
1709
|
+
const w = M.find((L) => L.id === i.id);
|
|
1710
|
+
w ? i = w : M.push(i);
|
|
1711
1711
|
}
|
|
1712
1712
|
M.forEach((w) => {
|
|
1713
|
-
u(w,
|
|
1714
|
-
});
|
|
1713
|
+
u(w, y);
|
|
1714
|
+
}), i && (console.log("selectedPortData", i), v(i));
|
|
1715
1715
|
}
|
|
1716
|
-
}, u = (M,
|
|
1716
|
+
}, u = (M, y = !0) => {
|
|
1717
1717
|
const [w, L] = M.latLon.split(","), C = new ie({
|
|
1718
1718
|
geometry: new le(ee([Number(w), Number(L)])),
|
|
1719
1719
|
portData: M,
|
|
1720
|
-
select: M.id === (
|
|
1721
|
-
showTitle: M.id === (
|
|
1722
|
-
}), b =
|
|
1723
|
-
|
|
1724
|
-
},
|
|
1725
|
-
const { select:
|
|
1720
|
+
select: M.id === (i == null ? void 0 : i.id),
|
|
1721
|
+
showTitle: M.id === (i == null ? void 0 : i.id) || y
|
|
1722
|
+
}), b = h(C);
|
|
1723
|
+
C.setStyle(b), r.addFeature(C);
|
|
1724
|
+
}, h = (M) => {
|
|
1725
|
+
const { select: y, showTitle: w } = M.getProperties(), L = (Y) => `<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1726
1726
|
<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="${Y}"/>
|
|
1727
1727
|
<g clip-path="url(#clip0_10059_122082)">
|
|
1728
1728
|
<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"/>
|
|
@@ -1733,18 +1733,18 @@ const nt = (e, r) => {
|
|
|
1733
1733
|
</clipPath>
|
|
1734
1734
|
</defs>
|
|
1735
1735
|
</svg>
|
|
1736
|
-
`, C = () => `data:image/svg+xml;utf8,${encodeURIComponent(L(
|
|
1736
|
+
`, C = () => `data:image/svg+xml;utf8,${encodeURIComponent(L(y ? "#FF5733" : "#3370FF"))}`, b = e.getView().getZoom(), B = M.get("portData"), G = {
|
|
1737
1737
|
image: new Oe({
|
|
1738
1738
|
src: C(),
|
|
1739
1739
|
scale: 0.5 * b / 10
|
|
1740
1740
|
}),
|
|
1741
|
-
zIndex:
|
|
1741
|
+
zIndex: y ? 110 : 100
|
|
1742
1742
|
}, q = {
|
|
1743
1743
|
text: new ge({
|
|
1744
1744
|
text: B.shortName,
|
|
1745
1745
|
font: "12px sans-serif",
|
|
1746
1746
|
fill: new Q({
|
|
1747
|
-
color:
|
|
1747
|
+
color: y ? "#ffffff" : "#000000"
|
|
1748
1748
|
}),
|
|
1749
1749
|
backgroundFill: new Q({
|
|
1750
1750
|
color: "#FFF"
|
|
@@ -1752,7 +1752,7 @@ const nt = (e, r) => {
|
|
|
1752
1752
|
offsetY: 30
|
|
1753
1753
|
})
|
|
1754
1754
|
};
|
|
1755
|
-
return !w && !
|
|
1755
|
+
return !w && !y ? new X({
|
|
1756
1756
|
...G
|
|
1757
1757
|
}) : new X({
|
|
1758
1758
|
...G,
|
|
@@ -1763,8 +1763,8 @@ const nt = (e, r) => {
|
|
|
1763
1763
|
if (s) {
|
|
1764
1764
|
console.log("清除非选中的港口");
|
|
1765
1765
|
const M = s.get("portData").id;
|
|
1766
|
-
r.getFeatures().forEach((
|
|
1767
|
-
|
|
1766
|
+
r.getFeatures().forEach((y) => {
|
|
1767
|
+
y.get("portData").id !== M && r.removeFeature(y);
|
|
1768
1768
|
});
|
|
1769
1769
|
} else
|
|
1770
1770
|
console.log("清除所有港口", r), r == null || r.clear();
|
|
@@ -1777,19 +1777,19 @@ const nt = (e, r) => {
|
|
|
1777
1777
|
}, m = () => {
|
|
1778
1778
|
var M;
|
|
1779
1779
|
if (s) {
|
|
1780
|
-
const
|
|
1780
|
+
const y = s == null ? void 0 : s.get("portData"), w = (M = r.getFeatures()) == null ? void 0 : M.find((L) => L.get("portData").id === y.id);
|
|
1781
1781
|
if (w) {
|
|
1782
|
-
const L =
|
|
1783
|
-
w.set("select", !1), w.setStyle(L), s = null,
|
|
1782
|
+
const L = h(w);
|
|
1783
|
+
w.set("select", !1), w.setStyle(L), s = null, i = null;
|
|
1784
1784
|
}
|
|
1785
1785
|
}
|
|
1786
1786
|
}, v = (M) => {
|
|
1787
1787
|
var w;
|
|
1788
1788
|
if (!r) return;
|
|
1789
|
-
const
|
|
1790
|
-
if (
|
|
1789
|
+
const y = r.getFeatures();
|
|
1790
|
+
if (i = M, s = y.find((L) => L.get("portData").id === M.id), s) {
|
|
1791
1791
|
s.set("select", !0);
|
|
1792
|
-
const L =
|
|
1792
|
+
const L = h(s);
|
|
1793
1793
|
L && ((w = L == null ? void 0 : L.getText()) == null || w.setBackgroundFill(new Q({
|
|
1794
1794
|
color: "#FF5733"
|
|
1795
1795
|
}))), s.setStyle(L);
|
|
@@ -1800,71 +1800,71 @@ const nt = (e, r) => {
|
|
|
1800
1800
|
clear: t,
|
|
1801
1801
|
selected: n,
|
|
1802
1802
|
handlePortHover: (M) => {
|
|
1803
|
-
const
|
|
1804
|
-
M && M.get("portData") &&
|
|
1803
|
+
const y = e == null ? void 0 : e.getTargetElement();
|
|
1804
|
+
M && M.get("portData") && y && (y.style.cursor = "pointer");
|
|
1805
1805
|
}
|
|
1806
1806
|
};
|
|
1807
|
-
}, To = (e, r, l, s,
|
|
1807
|
+
}, To = (e, r, l, s, i, o) => {
|
|
1808
1808
|
const u = e.getInstall();
|
|
1809
1809
|
u.on("moveend", () => {
|
|
1810
|
-
var
|
|
1810
|
+
var h, t;
|
|
1811
1811
|
try {
|
|
1812
1812
|
const n = e.getZoom();
|
|
1813
|
-
(t = (
|
|
1813
|
+
(t = (h = r.getProps()).mapMoveEnd) == null || t.call(h, n), l.reRenderTrackLine(), s.changeShipScale("end");
|
|
1814
1814
|
} catch (n) {
|
|
1815
1815
|
console.log("moveend---catch", n);
|
|
1816
1816
|
}
|
|
1817
|
-
}), u.on("pointermove", (
|
|
1817
|
+
}), u.on("pointermove", (h) => {
|
|
1818
1818
|
try {
|
|
1819
|
-
const t = u == null ? void 0 : u.getEventPixel(
|
|
1819
|
+
const t = u == null ? void 0 : u.getEventPixel(h.originalEvent);
|
|
1820
1820
|
if (!t || !u) return;
|
|
1821
1821
|
const n = u == null ? void 0 : u.forEachFeatureAtPixel(t, (m) => m, {
|
|
1822
1822
|
layerFilter: (m) => m.getVisible()
|
|
1823
1823
|
});
|
|
1824
|
-
s == null || s.handleShipMapEvent(n, "hover"), l == null || l.handleTrackMapEvent(n, "hover",
|
|
1824
|
+
s == null || s.handleShipMapEvent(n, "hover"), l == null || l.handleTrackMapEvent(n, "hover", h), n && (i == null || i.handlePortHover(n));
|
|
1825
1825
|
} catch (t) {
|
|
1826
1826
|
console.log("pointermove---catch", t);
|
|
1827
1827
|
}
|
|
1828
1828
|
}), u.on("movestart", () => {
|
|
1829
1829
|
try {
|
|
1830
|
-
const
|
|
1831
|
-
|
|
1832
|
-
} catch (
|
|
1833
|
-
console.log("movestart---catch",
|
|
1830
|
+
const h = u == null ? void 0 : u.getView().getZoom();
|
|
1831
|
+
h && h <= te.shipModelMax && h >= te.shipTriggleMin && s.changeShipScale("start");
|
|
1832
|
+
} catch (h) {
|
|
1833
|
+
console.log("movestart---catch", h);
|
|
1834
1834
|
}
|
|
1835
|
-
}), u.on("singleclick", Ne((
|
|
1835
|
+
}), u.on("singleclick", Ne((h) => {
|
|
1836
1836
|
var t, n, m;
|
|
1837
1837
|
try {
|
|
1838
1838
|
if (console.log("1", o.getState()), o.getState()) return;
|
|
1839
|
-
const v = u.getFeaturesAtPixel(
|
|
1839
|
+
const v = u.getFeaturesAtPixel(h.pixel);
|
|
1840
1840
|
if (!v && v.length === 0) return;
|
|
1841
1841
|
console.log("features------------", v);
|
|
1842
1842
|
let N = null, M = null;
|
|
1843
|
-
if (v == null || v.forEach((
|
|
1844
|
-
|
|
1843
|
+
if (v == null || v.forEach((y) => {
|
|
1844
|
+
y.get("shipData") && (N = y), y.get("portData") && (M = y);
|
|
1845
1845
|
}), N)
|
|
1846
1846
|
s.handleShipMapEvent(N, "click", (t = r.getProps()) == null ? void 0 : t.selectShip);
|
|
1847
1847
|
else if (M) {
|
|
1848
|
-
const
|
|
1849
|
-
|
|
1848
|
+
const y = M.get("portData");
|
|
1849
|
+
i.selected(y), (m = (n = r.getProps()) == null ? void 0 : n.selectPort) == null || m.call(n, y);
|
|
1850
1850
|
}
|
|
1851
|
-
|
|
1851
|
+
h.preventDefault(), h.stopPropagation();
|
|
1852
1852
|
} catch (v) {
|
|
1853
1853
|
console.log("click---catch", v);
|
|
1854
1854
|
}
|
|
1855
1855
|
}, 150)), u.getView().on("change:resolution", Ne(() => {
|
|
1856
|
-
const
|
|
1857
|
-
|
|
1856
|
+
const h = u == null ? void 0 : u.getView().getZoom();
|
|
1857
|
+
h && h <= te.shipModelMax && h >= te.shipTriggleMin && s.changeSelectedScale("start");
|
|
1858
1858
|
}, 10));
|
|
1859
1859
|
}, Fo = () => {
|
|
1860
1860
|
const e = St([]);
|
|
1861
1861
|
return {
|
|
1862
|
-
createInstance: (s,
|
|
1862
|
+
createInstance: (s, i) => {
|
|
1863
1863
|
const o = eo();
|
|
1864
|
-
o.initMap(s,
|
|
1865
|
-
const u = o.getInstall(),
|
|
1866
|
-
t.setProps(
|
|
1867
|
-
const n = so(u), m = lo(u, n), v = mo(u), N = bo(u), M = Mo(u, t),
|
|
1864
|
+
o.initMap(s, i);
|
|
1865
|
+
const u = o.getInstall(), h = wo(u), t = xo();
|
|
1866
|
+
t.setProps(i), h.setShowLayerType(i.layerType), h.setGreenTileVisible(i.showGreenLayer);
|
|
1867
|
+
const n = so(u), m = lo(u, n), v = mo(u), N = bo(u), M = Mo(u, t), y = Co(u, t), w = Eo(u);
|
|
1868
1868
|
To(o, t, n, v, w, M);
|
|
1869
1869
|
const L = () => {
|
|
1870
1870
|
const b = u.getView().calculateExtent(o.getSize()), B = ke([b[0], b[1]], K.mercator, K.data), G = ke([b[2], b[3]], K.mercator, K.data);
|
|
@@ -1878,7 +1878,7 @@ const nt = (e, r) => {
|
|
|
1878
1878
|
},
|
|
1879
1879
|
methods: {
|
|
1880
1880
|
...o,
|
|
1881
|
-
layer:
|
|
1881
|
+
layer: h,
|
|
1882
1882
|
ship: v,
|
|
1883
1883
|
track: n,
|
|
1884
1884
|
carTrack: m,
|
|
@@ -1889,7 +1889,7 @@ const nt = (e, r) => {
|
|
|
1889
1889
|
},
|
|
1890
1890
|
position: N,
|
|
1891
1891
|
drawLine: M,
|
|
1892
|
-
drawPolygon:
|
|
1892
|
+
drawPolygon: y,
|
|
1893
1893
|
// 子模块
|
|
1894
1894
|
utils: {
|
|
1895
1895
|
getCalculateExtent: L,
|
|
@@ -1901,8 +1901,8 @@ const nt = (e, r) => {
|
|
|
1901
1901
|
return e.push(C), C;
|
|
1902
1902
|
},
|
|
1903
1903
|
destroyInstance: (s) => {
|
|
1904
|
-
const
|
|
1905
|
-
|
|
1904
|
+
const i = e.findIndex((o) => o.id === s);
|
|
1905
|
+
i > -1 && (e[i].destroy(), e.splice(i, 1));
|
|
1906
1906
|
},
|
|
1907
1907
|
destroyAll: () => {
|
|
1908
1908
|
e.forEach((s) => s.destroy()), e.splice(0, e.length);
|
|
@@ -1929,16 +1929,16 @@ const nt = (e, r) => {
|
|
|
1929
1929
|
} }
|
|
1930
1930
|
},
|
|
1931
1931
|
setup(e, { expose: r }) {
|
|
1932
|
-
const l = I(), s = I(),
|
|
1932
|
+
const l = I(), s = I(), i = Fo(), o = I(), u = e, h = I({
|
|
1933
1933
|
getInstall() {
|
|
1934
1934
|
}
|
|
1935
1935
|
});
|
|
1936
1936
|
return Nt(() => {
|
|
1937
1937
|
var t;
|
|
1938
|
-
o.value =
|
|
1938
|
+
o.value = i.createInstance(l.value, u), h.value = o.value.methods, (t = s.value) == null || t.setScaleLine(o.value.map, u.scaleLineUnit);
|
|
1939
1939
|
}), Vt(() => {
|
|
1940
1940
|
var t, n;
|
|
1941
|
-
|
|
1941
|
+
i.destroyInstance((t = o == null ? void 0 : o.value) == null ? void 0 : t.id), (n = o.value) == null || n.destroy();
|
|
1942
1942
|
}), r({
|
|
1943
1943
|
getZoom: () => {
|
|
1944
1944
|
var t;
|